ranaroussi / yfinance

Download market data from Yahoo! Finance's API
https://aroussi.com/post/python-yahoo-finance
Apache License 2.0
14.6k stars 2.43k forks source link

Data stops before end date #1506

Closed MaraMarsu closed 1 year ago

MaraMarsu commented 1 year ago

For some reason the data I get is stopping at 22 April at seven a clock

`yf.pdr_override()

stock = "ETH-USD" start = datetime.now() - timedelta(days=50) now = dt.datetime.now()

print(now) df_daily = pdr.get_data_yahoo(stock,start,now, interval = "1d") df_hourly = pdr.get_data_yahoo(stock,start,now, interval = "1h")`

And I get this as the last line index is this: 2023-04-22 07:00:00+00:00 image

ValueRaider commented 1 year ago

I'm working on improving the logging so you interrogate what yfinance is doing and confirm/deny it is the problem. Can you use and give feedback? Follow instructions at #1080 to install Git branch feature/error-reporting, then run like this:

import logging
logging.getLogger('yfinance').setLevel(logging.DEBUG)
df_hourly = ...

and you will see this:

DEBUG ETH-USD: Yahoo GET parameters: {'period1': '2023-03-05 12:22:32+00:00', 'period2': '2023-04-24 12:22:32+00:00', 'interval': '1h', 'includePrePost': False, 'events': 'div,splits,capitalGains'} ...

Bonus question: Why do you use pdr?

scott-n58 commented 1 year ago

this 5' snippet was successful returning a full day's 5' price action bars, but for some reason now stops all price action requests after 10:55. is this a problem with Yahoo finance portal or some other unknown? using pendulum to support datetime requests between TZs.

start = pendulum.parse(today+ " " + st_time).add(hours= -1) # local CST end = pendulum.parse(today+ " " + nd_time).add(hours= -1) # same print(yf.download(tickers= symbol, interval= '5m', start= start, end= end))

ie - at the time of this submittal 11:53am CST & i am able to see 5' PA records ONLY from 09:30:00-04:00 to 10:55:00-04:00

thoughts or suggestions?

ValueRaider commented 1 year ago

@scott-n58 see my above reply