> ## Documentation Index
> Fetch the complete documentation index at: https://docs.b3os.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Track Position (TP/SL)

After a swap, record a filled position and optionally create take-profit / stop-loss sell orders. Non-USDC EVM entry costs are quoted to USDC when this action runs and fail closed if a quote is unavailable. Solana mainnet supports entry-record-only positions with canonical-USDC costs; it does not provide live valuation, P&L monitoring, or automated exits.

![Track Position (TP/SL) logo](https://ai-icon.b3.fun/logo/polymarket)
Built-in action Built In

After a swap, record a filled position and optionally create take-profit / stop-loss sell orders. Non-USDC EVM entry costs are quoted to USDC when this action runs and fail closed if a quote is unavailable. Solana mainnet supports entry-record-only positions with canonical-USDC costs; it does not provide live valuation, P&amp;L monitoring, or automated exits.


## At a Glance

| Field | Value |
| --- | --- |
| Action ID | `track-position` |
| Category | Built In |
| Connector | Not required |
| Requires gas | No |
| Funds movement | None declared |
| Tags | `trading`, `order`, `take-profit`, `stop-loss`, `tp-sl`, `defi`, `swap`, `polymarket`, `perp`, `hyperliquid`, `position` |

## Payload Schema

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `walletId` | `string` | Yes | Wallet ID that holds the position tokens. |
| `chainId` | `number` | Yes | Chain ID where the token was bought. Solana mainnet records the filled entry only; it does not provide live valuation, P&amp;L monitoring, or automated exits. |
| `assetAddress` | `string` | Yes | Token mint or contract address of the asset you bought. |
| `entryCost` | `string` | Yes | Positive canonical decimal string \(no sign or leading zero\): amount of quote token spent. EVM values are bounded by uint256; Solana values are bounded by uint64. Recording fails if the computed per-token price rounds below one USDC base unit. |
| `entryAmount` | `string` | Yes | Positive canonical decimal string \(no sign or leading zero\): amount of asset received. EVM values are bounded by uint256; Solana values are bounded by uint64. Recording fails if the computed per-token price rounds below one USDC base unit. |
| `entryTxHash` | `string` | Yes | Transaction hash or signature of the buy/entry. |
| `tpMultiplier` | `number \| string` | No | Take-profit multiplier \(e.g., 2.0 = sell when worth 2x entry cost\). Up to 6 decimal places. |
| `slMultiplier` | `number \| string` | No | Stop-loss multiplier \(e.g., 0.5 = sell when worth 50% of entry cost\). Up to 6 decimal places. |
| `label` | `string` | No | Display name for the position \(e.g., 'DEGEN', 'Trump YES'\). |
| `quoteToken` | `string` | No | Token mint or contract address of what you paid with. Omit only when entryCost is already denominated in canonical USDC for chainId. Non-USDC EVM costs use a current quote when this action runs and fail if a quote is unavailable; no historical entry-transaction lookup is performed. Solana currently requires canonical USDC. Use 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE for native ETH. |
| `assetDecimals` | `number \| string` | Yes | Required recovery assertion for this post-swap action. The platform verifies it against the token contract before monitoring and retries verification durably after transient failures. |
| `metadata` | `object` | No | Protocol-specific data \(e.g., Polymarket marketId, conditionId, outcome\). |
| `sellToToken` | `string` | No | Optional canonical USDC contract address for the selected chain. Omit to use USDC by default; custom settlement targets are not supported. |
| `positionType` | `string` | No | Position type. Defaults to 'dex'. |

## Result Schema

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `groupId` | `string` | Yes | Unique ID of the order group. Use to query order status via API. |
| `orders` | `array` | Yes | List of created orders \(filled buy + optional TP/SL sell orders\). |

## Examples

**Workflow node**

```json
{
  "type": "track-position",
  "payload": {
    "walletId": "0x0000000000000000000000000000000000000000",
    "chainId": 8453,
    "assetAddress": "0x0000000000000000000000000000000000000000",
    "assetDecimals": 18,
    "entryCost": "1000000",
    "entryAmount": "1000000",
    "entryTxHash": "example-entryTxHash"
  },
  "children": []
}
```
  **Test with API**

```bash
curl -X POST "https://api.b3os.org/v1/actions/track-position/test" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "inputs": {
    "walletId": "0x0000000000000000000000000000000000000000",
    "chainId": 8453,
    "assetAddress": "0x0000000000000000000000000000000000000000",
    "assetDecimals": 18,
    "entryCost": "1000000",
    "entryAmount": "1000000",
    "entryTxHash": "example-entryTxHash"
  }
}'
```

**Use expressions for dynamic values**

Payload fields can use workflow expressions such as `{{$trigger.body.amount}}`, `{{$nodes.fetch.result.price}}`, and `{{$props.asset}}` when the value should come from a trigger, prior node, or reusable workflow prop.