snap_to_next_tick#

API documentation for tradeexecutor.strategy.cycle.snap_to_next_tick Python function.

snap_to_next_tick(ts, tick_size, offset=datetime.timedelta(0))[source]#

Calculate when the trading logic should wake up from the sleep next time.

If cycle duration is unknown do nothing.

Parameters:
  • ts (datetime) – Current timestamp

  • tick_size (CycleDuration) – How big leaps we are taking

  • offset (timedelta) – How many minutes of offset we assume to ensure we have candle data generated after the timestamp

Returns:

When to wake up from the sleep next time

Return type:

datetime