428-backtester/scripts/hyperopt.sh
Artemii Peretiachenko 99de26e7f0 Add private Freqtrade scaffold for partner backtesting.
Ship SampleStrategy and Integral workflow scripts without proprietary V15 logic, Pine, or run results.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-02 23:55:44 +02:00

38 lines
976 B
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
# shellcheck disable=SC1091
source "$(dirname "$0")/_env.sh"
# In-sample range for hyperopt; use a later TIMERANGE for OOS backtest.
# --analyze-per-epoch is required when buy/sell params change populate_indicators
# (not only entry/exit columns). Set ANALYZE_PER_EPOCH=0 to disable.
TIMERANGE="${TIMERANGE:-20240701-20260101}"
STRATEGY="${STRATEGY:-SampleStrategy}"
EPOCHS="${EPOCHS:-100}"
SPACES="${SPACES:-buy sell}"
LOSS="${LOSS:-SharpeHyperOptLossDaily}"
JOBS="${JOBS:-}"
ANALYZE_PER_EPOCH="${ANALYZE_PER_EPOCH:-1}"
# shellcheck disable=SC2206
SPACES_ARR=(${SPACES})
ARGS=(
--config user_data/config.json
--strategy "${STRATEGY}"
--timeframe 15m
--timerange "${TIMERANGE}"
--spaces "${SPACES_ARR[@]}"
--hyperopt-loss "${LOSS}"
-e "${EPOCHS}"
)
if [[ "${ANALYZE_PER_EPOCH}" != "0" ]]; then
ARGS+=(--analyze-per-epoch)
fi
if [[ -n "${JOBS}" ]]; then
ARGS+=(-j "${JOBS}")
fi
freqtrade hyperopt "${ARGS[@]}" "$@"