From 9f4045f16a41a5ec698300e66fd88cb4c796a507 Mon Sep 17 00:00:00 2001 From: Ruida Zeng <31152346+ruidazeng@users.noreply.github.com> Date: Sat, 26 Oct 2024 22:32:47 -0500 Subject: [PATCH 1/2] Fixed Windows Asyncio RuntimeError --- main.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.py b/main.py index c7e8189..abb71d2 100644 --- a/main.py +++ b/main.py @@ -6,6 +6,9 @@ import triangular_arbitrage.detector as detector if __name__ == "__main__": + if hasattr(asyncio, "WindowsSelectorEventLoopPolicy"): + asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) # Windows handles asynchronous event loops + benchmark = os_util.parse_boolean_environment_var("IS_BENCHMARKING", "False") if benchmark: import time From 2895c516e3983de1cf2d9af70e2072ae27131ec0 Mon Sep 17 00:00:00 2001 From: Ruida Zeng <31152346+ruidazeng@users.noreply.github.com> Date: Sat, 26 Oct 2024 22:33:45 -0500 Subject: [PATCH 2/2] Fixed max_cycle is NoneType --- triangular_arbitrage/detector.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/triangular_arbitrage/detector.py b/triangular_arbitrage/detector.py index 79d0b8b..3d26b0b 100644 --- a/triangular_arbitrage/detector.py +++ b/triangular_arbitrage/detector.py @@ -108,7 +108,7 @@ async def get_exchange_last_prices(exchange_name, ignored_symbols, whitelisted_s return last_prices -async def run_detection(exchange_name, ignored_symbols=None, whitelisted_symbols=None, max_cycle=None): +async def run_detection(exchange_name, ignored_symbols=None, whitelisted_symbols=None, max_cycle=10): last_prices = await get_exchange_last_prices(exchange_name, ignored_symbols or [], whitelisted_symbols) # default is the best opportunity for all cycles best_opportunity, best_profit = get_best_opportunity(last_prices, max_cycle=max_cycle)