Orderbook

private/replace

Atomically cancels a resting order (identified by order_id_to_cancel or nonce_to_cancel) and submits a replacement order in a single request. The payload is a full new-order specification plus the cancel target and an optional expected_filled_amount guard. Requires a signed order payload and Orderbook trade scope; returns both the cancelled and the newly created order.

post/private/replace

Request

  • Base URL: https://api.derive.xyz/v3
  • URL: https://api.derive.xyz/v3/private/replace
  • Auth: none declared

Request body

algo_duration_secinteger nullable
algo_num_slicesinteger nullable
algo_type'twap'
amountstring decimal required

Order amount in units of the base, as a decimal string (e.g. "1.5") or a JSON number.

clientstring nullable
direction'buy' | 'sell' required
expected_filled_amountstring decimal nullable

Optional decimal string of the human value (e.g. "1.5"), up to 12 fractional digits, or null; a string or JSON number is accepted

extra_feestring decimal nullable

Optional extra fee per unit of volume, as a decimal string or JSON number. Defaults to zero.

instrument_namestring required
is_atomic_signingboolean nullable
labelstring nullable
limit_pricestring decimal required

Limit price in quote currency, as a decimal string (e.g. "3100.5") or a JSON number.

max_feestring decimal required

Max fee per unit of volume in quote currency, as a decimal string or a JSON number.

mmpboolean nullable

Tags the order for market maker protection. Only tagged orders are cancelled by cancel on disconnect.

noncestring required
nonce_to_cancelstring nullable
order_id_to_cancelstring uuid nullable

Optional UUID v4 string

order_type'limit' | 'market'
reduce_onlyboolean nullable
referral_codestring nullable
reject_post_onlyboolean nullable
reject_timestampinteger nullable
signaturestring required
signature_expiry_secinteger required
signerstring required
subaccount_idinteger required
time_in_force'gtc' | 'post_only' | 'fok' | 'ioc'
trigger_pricestring decimal nullable

Trigger price as a decimal string or JSON number; omit for non-trigger orders.

trigger_price_type'mark' | 'index'
trigger_type'stoploss' | 'takeprofit'

Response

Success

Changes

No recorded changes to this operation across all 1 revision of this API.