Scan your whole stack
Are you using portfolio-twr?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v0.1.0
portfolio-twr was last scanned on 29 Nov 2026 at version 0.1.0. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 0.1.0 LATEST | 29 Nov 2026 | No rules fired |
Findings for v0.1.0. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.
The score describes 0.1.0; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
Zero-dependency Python library for daily Time-Weighted Return (TWR) linking, geometric contribution attribution, Portfolio-Performance-aligned risk/drawdown/benchmark analytics, and reconciled Modified Dietz returns:
portfolio_twr.twr):linked_twr: geometrically links daily P&L over beginning-of-day invested capital, enforces weekday session completeness and P&L reconciliation, and computes exact additive wealth-scaled percentage-point contributions (sum(instrument_pp) + fees_pp == 100 * twr).monthly_returns: calendar-month linked TWR slices plus compounded YTD TWR.portfolio_twr.risk):risk_statistics: annualised arithmetic and log volatility, downside semi-deviation, max drawdown, peak/trough/recovery dates, max drawdown duration and longest recovery days, annualised TWR (>= 30 calendar days), and Sharpe/Sortino/Calmar ratios (>= 60 sessions), with optional holiday compounding via is_holiday.benchmark_statistics: aligns daily portfolio returns with a benchmark series (compounding across benchmark holidays) to compute Active Return, Correlation, Beta, Annualised Tracking Error, and Information Ratio.portfolio_twr.dietz):modified_dietz: base-currency-agnostic Daily Modified Dietz over end-of-day external equity flows with strict flow-identity, interval, and NAV/P&L reconciliation checks.pip install portfolio-twr
from datetime import date
from portfolio_twr import linked_twr, risk_statistics, monthly_returns, modified_dietz
rows = [
{"date": "2026-01-02", "pnl": 1000.0, "basis": 100_000.0, "isin": {"A": 1000.0},
"groups": {"Equities": {"pnl": 1000.0, "basis": 100_000.0}}, "estimated": False},
{"date": "2026-01-05", "pnl": -500.0, "basis": 101_000.0, "isin": {"A": -500.0},
"groups": {"Equities": {"pnl": -500.0, "basis": 101_000.0}}, "estimated": False},
]
res = linked_twr(rows, date(2026, 1, 2), date(2026, 1, 5), expected_pnl=500.0)
print(f"TWR: {res['twr']:.4%}, contribution_pp: {res['isin_contribution_pp']}")
stats = risk_statistics(rows)
print(f"Max drawdown: {stats['max_drawdown']:.4%}")
md = modified_dietz(
opening=100_000.0,
closing=112_500.0,
start=date(2026, 1, 1),
end=date(2026, 1, 31),
flows=[{"id": "dep-1", "kind": "external_equity", "date": "2026-01-16", "amount": 10_000.0}],
expected_pnl=2_500.0,
)
print(f"Modified Dietz: {md['value']:.4%}")
MIT — see LICENSE.
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.
The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.