crypto-simulator
Backtest crypto trading strategies (RSI, DCA, MACD, Grid, etc.) against real CoinGecko data.
- License 许可
- MIT
- 最近更新
- 2026-08-23
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- description
- Backtest crypto trading strategies (RSI, DCA, MACD, Grid, etc.) against real CoinGecko data.
02 资源文件 22
- 参考文档_meta.json462 B
- 参考文档package.json719 B
- 脚本src/backtest.ts7.2 KB
- 脚本src/cli.ts11.9 KB
- 脚本src/db.ts10.4 KB
- 脚本src/optimizer.ts11.6 KB
- 脚本src/prices.ts6.7 KB
- 脚本src/server.ts4.7 KB
- 脚本src/simulator.ts5.0 KB
- 脚本src/strategies/bollinger-bands.ts2.3 KB
- 脚本src/strategies/common.ts2.5 KB
- 脚本src/strategies/dca.ts1.7 KB
- 脚本src/strategies/grid.ts2.0 KB
- 脚本src/strategies/hodl.ts715 B
- 脚本src/strategies/ma-cross.ts2.1 KB
- 脚本src/strategies/macd.ts3.1 KB
- 脚本src/strategies/mean-reversion.ts1.8 KB
- 脚本src/strategies/rsi-swing.ts2.4 KB
- 脚本src/types.ts2.6 KB
- 脚本test/backtest.test.ts3.2 KB
- 脚本test/optimizer.test.ts1.3 KB
- 参考文档tsconfig.json438 B
03 SKILL.md 正文
Crypto Simulator
Backtest and simulate cryptocurrency trading strategies using real market data.
Quick Start
cd {skill_dir}
npm install && npm run build
# Backtest a strategy
node dist/cli.js backtest --coin bitcoin --strategy rsi_swing --days 90
# Compare all strategies
node dist/cli.js compare --coin ethereum --days 180
# Optimize parameters
node dist/cli.js optimize --coin bitcoin --strategy rsi_swing
# Start REST API
node dist/cli.js serve --port 3002
Strategies
| Strategy | Best For | Logic |
|---|---|---|
| RSI Swing | Volatile markets | Buy RSI < 30, sell RSI > 70 |
| DCA | Long-term | Fixed-interval buys |
| MA Cross | Trending | Buy/sell on MA crossovers |
| Grid | Ranging | Orders at price grid levels |
| HODL | Bull markets | Buy-and-hold baseline |
| Bollinger Bands | Mean reversion | Trade on band breakouts |
| MACD | Momentum | Signal line crossovers |
| Mean Reversion | Ranging | Buy below mean, sell above |
Supported coins: BTC, ETH, SOL, DOGE, ADA, DOT, AVAX, LINK, MATIC, XRP
API Endpoints
| Method | Path | Description |
|---|---|---|
GET |
/api/prices/:coinId |
Current & historical prices |
POST |
/api/backtest |
Run backtest |
GET |
/api/compare/:coinId |
Compare all strategies |
POST |
/api/optimize |
Find optimal parameters |
Edge Cases
- CoinGecko rate limits: Free tier = ~10-30 req/min. SQLite cache avoids redundant calls
- Insufficient data: Short timeframes may lack enough data for indicators (e.g., 50-day MA needs 50+ days)
- Slippage: Backtests assume perfect execution — real results will differ
⚠️ Disclaimer
For educational/informational purposes only. Not financial advice. Past performance ≠ future results.
Configuration
| Variable | Default | Description |
|---|---|---|
PORT |
3002 | API server port |
CACHE_DIR |
./data |
SQLite cache directory |
Requirements
- Node.js 18+
- Internet connection (CoinGecko API)
- No API keys needed (free tier)
04 同仓库更多 Skills
crowd-prompting
A marketplace where AI agents improve prompts, system instructions, tool descriptions, and other text-based content with domain expertise from real-world operations — and earn tokens for valuable contributions.
dilemm-ai
Compete in DilemmAI, the prisoner's dilemma AI arena at dilemm.ai. Use when an OpenClaw agent wants to create an account, design and submit strategy prompts for their bot, enter matchmaking, analyze historical matches and leaderboards, and iterate on bot strategy. Requires headless browser automation (no API available yet).
arxiv-paper-reviews
Interact with arXiv Crawler API to fetch papers, read reviews, and submit comments. Use when working with arXiv papers, fetching paper lists by date/category/interest, viewing paper details with comments, or submitting paper reviews via API at http://150.158.152.82:8000.
arxiv-paper-reviews
Interact with arXiv Crawler API to fetch papers, read reviews, and submit comments. Use when working with arXiv papers, fetching paper lists by date/category/interest, viewing paper details with comments, or submitting paper reviews via API at http://150.158.152.82:8000.
git-summary
Get a quick summary of the current Git repository including status, recent commits, branches, and contributors.
agent-constitution
Interact with AgentConstitution governance contracts on Base Sepolia. Check compliance, read rules, log actions, query governance state.