Skip to main content

Public HTTP API

Check Server Time

GET /v1/time

Test connectivity to the Rest API and get the current server time.

Response:

{
"serverTime": 1655815554336
}

ExchangeInfo

GET /v1/exchangeInfo

Current exchange trading rules and markets information

Response

{
"assets": [ // assets information
{
"fullName": "USD Coin",
"name": "USDC"
},
{
"fullName": "Bitcoin",
"name": "BTC"
},
{
"fullName": "Ethereum",
"name": "ETH"
}
],
"dealerInfo": {
"creditDecimals": 6,
"insuranceAmount": "75222.0595",
"paperDecimals": 18,
"totalTraders": 41,
"totalVolume": "329816287.00515376"
},
"eip712": {
"EIP712_DOMAIN_SEPARATOR": "0xd7b17a5a26dec9eba4db2f741253b269c1d187011b4c05285fd0df213ca42084",
"EIP712_DOMAIN_TYPEHASH": "0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f",
"EIP712_ORDER_TYPE": "0x6ce22f1be37c24a60b088bc91a456d1ae077db421fa72ffe85abd6af245899e4",
"chainId": 97,
"domainName": "JOJO",
"domainVersion": "1",
"verifyingContract": "0xCA5c790268C06fa2Ed8850023Ac85EA55E1a7C24"
},
"gasFeeInfo": {
"gasLimit": "296605.2173913",
"gasPrice": "322500000",
"lastEthIndexPrice": "1900.15075976",
"waiveGasFeeMinimumAmount": "288.506774458558599871"
},
"markets": [
{
"OrderType": [
"LIMIT",
"MARKET"
],
"baseAssetName": "BTC",
"desc": "DESC",
"filters": [
{
"filterType": "PRICE_FILTER",
"maxPrice": "100000",
"minPrice": "1",
"tickSize": "0.1"
},
{
"filterType": "AMOUNT_FILTER",
"maxAmount": "1000",
"minAmount": "0.001",
"stepSize": "0.001"
},
{
"filterType": "MARKET_AMOUNT_FILTER",
"maxAmount": "1000",
"minAmount": "0.001",
"stepSize": "0.001"
},
{
"filterType": "MAX_OPEN_ORDERS_FILTER",
"limit": 200
}
],
"fundingIntervalSeconds": 28800,
"id": "btcusdc",
"indexPriceSource": {
"text": "Index Price Source",
"url": "https://google.com"
},
"liquidatedAt": null,
"liquidationLeverage": "33.33",
"makerFee": "0.0001",
"markPriceSource": {
"text": "Mark Price Source",
"url": "https://google.com"
},
"maxExposure": "1000000",
"maxLeverage": 20,
"pair": "btcusdc",
"perpetualContractAddress": "0x00De48310d77A4d56aa400248b0B1613508f5B73",
"quoteAssetName": "USDC",
"stage": "TRADING",
"status": "TRADING",
"suspendedAt": null,
"symbol": "btcusdc",
"takerFee": "0.0005",
"timeInForce": [
"GTC",
"IOC",
"FOK",
"POST_ONLY"
]
}
],
"rateLimits": [
{
"intervalSeconds": 60,
"limit": 2400,
"name": "COMMON"
},
{
"intervalSeconds": 60,
"limit": 1200,
"name": "ORDER"
}
],
"serverTime": 1655815563277,
"timezone": "UTC"
}

Order Book

GET /v1/orderbook

Parameters:

ParameterTypeMandatoryDescription
marketIdSTRINGYESMarket id
limitINTEGERNODepth. Valid values are 10,20,50,100,500,1000. Default 500

Response

{
"asks": [
[
"30059",
"0.151"
],
[
"30058",
"0.091"
],
[
"30057",
"0.259"
],
...
],
"bids": [
[
"29986",
"0.037"
],
[
"29985",
"0.038"
],
...
],
"sequence": 523
}

Get Market Recent Trades

GET /v1/trades

Parameters:

ParameterTypeMandatoryDescription
marketIdSTRINGYESMarket id
limitINTEGERNOResult trades count, default is 100, maximum is 500

Response

[
{
"id": 181,
"price": "30020",
"amount": "0.023",
"quoteAmount": "690.46",
"time": 1655822152553,
"isBuyerMaker": false,
"status": "SETTLED"
},
{
"id": 180,
"price": "30017",
"amount": "0.003",
"quoteAmount": "90.051",
"time": 1655822152553,
"isBuyerMaker": false,
"status": "SETTLED"
},
{
"id": 218,
"price": "30007",
"amount": "0.058",
"quoteAmount": "1740.406",
"time": 1655822832751,
"isBuyerMaker": true,
"status": "SETTLED"
},
...
]

Get Market Historical Trades

GET /v1/historicalTrades

Parameters:

ParameterTypeMandatoryDescription
marketIdSTRINGYESMarket id
limitINTEGERNOResult trades count, Default 100, max 500
fromIdINTEGERNOTradeId to fetch from(if pass fromId, will respond trades that order by ASC). Default gets most recent trades.

Response

[
{
"id": 181,
"price": "30020",
"amount": "0.023",
"quoteAmount": "690.46",
"time": 1655822152553,
"isBuyerMaker": false,
"status": "SETTLED"
},
{
"id": 180,
"price": "30017",
"amount": "0.003",
"quoteAmount": "90.051",
"time": 1655822152553,
"isBuyerMaker": false,
"status": "SETTLED"
},
{
"id": 218,
"price": "30007",
"amount": "0.058",
"quoteAmount": "1740.406",
"time": 1655822832751,
"isBuyerMaker": true,
"status": "SETTLED"
},
...
]

Get Market Klines

GET /v1/klines

Parameters:

ParameterTypeMandatoryDescription
marketIdSTRINGYESMarket id
intervalENUMYESOne of 1M 5M 15M 30M 1H 2H 4H 6H 1D 1W 1MO
startTimeINTEGERNOTimestamp millisecond INCLUSIVE
endTimeINTEGERNOTimestamp millisecond EXCLUSIVE
limitINTEGERNODefault is 100, maximum is 500

Response

  1. The "time" field is timestamp in milliseconds.
  2. Data within each bar is based on the trading matching time, not the confirmation time on the blockchain. Therefore, the K-line generated from the transaction data on the blockchain may differ slightly from the data returned by this interface.
[
{
"time": 1656029700000,
"open": "2001",
"close": "2001",
"high": "2001",
"low": "2001",
"volume": "0"
},
...
]

Get Market Mark Price Klines

GET /v1/markPriceKlines

Parameters:

ParameterTypeMandatoryDescription
marketIdSTRINGYESMarket id
intervalENUMYESOne of 1M 5M 15M 30M 1H 2H 4H 6H 1D 1W 1MO
startTimeINTEGERNOTimestamp millisecond INCLUSIVE
endTimeINTEGERNOTimestamp millisecond EXCLUSIVE
limitINTEGERNODefault is 100, maximum is 500

Response

[
{
"time": 1656029700000,
"open": "2001",
"close": "2001",
"high": "2001",
"low": "2001",
"volume": "0"
},
...
]

Get Market FundingRates

GET /v1/fundingRate

Parameters:

ParameterTypeMandatoryDescription
marketIdSTRINGYESMarket id
startTimeINTEGERNOTimestamp millisecond INCLUSIVE
endTimeINTEGERNOTimestamp millisecond EXCLUSIVE
limitINTEGERNODefault is 100, maximum is 500

Response

[
{
"marketId": "btcusdc",
"fundingRate": "0.0000026",
"fundingTime": 1655902360000
},
{
"marketId": "btcusdc",
"fundingRate": "0.0000026",
"fundingTime": 1655902380000
},
{
"marketId": "btcusdc",
"fundingRate": "0.0000026",
"fundingTime": 1655902400000
},
...
]

Get High-Risk Account Positions

This interface will return position information of some high-risk accounts. When the risk level of an account is higher than 80%, it will appear here. Please note that this interface has a short cache, so you cannot simply rely on the "isSafe" returned by this interface to determine whether the position can be liquidated. Reliance solely on the return value of this interface for liquidation may cause you to miss the best liquidation timing. The correct approach is to use this interface to obtain the addresses that may be liquidated and then decide on the subsequent liquidation actions through direct interaction with the blockchain.

  • To check whether an account is safe on blockchain in real time, you can use the isSafe interface.
  • To liquidate a position, please refer to Liquidation.

GET /v1/riskyAccounts

Response

[
{
"account": "0x837Bcd683b8b08223f29A66A1665e43D79a0204F",
"isSafe": false,
"risk": "1.0000",
"positions": [
{
"marketId": "liqusdc",
"side": "LONG",
"status": "OPEN",
"size": "102.8",
"maxSize": "102.8",
"unrealizedPnl": "-5628.003915",
"realizedPnl": "0",
"entryPrice": "135.74712",
"exitPrice": "0",
"closedAt": null,
"sumOpen": "102.8",
"sumClose": "0",
"liquidationPrice": "130.208835",
"lastUpdatedAt": 1678206894000
}
]
}
]