From 3e548e5cfac9f3774dfdad4af09003cac3b2ac30 Mon Sep 17 00:00:00 2001 From: poliwop Date: Tue, 18 Jul 2023 14:56:35 -0500 Subject: [PATCH 1/2] Fixing invest_all --- hydradx/model/run.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hydradx/model/run.py b/hydradx/model/run.py index 9f994944..fc0c1e9d 100644 --- a/hydradx/model/run.py +++ b/hydradx/model/run.py @@ -1,6 +1,7 @@ import time from .amm.global_state import GlobalState +from copy import deepcopy def run(initial_state: GlobalState, time_steps: int, silent: bool = False) -> list: @@ -22,8 +23,9 @@ def run(initial_state: GlobalState, time_steps: int, silent: bool = False) -> li new_global_state.evolve() # agent actions - agents = new_global_state.agents - for agent_id, agent in agents.items(): + agent_ids = deepcopy(new_global_state.agents.keys()) + for agent_id in agent_ids: + agent = new_global_state.agents[agent_id] if agent.trade_strategy: new_global_state = agent.trade_strategy.execute(new_global_state, agent.unique_id) From 0820a665553e992b40ddcb6e159b18568c3e4887 Mon Sep 17 00:00:00 2001 From: poliwop Date: Tue, 18 Jul 2023 14:56:35 -0500 Subject: [PATCH 2/2] Fixing invest_all --- hydradx/model/run.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hydradx/model/run.py b/hydradx/model/run.py index fc0c1e9d..aa349795 100644 --- a/hydradx/model/run.py +++ b/hydradx/model/run.py @@ -23,7 +23,7 @@ def run(initial_state: GlobalState, time_steps: int, silent: bool = False) -> li new_global_state.evolve() # agent actions - agent_ids = deepcopy(new_global_state.agents.keys()) + agent_ids = deepcopy(list(new_global_state.agents.keys())) for agent_id in agent_ids: agent = new_global_state.agents[agent_id] if agent.trade_strategy: