Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fetching 1 minute bars from Yahoo Finance

I'm trying to download 1 minute historical stock prices from Yahoo Finance, both for the current day and the previous ones.

Yahoo (just like Google) supports up to 15 days worth of data, using the following API query:

http://chartapi.finance.yahoo.com/instrument/1.0/AAPL/chartdata;type=quote;range=1d/csv

The thing is that data keeps on changing even when the markets are closed! Try refreshing every minute or so and some minute bars change, even from the beginning of the session.

Another interesting thing is that all of these queries return slightly different data for the same bars: http://chartapi.finance.yahoo.com/instrument/2.0/AAPL/chartdata;type=quote;range=1d/csv

Replace the bold number with 100000 and it will still work but return slightly different data.

Does anyone understand this?

Is there a modern YQL query that can fetch historical minute data instead of this API?

Thanks!

like image 802
Danny Avatar asked Mar 03 '15 01:03

Danny


People also ask

Are Yahoo Finance quotes delayed?

US quotes are real-time for NASDAQ, NYSE, and NYSE American when available from Nasdaq Last Sale and if not available it will appear delayed from the consolidated tape.


2 Answers

Yes there is other APIs. I don't know if it can still help but if you need intraday data, there is a API on rapidapi called (Quotient) which allows to pull intraday (at 1-min level), EOD market (FX, Crypto, Stocks (US, CANADIAN, UK, AUSTRALIA, EUROPE), ETFs and Futures. It also provides earnings, dividends, splits and a lot others informations.

like image 142
belquant009 Avatar answered Sep 30 '22 17:09

belquant009


Historical minute data is not as easily accessible as we all would like. I have found that the most affordable way to gather Intraday Stock Price data is to develop automated scripts that log price information for whenever the markets are open.

Similar to the Yahoo data URL that you shared, Bloomberg maintains 1-Day Intraday Price information in JSON format like this : https://www.bloomberg.com/markets/api/bulk-time-series/price/AAPL%3AUS?timeFrame=1_DAY

The URL convention appears easy to input on your own once you have a list of Ticker Symbols and an understanding of the consistent syntax.

To arrive at that URL initially though, without having any idea for guessing / reverse-engineering it, I simply went here https://www.bloomberg.com/quote/AAPL:US and used Developer Tools on my browser and tracked a background GET request which led me to that URL. I wouldn't be surprised if you could employ similar methods on other Price Data-related websites.

You can also write scripts to track price data as fast as your internet goes. One python package that I find pretty handy and is ystockquote

You can have it request price data every couple of seconds and log that into a daily time series database.

like image 25
RasikhJ Avatar answered Sep 30 '22 17:09

RasikhJ