Skip to main content
Place orders, then protect and close positions, on any account you hold, from your trading program. Read this page first if you trade programmatically or build a trading screen: it says what the trading routes do and which guide covers each job. Every account trades through the same routes, whether it’s your Demo on the paper book or an account at any other provider. You name the account with provider and account, send the order, and read the result from the account. The engine checks the account’s risk state, its provider’s rules and the order itself before anything reaches the market, and a refusal carries a code you can show.

What you can do

  • Place an order with its bracket. Up to three take profits and three stop losses go in with the entry, laid out as pairs along the position. When one order of a pair fills, the other is cancelled.
  • Protect a position and change its bracket. Put a bracket on a position you hold or on an entry that’s resting, move its legs as the market moves, or withdraw it. A change is all or nothing, and a stop loss can move itself to breakeven and trail the price.
  • Manage working orders. Move one to a new price, cancel one, or cancel them all. A move reports its own outcome, because a move that looks accepted can still fail at the market.
  • Close positions. Close part of one, flatten one instrument, flatten the account, or reverse. They differ in what each cancels first.
  • Stay inside the locks. A locked account refuses new orders with 423, and the account stream carries the lock, so a screen shows it instead of an order button.
  • Use leverage where the provider has it. Read and set an instrument’s leverage, and price an order’s margin before you send it.

Two rules every route follows

A request that places an order carries a clientOrderId you choose. Mint it when the trader commits to the order and reuse it on every retry: the engine recognizes the second request as the same order, so a timeout can never become two positions. Idempotency has the details. A refusal carries a code beside the English error, often with params. Choose what to show by code, and treat a 423 as a state to display, not an error to retry. Errors lists every shape.

Next steps

Place your first order

Send an order with a take profit and a stop loss, confirm it, and flatten it again.

Protect a position

Place a bracket with an entry or on a position you hold, and change it as the market moves.

Manage working orders

Move a resting order, cancel one, or cancel every working order.

Close a position

Choose between the four ways out by what each one cancels first.

Trade with leverage

Read an account’s mode, set leverage, and price an order’s margin first.

Track fills and P&L

Read fills, order history and profit from history that outlives the session.