# Market Interface

# 1. Contract Information

HTTP Requests

    # Request
    GET api/v1/market/getAllContracts
    
    example: https://api-swap-rest.bingbon.pro/api/v1/market/getAllContracts   

Return Parameters

Field Description
code For error messages, 0 means normal
msg Error message description
contractId ContractId
symbol Trading pair symbol, returned in the form of A_B
name The name of the underlying index
size Contract value, for example 0.0001 BTC
minStep User's step
volumePrecision The precision of trading volume
pricePrecision The precision of price
feeRate Trading fees
tradeMinLimit Minimum trading unit
currency Settlement currency
asset Contract denomination asset
	# Response
	{
	    "code": 0,
	    "msg": "",
	    "data": [{
	        "contractId": "100",
	        "symbol": "BTC-USDT",
	        "name": "BTC-USDT",
	        "size": "0.0001",
	        "minStep": "0.5",
	        "volumePrecision": 0,
	        "pricePrecision": 2,
	        "feeRate": 0.001,
	        "tradeMinLimit": 1,
	        "currency": "USDT",
	        "asset": "BTC"
	    }, {
	        "contractId": "101",
	        "symbol": "ETH_USDT",
	        "name": "ETH-USDT",
	        "size": "0.01",
            "minStep": "0.05",
	        "volumePrecision": 0,
	        "pricePrecision": 2,
	        "feeRate": 0.001,
	        "tradeMinLimit": 1,
	        "currency": "USDT",
	        "asset": "ETH"
	    }],
	    ...
	} 

# 2. Get Latest Price of a Trading Pair

HTTP Requests

  # Request
  GET api/v1/market/getLatestPrice

Request Parameters

Parameters Type Required Field Description Description
symbol String YES Trading pair symbol There must be a hyphen/ "-" in the trading pair symbol. eg: BTC-USDT

Return Parameters

Parameters Type Description
tradePrice float64 Trading Price
indexPrice float64 Index Price
fairPrice float64 Mark Price
# Response
    {
        "code": 0,
        "msg": "",
        "data": {
          "tradePrice": "50000.18",
          "indexPrice": "50000.18",
          "fairPrice": "50000.18"
        }
    }

# 3. Get Market Depth

HTTP Requests

    # Request
    GET api/v1/market/getMarketDepth

Request Parameters

Parameters Type Required Field Description Description
symbol String YES Trading pair symbol There must be a hyphen/ "-" in the trading pair symbol. eg: BTC-USDT
level String NO Number of levels If it is empty, it will return 5 levels of data by default.

Return Parameters

Parameters Type Description
code Int64 For error messages, 0 means normal, 1 means error
msg String Error message description
asks array Sell side depth
bids array Buy side depth
p float64 price
v float64 volume
    # Response
    {
        "code": 0,
        "msg": "",
        "data": {
            "asks": [
              {
                "p": 5319.94,
                "v": 0.05483456
              },{
                "p": 5320.19,
                "v": 1.05734545
              },{
                "p": 5320.39,
                "v": 1.16307999
              },{
                "p": 5320.94,
                "v": 0.05483456
              },{
                "p": 5330.19,
                "v": 1.05734545
              },{
                "p": 5330.39,
                "v": 1.16307999
              },
            ],
            "bids": [
              {
                "p": 5319.93,
                "v": 0.05483456
              },{
                "p": 5318.19,
                "v": 1.05734545
              },{
                "p": 5317.39,
                "v": 1.16307999
              },{
                "p": 5316.94,
                "v": 0.05483456
              },{
                "p": 5315.19,
                "v": 1.05734545
              },{
                "p": 5314.39,
                "v": 1.16307999
              },
            ],
        }
    }

# 4. The latest Trade of a Trading Pair

HTTP Requests

  # Request
  GET api/v1/market/getMarketTrades

Request Parameters

Parameters Type Required Field Description Description
symbol String YES Trading pair symbol There must be a hyphen/ "-" in the trading pair symbol. eg: BTC-USDT

Return Parameters

Parameters Type Description
time data Closing Time
makerSide String Direction (Buy / Sell)
price String Closing Price
volume String Filled Amount
 # Response
 {
     "code": 0,
     "msg": "",
     "data": {
         "trades": [
             {
                 "time": "2018-04-25T15:00:51.999Z",
                 "makerSide": "Buy",
                 "price": 0.279563,
                 "volume": 100,
             },
             {
                 "time": "2018-04-25T15:00:51.000Z",
                 "makerSide": "Sell",
                 "price": 0.279563,
                 "volume": 300,
             }
         ]
     }
 }

# 5. Current Funding Rate

HTTP Requests

	# Request
	GET api/v1/market/getLatestFunding

Request Parameters

Parameters Type Required Field Description Description
symbol String YES Trading pair symbol There must be a hyphen/ "-" in the trading pair symbol. eg: BTC-USDT

Return Parameters

Parameters Type Description
fundingRate float64 Current Funding Rate
fairPrice float64 Current Mark Price
leftSeconds float64 Time left for the next settlement, in seconds
# Response
    {
        "code": 0,
        "msg": "",
        "data": {
          "fundingRate": "0.3000",
          "fairPrice": "182.90",
          "leftSeconds": "1024",
        }
    }

# 6. Funding Rate History

HTTP Requests

  # Request
  GET api/v1/market/getHistoryFunding

Request Parameters

Parameters Type Required Field Description Description
symbol String YES Trading pair symbol There must be a hyphen/ "-" in the trading pair symbol. eg: BTC-USDT

Return Parameters

Parameters Type Description
historyId String historyId
fundingRate String Funding rate
fairPrice String Mark Price
interval String The funding rate settlement cycle, unit: hour
time data Settlement Time
 # Response
 {
     "code": 0,
     "msg": "",
     "data": {
         "fundings": [
             {
                 "historyId": "687",
                 "symbol": "ETH-USDT",
                 "fundingRate": "0.3000",
                 "fairPrice": "182.73",
                 "interval": "8",
                 "time": "2019-10-28T16:00:00.000Z"
             },
             {
                 "historyId": "686",
                 "symbol": "ETH-USDT",
                 "fundingRate": "0.3000",
                 "fairPrice": "182.90",
                 "interval": "8",
                 "time": "2019-10-28T15:00:00.000Z"
             }
         ]
     }
 } 

# 7. Get K-Line Data

Get the latest Kline Data

HTTP Requests

  # Request
  GET api/v1/market/getLatestKline

Request Parameters

Parameters Type Required Field Description Description
symbol String YES Trading pair symbol There must be a hyphen/ "-" in the trading pair symbol. eg: BTC-USDT
klineType String YES K-Line Type The type of K-Line (minutes, hours, weeks etc.)

Remarks

klineType Field Description
1 1min Kline
3 3min Kline
5 5min Kline
15 15min Kline
30 30min Kline
60 1h Kline
120 2h Kline
240 4h Kline
360 6h Kline
720 12h Kline
1D 1D Kline
1W 1W Kline
1M 1M Kline

Return Parameters

Parameters Type Description
open float64 Open
close float64 Close
high float64 High
low float64 Low
volume float64 Volume
ts int64 The timestamp of K-Line,Unit: ms
# Response
    {
        "code": 0,
        "msg": "",
        "data": {
            "kline": {
                "ts": 1572253500000,
                "open": 181.41,
                "close": 181.54,
                "high": 181.54,
                "low": 181.39,
                "volume": 281
            }
        }
    }

# 8. K-Line Data History

Get the K-Line history data of the trading price over a certain period of time.

HTTP Requests

  # Request
  GET api/v1/market/getHistoryKlines

Request Parameters

Parameters Type Required Field Description Description
symbol String YES Trading pair symbol There must be a hyphen/ "-" in the trading pair symbol. eg: BTC-USDT
klineType String YES K-Line Type The type of K-Line (minutes, hours, weeks etc.)
startTs int64 YES Start timestamp, Unit: ms
endTs int64 YES End timestamp, Unit: ms

Remarks

klineType Field Description
1 1min Kline
3 3min Kline
5 5min Kline
15 15min Kline
30 30min Kline
60 1h Kline
120 2h Kline
240 4h Kline
360 6h Kline
720 12h Kline
1D 1D Kline
1W 1W Kline
1M 1M Kline

Return Parameters

Parameters Type Description
klines array K-Line data
open float64 Open
close float64 Close
high float64 High
low float64 Low
volume float64 Volume
ts int64 The timestamp of K-Line, Unit: ms
# Response
    {
        "code": 0,
        "msg": "",
        "data": {
            "klines": [
                {
                    "ts": 1572253140000,
                    "open": 181.89,
                    "close": 181.97,
                    "high": 182.04,
                    "low": 181.89,
                    "volume": 2136
                },
                {
                    "ts": 1572253200000,
                    "open": 181.94,
                    "close": 181.72,
                    "high": 181.94,
                    "low": 181.72,
                    "volume": 965
                },
                {
                    "ts": 1572253260000,
                    "open": 181.69,
                    "close": 181.72,
                    "high": 181.72,
                    "low": 181.56,
                    "volume": 1245
                },
                {
                    "ts": 1572253320000,
                    "open": 181.72,
                    "close": 181.73,
                    "high": 181.81,
                    "low": 181.69,
                    "volume": 541
                },
                {
                    "ts": 1572253380000,
                    "open": 181.77,
                    "close": 181.59,
                    "high": 181.77,
                    "low": 181.53,
                    "volume": 933
                },
                {
                    "ts": 1572253440000,
                    "open": 181.59,
                    "close": 181.38,
                    "high": 181.62,
                    "low": 181.38,
                    "volume": 1425
                },
                {
                    "ts": 1572253500000,
                    "open": 181.41,
                    "close": 181.64,
                    "high": 181.64,
                    "low": 181.39,
                    "volume": 923
                }
            ]
        }
    }

# 9. Get Swap Open Positions

HTTP Requests

	# Request
    GET api/v1/market/getOpenPositions

Request Parameters

Parameters Type Required Field Description Description
symbol String YES Trading pair symbol There must be a hyphen/ "-" in the trading pair symbol. eg: BTC-USDT

Return Parameters

Parameters Type Description
volume float64 Volume of opened positions
unit string The unit corresponding to the Volume of opened positions, CONT. - BTC, ETH, LINK, BCH, etc.
# Response
    {
        "code": 0,
        "msg": "",
        "data": {
          "volume": "10.00",
          "unit": "BTC",
        }
    }

# 10. Get Ticker

HTTP Requests

    # Request
    GET api/v1/market/getTicker

Request Parameters

Parameters Type Required Field Description Description
symbol String NO Trading pair symbol There must be a hyphen/ "-" in the trading pair symbol. eg: BTC-USDT

Return Parameters

Parameters Type Description
symbol String Trading pair symbol
priceChange String Price change, in USDT
priceChangePercent String Price change expressed as a percentage
lastPrice String The price for the last trade
lastVolume String The volume for the last trade
highPrice String Highest price during 24h
lowPrice String Lowest price during 24h
volume String Volume during last 24h in base currency
dayVolume String Volume during last 24h, in USDT
openPrice String 24h open price

#

# Response
    {
        "code": 0,
        "msg": "",
        "data": {
          "symbol": "BTC-USDT",
          "priceChange": "10.00",
          "priceChangePercent": "10",
          "lastPrice": "5738.23",
          "lastVolume": "31.21",
          "highPrice": "5938.23",
          "lowPrice": "5238.23",
          "volume": "23211231.13",
          "dayVolume": "213124412412.47",
          "openPrice": "5828.32"
        }
    }
Last Updated: 11/7/2022, 10:37:05 AM