Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
how to retrieve trade calendar under algorithm environment ?

I want to calculate the number of trade days between two real dates.

e.g. like 2018-10-01 ~ 2018-11-01, how many trade days?

if there a method to retrieve the list of all trade days?

Please help me , thanks~~

1 response

from zipline.utils.tradingcalendar import trading_day
from pandas import date_range

days = date_range('2010-01-01', '2015-01-01', freq=trading_day)
len(days)
output here #1258