From 215de33c35c79241de37c80d77fd299ba9ba9a14 Mon Sep 17 00:00:00 2001 From: Frederic Fortier Date: Fri, 5 Jan 2018 02:46:11 -0500 Subject: [PATCH] BUG: Fixed issue with updating positions after restoring the state of an algo --- catalyst/exchange/exchange_algorithm.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/catalyst/exchange/exchange_algorithm.py b/catalyst/exchange/exchange_algorithm.py index df30b368..9365d11d 100644 --- a/catalyst/exchange/exchange_algorithm.py +++ b/catalyst/exchange/exchange_algorithm.py @@ -271,9 +271,9 @@ class ExchangeTradingAlgorithmBase(TradingAlgorithm): # Merging latest recorded variables stats.update(self.recorded_vars) - stats['positions'] = cum.position_tracker.get_positions_list() - period = tracker.todays_performance + stats['positions'] = period.position_tracker.get_positions_list() + # we want the key to be absent, not just empty # Only include transactions for given dt stats['transactions'] = [] @@ -495,6 +495,7 @@ class ExchangeTradingAlgorithmLive(ExchangeTradingAlgorithmBase): period.starting_cash = perf.ending_cash period.starting_exposure = perf.ending_exposure period.starting_value = perf.ending_value + # This does not seem to get updated correctly period.position_tracker = perf.position_tracker self.trading_client = ExchangeAlgorithmExecutor(