Skip to main content

No project description provided

Project description

numfolio ⚡

Portfolio performance accelerated by Numba

A lightweight, flexible Python package for analyzing portfolio returns, risk metrics, and correlations using modern statistical and machine learning methods.


🚀 Features

✅ Bootstrapped metric estimation (e.g., Sharpe Ratio, Sortino Ratio)

✅ Automatic Scorecard Generation with time-based aggregation (Yearly, Quarterly, Monthly)

✅ Covariance and Correlation estimation with robust shrinkage methods

✅ Parallel computation for scalability

✅ Clean, consistent API inspired by scikit-learn & pandas


🔧 Installation

To install the package the simplest procedure is:

pip install numfolio

Now you can test the installation... In a python shell:

import numfolio as nf

nf.__version__

Optional dependencies are docs for documentation and build for development. To install optional dependencies pip install numfolio[docs,build].

📚 Example Usage

1. Compute Scorecard from PnL or Returns:

import pandas as pd
from numfolio import get_scorecard

# Sample PnL data
dates = pd.date_range("2025-01-01", periods=60, freq="D")
pnl = pd.Series(range(100, 160), index=dates)

df = pd.DataFrame({"pnl": pnl})

scorecard = get_scorecard(df, freq="M")
print(scorecard)

2. Estimate Bootstrapped Sharpe Ratio:

import numpy as np
from numfolio import bootstrap_metric

# Generate fake returns
returns = np.random.default_rng().normal(0, 1, 100)

bootstrapped = bootstrap_metric(returns, metric="sharpe_ratio", n_bootstraps=500)
print("Bootstrapped Sharpe Ratios:", bootstrapped[:5])

3. Estimate Correlation Matrix:

import pandas as pd
import numpy as np
from numfolio import estimate_correlation

dates = pd.date_range("2025-01-01", periods=100, freq="D")
returns = pd.DataFrame(np.random.default_rng().normal(0, 1, (100, 3)), columns=["A", "B", "C"], index=dates)

correlation = estimate_correlation(returns, method="ledoit_wolf", n_bootstraps=200)
print(correlation)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

numfolio-0.1.2.tar.gz (15.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

numfolio-0.1.2-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

Details for the file numfolio-0.1.2.tar.gz.

File metadata

  • Download URL: numfolio-0.1.2.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for numfolio-0.1.2.tar.gz
Algorithm Hash digest
SHA256 c269ad7544f54fbc4c320e193bc8dd619f90be9dd85bea9b0e903d47d21ec705
MD5 ea7753443eceaa2789d3afe33a8fabe9
BLAKE2b-256 6d9413936df3d15f5eac84b4f97b556b362615f1333cbb802cdbf37ce98302fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for numfolio-0.1.2.tar.gz:

Publisher: python-publish.yml on agdiiura/numfolio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file numfolio-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: numfolio-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 15.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for numfolio-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f712bccbf3628d7e8bba99e54e5ba2be5e247de57b09193d73b785b56743a094
MD5 d8e9c2a94e93ac5ec7a6e18436778f74
BLAKE2b-256 c46c0dabbeccf495885e8d20b6fa55ec4ea6a882f7700fcd0d1fcb405f8fab5a

See more details on using hashes here.

Provenance

The following attestation bundles were made for numfolio-0.1.2-py3-none-any.whl:

Publisher: python-publish.yml on agdiiura/numfolio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page