diff --git a/crates/brk_computer/src/vecs/blocks.rs b/crates/brk_computer/src/vecs/blocks.rs index 1abde0813..bb0c2dc1f 100644 --- a/crates/brk_computer/src/vecs/blocks.rs +++ b/crates/brk_computer/src/vecs/blocks.rs @@ -12,7 +12,7 @@ use crate::vecs::grouped::Source; use super::{ Indexes, - grouped::{ComputedVecsFromDateIndex, ComputedVecsFromHeight, EagerVecBuilderOptions}, + grouped::{ComputedVecsFromDateIndex, ComputedVecsFromHeight, VecBuilderOptions}, indexes, }; @@ -53,7 +53,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_first(), + VecBuilderOptions::default().add_first(), )?, indexes_to_block_interval: ComputedVecsFromHeight::forced_import( path, @@ -62,7 +62,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default() + VecBuilderOptions::default() .add_percentiles() .add_minmax() .add_average(), @@ -74,7 +74,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_sum().add_cumulative(), + VecBuilderOptions::default().add_sum().add_cumulative(), )?, indexes_to_block_weight: ComputedVecsFromHeight::forced_import( path, @@ -83,7 +83,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_sum().add_cumulative(), + VecBuilderOptions::default().add_sum().add_cumulative(), )?, indexes_to_block_size: ComputedVecsFromHeight::forced_import( path, @@ -92,7 +92,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_sum().add_cumulative(), + VecBuilderOptions::default().add_sum().add_cumulative(), )?, height_to_vbytes: EagerVec::forced_import( path, @@ -107,7 +107,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_sum().add_cumulative(), + VecBuilderOptions::default().add_sum().add_cumulative(), )?, difficultyepoch_to_timestamp: EagerVec::forced_import( path, diff --git a/crates/brk_computer/src/vecs/cointime.rs b/crates/brk_computer/src/vecs/cointime.rs index bf0bdd173..c641d9e17 100644 --- a/crates/brk_computer/src/vecs/cointime.rs +++ b/crates/brk_computer/src/vecs/cointime.rs @@ -13,7 +13,7 @@ use crate::vecs::{ use super::{ Indexes, - grouped::{ComputedVecsFromHeight, EagerVecBuilderOptions}, + grouped::{ComputedVecsFromHeight, VecBuilderOptions}, indexes, }; @@ -65,7 +65,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_sum().add_cumulative(), + VecBuilderOptions::default().add_sum().add_cumulative(), )?, indexes_to_coinblocks_stored: ComputedVecsFromHeight::forced_import( path, @@ -74,7 +74,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_sum().add_cumulative(), + VecBuilderOptions::default().add_sum().add_cumulative(), )?, indexes_to_liveliness: ComputedVecsFromHeight::forced_import( path, @@ -83,7 +83,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, indexes_to_vaultedness: ComputedVecsFromHeight::forced_import( path, @@ -92,7 +92,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, indexes_to_activity_to_vaultedness_ratio: ComputedVecsFromHeight::forced_import( path, @@ -101,7 +101,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, indexes_to_vaulted_supply: ComputedValueVecsFromHeight::forced_import( path, @@ -110,7 +110,7 @@ impl Vecs { version + VERSION + Version::ONE, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), compute_dollars, )?, indexes_to_active_supply: ComputedValueVecsFromHeight::forced_import( @@ -120,7 +120,7 @@ impl Vecs { version + VERSION + Version::ONE, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), compute_dollars, )?, indexes_to_thermo_cap: ComputedVecsFromHeight::forced_import( @@ -130,7 +130,7 @@ impl Vecs { version + VERSION + Version::ONE, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, indexes_to_investor_cap: ComputedVecsFromHeight::forced_import( path, @@ -139,7 +139,7 @@ impl Vecs { version + VERSION + Version::ONE, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, indexes_to_vaulted_cap: ComputedVecsFromHeight::forced_import( path, @@ -148,7 +148,7 @@ impl Vecs { version + VERSION + Version::ONE, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, indexes_to_active_cap: ComputedVecsFromHeight::forced_import( path, @@ -157,7 +157,7 @@ impl Vecs { version + VERSION + Version::ONE, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, indexes_to_vaulted_price: ComputedVecsFromHeight::forced_import( path, @@ -166,7 +166,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, indexes_to_vaulted_price_ratio: ComputedRatioVecsFromDateIndex::forced_import( path, @@ -183,7 +183,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, indexes_to_active_price_ratio: ComputedRatioVecsFromDateIndex::forced_import( path, @@ -200,7 +200,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, indexes_to_true_market_mean_ratio: ComputedRatioVecsFromDateIndex::forced_import( path, @@ -217,7 +217,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_sum().add_cumulative(), + VecBuilderOptions::default().add_sum().add_cumulative(), )?, indexes_to_cointime_value_created: ComputedVecsFromHeight::forced_import( path, @@ -226,7 +226,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_sum().add_cumulative(), + VecBuilderOptions::default().add_sum().add_cumulative(), )?, indexes_to_cointime_value_stored: ComputedVecsFromHeight::forced_import( path, @@ -235,7 +235,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_sum().add_cumulative(), + VecBuilderOptions::default().add_sum().add_cumulative(), )?, indexes_to_cointime_price: ComputedVecsFromHeight::forced_import( path, @@ -244,7 +244,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, indexes_to_cointime_cap: ComputedVecsFromHeight::forced_import( path, @@ -253,7 +253,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, indexes_to_cointime_price_ratio: ComputedRatioVecsFromDateIndex::forced_import( path, diff --git a/crates/brk_computer/src/vecs/constants.rs b/crates/brk_computer/src/vecs/constants.rs index 1a76cc36c..6eabc3211 100644 --- a/crates/brk_computer/src/vecs/constants.rs +++ b/crates/brk_computer/src/vecs/constants.rs @@ -9,7 +9,7 @@ use crate::vecs::grouped::Source; use super::{ Indexes, - grouped::{ComputedVecsFromHeight, EagerVecBuilderOptions}, + grouped::{ComputedVecsFromHeight, VecBuilderOptions}, indexes, }; @@ -38,7 +38,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, constant_1: ComputedVecsFromHeight::forced_import( path, @@ -47,7 +47,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, constant_50: ComputedVecsFromHeight::forced_import( path, @@ -56,7 +56,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, constant_100: ComputedVecsFromHeight::forced_import( path, @@ -65,7 +65,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, }) } diff --git a/crates/brk_computer/src/vecs/fetched.rs b/crates/brk_computer/src/vecs/fetched.rs index 2975127f5..22f62780e 100644 --- a/crates/brk_computer/src/vecs/fetched.rs +++ b/crates/brk_computer/src/vecs/fetched.rs @@ -16,7 +16,7 @@ use crate::vecs::grouped::Source; use super::{ Indexes, - grouped::{ComputedVecsFromDateIndex, ComputedVecsFromHeightStrict, EagerVecBuilderOptions}, + grouped::{ComputedVecsFromDateIndex, ComputedVecsFromHeightStrict, VecBuilderOptions}, indexes, }; @@ -176,7 +176,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_first(), + VecBuilderOptions::default().add_first(), )?, timeindexes_to_high: ComputedVecsFromDateIndex::forced_import( path, @@ -185,7 +185,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_max(), + VecBuilderOptions::default().add_max(), )?, timeindexes_to_low: ComputedVecsFromDateIndex::forced_import( path, @@ -194,7 +194,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_min(), + VecBuilderOptions::default().add_min(), )?, timeindexes_to_close: ComputedVecsFromDateIndex::forced_import( path, @@ -203,7 +203,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, timeindexes_to_open_in_sats: ComputedVecsFromDateIndex::forced_import( path, @@ -212,7 +212,7 @@ impl Vecs { version + VERSION + VERSION_IN_SATS + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_first(), + VecBuilderOptions::default().add_first(), )?, timeindexes_to_high_in_sats: ComputedVecsFromDateIndex::forced_import( path, @@ -221,7 +221,7 @@ impl Vecs { version + VERSION + VERSION_IN_SATS + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_max(), + VecBuilderOptions::default().add_max(), )?, timeindexes_to_low_in_sats: ComputedVecsFromDateIndex::forced_import( path, @@ -230,7 +230,7 @@ impl Vecs { version + VERSION + VERSION_IN_SATS + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_min(), + VecBuilderOptions::default().add_min(), )?, timeindexes_to_close_in_sats: ComputedVecsFromDateIndex::forced_import( path, @@ -239,63 +239,63 @@ impl Vecs { version + VERSION + VERSION_IN_SATS + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, chainindexes_to_open: ComputedVecsFromHeightStrict::forced_import( path, "open", version + VERSION + Version::ZERO, format, - EagerVecBuilderOptions::default().add_first(), + VecBuilderOptions::default().add_first(), )?, chainindexes_to_high: ComputedVecsFromHeightStrict::forced_import( path, "high", version + VERSION + Version::ZERO, format, - EagerVecBuilderOptions::default().add_max(), + VecBuilderOptions::default().add_max(), )?, chainindexes_to_low: ComputedVecsFromHeightStrict::forced_import( path, "low", version + VERSION + Version::ZERO, format, - EagerVecBuilderOptions::default().add_min(), + VecBuilderOptions::default().add_min(), )?, chainindexes_to_close: ComputedVecsFromHeightStrict::forced_import( path, "close", version + VERSION + Version::ZERO, format, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, chainindexes_to_open_in_sats: ComputedVecsFromHeightStrict::forced_import( path, "open_in_sats", version + VERSION + VERSION_IN_SATS + Version::ZERO, format, - EagerVecBuilderOptions::default().add_first(), + VecBuilderOptions::default().add_first(), )?, chainindexes_to_high_in_sats: ComputedVecsFromHeightStrict::forced_import( path, "high_in_sats", version + VERSION + VERSION_IN_SATS + Version::ZERO, format, - EagerVecBuilderOptions::default().add_max(), + VecBuilderOptions::default().add_max(), )?, chainindexes_to_low_in_sats: ComputedVecsFromHeightStrict::forced_import( path, "low_in_sats", version + VERSION + VERSION_IN_SATS + Version::ZERO, format, - EagerVecBuilderOptions::default().add_min(), + VecBuilderOptions::default().add_min(), )?, chainindexes_to_close_in_sats: ComputedVecsFromHeightStrict::forced_import( path, "close_in_sats", version + VERSION + VERSION_IN_SATS + Version::ZERO, format, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, weekindex_to_ohlc: EagerVec::forced_import( path, @@ -458,7 +458,7 @@ impl Vecs { .into_owned() }; - let mut ohlc = if di.unwrap_to_usize() + 1 >= this.len() { + let mut ohlc = if di.unwrap_to_usize() + 100 >= this.len() { fetcher.get_date(d).unwrap_or_else(|_| get_prev()) } else { get_prev() diff --git a/crates/brk_computer/src/vecs/grouped/builder_computed.rs b/crates/brk_computer/src/vecs/grouped/builder_computed.rs index a3cf94f51..538b2118c 100644 --- a/crates/brk_computer/src/vecs/grouped/builder_computed.rs +++ b/crates/brk_computer/src/vecs/grouped/builder_computed.rs @@ -7,7 +7,7 @@ use brk_vec::{ ComputedVec, ComputedVecFrom1, Format, StoredIndex, }; -use crate::vecs::grouped::{EagerVecBuilder, EagerVecBuilderOptions}; +use crate::vecs::grouped::{EagerVecBuilder, VecBuilderOptions}; use super::ComputedType; @@ -101,7 +101,7 @@ where ), |i, source| { source - .next_at(S1I::max_from(i)) + .next_at(S1I::max_from(i, source.len())) .map(|(_, cow)| cow.into_owned()) }, ) @@ -121,7 +121,7 @@ where .as_ref() .map_or_else(|| source.as_ref().unwrap().clone(), |v| v.clone()), |i, source| { - S1I::inclusive_range_from(i) + S1I::inclusive_range_from(i, source.len()) .flat_map(|i| source.next_at(i).map(|(_, cow)| cow.into_owned())) .min() }, @@ -142,7 +142,7 @@ where .as_ref() .map_or_else(|| source.as_ref().unwrap().clone(), |v| v.clone()), |i, source| { - S1I::inclusive_range_from(i) + S1I::inclusive_range_from(i, source.len()) .flat_map(|i| source.next_at(i).map(|(_, cow)| cow.into_owned())) .max() }, @@ -163,7 +163,7 @@ where .as_ref() .map_or_else(|| source.as_ref().unwrap().clone(), |v| v.clone()), |i, source| { - let vec = S1I::inclusive_range_from(i) + let vec = S1I::inclusive_range_from(i, source.len()) .flat_map(|i| source.next_at(i).map(|(_, cow)| cow.into_owned())) .collect::>(); if vec.is_empty() { @@ -195,7 +195,7 @@ where .as_ref() .map_or_else(|| source.as_ref().unwrap().clone(), |v| v.clone()), |i, source| { - let vec = S1I::inclusive_range_from(i) + let vec = S1I::inclusive_range_from(i, source.len()) .flat_map(|i| source.next_at(i).map(|(_, cow)| cow.into_owned())) .collect::>(); if vec.is_empty() { @@ -220,7 +220,7 @@ where source_extra.cumulative.as_ref().unwrap().boxed_clone(), |i, source| { source - .next_at(S1I::max_from(i)) + .next_at(S1I::max_from(i, source.len())) .map(|(_, cow)| cow.into_owned()) }, ) @@ -331,8 +331,8 @@ pub struct ComputedVecBuilderOptions { cumulative: bool, } -impl From for ComputedVecBuilderOptions { - fn from(value: EagerVecBuilderOptions) -> Self { +impl From for ComputedVecBuilderOptions { + fn from(value: VecBuilderOptions) -> Self { Self { average: value.average(), sum: value.sum(), diff --git a/crates/brk_computer/src/vecs/grouped/builder_eager.rs b/crates/brk_computer/src/vecs/grouped/builder_eager.rs index 7c21026e6..3a7d6e536 100644 --- a/crates/brk_computer/src/vecs/grouped/builder_eager.rs +++ b/crates/brk_computer/src/vecs/grouped/builder_eager.rs @@ -41,7 +41,7 @@ where name: &str, version: Version, format: Format, - options: EagerVecBuilderOptions, + options: VecBuilderOptions, ) -> color_eyre::Result { let only_one_active = options.is_only_one_active(); @@ -706,7 +706,7 @@ where } #[derive(Default, Clone, Copy)] -pub struct EagerVecBuilderOptions { +pub struct VecBuilderOptions { average: bool, sum: bool, max: bool, @@ -721,7 +721,7 @@ pub struct EagerVecBuilderOptions { cumulative: bool, } -impl EagerVecBuilderOptions { +impl VecBuilderOptions { pub fn average(&self) -> bool { self.average } diff --git a/crates/brk_computer/src/vecs/grouped/from_dateindex.rs b/crates/brk_computer/src/vecs/grouped/from_dateindex.rs index 4b2425b0b..30ac2d806 100644 --- a/crates/brk_computer/src/vecs/grouped/from_dateindex.rs +++ b/crates/brk_computer/src/vecs/grouped/from_dateindex.rs @@ -12,7 +12,7 @@ use brk_vec::{ use crate::vecs::{Indexes, grouped::ComputedVecBuilder, indexes}; -use super::{ComputedType, EagerVecBuilder, EagerVecBuilderOptions, Source}; +use super::{ComputedType, EagerVecBuilder, Source, VecBuilderOptions}; #[derive(Clone)] pub struct ComputedVecsFromDateIndex @@ -42,7 +42,7 @@ where version: Version, format: Format, computation: Computation, - options: EagerVecBuilderOptions, + options: VecBuilderOptions, ) -> color_eyre::Result { let dateindex = source.is_compute().then(|| { EagerVec::forced_import(path, name, version + VERSION + Version::ZERO, format).unwrap() @@ -76,7 +76,7 @@ where name, version + VERSION + Version::ZERO, format, - computation, + Computation::Lazy, dateindex_source.clone(), &dateindex_extra, options.into(), @@ -86,7 +86,7 @@ where name, version + VERSION + Version::ZERO, format, - computation, + Computation::Lazy, dateindex_source.clone(), &dateindex_extra, options.into(), @@ -96,7 +96,7 @@ where name, version + VERSION + Version::ZERO, format, - computation, + Computation::Lazy, dateindex_source.clone(), &dateindex_extra, options.into(), @@ -106,7 +106,7 @@ where name, version + VERSION + Version::ZERO, format, - computation, + Computation::Lazy, dateindex_source.clone(), &dateindex_extra, options.into(), @@ -116,7 +116,7 @@ where name, version + VERSION + Version::ZERO, format, - computation, + Computation::Lazy, dateindex_source.clone(), &dateindex_extra, options.into(), diff --git a/crates/brk_computer/src/vecs/grouped/from_height.rs b/crates/brk_computer/src/vecs/grouped/from_height.rs index 09f3de5d0..a6a695c41 100644 --- a/crates/brk_computer/src/vecs/grouped/from_height.rs +++ b/crates/brk_computer/src/vecs/grouped/from_height.rs @@ -14,7 +14,7 @@ use crate::vecs::{ indexes, }; -use super::{ComputedType, EagerVecBuilder, EagerVecBuilderOptions}; +use super::{ComputedType, EagerVecBuilder, VecBuilderOptions}; #[derive(Clone)] pub struct ComputedVecsFromHeight @@ -48,7 +48,7 @@ where version: Version, format: Format, computation: Computation, - options: EagerVecBuilderOptions, + options: VecBuilderOptions, ) -> color_eyre::Result { let height = source.is_compute().then(|| { EagerVec::forced_import(path, name, version + VERSION + Version::ZERO, format).unwrap() @@ -88,7 +88,7 @@ where name, version + VERSION + Version::ZERO, format, - computation, + Computation::Lazy, None, &dateindex, options.into(), @@ -98,7 +98,7 @@ where name, version + VERSION + Version::ZERO, format, - computation, + Computation::Lazy, None, &dateindex, options.into(), @@ -108,7 +108,7 @@ where name, version + VERSION + Version::ZERO, format, - computation, + Computation::Lazy, None, &dateindex, options.into(), @@ -118,7 +118,7 @@ where name, version + VERSION + Version::ZERO, format, - computation, + Computation::Lazy, None, &dateindex, options.into(), @@ -128,7 +128,7 @@ where name, version + VERSION + Version::ZERO, format, - computation, + Computation::Lazy, None, &dateindex, options.into(), diff --git a/crates/brk_computer/src/vecs/grouped/from_height_strict.rs b/crates/brk_computer/src/vecs/grouped/from_height_strict.rs index ba319de3a..1147a7f54 100644 --- a/crates/brk_computer/src/vecs/grouped/from_height_strict.rs +++ b/crates/brk_computer/src/vecs/grouped/from_height_strict.rs @@ -7,7 +7,7 @@ use brk_vec::{AnyCollectableVec, EagerVec, Format}; use crate::vecs::{Indexes, indexes}; -use super::{ComputedType, EagerVecBuilder, EagerVecBuilderOptions}; +use super::{ComputedType, EagerVecBuilder, VecBuilderOptions}; #[derive(Clone)] pub struct ComputedVecsFromHeightStrict @@ -32,7 +32,7 @@ where name: &str, version: Version, format: Format, - options: EagerVecBuilderOptions, + options: VecBuilderOptions, ) -> color_eyre::Result { let height = EagerVec::forced_import(path, name, version + VERSION + Version::ZERO, format)?; diff --git a/crates/brk_computer/src/vecs/grouped/from_txindex.rs b/crates/brk_computer/src/vecs/grouped/from_txindex.rs index 95762da37..1f4da4276 100644 --- a/crates/brk_computer/src/vecs/grouped/from_txindex.rs +++ b/crates/brk_computer/src/vecs/grouped/from_txindex.rs @@ -17,7 +17,7 @@ use crate::vecs::{ indexes, }; -use super::{ComputedType, EagerVecBuilder, EagerVecBuilderOptions}; +use super::{ComputedType, EagerVecBuilder, VecBuilderOptions}; #[derive(Clone)] pub struct ComputedVecsFromTxindex @@ -51,7 +51,7 @@ where version: Version, format: Format, computation: Computation, - options: EagerVecBuilderOptions, + options: VecBuilderOptions, ) -> color_eyre::Result { let txindex = source.is_compute().then(|| { Box::new( @@ -94,7 +94,7 @@ where name, version + VERSION + Version::ZERO, format, - computation, + Computation::Lazy, None, &dateindex, options.into(), @@ -104,7 +104,7 @@ where name, version + VERSION + Version::ZERO, format, - computation, + Computation::Lazy, None, &dateindex, options.into(), @@ -114,7 +114,7 @@ where name, version + VERSION + Version::ZERO, format, - computation, + Computation::Lazy, None, &dateindex, options.into(), @@ -124,7 +124,7 @@ where name, version + VERSION + Version::ZERO, format, - computation, + Computation::Lazy, None, &dateindex, options.into(), @@ -134,7 +134,7 @@ where name, version + VERSION + Version::ZERO, format, - computation, + Computation::Lazy, None, &dateindex, options.into(), diff --git a/crates/brk_computer/src/vecs/grouped/ratio_from_dateindex.rs b/crates/brk_computer/src/vecs/grouped/ratio_from_dateindex.rs index eb674562e..ef17044b6 100644 --- a/crates/brk_computer/src/vecs/grouped/ratio_from_dateindex.rs +++ b/crates/brk_computer/src/vecs/grouped/ratio_from_dateindex.rs @@ -13,7 +13,7 @@ use crate::{ vecs::{Indexes, fetched, grouped::source::Source, indexes}, }; -use super::{ComputedVecsFromDateIndex, EagerVecBuilderOptions}; +use super::{ComputedVecsFromDateIndex, VecBuilderOptions}; #[derive(Clone)] pub struct ComputedRatioVecsFromDateIndex { @@ -69,7 +69,7 @@ impl ComputedRatioVecsFromDateIndex { format: Format, computation: Computation, ) -> color_eyre::Result { - let options = EagerVecBuilderOptions::default().add_last(); + let options = VecBuilderOptions::default().add_last(); Ok(Self { price: source.is_compute().then(|| { diff --git a/crates/brk_computer/src/vecs/grouped/value_from_dateindex.rs b/crates/brk_computer/src/vecs/grouped/value_from_dateindex.rs index 721828224..a6e888ec8 100644 --- a/crates/brk_computer/src/vecs/grouped/value_from_dateindex.rs +++ b/crates/brk_computer/src/vecs/grouped/value_from_dateindex.rs @@ -7,7 +7,7 @@ use brk_vec::{AnyCollectableVec, CollectableVec, Computation, EagerVec, Format, use crate::vecs::{Indexes, fetched, grouped::ComputedVecsFromDateIndex, indexes}; -use super::{EagerVecBuilderOptions, Source}; +use super::{Source, VecBuilderOptions}; #[derive(Clone)] pub struct ComputedValueVecsFromDateIndex { @@ -27,7 +27,7 @@ impl ComputedValueVecsFromDateIndex { version: Version, format: Format, computation: Computation, - options: EagerVecBuilderOptions, + options: VecBuilderOptions, compute_dollars: bool, ) -> color_eyre::Result { Ok(Self { diff --git a/crates/brk_computer/src/vecs/grouped/value_from_height.rs b/crates/brk_computer/src/vecs/grouped/value_from_height.rs index 41fec526f..830b414a4 100644 --- a/crates/brk_computer/src/vecs/grouped/value_from_height.rs +++ b/crates/brk_computer/src/vecs/grouped/value_from_height.rs @@ -7,7 +7,7 @@ use brk_vec::{AnyCollectableVec, CollectableVec, Computation, EagerVec, Format, use crate::vecs::{Indexes, fetched, grouped::Source, indexes}; -use super::{ComputedVecsFromHeight, EagerVecBuilderOptions}; +use super::{ComputedVecsFromHeight, VecBuilderOptions}; #[derive(Clone)] pub struct ComputedValueVecsFromHeight { @@ -27,7 +27,7 @@ impl ComputedValueVecsFromHeight { version: Version, format: Format, computation: Computation, - options: EagerVecBuilderOptions, + options: VecBuilderOptions, compute_dollars: bool, ) -> color_eyre::Result { Ok(Self { diff --git a/crates/brk_computer/src/vecs/grouped/value_from_txindex.rs b/crates/brk_computer/src/vecs/grouped/value_from_txindex.rs index 32f6a3cdf..9b3554717 100644 --- a/crates/brk_computer/src/vecs/grouped/value_from_txindex.rs +++ b/crates/brk_computer/src/vecs/grouped/value_from_txindex.rs @@ -10,7 +10,7 @@ use brk_vec::{ use crate::vecs::{Indexes, fetched, grouped::Source, indexes}; -use super::{ComputedVecsFromTxindex, EagerVecBuilderOptions}; +use super::{ComputedVecsFromTxindex, VecBuilderOptions}; #[derive(Clone)] pub struct ComputedValueVecsFromTxindex { @@ -46,7 +46,7 @@ impl ComputedValueVecsFromTxindex { computation: Computation, format: Format, fetched: Option<&fetched::Vecs>, - options: EagerVecBuilderOptions, + options: VecBuilderOptions, ) -> color_eyre::Result { let compute_dollars = fetched.is_some(); diff --git a/crates/brk_computer/src/vecs/market.rs b/crates/brk_computer/src/vecs/market.rs index a5b27ec71..7288a5f72 100644 --- a/crates/brk_computer/src/vecs/market.rs +++ b/crates/brk_computer/src/vecs/market.rs @@ -9,7 +9,7 @@ use crate::vecs::grouped::Source; use super::{ Indexes, fetched, - grouped::{ComputedRatioVecsFromDateIndex, ComputedVecsFromDateIndex, EagerVecBuilderOptions}, + grouped::{ComputedRatioVecsFromDateIndex, ComputedVecsFromDateIndex, VecBuilderOptions}, indexes, transactions, }; @@ -194,7 +194,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, indexes_to_ath: ComputedVecsFromDateIndex::forced_import( path, @@ -203,7 +203,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, indexes_to_drawdown: ComputedVecsFromDateIndex::forced_import( path, @@ -212,7 +212,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, indexes_to_days_since_ath: ComputedVecsFromDateIndex::forced_import( path, @@ -221,7 +221,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, indexes_to_max_days_between_aths: ComputedVecsFromDateIndex::forced_import( path, @@ -230,7 +230,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, indexes_to_max_years_between_aths: ComputedVecsFromDateIndex::forced_import( path, @@ -239,7 +239,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, indexes_to_1w_sma: ComputedRatioVecsFromDateIndex::forced_import( @@ -362,7 +362,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _1w_returns: ComputedVecsFromDateIndex::forced_import( path, @@ -371,7 +371,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _1m_returns: ComputedVecsFromDateIndex::forced_import( path, @@ -380,7 +380,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _3m_returns: ComputedVecsFromDateIndex::forced_import( path, @@ -389,7 +389,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _6m_returns: ComputedVecsFromDateIndex::forced_import( path, @@ -398,7 +398,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _1y_returns: ComputedVecsFromDateIndex::forced_import( path, @@ -407,7 +407,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _2y_returns: ComputedVecsFromDateIndex::forced_import( path, @@ -416,7 +416,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _3y_returns: ComputedVecsFromDateIndex::forced_import( path, @@ -425,7 +425,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _4y_returns: ComputedVecsFromDateIndex::forced_import( path, @@ -434,7 +434,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _5y_returns: ComputedVecsFromDateIndex::forced_import( path, @@ -443,7 +443,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _6y_returns: ComputedVecsFromDateIndex::forced_import( path, @@ -452,7 +452,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _8y_returns: ComputedVecsFromDateIndex::forced_import( path, @@ -461,7 +461,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _10y_returns: ComputedVecsFromDateIndex::forced_import( path, @@ -470,7 +470,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _2y_cagr: ComputedVecsFromDateIndex::forced_import( path, @@ -479,7 +479,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _3y_cagr: ComputedVecsFromDateIndex::forced_import( path, @@ -488,7 +488,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _4y_cagr: ComputedVecsFromDateIndex::forced_import( path, @@ -497,7 +497,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _5y_cagr: ComputedVecsFromDateIndex::forced_import( path, @@ -506,7 +506,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _6y_cagr: ComputedVecsFromDateIndex::forced_import( path, @@ -515,7 +515,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _8y_cagr: ComputedVecsFromDateIndex::forced_import( path, @@ -524,7 +524,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _10y_cagr: ComputedVecsFromDateIndex::forced_import( path, @@ -533,7 +533,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _1w_dca_returns: ComputedVecsFromDateIndex::forced_import( @@ -543,7 +543,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _1m_dca_returns: ComputedVecsFromDateIndex::forced_import( path, @@ -552,7 +552,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _3m_dca_returns: ComputedVecsFromDateIndex::forced_import( path, @@ -561,7 +561,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _6m_dca_returns: ComputedVecsFromDateIndex::forced_import( path, @@ -570,7 +570,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _1y_dca_returns: ComputedVecsFromDateIndex::forced_import( path, @@ -579,7 +579,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _2y_dca_returns: ComputedVecsFromDateIndex::forced_import( path, @@ -588,7 +588,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _3y_dca_returns: ComputedVecsFromDateIndex::forced_import( path, @@ -597,7 +597,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _4y_dca_returns: ComputedVecsFromDateIndex::forced_import( path, @@ -606,7 +606,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _5y_dca_returns: ComputedVecsFromDateIndex::forced_import( path, @@ -615,7 +615,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _6y_dca_returns: ComputedVecsFromDateIndex::forced_import( path, @@ -624,7 +624,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _8y_dca_returns: ComputedVecsFromDateIndex::forced_import( path, @@ -633,7 +633,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _10y_dca_returns: ComputedVecsFromDateIndex::forced_import( path, @@ -642,7 +642,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _2y_dca_cagr: ComputedVecsFromDateIndex::forced_import( path, @@ -651,7 +651,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _3y_dca_cagr: ComputedVecsFromDateIndex::forced_import( path, @@ -660,7 +660,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _4y_dca_cagr: ComputedVecsFromDateIndex::forced_import( path, @@ -669,7 +669,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _5y_dca_cagr: ComputedVecsFromDateIndex::forced_import( path, @@ -678,7 +678,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _6y_dca_cagr: ComputedVecsFromDateIndex::forced_import( path, @@ -687,7 +687,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _8y_dca_cagr: ComputedVecsFromDateIndex::forced_import( path, @@ -696,7 +696,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _10y_dca_cagr: ComputedVecsFromDateIndex::forced_import( path, @@ -705,7 +705,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _1w_dca_avg_price: ComputedVecsFromDateIndex::forced_import( path, @@ -714,7 +714,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _1m_dca_avg_price: ComputedVecsFromDateIndex::forced_import( path, @@ -723,7 +723,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _3m_dca_avg_price: ComputedVecsFromDateIndex::forced_import( path, @@ -732,7 +732,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _6m_dca_avg_price: ComputedVecsFromDateIndex::forced_import( path, @@ -741,7 +741,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _1y_dca_avg_price: ComputedVecsFromDateIndex::forced_import( path, @@ -750,7 +750,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _2y_dca_avg_price: ComputedVecsFromDateIndex::forced_import( path, @@ -759,7 +759,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _3y_dca_avg_price: ComputedVecsFromDateIndex::forced_import( path, @@ -768,7 +768,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _4y_dca_avg_price: ComputedVecsFromDateIndex::forced_import( path, @@ -777,7 +777,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _5y_dca_avg_price: ComputedVecsFromDateIndex::forced_import( path, @@ -786,7 +786,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _6y_dca_avg_price: ComputedVecsFromDateIndex::forced_import( path, @@ -795,7 +795,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _8y_dca_avg_price: ComputedVecsFromDateIndex::forced_import( path, @@ -804,7 +804,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _10y_dca_avg_price: ComputedVecsFromDateIndex::forced_import( path, @@ -813,7 +813,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, price_1d_ago: ComputedVecsFromDateIndex::forced_import( path, @@ -822,7 +822,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, price_1w_ago: ComputedVecsFromDateIndex::forced_import( path, @@ -831,7 +831,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, price_1m_ago: ComputedVecsFromDateIndex::forced_import( path, @@ -840,7 +840,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, price_3m_ago: ComputedVecsFromDateIndex::forced_import( path, @@ -849,7 +849,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, price_6m_ago: ComputedVecsFromDateIndex::forced_import( path, @@ -858,7 +858,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, price_1y_ago: ComputedVecsFromDateIndex::forced_import( path, @@ -867,7 +867,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, price_2y_ago: ComputedVecsFromDateIndex::forced_import( path, @@ -876,7 +876,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, price_3y_ago: ComputedVecsFromDateIndex::forced_import( path, @@ -885,7 +885,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, price_4y_ago: ComputedVecsFromDateIndex::forced_import( path, @@ -894,7 +894,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, price_5y_ago: ComputedVecsFromDateIndex::forced_import( path, @@ -903,7 +903,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, price_6y_ago: ComputedVecsFromDateIndex::forced_import( path, @@ -912,7 +912,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, price_8y_ago: ComputedVecsFromDateIndex::forced_import( path, @@ -921,7 +921,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, price_10y_ago: ComputedVecsFromDateIndex::forced_import( path, @@ -930,7 +930,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _1w_dca_stack: ComputedVecsFromDateIndex::forced_import( path, @@ -939,7 +939,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _1m_dca_stack: ComputedVecsFromDateIndex::forced_import( path, @@ -948,7 +948,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _3m_dca_stack: ComputedVecsFromDateIndex::forced_import( path, @@ -957,7 +957,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _6m_dca_stack: ComputedVecsFromDateIndex::forced_import( path, @@ -966,7 +966,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _1y_dca_stack: ComputedVecsFromDateIndex::forced_import( path, @@ -975,7 +975,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _2y_dca_stack: ComputedVecsFromDateIndex::forced_import( path, @@ -984,7 +984,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _3y_dca_stack: ComputedVecsFromDateIndex::forced_import( path, @@ -993,7 +993,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _4y_dca_stack: ComputedVecsFromDateIndex::forced_import( path, @@ -1002,7 +1002,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _5y_dca_stack: ComputedVecsFromDateIndex::forced_import( path, @@ -1011,7 +1011,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _6y_dca_stack: ComputedVecsFromDateIndex::forced_import( path, @@ -1020,7 +1020,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _8y_dca_stack: ComputedVecsFromDateIndex::forced_import( path, @@ -1029,7 +1029,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, _10y_dca_stack: ComputedVecsFromDateIndex::forced_import( path, @@ -1038,7 +1038,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, dca_class_2025_stack: ComputedVecsFromDateIndex::forced_import( @@ -1048,7 +1048,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, dca_class_2024_stack: ComputedVecsFromDateIndex::forced_import( path, @@ -1057,7 +1057,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, dca_class_2023_stack: ComputedVecsFromDateIndex::forced_import( path, @@ -1066,7 +1066,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, dca_class_2022_stack: ComputedVecsFromDateIndex::forced_import( path, @@ -1075,7 +1075,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, dca_class_2021_stack: ComputedVecsFromDateIndex::forced_import( path, @@ -1084,7 +1084,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, dca_class_2020_stack: ComputedVecsFromDateIndex::forced_import( path, @@ -1093,7 +1093,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, dca_class_2019_stack: ComputedVecsFromDateIndex::forced_import( path, @@ -1102,7 +1102,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, dca_class_2018_stack: ComputedVecsFromDateIndex::forced_import( path, @@ -1111,7 +1111,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, dca_class_2017_stack: ComputedVecsFromDateIndex::forced_import( path, @@ -1120,7 +1120,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, dca_class_2016_stack: ComputedVecsFromDateIndex::forced_import( path, @@ -1129,7 +1129,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, dca_class_2015_stack: ComputedVecsFromDateIndex::forced_import( path, @@ -1138,7 +1138,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, dca_class_2025_avg_price: ComputedVecsFromDateIndex::forced_import( @@ -1148,7 +1148,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, dca_class_2024_avg_price: ComputedVecsFromDateIndex::forced_import( path, @@ -1157,7 +1157,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, dca_class_2023_avg_price: ComputedVecsFromDateIndex::forced_import( path, @@ -1166,7 +1166,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, dca_class_2022_avg_price: ComputedVecsFromDateIndex::forced_import( path, @@ -1175,7 +1175,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, dca_class_2021_avg_price: ComputedVecsFromDateIndex::forced_import( path, @@ -1184,7 +1184,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, dca_class_2020_avg_price: ComputedVecsFromDateIndex::forced_import( path, @@ -1193,7 +1193,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, dca_class_2019_avg_price: ComputedVecsFromDateIndex::forced_import( path, @@ -1202,7 +1202,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, dca_class_2018_avg_price: ComputedVecsFromDateIndex::forced_import( path, @@ -1211,7 +1211,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, dca_class_2017_avg_price: ComputedVecsFromDateIndex::forced_import( path, @@ -1220,7 +1220,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, dca_class_2016_avg_price: ComputedVecsFromDateIndex::forced_import( path, @@ -1229,7 +1229,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, dca_class_2015_avg_price: ComputedVecsFromDateIndex::forced_import( path, @@ -1238,7 +1238,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, dca_class_2025_returns: ComputedVecsFromDateIndex::forced_import( @@ -1248,7 +1248,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, dca_class_2024_returns: ComputedVecsFromDateIndex::forced_import( path, @@ -1257,7 +1257,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, dca_class_2023_returns: ComputedVecsFromDateIndex::forced_import( path, @@ -1266,7 +1266,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, dca_class_2022_returns: ComputedVecsFromDateIndex::forced_import( path, @@ -1275,7 +1275,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, dca_class_2021_returns: ComputedVecsFromDateIndex::forced_import( path, @@ -1284,7 +1284,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, dca_class_2020_returns: ComputedVecsFromDateIndex::forced_import( path, @@ -1293,7 +1293,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, dca_class_2019_returns: ComputedVecsFromDateIndex::forced_import( path, @@ -1302,7 +1302,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, dca_class_2018_returns: ComputedVecsFromDateIndex::forced_import( path, @@ -1311,7 +1311,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, dca_class_2017_returns: ComputedVecsFromDateIndex::forced_import( path, @@ -1320,7 +1320,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, dca_class_2016_returns: ComputedVecsFromDateIndex::forced_import( path, @@ -1329,7 +1329,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, dca_class_2015_returns: ComputedVecsFromDateIndex::forced_import( path, @@ -1338,7 +1338,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, indexes_to_200d_sma_x2_4: ComputedVecsFromDateIndex::forced_import( @@ -1348,7 +1348,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, indexes_to_200d_sma_x0_8: ComputedVecsFromDateIndex::forced_import( path, @@ -1357,7 +1357,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, }) } diff --git a/crates/brk_computer/src/vecs/mining.rs b/crates/brk_computer/src/vecs/mining.rs index 79a623ac3..b32af2ef9 100644 --- a/crates/brk_computer/src/vecs/mining.rs +++ b/crates/brk_computer/src/vecs/mining.rs @@ -9,7 +9,7 @@ use crate::vecs::grouped::Source; use super::{ Indexes, - grouped::{ComputedVecsFromDateIndex, ComputedVecsFromHeight, EagerVecBuilderOptions}, + grouped::{ComputedVecsFromDateIndex, ComputedVecsFromHeight, VecBuilderOptions}, indexes, }; @@ -37,7 +37,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, indexes_to_difficultyepoch: ComputedVecsFromDateIndex::forced_import( path, @@ -46,7 +46,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, indexes_to_halvingepoch: ComputedVecsFromDateIndex::forced_import( path, @@ -55,7 +55,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, }) } diff --git a/crates/brk_computer/src/vecs/stateful/address_cohort.rs b/crates/brk_computer/src/vecs/stateful/address_cohort.rs index 83ccf4a47..93e261de8 100644 --- a/crates/brk_computer/src/vecs/stateful/address_cohort.rs +++ b/crates/brk_computer/src/vecs/stateful/address_cohort.rs @@ -11,7 +11,7 @@ use crate::{ states::AddressCohortState, vecs::{ Indexes, fetched, - grouped::{ComputedVecsFromHeight, EagerVecBuilderOptions, Source}, + grouped::{ComputedVecsFromHeight, Source, VecBuilderOptions}, indexes, market, stateful::{ common, @@ -70,7 +70,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, inner: common::Vecs::forced_import( path, diff --git a/crates/brk_computer/src/vecs/stateful/common.rs b/crates/brk_computer/src/vecs/stateful/common.rs index 50d27c7f5..0d5db9101 100644 --- a/crates/brk_computer/src/vecs/stateful/common.rs +++ b/crates/brk_computer/src/vecs/stateful/common.rs @@ -17,7 +17,7 @@ use crate::{ grouped::{ ComputedHeightValueVecs, ComputedRatioVecsFromDateIndex, ComputedValueVecsFromDateIndex, ComputedVecsFromDateIndex, ComputedVecsFromHeight, - EagerVecBuilderOptions, Source, + Source, VecBuilderOptions, }, indexes, market, }, @@ -213,7 +213,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), compute_dollars, ) .unwrap() @@ -236,7 +236,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), compute_dollars, ) .unwrap() @@ -259,7 +259,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), compute_dollars, ) .unwrap() @@ -282,7 +282,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), ) .unwrap() }), @@ -322,7 +322,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), ) .unwrap() }), @@ -344,7 +344,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), ) .unwrap() }), @@ -356,7 +356,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), ) .unwrap() }), @@ -368,7 +368,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), ) .unwrap() }), @@ -393,7 +393,7 @@ impl Vecs { version + VERSION + Version::ONE, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), compute_dollars, )?, height_to_utxo_count: EagerVec::forced_import( @@ -409,7 +409,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, indexes_to_realized_price: compute_dollars.then(|| { ComputedVecsFromHeight::forced_import( @@ -419,7 +419,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), ) .unwrap() }), @@ -451,7 +451,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default() + VecBuilderOptions::default() .add_sum() .add_cumulative(), ) @@ -474,7 +474,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default() + VecBuilderOptions::default() .add_sum() .add_cumulative(), ) @@ -488,7 +488,7 @@ impl Vecs { version + VERSION + Version::ONE, format, computation, - EagerVecBuilderOptions::default().add_sum().add_cumulative(), + VecBuilderOptions::default().add_sum().add_cumulative(), ) .unwrap() }), @@ -509,7 +509,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_sum(), + VecBuilderOptions::default().add_sum(), ) .unwrap() }), @@ -521,7 +521,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_sum(), + VecBuilderOptions::default().add_sum(), ) .unwrap() }), @@ -542,7 +542,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_sum(), + VecBuilderOptions::default().add_sum(), ) .unwrap() }), @@ -563,7 +563,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_sum(), + VecBuilderOptions::default().add_sum(), ) .unwrap() }), @@ -584,7 +584,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_sum(), + VecBuilderOptions::default().add_sum(), ) .unwrap() }), @@ -596,7 +596,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), ) .unwrap() }), @@ -608,7 +608,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default() + VecBuilderOptions::default() .add_sum() .add_cumulative(), ) @@ -656,7 +656,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), compute_dollars, )?, height_to_negative_unrealized_loss: compute_dollars.then(|| { @@ -676,7 +676,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), ) .unwrap() }), @@ -697,7 +697,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), ) .unwrap() }), @@ -721,7 +721,7 @@ impl Vecs { version + VERSION + Version::ONE, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), ) .unwrap() }, @@ -734,7 +734,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_sum(), + VecBuilderOptions::default().add_sum(), ) .unwrap() }), @@ -746,7 +746,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_sum(), + VecBuilderOptions::default().add_sum(), ) .unwrap() }), @@ -759,7 +759,7 @@ impl Vecs { version + VERSION + Version::ONE, format, computation, - EagerVecBuilderOptions::default().add_sum(), + VecBuilderOptions::default().add_sum(), ) .unwrap() }, @@ -832,7 +832,7 @@ impl Vecs { version + VERSION + Version::ONE, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), ) .unwrap() }), @@ -844,7 +844,7 @@ impl Vecs { version + VERSION + Version::ONE, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), ) .unwrap() }), @@ -856,7 +856,7 @@ impl Vecs { version + VERSION + Version::ONE, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), ) .unwrap() }), @@ -868,7 +868,7 @@ impl Vecs { version + VERSION + Version::ONE, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), ) .unwrap() }), @@ -915,7 +915,7 @@ impl Vecs { version + VERSION + Version::ONE, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), ) .unwrap() }), @@ -929,7 +929,7 @@ impl Vecs { version + VERSION + Version::ONE, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), ) .unwrap() }), @@ -943,7 +943,7 @@ impl Vecs { version + VERSION + Version::ONE, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), ) .unwrap() }), @@ -966,7 +966,7 @@ impl Vecs { version + VERSION + Version::TWO, format, computation, - EagerVecBuilderOptions::default().add_sum().add_cumulative(), + VecBuilderOptions::default().add_sum().add_cumulative(), )?, indexes_to_coindays_destroyed: ComputedVecsFromHeight::forced_import( path, @@ -975,7 +975,7 @@ impl Vecs { version + VERSION + Version::TWO, format, computation, - EagerVecBuilderOptions::default().add_sum().add_cumulative(), + VecBuilderOptions::default().add_sum().add_cumulative(), )?, indexes_to_net_realized_profit_and_loss_cumulative_30d_change: compute_dollars.then(|| { ComputedVecsFromDateIndex::forced_import( @@ -985,7 +985,7 @@ impl Vecs { version + VERSION + Version::new(3), format, computation, - EagerVecBuilderOptions::default().add_last() + VecBuilderOptions::default().add_last() ) .unwrap() }), @@ -997,7 +997,7 @@ impl Vecs { version + VERSION + Version::new(3), format, computation, - EagerVecBuilderOptions::default().add_last() + VecBuilderOptions::default().add_last() ) .unwrap() }), @@ -1009,7 +1009,7 @@ impl Vecs { version + VERSION + Version::new(3), format, computation, - EagerVecBuilderOptions::default().add_last() + VecBuilderOptions::default().add_last() ) .unwrap() }), diff --git a/crates/brk_computer/src/vecs/stateful/mod.rs b/crates/brk_computer/src/vecs/stateful/mod.rs index d24b9f795..4bdf609c3 100644 --- a/crates/brk_computer/src/vecs/stateful/mod.rs +++ b/crates/brk_computer/src/vecs/stateful/mod.rs @@ -31,7 +31,7 @@ use crate::{ use super::{ Indexes, fetched, - grouped::{ComputedValueVecsFromHeight, EagerVecBuilderOptions}, + grouped::{ComputedValueVecsFromHeight, VecBuilderOptions}, indexes, transactions, }; @@ -110,7 +110,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), compute_dollars, )?, height_to_opreturn_supply: EagerVec::forced_import( @@ -126,7 +126,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), compute_dollars, )?, indexes_to_address_count: ComputedVecsFromHeight::forced_import( @@ -136,7 +136,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, indexes_to_empty_address_count: ComputedVecsFromHeight::forced_import( path, @@ -145,7 +145,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, addresstype_to_height_to_address_count: AddressTypeToHeightToAddressCount::from( ByAddressType { @@ -260,7 +260,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, p2pk33: ComputedVecsFromHeight::forced_import( path, @@ -269,7 +269,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, p2pkh: ComputedVecsFromHeight::forced_import( path, @@ -278,7 +278,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, p2sh: ComputedVecsFromHeight::forced_import( path, @@ -287,7 +287,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, p2wpkh: ComputedVecsFromHeight::forced_import( path, @@ -296,7 +296,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, p2wsh: ComputedVecsFromHeight::forced_import( path, @@ -305,7 +305,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, p2tr: ComputedVecsFromHeight::forced_import( path, @@ -314,7 +314,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, p2a: ComputedVecsFromHeight::forced_import( path, @@ -323,7 +323,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, }, ), @@ -336,7 +336,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, p2pk33: ComputedVecsFromHeight::forced_import( path, @@ -345,7 +345,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, p2pkh: ComputedVecsFromHeight::forced_import( path, @@ -354,7 +354,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, p2sh: ComputedVecsFromHeight::forced_import( path, @@ -363,7 +363,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, p2wpkh: ComputedVecsFromHeight::forced_import( path, @@ -372,7 +372,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, p2wsh: ComputedVecsFromHeight::forced_import( path, @@ -381,7 +381,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, p2tr: ComputedVecsFromHeight::forced_import( path, @@ -390,7 +390,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, p2a: ComputedVecsFromHeight::forced_import( path, @@ -399,7 +399,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, }, ), diff --git a/crates/brk_computer/src/vecs/transactions.rs b/crates/brk_computer/src/vecs/transactions.rs index 11380ed90..9c3f0bf9d 100644 --- a/crates/brk_computer/src/vecs/transactions.rs +++ b/crates/brk_computer/src/vecs/transactions.rs @@ -17,7 +17,7 @@ use super::{ Indexes, fetched, grouped::{ ComputedValueVecsFromHeight, ComputedValueVecsFromTxindex, ComputedVecsFromHeight, - ComputedVecsFromTxindex, EagerVecBuilderOptions, + ComputedVecsFromTxindex, VecBuilderOptions, }, indexes, }; @@ -347,7 +347,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default() + VecBuilderOptions::default() .add_average() .add_minmax() .add_percentiles() @@ -361,7 +361,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default() + VecBuilderOptions::default() .add_average() .add_minmax() .add_percentiles() @@ -375,7 +375,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default() + VecBuilderOptions::default() .add_average() .add_minmax() .add_percentiles() @@ -389,7 +389,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_sum().add_cumulative(), + VecBuilderOptions::default().add_sum().add_cumulative(), )?, indexes_to_tx_v2: ComputedVecsFromHeight::forced_import( path, @@ -398,7 +398,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_sum().add_cumulative(), + VecBuilderOptions::default().add_sum().add_cumulative(), )?, indexes_to_tx_v3: ComputedVecsFromHeight::forced_import( path, @@ -407,7 +407,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_sum().add_cumulative(), + VecBuilderOptions::default().add_sum().add_cumulative(), )?, indexes_to_fee: ComputedValueVecsFromTxindex::forced_import( path, @@ -418,7 +418,7 @@ impl Vecs { computation, format, fetched, - EagerVecBuilderOptions::default() + VecBuilderOptions::default() .add_sum() .add_cumulative() .add_percentiles() @@ -432,7 +432,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default() + VecBuilderOptions::default() .add_percentiles() .add_minmax() .add_average(), @@ -444,7 +444,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default() + VecBuilderOptions::default() .add_percentiles() .add_minmax() .add_average(), @@ -456,7 +456,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default() + VecBuilderOptions::default() .add_percentiles() .add_minmax() .add_average(), @@ -468,7 +468,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default() + VecBuilderOptions::default() .add_percentiles() .add_sum() .add_cumulative() @@ -483,7 +483,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default() + VecBuilderOptions::default() .add_sum() .add_cumulative() .add_percentiles() @@ -498,7 +498,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_sum().add_cumulative(), + VecBuilderOptions::default().add_sum().add_cumulative(), compute_dollars, )?, indexes_to_p2a_count: ComputedVecsFromHeight::forced_import( @@ -508,7 +508,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default() + VecBuilderOptions::default() .add_average() .add_minmax() .add_percentiles() @@ -522,7 +522,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default() + VecBuilderOptions::default() .add_average() .add_minmax() .add_percentiles() @@ -536,7 +536,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default() + VecBuilderOptions::default() .add_average() .add_minmax() .add_percentiles() @@ -550,7 +550,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default() + VecBuilderOptions::default() .add_average() .add_minmax() .add_percentiles() @@ -564,7 +564,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default() + VecBuilderOptions::default() .add_average() .add_minmax() .add_percentiles() @@ -578,7 +578,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default() + VecBuilderOptions::default() .add_average() .add_minmax() .add_percentiles() @@ -592,7 +592,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default() + VecBuilderOptions::default() .add_average() .add_minmax() .add_percentiles() @@ -606,7 +606,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default() + VecBuilderOptions::default() .add_average() .add_minmax() .add_percentiles() @@ -620,7 +620,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default() + VecBuilderOptions::default() .add_average() .add_minmax() .add_percentiles() @@ -634,7 +634,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default() + VecBuilderOptions::default() .add_average() .add_minmax() .add_percentiles() @@ -648,7 +648,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default() + VecBuilderOptions::default() .add_average() .add_minmax() .add_percentiles() @@ -662,7 +662,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default() + VecBuilderOptions::default() .add_average() .add_minmax() .add_percentiles() @@ -676,7 +676,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, - EagerVecBuilderOptions::default().add_last(), + VecBuilderOptions::default().add_last(), )?, txindex_to_is_coinbase, inputindex_to_value, diff --git a/crates/brk_core/src/structs/dateindex.rs b/crates/brk_core/src/structs/dateindex.rs index 8ca089287..e6d5d4185 100644 --- a/crates/brk_core/src/structs/dateindex.rs +++ b/crates/brk_core/src/structs/dateindex.rs @@ -119,7 +119,7 @@ impl FromCoarserIndex for DateIndex { } } - fn max_from(coarser: WeekIndex) -> usize { + fn max_from_(coarser: WeekIndex) -> usize { let coarser = usize::from(coarser); if coarser == 0 { 0 @@ -145,7 +145,7 @@ impl FromCoarserIndex for DateIndex { } } - fn max_from(coarser: MonthIndex) -> usize { + fn max_from_(coarser: MonthIndex) -> usize { let d = Date::new(2009, 1, 31) .into_jiff() .checked_add(Span::new().months(u16::from(coarser))) @@ -168,7 +168,7 @@ impl FromCoarserIndex for DateIndex { } } - fn max_from(coarser: QuarterIndex) -> usize { + fn max_from_(coarser: QuarterIndex) -> usize { let d = Date::new(2009, 3, 31) .into_jiff() .checked_add(Span::new().months(3 * u16::from(coarser))) @@ -191,7 +191,7 @@ impl FromCoarserIndex for DateIndex { } } - fn max_from(coarser: SemesterIndex) -> usize { + fn max_from_(coarser: SemesterIndex) -> usize { let d = Date::new(2009, 5, 31) .into_jiff() .checked_add(Span::new().months(1 + 6 * u16::from(coarser))) @@ -212,7 +212,7 @@ impl FromCoarserIndex for DateIndex { } } - fn max_from(coarser: YearIndex) -> usize { + fn max_from_(coarser: YearIndex) -> usize { Self::try_from(Date::new(2009 + u16::from(coarser), 12, 31)) .unwrap() .into() @@ -231,7 +231,7 @@ impl FromCoarserIndex for DateIndex { } } - fn max_from(coarser: DecadeIndex) -> usize { + fn max_from_(coarser: DecadeIndex) -> usize { let coarser = u16::from(coarser); Self::try_from(Date::new(2009 + (10 * coarser), 12, 31)) .unwrap() diff --git a/crates/brk_core/src/traits/from_coarser.rs b/crates/brk_core/src/traits/from_coarser.rs index 70128db6d..6f7686740 100644 --- a/crates/brk_core/src/traits/from_coarser.rs +++ b/crates/brk_core/src/traits/from_coarser.rs @@ -2,11 +2,14 @@ use std::ops::RangeInclusive; pub trait FromCoarserIndex { fn min_from(coarser: T) -> usize; - fn max_from(coarser: T) -> usize; - fn inclusive_range_from(coarser: T) -> RangeInclusive + fn max_from_(coarser: T) -> usize; + fn max_from(coarser: T, len: usize) -> usize { + Self::max_from_(coarser).min(len - 1) + } + fn inclusive_range_from(coarser: T, len: usize) -> RangeInclusive where T: Clone, { - Self::min_from(coarser.clone())..=Self::max_from(coarser) + Self::min_from(coarser.clone())..=Self::max_from(coarser, len) } } diff --git a/crates/brk_vec/src/traits/iterator.rs b/crates/brk_vec/src/traits/iterator.rs index a2b16fca4..097e513a7 100644 --- a/crates/brk_vec/src/traits/iterator.rs +++ b/crates/brk_vec/src/traits/iterator.rs @@ -62,7 +62,7 @@ pub trait VecIterator<'a>: BaseVecIterator)> { fn unwrap_get_inner_(&mut self, i: usize) -> Self::T { self.get_(i) .unwrap_or_else(|| { - dbg!(self.name(), i, self.len()); + dbg!(self.name(), i, self.len(), Self::I::to_string()); panic!("unwrap_get_inner_") }) .into_owned() diff --git a/crates/brk_vec/src/variants/lazy1.rs b/crates/brk_vec/src/variants/lazy1.rs index e69c26b71..2ceb0f693 100644 --- a/crates/brk_vec/src/variants/lazy1.rs +++ b/crates/brk_vec/src/variants/lazy1.rs @@ -35,6 +35,10 @@ where source: BoxedAnyIterableVec, compute: ComputeFrom1, ) -> Self { + if I::to_string() != S1I::to_string() { + unreachable!() + } + Self { name: name.to_string(), version,