Why Inventory Tracking?
When multiple agents trade on shared accounts, you need to know:- Which agent made which trades
- Each agentβs individual P&L
- Total exposure per agent
controller_id (agent ID).
Position Hold
Each position is uniquely keyed by(connector_name, trading_pair):
Two agents can trade the same pair on the same exchange, and each maintains their own separate position with their own breakeven price and P&L.
Position Types
Trading Pair Format
amount is always in base asset. All P&L is in quote asset.
Position State
Each position tracks cumulative trading activity:Derived Values
Net Amount:buy_amount_base - sell_amount_base
Side:
- Positive net β Long (BUY)
- Negative net β Short (SELL)
- Zero net β Closed
P&L Calculation
All P&L values are in quote asset.Unrealized P&L
Mark-to-market value at current price:Realized P&L
When positions are reduced (buys matched against sells):Global P&L
Example
Trade 1: Buy 100 SOL at $150Via API
Related
- Position Handover - How executors add to inventory
- Executors - Trading operations that create positions

