Resources/Crash Recovery Reconciliation Kit

Crash Recovery Reconciliation Kit

Reconciliation loop template for trading bots—detect and correct state drift on startup to prevent double orders and orphan positions.

FreeFeb 23, 2026

What’s inside

Individual files are accessible (best for SEO/AI), plus you can download the full ZIP.

Download

Shipped asset

What's Inside

A complete implementation of crash recovery reconciliation for trading bots in TypeScript—detect state drift on startup and fix it before resuming trading.

Files in This Package

FilePurpose
reconciliation-loop-template.tsFull TypeScript implementation with types, detection functions, and startup sequence
startup-sequence-checklist.mdStep-by-step checklist for bot startup with timing estimates and abort conditions

The Problem This Solves

Your bot crashes. On restart:

  • Did that last order go through? Unknown.
  • Place it again? Maybe double your position.
  • Skip it? Maybe miss the trade entirely.

Without reconciliation, you're guessing. Guessing destroys accounts.

What the Reconciliation Loop Does

  1. Detects orphan orders — Orders on exchange that you don't have locally
  2. Removes ghost orders — Orders you think exist but never reached the exchange
  3. Backfills stale fills — Fills that happened while you were down
  4. Verifies position — Final truth check against exchange

Key Features

  • Type-safe — Full TypeScript types for orders, positions, state
  • Error handling — Timeout protection, rate limit retry, exchange-down detection
  • Periodic mode — Light-weight version for runtime drift detection
  • Configurable — Adopt vs. cancel orphans, drift thresholds, timeouts

Integration

Uses ccxt-style exchange interface. Implement three methods:

  • fetchOpenOrders(symbol)
  • fetchOrder(clientOrderId)
  • fetchPosition(symbol)

Works with Binance, Bybit, OKX, and any ccxt-compatible exchange.

Newsletter

Get the automation reliability newsletter

Weekly runbooks, failure patterns, and practical fixes.

No spam. Practical updates only.

We respect your inbox. Unsubscribe anytime.

No spam. Unsubscribe anytime.

Need help implementing this?

I can help you apply this to your systems without the drama.

Work with me

Similar resources

More resources to help you succeed

View all
Canonical: https://matrixtrak.com/resources/crash-recovery-reconciliation-kit