@Stone141319: Just whipped up a quantitative backtesting tool, open-sourced for those who need it. If it helps you, feel free to follow and support, thanks!!! Wondering if your trading ideas are solid? Don't rely on gut feelings—throw them into historical K-line data and see for yourself!!! As a Hermes newbie, I used to only run simulated trades to test strategies. After participating in BG's hackathon, I learned about data backtesting.
Summary
Stone141319 released a local cryptocurrency quantitative backtesting tool called Hermes Backtest Lab, supporting spot, perpetual swap, and on-chain token backtesting without requiring an API key, and offers various presets and custom parameters.
View Cached Full Text
Cached at: 06/16/26, 05:41 PM
I just put together a quantitative backtesting tool and open-sourced it for anyone who needs it. If it helps you, feel free to follow and show some support — thanks!!!
Is your trading idea actually any good? Don’t rely on gut feelings — throw it into historical K-line data and see what happens!
As a Hermes newbie, I used to only validate trading strategies through paper trading. After joining the BG hackathon, I learned that data backtesting is also an option.
So I open-sourced a local crypto backtesting tool: Stone Quantitative Backtesting Lab (Hermes Backtest Lab)
Open-source repo: https://github.com/stong123456/stone-backtest-lab…
It doesn’t need an API Key, it’s not an exchange bot. Its one core job: take your trading idea, run it through real historical data, and let the numbers speak.
——————————————————
Core capabilities:
- OKX spot + USDT perpetual swap backtesting
- Multi-currency portfolio backtesting (simulates a real multi-asset account)
- Long/short both sides (long-only / short-only / both)
- On-chain token backtesting (GeckoTerminal data source)
- Full cost modeling (fees + slippage)
- Dynamic position sizing, leverage, margin, drawdown circuit breaker
- Built-in common factors (trend, mean reversion, ATR, ADX, RSI, EMA, Bollinger Bands, volume z-score, etc.)
- Report export — each backtest generates three files:
report.md: human-readable backtest reportmetrics.json: machine-readable metricstrades.csv: detailed log of every simulated trade
——————————————————
You can run it with PowerShell or directly feed it to your AI.
Quick start for beginners (recommended):
python -m pip install -r requirements.txt
python scripts/hermes_backtest_lab.py --preset demo
Run with common presets directly:
--preset balanced / conservative / aggressive / spot / onchain-demo
Custom OKX perpetual backtest:
python scripts/hermes_backtest_lab.py --symbols BTC,ETH,SOL,SUI --inst-type SWAP --days 180 --bar 1H
Spot backtest (short disabled):
--symbols BTC,ETH,SOL --inst-type SPOT --allow-short 0 --days 180
On-chain token backtest:
--data-source geckoterminal --symbols base:token:0x... --days 30 --bar 1H
See the repo README for more usage.
——————————————————
Why do I think backtesting is the most valuable thing?
It’s not meant to prove you can make money. It’s a cold, impartial quality inspector:
- Does your strategy survive fees and slippage?
- Is it propped up by a few big wins?
- Are win rate, profit/loss ratio, max drawdown, trade frequency reasonable?
- Can it still survive on a different set of coins or a different time period?
If a strategy can’t even pass the historical-data-plus-costs test, putting it on a live account is mostly just donating money.
So this tool is for three kinds of people:
- People who want to validate their own trading ideas
- People who want to systematically study different coins, timeframes, and parameters
- People who want to automate trading but don’t want to trial-and-error with real money right away
——————————————————
Final reminder: Historical backtesting does not guarantee future results. But without backtesting, most of the time you won’t even know where you lost.
Feel free to star, clone, and run it. After running, issues and feedback are welcome!
stong123456/stone-backtest-lab
Source: https://github.com/stong123456/stone-backtest-lab
Stone Quantitative Backtesting Lab
English name: Hermes Backtest Lab.
A local cryptocurrency backtesting tool that requires no API Key.
It uses OKX public K-line data and GeckoTerminal public DEX data. Supports spot, USDT perpetual swaps, multi-chain on-chain tokens, multi-currency portfolio backtesting, fee/slippage modeling, dynamic leverage, dynamic margin, take-profit/stop-loss, time-based exit, factor attribution, and report export.
This is not investment advice. Historical backtesting does not represent future returns. Please validate with small samples and paper trading first.
Features
- Backtest any OKX spot or USDT perpetual swap symbol
- Backtest any GeckoTerminal-supported on-chain token or DEX pool
- Single-currency backtesting or multi-currency portfolio backtesting
- Supports long/short both sides, long-only, short-only
- Built-in trend-following and mean-reversion logic
- Built-in indicators: ATR, ADX, RSI, EMA, Bollinger Bands, volume z-score, etc.
- Supports fees, slippage, max position, account drawdown circuit breaker
- Outputs
report.md,metrics.json,trades.csv - Does NOT read
.env, exchange accounts, private keys, API Keys, or Telegram Tokens
Installation
Requires Python 3.10+.
cd hermes-backtest-lab
python -m pip install -r requirements.txt
Windows users can also run directly:
.\run_setup.ps1
Quick Start
python scripts/hermes_backtest_lab.py --preset demo
If you’re not sure which command to use, first view the Chinese short menu:
python scripts/hermes_backtest_lab.py
After running, files will be generated in outputs/hermes_backtest_lab/<timestamp>/:
report.md: human-readable backtest reportmetrics.json: machine-readable metricstrades.csv: detailed log of every simulated trade
Common Presets
# View all presets with Chinese explanations
python scripts/hermes_backtest_lab.py --list-presets
# Dry-run: only show config, no network or backtest
python scripts/hermes_backtest_lab.py --dry-run --preset balanced
# 30-day quick check, good for confirming environment is working
python scripts/hermes_backtest_lab.py --preset demo
# 180-day balanced portfolio backtest
python scripts/hermes_backtest_lab.py --preset balanced
# More conservative: only mainstream coins, reduce portfolio exposure
python scripts/hermes_backtest_lab.py --preset conservative
# More aggressive: include more high-volatility assets
python scripts/hermes_backtest_lab.py --preset aggressive
# Spot, long-only
python scripts/hermes_backtest_lab.py --preset spot
# On-chain token backtest, automatically picks the highest-liquidity pool
python scripts/hermes_backtest_lab.py --preset onchain-demo
# Base chain WETH token
python scripts/hermes_backtest_lab.py --data-source geckoterminal --symbols base:token:0x4200000000000000000000000000000000000006 --days 30 --bar 1H
# Specify a particular DEX pool directly
python scripts/hermes_backtest_lab.py --data-source geckoterminal --symbols base:pool:0xPOOL_ADDRESS --days 30 --bar 1H
You can override any parameter in a preset:
python scripts/hermes_backtest_lab.py --preset balanced --symbols BTC,ETH,SOL --days 90 --max-leverage 8
You can also put symbols in a txt file, one per line, for easier maintenance:
python scripts/hermes_backtest_lab.py --preset balanced --symbols-file examples/symbols_okx_bluechip.txt
Windows one-click scripts:
.\run_demo.ps1
.\run_balanced.ps1
.\run_onchain_demo.ps1
Custom Backtesting
# Any OKX USDT perpetual
python scripts/hermes_backtest_lab.py --symbols BTC,ETH,SUI,LINK --inst-type SWAP --days 180 --bar 1H
# Specify OKX instId directly
python scripts/hermes_backtest_lab.py --symbols BTC-USDT-SWAP,ETH-USDT-SWAP --days 90 --bar 4H
# Spot backtesting
python scripts/hermes_backtest_lab.py --symbols BTC,ETH,SOL --inst-type SPOT --allow-short 0 --days 180
# On-chain token. Format: chain:token:contract. Script automatically selects highest-liquidity pool.
python scripts/hermes_backtest_lab.py --data-source geckoterminal --symbols eth:token:0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,base:token:0x4200000000000000000000000000000000000006 --days 30 --bar 1H
# On-chain pool. Format: chain:pool:pool_address.
python scripts/hermes_backtest_lab.py --data-source geckoterminal --symbols solana:pool:POOL_ADDRESS --days 30 --bar 1H
# Multi-currency sharing a single portfolio account (capital not split by symbol)
python scripts/hermes_backtest_lab.py --symbols BTC,ETH,SOL,SUI,LINK --inst-type SWAP --portfolio-mode 1 --starting-balance 100000 --min-margin 1000 --max-margin 3000
Important Parameters
| Parameter | Description |
|---|---|
--symbols | Symbol list, supports BTC,ETH or BTC-USDT-SWAP |
--data-source | Data source, okx or geckoterminal |
--inst-type | SWAP or SPOT |
--onchain-network | Default on-chain network, e.g., eth, bsc, base, solana |
--onchain-id-type | Default on-chain address type, token or pool |
--gecko-currency | GeckoTerminal quote currency, default usd |
--gecko-token-side | Which side of the pool (base or quote) to use for OHLCV |
--days | Backtest duration in days |
--bar | Candle interval, e.g., 1H, 4H, 1D |
--portfolio-mode | Whether to use shared portfolio account |
--starting-balance | Initial capital |
--min-margin | Minimum margin or nominal units per trade |
--max-margin | Maximum margin or nominal units per trade |
--max-leverage | Maximum leverage |
--entry-score | Minimum entry score |
--fee-bps | One-way fee in bps |
--slippage-bps | One-way slippage in bps |
--reward-r | Take-profit R multiple |
--account-stop-pct | Account drawdown circuit breaker percentage |
--refresh | Force re-fetch public K-lines, ignore cache |
See More Commands
python scripts/hermes_backtest_lab.py
python scripts/hermes_backtest_lab.py --list-presets
python scripts/hermes_backtest_lab.py --examples
python scripts/hermes_backtest_lab.py --advanced-help
How to Read Results
Don’t only look at win rate. Prioritize:
- Whether total return and max drawdown are aligned
- Profit Factor > 1
- Average profit significantly larger than average loss
- Sufficient number of trades (don’t be fooled by small samples)
- Whether profits are concentrated on a few days or a few coins
- Whether the strategy still works after adding fees and slippage
On-Chain Data Notes
- Token mode automatically selects the highest-liquidity pool returned by GeckoTerminal; it may not be the specific pool you intended to trade.
- Pool mode is more precise; use it when you already know the target pool address.
- New coins, small pools, or low-liquidity pools may have incomplete K-lines; data warnings will appear in the report.
- On-chain backtesting is only a price-series study by default. It does not simulate real on-chain execution risks such as MEV, gas, pool impact costs, buy/sell taxes, blacklists, trade pauses, routing failures, etc.
- For meme and small-cap tokens, manually increase slippage, e.g.,
--slippage-bps 30or higher.
Open-Source Sharing Suggestions
If you publish to GitHub, only commit these:
README.mdSKILL.mdrequirements.txtscripts/hermes_backtest_lab.pyexamples/commands.md.gitignore
Do NOT commit:
outputs/runtime-logs/cache/.env- API Keys, Telegram Tokens, exchange account files
Stone (@Stone141319): A lot of people talk about AI Web3, focusing on models, applications, airdrops, etc. But when it comes to AI agents executing on-chain tasks, calling data, coordinating trades, managing assets, the problems become very, very real: Can its reasoning be verified? Is the data it calls reliable? Where is its memory stored? When it collaborates with other agents, who audits if something goes wrong?
Similar Articles
@Stone141319: Hermes Evolution Diary · Latest Battle Report! Hello everyone, before I know it, I've been studying Hermes for over a month! Many people when they first start playing with AI quantitative trading think the key is to find high win-rate strategies, but what's most likely to blow up your account is actually not knowing how to set take-profit and stop-loss. Today I'm sharing the current take-profit and stop-loss setup of my Hermes semi-automated trading system...
The author shares the take-profit and stop-loss design of the Hermes semi-automated trading system, including a three-layer protection mechanism (attached on open, supplemental native protection, software-level fallback) and two sets of tiered rhythms for spot and futures, aimed at controlling risk and optimizing returns.
@huoshan007: Hermes Skills Trio Doubled My On-Chain Alpha Discovery Efficiency! Brothers, I'm completely stunned! Come check it out! Seriously, I used to stare at screens until my eyes went blind—scrolling Polymarket in the morning, checking GitHub Trending at noon, and watching Hyperliq signals at night...
Using the Hermes Skills trio (native-mcp, webhook-subscriptions, hermes-agent cron) to automatically capture on-chain data and push Alpha signals, significantly improving crypto trading efficiency.
@eastweb3eth: Github US Stock Quant Compilation - A Must-Use Tool for Smart People. Since Github came along, ordinary people can also do quant. But don't start by grinding away writing your own backtesting engine; really, most people's code is less robust than a three-year-old repo on Github. There are many repos, but I've already filtered them for you: these 4…
Recommends 4 open-source quantitative trading tools/frameworks (VeighNa, AI-Trader, StockSharp, QuantDinger), emphasizing that they are suitable for ordinary users to conduct US stock quantitative trading, helping to free your hands and let the model handle trading.
@XAMTO_AI: Guys, there's something I just have to tell you about. An open-source AI quantitative trading platform has quietly launched. Locally self-deployable, full-chain connectivity, covering crypto, US stocks, and forex — from analysis to live trading all in one — can you believe it? Two years ago, such a thing was either ridiculously expensive or simply non-existent. Now it's directly open-sourced on G…
Introducing QuantDinger, an open-source AI quantitative trading platform that supports local deployment, full-chain connectivity for crypto, US stocks, and forex, integrating AI analysis, strategy generation, backtesting, and live trading integration.
@XAMTO_AI: Finding reliable open-source libraries for quantitative and algorithmic trading can be tough amid the vast and scattered online resources. awesome-systematic-trading is a curated list of free quantitative libraries sorted by language, making it easy to jump to the right resources. It mainly includes:
This article introduces a GitHub repository called awesome-systematic-trading, which categorizes free open-source quantitative trading libraries and resources by programming language, helping developers quickly find suitable tools.