QuantConnect / Lean

Lean Algorithmic Trading Engine by QuantConnect (Python, C#)
https://lean.io
Apache License 2.0
9.47k stars 3.21k forks source link

Enable the Algorithm to Know its Runtime Mode #6192

Closed AlexCatarino closed 9 months ago

AlexCatarino commented 2 years ago

Expected Behavior

QCAlgorithm is aware of being used in live mode, optimization, and backtest (in QC Cloud or locally).

Actual Behavior

It's only possible to determine whether the algorithm is running in backtesting or live mode with the QCAlgorithm.LiveMode boolean member. Other runtime modes were not needed before the implementation of Optimization and Lean-CLI.

Potential Solution

N/A

Checklist

Martin-Molinero commented 9 months ago

Solved by https://github.com/QuantConnect/Lean/pull/7337