Skip to content

Implement trading fee model in portfolio rebalancing and update relat…#16

Merged
lbsm2017 merged 4 commits intomainfrom
tradingfees
Dec 9, 2025
Merged

Implement trading fee model in portfolio rebalancing and update relat…#16
lbsm2017 merged 4 commits intomainfrom
tradingfees

Conversation

@lbsm2017
Copy link
Owner

@lbsm2017 lbsm2017 commented Dec 9, 2025

…ed documentation

Copilot AI review requested due to automatic review settings December 9, 2025 21:09
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements a trading fee model for portfolio rebalancing and enhances individual hedge analysis with performance metrics (CAGR, Sharpe). The changes enable realistic transaction cost modeling in the quantitative finance backtesting framework.

Key changes:

  • Adds configurable trading fees (basis points per turnover) applied during rebalancing
  • Computes base (unhedged) performance metrics for comparison with hedged portfolios
  • Enriches HTML reports with CAGR and Sharpe ratios alongside existing risk metrics

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
config.yaml Adds trading_fee_bps: 10 parameter under rebalancing section
src/backtester/rebalancing.py Implements fee calculation logic in simulate_rebalanced_portfolio() with first-day exemption
src/backtester/engine.py Computes base_metrics for unhedged baseline, enriches optimization results with CAGR/Sharpe per weight, passes fees to simulations
src/reporting/report.py Adds trading fee and rebalancing frequency to summary, expands individual hedge table with 4 new performance columns (base/hedged CAGR and Sharpe)
tests/test_rebalancing.py Adds TestTradingFees class with 5 comprehensive tests covering fee mechanics, edge cases, and frequency effects
tests/test_engine.py Adds TestBaseMetrics class verifying base_metrics presence, structure, and handling of insufficient data
docs/trading_fees.md Documents implementation approach, fee formula, design decisions, and testing strategy
data/risk_free_rate.parquet Binary data file update (likely routine data refresh)
data/prices_metadata.csv Updates end date from 2025-12-08 to 2025-12-09 (routine data refresh)

@lbsm2017 lbsm2017 merged commit 1c0ec0d into main Dec 9, 2025
7 checks passed
@lbsm2017 lbsm2017 deleted the tradingfees branch December 9, 2025 21:41
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.

2 participants