Skip to main content

Exit workflow

Exit automation mirrors entry:

  1. Prepare exit (async job) → execution plan (ExecPlanId) and pricing snapshots
  2. Execute (paper fills or live orders)
  3. Reconcile the closed state via Control + Event hubs

Minimal runnable example

Use the runnable example (recommended):

# Prepare only
python -m mesolive_sdk_examples.positions_example exit --position-id 789

# Prepare + execute
python -m mesolive_sdk_examples.positions_example exit --position-id 789 --execute --paper-fill-price mid

Automation notes

  • Use a fresh idempotency key for StartPreparePositionExit, and persist it if you may retry after a crash.
  • Exit execution usually uses QtyMultiplier=None. Prefer using exactly what the prepare result and server rules imply, rather than inventing quantities.
  • Monitor OnOrderUpdate/OnPositionUpdate for completion; use polling only as a backstop.