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

View File

@@ -4,7 +4,7 @@ use brk_types::{Height, StoredU64, Version};
use vecdb::{Database, IterableCloneableVec, VecIndex};
use super::Vecs;
use crate::{indexes, internal::{ComputedDerivedBlockFull, BlockFullLazyHeight}};
use crate::{indexes, internal::{ComputedDerivedBlockFull, LazyBlockFullHeight}};
impl Vecs {
pub fn forced_import(
@@ -14,7 +14,7 @@ impl Vecs {
indexes: &indexes::Vecs,
) -> Result<Self> {
Ok(Self {
vbytes: BlockFullLazyHeight::forced_import_with_init(
vbytes: LazyBlockFullHeight::forced_import_with_init(
db,
"block_vbytes",
version,

View File

@@ -1,10 +1,10 @@
use brk_traversable::Traversable;
use brk_types::{StoredU64, Weight};
use crate::internal::{ComputedDerivedBlockFull, BlockFullLazyHeight};
use crate::internal::{ComputedDerivedBlockFull, LazyBlockFullHeight};
#[derive(Clone, Traversable)]
pub struct Vecs {
pub vbytes: BlockFullLazyHeight<StoredU64, Weight>,
pub vbytes: LazyBlockFullHeight<StoredU64, Weight>,
pub size: ComputedDerivedBlockFull<StoredU64>,
}

View File

@@ -12,8 +12,8 @@ use crate::{
distribution::state::RealizedState,
indexes,
internal::{
BinaryBlockSum, BinaryBlockSumCum, ComputedBlockLast, ComputedBlockSum,
ComputedBlockSumCum, ComputedDateLast, ComputedRatioVecsDate, DollarsMinus,
ComputedBlockLast, ComputedBlockSum, ComputedBlockSumCum, ComputedDateLast,
ComputedRatioVecsDate, DollarsMinus, LazyBinaryBlockSum, LazyBinaryBlockSumCum,
LazyBlockSum, LazyBlockSumCum, LazyDateLast, PercentageDollarsF32, StoredF32Identity,
},
price,
@@ -43,9 +43,9 @@ pub struct RealizedMetrics {
pub realized_value: ComputedBlockSum<Dollars>,
// === Realized vs Realized Cap Ratios (lazy) ===
pub realized_profit_rel_to_realized_cap: BinaryBlockSumCum<StoredF32, Dollars, Dollars>,
pub realized_loss_rel_to_realized_cap: BinaryBlockSumCum<StoredF32, Dollars, Dollars>,
pub net_realized_pnl_rel_to_realized_cap: BinaryBlockSumCum<StoredF32, Dollars, Dollars>,
pub realized_profit_rel_to_realized_cap: LazyBinaryBlockSumCum<StoredF32, Dollars, Dollars>,
pub realized_loss_rel_to_realized_cap: LazyBinaryBlockSumCum<StoredF32, Dollars, Dollars>,
pub net_realized_pnl_rel_to_realized_cap: LazyBinaryBlockSumCum<StoredF32, Dollars, Dollars>,
// === Total Realized PnL ===
pub total_realized_pnl: LazyBlockSum<Dollars>,
@@ -56,8 +56,8 @@ pub struct RealizedMetrics {
pub value_destroyed: ComputedBlockSum<Dollars>,
// === Adjusted Value (lazy: cohort - up_to_1h) ===
pub adjusted_value_created: Option<BinaryBlockSum<Dollars, Dollars, Dollars>>,
pub adjusted_value_destroyed: Option<BinaryBlockSum<Dollars, Dollars, Dollars>>,
pub adjusted_value_created: Option<LazyBinaryBlockSum<Dollars, Dollars, Dollars>>,
pub adjusted_value_destroyed: Option<LazyBinaryBlockSum<Dollars, Dollars, Dollars>>,
// === SOPR (Spent Output Profit Ratio) ===
pub sopr: EagerVec<PcoVec<DateIndex, StoredF64>>,
@@ -140,7 +140,7 @@ impl RealizedMetrics {
// Construct lazy ratio vecs
let realized_profit_rel_to_realized_cap =
BinaryBlockSumCum::from_computed_last::<PercentageDollarsF32>(
LazyBinaryBlockSumCum::from_computed_last::<PercentageDollarsF32>(
&cfg.name("realized_profit_rel_to_realized_cap"),
cfg.version + v1,
realized_profit.height.boxed_clone(),
@@ -150,7 +150,7 @@ impl RealizedMetrics {
);
let realized_loss_rel_to_realized_cap =
BinaryBlockSumCum::from_computed_last::<PercentageDollarsF32>(
LazyBinaryBlockSumCum::from_computed_last::<PercentageDollarsF32>(
&cfg.name("realized_loss_rel_to_realized_cap"),
cfg.version + v1,
realized_loss.height.boxed_clone(),
@@ -160,7 +160,7 @@ impl RealizedMetrics {
);
let net_realized_pnl_rel_to_realized_cap =
BinaryBlockSumCum::from_computed_last::<PercentageDollarsF32>(
LazyBinaryBlockSumCum::from_computed_last::<PercentageDollarsF32>(
&cfg.name("net_realized_pnl_rel_to_realized_cap"),
cfg.version + v1,
net_realized_pnl.height.boxed_clone(),
@@ -194,7 +194,7 @@ impl RealizedMetrics {
let adjusted_value_created =
(compute_adjusted && cfg.up_to_1h_realized.is_some()).then(|| {
let up_to_1h = cfg.up_to_1h_realized.unwrap();
BinaryBlockSum::from_computed::<DollarsMinus>(
LazyBinaryBlockSum::from_computed::<DollarsMinus>(
&cfg.name("adjusted_value_created"),
cfg.version,
&value_created,
@@ -204,7 +204,7 @@ impl RealizedMetrics {
let adjusted_value_destroyed =
(compute_adjusted && cfg.up_to_1h_realized.is_some()).then(|| {
let up_to_1h = cfg.up_to_1h_realized.unwrap();
BinaryBlockSum::from_computed::<DollarsMinus>(
LazyBinaryBlockSum::from_computed::<DollarsMinus>(
&cfg.name("adjusted_value_destroyed"),
cfg.version,
&value_destroyed,

View File

@@ -9,7 +9,7 @@ use vecdb::{AnyStoredVec, AnyVec, Exit, GenericStoredVec};
use crate::{
indexes,
internal::{
HalfClosePriceTimesSats, HalveDollars, HalveSats, HalveSatsToBitcoin, LazyBinaryLastBlockValue,
HalfClosePriceTimesSats, HalveDollars, HalveSats, HalveSatsToBitcoin, LazyBinaryValueBlockLast,
ValueBlockLast,
},
price,
@@ -21,7 +21,7 @@ use super::ImportConfig;
#[derive(Clone, Traversable)]
pub struct SupplyMetrics {
pub total: ValueBlockLast,
pub halved: LazyBinaryLastBlockValue,
pub halved: LazyBinaryValueBlockLast,
}
impl SupplyMetrics {
@@ -37,7 +37,7 @@ impl SupplyMetrics {
compute_dollars,
)?;
let supply_half = LazyBinaryLastBlockValue::from_block_source::<
let supply_half = LazyBinaryValueBlockLast::from_block_source::<
HalveSats,
HalveSatsToBitcoin,
HalfClosePriceTimesSats,

View File

@@ -9,7 +9,7 @@ use crate::{
distribution::state::UnrealizedState,
internal::{
ComputedHeightDateLast, DollarsMinus, DollarsPlus, LazyBinaryBlockLast, LazyBlockLast,
ValueBlockDateLast,
ValueHeightDateLast,
},
};
@@ -19,8 +19,8 @@ use super::ImportConfig;
#[derive(Clone, Traversable)]
pub struct UnrealizedMetrics {
// === Supply in Profit/Loss ===
pub supply_in_profit: ValueBlockDateLast,
pub supply_in_loss: ValueBlockDateLast,
pub supply_in_profit: ValueHeightDateLast,
pub supply_in_loss: ValueHeightDateLast,
// === Unrealized Profit/Loss ===
pub unrealized_profit: ComputedHeightDateLast<Dollars>,
@@ -40,7 +40,7 @@ impl UnrealizedMetrics {
let compute_dollars = cfg.compute_dollars();
// === Supply in Profit/Loss ===
let supply_in_profit = ValueBlockDateLast::forced_import(
let supply_in_profit = ValueHeightDateLast::forced_import(
cfg.db,
&cfg.name("supply_in_profit"),
cfg.version,
@@ -48,7 +48,7 @@ impl UnrealizedMetrics {
cfg.indexes,
cfg.price,
)?;
let supply_in_loss = ValueBlockDateLast::forced_import(
let supply_in_loss = ValueHeightDateLast::forced_import(
cfg.db,
&cfg.name("supply_in_loss"),
cfg.version,

View File

@@ -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::*;

View File

@@ -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::*;

View File

@@ -1,7 +0,0 @@
mod block;
mod date;
mod tx;
pub use block::*;
pub use date::*;
pub use tx::*;

View File

@@ -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::*;

View File

@@ -1,7 +0,0 @@
mod block;
mod date;
mod tx;
pub use block::*;
pub use date::*;
pub use tx::*;

View File

@@ -1,5 +0,0 @@
mod distribution;
mod full;
pub use distribution::*;
pub use full::*;

View File

@@ -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::*;

View File

@@ -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::*;

View File

@@ -1,5 +0,0 @@
mod distribution;
mod full;
pub use distribution::*;
pub use full::*;

View File

@@ -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::*;

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::*;

View File

@@ -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,
{

View File

@@ -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)]

View File

@@ -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)]

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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::*;

View File

@@ -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::*;

View File

@@ -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)]

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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::*;

View File

@@ -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)]

View File

@@ -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::*;

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,
{

View File

@@ -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>

View File

@@ -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,

View File

@@ -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,

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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::*;

View File

@@ -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::*;

View File

@@ -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::*;

View File

@@ -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,

View File

@@ -1,5 +1,3 @@
//! OHLC - Open/High/Low/Close specialized types.
mod computed;
mod lazy;
mod period;

View File

@@ -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 {

View File

@@ -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,

View File

@@ -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::*;

View File

@@ -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,

View File

@@ -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(),

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