全倉槓桿設置
全倉槓桿設置用戶最大槓桿倍數
覆蓋範圍: 全倉槓桿 (統一帳戶)
警告
需要先開啟全倉槓桿,才能調整槓桿。
HTTP 請求
POST /v5/spot-margin-trade/set-leverage
請求參數
參數 | 是否必需 | 類型 | 說明 |
---|---|---|---|
leverage | true | string | 槓桿倍數 (整數), 支持區間 [2 , 10 ] |
響應參數
無
請求示例
- HTTP
- Python
- Node.js
POST /v5/spot-margin-trade/set-leverage HTTP/1.1
Host: api-testnet.bybit.com
X-BAPI-SIGN: XXXXX
X-BAPI-API-KEY: XXXXX
X-BAPI-TIMESTAMP: 1672299806626
X-BAPI-RECV-WINDOW: 5000
Content-Type: application/json
{
"leverage": "4"
}
from pybit.unified_trading import HTTP
session = HTTP(
testnet=True,
api_key="XXXXX",
api_secret="XXXXX",
)
print(session.spot_margin_trade_set_leverage(
leverage="4",
))
const { RestClientV5 } = require('bybit-api');
const client = new RestClientV5({
testnet: true,
key: 'apikey',
secret: 'apisecret',
});
client
.setSpotMarginLeverage('4')
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});
響應示例
{
"retCode": 0,
"retMsg": "OK",
"result": {},
"retExtInfo": {},
"time": 1672710944282
}