Skip to main content

Entry workflow

This workflow is the canonical automation path for entering an options position:

  1. Prepare entry (async job) → get ExecPlanId, selected legs, prices/greeks, and an EntryAllowed gate
  2. Execute the execution plan:
    • paper account: ApplyPaperFills
    • live broker: SendOrder (typically one order per leg group)
  3. Reconcile by querying positions/legs and by monitoring events

Entry automation is commonly triggered by Event Hub Entry signals (OnEntrySignal), but you can also trigger entries from your own scheduler or external signals.

Prerequisites

  • A live strategy id (StrategyId) that is active on the target account
  • A connected agent for the provider you choose (IBKR/TastyTrade/Tradier)
  • Recommended: an Event Hub connection subscribed to your strategies (to receive Entry signals, updates, and job completion events)

Minimal runnable example

Use the runnable examples:

# Prepare only (no orders / no paper fills)
python -m mesolive_sdk_examples.positions_example create --strategy-id 123

# Prepare + execute (paper fills on MesoLive paper accounts, SendOrder on live accounts)
python -m mesolive_sdk_examples.positions_example create --strategy-id 123 --execute --paper-fill-price mid

# End-to-end trade flow (single command)
python -m mesolive_sdk_examples.trade_e2e_example --strategy-id 123

Automation notes

  • Persist idempotency keys for:
    • StartPreparePositionEntry (one per intent)
    • each SendOrder submission (one per leg group)
    • ApplyPaperFills
  • Treat EntryAllowed=false as a hard gate unless you have an explicit override path.
  • Prefer Event Hub OnOrderUpdate/OnPositionUpdate for real-time state changes; use Control Hub reads for reconciliation.