BUG: Fixed issue with updating positions after restoring the state of an algo

This commit is contained in:
Frederic Fortier
2018-01-05 02:46:11 -05:00
parent 4d8d1e33d0
commit 215de33c35
+3 -2
View File
@@ -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(