* feat: add Finnhub and AlphaVantage API key config fields
* feat: add FinnhubFetcher for US market OHLCV and realtime quotes
* feat: add AlphaVantageFetcher for US market OHLCV and realtime quotes
* feat: register FinnhubFetcher and AlphaVantageFetcher in DataFetcherManager
* fix: address PR review feedback on US fetcher routing and AlphaVantage pct_chg
- Fix AlphaVantage pct_chg calculation: sort by date ascending before
computing percentage change to handle newest-first API response
- Extend US daily routing source_order to include FinnhubFetcher and
AlphaVantageFetcher in the failover chain
- Add newest-first pct_chg regression test for AlphaVantage
- Add US routing fallback order test
- Update CHANGELOG.md with new feature and fix entries
- Add docs/specs/ to .gitignore to prevent accidental commits
Verified: 1956 tests passed, ci_gate.sh clean
* fix: address third round PR review - routing gaps, index isolation, CHANGELOG cleanup
- Isolate US index routing: YFinance-first, skip Finnhub/AlphaVantage for index codes
- Add Finnhub/AlphaVantage to US realtime_quote and get_stock_name routing
- Clean CHANGELOG.md: only our 3 Finnhub/AlphaVantage entries in [Unreleased]
* feat: enhance yfinance fetcher with Stooq fallback and stock mapping
- Implement _get_us_stock_quote_from_stooq for US stock data resilience
- Add stock_mapping.py for common stock code-to-name conversion
- Add unit test for Stooq fallback logic
- Part of #1
* feat: expand STOCK_NAME_MAP with major A-share stocks
* refactor: decouple stock_mapping from yfinance_fetcher (optional import)
* fix: correct Stooq fallback prev close and lint
* fix: data fetcher improvements and gitignore updates
- Prefer static stock name mapping for prefetch
- Fix gitignore to track src/data
- Document Stooq fallback prev close behavior in CHANGELOG
This combines the last three commits while excluding README.md changes.
Add a complete backtest/evaluation system that measures the accuracy of
AI-generated stock analysis recommendations against actual market outcomes.
Backend:
- Backtest engine (src/core/backtest_engine.py) with direction inference,
stop-loss/take-profit simulation, and outcome classification (win/loss/neutral)
- Repository layer (src/repositories/backtest_repo.py) with SQLite persistence
for backtest_results and backtest_summaries tables
- Service layer (src/services/backtest_service.py) orchestrating evaluation runs
with configurable window days, neutral band, and min-age filters
- REST API endpoints: POST /run, GET /results, GET /performance, GET /performance/{code}
- Pydantic schemas for request/response validation
Frontend (apps/dsa-web):
- New Backtest page with performance dashboard sidebar showing direction
accuracy, win rate, simulated returns, SL/TP trigger rates, and W/L/N counts
- Paginated results table with outcome badges, direction indicators, and
color-coded return percentages
- Stock code filter and one-click "Run Backtest" trigger
- Full TypeScript types and API client matching backend schemas
Direction mapping fix:
- "Wait/observe" (观望) advice now maps to direction_expected="down" instead
of "flat", correctly reflecting that "wait" means "stay out due to downside
risk" rather than predicting a flat market
Tests:
- 21 unit tests covering engine logic, service orchestration, and summary
aggregation (all passing)
Docs:
- Updated README, full-guide, and translations with backtest feature docs
- Upgrade Tushare priority to -1 when token configured
- Implement realtime quote with Pro/legacy API fallback
- Load .env earlier for proper proxy setup
- Remove unreliable north-bound capital from market analyzer
- Add ETF test scenario, extend stale issue timer (3d -> 7d)
- Expand .gitignore to block all *.env files (prevents accidental credential leaks like #57)
- Update bug_report.md template to require version confirmation before submitting issues