snap_to_next_tick#

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.

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