Folioframe
Folioframe turns user-provided Pandas return or equity series into structured portfolio analytics and a modern, interactive, self-contained HTML report. It supports English and Simplified Chinese, one or many strategies, and zero, one or many benchmarks.
Open the interactive English demo · Open the Simplified Chinese demo · Browse the demo source
What you get
- Performance, risk, drawdown, distribution, tail-risk and data-quality metrics for every series.
- Strategy-versus-benchmark metrics for every pair, with a selector when multiple benchmarks exist.
- Interactive equity, drawdown and weekly/monthly/quarterly/yearly return comparisons.
- Consistent comparison tables: series in rows, metrics in columns, best values emphasized.
- Optional IC/RankIC, sample, model, recorded-cost and turnover diagnostics.
- Offline Plotly charts, light/dark themes and a single portable HTML file.
- Strict inputs: no downloads, silent filling, implicit alignment or inferred return/equity type.
Install
Install the latest release from PyPI:
python -m pip install folioframe
To test the current unreleased main branch instead:
python -m pip install "folioframe @ git+https://github.com/xystudio-ai/folioframe.git"
For local development:
git clone https://github.com/xystudio-ai/folioframe.git
cd folioframe
python -m pip install -e ".[dev]"
Quick start
import pandas as pd
from folioframe import report
strategies = pd.DataFrame(
{"My strategy": strategy_returns},
index=pd.DatetimeIndex(dates),
)
benchmarks = pd.DataFrame(
{"Market benchmark": benchmark_returns},
index=strategies.index,
)
analysis = report(
strategies,
benchmarks,
input_kind="returns",
periods_per_year=252,
risk_free_rate=0.02,
primary_benchmark="Market benchmark",
output="report.html",
language="en", # or "zh-CN"
)
print(analysis.metrics)
DataFrame column names are the report labels. Use input_kind="returns" for simple period returns
or input_kind="equity" for positive equity/NAV levels. All series must share the same increasing,
unique DatetimeIndex; Folioframe fails clearly instead of repairing inputs silently.
periods_per_year and risk_free_rate default to None. Metrics that need a missing assumption
are marked unavailable instead of assuming 252 observations or a zero risk-free rate. See the
metric definitions.
Three public workflows
| API | Use it when |
|---|---|
report(...) |
You want analysis and an HTML file in one call. |
analyze(...) |
You want structured metrics and time-series results in Python. |
render_html(...) |
You already have an Analysis and want to render it separately. |
MachineLearningDiagnostics and TradingDiagnostics are independent optional inputs. If an
object or field is omitted, its report section is omitted too. They display supplied research
facts without training a model or rerunning a backtest. See
optional diagnostics.
Reproduce the demo
The repository includes an authorized, anonymized research sample with two strategy views, two benchmarks, a 2% risk-free assumption, IC/RankIC, recorded cost, turnover and sample diagnostics. Names and machine-specific identifiers have been removed.
python examples/generate_reports.py
This writes both languages to examples/output/. The two canonical reports are also versioned in
docs/demo, so visitors can
inspect the result before installing anything.
Project structure
src/folioframe/
_core.py input validation and portfolio calculations
_diagnostics.py optional research and trading diagnostics
_render.py the single HTML/Plotly renderer
examples/
data/ anonymous demo inputs
generate_reports.py
docs/
demo/ canonical bilingual HTML reports
tests/ numerical, rendering and real-browser checks
The library owns generic formulas and rendering. Calling frameworks only translate their own verified evidence into Pandas objects; no caller-specific report logic belongs in Folioframe.
Development
python -m pip install -e ".[dev,browser,release]"
python -m playwright install chromium
ruff check .
python -m pytest
python -m build
python -m twine check dist/*
Tests are offline and deterministic. Contributions that change a public formula must include a numerical regression test, metric-documentation update and changelog entry. See CONTRIBUTING.md.
License
Folioframe is source-available under CC BY-NC 4.0. Sharing and adaptation are allowed with attribution; commercial use requires separate permission. This non-commercial license is not an OSI-approved open-source license.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file folioframe-0.1.0.tar.gz.
File metadata
- Download URL: folioframe-0.1.0.tar.gz
- Upload date:
- Size: 270.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9fe7dbb9a6e5531202536c8aa7c9c63524b4aad4aad59517e23437bcb6a024e5
|
|
| MD5 |
bc30aae947933d9214dbf5f46c9ccca4
|
|
| BLAKE2b-256 |
83bd8b7177d33cf82dd79abba1ca5ae4df9526d335da4ad1c03e3d4dc88ad093
|
Provenance
The following attestation bundles were made for folioframe-0.1.0.tar.gz:
Publisher:
publish.yml on xystudio-ai/folioframe
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
folioframe-0.1.0.tar.gz -
Subject digest:
9fe7dbb9a6e5531202536c8aa7c9c63524b4aad4aad59517e23437bcb6a024e5 - Sigstore transparency entry: 2485398646
- Sigstore integration time:
-
Permalink:
xystudio-ai/folioframe@f96e96f624b481379774c12b5617ba36e07e8650 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/xystudio-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f96e96f624b481379774c12b5617ba36e07e8650 -
Trigger Event:
release
-
Statement type:
File details
Details for the file folioframe-0.1.0-py3-none-any.whl.
File metadata
- Download URL: folioframe-0.1.0-py3-none-any.whl
- Upload date:
- Size: 255.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
47d00c3534af77cbe1e3cffbdba593380310e37a6be75c4f153b108307f177fe
|
|
| MD5 |
91ea3c315315937e39facb9b29b37ea2
|
|
| BLAKE2b-256 |
c9db53484a5e2f9d022173ffe637b998d423cab235a079bf56188837b976b9e6
|
Provenance
The following attestation bundles were made for folioframe-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on xystudio-ai/folioframe
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
folioframe-0.1.0-py3-none-any.whl -
Subject digest:
47d00c3534af77cbe1e3cffbdba593380310e37a6be75c4f153b108307f177fe - Sigstore transparency entry: 2485398673
- Sigstore integration time:
-
Permalink:
xystudio-ai/folioframe@f96e96f624b481379774c12b5617ba36e07e8650 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/xystudio-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f96e96f624b481379774c12b5617ba36e07e8650 -
Trigger Event:
release
-
Statement type: