try even if we report no ballance
This commit is contained in:
parent
3471f6aa6d
commit
12769cd3cc
@ -58,8 +58,6 @@ error_logger.setLevel(logging.ERROR)
|
||||
error_logger.addHandler(error_file_handler)
|
||||
|
||||
|
||||
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
ENV_FILE = '.env'
|
||||
@ -990,6 +988,12 @@ async def follow_move(move):
|
||||
# amount_to_swap = amount_to_swap * 0.99
|
||||
|
||||
if your_balance >= amount_to_swap:
|
||||
msg = (
|
||||
f"<b>Warning:</b>\n"
|
||||
f"We have {your_balance:.6f} {token_name_in}. Insufficient balance to swap {amount_to_swap:.6f} ({move['token_in']}). This will probably fail. But we will try anyway."
|
||||
)
|
||||
logging.warning(msg)
|
||||
await send_telegram_message(msg)
|
||||
try:
|
||||
# Convert to lamports
|
||||
# if decimals is 6, then amount = amount * 1e6; if 9, then amount = amount * 1e9
|
||||
@ -1068,13 +1072,13 @@ async def follow_move(move):
|
||||
error_logger.error(error_message)
|
||||
error_logger.exception(e)
|
||||
# await send_telegram_message(error_message)
|
||||
else:
|
||||
msg = (
|
||||
f"<b>Move Not Followed:</b>\n"
|
||||
f"Insufficient balance to swap {amount_to_swap:.6f} {token_name_in} ({move['token_in']})"
|
||||
)
|
||||
logging.warning(msg)
|
||||
await send_telegram_message(msg)
|
||||
# else:
|
||||
# msg = (
|
||||
# f"<b>Move Not Followed:</b>\n"
|
||||
# f"Insufficient balance to swap {amount_to_swap:.6f} {token_name_in} ({move['token_in']})"
|
||||
# )
|
||||
# logging.warning(msg)
|
||||
# await send_telegram_message(msg)
|
||||
|
||||
|
||||
# Helper functions (implement these according to your needs)
|
||||
@ -1181,7 +1185,6 @@ if not pk:
|
||||
|
||||
|
||||
async def main():
|
||||
# Initialize logging
|
||||
await send_telegram_message("Solana Agent Started. Connecting to mainnet...")
|
||||
asyncio.create_task( list_initial_wallet_states())
|
||||
await subscribe_to_wallet()
|
||||
|
Loading…
x
Reference in New Issue
Block a user