本文整理汇总了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;
}
示例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;
}