Skip to main content

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 Common > Authentication & Code Snippet > Futures > RESTful Private Interface.

Request Method​

POST

Endpoint​

/v1/perpum/positions/margin

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​

ParameterMandatoryTypeDescription
idtrueLongPosition ID
addMarginfalseBigdecimalMargin amount to add.
Note: The margin amount to add must be greater than 0.
reduceMarginfalseBigdecimalMargin amount to reduce.
Note: The margin amount to reduce must be greater than 0.
typefalseStringSpecifies 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​

ParameterTypeDescription
msgStringSuccess
tsLongTimestamp (ms)

Request Example​

The following Python code shows how to add margin to a position.

Note: For a complete code example, please refer to Common > 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 (Common > Authentication & Code Snippet > Futures > RESTful Private Interface)

Note: For a complete Java code example, please refer to Common > 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', 'ts': 1775443378356}