From 8c59939bf046ea2834b2d26d7aec60e11c082840 Mon Sep 17 00:00:00 2001 From: Alexander Date: Sat, 13 Jul 2024 07:28:29 -0400 Subject: [PATCH] check gas prices before every sell --- bot-seller.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/bot-seller.py b/bot-seller.py index 5e9bbb1..6cfaee9 100755 --- a/bot-seller.py +++ b/bot-seller.py @@ -52,12 +52,6 @@ while True: else: logging.warning("Failed to send {} PLS to {}".format(send_to_wallet_b, wallet_b_address)) - # check the current gas price - if get_beacon_gas_prices('rapid', beacon_gasnow_cache_seconds) > rapid_gas_fee_limit: - logging.warning("Gas fees are too high") - log_end_loop(loop_delay) - continue - # take samples of 1 pdai/pusdc/affection to wpls price pdai_sample_result = sample_exchange_rate('PulseX_v2', pdai_address, wpls_address) pusdc_sample_result = sample_exchange_rate('PulseX_v2', pusdc_address, wpls_address) @@ -82,6 +76,11 @@ while True: logging.info("Selling {} AFFECTION™...".format(sum(selling_amounts))) i = 0 while i < len(selling_amounts): + # check the current gas price + if get_beacon_gas_prices('rapid', beacon_gasnow_cache_seconds) > rapid_gas_fee_limit: + logging.warning("Gas fees are too high") + log_end_loop(loop_delay) + continue amount = selling_amounts[i] # check if the pdai/pusdc price is cheaper than affection price if (pdai_sample_result < affection_sample_result