Repository navigation
Replies: 3 comments 1 reply
|
For daily bars this can be a data freshness / market-close timing issue rather than a local code bug. A few things I would check before changing the pipeline:
For backtests, I would avoid filling this silently on the same run. Record the data vintage/fetch time and rerun later, otherwise today's backtest and tomorrow's backtest may use different information for the same end date. |
|
That output is a useful extra clue: this is not just a missing final row. You have a row for A minimal check that would help narrow it down is to compare the same short window with adjustment/repair disabled and enabled: import yfinance as yf
for kwargs in [
{"auto_adjust": False, "repair": False},
{"auto_adjust": False, "repair": True},
{"auto_adjust": True, "repair": False},
]:
print("\n", kwargs)
df = yf.download(
"AAPL",
start="2026-07-20",
end="2026-07-28",
interval="1d",
progress=False,
**kwargs,
)
print(df.tail(10))If all variants still show For production/backtest code, I would also add a guard that rejects partial daily bars, not just missing dates. For example: require |
|
I pull data from several international exchanges on a daily basis - requestng the data from the 100 most recent daily sessions for 100's of symbols in a loop. This worked fine for many months (years). About 3 months ago the returns were missing the last day, even though I had not changed my pull scheduling. Even delaying my pulls until after the next session opened did not work in some cases. This issue happens regularly now on some exchanges (BSE) but rarely on US exchanges. Today I got all of Australia with no issues, but SET, JKT and SHA were missing the last session on all calls for 100 bars. My fix, that has been working for these last 3 months, is to check the data, and if the last day is missing, I make a second call to yfinance requesting only that last bar. This appears to trick yahoo into providing the prices. I then locally append that bar to my other 99 bars. Hopefully this can help someone. |
Uh oh!
There was an error while loading. Please reload this page.
I ran my code this morning (Wednesday) to snag closing prices, and for some reason yf.download() returns Monday's close data and not Tuesday's. Any thoughts on what is going on here. it's been working fine up until this morning.
All reactions