From 7b3a8f4e57f6e24013d8f4c787dc4f0f56aa39d4 Mon Sep 17 00:00:00 2001 From: Sheng Lundquist Date: Wed, 30 Oct 2024 14:56:37 -0700 Subject: [PATCH] Only log close if we found an open (#1722) --- .../hyperfuzz/system_fuzz/run_fuzz_bots.py | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/agent0/hyperfuzz/system_fuzz/run_fuzz_bots.py b/src/agent0/hyperfuzz/system_fuzz/run_fuzz_bots.py index 535d1cd8c3..cfc730eb52 100644 --- a/src/agent0/hyperfuzz/system_fuzz/run_fuzz_bots.py +++ b/src/agent0/hyperfuzz/system_fuzz/run_fuzz_bots.py @@ -174,27 +174,37 @@ def _check_trades_made_on_pool( pool_trade_event_counts = trade_counts[trade_counts["hyperdrive_name"] == pool.name][ "event_type" ].values + # Only look for close trades if we found a corresponding open trade if "OpenLong" not in pool_trade_event_counts: has_err = True error_message = f"Pool {pool.name} did not make any OpenLong trades after {iteration} iterations" + elif "CloseLong" not in pool_trade_event_counts: + has_err = True + error_message = ( + f"Pool {pool.name} did not make any CloseLong trades " + f"with open positions after {iteration} iterations" + ) + if "OpenShort" not in pool_trade_event_counts: has_err = True error_message = f"Pool {pool.name} did not make any OpenShort trades after {iteration} iterations" - if "CloseLong" not in pool_trade_event_counts: + elif "CloseShort" not in pool_trade_event_counts: has_err = True - error_message = f"Pool {pool.name} did not make any CloseLong trades after {iteration} iterations" - if "CloseShort" not in pool_trade_event_counts: - has_err = True - error_message = f"Pool {pool.name} did not make any CloseShort trades after {iteration} iterations" + error_message = ( + f"Pool {pool.name} did not make any CloseShort trades " + f"with open positions after {iteration} iterations" + ) + if "AddLiquidity" not in pool_trade_event_counts: has_err = True error_message = ( f"Pool {pool.name} did not make any AddLiquidity trades after {iteration} iterations" ) - if "RemoveLiquidity" not in pool_trade_event_counts: + elif "RemoveLiquidity" not in pool_trade_event_counts: has_err = True error_message = ( - f"Pool {pool.name} did not make any RemoveLiquidity trades after {iteration} iterations" + f"Pool {pool.name} did not make any RemoveLiquidity trades " + f"with open positions after {iteration} iterations" ) if has_err: