PearPear

Create a new trigger

Create a new trigger to close or reduce a position

POST
/triggers/close
x-api-key<token>

In: header

Header Parameters

X-Trade-Account-Id*string

UUID of the trade account the request acts on. Must belong to the authenticated user.

Formatuuid

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://example.com/triggers/close" \  -H "X-Trade-Account-Id: 3fa85f64-5717-4562-b3fc-2c963f66afa6" \  -H "Content-Type: application/json" \  -d '{    "intent": "CLOSE",    "type": "MARKET",    "positionId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",    "bracketType": "STOP_LOSS",    "condition": {      "type": "ratio",      "data": {        "priceSource": "mid",        "symbol_a": "BTC",        "symbol_b": "BTC",        "threshold": 1      }    }  }'
{  "trigger": {    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",    "tradeAccountId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",    "connector": "hyperliquid",    "status": "ACTIVE",    "ladderId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",    "ladderIndex": -9007199254740991,    "parentTriggerId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",    "triggeredAt": "string",    "cancelledAt": "string",    "cancelledReason": "POSITION_CLOSED",    "fills": [      {        "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",        "cloid": "string",        "exchangeFillId": "string",        "status": "PROVISIONAL",        "tradeAccountId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",        "symbol": "BTC",        "positionId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",        "connector": "hyperliquid",        "side": "BUY",        "reduceOnly": true,        "isExternal": true,        "synthetic": true,        "quantity": "string",        "price": "string",        "usd": "string",        "tradeFee": "string",        "pearFee": "string",        "timestamp": "string",        "original": {          "exchangeFillId": "string",          "quantity": "string"        }      }    ],    "bracketType": "STOP_LOSS",    "semanticBracketType": "STOP_LOSS",    "createdAt": "string",    "updatedAt": "string",    "intent": "OPEN",    "type": "MARKET",    "condition": {      "type": "ratio",      "data": {        "priceSource": "mid",        "symbol_a": "BTC",        "symbol_b": "BTC",        "track": "PEAK",        "threshold": 0      }    },    "context": {      "type": "MARKET",      "legs": [        {          "symbol": "BTC",          "side": "BUY",          "mode": "QUANTITY",          "amount": "1250.75"        }      ],      "attachedTriggers": [        {          "kind": "STATIC",          "bracketType": "TAKE_PROFIT"        }      ]    }  }}