79 lines
2.8 KiB
Markdown
79 lines
2.8 KiB
Markdown
---
|
|
name: stock-backtest
|
|
description: Design, run, and interpret strategy backtests for A-share stocks
|
|
---
|
|
|
|
## What I Do
|
|
|
|
Guide the agent through backtesting trading strategies:
|
|
1. Help design strategy rules from user descriptions
|
|
2. Run backtests on historical data
|
|
3. Interpret results and identify potential issues
|
|
4. Suggest improvements
|
|
|
|
## Capital Context (CRITICAL)
|
|
|
|
**The user has ~5万 RMB capital.** Backtest interpretation must be capital-aware:
|
|
|
|
- When presenting metrics, translate key numbers to the user's context:
|
|
- "Annualized return 15% = ¥7,500 on 5万"
|
|
- "Max drawdown 12% = ¥6,000 worst-case loss"
|
|
- "Average win ¥800, average loss ¥1,200 per trade"
|
|
- Assess whether a strategy is **practically usable** with 5万 considering position sizing constraints
|
|
- Flag if a strategy requires more positions than 5万 can support
|
|
|
|
## Key Backtest Metrics
|
|
|
|
- **Cumulative return**: total return over the period
|
|
- **Annualized return**: normalized yearly return (translate to ¥ on 5万)
|
|
- **Win rate**: percentage of profitable trades
|
|
- **Max drawdown**: worst peak-to-trough decline (translate to ¥)
|
|
- **Sharpe ratio**: risk-adjusted return
|
|
- **Benchmark comparison**: vs CSI 300 index
|
|
|
|
## Strategy Parameters
|
|
|
|
Common strategy elements to help users define:
|
|
- Entry conditions (e.g., MA crossover, breakout, pullback)
|
|
- Exit conditions (e.g., stop loss %, take profit %, trailing stop, time-based)
|
|
- Position sizing (e.g., fixed %, Kelly fraction)
|
|
- Test period and stock universe
|
|
|
|
## When to Use Me
|
|
|
|
Use when the user asks to:
|
|
- Backtest a trading strategy
|
|
- Verify a strategy's historical performance
|
|
- Compare multiple strategies
|
|
- Evaluate whether a strategy is worth using
|
|
|
|
## Workflow
|
|
|
|
1. Clarify strategy rules with user
|
|
2. Translate rules into testable parameters
|
|
3. Run backtest via `stock-backtest` tools
|
|
4. Present results with interpretation:
|
|
|
|
### Output Format
|
|
|
|
1. **Strategy Summary**: rules in plain language
|
|
2. **Performance Metrics**: all key metrics in table form
|
|
3. **Capital Context Translation**:
|
|
| Metric | Value | On 5万 Capital |
|
|
|--------|-------|----------------|
|
|
| Annualized Return | 18% | ¥9,000/year |
|
|
| Max Drawdown | 15% | ¥7,500 worst case |
|
|
| Avg Win per Trade | ¥450 | — |
|
|
| Avg Loss per Trade | ¥600 | — |
|
|
4. **Equity Curve Description**: shape, drawdown periods, recovery time
|
|
5. **Benchmark Comparison**: outperformance/underperformance vs CSI 300
|
|
6. **Practicality Assessment for 5万**:
|
|
- Can the user afford the position sizes?
|
|
- Does the strategy require too many concurrent positions?
|
|
- Is the max drawdown psychologically tolerable?
|
|
7. **Potential Concerns**: overfitting, look-ahead bias, survivorship bias, regime dependence
|
|
|
|
## Risk Disclaimer
|
|
|
|
Always remind: backtest results reflect historical data. Live performance will differ. Strategies can fail in new market regimes. The user bears all trading risk.
|