updatePositionMode
Switches the account between one-way and hedge position mode. In one-way mode a market holds a single net position; in hedge mode it can hold a long and a short at the same time — see Margin & Leverage.
The setting is account-wide and applies to perpetuals only. There is no per-instrument variant.
updatePositionModeSwitch the whole account between one-way and hedge mode (must be flat on perps).Agent-signed
`true` for one-way, `false` for hedge.
Must be `updatePositionMode`.
"updatePositionMode"curl -X POST https://rpc.txflow-testnet.xyz/exchange \
-H "Content-Type: application/json" \
-H "x-api-version: 2026-08-16" \
-d '{
"action": {
"type": "updatePositionMode",
"isOneway": true
},
"signature": {
"r": "0x<r>",
"s": "0x<s>",
"v": 27
},
"nonce": 1757992743994,
"vaultAddress": null,
"signatureChainId": null
}'`0` on success.
The action's internal name, which does not always match the request `type`.
"UpdatePositionMode"A rejected request returns `err` with a non-zero `code` and the reason in `message` (or `response`).
"ok"{
"status": "ok",
"code": 0,
"data": {
"type": "UpdatePositionMode",
"data": {
"statuses": [
"success"
]
}
}
}isOneway is the only field. Do not send an asset — the action carries no instrument, and any extra key would change the MessagePack bytes your client hashes without changing what the node hashes, so the signature would fail to recover.
Preconditions
The account must be flat on perpetuals before the mode can change:
| Error | Cause |
|---|---|
You have open perps orders or positions | Any perpetual open order, position, or ungrouped trigger order exists |
Cannot change position mode while a TWAP order is active | A TWAP job is still running |
Reverse position in progress for this coin and margin mode | A reverse-position job is still running |
Liquidator cannot update position mode | Liquidator accounts are fixed to hedge mode |
Outcome-market orders and positions do not block the switch, since position mode only applies to perpetuals. Cancel the perpetual orders and close the positions in question, then retry.
Next steps
The active mode is reflected in activeAssetData: one-way returns a single leverage.value, hedge returns separate leverage.long_value and leverage.short_value. Set those per-side leverages with updateLeverage.