From 03d12d33d959a94a4199312d242d730b876c582f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20S=C3=A1nchez?= Date: Mon, 2 Dec 2024 19:55:10 -0300 Subject: [PATCH] reshuffling --- utils/commander.py | 61 +++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/utils/commander.py b/utils/commander.py index 2eede9a..a20fde1 100644 --- a/utils/commander.py +++ b/utils/commander.py @@ -33,6 +33,7 @@ INSTANCE 7) mod_global_tp_level 8) global_last_call 9) edit_loop_wait_time 10) edit_call_wait_time 11) reload_markets 12) fetch_full_log 13) paused_traders 14) fetch_log 15) edit_cooldown_multiplier +16) backtests 17) get_balance TRADERS 51) worker_status 52) get_all_worker_status @@ -43,7 +44,6 @@ TRADERS 65) toggle_pause 66) toggle_cleanup 67) toggle_autoswitch 68) toggle_check_old_long_price 69) switch_quote_currency 70) reload_safety_order 71) view_old_long 72) switch_price -73) backtests 74) get_balance 98) Change broker 99) Exit ''' @@ -277,7 +277,36 @@ if __name__=="__main__": url = f"{base_url}{port}/edit_cooldown_multiplier" parameters = {"cooldown_multiplier": new_multiplier} print(json.loads(requests.post(url, headers=headers, json=parameters).content)) + input("Press ENTER to continue ") + + elif command==16: + print("Returns backtests of the pairs available in an exchange") + broker = input("Exchange? (binance, gateio, kucoin or okx): ") + amount = input("Amount of days to consider? ") + max_rank = input("Maximum CoinMarketCap rank? ") + if not validate_int(amount): + print("The amount of days specified is invalid") + break + if not validate_int(max_rank): + print("The max_rank specified is invalid") + break + if input("Proceed? (Y/n) ") in ["Y","y",""]: + url = f"{base_url}/statistics_server/fetch_backtests?exchange_name={broker}&days={amount}&max_rank={max_rank}" + result = json.loads(requests.get(url,headers=headers).content) + #for item in result: + # print(item, round(result[item],2)) + sorted_result = {key: value for key, value in sorted(result.items(),key=lambda item: item[1])} + for item in sorted_result: + print(item, sorted_result[item]) input("Press ENTER to continue ") + + elif command==17: + print("Returns the free balance of a given coin") + coin = input("Input currency: ").upper() + if input("Proceed? (Y/n) ") in ["Y","y",""]: + url = f"{base_url}{port}/get_balance?coin={coin}" + print(json.loads(requests.get(url,headers=headers).content)) + input("Press ENTER to continue ") ###################### ####### TRADER ####### @@ -616,32 +645,4 @@ if __name__=="__main__": url = f"{base_url}{port}/switch_to_long_price?base={base}"e={quote}" print(json.loads(requests.get(url,headers=headers).content)) input("Press ENTER to continue ") - - elif command==73: - print("Returns backtests of the pairs available in an exchange") - broker = input("Exchange? (binance, gateio, kucoin or okx): ") - amount = input("Amount of days to consider? ") - max_rank = input("Maximum CoinMarketCap rank? ") - if not validate_int(amount): - print("The amount of days specified is invalid") - break - if not validate_int(max_rank): - print("The max_rank specified is invalid") - break - if input("Proceed? (Y/n) ") in ["Y","y",""]: - url = f"{base_url}/statistics_server/fetch_backtests?exchange_name={broker}&days={amount}&max_rank={max_rank}" - result = json.loads(requests.get(url,headers=headers).content) - #for item in result: - # print(item, round(result[item],2)) - sorted_result = {key: value for key, value in sorted(result.items(),key=lambda item: item[1])} - for item in sorted_result: - print(item, sorted_result[item]) - input("Press ENTER to continue ") - - elif command==74: - print("Returns the free balance of a given coin") - coin = input("Input currency: ").upper() - if input("Proceed? (Y/n) ") in ["Y","y",""]: - url = f"{base_url}{port}/get_balance?coin={coin}" - print(json.loads(requests.get(url,headers=headers).content)) - input("Press ENTER to continue ") \ No newline at end of file + \ No newline at end of file