Skip to main content
Inventory (also called Position Hold) is the virtual portfolio that tracks a Trading Agent’s cumulative trading impact. It enables accurate P&L attribution when multiple agents share the same exchange accounts.

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
The Inventory system solves this by tracking positions per 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

Key principle: 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
Breakeven Price: Volume-weighted average entry price

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 $150
Trade 2: Buy 50 SOL at $145
Trade 3: Sell 100 SOL at $155

Via API