查詢平台最近成交歷史
獲取平台最近成交數據
覆蓋範圍: 現貨 / USDT永續 / USDC永續 / USDC交割 / 反向合約 / 期權
您可以從這個地址 下載到歸檔的更多的歷史成交數據:
HTTP請求
GET /v5/market/recent-trade
請求參數
參數 | 是否必需 | 類型 | 說明 |
---|---|---|---|
category | true | string | 產品類型. spot ,linear ,inverse ,option |
symbol | false | string | 合約名稱
|
baseCoin | false | string | 交易幣種. 僅option , 若不傳, 則默認返回BTC數據 |
optionType | false | string | 期權類型. Call 或 Put . 僅option |
limit | false | integer | 每頁數量限制.
|
響應參數
參數 | 類型 | 說明 |
---|---|---|
category | string | 產品類型 |
list | array | Object |
> execId | string | 成交id |
> symbol | string | 合約名稱 |
> price | string | 成交價格 |
> size | string | 成交數量 |
> side | string | 吃單方向. Buy , Sell |
> time | string | 成交時間戳 (毫秒) |
> isBlockTrade | boolean | 成交類型是否為大宗交易 |
> mP | string | 標記價格, 期權的特有字段 |
> iP | string | 指數價格, 期權的特有字段 |
> mIv | string | 標記iv, 期權的特有字段 |
> iv | string | iv, 期權的特有字段 |
請求示例
- HTTP
- Python
- GO
- Java
- Node.js
GET /v5/market/recent-trade?category=spot&symbol=BTCUSDT&limit=1 HTTP/1.1
Host: api-testnet.bybit.com
from pybit.unified_trading import HTTP
session = HTTP(testnet=True)
print(session.get_public_trade_history(
category="spot",
symbol="BTCUSDT",
limit=1,
))
import (
"context"
"fmt"
bybit "github.com/wuhewuhe/bybit.go.api"
)
client := bybit.NewBybitHttpClient("", "", bybit.WithBaseURL(bybit.TESTNET))
params := map[string]interface{}{"category": "linear", "symbol": "BTCUSDT"}
client.NewUtaBybitServiceWithParams(params).GetPublicRecentTrades(context.Background())
import com.bybit.api.client.domain.CategoryType;
import com.bybit.api.client.domain.market.*;
import com.bybit.api.client.domain.market.request.MarketDataRequest;
import com.bybit.api.client.service.BybitApiClientFactory;
var client = BybitApiClientFactory.newInstance().newAsyncMarketDataRestClient();
var recentTrade = MarketDataRequest.builder().category(CategoryType.OPTION).symbol("ETH-30JUN23-2050-C").build();
client.getRecentTradeData(recentTrade, System.out::println);
const { RestClientV5 } = require('bybit-api');
const client = new RestClientV5({
testnet: true,
});
client
.getPublicTradingHistory({
category: 'spot',
symbol: 'BTCUSDT',
limit: 1,
})
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});
響應示例
{
"retCode": 0,
"retMsg": "OK",
"result": {
"category": "spot",
"list": [
{
"execId": "2100000000007764263",
"symbol": "BTCUSDT",
"price": "16618.49",
"size": "0.00012",
"side": "Buy",
"time": "1672052955758",
"isBlockTrade": false
}
]
},
"retExtInfo": {},
"time": 1672053054358
}