Skip to content

Instantly share code, notes, and snippets.

@scubamut
Last active December 19, 2024 13:03
Show Gist options
  • Save scubamut/806b94f44c5d8681dfa9bab6f9b84357 to your computer and use it in GitHub Desktop.
Save scubamut/806b94f44c5d8681dfa9bab6f9b84357 to your computer and use it in GitHub Desktop.
# MONDAY '201005031' WAS NOT TRADING DAY!!!!!
!pip -q install pandas_market_calendars
import pandas_market_calendars as mcal
# Create a calendar
nyse = mcal.get_calendar('NYSE')
early = nyse.schedule(start_date='2010-05-15', end_date='2010-06-15')
print(mcal.date_range(early, frequency='1D'))
# REMEMBER THAT trading_days INCLUDES TODAY'S DATE!!!!
# df = yf.download('SPY')
# len(df is 1 LESS THAN len(trading_days)!!!!)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment