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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a7a012807a8ee82d017530ef4269ef907e72c1075d29b174d0c6d4c36c801ccc
|
|
| MD5 |
9f176a2a783c0381d6b61e1d17d01cec
|
|
| BLAKE2b-256 |
a06e3f7c6eec44f06a957436466d40809fabe907222dd38a48b6b7fded77b791
|
Provenance
The following attestation bundles were made for ddstats-0.0.5.tar.gz:
Publisher:
pypi.yml on integerQuant/ddstats
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ddstats-0.0.5.tar.gz -
Subject digest:
a7a012807a8ee82d017530ef4269ef907e72c1075d29b174d0c6d4c36c801ccc - Sigstore transparency entry: 539050455
- Sigstore integration time:
-
Permalink:
integerQuant/ddstats@3535748c1992a6c7dea0bf922c5b5519e101d766 -
Branch / Tag:
refs/tags/v0.0.5 - Owner: https://github.com/integerQuant
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@3535748c1992a6c7dea0bf922c5b5519e101d766 -
Trigger Event:
push
-
Statement type: