public string getResult() { var result = new StringBuilder(); resultDateList = getResultDateList(); result.AppendLine("Protocal"); result.AppendLine(TradingProtocal.toTitle()); result.AppendLine(tradeProtocal.ToString()); result.AppendLine("----------"); result.AppendLine("Trade Summary"); result.AppendLine(getTradeSummaryTitle()); result.AppendLine(getTradeSummaryCols()); result.AppendLine(getTradeSummary()); result.AppendLine("----------"); result.AppendLine("Dealed Trade"); foreach (var line in getDealedTradeResult()) { result.AppendLine(string.Join("\t", line)); } result.AppendLine("----------"); result.AppendLine("Daily Trade Detail"); foreach (var thisDate in resultDateList) { foreach (var line in getDailyTradeDetail(thisDate)) { result.AppendLine(string.Join("\t", line)); } } return(result.ToString()); }
public void endSimulation(DateTime currentDate) { int traderCount = 0; string summaryFileName = "summary" + "_" + DateTime.Now.ToString("yyyyMMdd_HHmm"); Core.tradeSimWriter.write("No.\t" + TradingProtocal.toTitle() + "\t" + Trader.getTradeSummaryCols(), summaryFileName, true); foreach (var trader in traders) { trader.endSimulation(currentDate); Core.tradeSimWriter.write(trader.getResult(), $"trader{++traderCount}", false); Core.tradeSimWriter.write(traderCount + "\t" + trader.tradeProtocal.ToString() + "\t" + trader.getShortResult(), summaryFileName, true); } }
public Trader(TradingProtocal tradeProtocal) { this.tradeProtocal = tradeProtocal; }
public void addTradingProtocals(TradingProtocal TradingProtocal) { protocals.Add(TradingProtocal); }