It is recommended to use the POST /api/v3/hf/margin/order endpoint instead of this endpoint
Place order in the Cross-margin or Isolated-margin trading system. You can place two major types of order: Limit and market. Orders can only be placed if your account has sufficient funds. Once an order is placed, your funds will be put on hold for the duration of the order. The amount of funds on hold depends on the order type and parameters specified.
Please note that once your order enters the order book, the system will freeze the handling fees for the order ahead of time.Before placing orders, please be sure to fully understand the meaning of the parameters for each trading pair.
The maximum number of active orders per account is 2000, with a maximum of 200 active orders per trading pair.
Public order placement request parametersParam | Type | Mandatory | Description |
---|
clientOid | String | Yes | Client Order ID, unique identifier created by the user, the use of UUID is recommended |
symbol | String | Yes | symbol |
side | String | Yes | ‘buy’ or ‘sell’ |
type | String | No | Order type ‘limit’ and ‘market’, default is limit |
stp | String | No | self trade prevention is divided into four strategies: ‘CN’, ‘CO’, ‘CB’, and ‘DC’ |
marginModel | String | No | The type of trading, including cross (cross mode) and isolated (isolated mode). It is set at cross by default. |
autoBorrow | boolean | No | When Margin Account has inefficient balance, our system autoborrows inefficient assets and opens positions according to the lowest market interest rate. |
autoRepay | boolean | No | AutoPay allows returning borrowed assets when you close a position. Our system automatically triggers the repayment and the maximum repayment amount equals to the filled-order amount. |
Additional Request Parameters Required by ‘limit’ OrdersParam | Type | Mandatory | Description |
---|
price | String | Yes | Specify price for currency |
size | String | Yes | Specify quantity for currency |
timeInForce | String | No | Order timing strategy ‘GTC’, ‘GTT’, ‘IOC’, ‘FOK’ (the default is ‘GTC’) |
cancelAfter | long | No | Cancel after ‘n’ seconds, the order timing strategy is ‘GTT’ |
postOnly | boolean | No | passive order labels, this is disabled when the order timing strategy is ‘IOC’ or ‘FOK’ |
hidden | boolean | No | Hidden or not (not shown in order book) |
iceberg | boolean | No | Whether or not only visible portions of orders are shown in iceberg orders |
visibleSize | String | No | Maximum visible quantity in iceberg orders |
Additional request parameters required by ‘market’ ordersParam | Type | Mandatory | Description |
---|
size | String | No | (Select one out of two: ‘size’ or ‘funds’) |
funds | String | No | (Select one out of two: ‘size’ or ‘funds’) |
Hidden Orders and Iceberg Orders (Hidden & Iceberg)Hidden orders and iceberg orders can be set in advanced settings (iceberg orders are a special type of hidden order). When placing limit orders or stop limit orders, you can choose to execute according to either hidden orders or iceberg orders.Hidden orders are not shown in order books.Unlike hidden orders, iceberg orders are divided into visible and hidden portions. When engaging in iceberg orders, visible order sizes must be set. The minimum visible size for an iceberg order is 1/20 of the total order size.When matching, the visible portions of iceberg orders are matched first. Once the visible portions are fully matched, hidden portions will emerge. This will continue until the order is fully filled.The system will charge taker fees for hidden orders and iceberg orders.
If you simultaneously set iceberg orders and hidden orders, your order will default to an iceberg order for execution.
For limit price purchase orders, we will hold the amount of funds (price * size) required for your purchase order. Similarly, for limit price sell orders, we will also hold you sell order assets. When the transaction is executed, the service fees will be calculated. If you cancel a portion of a filled or unfilled order, then the remaining funds or amounts will be released and returned to your account. For market price buy/sell orders that require specific funds, we will hold the required funds in from your account. If only the size is specified, we may freeze (usually for a very short amount of time) all of the funds in your account prior to the order being filled or canceled.When an order placement request is successful (the matching engine receives the order) or denied (due to there being insufficient funds or illegal parameter values, etc.), the system will respond to the HTTP request. When an order is successfully placed, the order ID is returned. The order will be matched, which could result in it being fully or partially filled. When an order is fully or partially filled, the remaining portions of the order will be in an active state awaiting to be matched (this does not include IOC orders). Orders that are fully or partially filled (already canceled) will be put into the “done” state.Users that have subscribed to the Market Data Channel can use the order ID (orderId) and client ID (clientOid) to identify messages.Price Protection MechanismsPrice protection mechanisms ae enabled for order placements. Rules are detailed below:If the spot trading market order/limit order placed by the user can be directly matched with an order in the current order book, the system will judge whether deviation between the price corresponding to the transaction depth and the spread exceeds the threshold value (the threshold value can be obtained using the symbol API endpoint);
If it is exceeded, for limit orders, the order will be directly canceled;
If it is a market order, then the system will partially execute the order. The execution limit will be the order size within the price range corresponding to the threshold value. The remaining orders will not be filled.
For example: If the threshold value is 10%, when a user places a market price purchase order in the KCS/USDT trading market for 10,000 USDT (the selling price is currently 1.20000), the system will determine that after the order is completely filled, the final price will be 1.40000. (1.40000-1.20000)/1.20000=16.7%>10%. The threshold value is 1.32000. The user’s market price purchase order will be filled only to a maximum of 1.32000. The remaining order portions will not be matched with orders in the order book. Note: This feature may not be able to determine depth with complete accuracy. If your order is not completely filled, it may be because the portion exceeding the threshold value was not filled.