Skip to content

Commit

Permalink
Chore: Make release 1.2.20
Browse files Browse the repository at this point in the history
  • Loading branch information
martinroberson authored and razvan-dorobantu committed Jan 24, 2025
1 parent e8f63a1 commit 6c94639
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions gs_quant/backtests/generic_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def _raise_order(self,
ti_by_state = {}
for s, ti in zip_longest(state_list, trigger_info):
ti_by_state[s] = ti
orders = self.get_base_orders_for_states(state_list)
orders = self.get_base_orders_for_states(state_list, trigger_infos=ti_by_state)
final_orders = {}
for d, p in orders.items():
new_port = Portfolio([t.clone(name=f'{t.name}_{d}') for t in p.result()])
Expand Down Expand Up @@ -195,7 +195,7 @@ def _raise_order(self,
Iterable[AddScaledTradeActionInfo]]]]):
if self.action.scaling_type == ScalingActionType.risk_measure:
self._order_valuations.append(self.action.scaling_risk)
orders = self.get_base_orders_for_states(state_list)
orders = self.get_base_orders_for_states(state_list, trigger_infos=trigger_infos)

final_orders = {}
for d, res in orders.items():
Expand Down Expand Up @@ -264,7 +264,7 @@ def apply_action(self,
trigger_infos = dict(zip_longest(state_list, trigger_info))
backtest.calc_calls += 1
backtest.calculations += len(state_list)
orders = self.get_base_orders_for_states(state_list)
orders = self.get_base_orders_for_states(state_list, trigger_infos=trigger_infos)

for create_date, portfolio in orders.items():
info = trigger_infos[create_date]
Expand Down Expand Up @@ -661,11 +661,18 @@ def _build_simple_and_semi_triggers_and_actions(self, strategy, backtest, strate
with self._trace('Build semi-det action') as scope:
if scope:
scope.span.set_tag('action.type', type(action).__name__)
trigger_info = None
if type(action) in trigger_infos:
trigger_info = trigger_infos[type(action)]
else:
for mapped_action_type, action_trigger_info in trigger_infos.items():
if isinstance(action, mapped_action_type):
trigger_info = action_trigger_info
break
self.get_action_handler(action).apply_action(
triggered_dates,
backtest,
trigger_infos[type(action)]
if type(action) in trigger_infos else None
trigger_info
)

def _price_semi_det_triggers(self, backtest, risks):
Expand Down

0 comments on commit 6c94639

Please sign in to comment.