The formulation above wasn't precise enough ... the implied meaning with
24 hours was:
- Put the expiration order at the end of next day
Sample snippet in the strategy:
import datetime .... # Get next day eofthisday = datetime.datetime.combine(self.data.datetime.date(), datetime.time(23, 59, 59, 999) eofnextday = eofthisday + datetime.timedelta(days=1) self.buy(size=x, price=y, valid=eofnextday)
The reason to use
datetime.time(23, 59, 59, 999) rather than
datetime.time.max is to avoid falling prey to floating point precision errors. The platform uses the
matplolib convention to store time in a float and this may sometimes overflow.
Some extra checks will also go into the next release to improve order validity checking.