Skip to main content

Module models

Module models 

Source
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’s deserialize_decimal / deserialize_optional_decimal functions.
  • Hot-path string identifiers (instrument_name, currency) -> [Ustr] for interning across decoded messages.
  • uuid::Uuid fields kept as String to avoid a fresh dep when only a couple of methods carry one.

Structs§

DeriveAggregateTradingStats
24-hour rolling trading statistics embedded in ticker payloads.
DeriveCollateral
Collateral row inside a private/get_subaccount response.
DeriveEmptyResult
Empty result returned by state-changing cancel endpoints.
DeriveInstrument
Instrument definition returned by public/get_instruments.
DeriveOpenOrdersResult
private/get_open_orders result envelope.
DeriveOptionPricing
Option pricing greeks and implied volatilities (option tickers only).
DeriveOptionPublicDetails
Option-specific fields appearing on public/get_instruments and legacy full ticker payloads when the instrument is an option.
DeriveOrder
Order record returned by private/order, private/get_orders, private/get_order_history, and the {subaccount_id}.orders WS channel.
DeriveOrderResult
Result envelope returned by private/order.
DeriveOrdersResult
Paginated private/get_orders result envelope.
DerivePaginationInfo
Pagination metadata attached to listing endpoints.
DerivePerpPublicDetails
Perp-specific fields appearing on public/get_instruments and legacy full ticker payloads when the instrument is a perpetual.
DerivePosition
Position record returned by private/get_positions and embedded in private/get_subaccount responses.
DerivePositionsResult
private/get_positions result envelope.
DerivePublicCandle
OHLCV candle returned by public/get_tradingview_chart_data.
DerivePublicFundingRate
Funding rate sample returned by public/get_funding_rate_history.
DerivePublicFundingRateHistoryResult
public/get_funding_rate_history result envelope.
DerivePublicTrade
Public trade record returned by public/get_trade_history and the trades.{instrument_type}.{currency} WS channel.
DerivePublicTradesResult
Paginated public/get_trade_history result envelope.
DeriveReplaceResult
Result envelope returned by private/replace.
DeriveSubaccount
Subaccount snapshot returned by private/get_subaccount.
DeriveTicker
Legacy full ticker snapshot pushed on the deprecated WS ticker.{instrument_name}.{interval} channel.
DeriveTickerSnapshot
Current ticker snapshot returned by public/get_tickers and ticker_slim.
DeriveTickersResult
Result returned by public/get_tickers.
DeriveTrade
Private trade record returned by private/get_trade_history and the {subaccount_id}.trades WS channel.
DeriveTradesResult
Paginated private/get_trade_history result envelope.
JsonRpcError
JSON-RPC error object as returned by Derive on failed requests.
JsonRpcRequest
Outbound JSON-RPC request frame. Used as-is by the WebSocket transport; the REST transport addresses the method by URL path and sends only params on the wire, but keeps the same id for telemetry.
JsonRpcResponse
Inbound JSON-RPC response frame. Exactly one of result or error is set by the venue.