Batch Set Collateral Coin
HTTP Request
POST /v5/account/set-collateral-switch-batch
Request Parameters
Parameter | Required | Type | Comments |
---|---|---|---|
request | true | array | Object |
> coin | true | string | Coin name, uppercase only
|
> collateralSwitch | true | string | ON : switch on collateral, OFF : switch off collateral |
Response Parameters
Parameter | Type | Comments |
---|---|---|
result | Object | |
> list | array | Object |
>> coin | string | Coin name |
>> collateralSwitch | string | ON : switch on collateral, OFF : switch off collateral |
Request Example
- HTTP
- Python
- Node.js
POST /v5/account/set-collateral-switch-batch HTTP/1.1
Host: api-testnet.bybit.com
X-BAPI-SIGN: XXXXXX
X-BAPI-API-KEY: XXXXXX
X-BAPI-TIMESTAMP: 1704782042755
X-BAPI-RECV-WINDOW: 5000
Content-Type: application/json
Content-Length: 371
{
"request": [
{
"coin": "MATIC",
"collateralSwitch": "OFF"
},
{
"coin": "BTC",
"collateralSwitch": "OFF"
},
{
"coin": "ETH",
"collateralSwitch": "OFF"
},
{
"coin": "SOL",
"collateralSwitch": "OFF"
}
]
}
from pybit.unified_trading import HTTP
session = HTTP(
testnet=True,
api_key="XXXXX",
api_secret="XXXXX",
)
print(session.batch_set_collateral_coin(
request=[
{
"coin": "BTC",
"collateralSwitch": "ON",
},
{
"coin": "ETH",
"collateralSwitch": "ON",
}
]
))
const { RestClientV5 } = require('bybit-api');
const client = new RestClientV5({
testnet: true,
key: 'apikey',
secret: 'apisecret',
});
client
.batchSetCollateralCoin({
request: [
{
coin: 'BTC',
collateralSwitch: 'ON',
},
{
coin: 'ETH',
collateralSwitch: 'OFF',
},
],
})
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});
Response Example
{
"retCode": 0,
"retMsg": "SUCCESS",
"result": {
"list": [
{
"coin": "MATIC",
"collateralSwitch": "OFF"
},
{
"coin": "BTC",
"collateralSwitch": "OFF"
},
{
"coin": "ETH",
"collateralSwitch": "OFF"
},
{
"coin": "SOL",
"collateralSwitch": "OFF"
}
]
},
"retExtInfo": {},
"time": 1704782042913
}