For the latest documentation, please visit the new sites: MesoSim docs at docs.mesosim.io and MesoLive docs at docs.mesolive.io.

Event Log Export

MesoSim records its key execution steps in the Event Log stream, called Blotter Events. The events recorded in Blotter are visible on the Backtest Details page under the ‘Events’ tab:

Events Tab
Events Tab

 With MesoSim version 2.1.0, the event log becomes available to export, enabling the users to do post-processing and custom analytics.

The event log format is JSON. During the download, the JSON is compressed, and a zip file is returned, which can easily be extracted on all platforms.

Fields of the Event log

BlotterEvent {
 DateTime EventTime           // The real time when the event happened
 DateTime? SimTime            // Simulation time for the event
 BlotterEventType EventType   // See BlotterEventType for details
 string Message               // Message associated with the event
 bool Invested                // Boolean flag of investment state
 decimal? NAV                 // Net Asset Value
 decimal? PnL                 // The running Profit and Loss
 int TradeCnt                 // Number of trades executed so far
 int SettlementCnt            // Number of settlements so far
 int OpenLegCnt               // Number of open legs
 TradeEventDto? TradeEvent    // Trade information (
 Dictionary<string, decimal>? Vars // ScriptEngine’s variables
 int? PositionId              // The ID of the position we 
}

BlotterEventType {
   // Strategy level events
   EntrySignal,
   EntryAborted,
   ExitSignal,
   AdjustmentSignal,
   AdjustmentDetail,
   AdjustmentAborted,
   ExpirationSelected,
   LegSelected,
   VariableSet,
   IndicatorInitialized,
   IndicatorFailed,
  
   // Broker level events
   EntryTrade,
   ExitTrade,
   Settlement,
  
   PriceZero,
   StrikeNotFound,
   MissingData,
  
   EndOfDay,
   Start,
   Finish,
   Failed,
}


TradeEvent {
  int TradeId               // Monotonically increasing TradeId
  OptionContract Contract   // Contract associated with the Trade
  decimal Price             // Execution price for the trade
  decimal Qty               // Qty of the trade
}

OptionContract {
  string Underlying    // Underlying symbol, such as SPX
  string Root          // The root (option class). e.g. SPX or SPXW
  OptionType Type      // Type of the option: Put or Call
  DateTime Expiration  // Expiration of the contract 
  decimal Strike       // Strike price of the contract
  int Multiplier       // Share multiplier of the contract. Defaults to 100
}

Notable event types:

  • EntrySignal: When Entry.Condition is populated, and any of its statements become true; it is triggered
  • EntryAborted: When Entry.AbortConditions is populated, and any of its statements become true, it is triggered
  • ExitSignal: When either the max days in trade is reached, or any of the exit condition is met
  • EndOfDay: Triggered once every day. When the Message field equals “DIT=0”, it contains the initial set of variables when an update is done daily.
  • LegSelected: Contains details around the log chosen by the selectors

Post-processing of the events can be done using various tools, such as Microsoft Excel (using PowerQuery), jq or Python.