Liquid API
Search
K
Comment on page

Create Orders

POST request with body parameters for Spot, Margin, CFD/Infinity, Perpetuals.
post
https://api.liquid.com
/orders
Create an Order
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.

Spot Order Type Examples

Limit Order

Request
Response
POST /orders/
// With Client Order ID //
{
"order_type": "limit",
"product_id": "27",
"side": "buy",
"quantity": "0.01",
"price": "100",
"client_order_id": "7b41d04a-1551-455a-939c-81c41c365ad9"
}
// Ensures order is a maker//
{
"order_type": "limit_post_only",
"product_id": "27",
"side": "buy",
"quantity": "0.44",
"price": "150"
}
// With Client Order ID
HTTP 200
{
"id": "2279447648",
"order_type": "limit",
"quantity": 0.01,
"disc_quantity": 0.0,
"iceberg_total_quantity": 0.0,
"side": "buy",
"filled_quantity": 0.0,
"price": 100.0,
"created_at": 1612233855,
"updated_at": 1612233855,
"status": "live",
"leverage_level": 1,
"source_exchange": "QUOINE",
"product_id": "27",
"margin_type": null,
"take_profit": null,
"stop_loss": null,
"trading_type": "spot",
"product_code": "CASH",
"funding_currency": "USD",
"crypto_account_id": null,
"currency_pair_code": "ETHUSD",
"average_price": 0.0,
"target": "spot",
"order_fee": 0.0,
"source_action": "manual",
"unwound_trade_id": null,
"trade_id": null,
"client_order_id": "7b41d04a1551-455a-939c-81c41c365ad9"
}
// Without Client Order ID
HTTP 200
{
"id": "2279447649",
"order_type": "limit",
"quantity": 0.22,
"disc_quantity": 0.0,
"iceberg_total_quantity": 0.0,
"side": "buy",
"filled_quantity": 0.0,
"price": 100.0,
"created_at": 1612233911,
"updated_at": 1612233911,
"status": "live",
"leverage_level": 1,
"source_exchange": "QUOINE",
"product_id": "27",
"margin_type": null,
"take_profit": null,
"stop_loss": null,
"trading_type": "spot",
"product_code": "CASH",
"funding_currency": "USD",
"crypto_account_id": null,
"currency_pair_code": "ETHUSD",
"average_price": 0.0,
"target": "spot",
"order_fee": 0.0,
"source_action": "manual",
"unwound_trade_id": null,
"trade_id": null,
"client_order_id": null
}
// Error when an order with "order_type": "limit_post_only"
// is unable to be a maker
HTTP 422
{
"errors": {
"order": [
"do_not_initiate"
]
}
}
// Error when Client Order ID is too long
HTTP 422
{
"errors": {
"client_order_id": ["invalid"]
}
}
// Duplicated Client Order ID //
HTTP 422
{
"errors": {
"client_order_id": ["exists"]
}
}

Market Order

Request
Response
POST /orders/
{
"order_type": "market",
"product_id": "27",
"side": "buy",
"quantity": "0.444"
}
// Market with range supports immediate-or-cancel (IOC)
// execution up to the stated price_range to
// control price slippage
{
"order_type": "market_with_range",
"product_id": "27",
"side": "sell",
"quantity": "10",
"price_range": "0.1"
}
HTTP 200
{
"id": "2279447550",
"order_type": "market",
"quantity": 0.444,
"disc_quantity": 0.0,
"iceberg_total_quantity": 0.0,
"side": "buy",
"filled_quantity": 0.444,
"price": 131.2,
"created_at": 1612171692,
"updated_at": 1612171692,
"status": "filled",
"leverage_level": 1,
"source_exchange": "QUOINE",
"product_id": "27",
"margin_type": null,
"take_profit": null,
"stop_loss": null,
"trading_type": "spot",
"product_code": "CASH",
"funding_currency": "USD",
"crypto_account_id": null,
"currency_pair_code": "ETHUSD",
"average_price": 0.0,
"target": "spot",
"order_fee": 0.0,
"source_action": "manual",
"unwound_trade_id": null,
"trade_id": null,
"client_order_id": null
}
// When trading ETHSGD but do not have any SGD balance
HTTP 422
{
"errors": {
"user": [
"not_enough_free_balance"
]
}
}

Stop Order

Request
Response
POST /orders/
{
"order_type": "stop",
"product_id": "27",
"side": "buy",
"quantity": "1.2",
"price": "140"
}
HTTP 200
{
"id": "2279447551",
"order_type": "stop",
"quantity": 1.2,
"disc_quantity": 0.0,
"iceberg_total_quantity": 0.0,
"side": "buy",
"filled_quantity": 0.0,
"price": 140.0,
"created_at": 1612172093,
"updated_at": 1612172093,
"status": "live",
"leverage_level": 1,
"source_exchange": "QUOINE",
"product_id": "27",
"margin_type": null,
"take_profit": null,
"stop_loss": null,
"trading_type": "spot",
"product_code": "CASH",
"funding_currency": "USD",
"crypto_account_id": null,
"currency_pair_code": "ETHUSD",
"average_price": 0.0,
"target": "spot",
"order_fee": 0.0,
"source_action": "manual",
"unwound_trade_id": null,
"trade_id": null,
"client_order_id": null
}
// When trading ETHSGD but do not have any SGD balance
HTTP 422
{
"errors": {
"user": [
"not_enough_free_balance"
]
}
}

Trailing-Stop Order

Request
Response
POST /orders/
// With 10% higher than market price //
{
"order_type": "trailing_stop",
"product_id": "27",
"side": "buy",
"quantity": "0.666",
"trailing_stop_type": "percentage",
"trailing_stop_value": "0.05"
}
// Absolute value of 100 higher than market price //
{
"order_type": "trailing_stop",
"product_id": "27",
"side": "buy",
"quantity": "0.666",
"trailing_stop_type": "price",
"trailing_stop_value": "100"
}
// With 10% higher than market price
HTTP 200
{
"id": "2279447670",
"order_type": "trailing_stop",
"quantity": 0.666,
"disc_quantity": 0.0,
"iceberg_total_quantity": 0.0,
"side": "buy",
"filled_quantity": 0.0,
"price": 131.3312,
"created_at": 1612237942,
"updated_at": 1612237942,
"status": "live",
"leverage_level": 1,
"source_exchange": "QUOINE",
"product_id": "27",
"margin_type": null,
"take_profit": null,
"stop_loss": null,
"trading_type": "spot",
"product_code": "CASH",
"funding_currency": "USD",
"crypto_account_id": null,
"currency_pair_code": "ETHUSD",
"average_price": 0.0,
"target": "spot",
"order_fee": 0.0,
"source_action": "manual",
"unwound_trade_id": null,
"trade_id": null,
"client_order_id": null
}
// Absolute value of 100 higher than market price
HTTP 200
{
"id": "2279447671",
"order_type": "trailing_stop",
"quantity": 0.666,
"disc_quantity": 0.0,
"iceberg_total_quantity": 0.0,
"side": "buy",
"filled_quantity": 0.0,
"price": 231.2,
"created_at": 1612238002,
"updated_at": 1612238002,
"status": "live",
"leverage_level": 1,
"source_exchange": "QUOINE",
"product_id": "27",
"margin_type": null,
"take_profit": null,
"stop_loss": null,
"trading_type": "spot",
"product_code": "CASH",
"funding_currency": "USD",
"crypto_account_id": null,
"currency_pair_code": "ETHUSD",
"average_price": 0.0,
"target": "spot",
"order_fee": 0.0,
"source_action": "manual",
"unwound_trade_id": null,
"trade_id": null,
"client_order_id": null
}
// When trading ETHSGD but do not have any SGD balance
HTTP 422
{
"errors": {
"user": [
"not_enough_free_balance"
]
}
}

Margin Orders Additional Body Parameters

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_profitmust 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_profitmust 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.

Limit Order

Request
Response
POST /orders/
// With Client Order ID //
{
"order_type": "limit",
"product_id": "27",
"side": "buy",
"price": "120",
"quantity": "0.333",
"leverage_level": "25",
"trading_type": "margin",
"margin_type": "isolated",
"funding_currency": "USD",
"order_direction": "netout",
"take_profit": "150",
"stop_loss": "100",
"client_order_id": "7b41d04a-1551-455a-939c-81c41c365ad9"
}
// Ensures order is a maker//
{
"order_type": "limit_post_only",
"product_id": "27",
"side": "buy",
"quantity": "0.44",
"price": "150",
"leverage_level": "25",
"trading_type": "margin"
}
HTTP 200
{
"id": "2279447576",
"order_type": "limit",
"quantity": 0.333,
"disc_quantity": 0.0,
"iceberg_total_quantity": 0.0,
"side": "buy",
"filled_quantity": 0.0,
"price": 120.0,
"created_at": 1612175439,
"updated_at": 1612175439,
"status": "live",
"leverage_level": 25,
"source_exchange": "QUOINE",
"product_id": "27",
"margin_type": "isolated",
"take_profit": 150.0,
"stop_loss": 100.0,
"trading_type": "margin",
"product_code": "CASH",
"funding_currency": "USD",
"crypto_account_id": null,
"currency_pair_code": "ETHUSD",
"average_price": 0.0,
"target": "open",
"order_fee": 0.0,
"source_action": "netout_open",
"unwound_trade_id": null,
"trade_id": null,
"client_order_id": "7b41d04a-1551-455a-939c-81c41c365ad9"
}
// Error when trading BTCJPY but account does not have enough JPY balance.
// If account has enough USD balance, provide "funding_currency": "USD"
// to use USD to trade and avoid this error
HTTP 422
{
"errors": {
"user": [
"not_enough_free_balance"
]
}
}
// Error when trading BTCJPY and provided "margin_type": "isolated" and
// "funding_currency": "USD" (if have enough USD balance), avoid this by
// changing to "margin_type": "cross" or simply just removing "margin_type"
HTTP 422
{
"errors": {
"order": [
"isolated_feature_is_disabled_for_multi_currency"
]
}
}
// Error when not proving valid leverage levels
HTTP 422
{
"errors": {
"leverage_level": [
"not_valid"
]
}
}
// Error when trying to place a short order but current long position exist
// and long position was an order with "order_direction": "one_direction", avoid
// this by using "order_direction": "two_direction" or "order_direction": "netout"
HTTP 422
{
"errors": {
"user": [
"have_another_direction_trade"
]
}
}
// Error when Client Order ID is too long
HTTP 422
{
"errors": {
"client_order_id": ["invalid"]
}
}
// Duplicated Client Order ID //
HTTP 422
{
"errors": {
"client_order_id": ["exists"]
}
}
// Error when an order with "order_type": "limit_post_only" is unable to be a maker
HTTP 422
{
"errors": {
"order": [
"do_not_initiate"
]
}
}

Market Order

Request
Response
POST /orders/
{
"order_type": "market",
"product_id": "27",
"side": "buy",
"quantity": "0.444",
"leverage_level": "25",
"trading_type": "margin",
"margin_type": "cross",
"funding_currency": "USD",
"order_direction": "netout",
"take_profit": "200",
"stop_loss": "100"
}
// Market with range supports immediate-or-cancel (IOC)
// execution up to the stated price_range to
// control price slippage
{
"order_type": "market_with_range",
"product_id": "27",
"side": "sell",
"quantity": "10",
"price_range": "0.1",
"leverage_level": "25",
"trading_type": "margin"
}
HTTP 200
{
"id": "2279447554",
"order_type": "market",
"quantity": 0.444,
"disc_quantity": 0.0,
"iceberg_total_quantity": 0.0,
"side": "buy",
"filled_quantity": 0.444,
"price": 131.2,
"created_at": 1612172933,
"updated_at": 1612172933,
"status": "filled",
"leverage_level": 25,
"source_exchange": "QUOINE",
"product_id": "27",
"margin_type": "cross",
"take_profit": 200.0,
"stop_loss": 100.0,
"trading_type": "margin",
"product_code": "CASH",
"funding_currency": "USD",
"crypto_account_id": null,
"currency_pair_code": "ETHUSD",
"average_price": 0.0,
"target": "open",
"order_fee": 0.0,
"source_action": "netout_open",
"unwound_trade_id": null,
"trade_id": "97441404",
"client_order_id": null
}
// Error when trading BTCJPY but account does not have enough JPY balance.
// If account has enough USD balance, provide "funding_currency": "USD"
// to use USD to trade and avoid this error //
HTTP 422
{
"errors": {
"user": [
"not_enough_free_balance"
]
}
}
// Error when trading BTCJPY and provided "margin_type": "isolated" and
// "funding_currency": "USD" (if have enough USD balance), avoid this by
// changing to "margin_type": "cross" or simply just removing "margin_type"
HTTP 422
{
"errors": {
"order": [
"isolated_feature_is_disabled_for_multi_currency"
]
}
}
// Error when not proving valid leverage levels //
HTTP 422
{
"errors": {
"leverage_level": [
"not_valid"
]
}
}
// Error when trying to place a short order but current long position exist
// and long position was an order with "order_direction": "one_direction", avoid
// this by using "order_direction": "two_direction" or "order_direction": "netout"
HTTP 422
{
"errors": {
"user": [
"have_another_direction_trade"
]
}
}

Stop Order

Request
Response
POST /orders/
{
"order_type": "stop",
"product_id": "27",
"side": "buy",
"price": "120",
"quantity": "0.333",
"leverage_level": "25",
"trading_type": "margin",
"margin_type": "cross",
"funding_currency": "USD",
"order_direction": "netout",
"take_profit": "150",
"stop_loss": "100"
}
HTTP 200
{
"id": "2279447577",
"order_type": "stop",
"quantity": 0.333,
"disc_quantity": 0.0,
"iceberg_total_quantity": 0.0,
"side": "buy",
"filled_quantity": 0.0,
"price": 120.0,
"created_at": 1612176682,
"updated_at": 1612176682,
"status": "live",
"leverage_level": 25,
"source_exchange": "QUOINE",
"product_id": "27",
"margin_type": "cross",
"take_profit": 150.0,
"stop_loss": 100.0,
"trading_type": "margin",
"product_code": "CASH",
"funding_currency": "USD",
"crypto_account_id": null,
"currency_pair_code": "ETHUSD",
"average_price": 0.0,
"target": "open",
"order_fee": 0.0,
"source_action": "netout_open",
"unwound_trade_id": null,
"trade_id": null,
"client_order_id": null
}
// Error when "side: "buy" and "price: "90" and "stop_loss": "100",
// avoid this by providing a stop_loss that is lower than 90.
HTTP 422
{
"errors": {
"order": [
"new_stop_loss_price_greater_than_price"
]
}
}
// Error when "side: "buy" and "price: "150" and "take_profit": "100",
// avoid this by providing a take_profit that is higher than 150.
HTTP 422
{
"errors": {
"order": [
"new_take_profit_price_less_than_price"
]
}
}
// Error when trading BTCJPY but account does not have enough JPY balance.
// If account has enough USD balance, provide "funding_currency": "USD"
/// to use USD to trade and avoid this error
HTTP 422
{
"errors": {
"user": [
"not_enough_free_balance"
]
}
}
// Error when trading BTCJPY and provided "margin_type": "isolated" and
// "funding_currency": "USD" (if have enough USD balance), avoid this by
// changing to "margin_type": "cross" or simply just removing "margin_type"
HTTP 422
{
"errors": {
"order": [
"isolated_feature_is_disabled_for_multi_currency"
]
}
}
// Error when not proving valid leverage levels //
HTTP 422
{
"errors": {
"leverage_level": [
"not_valid"
]
}
}
// Error when trying to place a short order but current long position exist
// and long position was an order with "order_direction": "one_direction", avoid
// this by using "order_direction": "two_direction" or "order_direction": "netout"
HTTP 422
{
"errors": {
"user": [
"have_another_direction_trade"
]
}
}

Trailing-Stop Order

Request
Response
POST /orders/
// With 10% higher than market price //
{
"order_type": "trailing_stop",
"product_id": "27",
"side": "buy",
"quantity": "0.666",
"leverage_level": "2",
"trading_type": "margin",
"trailing_stop_type": "percentage",
"trailing_stop_value": "0.10"
}
// With absolute value of 100 higher than market price //
{
"order_type": "trailing_stop",
"product_id": "27",
"side": "buy",
"quantity": "0.666",
"leverage_level": "2",
"trading_type": "margin",
"trailing_stop_type": "price",
"trailing_stop_value": "100"
}
// With 10% higher than market price
HTTP 200
{
"id": "2279447585",
"order_type": "trailing_stop",
"quantity": 0.666,
"disc_quantity": 0.0,
"iceberg_total_quantity": 0.0,
"side": "buy",
"filled_quantity": 0.0,
"price": 131.3312,
"created_at": 1612178876,
"updated_at": 1612178876,
"status": "live",
"leverage_level": 2,
"source_exchange": "QUOINE",
"product_id": "27",
"margin_type": "cross",
"take_profit": 0.0,
"stop_loss": 0.0,
"trading_type": "margin",
"product_code": "CASH",
"funding_currency": "USD",
"crypto_account_id": null,
"currency_pair_code": "ETHUSD",
"average_price": 0.0,
"target": "open",
"order_fee": 0.0,
"source_action": "manual",
"unwound_trade_id": null,
"trade_id": null,
"client_order_id": null
}
// With absolute value of 100 higher than market price
HTTP 200
{
"id": "2279447584",
"order_type": "trailing_stop",
"quantity": 0.666,
"disc_quantity": 0.0,
"iceberg_total_quantity": 0.0,
"side": "buy",
"filled_quantity": 0.0,
"price": 231.2,
"created_at": 1612178843,
"updated_at": 1612178843,
"status": "live",
"leverage_level": 2,
"source_exchange": "QUOINE",
"product_id": "27",
"margin_type": "cross",
"take_profit": 0.0,
"stop_loss": 0.0,
"trading_type": "margin",
"product_code": "CASH",
"funding_currency": "USD",
"crypto_account_id": null,
"currency_pair_code": "ETHUSD",
"average_price": 0.0,
"target": "open",
"order_fee": 0.0,
"source_action": "manual",
"unwound_trade_id": null,
"trade_id": null,
"client_order_id": null
}
// Error when trading BTCJPY but account does not have enough JPY balance.
// If account has enough USD balance, provide "funding_currency": "USD"
// to use USD to trade and avoid this error
HTTP 422
{