Skip to Content
Trading

Create Order

POST
/v1/account/orders

Create a New Order

Warning: Ensure your API key has the TRADE scope. You can generate an API key through the One Trading UI.

This endpoint is rate-limited per account holder (see 429).

This endpoint allows you to create a new order of type LIMIT.

Time in Force Options

For LIMIT orders, you can specify one of the following time_in_force options:

  • GOOD_TILL_CANCELLED (default): The order remains open until canceled.
  • IMMEDIATE_OR_CANCELLED: The order is filled immediately, either in full or partially, with any unfilled portion canceled.
  • FILL_OR_KILL: The order must be filled in full immediately; otherwise, it is canceled.
  • POST_ONLY: Ensures the order is added to the order book as a maker order and will be rejected if it would execute immediately as a taker order.

If no time_in_force is specified, GOOD_TILL_CANCELLED is assumed.

Order Size and Precision

Each order must meet a minimum size requirement. You can retrieve this minimum, along with precision limitations, by querying the /instruments endpoint.

Note: There is a global limit of 200 open orders per user across all markets.

Client ID for Order Tracking

Optionally, you can set a client_id to track orders without waiting for the assigned order_id.

Important: You are responsible for ensuring the uniqueness of each client_id. If multiple orders share the same client_id, only the newest order can be canceled via client_id; older orders will require the specific order_id or use of the "Cancel All Orders" endpoint.

Take Profit / Stop Loss

You can attach a take profit and/or stop loss (TP/SL) to the order. It is held in a separate service, not on the exchange itself, and when the price reaches a level, a reduce-only limit order is placed on the exchange to close for you.

  • take_profit and stop_loss are each { "value": "<price>", "type": "MID" | "BBO" } (type defaults to MID). Send at least one.
  • tpsl_mode is required with them. order closes this order's filled amount. position closes the whole position on the instrument, as it is when the level is reached (futures only).
  • tpsl_force: true, in position mode, replaces the instrument's existing position TP/SL. Without it a second position TP/SL is refused with POSITION_TPSL_EXISTS.
  • tpsl_slippage_bps bounds the price of the close: a limit order at the level less the slippage when selling, or plus it when buying. Defaults to 500 (5%), or the instrument's price collar if that is less.

The TP/SL is registered under the order's client_id before the order is placed, and is PENDING until the order fills:

  • When the order first fills, the TP/SL becomes ACTIVE. A position TP/SL sent with tpsl_force replaces the existing one at that moment, not before: until then the existing one stays ACTIVE.
  • If the order is rejected, or is cancelled or closes without a fill, the TP/SL is cancelled with it.
  • If a level has already been reached when the TP/SL becomes ACTIVE, it could never fire, so it is cancelled instead (VALIDATION_FAILED_AT_ACTIVATION).
  • Once ACTIVE, the TP/SL no longer depends on the order: cancelling what is left of the order, or Cancel All Orders, leaves it in place. It ends when a level fires, when you cancel it, or when its position is closed or flips.

A TP/SL is not an exchange order, so it does not appear in Get Orders. Read it back with Get Exotic Orders (TP/SL), change its levels with Update Exotic Order (TP/SL) and cancel it with Cancel Exotic Order (TP/SL): by the order's client_id, or for a position TP/SL by instrument_code. To add one to an order or position you already have, use Create Exotic Order (TP/SL). Every change of state is sent on the WebSocket ACCOUNT channel.

A TP/SL that is not accepted rejects the whole request and the order is not placed: see 400, 409 and 503.

Authorization

bearerAuth
headerAuthorizationBearer <token>

API key created in the One Trading UI, sent as Authorization: Bearer <token>. Each endpoint lists the key permission it needs.

Request Body

application/json
  1. body
instrument_code*string

The id of the market to create the order on. Use the /instruments endpoint to get the ids of ACTIVE markets to trade on

type*"LIMIT"

The type of order you wish to create

Value in"LIMIT"
side*string

BUY or SELL

Value in"BUY""SELL"
amount*string

The amount of currency for this order, as a positive decimal string within the instrument's amount precision

price*string

The price at which the order is set to execute, as a positive decimal string within the instrument's price precision and between its min_price and max_price

client_id?string

Unique client identifier for the order. Must be a version 4 UUID. If omitted, one is generated. It is your responsibility for the uniqueness of the client_id, if you create multiple orders with the same client_id, any subsequent operation performed using this client_id will only apply to the latest

Formatuuid
time_in_force?string

Defines the duration and conditions under which an order is considered valid in the market. Defaults to GOOD_TILL_CANCELLED

Value in"GOOD_TILL_CANCELLED""IMMEDIATE_OR_CANCELLED""FILL_OR_KILL""POST_ONLY"
reserve_price?string

Used for MOVE orders and is the max we can move to

take_profit?

Take profit level attached to the order. Requires tpsl_mode. Unknown keys are rejected.

stop_loss?

Stop loss level attached to the order. Requires tpsl_mode. Unknown keys are rejected.

tpsl_mode?string

Required when take_profit or stop_loss is sent. order: the TP/SL closes this order's filled amount. position: it closes the whole position on this instrument, as it is when a level is reached (futures only).

Value in"order""position"
tpsl_force?boolean

With tpsl_mode: position, replace the existing position take profit / stop loss on this instrument once this order fills, instead of failing with POSITION_TPSL_EXISTS.

Defaultfalse
tpsl_slippage_bps?integer

How far from its level the take profit / stop loss close may trade, in basis points. At most the instrument's price collar (price_collar_percentage × 100 on Instruments; 1000 for an instrument without one). Defaults to 500 (5%), or the collar if that is less. It cannot be changed later.

Range1 <= value <= 9999

Response Body

OK

application/json
  1. response
order_id*string
Formatuuid
client_id*string
Formatuuid
account_id*string
Formatuuid
instrument_code*string
time*string
Formatdate-time
side*string
Value in"BUY""SELL"
price*string
amount*string
type*"LIMIT"
Value in"LIMIT"
time_in_force*string

The time in force applied to the order (the requested value, or GOOD_TILL_CANCELLED by default)

Value in"GOOD_TILL_CANCELLED""IMMEDIATE_OR_CANCELLED""FILL_OR_KILL""POST_ONLY"
status*string

Status reported by the exchange when the order was accepted, e.g. OPEN, FILL or FILLED_FULLY. Rejections are returned as 422 instead.

Example Request
curl -X POST 'https://api.onetrading.com/fast/v1/account/orders' \  -H 'Content-Type: application/json' \  -d '{  "instrument_code": "string",  "type": "LIMIT",  "side": "BUY",  "amount": "string",  "price": "string"}'
Example Response
{  "order_id": "dc3239e2-e808-433a-8875-12ab7c537ce4",  "client_id": "58503f2b-ca87-4816-9338-93c443e6fdde",  "account_id": "726288e6-a463-4f88-9068-024ae8f97a34",  "instrument_code": "SOL_EUR",  "time": "2024-11-14T14:36:36.286Z",  "side": "SELL",  "price": "150",  "amount": "1",  "type": "LIMIT",  "time_in_force": "GOOD_TILL_CANCELLED",  "status": "OPEN"}