Skip to main content

Place an Order

API Description

This interface allows users to place orders for futures trading, supporting various order types, including market, limit, and trigger-based orders.

Note: Place an Order is only available via RESTful API.

Precautions

  1. When placing orders, make sure all required parameters are accurately specified based on the selected order type.

  2. If an order has already been placed with a specific leverage for an instrument, placing a new order with a different leverage for the same instrument is not supported.

  3. This interface supports Stop Loss (SL) and Take Profit (TP) orders for both market and limit orders. If SL/TP needs to be added to an existing order, please use the dedicated interfaces: For stop loss and/or take profit setup, refer to Futures > Place Orders > Set SL/TP; For stop loss and/or take profit setup in batches, refer to Futures > Place Orders > Set SL/TP in Batches.

  4. To place a trailing stop loss/take profit order, please first place a market or limit order through this interface. After the order is filled, use a separate interface to set up the trailing stop loss/take profit. For interface setting up trailing stop loss/take profit, please refer to Futures > Place Orders > Set Trailing SL/TP.

  5. The position margin mode "positionModel" can not be changed while open orders exist. Once modified, the following error will be returned:

    {'code': 9050, 'msg': 'The margin mode cannot be changed for existing orders.'}

    To modify the position margin mode, please refer to Futures > Account & Assets > Set Margin Mode.

  6. If the request parameter ( positionType ) is set to planTrigger, the response parameter openId will be null, but the order will still be successfully placed and can be viewed on the webpage under "Open Orders". For interface to view open orders, go to Futures > Check Orders >Get Current Orders

    'openId': 'null'
  7. During the funding period, operations related to transaction such as placing orders or closing positions are not permitted. Attempting these actions will result in an error response. The funding process typically takes 30 to 40 seconds. It is recommended to wait at least 1 minute before retrying transaction related operations. For the exact funding fee schedule, please refer to the official webpage.

  8. CoinW allows traders to open both long and short positions on the same asset simultaneously, enabling hedging functionality and supporting the development of more flexible and sophisticated trading strategies.

  9. Returning an order ID does not mean the order has been filled. Returning an orderId only means that the system has accepted your order request, but the order may be canceled during matching — it does not guarantee execution. To confirm whether the order has been filled, please call the Check Orders APIs or Positions Information API's.

Authentication

This is a private interface and requires authentication. For details on using the RESTful API, refer to Introduction > Authentication & Code Snippet > Futures > RESTful Private Interface.

Request Method

POST

Endpoint

/v1/perpum/order

Frequency Limit

The frequency limit for this interface is 30 requests/second per user ID and 100000 requests/second per IP. In addition to this per-interface limit, a global rate limit is also enforced.

For detailed information on Global rate limits and API Rate Limiting Policy, please refer to the "Frequency Limit" section at click here

Request Parameters

ParameterMandatoryTypeDescription
instrumenttrueStringThe base currency of the instrument. (e.g., BTC or btc). This parameter is case-insensitive.
Note: For instruments that start with numbers (e.g., 1000PEPE), both uppercase and lowercase formats are valid.
directiontrueStringTrade direction:
long/short.
leveragetrueIntegerPosition Leverage
quantityUnittrueIntegerSpecifies the unit for order size:
0: Denominated in the quote currency (e.g., USDT in BTC-USDT),
1: Denominated in number of contracts,
2: Denominated in the base currency (e.g., BTC in BTC-USDT)
quantitytrueIntger/StringSpecifies order size based on quantityUnit:
If quantityUnit=0, the quantity is measured the quote currency (e.g., USDT in BTC-USDT),
If quantityUnit=1, the quantity is measured in number of contracts,
If quantityUnit=2, the quantity is measured in the base currency (e.g., BTC in BTC-USDT)
positionModeltrueIntegerPosition margin mode:
0: Isolated margin
1: Cross margin
positionTypetrueStringOrder type:
execute: Market order
plan: for plan different orders including limit order, triggered limit order, limit order with SL/TP, triggered limit order with SL/TP, triggered market orders, triggered market orders with SL/TP
planTrigger: planned trigger order
Note: For trailing SL/TP, submit a market/limit order first, then use a dedicated interface to set up trailing SL/TP.
openPricefalseBigDecimalThe specified order price.
Note: It's mandatory for plan orders.
stopLossPricefalseBigDecimalStop loss price
Note: It's mandatory for stop loss orders.
stopProfitPricefalseBigDecimalTake profit price
Note: It's mandatory for take profit orders.
triggerPricefalseBigDecimalTrigger price for a plan order
triggerTypefalseIntegerSpecifies order type once triggerPrice is met:
0: Limit order
1: Market order
Note: It's mandatory to specify "openPrice" for limit orders.
goldIdfalseIntegerGolden ID (User can ignore it)
thirdOrderIdfalseStringA custom order ID assigned by the user to uniquely distinguish different positions.
Note:1. Maximum length: 50 characters; only Latin letters, numbers, hyphens (-), and underscores (_) are permitted.2. This parameter is mandatory for batch order closing.
useAlmightyGoldfalseBooleanWhether to use Mega Coupon
1: true
0: false

Response Parameters

ParameterTypeDescription
dataLongOrder ID

Request Example

The following Python code shows how to place a stop loss/take profit limit order for BTC.

Note: For a complete code example, please refer to Introduction > Authentication & Code Snippet > Futures > RESTful Private Interface.

params = {
"instrument": "BTC",
"direction": "long",
"leverage": 2,
"quantityUnit": 0, # for USDT selection
"quantity": "100", # 100 USDT
"positionModel": 0, # isolated margin
"positionType": "plan",
"openPrice" : 83000,
"stopProfitPrice" : 95000,
"stopLossPrice" : 82000,
"thirdOrderId" : "placeSLTPorder"
}

api_url = "/v1/perpum/order"

method = "POST"
response_code, response_data = FuturesRestfulPrivate(params, api_url, method, sec_key, api_key) # function FuturesRestfulPrivate() is defined in section (Introduction > Authentication & Code Snippet > Futures > RESTful Private Interface)

Note: For a complete Java code example, please refer to Introduction > Authentication & Code Snippet > Futures > RESTful Private Interface.

Response Example

The following is an example response returned by the above Python request:

{'code': 0, 'data': {'value': '33308751556999718'}, 'msg': ''}