Help to get current stock price within last 5-15 minutes

jryan15

Board Regular
Joined
Jan 27, 2005
Messages
168
Hi all,

I'm hoping someone can help me to get a current stock price within the last 15 minutes or so. I can get all the prior data using stockhistory, but I really need a way to get a stock price the same day. I've got a list of about 30 stocks and would like to run a macro, but getting the price now has me paying for a very expensive service. I would much prefer a free way even if it takes a google screen scrape although this is a bit problematic. Any help would be appreciated. Thanks!
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
You haven't said which stock exchange or exchanges you are trying to get prices from. I also think you are going to find it difficult to find any free source of stock prices that ISN'T delayed by 15 minutes. This is because up to date price information is a valuable commodity so stock exchanges make a lot of money selling the information . You best bet is to open an account with broker who will provide up to date information without needing to pay a monthly subscription, although you may need to deposit a minimum capital amount when you open the account.
 
Upvote 0
I'm looking for nasdaq and nyse quotes and a 15min or even 1hr delay isn't a big deal. I really just need the price for today...

I actually just found that excel 365 has a way in the data tab to convert a cell with a ticker symbol into a "stock" and from there can offer the current price. IE in cell B2 type, "ABNB" and then click data and stock. It will convert the cell into a new format and then in another cell I can type B2.price and it will convert to the stock price.

Somehow I need to figure out how to do this through VBA for my automation though.
 
Upvote 0
For instance, this line of code will convert a ticker symbol into a "stock" and link to a data source...

Selection.ConvertToLinkedDataType ServiceID:=268435456, LanguageCulture:="en-US"

It would be really helpful if there was a way that I could just pull from the data source in VBA... Or if needed, I could try to make a routine to convert a list into tickers and format the page and all, but really just need to suck the price into VBA to process.
 
Upvote 0
This code will download all the stock prices from NYSE to a workhseet called "Down". try it in a blank workbook:
VBA Code:
Sub Yquery()
Sheets("Down").Select
        'https://www.centralcharts.com/en/price-list-ranking/ALL/asc/ts_29-us-nyse-stocks--qc_1-alphabetical-order
        initstring = "URL;https://www.centralcharts.com/en/price-list-ranking/"
        laststring = "/asc/ts_29-us-nyse-stocks--qc_1-alphabetical-order"
        
        ' On the Workspace worksheet, clear all existing query tables
        For Each QT In ActiveSheet.QueryTables
            QT.Delete
        Next QT
       For i = 65 To 90
        Tt = Chr(i)
        ConnectString = initstring & Tt & laststring
        
        ' Define a new Web Query
        Set QT = ActiveSheet.QueryTables.Add(Connection:=ConnectString, Destination:=Range("A1"))
        With QT
            .Name = MyName
            .FieldNames = True
            .RowNumbers = False
            .FillAdjacentFormulas = False
            .PreserveFormatting = True
            .RefreshOnFileOpen = False
            .BackgroundQuery = False
            .RefreshStyle = xlInsertDeleteCells
            .SavePassword = False
            .SaveData = True
            .AdjustColumnWidth = True
            .RefreshPeriod = 0
'            .WebSelectionType = xlSpecifiedTables
            .WebFormatting = xlWebFormattingAll
'            .WebTables = "all"
            .WebPreFormattedTextToColumns = True
            .WebConsecutiveDelimitersAsOne = True
            .WebSingleBlockTextImport = False
            .WebDisableDateRecognition = False
            .WebDisableRedirections = False
        End With
        
        ' Refresh the Query
        QT.Refresh BackgroundQuery:=False
        Next i

End Sub
 
Upvote 0

Forum statistics

Threads
1,214,385
Messages
6,119,209
Members
448,874
Latest member
b1step2far

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top