Skip to main content

Crate use_drawdown

Crate use_drawdown 

Source
Expand description

§use-drawdown

Primitive drawdown vocabulary for RustUse quantitative crates.

use-drawdown uses the convention current / peak - 1.0, capped at 0.0 for new highs. Drawdowns are therefore zero or negative finite f64 values.

§Example

use use_drawdown::Drawdown;

let drawdown = Drawdown::from_peak_current(120.0, 90.0)?;
let maximum = Drawdown::maximum_from_values(&[100.0, 120.0, 90.0, 130.0])?;

assert_eq!(drawdown.value(), -0.25);
assert_eq!(maximum.value(), -0.25);

§Scope

Use this crate for drawdown values and small peak/current calculations. It does not implement performance analytics, reporting, or charts.

§License

Licensed under either MIT or Apache-2.0.

Modules§

prelude
Common drawdown primitives.

Structs§

Drawdown
A finite drawdown value using the convention current / peak - 1.0, capped at 0.0.
DrawdownPoint
A drawdown point with an optional label.
DrawdownWindow
A simple observation-count drawdown window.

Enums§

DrawdownError
Errors returned by drawdown helpers.