Skip to main content
Position Handover is the mechanism by which executors transfer their positions to the agent’s inventory (Position Hold) when they terminate with keep_position=true.

How It Works

When an executor terminates, it can either:
  • Close the position and report realized P&L
  • Hand over the position to the agent’s inventory for later management

keep_position Behavior

Executor Defaults

The Handover Flow

1. Executor Creates Trades

2. Executor Terminates

When the executor terminates (e.g., stop loss hit with keep_position=true):

3. Position Added to Inventory

The Position Hold aggregates with any existing position:

4. Agent Manages on Next Tick

On the next tick, the agent sees the position:
The agent can then:
  • Wait for recovery
  • Spawn a new executor to exit
  • Hedge with another position
  • Add to the position

Example: Grid Stop-Loss Recovery

LP Position Handover

LP positions work differently:
  1. On-chain position always closes when executor terminates
  2. If keep_position=true, the net token change is tracked
  3. ADD events → SELL (tokens left wallet)
  4. REMOVE events → BUY (tokens + fees returned)

Position Accumulation

Multiple executors can add to the same position:
Each executor adds to the Position Hold, creating a single aggregated position.

When to Use keep_position