Set Leverage
Sets the leverage multiplier on a symbol. Applies to subsequent orders; does not change the leverage on existing positions.
| Method | POST |
| Path | /v5/position/set-leverage |
| Auth | Authenticated. |
Body parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
category | string | Yes | linear. |
symbol | string | Yes | Symbol (e.g. BTCUSDT). |
buyLeverage | string | Yes | Leverage for long-side orders. |
sellLeverage | string | Yes | Leverage for short-side orders. |
In one-way mode buyLeverage and sellLeverage must match. In hedge mode they can differ.
The allowed range and step come from leverageFilter on Instruments Info — typically 1×–100× in 0.01× steps for BTCUSDT.
Request
- Python
- Java
- Go
- Node.js
from reference_client import sign_request, BASE_URL
import requests, json
payload = {
"category": "linear",
"symbol": "BTCUSDT",
"buyLeverage": "2",
"sellLeverage": "2"
}
headers, path = sign_request("POST", "/v5/position/set-leverage")
r = requests.post(BASE_URL + path, headers=headers, data=json.dumps(payload))
print(r.json())
Map<String, Object> body = new HashMap<>();
body.put("category", "linear");
body.put("symbol", "BTCUSDT");
body.put("buyLeverage", "2");
body.put("sellLeverage", "2");
HttpResponse<String> resp = client.send(
"POST", "/v5/position/set-leverage", null, body);
System.out.println(resp.body());
body := map[string]any{
"category": "linear",
"symbol": "BTCUSDT",
"buyLeverage": "2",
"sellLeverage": "2",
}
bodyJSON, _ := json.Marshal(body)
headers, p, err := SignRequest("POST", "/v5/position/set-leverage", nil)
if err != nil { panic(err) }
req, _ := http.NewRequest("POST", BaseURL+p, bytes.NewReader(bodyJSON))
for k, v := range headers { req.Header.Set(k, v) }
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
out, _ := io.ReadAll(resp.Body)
fmt.Println(string(out))
const {signRequest, BASE_URL} = require('./reference-client');
const body = {
"category": "linear",
"symbol": "BTCUSDT",
"buyLeverage": "2",
"sellLeverage": "2"
};
const {headers, path} = signRequest('POST', '/v5/position/set-leverage');
const r = await fetch(BASE_URL + path, {
method: 'POST',
headers,
body: JSON.stringify(body),
});
console.log(await r.json());
Response
{
"retCode": 0,
"retMsg": "OK",
"result": {},
"retExtInfo": {},
"time": 1756460695432
}
retCode: 110043 with retMsg: "leverage not modified" means the requested leverage matches the current value — your call was a no-op. Treat this as success.