コード例 #1
0
  private static void fillFactory(SimulatorSettingsGridFactory settings)
      throws BadParameterException, BadAlgorithmException {
    settings.addStock(
        "in",
        algoStockName(Input.class.getSimpleName()),
        "e",
        Arrays.asList(new String[] {"open", "close"}));
    settings.addStock(
        "ema",
        algoStockName(Ema.class.getSimpleName()),
        new AlgorithmSettingsIteratorFactory()
            .add(new MpDouble("P", 0.1, 0.6, 0.5))
            .add(new MpSubExecution("", "in")));
    settings.addStock(
        "level",
        algoStockName("." + Level.class.getSimpleName()),
        new AlgorithmSettingsIteratorFactory()
            .add(new MpDouble("f", 15.0, 20.0, 5))
            .add(new MpSubExecution("", Arrays.asList(new String[] {"ema"}))));
    settings.addEod(
        "os",
        algoEodName(OneSideOpenAlgorithm.class.getSimpleName()),
        "side",
        Arrays.asList(new String[] {"long", "short"}));

    final AlgorithmSettingsIteratorFactory factoryPositionSide =
        new AlgorithmSettingsIteratorFactory();
    factoryPositionSide.add(new MpSubExecution("", Arrays.asList(new String[] {"in", "level"})));
    factoryPositionSide.add(new MpInteger("n", 1, 32, 32));
    factoryPositionSide.add(new MpInteger("m", 1, 32, 32));
    factoryPositionSide.add(new MpDouble("ps", 50000.0, 200001.0, 160000.0));
    settings.addEod(
        "pnm", algoEodName(PositionNDayMStocks.class.getSimpleName()), factoryPositionSide);
  }
コード例 #2
0
 private SimulatorSettingsGridList getDefaultSimulatorSettingsGridList(
     final StockStorage stockStorage) throws IOException {
   try {
     final FromToPeriod period = new FromToPeriod("01-01-2013", "01-01-2014");
     final SimulatorSettingsGridFactory factory =
         new SimulatorSettingsGridFactory(stockStorage, period);
     fillFactory(factory);
     return factory.getList();
   } catch (ParseException | BadParameterException | BadAlgorithmException e) {
     throw new IOException(e.getMessage());
   }
 }