How to Manage a Local Order Book
Because Sparky has no sequence-numbered diff stream, keeping a local book is simpler than on Binance — and less flexible.
- Subscribe to
orderbook:<symbol>. The first message is a full snapshot (top 30 levels per side). - Replace your local book with every subsequent
orderbookmessage; do not try to merge. Messages arrive at most every 500 ms while the book changes. - If you need more than 30 levels, poll
GET /fapi/v1/depth?limit=…— but note itslastUpdateIdis a timestamp, not a sequence number, so there is nothing to reconcile against the stream. - Use the
timestampfield only for staleness detection (e.g. reconnect if no update for several seconds during active trading).
A per-level diff stream with U / u sequence ids is on the roadmap; track the Changelog.