As I've spent a ton of gosh darn hours coding the best version of this bot. It is infuriating when the best version of it you've made just doesn't work EXACTLY how I want it to be. Aggravated to keep it simple, lol.

I can not get these cancel orders to work. I keep getting the same response that there is no TX available, and then they go onto pending cancels but never cancel.
If anyone has any information on how to make a bot to cancel pending orders, I'm really having an issue. I'm at the point now that I'm not sure if I'm calling for the right cancel order. I don't know if its beem or @nectarflower, it could even be Hive Engine's API.
The bot works well, but this is bugging me.
I'm thinking of going the route of creating an entirely different 'cancel_order.py' to cancel orders upon being called for by 'peake_matic.py'. Hopefully you don't judge me for not calling some things the correct things.
peakecoin_matic.py
# Cancel the oldest order if at or above limit
ORDER_LIMIT = 100
if num_open_orders >= ORDER_LIMIT or total_open_orders >= ORDER_LIMIT:
printc("\n[ ORDER LIMIT WARNING ]", 'yellow')
printc(f"- Open order limit reached ({num_open_orders} for {token}, {total_open_orders} total). Cancelling oldest order...", 'yellow')
if open_orders:
oldest = min(open_orders, key=lambda o: o.get('timestamp', o.get('_id', 0)))
order_id = oldest.get('_id')
...
success, txid, error = cancel_order(account_name, order_id)
if success:
printc(f"✅ Cancelled order: {order_id} (TXID: {txid})", 'green')
else:
printc(f"❌ Failed to cancel order {order_id}: {error}", 'red')
place_order.py
# Cancel the oldest order if at or above limit
ORDER_LIMIT = 100
if num_open_orders >= ORDER_LIMIT or total_open_orders >= ORDER_LIMIT:
printc("\n[ ORDER LIMIT WARNING ]", 'yellow')
printc(f"- Open order limit reached ({num_open_orders} for {token}, {total_open_orders} total). Cancelling oldest order...", 'yellow')
if open_orders:
oldest = min(open_orders, key=lambda o: o.get('timestamp', o.get('_id', 0)))
order_id = oldest.get('_id')
...
success, txid, error = cancel_order(account_name, order_id)
if success:
printc(f"✅ Cancelled order: {order_id} (TXID: {txid})", 'green')
else:
printc(f"❌ Failed to cancel order {order_id}: {error}", 'red')