Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed max_cycle is NoneType and Windows Asyncio RuntimeError #23

Merged
merged 2 commits into from
Oct 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading