Update Leverage
Set leverage for a futures symbol.
HTTP
| Method | POST |
| Endpoint | /trade/api/v2/futures/leverage |
| Rate limit | 10 requests per 60 seconds |
Request Parameters
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
symbol | string | Yes | Symbol, e.g. BTCUSDT. |
exchange | string | Yes | EXCHANGE_2. |
leverage | integer | Yes | Integer between min_leverage and max_leverage for the symbol (read these from Get Instrument Info). |
Leverage change restrictions
You cannot change leverage on a symbol while you have:
- An open position on that symbol, or
- Any open orders on that symbol.
Cancel open orders and close the position first. See Margin & Leverage.
Example
- Python
- Java
- Go
- Node.js
import requests
body = {"symbol": "btcusdt", "exchange": "EXCHANGE_2", "leverage": 13}
headers, path = sign_request("POST", "/trade/api/v2/futures/leverage")
response = requests.post(BASE_URL + path, headers=headers, json=body)
print(response.json())
HashMap<String, Object> body = new HashMap<>();
body.put("symbol", "btcusdt");
body.put("exchange", "EXCHANGE_2");
body.put("leverage", 13);
HttpResponse<String> resp = client.send(
"POST", "/trade/api/v2/futures/leverage", null, body);
System.out.println(resp.body());
body := map[string]any{
"symbol": "btcusdt",
"exchange": "EXCHANGE_2",
"leverage": 13,
}
bodyJSON, _ := json.Marshal(body)
headers, p, err := SignRequest("POST", "/trade/api/v2/futures/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 = {"symbol": "btcusdt", "exchange": "EXCHANGE_2", "leverage": 13};
const {headers, path} = signRequest('POST', '/trade/api/v2/futures/leverage');
const r = await fetch(BASE_URL + path, {
method: 'POST',
headers,
body: JSON.stringify(body),
});
console.log(await r.json());
Response
{
"data": {
"exchange": "EXCHANGE_2",
"symbol": "BTCUSDT",
"leverage": "13"
}
}