Fast drawdown & CED metrics in Rust with NumPy bindings.
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.
- 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.
You can install ddstats using pip:
pip install ddstatsOr build from source:
git clone https://github.com/integerQuant/ddstats.git
cd ddstats
pip install maturin
maturin developimport 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)Computes the maximum drawdown of a time series.
- x: 1D NumPy array of floats.
Computes the Conditional Expected Drawdown at a given confidence level.
- x: 1D NumPy array of floats.
- level: Confidence level (e.g., 0.95).
This project uses maturin for building Python bindings:
maturin buildMIT License. See LICENSE.