本文整理汇总了C#中KeyValuePair.WriteToDisk方法的典型用法代码示例。如果您正苦于以下问题:C# KeyValuePair.WriteToDisk方法的具体用法?C# KeyValuePair.WriteToDisk怎么用?C# KeyValuePair.WriteToDisk使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KeyValuePair
的用法示例。
在下文中一共展示了KeyValuePair.WriteToDisk方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CommitBacktest
public static void CommitBacktest(Strat strat_,
KeyValuePair<ConstructGen<double>, ReturnsEval.DataSeriesEvaluator> kvp_)
{
Logger.Debug(string.Format("Commiting {0} backtest to disk", strat_), typeof (BacktestHelper));
kvp_.WriteToDisk(getPath(strat_));
}
示例2: btnTrade_Click
private void btnTrade_Click(object sender, EventArgs e)
{
try
{
TraderArgs args = buildArgs();
if (args == null) return;
ReturnsEval.DataSeriesEvaluator eval = null;
ConstructGen<double> wts = null;
Trader trader = null;
if (m_model.ProductType == ProductType.FX)
trader = Singleton<TraderFX>.Instance;
else if (m_model.ProductType == ProductType.Commods)
trader = Singleton<TraderGen>.Instance;
else if (m_model.ProductType == ProductType.Dynamic || m_model.ProductType==ProductType.EquityFutures || m_model.ProductType==ProductType.FIFutures)
trader = Singleton<TraderGen>.Instance;
//else if (m_model.ProductType == ProductType.ComSpread)
// trader = Singleton<TraderComSpread>.Instance;
//else if (m_model.ProductType == ProductType.FXCross)
// trader = Singleton<TraderFXCross>.Instance;
//else
// throw new Exception("Trader not set in btnTrade_Click");
wts = trader.GetWeights(args);
bool writeToDisk = string.Compare(tbSavePath.Text.Trim(), string.Empty) != 0;
if ((writeToDisk || cbShowPnl.Checked || cbShowWtsPnlDetail.Checked || cbShowInWeightsComparer.Checked ) && args.RebalFrequency != RebalFreq.JustNow)
eval = trader.DoPnl(args, wts);
if (writeToDisk)
{
KeyValuePair<ConstructGen<double>, ReturnsEval.DataSeriesEvaluator> kvp = new KeyValuePair<ConstructGen<double>, ReturnsEval.DataSeriesEvaluator>(
wts,
eval);
kvp.Key.ColumnHeadings = args.Products.Select(x => x.ToString()).ToArray<string>();
kvp.Value.Name = (tbSavePath.Text.Contains(@"\")) ? tbSavePath.Text.Trim().Split('\\').Last<string>() : tbSavePath.Text.Trim();
kvp.WriteToDisk(@"c:\temp\", string.Format("{0}.we", tbSavePath.Text.Trim()));
}
if (cbShowPnl.Checked && eval != null)
{
if (cbClearCache.Checked)
{
Singleton<SI.Data.CentralEvents>.Instance.FireClearCached();
System.GC.WaitForPendingFinalizers();
System.GC.Collect();
System.GC.WaitForFullGCComplete();
}
eval.Display(eval.Name);
}
//if (cbShowInWeightsComparer.Checked)
//{
// QC.Common.WtsAnalysis.WtsAnalysisCompareControl wtsComp = new QC.Common.WtsAnalysis.WtsAnalysisCompareControl();
// wtsComp.Create(new QC.Common.WtsAnalysis.WtsSeriesAnalyzer(eval.Name, FXStrat.Backtests.expandToFullUniverse(args, wts).ToGenContruct(), eval.GetInnerDailyAsConstruct(),
// delegate(DateTime date_)
// {
// DateTime covDate = date_;
// FX.Data.CovarianceItem cov;
// while ((cov = Singleton<FX.Data.FXCovarianceSource>.Instance[covDate, false]) == null)
// covDate = MyCalendar.PrevWeekDay(covDate);
// return cov;
// })
// );
// wtsComp.DisplayInShowForm(string.Format("wts / perf analysis of result ({0})", eval.Name));
//}
if (cbShowWeights.Checked)
{
wts.DisplayInGrid("Weights");
//if (trader is TraderFXCross)
// ConstructDisplay.Show(TraderFXCross.getInTermsOfUSD(args, wts), Singleton<FX.Data.FXIDs>.Instance.Headings, "In terms of usd");
//SaveWeightsFX(args, wts, "MA3T_BT");
}
if (cbShowOrigScores.Checked)
{
var list = new List<KeyValuePair<string, Control>>();
foreach (var product in args.Products)
{
foreach (var indic in args.WtIndicators)
{
string key = string.Format("{0}_{1}", product, indic);
var chart = indic.ChartSignal(product, false);
list.Add(new KeyValuePair<string, Control>(key, chart));
}
}
list.DisplayInShowForm("indicators");
}
//if (cbShowNetExposure.Checked)
// DisplayExposure.DoIt(wts, args);
////if (cbGenFXIntraDayConfig.Checked)
//// FXIntraDayConfigGen.Generator.Gen(args.Products.ToArray(), wts.GetValues(wts.Dates[0]));
//.........这里部分代码省略.........