Places a buy order for an instrument. Supports various order types including limit, market, stop, and advanced order types (stop-limit, take-profit, take-profit-limit, trailing-stop, etc.).
You can specify order parameters such as price, quantity, time-in-force, post-only, reduce-only, and trigger conditions. Orders can be labeled for easier management and tracking.
Note: For spot orders routed to Coinbase Exchange, fills come back asynchronously. It is recommended to receive fills from the user.trades channel.
📖 Related Articles:
Scope: trade:read_write
Request
- Base URLhttps://test.deribit.com/api/v2
- URLhttps://test.deribit.com/api/v2/private/buy
- Authnone declared
Query parameters
Unique instrument identifier
Instrument name
It represents the requested order size. For perpetual and inverse futures the amount is in USD units. For options and linear futures it is the underlying base currency coin. The amount is a mandatory parameter if contracts parameter is missing. If both contracts and amount parameter are passed they must match each other otherwise error is returned.
It represents the requested order size in contract units and can be passed instead of amount. The contracts is a mandatory parameter if amount parameter is missing. If both contracts and amount parameter are passed they must match each other otherwise error is returned.
The order type, default: "limit"
stop_limit, stop_market, take_limit, take_market, and trailing_stop (trigger/algo order types) are not supported for option and option_combo instruments.
For spot trading routed to Coinbase Exchange, only "market", "limit" and "stop_limit" orders are supported. Other order types will be rejected.
user defined label for the order (maximum 64 characters)
Initial visible amount for an iceberg order. Must meet the instrument's minimum iceberg amount and amount step, not exceed total amount, and satisfy the instrument's maximum total-to-display ratio.
Iceberg orders are not supported for option, future_combo, and option_combo instruments.
If true, the order is considered reduce-only which is intended to only reduce a current position
Trigger price, required for trigger orders only (Stop-loss or Take-profit orders)
Positive deviation from the price peak at which the order triggers; required for trailing_stop.
Trigger type (only for trigger orders). Allowed values: "index_price", "mark_price", "last_price".
advanced type: "usd" or "implv" (Only for options; field is omitted if not applicable).
Advanced option order type. (Only for options. Advanced USD orders are not supported for linear options.)
Order MMP flag, only for order_type 'limit'
Timestamp, when provided server will start processing request in Matching Engine only before given timestamp, in other cases timed_out error will be responded. Remember that the given timestamp should be consistent with the server's time, use <a href='#public-get_time'>/public/time</a> method to obtain current server time.
List of secondary orders. Each requires positive amount and direction. Non-market types (including take_limit) require price. Stop/take orders require trigger and trigger_price; trailing-stop orders require trigger and positive trigger_offset.
Response
Success response
Example response
{
"result": {
"order": {
"order_id": "ETH-100234",
"instrument_name": "BTC-PERPETUAL",
"creation_timestamp": 1536569522277,
"last_update_timestamp": 1536569522277,
"starbase_last_update_timestamp": 1536569522277000000,
"block_trade": true,
"trigger_order_id": "SLIB-370",
"combo_order_id": "103148386169",
"starbase_order_id": 103148386170,
"app_name": "Example Application",
"mmp_cancelled": true,
"oto_order_ids": [
"ETH-100234"
],
"primary_order_id": "ETH-100234"
},
"trades": [
{
"instrument_name": "BTC-PERPETUAL",
"timestamp": 1517329113791,
"starbase_timestamp": 1536569522277000000,
"starbase_order_id": 103148386170,
"block_trade_id": "154",
"block_trade_leg_count": 3
}
],
"oco_orders": [
{
"order_id": "ETH-100234",
"instrument_name": "BTC-PERPETUAL",
"creation_timestamp": 1536569522277,
"last_update_timestamp": 1536569522277,
"starbase_last_update_timestamp": 1536569522277000000,
"block_trade": true,
"trigger_order_id": "SLIB-370",
"combo_order_id": "103148386169",
"starbase_order_id": 103148386170,
"app_name": "Example Application",
"mmp_cancelled": true,
"oto_order_ids": [
"ETH-100234"
],
"primary_order_id": "ETH-100234"
}
]
}
}Changes
- breaking
for the
queryrequest parameterpost_only, default value was changed fromtruetofalse - breaking
for the
queryrequest parameterdisplay_amount, default value1was removed - breaking
the response property
///became nullable for the status - breaking
the response property
///became nullable for the status - breaking
the response property
///became nullable for the status - breaking
the response property
/became optional for the status - breaking
the
///response's property type changed fromstringtobooleanfor status - breaking
the
///response's property type changed fromstringtobooleanfor status - info
added the optional property
/to the response with the status
- breaking
- info
added the optional property
///to the response with the status
- info