From 14d06eef228432c0a51a69b26156c8acacbe51d6 Mon Sep 17 00:00:00 2001 From: Tom McLean Date: Mon, 5 Feb 2024 10:36:34 +0000 Subject: [PATCH 1/2] feat: Don't break on position empty dict --- vega_sim/scenario/common/agents.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/vega_sim/scenario/common/agents.py b/vega_sim/scenario/common/agents.py index 129450cda..56fdd0562 100644 --- a/vega_sim/scenario/common/agents.py +++ b/vega_sim/scenario/common/agents.py @@ -946,7 +946,9 @@ def __init__( self.initial_mint = ( initial_mint if initial_mint is not None - else (2 * commitment_amount) if commitment_amount is not None else 100 + else (2 * commitment_amount) + if commitment_amount is not None + else 100 ) self.market_name = market_name @@ -1174,7 +1176,9 @@ def step(self, vega_state: VegaState): key_name=self.key_name, ) - current_position = int(position.open_volume) if position is not None else 0 + current_position = ( + int(position.open_volume) if position is not None and position else 0 + ) self.bid_depth, self.ask_depth = self.best_price_offset_fn( current_position, self.current_step ) From 6d33a5c18354e8121ed65253dec3513c56e883c8 Mon Sep 17 00:00:00 2001 From: Tom McLean Date: Mon, 5 Feb 2024 11:11:05 +0000 Subject: [PATCH 2/2] feat: Don't break on position empty dict --- vega_sim/scenario/common/agents.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/vega_sim/scenario/common/agents.py b/vega_sim/scenario/common/agents.py index 56fdd0562..605bb298e 100644 --- a/vega_sim/scenario/common/agents.py +++ b/vega_sim/scenario/common/agents.py @@ -946,9 +946,7 @@ def __init__( self.initial_mint = ( initial_mint if initial_mint is not None - else (2 * commitment_amount) - if commitment_amount is not None - else 100 + else (2 * commitment_amount) if commitment_amount is not None else 100 ) self.market_name = market_name