行情接口
可用合约列表
GET /api/v1/perpetual/public
返回:
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| code | y | int | 状态,200:成功 | ||
| msg | y | string | 提示 | ||
| data | y | object | 合约信息 |
Response
{
"amount24": "0",
"base": "usdt",
"baseDisplayName": "USDT",
"bizType": "",
"code": "solusdt",
"codeDisplayName": "SOLUSDT",
"countDownTimeInterval": "",
"direction": 0,
"env": 0,
"fluctuation": "0",
"fund": "0",
"guaranteedStopLossRate": "0.0003",
"guaranteedStopLossStatus": 1,
"high": "168.2736",
"indexBase": "sol",
"indexBaseAppLogo": "https://hotcoin-snp-idcard.oss-accelerate.aliyuncs.com/hotcoin/photo/2022/03/905ba2d69c5648e5bc7f853aad763e49sol.png",
"indexBaseDisplayName": "SOL",
"indexBaseWebLogo": "https://hotcoin-snp-idcard.oss-accelerate.aliyuncs.com/hotcoin/photo/2022/03/905ba2d69c5648e5bc7f853aad763e49sol.png",
"indexPrice": "147.71",
"lastCny": "",
"liquidationTime": 1746617445000,
"low": "168.2736",
"marginDigit": 0,
"markPrice": "168.2736",
"marketPriceDigit": 4,
"maxLever": 50,
"minQuoteDigit": 3,
"minTradeDigit": 8,
"minTradeUnit": 1.0,
"nextLiquidationInterval": 0,
"openTradeTime": "",
"preDeliveryPrice": "",
"price": "168.2736",
"quote": "usdt",
"quoteDisplayName": "USDT",
"size24": "0",
"totalPosition": "360",
"tradeStatus": 0,
"type": "",
"unitAmount": 1.0
}
合约信息返回:
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| code | y | string | 合约code | ||
| base | y | string | 基础货币名,如btc、usdt | ||
| quote | y | string | 计价货币名,usd,usdt | ||
| direction | y | string | 方向 0:正向合约,1:反向合约 | ||
| minTradeDigit | y | string | 基础货币最小交易小数位 | ||
| minQuoteDigit | y | string | 计价货币最小交易小数位 | ||
| price | y | string | 最新价 | ||
| fluctuation | y | string | 涨跌幅 | ||
| high | y | string | 最高价 | ||
| low | y | string | 最低价 | ||
| amount24 | y | string | 24小时成交张数 | ||
| size24 | y | string | 24小时成交价值 | ||
| totalPosition | y | string | 最低价持仓量 | ||
| fund | y | string | 资金费率 | ||
| markPrice | y | string | 标记价格 | ||
| indexPrice | y | string | 指数价格 | ||
| unitAmount | y | string | 一张合约对应的quote面值,默认1 | ||
| env | y | string | 是否测试盘 0:线上盘,1:测试盘 | ||
| maxLever | y | string | 最大杠杆 |
K线
GET /api/v1/perpetual/public/{contractCode}/candles
请求参数:
路径参数
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| contractCode | y | string | 合约code |
Query
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| kline | y | string | k线类型 | 1min,3min,5min,15min,30min,1hour,2hour,4hour,6hour,12hour,day,week | |
| since | n | int | 时间戳,默认值0 | ||
| size | n | int | k线数量 | ||
| klineType | n | int | K线类型 | 1 | 1-最新价 2-标记价 3-指数价 |
返回:
Response
{
"code":0,
"data":[
[
1543405500000,//时间
"100",//最低
"100",//最高
"100",//开盘价
"100",//收盘价
"0",//成交量
"0"//成交价值
]
],
"msg":"success"
}
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| code | y | int | 状态,200:成功 | ||
| msg | y | string | 提示 | ||
| data | y | object |
深度信息
GET /api/v1/perpetual/public/products/{contractCode}/orderbook
路径参数
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| contractCode | y | string | 合约code |
Response
{
"asks": [
//卖一
[
"9721.47", //价格
"225", //张数
"225" //总张数
]
],
"bids": [
//买一
[
"9720",
"480",
"480"
]
]
}
返回:
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| asks | y | object | 卖盘 | ||
| bids | y | object | 买盘 |
最新交易数据
GET /api/v1/perpetual/public/{contractCode}/fills
请求参数:
路径参数
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| contractCode | y | string | 合约code |
Response
{
"code": 200,
"data": [
[
"9695.28", //成交价格
"496", //张数
"long", //方向
1582269058972, //时间
9916897 //成交id
]
],
"msg": "success"
}
返回:
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| code | y | string | 状态码 | ||
| data | y | object | 返回结果 | ||
| msg | y | string | 消息 |
指数价成分信息
GET /api/v1/perpetual/public/{contractCode}/indexInfo
请求参数:
路径参数
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| contractCode | y | string | 合约code |
Response
{
"code": 200,
"data": {
"components": [
{
"name": "binance_contract",
"price": "38983.69999999",
"symbol": "BTC/USDT",
"wgt": "1"
}
],
"index": "btc",
"indexPrice": "38983.69999999",
"time": 1650269513885
},
"msg": "success"
}
返回:
| 参数名称 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|
| components | obejct | 单个交易所指数信息 | ||
| >name | string | 交易所名称 | binance_contract-币安合约,binance-币安,huobi-火币,okex-OK | |
| >price | string | 价格 | ||
| >symbol | string | 交易对 | ||
| >wgt | number | 权重 | ||
| index | object | 指数货币 | ||
| indexPrice | string | 指数价 | ||
| time | number | 时间 |
资金费用历史
GET /api/v1/perpetual/public/{contractCode}/fee-rate
路径参数
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| contractCode | y | string | 合约code | ||
| page | n | int | 页码 | ||
| pageSize | n | int | 大小 |
返回:
Response
{
"code":200,
"data":
{
"amount24":830768400,
"contractCode":"etcusd",
"createdDate":1546603201000,
"feeRate":-0.00375,
"id":5,
"insuranceSize":0,
"modifyDate":1546603201000,
"size24":8307684,
"timeIndex":1546603201000,
"userPositionAmount":198000000
},
"msg":"success"
}
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| amount24 | y | string | 24小时成交量 | ||
| contractCode | y | string | 合约code | ||
| createdDate | y | string | 创建时间 | ||
| feeRate | y | string | 资金费率 | ||
| id | y | string | 主键id | ||
| insuranceSize | y | string | 风险准备金 | ||
| modifyDate | y | string | 修改时间 | ||
| size24 | y | string | 24小时成交价值 | ||
| timeIndex | y | string | 生成当前数据的时间 | ||
| userPositionAmount | y | string | 持仓总量 |
最新标记价格和资金费率
GET /api/v1/perpetual/public/{contractode}/premiumIndex
路径参数
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| contractCode | y | string | 合约code |
返回:
Response
{
"code": 200,
"data": {
"baseCurrency": "usdt",
"contractCode": "btcusdt",
"estimateFeeRate": "0.00375",
"indexPrice": "39008.4",
"lastFeeRate": "0.00375",
"lastPrice": "41500",
"markPrice": "39008.4",
"quoteCurrency": "usdt",
"time": 1650270347001,
"totalPosition": "19193"
},
"msg": "success"
}
| 参数名称 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|
| baseCurrency | string | 交易货币 | ||
| contractCode | string | 合约code | ||
| estimateFeeRate | string | 预估的资金费率 | ||
| indexPrice | string | 指数价 | ||
| lastFeeRate | string | 最近更新的资金费率 | ||
| lastPrice | string | 最新交易价格 | ||
| markPrice | string | 标记价 | ||
| quoteCurrency | string | 计价货币 | ||
| time | string | 更新时间 | ||
| totalPosition | string | 总持仓量 |