global: snapshot

This commit is contained in:
nym21
2025-12-29 17:02:17 +01:00
parent 445959f5b9
commit e89a67b9a7
40 changed files with 4057 additions and 1829 deletions
+1 -16
View File
@@ -1,4 +1,4 @@
use brk_types::{Bitcoin, Close, Dollars, High, Sats, StoredF32, StoredF64, StoredU32};
use brk_types::{Bitcoin, Close, Dollars, Sats, StoredF32, StoredF64, StoredU32};
use vecdb::{BinaryTransform, UnaryTransform};
/// (Dollars, Dollars) -> Dollars addition
@@ -320,18 +320,3 @@ impl BinaryTransform<Close<Dollars>, Dollars, StoredF32> for PercentageDiffClose
}
}
}
/// (High<Dollars>, Dollars) -> StoredF32 percentage difference ((a/b - 1) × 100)
/// Used for drawdown calculation from high prices
pub struct PercentageDiffHighDollars;
impl BinaryTransform<High<Dollars>, Dollars, StoredF32> for PercentageDiffHighDollars {
#[inline(always)]
fn apply(high: High<Dollars>, base: Dollars) -> StoredF32 {
if base == Dollars::ZERO {
StoredF32::default()
} else {
StoredF32::from((**high / *base - 1.0) * 100.0)
}
}
}