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.0.tar.gz (15.0 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.0-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for numfolio-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b07927b7fa3447f74a44bf67e28cc5b61d0cbe6fde55d56c0004575056b09c37
MD5 07eb6e6eff1da283aa8f144954303968
BLAKE2b-256 4556339072b1fc53b5209e7e822cadaf697671235c35cc13413246443ea3e486

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: numfolio-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.5 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 81091be32c3af5af94701152f79bea31ced4897af857680ec7c36704587d2972
MD5 c32c7c41a1c2aa6e0157987633ad3903
BLAKE2b-256 693cac5a3d817622524db6112e0acb1a68fec03a965f4a49f56f07d7faadbafe

See more details on using hashes here.

Provenance

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