global: snapshot

This commit is contained in:
nym21
2026-03-17 12:37:56 +01:00
parent f62943199c
commit 42540fba99
22 changed files with 736 additions and 794 deletions
@@ -10,6 +10,7 @@ pub struct Windows<A> {
impl<A> Windows<A> {
pub const SUFFIXES: [&'static str; 4] = ["24h", "1w", "1m", "1y"];
pub const DAYS: [usize; 4] = [1, 7, 30, 365];
pub fn try_from_fn<E>(
mut f: impl FnMut(&str) -> std::result::Result<A, E>,
@@ -136,7 +136,7 @@ impl RatioPerBlockPercentiles {
{
let _lock = exit.lock();
self.mut_pct_vecs().try_for_each(|v| v.flush())?;
self.mut_pct_vecs().try_for_each(|v| v.write().map(|_| ()))?;
}
// Cents bands
@@ -162,7 +162,7 @@ impl StdDevPerBlockExtended {
{
let _lock = exit.lock();
self.mut_band_height_vecs().try_for_each(|v| v.flush())?;
self.mut_band_height_vecs().try_for_each(|v| v.write().map(|_| ()))?;
}
self.zscore.height.compute_zscore(
@@ -30,6 +30,11 @@ pub trait SqrtDays {
const FACTOR: f32;
}
pub struct Days1;
impl SqrtDays for Days1 {
const FACTOR: f32 = 1.0; // 1.0_f32.sqrt()
}
pub struct Days7;
impl SqrtDays for Days7 {
const FACTOR: f32 = 2.6457513; // 7.0_f32.sqrt()
@@ -20,7 +20,7 @@ pub use currency::{
SatsToBitcoin, SatsToCents,
};
pub use derived::{
Days7, Days30, Days365, DaysToYears, PerSec, PriceTimesRatioBp32Cents, PriceTimesRatioCents,
Days1, Days7, Days30, Days365, DaysToYears, PerSec, PriceTimesRatioBp32Cents, PriceTimesRatioCents,
RatioCents64, TimesSqrt,
};
pub use ratio::{