Skip to main content

Position Mode (Hedge / One-way)

Description

Query or change the position mode.

ZTDX only supports One-way Mode

Hedge mode is not supported. A POST that requests dualSidePosition=true is rejected with -4059. Existing one-way positions are unaffected; clients that read this field via GET will always see false.

HTTP Request

  • Query: GET /fapi/v1/positionSide/dual (HMAC SHA256)
  • Change: POST /fapi/v1/positionSide/dual (HMAC SHA256)

Request Parameters (POST only)

NameTypeRequiredDescription
dualSidePositionBOOL or STRINGNODefaults to false when omitted. Accepts true / false (boolean) or "true" / "false" / "1" / "0" / "" (string; "1" means true, "0" and "" mean false). Only false is accepted; true returns -4059.
recvWindowLONGNOIgnored — the server enforces a fixed ±60 second timestamp window regardless of this value.
timestampLONGYESTimestamp

Response Example (GET)

{
"dualSidePosition": false // always false: One-way Mode
}

Response Example (POST)

{
"code": 200,
"msg": "success"
}

Code Examples

curl (query)

API_KEY="your_api_key"
API_SECRET="your_api_secret"
TIMESTAMP=$(date +%s%3N)
QUERY_STRING="timestamp=${TIMESTAMP}"
SIGNATURE=$(echo -n "${QUERY_STRING}" | openssl dgst -sha256 -hmac "${API_SECRET}" | awk '{print $2}')
curl -s -H "X-MBX-APIKEY: ${API_KEY}" \
"https://api.prex.world/fapi/v1/positionSide/dual?${QUERY_STRING}&signature=${SIGNATURE}"

Python

import time, hmac, hashlib, requests

API_KEY = "your_api_key"
API_SECRET = "your_api_secret"
BASE_URL = "https://api.prex.world"

# Query position mode
timestamp = int(time.time() * 1000)
qs = f"timestamp={timestamp}"
sig = hmac.new(API_SECRET.encode(), qs.encode(), hashlib.sha256).hexdigest()
response = requests.get(
f"{BASE_URL}/fapi/v1/positionSide/dual",
params={"timestamp": timestamp, "signature": sig},
headers={"X-MBX-APIKEY": API_KEY}
)
print(response.json()) # {"dualSidePosition": false}