fixed buyer/seller empty estimated swap result
This commit is contained in:
parent
679ad53691
commit
e9db8565cc
2 changed files with 41 additions and 31 deletions
10
bot-buyer.py
10
bot-buyer.py
|
|
@ -3,11 +3,11 @@ from core import *
|
|||
# set config variables
|
||||
buy_percent_diff_pdai = 20
|
||||
buy_percent_diff_pusdc = 30
|
||||
buy_with_amount_pls = 10000
|
||||
buy_with_amount_pls = 30000
|
||||
slippage_percent = 5
|
||||
wallet_min_pls = 20000
|
||||
loop_delay = 3
|
||||
rapid_gas_fee_limit = 650000
|
||||
rapid_gas_fee_limit = 777777
|
||||
|
||||
# load wallet A and set address for logging
|
||||
set_logging(wallet_a_address, 'INFO')
|
||||
|
|
@ -74,6 +74,7 @@ while True:
|
|||
pdai_address,
|
||||
buy_with_amount_pls
|
||||
)
|
||||
if estimated_swap_result:
|
||||
# broadcast swap pls for pdai
|
||||
if swap_tokens(
|
||||
account,
|
||||
|
|
@ -83,6 +84,8 @@ while True:
|
|||
slippage_percent
|
||||
):
|
||||
logging.info("Swapped {} PLS to pDAI".format(buy_with_amount_pls))
|
||||
else:
|
||||
logging.warning("No estimated swap result data")
|
||||
else:
|
||||
logging.info("pDAI is not within range to buy yet ({}%)".format(buy_percent_diff_pdai))
|
||||
else:
|
||||
|
|
@ -102,6 +105,7 @@ while True:
|
|||
pusdc_address,
|
||||
buy_with_amount_pls
|
||||
)
|
||||
if estimated_swap_result:
|
||||
# broadcast swap pls for pusdc
|
||||
if swap_tokens(
|
||||
account,
|
||||
|
|
@ -111,6 +115,8 @@ while True:
|
|||
slippage_percent
|
||||
):
|
||||
logging.info("Swapped {} PLS to pUSDC".format(buy_with_amount_pls))
|
||||
else:
|
||||
logging.warning("No estimated swap result data")
|
||||
else:
|
||||
logging.info("pUSDC is not within range to buy yet ({}%)".format(buy_percent_diff_pusdc))
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@ from core import *
|
|||
|
||||
# set config variables
|
||||
sell_percent_diff_affection = 0
|
||||
sell_with_amount_affection = 200
|
||||
sell_with_amount_affection = 500
|
||||
slippage_percent = 5
|
||||
wallet_min_pls = 20000
|
||||
loop_delay = 3
|
||||
loop_sell_delay = 10
|
||||
rapid_gas_fee_limit = 650000
|
||||
rapid_gas_fee_limit = 777777
|
||||
|
||||
# load wallet C and set address for logging
|
||||
set_logging(wallet_c_address, 'INFO')
|
||||
|
|
@ -31,7 +31,7 @@ while True:
|
|||
# send pls back to wallet a for buying
|
||||
pls_balance = get_pls_balance(account.address, False)
|
||||
pls_balance -= wallet_min_pls
|
||||
# send the minter 1/4
|
||||
# send the minter 1/3
|
||||
send_to_wallet_b = float(round(pls_balance / 4, 2))
|
||||
# send the rest to buyer
|
||||
send_to_wallet_a = float(round(pls_balance - send_to_wallet_b, 2))
|
||||
|
|
@ -82,6 +82,7 @@ while True:
|
|||
wpls_address,
|
||||
amount
|
||||
)
|
||||
if estimated_swap_result:
|
||||
if swap_tokens(
|
||||
account,
|
||||
'PulseX_v2',
|
||||
|
|
@ -90,6 +91,9 @@ while True:
|
|||
slippage_percent
|
||||
):
|
||||
logging.info("Swapped {} AFFECTION™ to PLS".format(amount))
|
||||
else:
|
||||
logging.warning("No estimated swap result from RPC")
|
||||
break
|
||||
# delay if amounts remain in the list
|
||||
if i + 1 != len(selling_amounts):
|
||||
logging.info("Waiting for {} seconds...".format(loop_sell_delay))
|
||||
|
|
|
|||
Loading…
Reference in a new issue