Skip to main content

backtest

Run a single backtest simulation for a strategy prompt.

Usage

gopher backtest --asset <ASSET> --prompt <STRATEGY> [flags]

Flags

FlagDescriptionDefault
--assetTrading asset (e.g., BTC, ETH)Required
--promptStrategy promptRequired
--startStart date (YYYY-MM-DD)7 days ago
--start-dateAlias for --start-
--endEnd date (YYYY-MM-DD)Today
--end-dateAlias for --end-
--intervalsCandle intervals15m,1h,4h
--eval-intervalEvaluation interval for decisionsFirst interval
--leverageTrading leverage10
--indicatorsIndicator config file (JSON or YAML)-
--dbSQLite database path~/Documents/Gopher/gopher.db
--outputOutput directory for results~/Documents/Gopher/sessions
--sessions-dirAlias for --output-
--api-keyLLM API key (OpenRouter or Gopher Key)Env
--llm-api-keyAlias for --api-key-
--base-urlLLM API base URLOpenRouter
--llm-base-urlAlias for --base-url-
--loop-modelOverride loop model ID-
--modelLLM model for decisionsqwen/qwen3-vl-8b-instruct
--backtest-modelAlias for --model-
--jsonOutput results as JSONfalse

Examples

# Basic backtest
gopher backtest \
--asset BTC \
--prompt "Follow momentum breakouts with RSI confirmation" \
--start 2025-01-01 \
--end 2025-01-25 \
--intervals 15m,1h,4h

# Fast run using 8h intervals and eval cadence
gopher backtest \
--asset TAO \
--prompt "Simple momentum" \
--start 2025-01-01 \
--end 2025-01-03 \
--intervals 8h \
--eval-interval 8h

# Indicator overrides (JSON or YAML)
gopher backtest --asset BTC --prompt "RSI + MACD" \
--indicators ./indicators.yaml