Create Orders
POST request with body parameters for Spot, Margin, CFD/Infinity, Perpetuals.
Last updated
POST request with body parameters for Spot, Margin, CFD/Infinity, Perpetuals.
Last updated
POST
https://api.liquid.com/orders
This section explains shareable body parameter for trading_type
of Spot
, Margin
, CFD/Infinity
, Perpetuals
.
For body parameters specific to a trading_type
, navigate further below.
Name | Type | Description |
---|---|---|
Nonce is not required in authentication’s payload if client_order_id is provided.
limit_post_only orders are limit orders that are only accepted if they do not immediately execute. limit_post _only orders never take liquidity.
limit_post_only order will not match with pre-existing orders. If your order would cause a match with a pre-existing order, your limit_post_only order will be cancelled.
limit_post_only order ensures that you pay the maker and not the taker fee.
Available leverage may be limited based on position and/or jurisdiction.
For spot trading (leverage_level=1), the funding_currency, if specified, has to equal to the product's quoted currency, for example to create an order in product BTCJPY, the funding currency has to be JPY.
For market_with_range:
price:
if order is buy: this order swipes out sell price ladders that has price lower than its price. If this action (partial order execution) bumps market ask price higher than its price, remaining unfulfilled quantity cancelled.
if order is sell: this order swipes out buy price ladders that has price higher than its price. If this action (partial order execution) bumps market ask price lower than its price, remaining unfulfilled quantity cancelled.
price_range:
if order is buy: get the current market ask, + the price_range, then we have price and apply above logic.
if order is sell: get the current market bid, - the price_range.
order_type
string
Supported values: limit
, market
, market_with_range
, trailing_stop
, limit_post_only
, stop
product_id
number
For BTCUSD product ID is 1
.
side
string
Supported values: buy
or sell
.
quantity
string
The quantity to buy or sell.
price
string
Price per unit of crypto. Only required if order_type is limit
, limit_post_only
, market_with_range
, stop
.
price_range
string
Only available if order_type
is market_with_range
. Using relative value of max deviation from best price on market (slippage control). Will override price parameter.
trailing_stop_type
string
Only available if order_type
is trailing_stop
. Supported values: price
, percentage
.
trailing_stop_value
string
Only available if order_type
is trailing_stop
. The distance (by percent or price) that the order should trail the market price.
client_order_id
string
Create a self-identified Order ID, a custom unique identifying JSON string up to 36 bytes with any content (as long as it is unique). User must avoid special characters besides "-". client_order_id must always be unique and not be reused.
Parameters
Optional
Description
leverage_level
No
Valid levels: 2
, 4
, 5
, 10
, 25
. Failure to supply these will result in an execution of spot
order with leverage of 1
trading_type
No
Supported value: margin
margin_type
Yes
Supported value:cross
or isolated,
defaults to isolated
. Only available if leverage_level is not 1
.
When "margin_type": "isolated"
the funding_currency
is the quote currency and does not support other funding currencies.
funding_currency
Conditional
Supported values are: SGD
, JPY
, USD
when "margin_type": "cross"
. When placing a BTCJPY order and account does not have JPY but has enough USD
balance, then specify "funding_currency": "USD"
. This will automatically switch margin_type
to cross
.
order_direction
Yes
Supported values: one_direction
, two_direction
, netout
. Defaults totwo_direction
.
When a user has an open Long position in one_direction
, placing a Short order will be rejected, and vice versa.
Use two_direction
to have an open Long position and an open Short position simultaneously.
Decrease the position sizes of a long position, place a short order with netout
.
take_profit
Yes
Only available if leverage_level is greater than 1.
If order side is buy
the value of take_profit
must be greater than the order's price.
If order side is sell
the value of take_profit
must be less than the order's price.
This same rule applies to orders that are executed at market. Take profit will be executed as a limit order.
stop_loss
Yes
Only available if leverage_level is greater than 1.
If order side is buy
the value of take_profit
must be less than the order's price.
If order side is sell
the value of take_profit
must be greater than the order's price.
This same rule applies to orders that are executed at market. Stop Loss will be executed as a market order.
Parameters
Optional
Description
leverage_level
No
Valid levels: 2
, 4
, 5
, 10
, 25
, 50
, 100
. Failure to supply these will result in an execution of spot
order with leverage of 1
trading_type
No
Supported values: cfd
margin_type
Yes
Supported value:cross
or isolated,
defaults to isolated
. Only available if leverage_level is not 1
.
When "margin_type": "isolated"
the funding_currency
is the quote currency and does not support other funding currencies.
funding_currency
Conditional
Supported values are: SGD
, JPY
, USD
when "margin_type": "cross"
. When placing a BTCJPY order and account does not have JPY but has enough USD
balance, then specify "funding_currency": "USD"
. This will automatically switch margin_type
to cross
.
order_direction
Yes
Supported values: one_direction
, two_direction
, netout
. Defaults totwo_direction
.
When a user has an open Long position in one_direction
, placing a Short order will be rejected, and vice versa.
Use two_direction
to have an open Long position and an open Short position simultaneously.
Decrease the position sizes of a long position, place a short order with netout
.
take_profit
Yes
Only available if leverage_level is greater than 1.
If order side is buy
the value of take_profit
must be greater than the order's price.
If order side is sell
the value of take_profit
must be less than the order's price.
This same rule applies to orders that are executed at market. Take profit will be executed as a limit order.
stop_loss
Yes
Only available if leverage_level is greater than 1.
If order side is buy
the value of take_profit
must be less than the order's price.
If order side is sell
the value of take_profit
must be greater than the order's price.
This same rule applies to orders that are executed at market. Stop loss will be executed as a market order.
Parameters
Optional
Description
leverage_level
No
Valid levels: 2
, 4
, 5
, 10
, 25
, 50
, 100
. Failure to supply these will result in an execution of spot
order with leverage of 1
trading_type
No
Supported values: perpetual
margin_type
Yes
Supported value:cross
or isolated,
defaults to isolated
. Only available if leverage_level is not 1
.
funding_currency
Conditional
Currency used to fund the trade with. Default is quoted currency (e.g a trade in BTCUSD product will use USD as the funding currency as default)
order_direction
Yes
Supported values: one_direction
, netout
. Defaults toone_direction
.
When a user has an open Long position in one_direction
, placing a Short order will be rejected, and vice versa.
Decrease the position sizes of a long position, place a short order with netout
.
take_profit
Yes
Only available if leverage_level is greater than 1.
If order side is buy
the value of take_profit
must be greater than the order's price.
If order side is sell
the value of take_profit
must be less than the order's price.
This same rule applies to orders that are executed at market. Take profit will be executed as a limit order.
stop_loss
Yes
Only available if leverage_level is greater than 1.
If order side is buy
the value of take_profit
must be less than the order's price.
If order side is sell
the value of take_profit
must be greater than the order's price.
This same rule applies to orders that are executed at market. Stop Loss will be executed as a market order.