Expand description
HTTP payload models and JSON-RPC envelope types for the Derive REST API.
Envelope types (JsonRpcRequest, JsonRpcResponse, JsonRpcError) cover
the wire framing shared with the WebSocket transport. Payload structs below
mirror the response shapes generated by Derive’s upstream Rust SDK at
derivexyz/cockpit,
adapted to project conventions:
bigdecimal::BigDecimal-> [rust_decimal::Decimal] via the project’sdeserialize_decimal/deserialize_optional_decimalfunctions.- Hot-path string identifiers (
instrument_name,currency) -> [Ustr] for interning across decoded messages. uuid::Uuidfields kept asStringto avoid a fresh dep when only a couple of methods carry one.
Structs§
- Derive
Aggregate Trading Stats - 24-hour rolling trading statistics embedded in ticker payloads.
- Derive
Collateral - Collateral row inside a
private/get_subaccountresponse. - Derive
Empty Result - Empty result returned by state-changing cancel endpoints.
- Derive
Instrument - Instrument definition returned by
public/get_instruments. - Derive
Open Orders Result private/get_open_ordersresult envelope.- Derive
Option Pricing - Option pricing greeks and implied volatilities (option tickers only).
- Derive
Option Public Details - Option-specific fields appearing on
public/get_instrumentsand legacy full ticker payloads when the instrument is an option. - Derive
Order - Order record returned by
private/order,private/get_orders,private/get_order_history, and the{subaccount_id}.ordersWS channel. - Derive
Order Result - Result envelope returned by
private/order. - Derive
Orders Result - Paginated
private/get_ordersresult envelope. - Derive
Pagination Info - Pagination metadata attached to listing endpoints.
- Derive
Perp Public Details - Perp-specific fields appearing on
public/get_instrumentsand legacy full ticker payloads when the instrument is a perpetual. - Derive
Position - Position record returned by
private/get_positionsand embedded inprivate/get_subaccountresponses. - Derive
Positions Result private/get_positionsresult envelope.- Derive
Public Candle - OHLCV candle returned by
public/get_tradingview_chart_data. - Derive
Public Funding Rate - Funding rate sample returned by
public/get_funding_rate_history. - Derive
Public Funding Rate History Result public/get_funding_rate_historyresult envelope.- Derive
Public Trade - Public trade record returned by
public/get_trade_historyand thetrades.{instrument_type}.{currency}WS channel. - Derive
Public Trades Result - Paginated
public/get_trade_historyresult envelope. - Derive
Replace Result - Result envelope returned by
private/replace. - Derive
Subaccount - Subaccount snapshot returned by
private/get_subaccount. - Derive
Ticker - Legacy full ticker snapshot pushed on the deprecated WS
ticker.{instrument_name}.{interval}channel. - Derive
Ticker Snapshot - Current ticker snapshot returned by
public/get_tickersandticker_slim. - Derive
Tickers Result - Result returned by
public/get_tickers. - Derive
Trade - Private trade record returned by
private/get_trade_historyand the{subaccount_id}.tradesWS channel. - Derive
Trades Result - Paginated
private/get_trade_historyresult envelope. - Json
RpcError - JSON-RPC error object as returned by Derive on failed requests.
- Json
RpcRequest - Outbound JSON-RPC request frame. Used as-is by the WebSocket transport; the
REST transport addresses the method by URL path and sends only
paramson the wire, but keeps the sameidfor telemetry. - Json
RpcResponse - Inbound JSON-RPC response frame. Exactly one of
resultorerroris set by the venue.