コード例 #1
0
        public StrategySimulatorDlg(StockDictionary stockDictionary, StockPortofolioList stockPortofolioList, string stockName)
        {
            InitializeComponent();

             // Initialize portofolio combo
             this.stockDictionary = stockDictionary;
             this.portofolioComboBox.Enabled = true;
             this.portofolioComboBox.Items.Clear();
             if (stockPortofolioList.Count == 0)
             {
            StockPortofolio portofolio = new StockPortofolio("SIMULATION");
            stockPortofolioList.Add(portofolio);
             }
             foreach (string name in stockPortofolioList.GetPortofolioNames())
             {
            this.portofolioComboBox.Items.Add(name);
             }
             this.portofolioComboBox.SelectedItem = this.portofolioComboBox.Items[0];

             // Initialize stock combo
             this.stockPortofolioList = stockPortofolioList;
             this.stockComboBox.Enabled = true;
             this.stockComboBox.Items.Clear();
             foreach (StockSerie stockSerie in stockDictionary.Values)
             {
            this.stockComboBox.Items.Add(stockSerie.StockName);
             }
             this.stockComboBox.SelectedItem = this.stockComboBox.Items[0];
        }
コード例 #2
0
        public PortfolioSimulatorDlg(StockDictionary stockDictionary, StockPortofolioList stockPortofolioList,
          string stockName, List<StockWatchList> watchLists)
        {
            InitializeComponent();

             foreach (var val in Enum.GetValues(typeof(UpdatePeriod)))
             {
            this.frequencyComboBox.Items.Add(val);
             }
             this.frequencyComboBox.SelectedIndex = 0;

             // Initialize portofolio combo
             this.stockDictionary = stockDictionary;
             this.portofolioComboBox.Enabled = true;
             this.stockPortofolioList = stockPortofolioList;
             this.portofolioComboBox.Items.Clear();
             if (stockPortofolioList.Count == 0)
             {
            StockPortofolio portofolio = new StockPortofolio("SIMULATION");
            stockPortofolioList.Add(portofolio);
             }
             foreach (string name in stockPortofolioList.GetPortofolioNames())
             {
            this.portofolioComboBox.Items.Add(name);
             }
             this.portofolioComboBox.SelectedItem = this.portofolioComboBox.Items[0];

             // Initialise input series
             this.watchLists = watchLists;
             this.portfolioStockSeries = new List<StockSerie>();
             foreach (string wlName in this.watchLists.Select(wl => wl.Name))
             {
            this.watchListComboBox.Items.Add(wlName);
             }
             this.watchListComboBox.SelectedIndex = 1;

             // Initialize Strategy combo
             this.strategyComboBox.Enabled = true;
             this.strategyComboBox.Items.Clear();
             foreach (string name in PortfolioStrategyManager.GetStrategyList())
             {
            this.strategyComboBox.Items.Add(name);
             }
             this.strategyComboBox.SelectedIndex = 0;
        }