diff --git a/gs_quant/backtests/generic_engine.py b/gs_quant/backtests/generic_engine.py index cd8adc19..6fb3b1d2 100644 --- a/gs_quant/backtests/generic_engine.py +++ b/gs_quant/backtests/generic_engine.py @@ -65,11 +65,10 @@ def __init__(self, action: Action): def get_base_orders_for_states(self, states: Collection[dt.date], **kwargs): orders = {} dated_priceables = getattr(self.action, 'dated_priceables', {}) - with PricingContext(): - for s in states: - active_portfolio = dated_priceables.get(s) or self.action.priceables - with PricingContext(pricing_date=s): - orders[s] = Portfolio(active_portfolio).calc(tuple(self._order_valuations)) + for s in states: + active_portfolio = dated_priceables.get(s) or self.action.priceables + with PricingContext(pricing_date=s): + orders[s] = Portfolio(active_portfolio).calc(tuple(self._order_valuations)) return orders def get_instrument_final_date(self, inst: Instrument, order_date: dt.date, info: namedtuple):