Adjust Margin
API Description
This interface allows users to adjust the margin of an existing position (filled orders). By specifying the position ID, users can either add or remove a specific margin amount.
Note: Adjust Margin is only available via RESTful API.
Precautions
None
Authentication
This is a private interface and requires authentication. For details on using the RESTful API, refer to Introduction > Authentication & Code Snippet > Futures > RESTful Private Interface.
Request Method
POST
Endpoint
Frequency Limit
The frequency limit for this interface is 5 requests/s per user ID and IP. In addition to this per-interface limit, a global rate limit is also enforced.
For detailed information on Global rate limits and API Rate Limiting Policy, please refer to the "Frequency Limit" section at click here
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| id | true | Long | Position ID |
| addMargin | false | Bigdecimal | Margin amount to add. Note: The margin amount to add must be greater than 0. |
| reduceMargin | false | Bigdecimal | Margin amount to reduce. Note: The margin amount to reduce must be greater than 0. |
| type | false | String | Specifies the scope of the balance inquiry. Possible values are : all: includes both balance and Mega Coupon; almightyGold: Mega Coupon only; balance: balance only. |
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| msg | String | Success |
Request Example
The following Python code shows how to add margin to a position.
Note: For a complete code example, please refer to Introduction > Authentication & Code Snippet > Futures > RESTful Private Interface.
params = {
"id": "2435521222632020221",
"addMargin": 1,
# "reduceMargin": 1,
# "type": "all",
}
method = "POST"
api_url = "/v1/perpum/positions/margin"
response_code, response_data = FuturesRestfulPrivate(params, api_url, method, sec_key, api_key) # function FuturesRestfulPrivate() is defined in section (Introduction > Authentication & Code Snippet > Futures > RESTful Private Interface)
Note: For a complete Java code example, please refer to Introduction > Authentication & Code Snippet > Futures > RESTful Private Interface.
Response Example
The following is an example response returned by the above Python request:
{'code': 0, 'msg': 'Success'}