BUG: env.next_trading_day() not Timezone aware
In certain cases the trading day and market open can fall on different days when the timestamp is converted to utc. What this means is the env.next_trading_day() can get stuck in a continuous loop due to the timezone change.
Till now this has probably been not much of an issue since the NYSE open times remain on the same day when converted to UTC but when used in markets where the difference between local tz and UTC is bigger this can be an issue.
I tried simply converting to the local tz before normalize_date(test_date) is called but this wasn't sufficient. Anyone have any recommendations for other possible solutions? @ssanderson?
@warren-oneill can you give an example of inputs you're providing to zipline that manifest this bug?
In my case I have a 24h market so market open is, e.g., 1-1-2015 00:00 in local tz and 31-12-2014 23:00 in UTC but it holds for any combination of timezone and open times where the UTC conversion changes the day.
Hey @ssanderson I think I may have found a solution. The PR is here #579
@warren-oneill glad you found a solution, and sorry for not being very responsive. I've been pretty heads-down on a major API redesign, the very WIP form of which lives here: https://github.com/quantopian/zipline/pull/584/files.
Closed by #579