Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

modifyTpsl

Changes the take-profit / stop-loss pair attached to an open position: trigger prices, sizes, and market or limit execution. The action is signed by an approved agent.

POST/exchangetype modifyTpsl

Change the trigger price, size, or limit price of a position’s TP/SL pair, or remove the pair.Agent-signed

Action fields
tpslModifyTpslBody[]required

Exactly two legs: the stop-loss and the take-profit of one pair, stop-loss first.

ointeger · uint64required

Id of the existing TP or SL order, from `positionTpslOrders`, as an integer. Long form: `oid`.

pstringrequired

Limit price for a limit leg (`isMarket: false`). Empty string for a market leg. Long form: `limitPx`.

sstringrequired

Size in base units. `"0"` closes the entire position; a positive size closes that much; `""` leaves the leg unset. Long form: `sz`.

tTriggerOrderTyperequired

The leg's `trigger` body. `tpsl` is required here and selects which leg this is. Long form: `orderType`.

typestringrequired

Must be `modifyTpsl`.

"modifyTpsl"
Request example
curl -X POST https://rpc.txflow-testnet.xyz/exchange \
  -H "Content-Type: application/json" \
  -H "x-api-version: 2026-08-16" \
  -d '{
  "action": {
    "type": "modifyTpsl",
    "tpsl": [
      {
        "o": 123456790,
        "p": "",
        "s": "0",
        "t": {
          "trigger": {
            "isMarket": true,
            "triggerPx": "48000",
            "tpsl": "sl"
          }
        }
      },
      {
        "o": 123456791,
        "p": "",
        "s": "0",
        "t": {
          "trigger": {
            "isMarket": true,
            "triggerPx": "56000",
            "tpsl": "tp"
          }
        }
      }
    ]
  },
  "signature": {
    "r": "0x<r>",
    "s": "0x<s>",
    "v": 27
  },
  "nonce": 1757992743994,
  "vaultAddress": null,
  "signatureChainId": null
}'
Try it
Response · ModifyTpsl 200
codeinteger

`0` on success.

dataobject
dataobject
typestring

The action's internal name, which does not always match the request `type`.

"ModifyTpsl"
statusstring

A rejected request returns `err` with a non-zero `code` and the reason in `message` (or `response`).

"ok"
Response example
{
  "status": "ok",
  "code": 0,
  "data": {
    "type": "ModifyTpsl",
    "data": {
      "statuses": [
        "success"
      ]
    }
  }
}

TP/SL leg

ointeger · uint64required

Id of the existing TP or SL order, from `positionTpslOrders`, as an integer. Long form: `oid`.

pstringrequired

Limit price for a limit leg (`isMarket: false`). Empty string for a market leg. Long form: `limitPx`.

sstringrequired

Size in base units. `"0"` closes the entire position; a positive size closes that much; `""` leaves the leg unset. Long form: `sz`.

tTriggerOrderTyperequired

The leg's `trigger` body. `tpsl` is required here and selects which leg this is. Long form: `orderType`.

triggerobjectrequired

Always send both legs of the pair, stop-loss first. Each o is one of the pair's two order ids, read from positionTpslOrders. To keep one leg unchanged, resend its current values under its existing o.

Legpst.trigger
Market, whole position"""0"isMarket: true
Market, partial""sizeisMarket: true
Limitlimit price"0" or sizeisMarket: false
Unset""""triggerPx: ""

Setting both legs to unset removes the pair.

Signing

Keep the leg key order o, p, s, t, and the trigger key order isMarket, triggerPx, tpsl. Sign o as an integer, even though a numeric string is accepted on the wire. See MessagePack rules.

Next steps

Read the updated pair back with positionTpslOrders.