查詢多空比
HTTP請求
GET /v5/market/account-ratio
請求參數
參數 | 是否必需 | 類型 | 說明 |
---|---|---|---|
category | true | string | 產品類型. linear (僅USDT永續),inverse |
symbol | true | string | 合約名稱 |
period | true | string | 數據週期. 5min , 15min , 30min , 1h , 4h , 1d |
startTime | false | string | 開始時間戳 (毫秒) |
endTime | false | string | 結束時間戳 (毫秒) |
limit | false | integer | 每頁數量限制. [1 , 500 ]. 默認: 50 |
cursor | false | string | 游標,用於分頁 |
響應參數
參數 | 類型 | 說明 |
---|---|---|
list | array | Object |
> symbol | string | 合約名稱 |
> buyRatio | string | 持有多倉比例 |
> sellRatio | string | 持有空倉的比例 |
> timestamp | string | 時間戳 (毫秒) |
nextPageCursor | string | 游標,用於分頁 |
請求示例
- HTTP
- Python
- GO
- Java
- Node.js
GET /v5/market/account-ratio?category=linear&symbol=BTCUSDT&period=1h&limit=2&startTime=1696089600000&endTime=1696262400000 HTTP/1.1
Host: api-testnet.bybit.com
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", "period": "5min"}
client.NewUtaBybitServiceWithParams(params).GetLongShortRatio(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 marketAccountRatioRequest = MarketDataRequest.builder().category(CategoryType.LINEAR).symbol("BTCUSDT").dataRecordingPeriod(DataRecordingPeriod.FIFTEEN_MINUTES).limit(10).build();
client.getMarketAccountRatio(marketAccountRatioRequest, System.out::println);
const { RestClientV5 } = require('bybit-api');
const client = new RestClientV5({
testnet: true,
});
client
.getLongShortRatio({
category: 'linear',
symbol: 'BTCUSDT',
period: '1h',
limit: 100,
})
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});
響應示例
{
"retCode": 0,
"retMsg": "OK",
"result": {
"list": [
{
"symbol": "BTCUSDT",
"buyRatio": "0.49",
"sellRatio": "0.51",
"timestamp": "1696262400000"
},
{
"symbol": "BTCUSDT",
"buyRatio": "0.4927",
"sellRatio": "0.5073",
"timestamp": "1696258800000"
}
],
"nextPageCursor": "lastid%3D0%26lasttime%3D1696258800"
},
"retExtInfo": {},
"time": 1731567491688
}