skfolio/skfolio-log-returns-in-optimizer
| Rule | skfolio-log-returns-in-optimizer |
|---|---|
| Pack | skfolio |
| Severity | warning |
| Fix | unsafe, with xpd check --fix --unsafe-fixes |
| Library versions | skfolio 1.14.4 and later |
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.
Message
Section titled “Message”xpd prints this message with the issue. A name that starts with $ stands for code from your file.
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.Browse the other rules of the skfolio pack.