# Positions Subscription & Events

## Subscribtion Method

#### `subscribe_positions_api`

Subscribe to real-time position updates using your API key.
It also returns all open positions at the time of subscription.

**Request:**


```javascript
{
  "apiKey": "your-api-key-here"
}
```

**Response example:**

It returns an array of all open positions.


```javascript
{
   "openPositions": [
      {
         "amountOfTokensSold": "0",
         "autoSellSettings": {
            "highestPriceExpressedInUsd": "0.000009408065947372651",
            "initialPriceExpressedInUsd": "0.000009399546288205757",
            "strategy": {
               "profitTargets": [
                  {
                     "multiplier": 1.01,
                     "sellPercentage": 50,
                     "trailingStopLossAfter": 20
                  },
                  {
                     "multiplier": 1.02,
                     "sellPercentage": 30,
                     "trailingStopLossAfter": 30
                  },
                  {
                     "multiplier": 1.03,
                     "sellPercentage": 20,
                     "trailingStopLossAfter": 20
                  },
                  {
                     "multiplier": 1.04,
                     "sellPercentage": 0,
                     "trailingStopLossAfter": 0
                  }
               ],
               "stopLossPercentage": 25,
               "stopLossType": "trailing",
               "strategyName": "grid"
            },
            "tokenAmountSold": "0"
         },
         "closedAt": null,
         "closedBy": null,
         "createdAt": "2025-07-25T21:29:21.771Z",
         "errorType": null,
         "id": 410899,
         "initialSolAmount": "100000",
         "initialSolAmountUi": 0.0001,
         "initialTokenAmount": "1970134811",
         "initialTokenAmountUi": 1970.134811,
         "isFalselyOpenSuspicion": false,
         "isOpen": true,
         "isPaused": false,
         "oneSolPriceInUSDAtClosing": null,
         "oneSolPriceInUSDAtCreation": "185.1837335",
         "timeoutRetryCount": 0,
         "tokenAddress": "5MWtJ6n3LmgGNTCo8sRpsJCcXgvD9TguWNAdqvkwbonk",
         "tokenExtraInfo": {
            "tokenDecimals": 6,
            "tokenImage": "https://ipfs.launchblitz.ai/file/cce750e2-49be-47b2-8884-48c74edcef88.jpg",
            "tokenName": "Rug",
            "tokenSymbol": "RUG",
            "totalSupply": 999631926.011981
         },
         "transactions": [
            {
               "id": 860868,
               "positionId": 410899,
               "positionTransactionTypeEnum": "initial_buy",
               "solAmount": "100000",
               "tokenAmount": "1970134811",
               "transactionDate": "2025-07-25T21:29:21.771Z",
               "transactionId": "4hc3f5yDfaHkaBAnUYh92TpDnqAsRuZMTitutPwRYNY5qbcXi57dCjPxu93fSxQJGjFuS3scY2AeCam6h7gjZtnm"
            }
         ],
         "updatedAt": "2025-07-25T21:29:21.795Z",
         "userId": 1235,
         "walletAddress": "55qd4sXuD9sxNuB81zt774Yu1TmCXDRgJtcERtPkQWxt",
         "walletId": 8963,
         "weirdErrorRetryCount": 0
      }
   ],
   "timestamp": 1753480570825
}
```

## Position Events

| Event | Description |
|  --- | --- |
| `position_created` | A new position was opened |
| `position_updated` | Position details changed (includes type: "update" or "close") |
| `position_transaction_added` | New sell transactio\n within a position |


#### Event Data Structures

[Download Typescript Interfaces](/assets/interfaces.0041f78313d0b18b80c38f92ca1f886e06dafb3855649a1eea8ef3adc88293c0.b6def933.rar)

**position_created:**


```javascript
{
  "positionWithTransactions": PositionWithTransactions,
  "timestamp": 1642694400000
}
```

**position_updated:**


```
{
  "position": SelectPosition,
  "timestamp": 1642694400000,
  "type": "update" | "close"
}
```

**position_transaction_added:**


```javascript
{
  "positionTransaction": SelectPositionTransaction,
  "timestamp": 1642694400000
}
```