예제 #1
0
        public PortfolioManager(DataManager DataManager, PortfolioSetup PortfolioSetup, IEnvironment Environment, Strategy Strategy)
        {
            _DataManager    = DataManager ?? throw new ArgumentNullException(nameof(DataManager));
            _PortfolioSetup = PortfolioSetup ?? throw new ArgumentNullException(nameof(PortfolioSetup));
            _Environment    = Environment ?? throw new ArgumentNullException(nameof(Environment));
            _Strategy       = Strategy ?? throw new ArgumentNullException(nameof(Strategy));

            _Portfolio = new Portfolio(_Environment, _PortfolioSetup, _Strategy);

            CurrentDate = _PortfolioSetup.InceptionDate;

            PopulateSecurityUniverse();
        }
예제 #2
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;
        }
예제 #3
0
 public Portfolio(PortfolioSetup portfolioSetup, string name = "Default Portfolio")
 {
     PortfolioSetup = portfolioSetup ?? throw new ArgumentNullException(nameof(portfolioSetup));
     Name           = name;
 }