Get Long Short Ratio
HTTP Request
GET /v5/market/account-ratio
Request Parameters
Parameter | Required | Type | Comments |
---|---|---|---|
category | true | string | Product type. linear (USDT Perpetual),inverse |
symbol | true | string | Symbol name, like BTCUSDT , uppercase only |
period | true | string | Data recording period. 5min , 15min , 30min , 1h , 4h , 1d |
limit | false | integer | Limit for data size per page. [1 , 500 ]. Default: 50 |
Response Parameters
Parameter | Type | Comments |
---|---|---|
list | array | Object |
> symbol | string | Symbol name |
> buyRatio | string | The ratio of users with net long position |
> sellRatio | string | The ratio of users with net short position |
> timestamp | string | Timestamp (ms) |
Request Example
- HTTP
- Python
- GO
- Java
- Node.js
GET /v5/market/account-ratio?category=linear&symbol=BTCUSDT&period=1d&limit=1 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);
});
Response Example
{
"retCode": 0,
"retMsg": "OK",
"result": {
"list": [
{
"symbol": "BTCUSDT",
"buyRatio": "0.5777",
"sellRatio": "0.4223",
"timestamp": "1695772800000"
}
]
},
"retExtInfo": {},
"time": 1695785131028
}