Heuristic:AI4Finance Foundation FinGPT Warning Deprecated Pyfolio Timeseries
| Knowledge Sources | |
|---|---|
| Domains | Portfolio_Analytics, Deprecation |
| Last Updated | 2026-10-18 00:00 GMT |
Overview
Deprecation warning for the vendored pyfolio timeseries module: 17 risk-metric functions are decorated `@deprecated` and delegate to the empyrical package.
Description
The vendored copy of pyfolio bundled in `fingpt/FinGPT_Others/FinGPT_Trading/chatgpt-trading-v2/pyfolio/timeseries.py` imports a `deprecated` decorator from `pyfolio.deprecate` and applies it to 17 functions (`sharpe_ratio`, `sortino_ratio`, `max_drawdown`, `annual_return`, `annual_volatility`, `calmar_ratio`, `downside_risk`, `capture`, `up_capture`, `down_capture`, `var_cov_var_normal`, `rolling_beta`, `rolling_fama_factor`, `plot_rolling_fama_decomposition`, `calc_beta`, `fragility_index`, `to_sector_mapping`). Each call emits a `DEPRECATION_WARNING` instructing users to prefer the equivalent function from the `empyrical` package, which is the actively maintained successor for these metrics.
Usage
Use this heuristic when consuming any function from the vendored `pyfolio.timeseries` module. The functions still work but emit deprecation warnings; for new code prefer importing directly from `empyrical` (e.g., `from empyrical import sharpe_ratio`) or the upstream `pyfolio` package rather than the vendored copy.
The Insight (Rule of Thumb)
- Action: Prefer `empyrical` over the vendored `pyfolio.timeseries` functions for all risk/performance metrics.
- Value: 17 of the module's public functions carry `@deprecated` — only `out_of_sample_vs_in_sample_returns` and a handful of plotting helpers are not deprecated.
- Trade-off: The vendored functions still return correct values; they only emit warnings. Continuing to use them risks future removal and clutters logs with deprecation noise.
- Compatibility: The `empyrical` package is already a transitive dependency of pyfolio and is documented at empyrical docs.
Reasoning
The vendored pyfolio was copied into the FinGPT Trading subproject for convenience, but the upstream pyfolio project itself moved its metric implementations into `empyrical`. The `DEPRECATION_WARNING` string in `timeseries.py` (line 33) reads: "Risk functions in pyfolio.timeseries are deprecated and will be removed in a future release; please import these functions from empyrical instead." The 17 `@deprecated` decorators (lines 62–485) confirm this is a systematic, module-level deprecation — not an incidental one — so any documentation of this module must flag the deprecation status to readers.