skfolio/skfolio-prices-not-returns
| Pack | Severity | Fix | Versions |
|---|---|---|---|
| skfolio | warning | unsafe, with xpd check --fix --unsafe-fixes |
skfolio 1.14.4+ |
The skfolio S&P 500, FTSE 100 and Nasdaq loaders return price levels. Optimizers expect period returns.
EqualWeighted().fit(load_sp500_dataset())EqualWeighted().fit(prices_to_returns(load_sp500_dataset()))What the rule reports
Section titled “What the rule reports”The rule follows an unmodified loader result into fit, partial_fit or predict.
How to fix it
Section titled “How to fix it”Use xpd check --fix --unsafe-fixes to wrap the price dataset call in prices_to_returns(...) when prices_to_returns is imported.
Diagnostic message
Section titled “Diagnostic message”The skfolio dataset loader supplies prices. In a 59-row example of converted prices, an equal-weighted portfolio mean was 0.0003062 compared with 101.7354 when fed levels. Convert prices to returns first.See all rules in the skfolio pack.