Skip to content

Commit 1247d53

Browse files
authored
Merge pull request #23 from ruidazeng/master
Fixed max_cycle is NoneType and Windows Asyncio RuntimeError
2 parents 2fa6496 + 2895c51 commit 1247d53

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

main.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
import triangular_arbitrage.detector as detector
77

88
if __name__ == "__main__":
9+
if hasattr(asyncio, "WindowsSelectorEventLoopPolicy"):
10+
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) # Windows handles asynchronous event loops
11+
912
benchmark = os_util.parse_boolean_environment_var("IS_BENCHMARKING", "False")
1013
if benchmark:
1114
import time

triangular_arbitrage/detector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ async def get_exchange_last_prices(exchange_name, ignored_symbols, whitelisted_s
108108
return last_prices
109109

110110

111-
async def run_detection(exchange_name, ignored_symbols=None, whitelisted_symbols=None, max_cycle=None):
111+
async def run_detection(exchange_name, ignored_symbols=None, whitelisted_symbols=None, max_cycle=10):
112112
last_prices = await get_exchange_last_prices(exchange_name, ignored_symbols or [], whitelisted_symbols)
113113
# default is the best opportunity for all cycles
114114
best_opportunity, best_profit = get_best_opportunity(last_prices, max_cycle=max_cycle)

0 commit comments

Comments
 (0)