Closed valotas closed 1 week ago
I've reproduced error and fix is simple.
@ValueRaider In case it is useful, I encountered this error with a different code path: import yfinance_cache as yf; yf.download("^VIX", period="5y", interval="1d", threads=False, progress=False)
Traceback:
- ticker = ^VIX
Traceback (most recent call last):
File "/home/richard/src/PERSONAL/stonk-screener/hurricane/hurricane.py", line 70, in <module>
vix = yf.download(
^^^^^^^^^^^^
File "/home/richard/src/PERSONAL/stonk-screener/.conda/lib/python3.12/site-packages/yfinance_cache/yfc_multi.py", line 97, in download
df = yfc_ticker.Ticker(tkr, session=session).history(**hist_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/richard/src/PERSONAL/stonk-screener/.conda/lib/python3.12/site-packages/yfinance_cache/yfc_ticker.py", line 225, in history
h = hist.get(start=None, end=None, period=period, max_age=max_age, trigger_at_market_close=trigger_at_market_close, quiet=quiet)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/richard/src/PERSONAL/stonk-screener/.conda/lib/python3.12/site-packages/yfinance_cache/yfc_prices_manager.py", line 535, in get
yf_lag = yfcd.exchangeToYfLag[self.exchange]
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
KeyError: 'CXI'
I'll fix soon, workaround is avoid those exchanges.
@valotas Fix in-progress, just needs an update to another project https://github.com/gerrymanoim/exchange_calendars/pull/387
@crypdick Can you help me understand the VIX trading hours? Yahoo showing 2am -> 3pm, that seems very unusual like Yahoo messed up timezone. Is Yahoo correct? If Yahoo is wrong, has it always been wrong?
Just do a
yfc.Ticker("1T5.DU").history(period="max", interval="1d")
yfinance seems to be working just fine, so my only guess is that there is an issue trying to repair the data