Skip to main content

Monaco Protocol SDK v1.0.97

This release caps a perp fill at its risk bucket’s bankruptcy price while the exchange runs in liquidation zero mode, adds the BANKRUPTCY_PRICE terminal reason, and sends the channels subscribed in one tick as one WebSocket request. Action items: accept BANKRUPTCY_PRICE wherever you switch on terminalReason; handle the two new INVALID_ORDER messages on order placement. No field is added, removed or renamed.

Changed

Fills stop at the risk bucket’s bankruptcy price in liquidation zero mode

While the exchange runs without an insurance-fund backstop (liquidation zero mode), a user’s own perp fill is never made if it would leave its risk bucket below zero equity and worse off than before the fill. A fill that raises a risk bucket already under zero is still made. The check runs when the order fills, inside the risk engine, not when it is accepted: nothing is refused at entry, and a resting LIMIT priced past its risk bucket’s bankruptcy price rests as before.
  • A MARKET, IOC or crossing LIMIT taker whose fills would leave its risk bucket below zero and worse off fills only what the book offers inside the bankruptcy price — the price at which the part of the position those fills close would take the risk bucket’s equity before them to zero, net of the fee the fills pay, rounded onto the tick in the safe direction with a small reserve for settlement rounding. A partial close is held to a looser price than a full one. The remainder is cancelled as a price cut (terminalReason PRICE_BAND), a limit remainder included: it is cancelled rather than rested. An FOK stays all-or-none: one the cap leaves short is rejected with nothing filled.
  • One with nothing fillable inside it is rejected with REST 400 / gRPC InvalidArgument code INVALID_ORDER and the message no liquidity inside the risk bucket's bankruptcy price, instead of INSUFFICIENT_LIQUIDITY. One no fill price keeps solvent is rejected with no price keeps the risk bucket solvent.
  • A resting order whose fill as the maker would leave its own risk bucket below zero and worse off is held to the quantity its price still fills, and its remainder is cancelled with terminalReason BANKRUPTCY_PRICE.
  • Margin order previews report the same capped fill or refusal.
Liquidation slices, auto-deleveraging, operator forced closes and spot orders are exempt. With an insurance fund behind the venue, fills are bounded by the price band alone, as before. See Perp price band.

@noble/curves v2

@0xmonaco/core now depends on @noble/curves v2. Session-key generation and Ed25519 request signatures are byte-for-byte unchanged.

Added

The BANKRUPTCY_PRICE terminal reason

OrderTerminalReason gains BANKRUPTCY_PRICE, carried on the REST order row (sdk.trading.getOrder; GET /api/v1/orders/{orderId}; gRPC OrdersService.GetOrder) and on the OrderCancelled WebSocket frame alike. It is neither INSUFFICIENT_MARGIN nor REDUCE_ONLY_EXHAUSTED, whatever the order’s flags. A taker the same check cut short is still reported as PRICE_BAND. Code that switches exhaustively on terminalReason must accept the new value. See Order lifecycle.

Fixed

Channels subscribed in one tick go out as one Subscribe

MonacoWebSocket now sends the channels subscribed in the same tick on an open socket as one Subscribe request, in call order, instead of one request per channel. The server reads one request at a time, so a page that subscribed instrument, trades and orderbook together waited for each earlier request to finish. A channel released in the same tick it was subscribed sends nothing. See WebSockets.

Security

Dependency floors

@0xmonaco/types requires zod ^4.6.7, so installs resolve a release with the zod 4.6.6 security fix. @0xmonaco/mcp-server requires @modelcontextprotocol/sdk ^1.32.1 and zod ^4.6.7, and its lockfile moves its HTTP stack to patched releases. No exported schema, type, tool or configuration changes.

Upgrade