Example #1
0
        /// <summary>
        /// Initializes a new portfolio manager able to execute a time simulation
        /// </summary>
        /// <param name="environment">Provided trading environment</param>
        /// <param name="setup">Initial portfolio setup parameters</param>
        /// <param name="dataManager">Initialized and connected Data Manager</param>
        /// <param name="strategy">Strategy Manager loaded with one or more strategies</param>
        public PortfolioManager(PortfolioSetup setup, StrategyManager strategy, RiskManager riskManager, string Name = "Default Portfolio")
        {
            Setup           = setup ?? throw new ArgumentNullException(nameof(setup));
            StrategyManager = strategy ?? throw new ArgumentNullException(nameof(strategy));

            Portfolio    = new Portfolio(setup, Name);
            TradeManager = new TradeManager(Portfolio);

            RiskManager = riskManager;
            RiskManager.Attach(Portfolio, TradeManager);

            //
            // TODO: Implement adjustable security filters
            //

            //SecurityUniverse = (from sec in DataManager.GetAllSecurities() where sec.DataUpToDate select sec).ToList();
            SecurityUniverse = RefDataManager.Instance.GetAllSecurities().Where(x => !x.Excluded).ToList();

            CurrentSimulationDate = setup.InceptionDate;
        }