Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
How to determine fist trading date of the month (pls help!)

Hi Guys,

Let say you are start your algorithm any day of the month, how do you find out which is the date for the 1st trading day of the month?

Please kindly help as I'm stuck !

Thanks

1 response

One way would be to include SPY in your algorithm (you wouldn't need to trade it). Then, using history load data going back beyond a month. Then find the earliest date in the data for the month of interest.

You might also be able to use https://github.com/quantopian/zipline/blob/master/zipline/utils/tradingcalendar.py. I think you'd need to import it.