JECSand / yahoofinancials

A powerful financial data module used for pulling data from Yahoo Finance. This module can pull fundamental and technical data for stocks, indexes, currencies, cryptos, ETFs, Mutual Funds, U.S. Treasuries, and commodity futures.
https://pypi.python.org/pypi/yahoofinancials
MIT License
896 stars 214 forks source link

get_historical_price_data() end_date #177

Open typhoon71 opened 6 months ago

typhoon71 commented 6 months ago

I'm trying to use get_historical_price_data() to get price data and noticed end_date is skipped if it's current day data. Data stops one day before - I don't think it's intended. I'm fetching CSSPX.MI, and the exchange was open today - get_stock_price_data() gets current data. Any idea?

typhoon71 commented 6 months ago

I asked this because yfinance returns the current day when fetching history data. I guess not reporting the current day is correct, but only if the market is still open.

datatalking commented 4 months ago

@typhoon71 when you mentioned yfinance you might want to ask the question with that repo which uses related data but its a different repo.

typhoon71 commented 4 months ago

No, I mentioned yfinance because I use that too, and its behaviour is different from yahoofinacials. They both use yahoo finance as a data source, but behave slightly differently, so I was asking thinking about the difference.

An historical price set should return the current day if asked so - if market is still open it could be OK to not do that. yfinance reports it (and it keeps changing it in successive requests if the market is open) while yahoofinacials does not.

datatalking commented 4 months ago

@typhoon71 look into the '_get_historical_data' method maybe that will give you what you are looking for.