FastMM documentation
FastMM C++ API 0.6.0
Public headers, tier 1 and tier 2
Loading...
Searching...
No Matches
dead_mans_switch.hpp File Reference

Venue-side dead man's switch: the venue cancels the account's resting orders when the connector stops talking to it, whatever the reason. More...

#include <algorithm>
#include <cstdint>

Go to the source code of this file.

Classes

class  fastmm::venues::CountdownSwitch
 Refresh clock for a countdown dead man's switch. More...
 
class  fastmm::venues::CountdownDriver
 What a connector does with a countdown switch, the same for every venue that has one (Binance USDⓈ-M countdownCancelAll, OKX cancel-all-after). More...
 

Namespaces

namespace  fastmm
 
namespace  fastmm::venues
 

Detailed Description

Venue-side dead man's switch: the venue cancels the account's resting orders when the connector stops talking to it, whatever the reason.

cancel_on_order_channel_loss is not this — that one is the connector issuing a REST cancel-all, and it needs a live process and a working network. A SIGKILL, an OOM kill, a kernel panic or a host that loses power leaves the quotes resting. Only the venue can clear them then.

The venues offer two shapes, and only the first needs anything here:

countdown The connector arms a timer ("cancel everything unless you hear from me within N ms") and keeps pushing it out. Binance USDⓈ-M countdownCancelAll. The window is the exposure after a hard kill, and every refresh costs rate limit, so the refresh runs at a fraction of the window rather than at its edge. CountdownSwitch below is the timer for it, CountdownDriver the rules around it. on-disconnect The venue watches its own socket and cancels when it dies. Deribit private/enable_cancel_on_disconnect, Bybit's Disconnect-Cancel-All. Armed once per connection or once per account; there is nothing to refresh, so these are wired in the connectors directly.

Binance Spot has neither, as of the 2026-09 API docs: neither rest-api.md nor web-socket-api.md has a countdown, a session auto-cancel or a cancel-on-disconnect, and the FIX session's "countdown" is a maintenance logout that leaves orders alone. The only venue-side primitive is the manual openOrders.cancelAll. Spot quotes survive a hard kill.