global: snapshot

This commit is contained in:
nym21
2026-01-15 23:34:43 +01:00
parent b0d933a7ab
commit 967d2c7f35
67 changed files with 6854 additions and 5210 deletions

View File

@@ -7,7 +7,7 @@ use brk_types::Version;
use schemars::JsonSchema;
use vecdb::{LazyVecFrom1, UnaryTransform, VecIndex};
use crate::internal::{ComputedVecValue, Full};
use crate::internal::{ComputedVecValue, Distribution, Full};
use super::LazyPercentiles;
@@ -61,4 +61,33 @@ where
),
}
}
pub fn from_distribution<F: UnaryTransform<S1T, T>>(
name: &str,
version: Version,
source: &Distribution<I, S1T>,
) -> Self {
Self {
average: LazyVecFrom1::transformed::<F>(
&format!("{name}_average"),
version,
source.boxed_average(),
),
min: LazyVecFrom1::transformed::<F>(
&format!("{name}_min"),
version,
source.boxed_min(),
),
max: LazyVecFrom1::transformed::<F>(
&format!("{name}_max"),
version,
source.boxed_max(),
),
percentiles: LazyPercentiles::from_percentiles::<F>(
name,
version,
&source.percentiles,
),
}
}
}

View File

@@ -0,0 +1,11 @@
use brk_types::{Cents, Dollars};
use vecdb::UnaryTransform;
pub struct CentsToDollars;
impl UnaryTransform<Cents, Dollars> for CentsToDollars {
#[inline(always)]
fn apply(cents: Cents) -> Dollars {
Dollars::from(cents)
}
}

View File

@@ -1,3 +1,4 @@
mod cents_to_dollars;
mod close_price_times_ratio;
mod close_price_times_sats;
mod difference_f32;
@@ -37,6 +38,7 @@ mod volatility_sqrt365;
mod volatility_sqrt7;
mod weight_to_fullness;
pub use cents_to_dollars::*;
pub use close_price_times_ratio::*;
pub use close_price_times_sats::*;
pub use difference_f32::*;