Skip to main content

Add your description here

Project description

PyFolioAnalytics

Python implementation of the R package PortfolioAnalytics.

Features

  • Portfolio Specification: Support for Box, Group, Turnover, Transaction Costs, and Position Limit constraints.
  • Optimization Engines:
    • CVXPY: Linear, Quadratic (MVO), and Mixed-Integer programming.
    • SciPy (SLSQP): Non-linear optimization for Equal Risk Contribution (ERC).
    • Differential Evolution: Global heuristic search for non-convex problems.
  • Risk Modeling:
    • Gaussian and Modified (Cornish-Fisher) VaR and ES.
    • Path-dependent measures: MaxDrawdown and AverageDrawdown.
  • Statistical Models:
    • Black-Litterman posterior estimation.
    • Statistical Factor Models (PCA).
    • Meucci Entropy Pooling for view integration.
  • Backtesting: Rolling-window and expanding-window rebalancing with flexible frequencies.
  • Hierarchical Structures: Support for Regime Switching and Multi-layer portfolio architectures.

Installation

uv sync

Testing & Validation

This library has been rigorously cross-validated against the original R PortfolioAnalytics and PerformanceAnalytics libraries using:

  1. EDHEC Dataset: Benchmark hedge fund index data.
  2. Real Stock Data: AAPL, MSFT, GOOGL, AMZN, META (2020-2026).
  3. Macro Asset Data: SPY, QQQ, GLD, TLT, BRK.B (2020-2026).

To run the parity tests:

uv run pytest

Structure

  • src/pyfolioanalytics/: Core package source.
  • data/: Sample datasets (EDHEC, Real Stock returns).
  • tests/: Comprehensive test suite including multi-dataset cross-validation.
  • third_party/PortfolioAnalytics/: Original R source for reference.

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

pyfolioanalytics-0.1.0.tar.gz (22.0 kB view details)

Uploaded Source

Built Distribution

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

pyfolioanalytics-0.1.0-py3-none-any.whl (27.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyfolioanalytics-0.1.0.tar.gz
  • Upload date:
  • Size: 22.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for pyfolioanalytics-0.1.0.tar.gz
Algorithm Hash digest
SHA256 37a2209bc234f6748aac6924409b68965f27ca0a098ef5fa949899a2741abc74
MD5 f593d20a4a162dee4afac080a250f6b2
BLAKE2b-256 5b65b3e9fda5039fc289c6bbe07175497d0b4559ef4bda116faaa77264e67d88

See more details on using hashes here.

File details

Details for the file pyfolioanalytics-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pyfolioanalytics-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 27.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for pyfolioanalytics-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6c8edab0c0b5d5e8a72ac75917ad8fb20ec11e7850a8a217a9374fe569da4da1
MD5 ca437b40496951eab00f2c80daca6069
BLAKE2b-256 522278f12eda9a1c5f95576d12d25ee4be37f374ff7d6ff2017a41606ea72618

See more details on using hashes here.

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