# Market Interface
# 1. Contract Information
HTTP Request
# Request
GET /rank/contracts
example: https://www.bydfi.com/b2b/rank/contracts
response description
| Name | Type | Status | Description |
|---|---|---|---|
| code | code | Mandatory | Status code Note:200 means success and other means failure |
| msg | String | Mandatory | Prompt information |
| change_percent | String | Mandatory | price limit |
| ticker_id | string | Mandatory | Identifier of a ticker with delimiter to separate base/quote, eg. BTC-PERPUSD, BTC-PERPETH, BTC-PERPEUR |
| base_currency | string | Mandatory | Symbol/currency code of base pair, eg. BTC |
| quote_currency | string | Mandatory | Symbol/currency code of quote pair, eg. ETH |
| base_id | string | Mandatory | Symbol/currency code of base ID, eg. 1 |
| quote_id | string | Mandatory | Symbol/currency code of quote ID, eg. 2 |
| last_price | decimal | Mandatory | Last transacted price of base currency based on given quote currency |
| base_volume | decimal | Mandatory | 24 hour trading volume in BASE currency |
| USD_volume | decimal | Recommended | 24 hour trading USD volume |
| quote_volume | decimal | Mandatory | 24 hour trading volume in QUOTE currency |
| bid | decimal | Mandatory | Current highest bid price |
| ask | decimal | Mandatory | Current lowest ask price |
| high | decimal | Mandatory | Rolling 24-hour highest transaction price |
| low | decimal | Mandatory | Rolling 24-hour lowest transaction price |
| product_type | String | Mandatory | Perpetual |
| open_interest | decimal | Mandatory | The number of outstanding derivatives contracts that have not been settled |
| open_interest_usd | decimal | Mandatory | none |
| index_price | decimal | Mandatory | Last calculated index price for underlying of contract |
| creation_timestamp | Long | Recommended | not needed for perpetual swap |
| expiry_timestamp | Long | Recommended | not needed for perpetual swaps |
| funding_rate | decimal | Mandatory | Current funding rate |
| next_funding_rate | decimal | Recommended | Upcoming predicted funding rate |
| next_funding_rate_timestamp | Long | Mandatory | Timestamp of the next funding rate change |
| maker_fee | decimal | Mandatory | Fees for filling a “maker” order (can be negative if rebate is given) |
| taker_fee | decimal | Mandatory | Fees for filling a “taker” order (can be negative if rebate is given) |
| contract_type | String | Mandatory | Describes the type of contract - Vanilla, Inverse or Quanto? |
| contract_price | decimal | Mandatory | Describes the price per contract. |
| contract_price_currency | String | Mandatory | Describes the currency which the contract is priced in (e.g. USD,) |
| avgResTimeMs | String | Mandatory | avg response time.ms |
| invoke | String | Mandatory | true invoke history 'false' is not invoke |
# Response
{
"code": 200,
"msg": "success",
"data": [{
"ask": "47115.0",
"base_currency": "BTC",
"base_id": 1,
"quote_id": 2781,
"base_volume": "70757042",
"bid": " 47114.0",
"contract_price": 47114.0,
"contract_price_currency": USD,
"contract_type": Vanilla,
"change_percent": 500,
"creation_timestamp": null,
"expiry_timestamp": "null",
"funding_rate": "0.000100",
"index_price": 47095.66,
"last_price": 47114.0,
"low": 46342.0,
"maker_fee": 0.0002000000000000,
"next_funding_rate": 0.00010,
"next_funding_rate_timestamp": 1631692800000,
"open_interest": 43649.0,
"open_interest_usd": null,
"product_type": Perpetual,
"quote_volume": 100,
"taker_fee": 0.0006000000000000,
"ticker_id": BTC-PERPUSD,
"USD_volume": null
}],],
...
}
# 2. Get Market Depth
HTTP Request
# Request
GET /rank/orderbook
example: https://www.bydfi.com/b2b/rank/orderbook
request Paramters
| name | Type | Status | description |
|---|---|---|---|
| market_pair | string | Mandatory | A pair such as “LTC-PERPUSD” |
| depth | string | Recommended | Orders depth quantity: [0,5,10,20,50,100,500]. Default depth=100 |
Response description
| name | Type | Status | description |
|---|---|---|---|
| ticker_id | string | Mandatory | A pair such as "BTC-PERPUSD", with delimiter between different cryptoassets |
| timestamp | Integer | Mandatory | Unix timestamp in milliseconds for when the last updated time occurred. |
| bids | decimal | Mandatory | An array containing 2 elements. The offer price and quantity fyor each bid order |
| asks | decimal | Mandatory | An array containing 2 elements. The ask price and quantity for each ask order |
| avgResTimeMs | Long | Mandatory | avg response time.ms |
| invoke | boolean | Mandatory | true invoke history 'false' is not invoke |
# Response
# Response
{
"code": 200,
"msg": "success",
"data":{
"ticker_id": BTC-PERPUSD,
"asks": [{
"amount": 1000,
"price": "50000.18"
} ],
"bids":[{
"amount": 1000,
"price": "50000.18"
}]
}
}
# 3. Get Kline
HTTP Request
# Request
GET /market/kline
example: https://www.bydfi.com/b2b/rank/market/kline
description:This endpoint retrieves all klines in a specific range
request description
| name | Type | Status | description |
|---|---|---|---|
| market_pair | string | Mandatory | A pair such as “LTC-PERPBTC” |
| period | string | Mandatory | The period of each candle example:1min,3min, 5min, 15min, 30min, 60min, 1day |
response description
| name | Type | Status | description |
|---|---|---|---|
| id | string | Mandatory | The UNIX timestamp in seconds as response id |
| open | string | Mandatory | The opening price |
| close | string | Mandatory | The closing price |
| low | string | Mandatory | The low price |
| high | string | Mandatory | The high price |
| vol | string | Mandatory | Accumulated trading value, in quote currency |
| openTime | string | Mandatory | Open time |
| closeTime | string | Mandatory | close time |
| avgResTimeMs | Long | Mandatory | avg response time.ms |
| invoke | boolean | Mandatory | true invoke history 'false' is not invoke |
# Response
{
"code": 200,
"msg": "success",
"data":[{
"id":1632462798405,
"open":44157.43,
"close":44126.59,
"low":44126.59,
"high":44174.71,
"closeTime":1632462660000,
"openTime":1632462660000,
"vol":"vol"
}]
}
}
# 4. Get Currency Info
HTTP Request
# Request
GET /market/kline
example: https://www.bydfi.com/b2b/rank/market/currencyInfo
description:This endpoint all currency trade info
response description
| name | Type | Status | description |
|---|---|---|---|
| coin | string | Mandatory | currency eg。BTC |
| trading | string | Mandatory | currency is not trading 。”online“ is trading Otherwise。“offline” |
| deposits | string | Mandatory | “online” is not deposits。Otherwise。“offline” |
| withdrawals | string | Mandatory | “online” is not withdrawals。Otherwise。“offline” |
| avgProcessTime | string | Mandatory | avg deal time |
| avgResTimeMs | Long | Mandatory | avg response time.ms |
| invoke | boolean | Mandatory | true invoke history 'false' is not invoke |
# Response
{
"code": 200,
"msg": "success",
"data":[{
"trading":online,
"avgProcessTime":5min,
"deposits":online,
"coin":BTC,
"withdrawals":online
}]
}
}