XASX missing 2 days
ValueRaider opened this issue · comments
XASX appears to be missing 2 days, because Yahoo Finance returns data for them: 1988-04-25, 1989-06-21.
No holidays nearby so maybe a timezone/DST problem? Mapping 0am to 23pm day before?
from datetime import date, timedelta
import exchange_calendars as xcal
import yfinance as yf
day = date(1988, 4, 25)
# day = date(1989, 6, 12)
exchange = 'ASX'
cal = xcal.get_calendar('X'+exchange)
try:
cal.schedule.loc[day]
except KeyError:
in_xcal = False
else:
in_xcal = True
dat = yf.Ticker('BHP.AX')
df = dat.history(start=day-timedelta(days=7), end=day+timedelta(days=7))
try:
df.loc[str(day)]
except KeyError:
in_yf = False
else:
in_yf = True
if in_yf and not in_xcal:
print(f"XCAL BUG: Day {day} in Yahoo Finance but missing from xcal exchange {exchange}")
Hi @ValueRaider,
1988-04-25 is the Anzac Day holiday. Not sure why yf has a price for it?
1989-06-21 is in the XASX schedule...? Did you mean 1989-06-12, which was the Queen's Birthday holiday?
You're right on both, I was misreading the holiday definitions.