示例#1
0
 @Override
 public List<TimePointStats> start(UserOutput output) {
   Thread.currentThread().setName("Main engine execution thread");
   double result = 1;
   initPopulation();
   TimePoint timePoint = new TimePoint(engineSettings.startTimePoint);
   List<TimePointStats> timePointStats = new ArrayList<>();
   while (engineSettings.endTimePoint.compareTo(timePoint) >= 0) {
     TimePointStats stat = executeTimePoint(timePoint);
     if (stat != null) {
       timePointStats.add(stat);
       result *= (stat.getPercentEarned() / 100 + 1);
       profitRecorder.recordProfit(stat.getPercentEarned());
       output.reportProfitForTimePoint(timePoint, (result - 1) * 100, stat.getPercentEarned());
       Debug.d("Time:", timePoint, "Percent earned so far:", (result - 1) * 100);
     }
     timePoint = timePoint.next();
   }
   if (!engineSettings.executionOnly) {
     savePopulation();
   }
   Debug.d(
       "Profit:",
       profitRecorder.getProfit(),
       "Drawdown:",
       profitRecorder.getMaxDrawdown(),
       "Profit / DD:",
       profitRecorder.getProfit() / profitRecorder.getMaxDrawdown());
   return timePointStats;
 }
示例#2
0
文件: Main.java 项目: neosb/genotick
 private static void checkSimulation(Parameters parameters) {
   if (!parameters.allConsumed()) {
     output.errorMessage("Not all program arguments processed: " + parameters.getUnconsumed());
     exit(ErrorCodes.UNKNOWN_ARGUMENT);
   }
   Application application = new Application(input, output);
   input.show(application);
 }