computer: renames

This commit is contained in:
nym21
2026-01-10 10:23:29 +01:00
parent 69729842a4
commit 3bc0615000
229 changed files with 3203 additions and 3944 deletions
@@ -1,25 +0,0 @@
//! Block-level computed types (height + dateindex + periods + difficultyepoch).
//!
//! For simpler chain-level types (height + difficultyepoch only), see `chain/`.
mod full;
mod height_date_bytes;
mod height_date_first;
mod height_date_last;
mod height_date_max;
mod height_date_min;
mod last;
mod lazy_height_sum_cum;
mod sum;
mod sum_cum;
pub use full::*;
pub use height_date_bytes::*;
pub use height_date_first::*;
pub use height_date_last::*;
pub use height_date_max::*;
pub use height_date_min::*;
pub use last::*;
pub use lazy_height_sum_cum::*;
pub use sum::*;
pub use sum_cum::*;
@@ -1,11 +0,0 @@
mod average;
mod first;
mod last;
mod max;
mod min;
pub use average::*;
pub use first::*;
pub use last::*;
pub use max::*;
pub use min::*;
@@ -1,7 +0,0 @@
mod block;
mod date;
mod tx;
pub use block::*;
pub use date::*;
pub use tx::*;
@@ -1,13 +0,0 @@
mod distribution;
mod first;
mod full;
mod last;
mod sum;
mod sum_cum;
pub use distribution::*;
pub use first::*;
pub use full::*;
pub use last::*;
pub use sum::*;
pub use sum_cum::*;
@@ -1,7 +0,0 @@
mod block;
mod date;
mod tx;
pub use block::*;
pub use date::*;
pub use tx::*;
@@ -1,5 +0,0 @@
mod distribution;
mod full;
pub use distribution::*;
pub use full::*;
@@ -1,17 +0,0 @@
mod binary_height_date_last;
mod binary_last;
mod binary_sum;
mod binary_sum_cum;
mod full;
mod last;
mod sum;
mod sum_cum;
pub use binary_height_date_last::*;
pub use binary_last::*;
pub use binary_sum::*;
pub use binary_sum_cum::*;
pub use full::*;
pub use last::*;
pub use sum::*;
pub use sum_cum::*;
@@ -1,15 +0,0 @@
mod binary_last;
mod binary_sum;
mod binary_sum_cum;
mod full;
mod last;
mod sum;
mod sum_cum;
pub use binary_last::*;
pub use binary_sum::*;
pub use binary_sum_cum::*;
pub use full::*;
pub use last::*;
pub use sum::*;
pub use sum_cum::*;
@@ -1,5 +0,0 @@
mod distribution;
mod full;
pub use distribution::*;
pub use full::*;
@@ -1,10 +0,0 @@
mod block;
mod date;
mod derived_block;
mod derived_tx;
mod transform;
pub use block::*;
pub use date::*;
pub use derived_tx::*;
pub use transform::*;
+4 -16
View File
@@ -1,21 +1,9 @@
mod aggregation;
mod compute;
mod computed;
mod derived;
mod group;
mod lazy;
mod specialized;
mod multi;
mod single;
mod traits;
mod transform;
mod vec;
pub(crate) use aggregation::*;
pub(crate) use compute::*;
pub(crate) use computed::*;
pub(crate) use derived::*;
pub(crate) use group::*;
pub(crate) use lazy::*;
pub(crate) use specialized::*;
pub(crate) use multi::*;
pub(crate) use single::*;
pub(crate) use traits::*;
pub(crate) use transform::*;
pub(crate) use vec::*;
@@ -1,4 +1,4 @@
//! ComputedVecsDate using only average-value aggregation.
//! ComputedDateAverage - dateindex storage + lazy periods for average-value aggregation.
use brk_error::Result;
use brk_traversable::Traversable;
@@ -13,7 +13,7 @@ use crate::internal::{ComputedVecValue, LazyPeriodsAverage};
#[derive(Clone, Deref, DerefMut, Traversable)]
#[traversable(merge)]
pub struct ComputedVecsDateAverage<T>
pub struct ComputedDateAverage<T>
where
T: ComputedVecValue + PartialOrd + JsonSchema,
{
@@ -26,7 +26,7 @@ where
const VERSION: Version = Version::ZERO;
impl<T> ComputedVecsDateAverage<T>
impl<T> ComputedDateAverage<T>
where
T: ComputedVecValue + JsonSchema + 'static,
{
@@ -8,12 +8,10 @@ use schemars::JsonSchema;
use vecdb::{BinaryTransform, IterableBoxedVec, IterableCloneableVec, LazyVecFrom2};
use crate::internal::{
ComputedBlockLast, ComputedBlockSum, ComputedDateLast, ComputedVecValue, LazyPeriodsLast,
LazyPeriodsSumCum, NumericValue,
ComputedBlockLast, ComputedBlockSum, ComputedDateLast, ComputedVecValue, LazyBinaryTransformLast,
LazyPeriodsLast, LazyPeriodsSumCum, NumericValue,
};
use super::super::transform::LazyBinaryTransformLast;
const VERSION: Version = Version::ZERO;
#[derive(Clone, Traversable)]
@@ -8,12 +8,11 @@ use schemars::JsonSchema;
use vecdb::{BinaryTransform, IterableCloneableVec};
use crate::internal::{
ComputedBlockLast, ComputedBlockSumCum, ComputedVecValue, ComputedDerivedBlockLast,
ComputedDerivedBlockSumCum, LazyPeriodsFull, LazyPeriodsSumCum, NumericValue, SumCum,
ComputedBlockLast, ComputedBlockSumCum, ComputedDerivedBlockLast,
ComputedDerivedBlockSumCum, ComputedVecValue, LazyBinaryTransformSumCum, LazyPeriodsFull,
LazyPeriodsSumCum, NumericValue, SumCum,
};
use super::super::transform::LazyBinaryTransformSumCum;
const VERSION: Version = Version::ZERO;
#[derive(Clone, Traversable)]
@@ -5,9 +5,7 @@ use brk_types::{DateIndex, DecadeIndex, MonthIndex, QuarterIndex, SemesterIndex,
use schemars::JsonSchema;
use vecdb::{IterableCloneableVec, UnaryTransform};
use crate::internal::{ComputedVecValue, LazyPeriodsFull, Full};
use super::super::transform::{LazyTransformFull, LazyTransformStats};
use crate::internal::{ComputedVecValue, Full, LazyPeriodsFull, LazyTransformFull, LazyTransformStats};
const VERSION: Version = Version::ZERO;
@@ -7,9 +7,7 @@ use brk_types::{
use schemars::JsonSchema;
use vecdb::{IterableBoxedVec, IterableCloneableVec, UnaryTransform};
use crate::internal::{ComputedBlockLast, ComputedDateLast, ComputedVecValue, LazyPeriodsLast, NumericValue};
use super::super::transform::LazyTransformLast;
use crate::internal::{ComputedBlockLast, ComputedDateLast, ComputedVecValue, LazyPeriodsLast, LazyTransformLast, NumericValue};
const VERSION: Version = Version::ZERO;
@@ -5,9 +5,7 @@ use brk_types::{DateIndex, DecadeIndex, MonthIndex, QuarterIndex, SemesterIndex,
use schemars::JsonSchema;
use vecdb::{IterableBoxedVec, IterableCloneableVec, UnaryTransform};
use crate::internal::{ComputedVecValue, LazyPeriodsSum};
use super::super::transform::LazyTransformSum;
use crate::internal::{ComputedVecValue, LazyPeriodsSum, LazyTransformSum};
const VERSION: Version = Version::ZERO;
@@ -5,9 +5,7 @@ use brk_types::{DateIndex, DecadeIndex, MonthIndex, QuarterIndex, SemesterIndex,
use schemars::JsonSchema;
use vecdb::{IterableCloneableVec, UnaryTransform};
use crate::internal::{ComputedVecValue, LazyPeriodsSumCum, SumCum};
use super::super::transform::LazyTransformSumCum;
use crate::internal::{ComputedVecValue, LazyPeriodsSumCum, LazyTransformSumCum, SumCum};
const VERSION: Version = Version::ZERO;
@@ -0,0 +1,25 @@
mod average;
mod binary_last;
mod binary_sum;
mod binary_sum_cum;
mod first;
mod last;
mod lazy_full;
mod lazy_last;
mod lazy_sum;
mod lazy_sum_cum;
mod max;
mod min;
pub use average::*;
pub use binary_last::*;
pub use binary_sum::*;
pub use binary_sum_cum::*;
pub use first::*;
pub use last::*;
pub use lazy_full::*;
pub use lazy_last::*;
pub use lazy_sum::*;
pub use lazy_sum_cum::*;
pub use max::*;
pub use min::*;
@@ -3,6 +3,7 @@ mod distribution;
mod first;
mod full;
mod last;
mod lazy;
mod max;
mod min;
mod sum;
@@ -13,6 +14,7 @@ pub use distribution::*;
pub use first::*;
pub use full::*;
pub use last::*;
pub use lazy::*;
pub use max::*;
pub use min::*;
pub use sum::*;
@@ -7,13 +7,11 @@ use schemars::JsonSchema;
use vecdb::{BinaryTransform, IterableCloneableVec};
use crate::internal::{
ComputedBlockLast, ComputedBlockSumCum, ComputedVecValue, ComputedDerivedBlockLast,
ComputedDerivedBlockSumCum, LazyPeriodsFull, LazyPeriodsSumCum, LazyBinaryDateSumCum, LazyFull,
LazySumCum, NumericValue, SumCum,
ComputedBlockLast, ComputedBlockSumCum, ComputedDerivedBlockLast, ComputedDerivedBlockSumCum,
ComputedVecValue, LazyBinaryDateSumCum, LazyBinaryTransformSumCum, LazyFull, LazyPeriodsFull,
LazyPeriodsSumCum, LazySumCum, NumericValue, SumCum,
};
use super::super::transform::LazyBinaryTransformSumCum;
const VERSION: Version = Version::ZERO;
#[derive(Clone, Deref, DerefMut, Traversable)]
@@ -7,11 +7,10 @@ use schemars::JsonSchema;
use vecdb::{IterableCloneableVec, UnaryTransform};
use crate::internal::{
ComputedVecValue, ComputedDerivedBlockFull, LazyPeriodsFull, Full, LazyDateFull, NumericValue,
ComputedDerivedBlockFull, ComputedVecValue, Full, LazyDateFull, LazyPeriodsFull,
LazyTransformStats, NumericValue,
};
use super::super::transform::LazyTransformStats;
#[derive(Clone, Deref, DerefMut, Traversable)]
#[traversable(merge)]
pub struct LazyDerivedBlockFull<T, S1T = T>
@@ -7,12 +7,10 @@ use schemars::JsonSchema;
use vecdb::{IterableCloneableVec, UnaryTransform};
use crate::internal::{
ComputedBlockLast, ComputedHeightDateLast, ComputedVecValue, ComputedDerivedBlockLast,
LazyDateLast, NumericValue,
ComputedBlockLast, ComputedDerivedBlockLast, ComputedHeightDateLast, ComputedVecValue,
LazyDateLast, LazyTransformLast, NumericValue,
};
use super::super::transform::LazyTransformLast;
#[derive(Clone, Deref, DerefMut, Traversable)]
#[traversable(merge)]
pub struct LazyDerivedBlockLast<T, S1T = T>
@@ -7,11 +7,10 @@ use schemars::JsonSchema;
use vecdb::{IterableCloneableVec, UnaryTransform};
use crate::internal::{
ComputedVecValue, ComputedDerivedBlockSum, LazyPeriodsSum, LazyDateSum, LazySum, NumericValue, SumVec,
ComputedDerivedBlockSum, ComputedVecValue, LazyDateSum, LazyPeriodsSum, LazySum,
LazyTransformSum, NumericValue, SumVec,
};
use super::super::transform::LazyTransformSum;
#[derive(Clone, Deref, DerefMut, Traversable)]
#[traversable(merge)]
pub struct LazyDerivedBlockSum<T, S1T = T>
@@ -7,12 +7,10 @@ use schemars::JsonSchema;
use vecdb::{IterableCloneableVec, UnaryTransform};
use crate::internal::{
ComputedVecValue, ComputedDerivedBlockSumCum, LazyPeriodsSumCum, LazyDateSumCum, LazySumCum,
NumericValue, SumCum,
ComputedDerivedBlockSumCum, ComputedVecValue, LazyDateSumCum, LazyPeriodsSumCum, LazySumCum,
LazyTransformSumCum, NumericValue, SumCum,
};
use super::super::transform::LazyTransformSumCum;
#[derive(Clone, Deref, DerefMut, Traversable)]
#[traversable(merge)]
pub struct LazyDerivedBlockSumCum<T, S1T = T>
@@ -1,21 +1,27 @@
mod binary_full;
mod binary_last;
mod binary_sum;
mod binary_sum_cum;
mod distribution;
mod first;
mod full;
mod last;
mod lazy_height_full;
mod lazy_full;
mod lazy_last;
mod lazy_sum;
mod lazy_sum_cum;
mod sum;
mod sum_cum;
pub use binary_full::*;
pub use binary_last::*;
pub use binary_sum::*;
pub use binary_sum_cum::*;
pub use distribution::*;
pub use first::*;
pub use full::*;
pub use last::*;
pub use lazy_height_full::*;
pub use lazy_full::*;
pub use lazy_last::*;
pub use lazy_sum::*;
pub use lazy_sum_cum::*;
pub use sum::*;
pub use sum_cum::*;
@@ -8,9 +8,7 @@ use brk_types::{
use schemars::JsonSchema;
use vecdb::{IterableCloneableVec, UnaryTransform};
use crate::internal::{ComputedVecValue, DerivedTxFull};
use super::super::transform::{LazyTransformFull, LazyTransformStats};
use crate::internal::{ComputedVecValue, DerivedTxFull, LazyTransformFull, LazyTransformStats};
#[derive(Clone, Traversable)]
#[traversable(merge)]
@@ -0,0 +1,9 @@
mod distribution;
mod full;
mod lazy_distribution;
mod lazy_full;
pub use distribution::*;
pub use full::*;
pub use lazy_distribution::*;
pub use lazy_full::*;
@@ -6,13 +6,13 @@ use derive_more::{Deref, DerefMut};
use schemars::JsonSchema;
use vecdb::{BinaryTransform, IterableBoxedVec, LazyVecFrom2};
use crate::internal::{ComputedBlockFull, ComputedVecValue, DerivedTxFull, NumericValue};
use super::super::derived_block::LazyBinaryDerivedBlockSumCum;
use crate::internal::{
ComputedBlockFull, ComputedVecValue, DerivedTxFull, LazyBinaryDerivedBlockSumCum, NumericValue,
};
#[derive(Clone, Deref, DerefMut, Traversable)]
#[traversable(merge)]
pub struct BinaryBlockFull<T, S1T = T, S2T = T>
pub struct LazyBinaryBlockFull<T, S1T = T, S2T = T>
where
T: ComputedVecValue + PartialOrd + JsonSchema,
S1T: ComputedVecValue,
@@ -27,7 +27,7 @@ where
const VERSION: Version = Version::ZERO;
impl<T, S1T, S2T> BinaryBlockFull<T, S1T, S2T>
impl<T, S1T, S2T> LazyBinaryBlockFull<T, S1T, S2T>
where
T: ComputedVecValue + JsonSchema + 'static,
S1T: NumericValue + JsonSchema,
@@ -1,4 +1,4 @@
//! BinaryHeightDateLast - height storage + binary transform lazy date periods.
//! LazyBinaryHeightDateLast - height storage + binary transform lazy date periods.
//!
//! Use this when height is stored as EagerVec and date periods are lazy binary transforms.
@@ -16,7 +16,7 @@ const VERSION: Version = Version::ZERO;
#[derive(Clone, Deref, DerefMut, Traversable)]
#[traversable(merge)]
pub struct BinaryHeightDateLast<T, S1T, S2T>
pub struct LazyBinaryHeightDateLast<T, S1T, S2T>
where
T: ComputedVecValue + PartialOrd + JsonSchema,
S1T: ComputedVecValue,
@@ -29,7 +29,7 @@ where
pub rest: LazyBinaryDateLast<T, S1T, S2T>,
}
impl<T, S1T, S2T> BinaryHeightDateLast<T, S1T, S2T>
impl<T, S1T, S2T> LazyBinaryHeightDateLast<T, S1T, S2T>
where
T: ComputedVecValue + JsonSchema + 'static,
S1T: ComputedVecValue + JsonSchema,
@@ -8,11 +8,10 @@ use vecdb::{BinaryTransform, IterableBoxedVec, IterableCloneableVec, LazyVecFrom
use crate::internal::{
ComputedBlockLast, ComputedBlockSumCum, ComputedHeightDateLast, ComputedVecValue,
LazyPeriodsLast, LazyBinaryDateLast, LazyBinaryTransformLast, NumericValue,
LazyBinaryDateLast, LazyBinaryDerivedBlockLast, LazyBinaryTransformLast, LazyPeriodsLast,
NumericValue,
};
use super::super::derived_block::LazyBinaryDerivedBlockLast;
#[derive(Clone, Deref, DerefMut, Traversable)]
#[traversable(merge)]
pub struct LazyBinaryBlockLast<T, S1T = T, S2T = T>
@@ -252,7 +251,7 @@ where
/// Create from separate height, difficultyepoch, and date sources.
///
/// Use when sources are split across different types (e.g., ValueBlockDateLast + ComputedBlockLast).
/// Use when sources are split across different types (e.g., ValueHeightDateLast + ComputedBlockLast).
#[allow(clippy::too_many_arguments)]
pub fn from_height_difficultyepoch_dates<F: BinaryTransform<S1T, S2T, T>>(
name: &str,
@@ -6,15 +6,16 @@ use derive_more::{Deref, DerefMut};
use schemars::JsonSchema;
use vecdb::{BinaryTransform, IterableBoxedVec, IterableCloneableVec, LazyVecFrom2};
use crate::internal::{ComputedBlockSum, ComputedVecValue, ComputedDerivedBlockSum, NumericValue};
use super::super::derived_block::LazyBinaryDerivedBlockSum;
use crate::internal::{
ComputedBlockSum, ComputedDerivedBlockSum, ComputedVecValue, LazyBinaryDerivedBlockSum,
NumericValue,
};
const VERSION: Version = Version::ZERO;
#[derive(Clone, Deref, DerefMut, Traversable)]
#[traversable(merge)]
pub struct BinaryBlockSum<T, S1T, S2T>
pub struct LazyBinaryBlockSum<T, S1T, S2T>
where
T: ComputedVecValue + PartialOrd + JsonSchema,
S1T: ComputedVecValue,
@@ -27,7 +28,7 @@ where
pub rest: LazyBinaryDerivedBlockSum<T, S1T, S2T>,
}
impl<T, S1T, S2T> BinaryBlockSum<T, S1T, S2T>
impl<T, S1T, S2T> LazyBinaryBlockSum<T, S1T, S2T>
where
T: ComputedVecValue + JsonSchema + 'static,
S1T: NumericValue + JsonSchema,
@@ -7,15 +7,13 @@ use schemars::JsonSchema;
use vecdb::{BinaryTransform, IterableBoxedVec, IterableCloneableVec, LazyVecFrom2};
use crate::internal::{
ComputedBlockLast, ComputedBlockSumCum, ComputedVecValue, ComputedDerivedBlockLast,
ComputedDerivedBlockSumCum, NumericValue,
ComputedBlockLast, ComputedBlockSumCum, ComputedDerivedBlockLast, ComputedDerivedBlockSumCum,
ComputedVecValue, LazyBinaryDerivedBlockSumCum, NumericValue,
};
use super::super::derived_block::LazyBinaryDerivedBlockSumCum;
#[derive(Clone, Deref, DerefMut, Traversable)]
#[traversable(merge)]
pub struct BinaryBlockSumCum<T, S1T = T, S2T = T>
pub struct LazyBinaryBlockSumCum<T, S1T = T, S2T = T>
where
T: ComputedVecValue + PartialOrd + JsonSchema,
S1T: ComputedVecValue,
@@ -32,7 +30,7 @@ where
const VERSION: Version = Version::ZERO;
impl<T, S1T, S2T> BinaryBlockSumCum<T, S1T, S2T>
impl<T, S1T, S2T> LazyBinaryBlockSumCum<T, S1T, S2T>
where
T: ComputedVecValue + JsonSchema + 'static,
S1T: ComputedVecValue + JsonSchema,
@@ -1,4 +1,4 @@
//! HeightDateBytes - height + dateindex BytesVec storage.
//! ComputedHeightDateBytes - height + dateindex BytesVec storage.
//!
//! Use this for simple cases where both height and dateindex are stored BytesVecs
//! without any lazy derivations. For OHLC-type data.
@@ -12,7 +12,7 @@ use vecdb::{BytesVec, BytesVecValue, Database, Formattable, ImportableVec};
#[derive(Clone, Traversable)]
#[traversable(merge)]
pub struct HeightDateBytes<T>
pub struct ComputedHeightDateBytes<T>
where
T: BytesVecValue + Formattable + Serialize + JsonSchema,
{
@@ -22,7 +22,7 @@ where
const VERSION: Version = Version::ZERO;
impl<T> HeightDateBytes<T>
impl<T> ComputedHeightDateBytes<T>
where
T: BytesVecValue + Formattable + Serialize + JsonSchema + 'static,
{
@@ -7,10 +7,9 @@ use schemars::JsonSchema;
use vecdb::{IterableBoxedVec, LazyVecFrom1, UnaryTransform};
use crate::internal::{
ComputedBlockFull, ComputedVecValue, ComputedDerivedBlockFull, NumericValue,
ComputedBlockFull, ComputedDerivedBlockFull, ComputedVecValue, LazyDerivedBlockFull,
NumericValue,
};
use super::super::derived_block::LazyDerivedBlockFull;
#[derive(Clone, Deref, DerefMut, Traversable)]
#[traversable(merge)]
pub struct LazyBlockFull<T, S1T = T>
@@ -1,4 +1,4 @@
//! BlockFullLazyHeight - block full with lazy height transform.
//! LazyBlockFullHeight - block full with lazy height transform.
use brk_error::Result;
use brk_traversable::Traversable;
@@ -17,7 +17,7 @@ const VERSION: Version = Version::ZERO;
/// Block full aggregation with lazy height transform + computed derived indexes.
#[derive(Clone, Deref, DerefMut, Traversable)]
#[traversable(merge)]
pub struct BlockFullLazyHeight<T, S = T>
pub struct LazyBlockFullHeight<T, S = T>
where
T: ComputedVecValue + PartialOrd + JsonSchema,
S: ComputedVecValue,
@@ -29,7 +29,7 @@ where
pub rest: ComputedDerivedBlockFull<T>,
}
impl<T, S> BlockFullLazyHeight<T, S>
impl<T, S> LazyBlockFullHeight<T, S>
where
T: NumericValue + JsonSchema,
S: ComputedVecValue + JsonSchema,
@@ -1,4 +1,4 @@
//! BlockSumCumLazyHeight - block sum+cumulative with lazy height transform.
//! LazyBlockSumCumHeight - block sum+cumulative with lazy height transform.
//!
//! Use this when you need:
//! - Lazy height (binary transform from two sources)
@@ -23,7 +23,7 @@ use crate::internal::{ComputedVecValue, ComputedDerivedBlockSumCum, NumericValue
/// Coarser periods are lazy lookups.
#[derive(Clone, Deref, DerefMut, Traversable)]
#[traversable(merge)]
pub struct BlockSumCumLazyHeight<T, S1T = T, S2T = T>
pub struct LazyBlockSumCumHeight<T, S1T = T, S2T = T>
where
T: ComputedVecValue + PartialOrd + JsonSchema,
S1T: ComputedVecValue,
@@ -38,7 +38,7 @@ where
const VERSION: Version = Version::ZERO;
impl<T, S1T, S2T> BlockSumCumLazyHeight<T, S1T, S2T>
impl<T, S1T, S2T> LazyBlockSumCumHeight<T, S1T, S2T>
where
T: NumericValue + JsonSchema,
S1T: ComputedVecValue + JsonSchema,
@@ -7,11 +7,9 @@ use schemars::JsonSchema;
use vecdb::{IterableBoxedVec, IterableCloneableVec, LazyVecFrom1, UnaryTransform};
use crate::internal::{
ComputedBlockLast, ComputedHeightDateLast, ComputedVecValue, ComputedDerivedBlockLast,
NumericValue,
ComputedBlockLast, ComputedDerivedBlockLast, ComputedHeightDateLast, ComputedVecValue,
LazyDerivedBlockLast, NumericValue,
};
use super::super::derived_block::LazyDerivedBlockLast;
#[derive(Clone, Deref, DerefMut, Traversable)]
#[traversable(merge)]
pub struct LazyBlockLast<T, S1T = T>
@@ -6,9 +6,9 @@ use derive_more::{Deref, DerefMut};
use schemars::JsonSchema;
use vecdb::{IterableBoxedVec, LazyVecFrom1, UnaryTransform};
use crate::internal::{ComputedBlockSum, ComputedVecValue, ComputedDerivedBlockSum, NumericValue};
use super::super::derived_block::LazyDerivedBlockSum;
use crate::internal::{
ComputedBlockSum, ComputedDerivedBlockSum, ComputedVecValue, LazyDerivedBlockSum, NumericValue,
};
#[derive(Clone, Deref, DerefMut, Traversable)]
#[traversable(merge)]
pub struct LazyBlockSum<T, S1T = T>
@@ -7,10 +7,9 @@ use schemars::JsonSchema;
use vecdb::{IterableBoxedVec, LazyVecFrom1, UnaryTransform};
use crate::internal::{
ComputedBlockSumCum, ComputedVecValue, ComputedDerivedBlockSumCum, NumericValue,
ComputedBlockSumCum, ComputedDerivedBlockSumCum, ComputedVecValue, LazyDerivedBlockSumCum,
NumericValue,
};
use super::super::derived_block::LazyDerivedBlockSumCum;
#[derive(Clone, Deref, DerefMut, Traversable)]
#[traversable(merge)]
pub struct LazyBlockSumCum<T, S1T = T>
@@ -0,0 +1,43 @@
mod binary_full;
mod binary_height_date_last;
mod binary_last;
mod binary_sum;
mod binary_sum_cum;
mod full;
mod height_date_bytes;
mod height_date_first;
mod height_date_last;
mod height_date_max;
mod height_date_min;
mod last;
mod lazy_distribution;
mod lazy_full;
mod lazy_height_full;
mod lazy_height_sum_cum;
mod lazy_last;
mod lazy_sum;
mod lazy_sum_cum;
mod sum;
mod sum_cum;
pub use binary_full::*;
pub use binary_height_date_last::*;
pub use binary_last::*;
pub use binary_sum::*;
pub use binary_sum_cum::*;
pub use full::*;
pub use height_date_bytes::*;
pub use height_date_first::*;
pub use height_date_last::*;
pub use height_date_max::*;
pub use height_date_min::*;
pub use last::*;
pub use lazy_distribution::*;
pub use lazy_full::*;
pub use lazy_height_full::*;
pub use lazy_height_sum_cum::*;
pub use lazy_last::*;
pub use lazy_sum::*;
pub use lazy_sum_cum::*;
pub use sum::*;
pub use sum_cum::*;
@@ -0,0 +1,17 @@
//! Multi-index composite types.
mod date;
mod derived_date;
mod derived_height;
mod derived_tx;
mod height;
mod specialized;
mod value;
pub use date::*;
pub use derived_date::*;
pub use derived_height::*;
pub use derived_tx::*;
pub use height::*;
pub use specialized::*;
pub use value::*;
@@ -1,15 +1,11 @@
mod constant;
mod lazy_period;
mod ohlc;
mod percentiles;
mod ratio;
mod stddev;
mod value;
pub use constant::*;
pub use lazy_period::*;
pub use ohlc::*;
pub use percentiles::*;
pub use ratio::*;
pub use stddev::*;
pub use value::*;
@@ -22,7 +22,7 @@ where
/// Lazy OHLC component extractors for height + dateindex.
#[derive(Clone, Traversable)]
pub struct HeightDateLazyOHLC<T, SourceT>
pub struct LazyHeightDateOHLC<T, SourceT>
where
T: BytesVecValue + Formattable + Serialize + JsonSchema + 'static,
SourceT: BytesVecValue + Formattable + Serialize + JsonSchema + 'static,
@@ -1,5 +1,3 @@
//! OHLC - Open/High/Low/Close specialized types.
mod computed;
mod lazy;
mod period;
@@ -10,7 +10,7 @@ use vecdb::{
use crate::{ComputeIndexes, indexes, price};
use super::super::{ClosePriceTimesRatio, ComputedDateLast, LazyBinaryDateLast};
use crate::internal::{ClosePriceTimesRatio, ComputedDateLast, LazyBinaryDateLast};
#[derive(Clone, Traversable)]
pub struct ComputedStandardDeviationVecsDate {
@@ -11,14 +11,14 @@ use vecdb::{Database, EagerVec, Exit, ImportableVec, IterableCloneableVec, PcoVe
use crate::{ComputeIndexes, indexes, price};
use super::super::block::{LazyDerivedBlockValue, LazyValueDifficultyEpochFromHeight};
use crate::internal::{LazyDerivedBlockValue, LazyValueDifficultyEpochFromHeight};
use super::ValueDateLast;
/// Value type where both height and dateindex are stored independently.
/// Dateindex values cannot be derived from height (e.g., unrealized P&L).
#[derive(Clone, Deref, DerefMut, Traversable)]
#[traversable(merge)]
pub struct ValueBlockDateLast {
pub struct ValueHeightDateLast {
#[traversable(rename = "sats")]
pub height: EagerVec<PcoVec<Height, Sats>>,
#[traversable(flatten)]
@@ -33,7 +33,7 @@ pub struct ValueBlockDateLast {
const VERSION: Version = Version::ZERO;
impl ValueBlockDateLast {
impl ValueHeightDateLast {
pub fn forced_import(
db: &Database,
name: &str,
@@ -1,9 +1,9 @@
mod block_date_last;
mod derived_last;
mod height_date_last;
mod last;
mod lazy_last;
pub use block_date_last::*;
pub use height_date_last::*;
pub use derived_last::*;
pub use last::*;
pub use lazy_last::*;
@@ -8,7 +8,7 @@ use vecdb::{Database, Exit, IterableBoxedVec, IterableCloneableVec, IterableVec,
use crate::{
ComputeIndexes, indexes,
internal::{
ClosePriceTimesSats, ComputedDerivedBlockSumCum, LazyBlockSumCum, BlockSumCumLazyHeight,
ClosePriceTimesSats, ComputedDerivedBlockSumCum, LazyBlockSumCum, LazyBlockSumCumHeight,
SatsToBitcoin,
},
price,
@@ -16,15 +16,15 @@ use crate::{
/// Value wrapper for derived SumCum (derives from external height source).
#[derive(Clone, Traversable)]
pub struct DerivedValueBlockSumCum {
pub struct ValueDerivedBlockSumCum {
pub sats: ComputedDerivedBlockSumCum<Sats>,
pub bitcoin: LazyBlockSumCum<Bitcoin, Sats>,
pub dollars: Option<BlockSumCumLazyHeight<Dollars, Close<Dollars>, Sats>>,
pub dollars: Option<LazyBlockSumCumHeight<Dollars, Close<Dollars>, Sats>>,
}
const VERSION: Version = Version::ZERO;
impl DerivedValueBlockSumCum {
impl ValueDerivedBlockSumCum {
pub fn forced_import(
db: &Database,
name: &str,
@@ -58,7 +58,7 @@ impl DerivedValueBlockSumCum {
sats_source.boxed_clone(),
);
Some(BlockSumCumLazyHeight::forced_import(
Some(LazyBlockSumCumHeight::forced_import(
db,
&format!("{name}_usd"),
v,
@@ -4,7 +4,7 @@ use schemars::JsonSchema;
use vecdb::{BinaryTransform, IterableBoxedVec, IterableCloneableVec};
use crate::internal::{
BinaryBlockSumCum, ComputedVecValue, DerivedValueBlockSumCum, LazyValueBlockSumCum,
ComputedVecValue, ValueDerivedBlockSumCum, LazyBinaryBlockSumCum, LazyValueBlockSumCum,
ValueBlockSumCum,
};
@@ -12,9 +12,9 @@ use crate::internal::{
/// Used for computing coinbase = subsidy + fee.
#[derive(Clone, Traversable)]
pub struct ValueBinaryBlock {
pub sats: BinaryBlockSumCum<Sats, Sats, Sats>,
pub bitcoin: BinaryBlockSumCum<Bitcoin, Sats, Sats>,
pub dollars: Option<BinaryBlockSumCum<Dollars, Dollars, Dollars>>,
pub sats: LazyBinaryBlockSumCum<Sats, Sats, Sats>,
pub bitcoin: LazyBinaryBlockSumCum<Bitcoin, Sats, Sats>,
pub dollars: Option<LazyBinaryBlockSumCum<Dollars, Dollars, Dollars>>,
}
impl ValueBinaryBlock {
@@ -31,7 +31,7 @@ impl ValueBinaryBlock {
BitcoinF: BinaryTransform<Sats, Sats, Bitcoin>,
DollarsF: BinaryTransform<Dollars, Dollars, Dollars>,
{
let sats = BinaryBlockSumCum::from_computed::<SatsF>(
let sats = LazyBinaryBlockSumCum::from_computed::<SatsF>(
name,
version,
height_source1.boxed_clone(),
@@ -40,7 +40,7 @@ impl ValueBinaryBlock {
&source2.sats,
);
let bitcoin = BinaryBlockSumCum::from_computed::<BitcoinF>(
let bitcoin = LazyBinaryBlockSumCum::from_computed::<BitcoinF>(
&format!("{name}_btc"),
version,
height_source1,
@@ -54,7 +54,7 @@ impl ValueBinaryBlock {
.as_ref()
.zip(source2.dollars.as_ref())
.map(|(d1, d2)| {
BinaryBlockSumCum::from_computed::<DollarsF>(
LazyBinaryBlockSumCum::from_computed::<DollarsF>(
&format!("{name}_usd"),
version,
d1.height.boxed_clone(),
@@ -76,15 +76,15 @@ impl ValueBinaryBlock {
version: Version,
height_source1: IterableBoxedVec<Height, Sats>,
height_source2: IterableBoxedVec<Height, Sats>,
source1: &DerivedValueBlockSumCum,
source2: &DerivedValueBlockSumCum,
source1: &ValueDerivedBlockSumCum,
source2: &ValueDerivedBlockSumCum,
) -> Self
where
SatsF: BinaryTransform<Sats, Sats, Sats>,
BitcoinF: BinaryTransform<Sats, Sats, Bitcoin>,
DollarsF: BinaryTransform<Dollars, Dollars, Dollars>,
{
let sats = BinaryBlockSumCum::from_derived::<SatsF>(
let sats = LazyBinaryBlockSumCum::from_derived::<SatsF>(
name,
version,
height_source1.boxed_clone(),
@@ -93,7 +93,7 @@ impl ValueBinaryBlock {
&source2.sats,
);
let bitcoin = BinaryBlockSumCum::from_derived::<BitcoinF>(
let bitcoin = LazyBinaryBlockSumCum::from_derived::<BitcoinF>(
&format!("{name}_btc"),
version,
height_source1,
@@ -107,7 +107,7 @@ impl ValueBinaryBlock {
.as_ref()
.zip(source2.dollars.as_ref())
.map(|(d1, d2)| {
BinaryBlockSumCum::from_derived::<DollarsF>(
LazyBinaryBlockSumCum::from_derived::<DollarsF>(
&format!("{name}_usd"),
version,
d1.height_cumulative.0.boxed_clone(),
@@ -137,7 +137,7 @@ impl ValueBinaryBlock {
S1T: ComputedVecValue + JsonSchema,
S2T: ComputedVecValue + JsonSchema,
{
let sats = BinaryBlockSumCum::from_derived::<SatsF>(
let sats = LazyBinaryBlockSumCum::from_derived::<SatsF>(
name,
version,
source1.sats.height.boxed_clone(),
@@ -146,7 +146,7 @@ impl ValueBinaryBlock {
&source2.sats.rest,
);
let bitcoin = BinaryBlockSumCum::from_derived::<BitcoinF>(
let bitcoin = LazyBinaryBlockSumCum::from_derived::<BitcoinF>(
&format!("{name}_btc"),
version,
source1.sats.height.boxed_clone(),
@@ -160,7 +160,7 @@ impl ValueBinaryBlock {
.as_ref()
.zip(source2.dollars.as_ref())
.map(|(d1, d2)| {
BinaryBlockSumCum::from_derived::<DollarsF>(
LazyBinaryBlockSumCum::from_derived::<DollarsF>(
&format!("{name}_usd"),
version,
d1.height.boxed_clone(),
@@ -19,7 +19,7 @@ const VERSION: Version = Version::ZERO;
/// No merge at this level - denominations (sats, bitcoin, dollars) stay as separate branches.
/// Each inner field has merge which combines indexes within each denomination.
#[derive(Clone, Deref, DerefMut, Traversable)]
pub struct LazyBinaryLastBlockValue {
pub struct LazyBinaryValueBlockLast {
#[traversable(flatten)]
pub height: LazyBlockValue,
#[traversable(flatten)]
@@ -30,7 +30,7 @@ pub struct LazyBinaryLastBlockValue {
pub dates: LazyValueDateLast,
}
impl LazyBinaryLastBlockValue {
impl LazyBinaryValueBlockLast {
pub fn from_block_source<SatsTransform, BitcoinTransform, HeightDollarsTransform, DateDollarsTransform>(
name: &str,
source: &ValueBlockLast,
@@ -14,7 +14,7 @@ use vecdb::{Database, Exit, IterableCloneableVec, LazyVecFrom2};
use crate::{
ComputeIndexes, indexes,
internal::{
ClosePriceTimesSats, ComputedBlockSumCum, LazyBlockSumCum, BlockSumCumLazyHeight,
ClosePriceTimesSats, ComputedBlockSumCum, LazyBlockSumCum, LazyBlockSumCumHeight,
SatsToBitcoin,
},
price,
@@ -29,7 +29,7 @@ use crate::{
pub struct LazyComputedValueBlockSumCum {
pub sats: ComputedBlockSumCum<Sats>,
pub bitcoin: LazyBlockSumCum<Bitcoin, Sats>,
pub dollars: Option<BlockSumCumLazyHeight<Dollars, Close<Dollars>, Sats>>,
pub dollars: Option<LazyBlockSumCumHeight<Dollars, Close<Dollars>, Sats>>,
}
const VERSION: Version = Version::ZERO;
@@ -61,7 +61,7 @@ impl LazyComputedValueBlockSumCum {
sats.height.boxed_clone(),
);
Some(BlockSumCumLazyHeight::forced_import(
Some(LazyBlockSumCumHeight::forced_import(
db,
&format!("{name}_usd"),
v,

Some files were not shown because too many files have changed in this diff Show More