Skip to main content

ScriptEngine modules

MesoLive uses the same ScriptEngine module surface as MesoSim v3:

  • timing.* (market calendar / time helpers)
  • options.* (options valuation helpers)

The key difference is that MesoLive runs these modules against live data (Agent market data + live positions), so results can be missing or change as quotes update.

Timing module

Source reference: Timing Module

FunctionMesoLive supportNotes
timing.trading_days_until(...)SupportedUses MesoLive’s market calendar service and exchange-local time.
timing.trading_days_after(...)SupportedSame semantics as MesoSim (trading-day counting).
timing.calendar_days_until(...)SupportedSame semantics as MesoSim (calendar-day counting).
timing.calendar_days_after(...)SupportedSame semantics as MesoSim (calendar-day counting).
timing.trading_days_in(...)SupportedSame semantics as MesoSim.
timing.calendar_days_in(...)SupportedSame semantics as MesoSim.
timing.minutes_after_openSupportedRounded down to 5-minute resolution (matches MesoSim).
timing.minutes_before_closeSupportedRounded down to 5-minute resolution (matches MesoSim).
timing.day_of_week / year / month / daySupportedUses exchange-local time.
timing.days_in_tradeSupportedUses the tracked position’s creation time in MesoLive.

Options Valuation module

Source reference (MesoSim): Options Valuation

note

options.* requires a position context (an open position, or a Build/Adjustment preview position). If evaluated without a position context, it returns null.

FunctionMesoLive supportNotes
options.model(...)SupportedUses live option snapshots (bid/ask/greeks/IV) from the selected provider. Returns null without a position context or when required data is missing.
options.model_solver(...)SupportedUses live option snapshots and scans the specified underlying range. Returns null without a position context or when required data is missing.

Supported targets and keywords

  • Targets:
    • position
    • leg_<LEGNAME> (dynamic leg keyword)
  • Time anchors (same names as MesoSim):
    • numeric DTE
    • now, at_exp, first_exp, last_exp
  • Metrics:
    • pnl, delta, gamma, theta, vega, wvega, rho
    • Rho is currently always 0 in MesoLive (rho is not supplied by live providers in the current implementation).
  • Solver goal/result keywords:
    • minimize, maximize, zero (alias: root)
    • return_value, return_price (alias: strike)

Live differences vs MesoSim

  • MesoLive depends on your Agent’s current market data; missing quotes/greeks can cause options.* calls to return null.