Skip to content

Commit

Permalink
Merge pull request #23 from ruidazeng/master
Browse files Browse the repository at this point in the history
Fixed max_cycle is NoneType and Windows Asyncio RuntimeError
  • Loading branch information
Herklos authored Oct 27, 2024
2 parents 2fa6496 + 2895c51 commit 1247d53
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion triangular_arbitrage/detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1247d53

Please sign in to comment.