Skip to content
Partner API Docs

Advanced Order Types and Time in Force

Configure limit, stop, stop-limit, GTC, DAY, and GTD orders and understand their trigger, expiry, escrow, and cancellation behavior.

Order typeRequired fieldsInitial behavior
MARKETquoteIdExecutes against the current dealing workflow.
LIMITlimitPriceRests as WORKING until executable or cancelled.
STOPstopPriceRests until the trigger is crossed, then enters the execution queue.
STOP_LIMITstopPrice, limitPriceTriggers into a limit order.

Prices (limitPrice, stopPrice) are always in the instrument's local trading currency — the same units a quote's price is quoted in, so you never have to convert.

Resting orders are available on both the master account and sub-accounts, and behave identically:

Master accountSub-account
PlacePOST /tradePOST /users/{userId}/trade
ModifyPATCH /orders/{orderId}PATCH /users/{userId}/orders/{orderId}
CancelDELETE /orders/{orderId}DELETE /users/{userId}/orders/{orderId}

A MARKET order is quote-gated and requires a quoteId. A resting order is not — you are setting the price yourself — so it can be placed while the exchange is closed, which is the point: it triggers when the market reopens and the price crosses.

Time in force

  • GTC keeps the order live until execution or cancellation (the default).
  • DAY automatically cancels if it is not executed within 24 hours.
  • GTD cancels at expiresAt; the timestamp is required.
  • IOC and FOK are not supported. Orders settle through a dealing desk rather than an automated matching engine, so immediate-or-cancel semantics cannot be honoured. Submitting IOC returns a 400 explaining this.

Modifying a resting order

PATCH an order to change limitPrice, stopPrice, and/or quantity, keeping the same orderId. Only WORKING resting orders can be modified — a MARKET order is already PENDING at the dealing desk and can only be cancelled. Check replaceable on the order to know which applies.

An Idempotency-Key is required, because a replace moves money: a BUY re-escrows the difference (and is refused with INSUFFICIENT_FUNDS if the wallet cannot cover an increase), and a SELL adjusts the reserved units. A replace is repriced on the same FX basis and fee rates captured when the order was first placed, so modifying an order never silently reprices it against a newer rate. The response carries escrowAdjustment on a BUY, and an order.replaced event is emitted.

curl -X PATCH https://mystocks.africa/api/v1/partner/orders/{orderId} \
  -H "Authorization: Bearer pk_live_..." \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{ "limitPrice": 18.50, "quantity": 200 }'

On expiry or cancellation, BUY escrow is refunded and SELL reservations are released. An order.cancelled event is emitted. Do not infer a fill from a trigger; inspect executions and final order status.

Was this page useful?

Your signal helps us tighten partner onboarding docs.

Last updated on

On this page