Skip to main content

Adjustment workflow

Adjustments are position lifecycle operations such as adding/removing legs, moving a leg, or updating strategy/position variables.

High-level flow:

  1. Prepare adjustment (async job) → ExecPlanId, order legs, leg groups, and (optionally) an AdjustmentAllowed gate
  2. Execute (paper fills or live orders) unless the operation is server-side only
  3. Reconcile via Control Hub reads and Event Hub updates

Operations

PreparePositionAdjustmentArgs.Operation selects the adjustment type. Common values include:

  • AddLegs, RemoveLegs, MoveLeg: requires execution (orders or paper fills)
  • UpdateVars: applied server-side (no orders)

Minimal runnable example

Use the runnable example:

# Prepare only
python -m mesolive_sdk_examples.positions_example adjust --position-id 789 --operation UpdateVars --condition "my-adjustment-condition"

# Prepare + execute (when the operation requires orders / paper fills)
python -m mesolive_sdk_examples.positions_example adjust --position-id 789 --operation AddLegs --condition "my-adjustment-condition" --execute --paper-fill-price mid

Automation notes

  • Use the Condition field to align with your strategy’s adjustment logic (often taken from an AdjustmentSignalEvent).
  • Not all operations require orders. Treat UpdateVars as “server-side apply”.
  • Subscribe to Event Hub to observe OnPositionAdjustmentPreparationCompleted/Failed and subsequent OnOrderUpdate / OnPositionUpdate / OnLegUpdate.