Skip to main content
POST
/
orders
/
cancel-replace
Cancel and replace order
curl --request POST \
  --url https://api.context.markets/v2/orders/cancel-replace \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "cancel": {
    "trader": "0x1111111111111111111111111111111111111111",
    "nonce": "0xabc123",
    "signature": "0xabc123"
  },
  "create": {
    "type": "limit",
    "marketId": "0x1111111111111111111111111111111111111111111111111111111111111111",
    "trader": "0x1111111111111111111111111111111111111111",
    "price": "1000000",
    "size": "1000000",
    "outcomeIndex": 123,
    "side": 0,
    "nonce": "0xabc123",
    "expiry": "1000000",
    "maxFee": "1000000",
    "makerRoleConstraint": 0,
    "inventoryModeConstraint": 0,
    "signature": "0xabc123",
    "buyValue": "1000000",
    "timeInForce": 0,
    "clientOrderType": "limit"
  }
}
'
{
  "cancel": {
    "success": true,
    "trader": "0x1111111111111111111111111111111111111111",
    "nonce": "0xabc123",
    "alreadyCancelled": true
  },
  "create": {
    "success": true,
    "order": {
      "marketId": "0x1111111111111111111111111111111111111111111111111111111111111111",
      "trader": "0x1111111111111111111111111111111111111111",
      "nonce": "0xabc123",
      "side": 0,
      "price": "1000000",
      "size": "1000000",
      "filledSize": "1000000",
      "remainingSize": "1000000",
      "percentFilled": 123,
      "insertedAt": "2023-11-07T05:31:56Z",
      "type": "limit",
      "status": "open",
      "voidedAt": "2023-11-07T05:31:56Z",
      "voidReason": "UNFILLED_MARKET_ORDER",
      "outcomeIndex": 123,
      "expiry": "1000000",
      "settlementVersion": 1,
      "sv2OrderKind": 0,
      "sv2TimeInForce": 0,
      "sv2MinSharesOut": "1000000",
      "sv2MaxCollateralIn": "1000000",
      "sv2MinCollateralOut": "1000000"
    }
  }
}

Authorizations

Authorization
string
header
required

API key passed as Bearer token

Body

application/json
cancel
object
required
create
object
required

Response

Order cancelled and replaced

cancel
object
required
create
object
required