diff --git a/Cargo.lock b/Cargo.lock index 371401b85..c006a147c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -457,8 +457,9 @@ version = "0.0.40" dependencies = [ "bitcoin", "bitcoincore-rpc", - "byteview 0.7.0", + "byteview", "derive_deref", + "fjall", "jiff", "log", "rapidhash", @@ -467,6 +468,7 @@ dependencies = [ "serde_bytes", "serde_derive", "serde_json", + "thiserror", "zerocopy", "zerocopy-derive", ] @@ -505,7 +507,7 @@ dependencies = [ "brk_parser", "brk_store", "brk_vec", - "byteview 0.7.0", + "byteview", "color-eyre", "fjall", "log", @@ -592,6 +594,7 @@ dependencies = [ "brk_core", "brk_store", "brk_vec", + "fjall", "rayon", "serde", "zerocopy", @@ -603,7 +606,7 @@ name = "brk_store" version = "0.0.40" dependencies = [ "brk_core", - "byteview 0.7.0", + "byteview", "color-eyre", "fjall", "zerocopy", @@ -682,12 +685,6 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6236364b88b9b6d0bc181ba374cf1ab55ba3ef97a1cb6f8cddad48a273767fb5" -[[package]] -name = "byteview" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f996a0c883b1ae93c53ffd21857b6eaba768998dbb1f7e2f269d53dd6553256c" - [[package]] name = "bzip2" version = "0.5.2" @@ -718,9 +715,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.24" +version = "1.2.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16595d3be041c03b09d08d0858631facccee9221e579704070e6e9e4915d3bc7" +checksum = "d0fc897dc1e865cc67c0e05a836d9d3f1df3cbe442aa4a9473b18e12624a4951" dependencies = [ "jobserver", "libc", @@ -803,9 +800,9 @@ checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" [[package]] name = "color-eyre" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6e1761c0e16f8883bbbb8ce5990867f4f06bf11a0253da6495a04ce4b6ef0ec" +checksum = "e5920befb47832a6d61ee3a3a846565cfa39b331331e68a3b1d1116630f2f26d" dependencies = [ "backtrace", "color-spantrace", @@ -818,9 +815,9 @@ dependencies = [ [[package]] name = "color-spantrace" -version = "0.2.2" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ddd8d5bfda1e11a501d0a7303f3bfed9aa632ebdb859be40d0fd70478ed70d5" +checksum = "b8b88ea9df13354b55bc7234ebcce36e6ef896aca2e42a15de9e10edce01b427" dependencies = [ "once_cell", "owo-colors", @@ -1161,12 +1158,12 @@ checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" [[package]] name = "fjall" -version = "2.10.0" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b929b3db7be7d7b4d4df67fb016fc446b8f57507b48a82e69d2a30610e460f28" +checksum = "13279146a877c2060f668bc4c477af8ef5aa42732c58dca32fcb4aff40edc5b4" dependencies = [ "byteorder", - "byteview 0.6.1", + "byteview", "dashmap", "log", "lsm-tree", @@ -1653,9 +1650,9 @@ checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" [[package]] name = "lock_api" -version = "0.4.12" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +checksum = "96936507f153605bddfcda068dd804796c84324ed2510809e5b2a624c81da765" dependencies = [ "autocfg", "scopeguard", @@ -1845,9 +1842,9 @@ checksum = "26995317201fa17f3656c36716aed4a7c81743a9634ac4c99c0eeda495db0cec" [[package]] name = "oxc" -version = "0.72.1" +version = "0.72.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61a4d9521b1c1c9750bef7fd133b542d48b0073097da97b0e0bbb89b6b59bc6c" +checksum = "e91ecbc3f076425da55380d3f3f873bbbd0a10f56d9f9b6c0d15c88a2188f127" dependencies = [ "oxc_allocator", "oxc_ast", @@ -1888,9 +1885,9 @@ dependencies = [ [[package]] name = "oxc_allocator" -version = "0.72.1" +version = "0.72.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e63bc2ee951d0991953c95412e8907457fc38c8d9366a65cfc31a0490cd6a5a2" +checksum = "94677be5d1874da150784b9d551bae0dfad7e5a6121a2c6acccda335c05504ea" dependencies = [ "allocator-api2", "bumpalo", @@ -1901,9 +1898,9 @@ dependencies = [ [[package]] name = "oxc_ast" -version = "0.72.1" +version = "0.72.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7def3a0a7776127c60afa410a6a4a03b27dec7c65d350478b234a7127ca53bf2" +checksum = "26f7b73c9a8e265169d98cd2395cbab52fcb849d3297b1ec2511a1d908775c73" dependencies = [ "bitflags", "cow-utils", @@ -1918,9 +1915,9 @@ dependencies = [ [[package]] name = "oxc_ast_macros" -version = "0.72.1" +version = "0.72.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7d2acd02146b9f5d69b4035a49f0ed91139b9168ff1559234481df9a4195630" +checksum = "3f411489fef9ace92fdea3105490f9aab07a78c9adff25b62345b1a1bd49ee0c" dependencies = [ "phf", "proc-macro2", @@ -1930,9 +1927,9 @@ dependencies = [ [[package]] name = "oxc_ast_visit" -version = "0.72.1" +version = "0.72.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9152368ec7ab6785568e3b53908a9c505402ee49e51cc77ebf717f7bfe60454" +checksum = "cf97a9b275654d7fc921c0c472ceab1ae167b670c9a761e5c2aec66b9076157b" dependencies = [ "oxc_allocator", "oxc_ast", @@ -1942,9 +1939,9 @@ dependencies = [ [[package]] name = "oxc_cfg" -version = "0.72.1" +version = "0.72.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bf5714ec4d469be32521c3c282df4d5a45abfa2bafc926b364b9869651661dd" +checksum = "2ac937d952a9990180f9090b5784713f66407a467f34e84f78bd204a7c2d6d73" dependencies = [ "bitflags", "itertools", @@ -1957,9 +1954,9 @@ dependencies = [ [[package]] name = "oxc_codegen" -version = "0.72.1" +version = "0.72.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e2cfa58ff8217601c4b4b525caef5a3c004bb017d3050fd73252fc91868c627" +checksum = "b09bbfd5a9faadff9578858f28dcfb46e2f9c4929ee0d8e076f928afe618010f" dependencies = [ "bitflags", "cow-utils", @@ -1978,18 +1975,18 @@ dependencies = [ [[package]] name = "oxc_data_structures" -version = "0.72.1" +version = "0.72.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3a91991eb494f1c3619feb27af1298bd05b0caac6198cdee528a61b7709ae9f" +checksum = "09ebee1a21c5d47b6e845357274904ec9568b001d3ff6ab04d4cc4754fd148c2" dependencies = [ "rustversion", ] [[package]] name = "oxc_diagnostics" -version = "0.72.1" +version = "0.72.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "580a11ff9d17d5b5ca93e9fd9a3d0404f010e71b5a6ee743b4e9f4641d786ab1" +checksum = "7fa03ff098ecf135235ed3c88e013a22e9b58caf1108d32eca5261daf2d88330" dependencies = [ "cow-utils", "oxc-miette", @@ -1997,9 +1994,9 @@ dependencies = [ [[package]] name = "oxc_ecmascript" -version = "0.72.1" +version = "0.72.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5613f7445cef6a08b9543dda6cb1962e5829c5ff5bae036d2bd41b740602e3eb" +checksum = "e1b5dba7d2918b9a59f82ce974b85cc6de1e577d06f49d1e608505e9da6a0b02" dependencies = [ "cow-utils", "num-bigint", @@ -2011,9 +2008,9 @@ dependencies = [ [[package]] name = "oxc_estree" -version = "0.72.1" +version = "0.72.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fb3d8b5e6674a51a9d5a8e1f051eba423c2b78381ecd0b7847517967193cbb8" +checksum = "7a870fcc8a8a8eeb3471cb51df3628f04e9f53521608e735a34bd9b6f96ce78c" [[package]] name = "oxc_index" @@ -2023,9 +2020,9 @@ checksum = "2fa07b0cfa997730afed43705766ef27792873fdf5215b1391949fec678d2392" [[package]] name = "oxc_mangler" -version = "0.72.1" +version = "0.72.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aaf4117f87d1d6e3adff0fd3f077cdf321a0e6292042bc1ba1b8df8be010e78b" +checksum = "1330ed79d68bae3bcc3d9ceca8b690f1d27056315ad4a6a97a8eda55e8bb8244" dependencies = [ "fixedbitset", "itertools", @@ -2040,9 +2037,9 @@ dependencies = [ [[package]] name = "oxc_minifier" -version = "0.72.1" +version = "0.72.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d019e9ff013696e27d6a22548fcb43c5000a8d2c8c97a9bba635c1f8aafd0402" +checksum = "3e788a77708893ba1cf82a9291ce18bdb6fbb69711aeeaf50514fd775c17a1a3" dependencies = [ "cow-utils", "oxc_allocator", @@ -2062,9 +2059,9 @@ dependencies = [ [[package]] name = "oxc_parser" -version = "0.72.1" +version = "0.72.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42bcc81f20b04c4d186ccf576487b93b6b437bda8626349b6ef770795e65781f" +checksum = "ca8194f22ac433d9f2575f3f5a35fdc2ec403877a2c98b8bbb7047acc73e07e6" dependencies = [ "bitflags", "cow-utils", @@ -2085,9 +2082,9 @@ dependencies = [ [[package]] name = "oxc_regular_expression" -version = "0.72.1" +version = "0.72.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0863519e3231996e3a6c2a86f068712dfed956d44228aa744593dde2ffbe169c" +checksum = "bac34c62476a83f00f36fb08991730db51a722082125067f9562257fd97cbb88" dependencies = [ "bitflags", "oxc_allocator", @@ -2101,9 +2098,9 @@ dependencies = [ [[package]] name = "oxc_semantic" -version = "0.72.1" +version = "0.72.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09a645cc47ed8dd6ace276d829cbe5cbf6a7fcb909093f533f5d29fa35545bdb" +checksum = "564256e85189bf5e6fb331f08892eeb8e13f3fcadb0dc08a85ce7db59519e174" dependencies = [ "itertools", "oxc_allocator", @@ -2137,9 +2134,9 @@ dependencies = [ [[package]] name = "oxc_span" -version = "0.72.1" +version = "0.72.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8580e4eedc08a6168a4a530fb407a17f70d270e8f2b2f6653914422b03f10321" +checksum = "886510fc6db2c5a7a905feeb966e613527bdbe2e544057923957ba79e3e93142" dependencies = [ "compact_str", "oxc-miette", @@ -2150,9 +2147,9 @@ dependencies = [ [[package]] name = "oxc_syntax" -version = "0.72.1" +version = "0.72.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d29704018fbd8b45711284729c5cde09c29391f254d7bca7e9c6899c0c44816" +checksum = "3dddefc02737686c68da8597a88ba5514e7134aba006c61f72fb1752451f95cc" dependencies = [ "bitflags", "cow-utils", @@ -2171,9 +2168,9 @@ dependencies = [ [[package]] name = "oxc_traverse" -version = "0.72.1" +version = "0.72.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c00ac4c7344ccd560bb8a2f89b2ca8b32e2efa8bdfdb305ef26be1f1fac5733" +checksum = "fa88eafbdafb3f0da21b03fb41b146602360dc2e952810e9d26688b2510e3693" dependencies = [ "itoa", "oxc_allocator", @@ -2200,9 +2197,9 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.10" +version = "0.9.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" +checksum = "bc838d2a56b5b1a6c25f55575dfc605fabb63bb2365f6c2353ef9159aa69e4a5" dependencies = [ "cfg-if", "libc", @@ -3203,7 +3200,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62fc7c4ce161f049607ecea654dca3f2d727da5371ae85e2e4f14ce2b98ed67c" dependencies = [ "byteorder", - "byteview 0.6.1", + "byteview", "interval-heap", "log", "path-absolutize", diff --git a/Cargo.toml b/Cargo.toml index 24576099c..227a7387c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,12 +32,12 @@ brk_server = { version = "0", path = "crates/brk_server" } brk_state = { version = "0", path = "crates/brk_state" } brk_store = { version = "0", path = "crates/brk_store" } brk_vec = { version = "0", path = "crates/brk_vec" } -byteview = "0.7.0" +byteview = "=0.6.1" clap = { version = "4.5.39", features = ["string"] } clap_derive = "4.5.32" -color-eyre = "0.6.4" +color-eyre = "0.6.5" derive_deref = "1.1.1" -fjall = "2.10.0" +fjall = "2.11.0" jiff = "0.2.14" log = { version = "0.4.27" } minreq = { version = "2.13.4", features = ["https", "serde_json"] } diff --git a/crates/brk_computer/src/lib.rs b/crates/brk_computer/src/lib.rs index b0e312a65..6e7d4d1c1 100644 --- a/crates/brk_computer/src/lib.rs +++ b/crates/brk_computer/src/lib.rs @@ -47,12 +47,14 @@ impl Computer { computation: Computation, ) -> color_eyre::Result<()> { self.vecs = Some(Vecs::import( + // TODO: Give self.path, join inside import &self.path.join("vecs/computed"), VERSION + Version::ZERO, indexer, self.fetcher.is_some(), computation, self.compressed, + indexer.keyspace(), )?); Ok(()) } @@ -61,6 +63,7 @@ impl Computer { /// Clone struct instead pub fn import_stores(&mut self, indexer: &Indexer) -> color_eyre::Result<()> { self.stores = Some(Stores::import( + // TODO: Give self.path, join inside import &self.path.join("stores"), VERSION + Version::ZERO, indexer.keyspace(), diff --git a/crates/brk_computer/src/vecs/blocks.rs b/crates/brk_computer/src/vecs/blocks.rs index 6f497182b..879c365d4 100644 --- a/crates/brk_computer/src/vecs/blocks.rs +++ b/crates/brk_computer/src/vecs/blocks.rs @@ -49,6 +49,7 @@ impl Vecs { timeindexes_to_timestamp: ComputedVecsFromDateIndex::forced_import( path, "timestamp", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_first(), @@ -132,7 +133,7 @@ impl Vecs { starting_indexes: &Indexes, exit: &Exit, ) -> color_eyre::Result<()> { - self.timeindexes_to_timestamp.compute( + self.timeindexes_to_timestamp.compute_all( indexer, indexes, starting_indexes, diff --git a/crates/brk_computer/src/vecs/fetched.rs b/crates/brk_computer/src/vecs/fetched.rs index 43200d5a2..23bdadb88 100644 --- a/crates/brk_computer/src/vecs/fetched.rs +++ b/crates/brk_computer/src/vecs/fetched.rs @@ -169,6 +169,7 @@ impl Vecs { timeindexes_to_open: ComputedVecsFromDateIndex::forced_import( path, "open", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_first(), @@ -176,6 +177,7 @@ impl Vecs { timeindexes_to_high: ComputedVecsFromDateIndex::forced_import( path, "high", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_max(), @@ -183,6 +185,7 @@ impl Vecs { timeindexes_to_low: ComputedVecsFromDateIndex::forced_import( path, "low", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_min(), @@ -190,6 +193,7 @@ impl Vecs { timeindexes_to_close: ComputedVecsFromDateIndex::forced_import( path, "close", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -197,6 +201,7 @@ impl Vecs { timeindexes_to_open_in_sats: ComputedVecsFromDateIndex::forced_import( path, "open_in_sats", + true, version + VERSION + VERSION_IN_SATS + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_first(), @@ -204,6 +209,7 @@ impl Vecs { timeindexes_to_high_in_sats: ComputedVecsFromDateIndex::forced_import( path, "high_in_sats", + true, version + VERSION + VERSION_IN_SATS + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_max(), @@ -211,6 +217,7 @@ impl Vecs { timeindexes_to_low_in_sats: ComputedVecsFromDateIndex::forced_import( path, "low_in_sats", + true, version + VERSION + VERSION_IN_SATS + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_min(), @@ -218,6 +225,7 @@ impl Vecs { timeindexes_to_close_in_sats: ComputedVecsFromDateIndex::forced_import( path, "close_in_sats", + true, version + VERSION + VERSION_IN_SATS + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -463,7 +471,7 @@ impl Vecs { exit, )?; - self.timeindexes_to_close.compute( + self.timeindexes_to_close.compute_all( indexer, indexes, starting_indexes, @@ -478,7 +486,7 @@ impl Vecs { }, )?; - self.timeindexes_to_high.compute( + self.timeindexes_to_high.compute_all( indexer, indexes, starting_indexes, @@ -493,7 +501,7 @@ impl Vecs { }, )?; - self.timeindexes_to_low.compute( + self.timeindexes_to_low.compute_all( indexer, indexes, starting_indexes, @@ -508,7 +516,7 @@ impl Vecs { }, )?; - self.timeindexes_to_open.compute( + self.timeindexes_to_open.compute_all( indexer, indexes, starting_indexes, @@ -776,7 +784,7 @@ impl Vecs { }, )?; - self.timeindexes_to_open_in_sats.compute( + self.timeindexes_to_open_in_sats.compute_all( indexer, indexes, starting_indexes, @@ -784,14 +792,14 @@ impl Vecs { |v, _, _, starting_indexes, exit| { v.compute_transform( starting_indexes.dateindex, - &self.timeindexes_to_open.dateindex, + self.timeindexes_to_open.dateindex.as_ref().unwrap(), |(i, open, ..)| (i, Open::new(Sats::ONE_BTC / *open)), exit, ) }, )?; - self.timeindexes_to_high_in_sats.compute( + self.timeindexes_to_high_in_sats.compute_all( indexer, indexes, starting_indexes, @@ -799,14 +807,14 @@ impl Vecs { |v, _, _, starting_indexes, exit| { v.compute_transform( starting_indexes.dateindex, - &self.timeindexes_to_low.dateindex, + self.timeindexes_to_low.dateindex.as_ref().unwrap(), |(i, low, ..)| (i, High::new(Sats::ONE_BTC / *low)), exit, ) }, )?; - self.timeindexes_to_low_in_sats.compute( + self.timeindexes_to_low_in_sats.compute_all( indexer, indexes, starting_indexes, @@ -814,14 +822,14 @@ impl Vecs { |v, _, _, starting_indexes, exit| { v.compute_transform( starting_indexes.dateindex, - &self.timeindexes_to_high.dateindex, + self.timeindexes_to_high.dateindex.as_ref().unwrap(), |(i, high, ..)| (i, Low::new(Sats::ONE_BTC / *high)), exit, ) }, )?; - self.timeindexes_to_close_in_sats.compute( + self.timeindexes_to_close_in_sats.compute_all( indexer, indexes, starting_indexes, @@ -829,7 +837,7 @@ impl Vecs { |v, _, _, starting_indexes, exit| { v.compute_transform( starting_indexes.dateindex, - &self.timeindexes_to_close.dateindex, + self.timeindexes_to_close.dateindex.as_ref().unwrap(), |(i, close, ..)| (i, Close::new(Sats::ONE_BTC / *close)), exit, ) @@ -856,12 +864,30 @@ impl Vecs { exit, )?; - let mut dateindex_first_iter = self.timeindexes_to_open_in_sats.dateindex.iter(); - let mut dateindex_max_iter = self.timeindexes_to_high_in_sats.dateindex.iter(); - let mut dateindex_min_iter = self.timeindexes_to_low_in_sats.dateindex.iter(); + let mut dateindex_first_iter = self + .timeindexes_to_open_in_sats + .dateindex + .as_ref() + .unwrap() + .iter(); + let mut dateindex_max_iter = self + .timeindexes_to_high_in_sats + .dateindex + .as_ref() + .unwrap() + .iter(); + let mut dateindex_min_iter = self + .timeindexes_to_low_in_sats + .dateindex + .as_ref() + .unwrap() + .iter(); self.dateindex_to_ohlc_in_sats.compute_transform( starting_indexes.dateindex, - &self.timeindexes_to_close_in_sats.dateindex, + self.timeindexes_to_close_in_sats + .dateindex + .as_ref() + .unwrap(), |(i, close, ..)| { ( i, diff --git a/crates/brk_computer/src/vecs/grouped/from_dateindex.rs b/crates/brk_computer/src/vecs/grouped/from_dateindex.rs index caf691635..8fc97e163 100644 --- a/crates/brk_computer/src/vecs/grouped/from_dateindex.rs +++ b/crates/brk_computer/src/vecs/grouped/from_dateindex.rs @@ -5,7 +5,7 @@ use brk_core::{ }; use brk_exit::Exit; use brk_indexer::Indexer; -use brk_vec::{AnyCollectableVec, Compressed, EagerVec}; +use brk_vec::{AnyCollectableVec, AnyIterableVec, Compressed, EagerVec}; use crate::vecs::{Indexes, indexes}; @@ -16,7 +16,7 @@ pub struct ComputedVecsFromDateIndex where T: ComputedType + PartialOrd, { - pub dateindex: EagerVec, + pub dateindex: Option>, pub dateindex_extra: ComputedVecBuilder, pub weekindex: ComputedVecBuilder, pub monthindex: ComputedVecBuilder, @@ -34,10 +34,16 @@ where pub fn forced_import( path: &Path, name: &str, + compute_source: bool, version: Version, compressed: Compressed, options: StorableVecGeneatorOptions, ) -> color_eyre::Result { + let dateindex = compute_source.then(|| { + EagerVec::forced_import(path, name, version + VERSION + Version::ZERO, compressed) + .unwrap() + }); + let dateindex_extra = ComputedVecBuilder::forced_import( path, name, @@ -49,12 +55,7 @@ where let options = options.remove_percentiles(); Ok(Self { - dateindex: EagerVec::forced_import( - path, - name, - version + VERSION + Version::ZERO, - compressed, - )?, + dateindex, dateindex_extra, weekindex: ComputedVecBuilder::forced_import( path, @@ -94,7 +95,7 @@ where }) } - pub fn compute( + pub fn compute_all( &mut self, indexer: &Indexer, indexes: &indexes::Vecs, @@ -112,14 +113,15 @@ where ) -> Result<()>, { compute( - &mut self.dateindex, + self.dateindex.as_mut().unwrap(), indexer, indexes, starting_indexes, exit, )?; - self.compute_rest(indexes, starting_indexes, exit) + let dateindex: Option<&EagerVec> = None; + self.compute_rest(indexes, starting_indexes, exit, dateindex) } pub fn compute_rest( @@ -127,25 +129,49 @@ where indexes: &indexes::Vecs, starting_indexes: &Indexes, exit: &Exit, + dateindex: Option<&impl AnyIterableVec>, ) -> color_eyre::Result<()> { - self.dateindex_extra - .extend(starting_indexes.dateindex, &self.dateindex, exit)?; + if let Some(dateindex) = dateindex { + self.dateindex_extra + .extend(starting_indexes.dateindex, dateindex, exit)?; - self.weekindex.compute( - starting_indexes.weekindex, - &self.dateindex, - &indexes.weekindex_to_first_dateindex, - &indexes.weekindex_to_dateindex_count, - exit, - )?; + self.weekindex.compute( + starting_indexes.weekindex, + dateindex, + &indexes.weekindex_to_first_dateindex, + &indexes.weekindex_to_dateindex_count, + exit, + )?; - self.monthindex.compute( - starting_indexes.monthindex, - &self.dateindex, - &indexes.monthindex_to_first_dateindex, - &indexes.monthindex_to_dateindex_count, - exit, - )?; + self.monthindex.compute( + starting_indexes.monthindex, + dateindex, + &indexes.monthindex_to_first_dateindex, + &indexes.monthindex_to_dateindex_count, + exit, + )?; + } else { + let dateindex = self.dateindex.as_ref().unwrap(); + + self.dateindex_extra + .extend(starting_indexes.dateindex, dateindex, exit)?; + + self.weekindex.compute( + starting_indexes.weekindex, + dateindex, + &indexes.weekindex_to_first_dateindex, + &indexes.weekindex_to_dateindex_count, + exit, + )?; + + self.monthindex.compute( + starting_indexes.monthindex, + dateindex, + &indexes.monthindex_to_first_dateindex, + &indexes.monthindex_to_dateindex_count, + exit, + )?; + } self.quarterindex.from_aligned( starting_indexes.quarterindex, @@ -176,7 +202,9 @@ where pub fn vecs(&self) -> Vec<&dyn AnyCollectableVec> { [ - vec![&self.dateindex as &dyn AnyCollectableVec], + self.dateindex + .as_ref() + .map_or(vec![], |v| vec![v as &dyn AnyCollectableVec]), self.dateindex_extra.vecs(), self.weekindex.vecs(), self.monthindex.vecs(), diff --git a/crates/brk_computer/src/vecs/grouped/from_height.rs b/crates/brk_computer/src/vecs/grouped/from_height.rs index a8d5ccc71..06a71ff84 100644 --- a/crates/brk_computer/src/vecs/grouped/from_height.rs +++ b/crates/brk_computer/src/vecs/grouped/from_height.rs @@ -17,7 +17,7 @@ pub struct ComputedVecsFromHeight where T: ComputedType + PartialOrd, { - pub height: Option>>, + pub height: Option>, pub height_extra: ComputedVecBuilder, pub dateindex: ComputedVecBuilder, pub weekindex: ComputedVecBuilder, @@ -45,10 +45,8 @@ where options: StorableVecGeneatorOptions, ) -> color_eyre::Result { let height = compute_source.then(|| { - Box::new( - EagerVec::forced_import(path, name, version + VERSION + Version::ZERO, compressed) - .unwrap(), - ) + EagerVec::forced_import(path, name, version + VERSION + Version::ZERO, compressed) + .unwrap() }); let height_extra = ComputedVecBuilder::forced_import( @@ -169,7 +167,7 @@ where exit, )?; } else { - let height = self.height.as_ref().unwrap().as_ref(); + let height = self.height.as_ref().unwrap(); self.height_extra .extend(starting_indexes.height, height, exit)?; @@ -238,7 +236,7 @@ where [ self.height .as_ref() - .map_or(vec![], |v| vec![v.as_ref() as &dyn AnyCollectableVec]), + .map_or(vec![], |v| vec![v as &dyn AnyCollectableVec]), self.height_extra.vecs(), self.dateindex.vecs(), self.weekindex.vecs(), 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 2352eaedd..c919a51a7 100644 --- a/crates/brk_computer/src/vecs/grouped/ratio_from_dateindex.rs +++ b/crates/brk_computer/src/vecs/grouped/ratio_from_dateindex.rs @@ -69,6 +69,7 @@ impl ComputedRatioVecsFromDateIndex { ComputedVecsFromDateIndex::forced_import( path, name, + true, version + VERSION, compressed, options, @@ -78,6 +79,7 @@ impl ComputedRatioVecsFromDateIndex { ratio: ComputedVecsFromDateIndex::forced_import( path, &format!("{name}_ratio"), + true, version + VERSION + Version::ZERO, compressed, options, @@ -85,6 +87,7 @@ impl ComputedRatioVecsFromDateIndex { ratio_sma: ComputedVecsFromDateIndex::forced_import( path, &format!("{name}_ratio_sma"), + true, version + VERSION + Version::ZERO, compressed, options, @@ -92,6 +95,7 @@ impl ComputedRatioVecsFromDateIndex { ratio_1w_sma: ComputedVecsFromDateIndex::forced_import( path, &format!("{name}_ratio_1w_sma"), + true, version + VERSION + Version::ZERO, compressed, options, @@ -99,6 +103,7 @@ impl ComputedRatioVecsFromDateIndex { ratio_1m_sma: ComputedVecsFromDateIndex::forced_import( path, &format!("{name}_ratio_1m_sma"), + true, version + VERSION + Version::ZERO, compressed, options, @@ -106,6 +111,7 @@ impl ComputedRatioVecsFromDateIndex { ratio_1y_sma: ComputedVecsFromDateIndex::forced_import( path, &format!("{name}_ratio_1y_sma"), + true, version + VERSION + Version::ZERO, compressed, options, @@ -113,6 +119,7 @@ impl ComputedRatioVecsFromDateIndex { ratio_1y_sma_momentum_oscillator: ComputedVecsFromDateIndex::forced_import( path, &format!("{name}_ratio_1y_sma_momentum_oscillator"), + true, version + VERSION + Version::ZERO, compressed, options, @@ -120,6 +127,7 @@ impl ComputedRatioVecsFromDateIndex { ratio_standard_deviation: ComputedVecsFromDateIndex::forced_import( path, &format!("{name}_ratio_standard_deviation"), + true, version + VERSION + Version::ZERO, compressed, options, @@ -127,6 +135,7 @@ impl ComputedRatioVecsFromDateIndex { ratio_p99_9: ComputedVecsFromDateIndex::forced_import( path, &format!("{name}_ratio_p99_9"), + true, version + VERSION + Version::ZERO, compressed, options, @@ -134,6 +143,7 @@ impl ComputedRatioVecsFromDateIndex { ratio_p99_5: ComputedVecsFromDateIndex::forced_import( path, &format!("{name}_ratio_p99_5"), + true, version + VERSION + Version::ZERO, compressed, options, @@ -141,6 +151,7 @@ impl ComputedRatioVecsFromDateIndex { ratio_p99: ComputedVecsFromDateIndex::forced_import( path, &format!("{name}_ratio_p99"), + true, version + VERSION + Version::ZERO, compressed, options, @@ -148,6 +159,7 @@ impl ComputedRatioVecsFromDateIndex { ratio_p1: ComputedVecsFromDateIndex::forced_import( path, &format!("{name}_ratio_p1"), + true, version + VERSION + Version::ZERO, compressed, options, @@ -155,6 +167,7 @@ impl ComputedRatioVecsFromDateIndex { ratio_p0_5: ComputedVecsFromDateIndex::forced_import( path, &format!("{name}_ratio_p0_5"), + true, version + VERSION + Version::ZERO, compressed, options, @@ -162,6 +175,7 @@ impl ComputedRatioVecsFromDateIndex { ratio_p0_1: ComputedVecsFromDateIndex::forced_import( path, &format!("{name}_ratio_p0_1"), + true, version + VERSION + Version::ZERO, compressed, options, @@ -169,6 +183,7 @@ impl ComputedRatioVecsFromDateIndex { ratio_p1sd: ComputedVecsFromDateIndex::forced_import( path, &format!("{name}_ratio_p1sd"), + true, version + VERSION + Version::ZERO, compressed, options, @@ -176,6 +191,7 @@ impl ComputedRatioVecsFromDateIndex { ratio_p2sd: ComputedVecsFromDateIndex::forced_import( path, &format!("{name}_ratio_p2sd"), + true, version + VERSION + Version::ZERO, compressed, options, @@ -183,6 +199,7 @@ impl ComputedRatioVecsFromDateIndex { ratio_p3sd: ComputedVecsFromDateIndex::forced_import( path, &format!("{name}_ratio_p3sd"), + true, version + VERSION + Version::ZERO, compressed, options, @@ -190,6 +207,7 @@ impl ComputedRatioVecsFromDateIndex { ratio_m1sd: ComputedVecsFromDateIndex::forced_import( path, &format!("{name}_ratio_m1sd"), + true, version + VERSION + Version::ZERO, compressed, options, @@ -197,6 +215,7 @@ impl ComputedRatioVecsFromDateIndex { ratio_m2sd: ComputedVecsFromDateIndex::forced_import( path, &format!("{name}_ratio_m2sd"), + true, version + VERSION + Version::ZERO, compressed, options, @@ -204,6 +223,7 @@ impl ComputedRatioVecsFromDateIndex { ratio_m3sd: ComputedVecsFromDateIndex::forced_import( path, &format!("{name}_ratio_m3sd"), + true, version + VERSION + Version::ZERO, compressed, options, @@ -211,6 +231,7 @@ impl ComputedRatioVecsFromDateIndex { ratio_p99_9_as_price: ComputedVecsFromDateIndex::forced_import( path, &format!("{name}_ratio_p99_9_as_price"), + true, version + VERSION + Version::ZERO, compressed, options, @@ -218,6 +239,7 @@ impl ComputedRatioVecsFromDateIndex { ratio_p99_5_as_price: ComputedVecsFromDateIndex::forced_import( path, &format!("{name}_ratio_p99_5_as_price"), + true, version + VERSION + Version::ZERO, compressed, options, @@ -225,6 +247,7 @@ impl ComputedRatioVecsFromDateIndex { ratio_p99_as_price: ComputedVecsFromDateIndex::forced_import( path, &format!("{name}_ratio_p99_as_price"), + true, version + VERSION + Version::ZERO, compressed, options, @@ -232,6 +255,7 @@ impl ComputedRatioVecsFromDateIndex { ratio_p1_as_price: ComputedVecsFromDateIndex::forced_import( path, &format!("{name}_ratio_p1_as_price"), + true, version + VERSION + Version::ZERO, compressed, options, @@ -239,6 +263,7 @@ impl ComputedRatioVecsFromDateIndex { ratio_p0_5_as_price: ComputedVecsFromDateIndex::forced_import( path, &format!("{name}_ratio_p0_5_as_price"), + true, version + VERSION + Version::ZERO, compressed, options, @@ -246,6 +271,7 @@ impl ComputedRatioVecsFromDateIndex { ratio_p0_1_as_price: ComputedVecsFromDateIndex::forced_import( path, &format!("{name}_ratio_p0_1_as_price"), + true, version + VERSION + Version::ZERO, compressed, options, @@ -253,6 +279,7 @@ impl ComputedRatioVecsFromDateIndex { ratio_p1sd_as_price: ComputedVecsFromDateIndex::forced_import( path, &format!("{name}_ratio_p1sd_as_price"), + true, version + VERSION + Version::ZERO, compressed, options, @@ -260,6 +287,7 @@ impl ComputedRatioVecsFromDateIndex { ratio_p2sd_as_price: ComputedVecsFromDateIndex::forced_import( path, &format!("{name}_ratio_p2sd_as_price"), + true, version + VERSION + Version::ZERO, compressed, options, @@ -267,6 +295,7 @@ impl ComputedRatioVecsFromDateIndex { ratio_p3sd_as_price: ComputedVecsFromDateIndex::forced_import( path, &format!("{name}_ratio_p3sd_as_price"), + true, version + VERSION + Version::ZERO, compressed, options, @@ -274,6 +303,7 @@ impl ComputedRatioVecsFromDateIndex { ratio_m1sd_as_price: ComputedVecsFromDateIndex::forced_import( path, &format!("{name}_ratio_m1sd_as_price"), + true, version + VERSION + Version::ZERO, compressed, options, @@ -281,6 +311,7 @@ impl ComputedRatioVecsFromDateIndex { ratio_m2sd_as_price: ComputedVecsFromDateIndex::forced_import( path, &format!("{name}_ratio_m2sd_as_price"), + true, version + VERSION + Version::ZERO, compressed, options, @@ -288,6 +319,7 @@ impl ComputedRatioVecsFromDateIndex { ratio_m3sd_as_price: ComputedVecsFromDateIndex::forced_import( path, &format!("{name}_ratio_m3sd_as_price"), + true, version + VERSION + Version::ZERO, compressed, options, @@ -295,6 +327,7 @@ impl ComputedRatioVecsFromDateIndex { ratio_zscore: ComputedVecsFromDateIndex::forced_import( path, &format!("{name}_ratio_zscore"), + true, version + VERSION + Version::ZERO, compressed, options, @@ -320,10 +353,13 @@ impl ComputedRatioVecsFromDateIndex { &Exit, ) -> Result<()>, { - self.price - .as_mut() - .unwrap() - .compute(indexer, indexes, starting_indexes, exit, compute)?; + self.price.as_mut().unwrap().compute_all( + indexer, + indexes, + starting_indexes, + exit, + compute, + )?; let date_to_price_opt: Option<&EagerVec> = None; self.compute_rest( @@ -349,9 +385,9 @@ impl ComputedRatioVecsFromDateIndex { std::mem::transmute(&self.price.as_ref().unwrap().dateindex) }); - let closes = &fetched.timeindexes_to_close.dateindex; + let closes = fetched.timeindexes_to_close.dateindex.as_ref().unwrap(); - self.ratio.compute( + self.ratio.compute_all( indexer, indexes, starting_indexes, @@ -376,7 +412,7 @@ impl ComputedRatioVecsFromDateIndex { let min_ratio_date = DateIndex::try_from(Date::MIN_RATIO).unwrap(); - self.ratio_sma.compute( + self.ratio_sma.compute_all( indexer, indexes, starting_indexes, @@ -384,7 +420,7 @@ impl ComputedRatioVecsFromDateIndex { |v, _, _, starting_indexes, exit| { v.compute_sma_( starting_indexes.dateindex, - &self.ratio.dateindex, + self.ratio.dateindex.as_ref().unwrap(), usize::MAX, exit, Some(min_ratio_date), @@ -392,7 +428,7 @@ impl ComputedRatioVecsFromDateIndex { }, )?; - self.ratio_1w_sma.compute( + self.ratio_1w_sma.compute_all( indexer, indexes, starting_indexes, @@ -400,7 +436,7 @@ impl ComputedRatioVecsFromDateIndex { |v, _, _, starting_indexes, exit| { v.compute_sma_( starting_indexes.dateindex, - &self.ratio.dateindex, + self.ratio.dateindex.as_ref().unwrap(), 7, exit, Some(min_ratio_date), @@ -408,7 +444,7 @@ impl ComputedRatioVecsFromDateIndex { }, )?; - self.ratio_1m_sma.compute( + self.ratio_1m_sma.compute_all( indexer, indexes, starting_indexes, @@ -416,7 +452,7 @@ impl ComputedRatioVecsFromDateIndex { |v, _, _, starting_indexes, exit| { v.compute_sma_( starting_indexes.dateindex, - &self.ratio.dateindex, + self.ratio.dateindex.as_ref().unwrap(), 30, exit, Some(min_ratio_date), @@ -424,7 +460,7 @@ impl ComputedRatioVecsFromDateIndex { }, )?; - self.ratio_1y_sma.compute( + self.ratio_1y_sma.compute_all( indexer, indexes, starting_indexes, @@ -432,7 +468,7 @@ impl ComputedRatioVecsFromDateIndex { |v, _, _, starting_indexes, exit| { v.compute_sma_( starting_indexes.dateindex, - &self.ratio.dateindex, + self.ratio.dateindex.as_ref().unwrap(), 365, exit, Some(min_ratio_date), @@ -440,16 +476,17 @@ impl ComputedRatioVecsFromDateIndex { }, )?; - self.ratio_1y_sma_momentum_oscillator.compute( + self.ratio_1y_sma_momentum_oscillator.compute_all( indexer, indexes, starting_indexes, exit, |v, _, _, starting_indexes, exit| { - let mut ratio_1y_sma_iter = self.ratio_1y_sma.dateindex.into_iter(); + let mut ratio_1y_sma_iter = + self.ratio_1y_sma.dateindex.as_ref().unwrap().into_iter(); v.compute_transform( starting_indexes.dateindex, - &self.ratio.dateindex, + self.ratio.dateindex.as_ref().unwrap(), |(i, ratio, ..)| { ( i, @@ -461,7 +498,7 @@ impl ComputedRatioVecsFromDateIndex { }, )?; - let ratio_version = self.ratio.dateindex.version(); + let ratio_version = self.ratio.dateindex.as_ref().unwrap().version(); self.mut_ratio_vecs() .iter_mut() .try_for_each(|v| -> Result<()> { @@ -478,7 +515,7 @@ impl ComputedRatioVecsFromDateIndex { .unwrap() .min(starting_indexes.dateindex); - let mut sorted = self.ratio.dateindex.collect_range( + let mut sorted = self.ratio.dateindex.as_ref().unwrap().collect_range( Some(min_ratio_date.unwrap_to_usize()), Some(starting_dateindex.unwrap_to_usize()), )?; @@ -489,68 +526,116 @@ impl ComputedRatioVecsFromDateIndex { // unreachable!(); // } - let mut sma_iter = self.ratio_sma.dateindex.into_iter(); + let mut sma_iter = self.ratio_sma.dateindex.as_ref().unwrap().into_iter(); let nan = StoredF32::from(f32::NAN); self.ratio .dateindex + .as_ref() + .unwrap() .iter_at(starting_dateindex) .try_for_each(|(index, ratio)| -> Result<()> { if index < min_ratio_date { - self.ratio_p0_1.dateindex.forced_push_at(index, nan, exit)?; - self.ratio_p0_5.dateindex.forced_push_at(index, nan, exit)?; - self.ratio_p1.dateindex.forced_push_at(index, nan, exit)?; - self.ratio_p99.dateindex.forced_push_at(index, nan, exit)?; + self.ratio_p0_1 + .dateindex + .as_mut() + .unwrap() + .forced_push_at(index, nan, exit)?; + self.ratio_p0_5 + .dateindex + .as_mut() + .unwrap() + .forced_push_at(index, nan, exit)?; + self.ratio_p1 + .dateindex + .as_mut() + .unwrap() + .forced_push_at(index, nan, exit)?; + self.ratio_p99 + .dateindex + .as_mut() + .unwrap() + .forced_push_at(index, nan, exit)?; self.ratio_p99_5 .dateindex + .as_mut() + .unwrap() .forced_push_at(index, nan, exit)?; self.ratio_p99_9 .dateindex + .as_mut() + .unwrap() .forced_push_at(index, nan, exit)?; self.ratio_standard_deviation .dateindex + .as_mut() + .unwrap() .forced_push_at(index, nan, exit)?; - self.ratio_p1sd.dateindex.forced_push_at(index, nan, exit)?; - self.ratio_p2sd.dateindex.forced_push_at(index, nan, exit)?; - self.ratio_p3sd.dateindex.forced_push_at(index, nan, exit)?; - self.ratio_m1sd.dateindex.forced_push_at(index, nan, exit)?; - self.ratio_m2sd.dateindex.forced_push_at(index, nan, exit)?; - self.ratio_m3sd.dateindex.forced_push_at(index, nan, exit)?; + self.ratio_p1sd + .dateindex + .as_mut() + .unwrap() + .forced_push_at(index, nan, exit)?; + self.ratio_p2sd + .dateindex + .as_mut() + .unwrap() + .forced_push_at(index, nan, exit)?; + self.ratio_p3sd + .dateindex + .as_mut() + .unwrap() + .forced_push_at(index, nan, exit)?; + self.ratio_m1sd + .dateindex + .as_mut() + .unwrap() + .forced_push_at(index, nan, exit)?; + self.ratio_m2sd + .dateindex + .as_mut() + .unwrap() + .forced_push_at(index, nan, exit)?; + self.ratio_m3sd + .dateindex + .as_mut() + .unwrap() + .forced_push_at(index, nan, exit)?; } else { let ratio = ratio.into_inner(); let pos = sorted.binary_search(&ratio).unwrap_or_else(|pos| pos); sorted.insert(pos, ratio); - self.ratio_p0_1.dateindex.forced_push_at( + self.ratio_p0_1.dateindex.as_mut().unwrap().forced_push_at( index, get_percentile(&sorted, 0.001), exit, )?; - self.ratio_p0_5.dateindex.forced_push_at( + self.ratio_p0_5.dateindex.as_mut().unwrap().forced_push_at( index, get_percentile(&sorted, 0.005), exit, )?; - self.ratio_p1.dateindex.forced_push_at( + self.ratio_p1.dateindex.as_mut().unwrap().forced_push_at( index, get_percentile(&sorted, 0.01), exit, )?; - self.ratio_p99.dateindex.forced_push_at( + self.ratio_p99.dateindex.as_mut().unwrap().forced_push_at( index, get_percentile(&sorted, 0.99), exit, )?; - self.ratio_p99_5.dateindex.forced_push_at( - index, - get_percentile(&sorted, 0.995), - exit, - )?; - self.ratio_p99_9.dateindex.forced_push_at( - index, - get_percentile(&sorted, 0.999), - exit, - )?; + self.ratio_p99_5 + .dateindex + .as_mut() + .unwrap() + .forced_push_at(index, get_percentile(&sorted, 0.995), exit)?; + self.ratio_p99_9 + .dateindex + .as_mut() + .unwrap() + .forced_push_at(index, get_percentile(&sorted, 0.999), exit)?; let avg = sma_iter.unwrap_get_inner(index); @@ -562,26 +647,40 @@ impl ComputedRatioVecsFromDateIndex { self.ratio_standard_deviation .dateindex + .as_mut() + .unwrap() .forced_push_at(index, sd, exit)?; - self.ratio_p1sd - .dateindex - .forced_push_at(index, avg + sd, exit)?; - self.ratio_p2sd - .dateindex - .forced_push_at(index, avg + 2 * sd, exit)?; - self.ratio_p3sd - .dateindex - .forced_push_at(index, avg + 3 * sd, exit)?; - self.ratio_m1sd - .dateindex - .forced_push_at(index, avg - sd, exit)?; - self.ratio_m2sd - .dateindex - .forced_push_at(index, avg - 2 * sd, exit)?; - self.ratio_m3sd - .dateindex - .forced_push_at(index, avg - 3 * sd, exit)?; + self.ratio_p1sd.dateindex.as_mut().unwrap().forced_push_at( + index, + avg + sd, + exit, + )?; + self.ratio_p2sd.dateindex.as_mut().unwrap().forced_push_at( + index, + avg + 2 * sd, + exit, + )?; + self.ratio_p3sd.dateindex.as_mut().unwrap().forced_push_at( + index, + avg + 3 * sd, + exit, + )?; + self.ratio_m1sd.dateindex.as_mut().unwrap().forced_push_at( + index, + avg - sd, + exit, + )?; + self.ratio_m2sd.dateindex.as_mut().unwrap().forced_push_at( + index, + avg - 2 * sd, + exit, + )?; + self.ratio_m3sd.dateindex.as_mut().unwrap().forced_push_at( + index, + avg - 3 * sd, + exit, + )?; } Ok(()) @@ -591,44 +690,96 @@ impl ComputedRatioVecsFromDateIndex { .into_iter() .try_for_each(|v| v.safe_flush(exit))?; - self.ratio_p99_9 - .compute_rest(indexes, starting_indexes, exit)?; - self.ratio_p99_5 - .compute_rest(indexes, starting_indexes, exit)?; - self.ratio_p99 - .compute_rest(indexes, starting_indexes, exit)?; - self.ratio_p1 - .compute_rest(indexes, starting_indexes, exit)?; - self.ratio_p0_5 - .compute_rest(indexes, starting_indexes, exit)?; - self.ratio_p0_1 - .compute_rest(indexes, starting_indexes, exit)?; - self.ratio_standard_deviation - .compute_rest(indexes, starting_indexes, exit)?; - self.ratio_p1sd - .compute_rest(indexes, starting_indexes, exit)?; - self.ratio_p2sd - .compute_rest(indexes, starting_indexes, exit)?; - self.ratio_p3sd - .compute_rest(indexes, starting_indexes, exit)?; - self.ratio_m1sd - .compute_rest(indexes, starting_indexes, exit)?; - self.ratio_m2sd - .compute_rest(indexes, starting_indexes, exit)?; - self.ratio_m3sd - .compute_rest(indexes, starting_indexes, exit)?; + self.ratio_p99_9.compute_rest( + indexes, + starting_indexes, + exit, + None as Option<&EagerVec<_, _>>, + )?; + self.ratio_p99_5.compute_rest( + indexes, + starting_indexes, + exit, + None as Option<&EagerVec<_, _>>, + )?; + self.ratio_p99.compute_rest( + indexes, + starting_indexes, + exit, + None as Option<&EagerVec<_, _>>, + )?; + self.ratio_p1.compute_rest( + indexes, + starting_indexes, + exit, + None as Option<&EagerVec<_, _>>, + )?; + self.ratio_p0_5.compute_rest( + indexes, + starting_indexes, + exit, + None as Option<&EagerVec<_, _>>, + )?; + self.ratio_p0_1.compute_rest( + indexes, + starting_indexes, + exit, + None as Option<&EagerVec<_, _>>, + )?; + self.ratio_standard_deviation.compute_rest( + indexes, + starting_indexes, + exit, + None as Option<&EagerVec<_, _>>, + )?; + self.ratio_p1sd.compute_rest( + indexes, + starting_indexes, + exit, + None as Option<&EagerVec<_, _>>, + )?; + self.ratio_p2sd.compute_rest( + indexes, + starting_indexes, + exit, + None as Option<&EagerVec<_, _>>, + )?; + self.ratio_p3sd.compute_rest( + indexes, + starting_indexes, + exit, + None as Option<&EagerVec<_, _>>, + )?; + self.ratio_m1sd.compute_rest( + indexes, + starting_indexes, + exit, + None as Option<&EagerVec<_, _>>, + )?; + self.ratio_m2sd.compute_rest( + indexes, + starting_indexes, + exit, + None as Option<&EagerVec<_, _>>, + )?; + self.ratio_m3sd.compute_rest( + indexes, + starting_indexes, + exit, + None as Option<&EagerVec<_, _>>, + )?; let date_to_price = date_to_price_opt.unwrap_or_else(|| unsafe { std::mem::transmute(&self.price.as_ref().unwrap().dateindex) }); - self.ratio_p99_as_price.compute( + self.ratio_p99_as_price.compute_all( indexer, indexes, starting_indexes, exit, |vec, _, _, starting_indexes, exit| { - let mut iter = self.ratio_p99.dateindex.into_iter(); + let mut iter = self.ratio_p99.dateindex.as_ref().unwrap().into_iter(); vec.compute_transform( starting_indexes.dateindex, date_to_price, @@ -641,13 +792,13 @@ impl ComputedRatioVecsFromDateIndex { }, )?; - self.ratio_p99_5_as_price.compute( + self.ratio_p99_5_as_price.compute_all( indexer, indexes, starting_indexes, exit, |vec, _, _, starting_indexes, exit| { - let mut iter = self.ratio_p99_5.dateindex.into_iter(); + let mut iter = self.ratio_p99_5.dateindex.as_ref().unwrap().into_iter(); vec.compute_transform( starting_indexes.dateindex, date_to_price, @@ -660,13 +811,13 @@ impl ComputedRatioVecsFromDateIndex { }, )?; - self.ratio_p99_9_as_price.compute( + self.ratio_p99_9_as_price.compute_all( indexer, indexes, starting_indexes, exit, |vec, _, _, starting_indexes, exit| { - let mut iter = self.ratio_p99_9.dateindex.into_iter(); + let mut iter = self.ratio_p99_9.dateindex.as_ref().unwrap().into_iter(); vec.compute_transform( starting_indexes.dateindex, date_to_price, @@ -679,13 +830,13 @@ impl ComputedRatioVecsFromDateIndex { }, )?; - self.ratio_p1_as_price.compute( + self.ratio_p1_as_price.compute_all( indexer, indexes, starting_indexes, exit, |vec, _, _, starting_indexes, exit| { - let mut iter = self.ratio_p1.dateindex.into_iter(); + let mut iter = self.ratio_p1.dateindex.as_ref().unwrap().into_iter(); vec.compute_transform( starting_indexes.dateindex, date_to_price, @@ -698,13 +849,13 @@ impl ComputedRatioVecsFromDateIndex { }, )?; - self.ratio_p0_5_as_price.compute( + self.ratio_p0_5_as_price.compute_all( indexer, indexes, starting_indexes, exit, |vec, _, _, starting_indexes, exit| { - let mut iter = self.ratio_p0_5.dateindex.into_iter(); + let mut iter = self.ratio_p0_5.dateindex.as_ref().unwrap().into_iter(); vec.compute_transform( starting_indexes.dateindex, date_to_price, @@ -717,13 +868,13 @@ impl ComputedRatioVecsFromDateIndex { }, )?; - self.ratio_p0_1_as_price.compute( + self.ratio_p0_1_as_price.compute_all( indexer, indexes, starting_indexes, exit, |vec, _, _, starting_indexes, exit| { - let mut iter = self.ratio_p0_1.dateindex.into_iter(); + let mut iter = self.ratio_p0_1.dateindex.as_ref().unwrap().into_iter(); vec.compute_transform( starting_indexes.dateindex, date_to_price, @@ -736,13 +887,13 @@ impl ComputedRatioVecsFromDateIndex { }, )?; - self.ratio_p1sd_as_price.compute( + self.ratio_p1sd_as_price.compute_all( indexer, indexes, starting_indexes, exit, |vec, _, _, starting_indexes, exit| { - let mut iter = self.ratio_p1sd.dateindex.into_iter(); + let mut iter = self.ratio_p1sd.dateindex.as_ref().unwrap().into_iter(); vec.compute_transform( starting_indexes.dateindex, date_to_price, @@ -755,13 +906,13 @@ impl ComputedRatioVecsFromDateIndex { }, )?; - self.ratio_p2sd_as_price.compute( + self.ratio_p2sd_as_price.compute_all( indexer, indexes, starting_indexes, exit, |vec, _, _, starting_indexes, exit| { - let mut iter = self.ratio_p2sd.dateindex.into_iter(); + let mut iter = self.ratio_p2sd.dateindex.as_ref().unwrap().into_iter(); vec.compute_transform( starting_indexes.dateindex, date_to_price, @@ -774,13 +925,13 @@ impl ComputedRatioVecsFromDateIndex { }, )?; - self.ratio_p3sd_as_price.compute( + self.ratio_p3sd_as_price.compute_all( indexer, indexes, starting_indexes, exit, |vec, _, _, starting_indexes, exit| { - let mut iter = self.ratio_p3sd.dateindex.into_iter(); + let mut iter = self.ratio_p3sd.dateindex.as_ref().unwrap().into_iter(); vec.compute_transform( starting_indexes.dateindex, date_to_price, @@ -793,13 +944,13 @@ impl ComputedRatioVecsFromDateIndex { }, )?; - self.ratio_m1sd_as_price.compute( + self.ratio_m1sd_as_price.compute_all( indexer, indexes, starting_indexes, exit, |vec, _, _, starting_indexes, exit| { - let mut iter = self.ratio_m1sd.dateindex.into_iter(); + let mut iter = self.ratio_m1sd.dateindex.as_ref().unwrap().into_iter(); vec.compute_transform( starting_indexes.dateindex, date_to_price, @@ -812,13 +963,13 @@ impl ComputedRatioVecsFromDateIndex { }, )?; - self.ratio_m2sd_as_price.compute( + self.ratio_m2sd_as_price.compute_all( indexer, indexes, starting_indexes, exit, |vec, _, _, starting_indexes, exit| { - let mut iter = self.ratio_m2sd.dateindex.into_iter(); + let mut iter = self.ratio_m2sd.dateindex.as_ref().unwrap().into_iter(); vec.compute_transform( starting_indexes.dateindex, date_to_price, @@ -831,13 +982,13 @@ impl ComputedRatioVecsFromDateIndex { }, )?; - self.ratio_m3sd_as_price.compute( + self.ratio_m3sd_as_price.compute_all( indexer, indexes, starting_indexes, exit, |vec, _, _, starting_indexes, exit| { - let mut iter = self.ratio_m3sd.dateindex.into_iter(); + let mut iter = self.ratio_m3sd.dateindex.as_ref().unwrap().into_iter(); vec.compute_transform( starting_indexes.dateindex, date_to_price, @@ -850,17 +1001,22 @@ impl ComputedRatioVecsFromDateIndex { }, )?; - self.ratio_zscore.compute( + self.ratio_zscore.compute_all( indexer, indexes, starting_indexes, exit, |vec, _, _, starting_indexes, exit| { - let mut sma_iter = self.ratio_sma.dateindex.into_iter(); - let mut sd_iter = self.ratio_standard_deviation.dateindex.into_iter(); + let mut sma_iter = self.ratio_sma.dateindex.as_ref().unwrap().into_iter(); + let mut sd_iter = self + .ratio_standard_deviation + .dateindex + .as_ref() + .unwrap() + .into_iter(); vec.compute_transform( starting_indexes.dateindex, - &self.ratio.dateindex, + self.ratio.dateindex.as_ref().unwrap(), |(i, ratio, ..)| { let sma = sma_iter.unwrap_get_inner(i); let sd = sd_iter.unwrap_get_inner(i); @@ -876,19 +1032,19 @@ impl ComputedRatioVecsFromDateIndex { fn mut_ratio_vecs(&mut self) -> Vec<&mut EagerVec> { vec![ - &mut self.ratio_standard_deviation.dateindex, - &mut self.ratio_p99_9.dateindex, - &mut self.ratio_p99_5.dateindex, - &mut self.ratio_p99.dateindex, - &mut self.ratio_p1.dateindex, - &mut self.ratio_p0_5.dateindex, - &mut self.ratio_p0_1.dateindex, - &mut self.ratio_p1sd.dateindex, - &mut self.ratio_p2sd.dateindex, - &mut self.ratio_p3sd.dateindex, - &mut self.ratio_m1sd.dateindex, - &mut self.ratio_m2sd.dateindex, - &mut self.ratio_m3sd.dateindex, + self.ratio_standard_deviation.dateindex.as_mut().unwrap(), + self.ratio_p99_9.dateindex.as_mut().unwrap(), + self.ratio_p99_5.dateindex.as_mut().unwrap(), + self.ratio_p99.dateindex.as_mut().unwrap(), + self.ratio_p1.dateindex.as_mut().unwrap(), + self.ratio_p0_5.dateindex.as_mut().unwrap(), + self.ratio_p0_1.dateindex.as_mut().unwrap(), + self.ratio_p1sd.dateindex.as_mut().unwrap(), + self.ratio_p2sd.dateindex.as_mut().unwrap(), + self.ratio_p3sd.dateindex.as_mut().unwrap(), + self.ratio_m1sd.dateindex.as_mut().unwrap(), + self.ratio_m2sd.dateindex.as_mut().unwrap(), + self.ratio_m3sd.dateindex.as_mut().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 a627b2f95..cd228821d 100644 --- a/crates/brk_computer/src/vecs/grouped/value_from_height.rs +++ b/crates/brk_computer/src/vecs/grouped/value_from_height.rs @@ -127,14 +127,14 @@ impl ComputedValueVecsFromHeight { |v, _, _, starting_indexes, exit| { v.compute_from_sats( starting_indexes.height, - self.sats.height.as_ref().unwrap().as_ref(), + self.sats.height.as_ref().unwrap(), exit, ) }, )?; } - let height_to_bitcoin = self.bitcoin.height.as_ref().unwrap().as_ref(); + let height_to_bitcoin = self.bitcoin.height.as_ref().unwrap(); let height_to_close = &fetched.as_ref().unwrap().chainindexes_to_close.height; if let Some(dollars) = self.dollars.as_mut() { diff --git a/crates/brk_computer/src/vecs/market.rs b/crates/brk_computer/src/vecs/market.rs index 8da981bdc..9c3e3bbe2 100644 --- a/crates/brk_computer/src/vecs/market.rs +++ b/crates/brk_computer/src/vecs/market.rs @@ -167,6 +167,7 @@ impl Vecs { indexes_to_marketcap: ComputedVecsFromDateIndex::forced_import( path, "marketcap", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -174,6 +175,7 @@ impl Vecs { indexes_to_ath: ComputedVecsFromDateIndex::forced_import( path, "ath", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -181,6 +183,7 @@ impl Vecs { indexes_to_drawdown: ComputedVecsFromDateIndex::forced_import( path, "drawdown", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -188,6 +191,7 @@ impl Vecs { indexes_to_days_since_ath: ComputedVecsFromDateIndex::forced_import( path, "days_since_ath", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -195,6 +199,7 @@ impl Vecs { indexes_to_max_days_between_ath: ComputedVecsFromDateIndex::forced_import( path, "max_days_between_ath", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -202,6 +207,7 @@ impl Vecs { indexes_to_max_years_between_ath: ComputedVecsFromDateIndex::forced_import( path, "max_years_between_ath", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -315,6 +321,7 @@ impl Vecs { _1d_returns: ComputedVecsFromDateIndex::forced_import( path, "1d_returns", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -322,6 +329,7 @@ impl Vecs { _1w_returns: ComputedVecsFromDateIndex::forced_import( path, "1w_returns", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -329,6 +337,7 @@ impl Vecs { _1m_returns: ComputedVecsFromDateIndex::forced_import( path, "1m_returns", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -336,6 +345,7 @@ impl Vecs { _3m_returns: ComputedVecsFromDateIndex::forced_import( path, "3m_returns", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -343,6 +353,7 @@ impl Vecs { _6m_returns: ComputedVecsFromDateIndex::forced_import( path, "6m_returns", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -350,6 +361,7 @@ impl Vecs { _1y_returns: ComputedVecsFromDateIndex::forced_import( path, "1y_returns", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -357,6 +369,7 @@ impl Vecs { _2y_returns: ComputedVecsFromDateIndex::forced_import( path, "2y_returns", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -364,6 +377,7 @@ impl Vecs { _3y_returns: ComputedVecsFromDateIndex::forced_import( path, "3y_returns", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -371,6 +385,7 @@ impl Vecs { _4y_returns: ComputedVecsFromDateIndex::forced_import( path, "4y_returns", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -378,6 +393,7 @@ impl Vecs { _5y_returns: ComputedVecsFromDateIndex::forced_import( path, "5y_returns", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -385,6 +401,7 @@ impl Vecs { _6y_returns: ComputedVecsFromDateIndex::forced_import( path, "6y_returns", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -392,6 +409,7 @@ impl Vecs { _8y_returns: ComputedVecsFromDateIndex::forced_import( path, "8y_returns", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -399,6 +417,7 @@ impl Vecs { _10y_returns: ComputedVecsFromDateIndex::forced_import( path, "10y_returns", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -406,6 +425,7 @@ impl Vecs { _2y_cagr: ComputedVecsFromDateIndex::forced_import( path, "2y_cagr", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -413,6 +433,7 @@ impl Vecs { _3y_cagr: ComputedVecsFromDateIndex::forced_import( path, "3y_cagr", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -420,6 +441,7 @@ impl Vecs { _4y_cagr: ComputedVecsFromDateIndex::forced_import( path, "4y_cagr", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -427,6 +449,7 @@ impl Vecs { _5y_cagr: ComputedVecsFromDateIndex::forced_import( path, "5y_cagr", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -434,6 +457,7 @@ impl Vecs { _6y_cagr: ComputedVecsFromDateIndex::forced_import( path, "6y_cagr", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -441,6 +465,7 @@ impl Vecs { _8y_cagr: ComputedVecsFromDateIndex::forced_import( path, "8y_cagr", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -448,6 +473,7 @@ impl Vecs { _10y_cagr: ComputedVecsFromDateIndex::forced_import( path, "10y_cagr", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -456,6 +482,7 @@ impl Vecs { _1w_dca_returns: ComputedVecsFromDateIndex::forced_import( path, "1w_dca_returns", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -463,6 +490,7 @@ impl Vecs { _1m_dca_returns: ComputedVecsFromDateIndex::forced_import( path, "1m_dca_returns", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -470,6 +498,7 @@ impl Vecs { _3m_dca_returns: ComputedVecsFromDateIndex::forced_import( path, "3m_dca_returns", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -477,6 +506,7 @@ impl Vecs { _6m_dca_returns: ComputedVecsFromDateIndex::forced_import( path, "6m_dca_returns", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -484,6 +514,7 @@ impl Vecs { _1y_dca_returns: ComputedVecsFromDateIndex::forced_import( path, "1y_dca_returns", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -491,6 +522,7 @@ impl Vecs { _2y_dca_returns: ComputedVecsFromDateIndex::forced_import( path, "2y_dca_returns", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -498,6 +530,7 @@ impl Vecs { _3y_dca_returns: ComputedVecsFromDateIndex::forced_import( path, "3y_dca_returns", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -505,6 +538,7 @@ impl Vecs { _4y_dca_returns: ComputedVecsFromDateIndex::forced_import( path, "4y_dca_returns", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -512,6 +546,7 @@ impl Vecs { _5y_dca_returns: ComputedVecsFromDateIndex::forced_import( path, "5y_dca_returns", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -519,6 +554,7 @@ impl Vecs { _6y_dca_returns: ComputedVecsFromDateIndex::forced_import( path, "6y_dca_returns", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -526,6 +562,7 @@ impl Vecs { _8y_dca_returns: ComputedVecsFromDateIndex::forced_import( path, "8y_dca_returns", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -533,6 +570,7 @@ impl Vecs { _10y_dca_returns: ComputedVecsFromDateIndex::forced_import( path, "10y_dca_returns", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -540,6 +578,7 @@ impl Vecs { _2y_dca_cagr: ComputedVecsFromDateIndex::forced_import( path, "2y_dca_cagr", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -547,6 +586,7 @@ impl Vecs { _3y_dca_cagr: ComputedVecsFromDateIndex::forced_import( path, "3y_dca_cagr", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -554,6 +594,7 @@ impl Vecs { _4y_dca_cagr: ComputedVecsFromDateIndex::forced_import( path, "4y_dca_cagr", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -561,6 +602,7 @@ impl Vecs { _5y_dca_cagr: ComputedVecsFromDateIndex::forced_import( path, "5y_dca_cagr", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -568,6 +610,7 @@ impl Vecs { _6y_dca_cagr: ComputedVecsFromDateIndex::forced_import( path, "6y_dca_cagr", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -575,6 +618,7 @@ impl Vecs { _8y_dca_cagr: ComputedVecsFromDateIndex::forced_import( path, "8y_dca_cagr", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -582,6 +626,7 @@ impl Vecs { _10y_dca_cagr: ComputedVecsFromDateIndex::forced_import( path, "10y_dca_cagr", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -589,6 +634,7 @@ impl Vecs { _1w_dca_avg_price: ComputedVecsFromDateIndex::forced_import( path, "1w_dca_avg_price", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -596,6 +642,7 @@ impl Vecs { _1m_dca_avg_price: ComputedVecsFromDateIndex::forced_import( path, "1m_dca_avg_price", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -603,6 +650,7 @@ impl Vecs { _3m_dca_avg_price: ComputedVecsFromDateIndex::forced_import( path, "3m_dca_avg_price", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -610,6 +658,7 @@ impl Vecs { _6m_dca_avg_price: ComputedVecsFromDateIndex::forced_import( path, "6m_dca_avg_price", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -617,6 +666,7 @@ impl Vecs { _1y_dca_avg_price: ComputedVecsFromDateIndex::forced_import( path, "1y_dca_avg_price", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -624,6 +674,7 @@ impl Vecs { _2y_dca_avg_price: ComputedVecsFromDateIndex::forced_import( path, "2y_dca_avg_price", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -631,6 +682,7 @@ impl Vecs { _3y_dca_avg_price: ComputedVecsFromDateIndex::forced_import( path, "3y_dca_avg_price", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -638,6 +690,7 @@ impl Vecs { _4y_dca_avg_price: ComputedVecsFromDateIndex::forced_import( path, "4y_dca_avg_price", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -645,6 +698,7 @@ impl Vecs { _5y_dca_avg_price: ComputedVecsFromDateIndex::forced_import( path, "5y_dca_avg_price", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -652,6 +706,7 @@ impl Vecs { _6y_dca_avg_price: ComputedVecsFromDateIndex::forced_import( path, "6y_dca_avg_price", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -659,6 +714,7 @@ impl Vecs { _8y_dca_avg_price: ComputedVecsFromDateIndex::forced_import( path, "8y_dca_avg_price", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -666,6 +722,7 @@ impl Vecs { _10y_dca_avg_price: ComputedVecsFromDateIndex::forced_import( path, "10y_dca_avg_price", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -673,6 +730,7 @@ impl Vecs { price_1d_ago: ComputedVecsFromDateIndex::forced_import( path, "price_1d_ago", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -680,6 +738,7 @@ impl Vecs { price_1w_ago: ComputedVecsFromDateIndex::forced_import( path, "price_1w_ago", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -687,6 +746,7 @@ impl Vecs { price_1m_ago: ComputedVecsFromDateIndex::forced_import( path, "price_1m_ago", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -694,6 +754,7 @@ impl Vecs { price_3m_ago: ComputedVecsFromDateIndex::forced_import( path, "price_3m_ago", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -701,6 +762,7 @@ impl Vecs { price_6m_ago: ComputedVecsFromDateIndex::forced_import( path, "price_6m_ago", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -708,6 +770,7 @@ impl Vecs { price_1y_ago: ComputedVecsFromDateIndex::forced_import( path, "price_1y_ago", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -715,6 +778,7 @@ impl Vecs { price_2y_ago: ComputedVecsFromDateIndex::forced_import( path, "price_2y_ago", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -722,6 +786,7 @@ impl Vecs { price_3y_ago: ComputedVecsFromDateIndex::forced_import( path, "price_3y_ago", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -729,6 +794,7 @@ impl Vecs { price_4y_ago: ComputedVecsFromDateIndex::forced_import( path, "price_4y_ago", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -736,6 +802,7 @@ impl Vecs { price_5y_ago: ComputedVecsFromDateIndex::forced_import( path, "price_5y_ago", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -743,6 +810,7 @@ impl Vecs { price_6y_ago: ComputedVecsFromDateIndex::forced_import( path, "price_6y_ago", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -750,6 +818,7 @@ impl Vecs { price_8y_ago: ComputedVecsFromDateIndex::forced_import( path, "price_8y_ago", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -757,6 +826,7 @@ impl Vecs { price_10y_ago: ComputedVecsFromDateIndex::forced_import( path, "price_10y_ago", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -764,6 +834,7 @@ impl Vecs { _1w_dca_stack: ComputedVecsFromDateIndex::forced_import( path, "1w_dca_stack", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -771,6 +842,7 @@ impl Vecs { _1m_dca_stack: ComputedVecsFromDateIndex::forced_import( path, "1m_dca_stack", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -778,6 +850,7 @@ impl Vecs { _3m_dca_stack: ComputedVecsFromDateIndex::forced_import( path, "3m_dca_stack", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -785,6 +858,7 @@ impl Vecs { _6m_dca_stack: ComputedVecsFromDateIndex::forced_import( path, "6m_dca_stack", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -792,6 +866,7 @@ impl Vecs { _1y_dca_stack: ComputedVecsFromDateIndex::forced_import( path, "1y_dca_stack", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -799,6 +874,7 @@ impl Vecs { _2y_dca_stack: ComputedVecsFromDateIndex::forced_import( path, "2y_dca_stack", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -806,6 +882,7 @@ impl Vecs { _3y_dca_stack: ComputedVecsFromDateIndex::forced_import( path, "3y_dca_stack", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -813,6 +890,7 @@ impl Vecs { _4y_dca_stack: ComputedVecsFromDateIndex::forced_import( path, "4y_dca_stack", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -820,6 +898,7 @@ impl Vecs { _5y_dca_stack: ComputedVecsFromDateIndex::forced_import( path, "5y_dca_stack", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -827,6 +906,7 @@ impl Vecs { _6y_dca_stack: ComputedVecsFromDateIndex::forced_import( path, "6y_dca_stack", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -834,6 +914,7 @@ impl Vecs { _8y_dca_stack: ComputedVecsFromDateIndex::forced_import( path, "8y_dca_stack", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -841,6 +922,7 @@ impl Vecs { _10y_dca_stack: ComputedVecsFromDateIndex::forced_import( path, "10y_dca_stack", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -849,6 +931,7 @@ impl Vecs { dca_class_2025_stack: ComputedVecsFromDateIndex::forced_import( path, "dca_class_2025_stack", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -856,6 +939,7 @@ impl Vecs { dca_class_2024_stack: ComputedVecsFromDateIndex::forced_import( path, "dca_class_2024_stack", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -863,6 +947,7 @@ impl Vecs { dca_class_2023_stack: ComputedVecsFromDateIndex::forced_import( path, "dca_class_2023_stack", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -870,6 +955,7 @@ impl Vecs { dca_class_2022_stack: ComputedVecsFromDateIndex::forced_import( path, "dca_class_2022_stack", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -877,6 +963,7 @@ impl Vecs { dca_class_2021_stack: ComputedVecsFromDateIndex::forced_import( path, "dca_class_2021_stack", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -884,6 +971,7 @@ impl Vecs { dca_class_2020_stack: ComputedVecsFromDateIndex::forced_import( path, "dca_class_2020_stack", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -891,6 +979,7 @@ impl Vecs { dca_class_2019_stack: ComputedVecsFromDateIndex::forced_import( path, "dca_class_2019_stack", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -898,6 +987,7 @@ impl Vecs { dca_class_2018_stack: ComputedVecsFromDateIndex::forced_import( path, "dca_class_2018_stack", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -905,6 +995,7 @@ impl Vecs { dca_class_2017_stack: ComputedVecsFromDateIndex::forced_import( path, "dca_class_2017_stack", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -912,6 +1003,7 @@ impl Vecs { dca_class_2016_stack: ComputedVecsFromDateIndex::forced_import( path, "dca_class_2016_stack", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -919,6 +1011,7 @@ impl Vecs { dca_class_2015_stack: ComputedVecsFromDateIndex::forced_import( path, "dca_class_2015_stack", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -927,6 +1020,7 @@ impl Vecs { dca_class_2025_avg_price: ComputedVecsFromDateIndex::forced_import( path, "dca_class_2025_avg_price", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -934,6 +1028,7 @@ impl Vecs { dca_class_2024_avg_price: ComputedVecsFromDateIndex::forced_import( path, "dca_class_2024_avg_price", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -941,6 +1036,7 @@ impl Vecs { dca_class_2023_avg_price: ComputedVecsFromDateIndex::forced_import( path, "dca_class_2023_avg_price", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -948,6 +1044,7 @@ impl Vecs { dca_class_2022_avg_price: ComputedVecsFromDateIndex::forced_import( path, "dca_class_2022_avg_price", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -955,6 +1052,7 @@ impl Vecs { dca_class_2021_avg_price: ComputedVecsFromDateIndex::forced_import( path, "dca_class_2021_avg_price", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -962,6 +1060,7 @@ impl Vecs { dca_class_2020_avg_price: ComputedVecsFromDateIndex::forced_import( path, "dca_class_2020_avg_price", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -969,6 +1068,7 @@ impl Vecs { dca_class_2019_avg_price: ComputedVecsFromDateIndex::forced_import( path, "dca_class_2019_avg_price", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -976,6 +1076,7 @@ impl Vecs { dca_class_2018_avg_price: ComputedVecsFromDateIndex::forced_import( path, "dca_class_2018_avg_price", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -983,6 +1084,7 @@ impl Vecs { dca_class_2017_avg_price: ComputedVecsFromDateIndex::forced_import( path, "dca_class_2017_avg_price", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -990,6 +1092,7 @@ impl Vecs { dca_class_2016_avg_price: ComputedVecsFromDateIndex::forced_import( path, "dca_class_2016_avg_price", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -997,6 +1100,7 @@ impl Vecs { dca_class_2015_avg_price: ComputedVecsFromDateIndex::forced_import( path, "dca_class_2015_avg_price", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -1005,6 +1109,7 @@ impl Vecs { dca_class_2025_returns: ComputedVecsFromDateIndex::forced_import( path, "dca_class_2025_returns", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -1012,6 +1117,7 @@ impl Vecs { dca_class_2024_returns: ComputedVecsFromDateIndex::forced_import( path, "dca_class_2024_returns", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -1019,6 +1125,7 @@ impl Vecs { dca_class_2023_returns: ComputedVecsFromDateIndex::forced_import( path, "dca_class_2023_returns", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -1026,6 +1133,7 @@ impl Vecs { dca_class_2022_returns: ComputedVecsFromDateIndex::forced_import( path, "dca_class_2022_returns", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -1033,6 +1141,7 @@ impl Vecs { dca_class_2021_returns: ComputedVecsFromDateIndex::forced_import( path, "dca_class_2021_returns", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -1040,6 +1149,7 @@ impl Vecs { dca_class_2020_returns: ComputedVecsFromDateIndex::forced_import( path, "dca_class_2020_returns", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -1047,6 +1157,7 @@ impl Vecs { dca_class_2019_returns: ComputedVecsFromDateIndex::forced_import( path, "dca_class_2019_returns", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -1054,6 +1165,7 @@ impl Vecs { dca_class_2018_returns: ComputedVecsFromDateIndex::forced_import( path, "dca_class_2018_returns", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -1061,6 +1173,7 @@ impl Vecs { dca_class_2017_returns: ComputedVecsFromDateIndex::forced_import( path, "dca_class_2017_returns", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -1068,6 +1181,7 @@ impl Vecs { dca_class_2016_returns: ComputedVecsFromDateIndex::forced_import( path, "dca_class_2016_returns", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -1075,6 +1189,7 @@ impl Vecs { dca_class_2015_returns: ComputedVecsFromDateIndex::forced_import( path, "dca_class_2015_returns", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -1091,7 +1206,7 @@ impl Vecs { starting_indexes: &Indexes, exit: &Exit, ) -> color_eyre::Result<()> { - self.indexes_to_marketcap.compute( + self.indexes_to_marketcap.compute_all( indexer, indexes, starting_indexes, @@ -1105,7 +1220,7 @@ impl Vecs { .into_iter(); v.compute_transform( starting_indexes.dateindex, - &fetched.timeindexes_to_close.dateindex, + fetched.timeindexes_to_close.dateindex.as_ref().unwrap(), |(i, close, ..)| { let supply = cumulative_subsidy_in_btc.unwrap_get_inner(i); (i, *close * supply) @@ -1115,7 +1230,7 @@ impl Vecs { }, )?; - self.indexes_to_ath.compute( + self.indexes_to_ath.compute_all( indexer, indexes, starting_indexes, @@ -1124,7 +1239,7 @@ impl Vecs { let mut prev = None; v.compute_transform( starting_indexes.dateindex, - &fetched.timeindexes_to_high.dateindex, + fetched.timeindexes_to_high.dateindex.as_ref().unwrap(), |(i, high, slf)| { if prev.is_none() { let i = i.unwrap_to_usize(); @@ -1143,17 +1258,22 @@ impl Vecs { }, )?; - self.indexes_to_drawdown.compute( + self.indexes_to_drawdown.compute_all( indexer, indexes, starting_indexes, exit, |v, _, _, starting_indexes, exit| { - let mut close_iter = fetched.timeindexes_to_close.dateindex.into_iter(); + let mut close_iter = fetched + .timeindexes_to_close + .dateindex + .as_ref() + .unwrap() + .into_iter(); v.compute_transform( starting_indexes.dateindex, - &self.indexes_to_ath.dateindex, + self.indexes_to_ath.dateindex.as_ref().unwrap(), |(i, ath, ..)| { if ath == Dollars::ZERO { return (i, StoredF32::default()); @@ -1167,17 +1287,22 @@ impl Vecs { }, )?; - self.indexes_to_days_since_ath.compute( + self.indexes_to_days_since_ath.compute_all( indexer, indexes, starting_indexes, exit, |v, _, _, starting_indexes, exit| { - let mut high_iter = fetched.timeindexes_to_high.dateindex.into_iter(); + let mut high_iter = fetched + .timeindexes_to_high + .dateindex + .as_ref() + .unwrap() + .into_iter(); let mut prev = None; v.compute_transform( starting_indexes.dateindex, - &self.indexes_to_ath.dateindex, + self.indexes_to_ath.dateindex.as_ref().unwrap(), |(i, ath, slf)| { if prev.is_none() { let i = i.unwrap_to_usize(); @@ -1200,7 +1325,7 @@ impl Vecs { }, )?; - self.indexes_to_max_days_between_ath.compute( + self.indexes_to_max_days_between_ath.compute_all( indexer, indexes, starting_indexes, @@ -1209,7 +1334,7 @@ impl Vecs { let mut prev = None; v.compute_transform( starting_indexes.dateindex, - &self.indexes_to_days_since_ath.dateindex, + self.indexes_to_days_since_ath.dateindex.as_ref().unwrap(), |(i, days, slf)| { if prev.is_none() { let i = i.unwrap_to_usize(); @@ -1228,7 +1353,7 @@ impl Vecs { }, )?; - self.indexes_to_max_years_between_ath.compute( + self.indexes_to_max_years_between_ath.compute_all( indexer, indexes, starting_indexes, @@ -1236,7 +1361,10 @@ impl Vecs { |v, _, _, starting_indexes, exit| { v.compute_transform( starting_indexes.dateindex, - &self.indexes_to_max_days_between_ath.dateindex, + self.indexes_to_max_days_between_ath + .dateindex + .as_ref() + .unwrap(), |(i, max, ..)| (i, StoredF32::from(*max as f64 / 365.0)), exit, ) @@ -1295,7 +1423,7 @@ impl Vecs { ] .into_iter() .try_for_each(|(days, ago, returns, cagr)| -> color_eyre::Result<()> { - ago.compute( + ago.compute_all( indexer, indexes, starting_indexes, @@ -1303,14 +1431,14 @@ impl Vecs { |v, _, _, starting_indexes, exit| { v.compute_previous_value( starting_indexes.dateindex, - &fetched.timeindexes_to_close.dateindex, + fetched.timeindexes_to_close.dateindex.as_ref().unwrap(), days, exit, ) }, )?; - returns.compute( + returns.compute_all( indexer, indexes, starting_indexes, @@ -1318,7 +1446,7 @@ impl Vecs { |v, _, _, starting_indexes, exit| { v.compute_percentage_change( starting_indexes.dateindex, - &fetched.timeindexes_to_close.dateindex, + fetched.timeindexes_to_close.dateindex.as_ref().unwrap(), days, exit, ) @@ -1326,13 +1454,18 @@ impl Vecs { )?; if let Some(cagr) = cagr { - cagr.compute( + cagr.compute_all( indexer, indexes, starting_indexes, exit, |v, _, _, starting_indexes, exit| { - v.compute_cagr(starting_indexes.dateindex, &returns.dateindex, days, exit) + v.compute_cagr( + starting_indexes.dateindex, + returns.dateindex.as_ref().unwrap(), + days, + exit, + ) }, )?; } @@ -1429,7 +1562,7 @@ impl Vecs { .into_iter() .try_for_each( |(days, dca_stack, dca_avg_price, dca_returns, dca_cagr)| -> color_eyre::Result<()> { - dca_stack.compute( + dca_stack.compute_all( indexer, indexes, starting_indexes, @@ -1437,14 +1570,14 @@ impl Vecs { |v, _, _, starting_indexes, exit| { v.compute_dca_stack_via_len( starting_indexes.dateindex, - &fetched.timeindexes_to_close.dateindex, + fetched.timeindexes_to_close.dateindex.as_ref().unwrap(), days, exit, ) }, )?; - dca_avg_price.compute( + dca_avg_price.compute_all( indexer, indexes, starting_indexes, @@ -1452,14 +1585,14 @@ impl Vecs { |v, _, _, starting_indexes, exit| { v.compute_dca_avg_price_via_len( starting_indexes.dateindex, - &dca_stack.dateindex, + dca_stack.dateindex.as_ref().unwrap(), days, exit, ) }, )?; - dca_returns.compute( + dca_returns.compute_all( indexer, indexes, starting_indexes, @@ -1467,15 +1600,15 @@ impl Vecs { |v, _, _, starting_indexes, exit| { v.compute_percentage_difference( starting_indexes.dateindex, - &fetched.timeindexes_to_close.dateindex, - &dca_avg_price.dateindex, + fetched.timeindexes_to_close.dateindex.as_ref().unwrap(), + dca_avg_price.dateindex.as_ref().unwrap(), exit, ) }, )?; if let Some(dca_cagr) = dca_cagr { - dca_cagr.compute( + dca_cagr.compute_all( indexer, indexes, starting_indexes, @@ -1483,7 +1616,7 @@ impl Vecs { |v, _, _, starting_indexes, exit| { v.compute_cagr( starting_indexes.dateindex, - &dca_returns.dateindex, + dca_returns.dateindex.as_ref().unwrap(), days, exit, ) @@ -1568,7 +1701,7 @@ impl Vecs { |(year, avg_price, returns, stack)| -> color_eyre::Result<()> { let dateindex = DateIndex::try_from(Date::new(year, 1, 1)).unwrap(); - stack.compute( + stack.compute_all( indexer, indexes, starting_indexes, @@ -1576,14 +1709,14 @@ impl Vecs { |v, _, _, starting_indexes, exit| { v.compute_dca_stack_via_from( starting_indexes.dateindex, - &fetched.timeindexes_to_close.dateindex, + fetched.timeindexes_to_close.dateindex.as_ref().unwrap(), dateindex, exit, ) }, )?; - avg_price.compute( + avg_price.compute_all( indexer, indexes, starting_indexes, @@ -1591,14 +1724,14 @@ impl Vecs { |v, _, _, starting_indexes, exit| { v.compute_dca_avg_price_via_from( starting_indexes.dateindex, - &stack.dateindex, + stack.dateindex.as_ref().unwrap(), dateindex, exit, ) }, )?; - returns.compute( + returns.compute_all( indexer, indexes, starting_indexes, @@ -1606,8 +1739,8 @@ impl Vecs { |v, _, _, starting_indexes, exit| { v.compute_percentage_difference( starting_indexes.dateindex, - &fetched.timeindexes_to_close.dateindex, - &avg_price.dateindex, + fetched.timeindexes_to_close.dateindex.as_ref().unwrap(), + avg_price.dateindex.as_ref().unwrap(), exit, ) }, @@ -1645,7 +1778,7 @@ impl Vecs { |v, _, _, starting_indexes, exit| { v.compute_sma( starting_indexes.dateindex, - &fetched.timeindexes_to_close.dateindex, + fetched.timeindexes_to_close.dateindex.as_ref().unwrap(), sma, exit, ) diff --git a/crates/brk_computer/src/vecs/mining.rs b/crates/brk_computer/src/vecs/mining.rs index 35ff38471..cd116946f 100644 --- a/crates/brk_computer/src/vecs/mining.rs +++ b/crates/brk_computer/src/vecs/mining.rs @@ -41,6 +41,7 @@ impl Vecs { indexes_to_difficultyepoch: ComputedVecsFromDateIndex::forced_import( path, "difficultyepoch", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -48,6 +49,7 @@ impl Vecs { indexes_to_halvingepoch: ComputedVecsFromDateIndex::forced_import( path, "halvingepoch", + true, version + VERSION + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), @@ -63,7 +65,7 @@ impl Vecs { exit: &Exit, ) -> color_eyre::Result<()> { let mut height_to_difficultyepoch_iter = indexes.height_to_difficultyepoch.into_iter(); - self.indexes_to_difficultyepoch.compute( + self.indexes_to_difficultyepoch.compute_all( indexer, indexes, starting_indexes, @@ -87,7 +89,7 @@ impl Vecs { )?; let mut height_to_halvingepoch_iter = indexes.height_to_halvingepoch.into_iter(); - self.indexes_to_halvingepoch.compute( + self.indexes_to_halvingepoch.compute_all( indexer, indexes, starting_indexes, diff --git a/crates/brk_computer/src/vecs/mod.rs b/crates/brk_computer/src/vecs/mod.rs index 516f2fcb4..2ceb72c11 100644 --- a/crates/brk_computer/src/vecs/mod.rs +++ b/crates/brk_computer/src/vecs/mod.rs @@ -5,6 +5,7 @@ use brk_exit::Exit; use brk_fetcher::Fetcher; use brk_indexer::Indexer; use brk_vec::{AnyCollectableVec, Compressed, Computation}; +use fjall::TransactionalKeyspace; pub mod blocks; pub mod constants; @@ -40,6 +41,7 @@ impl Vecs { fetch: bool, computation: Computation, compressed: Compressed, + keyspace: &TransactionalKeyspace, ) -> color_eyre::Result { fs::create_dir_all(path)?; @@ -92,6 +94,7 @@ impl Vecs { computation, compressed, fetched.as_ref(), + keyspace, )?, transactions: transactions::Vecs::forced_import( path, diff --git a/crates/brk_computer/src/vecs/stateful/cohort.rs b/crates/brk_computer/src/vecs/stateful/cohort.rs index 1b12f9a25..1b8972958 100644 --- a/crates/brk_computer/src/vecs/stateful/cohort.rs +++ b/crates/brk_computer/src/vecs/stateful/cohort.rs @@ -5,20 +5,24 @@ use brk_core::{ }; use brk_exit::Exit; use brk_indexer::Indexer; -use brk_state::{CohortState, RealizedState}; -use brk_vec::{AnyCollectableVec, AnyVec, Compressed, Computation, EagerVec, VecIterator}; +use brk_state::CohortState; +use brk_vec::{ + AnyCollectableVec, AnyVec, Compressed, Computation, EagerVec, StoredIndex, VecIterator, +}; +use fjall::TransactionalKeyspace; use crate::vecs::{ Indexes, fetched, grouped::{ - ComputedRatioVecsFromDateIndex, ComputedValueVecsFromHeight, ComputedVecsFromHeight, - StorableVecGeneatorOptions, + ComputedRatioVecsFromDateIndex, ComputedValueVecsFromHeight, ComputedVecsFromDateIndex, + ComputedVecsFromHeight, StorableVecGeneatorOptions, }, indexes, }; const VERSION: Version = Version::ZERO; +#[derive(Clone)] pub struct Vecs { starting_height: Height, pub state: CohortState, @@ -34,6 +38,16 @@ pub struct Vecs { pub height_to_adjusted_value_created: Option>, pub height_to_value_destroyed: Option>, pub height_to_adjusted_value_destroyed: Option>, + pub height_to_supply_in_profit: Option>, + pub height_to_supply_in_loss: Option>, + pub height_to_supply_even: Option>, + pub height_to_unrealized_profit: Option>, + pub height_to_unrealized_loss: Option>, + pub dateindex_to_supply_in_profit: Option>, + pub dateindex_to_supply_in_loss: Option>, + pub dateindex_to_supply_even: Option>, + pub dateindex_to_unrealized_profit: Option>, + pub dateindex_to_unrealized_loss: Option>, pub dateindex_to_adjusted_spent_output_profit_ratio: Option>, pub dateindex_to_realized_cap_30d_change: Option>, @@ -53,9 +67,15 @@ pub struct Vecs { pub indexes_to_utxo_count: ComputedVecsFromHeight, pub indexes_to_value_created: Option>, pub indexes_to_value_destroyed: Option>, + pub indexes_to_supply_in_profit: Option>, + pub indexes_to_supply_in_loss: Option>, + pub indexes_to_supply_even: Option>, + pub indexes_to_unrealized_profit: Option>, + pub indexes_to_unrealized_loss: Option>, } impl Vecs { + #[allow(clippy::too_many_arguments)] pub fn forced_import( path: &Path, cohort_name: Option<&str>, @@ -63,6 +83,8 @@ impl Vecs { compressed: Compressed, version: Version, fetched: Option<&fetched::Vecs>, + keyspace: &TransactionalKeyspace, + stores_path: &Path, ) -> color_eyre::Result { let compute_dollars = fetched.is_some(); @@ -72,15 +94,163 @@ impl Vecs { let suffix = |s: &str| cohort_name.map_or(s.to_string(), |name| format!("{name}_{s}")); - let mut state = CohortState::default(); - if compute_dollars { - state.realized = Some(RealizedState::NAN); - } + let state = CohortState::default_and_import( + keyspace, + stores_path, + cohort_name.unwrap_or_default(), + version, + compute_dollars, + )?; Ok(Self { starting_height: Height::ZERO, state, + height_to_supply_in_profit: compute_dollars.then(|| { + EagerVec::forced_import( + path, + &suffix("supply_in_profit"), + version + VERSION + Version::ZERO, + compressed, + ) + .unwrap() + }), + dateindex_to_supply_in_profit: compute_dollars.then(|| { + EagerVec::forced_import( + path, + &suffix("supply_in_profit"), + version + VERSION + Version::ZERO, + compressed, + ) + .unwrap() + }), + indexes_to_supply_in_profit: compute_dollars.then(|| { + ComputedVecsFromDateIndex::forced_import( + path, + &suffix("supply_in_profit"), + false, + version + VERSION + Version::ZERO, + compressed, + StorableVecGeneatorOptions::default().add_last(), + ) + .unwrap() + }), + height_to_supply_even: compute_dollars.then(|| { + EagerVec::forced_import( + path, + &suffix("supply_even"), + version + VERSION + Version::ZERO, + compressed, + ) + .unwrap() + }), + dateindex_to_supply_even: compute_dollars.then(|| { + EagerVec::forced_import( + path, + &suffix("supply_even"), + version + VERSION + Version::ZERO, + compressed, + ) + .unwrap() + }), + indexes_to_supply_even: compute_dollars.then(|| { + ComputedVecsFromDateIndex::forced_import( + path, + &suffix("supply_even"), + false, + version + VERSION + Version::ZERO, + compressed, + StorableVecGeneatorOptions::default().add_last(), + ) + .unwrap() + }), + height_to_supply_in_loss: compute_dollars.then(|| { + EagerVec::forced_import( + path, + &suffix("supply_in_loss"), + version + VERSION + Version::ZERO, + compressed, + ) + .unwrap() + }), + dateindex_to_supply_in_loss: compute_dollars.then(|| { + EagerVec::forced_import( + path, + &suffix("supply_in_loss"), + version + VERSION + Version::ZERO, + compressed, + ) + .unwrap() + }), + indexes_to_supply_in_loss: compute_dollars.then(|| { + ComputedVecsFromDateIndex::forced_import( + path, + &suffix("supply_in_loss"), + false, + version + VERSION + Version::ZERO, + compressed, + StorableVecGeneatorOptions::default().add_last(), + ) + .unwrap() + }), + height_to_unrealized_profit: compute_dollars.then(|| { + EagerVec::forced_import( + path, + &suffix("unrealized_profit"), + version + VERSION + Version::ZERO, + compressed, + ) + .unwrap() + }), + dateindex_to_unrealized_profit: compute_dollars.then(|| { + EagerVec::forced_import( + path, + &suffix("unrealized_profit"), + version + VERSION + Version::ZERO, + compressed, + ) + .unwrap() + }), + indexes_to_unrealized_profit: compute_dollars.then(|| { + ComputedVecsFromDateIndex::forced_import( + path, + &suffix("unrealized_profit"), + false, + version + VERSION + Version::ZERO, + compressed, + StorableVecGeneatorOptions::default().add_last(), + ) + .unwrap() + }), + height_to_unrealized_loss: compute_dollars.then(|| { + EagerVec::forced_import( + path, + &suffix("unrealized_loss"), + version + VERSION + Version::ZERO, + compressed, + ) + .unwrap() + }), + dateindex_to_unrealized_loss: compute_dollars.then(|| { + EagerVec::forced_import( + path, + &suffix("unrealized_loss"), + version + VERSION + Version::ZERO, + compressed, + ) + .unwrap() + }), + indexes_to_unrealized_loss: compute_dollars.then(|| { + ComputedVecsFromDateIndex::forced_import( + path, + &suffix("unrealized_loss"), + false, + version + VERSION + Version::ZERO, + compressed, + StorableVecGeneatorOptions::default().add_last(), + ) + .unwrap() + }), height_to_realized_cap: compute_dollars.then(|| { EagerVec::forced_import( path, @@ -346,6 +516,10 @@ impl Vecs { pub fn starting_height(&self) -> Height { [ + self.state + .price_to_amount + .height() + .map_or(usize::MAX, |h| h.incremented().unwrap_to_usize()), self.height_to_supply.len(), self.height_to_utxo_count.len(), self.height_to_realized_cap @@ -369,6 +543,21 @@ impl Vecs { self.height_to_adjusted_value_destroyed .as_ref() .map_or(usize::MAX, |v| v.len()), + self.height_to_supply_in_profit + .as_ref() + .map_or(usize::MAX, |v| v.len()), + self.height_to_supply_in_loss + .as_ref() + .map_or(usize::MAX, |v| v.len()), + self.height_to_supply_even + .as_ref() + .map_or(usize::MAX, |v| v.len()), + self.height_to_unrealized_profit + .as_ref() + .map_or(usize::MAX, |v| v.len()), + self.height_to_unrealized_loss + .as_ref() + .map_or(usize::MAX, |v| v.len()), ] .into_iter() .map(Height::from) @@ -483,6 +672,113 @@ impl Vecs { .validate_computed_version_or_reset_file( base_version + height_to_adjusted_value_destroyed_inner_version, )?; + let height_to_supply_in_profit_inner_version = self + .height_to_supply_in_profit + .as_ref() + .unwrap() + .inner_version(); + self.height_to_supply_in_profit + .as_mut() + .unwrap() + .validate_computed_version_or_reset_file( + base_version + height_to_supply_in_profit_inner_version, + )?; + let height_to_supply_in_loss_inner_version = self + .height_to_supply_in_loss + .as_ref() + .unwrap() + .inner_version(); + self.height_to_supply_in_loss + .as_mut() + .unwrap() + .validate_computed_version_or_reset_file( + base_version + height_to_supply_in_loss_inner_version, + )?; + let height_to_supply_even_inner_version = + self.height_to_supply_even.as_ref().unwrap().inner_version(); + self.height_to_supply_even + .as_mut() + .unwrap() + .validate_computed_version_or_reset_file( + base_version + height_to_supply_even_inner_version, + )?; + let height_to_unrealized_profit_inner_version = self + .height_to_unrealized_profit + .as_ref() + .unwrap() + .inner_version(); + self.height_to_unrealized_profit + .as_mut() + .unwrap() + .validate_computed_version_or_reset_file( + base_version + height_to_unrealized_profit_inner_version, + )?; + let height_to_unrealized_loss_inner_version = self + .height_to_unrealized_loss + .as_ref() + .unwrap() + .inner_version(); + self.height_to_unrealized_loss + .as_mut() + .unwrap() + .validate_computed_version_or_reset_file( + base_version + height_to_unrealized_loss_inner_version, + )?; + let dateindex_to_supply_in_profit_inner_version = self + .dateindex_to_supply_in_profit + .as_ref() + .unwrap() + .inner_version(); + self.dateindex_to_supply_in_profit + .as_mut() + .unwrap() + .validate_computed_version_or_reset_file( + base_version + dateindex_to_supply_in_profit_inner_version, + )?; + let dateindex_to_supply_in_loss_inner_version = self + .dateindex_to_supply_in_loss + .as_ref() + .unwrap() + .inner_version(); + self.dateindex_to_supply_in_loss + .as_mut() + .unwrap() + .validate_computed_version_or_reset_file( + base_version + dateindex_to_supply_in_loss_inner_version, + )?; + let dateindex_to_supply_even_inner_version = self + .dateindex_to_supply_even + .as_ref() + .unwrap() + .inner_version(); + self.dateindex_to_supply_even + .as_mut() + .unwrap() + .validate_computed_version_or_reset_file( + base_version + dateindex_to_supply_even_inner_version, + )?; + let dateindex_to_unrealized_profit_inner_version = self + .dateindex_to_unrealized_profit + .as_ref() + .unwrap() + .inner_version(); + self.dateindex_to_unrealized_profit + .as_mut() + .unwrap() + .validate_computed_version_or_reset_file( + base_version + dateindex_to_unrealized_profit_inner_version, + )?; + let dateindex_to_unrealized_loss_inner_version = self + .dateindex_to_unrealized_loss + .as_ref() + .unwrap() + .inner_version(); + self.dateindex_to_unrealized_loss + .as_mut() + .unwrap() + .validate_computed_version_or_reset_file( + base_version + dateindex_to_unrealized_loss_inner_version, + )?; } Ok(()) @@ -538,7 +834,70 @@ impl Vecs { Ok(()) } - pub fn safe_flush_height_vecs(&mut self, exit: &Exit) -> Result<()> { + pub fn compute_then_force_push_unrealized_states( + &mut self, + height: Height, + height_price: Option, + dateindex: Option, + date_price: Option>, + exit: &Exit, + ) -> Result<()> { + if let Some(height_price) = height_price { + let (height_unrealized_state, date_unrealized_state) = self + .state + .compute_unrealized_states(height_price, date_price.unwrap()); + + self.height_to_supply_even + .as_mut() + .unwrap() + .forced_push_at(height, height_unrealized_state.supply_even, exit)?; + self.height_to_supply_in_profit + .as_mut() + .unwrap() + .forced_push_at(height, height_unrealized_state.supply_in_profit, exit)?; + self.height_to_supply_in_loss + .as_mut() + .unwrap() + .forced_push_at(height, height_unrealized_state.supply_in_loss, exit)?; + self.height_to_unrealized_profit + .as_mut() + .unwrap() + .forced_push_at(height, height_unrealized_state.unrealized_profit, exit)?; + self.height_to_unrealized_loss + .as_mut() + .unwrap() + .forced_push_at(height, height_unrealized_state.unrealized_loss, exit)?; + + if let Some(date_unrealized_state) = date_unrealized_state { + let dateindex = dateindex.unwrap(); + + self.dateindex_to_supply_even + .as_mut() + .unwrap() + .forced_push_at(dateindex, date_unrealized_state.supply_even, exit)?; + self.dateindex_to_supply_in_profit + .as_mut() + .unwrap() + .forced_push_at(dateindex, date_unrealized_state.supply_in_profit, exit)?; + self.dateindex_to_supply_in_loss + .as_mut() + .unwrap() + .forced_push_at(dateindex, date_unrealized_state.supply_in_loss, exit)?; + self.dateindex_to_unrealized_profit + .as_mut() + .unwrap() + .forced_push_at(dateindex, date_unrealized_state.unrealized_profit, exit)?; + self.dateindex_to_unrealized_loss + .as_mut() + .unwrap() + .forced_push_at(dateindex, date_unrealized_state.unrealized_loss, exit)?; + } + } + + Ok(()) + } + + pub fn safe_flush_stateful_vecs(&mut self, height: Height, exit: &Exit) -> Result<()> { self.height_to_supply.safe_flush(exit)?; self.height_to_utxo_count.safe_flush(exit)?; @@ -569,8 +928,50 @@ impl Vecs { .as_mut() .unwrap() .safe_flush(exit)?; + self.height_to_supply_in_profit + .as_mut() + .unwrap() + .safe_flush(exit)?; + self.height_to_supply_in_loss + .as_mut() + .unwrap() + .safe_flush(exit)?; + self.height_to_supply_even + .as_mut() + .unwrap() + .safe_flush(exit)?; + self.height_to_unrealized_profit + .as_mut() + .unwrap() + .safe_flush(exit)?; + self.height_to_unrealized_loss + .as_mut() + .unwrap() + .safe_flush(exit)?; + self.dateindex_to_supply_in_profit + .as_mut() + .unwrap() + .safe_flush(exit)?; + self.dateindex_to_supply_in_loss + .as_mut() + .unwrap() + .safe_flush(exit)?; + self.dateindex_to_supply_even + .as_mut() + .unwrap() + .safe_flush(exit)?; + self.dateindex_to_unrealized_profit + .as_mut() + .unwrap() + .safe_flush(exit)?; + self.dateindex_to_unrealized_loss + .as_mut() + .unwrap() + .safe_flush(exit)?; } + self.state.commit(height)?; + Ok(()) } @@ -618,7 +1019,7 @@ impl Vecs { vec.compute_divide( starting_indexes.height, self.height_to_realized_cap.as_ref().unwrap(), - &**self.indexes_to_supply.bitcoin.height.as_ref().unwrap(), + self.indexes_to_supply.bitcoin.height.as_ref().unwrap(), exit, ) }, @@ -823,6 +1224,49 @@ impl Vecs { .unwrap_last(), exit, )?; + + self.indexes_to_supply_in_profit + .as_mut() + .unwrap() + .compute_rest( + indexes, + starting_indexes, + exit, + Some(self.dateindex_to_supply_in_profit.as_ref().unwrap()), + )?; + self.indexes_to_supply_in_loss + .as_mut() + .unwrap() + .compute_rest( + indexes, + starting_indexes, + exit, + Some(self.dateindex_to_supply_in_loss.as_ref().unwrap()), + )?; + self.indexes_to_supply_even.as_mut().unwrap().compute_rest( + indexes, + starting_indexes, + exit, + Some(self.dateindex_to_supply_even.as_ref().unwrap()), + )?; + self.indexes_to_unrealized_profit + .as_mut() + .unwrap() + .compute_rest( + indexes, + starting_indexes, + exit, + Some(self.dateindex_to_unrealized_profit.as_ref().unwrap()), + )?; + self.indexes_to_unrealized_loss + .as_mut() + .unwrap() + .compute_rest( + indexes, + starting_indexes, + exit, + Some(self.dateindex_to_unrealized_loss.as_ref().unwrap()), + )?; } Ok(()) @@ -905,53 +1349,54 @@ impl Vecs { self.dateindex_to_sell_side_risk_ratio .as_ref() .map_or(vec![], |v| vec![v]), + self.height_to_supply_in_profit + .as_ref() + .map_or(vec![], |v| vec![v]), + self.height_to_supply_in_loss + .as_ref() + .map_or(vec![], |v| vec![v]), + self.height_to_supply_even + .as_ref() + .map_or(vec![], |v| vec![v]), + self.height_to_unrealized_profit + .as_ref() + .map_or(vec![], |v| vec![v]), + self.height_to_unrealized_loss + .as_ref() + .map_or(vec![], |v| vec![v]), + self.dateindex_to_supply_in_profit + .as_ref() + .map_or(vec![], |v| vec![v]), + self.dateindex_to_supply_in_loss + .as_ref() + .map_or(vec![], |v| vec![v]), + self.dateindex_to_supply_even + .as_ref() + .map_or(vec![], |v| vec![v]), + self.dateindex_to_unrealized_profit + .as_ref() + .map_or(vec![], |v| vec![v]), + self.dateindex_to_unrealized_loss + .as_ref() + .map_or(vec![], |v| vec![v]), + self.indexes_to_supply_in_profit + .as_ref() + .map_or(vec![], |v| v.vecs()), + self.indexes_to_supply_in_loss + .as_ref() + .map_or(vec![], |v| v.vecs()), + self.indexes_to_supply_even + .as_ref() + .map_or(vec![], |v| v.vecs()), + self.indexes_to_unrealized_profit + .as_ref() + .map_or(vec![], |v| v.vecs()), + self.indexes_to_unrealized_loss + .as_ref() + .map_or(vec![], |v| v.vecs()), ] .into_iter() .flatten() .collect::>() } } - -impl Clone for Vecs { - fn clone(&self) -> Self { - Self { - starting_height: self.starting_height, - state: CohortState::default(), - - height_to_realized_cap: self.height_to_realized_cap.clone(), - height_to_supply: self.height_to_supply.clone(), - height_to_utxo_count: self.height_to_utxo_count.clone(), - height_to_realized_profit: self.height_to_realized_profit.clone(), - height_to_realized_loss: self.height_to_realized_loss.clone(), - height_to_value_created: self.height_to_value_created.clone(), - height_to_adjusted_value_created: self.height_to_adjusted_value_created.clone(), - height_to_value_destroyed: self.height_to_value_destroyed.clone(), - height_to_adjusted_value_destroyed: self.height_to_adjusted_value_destroyed.clone(), - - indexes_to_supply: self.indexes_to_supply.clone(), - indexes_to_utxo_count: self.indexes_to_utxo_count.clone(), - indexes_to_realized_cap: self.indexes_to_realized_cap.clone(), - indexes_to_realized_profit: self.indexes_to_realized_profit.clone(), - indexes_to_realized_loss: self.indexes_to_realized_loss.clone(), - indexes_to_negative_realized_loss: self.indexes_to_negative_realized_loss.clone(), - indexes_to_value_created: self.indexes_to_value_created.clone(), - indexes_to_adjusted_value_created: self.indexes_to_adjusted_value_created.clone(), - indexes_to_value_destroyed: self.indexes_to_value_destroyed.clone(), - indexes_to_adjusted_value_destroyed: self.indexes_to_adjusted_value_destroyed.clone(), - dateindex_to_realized_cap_30d_change: self.dateindex_to_realized_cap_30d_change.clone(), - indexes_to_realized_value: self.indexes_to_realized_value.clone(), - indexes_to_net_realized_profit_and_loss: self - .indexes_to_net_realized_profit_and_loss - .clone(), - indexes_to_realized_price: self.indexes_to_realized_price.clone(), - dateindex_to_sell_side_risk_ratio: self.dateindex_to_sell_side_risk_ratio.clone(), - indexes_to_realized_price_extra: self.indexes_to_realized_price_extra.clone(), - dateindex_to_spent_output_profit_ratio: self - .dateindex_to_spent_output_profit_ratio - .clone(), - dateindex_to_adjusted_spent_output_profit_ratio: self - .dateindex_to_adjusted_spent_output_profit_ratio - .clone(), - } - } -} diff --git a/crates/brk_computer/src/vecs/stateful/mod.rs b/crates/brk_computer/src/vecs/stateful/mod.rs index 334ab4a3a..6423cc9ac 100644 --- a/crates/brk_computer/src/vecs/stateful/mod.rs +++ b/crates/brk_computer/src/vecs/stateful/mod.rs @@ -1,12 +1,13 @@ use std::{cmp::Ordering, collections::BTreeMap, mem, path::Path, thread}; -use brk_core::{Height, InputIndex, OutputIndex, OutputType, Sats, Version}; +use brk_core::{DateIndex, Height, InputIndex, OutputIndex, OutputType, Sats, Version}; use brk_exit::Exit; use brk_indexer::Indexer; use brk_vec::{ AnyCollectableVec, AnyVec, BaseVecIterator, CollectableVec, Compressed, Computation, EagerVec, GenericStoredVec, StoredIndex, StoredVec, UnsafeSlice, VecIterator, }; +use fjall::TransactionalKeyspace; use log::info; use outputs::OutputCohorts; use rayon::prelude::*; @@ -47,12 +48,15 @@ impl Vecs { _computation: Computation, compressed: Compressed, fetched: Option<&fetched::Vecs>, + keyspace: &TransactionalKeyspace, ) -> color_eyre::Result { let compute_dollars = fetched.is_some(); - let mut states_path = path.to_owned(); - states_path.pop(); - states_path = states_path.join("states"); + let mut root_path = path.to_owned(); + root_path.pop(); + let states_path = root_path.join("states"); + root_path.pop(); + let stores_path = root_path.join("stores"); Ok(Self { chain_state: StoredVec::forced_import( @@ -101,6 +105,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, by_term: OutputsByTerm { short: cohort::Vecs::forced_import( @@ -110,6 +116,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, long: cohort::Vecs::forced_import( path, @@ -118,6 +126,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, }, by_up_to: OutputsByUpTo { @@ -128,6 +138,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _1w: cohort::Vecs::forced_import( path, @@ -136,6 +148,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _1m: cohort::Vecs::forced_import( path, @@ -144,6 +158,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _2m: cohort::Vecs::forced_import( path, @@ -152,6 +168,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _3m: cohort::Vecs::forced_import( path, @@ -160,6 +178,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _4m: cohort::Vecs::forced_import( path, @@ -168,6 +188,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _5m: cohort::Vecs::forced_import( path, @@ -176,6 +198,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _6m: cohort::Vecs::forced_import( path, @@ -184,6 +208,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _1y: cohort::Vecs::forced_import( path, @@ -192,6 +218,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _2y: cohort::Vecs::forced_import( path, @@ -200,6 +228,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _3y: cohort::Vecs::forced_import( path, @@ -208,6 +238,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _4y: cohort::Vecs::forced_import( path, @@ -216,6 +248,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _5y: cohort::Vecs::forced_import( path, @@ -224,6 +258,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _6y: cohort::Vecs::forced_import( path, @@ -232,6 +268,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _7y: cohort::Vecs::forced_import( path, @@ -240,6 +278,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _8y: cohort::Vecs::forced_import( path, @@ -248,6 +288,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _10y: cohort::Vecs::forced_import( path, @@ -256,6 +298,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _15y: cohort::Vecs::forced_import( path, @@ -264,6 +308,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, }, by_from: OutputsByFrom { @@ -274,6 +320,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _1w: cohort::Vecs::forced_import( path, @@ -282,6 +330,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _1m: cohort::Vecs::forced_import( path, @@ -290,6 +340,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _2m: cohort::Vecs::forced_import( path, @@ -298,6 +350,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _3m: cohort::Vecs::forced_import( path, @@ -306,6 +360,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _4m: cohort::Vecs::forced_import( path, @@ -314,6 +370,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _5m: cohort::Vecs::forced_import( path, @@ -322,6 +380,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _6m: cohort::Vecs::forced_import( path, @@ -330,6 +390,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _1y: cohort::Vecs::forced_import( path, @@ -338,6 +400,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _2y: cohort::Vecs::forced_import( path, @@ -346,6 +410,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _3y: cohort::Vecs::forced_import( path, @@ -354,6 +420,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _4y: cohort::Vecs::forced_import( path, @@ -362,6 +430,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _5y: cohort::Vecs::forced_import( path, @@ -370,6 +440,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _6y: cohort::Vecs::forced_import( path, @@ -378,6 +450,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _7y: cohort::Vecs::forced_import( path, @@ -386,6 +460,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _8y: cohort::Vecs::forced_import( path, @@ -394,6 +470,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _10y: cohort::Vecs::forced_import( path, @@ -402,6 +480,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _15y: cohort::Vecs::forced_import( path, @@ -410,6 +490,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, }, by_range: OutputsByRange { @@ -420,6 +502,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _1w_to_1m: cohort::Vecs::forced_import( path, @@ -428,6 +512,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _1m_to_3m: cohort::Vecs::forced_import( path, @@ -436,6 +522,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _3m_to_6m: cohort::Vecs::forced_import( path, @@ -444,6 +532,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _6m_to_1y: cohort::Vecs::forced_import( path, @@ -452,6 +542,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _1y_to_2y: cohort::Vecs::forced_import( path, @@ -460,6 +552,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _2y_to_3y: cohort::Vecs::forced_import( path, @@ -468,6 +562,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _3y_to_4y: cohort::Vecs::forced_import( path, @@ -476,6 +572,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _4y_to_5y: cohort::Vecs::forced_import( path, @@ -484,6 +582,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _5y_to_7y: cohort::Vecs::forced_import( path, @@ -492,6 +592,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _7y_to_10y: cohort::Vecs::forced_import( path, @@ -500,6 +602,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _10y_to_15y: cohort::Vecs::forced_import( path, @@ -508,6 +612,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, }, by_epoch: OutputsByEpoch { @@ -518,6 +624,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _1: cohort::Vecs::forced_import( path, @@ -526,6 +634,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _2: cohort::Vecs::forced_import( path, @@ -534,6 +644,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _3: cohort::Vecs::forced_import( path, @@ -542,6 +654,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, _4: cohort::Vecs::forced_import( path, @@ -550,6 +664,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, }, by_size: OutputsBySize { @@ -560,6 +676,8 @@ impl Vecs { compressed, version + BYSIZE_VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, from_1sat_to_10sats: cohort::Vecs::forced_import( path, @@ -568,6 +686,8 @@ impl Vecs { compressed, version + BYSIZE_VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, from_10sats_to_100sats: cohort::Vecs::forced_import( path, @@ -576,6 +696,8 @@ impl Vecs { compressed, version + BYSIZE_VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, from_100sats_to_1_000sats: cohort::Vecs::forced_import( path, @@ -584,6 +706,8 @@ impl Vecs { compressed, version + BYSIZE_VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, from_1_000sats_to_10_000sats: cohort::Vecs::forced_import( path, @@ -592,6 +716,8 @@ impl Vecs { compressed, version + BYSIZE_VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, from_10_000sats_to_100_000sats: cohort::Vecs::forced_import( path, @@ -600,6 +726,8 @@ impl Vecs { compressed, version + BYSIZE_VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, from_100_000sats_to_1_000_000sats: cohort::Vecs::forced_import( path, @@ -608,6 +736,8 @@ impl Vecs { compressed, version + BYSIZE_VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, from_1_000_000sats_to_10_000_000sats: cohort::Vecs::forced_import( path, @@ -616,6 +746,8 @@ impl Vecs { compressed, version + BYSIZE_VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, from_10_000_000sats_to_1btc: cohort::Vecs::forced_import( path, @@ -624,6 +756,8 @@ impl Vecs { compressed, version + BYSIZE_VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, from_1btc_to_10btc: cohort::Vecs::forced_import( path, @@ -632,6 +766,8 @@ impl Vecs { compressed, version + BYSIZE_VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, from_10btc_to_100btc: cohort::Vecs::forced_import( path, @@ -640,6 +776,8 @@ impl Vecs { compressed, version + BYSIZE_VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, from_100btc_to_1_000btc: cohort::Vecs::forced_import( path, @@ -648,6 +786,8 @@ impl Vecs { compressed, version + BYSIZE_VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, from_1_000btc_to_10_000btc: cohort::Vecs::forced_import( path, @@ -656,6 +796,8 @@ impl Vecs { compressed, version + BYSIZE_VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, from_10_000btc_to_100_000btc: cohort::Vecs::forced_import( path, @@ -664,6 +806,8 @@ impl Vecs { compressed, version + BYSIZE_VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, from_100_000btc: cohort::Vecs::forced_import( path, @@ -672,6 +816,8 @@ impl Vecs { compressed, version + BYSIZE_VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, }, // by_value: OutputsByValue { @@ -775,6 +921,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, p2pk33: cohort::Vecs::forced_import( path, @@ -783,6 +931,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, p2pkh: cohort::Vecs::forced_import( path, @@ -791,6 +941,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, p2ms: cohort::Vecs::forced_import( path, @@ -799,6 +951,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, p2sh: cohort::Vecs::forced_import( path, @@ -807,6 +961,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, // opreturn: cohort::Vecs::forced_import( // path, @@ -815,6 +971,7 @@ impl Vecs { // compressed, // VERSION + Version::ZERO, // fetched, + // keyspace // )?, p2wpkh: cohort::Vecs::forced_import( path, @@ -823,6 +980,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, p2wsh: cohort::Vecs::forced_import( path, @@ -831,6 +990,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, p2tr: cohort::Vecs::forced_import( path, @@ -839,6 +1000,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, p2a: cohort::Vecs::forced_import( path, @@ -847,6 +1010,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, empty: cohort::Vecs::forced_import( path, @@ -855,6 +1020,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, unknown: cohort::Vecs::forced_import( path, @@ -863,6 +1030,8 @@ impl Vecs { compressed, version + VERSION + Version::ZERO, fetched, + keyspace, + &stores_path, )?, }, }) @@ -896,11 +1065,16 @@ impl Vecs { .sats .height .as_ref() - .unwrap() - .as_ref(); - let height_to_close = &fetched + .unwrap(); + let height_to_close = fetched .as_ref() .map(|fetched| &fetched.chainindexes_to_close.height); + let dateindex_to_close = fetched + .as_ref() + .map(|fetched| fetched.timeindexes_to_close.dateindex.as_ref().unwrap()); + let height_to_date_fixed = &indexes.height_to_date_fixed; + let dateindex_to_first_height = &indexes.dateindex_to_first_height; + let dateindex_to_height_count = &indexes.dateindex_to_height_count; let inputindex_to_outputindex_mmap = inputindex_to_outputindex.mmap().load(); let outputindex_to_value_mmap = outputindex_to_value.mmap().load(); @@ -917,6 +1091,10 @@ impl Vecs { // let mut outputindex_to_outputtype_iter_2 = outputindex_to_outputtype.into_iter(); let mut height_to_unclaimed_rewards_iter = height_to_unclaimed_rewards.into_iter(); let mut height_to_timestamp_fixed_iter = height_to_timestamp_fixed.into_iter(); + let mut dateindex_to_close_iter = dateindex_to_close.as_ref().map(|v| v.into_iter()); + let mut height_to_date_fixed_iter = height_to_date_fixed.into_iter(); + let mut dateindex_to_first_height_iter = dateindex_to_first_height.into_iter(); + let mut dateindex_to_height_count_iter = dateindex_to_height_count.into_iter(); let mut flat_vecs_ = self.utxos_vecs.as_mut_vec(); @@ -934,7 +1112,13 @@ impl Vecs { + height_to_unclaimed_rewards.version() + height_to_close .as_ref() - .map_or(Version::ZERO, |v| v.version()); + .map_or(Version::ZERO, |v| v.version()) + + dateindex_to_close + .as_ref() + .map_or(Version::ZERO, |v| v.version()) + + height_to_date_fixed.version() + + dateindex_to_first_height.version() + + dateindex_to_height_count.version(); flat_vecs_ .iter_mut() @@ -1047,10 +1231,6 @@ impl Vecs { let output_count = height_to_output_count_iter.unwrap_get_inner(height); let input_count = height_to_input_count_iter.unwrap_get_inner(height); - // let sent_state = SentState::default(); - // let received_state = ReceivedState::default(); - // let realized_state = RealizedState::default(); - let (mut height_to_sent, mut received) = thread::scope(|s| { if chain_state_starting_height <= height { s.spawn(|| { @@ -1093,15 +1273,11 @@ impl Vecs { .unwrap() .into_inner(); - // let input_height = *cached_txindex_to_height - // .entry(input_txindex) - // .or_insert_with(|| { let height = txindex_to_height .get_or_read(input_txindex, &txindex_to_height_mmap) .unwrap() .unwrap() .into_inner(); - // }); (height, value, input_type) }) @@ -1204,8 +1380,9 @@ impl Vecs { panic!("temp, just making sure") } - self.utxos_vecs - .as_mut_vec() + let mut utxos_vecs = self.utxos_vecs.as_mut_vec(); + + utxos_vecs .iter_mut() .try_for_each(|(_, v)| v.forced_pushed_at(height, exit))?; @@ -1218,19 +1395,48 @@ impl Vecs { self.height_to_opreturn_supply .forced_push_at(height, opreturn_supply, exit)?; + let date = height_to_date_fixed_iter.unwrap_get_inner(height); + let dateindex = DateIndex::try_from(date).unwrap(); + let date_first_height = dateindex_to_first_height_iter.unwrap_get_inner(dateindex); + let date_height_count = dateindex_to_height_count_iter.unwrap_get_inner(dateindex); + let is_date_last_height = + date_first_height + Height::from(*date_height_count) == height; + let date_price = dateindex_to_close_iter + .as_mut() + .map(|v| is_date_last_height.then(|| *v.unwrap_get_inner(dateindex))); + + utxos_vecs.par_iter_mut().try_for_each(|(_, v)| { + v.compute_then_force_push_unrealized_states( + height, + price, + is_date_last_height.then_some(dateindex), + date_price, + exit, + ) + })?; + + if height != Height::ZERO && height.unwrap_to_usize() % 100_000 == 0 { + info!("Flushing..."); + + utxos_vecs + .par_iter_mut() + .try_for_each(|(_, v)| v.safe_flush_stateful_vecs(height, exit))?; + self.height_to_unspendable_supply.safe_flush(exit)?; + self.height_to_opreturn_supply.safe_flush(exit)?; + } + Ok(()) })?; exit.block(); - let mut flat_vecs_ = self.utxos_vecs.as_mut_vec(); - info!("Flushing..."); // Flush rest of values - flat_vecs_ + self.utxos_vecs + .as_mut_vec() .par_iter_mut() - .try_for_each(|(_, v)| v.safe_flush_height_vecs(exit))?; + .try_for_each(|(_, v)| v.safe_flush_stateful_vecs(height, exit))?; self.height_to_unspendable_supply.safe_flush(exit)?; self.height_to_opreturn_supply.safe_flush(exit)?; @@ -1246,9 +1452,12 @@ impl Vecs { info!("Computing rest..."); // Compute other vecs from height vecs - flat_vecs_.par_iter_mut().try_for_each(|(_, v)| { - v.compute_rest(indexer, indexes, fetched, starting_indexes, exit) - })?; + self.utxos_vecs + .as_mut_vec() + .par_iter_mut() + .try_for_each(|(_, v)| { + v.compute_rest(indexer, indexes, fetched, starting_indexes, exit) + })?; self.indexes_to_unspendable_supply.compute_rest( indexer, indexes, diff --git a/crates/brk_computer/src/vecs/transactions.rs b/crates/brk_computer/src/vecs/transactions.rs index f8775813b..423cc044e 100644 --- a/crates/brk_computer/src/vecs/transactions.rs +++ b/crates/brk_computer/src/vecs/transactions.rs @@ -864,12 +864,7 @@ impl Vecs { self.indexes_to_fee.sats.height.unwrap_sum().iter(); vec.compute_transform( starting_indexes.height, - self.indexes_to_coinbase - .sats - .height - .as_ref() - .unwrap() - .as_ref(), + self.indexes_to_coinbase.sats.height.as_ref().unwrap(), |(height, coinbase, ..)| { let fees = indexes_to_fee_sum_iter.unwrap_get_inner(height); (height, coinbase.checked_sub(fees).unwrap()) @@ -888,12 +883,7 @@ impl Vecs { |vec, _, _, starting_indexes, exit| { vec.compute_transform( starting_indexes.height, - self.indexes_to_subsidy - .sats - .height - .as_ref() - .unwrap() - .as_ref(), + self.indexes_to_subsidy.sats.height.as_ref().unwrap(), |(height, subsidy, ..)| { let halving = HalvingEpoch::from(height); let expected = diff --git a/crates/brk_core/Cargo.toml b/crates/brk_core/Cargo.toml index d01a8c917..bbcd9c678 100644 --- a/crates/brk_core/Cargo.toml +++ b/crates/brk_core/Cargo.toml @@ -11,6 +11,7 @@ bitcoin = { workspace = true } bitcoincore-rpc = { workspace = true } byteview = { workspace = true } derive_deref = { workspace = true } +fjall = { workspace = true } jiff = { workspace = true } log = { workspace = true } rapidhash = "1.4.0" @@ -19,6 +20,7 @@ serde = { workspace = true } serde_bytes = "0.11.17" serde_derive = { workspace = true } serde_json = { workspace = true } +thiserror = "2.0.12" zerocopy = { workspace = true } zerocopy-derive = { workspace = true } diff --git a/crates/brk_core/src/enums/error.rs b/crates/brk_core/src/enums/error.rs index 2f159ed3b..a5da19113 100644 --- a/crates/brk_core/src/enums/error.rs +++ b/crates/brk_core/src/enums/error.rs @@ -1,20 +1,24 @@ use std::{ fmt::{self, Debug}, - io, - time::SystemTimeError, + io, result, time, }; use crate::Version; -pub type Result = std::result::Result; +pub type Result = result::Result; #[derive(Debug)] pub enum Error { + IO(io::Error), + SerdeJson(serde_json::Error), + Jiff(jiff::Error), + Fjall(fjall::Error), + SystemTimeError(time::SystemTimeError), + ZeroCopyError, + WrongEndian, DifferentVersion { found: Version, expected: Version }, MmapsVecIsTooSmall, - IO(io::Error), - ZeroCopyError, IndexTooHigh, EmptyVec, IndexTooLow, @@ -24,17 +28,16 @@ pub enum Error { UnsupportedUnflushedState, RangeFromAfterTo(usize, usize), DifferentCompressionMode, - SystemTimeError, - ToSerdeJsonValueError(serde_json::Error), - Jiff(jiff::Error), WrongLength, WrongAddressType, UnindexableDate, + + String(&'static str), } -impl From for Error { - fn from(_: SystemTimeError) -> Self { - Self::SystemTimeError +impl From for Error { + fn from(value: time::SystemTimeError) -> Self { + Self::SystemTimeError(value) } } @@ -50,6 +53,12 @@ impl From for Error { } } +impl From for Error { + fn from(value: fjall::Error) -> Self { + Self::Fjall(value) + } +} + impl From> for Error { fn from(_: zerocopy::error::ConvertError) -> Self { Self::ZeroCopyError @@ -64,13 +73,20 @@ impl From> for Error { impl From for Error { fn from(error: serde_json::Error) -> Self { - Self::ToSerdeJsonValueError(error) + Self::SerdeJson(error) } } impl fmt::Display for Error { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { + Error::IO(error) => Debug::fmt(&error, f), + Error::SystemTimeError(error) => Debug::fmt(&error, f), + Error::SerdeJson(error) => Debug::fmt(&error, f), + Error::Jiff(error) => Debug::fmt(&error, f), + Error::Fjall(error) => Debug::fmt(&error, f), + Error::ZeroCopyError => write!(f, "ZeroCopy error"), + Error::WrongEndian => write!(f, "Wrong endian"), Error::DifferentVersion { found, expected } => { write!( @@ -79,7 +95,6 @@ impl fmt::Display for Error { ) } Error::MmapsVecIsTooSmall => write!(f, "Mmaps vec is too small"), - Error::IO(error) => Debug::fmt(&error, f), Error::IndexTooHigh => write!(f, "Index too high"), Error::IndexTooLow => write!(f, "Index too low"), Error::ExpectFileToHaveIndex => write!(f, "Expect file to have index"), @@ -91,19 +106,17 @@ impl fmt::Display for Error { "Unsupported unflush state, please flush before using this function" ) } - Error::ZeroCopyError => write!(f, "Zero copy convert error"), - Error::SystemTimeError => write!(f, "SystemTimeError"), Error::RangeFromAfterTo(from, to) => write!(f, "Range, from {from} is after to {to}"), Error::DifferentCompressionMode => write!(f, "Different compression mode chosen"), Error::EmptyVec => write!(f, "The Vec is empty, maybe wait for a bit"), - Error::ToSerdeJsonValueError(error) => Debug::fmt(&error, f), - Error::Jiff(error) => Debug::fmt(&error, f), Error::WrongLength => write!(f, "Wrong length"), Error::WrongAddressType => write!(f, "Wrong address type"), Error::UnindexableDate => write!( f, "Date cannot be indexed, must be 2009-01-03, 2009-01-09 or greater" ), + + Error::String(s) => write!(f, "{s}"), } } } diff --git a/crates/brk_core/src/structs/dollars.rs b/crates/brk_core/src/structs/dollars.rs index ffd6b22b6..f79a4e4bf 100644 --- a/crates/brk_core/src/structs/dollars.rs +++ b/crates/brk_core/src/structs/dollars.rs @@ -4,11 +4,12 @@ use std::{ ops::{Add, AddAssign, Div, Mul}, }; +use byteview::ByteView; use derive_deref::Deref; use serde::Serialize; use zerocopy_derive::{FromBytes, Immutable, IntoBytes, KnownLayout}; -use crate::CheckedSub; +use crate::{CheckedSub, Error, copy_first_8bytes}; use super::{Bitcoin, Cents, Close, Sats, StoredF32, StoredF64}; @@ -133,12 +134,18 @@ impl Div for Dollars { impl Mul for Dollars { type Output = Self; fn mul(self, rhs: Bitcoin) -> Self::Output { + self * Sats::from(rhs) + } +} + +impl Mul for Dollars { + type Output = Self; + fn mul(self, rhs: Sats) -> Self::Output { if self.is_nan() { self } else { Self::from(Cents::from( - u128::from(Sats::from(rhs)) * u128::from(Cents::from(self)) - / u128::from(Sats::ONE_BTC), + u128::from(rhs) * u128::from(Cents::from(self)) / u128::from(Sats::ONE_BTC), )) } } @@ -248,3 +255,23 @@ impl Ord for Dollars { } } } + +impl TryFrom for Dollars { + type Error = Error; + fn try_from(value: ByteView) -> Result { + let bytes = copy_first_8bytes(&value)?; + Ok(Self::from(f64::from_be_bytes(bytes))) + } +} + +impl From for ByteView { + fn from(value: Dollars) -> Self { + Self::from(&value) + } +} + +impl From<&Dollars> for ByteView { + fn from(value: &Dollars) -> Self { + Self::new(&value.to_be_bytes()) + } +} diff --git a/crates/brk_core/src/structs/sats.rs b/crates/brk_core/src/structs/sats.rs index d3150e318..9bfc05dc9 100644 --- a/crates/brk_core/src/structs/sats.rs +++ b/crates/brk_core/src/structs/sats.rs @@ -4,10 +4,11 @@ use std::{ }; use bitcoin::Amount; +use byteview::ByteView; use serde::Serialize; use zerocopy_derive::{FromBytes, Immutable, IntoBytes, KnownLayout}; -use crate::CheckedSub; +use crate::{CheckedSub, Error, copy_first_8bytes}; use super::{Bitcoin, Cents, Dollars, Height}; @@ -187,3 +188,23 @@ impl From for u128 { value.0 as u128 } } + +impl TryFrom for Sats { + type Error = Error; + fn try_from(value: ByteView) -> Result { + let bytes = copy_first_8bytes(&value)?; + Ok(Self::from(u64::from_be_bytes(bytes))) + } +} + +impl From<&Sats> for ByteView { + fn from(value: &Sats) -> Self { + Self::new(&value.0.to_be_bytes()) + } +} + +impl From for ByteView { + fn from(value: Sats) -> Self { + Self::from(&value) + } +} diff --git a/crates/brk_core/src/utils/bytes.rs b/crates/brk_core/src/utils/bytes.rs index 93d5f6450..e1146adcc 100644 --- a/crates/brk_core/src/utils/bytes.rs +++ b/crates/brk_core/src/utils/bytes.rs @@ -1,9 +1,11 @@ +use crate::{Error, Result}; + #[allow(clippy::result_unit_err)] -pub fn copy_first_8bytes(slice: &[u8]) -> Result<[u8; 8], ()> { +pub fn copy_first_8bytes(slice: &[u8]) -> Result<[u8; 8]> { let mut buf: [u8; 8] = [0; 8]; let buf_len = buf.len(); if slice.len() < buf_len { - return Err(()); + return Err(Error::String("Buffer is too small to convert to 8 bytes")); } slice.iter().take(buf_len).enumerate().for_each(|(i, r)| { buf[i] = *r; diff --git a/crates/brk_exit/src/lib.rs b/crates/brk_exit/src/lib.rs index 8824a2a6e..d29339c9f 100644 --- a/crates/brk_exit/src/lib.rs +++ b/crates/brk_exit/src/lib.rs @@ -57,6 +57,10 @@ impl Exit { self.blocking.store(true, Ordering::SeqCst); } + pub fn blocked(&self) -> bool { + self.blocking.load(Ordering::SeqCst) + } + pub fn release(&self) { self.blocking.store(false, Ordering::SeqCst); } diff --git a/crates/brk_indexer/src/stores.rs b/crates/brk_indexer/src/stores.rs index 12d01c19c..33ca8992c 100644 --- a/crates/brk_indexer/src/stores.rs +++ b/crates/brk_indexer/src/stores.rs @@ -1,8 +1,8 @@ use std::{fs, path::Path, thread}; use brk_core::{ - AddressBytes, AddressBytesHash, BlockHashPrefix, Height, OutputType, OutputTypeIndex, TxIndex, - TxidPrefix, Value, Version, + AddressBytes, AddressBytesHash, BlockHashPrefix, Height, OutputType, OutputTypeIndex, Result, + TxIndex, TxidPrefix, Value, Version, }; use brk_store::Store; use brk_vec::AnyIterableVec; @@ -37,26 +37,29 @@ impl Stores { thread::scope(|scope| { let addressbyteshash_to_outputtypeindex = scope.spawn(|| { Store::import( - keyspace.clone(), + &keyspace, path, "addressbyteshash_to_outputtypeindex", version + VERSION + Version::ZERO, + None, ) }); let blockhashprefix_to_height = scope.spawn(|| { Store::import( - keyspace.clone(), + &keyspace, path, "blockhashprefix_to_height", version + VERSION + Version::ZERO, + None, ) }); let txidprefix_to_txindex = scope.spawn(|| { Store::import( - keyspace.clone(), + &keyspace, path, "txidprefix_to_txindex", version + VERSION + Version::ZERO, + None, ) }); @@ -285,8 +288,8 @@ impl Stores { .unwrap() } - pub fn commit(&mut self, height: Height) -> fjall::Result<()> { - thread::scope(|scope| -> fjall::Result<()> { + pub fn commit(&mut self, height: Height) -> Result<()> { + thread::scope(|scope| -> Result<()> { let addressbyteshash_to_outputtypeindex_commit_handle = scope.spawn(|| self.addressbyteshash_to_outputtypeindex.commit(height)); let blockhashprefix_to_height_commit_handle = @@ -303,7 +306,9 @@ impl Stores { Ok(()) })?; - self.keyspace.persist(PersistMode::SyncAll) + self.keyspace + .persist(PersistMode::SyncAll) + .map_err(|e| e.into()) } pub fn rotate_memtables(&self) { diff --git a/crates/brk_server/Cargo.toml b/crates/brk_server/Cargo.toml index 4107a9149..ef75e75d2 100644 --- a/crates/brk_server/Cargo.toml +++ b/crates/brk_server/Cargo.toml @@ -24,7 +24,7 @@ color-eyre = { workspace = true } jiff = { workspace = true } log = { workspace = true } minreq = { workspace = true } -oxc = { version = "0.72.1", features = ["codegen", "minifier"] } +oxc = { version = "0.72.2", features = ["codegen", "minifier"] } serde = { workspace = true } tokio = { workspace = true } tower-http = { version = "0.6.4", features = ["compression-full", "trace"] } diff --git a/crates/brk_state/Cargo.toml b/crates/brk_state/Cargo.toml index 54054d91f..a0f130a73 100644 --- a/crates/brk_state/Cargo.toml +++ b/crates/brk_state/Cargo.toml @@ -10,6 +10,7 @@ repository.workspace = true brk_core = { workspace = true } brk_vec = { workspace = true } brk_store = { workspace = true } +fjall = { workspace = true } rayon = { workspace = true } serde = { workspace = true } zerocopy = { workspace = true } diff --git a/crates/brk_state/src/cohort.rs b/crates/brk_state/src/cohort.rs index c7735639e..e0924e404 100644 --- a/crates/brk_state/src/cohort.rs +++ b/crates/brk_state/src/cohort.rs @@ -1,16 +1,47 @@ -use brk_core::{Dollars, Sats}; +use std::{cmp::Ordering, path::Path}; + +use brk_core::{CheckedSub, Dollars, Height, Result, Sats, Version}; use brk_store::Store; +use fjall::TransactionalKeyspace; + +use crate::UnrealizedState; use super::{RealizedState, SupplyState}; -#[derive(Default, Clone)] +#[derive(Clone)] pub struct CohortState { pub supply: SupplyState, pub realized: Option, - // pub price_to_amount: Store, + pub price_to_amount: Store, } impl CohortState { + pub fn default_and_import( + keyspace: &TransactionalKeyspace, + path: &Path, + name: &str, + version: Version, + compute_dollars: bool, + ) -> Result { + Ok(Self { + supply: SupplyState::default(), + realized: compute_dollars.then_some(RealizedState::NAN), + price_to_amount: Store::import( + keyspace, + path, + &format!("{name}_price_to_amount"), + version + Version::TWO, + Some(None), + )?, + }) + } + + pub fn commit(&mut self, height: Height) -> Result<()> { + self.price_to_amount + .retain_or_del(|_, sats| *sats != Sats::ZERO); + self.price_to_amount.commit(height) + } + pub fn reset_single_iteration_values(&mut self) { if let Some(realized) = self.realized.as_mut() { realized.reset_single_iteration_values(); @@ -20,21 +51,27 @@ impl CohortState { pub fn increment(&mut self, supply_state: &SupplyState, price: Option) { self.supply += supply_state; if let Some(realized) = self.realized.as_mut() { - realized.increment(supply_state, price.unwrap()); + let price = price.unwrap(); + realized.increment(supply_state, price); + *self.price_to_amount.get_mut_or_default(&price) += supply_state.value; } } pub fn decrement(&mut self, supply_state: &SupplyState, price: Option) { self.supply -= supply_state; if let Some(realized) = self.realized.as_mut() { - realized.decrement(supply_state, price.unwrap()); + let price = price.unwrap(); + realized.decrement(supply_state, price); + *self.price_to_amount.get_mut_or_default(&price) -= supply_state.value; } } pub fn receive(&mut self, supply_state: &SupplyState, price: Option) { self.supply += supply_state; if let Some(realized) = self.realized.as_mut() { - realized.receive(supply_state, price.unwrap()); + let price = price.unwrap(); + realized.receive(supply_state, price); + *self.price_to_amount.get_mut_or_default(&price) += supply_state.value; } } @@ -47,12 +84,63 @@ impl CohortState { ) { self.supply -= supply_state; if let Some(realized) = self.realized.as_mut() { - realized.send( - supply_state, - current_price.unwrap(), - prev_price.unwrap(), - older_than_hour, - ); + let current_price = current_price.unwrap(); + let prev_price = prev_price.unwrap(); + realized.send(supply_state, current_price, prev_price, older_than_hour); + *self.price_to_amount.get_mut_or_default(&prev_price) -= supply_state.value; } } + + pub fn compute_unrealized_states( + &self, + height_price: Dollars, + date_price: Option, + ) -> (UnrealizedState, Option) { + if self.price_to_amount.is_empty() { + return ( + UnrealizedState::NAN, + date_price.map(|_| UnrealizedState::NAN), + ); + } + + let mut height_unrealized_state = UnrealizedState::ZERO; + let mut date_unrealized_state = date_price.map(|_| UnrealizedState::ZERO); + + let update_state = + |price: Dollars, current_price: Dollars, sats: Sats, state: &mut UnrealizedState| { + match price.cmp(¤t_price) { + Ordering::Equal => { + state.supply_even += sats; + } + Ordering::Less => { + state.supply_in_profit += sats; + // if price > Dollars::ZERO { + // state.unrealized_profit += + // current_price.checked_sub(price).unwrap() * sats; + // } + } + Ordering::Greater => { + state.supply_in_loss += sats; + // state.unrealized_loss += price.checked_sub(current_price).unwrap() * sats; + } + } + }; + + self.price_to_amount + .unordered_clone_iter() + .for_each(|(price, sats)| { + update_state(price, height_price, sats, &mut height_unrealized_state); + + if let Some(date_price) = date_price { + update_state( + price, + date_price, + sats, + date_unrealized_state.as_mut().unwrap(), + ) + } + }); + + (height_unrealized_state, date_unrealized_state) + } } diff --git a/crates/brk_state/src/lib.rs b/crates/brk_state/src/lib.rs index e2093964f..5d86434d3 100644 --- a/crates/brk_state/src/lib.rs +++ b/crates/brk_state/src/lib.rs @@ -5,11 +5,13 @@ mod realized; // mod hot; mod supply; mod transacted; +mod unrealized; pub use block::*; pub use cohort::*; pub use outputs::*; pub use realized::*; +pub use unrealized::*; // pub use hot::*; pub use supply::*; pub use transacted::*; diff --git a/crates/brk_state/src/realized.rs b/crates/brk_state/src/realized.rs index 6ed11e964..7d673ae8d 100644 --- a/crates/brk_state/src/realized.rs +++ b/crates/brk_state/src/realized.rs @@ -1,6 +1,6 @@ use std::cmp::Ordering; -use brk_core::{Bitcoin, CheckedSub, Dollars}; +use brk_core::{CheckedSub, Dollars}; use super::SupplyState; @@ -52,12 +52,12 @@ impl RealizedState { self.adj_value_destroyed = Dollars::ZERO; } - let value = price * Bitcoin::from(supply_state.value); + let value = price * supply_state.value; self.cap += value; } pub fn decrement(&mut self, supply_state: &SupplyState, price: Dollars) { - let value = price * Bitcoin::from(supply_state.value); + let value = price * supply_state.value; self.cap = self.cap.checked_sub(value).unwrap(); } @@ -72,8 +72,8 @@ impl RealizedState { prev_price: Dollars, older_than_hour: bool, ) { - let current_value = current_price * Bitcoin::from(supply_state.value); - let prev_value = prev_price * Bitcoin::from(supply_state.value); + let current_value = current_price * supply_state.value; + let prev_value = prev_price * supply_state.value; self.value_created += current_value; self.value_destroyed += prev_value; diff --git a/crates/brk_state/src/unrealized.rs b/crates/brk_state/src/unrealized.rs new file mode 100644 index 000000000..51ba02520 --- /dev/null +++ b/crates/brk_state/src/unrealized.rs @@ -0,0 +1,28 @@ +use brk_core::{Dollars, Sats}; + +#[derive(Debug, Default, Clone)] +pub struct UnrealizedState { + pub supply_in_profit: Sats, + pub supply_even: Sats, + pub supply_in_loss: Sats, + pub unrealized_profit: Dollars, + pub unrealized_loss: Dollars, +} + +impl UnrealizedState { + pub const NAN: Self = Self { + supply_in_profit: Sats::ZERO, + supply_even: Sats::ZERO, + supply_in_loss: Sats::ZERO, + unrealized_profit: Dollars::NAN, + unrealized_loss: Dollars::NAN, + }; + + pub const ZERO: Self = Self { + supply_in_profit: Sats::ZERO, + supply_even: Sats::ZERO, + supply_in_loss: Sats::ZERO, + unrealized_profit: Dollars::ZERO, + unrealized_loss: Dollars::ZERO, + }; +} diff --git a/crates/brk_store/src/lib.rs b/crates/brk_store/src/lib.rs index c0dca67db..9be1ebe7e 100644 --- a/crates/brk_store/src/lib.rs +++ b/crates/brk_store/src/lib.rs @@ -6,10 +6,10 @@ use std::{ path::Path, }; -use brk_core::{Height, Value, Version}; +use brk_core::{Height, Result, Value, Version}; use byteview::ByteView; use fjall::{ - PartitionCreateOptions, PersistMode, ReadTransaction, Result, TransactionalKeyspace, + PartitionCreateOptions, PersistMode, ReadTransaction, TransactionalKeyspace, TransactionalPartitionHandle, }; use zerocopy::{Immutable, IntoBytes}; @@ -25,29 +25,34 @@ pub struct Store { rtx: ReadTransaction, puts: BTreeMap, dels: BTreeSet, + bloom_filter_bits: Option>, } +/// Use default if will read +const DEFAULT_BLOOM_FILTER_BITS: Option = Some(5); const CHECK_COLLISISONS: bool = true; const MAJOR_FJALL_VERSION: Version = Version::TWO; impl Store where - K: Debug + Clone + Into + Ord + Immutable + IntoBytes, + K: Debug + Clone + Into + TryFrom + Ord + Immutable + IntoBytes, V: Debug + Clone + Into + TryFrom, + >::Error: error::Error + Send + Sync + 'static, >::Error: error::Error + Send + Sync + 'static, { pub fn import( - keyspace: TransactionalKeyspace, + keyspace: &TransactionalKeyspace, path: &Path, name: &str, version: Version, - ) -> color_eyre::Result { + bloom_filter_bits: Option>, + ) -> Result { let (meta, partition) = StoreMeta::checked_open( - &keyspace, + keyspace, &path.join(format!("meta/{name}")), MAJOR_FJALL_VERSION + version, || { - Self::open_partition_handle(&keyspace, name).inspect_err(|e| { + Self::open_partition_handle(keyspace, name, bloom_filter_bits).inspect_err(|e| { eprintln!("{e}"); eprintln!("Delete {path:?} and try again"); }) @@ -59,11 +64,12 @@ where Ok(Self { meta, name: name.to_owned(), - keyspace, + keyspace: keyspace.clone(), partition, rtx, puts: BTreeMap::new(), dels: BTreeSet::new(), + bloom_filter_bits, }) } @@ -77,6 +83,29 @@ where } } + pub fn get_mut_or_default(&mut self, key: &K) -> &mut V + where + V: Default, + { + self.puts.entry(key.clone()).or_insert_with(|| { + if let Some(slice) = self.rtx.get(&self.partition, key.as_bytes()).unwrap() { + V::try_from(slice.as_bytes().into()).unwrap() + } else { + V::default() + } + }) + } + + pub fn unordered_clone_iter(&self) -> impl Iterator { + self.rtx + .iter(&self.partition) + .map(|res| res.unwrap()) + .map(|(k, v)| (K::try_from(ByteView::from(k)).unwrap(), v)) + .filter(|(k, _)| !self.puts.contains_key(k) && !self.dels.contains(k)) + .map(|(k, v)| (k, V::try_from(ByteView::from(v)).unwrap())) + .chain(self.puts.iter().map(|(k, v)| (k.clone(), v.clone()))) + } + pub fn insert_if_needed(&mut self, key: K, value: V, height: Height) { if self.needs(height) { if !self.dels.is_empty() { @@ -102,6 +131,19 @@ where } } + pub fn retain_or_del(&mut self, retain: F) + where + F: Fn(&K, &mut V) -> bool, + { + self.puts.retain(|k, v| { + let ret = retain(k, v); + if !ret { + self.dels.insert(k.clone()); + } + ret + }); + } + pub fn commit(&mut self, height: Height) -> Result<()> { if self.has(height) && self.puts.is_empty() && self.dels.is_empty() { return Ok(()); @@ -169,20 +211,24 @@ where fn open_partition_handle( keyspace: &TransactionalKeyspace, name: &str, + bloom_filter_bits: Option>, ) -> Result { - keyspace.open_partition( - name, - PartitionCreateOptions::default() - .bloom_filter_bits(Some(5)) - .max_memtable_size(8 * 1024 * 1024) - .manual_journal_persist(true), - ) + keyspace + .open_partition( + name, + PartitionCreateOptions::default() + .bloom_filter_bits(bloom_filter_bits.unwrap_or(DEFAULT_BLOOM_FILTER_BITS)) + .max_memtable_size(8 * 1024 * 1024) + .manual_journal_persist(true), + ) + .map_err(|e| e.into()) } pub fn reset_partition(&mut self) -> Result<()> { self.keyspace.delete_partition(self.partition.clone())?; self.keyspace.persist(PersistMode::SyncAll)?; - self.partition = Self::open_partition_handle(&self.keyspace, &self.name)?; + self.partition = + Self::open_partition_handle(&self.keyspace, &self.name, self.bloom_filter_bits)?; Ok(()) } } @@ -201,6 +247,7 @@ where rtx: self.keyspace.read_tx(), puts: self.puts.clone(), dels: self.dels.clone(), + bloom_filter_bits: self.bloom_filter_bits, } } } diff --git a/crates/brk_store/src/meta.rs b/crates/brk_store/src/meta.rs index 239626dd9..71f3b5e42 100644 --- a/crates/brk_store/src/meta.rs +++ b/crates/brk_store/src/meta.rs @@ -3,7 +3,7 @@ use std::{ path::{Path, PathBuf}, }; -use brk_core::Version; +use brk_core::{Result, Version}; use fjall::{TransactionalKeyspace, TransactionalPartitionHandle}; use zerocopy::{FromBytes, IntoBytes}; @@ -23,9 +23,9 @@ impl StoreMeta { path: &Path, version: Version, open_partition_handle: F, - ) -> color_eyre::Result<(Self, TransactionalPartitionHandle)> + ) -> Result<(Self, TransactionalPartitionHandle)> where - F: Fn() -> fjall::Result, + F: Fn() -> Result, { fs::create_dir_all(path)?; @@ -109,7 +109,7 @@ impl StoreMeta { path.join("height") } - fn read_length_(path: &Path) -> color_eyre::Result { + fn read_length_(path: &Path) -> Result { Ok(fs::read(Self::path_length(path)) .map(|v| usize::read_from_bytes(v.as_slice()).unwrap_or_default()) .unwrap_or_default()) diff --git a/crates/brk_vec/src/variants/eager.rs b/crates/brk_vec/src/variants/eager.rs index 159a33f7a..3d4aaaaaa 100644 --- a/crates/brk_vec/src/variants/eager.rs +++ b/crates/brk_vec/src/variants/eager.rs @@ -58,9 +58,14 @@ where if exit.triggered() { return Ok(()); } - exit.block(); + let blocked = exit.blocked(); + if !blocked { + exit.block(); + } self.inner.truncate_if_needed(index)?; - exit.release(); + if !blocked { + exit.release(); + } Ok(()) } @@ -89,9 +94,14 @@ where if exit.triggered() { return Ok(()); } - exit.block(); + let blocked = exit.blocked(); + if !blocked { + exit.block(); + } self.inner.flush()?; - exit.release(); + if !blocked { + exit.release(); + } Ok(()) } diff --git a/websites/kibo.money/packages/lightweight-charts/wrapper.js b/websites/kibo.money/packages/lightweight-charts/wrapper.js index 302dd3684..a48c0a72a 100644 --- a/websites/kibo.money/packages/lightweight-charts/wrapper.js +++ b/websites/kibo.money/packages/lightweight-charts/wrapper.js @@ -511,7 +511,7 @@ export default import("./v5.0.6-treeshaked/script.js").then((lc) => { lineWidth: /** @type {any} */ (1.5), visible: defaultActive !== false, baseValue: { - price: 0, + price: options?.createPriceLine?.value ?? 0, }, ...options, topLineColor: options?.topLineColor ?? colors.green(), diff --git a/websites/kibo.money/scripts/options.js b/websites/kibo.money/scripts/options.js index a8b2c32cb..0ef222c2b 100644 --- a/websites/kibo.money/scripts/options.js +++ b/websites/kibo.money/scripts/options.js @@ -1273,9 +1273,15 @@ function createPartialOptions(colors) { color: colors.green, }), createBaseSeries({ - key: `${fixKey(args.key)}negative-realized-loss`, + key: `${fixKey(args.key)}realized-loss`, name: "Loss", color: colors.red, + defaultActive: false, + }), + createBaseSeries({ + key: `${fixKey(args.key)}negative-realized-loss`, + name: "Negative Loss", + color: colors.red, }), ], }, @@ -2818,48 +2824,3 @@ export function initOptions({ // name: "Highly Liquid", // }, // ]); - -// return { -// xTermHolders, -// upTo, -// fromX, -// fromXToY, -// epochs, -// age, -// type, -// size, -// address, -// liquidities, -// averages, -// cumulativeReturns, -// compoundReturns, -// percentiles, -// }; -// } -// /** -// * @typedef {ReturnType} Groups -// * -// * @typedef {Groups["age"][number]["id"]} AgeCohortId -// * -// * @typedef {Exclude} AgeCohortIdSub -// * -// * @typedef {Groups["address"][number]["key"]} AddressCohortId -// * -// * @typedef {Groups["liquidities"][number]["id"]} LiquidityId -// * -// * @typedef {AgeCohortId | AddressCohortId} AnyCohortId -// * -// * @typedef {AddressCohortId | LiquidityId} AnyAddressCohortId -// * -// * @typedef {AnyCohortId | LiquidityId} AnyPossibleCohortId -// * -// * @typedef {'' | `${AgeCohortIdSub | AddressCohortId | LiquidityId}-`} AnyDatasetPrefix -// * -// * @typedef {Groups["averages"][number]["key"]} AverageName -// * -// * @typedef {Groups["cumulativeReturns"][number]["key"]} CumulativeReturnKey -// * -// * @typedef {Groups["compoundReturns"][number]["key"]} CompoundReturnKey -// * -// * @typedef {Groups["percentiles"][number]["id"]} PercentileId -// */ diff --git a/websites/kibo.money/scripts/vecid-to-indexes.js b/websites/kibo.money/scripts/vecid-to-indexes.js index 740166522..d6b92950b 100644 --- a/websites/kibo.money/scripts/vecid-to-indexes.js +++ b/websites/kibo.money/scripts/vecid-to-indexes.js @@ -80,8 +80,13 @@ export function createVecIdToIndexes() { "0sat-sell-side-risk-ratio": [0], "0sat-spent-output-profit-ratio": [0], "0sat-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "0sat-supply-even": [0, 1, 5, 7, 19, 22, 23], "0sat-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "0sat-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "0sat-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "0sat-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "0sat-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "0sat-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "0sat-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "0sat-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "0sat-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -754,8 +759,13 @@ export function createVecIdToIndexes() { "empty-sell-side-risk-ratio": [0], "empty-spent-output-profit-ratio": [0], "empty-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "empty-supply-even": [0, 1, 5, 7, 19, 22, 23], "empty-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "empty-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "empty-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "empty-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "empty-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "empty-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "empty-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "empty-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "empty-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -816,8 +826,13 @@ export function createVecIdToIndexes() { "epoch-0-sell-side-risk-ratio": [0], "epoch-0-spent-output-profit-ratio": [0], "epoch-0-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "epoch-0-supply-even": [0, 1, 5, 7, 19, 22, 23], "epoch-0-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "epoch-0-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "epoch-0-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "epoch-0-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "epoch-0-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "epoch-0-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "epoch-0-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "epoch-0-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "epoch-0-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -867,8 +882,13 @@ export function createVecIdToIndexes() { "epoch-1-sell-side-risk-ratio": [0], "epoch-1-spent-output-profit-ratio": [0], "epoch-1-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "epoch-1-supply-even": [0, 1, 5, 7, 19, 22, 23], "epoch-1-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "epoch-1-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "epoch-1-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "epoch-1-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "epoch-1-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "epoch-1-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "epoch-1-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "epoch-1-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "epoch-1-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -918,8 +938,13 @@ export function createVecIdToIndexes() { "epoch-2-sell-side-risk-ratio": [0], "epoch-2-spent-output-profit-ratio": [0], "epoch-2-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "epoch-2-supply-even": [0, 1, 5, 7, 19, 22, 23], "epoch-2-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "epoch-2-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "epoch-2-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "epoch-2-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "epoch-2-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "epoch-2-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "epoch-2-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "epoch-2-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "epoch-2-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -969,8 +994,13 @@ export function createVecIdToIndexes() { "epoch-3-sell-side-risk-ratio": [0], "epoch-3-spent-output-profit-ratio": [0], "epoch-3-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "epoch-3-supply-even": [0, 1, 5, 7, 19, 22, 23], "epoch-3-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "epoch-3-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "epoch-3-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "epoch-3-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "epoch-3-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "epoch-3-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "epoch-3-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "epoch-3-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "epoch-3-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -1020,8 +1050,13 @@ export function createVecIdToIndexes() { "epoch-4-sell-side-risk-ratio": [0], "epoch-4-spent-output-profit-ratio": [0], "epoch-4-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "epoch-4-supply-even": [0, 1, 5, 7, 19, 22, 23], "epoch-4-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "epoch-4-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "epoch-4-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "epoch-4-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "epoch-4-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "epoch-4-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "epoch-4-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "epoch-4-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "epoch-4-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -1128,8 +1163,13 @@ export function createVecIdToIndexes() { "from-1-000-000sats-to-10-000-000sats-sell-side-risk-ratio": [0], "from-1-000-000sats-to-10-000-000sats-spent-output-profit-ratio": [0], "from-1-000-000sats-to-10-000-000sats-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "from-1-000-000sats-to-10-000-000sats-supply-even": [0, 1, 5, 7, 19, 22, 23], "from-1-000-000sats-to-10-000-000sats-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "from-1-000-000sats-to-10-000-000sats-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "from-1-000-000sats-to-10-000-000sats-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "from-1-000-000sats-to-10-000-000sats-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "from-1-000-000sats-to-10-000-000sats-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "from-1-000-000sats-to-10-000-000sats-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "from-1-000-000sats-to-10-000-000sats-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "from-1-000-000sats-to-10-000-000sats-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "from-1-000-000sats-to-10-000-000sats-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -1179,8 +1219,13 @@ export function createVecIdToIndexes() { "from-1-000btc-to-10-000btc-sell-side-risk-ratio": [0], "from-1-000btc-to-10-000btc-spent-output-profit-ratio": [0], "from-1-000btc-to-10-000btc-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "from-1-000btc-to-10-000btc-supply-even": [0, 1, 5, 7, 19, 22, 23], "from-1-000btc-to-10-000btc-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "from-1-000btc-to-10-000btc-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "from-1-000btc-to-10-000btc-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "from-1-000btc-to-10-000btc-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "from-1-000btc-to-10-000btc-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "from-1-000btc-to-10-000btc-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "from-1-000btc-to-10-000btc-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "from-1-000btc-to-10-000btc-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "from-1-000btc-to-10-000btc-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -1230,8 +1275,13 @@ export function createVecIdToIndexes() { "from-1-000sats-to-10-000sats-sell-side-risk-ratio": [0], "from-1-000sats-to-10-000sats-spent-output-profit-ratio": [0], "from-1-000sats-to-10-000sats-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "from-1-000sats-to-10-000sats-supply-even": [0, 1, 5, 7, 19, 22, 23], "from-1-000sats-to-10-000sats-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "from-1-000sats-to-10-000sats-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "from-1-000sats-to-10-000sats-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "from-1-000sats-to-10-000sats-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "from-1-000sats-to-10-000sats-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "from-1-000sats-to-10-000sats-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "from-1-000sats-to-10-000sats-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "from-1-000sats-to-10-000sats-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "from-1-000sats-to-10-000sats-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -1281,8 +1331,13 @@ export function createVecIdToIndexes() { "from-10-000-000sats-to-1btc-sell-side-risk-ratio": [0], "from-10-000-000sats-to-1btc-spent-output-profit-ratio": [0], "from-10-000-000sats-to-1btc-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "from-10-000-000sats-to-1btc-supply-even": [0, 1, 5, 7, 19, 22, 23], "from-10-000-000sats-to-1btc-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "from-10-000-000sats-to-1btc-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "from-10-000-000sats-to-1btc-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "from-10-000-000sats-to-1btc-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "from-10-000-000sats-to-1btc-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "from-10-000-000sats-to-1btc-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "from-10-000-000sats-to-1btc-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "from-10-000-000sats-to-1btc-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "from-10-000-000sats-to-1btc-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -1332,8 +1387,13 @@ export function createVecIdToIndexes() { "from-10-000btc-to-100-000btc-sell-side-risk-ratio": [0], "from-10-000btc-to-100-000btc-spent-output-profit-ratio": [0], "from-10-000btc-to-100-000btc-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "from-10-000btc-to-100-000btc-supply-even": [0, 1, 5, 7, 19, 22, 23], "from-10-000btc-to-100-000btc-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "from-10-000btc-to-100-000btc-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "from-10-000btc-to-100-000btc-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "from-10-000btc-to-100-000btc-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "from-10-000btc-to-100-000btc-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "from-10-000btc-to-100-000btc-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "from-10-000btc-to-100-000btc-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "from-10-000btc-to-100-000btc-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "from-10-000btc-to-100-000btc-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -1383,8 +1443,13 @@ export function createVecIdToIndexes() { "from-10-000sats-to-100-000sats-sell-side-risk-ratio": [0], "from-10-000sats-to-100-000sats-spent-output-profit-ratio": [0], "from-10-000sats-to-100-000sats-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "from-10-000sats-to-100-000sats-supply-even": [0, 1, 5, 7, 19, 22, 23], "from-10-000sats-to-100-000sats-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "from-10-000sats-to-100-000sats-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "from-10-000sats-to-100-000sats-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "from-10-000sats-to-100-000sats-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "from-10-000sats-to-100-000sats-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "from-10-000sats-to-100-000sats-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "from-10-000sats-to-100-000sats-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "from-10-000sats-to-100-000sats-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "from-10-000sats-to-100-000sats-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -1434,8 +1499,13 @@ export function createVecIdToIndexes() { "from-100-000btc-sell-side-risk-ratio": [0], "from-100-000btc-spent-output-profit-ratio": [0], "from-100-000btc-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "from-100-000btc-supply-even": [0, 1, 5, 7, 19, 22, 23], "from-100-000btc-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "from-100-000btc-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "from-100-000btc-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "from-100-000btc-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "from-100-000btc-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "from-100-000btc-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "from-100-000btc-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "from-100-000btc-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "from-100-000btc-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -1485,8 +1555,13 @@ export function createVecIdToIndexes() { "from-100-000sats-to-1-000-000sats-sell-side-risk-ratio": [0], "from-100-000sats-to-1-000-000sats-spent-output-profit-ratio": [0], "from-100-000sats-to-1-000-000sats-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "from-100-000sats-to-1-000-000sats-supply-even": [0, 1, 5, 7, 19, 22, 23], "from-100-000sats-to-1-000-000sats-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "from-100-000sats-to-1-000-000sats-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "from-100-000sats-to-1-000-000sats-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "from-100-000sats-to-1-000-000sats-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "from-100-000sats-to-1-000-000sats-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "from-100-000sats-to-1-000-000sats-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "from-100-000sats-to-1-000-000sats-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "from-100-000sats-to-1-000-000sats-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "from-100-000sats-to-1-000-000sats-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -1536,8 +1611,13 @@ export function createVecIdToIndexes() { "from-100btc-to-1-000btc-sell-side-risk-ratio": [0], "from-100btc-to-1-000btc-spent-output-profit-ratio": [0], "from-100btc-to-1-000btc-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "from-100btc-to-1-000btc-supply-even": [0, 1, 5, 7, 19, 22, 23], "from-100btc-to-1-000btc-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "from-100btc-to-1-000btc-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "from-100btc-to-1-000btc-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "from-100btc-to-1-000btc-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "from-100btc-to-1-000btc-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "from-100btc-to-1-000btc-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "from-100btc-to-1-000btc-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "from-100btc-to-1-000btc-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "from-100btc-to-1-000btc-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -1587,8 +1667,13 @@ export function createVecIdToIndexes() { "from-100sats-to-1-000sats-sell-side-risk-ratio": [0], "from-100sats-to-1-000sats-spent-output-profit-ratio": [0], "from-100sats-to-1-000sats-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "from-100sats-to-1-000sats-supply-even": [0, 1, 5, 7, 19, 22, 23], "from-100sats-to-1-000sats-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "from-100sats-to-1-000sats-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "from-100sats-to-1-000sats-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "from-100sats-to-1-000sats-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "from-100sats-to-1-000sats-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "from-100sats-to-1-000sats-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "from-100sats-to-1-000sats-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "from-100sats-to-1-000sats-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "from-100sats-to-1-000sats-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -1638,8 +1723,13 @@ export function createVecIdToIndexes() { "from-10btc-to-100btc-sell-side-risk-ratio": [0], "from-10btc-to-100btc-spent-output-profit-ratio": [0], "from-10btc-to-100btc-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "from-10btc-to-100btc-supply-even": [0, 1, 5, 7, 19, 22, 23], "from-10btc-to-100btc-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "from-10btc-to-100btc-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "from-10btc-to-100btc-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "from-10btc-to-100btc-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "from-10btc-to-100btc-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "from-10btc-to-100btc-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "from-10btc-to-100btc-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "from-10btc-to-100btc-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "from-10btc-to-100btc-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -1689,8 +1779,13 @@ export function createVecIdToIndexes() { "from-10sats-to-100sats-sell-side-risk-ratio": [0], "from-10sats-to-100sats-spent-output-profit-ratio": [0], "from-10sats-to-100sats-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "from-10sats-to-100sats-supply-even": [0, 1, 5, 7, 19, 22, 23], "from-10sats-to-100sats-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "from-10sats-to-100sats-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "from-10sats-to-100sats-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "from-10sats-to-100sats-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "from-10sats-to-100sats-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "from-10sats-to-100sats-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "from-10sats-to-100sats-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "from-10sats-to-100sats-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "from-10sats-to-100sats-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -1740,7 +1835,10 @@ export function createVecIdToIndexes() { "from-10y-sell-side-risk-ratio": [0], "from-10y-spent-output-profit-ratio": [0], "from-10y-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "from-10y-supply-even": [0, 1, 5, 7, 19, 22, 23], "from-10y-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "from-10y-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "from-10y-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "from-10y-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], "from-10y-to-15y-adjusted-spent-output-profit-ratio": [0], "from-10y-to-15y-adjusted-value-created": [0, 1, 2, 5, 7, 19, 22, 23], @@ -1788,11 +1886,18 @@ export function createVecIdToIndexes() { "from-10y-to-15y-sell-side-risk-ratio": [0], "from-10y-to-15y-spent-output-profit-ratio": [0], "from-10y-to-15y-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "from-10y-to-15y-supply-even": [0, 1, 5, 7, 19, 22, 23], "from-10y-to-15y-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "from-10y-to-15y-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "from-10y-to-15y-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "from-10y-to-15y-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "from-10y-to-15y-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "from-10y-to-15y-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "from-10y-to-15y-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "from-10y-to-15y-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "from-10y-to-15y-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], + "from-10y-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "from-10y-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "from-10y-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "from-10y-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "from-10y-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -1842,8 +1947,13 @@ export function createVecIdToIndexes() { "from-15y-sell-side-risk-ratio": [0], "from-15y-spent-output-profit-ratio": [0], "from-15y-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "from-15y-supply-even": [0, 1, 5, 7, 19, 22, 23], "from-15y-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "from-15y-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "from-15y-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "from-15y-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "from-15y-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "from-15y-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "from-15y-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "from-15y-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "from-15y-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -1893,8 +2003,13 @@ export function createVecIdToIndexes() { "from-1btc-to-10btc-sell-side-risk-ratio": [0], "from-1btc-to-10btc-spent-output-profit-ratio": [0], "from-1btc-to-10btc-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "from-1btc-to-10btc-supply-even": [0, 1, 5, 7, 19, 22, 23], "from-1btc-to-10btc-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "from-1btc-to-10btc-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "from-1btc-to-10btc-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "from-1btc-to-10btc-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "from-1btc-to-10btc-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "from-1btc-to-10btc-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "from-1btc-to-10btc-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "from-1btc-to-10btc-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "from-1btc-to-10btc-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -1944,7 +2059,10 @@ export function createVecIdToIndexes() { "from-1d-sell-side-risk-ratio": [0], "from-1d-spent-output-profit-ratio": [0], "from-1d-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "from-1d-supply-even": [0, 1, 5, 7, 19, 22, 23], "from-1d-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "from-1d-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "from-1d-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "from-1d-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], "from-1d-to-1w-adjusted-spent-output-profit-ratio": [0], "from-1d-to-1w-adjusted-value-created": [0, 1, 2, 5, 7, 19, 22, 23], @@ -1992,11 +2110,18 @@ export function createVecIdToIndexes() { "from-1d-to-1w-sell-side-risk-ratio": [0], "from-1d-to-1w-spent-output-profit-ratio": [0], "from-1d-to-1w-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "from-1d-to-1w-supply-even": [0, 1, 5, 7, 19, 22, 23], "from-1d-to-1w-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "from-1d-to-1w-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "from-1d-to-1w-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "from-1d-to-1w-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "from-1d-to-1w-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "from-1d-to-1w-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "from-1d-to-1w-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "from-1d-to-1w-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "from-1d-to-1w-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], + "from-1d-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "from-1d-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "from-1d-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "from-1d-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "from-1d-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -2046,7 +2171,10 @@ export function createVecIdToIndexes() { "from-1m-sell-side-risk-ratio": [0], "from-1m-spent-output-profit-ratio": [0], "from-1m-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "from-1m-supply-even": [0, 1, 5, 7, 19, 22, 23], "from-1m-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "from-1m-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "from-1m-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "from-1m-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], "from-1m-to-3m-adjusted-spent-output-profit-ratio": [0], "from-1m-to-3m-adjusted-value-created": [0, 1, 2, 5, 7, 19, 22, 23], @@ -2094,11 +2222,18 @@ export function createVecIdToIndexes() { "from-1m-to-3m-sell-side-risk-ratio": [0], "from-1m-to-3m-spent-output-profit-ratio": [0], "from-1m-to-3m-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "from-1m-to-3m-supply-even": [0, 1, 5, 7, 19, 22, 23], "from-1m-to-3m-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "from-1m-to-3m-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "from-1m-to-3m-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "from-1m-to-3m-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "from-1m-to-3m-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "from-1m-to-3m-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "from-1m-to-3m-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "from-1m-to-3m-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "from-1m-to-3m-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], + "from-1m-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "from-1m-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "from-1m-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "from-1m-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "from-1m-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -2148,8 +2283,13 @@ export function createVecIdToIndexes() { "from-1sat-to-10sats-sell-side-risk-ratio": [0], "from-1sat-to-10sats-spent-output-profit-ratio": [0], "from-1sat-to-10sats-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "from-1sat-to-10sats-supply-even": [0, 1, 5, 7, 19, 22, 23], "from-1sat-to-10sats-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "from-1sat-to-10sats-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "from-1sat-to-10sats-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "from-1sat-to-10sats-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "from-1sat-to-10sats-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "from-1sat-to-10sats-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "from-1sat-to-10sats-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "from-1sat-to-10sats-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "from-1sat-to-10sats-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -2199,7 +2339,10 @@ export function createVecIdToIndexes() { "from-1w-sell-side-risk-ratio": [0], "from-1w-spent-output-profit-ratio": [0], "from-1w-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "from-1w-supply-even": [0, 1, 5, 7, 19, 22, 23], "from-1w-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "from-1w-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "from-1w-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "from-1w-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], "from-1w-to-1m-adjusted-spent-output-profit-ratio": [0], "from-1w-to-1m-adjusted-value-created": [0, 1, 2, 5, 7, 19, 22, 23], @@ -2247,11 +2390,18 @@ export function createVecIdToIndexes() { "from-1w-to-1m-sell-side-risk-ratio": [0], "from-1w-to-1m-spent-output-profit-ratio": [0], "from-1w-to-1m-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "from-1w-to-1m-supply-even": [0, 1, 5, 7, 19, 22, 23], "from-1w-to-1m-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "from-1w-to-1m-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "from-1w-to-1m-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "from-1w-to-1m-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "from-1w-to-1m-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "from-1w-to-1m-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "from-1w-to-1m-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "from-1w-to-1m-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "from-1w-to-1m-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], + "from-1w-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "from-1w-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "from-1w-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "from-1w-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "from-1w-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -2301,7 +2451,10 @@ export function createVecIdToIndexes() { "from-1y-sell-side-risk-ratio": [0], "from-1y-spent-output-profit-ratio": [0], "from-1y-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "from-1y-supply-even": [0, 1, 5, 7, 19, 22, 23], "from-1y-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "from-1y-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "from-1y-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "from-1y-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], "from-1y-to-2y-adjusted-spent-output-profit-ratio": [0], "from-1y-to-2y-adjusted-value-created": [0, 1, 2, 5, 7, 19, 22, 23], @@ -2349,11 +2502,18 @@ export function createVecIdToIndexes() { "from-1y-to-2y-sell-side-risk-ratio": [0], "from-1y-to-2y-spent-output-profit-ratio": [0], "from-1y-to-2y-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "from-1y-to-2y-supply-even": [0, 1, 5, 7, 19, 22, 23], "from-1y-to-2y-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "from-1y-to-2y-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "from-1y-to-2y-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "from-1y-to-2y-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "from-1y-to-2y-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "from-1y-to-2y-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "from-1y-to-2y-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "from-1y-to-2y-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "from-1y-to-2y-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], + "from-1y-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "from-1y-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "from-1y-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "from-1y-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "from-1y-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -2403,8 +2563,13 @@ export function createVecIdToIndexes() { "from-2m-sell-side-risk-ratio": [0], "from-2m-spent-output-profit-ratio": [0], "from-2m-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "from-2m-supply-even": [0, 1, 5, 7, 19, 22, 23], "from-2m-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "from-2m-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "from-2m-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "from-2m-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "from-2m-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "from-2m-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "from-2m-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "from-2m-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "from-2m-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -2454,7 +2619,10 @@ export function createVecIdToIndexes() { "from-2y-sell-side-risk-ratio": [0], "from-2y-spent-output-profit-ratio": [0], "from-2y-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "from-2y-supply-even": [0, 1, 5, 7, 19, 22, 23], "from-2y-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "from-2y-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "from-2y-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "from-2y-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], "from-2y-to-3y-adjusted-spent-output-profit-ratio": [0], "from-2y-to-3y-adjusted-value-created": [0, 1, 2, 5, 7, 19, 22, 23], @@ -2502,11 +2670,18 @@ export function createVecIdToIndexes() { "from-2y-to-3y-sell-side-risk-ratio": [0], "from-2y-to-3y-spent-output-profit-ratio": [0], "from-2y-to-3y-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "from-2y-to-3y-supply-even": [0, 1, 5, 7, 19, 22, 23], "from-2y-to-3y-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "from-2y-to-3y-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "from-2y-to-3y-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "from-2y-to-3y-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "from-2y-to-3y-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "from-2y-to-3y-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "from-2y-to-3y-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "from-2y-to-3y-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "from-2y-to-3y-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], + "from-2y-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "from-2y-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "from-2y-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "from-2y-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "from-2y-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -2556,7 +2731,10 @@ export function createVecIdToIndexes() { "from-3m-sell-side-risk-ratio": [0], "from-3m-spent-output-profit-ratio": [0], "from-3m-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "from-3m-supply-even": [0, 1, 5, 7, 19, 22, 23], "from-3m-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "from-3m-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "from-3m-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "from-3m-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], "from-3m-to-6m-adjusted-spent-output-profit-ratio": [0], "from-3m-to-6m-adjusted-value-created": [0, 1, 2, 5, 7, 19, 22, 23], @@ -2604,11 +2782,18 @@ export function createVecIdToIndexes() { "from-3m-to-6m-sell-side-risk-ratio": [0], "from-3m-to-6m-spent-output-profit-ratio": [0], "from-3m-to-6m-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "from-3m-to-6m-supply-even": [0, 1, 5, 7, 19, 22, 23], "from-3m-to-6m-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "from-3m-to-6m-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "from-3m-to-6m-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "from-3m-to-6m-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "from-3m-to-6m-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "from-3m-to-6m-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "from-3m-to-6m-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "from-3m-to-6m-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "from-3m-to-6m-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], + "from-3m-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "from-3m-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "from-3m-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "from-3m-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "from-3m-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -2658,7 +2843,10 @@ export function createVecIdToIndexes() { "from-3y-sell-side-risk-ratio": [0], "from-3y-spent-output-profit-ratio": [0], "from-3y-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "from-3y-supply-even": [0, 1, 5, 7, 19, 22, 23], "from-3y-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "from-3y-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "from-3y-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "from-3y-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], "from-3y-to-4y-adjusted-spent-output-profit-ratio": [0], "from-3y-to-4y-adjusted-value-created": [0, 1, 2, 5, 7, 19, 22, 23], @@ -2706,11 +2894,18 @@ export function createVecIdToIndexes() { "from-3y-to-4y-sell-side-risk-ratio": [0], "from-3y-to-4y-spent-output-profit-ratio": [0], "from-3y-to-4y-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "from-3y-to-4y-supply-even": [0, 1, 5, 7, 19, 22, 23], "from-3y-to-4y-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "from-3y-to-4y-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "from-3y-to-4y-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "from-3y-to-4y-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "from-3y-to-4y-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "from-3y-to-4y-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "from-3y-to-4y-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "from-3y-to-4y-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "from-3y-to-4y-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], + "from-3y-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "from-3y-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "from-3y-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "from-3y-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "from-3y-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -2760,8 +2955,13 @@ export function createVecIdToIndexes() { "from-4m-sell-side-risk-ratio": [0], "from-4m-spent-output-profit-ratio": [0], "from-4m-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "from-4m-supply-even": [0, 1, 5, 7, 19, 22, 23], "from-4m-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "from-4m-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "from-4m-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "from-4m-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "from-4m-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "from-4m-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "from-4m-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "from-4m-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "from-4m-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -2811,7 +3011,10 @@ export function createVecIdToIndexes() { "from-4y-sell-side-risk-ratio": [0], "from-4y-spent-output-profit-ratio": [0], "from-4y-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "from-4y-supply-even": [0, 1, 5, 7, 19, 22, 23], "from-4y-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "from-4y-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "from-4y-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "from-4y-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], "from-4y-to-5y-adjusted-spent-output-profit-ratio": [0], "from-4y-to-5y-adjusted-value-created": [0, 1, 2, 5, 7, 19, 22, 23], @@ -2859,11 +3062,18 @@ export function createVecIdToIndexes() { "from-4y-to-5y-sell-side-risk-ratio": [0], "from-4y-to-5y-spent-output-profit-ratio": [0], "from-4y-to-5y-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "from-4y-to-5y-supply-even": [0, 1, 5, 7, 19, 22, 23], "from-4y-to-5y-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "from-4y-to-5y-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "from-4y-to-5y-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "from-4y-to-5y-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "from-4y-to-5y-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "from-4y-to-5y-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "from-4y-to-5y-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "from-4y-to-5y-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "from-4y-to-5y-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], + "from-4y-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "from-4y-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "from-4y-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "from-4y-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "from-4y-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -2913,8 +3123,13 @@ export function createVecIdToIndexes() { "from-5m-sell-side-risk-ratio": [0], "from-5m-spent-output-profit-ratio": [0], "from-5m-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "from-5m-supply-even": [0, 1, 5, 7, 19, 22, 23], "from-5m-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "from-5m-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "from-5m-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "from-5m-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "from-5m-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "from-5m-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "from-5m-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "from-5m-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "from-5m-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -2964,7 +3179,10 @@ export function createVecIdToIndexes() { "from-5y-sell-side-risk-ratio": [0], "from-5y-spent-output-profit-ratio": [0], "from-5y-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "from-5y-supply-even": [0, 1, 5, 7, 19, 22, 23], "from-5y-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "from-5y-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "from-5y-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "from-5y-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], "from-5y-to-7y-adjusted-spent-output-profit-ratio": [0], "from-5y-to-7y-adjusted-value-created": [0, 1, 2, 5, 7, 19, 22, 23], @@ -3012,11 +3230,18 @@ export function createVecIdToIndexes() { "from-5y-to-7y-sell-side-risk-ratio": [0], "from-5y-to-7y-spent-output-profit-ratio": [0], "from-5y-to-7y-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "from-5y-to-7y-supply-even": [0, 1, 5, 7, 19, 22, 23], "from-5y-to-7y-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "from-5y-to-7y-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "from-5y-to-7y-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "from-5y-to-7y-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "from-5y-to-7y-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "from-5y-to-7y-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "from-5y-to-7y-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "from-5y-to-7y-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "from-5y-to-7y-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], + "from-5y-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "from-5y-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "from-5y-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "from-5y-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "from-5y-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -3066,7 +3291,10 @@ export function createVecIdToIndexes() { "from-6m-sell-side-risk-ratio": [0], "from-6m-spent-output-profit-ratio": [0], "from-6m-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "from-6m-supply-even": [0, 1, 5, 7, 19, 22, 23], "from-6m-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "from-6m-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "from-6m-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "from-6m-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], "from-6m-to-1y-adjusted-spent-output-profit-ratio": [0], "from-6m-to-1y-adjusted-value-created": [0, 1, 2, 5, 7, 19, 22, 23], @@ -3114,11 +3342,18 @@ export function createVecIdToIndexes() { "from-6m-to-1y-sell-side-risk-ratio": [0], "from-6m-to-1y-spent-output-profit-ratio": [0], "from-6m-to-1y-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "from-6m-to-1y-supply-even": [0, 1, 5, 7, 19, 22, 23], "from-6m-to-1y-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "from-6m-to-1y-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "from-6m-to-1y-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "from-6m-to-1y-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "from-6m-to-1y-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "from-6m-to-1y-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "from-6m-to-1y-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "from-6m-to-1y-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "from-6m-to-1y-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], + "from-6m-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "from-6m-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "from-6m-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "from-6m-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "from-6m-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -3168,8 +3403,13 @@ export function createVecIdToIndexes() { "from-6y-sell-side-risk-ratio": [0], "from-6y-spent-output-profit-ratio": [0], "from-6y-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "from-6y-supply-even": [0, 1, 5, 7, 19, 22, 23], "from-6y-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "from-6y-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "from-6y-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "from-6y-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "from-6y-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "from-6y-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "from-6y-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "from-6y-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "from-6y-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -3219,7 +3459,10 @@ export function createVecIdToIndexes() { "from-7y-sell-side-risk-ratio": [0], "from-7y-spent-output-profit-ratio": [0], "from-7y-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "from-7y-supply-even": [0, 1, 5, 7, 19, 22, 23], "from-7y-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "from-7y-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "from-7y-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "from-7y-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], "from-7y-to-10y-adjusted-spent-output-profit-ratio": [0], "from-7y-to-10y-adjusted-value-created": [0, 1, 2, 5, 7, 19, 22, 23], @@ -3267,11 +3510,18 @@ export function createVecIdToIndexes() { "from-7y-to-10y-sell-side-risk-ratio": [0], "from-7y-to-10y-spent-output-profit-ratio": [0], "from-7y-to-10y-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "from-7y-to-10y-supply-even": [0, 1, 5, 7, 19, 22, 23], "from-7y-to-10y-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "from-7y-to-10y-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "from-7y-to-10y-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "from-7y-to-10y-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "from-7y-to-10y-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "from-7y-to-10y-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "from-7y-to-10y-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "from-7y-to-10y-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "from-7y-to-10y-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], + "from-7y-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "from-7y-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "from-7y-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "from-7y-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "from-7y-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -3321,8 +3571,13 @@ export function createVecIdToIndexes() { "from-8y-sell-side-risk-ratio": [0], "from-8y-spent-output-profit-ratio": [0], "from-8y-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "from-8y-supply-even": [0, 1, 5, 7, 19, 22, 23], "from-8y-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "from-8y-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "from-8y-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "from-8y-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "from-8y-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "from-8y-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "from-8y-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "from-8y-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "from-8y-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -3396,8 +3651,13 @@ export function createVecIdToIndexes() { "lth-sell-side-risk-ratio": [0], "lth-spent-output-profit-ratio": [0], "lth-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "lth-supply-even": [0, 1, 5, 7, 19, 22, 23], "lth-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "lth-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "lth-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "lth-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "lth-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "lth-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "lth-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "lth-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "lth-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -3498,8 +3758,13 @@ export function createVecIdToIndexes() { "p2a-sell-side-risk-ratio": [0], "p2a-spent-output-profit-ratio": [0], "p2a-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "p2a-supply-even": [0, 1, 5, 7, 19, 22, 23], "p2a-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "p2a-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "p2a-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "p2a-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "p2a-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "p2a-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "p2a-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "p2a-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "p2a-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -3561,8 +3826,13 @@ export function createVecIdToIndexes() { "p2ms-sell-side-risk-ratio": [0], "p2ms-spent-output-profit-ratio": [0], "p2ms-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "p2ms-supply-even": [0, 1, 5, 7, 19, 22, 23], "p2ms-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "p2ms-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "p2ms-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "p2ms-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "p2ms-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "p2ms-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "p2ms-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "p2ms-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "p2ms-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -3623,8 +3893,13 @@ export function createVecIdToIndexes() { "p2pk33-sell-side-risk-ratio": [0], "p2pk33-spent-output-profit-ratio": [0], "p2pk33-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "p2pk33-supply-even": [0, 1, 5, 7, 19, 22, 23], "p2pk33-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "p2pk33-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "p2pk33-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "p2pk33-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "p2pk33-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "p2pk33-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "p2pk33-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "p2pk33-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "p2pk33-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -3686,8 +3961,13 @@ export function createVecIdToIndexes() { "p2pk65-sell-side-risk-ratio": [0], "p2pk65-spent-output-profit-ratio": [0], "p2pk65-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "p2pk65-supply-even": [0, 1, 5, 7, 19, 22, 23], "p2pk65-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "p2pk65-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "p2pk65-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "p2pk65-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "p2pk65-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "p2pk65-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "p2pk65-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "p2pk65-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "p2pk65-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -3749,8 +4029,13 @@ export function createVecIdToIndexes() { "p2pkh-sell-side-risk-ratio": [0], "p2pkh-spent-output-profit-ratio": [0], "p2pkh-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "p2pkh-supply-even": [0, 1, 5, 7, 19, 22, 23], "p2pkh-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "p2pkh-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "p2pkh-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "p2pkh-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "p2pkh-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "p2pkh-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "p2pkh-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "p2pkh-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "p2pkh-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -3812,8 +4097,13 @@ export function createVecIdToIndexes() { "p2sh-sell-side-risk-ratio": [0], "p2sh-spent-output-profit-ratio": [0], "p2sh-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "p2sh-supply-even": [0, 1, 5, 7, 19, 22, 23], "p2sh-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "p2sh-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "p2sh-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "p2sh-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "p2sh-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "p2sh-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "p2sh-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "p2sh-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "p2sh-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -3875,8 +4165,13 @@ export function createVecIdToIndexes() { "p2tr-sell-side-risk-ratio": [0], "p2tr-spent-output-profit-ratio": [0], "p2tr-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "p2tr-supply-even": [0, 1, 5, 7, 19, 22, 23], "p2tr-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "p2tr-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "p2tr-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "p2tr-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "p2tr-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "p2tr-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "p2tr-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "p2tr-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "p2tr-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -3938,8 +4233,13 @@ export function createVecIdToIndexes() { "p2wpkh-sell-side-risk-ratio": [0], "p2wpkh-spent-output-profit-ratio": [0], "p2wpkh-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "p2wpkh-supply-even": [0, 1, 5, 7, 19, 22, 23], "p2wpkh-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "p2wpkh-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "p2wpkh-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "p2wpkh-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "p2wpkh-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "p2wpkh-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "p2wpkh-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "p2wpkh-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "p2wpkh-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -4001,8 +4301,13 @@ export function createVecIdToIndexes() { "p2wsh-sell-side-risk-ratio": [0], "p2wsh-spent-output-profit-ratio": [0], "p2wsh-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "p2wsh-supply-even": [0, 1, 5, 7, 19, 22, 23], "p2wsh-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "p2wsh-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "p2wsh-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "p2wsh-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "p2wsh-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "p2wsh-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "p2wsh-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "p2wsh-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "p2wsh-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -4109,8 +4414,13 @@ export function createVecIdToIndexes() { "sth-sell-side-risk-ratio": [0], "sth-spent-output-profit-ratio": [0], "sth-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "sth-supply-even": [0, 1, 5, 7, 19, 22, 23], "sth-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "sth-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "sth-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "sth-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "sth-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "sth-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "sth-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "sth-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "sth-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -4145,7 +4455,10 @@ export function createVecIdToIndexes() { "subsidy-min": [0, 1, 2, 7, 19, 22, 23], "subsidy-sum": [0, 1, 2, 7, 19, 22, 23], "supply": [0, 1, 2, 5, 7, 19, 22, 23], + "supply-even": [0, 1, 5, 7, 19, 22, 23], "supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], "timestamp": [0, 1, 2, 4, 5, 7, 19, 22, 23], "timestamp-fixed": [5], @@ -4238,8 +4551,13 @@ export function createVecIdToIndexes() { "unknown-sell-side-risk-ratio": [0], "unknown-spent-output-profit-ratio": [0], "unknown-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "unknown-supply-even": [0, 1, 5, 7, 19, 22, 23], "unknown-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "unknown-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "unknown-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "unknown-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "unknown-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "unknown-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "unknown-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "unknown-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "unknown-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -4254,6 +4572,8 @@ export function createVecIdToIndexes() { "unknownoutput-count-min": [0, 1, 2, 7, 19, 22, 23], "unknownoutput-count-sum": [0, 1, 2, 7, 19, 22, 23], "unknownoutputindex": [21], + "unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "unspendable-supply": [0, 1, 2, 5, 7, 19, 22, 23], "unspendable-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], "unspendable-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], @@ -4303,8 +4623,13 @@ export function createVecIdToIndexes() { "up-to-10y-sell-side-risk-ratio": [0], "up-to-10y-spent-output-profit-ratio": [0], "up-to-10y-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-10y-supply-even": [0, 1, 5, 7, 19, 22, 23], "up-to-10y-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-10y-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "up-to-10y-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "up-to-10y-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-10y-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "up-to-10y-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "up-to-10y-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "up-to-10y-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "up-to-10y-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -4354,8 +4679,13 @@ export function createVecIdToIndexes() { "up-to-15y-sell-side-risk-ratio": [0], "up-to-15y-spent-output-profit-ratio": [0], "up-to-15y-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-15y-supply-even": [0, 1, 5, 7, 19, 22, 23], "up-to-15y-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-15y-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "up-to-15y-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "up-to-15y-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-15y-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "up-to-15y-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "up-to-15y-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "up-to-15y-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "up-to-15y-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -4405,8 +4735,13 @@ export function createVecIdToIndexes() { "up-to-1d-sell-side-risk-ratio": [0], "up-to-1d-spent-output-profit-ratio": [0], "up-to-1d-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-1d-supply-even": [0, 1, 5, 7, 19, 22, 23], "up-to-1d-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-1d-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "up-to-1d-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "up-to-1d-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-1d-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "up-to-1d-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "up-to-1d-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "up-to-1d-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "up-to-1d-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -4456,8 +4791,13 @@ export function createVecIdToIndexes() { "up-to-1m-sell-side-risk-ratio": [0], "up-to-1m-spent-output-profit-ratio": [0], "up-to-1m-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-1m-supply-even": [0, 1, 5, 7, 19, 22, 23], "up-to-1m-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-1m-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "up-to-1m-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "up-to-1m-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-1m-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "up-to-1m-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "up-to-1m-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "up-to-1m-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "up-to-1m-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -4507,8 +4847,13 @@ export function createVecIdToIndexes() { "up-to-1w-sell-side-risk-ratio": [0], "up-to-1w-spent-output-profit-ratio": [0], "up-to-1w-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-1w-supply-even": [0, 1, 5, 7, 19, 22, 23], "up-to-1w-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-1w-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "up-to-1w-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "up-to-1w-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-1w-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "up-to-1w-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "up-to-1w-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "up-to-1w-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "up-to-1w-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -4558,8 +4903,13 @@ export function createVecIdToIndexes() { "up-to-1y-sell-side-risk-ratio": [0], "up-to-1y-spent-output-profit-ratio": [0], "up-to-1y-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-1y-supply-even": [0, 1, 5, 7, 19, 22, 23], "up-to-1y-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-1y-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "up-to-1y-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "up-to-1y-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-1y-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "up-to-1y-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "up-to-1y-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "up-to-1y-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "up-to-1y-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -4609,8 +4959,13 @@ export function createVecIdToIndexes() { "up-to-2m-sell-side-risk-ratio": [0], "up-to-2m-spent-output-profit-ratio": [0], "up-to-2m-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-2m-supply-even": [0, 1, 5, 7, 19, 22, 23], "up-to-2m-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-2m-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "up-to-2m-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "up-to-2m-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-2m-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "up-to-2m-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "up-to-2m-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "up-to-2m-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "up-to-2m-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -4660,8 +5015,13 @@ export function createVecIdToIndexes() { "up-to-2y-sell-side-risk-ratio": [0], "up-to-2y-spent-output-profit-ratio": [0], "up-to-2y-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-2y-supply-even": [0, 1, 5, 7, 19, 22, 23], "up-to-2y-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-2y-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "up-to-2y-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "up-to-2y-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-2y-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "up-to-2y-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "up-to-2y-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "up-to-2y-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "up-to-2y-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -4711,8 +5071,13 @@ export function createVecIdToIndexes() { "up-to-3m-sell-side-risk-ratio": [0], "up-to-3m-spent-output-profit-ratio": [0], "up-to-3m-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-3m-supply-even": [0, 1, 5, 7, 19, 22, 23], "up-to-3m-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-3m-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "up-to-3m-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "up-to-3m-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-3m-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "up-to-3m-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "up-to-3m-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "up-to-3m-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "up-to-3m-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -4762,8 +5127,13 @@ export function createVecIdToIndexes() { "up-to-3y-sell-side-risk-ratio": [0], "up-to-3y-spent-output-profit-ratio": [0], "up-to-3y-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-3y-supply-even": [0, 1, 5, 7, 19, 22, 23], "up-to-3y-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-3y-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "up-to-3y-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "up-to-3y-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-3y-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "up-to-3y-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "up-to-3y-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "up-to-3y-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "up-to-3y-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -4813,8 +5183,13 @@ export function createVecIdToIndexes() { "up-to-4m-sell-side-risk-ratio": [0], "up-to-4m-spent-output-profit-ratio": [0], "up-to-4m-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-4m-supply-even": [0, 1, 5, 7, 19, 22, 23], "up-to-4m-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-4m-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "up-to-4m-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "up-to-4m-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-4m-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "up-to-4m-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "up-to-4m-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "up-to-4m-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "up-to-4m-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -4864,8 +5239,13 @@ export function createVecIdToIndexes() { "up-to-4y-sell-side-risk-ratio": [0], "up-to-4y-spent-output-profit-ratio": [0], "up-to-4y-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-4y-supply-even": [0, 1, 5, 7, 19, 22, 23], "up-to-4y-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-4y-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "up-to-4y-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "up-to-4y-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-4y-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "up-to-4y-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "up-to-4y-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "up-to-4y-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "up-to-4y-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -4915,8 +5295,13 @@ export function createVecIdToIndexes() { "up-to-5m-sell-side-risk-ratio": [0], "up-to-5m-spent-output-profit-ratio": [0], "up-to-5m-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-5m-supply-even": [0, 1, 5, 7, 19, 22, 23], "up-to-5m-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-5m-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "up-to-5m-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "up-to-5m-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-5m-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "up-to-5m-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "up-to-5m-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "up-to-5m-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "up-to-5m-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -4966,8 +5351,13 @@ export function createVecIdToIndexes() { "up-to-5y-sell-side-risk-ratio": [0], "up-to-5y-spent-output-profit-ratio": [0], "up-to-5y-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-5y-supply-even": [0, 1, 5, 7, 19, 22, 23], "up-to-5y-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-5y-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "up-to-5y-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "up-to-5y-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-5y-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "up-to-5y-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "up-to-5y-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "up-to-5y-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "up-to-5y-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -5017,8 +5407,13 @@ export function createVecIdToIndexes() { "up-to-6m-sell-side-risk-ratio": [0], "up-to-6m-spent-output-profit-ratio": [0], "up-to-6m-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-6m-supply-even": [0, 1, 5, 7, 19, 22, 23], "up-to-6m-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-6m-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "up-to-6m-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "up-to-6m-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-6m-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "up-to-6m-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "up-to-6m-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "up-to-6m-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "up-to-6m-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -5068,8 +5463,13 @@ export function createVecIdToIndexes() { "up-to-6y-sell-side-risk-ratio": [0], "up-to-6y-spent-output-profit-ratio": [0], "up-to-6y-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-6y-supply-even": [0, 1, 5, 7, 19, 22, 23], "up-to-6y-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-6y-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "up-to-6y-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "up-to-6y-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-6y-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "up-to-6y-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "up-to-6y-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "up-to-6y-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "up-to-6y-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -5119,8 +5519,13 @@ export function createVecIdToIndexes() { "up-to-7y-sell-side-risk-ratio": [0], "up-to-7y-spent-output-profit-ratio": [0], "up-to-7y-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-7y-supply-even": [0, 1, 5, 7, 19, 22, 23], "up-to-7y-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-7y-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "up-to-7y-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "up-to-7y-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-7y-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "up-to-7y-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "up-to-7y-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "up-to-7y-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "up-to-7y-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23], @@ -5170,8 +5575,13 @@ export function createVecIdToIndexes() { "up-to-8y-sell-side-risk-ratio": [0], "up-to-8y-spent-output-profit-ratio": [0], "up-to-8y-supply": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-8y-supply-even": [0, 1, 5, 7, 19, 22, 23], "up-to-8y-supply-in-btc": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-8y-supply-in-loss": [0, 1, 5, 7, 19, 22, 23], + "up-to-8y-supply-in-profit": [0, 1, 5, 7, 19, 22, 23], "up-to-8y-supply-in-usd": [0, 1, 2, 5, 7, 19, 22, 23], + "up-to-8y-unrealized-loss": [0, 1, 5, 7, 19, 22, 23], + "up-to-8y-unrealized-profit": [0, 1, 5, 7, 19, 22, 23], "up-to-8y-utxo-count": [0, 1, 2, 5, 7, 19, 22, 23], "up-to-8y-value-created": [0, 1, 2, 5, 7, 19, 22, 23], "up-to-8y-value-destroyed": [0, 1, 2, 5, 7, 19, 22, 23],