portfolio_performance_metrics
  1. Tests (nbdev notebook)
  • Portfolio Performance Metrics with External Cashflows
  • Core
  • IO
  • Metrics
  • CLI
  • Tests (nbdev notebook)

Other Formats

  • CommonMark

Tests (nbdev notebook)

fixture = pathlib.Path('tests/fixtures/sample_cashflows.csv')
if not fixture.exists():
    fixture = pathlib.Path.cwd().parent / 'tests' / 'fixtures' / 'sample_cashflows.csv'
lr = load_cashflows(fixture)
res = compute_metrics(lr)
res.summary
/home/cs/workspaces/portfolio-performance-metrics/portfolio_performance_metrics/core.py:83: RuntimeWarning: IRR may be non-unique because there are multiple sign changes in cashflows.
  warnings.warn("IRR may be non-unique because there are multiple sign changes in cashflows.", RuntimeWarning)
metric period_return annualized
0 TWR 0.221754 0.222427
1 MWR_XIRR 0.227029 0.227718
2 Modified_Dietz 0.226616 0.227304
  • Report an issue