Update margin mode
This endpoint allows users to switch between isolated and cross margin modes for a specific trading pair. For open positions, users cannot change the margin mode.
POST /api/v1/account/margin
Operation Type (for signing)
"type"
string
"update_margin_mode"
Request Body
"account"
string
required
User's wallet address
42trU9A5...
"symbol"
string
required
Trading pair symbol
BTC
"is_isolated"
boolean
required
Margin mode (true for isolated, false for cross)
false
"timestamp"
integer
required
Current timestamp in milliseconds
1716200000000
"expiry_window"
integer
optional
Signature expiry in milliseconds
30000
"agent_wallet"
string
optional
Agent wallet address
69trU9A5...
"signature"
string
required
Cryptographic signature
5j1Vy9Uq...
{
"account": "42trU9A5...",
"symbol": "BTC",
"is_isolated": false,
"timestamp": 1716200000000,
"expiry_window": 30000,
"agent_wallet": "69trU9A5...",
"signature": "5j1Vy9Uq..."
}
Response
Status 200: Margin mode updated successfully
{
"success": true
}
Status 400: Invalid request parameters
{
"error": "Invalid margin mode",
"code": 400
}
Status 500: Internal server error
Code Example (Python)
import requests
payload = {
"account": "42trU9A5...",
"signature": "5j1Vy9Uq",
"timestamp": 1716200000000,
"symbol": "BTC",
"is_isolated": false
}
response = requests.post(
"/api/v1/account/margin",
json=payload,
headers={"Content-Type": "application/json"}
)
data = response.json()
Last updated