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

twapCancel

Cancels a running TWAP order before its duration ends. The action is signed by an approved agent.

POST/exchangetype twapCancel

Stop a running TWAP before its duration ends.Agent-signed

Action fields
ainteger · uint32required

Perp instrument's external id — the same `a` the TWAP was placed with.

tstringrequired

TWAP id, as a decimal string — the `twapId` returned by `twapOrder`.

typestringrequired

Must be `twapCancel`.

"twapCancel"
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": "twapCancel",
    "a": 1,
    "t": "8642097531"
  },
  "signature": {
    "r": "0x<r>",
    "s": "0x<s>",
    "v": 27
  },
  "nonce": 1757992743994,
  "vaultAddress": null,
  "signatureChainId": null
}'
Try it
Response · twapCancel 200
codeinteger

`0` on success.

dataobject
dataobject
typestring

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

"twapCancel"
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": "twapCancel",
    "data": {
      "status": "success"
    }
  }
}

a is the instrument the TWAP was placed on, and t is the twapId returned by twapOrder. The running TWAPs and their ids are in twapStates.

Signing

Sign t as a string, exactly as sent, and keep the key order a, t. Send the envelope vaultAddress as null. See Signing.

Next steps

On success the response carries data.data.status: "success". The cancelled TWAP then appears in twapHistory and on userTwapHistory.