diff --git a/Cargo.lock b/Cargo.lock index 38ff34c90..ea5e82d48 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4240,9 +4240,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f271e09bde39ab52250160a67e88577e0559ad77e9085de6e9051a2c4353f8f8" +checksum = "0207d6ed1852c2a124c1fbec61621acb8330d2bf969a5d0643131e9affd985a5" dependencies = [ "indexmap 2.10.0", "serde", diff --git a/TODO.md b/TODO.md index 1bf18338f..8ae918195 100644 --- a/TODO.md +++ b/TODO.md @@ -55,6 +55,7 @@ - api - add extensions support (.json .csv …) - if format instead of extension then don't download file + - add support for https (rustls) - _vec_ - add native lock file support (once it's available in stable rust) - improve compressed mode (slow reads) diff --git a/crates/brk_cli/Cargo.toml b/crates/brk_cli/Cargo.toml index 76ab2b2e9..933763f77 100644 --- a/crates/brk_cli/Cargo.toml +++ b/crates/brk_cli/Cargo.toml @@ -24,7 +24,7 @@ color-eyre = { workspace = true } log = { workspace = true } serde = { workspace = true } tokio = { workspace = true } -toml = "0.9.0" +toml = "0.9.1" [[bin]] name = "brk" diff --git a/crates/brk_computer/src/vecs/blocks.rs b/crates/brk_computer/src/vecs/blocks.rs index bb0c2dc1f..9a3a0da59 100644 --- a/crates/brk_computer/src/vecs/blocks.rs +++ b/crates/brk_computer/src/vecs/blocks.rs @@ -38,6 +38,7 @@ impl Vecs { version: Version, computation: Computation, format: Format, + indexes: &indexes::Vecs, ) -> color_eyre::Result { Ok(Self { height_to_interval: EagerVec::forced_import( @@ -53,6 +54,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_first(), )?, indexes_to_block_interval: ComputedVecsFromHeight::forced_import( @@ -62,6 +64,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default() .add_percentiles() .add_minmax() @@ -74,6 +77,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_sum().add_cumulative(), )?, indexes_to_block_weight: ComputedVecsFromHeight::forced_import( @@ -83,6 +87,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_sum().add_cumulative(), )?, indexes_to_block_size: ComputedVecsFromHeight::forced_import( @@ -92,6 +97,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_sum().add_cumulative(), )?, height_to_vbytes: EagerVec::forced_import( @@ -107,6 +113,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_sum().add_cumulative(), )?, difficultyepoch_to_timestamp: EagerVec::forced_import( diff --git a/crates/brk_computer/src/vecs/cointime.rs b/crates/brk_computer/src/vecs/cointime.rs index c641d9e17..da42e5a1b 100644 --- a/crates/brk_computer/src/vecs/cointime.rs +++ b/crates/brk_computer/src/vecs/cointime.rs @@ -53,6 +53,7 @@ impl Vecs { version: Version, computation: Computation, format: Format, + indexes: &indexes::Vecs, fetched: Option<&fetched::Vecs>, ) -> color_eyre::Result { let compute_dollars = fetched.is_some(); @@ -65,6 +66,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_sum().add_cumulative(), )?, indexes_to_coinblocks_stored: ComputedVecsFromHeight::forced_import( @@ -74,6 +76,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_sum().add_cumulative(), )?, indexes_to_liveliness: ComputedVecsFromHeight::forced_import( @@ -83,6 +86,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, indexes_to_vaultedness: ComputedVecsFromHeight::forced_import( @@ -92,6 +96,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, indexes_to_activity_to_vaultedness_ratio: ComputedVecsFromHeight::forced_import( @@ -101,6 +106,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, indexes_to_vaulted_supply: ComputedValueVecsFromHeight::forced_import( @@ -112,6 +118,7 @@ impl Vecs { computation, VecBuilderOptions::default().add_last(), compute_dollars, + indexes, )?, indexes_to_active_supply: ComputedValueVecsFromHeight::forced_import( path, @@ -122,6 +129,7 @@ impl Vecs { computation, VecBuilderOptions::default().add_last(), compute_dollars, + indexes, )?, indexes_to_thermo_cap: ComputedVecsFromHeight::forced_import( path, @@ -130,6 +138,7 @@ impl Vecs { version + VERSION + Version::ONE, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, indexes_to_investor_cap: ComputedVecsFromHeight::forced_import( @@ -139,6 +148,7 @@ impl Vecs { version + VERSION + Version::ONE, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, indexes_to_vaulted_cap: ComputedVecsFromHeight::forced_import( @@ -148,6 +158,7 @@ impl Vecs { version + VERSION + Version::ONE, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, indexes_to_active_cap: ComputedVecsFromHeight::forced_import( @@ -157,6 +168,7 @@ impl Vecs { version + VERSION + Version::ONE, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, indexes_to_vaulted_price: ComputedVecsFromHeight::forced_import( @@ -166,6 +178,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, indexes_to_vaulted_price_ratio: ComputedRatioVecsFromDateIndex::forced_import( @@ -175,6 +188,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, )?, indexes_to_active_price: ComputedVecsFromHeight::forced_import( path, @@ -183,6 +197,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, indexes_to_active_price_ratio: ComputedRatioVecsFromDateIndex::forced_import( @@ -192,6 +207,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, )?, indexes_to_true_market_mean: ComputedVecsFromHeight::forced_import( path, @@ -200,6 +216,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, indexes_to_true_market_mean_ratio: ComputedRatioVecsFromDateIndex::forced_import( @@ -209,6 +226,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, )?, indexes_to_cointime_value_destroyed: ComputedVecsFromHeight::forced_import( path, @@ -217,6 +235,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_sum().add_cumulative(), )?, indexes_to_cointime_value_created: ComputedVecsFromHeight::forced_import( @@ -226,6 +245,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_sum().add_cumulative(), )?, indexes_to_cointime_value_stored: ComputedVecsFromHeight::forced_import( @@ -235,6 +255,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_sum().add_cumulative(), )?, indexes_to_cointime_price: ComputedVecsFromHeight::forced_import( @@ -244,6 +265,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, indexes_to_cointime_cap: ComputedVecsFromHeight::forced_import( @@ -253,6 +275,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, indexes_to_cointime_price_ratio: ComputedRatioVecsFromDateIndex::forced_import( @@ -262,6 +285,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, )?, }) } diff --git a/crates/brk_computer/src/vecs/constants.rs b/crates/brk_computer/src/vecs/constants.rs index 6eabc3211..6607df3d5 100644 --- a/crates/brk_computer/src/vecs/constants.rs +++ b/crates/brk_computer/src/vecs/constants.rs @@ -29,6 +29,7 @@ impl Vecs { version: Version, computation: Computation, format: Format, + indexes: &indexes::Vecs, ) -> color_eyre::Result { Ok(Self { constant_0: ComputedVecsFromHeight::forced_import( @@ -38,6 +39,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, constant_1: ComputedVecsFromHeight::forced_import( @@ -47,6 +49,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, constant_50: ComputedVecsFromHeight::forced_import( @@ -56,6 +59,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, constant_100: ComputedVecsFromHeight::forced_import( @@ -65,6 +69,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, }) diff --git a/crates/brk_computer/src/vecs/fetched.rs b/crates/brk_computer/src/vecs/fetched.rs index 22f62780e..b326cbcaf 100644 --- a/crates/brk_computer/src/vecs/fetched.rs +++ b/crates/brk_computer/src/vecs/fetched.rs @@ -1,9 +1,9 @@ use std::path::Path; use brk_core::{ - Cents, Close, DateIndex, DecadeIndex, DifficultyEpoch, Dollars, Height, High, Low, MonthIndex, - OHLCCents, OHLCDollars, OHLCSats, Open, QuarterIndex, Sats, SemesterIndex, Version, WeekIndex, - YearIndex, + Cents, Close, DateIndex, DecadeIndex, DifficultyEpoch, Dollars, FromCoarserIndex, Height, High, + Low, MonthIndex, OHLCCents, OHLCDollars, OHLCSats, Open, QuarterIndex, Sats, SemesterIndex, + Version, WeekIndex, YearIndex, }; use brk_exit::Exit; use brk_fetcher::Fetcher; @@ -79,6 +79,7 @@ impl Vecs { version: Version, computation: Computation, format: Format, + indexes: &indexes::Vecs, ) -> color_eyre::Result { let mut fetched_path = path.to_owned(); fetched_path.pop(); @@ -88,7 +89,7 @@ impl Vecs { dateindex_to_ohlc_in_cents: EagerVec::forced_import( &fetched_path, "ohlc_in_cents", - version + VERSION + Version::ZERO, + version + Version::ZERO, format, )?, dateindex_to_ohlc: EagerVec::forced_import( @@ -130,7 +131,7 @@ impl Vecs { height_to_ohlc_in_cents: EagerVec::forced_import( &fetched_path, "ohlc_in_cents", - version + VERSION + Version::ZERO, + version + Version::ZERO, format, )?, height_to_ohlc: EagerVec::forced_import( @@ -176,6 +177,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_first(), )?, timeindexes_to_high: ComputedVecsFromDateIndex::forced_import( @@ -185,6 +187,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_max(), )?, timeindexes_to_low: ComputedVecsFromDateIndex::forced_import( @@ -194,6 +197,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_min(), )?, timeindexes_to_close: ComputedVecsFromDateIndex::forced_import( @@ -203,6 +207,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, timeindexes_to_open_in_sats: ComputedVecsFromDateIndex::forced_import( @@ -212,6 +217,7 @@ impl Vecs { version + VERSION + VERSION_IN_SATS + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_first(), )?, timeindexes_to_high_in_sats: ComputedVecsFromDateIndex::forced_import( @@ -221,6 +227,7 @@ impl Vecs { version + VERSION + VERSION_IN_SATS + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_max(), )?, timeindexes_to_low_in_sats: ComputedVecsFromDateIndex::forced_import( @@ -230,6 +237,7 @@ impl Vecs { version + VERSION + VERSION_IN_SATS + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_min(), )?, timeindexes_to_close_in_sats: ComputedVecsFromDateIndex::forced_import( @@ -239,6 +247,7 @@ impl Vecs { version + VERSION + VERSION_IN_SATS + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, chainindexes_to_open: ComputedVecsFromHeightStrict::forced_import( @@ -641,12 +650,25 @@ impl Vecs { starting_indexes.weekindex, self.timeindexes_to_close.weekindex.unwrap_last(), |(i, close, ..)| { + dbg!( + i, + close, + DateIndex::max_from(i, 10000), + DateIndex::min_from(i), + DateIndex::inclusive_range_from(i, 10000) + ); + let open = weekindex_first_iter.unwrap_get_inner(i); + dbg!(open); + let high = weekindex_max_iter.unwrap_get_inner(i); + dbg!(high); + let low = weekindex_min_iter.unwrap_get_inner(i); + dbg!(low); ( i, OHLCDollars { - open: weekindex_first_iter.unwrap_get_inner(i), - high: weekindex_max_iter.unwrap_get_inner(i), - low: weekindex_min_iter.unwrap_get_inner(i), + open, + high, + low, close, }, ) diff --git a/crates/brk_computer/src/vecs/grouped/builder_computed.rs b/crates/brk_computer/src/vecs/grouped/builder_computed.rs index 538b2118c..8115570c9 100644 --- a/crates/brk_computer/src/vecs/grouped/builder_computed.rs +++ b/crates/brk_computer/src/vecs/grouped/builder_computed.rs @@ -4,35 +4,38 @@ use brk_core::{FromCoarserIndex, Result, Version}; use brk_exit::Exit; use brk_vec::{ AnyCollectableVec, AnyIterableVec, BoxedAnyIterableVec, CloneableAnyIterableVec, Computation, - ComputedVec, ComputedVecFrom1, Format, StoredIndex, + ComputedVec, ComputedVecFrom2, Format, StoredIndex, }; use crate::vecs::grouped::{EagerVecBuilder, VecBuilderOptions}; use super::ComputedType; +#[allow(clippy::type_complexity)] #[derive(Clone)] -pub struct ComputedVecBuilder +pub struct ComputedVecBuilder where I: StoredIndex, T: ComputedType, + S2T: ComputedType, { - pub first: Option>>, - pub average: Option>>, - pub sum: Option>>, - pub max: Option>>, - pub min: Option>>, - pub last: Option>>, - pub cumulative: Option>>, + pub first: Option>>, + pub average: Option>>, + pub sum: Option>>, + pub max: Option>>, + pub min: Option>>, + pub last: Option>>, + pub cumulative: Option>>, } const VERSION: Version = Version::ZERO; -impl ComputedVecBuilder +impl ComputedVecBuilder where I: StoredIndex, T: ComputedType + 'static, S1I: StoredIndex + 'static + FromCoarserIndex, + S2T: ComputedType, { #[allow(clippy::too_many_arguments)] pub fn forced_import( @@ -43,6 +46,7 @@ where computation: Computation, source: Option>, source_extra: &EagerVecBuilder, + len_source: BoxedAnyIterableVec, options: ComputedVecBuilderOptions, ) -> color_eyre::Result { let only_one_active = options.is_only_one_active(); @@ -60,7 +64,7 @@ where Ok(Self { first: options.first.then(|| { Box::new( - ComputedVec::forced_import_or_init_from_1( + ComputedVec::forced_import_or_init_from_2( computation, path, &maybe_suffix("first"), @@ -70,7 +74,11 @@ where .first .as_ref() .map_or_else(|| source.as_ref().unwrap().clone(), |v| v.clone()), - |i, source| { + len_source.clone(), + |i: I, source, len_source| { + if i.unwrap_to_usize() >= len_source.len() { + return None; + } source .next_at(S1I::min_from(i)) .map(|(_, cow)| cow.into_owned()) @@ -81,7 +89,7 @@ where }), last: options.last.then(|| { Box::new( - ComputedVec::forced_import_or_init_from_1( + ComputedVec::forced_import_or_init_from_2( computation, path, name, @@ -99,7 +107,11 @@ where }, |v| v.clone(), ), - |i, source| { + len_source.clone(), + |i: I, source, len_source| { + if i.unwrap_to_usize() >= len_source.len() { + return None; + } source .next_at(S1I::max_from(i, source.len())) .map(|(_, cow)| cow.into_owned()) @@ -110,7 +122,7 @@ where }), min: options.min.then(|| { Box::new( - ComputedVec::forced_import_or_init_from_1( + ComputedVec::forced_import_or_init_from_2( computation, path, &maybe_suffix("min"), @@ -120,7 +132,11 @@ where .min .as_ref() .map_or_else(|| source.as_ref().unwrap().clone(), |v| v.clone()), - |i, source| { + len_source.clone(), + |i: I, source, len_source| { + if i.unwrap_to_usize() >= len_source.len() { + return None; + } S1I::inclusive_range_from(i, source.len()) .flat_map(|i| source.next_at(i).map(|(_, cow)| cow.into_owned())) .min() @@ -131,7 +147,7 @@ where }), max: options.max.then(|| { Box::new( - ComputedVec::forced_import_or_init_from_1( + ComputedVec::forced_import_or_init_from_2( computation, path, &maybe_suffix("max"), @@ -141,7 +157,11 @@ where .max .as_ref() .map_or_else(|| source.as_ref().unwrap().clone(), |v| v.clone()), - |i, source| { + len_source.clone(), + |i: I, source, len_source| { + if i.unwrap_to_usize() >= len_source.len() { + return None; + } S1I::inclusive_range_from(i, source.len()) .flat_map(|i| source.next_at(i).map(|(_, cow)| cow.into_owned())) .max() @@ -152,7 +172,7 @@ where }), average: options.average.then(|| { Box::new( - ComputedVec::forced_import_or_init_from_1( + ComputedVec::forced_import_or_init_from_2( computation, path, &maybe_suffix("average"), @@ -162,7 +182,11 @@ where .average .as_ref() .map_or_else(|| source.as_ref().unwrap().clone(), |v| v.clone()), - |i, source| { + len_source.clone(), + |i: I, source, len_source| { + if i.unwrap_to_usize() >= len_source.len() { + return None; + } let vec = S1I::inclusive_range_from(i, source.len()) .flat_map(|i| source.next_at(i).map(|(_, cow)| cow.into_owned())) .collect::>(); @@ -180,7 +204,7 @@ where }), sum: options.sum.then(|| { Box::new( - ComputedVec::forced_import_or_init_from_1( + ComputedVec::forced_import_or_init_from_2( computation, path, &(if !options.last && !options.average && !options.min && !options.max { @@ -194,7 +218,11 @@ where .sum .as_ref() .map_or_else(|| source.as_ref().unwrap().clone(), |v| v.clone()), - |i, source| { + len_source.clone(), + |i: I, source, len_source| { + if i.unwrap_to_usize() >= len_source.len() { + return None; + } let vec = S1I::inclusive_range_from(i, source.len()) .flat_map(|i| source.next_at(i).map(|(_, cow)| cow.into_owned())) .collect::>(); @@ -211,14 +239,18 @@ where }), cumulative: options.cumulative.then(|| { Box::new( - ComputedVec::forced_import_or_init_from_1( + ComputedVec::forced_import_or_init_from_2( computation, path, &suffix("cumulative"), version + VERSION + Version::ZERO, format, source_extra.cumulative.as_ref().unwrap().boxed_clone(), - |i, source| { + len_source.clone(), + |i: I, source, len_source| { + if i.unwrap_to_usize() >= len_source.len() { + return None; + } source .next_at(S1I::max_from(i, source.len())) .map(|(_, cow)| cow.into_owned()) @@ -267,27 +299,27 @@ where )) } - pub fn unwrap_first(&self) -> &ComputedVecFrom1 { + pub fn unwrap_first(&self) -> &ComputedVecFrom2 { self.first.as_ref().unwrap() } #[allow(unused)] - pub fn unwrap_average(&self) -> &ComputedVecFrom1 { + pub fn unwrap_average(&self) -> &ComputedVecFrom2 { self.average.as_ref().unwrap() } - pub fn unwrap_sum(&self) -> &ComputedVecFrom1 { + pub fn unwrap_sum(&self) -> &ComputedVecFrom2 { self.sum.as_ref().unwrap() } - pub fn unwrap_max(&self) -> &ComputedVecFrom1 { + pub fn unwrap_max(&self) -> &ComputedVecFrom2 { self.max.as_ref().unwrap() } - pub fn unwrap_min(&self) -> &ComputedVecFrom1 { + pub fn unwrap_min(&self) -> &ComputedVecFrom2 { self.min.as_ref().unwrap() } - pub fn unwrap_last(&self) -> &ComputedVecFrom1 { + pub fn unwrap_last(&self) -> &ComputedVecFrom2 { self.last.as_ref().unwrap() } #[allow(unused)] - pub fn unwrap_cumulative(&self) -> &ComputedVecFrom1 { + pub fn unwrap_cumulative(&self) -> &ComputedVecFrom2 { self.cumulative.as_ref().unwrap() } diff --git a/crates/brk_computer/src/vecs/grouped/from_dateindex.rs b/crates/brk_computer/src/vecs/grouped/from_dateindex.rs index 30ac2d806..77a366e60 100644 --- a/crates/brk_computer/src/vecs/grouped/from_dateindex.rs +++ b/crates/brk_computer/src/vecs/grouped/from_dateindex.rs @@ -21,12 +21,12 @@ where { pub dateindex: Option>, pub dateindex_extra: EagerVecBuilder, - pub weekindex: ComputedVecBuilder, - pub monthindex: ComputedVecBuilder, - pub quarterindex: ComputedVecBuilder, - pub semesterindex: ComputedVecBuilder, - pub yearindex: ComputedVecBuilder, - pub decadeindex: ComputedVecBuilder, + pub weekindex: ComputedVecBuilder, + pub monthindex: ComputedVecBuilder, + pub quarterindex: ComputedVecBuilder, + pub semesterindex: ComputedVecBuilder, + pub yearindex: ComputedVecBuilder, + pub decadeindex: ComputedVecBuilder, } const VERSION: Version = Version::ZERO; @@ -35,6 +35,7 @@ impl ComputedVecsFromDateIndex where T: ComputedType + 'static, { + #[allow(clippy::too_many_arguments)] pub fn forced_import( path: &Path, name: &str, @@ -42,6 +43,7 @@ where version: Version, format: Format, computation: Computation, + indexes: &indexes::Vecs, options: VecBuilderOptions, ) -> color_eyre::Result { let dateindex = source.is_compute().then(|| { @@ -69,6 +71,7 @@ where computation, dateindex_source.clone(), &dateindex_extra, + indexes.weekindex_to_weekindex.boxed_clone(), options.into(), )?, monthindex: ComputedVecBuilder::forced_import( @@ -79,6 +82,7 @@ where Computation::Lazy, dateindex_source.clone(), &dateindex_extra, + indexes.monthindex_to_monthindex.boxed_clone(), options.into(), )?, quarterindex: ComputedVecBuilder::forced_import( @@ -89,6 +93,7 @@ where Computation::Lazy, dateindex_source.clone(), &dateindex_extra, + indexes.quarterindex_to_quarterindex.boxed_clone(), options.into(), )?, semesterindex: ComputedVecBuilder::forced_import( @@ -99,6 +104,7 @@ where Computation::Lazy, dateindex_source.clone(), &dateindex_extra, + indexes.semesterindex_to_semesterindex.boxed_clone(), options.into(), )?, yearindex: ComputedVecBuilder::forced_import( @@ -109,6 +115,7 @@ where Computation::Lazy, dateindex_source.clone(), &dateindex_extra, + indexes.yearindex_to_yearindex.boxed_clone(), options.into(), )?, decadeindex: ComputedVecBuilder::forced_import( @@ -119,6 +126,7 @@ where Computation::Lazy, dateindex_source.clone(), &dateindex_extra, + indexes.decadeindex_to_decadeindex.boxed_clone(), options.into(), )?, dateindex, diff --git a/crates/brk_computer/src/vecs/grouped/from_height.rs b/crates/brk_computer/src/vecs/grouped/from_height.rs index a6a695c41..0ed075529 100644 --- a/crates/brk_computer/src/vecs/grouped/from_height.rs +++ b/crates/brk_computer/src/vecs/grouped/from_height.rs @@ -6,7 +6,9 @@ use brk_core::{ }; use brk_exit::Exit; use brk_indexer::Indexer; -use brk_vec::{AnyCollectableVec, AnyIterableVec, Computation, EagerVec, Format}; +use brk_vec::{ + AnyCollectableVec, AnyIterableVec, CloneableAnyIterableVec, Computation, EagerVec, Format, +}; use crate::vecs::{ Indexes, @@ -24,14 +26,14 @@ where pub height: Option>, pub height_extra: EagerVecBuilder, pub dateindex: EagerVecBuilder, - pub weekindex: ComputedVecBuilder, + pub weekindex: ComputedVecBuilder, pub difficultyepoch: EagerVecBuilder, - pub monthindex: ComputedVecBuilder, - pub quarterindex: ComputedVecBuilder, - pub semesterindex: ComputedVecBuilder, - pub yearindex: ComputedVecBuilder, + pub monthindex: ComputedVecBuilder, + pub quarterindex: ComputedVecBuilder, + pub semesterindex: ComputedVecBuilder, + pub yearindex: ComputedVecBuilder, // TODO: pub halvingepoch: StorableVecGeneator, - pub decadeindex: ComputedVecBuilder, + pub decadeindex: ComputedVecBuilder, } const VERSION: Version = Version::ZERO; @@ -41,6 +43,7 @@ where T: ComputedType + Ord + From + 'static, f64: From, { + #[allow(clippy::too_many_arguments)] pub fn forced_import( path: &Path, name: &str, @@ -48,6 +51,7 @@ where version: Version, format: Format, computation: Computation, + indexes: &indexes::Vecs, options: VecBuilderOptions, ) -> color_eyre::Result { let height = source.is_compute().then(|| { @@ -81,6 +85,7 @@ where computation, None, &dateindex, + indexes.weekindex_to_weekindex.boxed_clone(), options.into(), )?, monthindex: ComputedVecBuilder::forced_import( @@ -91,6 +96,7 @@ where Computation::Lazy, None, &dateindex, + indexes.monthindex_to_monthindex.boxed_clone(), options.into(), )?, quarterindex: ComputedVecBuilder::forced_import( @@ -101,6 +107,7 @@ where Computation::Lazy, None, &dateindex, + indexes.quarterindex_to_quarterindex.boxed_clone(), options.into(), )?, semesterindex: ComputedVecBuilder::forced_import( @@ -111,6 +118,7 @@ where Computation::Lazy, None, &dateindex, + indexes.semesterindex_to_semesterindex.boxed_clone(), options.into(), )?, yearindex: ComputedVecBuilder::forced_import( @@ -121,6 +129,7 @@ where Computation::Lazy, None, &dateindex, + indexes.yearindex_to_yearindex.boxed_clone(), options.into(), )?, decadeindex: ComputedVecBuilder::forced_import( @@ -131,6 +140,7 @@ where Computation::Lazy, None, &dateindex, + indexes.decadeindex_to_decadeindex.boxed_clone(), options.into(), )?, // halvingepoch: StorableVecGeneator::forced_import(path, name, version + VERSION + Version::ZERO, format, options)?, diff --git a/crates/brk_computer/src/vecs/grouped/from_txindex.rs b/crates/brk_computer/src/vecs/grouped/from_txindex.rs index 1f4da4276..a9eb32948 100644 --- a/crates/brk_computer/src/vecs/grouped/from_txindex.rs +++ b/crates/brk_computer/src/vecs/grouped/from_txindex.rs @@ -7,8 +7,8 @@ use brk_core::{ use brk_exit::Exit; use brk_indexer::Indexer; use brk_vec::{ - AnyCollectableVec, AnyVec, CollectableVec, Computation, EagerVec, Format, StoredIndex, - VecIterator, + AnyCollectableVec, AnyVec, CloneableAnyIterableVec, CollectableVec, Computation, EagerVec, + Format, StoredIndex, VecIterator, }; use crate::vecs::{ @@ -27,14 +27,14 @@ where pub txindex: Option>>, pub height: EagerVecBuilder, pub dateindex: EagerVecBuilder, - pub weekindex: ComputedVecBuilder, + pub weekindex: ComputedVecBuilder, pub difficultyepoch: EagerVecBuilder, - pub monthindex: ComputedVecBuilder, - pub quarterindex: ComputedVecBuilder, - pub semesterindex: ComputedVecBuilder, - pub yearindex: ComputedVecBuilder, + pub monthindex: ComputedVecBuilder, + pub quarterindex: ComputedVecBuilder, + pub semesterindex: ComputedVecBuilder, + pub yearindex: ComputedVecBuilder, // TODO: pub halvingepoch: StorableVecGeneator, - pub decadeindex: ComputedVecBuilder, + pub decadeindex: ComputedVecBuilder, } const VERSION: Version = Version::ZERO; @@ -44,6 +44,7 @@ where T: ComputedType + Ord + From + 'static, f64: From, { + #[allow(clippy::too_many_arguments)] pub fn forced_import( path: &Path, name: &str, @@ -51,6 +52,7 @@ where version: Version, format: Format, computation: Computation, + indexes: &indexes::Vecs, options: VecBuilderOptions, ) -> color_eyre::Result { let txindex = source.is_compute().then(|| { @@ -87,6 +89,7 @@ where computation, None, &dateindex, + indexes.weekindex_to_weekindex.boxed_clone(), options.into(), )?, monthindex: ComputedVecBuilder::forced_import( @@ -97,6 +100,7 @@ where Computation::Lazy, None, &dateindex, + indexes.monthindex_to_monthindex.boxed_clone(), options.into(), )?, quarterindex: ComputedVecBuilder::forced_import( @@ -107,6 +111,7 @@ where Computation::Lazy, None, &dateindex, + indexes.quarterindex_to_quarterindex.boxed_clone(), options.into(), )?, semesterindex: ComputedVecBuilder::forced_import( @@ -117,6 +122,7 @@ where Computation::Lazy, None, &dateindex, + indexes.semesterindex_to_semesterindex.boxed_clone(), options.into(), )?, yearindex: ComputedVecBuilder::forced_import( @@ -127,6 +133,7 @@ where Computation::Lazy, None, &dateindex, + indexes.yearindex_to_yearindex.boxed_clone(), options.into(), )?, decadeindex: ComputedVecBuilder::forced_import( @@ -137,6 +144,7 @@ where Computation::Lazy, None, &dateindex, + indexes.decadeindex_to_decadeindex.boxed_clone(), 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 ef17044b6..306189c27 100644 --- a/crates/brk_computer/src/vecs/grouped/ratio_from_dateindex.rs +++ b/crates/brk_computer/src/vecs/grouped/ratio_from_dateindex.rs @@ -68,6 +68,7 @@ impl ComputedRatioVecsFromDateIndex { version: Version, format: Format, computation: Computation, + indexes: &indexes::Vecs, ) -> color_eyre::Result { let options = VecBuilderOptions::default().add_last(); @@ -80,6 +81,7 @@ impl ComputedRatioVecsFromDateIndex { version + VERSION, format, computation, + indexes, options, ) .unwrap() @@ -91,6 +93,7 @@ impl ComputedRatioVecsFromDateIndex { version + VERSION + Version::ZERO, format, computation, + indexes, options, )?, ratio_sma: ComputedVecsFromDateIndex::forced_import( @@ -100,6 +103,7 @@ impl ComputedRatioVecsFromDateIndex { version + VERSION + Version::ZERO, format, computation, + indexes, options, )?, ratio_1w_sma: ComputedVecsFromDateIndex::forced_import( @@ -109,6 +113,7 @@ impl ComputedRatioVecsFromDateIndex { version + VERSION + Version::ZERO, format, computation, + indexes, options, )?, ratio_1m_sma: ComputedVecsFromDateIndex::forced_import( @@ -118,6 +123,7 @@ impl ComputedRatioVecsFromDateIndex { version + VERSION + Version::ZERO, format, computation, + indexes, options, )?, ratio_1y_sma: ComputedVecsFromDateIndex::forced_import( @@ -127,6 +133,7 @@ impl ComputedRatioVecsFromDateIndex { version + VERSION + Version::ZERO, format, computation, + indexes, options, )?, ratio_4y_sma: ComputedVecsFromDateIndex::forced_import( @@ -136,6 +143,7 @@ impl ComputedRatioVecsFromDateIndex { version + VERSION + Version::ZERO, format, computation, + indexes, options, )?, ratio_1y_sma_momentum_oscillator: ComputedVecsFromDateIndex::forced_import( @@ -145,6 +153,7 @@ impl ComputedRatioVecsFromDateIndex { version + VERSION + Version::ZERO, format, computation, + indexes, options, )?, ratio_sd: ComputedVecsFromDateIndex::forced_import( @@ -154,6 +163,7 @@ impl ComputedRatioVecsFromDateIndex { version + VERSION + Version::ZERO, format, computation, + indexes, options, )?, ratio_4y_sd: ComputedVecsFromDateIndex::forced_import( @@ -163,6 +173,7 @@ impl ComputedRatioVecsFromDateIndex { version + VERSION + Version::ZERO, format, computation, + indexes, options, )?, ratio_1y_sd: ComputedVecsFromDateIndex::forced_import( @@ -172,6 +183,7 @@ impl ComputedRatioVecsFromDateIndex { version + VERSION + Version::ZERO, format, computation, + indexes, options, )?, ratio_p99_9: ComputedVecsFromDateIndex::forced_import( @@ -181,6 +193,7 @@ impl ComputedRatioVecsFromDateIndex { version + VERSION + Version::ZERO, format, computation, + indexes, options, )?, ratio_p99_5: ComputedVecsFromDateIndex::forced_import( @@ -190,6 +203,7 @@ impl ComputedRatioVecsFromDateIndex { version + VERSION + Version::ZERO, format, computation, + indexes, options, )?, ratio_p99: ComputedVecsFromDateIndex::forced_import( @@ -199,6 +213,7 @@ impl ComputedRatioVecsFromDateIndex { version + VERSION + Version::ZERO, format, computation, + indexes, options, )?, ratio_p1: ComputedVecsFromDateIndex::forced_import( @@ -208,6 +223,7 @@ impl ComputedRatioVecsFromDateIndex { version + VERSION + Version::ZERO, format, computation, + indexes, options, )?, ratio_p0_5: ComputedVecsFromDateIndex::forced_import( @@ -217,6 +233,7 @@ impl ComputedRatioVecsFromDateIndex { version + VERSION + Version::ZERO, format, computation, + indexes, options, )?, ratio_p0_1: ComputedVecsFromDateIndex::forced_import( @@ -226,6 +243,7 @@ impl ComputedRatioVecsFromDateIndex { version + VERSION + Version::ZERO, format, computation, + indexes, options, )?, ratio_p1sd: ComputedVecsFromDateIndex::forced_import( @@ -235,6 +253,7 @@ impl ComputedRatioVecsFromDateIndex { version + VERSION + Version::ZERO, format, computation, + indexes, options, )?, ratio_p2sd: ComputedVecsFromDateIndex::forced_import( @@ -244,6 +263,7 @@ impl ComputedRatioVecsFromDateIndex { version + VERSION + Version::ZERO, format, computation, + indexes, options, )?, ratio_p3sd: ComputedVecsFromDateIndex::forced_import( @@ -253,6 +273,7 @@ impl ComputedRatioVecsFromDateIndex { version + VERSION + Version::ZERO, format, computation, + indexes, options, )?, ratio_m1sd: ComputedVecsFromDateIndex::forced_import( @@ -262,6 +283,7 @@ impl ComputedRatioVecsFromDateIndex { version + VERSION + Version::ZERO, format, computation, + indexes, options, )?, ratio_m2sd: ComputedVecsFromDateIndex::forced_import( @@ -271,6 +293,7 @@ impl ComputedRatioVecsFromDateIndex { version + VERSION + Version::ZERO, format, computation, + indexes, options, )?, ratio_m3sd: ComputedVecsFromDateIndex::forced_import( @@ -280,6 +303,7 @@ impl ComputedRatioVecsFromDateIndex { version + VERSION + Version::ZERO, format, computation, + indexes, options, )?, ratio_p99_9_as_price: ComputedVecsFromDateIndex::forced_import( @@ -289,6 +313,7 @@ impl ComputedRatioVecsFromDateIndex { version + VERSION + Version::ZERO, format, computation, + indexes, options, )?, ratio_p99_5_as_price: ComputedVecsFromDateIndex::forced_import( @@ -298,6 +323,7 @@ impl ComputedRatioVecsFromDateIndex { version + VERSION + Version::ZERO, format, computation, + indexes, options, )?, ratio_p99_as_price: ComputedVecsFromDateIndex::forced_import( @@ -307,6 +333,7 @@ impl ComputedRatioVecsFromDateIndex { version + VERSION + Version::ZERO, format, computation, + indexes, options, )?, ratio_p1_as_price: ComputedVecsFromDateIndex::forced_import( @@ -316,6 +343,7 @@ impl ComputedRatioVecsFromDateIndex { version + VERSION + Version::ZERO, format, computation, + indexes, options, )?, ratio_p0_5_as_price: ComputedVecsFromDateIndex::forced_import( @@ -325,6 +353,7 @@ impl ComputedRatioVecsFromDateIndex { version + VERSION + Version::ZERO, format, computation, + indexes, options, )?, ratio_p0_1_as_price: ComputedVecsFromDateIndex::forced_import( @@ -334,6 +363,7 @@ impl ComputedRatioVecsFromDateIndex { version + VERSION + Version::ZERO, format, computation, + indexes, options, )?, ratio_p1sd_as_price: ComputedVecsFromDateIndex::forced_import( @@ -343,6 +373,7 @@ impl ComputedRatioVecsFromDateIndex { version + VERSION + Version::ZERO, format, computation, + indexes, options, )?, ratio_p2sd_as_price: ComputedVecsFromDateIndex::forced_import( @@ -352,6 +383,7 @@ impl ComputedRatioVecsFromDateIndex { version + VERSION + Version::ZERO, format, computation, + indexes, options, )?, ratio_p3sd_as_price: ComputedVecsFromDateIndex::forced_import( @@ -361,6 +393,7 @@ impl ComputedRatioVecsFromDateIndex { version + VERSION + Version::ZERO, format, computation, + indexes, options, )?, ratio_m1sd_as_price: ComputedVecsFromDateIndex::forced_import( @@ -370,6 +403,7 @@ impl ComputedRatioVecsFromDateIndex { version + VERSION + Version::ZERO, format, computation, + indexes, options, )?, ratio_m2sd_as_price: ComputedVecsFromDateIndex::forced_import( @@ -379,6 +413,7 @@ impl ComputedRatioVecsFromDateIndex { version + VERSION + Version::ZERO, format, computation, + indexes, options, )?, ratio_m3sd_as_price: ComputedVecsFromDateIndex::forced_import( @@ -388,6 +423,7 @@ impl ComputedRatioVecsFromDateIndex { version + VERSION + Version::ZERO, format, computation, + indexes, options, )?, ratio_zscore: ComputedVecsFromDateIndex::forced_import( @@ -397,6 +433,7 @@ impl ComputedRatioVecsFromDateIndex { version + VERSION + Version::ZERO, format, computation, + indexes, options, )?, ratio_4y_zscore: ComputedVecsFromDateIndex::forced_import( @@ -406,6 +443,7 @@ impl ComputedRatioVecsFromDateIndex { version + VERSION + Version::ZERO, format, computation, + indexes, options, )?, ratio_1y_zscore: ComputedVecsFromDateIndex::forced_import( @@ -415,6 +453,7 @@ impl ComputedRatioVecsFromDateIndex { version + VERSION + Version::ZERO, format, computation, + indexes, options, )?, }) 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 a6e888ec8..124fec3ea 100644 --- a/crates/brk_computer/src/vecs/grouped/value_from_dateindex.rs +++ b/crates/brk_computer/src/vecs/grouped/value_from_dateindex.rs @@ -29,6 +29,7 @@ impl ComputedValueVecsFromDateIndex { computation: Computation, options: VecBuilderOptions, compute_dollars: bool, + indexes: &indexes::Vecs, ) -> color_eyre::Result { Ok(Self { sats: ComputedVecsFromDateIndex::forced_import( @@ -38,6 +39,7 @@ impl ComputedValueVecsFromDateIndex { version + VERSION, format, computation, + indexes, options, )?, bitcoin: ComputedVecsFromDateIndex::forced_import( @@ -47,6 +49,7 @@ impl ComputedValueVecsFromDateIndex { version + VERSION, format, computation, + indexes, options, )?, dollars: compute_dollars.then(|| { @@ -57,6 +60,7 @@ impl ComputedValueVecsFromDateIndex { version + VERSION, format, computation, + indexes, options, ) .unwrap() 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 830b414a4..b582475aa 100644 --- a/crates/brk_computer/src/vecs/grouped/value_from_height.rs +++ b/crates/brk_computer/src/vecs/grouped/value_from_height.rs @@ -29,6 +29,7 @@ impl ComputedValueVecsFromHeight { computation: Computation, options: VecBuilderOptions, compute_dollars: bool, + indexes: &indexes::Vecs, ) -> color_eyre::Result { Ok(Self { sats: ComputedVecsFromHeight::forced_import( @@ -38,6 +39,7 @@ impl ComputedValueVecsFromHeight { version + VERSION, format, computation, + indexes, options, )?, bitcoin: ComputedVecsFromHeight::forced_import( @@ -47,6 +49,7 @@ impl ComputedValueVecsFromHeight { version + VERSION, format, computation, + indexes, options, )?, dollars: compute_dollars.then(|| { @@ -57,6 +60,7 @@ impl ComputedValueVecsFromHeight { version + VERSION, format, computation, + indexes, options, ) .unwrap() 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 9b3554717..534ee33b5 100644 --- a/crates/brk_computer/src/vecs/grouped/value_from_txindex.rs +++ b/crates/brk_computer/src/vecs/grouped/value_from_txindex.rs @@ -60,6 +60,7 @@ impl ComputedValueVecsFromTxindex { version + VERSION, format, computation, + indexes, options, )?; @@ -84,6 +85,7 @@ impl ComputedValueVecsFromTxindex { version + VERSION, format, computation, + indexes, options, )?; @@ -131,6 +133,7 @@ impl ComputedValueVecsFromTxindex { version + VERSION, format, computation, + indexes, options, ) .unwrap() diff --git a/crates/brk_computer/src/vecs/market.rs b/crates/brk_computer/src/vecs/market.rs index 7288a5f72..2a6c2d519 100644 --- a/crates/brk_computer/src/vecs/market.rs +++ b/crates/brk_computer/src/vecs/market.rs @@ -167,6 +167,7 @@ impl Vecs { version: Version, computation: Computation, format: Format, + indexes: &indexes::Vecs, ) -> color_eyre::Result { Ok(Self { height_to_marketcap: EagerVec::forced_import( @@ -194,6 +195,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, indexes_to_ath: ComputedVecsFromDateIndex::forced_import( @@ -203,6 +205,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, indexes_to_drawdown: ComputedVecsFromDateIndex::forced_import( @@ -212,6 +215,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, indexes_to_days_since_ath: ComputedVecsFromDateIndex::forced_import( @@ -221,6 +225,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, indexes_to_max_days_between_aths: ComputedVecsFromDateIndex::forced_import( @@ -230,6 +235,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, indexes_to_max_years_between_aths: ComputedVecsFromDateIndex::forced_import( @@ -239,6 +245,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, @@ -249,6 +256,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, )?, indexes_to_8d_sma: ComputedRatioVecsFromDateIndex::forced_import( path, @@ -257,6 +265,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, )?, indexes_to_13d_sma: ComputedRatioVecsFromDateIndex::forced_import( path, @@ -265,6 +274,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, )?, indexes_to_21d_sma: ComputedRatioVecsFromDateIndex::forced_import( path, @@ -273,6 +283,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, )?, indexes_to_1m_sma: ComputedRatioVecsFromDateIndex::forced_import( path, @@ -281,6 +292,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, )?, indexes_to_34d_sma: ComputedRatioVecsFromDateIndex::forced_import( path, @@ -289,6 +301,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, )?, indexes_to_55d_sma: ComputedRatioVecsFromDateIndex::forced_import( path, @@ -297,6 +310,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, )?, indexes_to_89d_sma: ComputedRatioVecsFromDateIndex::forced_import( path, @@ -305,6 +319,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, )?, indexes_to_144d_sma: ComputedRatioVecsFromDateIndex::forced_import( path, @@ -313,6 +328,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, )?, indexes_to_200d_sma: ComputedRatioVecsFromDateIndex::forced_import( path, @@ -321,6 +337,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, )?, indexes_to_1y_sma: ComputedRatioVecsFromDateIndex::forced_import( path, @@ -329,6 +346,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, )?, indexes_to_2y_sma: ComputedRatioVecsFromDateIndex::forced_import( path, @@ -337,6 +355,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, )?, indexes_to_200w_sma: ComputedRatioVecsFromDateIndex::forced_import( path, @@ -345,6 +364,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, )?, indexes_to_4y_sma: ComputedRatioVecsFromDateIndex::forced_import( path, @@ -353,6 +373,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, )?, _1d_returns: ComputedVecsFromDateIndex::forced_import( @@ -362,6 +383,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _1w_returns: ComputedVecsFromDateIndex::forced_import( @@ -371,6 +393,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _1m_returns: ComputedVecsFromDateIndex::forced_import( @@ -380,6 +403,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _3m_returns: ComputedVecsFromDateIndex::forced_import( @@ -389,6 +413,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _6m_returns: ComputedVecsFromDateIndex::forced_import( @@ -398,6 +423,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _1y_returns: ComputedVecsFromDateIndex::forced_import( @@ -407,6 +433,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _2y_returns: ComputedVecsFromDateIndex::forced_import( @@ -416,6 +443,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _3y_returns: ComputedVecsFromDateIndex::forced_import( @@ -425,6 +453,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _4y_returns: ComputedVecsFromDateIndex::forced_import( @@ -434,6 +463,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _5y_returns: ComputedVecsFromDateIndex::forced_import( @@ -443,6 +473,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _6y_returns: ComputedVecsFromDateIndex::forced_import( @@ -452,6 +483,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _8y_returns: ComputedVecsFromDateIndex::forced_import( @@ -461,6 +493,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _10y_returns: ComputedVecsFromDateIndex::forced_import( @@ -470,6 +503,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _2y_cagr: ComputedVecsFromDateIndex::forced_import( @@ -479,6 +513,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _3y_cagr: ComputedVecsFromDateIndex::forced_import( @@ -488,6 +523,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _4y_cagr: ComputedVecsFromDateIndex::forced_import( @@ -497,6 +533,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _5y_cagr: ComputedVecsFromDateIndex::forced_import( @@ -506,6 +543,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _6y_cagr: ComputedVecsFromDateIndex::forced_import( @@ -515,6 +553,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _8y_cagr: ComputedVecsFromDateIndex::forced_import( @@ -524,6 +563,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _10y_cagr: ComputedVecsFromDateIndex::forced_import( @@ -533,6 +573,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, @@ -543,6 +584,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _1m_dca_returns: ComputedVecsFromDateIndex::forced_import( @@ -552,6 +594,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _3m_dca_returns: ComputedVecsFromDateIndex::forced_import( @@ -561,6 +604,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _6m_dca_returns: ComputedVecsFromDateIndex::forced_import( @@ -570,6 +614,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _1y_dca_returns: ComputedVecsFromDateIndex::forced_import( @@ -579,6 +624,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _2y_dca_returns: ComputedVecsFromDateIndex::forced_import( @@ -588,6 +634,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _3y_dca_returns: ComputedVecsFromDateIndex::forced_import( @@ -597,6 +644,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _4y_dca_returns: ComputedVecsFromDateIndex::forced_import( @@ -606,6 +654,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _5y_dca_returns: ComputedVecsFromDateIndex::forced_import( @@ -615,6 +664,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _6y_dca_returns: ComputedVecsFromDateIndex::forced_import( @@ -624,6 +674,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _8y_dca_returns: ComputedVecsFromDateIndex::forced_import( @@ -633,6 +684,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _10y_dca_returns: ComputedVecsFromDateIndex::forced_import( @@ -642,6 +694,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _2y_dca_cagr: ComputedVecsFromDateIndex::forced_import( @@ -651,6 +704,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _3y_dca_cagr: ComputedVecsFromDateIndex::forced_import( @@ -660,6 +714,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _4y_dca_cagr: ComputedVecsFromDateIndex::forced_import( @@ -669,6 +724,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _5y_dca_cagr: ComputedVecsFromDateIndex::forced_import( @@ -678,6 +734,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _6y_dca_cagr: ComputedVecsFromDateIndex::forced_import( @@ -687,6 +744,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _8y_dca_cagr: ComputedVecsFromDateIndex::forced_import( @@ -696,6 +754,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _10y_dca_cagr: ComputedVecsFromDateIndex::forced_import( @@ -705,6 +764,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _1w_dca_avg_price: ComputedVecsFromDateIndex::forced_import( @@ -714,6 +774,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _1m_dca_avg_price: ComputedVecsFromDateIndex::forced_import( @@ -723,6 +784,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _3m_dca_avg_price: ComputedVecsFromDateIndex::forced_import( @@ -732,6 +794,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _6m_dca_avg_price: ComputedVecsFromDateIndex::forced_import( @@ -741,6 +804,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _1y_dca_avg_price: ComputedVecsFromDateIndex::forced_import( @@ -750,6 +814,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _2y_dca_avg_price: ComputedVecsFromDateIndex::forced_import( @@ -759,6 +824,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _3y_dca_avg_price: ComputedVecsFromDateIndex::forced_import( @@ -768,6 +834,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _4y_dca_avg_price: ComputedVecsFromDateIndex::forced_import( @@ -777,6 +844,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _5y_dca_avg_price: ComputedVecsFromDateIndex::forced_import( @@ -786,6 +854,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _6y_dca_avg_price: ComputedVecsFromDateIndex::forced_import( @@ -795,6 +864,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _8y_dca_avg_price: ComputedVecsFromDateIndex::forced_import( @@ -804,6 +874,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _10y_dca_avg_price: ComputedVecsFromDateIndex::forced_import( @@ -813,6 +884,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, price_1d_ago: ComputedVecsFromDateIndex::forced_import( @@ -822,6 +894,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, price_1w_ago: ComputedVecsFromDateIndex::forced_import( @@ -831,6 +904,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, price_1m_ago: ComputedVecsFromDateIndex::forced_import( @@ -840,6 +914,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, price_3m_ago: ComputedVecsFromDateIndex::forced_import( @@ -849,6 +924,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, price_6m_ago: ComputedVecsFromDateIndex::forced_import( @@ -858,6 +934,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, price_1y_ago: ComputedVecsFromDateIndex::forced_import( @@ -867,6 +944,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, price_2y_ago: ComputedVecsFromDateIndex::forced_import( @@ -876,6 +954,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, price_3y_ago: ComputedVecsFromDateIndex::forced_import( @@ -885,6 +964,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, price_4y_ago: ComputedVecsFromDateIndex::forced_import( @@ -894,6 +974,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, price_5y_ago: ComputedVecsFromDateIndex::forced_import( @@ -903,6 +984,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, price_6y_ago: ComputedVecsFromDateIndex::forced_import( @@ -912,6 +994,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, price_8y_ago: ComputedVecsFromDateIndex::forced_import( @@ -921,6 +1004,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, price_10y_ago: ComputedVecsFromDateIndex::forced_import( @@ -930,6 +1014,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _1w_dca_stack: ComputedVecsFromDateIndex::forced_import( @@ -939,6 +1024,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _1m_dca_stack: ComputedVecsFromDateIndex::forced_import( @@ -948,6 +1034,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _3m_dca_stack: ComputedVecsFromDateIndex::forced_import( @@ -957,6 +1044,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _6m_dca_stack: ComputedVecsFromDateIndex::forced_import( @@ -966,6 +1054,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _1y_dca_stack: ComputedVecsFromDateIndex::forced_import( @@ -975,6 +1064,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _2y_dca_stack: ComputedVecsFromDateIndex::forced_import( @@ -984,6 +1074,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _3y_dca_stack: ComputedVecsFromDateIndex::forced_import( @@ -993,6 +1084,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _4y_dca_stack: ComputedVecsFromDateIndex::forced_import( @@ -1002,6 +1094,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _5y_dca_stack: ComputedVecsFromDateIndex::forced_import( @@ -1011,6 +1104,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _6y_dca_stack: ComputedVecsFromDateIndex::forced_import( @@ -1020,6 +1114,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _8y_dca_stack: ComputedVecsFromDateIndex::forced_import( @@ -1029,6 +1124,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, _10y_dca_stack: ComputedVecsFromDateIndex::forced_import( @@ -1038,6 +1134,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, @@ -1048,6 +1145,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, dca_class_2024_stack: ComputedVecsFromDateIndex::forced_import( @@ -1057,6 +1155,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, dca_class_2023_stack: ComputedVecsFromDateIndex::forced_import( @@ -1066,6 +1165,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, dca_class_2022_stack: ComputedVecsFromDateIndex::forced_import( @@ -1075,6 +1175,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, dca_class_2021_stack: ComputedVecsFromDateIndex::forced_import( @@ -1084,6 +1185,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, dca_class_2020_stack: ComputedVecsFromDateIndex::forced_import( @@ -1093,6 +1195,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, dca_class_2019_stack: ComputedVecsFromDateIndex::forced_import( @@ -1102,6 +1205,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, dca_class_2018_stack: ComputedVecsFromDateIndex::forced_import( @@ -1111,6 +1215,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, dca_class_2017_stack: ComputedVecsFromDateIndex::forced_import( @@ -1120,6 +1225,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, dca_class_2016_stack: ComputedVecsFromDateIndex::forced_import( @@ -1129,6 +1235,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, dca_class_2015_stack: ComputedVecsFromDateIndex::forced_import( @@ -1138,6 +1245,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, @@ -1148,6 +1256,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, dca_class_2024_avg_price: ComputedVecsFromDateIndex::forced_import( @@ -1157,6 +1266,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, dca_class_2023_avg_price: ComputedVecsFromDateIndex::forced_import( @@ -1166,6 +1276,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, dca_class_2022_avg_price: ComputedVecsFromDateIndex::forced_import( @@ -1175,6 +1286,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, dca_class_2021_avg_price: ComputedVecsFromDateIndex::forced_import( @@ -1184,6 +1296,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, dca_class_2020_avg_price: ComputedVecsFromDateIndex::forced_import( @@ -1193,6 +1306,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, dca_class_2019_avg_price: ComputedVecsFromDateIndex::forced_import( @@ -1202,6 +1316,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, dca_class_2018_avg_price: ComputedVecsFromDateIndex::forced_import( @@ -1211,6 +1326,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, dca_class_2017_avg_price: ComputedVecsFromDateIndex::forced_import( @@ -1220,6 +1336,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, dca_class_2016_avg_price: ComputedVecsFromDateIndex::forced_import( @@ -1229,6 +1346,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, dca_class_2015_avg_price: ComputedVecsFromDateIndex::forced_import( @@ -1238,6 +1356,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, @@ -1248,6 +1367,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, dca_class_2024_returns: ComputedVecsFromDateIndex::forced_import( @@ -1257,6 +1377,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, dca_class_2023_returns: ComputedVecsFromDateIndex::forced_import( @@ -1266,6 +1387,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, dca_class_2022_returns: ComputedVecsFromDateIndex::forced_import( @@ -1275,6 +1397,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, dca_class_2021_returns: ComputedVecsFromDateIndex::forced_import( @@ -1284,6 +1407,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, dca_class_2020_returns: ComputedVecsFromDateIndex::forced_import( @@ -1293,6 +1417,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, dca_class_2019_returns: ComputedVecsFromDateIndex::forced_import( @@ -1302,6 +1427,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, dca_class_2018_returns: ComputedVecsFromDateIndex::forced_import( @@ -1311,6 +1437,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, dca_class_2017_returns: ComputedVecsFromDateIndex::forced_import( @@ -1320,6 +1447,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, dca_class_2016_returns: ComputedVecsFromDateIndex::forced_import( @@ -1329,6 +1457,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, dca_class_2015_returns: ComputedVecsFromDateIndex::forced_import( @@ -1338,6 +1467,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, @@ -1348,6 +1478,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, indexes_to_200d_sma_x0_8: ComputedVecsFromDateIndex::forced_import( @@ -1357,6 +1488,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, }) diff --git a/crates/brk_computer/src/vecs/mining.rs b/crates/brk_computer/src/vecs/mining.rs index b32af2ef9..0124e61c9 100644 --- a/crates/brk_computer/src/vecs/mining.rs +++ b/crates/brk_computer/src/vecs/mining.rs @@ -28,6 +28,7 @@ impl Vecs { version: Version, computation: Computation, format: Format, + indexes: &indexes::Vecs, ) -> color_eyre::Result { Ok(Self { indexes_to_difficulty: ComputedVecsFromHeight::forced_import( @@ -37,6 +38,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, indexes_to_difficultyepoch: ComputedVecsFromDateIndex::forced_import( @@ -46,6 +48,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, indexes_to_halvingepoch: ComputedVecsFromDateIndex::forced_import( @@ -55,6 +58,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, }) diff --git a/crates/brk_computer/src/vecs/mod.rs b/crates/brk_computer/src/vecs/mod.rs index 747c2da3d..3c53ec106 100644 --- a/crates/brk_computer/src/vecs/mod.rs +++ b/crates/brk_computer/src/vecs/mod.rs @@ -60,6 +60,7 @@ impl Vecs { version + VERSION + Version::ZERO, computation, format, + &indexes, ) .unwrap() }); @@ -70,30 +71,35 @@ impl Vecs { version + VERSION + Version::ZERO, computation, format, + &indexes, )?, mining: mining::Vecs::forced_import( path, version + VERSION + Version::ZERO, computation, format, + &indexes, )?, constants: constants::Vecs::forced_import( path, version + VERSION + Version::ZERO, computation, format, + &indexes, )?, market: market::Vecs::forced_import( path, version + VERSION + Version::ZERO, computation, format, + &indexes, )?, stateful: stateful::Vecs::forced_import( path, version + VERSION + Version::ZERO, computation, format, + &indexes, fetched.as_ref(), )?, transactions: transactions::Vecs::forced_import( @@ -110,6 +116,7 @@ impl Vecs { version + VERSION + Version::ZERO, computation, format, + &indexes, fetched.as_ref(), )?, indexes, diff --git a/crates/brk_computer/src/vecs/stateful/address_cohort.rs b/crates/brk_computer/src/vecs/stateful/address_cohort.rs index 93e261de8..29a8309a2 100644 --- a/crates/brk_computer/src/vecs/stateful/address_cohort.rs +++ b/crates/brk_computer/src/vecs/stateful/address_cohort.rs @@ -42,6 +42,7 @@ impl Vecs { computation: Computation, format: Format, version: Version, + indexes: &indexes::Vecs, fetched: Option<&fetched::Vecs>, states_path: &Path, compute_relative_to_all: bool, @@ -70,6 +71,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, inner: common::Vecs::forced_import( @@ -78,6 +80,7 @@ impl Vecs { computation, format, version, + indexes, fetched, compute_relative_to_all, )?, diff --git a/crates/brk_computer/src/vecs/stateful/address_cohorts.rs b/crates/brk_computer/src/vecs/stateful/address_cohorts.rs index 6512d1567..5f0e623dc 100644 --- a/crates/brk_computer/src/vecs/stateful/address_cohorts.rs +++ b/crates/brk_computer/src/vecs/stateful/address_cohorts.rs @@ -10,7 +10,7 @@ use derive_deref::{Deref, DerefMut}; use rayon::prelude::*; use crate::vecs::{ - Indexes, fetched, + Indexes, fetched, indexes, stateful::{ address_cohort, r#trait::{CohortVecs, DynCohortVecs}, @@ -28,6 +28,7 @@ impl Vecs { version: Version, _computation: Computation, format: Format, + indexes: &indexes::Vecs, fetched: Option<&fetched::Vecs>, states_path: &Path, ) -> color_eyre::Result { @@ -40,6 +41,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -50,6 +52,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -60,6 +63,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -70,6 +74,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -80,6 +85,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -90,6 +96,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -100,6 +107,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -110,6 +118,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -120,6 +129,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -130,6 +140,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -140,6 +151,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -150,6 +162,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -160,6 +173,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -170,6 +184,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -180,6 +195,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -192,6 +208,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -202,6 +219,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -212,6 +230,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -222,6 +241,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -232,6 +252,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -242,6 +263,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -252,6 +274,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -262,6 +285,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -272,6 +296,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -282,6 +307,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -292,6 +318,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -302,6 +329,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -312,6 +340,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -324,6 +353,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -334,6 +364,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -344,6 +375,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -354,6 +386,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -364,6 +397,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -374,6 +408,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -384,6 +419,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -394,6 +430,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -404,6 +441,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -414,6 +452,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -424,6 +463,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -434,6 +474,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -444,6 +485,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, diff --git a/crates/brk_computer/src/vecs/stateful/common.rs b/crates/brk_computer/src/vecs/stateful/common.rs index 0d5db9101..7c4fda9cb 100644 --- a/crates/brk_computer/src/vecs/stateful/common.rs +++ b/crates/brk_computer/src/vecs/stateful/common.rs @@ -136,6 +136,7 @@ impl Vecs { computation: Computation, format: Format, version: Version, + indexes: &indexes::Vecs, fetched: Option<&fetched::Vecs>, compute_relative_to_all: bool, ) -> color_eyre::Result { @@ -215,6 +216,7 @@ impl Vecs { computation, VecBuilderOptions::default().add_last(), compute_dollars, + indexes, ) .unwrap() }), @@ -238,6 +240,7 @@ impl Vecs { computation, VecBuilderOptions::default().add_last(), compute_dollars, + indexes, ) .unwrap() }), @@ -261,6 +264,7 @@ impl Vecs { computation, VecBuilderOptions::default().add_last(), compute_dollars, + indexes, ) .unwrap() }), @@ -282,6 +286,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), ) .unwrap() @@ -322,6 +327,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), ) .unwrap() @@ -344,6 +350,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), ) .unwrap() @@ -356,6 +363,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), ) .unwrap() @@ -368,6 +376,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), ) .unwrap() @@ -395,6 +404,7 @@ impl Vecs { computation, VecBuilderOptions::default().add_last(), compute_dollars, + indexes, )?, height_to_utxo_count: EagerVec::forced_import( path, @@ -409,6 +419,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, indexes_to_realized_price: compute_dollars.then(|| { @@ -419,6 +430,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), ) .unwrap() @@ -431,6 +443,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, ) .unwrap() }), @@ -451,6 +464,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default() .add_sum() .add_cumulative(), @@ -474,6 +488,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default() .add_sum() .add_cumulative(), @@ -488,6 +503,7 @@ impl Vecs { version + VERSION + Version::ONE, format, computation, + indexes, VecBuilderOptions::default().add_sum().add_cumulative(), ) .unwrap() @@ -509,6 +525,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_sum(), ) .unwrap() @@ -521,6 +538,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_sum(), ) .unwrap() @@ -542,6 +560,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_sum(), ) .unwrap() @@ -563,6 +582,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_sum(), ) .unwrap() @@ -584,6 +604,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_sum(), ) .unwrap() @@ -596,6 +617,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), ) .unwrap() @@ -608,6 +630,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default() .add_sum() .add_cumulative(), @@ -658,6 +681,7 @@ impl Vecs { computation, VecBuilderOptions::default().add_last(), compute_dollars, + indexes, )?, height_to_negative_unrealized_loss: compute_dollars.then(|| { EagerVec::forced_import( @@ -676,6 +700,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), ) .unwrap() @@ -697,6 +722,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), ) .unwrap() @@ -721,6 +747,7 @@ impl Vecs { version + VERSION + Version::ONE, format, computation, + indexes, VecBuilderOptions::default().add_last(), ) .unwrap() @@ -734,6 +761,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_sum(), ) .unwrap() @@ -746,6 +774,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_sum(), ) .unwrap() @@ -759,6 +788,7 @@ impl Vecs { version + VERSION + Version::ONE, format, computation, + indexes, VecBuilderOptions::default().add_sum(), ) .unwrap() @@ -832,6 +862,7 @@ impl Vecs { version + VERSION + Version::ONE, format, computation, + indexes, VecBuilderOptions::default().add_last(), ) .unwrap() @@ -844,6 +875,7 @@ impl Vecs { version + VERSION + Version::ONE, format, computation, + indexes, VecBuilderOptions::default().add_last(), ) .unwrap() @@ -856,6 +888,7 @@ impl Vecs { version + VERSION + Version::ONE, format, computation, + indexes, VecBuilderOptions::default().add_last(), ) .unwrap() @@ -868,6 +901,7 @@ impl Vecs { version + VERSION + Version::ONE, format, computation, + indexes, VecBuilderOptions::default().add_last(), ) .unwrap() @@ -915,6 +949,7 @@ impl Vecs { version + VERSION + Version::ONE, format, computation, + indexes, VecBuilderOptions::default().add_last(), ) .unwrap() @@ -929,6 +964,7 @@ impl Vecs { version + VERSION + Version::ONE, format, computation, + indexes, VecBuilderOptions::default().add_last(), ) .unwrap() @@ -943,6 +979,7 @@ impl Vecs { version + VERSION + Version::ONE, format, computation, + indexes, VecBuilderOptions::default().add_last(), ) .unwrap() @@ -966,6 +1003,7 @@ impl Vecs { version + VERSION + Version::TWO, format, computation, + indexes, VecBuilderOptions::default().add_sum().add_cumulative(), )?, indexes_to_coindays_destroyed: ComputedVecsFromHeight::forced_import( @@ -975,6 +1013,7 @@ impl Vecs { version + VERSION + Version::TWO, format, computation, + indexes, VecBuilderOptions::default().add_sum().add_cumulative(), )?, indexes_to_net_realized_profit_and_loss_cumulative_30d_change: compute_dollars.then(|| { @@ -985,6 +1024,7 @@ impl Vecs { version + VERSION + Version::new(3), format, computation, + indexes, VecBuilderOptions::default().add_last() ) .unwrap() @@ -997,6 +1037,7 @@ impl Vecs { version + VERSION + Version::new(3), format, computation, + indexes, VecBuilderOptions::default().add_last() ) .unwrap() @@ -1009,6 +1050,7 @@ impl Vecs { version + VERSION + Version::new(3), format, computation, + indexes, 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 4bdf609c3..bce92f648 100644 --- a/crates/brk_computer/src/vecs/stateful/mod.rs +++ b/crates/brk_computer/src/vecs/stateful/mod.rs @@ -80,6 +80,7 @@ impl Vecs { version: Version, computation: Computation, format: Format, + indexes: &indexes::Vecs, fetched: Option<&fetched::Vecs>, ) -> color_eyre::Result { let compute_dollars = fetched.is_some(); @@ -112,6 +113,7 @@ impl Vecs { computation, VecBuilderOptions::default().add_last(), compute_dollars, + indexes, )?, height_to_opreturn_supply: EagerVec::forced_import( path, @@ -128,6 +130,7 @@ impl Vecs { computation, VecBuilderOptions::default().add_last(), compute_dollars, + indexes, )?, indexes_to_address_count: ComputedVecsFromHeight::forced_import( path, @@ -136,6 +139,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, indexes_to_empty_address_count: ComputedVecsFromHeight::forced_import( @@ -145,6 +149,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, addresstype_to_height_to_address_count: AddressTypeToHeightToAddressCount::from( @@ -260,6 +265,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, p2pk33: ComputedVecsFromHeight::forced_import( @@ -269,6 +275,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, p2pkh: ComputedVecsFromHeight::forced_import( @@ -278,6 +285,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, p2sh: ComputedVecsFromHeight::forced_import( @@ -287,6 +295,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, p2wpkh: ComputedVecsFromHeight::forced_import( @@ -296,6 +305,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, p2wsh: ComputedVecsFromHeight::forced_import( @@ -305,6 +315,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, p2tr: ComputedVecsFromHeight::forced_import( @@ -314,6 +325,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, p2a: ComputedVecsFromHeight::forced_import( @@ -323,6 +335,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, }, @@ -336,6 +349,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, p2pk33: ComputedVecsFromHeight::forced_import( @@ -345,6 +359,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, p2pkh: ComputedVecsFromHeight::forced_import( @@ -354,6 +369,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, p2sh: ComputedVecsFromHeight::forced_import( @@ -363,6 +379,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, p2wpkh: ComputedVecsFromHeight::forced_import( @@ -372,6 +389,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, p2wsh: ComputedVecsFromHeight::forced_import( @@ -381,6 +399,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, p2tr: ComputedVecsFromHeight::forced_import( @@ -390,6 +409,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, p2a: ComputedVecsFromHeight::forced_import( @@ -399,6 +419,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, }, @@ -408,6 +429,7 @@ impl Vecs { version, computation, format, + indexes, fetched, &states_path, )?, @@ -416,6 +438,7 @@ impl Vecs { version, computation, format, + indexes, fetched, &states_path, )?, diff --git a/crates/brk_computer/src/vecs/stateful/utxo_cohort.rs b/crates/brk_computer/src/vecs/stateful/utxo_cohort.rs index 1c72bc084..6ca76545e 100644 --- a/crates/brk_computer/src/vecs/stateful/utxo_cohort.rs +++ b/crates/brk_computer/src/vecs/stateful/utxo_cohort.rs @@ -33,6 +33,7 @@ impl Vecs { computation: Computation, format: Format, version: Version, + indexes: &indexes::Vecs, fetched: Option<&fetched::Vecs>, states_path: &Path, compute_relative_to_all: bool, @@ -54,6 +55,7 @@ impl Vecs { computation, format, version, + indexes, fetched, compute_relative_to_all, )?, diff --git a/crates/brk_computer/src/vecs/stateful/utxo_cohorts.rs b/crates/brk_computer/src/vecs/stateful/utxo_cohorts.rs index 787c42234..8775cbc7e 100644 --- a/crates/brk_computer/src/vecs/stateful/utxo_cohorts.rs +++ b/crates/brk_computer/src/vecs/stateful/utxo_cohorts.rs @@ -12,7 +12,7 @@ use rayon::prelude::*; use crate::{ states::{BlockState, Transacted}, - vecs::{Indexes, fetched, stateful::r#trait::DynCohortVecs}, + vecs::{Indexes, fetched, indexes, stateful::r#trait::DynCohortVecs}, }; use super::{r#trait::CohortVecs, utxo_cohort}; @@ -28,6 +28,7 @@ impl Vecs { version: Version, _computation: Computation, format: Format, + indexes: &indexes::Vecs, fetched: Option<&fetched::Vecs>, states_path: &Path, ) -> color_eyre::Result { @@ -39,6 +40,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, false, @@ -50,6 +52,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -60,6 +63,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -72,6 +76,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -82,6 +87,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -92,6 +98,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -102,6 +109,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -112,6 +120,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -124,6 +133,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -134,6 +144,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -144,6 +155,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -154,6 +166,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -164,6 +177,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -174,6 +188,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -184,6 +199,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -194,6 +210,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -204,6 +221,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -214,6 +232,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -224,6 +243,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -236,6 +256,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -246,6 +267,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -256,6 +278,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -266,6 +289,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -276,6 +300,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -286,6 +311,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -296,6 +322,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -306,6 +333,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -316,6 +344,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -326,6 +355,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -336,6 +366,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -346,6 +377,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -356,6 +388,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -366,6 +399,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -376,6 +410,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -386,6 +421,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -396,6 +432,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -406,6 +443,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -418,6 +456,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -428,6 +467,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -438,6 +478,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -448,6 +489,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -458,6 +500,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -468,6 +511,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -478,6 +522,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -488,6 +533,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -498,6 +544,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -508,6 +555,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -518,6 +566,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -528,6 +577,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -538,6 +588,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -548,6 +599,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -558,6 +610,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -568,6 +621,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -578,6 +632,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -588,6 +643,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -600,6 +656,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -610,6 +667,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -620,6 +678,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -630,6 +689,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -640,6 +700,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -650,6 +711,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -660,6 +722,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -670,6 +733,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -680,6 +744,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -690,6 +755,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -700,6 +766,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -710,6 +777,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -720,6 +788,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -730,6 +799,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -740,6 +810,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -750,6 +821,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -760,6 +832,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -770,6 +843,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -780,6 +854,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -790,6 +865,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -802,6 +878,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -812,6 +889,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -822,6 +900,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -832,6 +911,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -842,6 +922,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -852,6 +933,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -862,6 +944,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -872,6 +955,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -882,6 +966,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -892,6 +977,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -902,6 +988,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -912,6 +999,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -922,6 +1010,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -932,6 +1021,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -942,6 +1032,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -954,6 +1045,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -964,6 +1056,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -974,6 +1067,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -984,6 +1078,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -994,6 +1089,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -1004,6 +1100,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -1014,6 +1111,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -1024,6 +1122,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -1034,6 +1133,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -1044,6 +1144,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -1054,6 +1155,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -1064,6 +1166,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -1074,6 +1177,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -1086,6 +1190,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -1096,6 +1201,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -1106,6 +1212,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -1116,6 +1223,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -1126,6 +1234,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -1136,6 +1245,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -1146,6 +1256,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -1156,6 +1267,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -1166,6 +1278,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -1176,6 +1289,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -1186,6 +1300,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -1196,6 +1311,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, @@ -1206,6 +1322,7 @@ impl Vecs { _computation, format, version + VERSION + Version::ZERO, + indexes, fetched, states_path, true, diff --git a/crates/brk_computer/src/vecs/transactions.rs b/crates/brk_computer/src/vecs/transactions.rs index 9c3f0bf9d..d2e008f30 100644 --- a/crates/brk_computer/src/vecs/transactions.rs +++ b/crates/brk_computer/src/vecs/transactions.rs @@ -347,6 +347,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default() .add_average() .add_minmax() @@ -361,6 +362,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default() .add_average() .add_minmax() @@ -375,6 +377,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default() .add_average() .add_minmax() @@ -389,6 +392,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_sum().add_cumulative(), )?, indexes_to_tx_v2: ComputedVecsFromHeight::forced_import( @@ -398,6 +402,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_sum().add_cumulative(), )?, indexes_to_tx_v3: ComputedVecsFromHeight::forced_import( @@ -407,6 +412,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_sum().add_cumulative(), )?, indexes_to_fee: ComputedValueVecsFromTxindex::forced_import( @@ -432,6 +438,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default() .add_percentiles() .add_minmax() @@ -444,6 +451,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default() .add_percentiles() .add_minmax() @@ -456,6 +464,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default() .add_percentiles() .add_minmax() @@ -475,6 +484,7 @@ impl Vecs { .add_minmax() .add_average(), compute_dollars, + indexes, )?, indexes_to_coinbase: ComputedValueVecsFromHeight::forced_import( path, @@ -490,6 +500,7 @@ impl Vecs { .add_minmax() .add_average(), compute_dollars, + indexes, )?, indexes_to_unclaimed_rewards: ComputedValueVecsFromHeight::forced_import( path, @@ -500,6 +511,7 @@ impl Vecs { computation, VecBuilderOptions::default().add_sum().add_cumulative(), compute_dollars, + indexes, )?, indexes_to_p2a_count: ComputedVecsFromHeight::forced_import( path, @@ -508,6 +520,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default() .add_average() .add_minmax() @@ -522,6 +535,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default() .add_average() .add_minmax() @@ -536,6 +550,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default() .add_average() .add_minmax() @@ -550,6 +565,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default() .add_average() .add_minmax() @@ -564,6 +580,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default() .add_average() .add_minmax() @@ -578,6 +595,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default() .add_average() .add_minmax() @@ -592,6 +610,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default() .add_average() .add_minmax() @@ -606,6 +625,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default() .add_average() .add_minmax() @@ -620,6 +640,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default() .add_average() .add_minmax() @@ -634,6 +655,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default() .add_average() .add_minmax() @@ -648,6 +670,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default() .add_average() .add_minmax() @@ -662,6 +685,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default() .add_average() .add_minmax() @@ -676,6 +700,7 @@ impl Vecs { version + VERSION + Version::ZERO, format, computation, + indexes, VecBuilderOptions::default().add_last(), )?, txindex_to_is_coinbase, diff --git a/crates/brk_core/src/structs/dateindex.rs b/crates/brk_core/src/structs/dateindex.rs index e6d5d4185..1b47506c2 100644 --- a/crates/brk_core/src/structs/dateindex.rs +++ b/crates/brk_core/src/structs/dateindex.rs @@ -115,7 +115,7 @@ impl FromCoarserIndex for DateIndex { } else if coarser == 1 { 1 } else { - 4 + (coarser - 1) * 7 + 4 + (coarser - 2) * 7 } } @@ -126,7 +126,7 @@ impl FromCoarserIndex for DateIndex { } else if coarser == 1 { 3 } else { - 3 + coarser * 7 + 3 + (coarser - 1) * 7 } } } diff --git a/crates/brk_core/src/structs/decadeindex.rs b/crates/brk_core/src/structs/decadeindex.rs index d0b01002a..e02a5a7ff 100644 --- a/crates/brk_core/src/structs/decadeindex.rs +++ b/crates/brk_core/src/structs/decadeindex.rs @@ -1,4 +1,7 @@ -use std::{fmt::Debug, ops::Add}; +use std::{ + fmt::Debug, + ops::{Add, AddAssign, Div}, +}; use serde::{Deserialize, Serialize}; use zerocopy_derive::{FromBytes, Immutable, IntoBytes, KnownLayout}; @@ -63,6 +66,27 @@ impl Add for DecadeIndex { } } +impl Add for DecadeIndex { + type Output = Self; + + fn add(self, rhs: Self) -> Self::Output { + Self::from(self.0 + rhs.0) + } +} + +impl AddAssign for DecadeIndex { + fn add_assign(&mut self, rhs: Self) { + *self = Self(self.0 + rhs.0) + } +} + +impl Div for DecadeIndex { + type Output = Self; + fn div(self, _: usize) -> Self::Output { + unreachable!() + } +} + impl From for DecadeIndex { fn from(value: DateIndex) -> Self { Self::from(Date::from(value)) diff --git a/crates/brk_core/src/structs/monthindex.rs b/crates/brk_core/src/structs/monthindex.rs index 7c4e88b71..94fdfb4ea 100644 --- a/crates/brk_core/src/structs/monthindex.rs +++ b/crates/brk_core/src/structs/monthindex.rs @@ -1,4 +1,7 @@ -use std::{fmt::Debug, ops::Add}; +use std::{ + fmt::Debug, + ops::{Add, AddAssign, Div}, +}; use serde::{Deserialize, Serialize}; use zerocopy_derive::{FromBytes, Immutable, IntoBytes, KnownLayout}; @@ -57,6 +60,27 @@ impl Add for MonthIndex { } } +impl Add for MonthIndex { + type Output = Self; + + fn add(self, rhs: Self) -> Self::Output { + Self::from(self.0 + rhs.0) + } +} + +impl AddAssign for MonthIndex { + fn add_assign(&mut self, rhs: Self) { + *self = Self(self.0 + rhs.0) + } +} + +impl Div for MonthIndex { + type Output = Self; + fn div(self, _: usize) -> Self::Output { + unreachable!() + } +} + impl From for MonthIndex { fn from(value: DateIndex) -> Self { Self::from(Date::from(value)) diff --git a/crates/brk_core/src/structs/quarterindex.rs b/crates/brk_core/src/structs/quarterindex.rs index a7e65d9c9..3ace803ae 100644 --- a/crates/brk_core/src/structs/quarterindex.rs +++ b/crates/brk_core/src/structs/quarterindex.rs @@ -1,4 +1,7 @@ -use std::{fmt::Debug, ops::Add}; +use std::{ + fmt::Debug, + ops::{Add, AddAssign, Div}, +}; use serde::{Deserialize, Serialize}; use zerocopy_derive::{FromBytes, Immutable, IntoBytes, KnownLayout}; @@ -57,6 +60,27 @@ impl Add for QuarterIndex { } } +impl Add for QuarterIndex { + type Output = Self; + + fn add(self, rhs: Self) -> Self::Output { + Self::from(self.0 + rhs.0) + } +} + +impl AddAssign for QuarterIndex { + fn add_assign(&mut self, rhs: Self) { + *self = Self(self.0 + rhs.0) + } +} + +impl Div for QuarterIndex { + type Output = Self; + fn div(self, _: usize) -> Self::Output { + unreachable!() + } +} + impl From for QuarterIndex { fn from(value: MonthIndex) -> Self { Self((usize::from(value) / 3) as u16) diff --git a/crates/brk_core/src/structs/semesterindex.rs b/crates/brk_core/src/structs/semesterindex.rs index 6de6c428b..4d3c0f649 100644 --- a/crates/brk_core/src/structs/semesterindex.rs +++ b/crates/brk_core/src/structs/semesterindex.rs @@ -1,4 +1,7 @@ -use std::{fmt::Debug, ops::Add}; +use std::{ + fmt::Debug, + ops::{Add, AddAssign, Div}, +}; use serde::{Deserialize, Serialize}; use zerocopy_derive::{FromBytes, Immutable, IntoBytes, KnownLayout}; @@ -57,6 +60,27 @@ impl Add for SemesterIndex { } } +impl Add for SemesterIndex { + type Output = Self; + + fn add(self, rhs: Self) -> Self::Output { + Self::from(self.0 + rhs.0) + } +} + +impl AddAssign for SemesterIndex { + fn add_assign(&mut self, rhs: Self) { + *self = Self(self.0 + rhs.0) + } +} + +impl Div for SemesterIndex { + type Output = Self; + fn div(self, _: usize) -> Self::Output { + unreachable!() + } +} + impl From for SemesterIndex { fn from(value: MonthIndex) -> Self { Self((usize::from(value) / 6) as u16) diff --git a/crates/brk_core/src/structs/weekindex.rs b/crates/brk_core/src/structs/weekindex.rs index 86c4dca8b..d302cdfe7 100644 --- a/crates/brk_core/src/structs/weekindex.rs +++ b/crates/brk_core/src/structs/weekindex.rs @@ -1,4 +1,7 @@ -use std::{fmt::Debug, ops::Add}; +use std::{ + fmt::Debug, + ops::{Add, AddAssign, Div}, +}; use serde::{Deserialize, Serialize}; use zerocopy_derive::{FromBytes, Immutable, IntoBytes, KnownLayout}; @@ -49,6 +52,27 @@ impl From for usize { } } +impl Add for WeekIndex { + type Output = Self; + + fn add(self, rhs: Self) -> Self::Output { + Self::from(self.0 + rhs.0) + } +} + +impl AddAssign for WeekIndex { + fn add_assign(&mut self, rhs: Self) { + *self = Self(self.0 + rhs.0) + } +} + +impl Div for WeekIndex { + type Output = Self; + fn div(self, _: usize) -> Self::Output { + unreachable!() + } +} + impl Add for WeekIndex { type Output = Self; diff --git a/crates/brk_core/src/structs/yearindex.rs b/crates/brk_core/src/structs/yearindex.rs index 78261f78f..8ba72883f 100644 --- a/crates/brk_core/src/structs/yearindex.rs +++ b/crates/brk_core/src/structs/yearindex.rs @@ -1,4 +1,7 @@ -use std::{fmt::Debug, ops::Add}; +use std::{ + fmt::Debug, + ops::{Add, AddAssign, Div}, +}; use serde::{Deserialize, Serialize}; use zerocopy_derive::{FromBytes, Immutable, IntoBytes, KnownLayout}; @@ -51,6 +54,27 @@ impl Add for YearIndex { } } +impl Add for YearIndex { + type Output = Self; + + fn add(self, rhs: Self) -> Self::Output { + Self::from(self.0 + rhs.0) + } +} + +impl AddAssign for YearIndex { + fn add_assign(&mut self, rhs: Self) { + *self = Self(self.0 + rhs.0) + } +} + +impl Div for YearIndex { + type Output = Self; + fn div(self, _: usize) -> Self::Output { + unreachable!() + } +} + impl From for YearIndex { fn from(value: DateIndex) -> Self { Self::from(Date::from(value)) diff --git a/crates/brk_core/src/traits/from_coarser.rs b/crates/brk_core/src/traits/from_coarser.rs index 6f7686740..93c1f697e 100644 --- a/crates/brk_core/src/traits/from_coarser.rs +++ b/crates/brk_core/src/traits/from_coarser.rs @@ -1,6 +1,9 @@ use std::ops::RangeInclusive; -pub trait FromCoarserIndex { +pub trait FromCoarserIndex +where + T: Ord + From, +{ fn min_from(coarser: T) -> usize; fn max_from_(coarser: T) -> usize; fn max_from(coarser: T, len: usize) -> usize {