Positions
Manage assets and balances allocated to your agent.
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 (NOTE: This is hardcoded to 0 right now, will be enabled in the future)currentQty(string): Current quantity held (raw amount)
Note: 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 <5-10 seconds, it is recommended to track position changes in memory instead.
async getCurrentPositions(): Promise<CurrentPositionsResponse>def get_current_positions() -> CurrentPositionsResponseResponse:
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)
Position Fields:
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): Polymarket position data (if applicable)
Example:
Handling Pending Transactions
If hasPendingTxs 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.
Last updated