Bot restart causes duplicate orders or orphan state
After crash or restart, reconciliation is incomplete and live state diverges from exchange truth. Without startup guards and idempotent reconciliation loops, duplicates are likely.
Common symptom variants
Primary playbook
Build crash-proof trading bots with reconciliation loops that detect and correct out-of-sync state on restart—preventing double orders and orphan positions.
Recommended resource
Reconciliation loop template for trading bots—detect and correct state drift on startup to prevent double orders and orphan positions.
Related posts
WebSocket Disconnects in Trading Bots: Reconnection That Actually Works
Handle WebSocket disconnects in trading bots with automatic reconnection, message gap detection, and state recovery—without missing fills or duplicating orders.
Idempotency keys for APIs: stop duplicate orders, emails, and writes
When retries create duplicate side effects, idempotency keys are the only safe fix. This playbook shows how to design keys, store results, and prove duplicates cannot recur.