Skip to content

feat(cli): add benchmark comparison to backtest output#48

Open
MB-Ndhlovu wants to merge 2 commits intoHKUDS:mainfrom
MB-Ndhlovu:main
Open

feat(cli): add benchmark comparison to backtest output#48
MB-Ndhlovu wants to merge 2 commits intoHKUDS:mainfrom
MB-Ndhlovu:main

Conversation

@MB-Ndhlovu
Copy link
Copy Markdown

@MB-Ndhlovu MB-Ndhlovu commented Apr 21, 2026

-- Add benchmark.py: resolve + fetch benchmark tickers (SPY, CSI 300, etc.) via yfinance based on market type inference

  • Modify engines/base.py: inject external benchmark via config['benchmark'] ticker, replacing equal-weight market proxy with real benchmark returns
  • Modify cli.py: add _build_benchmark_table() and benchmark panel in _print_result() showing ticker, benchmark return, excess return, and information ratio

Summary

Why

Changes

Test Plan

  • [x ] Existing tests pass (pytest --ignore=agent/tests/e2e_backtest --tb=short -q)
  • [] New tests added (if applicable)
  • Tested manually (describe below)

Checklist

  • [x ] No changes to protected areas (src/agent/, src/session/, src/providers/) without prior discussion
  • [x ] No hardcoded values (API keys, file paths, magic numbers)
  • [ x] Code follows CONTRIBUTING.md guidelines
  • [ x] Documentation updated (if user-facing change)

- Add benchmark.py: resolve + fetch benchmark tickers (SPY, CSI 300, etc.)
  via yfinance based on market type inference
- Modify engines/base.py: inject external benchmark via config['benchmark']
  ticker, replacing equal-weight market proxy with real benchmark returns
- Modify cli.py: add _build_benchmark_table() and benchmark panel in
  _print_result() showing ticker, benchmark return, excess return,
  and information ratio
table.box attribute doesn't exist in this rich version.
table uses default ASCII border instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant