Пример #1
0
  public boolean startBacktest() {

    // backtest結果ファイルのpathをセット
    setFilePath();

    // set parameter
    btResult = new BacktestResultFx();
    btParam = new BacktestParamFx();
    btParamCoe = new BacktestParamFxCoe();
    setBacktestParam5();
    setSpread();
    initializeEntryControl();
    initializePosition();
    initializeResult();
    initilalizeMaxProfitLoss();
    log.info("setting parameter is done.");

    // predict結果ファイルをserverから作業ディレクトリにダウンロード
    if (!downloadPredictResulFile()) return false;

    // buffered reader にファイルをセット
    loadFile();

    // backtestの出力ファイルのヘッダを作成
    createHeader2();

    // datetimeごとの処理を開始
    // datetimeごとの処理を開始
    if (!entry()) return false;
    try {
      calcEvaluation();
    } catch (Exception e) {
      e.printStackTrace();
    }
    closeBufferedReader();

    // 結果ファイルをup
    if (ControlProgram.getLocation().equals(ControlProgram.Location.local)) {
      if (!upFile(testResultLocalPath, testResultServerPath)) return false;
    }
    if (ControlProgram.getLocation().equals(ControlProgram.Location.global)) {
      upFileFtp(testResultLocalPath, testResultFtpPath);
    }

    // resultテーブル更新
    updateResult();

    return true;
  }