Stock Strategy Backtester
Backtest stock trading strategies on historical OHLCV data and report win rate, return, CAGR, drawdown, Sharpe ratio, and trade logs. Use when evaluating or...
MIT-0 · Free to use, modify, and redistribute. No attribution required.
⭐ 2 · 2.1k · 29 current installs · 30 all-time installs
by@taylen
MIT-0
Security Scan
OpenClaw
Benign
medium confidencePurpose & Capability
Name/description match the artifacts: a Python backtest script plus documentation for running it on OHLCV CSVs. No unrelated env variables, binaries, or external services are requested.
Instruction Scope
SKILL.md instructs the agent/user to run the bundled Python script against local CSV files and to interpret outputs; the instructions reference only CSV paths and backtest parameters. There are no instructions to read unrelated system files, environment variables, or to transmit data externally.
Install Mechanism
No install spec is provided (instruction-only with bundled script), so nothing is automatically downloaded or written by an installer. The runtime requires a local Python interpreter, which is consistent with the skill's purpose.
Credentials
The skill declares no required environment variables or credentials. The script reads only the CSV path supplied by the user and produces JSON output — no external credentials or unrelated environment access is requested.
Persistence & Privilege
Flags show always:false and no special privileges. The skill does not request persistent system presence or modification of other skills or global agent settings.
Assessment
This skill is coherent with its purpose and runs a local Python script on CSV price data, but the source is unknown — review the full scripts/backtest_strategy.py before running. Notable points: the pasted script is truncated and contains a likely typo ('proceeds = gros') that will cause a runtime error; verify the file is complete and test on non-sensitive sample data inside a sandbox or virtualenv. Confirm there are no hidden network calls or credential access in the remainder of the file, and validate outputs against small known examples (and include realistic commission/slippage assumptions). If you lack confidence in the code, run it in an isolated environment or ask the author for source provenance and an integrity checksum.Like a lobster shell, security has layers — review code before you run it.
Current versionv1.0.4
Download zipbacktestlatestquantstocks
License
MIT-0
Free to use, modify, and redistribute. No attribution required.
SKILL.md
Stock Strategy Backtester
Version Notice
1.0.0and1.0.1are deprecated.- Use
1.0.2or newer only. - Deprecation reason: early versions bundled non-core marketplace automation files and may trigger security scanner warnings in some environments.
Overview
Run repeatable, long-only stock strategy backtests from daily OHLCV CSV files. Use bundled scripts to generate consistent metrics and trade-level output, then summarize with investor-friendly conclusions.
Quick Start
- Prepare a CSV with at least
DateandClosecolumns. - Run a baseline backtest:
python scripts/backtest_strategy.py \
--csv /path/to/prices.csv \
--strategy sma-crossover \
--fast-window 20 \
--slow-window 60
- Export artifacts for review:
python scripts/backtest_strategy.py \
--csv /path/to/prices.csv \
--strategy rsi-reversion \
--rsi-period 14 \
--rsi-entry 30 \
--rsi-exit 55 \
--commission-bps 5 \
--slippage-bps 2
Workflow
- Validate data
- Ensure
Dateis parseable and sorted ascending. - Ensure
Open/High/Low/Closeare numeric; missingOpen/High/Lowfalls back toClose.
- Pick strategy logic
sma-crossover: trend-following with fast/slow moving averages.rsi-reversion: buy oversold and exit on momentum recovery.breakout: enter on highs breakout and exit on lows breakdown.
- Set realistic assumptions
- Always set
--commission-bpsand--slippage-bps. - Avoid reporting cost-free backtests as production-ready.
- Compare variants
- Change one parameter block at a time.
- Compare on the same date range and same cost model.
- Produce final summary
- Report:
total_return_pct,cagr_pct,win_rate_pct,max_drawdown_pct,sharpe_ratio,profit_factor, and trade count. - Use trade CSV to explain where alpha is coming from.
Supported Commands
- Baseline SMA strategy:
python scripts/backtest_strategy.py \
--csv /path/to/prices.csv \
--strategy sma-crossover \
--fast-window 10 \
--slow-window 50
- Breakout strategy:
python scripts/backtest_strategy.py \
--csv /path/to/prices.csv \
--strategy breakout \
--lookback 20
- JSON-only output (for automation pipelines):
python scripts/backtest_strategy.py \
--csv /path/to/prices.csv \
--strategy rsi-reversion \
--quiet
Output Contract
- Script prints a JSON object to stdout with:
strategyperiodmetricsconfigtrades
Analysis Guardrails
- Use out-of-sample logic
- Prefer walk-forward validation over one-shot tuning.
- Avoid leakage
- Compute signals from bar
t, execute at bart+1open.
- Report downside with upside
- Never present return without drawdown and trade count.
- Treat results as research
- Backtests are not guarantees and should not be framed as financial advice.
References
- Metrics details:
references/backtest-metrics.md
Files
4 totalSelect a file
Select a file to preview.
Comments
Loading comments…
