全倉槓桿開關
全倉槓桿開關
覆蓋範圍: 全倉槓桿 (統一帳戶)
警告
您的帳戶需要先開啟全倉槓桿
HTTP 請求
POST /v5/spot-margin-trade/switch-mode
請求參數
參數 | 是否必需 | 類型 | 說明 |
---|---|---|---|
spotMarginMode | true | string | 1 : 開啟,0 : 關閉 |
響應參數
參數 | 類型 | 說明 |
---|---|---|
spotMarginMode | string | 全倉槓桿狀態(1 : 開啟,0 : 關閉) |
請求示例
- HTTP
- Python
- Node.js
POST /v5/spot-margin-trade/switch-mode HTTP/1.1
Host: api-testnet.bybit.com
X-BAPI-SIGN: XXXXX
X-BAPI-API-KEY: XXXXX
X-BAPI-TIMESTAMP: 1672297794480
X-BAPI-RECV-WINDOW: 5000
Content-Type: application/json
{
"spotMarginMode": "0"
}
from pybit.unified_trading import HTTP
session = HTTP(
testnet=True,
api_key="XXXXX",
api_secret="XXXXX",
)
print(session.spot_margin_trade_toggle_margin_trade(
spotMarginMode="0",
))
const { RestClientV5 } = require('bybit-api');
const client = new RestClientV5({
testnet: true,
key: 'apikey',
secret: 'apisecret',
});
client
.toggleSpotMarginTrade('0')
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});
響應示例
{
"retCode": 0,
"retMsg": "OK",
"result": {
"spotMarginMode": "0"
},
"retExtInfo": {},
"time": 1672297795542
}