# Trade Interface

# Create an Order

API

    POST /openApi/spot/v1/trade/order

Parameters

Parameters Type Required Description
symbol string YES Trading pair, e.g., BTC-USDT
side string YES BUY/SELL
type string YES MARKET/LIMIT
timeInForce string NO IOC/POC
quantity float64 NO Original quantity, e.g., 0.1BTC
quoteOrderQty float64 NO Quote order quantity, e.g., 100USDT
price float64 NO Price, e.g., 10000USDT
recvWindow int64 NO Request valid time window value, Unit: milliseconds
timestamp int64 YES Timestamp of initiating the request, Unit: milliseconds

Notes

  • For limit orders, price is required.
  • For limit orders, either quantity or quoteOrderQty is required. When two parameters are passed at the same time, the server uses the parameter quantity first.
  • For buy-side market orders, quoteOrderQty is required.
  • For sell-side market orders, quantity is required.
  • Orders created by the interface will not be displayed on the APP and web pages.

Response

Parameters Type Description
symbol string Trading pair
orderId int64 Order ID
transactTime int64 Transaction timestamp
price string Price
origQty string Original quantity
executedQty string Executed quantity
cummulativeQuoteQty string Cumulative quote asset transacted quantity
status string Order status: NEW, PENDING, PARTIALLY_FILLED, FILLED, CANCELED, FAILED
type string MARKET/LIMIT
side string BUY/SELL
{
    "code": 0,
    "msg": "",
    "data": {
        "symbol": "XRP-USDT",
        "orderId": 1514090846268424192,
        "transactTime": 1649822362855,
        "price": "0.5",
        "origQty": "10",
        "executedQty": "0",
        "cummulativeQuoteQty": "0",
        "status": "PENDING",
        "type": "LIMIT",
        "side": "BUY"
    }
}

# Cancel an Order

API

    POST /openApi/spot/v1/trade/cancel

Parameters

Parameters Type Required Description
symbol string YES Trading pair, e.g., BTC-USDT
orderId int64 YES Order ID
recvWindow int64 NO Request valid time window value, Unit: milliseconds
timestamp int64 YES Timestamp of initiating the request, Unit: milliseconds

Response

Parameters Type Description
symbol string Trading pair
orderId int64 Order ID
price string Price
origQty string Original quantity
executedQty string Executed quantity
cummulativeQuoteQty string Cumulative quote asset transacted quantity
status string Order status: NEW, PENDING, PARTIALLY_FILLED, FILLED, CANCELED, FAILED
type string MARKET/LIMIT
side string BUY/SELL
{
    "code": 0,
    "msg": "",
    "data": {
        "symbol": "XRP-USDT",
        "orderId": 1514090846268424192,
        "price": "0.5",
        "origQty": "10",
        "executedQty": "0",
        "cummulativeQuoteQty": "0",
        "status": "CANCELED",
        "type": "LIMIT",
        "side": "BUY"
    }
}

# Query Orders

API

    GET /openApi/spot/v1/trade/query

Parameters

Parameters Type Required Description
symbol string YES Trading pair, e.g., BTC-USDT
orderId int64 YES Order ID
recvWindow int64 NO Request valid time window value, Unit: milliseconds
timestamp int64 YES Timestamp of initiating the request, Unit: milliseconds

Response

Parameters Type Description
symbol string Trading pair symbol
orderId int64 Order ID
price string Price
origQty string Original quantity
executedQty string Executed quantity
cummulativeQuoteQty string Cumulative quote asset transacted quantity
status string Order status: NEW, PENDING, PARTIALLY_FILLED, FILLED, CANCELED, FAILED
type string MARKET/LIMIT
side string BUY/SELL
time int64 Order timestamp
updateTime int64 Update timestamp
origQuoteOrderQty string Original quote order quantity
fee string Fee
feeAsset string Fee asset
{
    "code": 0,
    "msg": "",
    "data": {
        "symbol": "XRP-USDT",
        "orderId": 1514087361158316032,
        "price": "0.5",
        "origQty": "10",
        "executedQty": "0",
        "cummulativeQuoteQty": "0",
        "status": "CANCELED",
        "type": "LIMIT",
        "side": "BUY",
        "time": 1649821532000,
        "updateTime": 1649821543000,
        "origQuoteOrderQty": "0",
        "fee": "0",
        "feeAsset": "XRP"
    }
}

# Query Open Orders

API

    GET /openApi/spot/v1/trade/openOrders

Parameters

Parameters Type Required Description
symbol string YES Trading pair symbol, e.g., BTC-USDT
recvWindow int64 NO Request valid time window value, Unit: milliseconds
timestamp int64 YES Timestamp of initiating the request, Unit: milliseconds

Response

Parameters Type Description
orders array Order list,max length is 2000, refer to the table below for order fields
Parameters Type Description
symbol string Trading pair symbol
orderId int64 Order ID
price string Price
origQty string Original quantity
executedQty string Executed quantity
cummulativeQuoteQty string Cumulative quote asset transacted quantity
status string Order status: NEW, PENDING, PARTIALLY_FILLED, FILLED, CANCELED, FAILED
type string MARKET/LIMIT
side string BUY/SELL
time int64 Order timestamp
updateTime int64 Update timestamp
origQuoteOrderQty string Original quote order quantity
{
    "code": 0,
    "msg": "",
    "data": {
        "orders": [
            {
                "symbol": "XRP-USDT",
                "orderId": 1514073325788200960,
                "price": "0.5",
                "origQty": "20",
                "executedQty": "0",
                "cummulativeQuoteQty": "0",
                "status": "PENDING",
                "type": "LIMIT",
                "side": "BUY",
                "time": 1649818185647,
                "updateTime": 1649818185647,
                "origQuoteOrderQty": "0"
            }
        ]
    }
}

# Query Order History

API

    GET /openApi/spot/v1/trade/historyOrders

Parameters

Parameters Type Required Description
symbol string YES Trading pair, e.g., BTC-USDT
orderId int64 NO
startTime int64 NO Start timestamp, Unit: ms
endTime int64 NO End timestamp, Unit: ms
pageIndex int64 NO Page number, must greather than 0
pageSize int64 NO Page size,Max 100
recvWindow int64 NO Request valid time window value, Unit: milliseconds
timestamp int64 YES Timestamp of initiating the request, Unit: milliseconds

Notes

  • If orderId is set, orders >= orderId. Otherwise, the most recent orders will be returned.
  • If startTime and endTime are provided, orderId is not required.

Response

Parameters Type Description
orders array Order list, refer to the table below for order fields
Parameters Type Description
symbol string Trading pair symbol
orderId int64 Order ID
price string Price
origQty string Original Quantity
executedQty string Executed Quantity
cummulativeQuoteQty string Cumulative quote asset transacted quantity
status string Order status: NEW, PENDING, PARTIALLY_FILLED, FILLED, CANCELED, FAILED
type string MARKET/LIMIT
side string BUY/SELL
time int64 Order timestamp
updateTime int64 Update timestamp
origQuoteOrderQty string Original quote order quantity
{
    "code": 0,
    "msg": "",
    "data": {
        "orders": [
            {
                "symbol": "XRP-USDT",
                "orderId": 1502203895118561280,
                "price": "0.74011",
                "origQty": "0",
                "executedQty": "13.5",
                "cummulativeQuoteQty": "9.9927",
                "status": "FILLED",
                "type": "MARKET",
                "side": "BUY",
                "time": 1646988293000,
                "updateTime": 1646988293000,
                "origQuoteOrderQty": "10"
            }
        ]
    }
}

# Query Assets

API

    GET /openApi/spot/v1/account/balance

Parameters

Parameters Type Required Description
recvWindow int64 NO Request valid time window value, Unit: milliseconds
timestamp int64 YES Timestamp of initiating the request, Unit: milliseconds

Response

Parameters Type Description
balances array Asset list, element fields refer to the following table
Parameters Type Description
asset string Asset name
free string Available asset
locked string Freeze asset
{
    "code": 0,
    "msg": "",
    "ttl": 1,
    "data": {
        "balances": [
            {
                "asset": "USDT",
                "free": "16.73971130673954",
                "locked": "0"
            }
        ]
    }
}
Last Updated: 6/10/2022, 5:53:34 PM