NAV Navbar
English简体中文

Change Log

2019-12-23

Rest API

2019-10-28

websocket

2019-10-22

Rest API

Trigger price of condition order must be:

2019-10-15

2019-10-14

2019-10-11

2019-09-27

Rest API

General API

General API Information

{
  "code": -1121,
  "msg": "Invalid symbol."
}

LIMITS

Order Count Limits * To keep an orderly market, jex imposes limits on the number of open orders per account. These limits are: * Maximum 200 open orders per contract per account; * Maximum 10 stop profit or stop orders per contract per account; * When placing a new order that causes these caps to be exceeded, it will be rejected with the message “has reach max order number [200|10]”.

Other instructions The number of contract orders sells for API is uniformly negative

Endpoint security type

Security Type Description
NONE Endpoint can be accessed freely.
TRADE Endpoint requires sending a valid API-Key and signature
USER_DATA Endpoint requires sending a valid API-Key and signature.
USER_STREAM Endpoint requires sending a valid API-Key.
MARKET_DATA Endpoint requires sending a valid API-Key.

SIGNED (TRADE and USER_DATA) Endpoint security

Timing security * A SIGNED endpoint also requires a parameter, timestamp, to be sent which should be the millisecond timestamp of when the request was created and sent. * An additional parameter, recvWindow, may be sent to specify the number of milliseconds after timestamp the request is valid for. If recvWindow is not sent, it defaults to 5000. * The logic is as follows: javascript if (timestamp < (serverTime + 1000) && (serverTime - timestamp) <= recvWindow) { // process request } else { // reject request } Serious trading is about timing. Networks can be unstable and unreliable, which can lead to requests taking varying amounts of time to reach the servers. With recvWindow, you can specify that the request must be processed within a certain number of milliseconds or be rejected by the server.

Key Value
apiKey vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A
secretKey NhqPtmdSJYdKjVHjA7PZj4Mge3R5YNiP1e3UZjInClVN65XAbvqqM6A7H5fATj0j
Parameters Value
symbol LTCBTC
side BUY
type LIMIT
timeInForce GTC
quantity 1
price 0.1
recvWindow 5000
timestamp 1499827319559

Example 1: As a query string

[linux]$ echo -n "symbol=LTCBTC&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=0.1&recvWindow=5000&timestamp=1499827319559" | openssl dgst -sha256 -hmac "NhqPtmdSJYdKjVHjA7PZj4Mge3R5YNiP1e3UZjInClVN65XAbvqqM6A7H5fATj0j"
(stdin)= c8db56825ae71d6d79447849e617115f4a920fa2acdcab2b053c4b2838bd6b71
  (HMAC SHA256)
  [linux]$ curl -H "X-JEX-APIKEY: vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A" -X POST 'https://www.jex.com/api/v1/order?symbol=LTCBTC&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=0.1&recvWindow=5000&timestamp=1499827319559&signature=c8db56825ae71d6d79447849e617115f4a920fa2acdcab2b053c4b2838bd6b71'

Example 2: As a request body

[linux]$ echo -n "symbol=LTCBTC&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=0.1&recvWindow=5000&timestamp=1499827319559" | openssl dgst -sha256 -hmac "NhqPtmdSJYdKjVHjA7PZj4Mge3R5YNiP1e3UZjInClVN65XAbvqqM6A7H5fATj0j"
(stdin)= c8db56825ae71d6d79447849e617115f4a920fa2acdcab2b053c4b2838bd6b71
(HMAC SHA256)
[linux]$ curl -H "X-JEX-APIKEY: vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A" -X POST 'https://www.jex.com/api/v1/order' -d 'symbol=LTCBTC&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=0.1&recvWindow=5000&timestamp=1499827319559&signature=c8db56825ae71d6d79447849e617115f4a920fa2acdcab2b053c4b2838bd6b71'

Example 3: Mixed query string and request body

[linux]$ echo -n "symbol=LTCBTC&side=BUY&type=LIMIT&timeInForce=GTCquantity=1&price=0.1&recvWindow=5000&timestamp=1499827319559" | openssl dgst -sha256 -hmac "NhqPtmdSJYdKjVHjA7PZj4Mge3R5YNiP1e3UZjInClVN65XAbvqqM6A7H5fATj0j"
(stdin)= 0fd168b8ddb4876a0358a8d14d0c9f3da0e9b20c5d52b2a00fcf7d1c602f9a77
(HMAC SHA256)
[linux]$ curl -H "X-JEX-APIKEY: vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A" -X POST 'https://www.jex.com/api/v1/order?symbol=LTCBTC&side=BUY&type=LIMIT&timeInForce=GTC' -d 'quantity=1&price=0.1&recvWindow=5000&timestamp=1499827319559&signature=0fd168b8ddb4876a0358a8d14d0c9f3da0e9b20c5d52b2a00fcf7d1c602f9a77'

Note that the signature is different in example 3. There is no & between "GTC" and "quantity=1".

Terminology

ENUM definitions

Symbol status (status):

Symbol type:

spot and option Order status (status):

contract status (status):

Order types (orderTypes, type):

Order side (side):

Time in force:

Kline/Candlestick chart intervals:

m -> minutes; h -> hours; d -> days; w -> weeks; M -> months

Rate limiters (rateLimitType)

Rate limit intervals (interval)

Endpoints for futures account

General endpoints

Test connectivity PING

GET /api/v1/ping

Test connectivity

Weight: 1

Parameters: NONE

Response

{}

Check server time

GET /api/v1/time

Get the current server time.

Weight: 1

Parameters: NONE

Response

{
  "serverTime": 1499827319595
}

Exchange information

GET /api/v1/exchangeInfo

Get the current trading rules and symbol information

Weight: 1

Parameters: NONE

Response

{
  "timezone": "UTC",
  "serverTime": 1551270414646,
  "rateLimits": [
    {
      "rateLimitType": "requestsWeight",
      "interval": "minute",
      "intervalNum": 1,
      "limit": 1200
    },
    {
      "rateLimitType": "orders",
      "interval": "second",
      "intervalNum": 1,
      "limit": 10
    },
    {
      "rateLimitType": "orders",
      "interval": "day",
      "intervalNum": 1,
      "limit": 100000
    },
    {
      "rateLimitType": "rawRequests",
      "interval": "minute",
      "intervalNum": 5,
      "limit": 5000
    }
  ],
  "optionSymbols": [
    {
      "symbol": "BTCCALLM",
      "status": "TRADING",
      "baseAsset": "月BTC看涨0226",
      "baseAssetPrecision": 0,
      "quoteAsset": "USDT",
      "quotePrecision": 2,
      "orderTypes": [
        "LIMIT"
      ],
      "icebergAllowed": false,
      "filters": [
        {
          "filterType": "PRICE_FILTER",
          "maxPrice": "100000"
        },
        {
          "filterType": "LOT_SIZE",
          "minQty": "0.00000000"
        }
      ]
    }
  ],
  "contractSymbols": [
    {
      "symbol": "BTCUSDT",
      "status": "TRADING",
      "baseAsset": "btc",
      "baseAssetPrecision": 4,
      "quoteAsset": "usdt",
      "quotePrecision": 0,
      "orderTypes": [
        "LIMIT",
        "MARKET"
      ],
      "icebergAllowed": false,
      "filters": [
        {
          "filterType": "PRICE_FILTER",
          "minPrice": "0.00000001000000000000",
          "maxPrice": "1000000.00000000000000000000"
        },
        {
          "filterType": "LOT_SIZE",
          "minQty": "0.00010000000000000000",
          "maxQty": "1000000.00000000000000000000"
        }
      ]
    }
  ],
  "spotSymbols": [
    {
      "symbol": "DASHUSDT",
      "status": "TRADING",
      "baseAsset": "DASH",
      "baseAssetPrecision": 4,
      "quoteAsset": "USDT",
      "quotePrecision": 2,
      "orderTypes": [
        "LIMIT"
      ],
      "icebergAllowed": false,
      "filters": [
        {
          "filterType": "PRICE_FILTER",
          "maxPrice": "100000"
        },
        {
          "filterType": "LOT_SIZE",
          "minQty": "1.00000000"
        }
      ]
    }
  ]
}

Exchange information for options

GET /api/v1/optionInfo

Get the current trading rules and symbol information

Weight: 1

Parameters: NONE

Response

[
  {
    "symbol": "BTCCALLM",
    "status": "TRADING",
    "type": "LONGS",
    "exertionTime": 1551344400000,
    "optionDesc": "www.jex.com",
    "canRelease": true,
    "releaseOption": {
      "convertRatio": 0.1,
      "assetMarginName": "BTC",
      "rateMargin": 0.1,
      "rateBase": 1,
      "assetBaseName": "JEX"
    }
  },
  {
    "symbol": "BTCPUTM",
    "status": "TRADING",
    "type": "SHORTS",
    "exertionTime": 1551172087000,
    "optionDesc": "www.jex.com",
    "canRelease": false,
    "releaseOption": null
  }
]

Depth information for options

GET /api/v1/option/depth

Weight:1
Parameters:

Name Type Mandatory Description
symbol STRING YES
limit INT NO Default 60; Max 60. Available:[5, 10, 20, 50, 60]

Response

{
  "lastUpdateId": 1027024,
  "bids": [
    [
      "4.00000000",     // PRICE
      "431.00000000",   // QTY
      []                // IGNORE.
    ]
  ],
  "asks": [
    [
      "4.00000200",
      "12.00000000",
      []
    ]
  ]
}

Recent trades for options

GET /api/v1/option/trades

Weight:1
Parameters:

Name Type Mandatory Description
symbol STRING YES
limit INT NO Default 60; max 60.

Response

[
  {
    "price": "81.230000000000000000",
    "qty": "0.001000000000000000",
    "time": 0
  },
  {
    "price": "81.230000000000000000",
    "qty": "0.000400000000000000",
    "time": 0
  },
  {
    "price": "81.240000000000000000",
    "qty": "0.001100000000000000",
    "time": 0
  }
]

Old trade lookup for options (MARKET_DATA)

GET /api/v1/option/historicalTrades

Weight:5
Parameters:

Name Type Mandatory Description
symbol STRING YES
limit INT NO Default 200; max 500.
fromId LONG NO TradeId to fetch from. Default gets most recent trades

Response

[
  {
    "id": "3489",
    "price": "0.00001457",
    "qty": "6",
    "time": 1551129538000,
    "buyerMaker": false
  },
  {
    "id": "3488",
    "price": "0.00001464",
    "qty": "2",
    "time": 1551129500000,
    "buyerMaker": true
  }
]

Kline data lookup for options

GET /api/v1/option/klines

Weight:1
Parameters:

Name Type Mandatory Description
symbol STRING YES
interval ENUM YES "1m":minute"3m": minute"5m": minute"15m":minute"30m":minute"1h":hour"2h":hour"4h":hour"6h":"12h":hour"1d":day"3d":day"1w":week
startTime LONG NO
endTime LONG NO
limit INT NO Default 500; max 1000.

Response

[
  [
    1499040000000,      // Open time
    "0.01634790",       // Open
    "0.80000000",       // High
    "0.01575800",       // Low
    "0.01577100",       // Close
    "148976.11427815",  // Volume
    1499644799999,      // Close time
    "2434.19055334",    // Quote asset volume
    308,                // Number of trades
    "1756.87402397",    // Taker buy base asset volume
    "28.46694368",      // Taker buy quote asset volume
    "17928899.62484339" // Ignore
  ]
]

Look up current average price for options

GET /api/v1/option/avgPrice Weight:1
Parameters:

Name Type Mandatory Description
symbol STRING YES

Response

{
  "mins": 5,
  "price": "9.35751834"
}

Look up 24hr ticker price change statistics for options

GET /api/v1/option/ticker/24hr Weight:
1 for a single symbol; 40 when the symbol parameter is omitted

Parameters:

Name Type Mandatory Description
symbol STRING NO

Response

{
  "symbol": "BNBBTC",
  "priceChange": "1.00000000",
  "priceChangePercent": "50.00000000",
  "weightedAvgPrice": "1.88",
  "lastPrice": "3.00000000",
  "bidPrice": "1.00000000",
  "bidQty": "5.00000000",
  "askPrice": "3.00000000",
  "askQty": "9.00000000",
  "openPrice": "2.00000000",
  "highPrice": "18.00000000",
  "lowPrice": "1.00000000",
  "volume": "8.00000000",
  "quoteVolume": "15.00000000",
  "openTime": 1551174049782,
  "closeTime": 1551173957144
  "exertionTime": 1574841600000,    //Expiry Date
  "performPrice": "0.0000",         //Performance Price
  "referencePrice": "9279.5200",    //Spot Price
  "exertionPrice": "7958.7100"      //Strike Price
}

OR

[
  {
    "symbol": "BNBBTC",
    "priceChange": "1.00000000",
    "priceChangePercent": "50.00000000",
    "weightedAvgPrice": "1.88",
    "lastPrice": "3.00000000",
    "bidPrice": "1.00000000",
    "bidQty": "5.00000000",
    "askPrice": "3.00000000",
    "askQty": "9.00000000",
    "openPrice": "2.00000000",
    "highPrice": "18.00000000",
    "lowPrice": "1.00000000",
    "volume": "8.00000000",
    "quoteVolume": "15.00000000",
    "openTime": 1551174049782,
    "closeTime": 1551173957144
    "exertionTime": 1574841600000,    //Expiry Date
    "performPrice": "0.0000",         //Performance Price
    "referencePrice": "9279.5200",    //Spot Price
    "exertionPrice": "7958.7100"      //Strike Price
  }
]

Look up price ticker for options

GET /api/v1/option/ticker/price

Weight:
1 for a single symbol; 2 when the symbol parameter is omitted Parameters:

Name Type Mandatory Description
symbol STRING NO

Response

{
  "symbol": "LTCBTC",
  "price": "4.00000200"
}

OR

[
  {
    "symbol": "LTCBTC",
    "price": "4.00000200"
  },
  {
    "symbol": "ETHBTC",
    "price": "0.07946600"
  }
]

## Look up Symbol order book ticker for options

`GET /api/v1/option/ticker/bookTicker`

Best price/qty on the order book for a symbol or symbols.
**Weight:**  
1 for a single symbol; **2** when the symbol parameter is omitted 
**Parameters:**  

Name | Type | Mandatory | Description
------------ | ------------ | ------------ | ------------
symbol | STRING | NO |

* If the symbol is not sent, prices for all symbols will be returned in an array.  

>**Response**    

```javascript
{
  "symbol": "LTCBTC",
  "bidPrice": "4.00000000",//Best price for buy
  "bidQty": "431.00000000",//QTY
  "askPrice": "4.00000200",//Best price for sell
  "askQty": "9.00000000"//QTY
}

OR

[
  {
    "symbol": "LTCBTC",
    "bidPrice": "4.00000000",
    "bidQty": "431.00000000",
    "askPrice": "4.00000200",
    "askQty": "9.00000000"
  },
  {
    "symbol": "ETHBTC",
    "bidPrice": "0.07946700",
    "bidQty": "9.00000000",
    "askPrice": "100000.00000000",
    "askQty": "1000.00000000"
  }
]

Account endpoints

Place order in options transaction(TRADE) (TRADE)

POST /api/v1/option/order (HMAC SHA256)

Weight:
1
Parameters:

Name Type Mandatory Description
symbol STRING YES
side ENUM YES
type ENUM YES LIMIT
quantity DECIMAL YES
price DECIMAL YES
newOrderRespType ENUM NO Specify response type ACK, RESULT; Default is ACK.
recvWindow LONG NO
timestamp LONG YES

Two choices for newOrderRespType

Response ACK: Returning speed is fast, trading information not included, less information

Response

{
  "symbol": "JEXBTC",
  "orderId": 28,
  "transactTime": 1507725176595
}

Response RESULT: Returning speed is slow, returning some information on taking order transaction

Response

{
  "symbol": "JEXBTC",
  "orderId": 2208,
  "transactTime": 1551184078060,
  "price": "0.00001464",
  "origQty": "1",
  "executedQty": "0",
  "cummulativeQuoteQty": "0.00000000",
  "status": "NEW",
  "timeInForce": "GTC",
  "type": "LIMIT",
  "side": "BUY"
}

Test placing order API of options transaction(TRADE)

POST /api/v1/option/order/test (HMAC SHA256)

Used for test placing order request, won’t be submitted to matchmaking trading engine

Weight: 1

Parameters:

Reference POST /api/v1/option/order

Response

{}

Check orders of options transaction(USER_DATA)

GET /api/v1/option/order (HMAC SHA256)

Check order status

Weight: 1

Parameters:

Name Type Mandatory Description
symbol STRING YES
orderId LONG YES

recvWindow | LONG | NO | timestamp | LONG | YES |

Response

{
  "symbol": "BTCCALLM",
  "orderId": "61292",
  "price": "2.00",
  "origQty": "1.00",
  "executedQty": "1.00",
  "cummulativeQuoteQty": "2.00",
  "status": "FILLED",
  "timeInForce": "GTC",
  "type": "LIMIT",
  "side": "BUY",
  "time": 1551184924000,
  "updateTime": 1551234873000,
  "working": true
}

Cancel order for options transaction(TRADE)

DELETE /api/v1/option/order (HMAC SHA256)

Weight: 1

Parameters:

Name Type Mandatory Description
symbol STRING YES
orderId LONG YES
recvWindow LONG NO
timestamp LONG YES

Response

{
  "symbol": "BTCCALLM",
  "orderId": 61299,
  "transactTime": 1551239198405,
  "price": "2.00",
  "origQty": "1",
  "executedQty": "0",
  "cummulativeQuoteQty": "0.00",
  "status": "CANCELED",
  "timeInForce": "GTC",
  "type": "LIMIT",
  "side": "BUY"
}

Check entry orders of options transaction of this account (USER_DATA)

GET /api/v1/option/openOrders (HMAC SHA256)

Weight: 5

Parameters:

Name Type Mandatory Description
symbol STRING YES
orderId LONG NO Only orders after this orderID will be returned. Only partial recent orders will be returned
startTime LONG NO
endTime LONG NO
limit INT NO Default 500; max 500.
recvWindow LONG NO
timestamp LONG YES

Response

[
  {
    "symbol": "JEXBTC",
    "orderId": "76",
    "price": "0.00001406",
    "origQty": "5.00000000",
    "executedQty": "0.00000000",
    "cummulativeQuoteQty": "0.00000000",
    "status": "NEW",
    "timeInForce": "GTC",
    "type": "LIMIT",
    "side": "BUY",
    "time": 1550659007000,
    "updateTime": 1550659007000,
    "working": true
  }
]

Historical options entry order of the account (USER_DATA)

GET /api/v1/option/historyOrders (HMAC SHA256)

Obtain trading history of specified trading pair

Weight: 5

Parameters:

Name Type Mandatory Description
symbol STRING YES
orderId LONG NO Only orders after this orderID will be returned. Only partial recent orders will be returned
startTime LONG NO
endTime LONG NO
limit INT NO Default 500; max 500.
recvWindow LONG NO
timestamp LONG YES

Response

[
  {
    "symbol": "BTCCALLM",
    "orderId": "7",
    "price": "0.02",
    "origQty": "2.00",
    "executedQty": "0.00",
    "cummulativeQuoteQty": "0.00",
    "status": "CANCELED",
    "timeInForce": "GTC",
    "type": "LIMIT",
    "side": "BUY",
    "time": 1550564707000,
    "updateTime": 1551085162000,
    "working": true
  }
]

Users short options(TRADE)

POST /api/v1/option/release (HMAC SHA256)

Short options of a specified trading pair

Weight: 1

Parameters:

Name Type Mandatory Description
symbol STRING YES
amount INT YES
recvWindow LONG NO
timestamp LONG YES

Response

{
  "assetMargin": "BTC",
  "assetBase": "JEX",
  "assetOption": "BTCCALLM",
  "releaseAmount": "17780",
  "backAmount": "0",
  "marginAmount": "177.8000",
  "baseAmount": "17780.000",
  "availableMargin": "999616.1163",
  "availableBase": "267400.836",
  "availableOption": "17785",
  "createdDate": 1551428811520
}

Users call options(TRADE)

POST /api/v1/option/back (HMAC SHA256)

Users call options of a specified trading pair

Weight: 1

Parameters:

Name Type Mandatory Description
symbol STRING YES
amount INT YES
recvWindow LONG NO
timestamp LONG YES

Response

{
  "assetMargin": "BTC",
  "assetBase": "JEX",
  "assetOption": "BTCCALLM",
  "releaseAmount": "17780",
  "backAmount": "2",
  "marginAmount": "177.7800",
  "baseAmount": "17778.000",
  "availableMargin": "999616.1363",
  "availableBase": "267402.836",
  "availableOption": "17783",
  "createdDate": 1551668068964
}

Options positions of the account(USER_DATA)

GET /api/v1/option/position (HMAC SHA256)

Get all the positions of one specified options trading pair

Weight: 2

Parameters:

Name Type Mandatory Description
symbol STRING NO
recvWindow LONG NO
timestamp LONG YES

Response

[
  {
    "name": "BTCCALLM",
    "amount": "5",
    "availAmount": "5",
    "profit": "15.99999996",
    "profitRate": "1.14285714",
    "cost": "2.80",
    "type": "CALL",
    "execTime": 1553763600000,
    "execrPrice": "5.00",
    "orderIndex": 0
  }
]

Short & Call options information of the account(USER_DATA)

GET /api/v1/option/info (HMAC SHA256)

Get the the short & call information of one option of the account

Weight: 1

Parameters:

Name Type Mandatory Description
symbol STRING YES
recvWindow LONG NO
timestamp LONG YES

Response

{
  "assetMargin": "BTC",
  "assetBase": "JEX",
  "assetOption": "BTCCALLM",
  "releaseAmount": "17780",
  "backAmount": "2",
  "marginAmount": "177.78",
  "baseAmount": "17778.00",
  "availableMargin": "999616.1363",
  "availableBase": "267402.836",
  "availableOption": "17783"
}

Historical records of Short & Call options of the account (USER_DATA)

GET /api/v1/option/record (HMAC SHA256)

Short & Call Records of one specified options or all options of the account

Weight: 5

Parameters:

Name Type Mandatory Description
symbol STRING YES
startTime LONG NO
endTime LONG NO
fromId LONG NO Only orders after this orderID will be returned. Only partial recent orders will be returned
limit INT NO Default 500; max 500.
recvWindow LONG NO
timestamp LONG YES

Response

[
  {
    "createdDate": 1551668069000,
    "name": "BTCCALLM",
    "status": 2,
    "amount": "2",
    "convertRatio": "0.10000000",
    "rateMargin": "0.10",
    "baseAmount": "2.000",
    "marginAmount": "0.0200",
    "assetMargin": "BTC",
    "assetBase": "JEX",
    "id": 21821
  }
]

Account information(USER_DATA)

GET /api/v1/account (HMAC SHA256)

Weight: 1

Parameters:

Name Type Mandatory Description
recvWindow LONG NO
timestamp LONG YES

Response

{
    "updateTime": 1523093528000
    "contractBalances": [
        {
            "asset": "usdt",
            "canDeposit": false,
            "canTrade": true,
            "canWithdraw": false,
            "free": "8144.0412",
            "locked": "1855.3288"
        }
    ],
    "optionBalances": [
        {
            "asset": "BCXBTC01",
            "canDeposit": false,
            "canTrade": true,
            "canWithdraw": false,
            "free": "0",
            "locked": "0"
        }
    ],
    "spotBalances": [
        {
            "asset": "BTC",
            "canDeposit": true,
            "canTrade": true,
            "canWithdraw": false,
            "free": "999616.1363",
            "locked": "0.7219"
        }
    ],
}

User Data Streams

Start user data stream (USER_STREAM)

POST /api/v1/userDataStream

Start a new user data stream. The stream will close after 60 minutes unless a keepalive is sent.

Weight: 1

Parameters: NONE

Response

{
  "listenKey": "pqia91ma19a5s61cv6a81va65sdf19v8a65a1a5s61cv6a81va65sdf19v8a65a1" //用于订阅的数据流名
}

Keepalive (USER_STREAM)

PUT /api/v1/userDataStream

Keepalive a user data stream to prevent a time out. User data streams will close after 60 minutes. It's recommended to send a ping about every 30 minutes.

Weight: 1

Parameters:

Name Type Mandatory Description
listenKey STRING YES

Response

{}

Close user data stream (USER_STREAM)

DELETE /api/v1/userDataStream

Weight: 1

Parameters:

Name Type Mandatory Description
listenKey STRING YES

Response

{}

Account updates

Response

{
  "e": "accountSpotInfo",       // Event type
  "E": 1499405658849,           // Event time
  "m": 0,                       // Fee rate of entry order 
  "t": 0,                       // Fee rate of taking order
  "u": 1499405658848,           // Time stamp of
  "B": [                        // Balance
    {
      "a": "LTC",               // Asset name
      "o": "1.57",              // Order Margin(Only Furtures)
      "p":  "0"               // Position Margin(Only Furtures )
      "f": "17366.18538083",    // Free amount
      "l": "0.00000000",        // Locked amount  
      "T": true,                // Can trade
      "W": true,                // Can withdraw
      "D": true,                // Can deposit
    },
    {
      "a": "BTC",
      "f": "10537.85314051",
      "l": "2.19464093",
      "T": true,                // Can trade
      "W": true,                // Can withdraw
       "D": true,               // Can deposit
 },
    {
    "T": true,                  // Can trade
    "W": true,                  // Can withdraw
    "D": true,                  // Can deposit
    "a": "ETH",
    "f": "17902.35190619",
    "l": "0.00000000"
    }
  ]
}

Update of orders

event type is execSpotReport AND execOptionReport AND execContractReport They respectively refers to the asset related event of spot、options、futures Event type

Possible executive type of contract(X field)

Response of spot and options:

{
  "E": 1499405658849,            // Event time
  "e": "execSpotReport",         // Event type
  "s": "JEXBTC",                 // Symbol
  "S": "BUY",                    // Order direction
  "q": "1.00000000",             //  Order quantity
  "p": "0.10264410",             //  Order price
  "X": "NEW",                    // Current order state
  "i": 4293153,                  // ID Order ID
  "z": "0.00000000",             //  Cumulative filled quantity
  "O": 1499405658657,            // Transaction time
  "Z": "0.00000000",             // Total transaction sum
}

Possible executive type of spot and options (X field):

Response contract :

{
  "E": 1499405658849,            // Event time
  "e": "execContractReport",     // Event type
  "s": "ETHBTC",                 // Symbol   (Not exist if refused)   
  "X": "NEW",                    // Current state of the order   
  "r": "NONE",                   // Refused reason of the order ( exist if refused)
  "i": 4293153,                  // Order ID
  "z": "0.00000000",             // Cumulative filled quantity (Not exist if refused)
  "Z": "0.00000000",             // Cumulative filled sum(Not exist if refused)

}

Possible executive type of contract(X field):

Response example if refused:

{
  E: 1571225843289
  X: "FAIL"
  e: "execContractReport"
  i: "4612616205276108403"
  r: "insufficient Available"  
}

if refused(R field)

Contract positions

Response:

{
    "E": 1553050064078,
    "e": "contractPositions",
    "p": [{
        "M": "100", // Largest leverage available 
        "R": "3903.99060000", // Used risk limits
        "S": "0", // sell Entrusted value
        "a": "20", // Auto-deleverage sequence
        "b": "0", // buy Entrusted value
        "c": "1301.33020000", //Open price
        "d": "longs", //Direction 
        "i": "0.05", //Initial margin
        "l": "-49.9759", //Close price
        "m": "0.005", //Maintenance Margin
        "n": "0", //Current entrusted value 
        "o": "4088.0779300000", //Margin
        "q": "3.0000",//Holding positions 
        "r": "900000",//Current risk value
        "s": "EOSUSDT",//Symbol
        "t": "3903.99060000", //Holding positions costs value 
        "v": "20.00"//Leverage
    }]
}

Web Socket Streams

General WSS information

Stream Detailed Stream information

Websocket Trade Streams

Stream Name: <symbol>@<tradeType>

Response


[{
  "e": "spotTrade",    //  Event type
  "E": 123456789,      // Event time
  "s": "JEXBTC",       // Symbol
  "t": 12345,          // Trade ID
  "p": "0.001",        // Price
  "q": "100",          // Quantity
  "T": 123456785,      // Trade time
  "m": true,           // Is the buyer the market maker?If true,this is a seller order,otherwise it is a buyer order.
},{...},...
]

tradeType

Websocket Kline/Candlestick Streams

Stream Name: <symbol>@<klineType>_<interval>

Response

{
  "e": "spotKline",     // Event type
  "E": 123456789,       // Event time
  "s": "JEXBTC",        // Symbol
  "k": {
    "t": 123400000,     // Kline start time
    "T": 123460000,     // Kline close time
    "s": "JEXBTC",      // Symbol
    "i": "1m",          // Interval
    "o": "0.0010",      // Open price
    "c": "0.0020",      // Close price
    "h": "0.0025",      // High price
    "l": "0.0015",      // Low price
    "v": "1000",        // Base asset volume
    "q": "1.0000",      // Quote asset volume
  }
}

klineType

-Support types - spotKline - optionKline - contractKline

Individual Symbol Mini Ticker Stream

Stream Name: <symbol>@<miniTickerType>

Response

{
    "e": "24hrSpotMiniTicker",   // Event type
    "E": 123456789,              // Event time
    "s": "JEXBTC",               // Symbol
    "c": "0.0025",               // Close price
    "h": "0.0025",               //  High  price
    "o": "0.0025",               // Open price
    "l": "0.0010",               // Low price
    "m": "10000",                // mark price(Only  contractMiniTicker have)
    "i": "10000",                // index price(Only contractMiniTicker have)
    "v": "10000",                // Base asset volume
    "q": "18"                    // Total traded quote asset volume
}

miniTickerType

All Market Mini Tickers Stream

StreamName: !<miniTickerType>@arr

Response


[
  {
     // Same as <symbol>@miniTicker payload
  }
]

miniTickerType

Individual Symbol Ticker Streams

Stream Name: <symbol>@<tickerType>

Response

{
  "e": "24hrSpotTicker",  // Event type
  "E": 123456789,         // Event time
  "s": "JEXBTC",          // Symbol
  "p": "0.0015",          // Price change in 24h
  "P": "250.00",          // Price change in 24h percent
  "c": "0.0025",          // Last price
  "h": "0.0025",          // Highest price in 24h
  "l": "0.0010",          // Lowest price in 24h
  "v": "10000",           // Trade volume in 24h
  "q": "18",              // Trade asset in 24h
  "m": "10000",           // mark price(Only  contractMiniTicker have)
  "i": "10000",           // index price(Only contractMiniTicker have)
  "O": 1234567890,        // TODO 0  Starting time
  "C": 86400000,          // TODO 3600*24*1000,milliseconds in 24h  ending time
}

All Market Tickers Stream

24hr rolling window ticker statistics for all symbols that changed in an array pushed every second.

StreamName: !<tickerType>@arr

Payload:

[
  {
     //Same as <symbol>@ticker payload
  }
]

Partial Book Depth Streams

Stream Name: <symbol>@<depthType><levels>

Response :

{
  "bids": [             // Buy
    [
      "0.0024",         // Price
      "10",             // Quantity
    ]
  ],
  "asks": [             // Sell
    [
      "0.0026",         // Price
      "100",            // Quantity
    ]
  ]
}

Diff. Depth Stream

Stream Name: <symbol>@<depthType>

Response :

{
  "e": "spotDepthUpdate", // Event type
  "s": "JEXBTC",          // Symbol
  "v": 157,               // Version to be updated
  "b": [                  // Changing depth for buyer
    [
      "0.0024",          // Price
      "10",              // Quantity
    ]
  ],
  "a": [                 // Changing depth for seller
    [
      "0.0026",          // Price
      "100",             // Quantity
    ]
  ]
}

Error Codes

JEX Rest接口(包括wapi)返回的错误包含两部分,错误码与错误信息. 错误码是大类,一个错误码可能对应多个不同的错误信息。 以下是一个完整错误码实例 javascript { "code":-1121, "msg":"Invalid symbol." }

-1

10xx - 服务器或网络问题

-1000 未知错误

-1001 连接断开

-1002 未授权

-1003 请求过多

-1006 非常规响应

-1007 超时

-1014 不支持的订单参数(组合)

-1015 订单太多

-1016 服务器下线

-1020 不支持的操作

-1021 时间同步问题

-1022 签名不正确

11xx - 请求内容中的问题

-1100 非法字符

-1101 参数太多

-1102 缺少必须参数

-1103 无法识别的参数

-1104 冗余参数

-1105 空参数(仅有参数名)

-1106 非必需参数

-1111 精度过高

-1112 空白的orderbook

-1114 错误地发送了不需要的TIF参数

-1115 无效的TIF参数

-1116 无效的订单类型

-1117 无效的订单方向

-1118 空白的newClientOrderId

-1119 空白的originalClientOrderId

-1120 无效的间隔(interval)

-1121 无效的交易对

-1125 无效的listenKey

-1127 开始结束时间错误

-1128 无效的可选参数组合

-1129 下单小数位错误

-2010 订单被拒绝

-2011 订单取消被拒绝

-2012 不存在的订单

-2013 不存在的订单

-2014 API Key格式无效

-2015 API Key权限,例如该Key不存在、请求并非来自允许的IP范围、或者该接口对应权限未开放

-2016 NO_TRADING_WINDOW

-1010 收到了错误消息

这个错误代码是由撮合引擎抛出的,引擎还会抛出2010和2011,具体原因需要参考下面列出的具体消息

错误消息 描述
"Unknown order sent." 找不到订单, (根据请求里发送的 orderId, clOrdId, origClOrdId)
"Duplicate order sent." 客户自定义的订单号重复了
"Market is closed." 该交易对交易关闭了
"Account has insufficient balance for requested action." 账户金额不足。
"Market orders are not supported for this symbol." 该交易对无法发起市价单
"Price * QTY is zero or less." 订单金额必须大于0
"IcebergQty exceeds QTY." 冰山订单中小订单的Quantity必须小于总的Quantity
"This action disabled is on this account." 账户被封禁,联系客服
"Unsupported order combination" orderType, timeInForce, stopPrice, 某些参数取某些值的时候另一些参数必须/不得提供。
"Cancel order is invalid. Check origClOrdId and orderId." 撤销订单必须提供origClOrdId或者orderId中的一个。
"Order would immediately match and take." LIMIT_MAKER 订单如果按照规则会成为Taker,就会报此错。

-6000

-7001

-7002

-7003

-7004

-7005

-7006

-7007

-7008

-7009

-7010

-7011

-7012

-7013

-7014

-7015

-7016

-7017

-7018

-7019

-7020

-8xxx 提现错误

-8000

-8001

-8002

-8003

-8004

-8005

-8006

-9xxx 订单未能通过过滤器

错误信息 描述
"Filter failure: PRICE_FILTER" 检查价格的上限、下限、步进间隔。
"Filter failure: PERCENT_PRICE" 检查订单中价格是否相对于过去N分钟的平均价格变动超过了百分之X。
"Filter failure: LOT_SIZE" 检查订单中数量的上限、下线、步进间隔。
"Filter failure: MIN_NOTIONAL" price * quantity,也就是订单金额,是否超过了最小值。
"Filter failure: MARKET_LOT_SIZE" 与LOT_SIZE含义一致,只是对市价单生效。
"Filter failure: MAX_NUM_ORDERS" 账户在该交易对下最多挂单数。
"Filter failure: EXCHANGE_MAX_NUM_ORDERS" 账户在全交易所最多的挂单数。

-9000 下单被拒