行情
訂閱行情數據推送.
警告
- 注意,該topic推送delta數據和snapshot数据。如果delta數據中缺失一些字段,表明該字段自上次推送以來沒有發生變化。
- 現貨只推送snapshot類型數據
推送頻率: 期貨 - 100ms, 現貨 - 實時
Topic:
tickers.{symbol}
響應參數
- Linear/Inverse
- Spot
參數 | 類型 | 說明 |
---|---|---|
topic | string | Topic名稱 |
type | string | 數據類型. `snapshot`,`delta` |
cs | integer | 撮合版本號 |
ts | number | 行情服務生成數據的時間戳 (毫秒) |
data | array | Object |
> symbol | string | 合約名稱 |
> tickDirection | string | 價格變化方向 |
> price24hPcnt | string | 市場價格相對24h前變化的百分比 |
> lastPrice | string | 最新市場成交價 |
> prevPrice24h | string | 24小時前的整點市價 |
> highPrice24h | string | 最近24小時的最高價 |
> lowPrice24h | string | 最近24小時的最低價 |
> prevPrice1h | string | 1小時前的整點市價 |
> markPrice | string | 標記價格 |
> indexPrice | string | 指數價格 |
> openInterest | string | 未平倉合約的數量 |
> openInterestValue | string | 未平倉合約的價值 |
> turnover24h | string | 最近24小時成交額 |
> volume24h | string | 最近24小時成交量 |
> nextFundingTime | string | 下次結算資金費用的時間戳 (毫秒) |
> fundingRate | string | 資金費率 |
> bid1Price | string | 買1價 |
> bid1Size | string | 買1價的數量 |
> ask1Price | string | 賣1價 |
> ask1Size | string | 賣1價的數量 |
參數 | 類型 | 說明 |
---|---|---|
topic | string | Topic名稱 |
type | string | 數據類型. `snapshot`,`delta` |
cs | integer | 撮合版本號 |
ts | number | 行情服務生成數據的時間戳 (毫秒) |
data | array | Object |
> symbol | string | 合約名稱 |
> lastPrice | string | 最新市場成交價 |
> highPrice24h | string | 最近24小時的最高價 |
> lowPrice24h | string | 最近24小時的最低價 |
> prevPrice24h | string | 24小時前的整點市價 |
> volume24h | string | 最近24小時成交量 |
> turnover24h | string | 最近24小時成交額 |
> price24hPcnt | string | 市場價格相對24h前變化的百分比 |
訂閱示例
const socket = new WebSocket('wss://stream-testnet.zoomex.com/v3/public/linear');
socket.onopen = function() {
const subscribeMsg = {
"op": "subscribe",
"args": ["tickers.BTCUSDT"]
};
socket.send(JSON.stringify(subscribeMsg));
};
socket.onmessage = function(event) {
};
socket.onclose = function(event) {
};
響應示例
- Linear
{
"topic": "tickers.BTCUSDT",
"type": "snapshot",
"data": {
"symbol": "BTCUSDT",
"tickDirection": "PlusTick",
"price24hPcnt": "0.017103",
"lastPrice": "17216.00",
"prevPrice24h": "16926.50",
"highPrice24h": "17281.50",
"lowPrice24h": "16915.00",
"prevPrice1h": "17238.00",
"markPrice": "17217.33",
"indexPrice": "17227.36",
"openInterest": "68744.761",
"openInterestValue": "1183601235.91",
"turnover24h": "1570383121.943499",
"volume24h": "91705.276",
"nextFundingTime": "1673280000000",
"fundingRate": "-0.000212",
"bid1Price": "17215.50",
"bid1Size": "84.489",
"ask1Price": "17216.00",
"ask1Size": "83.020"
},
"cs": 24987956059,
"ts": 1673272861686
}