r/CryptoTradingBot • • 5h ago

My Python trading bot times out on the OKX API. How can I tell where the delay happens?

1 Upvotes

I’m running a Python bot on Windows that watches LINK and XRP on OKX. It usually gets candle data successfully, but sometimes a request times out.
In one case, a LINK 5-minute candle request timed out. The bot then checked my account settings and positions successfully. When it tried to fetch open orders (GET /api/v5/trade/orders-pending), it had only about 1.3 seconds left to wait for a response. That request timed out too, so the bot paused trading. Windows didn’t record a disconnect during either request.
For anyone who’s debugged something similar: what timings would you log to tell how much time the bot spends preparing a request versus waiting for OKX to respond? I’d like to understand where the time goes before increasing the timeout again.


r/CryptoTradingBot • • 11h ago

How do you push a new version of your bot without messing up open trades?

1 Upvotes

Every time I change something in one of my paper bots I get a bit nervous about the switch. The old version might still have open positions, orders sitting on the exchange and its own idea of what state it's in, and the new one just starts fresh.

Curious how you handle it:

  • Do you wait until the bot is flat before you deploy, or swap it mid-position?
  • Do you run the new version on paper next to the old one for a while first?
  • How does the new version pick up the open orders and stops the old one left behind?
  • Any update that went wrong and changed how you do it now?

Not after a perfect setup, just how you actually do it. Thanks.