Skip to content

Commit

Permalink
Merge pull request #353 from mhallsmoore/fix-burn-in-issue
Browse files Browse the repository at this point in the history
[Bug Fix] Burn-in date was being ignored for rebalance events
  • Loading branch information
mhallsmoore committed Jan 19, 2021
2 parents 67d3737 + 9e47d71 commit 6a43978
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions qstrader/trading/backtest.py
Expand Up @@ -396,10 +396,23 @@ def run(self, results=False):

# If we have hit a rebalance time then carry
# out a full run of the quant trading system
if self._is_rebalance_event(dt):
if settings.PRINT_EVENTS:
print("(%s) - trading logic and rebalance" % event.ts)
self.qts(dt, stats=stats)
if self.burn_in_dt is not None:
if dt >= self.burn_in_dt:
if self._is_rebalance_event(dt):
if settings.PRINT_EVENTS:
print(
"(%s) - trading logic "
"and rebalance" % event.ts
)
self.qts(dt, stats=stats)
else:
if self._is_rebalance_event(dt):
if settings.PRINT_EVENTS:
print(
"(%s) - trading logic "
"and rebalance" % event.ts
)
self.qts(dt, stats=stats)

# Out of market hours we want a daily
# performance update, but only if we
Expand Down

0 comments on commit 6a43978

Please sign in to comment.