public void TestTradesToday() { //string filename = "today_trades.txt"; string fileSummary = "summary.xls"; string fileVariability = "variability.txt"; string fileBrutto = "brutto.txt"; string fileBruttoFiltr = "brutto_filtr.txt"; string fileBruttoFiltrPro = "brutto_filtr_pro.txt"; string fileTrades = "trades.txt"; MarketTradesRepository mTR = new MarketTradesRepository(); TradesBolingerRepository tBR = new TradesBolingerRepository(); mTR = (MarketTradesRepository)StaticService.Deserializes(mTR.GetType().ToString(), mTR); tBR = (TradesBolingerRepository)StaticService.Deserializes("09.11.2016_070008", tBR); //for (int i = 3; i <= 3; i++) //{ // CalculationExtremumPrice(mTR, i, filename); //} StaticService.DeleteFile(fileSummary); StaticService.DeleteFile(fileVariability); StaticService.DeleteFile(fileTrades); StaticService.DeleteFile(fileBruttoFiltr); StaticService.DeleteFile(fileBruttoFiltrPro); StaticService.LogFileWriteNotDateTime("Profit sett\tProfit\tCount profit\tCount loss\tCount all", fileSummary, true); // оптимизация по профиту for (int i = 5; i <= 5; i++) { CalculationExtremumProfit(mTR, tBR, 5, i, fileSummary, fileTrades, fileVariability, fileBrutto, fileBruttoFiltr, fileBruttoFiltrPro); } }
public async Task TestTradesTodayAsync() { string _result_test = String.Empty; TimeSpan _runTime; DateTime _startRun = DateTime.Now; decimal otkat = 30; decimal distance = 30; decimal profit = 30; List <Task <string> > tasks = new List <Task <string> >(); MarketTradesRepository mTR = new MarketTradesRepository(); mTR = (MarketTradesRepository)StaticService.Deserializes(mTR.GetType().ToString(), mTR); StaticService.DeleteFile("trade_log.txt"); StaticService.DeleteFile("equ.txt"); StaticService.LogFileWriteNotDateTime("EqCurrent\tCountTrades\tCountProfit\tCountLoss\tDrawdown\t_otkat\t_distance\t_profit", "equ.txt", true); for (int i = (int)otkat; i <= 200; i += 10) { for (int ii = i; ii <= 200; ii += 10) { for (int iii = i; iii <= 200; iii += 10) { //ExtremumPrice _extPrice2 = new ExtremumPrice(); //CalculationExtremumPrice1(mTR, _extPrice2, i, ii, iii, false); Task <string> theTask = TaskCalculation(mTR, i, ii, iii); tasks.Add(theTask); } } } await Task <string> .WhenAll(tasks); foreach (Task <string> item in tasks) { _result_test += item.Result; } _runTime = DateTime.Now - _startRun; StaticService.LogFileWriteNotDateTime(String.Format("{0:00}:{1:00}:{2:00}.{3:000}", _runTime.Hours, _runTime.Minutes, _runTime.Seconds, _runTime.Milliseconds), "runtime.txt", true); StaticService.LogFileWriteNotDateTime(_result_test, "equ.txt", true); }
/// <summary> /// Прогон по единичным параметрам /// </summary> public ExtremumPrice TestTradesToday1() { decimal otkat = 80; decimal distance = 190; decimal profit = 170; MarketTradesRepository mTR = new MarketTradesRepository(); mTR = (MarketTradesRepository)StaticService.Deserializes(mTR.GetType().ToString(), mTR); StaticService.DeleteFile("trade_log.txt"); StaticService.DeleteFile("equ.txt"); return(CalculationExtremumPrice1(mTR, otkat, distance, profit, true)); }