From 529757025ada6718f8d77dee1b4ed70cee69a5e7 Mon Sep 17 00:00:00 2001 From: Dowland Aiello Date: Wed, 2 Oct 2024 21:09:25 +0000 Subject: [PATCH 1/2] Refresh wallet balance more regularly. --- src/strategies/naive.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/strategies/naive.py b/src/strategies/naive.py index 9bdecc87..bef68150 100644 --- a/src/strategies/naive.py +++ b/src/strategies/naive.py @@ -96,6 +96,15 @@ async def strategy( except ValueError as e: logger.error("Failed to rebalance portfolio: %s", e) + ctx = ctx.with_state(state.poll(ctx, pools, auctions)) + + if not state.balance: + return ctx + + logger.info( + f"Starting arbitrage round with {state.balance} {ctx.cli_args['base_denom']}" + ) + # Report route stats to user logger.info( "Finding profitable routes", From 9e865aa4f0fa791c9b2454821ede45b4a47e6dca Mon Sep 17 00:00:00 2001 From: Dowland Aiello Date: Thu, 3 Oct 2024 14:50:43 +0000 Subject: [PATCH 2/2] Update balance even if fetch fails. --- src/strategies/naive.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/strategies/naive.py b/src/strategies/naive.py index bef68150..5624d724 100644 --- a/src/strategies/naive.py +++ b/src/strategies/naive.py @@ -63,8 +63,7 @@ def poll( ), ) - if balance_resp: - self.balance = balance_resp + self.balance = balance_resp return self