Track Position (TP/SL)
After a swap, create a position group with a filled buy order and optional take-profit / stop-loss sell orders. Entry cost is auto-converted to USD (USDC). The platform monitors and auto-sells when thresholds are hit.
Built-in action Built In
After a swap, create a position group with a filled buy order and optional take-profit / stop-loss sell orders. Entry cost is auto-converted to USD (USDC). The platform monitors and auto-sells when thresholds are hit.
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. |
assetAddress | string | Yes | Contract address of the asset you bought (token, conditional token, etc.). |
entryCost | string | Yes | BigInt: amount of quote token spent (from swap/bet result). |
entryAmount | string | Yes | BigInt: amount of asset received (from swap/bet result). |
entryTxHash | string | Yes | Transaction hash of the buy/entry. |
tpMultiplier | number | No | Take-profit multiplier (e.g., 2.0 = sell when worth 2x entry cost). |
slMultiplier | number | No | Stop-loss multiplier (e.g., 0.5 = sell when worth 50% of entry cost). |
label | string | No | Display name for the position (e.g., 'DEGEN', 'Trump YES'). |
quoteToken | string | No | Contract address of what you paid with. Use 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE for native ETH. |
assetDecimals | number | No | Token decimals (default: 18). |
metadata | object | No | Protocol-specific data (e.g., Polymarket marketId, conditionId, outcome). |
sellToToken | string | No | Contract address of the token to receive on sell. Defaults to USDC. |
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
json{ "type": "track-position", "payload": { "walletId": "0x0000000000000000000000000000000000000000", "chainId": 8453, "assetAddress": "0x0000000000000000000000000000000000000000", "entryCost": "example-entryCost", "entryAmount": "1000000", "entryTxHash": "example-entryTxHash" }, "children": []}
bashcurl -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", "entryCost": "example-entryCost", "entryAmount": "1000000", "entryTxHash": "example-entryTxHash" }}'
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.
