Introduction
After you have a user access token, trading lives under /v1. Send Authorization: Bearer. Money fields are strings, not floats. Default account is demo unless you set accountType to real.
Reads need trade:read or account:read. CFD writes need trade:write. Timed contracts need contract:write (and contract:read to list them). Live funds also need a partner_live_* client. Sandbox clients can only touch demo wallets.
List wallets first
Call GET /v1/accounts to see demo and real wallets, balances, and account ids. Show the user which book they are about to trade. Use GET /v1/accounts/risk for margin, equity, and free margin on one account type before you enable Buy.
If the real wallet is empty, keep the UI on demo or send them to deposit in Trade. Do not silently flip accountType to real.
CFD / Market orders
Quote with GET /v1/quotes when you need bid/ask on the confirm screen. Then POST /v1/orders with symbol, side, quantity, and accountType. Optional leverage, stop loss, and take profit follow the same rules as the Trade ticket.
Send a unique Idempotency-Key header on every write. Generate it when the user taps Buy (a UUID is enough). If the request times out, retry with the same key. A new key is a new order.
Timed contracts
Contract placement uses the contract routes in the Trading API reference. Pass the user token, symbol, contract type (Rise, Fall, Higher, and the rest), stake, duration, and account type. Barrier and digit prediction are required only for those families — same as the dashboard form.
Stake and duration lock at placement. Return rate is computed by the platform. After settle, either poll the contract resource or listen for contract.settled on your webhook if you also track referrals.
Idempotency
Network blips are common on mobile. If you create a new key after a 504, you can open two positions. Store the key with the in-flight intent until you have an order id, then discard it.
After the fill
REST confirms the order. For a live book, subscribe on the WebSocket. Partner-wide referral events (fills from traders who are not this OAuth user) still arrive on webhooks, not on this socket.
Real writes need trade:write and a live OAuth client. Sandbox clients can only operate on demo accounts.
Full path list: Trading API reference.
