currentPositions at the start of each run to decide what to do.
Current Positions
agent.currentPositions contains assets allocated at the start of execution. Each position includes:
network(string): Network identifier (e.g., “ethereum:137”)assetAddress(string): Token contract addresstokenId(string | null): Token ID for NFTs/ERC1155 (null for fungible tokens)avgUnitCost(string): Average unit cost in USD. Currently returns"0"— cost basis tracking will be enabled in a future release.currentQty(string): Current quantity held (raw amount)
currentPositions reflects balances at execution start. After transactions, use getCurrentPositions() for updated balances.
Get Current Positions
Get live positions with updated balances. Indexing speed varies by chain, so updated positions may not appear immediately after transactions are submitted. For agents that need position updates under 5-10 seconds, it is recommended to track position changes in memory instead.success(boolean): Whether the operation succeededdata.hasPendingTxs(boolean): Whether there are pending transactionsdata.positions(array): Array of current positionserror(string | null): Error message (on failure)
network(string): Network identifierassetAddress(string): Token contract addresstokenId(string | null): Token ID for NFTs/ERC1155avgUnitCost(string): Average unit cost in USDcurrentQty(string): Current quantity held (raw amount)polymarketMetadata(object | null): Enriched Polymarket position data (if applicable)question(string): Market question textoutcome(string): Outcome name (e.g., “Yes”, “No”)valueUsd(string): Position value in USDpriceUsd(string): Current price per shareaveragePriceUsd(string): Average entry pricepnlUsd(string): Profit/loss in USDpnlPercent(string): Profit/loss percentagepnlRealizedUsd(string): Realized PnL in USDpnlRealizedPercent(string): Realized PnL percentageisRedeemable(boolean): Whether position can be redeemedisNegativeRisk(boolean): Whether this is a negative risk marketimageUrl(string): Market image URLendDate(string): Market end datecontractAddress(string): Polymarket contract addresstokenId(string | null): Outcome token IDdecimals(number): Token decimalsconditionId(string): Market condition IDformattedShares(string): Human-readable share countshares(string): Raw share countinitialValue(string): Initial position value
Handling Pending Transactions
IfhasPendingTxs is true, wait until it’s false before relying on balances, as this indicates not all transactions have been indexed. Indexing speed varies by chain. For critical time-sensitive logic, track position changes in memory instead:
Notes
currentPositionsis provided at execution start. UsegetCurrentPositions()for live balances.- Quantities are strings to preserve precision for large numbers.
- Polymarket positions include enriched metadata (question, outcome, PNL, etc.).
- Check
hasPendingTxsbefore relying on balance data after transactions. - For tracking position changes within an execution cycle, consider using Memory to store deltas instead of polling
getCurrentPositions()repeatedly.
See Also
- Wallets & Asset Allocation — How assets are allocated to sessions
- Memory — Track position deltas without polling
- Hyperliquid — Hyperliquid agents use platform-specific balance methods instead