bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 42쪽 중 33쪽
| "true" or "false". default "false". Cannot be sent in Hedge Mode; cannot be sent with `closePosition`=`true` |
| price | DECIMAL | NO | |
| newClientOrderId | STRING | NO | A unique ID among open orders. Automatically generated if not sent. Can only be string following the rule: `^[\.A-Z\:/a-z0-9_-]{1,36}$` |
| stopPrice | DECIMAL | NO | Used with `STOP/STOP_MARKET` or `TAKE_PROFIT/TAKE_PROFIT_MARKET` orders. |
| closePosition | STRING | NO | `true`, `false`;Close-All, used with `STOP_MARKET` or `TAKE_PROFIT_MARKET`. |
| activationPrice | DECIMAL | NO | Used with `TRAILING_STOP_MARKET` orders, default as the latest price (supporting different `workingType`) |
| callbackRate | DECIMAL | NO | Used with `TRAILING_STOP_MARKET` orders, min 0.1, max 5 where 1 for 1% |
| workingType | ENUM | NO | stopPrice triggered by: "MARK\_PRICE", "CONTRACT\_PRICE". Default "CONTRACT\_PRICE" |
| priceProtect | STRING | NO | "TRUE" or "FALSE", default "FALSE". Used with `STOP/STOP_MARKET` or `TAKE_PROFIT/TAKE_PROFIT_MARKET` orders. |
| newOrderRespType | ENUM | NO | "ACK", "RESULT", default "ACK" |
| recvWindow | LONG | NO | |
| timestamp | LONG | YES | |
Additional mandatory parameters based on `type`:
| Type | Additional mandatory parameters |
| -------------------------------- | ---------------------------------- |
| `LIMIT` | `timeInForce`, `quantity`, `price` |
| `MARKET` | `quantity` |
| `STOP/TAKE_PROFIT` | `quantity`, `price`, `stopPrice` |
| `STOP_MARKET/TAKE_PROFIT_MARKET` | `stopPrice` |
| `TRAILING_STOP_MARKET` | `callbackRate` |
* Order with type `STOP`, parameter `timeInForce` can be sent (default `GTC`).
* Order with type `TAKE_PROFIT`, parameter `timeInForce` can be sent (default `GTC`).
* Condition orders will be triggered when:
* If parameter`priceProtect`is sent as true:
* when price reaches the `stopPrice` ,the difference rate between "MARK\_PRICE" and "CONTRACT\_PRICE" cannot be larger than the "triggerProtect" of the symbol
* "triggerProtect" of a symbol can be got from `GET /fapi/v1/exchangeInfo`
* `STOP`, `STOP_MARKET`:
* BUY: latest price ("MARK\_PRICE" or "CONTRACT\_PRICE") >= `stopPrice`
* SELL: latest price ("MARK\_PRICE" or "CONTRACT\_PRICE") <= `stopPrice`
* `TAKE_PROFIT`, `TAKE_PROFIT_MARKET`:
* BUY: latest price ("MARK\_PRICE" or "CONTRACT\_PRICE") <= `stopPrice`
* SELL: latest price ("MARK\_PRICE" or "CONTRACT\_PRICE") >= `stopPrice`
* `TRAILING_STOP_MARKET`:
* BUY: the lowest price after order placed <= `activationPrice`, and the latest price >= the lowest price \* (1 + `callbackRate`)
* SELL: the highest price after order placed >= `activationPrice`, and the latest price <= the highest price \* (1 - `callbackRate`)
* For `TRAILING_STOP_MARKET`, if you got such error code.\
`{"code": -2021, "msg": "Order would immediately trigger."}`\
means that the parameters you send do not meet the following requirements:
* BUY: `activationPrice` should be smaller than latest price.
* SELL: `activationPrice` should be larger than latest price.
* If `newOrderRespType` is sent as `RESULT`:
* `MARKET` order: the final FILLED result of the order will be return directly.
* `LIMIT` order with special `timeInForce`: the final status result of the order(FILLED or EXPIRED) will be returned directly.
* `STOP_MARKET`, `TAKE_PROFIT_MARKET` with `closePosition`=`true`:
* Follow the same rules for condition orders.
* If triggered,**close all** current long position( if `SELL`) or current short position( if `BUY`).
* Cannot be used with `quantity` paremeter
* Cannot be used with `reduceOnly` parameter
* In Hedge Mode,cannot be used with `BUY` orders in `LONG` position side. and cannot be used with `SELL` orders in `SHORT` position side
### Place Multiple Orders (TRADE)
> **Response:**
```
[
{
"clientOrderId": "testOrder",
"cumQty": "0",
"cumQuote": "0",
"executedQty": "0",
"orderId": 22542179,
"avgPrice": "0.00000",
"origQty": "10",
"price": "0",
"reduceOnly": false,
"side": "BUY",
"positionSide": "SHORT",
"status": "NEW",
"stopPrice": "9300", // please ignore when order type is TRAILING_STOP_MARKET
"symbol": "BTCUSDT",
"timeInForce": "GTC",
"type": "TRAILING_STOP_MARKET",
"origType": "TRAILING_STOP_MARKET",
"activatePrice": "9020", // activation price, only return with TRAILING_STOP_MARKET order
"priceRate": "0.3", // callback rate, only return with TRAILING_STOP_MARKET order
"updateTime": 1566818724722,
"workingType": "CONTRACT_PRICE",
"priceProtect": false // if conditional order trigger is protected
},
{
"code": -2022,
"msg": "ReduceOnly Order is rejected."
}
]
```
`POST /fapi/v1/batchOrders (HMAC SHA256)`
**Weight:** 5
**Parameters:**
| Name | Type | Mandatory | Description |
| ----------- | ---- | --------- | ------------------------ |
| batchOrders | LIST | YES | order list. Max 5 orders |
| recvWindow | LONG | NO | |
| timestamp | LONG | YES | |
**Where `batchOrders` is the list of order parameters in JSON**
| Name | Type | Mandatory | Description |
| ---------------- | ------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| symbol | STRING | YES | |
| side | ENUM | YES | |
| positionSide | ENUM | NO | Default `BOTH` for One-way Mode ; `LONG` or `SHORT` for Hedge Mode. It must be sent with Hedge Mode. |
| type | ENUM | YES | |
| timeInForce | ENUM | NO | |
| quantity | DECIMAL | YES | |
| reduceOnly | STRING | NO | "true" or "false". default "false". |
| price | DECIMAL | NO | |
| newClientOrderId | STRING | NO | A unique id among open orders. Automatically generated if not sent. Can only be string following the rule: `^[\.A-Z\:/a-z0-9_-]{1,36}$` |
| stopPrice | DECIMAL | NO | Used with `STOP/STOP_MARKET` or `TAKE_PROFIT/TAKE_PROFIT_MARKET` orders. |
| activationPrice | DECIMAL | NO | Used with `TRAILING_STOP_MARKET` orders, default as the latest price(supporting different `workingType`) |
| callbackRate | DECIMAL | NO | Used with `TRAILING_STOP_MARKET` orders, min 0.1, max 4 where 1 for 1% |
| workingType | ENUM | NO | stopPrice triggered by: "MARK\_PRICE", "CONTRACT\_PRICE". Default "CONTRACT\_PRICE" |
| priceProtect | STRING | NO | "TRUE" or "FALSE", default "FALSE". Used with `STOP/STOP_MARKET` or `TAKE_PROFIT/TAKE_PROFIT_MARKET` orders. |
| newOrderRespType | ENUM | NO | "ACK", "RESULT", default "ACK" |
* Paremeter rules are same with `New Order`
* Batch orders are processed concurrently, and the order of matching is not guaranteed.
* The order of returned contents for batch orders is the same as the order of the order list.
### Query Order (USER\_DATA)
> **Response:**
```
{
"avgPrice": "0.00000",
"clientOrderId": "abc",
"cumQuote": "0",
"executedQty": "0",
"orderId": 1917641,
"origQty": "0.40",
"origType": "TRAILING_STOP_MARKET",
"price": "0",
"reduceOnly": false,
"side": "BUY",
"positionSide": "SHORT",
"status": "NEW",
"stopPrice": "9300", // please ignore when order type is TRAILING_STOP_MARKET
"closePosition": false, // if Close-All
"symbol": "BTCUSDT",
"time": 1579276756075, // order time
"timeInForce": "GTC",
"type": "TRAILING_STOP_MARKET",
"activatePrice": "9020", // activation price, only return with TRAILING_STOP_MARKET order
"priceRate": "0.3", // callback rate, only return with TRAILING_STOP_MARKET order
"updateTime": 1579276756075, // update time
"workingType": "CONTRACT_PRICE",
"priceProtect": false // if conditional order trigger is protected
}
```
`GET /fapi/v1/order (HMAC SHA256)`
Check an order's status.
**Weight:** 1
* These orders will not be found:
* order status is `CANCELED` or `EXPIRED`, **AND**
* order has NO filled trade, **AND**
* created time + 7 days < current time
**Parameters:**
| Name | Type | Mandatory | Description |
| ----------------- | ------ | --------- | ----------- |
| symbol | STRING | YES | |
| orderId | LONG | NO | |
| origClientOrderId | STRING | NO | |
| recvWindow | LONG | NO | |
| timestamp | LONG | YES | |
Notes:
* Either `orderId` or `origClientOrderId` must be sent.
### Cancel Order (TRADE)
> **Response:**
```
{
"clientOrderId": "myOrder1",
"cumQty": "0",
"cumQuote": "0",
"executedQty": "0",
"orderId": 283194212,
"origQty": "11",
"origType": "TRAILING_STOP_MARKET",
"price": "0",
"reduceOnly": false,
"side": "BUY",
"positionSide": "SHORT",
"status": "CANCELED",
"stopPrice": "9300", // please ignore when order type is TRAILING_STOP_MARKET
"closePosition": false, // if Close-All
"symbol": "BTCUSDT",
"timeInForce": "GTC",
"type": "TRAILING_STOP_MARKET",
"activatePrice": "9020", // activation price, only return with TRAILING_STOP_MARKET order
"priceRate": "0.3", // callback rate, only return with TRAILING_STOP_MARKET order
"updateTime": 1571110484038,
"workingType": "CONTRACT_PRICE",
"priceProtect": false // if conditional order trigger is protected
}
```
`DELETE /fapi/v1/order (HMAC SHA256)`
Cancel an active order.
**Weight:** 1
**Parameters:**
| Name | Type | Mandatory | Description |
| ----------------- | ------ | --------- | ----------- |
| symbol | STRING | YES | |
| orderId | LONG | NO | |
| origClientOrderId | STRING | NO | |
| recvWindow | LONG | NO | |
| timestamp | LONG | YES | |
Either `orderId` or `origClientOrderId` must be sent.
### Cancel All Open Orders (TRADE)
> **Response:**
```
{
"code": "200",
"msg": "The operation of cancel all open order is done."
}
```
`DELETE /fapi/v1/allOpenOrders (HMAC SHA256)`
**Weight:** 1
**Parameters:**
| Name | Type | Mandatory | Description |
| ---------- | ------ | --------- | ----------- |
| symbol | STRING | YES | |
| recvWindow | LONG | NO | |
| timestamp | LONG | YES | |
### Cancel Multiple Orders (TRADE)
> **Response:**
```
[
{
"clientOrderId": "myOrder1",
"cumQty": "0",
"cumQuote": "0",
"executedQty": "0",
"orderId": 283194212,
"origQty": "11",
"origType": "TRAILING_STOP_MARKET",
"price": "0",
"reduceOnly": false,
"side": "BUY",
"positionSide": "SHORT",
"status": "CANCELED",
"stopPrice": "9300", // please ignore when order type is TRAILING_STOP_MARKET
"closePosition": false, // if Close-All
"symbol": "BTCUSDT",
"timeInForce": "GTC",
"type": "TRAILING_STOP_MARKET",
"activatePrice": "9020", // activation price, only return with TRAILING_STOP_MARKET order
"priceRate": "0.3", // callback rate, only return with TRAILING_STOP_MARKET order
"updateTime": 1571110484038,
"workingType": "CONTRACT_PRICE",
"priceProtect": false // if conditional order trigger is protected
},
{
"code": -2011,
"msg": "Unknown order sent."
}
]
```
`DELETE /fapi/v1/batchOrders (HMAC SHA256)`
**Weight:** 1
**Parameters:**
| Name | Type | Mandatory | Description |
| --------------------- | ------------- | --------- | -------------------------------------------------------------------------------------------------------- |
| symbol | STRING | YES | |
| orderIdList | LIST\<LONG> | NO | <p>max length 10<br>e.g. \[1234567,2345678]</p> |
| origClientOrderIdList | LIST\<STRING> | NO | <p>max length 10<br>e.g. \["my\_id\_1","my\_id\_2"], encode the double quotes. No space after comma.</p> |
| recvWindow | LONG | NO | |
| timestamp | LONG | YES | |
Either `orderIdList` or `origClientOrderIdList` must be sent.
### Auto-Cancel All Open Orders (TRADE)
> **Response:**
```
{
"symbol": "BTCUSDT",
"countdownTime": "100000"
}
```
Cancel all open orders of the specified symbol at the end of the specified countdown.
`POST /fapi/v1/countdownCancelAll (HMAC SHA256)`
**Weight:** 10
**Parameters:**
| Name | Type | Mandatory | Description |
| ------------- | ------ | --------- | -------------------------------------------------------- |
| symbol | STRING | YES | |
| countdownTime | LONG | YES | countdown time, 1000 for 1 second. 0 to cancel the timer |
| recvWindow | LONG | NO | |
| timestamp | LONG | YES | |
* The endpoint should be called repeatedly as heartbeats so that the existing countdown time can be canceled and replaced by a new one.
* Example usage:\
Call this endpoint at 30s intervals with an countdownTime of 120000 (120s).\
If this endpoint is not called within 120 seconds, all your orders of the specified symbol will be automatically canceled.\
If this endpoint is called with an countdownTime of 0, the countdown timer will be stopped.
* The system will check all countdowns **approximately every 10 milliseconds**, so please note that sufficient redundancy should be considered when using this function. We do not recommend setting the countdown time to be too precise or too small.
### Query Current Open Order (USER\_DATA)
> **Response:**
```
{
"avgPrice": "0.00000",
"clientOrderId": "abc",
"cumQuote": "0",
"executedQty": "0",
"orderId": 1917641,
"origQty": "0.40",
"origType": "TRAILING_STOP_MARKET",
"price": "0",
"reduceOnly": false,
"side": "BUY",
"positionSide": "SHORT",
"status": "NEW",
"stopPrice": "9300", // please ignore when order type is TRAILING_STOP_MARKET
"closePosition": false, // if Close-All
"symbol": "BTCUSDT",
"time": 1579276756075, // order time
"timeInForce": "GTC",
"type": "TRAILING_STOP_MARKET",
"activatePrice": "9020", // activation price, only return with TRAILING_STOP_MARKET order
"priceRate": "0.3", // callback rate, only return with TRAILING_STOP_MARKET order
"updateTime": 1579276756075,
"workingType": "CONTRACT_PRICE",
"priceProtect": false // if conditional order trigger is protected
}
```
`GET /fapi/v1/openOrder (HMAC SHA256)`
**Weight:** 1
**Parameters:**
| Name | Type | Mandatory | Description |
| ----------------- | ------ | --------- | ----------- |
| symbol | STRING | YES | |
| orderId | LONG | NO | |
| origClientOrderId | STRING | NO | |
| recvWindow | LONG | NO | |
| timestamp | LONG | YES | |
* Either`orderId` or `origClientOrderId` must be sent
* If the queried order has been filled or cancelled, the error message "Order does not exist" will be returned.
### Current All Open Orders (USER\_DATA)
> **Response:**
```
[
{
"avgPrice": "0.00000",
"clientOrderId": "abc",
"cumQuote": "0",
"executedQty": "0",
"orderId": 1917641,
"origQty": "0.40",
"origType": "TRAILING_STOP_MARKET",
"price": "0",
"reduceOnly": false,
"side": "BUY",
"positionSide": "SHORT",
"status": "NEW",
"stopPrice": "9300", // please ignore when order type is TRAILING_STOP_MARKET
"closePosition": false, // if Close-All
"symbol": "BTCUSDT",
"time": 1579276756075, // order time
"timeInForce": "GTC",
"type": "TRAILING_STOP_MARKET",
"activatePrice": "9020", // activation price, only return with TRAILING_STOP_MARKET order
"priceRate": "0.3", // callback rate, only return with TRAILING_STOP_MARKET order
"updateTime": 1579276756075, // update time
"workingType": "CONTRACT_PRICE",
"priceProtect": false // if conditional order trigger is protected
}
]
```
`GET /fapi/v1/openOrders (HMAC SHA256)`
Get all open orders on a symbol. **Careful** when accessing this with no symbol.
**Weight:** 1 for a single symbol; **40** when the symbol parameter is omitted
**Parameters:**
| Name | Type | Mandatory | Description |
| ---------- | ------ | --------- | ----------- |
| symbol | STRING | NO | |
| recvWindow | LONG | NO | |
| timestamp | LONG | YES | |
* If the symbol is not sent, orders for all symbols will be returned in an array.
### All Orders (USER\_DATA)
> **Response:**
```
[
{
"avgPrice": "0.00000",
"clientOrderId": "abc",
"cumQuote": "0",
"executedQty": "0",
"orderId": 1917641,
"origQty": "0.40",
"origType": "TRAILING_STOP_MARKET",
"price": "0",
"reduceOnly": false,
"side": "BUY",
"positionSide": "SHORT",
"status": "NEW",
"stopPrice": "9300", // please ignore when order type is TRAILING_STOP_MARKET
"closePosition": false, // if Close-All
"symbol": "BTCUSDT",
"time": 1579276756075, // order time
"timeInForce": "GTC",
"type": "TRAILING_STOP_MARKET",
"activatePrice": "9020", // activation price, only return with TRAILING_STOP_MARKET order
"priceRate": "0.3", // callback rate, only return with TRAILING_STOP_MARKET order
"updateTime": 1579276756075, // update time
"workingType": "CONTRACT_PRICE",
"priceProtect": false // if conditional order trigger is protected
}
]
```
`GET /fapi/v1/allOrders (HMAC SHA256)`
Get all account orders; active, canceled, or filled.
* These orders will not be found:
* order status is `CANCELED` or `EXPIRED`, **AND**
* order has NO filled trade, **AND**
* created time + 7 days < current time
**Weight:** 5
**Parameters:**
| Name | Type | Mandatory | Description |
| ---------- | ------ | --------- | ---------------------- |
| symbol | STRING | YES | |
| orderId | LONG | NO | |
| startTime | LONG | NO | |
| endTime | LONG | NO | |
| limit | INT | NO | Default 500; max 1000. |
| recvWindow | LONG | NO | |
| timestamp | LONG | YES | |
**Notes:**
* If `orderId` is set, it will get orders >= that `orderId`. Otherwise most recent orders are returned.
* The query time period must be less then 7 days( default as the recent 7 days).
### Futures Account Balance V2 (USER\_DATA)
> **Response:**
```
[
{
"accountAlias": "SgsR", // unique account code
"asset": "USDT", // asset name
"balance": "122607.35137903", // wallet balance
"crossWalletBalance": "23.72469206", // crossed wallet balance
"crossUnPnl": "0.00000000" // unrealized profit of crossed positions
"availableBalance": "23.72469206", // available balance
"maxWithdrawAmount": "23.72469206", // maximum amount for transfer out
"marginAvailable": true, // whether the asset can be used as margin in Multi-Assets mode
"updateTime": 1617939110373
}
]
```
`GET /fapi/v2/balance (HMAC SHA256)`
**Weight:** 5
**Parameters:**
| Name | Type | Mandatory | Description |
| ---------- | ---- | --------- | ----------- |
| recvWindow | LONG | NO | |
| timestamp | LONG | YES | |
### Account Information V4 (USER\_DATA)
> **Response:**
```
{
"feeTier": 0, // account commisssion tier
"canTrade": true, // if can trade
"canDeposit": true, // if can transfer in asset
"canWithdraw": true, // if can transfer out asset
"updateTime": 0,
"totalInitialMargin": "0.00000000", // total initial margin required with current mark price (useless with isolated positions), only for USDT asset
"totalMaintMargin": "0.00000000", // total maintenance margin required, only for USDT asset
"totalWalletBalance": "23.72469206", // total wallet balance, using BidRate/AskRate for value caculation under multi-asset mode
"totalUnrealizedProfit": "0.00000000", // total unrealized profit in USDT
"totalMarginBalance": "23.72469206", // total margin balance, using BidRate/AskRate for value caculation under multi-asset mode
"totalPositionInitialMargin": "0.00000000", // initial margin required for positions with current mark price, only for USDT asset
"totalOpenOrderInitialMargin": "0.00000000", // initial margin required for open orders with current mark price, only for USDT asset
"totalCrossWalletBalance": "23.72469206", // crossed wallet balance, using BidRate/AskRate for value caculation under multi-asset mode
"totalCrossUnPnl": "0.00000000", // unrealized profit of crossed positions in USDT
"availableBalance": "23.72469206", // available balance, only for USDT asset
"maxWithdrawAmount": "23.72469206" // maximum amount for transfer out, using BidRate for value caculation under multi-asset mode
"assets": [
{
"asset": "USDT", // asset name
"walletBalance": "23.72469206", // wallet balance
"unrealizedProfit": "0.00000000", // unrealized profit
"marginBalance": "23.72469206", // margin balance
"maintMargin": "0.00000000", // maintenance margin required
"initialMargin": "0.00000000", // total initial margin required with current mark price
"positionInitialMargin": "0.00000000", //initial margin required for positions with current mark price
"openOrderInitialMargin": "0.00000000", // initial margin required for open orders with current mark price
"crossWalletBalance": "23.72469206", // crossed wallet balance
"crossUnPn프로젝트로 돌아가기