Hi, Shrewd!        Login  
Shrewd'm.com 
A merry & shrewd investing community
Best Of BRK.A | Best Of | Favourites & Replies | All Boards | Post of the Week!
Search BRK.A
Shrewd'm.com Merry shrewd investors
Best Of BRK.A | Best Of | Favourites & Replies | All Boards | Post of the Week!
Search BRK.A


Stocks A to Z / Stocks B / Berkshire Hathaway (BRK.A)
Unthreaded | Threaded | Whole Thread (8) |
Post New
Author: TGMark 🐝  😊 😞
Number: of 3958 
Subject: Grabbing Market Data During Day
Date: 06/29/2024 1:46 PM
Post Reply | Report Post | Recommend It!
No. of Recommendations: 0
Any recommendations on the best way to do that? It would be basic data, open/high/low/close/volume at end of day, and perhaps a couple times during the day.
It would be for most of the tickers in the SiPro database, to update screens on the fly.
There are various possible sources, the better ones cost $. Does anyone use Interactive Brokers API to do that?
Excel can do it with the Stock data type but I'm pretty sure that's slow and buggy.

Mark
Print the post


Author: rayvt 🐝  😊 😞
Number: of 3958 
Subject: Re: Grabbing Market Data During Day
Date: 06/29/2024 4:30 PM
Post Reply | Report Post | Recommend It!
No. of Recommendations: 0
Google sheets, with the GOOGLEFINANCE function. 15 minutes delayed I believe.

From yahoo with a script that does the cookie/crumb thing.
Print the post


Author: mungofitch 🐝🐝🐝🐝 SILVER
SHREWD
  😊 😞

Number: of 15062 
Subject: Re: Grabbing Market Data During Day
Date: 06/29/2024 4:46 PM
Post Reply | Report Post | Recommend It!
No. of Recommendations: 1
From yahoo with a script that does the cookie/crumb thing.

I sure miss when you could just put a bunch of space-separated tickers in the quote box. But it's not as if I ever paid them anything, so I can't really complain.
But intraday snapshot prices are not a problem for me, I can just put a bunch of tickers on a page within IB's TWS app, and either cut-and-paste or export as csv.

But the Yahoo crumb thing is needed for history.
I can't remember the long thread of comments, what's the best version of that to use?
Minimal set of programs to install, I have ancient versions of absolutely everything.

Jim
Print the post


Author: rayvt 🐝  😊 😞
Number: of 15062 
Subject: Re: Grabbing Market Data During Day
Date: 06/30/2024 10:56 AM
Post Reply | Report Post | Recommend It!
No. of Recommendations: 1
But the Yahoo crumb thing is needed for history.
I can't remember the long thread of comments, what's the best version of that to use?


AFAIK there are perl and python, etc. scripts, but I've never used them.

I have a set of bash scripts that run on Linux or Windows under cygwin. If anybody is interested, let me know and I will upload them for downloading.

Print the post


Author: FlyingCircus   😊 😞
Number: of 15062 
Subject: Re: Grabbing Market Data During Day
Date: 06/30/2024 10:51 PM
Post Reply | Report Post | Recommend It!
No. of Recommendations: 6
No cookie/crumb thing required.
Google Sheet.
symbol in A1.
Two choices: current price delayed 20 minutes: =googlefinance(A1,"price")
historical price data either rolling or from a fixed point:
=googlefinance(a1,"price",start date (which can be something like today()-250 or a typical Excel date formula),end date, interval (daily or weekly).
such as
GOOGLEFINANCE("GOOG", "price", "1/1/2014", "12/31/2014", "DAILY")

self-documented with all the other attribute parameter values you can use, including basic fundamentals, and can be run with different (limited) parameters against mutual funds.

FC
Print the post


Author: mechinv   😊 😞
Number: of 15062 
Subject: Re: Grabbing Market Data During Day
Date: 07/03/2024 6:59 AM
Post Reply | Report Post | Recommend It!
No. of Recommendations: 9
Any recommendations on the best way to [grab market data during the day]?

I use finnhub.io to subscribe to realtime streaming quotes for free. You can sign up in 15 seconds at https://finnhub.io/

Gives you realtime prices every second plus open/low/high/close/volume on any ticker you want. I use it to calc

You need to have some familiarity with Python. For example, my Python programs calculate 50-day moving averages on the stocks I own, and can automatically send buy/sell and stop/loss orders to my broker.

These days, with Generative AI tools you can use Amazon Q Developer or Microsoft Copilot to generate and explain the code you need. The Finnhub API uses Websockets, which is pretty fast.

The below code, for example, gets real time prices on AAPL and AMZN for free.

#https://pypi.org/project/websocket_client/
import websocket

def on_message(ws, message):
print(message)

def on_error(ws, error):
print(error)

def on_close(ws):
print("### closed ###")

def on_open(ws):
ws.send('{"type":"subscribe","symbol":"AAPL"}')
ws.send('{"type":"subscribe","symbol":"AMZN"}')


if __name__ == "__main__":
websocket.enableTrace(True)
ws = websocket.WebSocketApp("wss://ws.finnhub.io?token=cq02qp9r01qkg1bdubkgcq02qp9r01qkg1bdubl0",
on_message = on_message,
on_error = on_error,
on_close = on_close)
ws.on_open = on_open
ws.run_forever()

Print the post


Author: OrmontUS 🐝  😊 😞
Number: of 15062 
Subject: Re: Grabbing Market Data During Day
Date: 07/06/2024 9:07 PM
Post Reply | Report Post | Recommend It!
No. of Recommendations: 11
The Googlefinance functions are fast and varied - and work seemlessly with Google Sheets:
https://support.google.com/docs/answer/3093281?hl=...

Primer on their use:
https://blog.sheetgo.com/google-sheets-formulas/go...

I used to scrape from Yahoo Finaance intto Excel, but that blew up about a year ago and, after spending hours trying to tweak it back to life, I made the plunge and switched to the above stuff - which lets me have a "live" spreadheet on my PC.



As an aside, ther are a few frustrations with unsupported functions I wanted - solutions as follows:

The US Dollar Index: USDX = 50.14348112 × EURUSD^-0.576 × USDJPY^0.136 × GBPUSD^-0.119 × USDCAD^0.091 × USDSEK^0.042 × USDCHF^0.036

Spot Gold: =MID(INDEX(importhtml("https://widget.nfusionsolutions.com/widget/table/5...","table",1),4,2),1,100)

Spot Silver: =MID(INDEX(importhtml("https://widget.nfusionsolutions.com/widget/table/5...","table",1),4,2),1,100)

Enjooy,
Jeff
Print the post


Author: chk999   😊 😞
Number: of 15062 
Subject: Re: Grabbing Market Data During Day
Date: 07/08/2024 7:51 PM
Post Reply | Report Post | Recommend It!
No. of Recommendations: 1
The Googlefinance functions are fast and varied - and work seemlessly with Google Sheets:
https://support.google.com/docs/answer/3093281?hl=...

Primer on their use:
https://blog.sheetgo.com/google-sheets-formulas/go...


Thank you very much for this. I was not aware of it. I had code that scraped yahoo, but had kind of given up on it.

Print the post


Post New
Unthreaded | Threaded | Whole Thread (8) |


Announcements
Berkshire Hathaway FAQ
Contact Shrewd'm
Contact the developer of these message boards.

Best Of BRK.A | Best Of | Favourites & Replies | All Boards | Followed Shrewds