Skip to main content

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.

Metadata

Release files for ddstats 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ddstats 0.0.5
File Size Uploaded
ddstats-0.0.5.tar.gz 12.3 kB Details

Release files / ddstats-0.0.5.tar.gz

Download URL ddstats-0.0.5.tar.gz
Size 12.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a7a012807a8ee82d017530ef4269ef907e72c1075d29b174d0c6d4c36c801ccc
BLAKE2b-256 checksum
How to use checksums
a06e3f7c6eec44f06a957436466d40809fabe907222dd38a48b6b7fded77b791
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 19, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.5 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page