skfolio/skfolio-log-returns-in-optimizer
| Pack | Severity | Fix | Versions |
|---|---|---|---|
| skfolio | warning | unsafe, with xpd check --fix --unsafe-fixes |
skfolio 1.14.4+ |
skfolio portfolio weights combine asset returns linearly. Averaging asset log returns produces a different portfolio return.
model.fit(prices_to_returns(prices, log_returns=True))model.fit(prices_to_returns(prices))What the rule reports
Section titled “What the rule reports”The rule follows a conversion with the explicit log option into a skfolio optimizer.
How to fix it
Section titled “How to fix it”Use xpd check --fix --unsafe-fixes when prices_to_returns(..., log_returns=True) is passed inline to switch log_returns=False.
Diagnostic message
Section titled “Diagnostic message”A skfolio optimizer averages linear asset returns. In a 59-row example, the portfolio mean was 0.0002523 from log returns and 0.0003062 from linear returns. Use prices_to_returns with log_returns=False.See all rules in the skfolio pack.