Skip to main content
Function:
ABI Object:
Parameters:
  • signer - The account signer
  • subaccount - The Trading Account object
  • market - The PerpMarket object
  • price - Order price `<u64>`
  • size - Order size `<u64>`
  • is_buy - True for buy order, false for sell order
  • time_in_force - Time in force `<u8>`: 0 = GoodTillCanceled, 1 = PostOnly, 2 = ImmediateOrCancel
  • is_reduce_only - Whether order can only reduce position size
  • client_order_id - Optional client-assigned order ID, at most 32 bytes `<Option<String>>`
  • stop_price - Optional stop price `<Option<u64>>`
  • tp_trigger_price - Optional take-profit trigger price `<Option<u64>>`
  • tp_limit_price - Optional take-profit limit price `<Option<u64>>`
  • sl_trigger_price - Optional stop-loss trigger price `<Option<u64>>`
  • sl_limit_price - Optional stop-loss limit price `<Option<u64>>`
  • builder_address - Optional builder/referrer address `<Option<address>>`
  • builder_fees - Optional builder fee `<Option<u64>>`, in units of 0.0001% (basis points × 100; e.g. 1000 = 10 bps = 0.1%, the protocol maximum). The TypeScript SDK takes basis points and does this conversion for you. Must not exceed the maximum approved for this builder

Time in Force Options

When placing orders, you can specify different execution types using the time_in_force parameter:
  • 0 (GoodTillCanceled) - Order stays active until it is filled or manually canceled
  • 1 (PostOnly) - Order only adds liquidity to the order book (becomes a maker order). If the order would execute immediately, it is canceled
  • 2 (ImmediateOrCancel) - Order executes immediately at the best available price. Any unfilled portion is canceled

Constraints

  • client_order_id, if set, is at most 32 bytes
  • If both tp_trigger_price and sl_trigger_price are set: a buy requires TP above SL, a sell requires SL above TP. A limit price without its trigger price aborts with EINVALID_TP_SL_PARAMETERS
  • price must lie within the market’s min_price/max_price band and be a multiple of tick_size; size must be a multiple of lot_size and at least min_size
Example: