Beispiel #1
0
        public virtual void makeReport(bool bAddParams = true)
        {
            foreach (string sSymbol in m_sSymbols)
            {
                m_report.m_dProfit   = 0;
                m_report.m_nTradeCnt = 0;

                //Write Trade history to File
                string sData = "";
                foreach (TPosItem posItem in m_lstPosHistory_vt)
                {
                    if (posItem.m_sSymbol != sSymbol)
                    {
                        continue;
                    }

                    m_report.m_dProfit += posItem.m_dProfit_real;
                    m_report.m_nTradeCnt++;
                    sData += posItem.getString();
                    sData += "\r\n";
                }

                if (CFATManager.m_nRunMode == ERUN_MODE.BACKTEST)
                {
                    string sFile = Path.Combine(Application.StartupPath, string.Format("_log\\backtest_reports\\{0}_{1}_{2}.csv",
                                                                                       DateTime.Now.ToString("yyyy_MM_dd HH_mm_ss_fff"), m_sSiteName, sSymbol));
                    File.WriteAllText(sFile, sData);
                }
                //----------------------------------------

                //Output backtest result
                CFATLogger.output_proc(string.Format("*** BackTest Result : Site {0} : {1} ***", m_sSiteName, sSymbol));
                sData = string.Format(" {0}, {1}, Profit,{2:0.00000}, TradeCount = {3},", m_sSiteName, sSymbol, m_report.m_dProfit, m_report.m_nTradeCnt);
                if (bAddParams)
                {
                    sData += CFATCommon.m_sOpt_param;
                }

                CFATLogger.output_opt(sData);
                CFATLogger.output_proc(sData);
                CFATLogger.output_proc("******************************************");
            }
        }