public static ZooData Calculate( String instKey, AdjTable adjTable, DateTime from, DateTime until, double investAmount) { SortedList<DateTime, double> adjs = adjTable.Data[instKey]; SortedList<DateTime, double> investAmts = CreateInvestAmount(adjs, investAmount); SortedList<DateTime, double> instData = MarketDataManager.Ins().GetData(instKey); SortedList<DateTime, double> increments = ConvertUtil.ToIncrement(instData); // create pivot dates List<DateTime> pivotDates = CreatePivotDates(from, until, instData); // create ZooData, Set adj and instData ZooData zoo = new ZooData(); zoo.SetPivotDates(pivotDates); zoo.Append("insts", instData); // instruments market data zoo.Append("increments", increments); zoo.Append("adjs", adjs, 1.0); zoo.Append("investAmts", investAmts); SortedList<DateTime, double> pnls = CalculatePnl(zoo, investAmount); SortedList<DateTime, double> sum = ConvertUtil.ToSum(pnls); zoo.Append("pnls", pnls); zoo.Append("sum", sum); return zoo; }
void ReportResultData() { ZooData zoo = new ZooData(); zoo.SetPivot("CumPnl", GetCumPnls()); zoo.Append("Index", _marketData); zoo.Append("Investment", GetInvestments()); zoo.ToCsv(String.Format("C:\\report\\result_data_{0}.csv", this.Key)); }