void ReportManager::_ShowReport(Report& report) const { this->Log(CLASS "=== Begin results ==="); this->Log(CLASS "Parameters:"); report.DumpParams(); this->Log(CLASS "Results:"); float balance = this->_conf.deposit; unsigned int profitTrades = 0; unsigned int profitBuyTrades = 0; unsigned int profitSellTrades = 0; unsigned int lossTrades = 0; unsigned int lossBuyTrades = 0; unsigned int lossSellTrades = 0; std::list<Report::Trade> const& trades = report.GetTrades(); std::list<Report::Trade>::const_iterator it = trades.begin(); std::list<Report::Trade>::const_iterator itEnd = trades.end(); for (; it != itEnd; ++it) { balance += it->counterCurrencyProfit; if (it->counterCurrencyProfit > 0) { ++profitTrades; if (it->type == Core::Controller::StatusBuy) ++profitBuyTrades; else ++profitSellTrades; } else { ++lossTrades; if (it->type == Core::Controller::StatusBuy) ++lossBuyTrades; else ++lossSellTrades; } } this->Log(CLASS " - Balance: " + this->_conf.counterCurrency + " " + Tools::ToString(balance, 2) + "."); this->Log(CLASS " - Profit: " + this->_conf.counterCurrency + " " + Tools::ToString(balance - this->_conf.deposit, 2) + "."); this->Log(CLASS " - Trades:\t\tP\tP%\tL&E\tL&E%"); this->Log(CLASS " - All\t" + Tools::ToString(profitTrades + lossTrades) + "\t" + Tools::ToString(profitTrades) + "\t" + Tools::ToString((profitTrades / static_cast<float>(lossTrades + profitTrades)) * 100., 2) + "\t" + Tools::ToString(lossTrades) + "\t" + Tools::ToString((lossTrades / static_cast<float>(lossTrades + profitTrades)) * 100., 2)); this->Log(CLASS " - Buy\t" + Tools::ToString(profitBuyTrades + lossBuyTrades) + "\t" + Tools::ToString(profitBuyTrades) + "\t" + Tools::ToString((profitBuyTrades / static_cast<float>(lossBuyTrades + profitBuyTrades)) * 100., 2) + "\t" + Tools::ToString(lossBuyTrades) + "\t" + Tools::ToString((lossBuyTrades / static_cast<float>(lossBuyTrades + profitBuyTrades)) * 100., 2)); this->Log(CLASS " - Sell\t" + Tools::ToString(profitSellTrades + lossSellTrades) + "\t" + Tools::ToString(profitSellTrades) + "\t" + Tools::ToString((profitSellTrades / static_cast<float>(lossSellTrades + profitSellTrades)) * 100., 2) + "\t" + Tools::ToString(lossSellTrades) + "\t" + Tools::ToString((lossSellTrades / static_cast<float>(lossSellTrades + profitSellTrades)) * 100., 2)); this->Log(CLASS "=== End results ==="); }
void Report::CopyDataFrom(Report const& report) { this->_params.GetDataFrom(report.GetParams()); this->_failed = report.HasFailed(); this->_trades = report.GetTrades(); }