805 lines
35 KiB
JSON
805 lines
35 KiB
JSON
{
|
||
"openapi": "3.0.1",
|
||
"info": {
|
||
"title": "REST API",
|
||
"version": "v5",
|
||
"description": "# 使用说明 \n <b>接口只会请求模拟环境</b><br><br>*Parameters* 面板中点击`Try it out`按钮,编辑请求参数,点击`Execute`按钮发送请求。*Responses* 面板中查看请求结果。<br>"
|
||
},
|
||
"tags": [
|
||
{
|
||
"name": "Market Data",
|
||
"description": "行情数据"
|
||
}
|
||
],
|
||
"paths": {
|
||
"/api/v5/market/tickers": {
|
||
"get": {
|
||
"tags": [
|
||
"Market Data"
|
||
],
|
||
"summary": "获取所有产品行情信息",
|
||
"parameters": [
|
||
{
|
||
"name": "instType",
|
||
"in": "query",
|
||
"description": "产品类型<br>`SPOT`:币币<br>`SWAP`:永续合约<br>`FUTURES`:交割合约<br>`OPTION`:期权",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string"
|
||
},
|
||
"example": "SPOT"
|
||
},
|
||
{
|
||
"name": "uly",
|
||
"in": "query",
|
||
"description": "合约标的指数<br>仅适用于`交割/永续/期权`,如 `BTC-USD`",
|
||
"schema": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "成功",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"example": {
|
||
"code": "0",
|
||
"msg": "",
|
||
"data": [
|
||
{
|
||
"instType": "SWAP",
|
||
"instId": "LTC-USD-SWAP",
|
||
"last": "9999.99",
|
||
"lastSz": "0.1",
|
||
"askPx": "9999.99",
|
||
"askSz": "11",
|
||
"bidPx": "8888.88",
|
||
"bidSz": "5",
|
||
"open24h": "9000",
|
||
"high24h": "10000",
|
||
"low24h": "8888.88",
|
||
"volCcy24h": "2222",
|
||
"vol24h": "2222",
|
||
"sodUtc0": "0.1",
|
||
"sodUtc8": "0.1",
|
||
"ts": "1597026383085"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v5/market/ticker": {
|
||
"get": {
|
||
"tags": [
|
||
"Market Data"
|
||
],
|
||
"summary": "获取单个产品行情信息",
|
||
"parameters": [
|
||
{
|
||
"name": "instId",
|
||
"in": "query",
|
||
"description": "产品ID,如:`BTC-USD-SWAP`",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string"
|
||
},
|
||
"example": "BTC-USD-SWAP"
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "成功",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"example": {
|
||
"code": "0",
|
||
"msg": "",
|
||
"data": [
|
||
{
|
||
"instType": "SWAP",
|
||
"instId": "BTC-USD-SWAP",
|
||
"last": "56956.1",
|
||
"lastSz": "3",
|
||
"askPx": "56959.1",
|
||
"askSz": "10582",
|
||
"bidPx": "56959",
|
||
"bidSz": "4552",
|
||
"open24h": "55926",
|
||
"high24h": "57641.1",
|
||
"low24h": "54570.1",
|
||
"volCcy24h": "81137.755",
|
||
"vol24h": "46258703",
|
||
"ts": "1620289117764",
|
||
"sodUtc0": "55926",
|
||
"sodUtc8": "55926"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v5/market/index-tickers": {
|
||
"get": {
|
||
"tags": [
|
||
"Market Data"
|
||
],
|
||
"summary": "获取指数行情",
|
||
"parameters": [
|
||
{
|
||
"name": "instId",
|
||
"in": "query",
|
||
"description": "指数,如:`BTC-USD`<br>`instId`和`quoteCcy`必须填写一个",
|
||
"schema": {
|
||
"type": "string"
|
||
},
|
||
"example": "BTC-USD"
|
||
},
|
||
{
|
||
"name": "quoteCcy",
|
||
"in": "query",
|
||
"description": "指数计价单位<br>目前只有`USD`/`USDT`/`BTC`为计价单位的指数",
|
||
"schema": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "成功",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"example": {
|
||
"code": "0",
|
||
"msg": "",
|
||
"data": [
|
||
{
|
||
"instId": "BTC-USDT",
|
||
"idxPx": "0.1",
|
||
"high24h": "0.5",
|
||
"low24h": "0.1",
|
||
"open24h": "0.1",
|
||
"sodUtc0": "0.1",
|
||
"sodUtc8": "0.1",
|
||
"ts": "1597026383085"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v5/market/books": {
|
||
"get": {
|
||
"tags": [
|
||
"Market Data"
|
||
],
|
||
"summary": "获取产品深度",
|
||
"parameters": [
|
||
{
|
||
"name": "instId",
|
||
"in": "query",
|
||
"description": "产品ID,如:`BTC-USDT`",
|
||
"schema": {
|
||
"type": "string"
|
||
},
|
||
"required": true,
|
||
"example": "BTC-USDT"
|
||
},
|
||
{
|
||
"name": "sz",
|
||
"in": "query",
|
||
"description": "深度档位数量<br>最大值可传400,即买卖深度共800条<br>不填写此参数,默认返回1档深度数据",
|
||
"schema": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "成功",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"example": {
|
||
"code": "0",
|
||
"msg": "",
|
||
"data": [
|
||
{
|
||
"asks": [
|
||
[
|
||
"41006.8",
|
||
"0.60038921",
|
||
"0",
|
||
"1"
|
||
]
|
||
],
|
||
"bids": [
|
||
[
|
||
"41006.3",
|
||
"0.30178218",
|
||
"0",
|
||
"2"
|
||
]
|
||
],
|
||
"ts": "1629966436396"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v5/market/candles": {
|
||
"get": {
|
||
"tags": [
|
||
"Market Data"
|
||
],
|
||
"summary": "获取所有交易产品K线数据",
|
||
"parameters": [
|
||
{
|
||
"name": "instId",
|
||
"in": "query",
|
||
"description": "产品ID,如:`BTC-USDT`",
|
||
"schema": {
|
||
"type": "string"
|
||
},
|
||
"required": true,
|
||
"example": "BTC-USDT"
|
||
},
|
||
{
|
||
"name": "bar",
|
||
"in": "query",
|
||
"description": "时间粒度,默认值`1m`<br>如 [1m/3m/5m/15m/30m/1H/2H/4H/6H/12H/1D/1W/1M/3M/6M/1Y]",
|
||
"schema": {
|
||
"type": "string"
|
||
}
|
||
},
|
||
{
|
||
"name": "after",
|
||
"in": "query",
|
||
"description": "请求此时间戳之前(更旧的数据)的分页内容,传的值为对应接口的`ts`",
|
||
"schema": {
|
||
"type": "string"
|
||
}
|
||
},
|
||
{
|
||
"name": "before",
|
||
"in": "query",
|
||
"description": "请求此时间戳之后(更新的数据)的分页内容,传的值为对应接口的`ts`",
|
||
"schema": {
|
||
"type": "string"
|
||
}
|
||
},
|
||
{
|
||
"name": "limit",
|
||
"in": "query",
|
||
"description": "分页返回的结果集数量,最大为100,不填默认返回100条",
|
||
"schema": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "成功",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"example": {
|
||
"code": "0",
|
||
"msg": "",
|
||
"data": [
|
||
[
|
||
"1597026383085",
|
||
"3.721",
|
||
"3.743",
|
||
"3.677",
|
||
"3.708",
|
||
"8422410",
|
||
"22698348.04828491"
|
||
],
|
||
[
|
||
"1597026383085",
|
||
"3.731",
|
||
"3.799",
|
||
"3.494",
|
||
"3.72",
|
||
"24912403",
|
||
"67632347.24399722"
|
||
]
|
||
]
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v5/market/history-candles": {
|
||
"get": {
|
||
"tags": [
|
||
"Market Data"
|
||
],
|
||
"summary": "获取交易产品历史K线数据(仅主流币)",
|
||
"parameters": [
|
||
{
|
||
"name": "instId",
|
||
"in": "query",
|
||
"description": "产品ID,如:`BTC-USDT`",
|
||
"schema": {
|
||
"type": "string"
|
||
},
|
||
"required": true,
|
||
"example": "BTC-USDT"
|
||
},
|
||
{
|
||
"name": "bar",
|
||
"in": "query",
|
||
"description": "时间粒度,默认值`1m`<br>如 [1m/3m/5m/15m/30m/1H/2H/4H/6H/12H/1D/1W/1M/3M/6M/1Y]",
|
||
"schema": {
|
||
"type": "string"
|
||
}
|
||
},
|
||
{
|
||
"name": "after",
|
||
"in": "query",
|
||
"description": "请求此时间戳之前(更旧的数据)的分页内容,传的值为对应接口的`ts`",
|
||
"schema": {
|
||
"type": "string"
|
||
}
|
||
},
|
||
{
|
||
"name": "before",
|
||
"in": "query",
|
||
"description": "请求此时间戳之后(更新的数据)的分页内容,传的值为对应接口的`ts`",
|
||
"schema": {
|
||
"type": "string"
|
||
}
|
||
},
|
||
{
|
||
"name": "limit",
|
||
"in": "query",
|
||
"description": "分页返回的结果集数量,最大为100,不填默认返回100条",
|
||
"schema": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "成功",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"example": {
|
||
"code": "0",
|
||
"msg": "",
|
||
"data": [
|
||
[
|
||
"1597026383085",
|
||
"3.721",
|
||
"3.743",
|
||
"3.677",
|
||
"3.708",
|
||
"8422410",
|
||
"22698348.04828491"
|
||
],
|
||
[
|
||
"1597026383085",
|
||
"3.731",
|
||
"3.799",
|
||
"3.494",
|
||
"3.72",
|
||
"24912403",
|
||
"67632347.24399722"
|
||
]
|
||
]
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v5/market/index-candles": {
|
||
"get": {
|
||
"tags": [
|
||
"Market Data"
|
||
],
|
||
"summary": "获取指数K线数据",
|
||
"parameters": [
|
||
{
|
||
"name": "instId",
|
||
"in": "query",
|
||
"description": "现货指数,如:`BTC-USD`",
|
||
"schema": {
|
||
"type": "string"
|
||
},
|
||
"required": true,
|
||
"example": "BTC-USDT"
|
||
},
|
||
{
|
||
"name": "bar",
|
||
"in": "query",
|
||
"description": "时间粒度,默认值`1m`<br>如 [1m/3m/5m/15m/30m/1H/2H/4H/6H/12H/1D/1W/1M/3M/6M/1Y]",
|
||
"schema": {
|
||
"type": "string"
|
||
}
|
||
},
|
||
{
|
||
"name": "after",
|
||
"in": "query",
|
||
"description": "请求此时间戳之前(更旧的数据)的分页内容,传的值为对应接口的`ts`",
|
||
"schema": {
|
||
"type": "string"
|
||
}
|
||
},
|
||
{
|
||
"name": "before",
|
||
"in": "query",
|
||
"description": "请求此时间戳之后(更新的数据)的分页内容,传的值为对应接口的`ts`",
|
||
"schema": {
|
||
"type": "string"
|
||
}
|
||
},
|
||
{
|
||
"name": "limit",
|
||
"in": "query",
|
||
"description": "分页返回的结果集数量,最大为100,不填默认返回100条",
|
||
"schema": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "成功",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"example": {
|
||
"code": "0",
|
||
"msg": "",
|
||
"data": [
|
||
[
|
||
"1597026383085",
|
||
"3.721",
|
||
"3.743",
|
||
"3.677",
|
||
"3.708",
|
||
"8422410",
|
||
"22698348.04828491"
|
||
],
|
||
[
|
||
"1597026383085",
|
||
"3.731",
|
||
"3.799",
|
||
"3.494",
|
||
"3.72",
|
||
"24912403",
|
||
"67632347.24399722"
|
||
]
|
||
]
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v5/market/mark-price-candles": {
|
||
"get": {
|
||
"tags": [
|
||
"Market Data"
|
||
],
|
||
"summary": "获取标记价格K线数据",
|
||
"parameters": [
|
||
{
|
||
"name": "instId",
|
||
"in": "query",
|
||
"description": "现货指数,如:`BTC-USD-SWAP`",
|
||
"schema": {
|
||
"type": "string"
|
||
},
|
||
"required": true,
|
||
"example": "BTC-USD-SWAP"
|
||
},
|
||
{
|
||
"name": "bar",
|
||
"in": "query",
|
||
"description": "时间粒度,默认值`1m`<br>如 [1m/3m/5m/15m/30m/1H/2H/4H/6H/12H/1D/1W/1M/3M/6M/1Y]",
|
||
"schema": {
|
||
"type": "string"
|
||
}
|
||
},
|
||
{
|
||
"name": "after",
|
||
"in": "query",
|
||
"description": "请求此时间戳之前(更旧的数据)的分页内容,传的值为对应接口的`ts`",
|
||
"schema": {
|
||
"type": "string"
|
||
}
|
||
},
|
||
{
|
||
"name": "before",
|
||
"in": "query",
|
||
"description": "请求此时间戳之后(更新的数据)的分页内容,传的值为对应接口的`ts`",
|
||
"schema": {
|
||
"type": "string"
|
||
}
|
||
},
|
||
{
|
||
"name": "limit",
|
||
"in": "query",
|
||
"description": "分页返回的结果集数量,最大为100,不填默认返回100条",
|
||
"schema": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "成功",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"example": {
|
||
"code": "0",
|
||
"msg": "",
|
||
"data": [
|
||
[
|
||
"1597026383085",
|
||
"3.721",
|
||
"3.743",
|
||
"3.677",
|
||
"3.708"
|
||
],
|
||
[
|
||
"1597026383085",
|
||
"3.731",
|
||
"3.799",
|
||
"3.494",
|
||
"3.72"
|
||
]
|
||
]
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v5/market/trades": {
|
||
"get": {
|
||
"tags": [
|
||
"Market Data"
|
||
],
|
||
"summary": "获取交易产品公共成交数据",
|
||
"parameters": [
|
||
{
|
||
"name": "instId",
|
||
"in": "query",
|
||
"description": "产品ID,如:`BTC-USDT`",
|
||
"schema": {
|
||
"type": "string"
|
||
},
|
||
"required": true,
|
||
"example": "BTC-USDT"
|
||
},
|
||
{
|
||
"name": "limit",
|
||
"in": "query",
|
||
"description": "分页返回的结果集数量,最大为500,不填默认返回100条",
|
||
"schema": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "成功",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"example": {
|
||
"code": "0",
|
||
"msg": "",
|
||
"data": [
|
||
{
|
||
"instId": "BTC-USDT",
|
||
"tradeId": "9",
|
||
"px": "0.016",
|
||
"sz": "50",
|
||
"side": "buy",
|
||
"ts": "1597026383085"
|
||
},
|
||
{
|
||
"instId": "BTC-USDT",
|
||
"tradeId": "9",
|
||
"px": "0.016",
|
||
"sz": "50",
|
||
"side": "buy",
|
||
"ts": "1597026383085"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v5/market/platform-24-volume": {
|
||
"get": {
|
||
"tags": [
|
||
"Market Data"
|
||
],
|
||
"summary": "获取平台24小时总成交量",
|
||
"responses": {
|
||
"200": {
|
||
"description": "成功",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"example": {
|
||
"code": "0",
|
||
"msg": "",
|
||
"data": [
|
||
{
|
||
"volUsd": "2222",
|
||
"volCny": "14220.8"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v5/market/open-oracle": {
|
||
"get": {
|
||
"tags": [
|
||
"Market Data"
|
||
],
|
||
"summary": "Oracle上链交易数据",
|
||
"responses": {
|
||
"200": {
|
||
"description": "成功",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"example": {
|
||
"code": "0",
|
||
"msg": "",
|
||
"data": {
|
||
"messages": [
|
||
"0x00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000060d98cc000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000081a06ed800000000000000000000000000000000000000000000000000000000000000006707269636573000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034254430000000000000000000000000000000000000000000000000000000000"
|
||
],
|
||
"prices": {
|
||
"BTC": "34796.4"
|
||
},
|
||
"signatures": [
|
||
"0xa8124d0dd7a6cd46aafc752272d2e67b09f0abb0f759c55712cf0c100e5ed6ad25853d97fd691c47539eac08d7e7b0ce3f6d1e8f6fa15850d8099718d37af376000000000000000000000000000000000000000000000000000000000000001c"
|
||
],
|
||
"timestamp": "1624870080"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v5/market/index-components": {
|
||
"get": {
|
||
"tags": [
|
||
"Market Data"
|
||
],
|
||
"summary": "获取指数成分数据",
|
||
"parameters": [
|
||
{
|
||
"name": "index",
|
||
"in": "query",
|
||
"description": "指数,如:`BTC-USDT`",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string"
|
||
},
|
||
"example": "BTC-USDT"
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "成功",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"example": {
|
||
"code": "0",
|
||
"msg": "",
|
||
"data": {
|
||
"components": [
|
||
{
|
||
"symbol": "BTC/USDT",
|
||
"symPx": "52733.2",
|
||
"wgt": "0.250",
|
||
"cnvPx": "52733.2",
|
||
"exch": "OKEx"
|
||
},
|
||
{
|
||
"symbol": "BTC/USDT",
|
||
"symPx": "52739.87000000",
|
||
"wgt": "0.250",
|
||
"cnvPx": "52739.87000000",
|
||
"exch": "Binance"
|
||
},
|
||
{
|
||
"symbol": "BTC/USDT",
|
||
"symPx": "52729.1",
|
||
"wgt": "0.250",
|
||
"cnvPx": "52729.1",
|
||
"exch": "Huobi"
|
||
},
|
||
{
|
||
"symbol": "BTC/USDT",
|
||
"symPx": "52739.47929397",
|
||
"wgt": "0.250",
|
||
"cnvPx": "52739.47929397",
|
||
"exch": "Poloniex"
|
||
}
|
||
],
|
||
"last": "52735.4123234925",
|
||
"index": "BTC-USDT",
|
||
"ts": "1630985335599"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"components": {}
|
||
}
|