Skip to main content

ExternalData fields

MesoSim supports loading external variables from a CSV file via ExternalData.CsvUrl. MesoLive uses the same mechanism to populate variables during Build and during ongoing signal evaluation.

Source reference (MesoSim): External CSV Data

Field support

Strategy Definition fieldMesoLive supportNotes
ExternalDataSupportedCSV is downloaded and parsed; columns become ScriptEngine variables.
ExternalData.CsvUrlSupportedCSV is updated every minute in live-trading.

CSV requirements

The CSV requirements match MesoSim's requirements:

  • The CSV must have a header row
  • The first column must be named date or datetime
  • Remaining columns become variables (names must be valid identifiers: letters/numbers/underscore)
  • The file must be ≤ 2 MB
  • Only these hosts are allowed:
    • gist.githubusercontent.com
    • docs.google.com

Live semantics in MesoLive (important)

  • MesoLive caches the CSV for about 1 minute and will re-download it after cache expiry (absolute cache expiration).
  • External variables are refreshed during the server-side evaluation cycle (typically ~1 minute), so updates to the CSV are not instantaneous.
  • If the closest CSV entry is more than 5 days older than “now”, evaluation fails for that variable.
    • Keep your CSV current and avoid multi-day gaps.

Date vs datetime behavior

The anti-lookahead behavior still applies:

  • If the first column is a date (no time), the value is treated as sampled at end of day and becomes usable after that day completes.
  • If the first column is a datetime, the value becomes usable after that timestamp has passed.

If you expect the value to be usable intraday, prefer a datetime column.

Troubleshooting

  • External variables missing or Eval failed: validate the CSV URL/host, file size, column names, and that there are recent rows covering the current time.
  • CSV updated but values don’t change: wait ~1 minute for cache expiry and the next evaluation cycle.