My algorithm requires to store internal state in order to functional correctly. I planned to use ObjectStore for that purpose. 

However, same ObjectStore shared between all backtests, live and paper modes. Obviously each algorithm session requires to have its own state and I definitely don't want to corrupt state of my live trading. So I need somehow to distinguish between backtest, paper and live modes - so I could store different keys in ObjectStore and this way to maintain separation. 

Moreover, my broker is IBKR, and I intend to use it both for live and paper trading (it supports paper trading). So I need to know whether I'm running in live or paper mode. 

I'm aware about “LiveMode” property but its boolean - so using it I can know only whether I'm in backtest or not - but that doesn't help to determine whether its paper or live modes. Also, for a question why I not using QC for paper trading - its because I want my paper trading to be close as possible to live, so I prefer to use IBKR for both, to accurately simulate fees, margins, etc.

Author

Evgeni Aizikovich

22 days ago