Skip to main content

Fast drawdown & CED metrics in Rust with NumPy bindings

Project description

ddstats

Fast drawdown & CED metrics in Rust with NumPy bindings.

Overview

ddstats provides high-performance financial metrics, including drawdown and Expected Drawdown (CED), implemented in Rust and exposed to Python via NumPy bindings. This allows for fast computations directly from Python, leveraging Rust's speed and safety.

Features

  • Drawdown metrics: Compute maximum drawdown and related statistics.
  • CED (Conditional Expected Drawdown): Efficient calculation for risk analysis.
  • NumPy integration: Seamless usage from Python with NumPy arrays.
  • Cross-platform: Works on Windows, macOS, and Linux.

Installation

You can install ddstats using pip:

pip install ddstats

Or build from source:

git clone https://github.com/integerQuant/ddstats.git
cd ddstats
pip install maturin
maturin develop

Usage

import numpy as np
import ddstats

x = np.array([0.01, -0.02, 0.03], dtype=float)
max_dd = ddstats.max_drawdown(x)
print("Max Drawdown:", max_dd)

API

ddstats.max_drawdown(x: np.ndarray) -> float

Computes the maximum drawdown of a time series.

  • x: 1D NumPy array of floats.

ddstats.ced(x: np.ndarray, level: float) -> float

Computes the Conditional Expected Drawdown at a given confidence level.

  • x: 1D NumPy array of floats.
  • level: Confidence level (e.g., 0.95).

Building

This project uses maturin for building Python bindings:

maturin build

License

MIT License. See LICENSE.

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

ddstats-0.0.5.tar.gz (12.3 kB view details)

Uploaded Source

File details

Details for the file ddstats-0.0.5.tar.gz.

File metadata

  • Download URL: ddstats-0.0.5.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ddstats-0.0.5.tar.gz
Algorithm Hash digest
SHA256 a7a012807a8ee82d017530ef4269ef907e72c1075d29b174d0c6d4c36c801ccc
MD5 9f176a2a783c0381d6b61e1d17d01cec
BLAKE2b-256 a06e3f7c6eec44f06a957436466d40809fabe907222dd38a48b6b7fded77b791

See more details on using hashes here.

Provenance

The following attestation bundles were made for ddstats-0.0.5.tar.gz:

Publisher: pypi.yml on integerQuant/ddstats

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