} // constractor public finalAllStratLog(finalAllStratLog l) { this.start = l.start; this.end = l.end; this.name = l.name; this.pLog = l.pLog; this.numOfPos = l.numOfPos; this.avg = l.avg; this.totalSum = l.totalSum; this.avgSum = l.avgSum; this.percentProfit = l.percentProfit; this.paramArr = new double[l.paramArr.Length]; for(int i = 0; i<l.paramArr.Length; i++) { this.paramArr[i] = l.paramArr[i]; } this.Score = l.Score; } // copy constractor
static void Main(string[] args) { //binaryconverter.binconv(); //only for new files List<Strategy> ls = new List<Strategy>(); //list of strategies List<finalAllStratLog> ell = new List<finalAllStratLog>(); //list of config final log //creates list createStrategyToList(ls); RunMain(path, ls); // runs methods finalAllStratLog editLog = new finalAllStratLog(ls[0].getLength()); foreach (var strat in ls) // prints log for pos { if (strat.getList().Count != 0) { strat.writePosLogFile(strat.getList(), path); } else { creatErrorInfoLogTxt("No Transactions and Positions for: " + strat.getName() + " Paramaters: " + strat.getParamatersInfo()); } finalAllStratLog logInfo; logInfo = strat.editFinalLogData(path, editLog); if (logInfo != null) ell.Add(new finalAllStratLog(logInfo)); } foreach (finalAllStratLog e in ell) // prints sum log for all strategy { printFinalConfigLog(path, ell); } //add func to create graph img to top 10 (paramater) } // Main
} // writes position - configuration log into file public finalAllStratLog editFinalLogData(String path , finalAllStratLog endLog/* , double score*/) { if (this.logInfo.Count != 0) { endLog.start = this.logInfo[0].getFirst().datetime; endLog.end = this.logInfo[this.logInfo.Count() - 1].getEnd().datetime; endLog.name = this.name; endLog.pLog = path; endLog.numOfPos = this.logInfo.Count(); endLog.avg = 0; foreach (saveData s in this.logInfo) { endLog.avg += ProgramMain.deltaMin(s.getFirst().datetime, s.getEnd().datetime); } // makes avg time for position endLog.avg = (endLog.avg / endLog.numOfPos) / 60; endLog.totalSum = this.sum; foreach (saveData s in this.logInfo) { endLog.avgSum += s.getProfit(); } endLog.avgSum = endLog.avgSum / this.logInfo.Count(); // does avg sum for position int totalPos = logInfo.Count(); int profitablePos = logInfo.Where(x => x.getBoolProfit()).Count(); endLog.percentProfit = ((1.0 * profitablePos) / (1.0 * totalPos)) * 100; for (int i = 0; i < endLog.paramArr.Length; i++) { endLog.paramArr[i] = this.paramArr[i]; } //endLog.Score = (profitablePos / endLog.numOfPos) * 100; // easy score to test //copies paramater array to log Console.WriteLine("Start Working On Test Class"); endLog.Score = Scoring.Test2.score(profitablePos, endLog.numOfPos, this.sum, this.eachDaySum); return endLog; } return null; } // edits info for final log