コード例 #1
0
        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());
        }
コード例 #2
0
ファイル: TradeSimulator.cs プロジェクト: david855033/AlphaS
        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);
            }
        }
コード例 #3
0
 public Trader(TradingProtocal tradeProtocal)
 {
     this.tradeProtocal = tradeProtocal;
 }
コード例 #4
0
ファイル: TradeSimulator.cs プロジェクト: david855033/AlphaS
 public void addTradingProtocals(TradingProtocal TradingProtocal)
 {
     protocals.Add(TradingProtocal);
 }