当前位置: 首页>>代码示例>>C#>>正文


C# StockSerie.GenerateSimulation方法代码示例

本文整理汇总了C#中StockSerie.GenerateSimulation方法的典型用法代码示例。如果您正苦于以下问题:C# StockSerie.GenerateSimulation方法的具体用法?C# StockSerie.GenerateSimulation怎么用?C# StockSerie.GenerateSimulation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StockSerie的用法示例。


在下文中一共展示了StockSerie.GenerateSimulation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GenerateTradingSimulation

        private StockPortofolio GenerateTradingSimulation(StockSerie stockSerie, System.DateTime startDate, System.DateTime endDate, float amount, bool reinvest, bool amendOrders, bool supportShortSelling, float fixedFee, float taxRate)
        {
            // Manage selected Stock and portofolio
            stockPortofolioList.RemoveAll(p => p.Name == (stockSerie.StockName + "_P"));

            StockPortofolio portofolio = new StockPortofolio(stockSerie.StockName + "_P");
            portofolio.TotalDeposit = amount;
            stockPortofolioList.Add(portofolio);

            stockSerie.GenerateSimulation(SelectedStrategy, startDate, endDate, amount, reinvest,
                                    amendOrders, supportShortSelling, fixedFee, taxRate, portofolio);

            // Create Portofoglio serie
            portofolio.Initialize(stockDictionary);

            return portofolio;
        }
开发者ID:dadelcarbo,项目名称:StockAnalyzer,代码行数:17,代码来源:SarexStrategySimulatorTuningDlg.cs

示例2: GenerateSimulation

        private StockPortofolio GenerateSimulation(StockSerie stockSerie)
        {
            stockSerie.Initialise();

             // Manage selected Stock and portofolio
             StockPortofolio portofolio = new StockPortofolio(stockSerie.StockName + "_P");
             portofolio.TotalDeposit = this.simulationParameterControl.amount;
             stockPortofolioList.Add(portofolio);

             this.SelectedStrategy = StrategyManager.CreateStrategy(this.simulationParameterControl.SelectedStrategyName, stockSerie, null, simulationParameterControl.supportShortSelling);

             // intialise the serie
             stockSerie.Initialise();

             StockOrder lastOrder = stockSerie.GenerateSimulation(SelectedStrategy, this.simulationParameterControl.StartDate, this.simulationParameterControl.EndDate.AddHours(18), this.simulationParameterControl.amount, this.simulationParameterControl.reinvest,
             this.simulationParameterControl.amendOrders, this.simulationParameterControl.supportShortSelling,
             this.simulationParameterControl.takeProfit, this.simulationParameterControl.profitRate,
             this.simulationParameterControl.stopLoss, this.simulationParameterControl.stopLossRate,
             this.simulationParameterControl.fixedFee, this.simulationParameterControl.taxRate, portofolio);

             // Do a bit of cleanup
             if (lastOrder != null && this.simulationParameterControl.removePendingOrders)
             {
            if (lastOrder.IsBuyOrder())
            {
               lastOrder = null;
            }
            else
            {
               if (lastOrder.State != StockOrder.OrderStatus.Executed)
               {
                  portofolio.OrderList.Remove(portofolio.OrderList.Last());
                  lastOrder = null;
               }
            }
             }

             // Display pending order
             if (this.simulationParameterControl.displayPendingOrders && lastOrder != null && lastOrder.State == StockOrder.OrderStatus.Pending)
             {
            if (SelectedStockChanged != null)
            {
               SelectedStockChanged(lastOrder.StockName, true);
            }
            OrderEditionDlg orderEditionDlg = new OrderEditionDlg(lastOrder);
            orderEditionDlg.StartPosition = FormStartPosition.Manual;
            orderEditionDlg.Location = new Point(0, 0);
            orderEditionDlg.ShowDialog();
             }

             // Create Portofoglio serie
             portofolio.Initialize(stockDictionary);
             if (stockDictionary.Keys.Contains(portofolio.Name))
             {
            stockDictionary.Remove(portofolio.Name);
             }
             stockDictionary.Add(portofolio.Name, portofolio.GeneratePortfolioStockSerie(portofolio.Name, stockSerie, stockSerie.StockGroup));

             // Generate report
             if (this.generateReportCheckBox.Checked)
             {
            this.simulationParameterControl.GenerateReportLine("BatchReport_" + SelectedStrategy + ".csv", stockSerie, portofolio);
             }

             return portofolio;
        }
开发者ID:dadelcarbo,项目名称:StockAnalyzer,代码行数:66,代码来源:BatchStrategySimulatorDlg.cs


注:本文中的StockSerie.GenerateSimulation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。