if to is not None:
start = time.time() - time_interval_to_seconds(to)
end = time.time()
The current time should be checked once and then its value used as a constant for backtesting time calculation. Otherwise the resulting interval (end - start) will always be slightly longer than the user expects. Proposed change:
if to is not None:
end = time.time()
start = end - time_interval_to_seconds(to)
Hey @unmais thanks for opening an issue. I'm happy to accept a pull request for this change just be aware this will have microseconds of difference from the current calculation.
Description
file:
backtest_controller.py
, line: 508The current time should be checked once and then its value used as a constant for backtesting time calculation. Otherwise the resulting interval (end - start) will always be slightly longer than the user expects. Proposed change: