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.0.1.tar.gz (4.6 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.0.1-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for numfolio-0.0.1.tar.gz
Algorithm Hash digest
SHA256 be1d61b29cf00a343f556d4266142aab0e1b23fc4123709ba94b938116c729d4
MD5 8c92468aee89318c55594cd763def0db
BLAKE2b-256 3aeeda5a0e078d82eb77cbbb59630a264c2682ae5d072d771170c3612a2e8f5f

See more details on using hashes here.

Provenance

The following attestation bundles were made for numfolio-0.0.1.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.0.1-py3-none-any.whl.

File metadata

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

File hashes

Hashes for numfolio-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 57e2f2e3331cbe91024868c2794eb526e0c8a4dc07383a76371558fa90a33fe1
MD5 40974eac41b9fb65b757db57bb90da35
BLAKE2b-256 4e18759025c5c762f8aac67813e84838a37f78efdf7b97c105de8f14244f3df5

See more details on using hashes here.

Provenance

The following attestation bundles were made for numfolio-0.0.1-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