Get Status And Leverage
Query the Spot margin status and leverage of Unified account
Covers: Margin trade (Unified Account)
HTTP Request
GET /v5/spot-margin-trade/state
Request Parameters
None
Response Parameters
Parameter | Type | Comments |
---|---|---|
spotLeverage | string | Spot margin leverage. Returns "" if the margin trade is turned off |
spotMarginMode | string | Spot margin status. 1 : on, 0 : off |
effectiveLeverage | string | actual leverage ratio. Precision retains 2 decimal places, truncate downwards |
Request Example
- HTTP
- Python
- Node.js
GET /v5/spot-margin-trade/state HTTP/1.1
Host: api.bybit.com
X-BAPI-SIGN: XXXXX
X-BAPI-API-KEY: XXXXX
X-BAPI-TIMESTAMP: 1692696840996
X-BAPI-RECV-WINDOW: 5000
from pybit.unified_trading import HTTP
session = HTTP(
testnet=True,
api_key="XXXXX",
api_secret="XXXXX",
)
print(session.spot_margin_trade_get_status_and_leverage())
const { RestClientV5 } = require('bybit-api');
const client = new RestClientV5({
testnet: true,
key: 'apikey',
secret: 'apisecret',
});
client
.getSpotMarginState()
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});
Response Example
{
"retCode": 0,
"retMsg": "OK",
"result": {
"spotLeverage": "10",
"spotMarginMode": "1",
"effectiveLeverage": "1"
},
"retExtInfo": {},
"time": 1692696841231
}