From ef0b77baa87892a58d70c52aae3d7f204abdc0b8 Mon Sep 17 00:00:00 2001 From: nym21 Date: Wed, 4 Mar 2026 23:21:56 +0100 Subject: [PATCH] global: snapshot --- Cargo.lock | 117 +- Cargo.toml | 6 +- crates/brk_client/src/lib.rs | 5587 ++++------------- .../src/cointime/activity/compute.rs | 17 +- .../brk_computer/src/cointime/cap/compute.rs | 19 +- .../src/cointime/pricing/compute.rs | 19 +- .../src/cointime/value/compute.rs | 26 +- .../src/distribution/block/cohort/received.rs | 5 +- .../src/distribution/block/cohort/sent.rs | 4 +- .../src/distribution/block/utxo/inputs.rs | 8 +- .../src/distribution/block/utxo/outputs.rs | 89 +- .../src/distribution/cohorts/utxo/groups.rs | 352 +- .../src/distribution/cohorts/utxo/mod.rs | 1 + .../distribution/cohorts/utxo/percentiles.rs | 322 + .../src/distribution/cohorts/utxo/receive.rs | 11 +- .../src/distribution/cohorts/utxo/send.rs | 86 +- .../distribution/cohorts/utxo/tick_tock.rs | 8 +- .../src/distribution/compute/block_loop.rs | 44 +- .../src/distribution/compute/readers.rs | 92 +- .../src/distribution/compute/write.rs | 2 +- .../src/distribution/metrics/activity.rs | 37 +- .../src/distribution/metrics/cohort/basic.rs | 46 +- .../src/distribution/metrics/mod.rs | 52 +- .../src/distribution/metrics/realized/base.rs | 133 +- .../distribution/metrics/unrealized/base.rs | 70 +- .../src/distribution/state/cohort/base.rs | 128 +- .../src/distribution/state/cost_basis/data.rs | 34 +- .../state/cost_basis/percentiles.rs | 35 +- .../src/internal/aggregate/distribution.rs | 8 +- .../src/internal/aggregate/full.rs | 4 +- .../src/internal/algo/sliding_distribution.rs | 7 +- .../src/internal/algo/sliding_median.rs | 7 +- .../src/internal/algo/sliding_window.rs | 5 +- .../brk_computer/src/internal/algo/tdigest.rs | 31 +- .../src/internal/from_height/percent.rs | 10 +- .../internal/from_height/ratio/extension.rs | 4 +- .../internal/from_height/stddev/extended.rs | 12 +- .../src/internal/from_height/stddev/mod.rs | 13 + crates/brk_computer/src/market/dca/compute.rs | 3 +- .../src/market/indicators/compute.rs | 75 +- .../src/market/returns/compute.rs | 50 +- .../src/market/volatility/compute.rs | 100 +- .../src/mining/hashrate/compute.rs | 83 +- .../src/mining/rewards/compute.rs | 3 +- crates/brk_computer/src/prices/compute.rs | 17 +- crates/brk_computer/src/supply/compute.rs | 15 +- crates/brk_types/src/basis_points_16.rs | 6 +- crates/brk_types/src/fundedaddressdata.rs | 2 +- crates/brk_types/src/supply_state.rs | 2 +- modules/brk-client/index.js | 16 +- packages/brk_client/brk_client/__init__.py | 16 +- 51 files changed, 2109 insertions(+), 5730 deletions(-) create mode 100644 crates/brk_computer/src/distribution/cohorts/utxo/percentiles.rs diff --git a/Cargo.lock b/Cargo.lock index b420a311e..5b92b1646 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -98,9 +98,9 @@ checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "async-compression" -version = "0.4.40" +version = "0.4.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d67d43201f4d20c78bcda740c142ca52482d81da80681533d33bf3f0596c8e2" +checksum = "d0f9ee0f6e02ffd7ad5816e9464499fba7b3effd01123b515c41d1697c43dad1" dependencies = [ "compression-codecs", "compression-core", @@ -1140,9 +1140,9 @@ dependencies = [ [[package]] name = "dlib" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412" +checksum = "ab8ecd87370524b461f8557c119c405552c396ed91fc0a8eec68679eab26f94a" dependencies = [ "libloading", ] @@ -1238,9 +1238,9 @@ checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" [[package]] name = "fjall" -version = "3.0.2" +version = "3.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a2799b4198427a08c774838e44d0b77f677208f19a1927671cd2cd36bb30d69" +checksum = "5ce4b4c3a755bae832077657db2727b29b9acc535bb471c6d91ab4fe408fd805" dependencies = [ "byteorder-lite", "byteview", @@ -1463,19 +1463,19 @@ checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" dependencies = [ "cfg-if", "libc", - "r-efi", + "r-efi 5.3.0", "wasip2", ] [[package]] name = "getrandom" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "139ef39800118c7683f2fd3c98c1b23c09ae076556b435f8e9064ae108aaeeec" +checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555" dependencies = [ "cfg-if", "libc", - "r-efi", + "r-efi 6.0.0", "wasip2", "wasip3", ] @@ -1856,9 +1856,9 @@ checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" [[package]] name = "jiff" -version = "0.2.21" +version = "0.2.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3e3d65f018c6ae946ab16e80944b97096ed73c35b221d1c478a6c81d8f57940" +checksum = "1a3546dc96b6d42c5f24902af9e2538e82e39ad350b0c766eb3fbf2d8f3d8359" dependencies = [ "jiff-static", "log", @@ -1870,9 +1870,9 @@ dependencies = [ [[package]] name = "jiff-static" -version = "0.2.21" +version = "0.2.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a17c2b211d863c7fde02cbea8a3c1a439b98e109286554f2860bdded7ff83818" +checksum = "2a8c8b344124222efd714b73bb41f8b5120b27a7cc1c75593a6ff768d9d05aa4" dependencies = [ "proc-macro2", "quote", @@ -1897,9 +1897,9 @@ checksum = "00810f1d8b74be64b13dbf3db89ac67740615d6c891f0e7b6179326533011a07" [[package]] name = "js-sys" -version = "0.3.89" +version = "0.3.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4eacb0641a310445a4c513f2a5e23e19952e269c6a38887254d5f837a305506" +checksum = "b49715b7073f385ba4bc528e5747d02e66cb39c6146efb66b781f131f0fb399c" dependencies = [ "once_cell", "wasm-bindgen", @@ -1940,15 +1940,15 @@ checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" [[package]] name = "lexopt" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fa0e2a1fcbe2f6be6c42e342259976206b383122fc152e872795338b5a3f3a7" +checksum = "803ec87c9cfb29b9d2633f20cba1f488db3fd53f2158b1024cbefb47ba05d413" [[package]] name = "libc" -version = "0.2.180" +version = "0.2.182" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc" +checksum = "6800badb6cb2082ffd7b6a67e6125bb39f18782f793520caee8cb8846be06112" [[package]] name = "libloading" @@ -1984,19 +1984,18 @@ dependencies = [ [[package]] name = "libredox" -version = "0.1.12" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d0b95e02c851351f877147b7deea7b1afb1df71b63aa5f8270716e0c5720616" +checksum = "1744e39d1d6a9948f4f388969627434e31128196de472883b39f148769bfe30a" dependencies = [ - "bitflags 2.11.0", "libc", ] [[package]] name = "linux-raw-sys" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" [[package]] name = "litemap" @@ -2021,9 +2020,9 @@ checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" [[package]] name = "lsm-tree" -version = "3.0.2" +version = "3.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86e8d0b8e0cf2531a437788ce94d95570dbaabfe9888db20022c2d5ccec9b221" +checksum = "341e13fa389d2e24023c2c2c110ae556b29fa59a2e734872de295863e11a6741" dependencies = [ "byteorder-lite", "byteview", @@ -2257,9 +2256,9 @@ checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" [[package]] name = "pin-project-lite" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" [[package]] name = "pin-utils" @@ -2407,9 +2406,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.44" +version = "1.0.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4" +checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" dependencies = [ "proc-macro2", ] @@ -2420,6 +2419,12 @@ version = "5.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + [[package]] name = "rand" version = "0.8.5" @@ -2566,9 +2571,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.9" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a96887878f22d7bad8a3b6dc5b7440e0ada9a245242924394987b21cf2210a4c" +checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" [[package]] name = "ring" @@ -2616,9 +2621,9 @@ dependencies = [ [[package]] name = "rustix" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34" +checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" dependencies = [ "bitflags 2.11.0", "errno", @@ -2975,12 +2980,12 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.25.0" +version = "3.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0136791f7c95b1f6dd99f9cc786b91bb81c3800b639b3478e561ddb7be95e5f1" +checksum = "82a72c767771b47409d2345987fda8628641887d5466101319899796367354a0" dependencies = [ "fastrand", - "getrandom 0.4.1", + "getrandom 0.4.2", "once_cell", "rustix", "windows-sys 0.61.2", @@ -3027,9 +3032,9 @@ dependencies = [ [[package]] name = "tokio" -version = "1.49.0" +version = "1.50.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72a2903cd7736441aac9df9d7688bd0ce48edccaadf181c3b90be801e81d3d86" +checksum = "27ad5e34374e03cfffefc301becb44e9dc3c17584f414349ebe29ed26661822d" dependencies = [ "libc", "mio", @@ -3041,9 +3046,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.6.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" +checksum = "5c55a2eff8b69ce66c84f85e1da1c233edc36ceb85a2058d11b0d6a3c7e7569c" dependencies = [ "proc-macro2", "quote", @@ -3351,9 +3356,9 @@ dependencies = [ [[package]] name = "wasm-bindgen" -version = "0.2.112" +version = "0.2.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05d7d0fce354c88b7982aec4400b3e7fcf723c32737cef571bd165f7613557ee" +checksum = "6532f9a5c1ece3798cb1c2cfdba640b9b3ba884f5db45973a6f442510a87d38e" dependencies = [ "cfg-if", "once_cell", @@ -3364,9 +3369,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.112" +version = "0.2.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55839b71ba921e4f75b674cb16f843f4b1f3b26ddfcb3454de1cf65cc021ec0f" +checksum = "18a2d50fcf105fb33bb15f00e7a77b772945a2ee45dcf454961fd843e74c18e6" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3374,9 +3379,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.112" +version = "0.2.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "caf2e969c2d60ff52e7e98b7392ff1588bffdd1ccd4769eba27222fd3d621571" +checksum = "03ce4caeaac547cdf713d280eda22a730824dd11e6b8c3ca9e42247b25c631e3" dependencies = [ "bumpalo", "proc-macro2", @@ -3387,9 +3392,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.112" +version = "0.2.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0861f0dcdf46ea819407495634953cdcc8a8c7215ab799a7a7ce366be71c7b30" +checksum = "75a326b8c223ee17883a4251907455a2431acc2791c98c26279376490c378c16" dependencies = [ "unicode-ident", ] @@ -3430,9 +3435,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.89" +version = "0.3.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10053fbf9a374174094915bbce141e87a6bf32ecd9a002980db4b638405e8962" +checksum = "854ba17bb104abfb26ba36da9729addc7ce7f06f5c0f90f3c391f8461cca21f9" dependencies = [ "js-sys", "wasm-bindgen", @@ -3847,18 +3852,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.39" +version = "0.8.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db6d35d663eadb6c932438e763b262fe1a70987f9ae936e60158176d710cae4a" +checksum = "a789c6e490b576db9f7e6b6d661bcc9799f7c0ac8352f56ea20193b2681532e5" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.39" +version = "0.8.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4122cd3169e94605190e77839c9a40d40ed048d305bfdc146e7df40ab0f3e517" +checksum = "f65c489a7071a749c849713807783f70672b28094011623e200cb86dcb835953" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 542f25725..f72c86113 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -68,9 +68,9 @@ brk_website = { version = "0.1.9", path = "crates/brk_website" } byteview = "0.10.1" color-eyre = "0.6.5" derive_more = { version = "2.1.1", features = ["deref", "deref_mut"] } -fjall = "3.0.2" +fjall = "3.0.3" indexmap = { version = "2.13.0", features = ["serde"] } -jiff = { version = "0.2.21", features = ["perf-inline", "tz-system"], default-features = false } +jiff = { version = "0.2.23", features = ["perf-inline", "tz-system"], default-features = false } minreq = { version = "2.14.1", features = ["https", "json-using-serde"] } owo-colors = "4.3.0" parking_lot = "0.12.5" @@ -83,7 +83,7 @@ serde_bytes = "0.11.19" serde_derive = "1.0.228" serde_json = { version = "1.0.149", features = ["float_roundtrip", "preserve_order"] } smallvec = "1.15.1" -tokio = { version = "1.49.0", features = ["rt-multi-thread"] } +tokio = { version = "1.50.0", features = ["rt-multi-thread"] } tracing = { version = "0.1", default-features = false, features = ["std"] } tower-http = { version = "0.6.8", features = ["catch-panic", "compression-br", "compression-gzip", "compression-zstd", "cors", "normalize-path", "timeout", "trace"] } tower-layer = "0.3" diff --git a/crates/brk_client/src/lib.rs b/crates/brk_client/src/lib.rs index 7f2969da4..a5477533d 100644 --- a/crates/brk_client/src/lib.rs +++ b/crates/brk_client/src/lib.rs @@ -7,11 +7,12 @@ #![allow(clippy::useless_format)] #![allow(clippy::unnecessary_to_owned)] +use std::sync::Arc; +use std::ops::{Bound, RangeBounds}; +use serde::de::DeserializeOwned; pub use brk_cohort::*; pub use brk_types::*; -use serde::de::DeserializeOwned; -use std::ops::{Bound, RangeBounds}; -use std::sync::Arc; + /// Error type for BRK client operations. #[derive(Debug)] @@ -76,9 +77,7 @@ impl BrkClientBase { let response = minreq::get(&url) .with_timeout(self.timeout_secs) .send() - .map_err(|e| BrkError { - message: e.to_string(), - })?; + .map_err(|e| BrkError { message: e.to_string() })?; if response.status_code >= 400 { return Err(BrkError { @@ -91,9 +90,9 @@ impl BrkClientBase { /// Make a GET request and deserialize JSON response. pub fn get_json(&self, path: &str) -> Result { - self.get(path)?.json().map_err(|e| BrkError { - message: e.to_string(), - }) + self.get(path)? + .json() + .map_err(|e| BrkError { message: e.to_string() }) } /// Make a GET request and return raw text response. @@ -101,34 +100,25 @@ impl BrkClientBase { self.get(path)? .as_str() .map(|s| s.to_string()) - .map_err(|e| BrkError { - message: e.to_string(), - }) + .map_err(|e| BrkError { message: e.to_string() }) } } /// Build metric name with suffix. #[inline] fn _m(acc: &str, s: &str) -> String { - if s.is_empty() { - acc.to_string() - } else if acc.is_empty() { - s.to_string() - } else { - format!("{acc}_{s}") - } + if s.is_empty() { acc.to_string() } + else if acc.is_empty() { s.to_string() } + else { format!("{acc}_{s}") } } /// Build metric name with prefix. #[inline] fn _p(prefix: &str, acc: &str) -> String { - if acc.is_empty() { - prefix.to_string() - } else { - format!("{prefix}_{acc}") - } + if acc.is_empty() { prefix.to_string() } else { format!("{prefix}_{acc}") } } + /// Non-generic trait for metric patterns (usable in collections). pub trait AnyMetricPattern { /// Get the metric name. @@ -144,6 +134,7 @@ pub trait MetricPattern: AnyMetricPattern { fn get(&self, index: Index) -> Option>; } + /// Shared endpoint configuration. #[derive(Clone)] struct EndpointConfig { @@ -156,13 +147,7 @@ struct EndpointConfig { impl EndpointConfig { fn new(client: Arc, name: Arc, index: Index) -> Self { - Self { - client, - name, - index, - start: None, - end: None, - } + Self { client, name, index, start: None, end: None } } fn path(&self) -> String { @@ -171,21 +156,11 @@ impl EndpointConfig { fn build_path(&self, format: Option<&str>) -> String { let mut params = Vec::new(); - if let Some(s) = self.start { - params.push(format!("start={}", s)); - } - if let Some(e) = self.end { - params.push(format!("end={}", e)); - } - if let Some(fmt) = format { - params.push(format!("format={}", fmt)); - } + if let Some(s) = self.start { params.push(format!("start={}", s)); } + if let Some(e) = self.end { params.push(format!("end={}", e)); } + if let Some(fmt) = format { params.push(format!("format={}", fmt)); } let p = self.path(); - if params.is_empty() { - p - } else { - format!("{}?{}", p, params.join("&")) - } + if params.is_empty() { p } else { format!("{}?{}", p, params.join("&")) } } fn get_json(&self, format: Option<&str>) -> Result { @@ -225,20 +200,14 @@ pub type DateMetricEndpointBuilder = MetricEndpointBuilder MetricEndpointBuilder { pub fn new(client: Arc, name: Arc, index: Index) -> Self { - Self { - config: EndpointConfig::new(client, name, index), - _marker: std::marker::PhantomData, - } + Self { config: EndpointConfig::new(client, name, index), _marker: std::marker::PhantomData } } /// Select a specific index position. pub fn get(mut self, index: usize) -> SingleItemBuilder { self.config.start = Some(index as i64); self.config.end = Some(index as i64 + 1); - SingleItemBuilder { - config: self.config, - _marker: std::marker::PhantomData, - } + SingleItemBuilder { config: self.config, _marker: std::marker::PhantomData } } /// Select a range using Rust range syntax. @@ -260,10 +229,7 @@ impl MetricEndpointBuilder { Bound::Excluded(&n) => Some(n as i64), Bound::Unbounded => None, }; - RangeBuilder { - config: self.config, - _marker: std::marker::PhantomData, - } + RangeBuilder { config: self.config, _marker: std::marker::PhantomData } } /// Take the first n items. @@ -278,19 +244,13 @@ impl MetricEndpointBuilder { } else { self.config.start = Some(-(n as i64)); } - RangeBuilder { - config: self.config, - _marker: std::marker::PhantomData, - } + RangeBuilder { config: self.config, _marker: std::marker::PhantomData } } /// Skip the first n items. Chain with `take(n)` to get a range. pub fn skip(mut self, n: usize) -> SkippedBuilder { self.config.start = Some(n as i64); - SkippedBuilder { - config: self.config, - _marker: std::marker::PhantomData, - } + SkippedBuilder { config: self.config, _marker: std::marker::PhantomData } } /// Fetch all data as parsed JSON. @@ -331,11 +291,7 @@ impl MetricEndpointBuilder> { } /// Select a timestamp range (works for all date-based indexes including sub-daily). - pub fn timestamp_range( - self, - start: Timestamp, - end: Timestamp, - ) -> RangeBuilder> { + pub fn timestamp_range(self, start: Timestamp, end: Timestamp) -> RangeBuilder> { let s = self.config.index.timestamp_to_index(start).unwrap_or(0); let e = self.config.index.timestamp_to_index(end).unwrap_or(0); self.range(s..e) @@ -377,10 +333,7 @@ impl SkippedBuilder { pub fn take(mut self, n: usize) -> RangeBuilder { let start = self.config.start.unwrap_or(0); self.config.end = Some(start + n as i64); - RangeBuilder { - config: self.config, - _marker: std::marker::PhantomData, - } + RangeBuilder { config: self.config, _marker: std::marker::PhantomData } } /// Fetch from the skipped position to the end. @@ -415,42 +368,10 @@ impl RangeBuilder { } } + // Static index arrays -const _I1: &[Index] = &[ - Index::Minute10, - Index::Minute30, - Index::Hour1, - Index::Hour4, - Index::Hour12, - Index::Day1, - Index::Day3, - Index::Week1, - Index::Month1, - Index::Month3, - Index::Month6, - Index::Year1, - Index::Year10, - Index::HalvingEpoch, - Index::DifficultyEpoch, - Index::Height, -]; -const _I2: &[Index] = &[ - Index::Minute10, - Index::Minute30, - Index::Hour1, - Index::Hour4, - Index::Hour12, - Index::Day1, - Index::Day3, - Index::Week1, - Index::Month1, - Index::Month3, - Index::Month6, - Index::Year1, - Index::Year10, - Index::HalvingEpoch, - Index::DifficultyEpoch, -]; +const _I1: &[Index] = &[Index::Minute10, Index::Minute30, Index::Hour1, Index::Hour4, Index::Hour12, Index::Day1, Index::Day3, Index::Week1, Index::Month1, Index::Month3, Index::Month6, Index::Year1, Index::Year10, Index::HalvingEpoch, Index::DifficultyEpoch, Index::Height]; +const _I2: &[Index] = &[Index::Minute10, Index::Minute30, Index::Hour1, Index::Hour4, Index::Hour12, Index::Day1, Index::Day3, Index::Week1, Index::Month1, Index::Month3, Index::Month6, Index::Year1, Index::Year10, Index::HalvingEpoch, Index::DifficultyEpoch]; const _I3: &[Index] = &[Index::Minute10]; const _I4: &[Index] = &[Index::Minute30]; const _I5: &[Index] = &[Index::Hour1]; @@ -486,1762 +407,540 @@ const _I34: &[Index] = &[Index::FundedAddressIndex]; const _I35: &[Index] = &[Index::EmptyAddressIndex]; #[inline] -fn _ep( - c: &Arc, - n: &Arc, - i: Index, -) -> MetricEndpointBuilder { +fn _ep(c: &Arc, n: &Arc, i: Index) -> MetricEndpointBuilder { MetricEndpointBuilder::new(c.clone(), n.clone(), i) } #[inline] -fn _dep( - c: &Arc, - n: &Arc, - i: Index, -) -> DateMetricEndpointBuilder { +fn _dep(c: &Arc, n: &Arc, i: Index) -> DateMetricEndpointBuilder { DateMetricEndpointBuilder::new(c.clone(), n.clone(), i) } // Index accessor structs -pub struct MetricPattern1By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +pub struct MetricPattern1By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern1By { - pub fn minute10(&self) -> DateMetricEndpointBuilder { - _dep(&self.client, &self.name, Index::Minute10) - } - pub fn minute30(&self) -> DateMetricEndpointBuilder { - _dep(&self.client, &self.name, Index::Minute30) - } - pub fn hour1(&self) -> DateMetricEndpointBuilder { - _dep(&self.client, &self.name, Index::Hour1) - } - pub fn hour4(&self) -> DateMetricEndpointBuilder { - _dep(&self.client, &self.name, Index::Hour4) - } - pub fn hour12(&self) -> DateMetricEndpointBuilder { - _dep(&self.client, &self.name, Index::Hour12) - } - pub fn day1(&self) -> DateMetricEndpointBuilder { - _dep(&self.client, &self.name, Index::Day1) - } - pub fn day3(&self) -> DateMetricEndpointBuilder { - _dep(&self.client, &self.name, Index::Day3) - } - pub fn week1(&self) -> DateMetricEndpointBuilder { - _dep(&self.client, &self.name, Index::Week1) - } - pub fn month1(&self) -> DateMetricEndpointBuilder { - _dep(&self.client, &self.name, Index::Month1) - } - pub fn month3(&self) -> DateMetricEndpointBuilder { - _dep(&self.client, &self.name, Index::Month3) - } - pub fn month6(&self) -> DateMetricEndpointBuilder { - _dep(&self.client, &self.name, Index::Month6) - } - pub fn year1(&self) -> DateMetricEndpointBuilder { - _dep(&self.client, &self.name, Index::Year1) - } - pub fn year10(&self) -> DateMetricEndpointBuilder { - _dep(&self.client, &self.name, Index::Year10) - } - pub fn halvingepoch(&self) -> MetricEndpointBuilder { - _ep(&self.client, &self.name, Index::HalvingEpoch) - } - pub fn difficultyepoch(&self) -> MetricEndpointBuilder { - _ep(&self.client, &self.name, Index::DifficultyEpoch) - } - pub fn height(&self) -> MetricEndpointBuilder { - _ep(&self.client, &self.name, Index::Height) - } + pub fn minute10(&self) -> DateMetricEndpointBuilder { _dep(&self.client, &self.name, Index::Minute10) } + pub fn minute30(&self) -> DateMetricEndpointBuilder { _dep(&self.client, &self.name, Index::Minute30) } + pub fn hour1(&self) -> DateMetricEndpointBuilder { _dep(&self.client, &self.name, Index::Hour1) } + pub fn hour4(&self) -> DateMetricEndpointBuilder { _dep(&self.client, &self.name, Index::Hour4) } + pub fn hour12(&self) -> DateMetricEndpointBuilder { _dep(&self.client, &self.name, Index::Hour12) } + pub fn day1(&self) -> DateMetricEndpointBuilder { _dep(&self.client, &self.name, Index::Day1) } + pub fn day3(&self) -> DateMetricEndpointBuilder { _dep(&self.client, &self.name, Index::Day3) } + pub fn week1(&self) -> DateMetricEndpointBuilder { _dep(&self.client, &self.name, Index::Week1) } + pub fn month1(&self) -> DateMetricEndpointBuilder { _dep(&self.client, &self.name, Index::Month1) } + pub fn month3(&self) -> DateMetricEndpointBuilder { _dep(&self.client, &self.name, Index::Month3) } + pub fn month6(&self) -> DateMetricEndpointBuilder { _dep(&self.client, &self.name, Index::Month6) } + pub fn year1(&self) -> DateMetricEndpointBuilder { _dep(&self.client, &self.name, Index::Year1) } + pub fn year10(&self) -> DateMetricEndpointBuilder { _dep(&self.client, &self.name, Index::Year10) } + pub fn halvingepoch(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::HalvingEpoch) } + pub fn difficultyepoch(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::DifficultyEpoch) } + pub fn height(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::Height) } } -pub struct MetricPattern1 { - name: Arc, - pub by: MetricPattern1By, -} +pub struct MetricPattern1 { name: Arc, pub by: MetricPattern1By } impl MetricPattern1 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern1By { - client, - name, - _marker: std::marker::PhantomData, - }, - } - } - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern1By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern1 { - fn name(&self) -> &str { - &self.name - } - fn indexes(&self) -> &'static [Index] { - _I1 - } -} -impl MetricPattern for MetricPattern1 { - fn get(&self, index: Index) -> Option> { - _I1.contains(&index) - .then(|| _ep(&self.by.client, &self.by.name, index)) - } -} +impl AnyMetricPattern for MetricPattern1 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I1 } } +impl MetricPattern for MetricPattern1 { fn get(&self, index: Index) -> Option> { _I1.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } -pub struct MetricPattern2By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +pub struct MetricPattern2By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern2By { - pub fn minute10(&self) -> DateMetricEndpointBuilder { - _dep(&self.client, &self.name, Index::Minute10) - } - pub fn minute30(&self) -> DateMetricEndpointBuilder { - _dep(&self.client, &self.name, Index::Minute30) - } - pub fn hour1(&self) -> DateMetricEndpointBuilder { - _dep(&self.client, &self.name, Index::Hour1) - } - pub fn hour4(&self) -> DateMetricEndpointBuilder { - _dep(&self.client, &self.name, Index::Hour4) - } - pub fn hour12(&self) -> DateMetricEndpointBuilder { - _dep(&self.client, &self.name, Index::Hour12) - } - pub fn day1(&self) -> DateMetricEndpointBuilder { - _dep(&self.client, &self.name, Index::Day1) - } - pub fn day3(&self) -> DateMetricEndpointBuilder { - _dep(&self.client, &self.name, Index::Day3) - } - pub fn week1(&self) -> DateMetricEndpointBuilder { - _dep(&self.client, &self.name, Index::Week1) - } - pub fn month1(&self) -> DateMetricEndpointBuilder { - _dep(&self.client, &self.name, Index::Month1) - } - pub fn month3(&self) -> DateMetricEndpointBuilder { - _dep(&self.client, &self.name, Index::Month3) - } - pub fn month6(&self) -> DateMetricEndpointBuilder { - _dep(&self.client, &self.name, Index::Month6) - } - pub fn year1(&self) -> DateMetricEndpointBuilder { - _dep(&self.client, &self.name, Index::Year1) - } - pub fn year10(&self) -> DateMetricEndpointBuilder { - _dep(&self.client, &self.name, Index::Year10) - } - pub fn halvingepoch(&self) -> MetricEndpointBuilder { - _ep(&self.client, &self.name, Index::HalvingEpoch) - } - pub fn difficultyepoch(&self) -> MetricEndpointBuilder { - _ep(&self.client, &self.name, Index::DifficultyEpoch) - } + pub fn minute10(&self) -> DateMetricEndpointBuilder { _dep(&self.client, &self.name, Index::Minute10) } + pub fn minute30(&self) -> DateMetricEndpointBuilder { _dep(&self.client, &self.name, Index::Minute30) } + pub fn hour1(&self) -> DateMetricEndpointBuilder { _dep(&self.client, &self.name, Index::Hour1) } + pub fn hour4(&self) -> DateMetricEndpointBuilder { _dep(&self.client, &self.name, Index::Hour4) } + pub fn hour12(&self) -> DateMetricEndpointBuilder { _dep(&self.client, &self.name, Index::Hour12) } + pub fn day1(&self) -> DateMetricEndpointBuilder { _dep(&self.client, &self.name, Index::Day1) } + pub fn day3(&self) -> DateMetricEndpointBuilder { _dep(&self.client, &self.name, Index::Day3) } + pub fn week1(&self) -> DateMetricEndpointBuilder { _dep(&self.client, &self.name, Index::Week1) } + pub fn month1(&self) -> DateMetricEndpointBuilder { _dep(&self.client, &self.name, Index::Month1) } + pub fn month3(&self) -> DateMetricEndpointBuilder { _dep(&self.client, &self.name, Index::Month3) } + pub fn month6(&self) -> DateMetricEndpointBuilder { _dep(&self.client, &self.name, Index::Month6) } + pub fn year1(&self) -> DateMetricEndpointBuilder { _dep(&self.client, &self.name, Index::Year1) } + pub fn year10(&self) -> DateMetricEndpointBuilder { _dep(&self.client, &self.name, Index::Year10) } + pub fn halvingepoch(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::HalvingEpoch) } + pub fn difficultyepoch(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::DifficultyEpoch) } } -pub struct MetricPattern2 { - name: Arc, - pub by: MetricPattern2By, -} +pub struct MetricPattern2 { name: Arc, pub by: MetricPattern2By } impl MetricPattern2 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern2By { - client, - name, - _marker: std::marker::PhantomData, - }, - } - } - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern2By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern2 { - fn name(&self) -> &str { - &self.name - } - fn indexes(&self) -> &'static [Index] { - _I2 - } -} -impl MetricPattern for MetricPattern2 { - fn get(&self, index: Index) -> Option> { - _I2.contains(&index) - .then(|| _ep(&self.by.client, &self.by.name, index)) - } -} +impl AnyMetricPattern for MetricPattern2 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I2 } } +impl MetricPattern for MetricPattern2 { fn get(&self, index: Index) -> Option> { _I2.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } -pub struct MetricPattern3By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +pub struct MetricPattern3By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern3By { - pub fn minute10(&self) -> DateMetricEndpointBuilder { - _dep(&self.client, &self.name, Index::Minute10) - } + pub fn minute10(&self) -> DateMetricEndpointBuilder { _dep(&self.client, &self.name, Index::Minute10) } } -pub struct MetricPattern3 { - name: Arc, - pub by: MetricPattern3By, -} +pub struct MetricPattern3 { name: Arc, pub by: MetricPattern3By } impl MetricPattern3 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern3By { - client, - name, - _marker: std::marker::PhantomData, - }, - } - } - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern3By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern3 { - fn name(&self) -> &str { - &self.name - } - fn indexes(&self) -> &'static [Index] { - _I3 - } -} -impl MetricPattern for MetricPattern3 { - fn get(&self, index: Index) -> Option> { - _I3.contains(&index) - .then(|| _ep(&self.by.client, &self.by.name, index)) - } -} +impl AnyMetricPattern for MetricPattern3 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I3 } } +impl MetricPattern for MetricPattern3 { fn get(&self, index: Index) -> Option> { _I3.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } -pub struct MetricPattern4By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +pub struct MetricPattern4By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern4By { - pub fn minute30(&self) -> DateMetricEndpointBuilder { - _dep(&self.client, &self.name, Index::Minute30) - } + pub fn minute30(&self) -> DateMetricEndpointBuilder { _dep(&self.client, &self.name, Index::Minute30) } } -pub struct MetricPattern4 { - name: Arc, - pub by: MetricPattern4By, -} +pub struct MetricPattern4 { name: Arc, pub by: MetricPattern4By } impl MetricPattern4 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern4By { - client, - name, - _marker: std::marker::PhantomData, - }, - } - } - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern4By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern4 { - fn name(&self) -> &str { - &self.name - } - fn indexes(&self) -> &'static [Index] { - _I4 - } -} -impl MetricPattern for MetricPattern4 { - fn get(&self, index: Index) -> Option> { - _I4.contains(&index) - .then(|| _ep(&self.by.client, &self.by.name, index)) - } -} +impl AnyMetricPattern for MetricPattern4 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I4 } } +impl MetricPattern for MetricPattern4 { fn get(&self, index: Index) -> Option> { _I4.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } -pub struct MetricPattern5By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +pub struct MetricPattern5By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern5By { - pub fn hour1(&self) -> DateMetricEndpointBuilder { - _dep(&self.client, &self.name, Index::Hour1) - } + pub fn hour1(&self) -> DateMetricEndpointBuilder { _dep(&self.client, &self.name, Index::Hour1) } } -pub struct MetricPattern5 { - name: Arc, - pub by: MetricPattern5By, -} +pub struct MetricPattern5 { name: Arc, pub by: MetricPattern5By } impl MetricPattern5 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern5By { - client, - name, - _marker: std::marker::PhantomData, - }, - } - } - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern5By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern5 { - fn name(&self) -> &str { - &self.name - } - fn indexes(&self) -> &'static [Index] { - _I5 - } -} -impl MetricPattern for MetricPattern5 { - fn get(&self, index: Index) -> Option> { - _I5.contains(&index) - .then(|| _ep(&self.by.client, &self.by.name, index)) - } -} +impl AnyMetricPattern for MetricPattern5 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I5 } } +impl MetricPattern for MetricPattern5 { fn get(&self, index: Index) -> Option> { _I5.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } -pub struct MetricPattern6By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +pub struct MetricPattern6By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern6By { - pub fn hour4(&self) -> DateMetricEndpointBuilder { - _dep(&self.client, &self.name, Index::Hour4) - } + pub fn hour4(&self) -> DateMetricEndpointBuilder { _dep(&self.client, &self.name, Index::Hour4) } } -pub struct MetricPattern6 { - name: Arc, - pub by: MetricPattern6By, -} +pub struct MetricPattern6 { name: Arc, pub by: MetricPattern6By } impl MetricPattern6 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern6By { - client, - name, - _marker: std::marker::PhantomData, - }, - } - } - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern6By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern6 { - fn name(&self) -> &str { - &self.name - } - fn indexes(&self) -> &'static [Index] { - _I6 - } -} -impl MetricPattern for MetricPattern6 { - fn get(&self, index: Index) -> Option> { - _I6.contains(&index) - .then(|| _ep(&self.by.client, &self.by.name, index)) - } -} +impl AnyMetricPattern for MetricPattern6 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I6 } } +impl MetricPattern for MetricPattern6 { fn get(&self, index: Index) -> Option> { _I6.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } -pub struct MetricPattern7By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +pub struct MetricPattern7By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern7By { - pub fn hour12(&self) -> DateMetricEndpointBuilder { - _dep(&self.client, &self.name, Index::Hour12) - } + pub fn hour12(&self) -> DateMetricEndpointBuilder { _dep(&self.client, &self.name, Index::Hour12) } } -pub struct MetricPattern7 { - name: Arc, - pub by: MetricPattern7By, -} +pub struct MetricPattern7 { name: Arc, pub by: MetricPattern7By } impl MetricPattern7 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern7By { - client, - name, - _marker: std::marker::PhantomData, - }, - } - } - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern7By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern7 { - fn name(&self) -> &str { - &self.name - } - fn indexes(&self) -> &'static [Index] { - _I7 - } -} -impl MetricPattern for MetricPattern7 { - fn get(&self, index: Index) -> Option> { - _I7.contains(&index) - .then(|| _ep(&self.by.client, &self.by.name, index)) - } -} +impl AnyMetricPattern for MetricPattern7 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I7 } } +impl MetricPattern for MetricPattern7 { fn get(&self, index: Index) -> Option> { _I7.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } -pub struct MetricPattern8By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +pub struct MetricPattern8By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern8By { - pub fn day1(&self) -> DateMetricEndpointBuilder { - _dep(&self.client, &self.name, Index::Day1) - } + pub fn day1(&self) -> DateMetricEndpointBuilder { _dep(&self.client, &self.name, Index::Day1) } } -pub struct MetricPattern8 { - name: Arc, - pub by: MetricPattern8By, -} +pub struct MetricPattern8 { name: Arc, pub by: MetricPattern8By } impl MetricPattern8 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern8By { - client, - name, - _marker: std::marker::PhantomData, - }, - } - } - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern8By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern8 { - fn name(&self) -> &str { - &self.name - } - fn indexes(&self) -> &'static [Index] { - _I8 - } -} -impl MetricPattern for MetricPattern8 { - fn get(&self, index: Index) -> Option> { - _I8.contains(&index) - .then(|| _ep(&self.by.client, &self.by.name, index)) - } -} +impl AnyMetricPattern for MetricPattern8 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I8 } } +impl MetricPattern for MetricPattern8 { fn get(&self, index: Index) -> Option> { _I8.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } -pub struct MetricPattern9By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +pub struct MetricPattern9By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern9By { - pub fn day3(&self) -> DateMetricEndpointBuilder { - _dep(&self.client, &self.name, Index::Day3) - } + pub fn day3(&self) -> DateMetricEndpointBuilder { _dep(&self.client, &self.name, Index::Day3) } } -pub struct MetricPattern9 { - name: Arc, - pub by: MetricPattern9By, -} +pub struct MetricPattern9 { name: Arc, pub by: MetricPattern9By } impl MetricPattern9 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern9By { - client, - name, - _marker: std::marker::PhantomData, - }, - } - } - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern9By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern9 { - fn name(&self) -> &str { - &self.name - } - fn indexes(&self) -> &'static [Index] { - _I9 - } -} -impl MetricPattern for MetricPattern9 { - fn get(&self, index: Index) -> Option> { - _I9.contains(&index) - .then(|| _ep(&self.by.client, &self.by.name, index)) - } -} +impl AnyMetricPattern for MetricPattern9 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I9 } } +impl MetricPattern for MetricPattern9 { fn get(&self, index: Index) -> Option> { _I9.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } -pub struct MetricPattern10By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +pub struct MetricPattern10By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern10By { - pub fn week1(&self) -> DateMetricEndpointBuilder { - _dep(&self.client, &self.name, Index::Week1) - } + pub fn week1(&self) -> DateMetricEndpointBuilder { _dep(&self.client, &self.name, Index::Week1) } } -pub struct MetricPattern10 { - name: Arc, - pub by: MetricPattern10By, -} +pub struct MetricPattern10 { name: Arc, pub by: MetricPattern10By } impl MetricPattern10 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern10By { - client, - name, - _marker: std::marker::PhantomData, - }, - } - } - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern10By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern10 { - fn name(&self) -> &str { - &self.name - } - fn indexes(&self) -> &'static [Index] { - _I10 - } -} -impl MetricPattern for MetricPattern10 { - fn get(&self, index: Index) -> Option> { - _I10.contains(&index) - .then(|| _ep(&self.by.client, &self.by.name, index)) - } -} +impl AnyMetricPattern for MetricPattern10 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I10 } } +impl MetricPattern for MetricPattern10 { fn get(&self, index: Index) -> Option> { _I10.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } -pub struct MetricPattern11By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +pub struct MetricPattern11By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern11By { - pub fn month1(&self) -> DateMetricEndpointBuilder { - _dep(&self.client, &self.name, Index::Month1) - } + pub fn month1(&self) -> DateMetricEndpointBuilder { _dep(&self.client, &self.name, Index::Month1) } } -pub struct MetricPattern11 { - name: Arc, - pub by: MetricPattern11By, -} +pub struct MetricPattern11 { name: Arc, pub by: MetricPattern11By } impl MetricPattern11 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern11By { - client, - name, - _marker: std::marker::PhantomData, - }, - } - } - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern11By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern11 { - fn name(&self) -> &str { - &self.name - } - fn indexes(&self) -> &'static [Index] { - _I11 - } -} -impl MetricPattern for MetricPattern11 { - fn get(&self, index: Index) -> Option> { - _I11.contains(&index) - .then(|| _ep(&self.by.client, &self.by.name, index)) - } -} +impl AnyMetricPattern for MetricPattern11 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I11 } } +impl MetricPattern for MetricPattern11 { fn get(&self, index: Index) -> Option> { _I11.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } -pub struct MetricPattern12By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +pub struct MetricPattern12By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern12By { - pub fn month3(&self) -> DateMetricEndpointBuilder { - _dep(&self.client, &self.name, Index::Month3) - } + pub fn month3(&self) -> DateMetricEndpointBuilder { _dep(&self.client, &self.name, Index::Month3) } } -pub struct MetricPattern12 { - name: Arc, - pub by: MetricPattern12By, -} +pub struct MetricPattern12 { name: Arc, pub by: MetricPattern12By } impl MetricPattern12 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern12By { - client, - name, - _marker: std::marker::PhantomData, - }, - } - } - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern12By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern12 { - fn name(&self) -> &str { - &self.name - } - fn indexes(&self) -> &'static [Index] { - _I12 - } -} -impl MetricPattern for MetricPattern12 { - fn get(&self, index: Index) -> Option> { - _I12.contains(&index) - .then(|| _ep(&self.by.client, &self.by.name, index)) - } -} +impl AnyMetricPattern for MetricPattern12 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I12 } } +impl MetricPattern for MetricPattern12 { fn get(&self, index: Index) -> Option> { _I12.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } -pub struct MetricPattern13By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +pub struct MetricPattern13By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern13By { - pub fn month6(&self) -> DateMetricEndpointBuilder { - _dep(&self.client, &self.name, Index::Month6) - } + pub fn month6(&self) -> DateMetricEndpointBuilder { _dep(&self.client, &self.name, Index::Month6) } } -pub struct MetricPattern13 { - name: Arc, - pub by: MetricPattern13By, -} +pub struct MetricPattern13 { name: Arc, pub by: MetricPattern13By } impl MetricPattern13 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern13By { - client, - name, - _marker: std::marker::PhantomData, - }, - } - } - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern13By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern13 { - fn name(&self) -> &str { - &self.name - } - fn indexes(&self) -> &'static [Index] { - _I13 - } -} -impl MetricPattern for MetricPattern13 { - fn get(&self, index: Index) -> Option> { - _I13.contains(&index) - .then(|| _ep(&self.by.client, &self.by.name, index)) - } -} +impl AnyMetricPattern for MetricPattern13 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I13 } } +impl MetricPattern for MetricPattern13 { fn get(&self, index: Index) -> Option> { _I13.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } -pub struct MetricPattern14By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +pub struct MetricPattern14By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern14By { - pub fn year1(&self) -> DateMetricEndpointBuilder { - _dep(&self.client, &self.name, Index::Year1) - } + pub fn year1(&self) -> DateMetricEndpointBuilder { _dep(&self.client, &self.name, Index::Year1) } } -pub struct MetricPattern14 { - name: Arc, - pub by: MetricPattern14By, -} +pub struct MetricPattern14 { name: Arc, pub by: MetricPattern14By } impl MetricPattern14 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern14By { - client, - name, - _marker: std::marker::PhantomData, - }, - } - } - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern14By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern14 { - fn name(&self) -> &str { - &self.name - } - fn indexes(&self) -> &'static [Index] { - _I14 - } -} -impl MetricPattern for MetricPattern14 { - fn get(&self, index: Index) -> Option> { - _I14.contains(&index) - .then(|| _ep(&self.by.client, &self.by.name, index)) - } -} +impl AnyMetricPattern for MetricPattern14 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I14 } } +impl MetricPattern for MetricPattern14 { fn get(&self, index: Index) -> Option> { _I14.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } -pub struct MetricPattern15By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +pub struct MetricPattern15By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern15By { - pub fn year10(&self) -> DateMetricEndpointBuilder { - _dep(&self.client, &self.name, Index::Year10) - } + pub fn year10(&self) -> DateMetricEndpointBuilder { _dep(&self.client, &self.name, Index::Year10) } } -pub struct MetricPattern15 { - name: Arc, - pub by: MetricPattern15By, -} +pub struct MetricPattern15 { name: Arc, pub by: MetricPattern15By } impl MetricPattern15 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern15By { - client, - name, - _marker: std::marker::PhantomData, - }, - } - } - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern15By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern15 { - fn name(&self) -> &str { - &self.name - } - fn indexes(&self) -> &'static [Index] { - _I15 - } -} -impl MetricPattern for MetricPattern15 { - fn get(&self, index: Index) -> Option> { - _I15.contains(&index) - .then(|| _ep(&self.by.client, &self.by.name, index)) - } -} +impl AnyMetricPattern for MetricPattern15 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I15 } } +impl MetricPattern for MetricPattern15 { fn get(&self, index: Index) -> Option> { _I15.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } -pub struct MetricPattern16By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +pub struct MetricPattern16By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern16By { - pub fn halvingepoch(&self) -> MetricEndpointBuilder { - _ep(&self.client, &self.name, Index::HalvingEpoch) - } + pub fn halvingepoch(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::HalvingEpoch) } } -pub struct MetricPattern16 { - name: Arc, - pub by: MetricPattern16By, -} +pub struct MetricPattern16 { name: Arc, pub by: MetricPattern16By } impl MetricPattern16 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern16By { - client, - name, - _marker: std::marker::PhantomData, - }, - } - } - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern16By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern16 { - fn name(&self) -> &str { - &self.name - } - fn indexes(&self) -> &'static [Index] { - _I16 - } -} -impl MetricPattern for MetricPattern16 { - fn get(&self, index: Index) -> Option> { - _I16.contains(&index) - .then(|| _ep(&self.by.client, &self.by.name, index)) - } -} +impl AnyMetricPattern for MetricPattern16 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I16 } } +impl MetricPattern for MetricPattern16 { fn get(&self, index: Index) -> Option> { _I16.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } -pub struct MetricPattern17By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +pub struct MetricPattern17By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern17By { - pub fn difficultyepoch(&self) -> MetricEndpointBuilder { - _ep(&self.client, &self.name, Index::DifficultyEpoch) - } + pub fn difficultyepoch(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::DifficultyEpoch) } } -pub struct MetricPattern17 { - name: Arc, - pub by: MetricPattern17By, -} +pub struct MetricPattern17 { name: Arc, pub by: MetricPattern17By } impl MetricPattern17 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern17By { - client, - name, - _marker: std::marker::PhantomData, - }, - } - } - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern17By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern17 { - fn name(&self) -> &str { - &self.name - } - fn indexes(&self) -> &'static [Index] { - _I17 - } -} -impl MetricPattern for MetricPattern17 { - fn get(&self, index: Index) -> Option> { - _I17.contains(&index) - .then(|| _ep(&self.by.client, &self.by.name, index)) - } -} +impl AnyMetricPattern for MetricPattern17 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I17 } } +impl MetricPattern for MetricPattern17 { fn get(&self, index: Index) -> Option> { _I17.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } -pub struct MetricPattern18By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +pub struct MetricPattern18By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern18By { - pub fn height(&self) -> MetricEndpointBuilder { - _ep(&self.client, &self.name, Index::Height) - } + pub fn height(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::Height) } } -pub struct MetricPattern18 { - name: Arc, - pub by: MetricPattern18By, -} +pub struct MetricPattern18 { name: Arc, pub by: MetricPattern18By } impl MetricPattern18 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern18By { - client, - name, - _marker: std::marker::PhantomData, - }, - } - } - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern18By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern18 { - fn name(&self) -> &str { - &self.name - } - fn indexes(&self) -> &'static [Index] { - _I18 - } -} -impl MetricPattern for MetricPattern18 { - fn get(&self, index: Index) -> Option> { - _I18.contains(&index) - .then(|| _ep(&self.by.client, &self.by.name, index)) - } -} +impl AnyMetricPattern for MetricPattern18 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I18 } } +impl MetricPattern for MetricPattern18 { fn get(&self, index: Index) -> Option> { _I18.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } -pub struct MetricPattern19By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +pub struct MetricPattern19By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern19By { - pub fn txindex(&self) -> MetricEndpointBuilder { - _ep(&self.client, &self.name, Index::TxIndex) - } + pub fn txindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::TxIndex) } } -pub struct MetricPattern19 { - name: Arc, - pub by: MetricPattern19By, -} +pub struct MetricPattern19 { name: Arc, pub by: MetricPattern19By } impl MetricPattern19 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern19By { - client, - name, - _marker: std::marker::PhantomData, - }, - } - } - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern19By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern19 { - fn name(&self) -> &str { - &self.name - } - fn indexes(&self) -> &'static [Index] { - _I19 - } -} -impl MetricPattern for MetricPattern19 { - fn get(&self, index: Index) -> Option> { - _I19.contains(&index) - .then(|| _ep(&self.by.client, &self.by.name, index)) - } -} +impl AnyMetricPattern for MetricPattern19 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I19 } } +impl MetricPattern for MetricPattern19 { fn get(&self, index: Index) -> Option> { _I19.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } -pub struct MetricPattern20By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +pub struct MetricPattern20By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern20By { - pub fn txinindex(&self) -> MetricEndpointBuilder { - _ep(&self.client, &self.name, Index::TxInIndex) - } + pub fn txinindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::TxInIndex) } } -pub struct MetricPattern20 { - name: Arc, - pub by: MetricPattern20By, -} +pub struct MetricPattern20 { name: Arc, pub by: MetricPattern20By } impl MetricPattern20 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern20By { - client, - name, - _marker: std::marker::PhantomData, - }, - } - } - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern20By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern20 { - fn name(&self) -> &str { - &self.name - } - fn indexes(&self) -> &'static [Index] { - _I20 - } -} -impl MetricPattern for MetricPattern20 { - fn get(&self, index: Index) -> Option> { - _I20.contains(&index) - .then(|| _ep(&self.by.client, &self.by.name, index)) - } -} +impl AnyMetricPattern for MetricPattern20 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I20 } } +impl MetricPattern for MetricPattern20 { fn get(&self, index: Index) -> Option> { _I20.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } -pub struct MetricPattern21By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +pub struct MetricPattern21By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern21By { - pub fn txoutindex(&self) -> MetricEndpointBuilder { - _ep(&self.client, &self.name, Index::TxOutIndex) - } + pub fn txoutindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::TxOutIndex) } } -pub struct MetricPattern21 { - name: Arc, - pub by: MetricPattern21By, -} +pub struct MetricPattern21 { name: Arc, pub by: MetricPattern21By } impl MetricPattern21 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern21By { - client, - name, - _marker: std::marker::PhantomData, - }, - } - } - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern21By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern21 { - fn name(&self) -> &str { - &self.name - } - fn indexes(&self) -> &'static [Index] { - _I21 - } -} -impl MetricPattern for MetricPattern21 { - fn get(&self, index: Index) -> Option> { - _I21.contains(&index) - .then(|| _ep(&self.by.client, &self.by.name, index)) - } -} +impl AnyMetricPattern for MetricPattern21 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I21 } } +impl MetricPattern for MetricPattern21 { fn get(&self, index: Index) -> Option> { _I21.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } -pub struct MetricPattern22By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +pub struct MetricPattern22By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern22By { - pub fn emptyoutputindex(&self) -> MetricEndpointBuilder { - _ep(&self.client, &self.name, Index::EmptyOutputIndex) - } + pub fn emptyoutputindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::EmptyOutputIndex) } } -pub struct MetricPattern22 { - name: Arc, - pub by: MetricPattern22By, -} +pub struct MetricPattern22 { name: Arc, pub by: MetricPattern22By } impl MetricPattern22 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern22By { - client, - name, - _marker: std::marker::PhantomData, - }, - } - } - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern22By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern22 { - fn name(&self) -> &str { - &self.name - } - fn indexes(&self) -> &'static [Index] { - _I22 - } -} -impl MetricPattern for MetricPattern22 { - fn get(&self, index: Index) -> Option> { - _I22.contains(&index) - .then(|| _ep(&self.by.client, &self.by.name, index)) - } -} +impl AnyMetricPattern for MetricPattern22 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I22 } } +impl MetricPattern for MetricPattern22 { fn get(&self, index: Index) -> Option> { _I22.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } -pub struct MetricPattern23By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +pub struct MetricPattern23By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern23By { - pub fn opreturnindex(&self) -> MetricEndpointBuilder { - _ep(&self.client, &self.name, Index::OpReturnIndex) - } + pub fn opreturnindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::OpReturnIndex) } } -pub struct MetricPattern23 { - name: Arc, - pub by: MetricPattern23By, -} +pub struct MetricPattern23 { name: Arc, pub by: MetricPattern23By } impl MetricPattern23 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern23By { - client, - name, - _marker: std::marker::PhantomData, - }, - } - } - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern23By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern23 { - fn name(&self) -> &str { - &self.name - } - fn indexes(&self) -> &'static [Index] { - _I23 - } -} -impl MetricPattern for MetricPattern23 { - fn get(&self, index: Index) -> Option> { - _I23.contains(&index) - .then(|| _ep(&self.by.client, &self.by.name, index)) - } -} +impl AnyMetricPattern for MetricPattern23 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I23 } } +impl MetricPattern for MetricPattern23 { fn get(&self, index: Index) -> Option> { _I23.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } -pub struct MetricPattern24By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +pub struct MetricPattern24By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern24By { - pub fn p2aaddressindex(&self) -> MetricEndpointBuilder { - _ep(&self.client, &self.name, Index::P2AAddressIndex) - } + pub fn p2aaddressindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::P2AAddressIndex) } } -pub struct MetricPattern24 { - name: Arc, - pub by: MetricPattern24By, -} +pub struct MetricPattern24 { name: Arc, pub by: MetricPattern24By } impl MetricPattern24 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern24By { - client, - name, - _marker: std::marker::PhantomData, - }, - } - } - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern24By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern24 { - fn name(&self) -> &str { - &self.name - } - fn indexes(&self) -> &'static [Index] { - _I24 - } -} -impl MetricPattern for MetricPattern24 { - fn get(&self, index: Index) -> Option> { - _I24.contains(&index) - .then(|| _ep(&self.by.client, &self.by.name, index)) - } -} +impl AnyMetricPattern for MetricPattern24 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I24 } } +impl MetricPattern for MetricPattern24 { fn get(&self, index: Index) -> Option> { _I24.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } -pub struct MetricPattern25By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +pub struct MetricPattern25By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern25By { - pub fn p2msoutputindex(&self) -> MetricEndpointBuilder { - _ep(&self.client, &self.name, Index::P2MSOutputIndex) - } + pub fn p2msoutputindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::P2MSOutputIndex) } } -pub struct MetricPattern25 { - name: Arc, - pub by: MetricPattern25By, -} +pub struct MetricPattern25 { name: Arc, pub by: MetricPattern25By } impl MetricPattern25 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern25By { - client, - name, - _marker: std::marker::PhantomData, - }, - } - } - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern25By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern25 { - fn name(&self) -> &str { - &self.name - } - fn indexes(&self) -> &'static [Index] { - _I25 - } -} -impl MetricPattern for MetricPattern25 { - fn get(&self, index: Index) -> Option> { - _I25.contains(&index) - .then(|| _ep(&self.by.client, &self.by.name, index)) - } -} +impl AnyMetricPattern for MetricPattern25 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I25 } } +impl MetricPattern for MetricPattern25 { fn get(&self, index: Index) -> Option> { _I25.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } -pub struct MetricPattern26By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +pub struct MetricPattern26By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern26By { - pub fn p2pk33addressindex(&self) -> MetricEndpointBuilder { - _ep(&self.client, &self.name, Index::P2PK33AddressIndex) - } + pub fn p2pk33addressindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::P2PK33AddressIndex) } } -pub struct MetricPattern26 { - name: Arc, - pub by: MetricPattern26By, -} +pub struct MetricPattern26 { name: Arc, pub by: MetricPattern26By } impl MetricPattern26 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern26By { - client, - name, - _marker: std::marker::PhantomData, - }, - } - } - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern26By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern26 { - fn name(&self) -> &str { - &self.name - } - fn indexes(&self) -> &'static [Index] { - _I26 - } -} -impl MetricPattern for MetricPattern26 { - fn get(&self, index: Index) -> Option> { - _I26.contains(&index) - .then(|| _ep(&self.by.client, &self.by.name, index)) - } -} +impl AnyMetricPattern for MetricPattern26 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I26 } } +impl MetricPattern for MetricPattern26 { fn get(&self, index: Index) -> Option> { _I26.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } -pub struct MetricPattern27By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +pub struct MetricPattern27By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern27By { - pub fn p2pk65addressindex(&self) -> MetricEndpointBuilder { - _ep(&self.client, &self.name, Index::P2PK65AddressIndex) - } + pub fn p2pk65addressindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::P2PK65AddressIndex) } } -pub struct MetricPattern27 { - name: Arc, - pub by: MetricPattern27By, -} +pub struct MetricPattern27 { name: Arc, pub by: MetricPattern27By } impl MetricPattern27 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern27By { - client, - name, - _marker: std::marker::PhantomData, - }, - } - } - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern27By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern27 { - fn name(&self) -> &str { - &self.name - } - fn indexes(&self) -> &'static [Index] { - _I27 - } -} -impl MetricPattern for MetricPattern27 { - fn get(&self, index: Index) -> Option> { - _I27.contains(&index) - .then(|| _ep(&self.by.client, &self.by.name, index)) - } -} +impl AnyMetricPattern for MetricPattern27 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I27 } } +impl MetricPattern for MetricPattern27 { fn get(&self, index: Index) -> Option> { _I27.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } -pub struct MetricPattern28By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +pub struct MetricPattern28By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern28By { - pub fn p2pkhaddressindex(&self) -> MetricEndpointBuilder { - _ep(&self.client, &self.name, Index::P2PKHAddressIndex) - } + pub fn p2pkhaddressindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::P2PKHAddressIndex) } } -pub struct MetricPattern28 { - name: Arc, - pub by: MetricPattern28By, -} +pub struct MetricPattern28 { name: Arc, pub by: MetricPattern28By } impl MetricPattern28 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern28By { - client, - name, - _marker: std::marker::PhantomData, - }, - } - } - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern28By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern28 { - fn name(&self) -> &str { - &self.name - } - fn indexes(&self) -> &'static [Index] { - _I28 - } -} -impl MetricPattern for MetricPattern28 { - fn get(&self, index: Index) -> Option> { - _I28.contains(&index) - .then(|| _ep(&self.by.client, &self.by.name, index)) - } -} +impl AnyMetricPattern for MetricPattern28 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I28 } } +impl MetricPattern for MetricPattern28 { fn get(&self, index: Index) -> Option> { _I28.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } -pub struct MetricPattern29By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +pub struct MetricPattern29By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern29By { - pub fn p2shaddressindex(&self) -> MetricEndpointBuilder { - _ep(&self.client, &self.name, Index::P2SHAddressIndex) - } + pub fn p2shaddressindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::P2SHAddressIndex) } } -pub struct MetricPattern29 { - name: Arc, - pub by: MetricPattern29By, -} +pub struct MetricPattern29 { name: Arc, pub by: MetricPattern29By } impl MetricPattern29 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern29By { - client, - name, - _marker: std::marker::PhantomData, - }, - } - } - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern29By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern29 { - fn name(&self) -> &str { - &self.name - } - fn indexes(&self) -> &'static [Index] { - _I29 - } -} -impl MetricPattern for MetricPattern29 { - fn get(&self, index: Index) -> Option> { - _I29.contains(&index) - .then(|| _ep(&self.by.client, &self.by.name, index)) - } -} +impl AnyMetricPattern for MetricPattern29 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I29 } } +impl MetricPattern for MetricPattern29 { fn get(&self, index: Index) -> Option> { _I29.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } -pub struct MetricPattern30By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +pub struct MetricPattern30By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern30By { - pub fn p2traddressindex(&self) -> MetricEndpointBuilder { - _ep(&self.client, &self.name, Index::P2TRAddressIndex) - } + pub fn p2traddressindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::P2TRAddressIndex) } } -pub struct MetricPattern30 { - name: Arc, - pub by: MetricPattern30By, -} +pub struct MetricPattern30 { name: Arc, pub by: MetricPattern30By } impl MetricPattern30 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern30By { - client, - name, - _marker: std::marker::PhantomData, - }, - } - } - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern30By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern30 { - fn name(&self) -> &str { - &self.name - } - fn indexes(&self) -> &'static [Index] { - _I30 - } -} -impl MetricPattern for MetricPattern30 { - fn get(&self, index: Index) -> Option> { - _I30.contains(&index) - .then(|| _ep(&self.by.client, &self.by.name, index)) - } -} +impl AnyMetricPattern for MetricPattern30 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I30 } } +impl MetricPattern for MetricPattern30 { fn get(&self, index: Index) -> Option> { _I30.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } -pub struct MetricPattern31By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +pub struct MetricPattern31By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern31By { - pub fn p2wpkhaddressindex(&self) -> MetricEndpointBuilder { - _ep(&self.client, &self.name, Index::P2WPKHAddressIndex) - } + pub fn p2wpkhaddressindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::P2WPKHAddressIndex) } } -pub struct MetricPattern31 { - name: Arc, - pub by: MetricPattern31By, -} +pub struct MetricPattern31 { name: Arc, pub by: MetricPattern31By } impl MetricPattern31 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern31By { - client, - name, - _marker: std::marker::PhantomData, - }, - } - } - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern31By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern31 { - fn name(&self) -> &str { - &self.name - } - fn indexes(&self) -> &'static [Index] { - _I31 - } -} -impl MetricPattern for MetricPattern31 { - fn get(&self, index: Index) -> Option> { - _I31.contains(&index) - .then(|| _ep(&self.by.client, &self.by.name, index)) - } -} +impl AnyMetricPattern for MetricPattern31 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I31 } } +impl MetricPattern for MetricPattern31 { fn get(&self, index: Index) -> Option> { _I31.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } -pub struct MetricPattern32By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +pub struct MetricPattern32By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern32By { - pub fn p2wshaddressindex(&self) -> MetricEndpointBuilder { - _ep(&self.client, &self.name, Index::P2WSHAddressIndex) - } + pub fn p2wshaddressindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::P2WSHAddressIndex) } } -pub struct MetricPattern32 { - name: Arc, - pub by: MetricPattern32By, -} +pub struct MetricPattern32 { name: Arc, pub by: MetricPattern32By } impl MetricPattern32 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern32By { - client, - name, - _marker: std::marker::PhantomData, - }, - } - } - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern32By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern32 { - fn name(&self) -> &str { - &self.name - } - fn indexes(&self) -> &'static [Index] { - _I32 - } -} -impl MetricPattern for MetricPattern32 { - fn get(&self, index: Index) -> Option> { - _I32.contains(&index) - .then(|| _ep(&self.by.client, &self.by.name, index)) - } -} +impl AnyMetricPattern for MetricPattern32 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I32 } } +impl MetricPattern for MetricPattern32 { fn get(&self, index: Index) -> Option> { _I32.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } -pub struct MetricPattern33By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +pub struct MetricPattern33By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern33By { - pub fn unknownoutputindex(&self) -> MetricEndpointBuilder { - _ep(&self.client, &self.name, Index::UnknownOutputIndex) - } + pub fn unknownoutputindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::UnknownOutputIndex) } } -pub struct MetricPattern33 { - name: Arc, - pub by: MetricPattern33By, -} +pub struct MetricPattern33 { name: Arc, pub by: MetricPattern33By } impl MetricPattern33 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern33By { - client, - name, - _marker: std::marker::PhantomData, - }, - } - } - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern33By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern33 { - fn name(&self) -> &str { - &self.name - } - fn indexes(&self) -> &'static [Index] { - _I33 - } -} -impl MetricPattern for MetricPattern33 { - fn get(&self, index: Index) -> Option> { - _I33.contains(&index) - .then(|| _ep(&self.by.client, &self.by.name, index)) - } -} +impl AnyMetricPattern for MetricPattern33 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I33 } } +impl MetricPattern for MetricPattern33 { fn get(&self, index: Index) -> Option> { _I33.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } -pub struct MetricPattern34By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +pub struct MetricPattern34By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern34By { - pub fn fundedaddressindex(&self) -> MetricEndpointBuilder { - _ep(&self.client, &self.name, Index::FundedAddressIndex) - } + pub fn fundedaddressindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::FundedAddressIndex) } } -pub struct MetricPattern34 { - name: Arc, - pub by: MetricPattern34By, -} +pub struct MetricPattern34 { name: Arc, pub by: MetricPattern34By } impl MetricPattern34 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern34By { - client, - name, - _marker: std::marker::PhantomData, - }, - } - } - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern34By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern34 { - fn name(&self) -> &str { - &self.name - } - fn indexes(&self) -> &'static [Index] { - _I34 - } -} -impl MetricPattern for MetricPattern34 { - fn get(&self, index: Index) -> Option> { - _I34.contains(&index) - .then(|| _ep(&self.by.client, &self.by.name, index)) - } -} +impl AnyMetricPattern for MetricPattern34 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I34 } } +impl MetricPattern for MetricPattern34 { fn get(&self, index: Index) -> Option> { _I34.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } -pub struct MetricPattern35By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +pub struct MetricPattern35By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern35By { - pub fn emptyaddressindex(&self) -> MetricEndpointBuilder { - _ep(&self.client, &self.name, Index::EmptyAddressIndex) - } + pub fn emptyaddressindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::EmptyAddressIndex) } } -pub struct MetricPattern35 { - name: Arc, - pub by: MetricPattern35By, -} +pub struct MetricPattern35 { name: Arc, pub by: MetricPattern35By } impl MetricPattern35 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern35By { - client, - name, - _marker: std::marker::PhantomData, - }, - } - } - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern35By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern35 { - fn name(&self) -> &str { - &self.name - } - fn indexes(&self) -> &'static [Index] { - _I35 - } -} -impl MetricPattern for MetricPattern35 { - fn get(&self, index: Index) -> Option> { - _I35.contains(&index) - .then(|| _ep(&self.by.client, &self.by.name, index)) - } -} +impl AnyMetricPattern for MetricPattern35 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I35 } } +impl MetricPattern for MetricPattern35 { fn get(&self, index: Index) -> Option> { _I35.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } // Reusable pattern structs /// Pattern struct for repeated tree structure. -pub struct AdjustedCapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprUpperValuePattern -{ +pub struct AdjustedCapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprUpperValuePattern { pub adjusted_sopr: _1m1w1y24hPattern, pub adjusted_sopr_ema: _1m1wPattern2, pub adjusted_value_created: MetricPattern1, @@ -2371,8 +1070,7 @@ impl AdjustedCapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSe } /// Pattern struct for repeated tree structure. -pub struct AdjustedCapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprUpperValuePattern2 -{ +pub struct AdjustedCapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprUpperValuePattern2 { pub adjusted_sopr: _1m1w1y24hPattern, pub adjusted_sopr_ema: _1m1wPattern2, pub adjusted_value_created: MetricPattern1, @@ -2490,8 +1188,7 @@ impl AdjustedCapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSe } /// Pattern struct for repeated tree structure. -pub struct CapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprUpperValuePattern2 -{ +pub struct CapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprUpperValuePattern2 { pub cap_raw: MetricPattern18, pub capitulation_flow: MetricPattern1, pub gross_pnl: CentsUsdPattern, @@ -2547,9 +1244,7 @@ pub struct CapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSell pub value_destroyed_sum: _1m1w1y24hPattern, } -impl - CapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprUpperValuePattern2 -{ +impl CapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprUpperValuePattern2 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -2559,144 +1254,59 @@ impl gross_pnl_sum: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "gross_pnl_sum")), investor_cap_raw: MetricPattern18::new(client.clone(), _m(&acc, "investor_cap_raw")), investor_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "investor_price")), - investor_price_ratio: BpsRatioPattern::new( - client.clone(), - _m(&acc, "investor_price_ratio"), - ), - investor_price_ratio_ext: RatioPattern::new( - client.clone(), - _m(&acc, "investor_price_ratio"), - ), + investor_price_ratio: BpsRatioPattern::new(client.clone(), _m(&acc, "investor_price_ratio")), + investor_price_ratio_ext: RatioPattern::new(client.clone(), _m(&acc, "investor_price_ratio")), loss_value_created: MetricPattern1::new(client.clone(), _m(&acc, "loss_value_created")), - loss_value_destroyed: MetricPattern1::new( - client.clone(), - _m(&acc, "loss_value_destroyed"), - ), - lower_price_band: CentsSatsUsdPattern::new( - client.clone(), - _m(&acc, "lower_price_band"), - ), + loss_value_destroyed: MetricPattern1::new(client.clone(), _m(&acc, "loss_value_destroyed")), + lower_price_band: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "lower_price_band")), mvrv: MetricPattern1::new(client.clone(), _m(&acc, "mvrv")), neg_realized_loss: MetricPattern1::new(client.clone(), _m(&acc, "neg_realized_loss")), net_pnl_change_1m: MetricPattern1::new(client.clone(), _m(&acc, "net_pnl_change_1m")), - net_pnl_change_1m_rel_to_market_cap: BpsPercentRatioPattern::new( - client.clone(), - _m(&acc, "net_pnl_change_1m_rel_to_market_cap"), - ), - net_pnl_change_1m_rel_to_realized_cap: BpsPercentRatioPattern::new( - client.clone(), - _m(&acc, "net_pnl_change_1m_rel_to_realized_cap"), - ), - net_realized_pnl: CumulativeHeightPattern::new( - client.clone(), - _m(&acc, "net_realized_pnl"), - ), - net_realized_pnl_ema_1w: MetricPattern1::new( - client.clone(), - _m(&acc, "net_realized_pnl_ema_1w"), - ), - net_realized_pnl_rel_to_realized_cap: BpsPercentRatioPattern::new( - client.clone(), - _m(&acc, "net_realized_pnl_rel_to_realized_cap"), - ), - peak_regret: CumulativeHeightPattern::new( - client.clone(), - _m(&acc, "realized_peak_regret"), - ), - peak_regret_rel_to_realized_cap: BpsPercentRatioPattern::new( - client.clone(), - _m(&acc, "realized_peak_regret_rel_to_realized_cap"), - ), + net_pnl_change_1m_rel_to_market_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "net_pnl_change_1m_rel_to_market_cap")), + net_pnl_change_1m_rel_to_realized_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "net_pnl_change_1m_rel_to_realized_cap")), + net_realized_pnl: CumulativeHeightPattern::new(client.clone(), _m(&acc, "net_realized_pnl")), + net_realized_pnl_ema_1w: MetricPattern1::new(client.clone(), _m(&acc, "net_realized_pnl_ema_1w")), + net_realized_pnl_rel_to_realized_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "net_realized_pnl_rel_to_realized_cap")), + peak_regret: CumulativeHeightPattern::new(client.clone(), _m(&acc, "realized_peak_regret")), + peak_regret_rel_to_realized_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "realized_peak_regret_rel_to_realized_cap")), profit_flow: MetricPattern1::new(client.clone(), _m(&acc, "profit_flow")), - profit_value_created: MetricPattern1::new( - client.clone(), - _m(&acc, "profit_value_created"), - ), - profit_value_destroyed: MetricPattern1::new( - client.clone(), - _m(&acc, "profit_value_destroyed"), - ), + profit_value_created: MetricPattern1::new(client.clone(), _m(&acc, "profit_value_created")), + profit_value_destroyed: MetricPattern1::new(client.clone(), _m(&acc, "profit_value_destroyed")), realized_cap: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap")), realized_cap_cents: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap_cents")), - realized_cap_change_1m: MetricPattern1::new( - client.clone(), - _m(&acc, "realized_cap_change_1m"), - ), - realized_cap_rel_to_own_market_cap: BpsPercentRatioPattern::new( - client.clone(), - _m(&acc, "realized_cap_rel_to_own_market_cap"), - ), + realized_cap_change_1m: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap_change_1m")), + realized_cap_rel_to_own_market_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "realized_cap_rel_to_own_market_cap")), realized_loss: CumulativeHeightPattern::new(client.clone(), _m(&acc, "realized_loss")), - realized_loss_ema_1w: MetricPattern1::new( - client.clone(), - _m(&acc, "realized_loss_ema_1w"), - ), - realized_loss_rel_to_realized_cap: BpsPercentRatioPattern::new( - client.clone(), - _m(&acc, "realized_loss_rel_to_realized_cap"), - ), + realized_loss_ema_1w: MetricPattern1::new(client.clone(), _m(&acc, "realized_loss_ema_1w")), + realized_loss_rel_to_realized_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "realized_loss_rel_to_realized_cap")), realized_loss_sum: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "realized_loss")), realized_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "realized_price")), - realized_price_ratio: BpsRatioPattern::new( - client.clone(), - _m(&acc, "realized_price_ratio"), - ), - realized_price_ratio_ext: RatioPattern::new( - client.clone(), - _m(&acc, "realized_price_ratio"), - ), - realized_profit: CumulativeHeightPattern::new( - client.clone(), - _m(&acc, "realized_profit"), - ), - realized_profit_ema_1w: MetricPattern1::new( - client.clone(), - _m(&acc, "realized_profit_ema_1w"), - ), - realized_profit_rel_to_realized_cap: BpsPercentRatioPattern::new( - client.clone(), - _m(&acc, "realized_profit_rel_to_realized_cap"), - ), - realized_profit_sum: _1m1w1y24hPattern::new( - client.clone(), - _m(&acc, "realized_profit"), - ), - realized_profit_to_loss_ratio: _1m1w1y24hPattern::new( - client.clone(), - _m(&acc, "realized_profit_to_loss_ratio"), - ), - sell_side_risk_ratio: _1m1w1y24hPattern2::new( - client.clone(), - _m(&acc, "sell_side_risk_ratio"), - ), - sell_side_risk_ratio_24h_ema: _1m1wPattern::new( - client.clone(), - _m(&acc, "sell_side_risk_ratio_24h_ema"), - ), + realized_price_ratio: BpsRatioPattern::new(client.clone(), _m(&acc, "realized_price_ratio")), + realized_price_ratio_ext: RatioPattern::new(client.clone(), _m(&acc, "realized_price_ratio")), + realized_profit: CumulativeHeightPattern::new(client.clone(), _m(&acc, "realized_profit")), + realized_profit_ema_1w: MetricPattern1::new(client.clone(), _m(&acc, "realized_profit_ema_1w")), + realized_profit_rel_to_realized_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "realized_profit_rel_to_realized_cap")), + realized_profit_sum: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "realized_profit")), + realized_profit_to_loss_ratio: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "realized_profit_to_loss_ratio")), + sell_side_risk_ratio: _1m1w1y24hPattern2::new(client.clone(), _m(&acc, "sell_side_risk_ratio")), + sell_side_risk_ratio_24h_ema: _1m1wPattern::new(client.clone(), _m(&acc, "sell_side_risk_ratio_24h_ema")), sent_in_loss: BaseCumulativePattern::new(client.clone(), _m(&acc, "sent_in_loss")), sent_in_loss_ema: _2wPattern::new(client.clone(), _m(&acc, "sent_in_loss_ema_2w")), sent_in_profit: BaseCumulativePattern::new(client.clone(), _m(&acc, "sent_in_profit")), sent_in_profit_ema: _2wPattern::new(client.clone(), _m(&acc, "sent_in_profit_ema_2w")), sopr: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "sopr")), sopr_24h_ema: _1m1wPattern2::new(client.clone(), _m(&acc, "sopr_24h_ema")), - upper_price_band: CentsSatsUsdPattern::new( - client.clone(), - _m(&acc, "upper_price_band"), - ), + upper_price_band: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "upper_price_band")), value_created: MetricPattern1::new(client.clone(), _m(&acc, "value_created")), value_created_sum: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "value_created")), value_destroyed: MetricPattern1::new(client.clone(), _m(&acc, "value_destroyed")), - value_destroyed_sum: _1m1w1y24hPattern::new( - client.clone(), - _m(&acc, "value_destroyed"), - ), + value_destroyed_sum: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "value_destroyed")), } } } /// Pattern struct for repeated tree structure. -pub struct CapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprUpperValuePattern -{ +pub struct CapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprUpperValuePattern { pub cap_raw: MetricPattern18, pub capitulation_flow: MetricPattern1, pub gross_pnl: CentsUsdPattern, @@ -2746,9 +1356,7 @@ pub struct CapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSell pub value_destroyed_sum: _1m1w1y24hPattern, } -impl - CapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprUpperValuePattern -{ +impl CapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprUpperValuePattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -2758,116 +1366,47 @@ impl gross_pnl_sum: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "gross_pnl_sum")), investor_cap_raw: MetricPattern18::new(client.clone(), _m(&acc, "investor_cap_raw")), investor_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "investor_price")), - investor_price_ratio: BpsRatioPattern::new( - client.clone(), - _m(&acc, "investor_price_ratio"), - ), + investor_price_ratio: BpsRatioPattern::new(client.clone(), _m(&acc, "investor_price_ratio")), loss_value_created: MetricPattern1::new(client.clone(), _m(&acc, "loss_value_created")), - loss_value_destroyed: MetricPattern1::new( - client.clone(), - _m(&acc, "loss_value_destroyed"), - ), - lower_price_band: CentsSatsUsdPattern::new( - client.clone(), - _m(&acc, "lower_price_band"), - ), + loss_value_destroyed: MetricPattern1::new(client.clone(), _m(&acc, "loss_value_destroyed")), + lower_price_band: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "lower_price_band")), mvrv: MetricPattern1::new(client.clone(), _m(&acc, "mvrv")), neg_realized_loss: MetricPattern1::new(client.clone(), _m(&acc, "neg_realized_loss")), net_pnl_change_1m: MetricPattern1::new(client.clone(), _m(&acc, "net_pnl_change_1m")), - net_pnl_change_1m_rel_to_market_cap: BpsPercentRatioPattern::new( - client.clone(), - _m(&acc, "net_pnl_change_1m_rel_to_market_cap"), - ), - net_pnl_change_1m_rel_to_realized_cap: BpsPercentRatioPattern::new( - client.clone(), - _m(&acc, "net_pnl_change_1m_rel_to_realized_cap"), - ), - net_realized_pnl: CumulativeHeightPattern::new( - client.clone(), - _m(&acc, "net_realized_pnl"), - ), - net_realized_pnl_ema_1w: MetricPattern1::new( - client.clone(), - _m(&acc, "net_realized_pnl_ema_1w"), - ), - net_realized_pnl_rel_to_realized_cap: BpsPercentRatioPattern::new( - client.clone(), - _m(&acc, "net_realized_pnl_rel_to_realized_cap"), - ), - peak_regret: CumulativeHeightPattern::new( - client.clone(), - _m(&acc, "realized_peak_regret"), - ), - peak_regret_rel_to_realized_cap: BpsPercentRatioPattern::new( - client.clone(), - _m(&acc, "realized_peak_regret_rel_to_realized_cap"), - ), + net_pnl_change_1m_rel_to_market_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "net_pnl_change_1m_rel_to_market_cap")), + net_pnl_change_1m_rel_to_realized_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "net_pnl_change_1m_rel_to_realized_cap")), + net_realized_pnl: CumulativeHeightPattern::new(client.clone(), _m(&acc, "net_realized_pnl")), + net_realized_pnl_ema_1w: MetricPattern1::new(client.clone(), _m(&acc, "net_realized_pnl_ema_1w")), + net_realized_pnl_rel_to_realized_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "net_realized_pnl_rel_to_realized_cap")), + peak_regret: CumulativeHeightPattern::new(client.clone(), _m(&acc, "realized_peak_regret")), + peak_regret_rel_to_realized_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "realized_peak_regret_rel_to_realized_cap")), profit_flow: MetricPattern1::new(client.clone(), _m(&acc, "profit_flow")), - profit_value_created: MetricPattern1::new( - client.clone(), - _m(&acc, "profit_value_created"), - ), - profit_value_destroyed: MetricPattern1::new( - client.clone(), - _m(&acc, "profit_value_destroyed"), - ), + profit_value_created: MetricPattern1::new(client.clone(), _m(&acc, "profit_value_created")), + profit_value_destroyed: MetricPattern1::new(client.clone(), _m(&acc, "profit_value_destroyed")), realized_cap: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap")), realized_cap_cents: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap_cents")), - realized_cap_change_1m: MetricPattern1::new( - client.clone(), - _m(&acc, "realized_cap_change_1m"), - ), + realized_cap_change_1m: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap_change_1m")), realized_loss: CumulativeHeightPattern::new(client.clone(), _m(&acc, "realized_loss")), - realized_loss_ema_1w: MetricPattern1::new( - client.clone(), - _m(&acc, "realized_loss_ema_1w"), - ), - realized_loss_rel_to_realized_cap: BpsPercentRatioPattern::new( - client.clone(), - _m(&acc, "realized_loss_rel_to_realized_cap"), - ), + realized_loss_ema_1w: MetricPattern1::new(client.clone(), _m(&acc, "realized_loss_ema_1w")), + realized_loss_rel_to_realized_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "realized_loss_rel_to_realized_cap")), realized_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "realized_price")), - realized_price_ratio: BpsRatioPattern::new( - client.clone(), - _m(&acc, "realized_price_ratio"), - ), - realized_profit: CumulativeHeightPattern::new( - client.clone(), - _m(&acc, "realized_profit"), - ), - realized_profit_ema_1w: MetricPattern1::new( - client.clone(), - _m(&acc, "realized_profit_ema_1w"), - ), - realized_profit_rel_to_realized_cap: BpsPercentRatioPattern::new( - client.clone(), - _m(&acc, "realized_profit_rel_to_realized_cap"), - ), - sell_side_risk_ratio: _1m1w1y24hPattern2::new( - client.clone(), - _m(&acc, "sell_side_risk_ratio"), - ), - sell_side_risk_ratio_24h_ema: _1m1wPattern::new( - client.clone(), - _m(&acc, "sell_side_risk_ratio_24h_ema"), - ), + realized_price_ratio: BpsRatioPattern::new(client.clone(), _m(&acc, "realized_price_ratio")), + realized_profit: CumulativeHeightPattern::new(client.clone(), _m(&acc, "realized_profit")), + realized_profit_ema_1w: MetricPattern1::new(client.clone(), _m(&acc, "realized_profit_ema_1w")), + realized_profit_rel_to_realized_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "realized_profit_rel_to_realized_cap")), + sell_side_risk_ratio: _1m1w1y24hPattern2::new(client.clone(), _m(&acc, "sell_side_risk_ratio")), + sell_side_risk_ratio_24h_ema: _1m1wPattern::new(client.clone(), _m(&acc, "sell_side_risk_ratio_24h_ema")), sent_in_loss: BaseCumulativePattern::new(client.clone(), _m(&acc, "sent_in_loss")), sent_in_loss_ema: _2wPattern::new(client.clone(), _m(&acc, "sent_in_loss_ema_2w")), sent_in_profit: BaseCumulativePattern::new(client.clone(), _m(&acc, "sent_in_profit")), sent_in_profit_ema: _2wPattern::new(client.clone(), _m(&acc, "sent_in_profit_ema_2w")), sopr: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "sopr")), sopr_24h_ema: _1m1wPattern2::new(client.clone(), _m(&acc, "sopr_24h_ema")), - upper_price_band: CentsSatsUsdPattern::new( - client.clone(), - _m(&acc, "upper_price_band"), - ), + upper_price_band: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "upper_price_band")), value_created: MetricPattern1::new(client.clone(), _m(&acc, "value_created")), value_created_sum: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "value_created")), value_destroyed: MetricPattern1::new(client.clone(), _m(&acc, "value_destroyed")), - value_destroyed_sum: _1m1w1y24hPattern::new( - client.clone(), - _m(&acc, "value_destroyed"), - ), + value_destroyed_sum: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "value_destroyed")), } } } @@ -2984,22 +1523,10 @@ impl BpsPriceRatioPattern { ratio_pct98_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "ratio_pct98")), ratio_pct99: BpsRatioPattern::new(client.clone(), _m(&acc, "ratio_pct99")), ratio_pct99_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "ratio_pct99")), - ratio_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern::new( - client.clone(), - _m(&acc, "ratio"), - ), - ratio_sd_1y: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern::new( - client.clone(), - _m(&acc, "ratio"), - ), - ratio_sd_2y: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern::new( - client.clone(), - _m(&acc, "ratio"), - ), - ratio_sd_4y: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern::new( - client.clone(), - _m(&acc, "ratio"), - ), + ratio_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern::new(client.clone(), _m(&acc, "ratio")), + ratio_sd_1y: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern::new(client.clone(), _m(&acc, "ratio")), + ratio_sd_2y: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern::new(client.clone(), _m(&acc, "ratio")), + ratio_sd_4y: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern::new(client.clone(), _m(&acc, "ratio")), ratio_sma_1m: BpsRatioPattern::new(client.clone(), _m(&acc, "ratio_sma_1m")), ratio_sma_1w: BpsRatioPattern::new(client.clone(), _m(&acc, "ratio_sma_1w")), } @@ -3048,22 +1575,10 @@ impl BpsRatioPattern2 { ratio_pct98_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "pct98")), ratio_pct99: BpsRatioPattern::new(client.clone(), _m(&acc, "pct99")), ratio_pct99_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "pct99")), - ratio_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern::new( - client.clone(), - acc.clone(), - ), - ratio_sd_1y: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern::new( - client.clone(), - acc.clone(), - ), - ratio_sd_2y: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern::new( - client.clone(), - acc.clone(), - ), - ratio_sd_4y: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern::new( - client.clone(), - acc.clone(), - ), + ratio_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern::new(client.clone(), acc.clone()), + ratio_sd_1y: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern::new(client.clone(), acc.clone()), + ratio_sd_2y: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern::new(client.clone(), acc.clone()), + ratio_sd_4y: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern::new(client.clone(), acc.clone()), ratio_sma_1m: BpsRatioPattern::new(client.clone(), _m(&acc, "sma_1m")), ratio_sma_1w: BpsRatioPattern::new(client.clone(), _m(&acc, "sma_1w")), } @@ -3098,90 +1613,32 @@ impl InvestedNegNetNuplSupplyUnrealizedPattern2 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - invested_capital_in_loss_rel_to_realized_cap: BpsPercentRatioPattern::new( - client.clone(), - _m(&acc, "invested_capital_in_loss_rel_to_realized_cap"), - ), - invested_capital_in_profit_rel_to_realized_cap: BpsPercentRatioPattern::new( - client.clone(), - _m(&acc, "invested_capital_in_profit_rel_to_realized_cap"), - ), - neg_unrealized_loss_rel_to_market_cap: BpsPercentRatioPattern::new( - client.clone(), - _m(&acc, "neg_unrealized_loss_rel_to_market_cap"), - ), - neg_unrealized_loss_rel_to_own_gross_pnl: BpsPercentRatioPattern::new( - client.clone(), - _m(&acc, "neg_unrealized_loss_rel_to_own_gross_pnl"), - ), - neg_unrealized_loss_rel_to_own_market_cap: BpsPercentRatioPattern::new( - client.clone(), - _m(&acc, "neg_unrealized_loss_rel_to_own_market_cap"), - ), - net_unrealized_pnl_rel_to_market_cap: BpsPercentRatioPattern::new( - client.clone(), - _m(&acc, "net_unrealized_pnl_rel_to_market_cap"), - ), - net_unrealized_pnl_rel_to_own_gross_pnl: BpsPercentRatioPattern::new( - client.clone(), - _m(&acc, "net_unrealized_pnl_rel_to_own_gross_pnl"), - ), - net_unrealized_pnl_rel_to_own_market_cap: BpsPercentRatioPattern::new( - client.clone(), - _m(&acc, "net_unrealized_pnl_rel_to_own_market_cap"), - ), + invested_capital_in_loss_rel_to_realized_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "invested_capital_in_loss_rel_to_realized_cap")), + invested_capital_in_profit_rel_to_realized_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "invested_capital_in_profit_rel_to_realized_cap")), + neg_unrealized_loss_rel_to_market_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "neg_unrealized_loss_rel_to_market_cap")), + neg_unrealized_loss_rel_to_own_gross_pnl: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "neg_unrealized_loss_rel_to_own_gross_pnl")), + neg_unrealized_loss_rel_to_own_market_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "neg_unrealized_loss_rel_to_own_market_cap")), + net_unrealized_pnl_rel_to_market_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "net_unrealized_pnl_rel_to_market_cap")), + net_unrealized_pnl_rel_to_own_gross_pnl: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "net_unrealized_pnl_rel_to_own_gross_pnl")), + net_unrealized_pnl_rel_to_own_market_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "net_unrealized_pnl_rel_to_own_market_cap")), nupl: MetricPattern1::new(client.clone(), _m(&acc, "nupl")), - supply_in_loss_rel_to_circulating_supply: BpsPercentRatioPattern::new( - client.clone(), - _m(&acc, "supply_in_loss_rel_to_circulating_supply"), - ), - supply_in_loss_rel_to_own_supply: BpsPercentRatioPattern::new( - client.clone(), - _m(&acc, "supply_in_loss_rel_to_own_supply"), - ), - supply_in_profit_rel_to_circulating_supply: BpsPercentRatioPattern::new( - client.clone(), - _m(&acc, "supply_in_profit_rel_to_circulating_supply"), - ), - supply_in_profit_rel_to_own_supply: BpsPercentRatioPattern::new( - client.clone(), - _m(&acc, "supply_in_profit_rel_to_own_supply"), - ), - supply_rel_to_circulating_supply: BpsPercentRatioPattern::new( - client.clone(), - _m(&acc, "supply_rel_to_circulating_supply"), - ), - unrealized_loss_rel_to_market_cap: BpsPercentRatioPattern::new( - client.clone(), - _m(&acc, "unrealized_loss_rel_to_market_cap"), - ), - unrealized_loss_rel_to_own_gross_pnl: BpsPercentRatioPattern::new( - client.clone(), - _m(&acc, "unrealized_loss_rel_to_own_gross_pnl"), - ), - unrealized_loss_rel_to_own_market_cap: BpsPercentRatioPattern::new( - client.clone(), - _m(&acc, "unrealized_loss_rel_to_own_market_cap"), - ), - unrealized_profit_rel_to_market_cap: BpsPercentRatioPattern::new( - client.clone(), - _m(&acc, "unrealized_profit_rel_to_market_cap"), - ), - unrealized_profit_rel_to_own_gross_pnl: BpsPercentRatioPattern::new( - client.clone(), - _m(&acc, "unrealized_profit_rel_to_own_gross_pnl"), - ), - unrealized_profit_rel_to_own_market_cap: BpsPercentRatioPattern::new( - client.clone(), - _m(&acc, "unrealized_profit_rel_to_own_market_cap"), - ), + supply_in_loss_rel_to_circulating_supply: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "supply_in_loss_rel_to_circulating_supply")), + supply_in_loss_rel_to_own_supply: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "supply_in_loss_rel_to_own_supply")), + supply_in_profit_rel_to_circulating_supply: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "supply_in_profit_rel_to_circulating_supply")), + supply_in_profit_rel_to_own_supply: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "supply_in_profit_rel_to_own_supply")), + supply_rel_to_circulating_supply: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "supply_rel_to_circulating_supply")), + unrealized_loss_rel_to_market_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "unrealized_loss_rel_to_market_cap")), + unrealized_loss_rel_to_own_gross_pnl: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "unrealized_loss_rel_to_own_gross_pnl")), + unrealized_loss_rel_to_own_market_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "unrealized_loss_rel_to_own_market_cap")), + unrealized_profit_rel_to_market_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "unrealized_profit_rel_to_market_cap")), + unrealized_profit_rel_to_own_gross_pnl: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "unrealized_profit_rel_to_own_gross_pnl")), + unrealized_profit_rel_to_own_market_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "unrealized_profit_rel_to_own_market_cap")), } } } /// Pattern struct for repeated tree structure. -pub struct Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern -{ +pub struct Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern { pub pct05: CentsSatsUsdPattern, pub pct10: CentsSatsUsdPattern, pub pct15: CentsSatsUsdPattern, @@ -3268,22 +1725,10 @@ impl RatioPattern { ratio_pct98_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "pct98")), ratio_pct99: BpsRatioPattern::new(client.clone(), _m(&acc, "pct99")), ratio_pct99_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "pct99")), - ratio_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern::new( - client.clone(), - acc.clone(), - ), - ratio_sd_1y: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern::new( - client.clone(), - acc.clone(), - ), - ratio_sd_2y: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern::new( - client.clone(), - acc.clone(), - ), - ratio_sd_4y: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern::new( - client.clone(), - acc.clone(), - ), + ratio_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern::new(client.clone(), acc.clone()), + ratio_sd_1y: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern::new(client.clone(), acc.clone()), + ratio_sd_2y: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern::new(client.clone(), acc.clone()), + ratio_sd_4y: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern::new(client.clone(), acc.clone()), ratio_sma_1m: BpsRatioPattern::new(client.clone(), _m(&acc, "sma_1m")), ratio_sma_1w: BpsRatioPattern::new(client.clone(), _m(&acc, "sma_1w")), } @@ -3316,45 +1761,18 @@ impl GreedGrossInvestedInvestorNegNetPainSupplyUnrealizedPattern { Self { greed_index: CentsUsdPattern::new(client.clone(), _m(&acc, "greed_index")), gross_pnl: CentsUsdPattern::new(client.clone(), _m(&acc, "unrealized_gross_pnl")), - invested_capital_in_loss: CentsUsdPattern::new( - client.clone(), - _m(&acc, "invested_capital_in_loss"), - ), - invested_capital_in_loss_raw: MetricPattern18::new( - client.clone(), - _m(&acc, "invested_capital_in_loss_raw"), - ), - invested_capital_in_profit: CentsUsdPattern::new( - client.clone(), - _m(&acc, "invested_capital_in_profit"), - ), - invested_capital_in_profit_raw: MetricPattern18::new( - client.clone(), - _m(&acc, "invested_capital_in_profit_raw"), - ), - investor_cap_in_loss_raw: MetricPattern18::new( - client.clone(), - _m(&acc, "investor_cap_in_loss_raw"), - ), - investor_cap_in_profit_raw: MetricPattern18::new( - client.clone(), - _m(&acc, "investor_cap_in_profit_raw"), - ), - neg_unrealized_loss: MetricPattern1::new( - client.clone(), - _m(&acc, "neg_unrealized_loss"), - ), + invested_capital_in_loss: CentsUsdPattern::new(client.clone(), _m(&acc, "invested_capital_in_loss")), + invested_capital_in_loss_raw: MetricPattern18::new(client.clone(), _m(&acc, "invested_capital_in_loss_raw")), + invested_capital_in_profit: CentsUsdPattern::new(client.clone(), _m(&acc, "invested_capital_in_profit")), + invested_capital_in_profit_raw: MetricPattern18::new(client.clone(), _m(&acc, "invested_capital_in_profit_raw")), + investor_cap_in_loss_raw: MetricPattern18::new(client.clone(), _m(&acc, "investor_cap_in_loss_raw")), + investor_cap_in_profit_raw: MetricPattern18::new(client.clone(), _m(&acc, "investor_cap_in_profit_raw")), + neg_unrealized_loss: MetricPattern1::new(client.clone(), _m(&acc, "neg_unrealized_loss")), net_sentiment: CentsUsdPattern::new(client.clone(), _m(&acc, "net_sentiment")), - net_unrealized_pnl: CentsUsdPattern::new( - client.clone(), - _m(&acc, "net_unrealized_pnl"), - ), + net_unrealized_pnl: CentsUsdPattern::new(client.clone(), _m(&acc, "net_unrealized_pnl")), pain_index: CentsUsdPattern::new(client.clone(), _m(&acc, "pain_index")), supply_in_loss: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "supply_in_loss")), - supply_in_profit: BtcCentsSatsUsdPattern::new( - client.clone(), - _m(&acc, "supply_in_profit"), - ), + supply_in_profit: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "supply_in_profit")), unrealized_loss: CentsUsdPattern::new(client.clone(), _m(&acc, "unrealized_loss")), unrealized_profit: CentsUsdPattern::new(client.clone(), _m(&acc, "unrealized_profit")), } @@ -3453,51 +1871,18 @@ impl InvestedNegNetNuplSupplyUnrealizedPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - invested_capital_in_loss_rel_to_realized_cap: BpsPercentRatioPattern::new( - client.clone(), - _m(&acc, "invested_capital_in_loss_rel_to_realized_cap"), - ), - invested_capital_in_profit_rel_to_realized_cap: BpsPercentRatioPattern::new( - client.clone(), - _m(&acc, "invested_capital_in_profit_rel_to_realized_cap"), - ), - neg_unrealized_loss_rel_to_market_cap: BpsPercentRatioPattern::new( - client.clone(), - _m(&acc, "neg_unrealized_loss_rel_to_market_cap"), - ), - net_unrealized_pnl_rel_to_market_cap: BpsPercentRatioPattern::new( - client.clone(), - _m(&acc, "net_unrealized_pnl_rel_to_market_cap"), - ), + invested_capital_in_loss_rel_to_realized_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "invested_capital_in_loss_rel_to_realized_cap")), + invested_capital_in_profit_rel_to_realized_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "invested_capital_in_profit_rel_to_realized_cap")), + neg_unrealized_loss_rel_to_market_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "neg_unrealized_loss_rel_to_market_cap")), + net_unrealized_pnl_rel_to_market_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "net_unrealized_pnl_rel_to_market_cap")), nupl: MetricPattern1::new(client.clone(), _m(&acc, "nupl")), - supply_in_loss_rel_to_circulating_supply: BpsPercentRatioPattern::new( - client.clone(), - _m(&acc, "supply_in_loss_rel_to_circulating_supply"), - ), - supply_in_loss_rel_to_own_supply: BpsPercentRatioPattern::new( - client.clone(), - _m(&acc, "supply_in_loss_rel_to_own_supply"), - ), - supply_in_profit_rel_to_circulating_supply: BpsPercentRatioPattern::new( - client.clone(), - _m(&acc, "supply_in_profit_rel_to_circulating_supply"), - ), - supply_in_profit_rel_to_own_supply: BpsPercentRatioPattern::new( - client.clone(), - _m(&acc, "supply_in_profit_rel_to_own_supply"), - ), - supply_rel_to_circulating_supply: BpsPercentRatioPattern::new( - client.clone(), - _m(&acc, "supply_rel_to_circulating_supply"), - ), - unrealized_loss_rel_to_market_cap: BpsPercentRatioPattern::new( - client.clone(), - _m(&acc, "unrealized_loss_rel_to_market_cap"), - ), - unrealized_profit_rel_to_market_cap: BpsPercentRatioPattern::new( - client.clone(), - _m(&acc, "unrealized_profit_rel_to_market_cap"), - ), + supply_in_loss_rel_to_circulating_supply: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "supply_in_loss_rel_to_circulating_supply")), + supply_in_loss_rel_to_own_supply: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "supply_in_loss_rel_to_own_supply")), + supply_in_profit_rel_to_circulating_supply: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "supply_in_profit_rel_to_circulating_supply")), + supply_in_profit_rel_to_own_supply: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "supply_in_profit_rel_to_own_supply")), + supply_rel_to_circulating_supply: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "supply_rel_to_circulating_supply")), + unrealized_loss_rel_to_market_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "unrealized_loss_rel_to_market_cap")), + unrealized_profit_rel_to_market_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "unrealized_profit_rel_to_market_cap")), } } } @@ -3526,14 +1911,11 @@ impl AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90RollingSumPattern { max: MetricPattern18::new(client.clone(), _m(&acc, "max")), median: MetricPattern18::new(client.clone(), _m(&acc, "median")), min: MetricPattern18::new(client.clone(), _m(&acc, "min")), - pct10: MetricPattern18::new(client.clone(), _m(&acc, "pct10")), - pct25: MetricPattern18::new(client.clone(), _m(&acc, "pct25")), - pct75: MetricPattern18::new(client.clone(), _m(&acc, "pct75")), - pct90: MetricPattern18::new(client.clone(), _m(&acc, "pct90")), - rolling: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern::new( - client.clone(), - acc.clone(), - ), + pct10: MetricPattern18::new(client.clone(), _m(&acc, "p10")), + pct25: MetricPattern18::new(client.clone(), _m(&acc, "p25")), + pct75: MetricPattern18::new(client.clone(), _m(&acc, "p75")), + pct90: MetricPattern18::new(client.clone(), _m(&acc, "p90")), + rolling: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern::new(client.clone(), acc.clone()), sum: MetricPattern18::new(client.clone(), _m(&acc, "sum")), } } @@ -3801,10 +2183,7 @@ impl BlocksCoinbaseDominanceFeeSubsidyPattern { Self { blocks_mined: CumulativeHeightSumPattern::new(client.clone(), _m(&acc, "blocks_mined")), blocks_mined_sum: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "blocks_mined_sum")), - blocks_since_last_mined: MetricPattern1::new( - client.clone(), - _m(&acc, "blocks_since_last_mined"), - ), + blocks_since_last_mined: MetricPattern1::new(client.clone(), _m(&acc, "blocks_since_last_mined")), coinbase: BaseCumulativeSumPattern::new(client.clone(), _m(&acc, "coinbase")), dominance: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "dominance")), dominance_rolling: _1m1w1y24hPattern2::new(client.clone(), _m(&acc, "dominance")), @@ -3834,10 +2213,10 @@ impl AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern { max: MetricPattern18::new(client.clone(), _m(&acc, "max")), median: MetricPattern18::new(client.clone(), _m(&acc, "median")), min: MetricPattern18::new(client.clone(), _m(&acc, "min")), - pct10: MetricPattern18::new(client.clone(), _m(&acc, "pct10")), - pct25: MetricPattern18::new(client.clone(), _m(&acc, "pct25")), - pct75: MetricPattern18::new(client.clone(), _m(&acc, "pct75")), - pct90: MetricPattern18::new(client.clone(), _m(&acc, "pct90")), + pct10: MetricPattern18::new(client.clone(), _m(&acc, "p10")), + pct25: MetricPattern18::new(client.clone(), _m(&acc, "p25")), + pct75: MetricPattern18::new(client.clone(), _m(&acc, "p75")), + pct90: MetricPattern18::new(client.clone(), _m(&acc, "p90")), } } } @@ -3960,22 +2339,10 @@ impl _1m1w1y24hBaseCumulativePattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - _1m: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new( - client.clone(), - _m(&acc, "1m"), - ), - _1w: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new( - client.clone(), - _m(&acc, "1w"), - ), - _1y: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new( - client.clone(), - _m(&acc, "1y"), - ), - _24h: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new( - client.clone(), - _m(&acc, "24h"), - ), + _1m: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), _m(&acc, "1m")), + _1w: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), _m(&acc, "1w")), + _1y: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), _m(&acc, "1y")), + _24h: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), _m(&acc, "24h")), base: BtcCentsSatsUsdPattern::new(client.clone(), acc.clone()), cumulative: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "cumulative")), } @@ -3996,30 +2363,12 @@ impl BalanceBothReactivatedReceivingSendingPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - balance_decreased: AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern::new( - client.clone(), - _m(&acc, "balance_decreased"), - ), - balance_increased: AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern::new( - client.clone(), - _m(&acc, "balance_increased"), - ), - both: AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern::new( - client.clone(), - _m(&acc, "both"), - ), - reactivated: AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern::new( - client.clone(), - _m(&acc, "reactivated"), - ), - receiving: AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern::new( - client.clone(), - _m(&acc, "receiving"), - ), - sending: AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern::new( - client.clone(), - _m(&acc, "sending"), - ), + balance_decreased: AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern::new(client.clone(), _m(&acc, "balance_decreased")), + balance_increased: AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern::new(client.clone(), _m(&acc, "balance_increased")), + both: AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern::new(client.clone(), _m(&acc, "both")), + reactivated: AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern::new(client.clone(), _m(&acc, "reactivated")), + receiving: AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern::new(client.clone(), _m(&acc, "receiving")), + sending: AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern::new(client.clone(), _m(&acc, "sending")), } } } @@ -4038,18 +2387,9 @@ impl CoinblocksCoindaysSatblocksSatdaysSentPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - coinblocks_destroyed: CumulativeHeightSumPattern::new( - client.clone(), - _m(&acc, "coinblocks_destroyed"), - ), - coindays_destroyed: CumulativeHeightSumPattern::new( - client.clone(), - _m(&acc, "coindays_destroyed"), - ), - satblocks_destroyed: MetricPattern18::new( - client.clone(), - _m(&acc, "satblocks_destroyed"), - ), + coinblocks_destroyed: CumulativeHeightSumPattern::new(client.clone(), _m(&acc, "coinblocks_destroyed")), + coindays_destroyed: CumulativeHeightSumPattern::new(client.clone(), _m(&acc, "coindays_destroyed")), + satblocks_destroyed: MetricPattern18::new(client.clone(), _m(&acc, "satblocks_destroyed")), satdays_destroyed: MetricPattern18::new(client.clone(), _m(&acc, "satdays_destroyed")), sent: BaseCumulativePattern::new(client.clone(), _m(&acc, "sent")), sent_ema: _2wPattern::new(client.clone(), _m(&acc, "sent_ema_2w")), @@ -4212,10 +2552,7 @@ impl BpsPercentRatioPattern2 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - bps: AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern::new( - client.clone(), - _m(&acc, "bps"), - ), + bps: AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern::new(client.clone(), _m(&acc, "bps")), percent: MetricPattern1::new(client.clone(), acc.clone()), ratio: MetricPattern1::new(client.clone(), _m(&acc, "ratio")), } @@ -4305,10 +2642,7 @@ impl _6bBlockTxindexPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - _6b: AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern::new( - client.clone(), - _m(&acc, "6b"), - ), + _6b: AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern::new(client.clone(), _m(&acc, "6b")), block: AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern::new(client.clone(), acc.clone()), txindex: MetricPattern19::new(client.clone(), acc.clone()), } @@ -4533,10 +2867,7 @@ impl MetricsTree { pub fn new(client: Arc, base_path: String) -> Self { Self { blocks: MetricsTree_Blocks::new(client.clone(), format!("{base_path}_blocks")), - transactions: MetricsTree_Transactions::new( - client.clone(), - format!("{base_path}_transactions"), - ), + transactions: MetricsTree_Transactions::new(client.clone(), format!("{base_path}_transactions")), inputs: MetricsTree_Inputs::new(client.clone(), format!("{base_path}_inputs")), outputs: MetricsTree_Outputs::new(client.clone(), format!("{base_path}_outputs")), addresses: MetricsTree_Addresses::new(client.clone(), format!("{base_path}_addresses")), @@ -4549,10 +2880,7 @@ impl MetricsTree { market: MetricsTree_Market::new(client.clone(), format!("{base_path}_market")), pools: MetricsTree_Pools::new(client.clone(), format!("{base_path}_pools")), prices: MetricsTree_Prices::new(client.clone(), format!("{base_path}_prices")), - distribution: MetricsTree_Distribution::new( - client.clone(), - format!("{base_path}_distribution"), - ), + distribution: MetricsTree_Distribution::new(client.clone(), format!("{base_path}_distribution")), supply: MetricsTree_Supply::new(client.clone(), format!("{base_path}_supply")), } } @@ -4577,26 +2905,14 @@ impl MetricsTree_Blocks { pub fn new(client: Arc, base_path: String) -> Self { Self { blockhash: MetricPattern18::new(client.clone(), "blockhash".to_string()), - difficulty: MetricsTree_Blocks_Difficulty::new( - client.clone(), - format!("{base_path}_difficulty"), - ), + difficulty: MetricsTree_Blocks_Difficulty::new(client.clone(), format!("{base_path}_difficulty")), time: MetricsTree_Blocks_Time::new(client.clone(), format!("{base_path}_time")), total_size: MetricPattern18::new(client.clone(), "total_size".to_string()), weight: MetricsTree_Blocks_Weight::new(client.clone(), format!("{base_path}_weight")), count: MetricsTree_Blocks_Count::new(client.clone(), format!("{base_path}_count")), - interval: AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern::new( - client.clone(), - "block_interval".to_string(), - ), - halving: MetricsTree_Blocks_Halving::new( - client.clone(), - format!("{base_path}_halving"), - ), - vbytes: AverageCumulativeHeightMaxMedianMinPct10Pct25Pct75Pct90SumPattern::new( - client.clone(), - "block_vbytes".to_string(), - ), + interval: AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern::new(client.clone(), "block_interval".to_string()), + halving: MetricsTree_Blocks_Halving::new(client.clone(), format!("{base_path}_halving")), + vbytes: AverageCumulativeHeightMaxMedianMinPct10Pct25Pct75Pct90SumPattern::new(client.clone(), "block_vbytes".to_string()), size: MetricsTree_Blocks_Size::new(client.clone(), format!("{base_path}_size")), fullness: BpsPercentRatioPattern2::new(client.clone(), "block_fullness".to_string()), } @@ -4618,19 +2934,10 @@ impl MetricsTree_Blocks_Difficulty { Self { raw: MetricPattern1::new(client.clone(), "difficulty".to_string()), as_hash: MetricPattern1::new(client.clone(), "difficulty_as_hash".to_string()), - adjustment: BpsPercentRatioPattern::new( - client.clone(), - "difficulty_adjustment".to_string(), - ), + adjustment: BpsPercentRatioPattern::new(client.clone(), "difficulty_adjustment".to_string()), epoch: MetricPattern1::new(client.clone(), "difficulty_epoch".to_string()), - blocks_before_next_adjustment: MetricPattern1::new( - client.clone(), - "blocks_before_next_difficulty_adjustment".to_string(), - ), - days_before_next_adjustment: MetricPattern1::new( - client.clone(), - "days_before_next_difficulty_adjustment".to_string(), - ), + blocks_before_next_adjustment: MetricPattern1::new(client.clone(), "blocks_before_next_difficulty_adjustment".to_string()), + days_before_next_adjustment: MetricPattern1::new(client.clone(), "days_before_next_difficulty_adjustment".to_string()), } } } @@ -4647,10 +2954,7 @@ impl MetricsTree_Blocks_Time { Self { timestamp: MetricPattern1::new(client.clone(), "timestamp".to_string()), date: MetricPattern18::new(client.clone(), "date".to_string()), - timestamp_monotonic: MetricPattern18::new( - client.clone(), - "timestamp_monotonic".to_string(), - ), + timestamp_monotonic: MetricPattern18::new(client.clone(), "timestamp_monotonic".to_string()), } } } @@ -4741,10 +3045,7 @@ pub struct MetricsTree_Blocks_Count { impl MetricsTree_Blocks_Count { pub fn new(client: Arc, base_path: String) -> Self { Self { - block_count_target: MetricPattern1::new( - client.clone(), - "block_count_target".to_string(), - ), + block_count_target: MetricPattern1::new(client.clone(), "block_count_target".to_string()), block_count: CumulativeHeightSumPattern::new(client.clone(), "block_count".to_string()), block_count_sum: _1m1w1y24hPattern::new(client.clone(), "block_count_sum".to_string()), height_1h_ago: MetricPattern18::new(client.clone(), "height_1h_ago".to_string()), @@ -4805,14 +3106,8 @@ impl MetricsTree_Blocks_Halving { pub fn new(client: Arc, base_path: String) -> Self { Self { epoch: MetricPattern1::new(client.clone(), "halving_epoch".to_string()), - blocks_before_next_halving: MetricPattern1::new( - client.clone(), - "blocks_before_next_halving".to_string(), - ), - days_before_next_halving: MetricPattern1::new( - client.clone(), - "days_before_next_halving".to_string(), - ), + blocks_before_next_halving: MetricPattern1::new(client.clone(), "blocks_before_next_halving".to_string()), + days_before_next_halving: MetricPattern1::new(client.clone(), "days_before_next_halving".to_string()), } } } @@ -4877,26 +3172,14 @@ impl MetricsTree_Transactions { rawlocktime: MetricPattern19::new(client.clone(), "rawlocktime".to_string()), base_size: MetricPattern19::new(client.clone(), "base_size".to_string()), total_size: MetricPattern19::new(client.clone(), "total_size".to_string()), - is_explicitly_rbf: MetricPattern19::new( - client.clone(), - "is_explicitly_rbf".to_string(), - ), + is_explicitly_rbf: MetricPattern19::new(client.clone(), "is_explicitly_rbf".to_string()), first_txinindex: MetricPattern19::new(client.clone(), "first_txinindex".to_string()), first_txoutindex: MetricPattern19::new(client.clone(), "first_txoutindex".to_string()), - count: MetricsTree_Transactions_Count::new( - client.clone(), - format!("{base_path}_count"), - ), + count: MetricsTree_Transactions_Count::new(client.clone(), format!("{base_path}_count")), size: MetricsTree_Transactions_Size::new(client.clone(), format!("{base_path}_size")), fees: MetricsTree_Transactions_Fees::new(client.clone(), format!("{base_path}_fees")), - versions: MetricsTree_Transactions_Versions::new( - client.clone(), - format!("{base_path}_versions"), - ), - volume: MetricsTree_Transactions_Volume::new( - client.clone(), - format!("{base_path}_volume"), - ), + versions: MetricsTree_Transactions_Versions::new(client.clone(), format!("{base_path}_versions")), + volume: MetricsTree_Transactions_Volume::new(client.clone(), format!("{base_path}_volume")), } } } @@ -4910,10 +3193,7 @@ pub struct MetricsTree_Transactions_Count { impl MetricsTree_Transactions_Count { pub fn new(client: Arc, base_path: String) -> Self { Self { - tx_count: AverageCumulativeHeightMaxMedianMinPct10Pct25Pct75Pct90SumPattern::new( - client.clone(), - "tx_count".to_string(), - ), + tx_count: AverageCumulativeHeightMaxMedianMinPct10Pct25Pct75Pct90SumPattern::new(client.clone(), "tx_count".to_string()), is_coinbase: MetricPattern19::new(client.clone(), "is_coinbase".to_string()), } } @@ -4984,14 +3264,8 @@ impl MetricsTree_Transactions_Volume { pub fn new(client: Arc, base_path: String) -> Self { Self { sent_sum: _1m1w1y24hBtcCentsSatsUsdPattern::new(client.clone(), "sent_sum".to_string()), - received_sum: _1m1w1y24hBtcCentsSatsUsdPattern::new( - client.clone(), - "received_sum".to_string(), - ), - annualized_volume: BtcCentsSatsUsdPattern::new( - client.clone(), - "annualized_volume".to_string(), - ), + received_sum: _1m1w1y24hBtcCentsSatsUsdPattern::new(client.clone(), "received_sum".to_string()), + annualized_volume: BtcCentsSatsUsdPattern::new(client.clone(), "annualized_volume".to_string()), tx_per_sec: MetricPattern1::new(client.clone(), "tx_per_sec".to_string()), outputs_per_sec: MetricPattern1::new(client.clone(), "outputs_per_sec".to_string()), inputs_per_sec: MetricPattern1::new(client.clone(), "inputs_per_sec".to_string()), @@ -5019,10 +3293,7 @@ impl MetricsTree_Inputs { outputtype: MetricPattern20::new(client.clone(), "outputtype".to_string()), typeindex: MetricPattern20::new(client.clone(), "typeindex".to_string()), spent: MetricsTree_Inputs_Spent::new(client.clone(), format!("{base_path}_spent")), - count: AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90RollingSumPattern::new( - client.clone(), - "input_count".to_string(), - ), + count: AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90RollingSumPattern::new(client.clone(), "input_count".to_string()), } } } @@ -5089,10 +3360,7 @@ pub struct MetricsTree_Outputs_Count { impl MetricsTree_Outputs_Count { pub fn new(client: Arc, base_path: String) -> Self { Self { - total_count: AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90RollingSumPattern::new( - client.clone(), - "output_count".to_string(), - ), + total_count: AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90RollingSumPattern::new(client.clone(), "output_count".to_string()), utxo_count: MetricPattern1::new(client.clone(), "exact_utxo_count".to_string()), } } @@ -5121,38 +3389,14 @@ pub struct MetricsTree_Addresses { impl MetricsTree_Addresses { pub fn new(client: Arc, base_path: String) -> Self { Self { - first_p2pk65addressindex: MetricPattern18::new( - client.clone(), - "first_p2pk65addressindex".to_string(), - ), - first_p2pk33addressindex: MetricPattern18::new( - client.clone(), - "first_p2pk33addressindex".to_string(), - ), - first_p2pkhaddressindex: MetricPattern18::new( - client.clone(), - "first_p2pkhaddressindex".to_string(), - ), - first_p2shaddressindex: MetricPattern18::new( - client.clone(), - "first_p2shaddressindex".to_string(), - ), - first_p2wpkhaddressindex: MetricPattern18::new( - client.clone(), - "first_p2wpkhaddressindex".to_string(), - ), - first_p2wshaddressindex: MetricPattern18::new( - client.clone(), - "first_p2wshaddressindex".to_string(), - ), - first_p2traddressindex: MetricPattern18::new( - client.clone(), - "first_p2traddressindex".to_string(), - ), - first_p2aaddressindex: MetricPattern18::new( - client.clone(), - "first_p2aaddressindex".to_string(), - ), + first_p2pk65addressindex: MetricPattern18::new(client.clone(), "first_p2pk65addressindex".to_string()), + first_p2pk33addressindex: MetricPattern18::new(client.clone(), "first_p2pk33addressindex".to_string()), + first_p2pkhaddressindex: MetricPattern18::new(client.clone(), "first_p2pkhaddressindex".to_string()), + first_p2shaddressindex: MetricPattern18::new(client.clone(), "first_p2shaddressindex".to_string()), + first_p2wpkhaddressindex: MetricPattern18::new(client.clone(), "first_p2wpkhaddressindex".to_string()), + first_p2wshaddressindex: MetricPattern18::new(client.clone(), "first_p2wshaddressindex".to_string()), + first_p2traddressindex: MetricPattern18::new(client.clone(), "first_p2traddressindex".to_string()), + first_p2aaddressindex: MetricPattern18::new(client.clone(), "first_p2aaddressindex".to_string()), p2pk65bytes: MetricPattern27::new(client.clone(), "p2pk65bytes".to_string()), p2pk33bytes: MetricPattern26::new(client.clone(), "p2pk33bytes".to_string()), p2pkhbytes: MetricPattern28::new(client.clone(), "p2pkhbytes".to_string()), @@ -5183,32 +3427,17 @@ pub struct MetricsTree_Scripts { impl MetricsTree_Scripts { pub fn new(client: Arc, base_path: String) -> Self { Self { - first_emptyoutputindex: MetricPattern18::new( - client.clone(), - "first_emptyoutputindex".to_string(), - ), - first_opreturnindex: MetricPattern18::new( - client.clone(), - "first_opreturnindex".to_string(), - ), - first_p2msoutputindex: MetricPattern18::new( - client.clone(), - "first_p2msoutputindex".to_string(), - ), - first_unknownoutputindex: MetricPattern18::new( - client.clone(), - "first_unknownoutputindex".to_string(), - ), + first_emptyoutputindex: MetricPattern18::new(client.clone(), "first_emptyoutputindex".to_string()), + first_opreturnindex: MetricPattern18::new(client.clone(), "first_opreturnindex".to_string()), + first_p2msoutputindex: MetricPattern18::new(client.clone(), "first_p2msoutputindex".to_string()), + first_unknownoutputindex: MetricPattern18::new(client.clone(), "first_unknownoutputindex".to_string()), empty_to_txindex: MetricPattern22::new(client.clone(), "txindex".to_string()), opreturn_to_txindex: MetricPattern23::new(client.clone(), "txindex".to_string()), p2ms_to_txindex: MetricPattern25::new(client.clone(), "txindex".to_string()), unknown_to_txindex: MetricPattern33::new(client.clone(), "txindex".to_string()), count: MetricsTree_Scripts_Count::new(client.clone(), format!("{base_path}_count")), value: MetricsTree_Scripts_Value::new(client.clone(), format!("{base_path}_value")), - adoption: MetricsTree_Scripts_Adoption::new( - client.clone(), - format!("{base_path}_adoption"), - ), + adoption: MetricsTree_Scripts_Adoption::new(client.clone(), format!("{base_path}_adoption")), } } } @@ -5243,14 +3472,8 @@ impl MetricsTree_Scripts_Count { p2wpkh: CumulativeHeightSumPattern::new(client.clone(), "p2wpkh_count".to_string()), p2wsh: CumulativeHeightSumPattern::new(client.clone(), "p2wsh_count".to_string()), opreturn: CumulativeHeightSumPattern::new(client.clone(), "opreturn_count".to_string()), - emptyoutput: CumulativeHeightSumPattern::new( - client.clone(), - "emptyoutput_count".to_string(), - ), - unknownoutput: CumulativeHeightSumPattern::new( - client.clone(), - "unknownoutput_count".to_string(), - ), + emptyoutput: CumulativeHeightSumPattern::new(client.clone(), "emptyoutput_count".to_string()), + unknownoutput: CumulativeHeightSumPattern::new(client.clone(), "unknownoutput_count".to_string()), segwit: CumulativeHeightSumPattern::new(client.clone(), "segwit_count".to_string()), } } @@ -5264,10 +3487,7 @@ pub struct MetricsTree_Scripts_Value { impl MetricsTree_Scripts_Value { pub fn new(client: Arc, base_path: String) -> Self { Self { - opreturn: _1m1w1y24hBaseCumulativePattern::new( - client.clone(), - "opreturn_value".to_string(), - ), + opreturn: _1m1w1y24hBaseCumulativePattern::new(client.clone(), "opreturn_value".to_string()), } } } @@ -5296,14 +3516,8 @@ pub struct MetricsTree_Mining { impl MetricsTree_Mining { pub fn new(client: Arc, base_path: String) -> Self { Self { - rewards: MetricsTree_Mining_Rewards::new( - client.clone(), - format!("{base_path}_rewards"), - ), - hashrate: MetricsTree_Mining_Hashrate::new( - client.clone(), - format!("{base_path}_hashrate"), - ), + rewards: MetricsTree_Mining_Rewards::new(client.clone(), format!("{base_path}_rewards")), + hashrate: MetricsTree_Mining_Hashrate::new(client.clone(), format!("{base_path}_hashrate")), } } } @@ -5327,23 +3541,11 @@ impl MetricsTree_Mining_Rewards { coinbase: _1m1w1y24hBaseCumulativePattern::new(client.clone(), "coinbase".to_string()), subsidy: _1m1w1y24hBaseCumulativePattern::new(client.clone(), "subsidy".to_string()), fees: _1m1w1y24hBaseCumulativePattern::new(client.clone(), "fees".to_string()), - unclaimed_rewards: BaseCumulativeSumPattern::new( - client.clone(), - "unclaimed_rewards".to_string(), - ), + unclaimed_rewards: BaseCumulativeSumPattern::new(client.clone(), "unclaimed_rewards".to_string()), fee_dominance: BpsPercentRatioPattern::new(client.clone(), "fee_dominance".to_string()), - fee_dominance_rolling: _1m1w1y24hPattern2::new( - client.clone(), - "fee_dominance".to_string(), - ), - subsidy_dominance: BpsPercentRatioPattern::new( - client.clone(), - "subsidy_dominance".to_string(), - ), - subsidy_dominance_rolling: _1m1w1y24hPattern2::new( - client.clone(), - "subsidy_dominance".to_string(), - ), + fee_dominance_rolling: _1m1w1y24hPattern2::new(client.clone(), "fee_dominance".to_string()), + subsidy_dominance: BpsPercentRatioPattern::new(client.clone(), "subsidy_dominance".to_string()), + subsidy_dominance_rolling: _1m1w1y24hPattern2::new(client.clone(), "subsidy_dominance".to_string()), subsidy_sma_1y: CentsUsdPattern::new(client.clone(), "subsidy_sma_1y".to_string()), } } @@ -5379,38 +3581,17 @@ impl MetricsTree_Mining_Hashrate { hash_rate_sma_2m: MetricPattern1::new(client.clone(), "hash_rate_sma_2m".to_string()), hash_rate_sma_1y: MetricPattern1::new(client.clone(), "hash_rate_sma_1y".to_string()), hash_rate_ath: MetricPattern1::new(client.clone(), "hash_rate_ath".to_string()), - hash_rate_drawdown: BpsPercentRatioPattern::new( - client.clone(), - "hash_rate_drawdown".to_string(), - ), + hash_rate_drawdown: BpsPercentRatioPattern::new(client.clone(), "hash_rate_drawdown".to_string()), hash_price_ths: MetricPattern1::new(client.clone(), "hash_price_ths".to_string()), - hash_price_ths_min: MetricPattern1::new( - client.clone(), - "hash_price_ths_min".to_string(), - ), + hash_price_ths_min: MetricPattern1::new(client.clone(), "hash_price_ths_min".to_string()), hash_price_phs: MetricPattern1::new(client.clone(), "hash_price_phs".to_string()), - hash_price_phs_min: MetricPattern1::new( - client.clone(), - "hash_price_phs_min".to_string(), - ), - hash_price_rebound: BpsPercentRatioPattern::new( - client.clone(), - "hash_price_rebound".to_string(), - ), + hash_price_phs_min: MetricPattern1::new(client.clone(), "hash_price_phs_min".to_string()), + hash_price_rebound: BpsPercentRatioPattern::new(client.clone(), "hash_price_rebound".to_string()), hash_value_ths: MetricPattern1::new(client.clone(), "hash_value_ths".to_string()), - hash_value_ths_min: MetricPattern1::new( - client.clone(), - "hash_value_ths_min".to_string(), - ), + hash_value_ths_min: MetricPattern1::new(client.clone(), "hash_value_ths_min".to_string()), hash_value_phs: MetricPattern1::new(client.clone(), "hash_value_phs".to_string()), - hash_value_phs_min: MetricPattern1::new( - client.clone(), - "hash_value_phs_min".to_string(), - ), - hash_value_rebound: BpsPercentRatioPattern::new( - client.clone(), - "hash_value_rebound".to_string(), - ), + hash_value_phs_min: MetricPattern1::new(client.clone(), "hash_value_phs_min".to_string()), + hash_value_rebound: BpsPercentRatioPattern::new(client.clone(), "hash_value_rebound".to_string()), } } } @@ -5444,25 +3625,13 @@ pub struct MetricsTree_Cointime { impl MetricsTree_Cointime { pub fn new(client: Arc, base_path: String) -> Self { Self { - activity: MetricsTree_Cointime_Activity::new( - client.clone(), - format!("{base_path}_activity"), - ), + activity: MetricsTree_Cointime_Activity::new(client.clone(), format!("{base_path}_activity")), supply: MetricsTree_Cointime_Supply::new(client.clone(), format!("{base_path}_supply")), value: MetricsTree_Cointime_Value::new(client.clone(), format!("{base_path}_value")), cap: MetricsTree_Cointime_Cap::new(client.clone(), format!("{base_path}_cap")), - pricing: MetricsTree_Cointime_Pricing::new( - client.clone(), - format!("{base_path}_pricing"), - ), - adjusted: MetricsTree_Cointime_Adjusted::new( - client.clone(), - format!("{base_path}_adjusted"), - ), - reserve_risk: MetricsTree_Cointime_ReserveRisk::new( - client.clone(), - format!("{base_path}_reserve_risk"), - ), + pricing: MetricsTree_Cointime_Pricing::new(client.clone(), format!("{base_path}_pricing")), + adjusted: MetricsTree_Cointime_Adjusted::new(client.clone(), format!("{base_path}_adjusted")), + reserve_risk: MetricsTree_Cointime_ReserveRisk::new(client.clone(), format!("{base_path}_reserve_risk")), } } } @@ -5479,20 +3648,11 @@ pub struct MetricsTree_Cointime_Activity { impl MetricsTree_Cointime_Activity { pub fn new(client: Arc, base_path: String) -> Self { Self { - coinblocks_created: CumulativeHeightSumPattern::new( - client.clone(), - "coinblocks_created".to_string(), - ), - coinblocks_stored: CumulativeHeightSumPattern::new( - client.clone(), - "coinblocks_stored".to_string(), - ), + coinblocks_created: CumulativeHeightSumPattern::new(client.clone(), "coinblocks_created".to_string()), + coinblocks_stored: CumulativeHeightSumPattern::new(client.clone(), "coinblocks_stored".to_string()), liveliness: MetricPattern1::new(client.clone(), "liveliness".to_string()), vaultedness: MetricPattern1::new(client.clone(), "vaultedness".to_string()), - activity_to_vaultedness_ratio: MetricPattern1::new( - client.clone(), - "activity_to_vaultedness_ratio".to_string(), - ), + activity_to_vaultedness_ratio: MetricPattern1::new(client.clone(), "activity_to_vaultedness_ratio".to_string()), } } } @@ -5506,10 +3666,7 @@ pub struct MetricsTree_Cointime_Supply { impl MetricsTree_Cointime_Supply { pub fn new(client: Arc, base_path: String) -> Self { Self { - vaulted_supply: BtcCentsSatsUsdPattern::new( - client.clone(), - "vaulted_supply".to_string(), - ), + vaulted_supply: BtcCentsSatsUsdPattern::new(client.clone(), "vaulted_supply".to_string()), active_supply: BtcCentsSatsUsdPattern::new(client.clone(), "active_supply".to_string()), } } @@ -5526,18 +3683,9 @@ pub struct MetricsTree_Cointime_Value { impl MetricsTree_Cointime_Value { pub fn new(client: Arc, base_path: String) -> Self { Self { - cointime_value_destroyed: CumulativeHeightSumPattern::new( - client.clone(), - "cointime_value_destroyed".to_string(), - ), - cointime_value_created: CumulativeHeightSumPattern::new( - client.clone(), - "cointime_value_created".to_string(), - ), - cointime_value_stored: CumulativeHeightSumPattern::new( - client.clone(), - "cointime_value_stored".to_string(), - ), + cointime_value_destroyed: CumulativeHeightSumPattern::new(client.clone(), "cointime_value_destroyed".to_string()), + cointime_value_created: CumulativeHeightSumPattern::new(client.clone(), "cointime_value_created".to_string()), + cointime_value_stored: CumulativeHeightSumPattern::new(client.clone(), "cointime_value_stored".to_string()), vocdd: CumulativeHeightSumPattern::new(client.clone(), "vocdd".to_string()), } } @@ -5580,28 +3728,13 @@ impl MetricsTree_Cointime_Pricing { pub fn new(client: Arc, base_path: String) -> Self { Self { vaulted_price: CentsSatsUsdPattern::new(client.clone(), "vaulted_price".to_string()), - vaulted_price_ratio: BpsRatioPattern2::new( - client.clone(), - "vaulted_price_ratio".to_string(), - ), + vaulted_price_ratio: BpsRatioPattern2::new(client.clone(), "vaulted_price_ratio".to_string()), active_price: CentsSatsUsdPattern::new(client.clone(), "active_price".to_string()), - active_price_ratio: BpsRatioPattern2::new( - client.clone(), - "active_price_ratio".to_string(), - ), - true_market_mean: CentsSatsUsdPattern::new( - client.clone(), - "true_market_mean".to_string(), - ), - true_market_mean_ratio: BpsRatioPattern2::new( - client.clone(), - "true_market_mean_ratio".to_string(), - ), + active_price_ratio: BpsRatioPattern2::new(client.clone(), "active_price_ratio".to_string()), + true_market_mean: CentsSatsUsdPattern::new(client.clone(), "true_market_mean".to_string()), + true_market_mean_ratio: BpsRatioPattern2::new(client.clone(), "true_market_mean_ratio".to_string()), cointime_price: CentsSatsUsdPattern::new(client.clone(), "cointime_price".to_string()), - cointime_price_ratio: BpsRatioPattern2::new( - client.clone(), - "cointime_price_ratio".to_string(), - ), + cointime_price_ratio: BpsRatioPattern2::new(client.clone(), "cointime_price_ratio".to_string()), } } } @@ -5616,18 +3749,9 @@ pub struct MetricsTree_Cointime_Adjusted { impl MetricsTree_Cointime_Adjusted { pub fn new(client: Arc, base_path: String) -> Self { Self { - cointime_adj_inflation_rate: BpsPercentRatioPattern::new( - client.clone(), - "cointime_adj_inflation_rate".to_string(), - ), - cointime_adj_tx_velocity_btc: MetricPattern1::new( - client.clone(), - "cointime_adj_tx_velocity_btc".to_string(), - ), - cointime_adj_tx_velocity_usd: MetricPattern1::new( - client.clone(), - "cointime_adj_tx_velocity_usd".to_string(), - ), + cointime_adj_inflation_rate: BpsPercentRatioPattern::new(client.clone(), "cointime_adj_inflation_rate".to_string()), + cointime_adj_tx_velocity_btc: MetricPattern1::new(client.clone(), "cointime_adj_tx_velocity_btc".to_string()), + cointime_adj_tx_velocity_usd: MetricPattern1::new(client.clone(), "cointime_adj_tx_velocity_usd".to_string()), } } } @@ -5723,27 +3847,12 @@ pub struct MetricsTree_Indexes { impl MetricsTree_Indexes { pub fn new(client: Arc, base_path: String) -> Self { Self { - address: MetricsTree_Indexes_Address::new( - client.clone(), - format!("{base_path}_address"), - ), + address: MetricsTree_Indexes_Address::new(client.clone(), format!("{base_path}_address")), height: MetricsTree_Indexes_Height::new(client.clone(), format!("{base_path}_height")), - difficultyepoch: MetricsTree_Indexes_Difficultyepoch::new( - client.clone(), - format!("{base_path}_difficultyepoch"), - ), - halvingepoch: MetricsTree_Indexes_Halvingepoch::new( - client.clone(), - format!("{base_path}_halvingepoch"), - ), - minute10: MetricsTree_Indexes_Minute10::new( - client.clone(), - format!("{base_path}_minute10"), - ), - minute30: MetricsTree_Indexes_Minute30::new( - client.clone(), - format!("{base_path}_minute30"), - ), + difficultyepoch: MetricsTree_Indexes_Difficultyepoch::new(client.clone(), format!("{base_path}_difficultyepoch")), + halvingepoch: MetricsTree_Indexes_Halvingepoch::new(client.clone(), format!("{base_path}_halvingepoch")), + minute10: MetricsTree_Indexes_Minute10::new(client.clone(), format!("{base_path}_minute10")), + minute30: MetricsTree_Indexes_Minute30::new(client.clone(), format!("{base_path}_minute30")), hour1: MetricsTree_Indexes_Hour1::new(client.clone(), format!("{base_path}_hour1")), hour4: MetricsTree_Indexes_Hour4::new(client.clone(), format!("{base_path}_hour4")), hour12: MetricsTree_Indexes_Hour12::new(client.clone(), format!("{base_path}_hour12")), @@ -5755,18 +3864,9 @@ impl MetricsTree_Indexes { month6: MetricsTree_Indexes_Month6::new(client.clone(), format!("{base_path}_month6")), year1: MetricsTree_Indexes_Year1::new(client.clone(), format!("{base_path}_year1")), year10: MetricsTree_Indexes_Year10::new(client.clone(), format!("{base_path}_year10")), - txindex: MetricsTree_Indexes_Txindex::new( - client.clone(), - format!("{base_path}_txindex"), - ), - txinindex: MetricsTree_Indexes_Txinindex::new( - client.clone(), - format!("{base_path}_txinindex"), - ), - txoutindex: MetricsTree_Indexes_Txoutindex::new( - client.clone(), - format!("{base_path}_txoutindex"), - ), + txindex: MetricsTree_Indexes_Txindex::new(client.clone(), format!("{base_path}_txindex")), + txinindex: MetricsTree_Indexes_Txinindex::new(client.clone(), format!("{base_path}_txinindex")), + txoutindex: MetricsTree_Indexes_Txoutindex::new(client.clone(), format!("{base_path}_txoutindex")), } } } @@ -5790,51 +3890,18 @@ pub struct MetricsTree_Indexes_Address { impl MetricsTree_Indexes_Address { pub fn new(client: Arc, base_path: String) -> Self { Self { - p2pk33: MetricsTree_Indexes_Address_P2pk33::new( - client.clone(), - format!("{base_path}_p2pk33"), - ), - p2pk65: MetricsTree_Indexes_Address_P2pk65::new( - client.clone(), - format!("{base_path}_p2pk65"), - ), - p2pkh: MetricsTree_Indexes_Address_P2pkh::new( - client.clone(), - format!("{base_path}_p2pkh"), - ), - p2sh: MetricsTree_Indexes_Address_P2sh::new( - client.clone(), - format!("{base_path}_p2sh"), - ), - p2tr: MetricsTree_Indexes_Address_P2tr::new( - client.clone(), - format!("{base_path}_p2tr"), - ), - p2wpkh: MetricsTree_Indexes_Address_P2wpkh::new( - client.clone(), - format!("{base_path}_p2wpkh"), - ), - p2wsh: MetricsTree_Indexes_Address_P2wsh::new( - client.clone(), - format!("{base_path}_p2wsh"), - ), + p2pk33: MetricsTree_Indexes_Address_P2pk33::new(client.clone(), format!("{base_path}_p2pk33")), + p2pk65: MetricsTree_Indexes_Address_P2pk65::new(client.clone(), format!("{base_path}_p2pk65")), + p2pkh: MetricsTree_Indexes_Address_P2pkh::new(client.clone(), format!("{base_path}_p2pkh")), + p2sh: MetricsTree_Indexes_Address_P2sh::new(client.clone(), format!("{base_path}_p2sh")), + p2tr: MetricsTree_Indexes_Address_P2tr::new(client.clone(), format!("{base_path}_p2tr")), + p2wpkh: MetricsTree_Indexes_Address_P2wpkh::new(client.clone(), format!("{base_path}_p2wpkh")), + p2wsh: MetricsTree_Indexes_Address_P2wsh::new(client.clone(), format!("{base_path}_p2wsh")), p2a: MetricsTree_Indexes_Address_P2a::new(client.clone(), format!("{base_path}_p2a")), - p2ms: MetricsTree_Indexes_Address_P2ms::new( - client.clone(), - format!("{base_path}_p2ms"), - ), - empty: MetricsTree_Indexes_Address_Empty::new( - client.clone(), - format!("{base_path}_empty"), - ), - unknown: MetricsTree_Indexes_Address_Unknown::new( - client.clone(), - format!("{base_path}_unknown"), - ), - opreturn: MetricsTree_Indexes_Address_Opreturn::new( - client.clone(), - format!("{base_path}_opreturn"), - ), + p2ms: MetricsTree_Indexes_Address_P2ms::new(client.clone(), format!("{base_path}_p2ms")), + empty: MetricsTree_Indexes_Address_Empty::new(client.clone(), format!("{base_path}_empty")), + unknown: MetricsTree_Indexes_Address_Unknown::new(client.clone(), format!("{base_path}_unknown")), + opreturn: MetricsTree_Indexes_Address_Opreturn::new(client.clone(), format!("{base_path}_opreturn")), } } } @@ -6342,28 +4409,13 @@ impl MetricsTree_Market { pub fn new(client: Arc, base_path: String) -> Self { Self { ath: MetricsTree_Market_Ath::new(client.clone(), format!("{base_path}_ath")), - lookback: MetricsTree_Market_Lookback::new( - client.clone(), - format!("{base_path}_lookback"), - ), - returns: MetricsTree_Market_Returns::new( - client.clone(), - format!("{base_path}_returns"), - ), - volatility: MetricsTree_Market_Volatility::new( - client.clone(), - format!("{base_path}_volatility"), - ), + lookback: MetricsTree_Market_Lookback::new(client.clone(), format!("{base_path}_lookback")), + returns: MetricsTree_Market_Returns::new(client.clone(), format!("{base_path}_returns")), + volatility: MetricsTree_Market_Volatility::new(client.clone(), format!("{base_path}_volatility")), range: MetricsTree_Market_Range::new(client.clone(), format!("{base_path}_range")), - moving_average: MetricsTree_Market_MovingAverage::new( - client.clone(), - format!("{base_path}_moving_average"), - ), + moving_average: MetricsTree_Market_MovingAverage::new(client.clone(), format!("{base_path}_moving_average")), dca: MetricsTree_Market_Dca::new(client.clone(), format!("{base_path}_dca")), - indicators: MetricsTree_Market_Indicators::new( - client.clone(), - format!("{base_path}_indicators"), - ), + indicators: MetricsTree_Market_Indicators::new(client.clone(), format!("{base_path}_indicators")), } } } @@ -6382,26 +4434,11 @@ impl MetricsTree_Market_Ath { pub fn new(client: Arc, base_path: String) -> Self { Self { price_ath: CentsSatsUsdPattern::new(client.clone(), "price_ath".to_string()), - price_drawdown: BpsPercentRatioPattern::new( - client.clone(), - "price_drawdown".to_string(), - ), - days_since_price_ath: MetricPattern1::new( - client.clone(), - "days_since_price_ath".to_string(), - ), - years_since_price_ath: MetricPattern2::new( - client.clone(), - "years_since_price_ath".to_string(), - ), - max_days_between_price_ath: MetricPattern1::new( - client.clone(), - "max_days_between_price_ath".to_string(), - ), - max_years_between_price_ath: MetricPattern2::new( - client.clone(), - "max_years_between_price_ath".to_string(), - ), + price_drawdown: BpsPercentRatioPattern::new(client.clone(), "price_drawdown".to_string()), + days_since_price_ath: MetricPattern1::new(client.clone(), "days_since_price_ath".to_string()), + years_since_price_ath: MetricPattern2::new(client.clone(), "years_since_price_ath".to_string()), + max_days_between_price_ath: MetricPattern1::new(client.clone(), "max_days_between_price_ath".to_string()), + max_years_between_price_ath: MetricPattern2::new(client.clone(), "max_years_between_price_ath".to_string()), } } } @@ -6459,39 +4496,15 @@ pub struct MetricsTree_Market_Returns { impl MetricsTree_Market_Returns { pub fn new(client: Arc, base_path: String) -> Self { Self { - price_return: MetricsTree_Market_Returns_PriceReturn::new( - client.clone(), - format!("{base_path}_price_return"), - ), + price_return: MetricsTree_Market_Returns_PriceReturn::new(client.clone(), format!("{base_path}_price_return")), price_cagr: _10y2y3y4y5y6y8yPattern::new(client.clone(), "price_cagr".to_string()), - price_return_24h_sd_1w: MetricsTree_Market_Returns_PriceReturn24hSd1w::new( - client.clone(), - format!("{base_path}_price_return_24h_sd_1w"), - ), - price_return_24h_sd_1m: MetricsTree_Market_Returns_PriceReturn24hSd1m::new( - client.clone(), - format!("{base_path}_price_return_24h_sd_1m"), - ), - price_return_24h_sd_1y: SdSmaPattern::new( - client.clone(), - "price_return_24h".to_string(), - ), - price_downside_24h: MetricPattern18::new( - client.clone(), - "price_downside_24h".to_string(), - ), - price_downside_24h_sd_1w: MetricsTree_Market_Returns_PriceDownside24hSd1w::new( - client.clone(), - format!("{base_path}_price_downside_24h_sd_1w"), - ), - price_downside_24h_sd_1m: MetricsTree_Market_Returns_PriceDownside24hSd1m::new( - client.clone(), - format!("{base_path}_price_downside_24h_sd_1m"), - ), - price_downside_24h_sd_1y: SdSmaPattern::new( - client.clone(), - "price_downside_24h".to_string(), - ), + price_return_24h_sd_1w: MetricsTree_Market_Returns_PriceReturn24hSd1w::new(client.clone(), format!("{base_path}_price_return_24h_sd_1w")), + price_return_24h_sd_1m: MetricsTree_Market_Returns_PriceReturn24hSd1m::new(client.clone(), format!("{base_path}_price_return_24h_sd_1m")), + price_return_24h_sd_1y: SdSmaPattern::new(client.clone(), "price_return_24h".to_string()), + price_downside_24h: MetricPattern18::new(client.clone(), "price_downside_24h".to_string()), + price_downside_24h_sd_1w: MetricsTree_Market_Returns_PriceDownside24hSd1w::new(client.clone(), format!("{base_path}_price_downside_24h_sd_1w")), + price_downside_24h_sd_1m: MetricsTree_Market_Returns_PriceDownside24hSd1m::new(client.clone(), format!("{base_path}_price_downside_24h_sd_1m")), + price_downside_24h_sd_1y: SdSmaPattern::new(client.clone(), "price_downside_24h".to_string()), } } } @@ -6609,18 +4622,9 @@ pub struct MetricsTree_Market_Volatility { impl MetricsTree_Market_Volatility { pub fn new(client: Arc, base_path: String) -> Self { Self { - price_volatility_1w: MetricPattern1::new( - client.clone(), - "price_volatility_1w".to_string(), - ), - price_volatility_1m: MetricPattern1::new( - client.clone(), - "price_volatility_1m".to_string(), - ), - price_volatility_1y: MetricPattern1::new( - client.clone(), - "price_volatility_1y".to_string(), - ), + price_volatility_1w: MetricPattern1::new(client.clone(), "price_volatility_1w".to_string()), + price_volatility_1m: MetricPattern1::new(client.clone(), "price_volatility_1m".to_string()), + price_volatility_1y: MetricPattern1::new(client.clone(), "price_volatility_1y".to_string()), price_sharpe_1w: MetricPattern1::new(client.clone(), "price_sharpe_1w".to_string()), price_sharpe_1m: MetricPattern1::new(client.clone(), "price_sharpe_1m".to_string()), price_sharpe_1y: MetricPattern1::new(client.clone(), "price_sharpe_1y".to_string()), @@ -6658,14 +4662,8 @@ impl MetricsTree_Market_Range { price_min_1y: CentsSatsUsdPattern::new(client.clone(), "price_min_1y".to_string()), price_max_1y: CentsSatsUsdPattern::new(client.clone(), "price_max_1y".to_string()), price_true_range: MetricPattern1::new(client.clone(), "price_true_range".to_string()), - price_true_range_sum_2w: MetricPattern1::new( - client.clone(), - "price_true_range_sum_2w".to_string(), - ), - price_choppiness_index_2w: BpsPercentRatioPattern::new( - client.clone(), - "price_choppiness_index_2w".to_string(), - ), + price_true_range_sum_2w: MetricPattern1::new(client.clone(), "price_true_range_sum_2w".to_string()), + price_choppiness_index_2w: BpsPercentRatioPattern::new(client.clone(), "price_choppiness_index_2w".to_string()), } } } @@ -6744,18 +4742,9 @@ impl MetricsTree_Market_MovingAverage { price_ema_2y: BpsPriceRatioPattern::new(client.clone(), "price_ema_2y".to_string()), price_ema_200w: BpsPriceRatioPattern::new(client.clone(), "price_ema_200w".to_string()), price_ema_4y: BpsPriceRatioPattern::new(client.clone(), "price_ema_4y".to_string()), - price_sma_200d_x2_4: CentsSatsUsdPattern::new( - client.clone(), - "price_sma_200d_x2_4".to_string(), - ), - price_sma_200d_x0_8: CentsSatsUsdPattern::new( - client.clone(), - "price_sma_200d_x0_8".to_string(), - ), - price_sma_350d_x2: CentsSatsUsdPattern::new( - client.clone(), - "price_sma_350d_x2".to_string(), - ), + price_sma_200d_x2_4: CentsSatsUsdPattern::new(client.clone(), "price_sma_200d_x2_4".to_string()), + price_sma_200d_x0_8: CentsSatsUsdPattern::new(client.clone(), "price_sma_200d_x0_8".to_string()), + price_sma_350d_x2: CentsSatsUsdPattern::new(client.clone(), "price_sma_350d_x2".to_string()), } } } @@ -6778,39 +4767,15 @@ impl MetricsTree_Market_Dca { pub fn new(client: Arc, base_path: String) -> Self { Self { dca_sats_per_day: MetricPattern18::new(client.clone(), "dca_sats_per_day".to_string()), - period_stack: _10y1m1w1y2y3m3y4y5y6m6y8yPattern3::new( - client.clone(), - "dca_stack".to_string(), - ), - period_cost_basis: MetricsTree_Market_Dca_PeriodCostBasis::new( - client.clone(), - format!("{base_path}_period_cost_basis"), - ), - period_return: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2::new( - client.clone(), - "dca_return".to_string(), - ), + period_stack: _10y1m1w1y2y3m3y4y5y6m6y8yPattern3::new(client.clone(), "dca_stack".to_string()), + period_cost_basis: MetricsTree_Market_Dca_PeriodCostBasis::new(client.clone(), format!("{base_path}_period_cost_basis")), + period_return: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2::new(client.clone(), "dca_return".to_string()), period_cagr: _10y2y3y4y5y6y8yPattern::new(client.clone(), "dca_cagr".to_string()), - period_lump_sum_stack: _10y1m1w1y2y3m3y4y5y6m6y8yPattern3::new( - client.clone(), - "lump_sum_stack".to_string(), - ), - period_lump_sum_return: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2::new( - client.clone(), - "lump_sum_return".to_string(), - ), - class_stack: MetricsTree_Market_Dca_ClassStack::new( - client.clone(), - format!("{base_path}_class_stack"), - ), - class_cost_basis: MetricsTree_Market_Dca_ClassCostBasis::new( - client.clone(), - format!("{base_path}_class_cost_basis"), - ), - class_return: MetricsTree_Market_Dca_ClassReturn::new( - client.clone(), - format!("{base_path}_class_return"), - ), + period_lump_sum_stack: _10y1m1w1y2y3m3y4y5y6m6y8yPattern3::new(client.clone(), "lump_sum_stack".to_string()), + period_lump_sum_return: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2::new(client.clone(), "lump_sum_return".to_string()), + class_stack: MetricsTree_Market_Dca_ClassStack::new(client.clone(), format!("{base_path}_class_stack")), + class_cost_basis: MetricsTree_Market_Dca_ClassCostBasis::new(client.clone(), format!("{base_path}_class_cost_basis")), + class_return: MetricsTree_Market_Dca_ClassReturn::new(client.clone(), format!("{base_path}_class_return")), } } } @@ -6869,54 +4834,18 @@ pub struct MetricsTree_Market_Dca_ClassStack { impl MetricsTree_Market_Dca_ClassStack { pub fn new(client: Arc, base_path: String) -> Self { Self { - from_2015: BtcCentsSatsUsdPattern::new( - client.clone(), - "dca_stack_from_2015".to_string(), - ), - from_2016: BtcCentsSatsUsdPattern::new( - client.clone(), - "dca_stack_from_2016".to_string(), - ), - from_2017: BtcCentsSatsUsdPattern::new( - client.clone(), - "dca_stack_from_2017".to_string(), - ), - from_2018: BtcCentsSatsUsdPattern::new( - client.clone(), - "dca_stack_from_2018".to_string(), - ), - from_2019: BtcCentsSatsUsdPattern::new( - client.clone(), - "dca_stack_from_2019".to_string(), - ), - from_2020: BtcCentsSatsUsdPattern::new( - client.clone(), - "dca_stack_from_2020".to_string(), - ), - from_2021: BtcCentsSatsUsdPattern::new( - client.clone(), - "dca_stack_from_2021".to_string(), - ), - from_2022: BtcCentsSatsUsdPattern::new( - client.clone(), - "dca_stack_from_2022".to_string(), - ), - from_2023: BtcCentsSatsUsdPattern::new( - client.clone(), - "dca_stack_from_2023".to_string(), - ), - from_2024: BtcCentsSatsUsdPattern::new( - client.clone(), - "dca_stack_from_2024".to_string(), - ), - from_2025: BtcCentsSatsUsdPattern::new( - client.clone(), - "dca_stack_from_2025".to_string(), - ), - from_2026: BtcCentsSatsUsdPattern::new( - client.clone(), - "dca_stack_from_2026".to_string(), - ), + from_2015: BtcCentsSatsUsdPattern::new(client.clone(), "dca_stack_from_2015".to_string()), + from_2016: BtcCentsSatsUsdPattern::new(client.clone(), "dca_stack_from_2016".to_string()), + from_2017: BtcCentsSatsUsdPattern::new(client.clone(), "dca_stack_from_2017".to_string()), + from_2018: BtcCentsSatsUsdPattern::new(client.clone(), "dca_stack_from_2018".to_string()), + from_2019: BtcCentsSatsUsdPattern::new(client.clone(), "dca_stack_from_2019".to_string()), + from_2020: BtcCentsSatsUsdPattern::new(client.clone(), "dca_stack_from_2020".to_string()), + from_2021: BtcCentsSatsUsdPattern::new(client.clone(), "dca_stack_from_2021".to_string()), + from_2022: BtcCentsSatsUsdPattern::new(client.clone(), "dca_stack_from_2022".to_string()), + from_2023: BtcCentsSatsUsdPattern::new(client.clone(), "dca_stack_from_2023".to_string()), + from_2024: BtcCentsSatsUsdPattern::new(client.clone(), "dca_stack_from_2024".to_string()), + from_2025: BtcCentsSatsUsdPattern::new(client.clone(), "dca_stack_from_2025".to_string()), + from_2026: BtcCentsSatsUsdPattern::new(client.clone(), "dca_stack_from_2026".to_string()), } } } @@ -6940,54 +4869,18 @@ pub struct MetricsTree_Market_Dca_ClassCostBasis { impl MetricsTree_Market_Dca_ClassCostBasis { pub fn new(client: Arc, base_path: String) -> Self { Self { - from_2015: CentsSatsUsdPattern::new( - client.clone(), - "dca_cost_basis_from_2015".to_string(), - ), - from_2016: CentsSatsUsdPattern::new( - client.clone(), - "dca_cost_basis_from_2016".to_string(), - ), - from_2017: CentsSatsUsdPattern::new( - client.clone(), - "dca_cost_basis_from_2017".to_string(), - ), - from_2018: CentsSatsUsdPattern::new( - client.clone(), - "dca_cost_basis_from_2018".to_string(), - ), - from_2019: CentsSatsUsdPattern::new( - client.clone(), - "dca_cost_basis_from_2019".to_string(), - ), - from_2020: CentsSatsUsdPattern::new( - client.clone(), - "dca_cost_basis_from_2020".to_string(), - ), - from_2021: CentsSatsUsdPattern::new( - client.clone(), - "dca_cost_basis_from_2021".to_string(), - ), - from_2022: CentsSatsUsdPattern::new( - client.clone(), - "dca_cost_basis_from_2022".to_string(), - ), - from_2023: CentsSatsUsdPattern::new( - client.clone(), - "dca_cost_basis_from_2023".to_string(), - ), - from_2024: CentsSatsUsdPattern::new( - client.clone(), - "dca_cost_basis_from_2024".to_string(), - ), - from_2025: CentsSatsUsdPattern::new( - client.clone(), - "dca_cost_basis_from_2025".to_string(), - ), - from_2026: CentsSatsUsdPattern::new( - client.clone(), - "dca_cost_basis_from_2026".to_string(), - ), + from_2015: CentsSatsUsdPattern::new(client.clone(), "dca_cost_basis_from_2015".to_string()), + from_2016: CentsSatsUsdPattern::new(client.clone(), "dca_cost_basis_from_2016".to_string()), + from_2017: CentsSatsUsdPattern::new(client.clone(), "dca_cost_basis_from_2017".to_string()), + from_2018: CentsSatsUsdPattern::new(client.clone(), "dca_cost_basis_from_2018".to_string()), + from_2019: CentsSatsUsdPattern::new(client.clone(), "dca_cost_basis_from_2019".to_string()), + from_2020: CentsSatsUsdPattern::new(client.clone(), "dca_cost_basis_from_2020".to_string()), + from_2021: CentsSatsUsdPattern::new(client.clone(), "dca_cost_basis_from_2021".to_string()), + from_2022: CentsSatsUsdPattern::new(client.clone(), "dca_cost_basis_from_2022".to_string()), + from_2023: CentsSatsUsdPattern::new(client.clone(), "dca_cost_basis_from_2023".to_string()), + from_2024: CentsSatsUsdPattern::new(client.clone(), "dca_cost_basis_from_2024".to_string()), + from_2025: CentsSatsUsdPattern::new(client.clone(), "dca_cost_basis_from_2025".to_string()), + from_2026: CentsSatsUsdPattern::new(client.clone(), "dca_cost_basis_from_2026".to_string()), } } } @@ -7011,54 +4904,18 @@ pub struct MetricsTree_Market_Dca_ClassReturn { impl MetricsTree_Market_Dca_ClassReturn { pub fn new(client: Arc, base_path: String) -> Self { Self { - from_2015: BpsPercentRatioPattern::new( - client.clone(), - "dca_return_from_2015".to_string(), - ), - from_2016: BpsPercentRatioPattern::new( - client.clone(), - "dca_return_from_2016".to_string(), - ), - from_2017: BpsPercentRatioPattern::new( - client.clone(), - "dca_return_from_2017".to_string(), - ), - from_2018: BpsPercentRatioPattern::new( - client.clone(), - "dca_return_from_2018".to_string(), - ), - from_2019: BpsPercentRatioPattern::new( - client.clone(), - "dca_return_from_2019".to_string(), - ), - from_2020: BpsPercentRatioPattern::new( - client.clone(), - "dca_return_from_2020".to_string(), - ), - from_2021: BpsPercentRatioPattern::new( - client.clone(), - "dca_return_from_2021".to_string(), - ), - from_2022: BpsPercentRatioPattern::new( - client.clone(), - "dca_return_from_2022".to_string(), - ), - from_2023: BpsPercentRatioPattern::new( - client.clone(), - "dca_return_from_2023".to_string(), - ), - from_2024: BpsPercentRatioPattern::new( - client.clone(), - "dca_return_from_2024".to_string(), - ), - from_2025: BpsPercentRatioPattern::new( - client.clone(), - "dca_return_from_2025".to_string(), - ), - from_2026: BpsPercentRatioPattern::new( - client.clone(), - "dca_return_from_2026".to_string(), - ), + from_2015: BpsPercentRatioPattern::new(client.clone(), "dca_return_from_2015".to_string()), + from_2016: BpsPercentRatioPattern::new(client.clone(), "dca_return_from_2016".to_string()), + from_2017: BpsPercentRatioPattern::new(client.clone(), "dca_return_from_2017".to_string()), + from_2018: BpsPercentRatioPattern::new(client.clone(), "dca_return_from_2018".to_string()), + from_2019: BpsPercentRatioPattern::new(client.clone(), "dca_return_from_2019".to_string()), + from_2020: BpsPercentRatioPattern::new(client.clone(), "dca_return_from_2020".to_string()), + from_2021: BpsPercentRatioPattern::new(client.clone(), "dca_return_from_2021".to_string()), + from_2022: BpsPercentRatioPattern::new(client.clone(), "dca_return_from_2022".to_string()), + from_2023: BpsPercentRatioPattern::new(client.clone(), "dca_return_from_2023".to_string()), + from_2024: BpsPercentRatioPattern::new(client.clone(), "dca_return_from_2024".to_string()), + from_2025: BpsPercentRatioPattern::new(client.clone(), "dca_return_from_2025".to_string()), + from_2026: BpsPercentRatioPattern::new(client.clone(), "dca_return_from_2026".to_string()), } } } @@ -7084,10 +4941,7 @@ impl MetricsTree_Market_Indicators { stoch_k: BpsPercentRatioPattern::new(client.clone(), "stoch_k".to_string()), stoch_d: BpsPercentRatioPattern::new(client.clone(), "stoch_d".to_string()), pi_cycle: BpsRatioPattern::new(client.clone(), "pi_cycle".to_string()), - macd: MetricsTree_Market_Indicators_Macd::new( - client.clone(), - format!("{base_path}_macd"), - ), + macd: MetricsTree_Market_Indicators_Macd::new(client.clone(), format!("{base_path}_macd")), gini: BpsPercentRatioPattern::new(client.clone(), "gini".to_string()), } } @@ -7105,18 +4959,9 @@ impl MetricsTree_Market_Indicators_Rsi { pub fn new(client: Arc, base_path: String) -> Self { Self { _24h: AverageGainsLossesRsiStochPattern::new(client.clone(), "rsi".to_string()), - _1w: MetricsTree_Market_Indicators_Rsi_1w::new( - client.clone(), - format!("{base_path}_1w"), - ), - _1m: MetricsTree_Market_Indicators_Rsi_1m::new( - client.clone(), - format!("{base_path}_1m"), - ), - _1y: MetricsTree_Market_Indicators_Rsi_1y::new( - client.clone(), - format!("{base_path}_1y"), - ), + _1w: MetricsTree_Market_Indicators_Rsi_1w::new(client.clone(), format!("{base_path}_1w")), + _1m: MetricsTree_Market_Indicators_Rsi_1m::new(client.clone(), format!("{base_path}_1m")), + _1y: MetricsTree_Market_Indicators_Rsi_1y::new(client.clone(), format!("{base_path}_1y")), } } } @@ -7226,18 +5071,9 @@ impl MetricsTree_Market_Indicators_Macd { pub fn new(client: Arc, base_path: String) -> Self { Self { _24h: EmaHistogramLineSignalPattern::new(client.clone(), "macd".to_string()), - _1w: MetricsTree_Market_Indicators_Macd_1w::new( - client.clone(), - format!("{base_path}_1w"), - ), - _1m: MetricsTree_Market_Indicators_Macd_1m::new( - client.clone(), - format!("{base_path}_1m"), - ), - _1y: MetricsTree_Market_Indicators_Macd_1y::new( - client.clone(), - format!("{base_path}_1y"), - ), + _1w: MetricsTree_Market_Indicators_Macd_1w::new(client.clone(), format!("{base_path}_1w")), + _1m: MetricsTree_Market_Indicators_Macd_1m::new(client.clone(), format!("{base_path}_1m")), + _1y: MetricsTree_Market_Indicators_Macd_1y::new(client.clone(), format!("{base_path}_1y")), } } } @@ -7489,639 +5325,168 @@ pub struct MetricsTree_Pools_Vecs { impl MetricsTree_Pools_Vecs { pub fn new(client: Arc, base_path: String) -> Self { Self { - unknown: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "unknown".to_string(), - ), - blockfills: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "blockfills".to_string(), - ), - ultimuspool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "ultimuspool".to_string(), - ), - terrapool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "terrapool".to_string(), - ), - luxor: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "luxor".to_string(), - ), - onethash: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "onethash".to_string(), - ), - btccom: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "btccom".to_string(), - ), - bitfarms: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "bitfarms".to_string(), - ), - huobipool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "huobipool".to_string(), - ), - wayicn: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "wayicn".to_string(), - ), - canoepool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "canoepool".to_string(), - ), - btctop: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "btctop".to_string(), - ), - bitcoincom: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "bitcoincom".to_string(), - ), - pool175btc: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "pool175btc".to_string(), - ), - gbminers: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "gbminers".to_string(), - ), + unknown: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "unknown".to_string()), + blockfills: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "blockfills".to_string()), + ultimuspool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "ultimuspool".to_string()), + terrapool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "terrapool".to_string()), + luxor: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "luxor".to_string()), + onethash: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "onethash".to_string()), + btccom: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "btccom".to_string()), + bitfarms: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "bitfarms".to_string()), + huobipool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "huobipool".to_string()), + wayicn: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "wayicn".to_string()), + canoepool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "canoepool".to_string()), + btctop: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "btctop".to_string()), + bitcoincom: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "bitcoincom".to_string()), + pool175btc: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "pool175btc".to_string()), + gbminers: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "gbminers".to_string()), axbt: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "axbt".to_string()), - asicminer: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "asicminer".to_string(), - ), - bitminter: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "bitminter".to_string(), - ), - bitcoinrussia: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "bitcoinrussia".to_string(), - ), - btcserv: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "btcserv".to_string(), - ), - simplecoinus: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "simplecoinus".to_string(), - ), - btcguild: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "btcguild".to_string(), - ), - eligius: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "eligius".to_string(), - ), - ozcoin: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "ozcoin".to_string(), - ), - eclipsemc: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "eclipsemc".to_string(), - ), - maxbtc: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "maxbtc".to_string(), - ), - triplemining: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "triplemining".to_string(), - ), - coinlab: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "coinlab".to_string(), - ), - pool50btc: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "pool50btc".to_string(), - ), - ghashio: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "ghashio".to_string(), - ), - stminingcorp: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "stminingcorp".to_string(), - ), - bitparking: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "bitparking".to_string(), - ), - mmpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "mmpool".to_string(), - ), - polmine: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "polmine".to_string(), - ), - kncminer: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "kncminer".to_string(), - ), - bitalo: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "bitalo".to_string(), - ), - f2pool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "f2pool".to_string(), - ), + asicminer: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "asicminer".to_string()), + bitminter: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "bitminter".to_string()), + bitcoinrussia: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "bitcoinrussia".to_string()), + btcserv: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "btcserv".to_string()), + simplecoinus: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "simplecoinus".to_string()), + btcguild: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "btcguild".to_string()), + eligius: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "eligius".to_string()), + ozcoin: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "ozcoin".to_string()), + eclipsemc: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "eclipsemc".to_string()), + maxbtc: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "maxbtc".to_string()), + triplemining: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "triplemining".to_string()), + coinlab: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "coinlab".to_string()), + pool50btc: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "pool50btc".to_string()), + ghashio: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "ghashio".to_string()), + stminingcorp: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "stminingcorp".to_string()), + bitparking: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "bitparking".to_string()), + mmpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "mmpool".to_string()), + polmine: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "polmine".to_string()), + kncminer: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "kncminer".to_string()), + bitalo: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "bitalo".to_string()), + f2pool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "f2pool".to_string()), hhtt: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "hhtt".to_string()), - megabigpower: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "megabigpower".to_string(), - ), - mtred: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "mtred".to_string(), - ), - nmcbit: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "nmcbit".to_string(), - ), - yourbtcnet: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "yourbtcnet".to_string(), - ), - givemecoins: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "givemecoins".to_string(), - ), - braiinspool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "braiinspool".to_string(), - ), - antpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "antpool".to_string(), - ), - multicoinco: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "multicoinco".to_string(), - ), - bcpoolio: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "bcpoolio".to_string(), - ), - cointerra: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "cointerra".to_string(), - ), - kanopool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "kanopool".to_string(), - ), - solock: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "solock".to_string(), - ), - ckpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "ckpool".to_string(), - ), - nicehash: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "nicehash".to_string(), - ), - bitclub: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "bitclub".to_string(), - ), - bitcoinaffiliatenetwork: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "bitcoinaffiliatenetwork".to_string(), - ), + megabigpower: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "megabigpower".to_string()), + mtred: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "mtred".to_string()), + nmcbit: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "nmcbit".to_string()), + yourbtcnet: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "yourbtcnet".to_string()), + givemecoins: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "givemecoins".to_string()), + braiinspool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "braiinspool".to_string()), + antpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "antpool".to_string()), + multicoinco: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "multicoinco".to_string()), + bcpoolio: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "bcpoolio".to_string()), + cointerra: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "cointerra".to_string()), + kanopool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "kanopool".to_string()), + solock: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "solock".to_string()), + ckpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "ckpool".to_string()), + nicehash: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "nicehash".to_string()), + bitclub: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "bitclub".to_string()), + bitcoinaffiliatenetwork: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "bitcoinaffiliatenetwork".to_string()), btcc: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "btcc".to_string()), - bwpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "bwpool".to_string(), - ), - exxbw: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "exxbw".to_string(), - ), - bitsolo: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "bitsolo".to_string(), - ), - bitfury: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "bitfury".to_string(), - ), - twentyoneinc: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "twentyoneinc".to_string(), - ), - digitalbtc: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "digitalbtc".to_string(), - ), - eightbaochi: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "eightbaochi".to_string(), - ), - mybtccoinpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "mybtccoinpool".to_string(), - ), - tbdice: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "tbdice".to_string(), - ), - hashpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "hashpool".to_string(), - ), - nexious: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "nexious".to_string(), - ), - bravomining: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "bravomining".to_string(), - ), - hotpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "hotpool".to_string(), - ), - okexpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "okexpool".to_string(), - ), - bcmonster: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "bcmonster".to_string(), - ), - onehash: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "onehash".to_string(), - ), - bixin: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "bixin".to_string(), - ), - tatmaspool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "tatmaspool".to_string(), - ), - viabtc: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "viabtc".to_string(), - ), - connectbtc: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "connectbtc".to_string(), - ), - batpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "batpool".to_string(), - ), - waterhole: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "waterhole".to_string(), - ), - dcexploration: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "dcexploration".to_string(), - ), + bwpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "bwpool".to_string()), + exxbw: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "exxbw".to_string()), + bitsolo: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "bitsolo".to_string()), + bitfury: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "bitfury".to_string()), + twentyoneinc: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "twentyoneinc".to_string()), + digitalbtc: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "digitalbtc".to_string()), + eightbaochi: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "eightbaochi".to_string()), + mybtccoinpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "mybtccoinpool".to_string()), + tbdice: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "tbdice".to_string()), + hashpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "hashpool".to_string()), + nexious: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "nexious".to_string()), + bravomining: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "bravomining".to_string()), + hotpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "hotpool".to_string()), + okexpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "okexpool".to_string()), + bcmonster: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "bcmonster".to_string()), + onehash: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "onehash".to_string()), + bixin: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "bixin".to_string()), + tatmaspool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "tatmaspool".to_string()), + viabtc: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "viabtc".to_string()), + connectbtc: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "connectbtc".to_string()), + batpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "batpool".to_string()), + waterhole: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "waterhole".to_string()), + dcexploration: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "dcexploration".to_string()), dcex: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "dcex".to_string()), - btpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "btpool".to_string(), - ), - fiftyeightcoin: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "fiftyeightcoin".to_string(), - ), - bitcoinindia: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "bitcoinindia".to_string(), - ), - shawnp0wers: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "shawnp0wers".to_string(), - ), - phashio: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "phashio".to_string(), - ), - rigpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "rigpool".to_string(), - ), - haozhuzhu: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "haozhuzhu".to_string(), - ), - sevenpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "sevenpool".to_string(), - ), - miningkings: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "miningkings".to_string(), - ), - hashbx: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "hashbx".to_string(), - ), - dpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "dpool".to_string(), - ), - rawpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "rawpool".to_string(), - ), - haominer: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "haominer".to_string(), - ), - helix: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "helix".to_string(), - ), - bitcoinukraine: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "bitcoinukraine".to_string(), - ), - poolin: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "poolin".to_string(), - ), - secretsuperstar: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "secretsuperstar".to_string(), - ), - tigerpoolnet: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "tigerpoolnet".to_string(), - ), - sigmapoolcom: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "sigmapoolcom".to_string(), - ), - okpooltop: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "okpooltop".to_string(), - ), - hummerpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "hummerpool".to_string(), - ), - tangpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "tangpool".to_string(), - ), - bytepool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "bytepool".to_string(), - ), - spiderpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "spiderpool".to_string(), - ), - novablock: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "novablock".to_string(), - ), - miningcity: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "miningcity".to_string(), - ), - binancepool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "binancepool".to_string(), - ), - minerium: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "minerium".to_string(), - ), - lubiancom: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "lubiancom".to_string(), - ), - okkong: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "okkong".to_string(), - ), - aaopool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "aaopool".to_string(), - ), - emcdpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "emcdpool".to_string(), - ), - foundryusa: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "foundryusa".to_string(), - ), - sbicrypto: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "sbicrypto".to_string(), - ), - arkpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "arkpool".to_string(), - ), - purebtccom: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "purebtccom".to_string(), - ), - marapool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "marapool".to_string(), - ), - kucoinpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "kucoinpool".to_string(), - ), - entrustcharitypool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "entrustcharitypool".to_string(), - ), - okminer: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "okminer".to_string(), - ), - titan: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "titan".to_string(), - ), - pegapool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "pegapool".to_string(), - ), - btcnuggets: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "btcnuggets".to_string(), - ), - cloudhashing: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "cloudhashing".to_string(), - ), - digitalxmintsy: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "digitalxmintsy".to_string(), - ), - telco214: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "telco214".to_string(), - ), - btcpoolparty: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "btcpoolparty".to_string(), - ), - multipool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "multipool".to_string(), - ), - transactioncoinmining: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "transactioncoinmining".to_string(), - ), - btcdig: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "btcdig".to_string(), - ), - trickysbtcpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "trickysbtcpool".to_string(), - ), - btcmp: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "btcmp".to_string(), - ), - eobot: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "eobot".to_string(), - ), - unomp: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "unomp".to_string(), - ), - patels: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "patels".to_string(), - ), - gogreenlight: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "gogreenlight".to_string(), - ), - bitcoinindiapool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "bitcoinindiapool".to_string(), - ), - ekanembtc: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "ekanembtc".to_string(), - ), - canoe: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "canoe".to_string(), - ), - tiger: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "tiger".to_string(), - ), - onem1x: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "onem1x".to_string(), - ), - zulupool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "zulupool".to_string(), - ), - secpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "secpool".to_string(), - ), - ocean: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "ocean".to_string(), - ), - whitepool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "whitepool".to_string(), - ), + btpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "btpool".to_string()), + fiftyeightcoin: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "fiftyeightcoin".to_string()), + bitcoinindia: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "bitcoinindia".to_string()), + shawnp0wers: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "shawnp0wers".to_string()), + phashio: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "phashio".to_string()), + rigpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "rigpool".to_string()), + haozhuzhu: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "haozhuzhu".to_string()), + sevenpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "sevenpool".to_string()), + miningkings: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "miningkings".to_string()), + hashbx: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "hashbx".to_string()), + dpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "dpool".to_string()), + rawpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "rawpool".to_string()), + haominer: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "haominer".to_string()), + helix: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "helix".to_string()), + bitcoinukraine: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "bitcoinukraine".to_string()), + poolin: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "poolin".to_string()), + secretsuperstar: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "secretsuperstar".to_string()), + tigerpoolnet: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "tigerpoolnet".to_string()), + sigmapoolcom: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "sigmapoolcom".to_string()), + okpooltop: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "okpooltop".to_string()), + hummerpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "hummerpool".to_string()), + tangpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "tangpool".to_string()), + bytepool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "bytepool".to_string()), + spiderpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "spiderpool".to_string()), + novablock: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "novablock".to_string()), + miningcity: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "miningcity".to_string()), + binancepool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "binancepool".to_string()), + minerium: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "minerium".to_string()), + lubiancom: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "lubiancom".to_string()), + okkong: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "okkong".to_string()), + aaopool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "aaopool".to_string()), + emcdpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "emcdpool".to_string()), + foundryusa: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "foundryusa".to_string()), + sbicrypto: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "sbicrypto".to_string()), + arkpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "arkpool".to_string()), + purebtccom: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "purebtccom".to_string()), + marapool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "marapool".to_string()), + kucoinpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "kucoinpool".to_string()), + entrustcharitypool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "entrustcharitypool".to_string()), + okminer: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "okminer".to_string()), + titan: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "titan".to_string()), + pegapool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "pegapool".to_string()), + btcnuggets: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "btcnuggets".to_string()), + cloudhashing: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "cloudhashing".to_string()), + digitalxmintsy: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "digitalxmintsy".to_string()), + telco214: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "telco214".to_string()), + btcpoolparty: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "btcpoolparty".to_string()), + multipool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "multipool".to_string()), + transactioncoinmining: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "transactioncoinmining".to_string()), + btcdig: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "btcdig".to_string()), + trickysbtcpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "trickysbtcpool".to_string()), + btcmp: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "btcmp".to_string()), + eobot: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "eobot".to_string()), + unomp: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "unomp".to_string()), + patels: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "patels".to_string()), + gogreenlight: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "gogreenlight".to_string()), + bitcoinindiapool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "bitcoinindiapool".to_string()), + ekanembtc: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "ekanembtc".to_string()), + canoe: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "canoe".to_string()), + tiger: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "tiger".to_string()), + onem1x: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "onem1x".to_string()), + zulupool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "zulupool".to_string()), + secpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "secpool".to_string()), + ocean: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "ocean".to_string()), + whitepool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "whitepool".to_string()), wiz: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "wiz".to_string()), - wk057: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "wk057".to_string(), - ), - futurebitapollosolo: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "futurebitapollosolo".to_string(), - ), - carbonnegative: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "carbonnegative".to_string(), - ), - portlandhodl: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "portlandhodl".to_string(), - ), - phoenix: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "phoenix".to_string(), - ), - neopool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "neopool".to_string(), - ), - maxipool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "maxipool".to_string(), - ), - bitfufupool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "bitfufupool".to_string(), - ), - gdpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "gdpool".to_string(), - ), - miningdutch: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "miningdutch".to_string(), - ), - publicpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "publicpool".to_string(), - ), - miningsquared: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "miningsquared".to_string(), - ), - innopolistech: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "innopolistech".to_string(), - ), - btclab: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "btclab".to_string(), - ), - parasite: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "parasite".to_string(), - ), - redrockpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "redrockpool".to_string(), - ), - est3lar: BlocksCoinbaseDominanceFeeSubsidyPattern::new( - client.clone(), - "est3lar".to_string(), - ), + wk057: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "wk057".to_string()), + futurebitapollosolo: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "futurebitapollosolo".to_string()), + carbonnegative: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "carbonnegative".to_string()), + portlandhodl: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "portlandhodl".to_string()), + phoenix: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "phoenix".to_string()), + neopool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "neopool".to_string()), + maxipool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "maxipool".to_string()), + bitfufupool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "bitfufupool".to_string()), + gdpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "gdpool".to_string()), + miningdutch: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "miningdutch".to_string()), + publicpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "publicpool".to_string()), + miningsquared: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "miningsquared".to_string()), + innopolistech: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "innopolistech".to_string()), + btclab: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "btclab".to_string()), + parasite: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "parasite".to_string()), + redrockpool: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "redrockpool".to_string()), + est3lar: BlocksCoinbaseDominanceFeeSubsidyPattern::new(client.clone(), "est3lar".to_string()), } } } @@ -8157,10 +5522,7 @@ impl MetricsTree_Prices_Split { open: CentsSatsUsdPattern2::new(client.clone(), "price_open".to_string()), high: CentsSatsUsdPattern2::new(client.clone(), "price_high".to_string()), low: CentsSatsUsdPattern2::new(client.clone(), "price_low".to_string()), - close: MetricsTree_Prices_Split_Close::new( - client.clone(), - format!("{base_path}_close"), - ), + close: MetricsTree_Prices_Split_Close::new(client.clone(), format!("{base_path}_close")), } } } @@ -8237,54 +5599,18 @@ impl MetricsTree_Distribution { pub fn new(client: Arc, base_path: String) -> Self { Self { supply_state: MetricPattern18::new(client.clone(), "supply_state".to_string()), - any_address_indexes: MetricsTree_Distribution_AnyAddressIndexes::new( - client.clone(), - format!("{base_path}_any_address_indexes"), - ), - addresses_data: MetricsTree_Distribution_AddressesData::new( - client.clone(), - format!("{base_path}_addresses_data"), - ), - utxo_cohorts: MetricsTree_Distribution_UtxoCohorts::new( - client.clone(), - format!("{base_path}_utxo_cohorts"), - ), - address_cohorts: MetricsTree_Distribution_AddressCohorts::new( - client.clone(), - format!("{base_path}_address_cohorts"), - ), - addr_count: AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern::new( - client.clone(), - "addr_count".to_string(), - ), - empty_addr_count: AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern::new( - client.clone(), - "empty_addr_count".to_string(), - ), - address_activity: MetricsTree_Distribution_AddressActivity::new( - client.clone(), - format!("{base_path}_address_activity"), - ), - total_addr_count: MetricsTree_Distribution_TotalAddrCount::new( - client.clone(), - format!("{base_path}_total_addr_count"), - ), - new_addr_count: MetricsTree_Distribution_NewAddrCount::new( - client.clone(), - format!("{base_path}_new_addr_count"), - ), - growth_rate: MetricsTree_Distribution_GrowthRate::new( - client.clone(), - format!("{base_path}_growth_rate"), - ), - fundedaddressindex: MetricPattern34::new( - client.clone(), - "fundedaddressindex".to_string(), - ), - emptyaddressindex: MetricPattern35::new( - client.clone(), - "emptyaddressindex".to_string(), - ), + any_address_indexes: MetricsTree_Distribution_AnyAddressIndexes::new(client.clone(), format!("{base_path}_any_address_indexes")), + addresses_data: MetricsTree_Distribution_AddressesData::new(client.clone(), format!("{base_path}_addresses_data")), + utxo_cohorts: MetricsTree_Distribution_UtxoCohorts::new(client.clone(), format!("{base_path}_utxo_cohorts")), + address_cohorts: MetricsTree_Distribution_AddressCohorts::new(client.clone(), format!("{base_path}_address_cohorts")), + addr_count: AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern::new(client.clone(), "addr_count".to_string()), + empty_addr_count: AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern::new(client.clone(), "empty_addr_count".to_string()), + address_activity: MetricsTree_Distribution_AddressActivity::new(client.clone(), format!("{base_path}_address_activity")), + total_addr_count: MetricsTree_Distribution_TotalAddrCount::new(client.clone(), format!("{base_path}_total_addr_count")), + new_addr_count: MetricsTree_Distribution_NewAddrCount::new(client.clone(), format!("{base_path}_new_addr_count")), + growth_rate: MetricsTree_Distribution_GrowthRate::new(client.clone(), format!("{base_path}_growth_rate")), + fundedaddressindex: MetricPattern34::new(client.clone(), "fundedaddressindex".to_string()), + emptyaddressindex: MetricPattern35::new(client.clone(), "emptyaddressindex".to_string()), } } } @@ -8350,54 +5676,18 @@ pub struct MetricsTree_Distribution_UtxoCohorts { impl MetricsTree_Distribution_UtxoCohorts { pub fn new(client: Arc, base_path: String) -> Self { Self { - all: MetricsTree_Distribution_UtxoCohorts_All::new( - client.clone(), - format!("{base_path}_all"), - ), - sth: MetricsTree_Distribution_UtxoCohorts_Sth::new( - client.clone(), - format!("{base_path}_sth"), - ), - lth: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "lth".to_string(), - ), - age_range: MetricsTree_Distribution_UtxoCohorts_AgeRange::new( - client.clone(), - format!("{base_path}_age_range"), - ), - max_age: MetricsTree_Distribution_UtxoCohorts_MaxAge::new( - client.clone(), - format!("{base_path}_max_age"), - ), - min_age: MetricsTree_Distribution_UtxoCohorts_MinAge::new( - client.clone(), - format!("{base_path}_min_age"), - ), - ge_amount: MetricsTree_Distribution_UtxoCohorts_GeAmount::new( - client.clone(), - format!("{base_path}_ge_amount"), - ), - amount_range: MetricsTree_Distribution_UtxoCohorts_AmountRange::new( - client.clone(), - format!("{base_path}_amount_range"), - ), - lt_amount: MetricsTree_Distribution_UtxoCohorts_LtAmount::new( - client.clone(), - format!("{base_path}_lt_amount"), - ), - epoch: MetricsTree_Distribution_UtxoCohorts_Epoch::new( - client.clone(), - format!("{base_path}_epoch"), - ), - year: MetricsTree_Distribution_UtxoCohorts_Year::new( - client.clone(), - format!("{base_path}_year"), - ), - type_: MetricsTree_Distribution_UtxoCohorts_Type::new( - client.clone(), - format!("{base_path}_type_"), - ), + all: MetricsTree_Distribution_UtxoCohorts_All::new(client.clone(), format!("{base_path}_all")), + sth: MetricsTree_Distribution_UtxoCohorts_Sth::new(client.clone(), format!("{base_path}_sth")), + lth: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "lth".to_string()), + age_range: MetricsTree_Distribution_UtxoCohorts_AgeRange::new(client.clone(), format!("{base_path}_age_range")), + max_age: MetricsTree_Distribution_UtxoCohorts_MaxAge::new(client.clone(), format!("{base_path}_max_age")), + min_age: MetricsTree_Distribution_UtxoCohorts_MinAge::new(client.clone(), format!("{base_path}_min_age")), + ge_amount: MetricsTree_Distribution_UtxoCohorts_GeAmount::new(client.clone(), format!("{base_path}_ge_amount")), + amount_range: MetricsTree_Distribution_UtxoCohorts_AmountRange::new(client.clone(), format!("{base_path}_amount_range")), + lt_amount: MetricsTree_Distribution_UtxoCohorts_LtAmount::new(client.clone(), format!("{base_path}_lt_amount")), + epoch: MetricsTree_Distribution_UtxoCohorts_Epoch::new(client.clone(), format!("{base_path}_epoch")), + year: MetricsTree_Distribution_UtxoCohorts_Year::new(client.clone(), format!("{base_path}_year")), + type_: MetricsTree_Distribution_UtxoCohorts_Type::new(client.clone(), format!("{base_path}_type_")), } } } @@ -8447,55 +5737,19 @@ pub struct MetricsTree_Distribution_UtxoCohorts_All_Relative { impl MetricsTree_Distribution_UtxoCohorts_All_Relative { pub fn new(client: Arc, base_path: String) -> Self { Self { - supply_in_profit_rel_to_own_supply: BpsPercentRatioPattern::new( - client.clone(), - "supply_in_profit_rel_to_own_supply".to_string(), - ), - supply_in_loss_rel_to_own_supply: BpsPercentRatioPattern::new( - client.clone(), - "supply_in_loss_rel_to_own_supply".to_string(), - ), - unrealized_profit_rel_to_market_cap: BpsPercentRatioPattern::new( - client.clone(), - "unrealized_profit_rel_to_market_cap".to_string(), - ), - unrealized_loss_rel_to_market_cap: BpsPercentRatioPattern::new( - client.clone(), - "unrealized_loss_rel_to_market_cap".to_string(), - ), - neg_unrealized_loss_rel_to_market_cap: BpsPercentRatioPattern::new( - client.clone(), - "neg_unrealized_loss_rel_to_market_cap".to_string(), - ), - net_unrealized_pnl_rel_to_market_cap: BpsPercentRatioPattern::new( - client.clone(), - "net_unrealized_pnl_rel_to_market_cap".to_string(), - ), + supply_in_profit_rel_to_own_supply: BpsPercentRatioPattern::new(client.clone(), "supply_in_profit_rel_to_own_supply".to_string()), + supply_in_loss_rel_to_own_supply: BpsPercentRatioPattern::new(client.clone(), "supply_in_loss_rel_to_own_supply".to_string()), + unrealized_profit_rel_to_market_cap: BpsPercentRatioPattern::new(client.clone(), "unrealized_profit_rel_to_market_cap".to_string()), + unrealized_loss_rel_to_market_cap: BpsPercentRatioPattern::new(client.clone(), "unrealized_loss_rel_to_market_cap".to_string()), + neg_unrealized_loss_rel_to_market_cap: BpsPercentRatioPattern::new(client.clone(), "neg_unrealized_loss_rel_to_market_cap".to_string()), + net_unrealized_pnl_rel_to_market_cap: BpsPercentRatioPattern::new(client.clone(), "net_unrealized_pnl_rel_to_market_cap".to_string()), nupl: MetricPattern1::new(client.clone(), "nupl".to_string()), - invested_capital_in_profit_rel_to_realized_cap: BpsPercentRatioPattern::new( - client.clone(), - "invested_capital_in_profit_rel_to_realized_cap".to_string(), - ), - invested_capital_in_loss_rel_to_realized_cap: BpsPercentRatioPattern::new( - client.clone(), - "invested_capital_in_loss_rel_to_realized_cap".to_string(), - ), - unrealized_profit_rel_to_own_gross_pnl: BpsPercentRatioPattern::new( - client.clone(), - "unrealized_profit_rel_to_own_gross_pnl".to_string(), - ), - unrealized_loss_rel_to_own_gross_pnl: BpsPercentRatioPattern::new( - client.clone(), - "unrealized_loss_rel_to_own_gross_pnl".to_string(), - ), - neg_unrealized_loss_rel_to_own_gross_pnl: BpsPercentRatioPattern::new( - client.clone(), - "neg_unrealized_loss_rel_to_own_gross_pnl".to_string(), - ), - net_unrealized_pnl_rel_to_own_gross_pnl: BpsPercentRatioPattern::new( - client.clone(), - "net_unrealized_pnl_rel_to_own_gross_pnl".to_string(), - ), + invested_capital_in_profit_rel_to_realized_cap: BpsPercentRatioPattern::new(client.clone(), "invested_capital_in_profit_rel_to_realized_cap".to_string()), + invested_capital_in_loss_rel_to_realized_cap: BpsPercentRatioPattern::new(client.clone(), "invested_capital_in_loss_rel_to_realized_cap".to_string()), + unrealized_profit_rel_to_own_gross_pnl: BpsPercentRatioPattern::new(client.clone(), "unrealized_profit_rel_to_own_gross_pnl".to_string()), + unrealized_loss_rel_to_own_gross_pnl: BpsPercentRatioPattern::new(client.clone(), "unrealized_loss_rel_to_own_gross_pnl".to_string()), + neg_unrealized_loss_rel_to_own_gross_pnl: BpsPercentRatioPattern::new(client.clone(), "neg_unrealized_loss_rel_to_own_gross_pnl".to_string()), + net_unrealized_pnl_rel_to_own_gross_pnl: BpsPercentRatioPattern::new(client.clone(), "net_unrealized_pnl_rel_to_own_gross_pnl".to_string()), } } } @@ -8553,90 +5807,27 @@ pub struct MetricsTree_Distribution_UtxoCohorts_AgeRange { impl MetricsTree_Distribution_UtxoCohorts_AgeRange { pub fn new(client: Arc, base_path: String) -> Self { Self { - up_to_1h: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "utxos_under_1h_old".to_string(), - ), - _1h_to_1d: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "utxos_1h_to_1d_old".to_string(), - ), - _1d_to_1w: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "utxos_1d_to_1w_old".to_string(), - ), - _1w_to_1m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "utxos_1w_to_1m_old".to_string(), - ), - _1m_to_2m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "utxos_1m_to_2m_old".to_string(), - ), - _2m_to_3m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "utxos_2m_to_3m_old".to_string(), - ), - _3m_to_4m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "utxos_3m_to_4m_old".to_string(), - ), - _4m_to_5m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "utxos_4m_to_5m_old".to_string(), - ), - _5m_to_6m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "utxos_5m_to_6m_old".to_string(), - ), - _6m_to_1y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "utxos_6m_to_1y_old".to_string(), - ), - _1y_to_2y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "utxos_1y_to_2y_old".to_string(), - ), - _2y_to_3y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "utxos_2y_to_3y_old".to_string(), - ), - _3y_to_4y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "utxos_3y_to_4y_old".to_string(), - ), - _4y_to_5y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "utxos_4y_to_5y_old".to_string(), - ), - _5y_to_6y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "utxos_5y_to_6y_old".to_string(), - ), - _6y_to_7y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "utxos_6y_to_7y_old".to_string(), - ), - _7y_to_8y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "utxos_7y_to_8y_old".to_string(), - ), - _8y_to_10y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "utxos_8y_to_10y_old".to_string(), - ), - _10y_to_12y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "utxos_10y_to_12y_old".to_string(), - ), - _12y_to_15y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "utxos_12y_to_15y_old".to_string(), - ), - from_15y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "utxos_over_15y_old".to_string(), - ), + up_to_1h: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "utxos_under_1h_old".to_string()), + _1h_to_1d: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "utxos_1h_to_1d_old".to_string()), + _1d_to_1w: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "utxos_1d_to_1w_old".to_string()), + _1w_to_1m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "utxos_1w_to_1m_old".to_string()), + _1m_to_2m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "utxos_1m_to_2m_old".to_string()), + _2m_to_3m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "utxos_2m_to_3m_old".to_string()), + _3m_to_4m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "utxos_3m_to_4m_old".to_string()), + _4m_to_5m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "utxos_4m_to_5m_old".to_string()), + _5m_to_6m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "utxos_5m_to_6m_old".to_string()), + _6m_to_1y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "utxos_6m_to_1y_old".to_string()), + _1y_to_2y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "utxos_1y_to_2y_old".to_string()), + _2y_to_3y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "utxos_2y_to_3y_old".to_string()), + _3y_to_4y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "utxos_3y_to_4y_old".to_string()), + _4y_to_5y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "utxos_4y_to_5y_old".to_string()), + _5y_to_6y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "utxos_5y_to_6y_old".to_string()), + _6y_to_7y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "utxos_6y_to_7y_old".to_string()), + _7y_to_8y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "utxos_7y_to_8y_old".to_string()), + _8y_to_10y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "utxos_8y_to_10y_old".to_string()), + _10y_to_12y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "utxos_10y_to_12y_old".to_string()), + _12y_to_15y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "utxos_12y_to_15y_old".to_string()), + from_15y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "utxos_over_15y_old".to_string()), } } } @@ -8666,78 +5857,24 @@ pub struct MetricsTree_Distribution_UtxoCohorts_MaxAge { impl MetricsTree_Distribution_UtxoCohorts_MaxAge { pub fn new(client: Arc, base_path: String) -> Self { Self { - _1w: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new( - client.clone(), - "utxos_under_1w_old".to_string(), - ), - _1m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new( - client.clone(), - "utxos_under_1m_old".to_string(), - ), - _2m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new( - client.clone(), - "utxos_under_2m_old".to_string(), - ), - _3m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new( - client.clone(), - "utxos_under_3m_old".to_string(), - ), - _4m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new( - client.clone(), - "utxos_under_4m_old".to_string(), - ), - _5m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new( - client.clone(), - "utxos_under_5m_old".to_string(), - ), - _6m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new( - client.clone(), - "utxos_under_6m_old".to_string(), - ), - _1y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new( - client.clone(), - "utxos_under_1y_old".to_string(), - ), - _2y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new( - client.clone(), - "utxos_under_2y_old".to_string(), - ), - _3y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new( - client.clone(), - "utxos_under_3y_old".to_string(), - ), - _4y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new( - client.clone(), - "utxos_under_4y_old".to_string(), - ), - _5y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new( - client.clone(), - "utxos_under_5y_old".to_string(), - ), - _6y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new( - client.clone(), - "utxos_under_6y_old".to_string(), - ), - _7y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new( - client.clone(), - "utxos_under_7y_old".to_string(), - ), - _8y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new( - client.clone(), - "utxos_under_8y_old".to_string(), - ), - _10y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new( - client.clone(), - "utxos_under_10y_old".to_string(), - ), - _12y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new( - client.clone(), - "utxos_under_12y_old".to_string(), - ), - _15y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new( - client.clone(), - "utxos_under_15y_old".to_string(), - ), + _1w: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_under_1w_old".to_string()), + _1m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_under_1m_old".to_string()), + _2m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_under_2m_old".to_string()), + _3m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_under_3m_old".to_string()), + _4m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_under_4m_old".to_string()), + _5m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_under_5m_old".to_string()), + _6m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_under_6m_old".to_string()), + _1y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_under_1y_old".to_string()), + _2y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_under_2y_old".to_string()), + _3y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_under_3y_old".to_string()), + _4y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_under_4y_old".to_string()), + _5y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_under_5y_old".to_string()), + _6y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_under_6y_old".to_string()), + _7y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_under_7y_old".to_string()), + _8y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_under_8y_old".to_string()), + _10y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_under_10y_old".to_string()), + _12y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_under_12y_old".to_string()), + _15y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_under_15y_old".to_string()), } } } @@ -8767,78 +5904,24 @@ pub struct MetricsTree_Distribution_UtxoCohorts_MinAge { impl MetricsTree_Distribution_UtxoCohorts_MinAge { pub fn new(client: Arc, base_path: String) -> Self { Self { - _1d: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_over_1d_old".to_string(), - ), - _1w: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_over_1w_old".to_string(), - ), - _1m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_over_1m_old".to_string(), - ), - _2m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_over_2m_old".to_string(), - ), - _3m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_over_3m_old".to_string(), - ), - _4m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_over_4m_old".to_string(), - ), - _5m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_over_5m_old".to_string(), - ), - _6m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_over_6m_old".to_string(), - ), - _1y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_over_1y_old".to_string(), - ), - _2y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_over_2y_old".to_string(), - ), - _3y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_over_3y_old".to_string(), - ), - _4y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_over_4y_old".to_string(), - ), - _5y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_over_5y_old".to_string(), - ), - _6y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_over_6y_old".to_string(), - ), - _7y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_over_7y_old".to_string(), - ), - _8y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_over_8y_old".to_string(), - ), - _10y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_over_10y_old".to_string(), - ), - _12y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_over_12y_old".to_string(), - ), + _1d: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_over_1d_old".to_string()), + _1w: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_over_1w_old".to_string()), + _1m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_over_1m_old".to_string()), + _2m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_over_2m_old".to_string()), + _3m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_over_3m_old".to_string()), + _4m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_over_4m_old".to_string()), + _5m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_over_5m_old".to_string()), + _6m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_over_6m_old".to_string()), + _1y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_over_1y_old".to_string()), + _2y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_over_2y_old".to_string()), + _3y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_over_3y_old".to_string()), + _4y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_over_4y_old".to_string()), + _5y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_over_5y_old".to_string()), + _6y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_over_6y_old".to_string()), + _7y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_over_7y_old".to_string()), + _8y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_over_8y_old".to_string()), + _10y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_over_10y_old".to_string()), + _12y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_over_12y_old".to_string()), } } } @@ -8863,58 +5946,19 @@ pub struct MetricsTree_Distribution_UtxoCohorts_GeAmount { impl MetricsTree_Distribution_UtxoCohorts_GeAmount { pub fn new(client: Arc, base_path: String) -> Self { Self { - _1sat: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_over_1sat".to_string(), - ), - _10sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_over_10sats".to_string(), - ), - _100sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_over_100sats".to_string(), - ), - _1k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_over_1k_sats".to_string(), - ), - _10k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_over_10k_sats".to_string(), - ), - _100k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_over_100k_sats".to_string(), - ), - _1m_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_over_1m_sats".to_string(), - ), - _10m_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_over_10m_sats".to_string(), - ), - _1btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_over_1btc".to_string(), - ), - _10btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_over_10btc".to_string(), - ), - _100btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_over_100btc".to_string(), - ), - _1k_btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_over_1k_btc".to_string(), - ), - _10k_btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_over_10k_btc".to_string(), - ), + _1sat: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_over_1sat".to_string()), + _10sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_over_10sats".to_string()), + _100sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_over_100sats".to_string()), + _1k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_over_1k_sats".to_string()), + _10k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_over_10k_sats".to_string()), + _100k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_over_100k_sats".to_string()), + _1m_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_over_1m_sats".to_string()), + _10m_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_over_10m_sats".to_string()), + _1btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_over_1btc".to_string()), + _10btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_over_10btc".to_string()), + _100btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_over_100btc".to_string()), + _1k_btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_over_1k_btc".to_string()), + _10k_btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_over_10k_btc".to_string()), } } } @@ -8941,67 +5985,21 @@ pub struct MetricsTree_Distribution_UtxoCohorts_AmountRange { impl MetricsTree_Distribution_UtxoCohorts_AmountRange { pub fn new(client: Arc, base_path: String) -> Self { Self { - _0sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_with_0sats".to_string(), - ), - _1sat_to_10sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_above_1sat_under_10sats".to_string(), - ), - _10sats_to_100sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_above_10sats_under_100sats".to_string(), - ), - _100sats_to_1k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_above_100sats_under_1k_sats".to_string(), - ), - _1k_sats_to_10k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_above_1k_sats_under_10k_sats".to_string(), - ), - _10k_sats_to_100k_sats: - ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_above_10k_sats_under_100k_sats".to_string(), - ), - _100k_sats_to_1m_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_above_100k_sats_under_1m_sats".to_string(), - ), - _1m_sats_to_10m_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_above_1m_sats_under_10m_sats".to_string(), - ), - _10m_sats_to_1btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_above_10m_sats_under_1btc".to_string(), - ), - _1btc_to_10btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_above_1btc_under_10btc".to_string(), - ), - _10btc_to_100btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_above_10btc_under_100btc".to_string(), - ), - _100btc_to_1k_btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_above_100btc_under_1k_btc".to_string(), - ), - _1k_btc_to_10k_btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_above_1k_btc_under_10k_btc".to_string(), - ), - _10k_btc_to_100k_btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_above_10k_btc_under_100k_btc".to_string(), - ), - _100k_btc_or_more: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_above_100k_btc".to_string(), - ), + _0sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_with_0sats".to_string()), + _1sat_to_10sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_above_1sat_under_10sats".to_string()), + _10sats_to_100sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_above_10sats_under_100sats".to_string()), + _100sats_to_1k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_above_100sats_under_1k_sats".to_string()), + _1k_sats_to_10k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_above_1k_sats_under_10k_sats".to_string()), + _10k_sats_to_100k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_above_10k_sats_under_100k_sats".to_string()), + _100k_sats_to_1m_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_above_100k_sats_under_1m_sats".to_string()), + _1m_sats_to_10m_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_above_1m_sats_under_10m_sats".to_string()), + _10m_sats_to_1btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_above_10m_sats_under_1btc".to_string()), + _1btc_to_10btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_above_1btc_under_10btc".to_string()), + _10btc_to_100btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_above_10btc_under_100btc".to_string()), + _100btc_to_1k_btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_above_100btc_under_1k_btc".to_string()), + _1k_btc_to_10k_btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_above_1k_btc_under_10k_btc".to_string()), + _10k_btc_to_100k_btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_above_10k_btc_under_100k_btc".to_string()), + _100k_btc_or_more: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_above_100k_btc".to_string()), } } } @@ -9026,58 +6024,19 @@ pub struct MetricsTree_Distribution_UtxoCohorts_LtAmount { impl MetricsTree_Distribution_UtxoCohorts_LtAmount { pub fn new(client: Arc, base_path: String) -> Self { Self { - _10sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_under_10sats".to_string(), - ), - _100sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_under_100sats".to_string(), - ), - _1k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_under_1k_sats".to_string(), - ), - _10k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_under_10k_sats".to_string(), - ), - _100k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_under_100k_sats".to_string(), - ), - _1m_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_under_1m_sats".to_string(), - ), - _10m_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_under_10m_sats".to_string(), - ), - _1btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_under_1btc".to_string(), - ), - _10btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_under_10btc".to_string(), - ), - _100btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_under_100btc".to_string(), - ), - _1k_btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_under_1k_btc".to_string(), - ), - _10k_btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_under_10k_btc".to_string(), - ), - _100k_btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "utxos_under_100k_btc".to_string(), - ), + _10sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_under_10sats".to_string()), + _100sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_under_100sats".to_string()), + _1k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_under_1k_sats".to_string()), + _10k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_under_10k_sats".to_string()), + _100k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_under_100k_sats".to_string()), + _1m_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_under_1m_sats".to_string()), + _10m_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_under_10m_sats".to_string()), + _1btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_under_1btc".to_string()), + _10btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_under_10btc".to_string()), + _100btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_under_100btc".to_string()), + _1k_btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_under_1k_btc".to_string()), + _10k_btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_under_10k_btc".to_string()), + _100k_btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "utxos_under_100k_btc".to_string()), } } } @@ -9094,26 +6053,11 @@ pub struct MetricsTree_Distribution_UtxoCohorts_Epoch { impl MetricsTree_Distribution_UtxoCohorts_Epoch { pub fn new(client: Arc, base_path: String) -> Self { Self { - _0: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "epoch_0".to_string(), - ), - _1: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "epoch_1".to_string(), - ), - _2: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "epoch_2".to_string(), - ), - _3: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "epoch_3".to_string(), - ), - _4: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "epoch_4".to_string(), - ), + _0: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "epoch_0".to_string()), + _1: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "epoch_1".to_string()), + _2: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "epoch_2".to_string()), + _3: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "epoch_3".to_string()), + _4: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "epoch_4".to_string()), } } } @@ -9143,78 +6087,24 @@ pub struct MetricsTree_Distribution_UtxoCohorts_Year { impl MetricsTree_Distribution_UtxoCohorts_Year { pub fn new(client: Arc, base_path: String) -> Self { Self { - _2009: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "year_2009".to_string(), - ), - _2010: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "year_2010".to_string(), - ), - _2011: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "year_2011".to_string(), - ), - _2012: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "year_2012".to_string(), - ), - _2013: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "year_2013".to_string(), - ), - _2014: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "year_2014".to_string(), - ), - _2015: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "year_2015".to_string(), - ), - _2016: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "year_2016".to_string(), - ), - _2017: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "year_2017".to_string(), - ), - _2018: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "year_2018".to_string(), - ), - _2019: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "year_2019".to_string(), - ), - _2020: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "year_2020".to_string(), - ), - _2021: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "year_2021".to_string(), - ), - _2022: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "year_2022".to_string(), - ), - _2023: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "year_2023".to_string(), - ), - _2024: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "year_2024".to_string(), - ), - _2025: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "year_2025".to_string(), - ), - _2026: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "year_2026".to_string(), - ), + _2009: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "year_2009".to_string()), + _2010: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "year_2010".to_string()), + _2011: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "year_2011".to_string()), + _2012: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "year_2012".to_string()), + _2013: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "year_2013".to_string()), + _2014: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "year_2014".to_string()), + _2015: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "year_2015".to_string()), + _2016: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "year_2016".to_string()), + _2017: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "year_2017".to_string()), + _2018: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "year_2018".to_string()), + _2019: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "year_2019".to_string()), + _2020: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "year_2020".to_string()), + _2021: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "year_2021".to_string()), + _2022: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "year_2022".to_string()), + _2023: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "year_2023".to_string()), + _2024: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "year_2024".to_string()), + _2025: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "year_2025".to_string()), + _2026: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "year_2026".to_string()), } } } @@ -9237,50 +6127,17 @@ pub struct MetricsTree_Distribution_UtxoCohorts_Type { impl MetricsTree_Distribution_UtxoCohorts_Type { pub fn new(client: Arc, base_path: String) -> Self { Self { - p2pk65: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "p2pk65".to_string(), - ), - p2pk33: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "p2pk33".to_string(), - ), - p2pkh: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "p2pkh".to_string(), - ), - p2ms: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "p2ms".to_string(), - ), - p2sh: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "p2sh".to_string(), - ), - p2wpkh: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "p2wpkh".to_string(), - ), - p2wsh: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "p2wsh".to_string(), - ), - p2tr: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "p2tr".to_string(), - ), - p2a: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "p2a".to_string(), - ), - unknown: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "unknown_outputs".to_string(), - ), - empty: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new( - client.clone(), - "empty_outputs".to_string(), - ), + p2pk65: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "p2pk65".to_string()), + p2pk33: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "p2pk33".to_string()), + p2pkh: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "p2pkh".to_string()), + p2ms: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "p2ms".to_string()), + p2sh: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "p2sh".to_string()), + p2wpkh: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "p2wpkh".to_string()), + p2wsh: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "p2wsh".to_string()), + p2tr: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "p2tr".to_string()), + p2a: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "p2a".to_string()), + unknown: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "unknown_outputs".to_string()), + empty: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3::new(client.clone(), "empty_outputs".to_string()), } } } @@ -9295,18 +6152,9 @@ pub struct MetricsTree_Distribution_AddressCohorts { impl MetricsTree_Distribution_AddressCohorts { pub fn new(client: Arc, base_path: String) -> Self { Self { - ge_amount: MetricsTree_Distribution_AddressCohorts_GeAmount::new( - client.clone(), - format!("{base_path}_ge_amount"), - ), - amount_range: MetricsTree_Distribution_AddressCohorts_AmountRange::new( - client.clone(), - format!("{base_path}_amount_range"), - ), - lt_amount: MetricsTree_Distribution_AddressCohorts_LtAmount::new( - client.clone(), - format!("{base_path}_lt_amount"), - ), + ge_amount: MetricsTree_Distribution_AddressCohorts_GeAmount::new(client.clone(), format!("{base_path}_ge_amount")), + amount_range: MetricsTree_Distribution_AddressCohorts_AmountRange::new(client.clone(), format!("{base_path}_amount_range")), + lt_amount: MetricsTree_Distribution_AddressCohorts_LtAmount::new(client.clone(), format!("{base_path}_lt_amount")), } } } @@ -9331,58 +6179,19 @@ pub struct MetricsTree_Distribution_AddressCohorts_GeAmount { impl MetricsTree_Distribution_AddressCohorts_GeAmount { pub fn new(client: Arc, base_path: String) -> Self { Self { - _1sat: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "addrs_over_1sat".to_string(), - ), - _10sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "addrs_over_10sats".to_string(), - ), - _100sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "addrs_over_100sats".to_string(), - ), - _1k_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "addrs_over_1k_sats".to_string(), - ), - _10k_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "addrs_over_10k_sats".to_string(), - ), - _100k_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "addrs_over_100k_sats".to_string(), - ), - _1m_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "addrs_over_1m_sats".to_string(), - ), - _10m_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "addrs_over_10m_sats".to_string(), - ), - _1btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "addrs_over_1btc".to_string(), - ), - _10btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "addrs_over_10btc".to_string(), - ), - _100btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "addrs_over_100btc".to_string(), - ), - _1k_btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "addrs_over_1k_btc".to_string(), - ), - _10k_btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "addrs_over_10k_btc".to_string(), - ), + _1sat: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "addrs_over_1sat".to_string()), + _10sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "addrs_over_10sats".to_string()), + _100sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "addrs_over_100sats".to_string()), + _1k_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "addrs_over_1k_sats".to_string()), + _10k_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "addrs_over_10k_sats".to_string()), + _100k_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "addrs_over_100k_sats".to_string()), + _1m_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "addrs_over_1m_sats".to_string()), + _10m_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "addrs_over_10m_sats".to_string()), + _1btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "addrs_over_1btc".to_string()), + _10btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "addrs_over_10btc".to_string()), + _100btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "addrs_over_100btc".to_string()), + _1k_btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "addrs_over_1k_btc".to_string()), + _10k_btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "addrs_over_10k_btc".to_string()), } } } @@ -9409,72 +6218,21 @@ pub struct MetricsTree_Distribution_AddressCohorts_AmountRange { impl MetricsTree_Distribution_AddressCohorts_AmountRange { pub fn new(client: Arc, base_path: String) -> Self { Self { - _0sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "addrs_with_0sats".to_string(), - ), - _1sat_to_10sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "addrs_above_1sat_under_10sats".to_string(), - ), - _10sats_to_100sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "addrs_above_10sats_under_100sats".to_string(), - ), - _100sats_to_1k_sats: - ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "addrs_above_100sats_under_1k_sats".to_string(), - ), - _1k_sats_to_10k_sats: - ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "addrs_above_1k_sats_under_10k_sats".to_string(), - ), - _10k_sats_to_100k_sats: - ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "addrs_above_10k_sats_under_100k_sats".to_string(), - ), - _100k_sats_to_1m_sats: - ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "addrs_above_100k_sats_under_1m_sats".to_string(), - ), - _1m_sats_to_10m_sats: - ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "addrs_above_1m_sats_under_10m_sats".to_string(), - ), - _10m_sats_to_1btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "addrs_above_10m_sats_under_1btc".to_string(), - ), - _1btc_to_10btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "addrs_above_1btc_under_10btc".to_string(), - ), - _10btc_to_100btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "addrs_above_10btc_under_100btc".to_string(), - ), - _100btc_to_1k_btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "addrs_above_100btc_under_1k_btc".to_string(), - ), - _1k_btc_to_10k_btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "addrs_above_1k_btc_under_10k_btc".to_string(), - ), - _10k_btc_to_100k_btc: - ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "addrs_above_10k_btc_under_100k_btc".to_string(), - ), - _100k_btc_or_more: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "addrs_above_100k_btc".to_string(), - ), + _0sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "addrs_with_0sats".to_string()), + _1sat_to_10sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "addrs_above_1sat_under_10sats".to_string()), + _10sats_to_100sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "addrs_above_10sats_under_100sats".to_string()), + _100sats_to_1k_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "addrs_above_100sats_under_1k_sats".to_string()), + _1k_sats_to_10k_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "addrs_above_1k_sats_under_10k_sats".to_string()), + _10k_sats_to_100k_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "addrs_above_10k_sats_under_100k_sats".to_string()), + _100k_sats_to_1m_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "addrs_above_100k_sats_under_1m_sats".to_string()), + _1m_sats_to_10m_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "addrs_above_1m_sats_under_10m_sats".to_string()), + _10m_sats_to_1btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "addrs_above_10m_sats_under_1btc".to_string()), + _1btc_to_10btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "addrs_above_1btc_under_10btc".to_string()), + _10btc_to_100btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "addrs_above_10btc_under_100btc".to_string()), + _100btc_to_1k_btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "addrs_above_100btc_under_1k_btc".to_string()), + _1k_btc_to_10k_btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "addrs_above_1k_btc_under_10k_btc".to_string()), + _10k_btc_to_100k_btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "addrs_above_10k_btc_under_100k_btc".to_string()), + _100k_btc_or_more: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "addrs_above_100k_btc".to_string()), } } } @@ -9499,58 +6257,19 @@ pub struct MetricsTree_Distribution_AddressCohorts_LtAmount { impl MetricsTree_Distribution_AddressCohorts_LtAmount { pub fn new(client: Arc, base_path: String) -> Self { Self { - _10sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "addrs_under_10sats".to_string(), - ), - _100sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "addrs_under_100sats".to_string(), - ), - _1k_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "addrs_under_1k_sats".to_string(), - ), - _10k_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "addrs_under_10k_sats".to_string(), - ), - _100k_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "addrs_under_100k_sats".to_string(), - ), - _1m_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "addrs_under_1m_sats".to_string(), - ), - _10m_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "addrs_under_10m_sats".to_string(), - ), - _1btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "addrs_under_1btc".to_string(), - ), - _10btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "addrs_under_10btc".to_string(), - ), - _100btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "addrs_under_100btc".to_string(), - ), - _1k_btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "addrs_under_1k_btc".to_string(), - ), - _10k_btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "addrs_under_10k_btc".to_string(), - ), - _100k_btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new( - client.clone(), - "addrs_under_100k_btc".to_string(), - ), + _10sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "addrs_under_10sats".to_string()), + _100sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "addrs_under_100sats".to_string()), + _1k_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "addrs_under_1k_sats".to_string()), + _10k_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "addrs_under_10k_sats".to_string()), + _100k_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "addrs_under_100k_sats".to_string()), + _1m_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "addrs_under_1m_sats".to_string()), + _10m_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "addrs_under_10m_sats".to_string()), + _1btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "addrs_under_1btc".to_string()), + _10btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "addrs_under_10btc".to_string()), + _100btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "addrs_under_100btc".to_string()), + _1k_btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "addrs_under_1k_btc".to_string()), + _10k_btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "addrs_under_10k_btc".to_string()), + _100k_btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern::new(client.clone(), "addrs_under_100k_btc".to_string()), } } } @@ -9571,42 +6290,15 @@ pub struct MetricsTree_Distribution_AddressActivity { impl MetricsTree_Distribution_AddressActivity { pub fn new(client: Arc, base_path: String) -> Self { Self { - all: BalanceBothReactivatedReceivingSendingPattern::new( - client.clone(), - "address_activity".to_string(), - ), - p2pk65: BalanceBothReactivatedReceivingSendingPattern::new( - client.clone(), - "p2pk65_address_activity".to_string(), - ), - p2pk33: BalanceBothReactivatedReceivingSendingPattern::new( - client.clone(), - "p2pk33_address_activity".to_string(), - ), - p2pkh: BalanceBothReactivatedReceivingSendingPattern::new( - client.clone(), - "p2pkh_address_activity".to_string(), - ), - p2sh: BalanceBothReactivatedReceivingSendingPattern::new( - client.clone(), - "p2sh_address_activity".to_string(), - ), - p2wpkh: BalanceBothReactivatedReceivingSendingPattern::new( - client.clone(), - "p2wpkh_address_activity".to_string(), - ), - p2wsh: BalanceBothReactivatedReceivingSendingPattern::new( - client.clone(), - "p2wsh_address_activity".to_string(), - ), - p2tr: BalanceBothReactivatedReceivingSendingPattern::new( - client.clone(), - "p2tr_address_activity".to_string(), - ), - p2a: BalanceBothReactivatedReceivingSendingPattern::new( - client.clone(), - "p2a_address_activity".to_string(), - ), + all: BalanceBothReactivatedReceivingSendingPattern::new(client.clone(), "address_activity".to_string()), + p2pk65: BalanceBothReactivatedReceivingSendingPattern::new(client.clone(), "p2pk65_address_activity".to_string()), + p2pk33: BalanceBothReactivatedReceivingSendingPattern::new(client.clone(), "p2pk33_address_activity".to_string()), + p2pkh: BalanceBothReactivatedReceivingSendingPattern::new(client.clone(), "p2pkh_address_activity".to_string()), + p2sh: BalanceBothReactivatedReceivingSendingPattern::new(client.clone(), "p2sh_address_activity".to_string()), + p2wpkh: BalanceBothReactivatedReceivingSendingPattern::new(client.clone(), "p2wpkh_address_activity".to_string()), + p2wsh: BalanceBothReactivatedReceivingSendingPattern::new(client.clone(), "p2wsh_address_activity".to_string()), + p2tr: BalanceBothReactivatedReceivingSendingPattern::new(client.clone(), "p2tr_address_activity".to_string()), + p2a: BalanceBothReactivatedReceivingSendingPattern::new(client.clone(), "p2a_address_activity".to_string()), } } } @@ -9656,42 +6348,15 @@ pub struct MetricsTree_Distribution_NewAddrCount { impl MetricsTree_Distribution_NewAddrCount { pub fn new(client: Arc, base_path: String) -> Self { Self { - all: AverageCumulativeHeightMaxMedianMinPct10Pct25Pct75Pct90SumPattern::new( - client.clone(), - "new_addr_count".to_string(), - ), - p2pk65: AverageCumulativeHeightMaxMedianMinPct10Pct25Pct75Pct90SumPattern::new( - client.clone(), - "p2pk65_new_addr_count".to_string(), - ), - p2pk33: AverageCumulativeHeightMaxMedianMinPct10Pct25Pct75Pct90SumPattern::new( - client.clone(), - "p2pk33_new_addr_count".to_string(), - ), - p2pkh: AverageCumulativeHeightMaxMedianMinPct10Pct25Pct75Pct90SumPattern::new( - client.clone(), - "p2pkh_new_addr_count".to_string(), - ), - p2sh: AverageCumulativeHeightMaxMedianMinPct10Pct25Pct75Pct90SumPattern::new( - client.clone(), - "p2sh_new_addr_count".to_string(), - ), - p2wpkh: AverageCumulativeHeightMaxMedianMinPct10Pct25Pct75Pct90SumPattern::new( - client.clone(), - "p2wpkh_new_addr_count".to_string(), - ), - p2wsh: AverageCumulativeHeightMaxMedianMinPct10Pct25Pct75Pct90SumPattern::new( - client.clone(), - "p2wsh_new_addr_count".to_string(), - ), - p2tr: AverageCumulativeHeightMaxMedianMinPct10Pct25Pct75Pct90SumPattern::new( - client.clone(), - "p2tr_new_addr_count".to_string(), - ), - p2a: AverageCumulativeHeightMaxMedianMinPct10Pct25Pct75Pct90SumPattern::new( - client.clone(), - "p2a_new_addr_count".to_string(), - ), + all: AverageCumulativeHeightMaxMedianMinPct10Pct25Pct75Pct90SumPattern::new(client.clone(), "new_addr_count".to_string()), + p2pk65: AverageCumulativeHeightMaxMedianMinPct10Pct25Pct75Pct90SumPattern::new(client.clone(), "p2pk65_new_addr_count".to_string()), + p2pk33: AverageCumulativeHeightMaxMedianMinPct10Pct25Pct75Pct90SumPattern::new(client.clone(), "p2pk33_new_addr_count".to_string()), + p2pkh: AverageCumulativeHeightMaxMedianMinPct10Pct25Pct75Pct90SumPattern::new(client.clone(), "p2pkh_new_addr_count".to_string()), + p2sh: AverageCumulativeHeightMaxMedianMinPct10Pct25Pct75Pct90SumPattern::new(client.clone(), "p2sh_new_addr_count".to_string()), + p2wpkh: AverageCumulativeHeightMaxMedianMinPct10Pct25Pct75Pct90SumPattern::new(client.clone(), "p2wpkh_new_addr_count".to_string()), + p2wsh: AverageCumulativeHeightMaxMedianMinPct10Pct25Pct75Pct90SumPattern::new(client.clone(), "p2wsh_new_addr_count".to_string()), + p2tr: AverageCumulativeHeightMaxMedianMinPct10Pct25Pct75Pct90SumPattern::new(client.clone(), "p2tr_new_addr_count".to_string()), + p2a: AverageCumulativeHeightMaxMedianMinPct10Pct25Pct75Pct90SumPattern::new(client.clone(), "p2a_new_addr_count".to_string()), } } } @@ -9740,32 +6405,14 @@ pub struct MetricsTree_Supply { impl MetricsTree_Supply { pub fn new(client: Arc, base_path: String) -> Self { Self { - circulating: BtcCentsSatsUsdPattern::new( - client.clone(), - "circulating_supply".to_string(), - ), + circulating: BtcCentsSatsUsdPattern::new(client.clone(), "circulating_supply".to_string()), burned: MetricsTree_Supply_Burned::new(client.clone(), format!("{base_path}_burned")), - inflation_rate: BpsPercentRatioPattern::new( - client.clone(), - "inflation_rate".to_string(), - ), - velocity: MetricsTree_Supply_Velocity::new( - client.clone(), - format!("{base_path}_velocity"), - ), + inflation_rate: BpsPercentRatioPattern::new(client.clone(), "inflation_rate".to_string()), + velocity: MetricsTree_Supply_Velocity::new(client.clone(), format!("{base_path}_velocity")), market_cap: MetricPattern1::new(client.clone(), "market_cap".to_string()), - market_cap_growth_rate: BpsPercentRatioPattern::new( - client.clone(), - "market_cap_growth_rate".to_string(), - ), - realized_cap_growth_rate: BpsPercentRatioPattern::new( - client.clone(), - "realized_cap_growth_rate".to_string(), - ), - market_minus_realized_cap_growth_rate: MetricPattern1::new( - client.clone(), - "market_minus_realized_cap_growth_rate".to_string(), - ), + market_cap_growth_rate: BpsPercentRatioPattern::new(client.clone(), "market_cap_growth_rate".to_string()), + realized_cap_growth_rate: BpsPercentRatioPattern::new(client.clone(), "realized_cap_growth_rate".to_string()), + market_minus_realized_cap_growth_rate: MetricPattern1::new(client.clone(), "market_minus_realized_cap_growth_rate".to_string()), } } } @@ -9780,10 +6427,7 @@ impl MetricsTree_Supply_Burned { pub fn new(client: Arc, base_path: String) -> Self { Self { opreturn: BaseCumulativeSumPattern::new(client.clone(), "opreturn_supply".to_string()), - unspendable: BaseCumulativeSumPattern::new( - client.clone(), - "unspendable_supply".to_string(), - ), + unspendable: BaseCumulativeSumPattern::new(client.clone(), "unspendable_supply".to_string()), } } } @@ -9843,26 +6487,20 @@ impl BrkClient { /// .last(10) /// .json::()?; /// ``` - pub fn metric( - &self, - metric: impl Into, - index: Index, - ) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.base.clone(), Arc::from(metric.into().as_str()), index) + pub fn metric(&self, metric: impl Into, index: Index) -> MetricEndpointBuilder { + MetricEndpointBuilder::new( + self.base.clone(), + Arc::from(metric.into().as_str()), + index, + ) } /// Create a dynamic date-based metric endpoint builder. /// /// Returns `Err` if the index is not date-based. - pub fn date_metric( - &self, - metric: impl Into, - index: Index, - ) -> Result> { + pub fn date_metric(&self, metric: impl Into, index: Index) -> Result> { if !index.is_date_based() { - return Err(BrkError { - message: format!("{} is not a date-based index", index.name()), - }); + return Err(BrkError { message: format!("{} is not a date-based index", index.name()) }); } Ok(DateMetricEndpointBuilder::new( self.base.clone(), @@ -9898,24 +6536,11 @@ impl BrkClient { /// *[Mempool.space docs](https://mempool.space/docs/api/rest#get-address-transactions)* /// /// Endpoint: `GET /api/address/{address}/txs` - pub fn get_address_txs( - &self, - address: Address, - after_txid: Option<&str>, - limit: Option, - ) -> Result> { + pub fn get_address_txs(&self, address: Address, after_txid: Option<&str>, limit: Option) -> Result> { let mut query = Vec::new(); - if let Some(v) = after_txid { - query.push(format!("after_txid={}", v)); - } - if let Some(v) = limit { - query.push(format!("limit={}", v)); - } - let query_str = if query.is_empty() { - String::new() - } else { - format!("?{}", query.join("&")) - }; + if let Some(v) = after_txid { query.push(format!("after_txid={}", v)); } + if let Some(v) = limit { query.push(format!("limit={}", v)); } + let query_str = if query.is_empty() { String::new() } else { format!("?{}", query.join("&")) }; let path = format!("/api/address/{address}/txs{}", query_str); self.base.get_json(&path) } @@ -9927,24 +6552,11 @@ impl BrkClient { /// *[Mempool.space docs](https://mempool.space/docs/api/rest#get-address-transactions-chain)* /// /// Endpoint: `GET /api/address/{address}/txs/chain` - pub fn get_address_confirmed_txs( - &self, - address: Address, - after_txid: Option<&str>, - limit: Option, - ) -> Result> { + pub fn get_address_confirmed_txs(&self, address: Address, after_txid: Option<&str>, limit: Option) -> Result> { let mut query = Vec::new(); - if let Some(v) = after_txid { - query.push(format!("after_txid={}", v)); - } - if let Some(v) = limit { - query.push(format!("limit={}", v)); - } - let query_str = if query.is_empty() { - String::new() - } else { - format!("?{}", query.join("&")) - }; + if let Some(v) = after_txid { query.push(format!("after_txid={}", v)); } + if let Some(v) = limit { query.push(format!("limit={}", v)); } + let query_str = if query.is_empty() { String::new() } else { format!("?{}", query.join("&")) }; let path = format!("/api/address/{address}/txs/chain{}", query_str); self.base.get_json(&path) } @@ -9957,8 +6569,7 @@ impl BrkClient { /// /// Endpoint: `GET /api/address/{address}/txs/mempool` pub fn get_address_mempool_txs(&self, address: Address) -> Result> { - self.base - .get_json(&format!("/api/address/{address}/txs/mempool")) + self.base.get_json(&format!("/api/address/{address}/txs/mempool")) } /// Address UTXOs @@ -10024,8 +6635,7 @@ impl BrkClient { /// /// Endpoint: `GET /api/block/{hash}/txid/{index}` pub fn get_block_txid(&self, hash: BlockHash, index: TxIndex) -> Result { - self.base - .get_json(&format!("/api/block/{hash}/txid/{index}")) + self.base.get_json(&format!("/api/block/{hash}/txid/{index}")) } /// Block transaction IDs @@ -10047,8 +6657,7 @@ impl BrkClient { /// /// Endpoint: `GET /api/block/{hash}/txs/{start_index}` pub fn get_block_txs(&self, hash: BlockHash, start_index: TxIndex) -> Result> { - self.base - .get_json(&format!("/api/block/{hash}/txs/{start_index}")) + self.base.get_json(&format!("/api/block/{hash}/txs/{start_index}")) } /// Recent blocks @@ -10118,33 +6727,13 @@ impl BrkClient { /// Fetch data for a specific metric at the given index. Use query parameters to filter by date range and format (json/csv). /// /// Endpoint: `GET /api/metric/{metric}/{index}` - pub fn get_metric( - &self, - metric: Metric, - index: Index, - start: Option, - end: Option, - limit: Option<&str>, - format: Option, - ) -> Result> { + pub fn get_metric(&self, metric: Metric, index: Index, start: Option, end: Option, limit: Option<&str>, format: Option) -> Result> { let mut query = Vec::new(); - if let Some(v) = start { - query.push(format!("start={}", v)); - } - if let Some(v) = end { - query.push(format!("end={}", v)); - } - if let Some(v) = limit { - query.push(format!("limit={}", v)); - } - if let Some(v) = format { - query.push(format!("format={}", v)); - } - let query_str = if query.is_empty() { - String::new() - } else { - format!("?{}", query.join("&")) - }; + if let Some(v) = start { query.push(format!("start={}", v)); } + if let Some(v) = end { query.push(format!("end={}", v)); } + if let Some(v) = limit { query.push(format!("limit={}", v)); } + if let Some(v) = format { query.push(format!("format={}", v)); } + let query_str = if query.is_empty() { String::new() } else { format!("?{}", query.join("&")) }; let path = format!("/api/metric/{metric}/{}{}", index.name(), query_str); if format == Some(Format::CSV) { self.base.get_text(&path).map(FormatResponse::Csv) @@ -10167,35 +6756,15 @@ impl BrkClient { /// Fetch multiple metrics in a single request. Supports filtering by index and date range. Returns an array of MetricData objects. For a single metric, use `get_metric` instead. /// /// Endpoint: `GET /api/metrics/bulk` - pub fn get_metrics( - &self, - metrics: Metrics, - index: Index, - start: Option, - end: Option, - limit: Option<&str>, - format: Option, - ) -> Result>> { + pub fn get_metrics(&self, metrics: Metrics, index: Index, start: Option, end: Option, limit: Option<&str>, format: Option) -> Result>> { let mut query = Vec::new(); query.push(format!("metrics={}", metrics)); query.push(format!("index={}", index)); - if let Some(v) = start { - query.push(format!("start={}", v)); - } - if let Some(v) = end { - query.push(format!("end={}", v)); - } - if let Some(v) = limit { - query.push(format!("limit={}", v)); - } - if let Some(v) = format { - query.push(format!("format={}", v)); - } - let query_str = if query.is_empty() { - String::new() - } else { - format!("?{}", query.join("&")) - }; + if let Some(v) = start { query.push(format!("start={}", v)); } + if let Some(v) = end { query.push(format!("end={}", v)); } + if let Some(v) = limit { query.push(format!("limit={}", v)); } + if let Some(v) = format { query.push(format!("format={}", v)); } + let query_str = if query.is_empty() { String::new() } else { format!("?{}", query.join("&")) }; let path = format!("/api/metrics/bulk{}", query_str); if format == Some(Format::CSV) { self.base.get_text(&path).map(FormatResponse::Csv) @@ -10219,8 +6788,7 @@ impl BrkClient { /// /// Endpoint: `GET /api/metrics/cost-basis/{cohort}/dates` pub fn get_cost_basis_dates(&self, cohort: Cohort) -> Result> { - self.base - .get_json(&format!("/api/metrics/cost-basis/{cohort}/dates")) + self.base.get_json(&format!("/api/metrics/cost-basis/{cohort}/dates")) } /// Cost basis distribution @@ -10232,25 +6800,11 @@ impl BrkClient { /// - `value`: supply (default, in BTC), realized (USD), unrealized (USD) /// /// Endpoint: `GET /api/metrics/cost-basis/{cohort}/{date}` - pub fn get_cost_basis( - &self, - cohort: Cohort, - date: &str, - bucket: Option, - value: Option, - ) -> Result { + pub fn get_cost_basis(&self, cohort: Cohort, date: &str, bucket: Option, value: Option) -> Result { let mut query = Vec::new(); - if let Some(v) = bucket { - query.push(format!("bucket={}", v)); - } - if let Some(v) = value { - query.push(format!("value={}", v)); - } - let query_str = if query.is_empty() { - String::new() - } else { - format!("?{}", query.join("&")) - }; + if let Some(v) = bucket { query.push(format!("bucket={}", v)); } + if let Some(v) = value { query.push(format!("value={}", v)); } + let query_str = if query.is_empty() { String::new() } else { format!("?{}", query.join("&")) }; let path = format!("/api/metrics/cost-basis/{cohort}/{date}{}", query_str); self.base.get_json(&path) } @@ -10280,14 +6834,8 @@ impl BrkClient { /// Endpoint: `GET /api/metrics/list` pub fn list_metrics(&self, page: Option) -> Result { let mut query = Vec::new(); - if let Some(v) = page { - query.push(format!("page={}", v)); - } - let query_str = if query.is_empty() { - String::new() - } else { - format!("?{}", query.join("&")) - }; + if let Some(v) = page { query.push(format!("page={}", v)); } + let query_str = if query.is_empty() { String::new() } else { format!("?{}", query.join("&")) }; let path = format!("/api/metrics/list{}", query_str); self.base.get_json(&path) } @@ -10299,14 +6847,8 @@ impl BrkClient { /// Endpoint: `GET /api/metrics/search/{metric}` pub fn search_metrics(&self, metric: Metric, limit: Option) -> Result> { let mut query = Vec::new(); - if let Some(v) = limit { - query.push(format!("limit={}", v)); - } - let query_str = if query.is_empty() { - String::new() - } else { - format!("?{}", query.join("&")) - }; + if let Some(v) = limit { query.push(format!("limit={}", v)); } + let query_str = if query.is_empty() { String::new() } else { format!("?{}", query.join("&")) }; let path = format!("/api/metrics/search/{metric}{}", query_str); self.base.get_json(&path) } @@ -10359,8 +6901,7 @@ impl BrkClient { /// /// Endpoint: `GET /api/tx/{txid}/outspend/{vout}` pub fn get_tx_outspend(&self, txid: Txid, vout: Vout) -> Result { - self.base - .get_json(&format!("/api/tx/{txid}/outspend/{vout}")) + self.base.get_json(&format!("/api/tx/{txid}/outspend/{vout}")) } /// All output spend statuses @@ -10393,8 +6934,7 @@ impl BrkClient { /// /// Endpoint: `GET /api/v1/difficulty-adjustment` pub fn get_difficulty_adjustment(&self) -> Result { - self.base - .get_json(&format!("/api/v1/difficulty-adjustment")) + self.base.get_json(&format!("/api/v1/difficulty-adjustment")) } /// Projected mempool blocks @@ -10427,8 +6967,7 @@ impl BrkClient { /// /// Endpoint: `GET /api/v1/mining/blocks/fee-rates/{time_period}` pub fn get_block_fee_rates(&self, time_period: TimePeriod) -> Result { - self.base - .get_json(&format!("/api/v1/mining/blocks/fee-rates/{time_period}")) + self.base.get_json(&format!("/api/v1/mining/blocks/fee-rates/{time_period}")) } /// Block fees @@ -10439,8 +6978,7 @@ impl BrkClient { /// /// Endpoint: `GET /api/v1/mining/blocks/fees/{time_period}` pub fn get_block_fees(&self, time_period: TimePeriod) -> Result> { - self.base - .get_json(&format!("/api/v1/mining/blocks/fees/{time_period}")) + self.base.get_json(&format!("/api/v1/mining/blocks/fees/{time_period}")) } /// Block rewards @@ -10451,8 +6989,7 @@ impl BrkClient { /// /// Endpoint: `GET /api/v1/mining/blocks/rewards/{time_period}` pub fn get_block_rewards(&self, time_period: TimePeriod) -> Result> { - self.base - .get_json(&format!("/api/v1/mining/blocks/rewards/{time_period}")) + self.base.get_json(&format!("/api/v1/mining/blocks/rewards/{time_period}")) } /// Block sizes and weights @@ -10463,9 +7000,7 @@ impl BrkClient { /// /// Endpoint: `GET /api/v1/mining/blocks/sizes-weights/{time_period}` pub fn get_block_sizes_weights(&self, time_period: TimePeriod) -> Result { - self.base.get_json(&format!( - "/api/v1/mining/blocks/sizes-weights/{time_period}" - )) + self.base.get_json(&format!("/api/v1/mining/blocks/sizes-weights/{time_period}")) } /// Block by timestamp @@ -10476,8 +7011,7 @@ impl BrkClient { /// /// Endpoint: `GET /api/v1/mining/blocks/timestamp/{timestamp}` pub fn get_block_by_timestamp(&self, timestamp: Timestamp) -> Result { - self.base - .get_json(&format!("/api/v1/mining/blocks/timestamp/{timestamp}")) + self.base.get_json(&format!("/api/v1/mining/blocks/timestamp/{timestamp}")) } /// Difficulty adjustments (all time) @@ -10488,8 +7022,7 @@ impl BrkClient { /// /// Endpoint: `GET /api/v1/mining/difficulty-adjustments` pub fn get_difficulty_adjustments(&self) -> Result> { - self.base - .get_json(&format!("/api/v1/mining/difficulty-adjustments")) + self.base.get_json(&format!("/api/v1/mining/difficulty-adjustments")) } /// Difficulty adjustments @@ -10499,13 +7032,8 @@ impl BrkClient { /// *[Mempool.space docs](https://mempool.space/docs/api/rest#get-difficulty-adjustments)* /// /// Endpoint: `GET /api/v1/mining/difficulty-adjustments/{time_period}` - pub fn get_difficulty_adjustments_by_period( - &self, - time_period: TimePeriod, - ) -> Result> { - self.base.get_json(&format!( - "/api/v1/mining/difficulty-adjustments/{time_period}" - )) + pub fn get_difficulty_adjustments_by_period(&self, time_period: TimePeriod) -> Result> { + self.base.get_json(&format!("/api/v1/mining/difficulty-adjustments/{time_period}")) } /// Network hashrate (all time) @@ -10527,8 +7055,7 @@ impl BrkClient { /// /// Endpoint: `GET /api/v1/mining/hashrate/{time_period}` pub fn get_hashrate_by_period(&self, time_period: TimePeriod) -> Result { - self.base - .get_json(&format!("/api/v1/mining/hashrate/{time_period}")) + self.base.get_json(&format!("/api/v1/mining/hashrate/{time_period}")) } /// Mining pool details @@ -10561,8 +7088,7 @@ impl BrkClient { /// /// Endpoint: `GET /api/v1/mining/pools/{time_period}` pub fn get_pool_stats(&self, time_period: TimePeriod) -> Result { - self.base - .get_json(&format!("/api/v1/mining/pools/{time_period}")) + self.base.get_json(&format!("/api/v1/mining/pools/{time_period}")) } /// Mining reward statistics @@ -10573,8 +7099,7 @@ impl BrkClient { /// /// Endpoint: `GET /api/v1/mining/reward-stats/{block_count}` pub fn get_reward_stats(&self, block_count: i64) -> Result { - self.base - .get_json(&format!("/api/v1/mining/reward-stats/{block_count}")) + self.base.get_json(&format!("/api/v1/mining/reward-stats/{block_count}")) } /// Validate address @@ -10585,8 +7110,7 @@ impl BrkClient { /// /// Endpoint: `GET /api/v1/validate-address/{address}` pub fn validate_address(&self, address: &str) -> Result { - self.base - .get_json(&format!("/api/v1/validate-address/{address}")) + self.base.get_json(&format!("/api/v1/validate-address/{address}")) } /// Health check @@ -10615,4 +7139,5 @@ impl BrkClient { pub fn get_version(&self) -> Result { self.base.get_json(&format!("/version")) } + } diff --git a/crates/brk_computer/src/cointime/activity/compute.rs b/crates/brk_computer/src/cointime/activity/compute.rs index ce621ef87..ed00bd677 100644 --- a/crates/brk_computer/src/cointime/activity/compute.rs +++ b/crates/brk_computer/src/cointime/activity/compute.rs @@ -15,14 +15,8 @@ impl Vecs { ) -> Result<()> { let window_starts = blocks.count.window_starts(); - let circulating_supply = &distribution - .utxo_cohorts - .all - .metrics - .supply - .total - .sats - .height; + let all_metrics = &distribution.utxo_cohorts.all.metrics; + let circulating_supply = &all_metrics.supply.total.sats.height; self.coinblocks_created .compute(starting_indexes.height, &window_starts, exit, |vec| { @@ -35,12 +29,7 @@ impl Vecs { Ok(()) })?; - let coinblocks_destroyed = &distribution - .utxo_cohorts - .all - .metrics - .activity - .coinblocks_destroyed; + let coinblocks_destroyed = &all_metrics.activity.coinblocks_destroyed; self.coinblocks_stored .compute(starting_indexes.height, &window_starts, exit, |vec| { diff --git a/crates/brk_computer/src/cointime/cap/compute.rs b/crates/brk_computer/src/cointime/cap/compute.rs index 28677c3d9..45c4f1692 100644 --- a/crates/brk_computer/src/cointime/cap/compute.rs +++ b/crates/brk_computer/src/cointime/cap/compute.rs @@ -17,22 +17,9 @@ impl Vecs { value: &value::Vecs, exit: &Exit, ) -> Result<()> { - let realized_cap_cents = &distribution - .utxo_cohorts - .all - .metrics - .realized - .realized_cap_cents - .height; - - let circulating_supply = &distribution - .utxo_cohorts - .all - .metrics - .supply - .total - .btc - .height; + let all_metrics = &distribution.utxo_cohorts.all.metrics; + let realized_cap_cents = &all_metrics.realized.realized_cap_cents.height; + let circulating_supply = &all_metrics.supply.total.btc.height; self.thermo_cap.cents.height.compute_transform( starting_indexes.height, diff --git a/crates/brk_computer/src/cointime/pricing/compute.rs b/crates/brk_computer/src/cointime/pricing/compute.rs index 8c32bdc03..865823825 100644 --- a/crates/brk_computer/src/cointime/pricing/compute.rs +++ b/crates/brk_computer/src/cointime/pricing/compute.rs @@ -19,22 +19,9 @@ impl Vecs { cap: &cap::Vecs, exit: &Exit, ) -> Result<()> { - let circulating_supply = &distribution - .utxo_cohorts - .all - .metrics - .supply - .total - .btc - .height; - let realized_price = &distribution - .utxo_cohorts - .all - .metrics - .realized - .realized_price - .cents - .height; + let all_metrics = &distribution.utxo_cohorts.all.metrics; + let circulating_supply = &all_metrics.supply.total.btc.height; + let realized_price = &all_metrics.realized.realized_price.cents.height; self.vaulted_price.cents.height.compute_transform2( starting_indexes.height, diff --git a/crates/brk_computer/src/cointime/value/compute.rs b/crates/brk_computer/src/cointime/value/compute.rs index a7310fe4a..783aea688 100644 --- a/crates/brk_computer/src/cointime/value/compute.rs +++ b/crates/brk_computer/src/cointime/value/compute.rs @@ -18,28 +18,10 @@ impl Vecs { ) -> Result<()> { let window_starts = blocks.count.window_starts(); - let coinblocks_destroyed = &distribution - .utxo_cohorts - .all - .metrics - .activity - .coinblocks_destroyed; - - let coindays_destroyed = &distribution - .utxo_cohorts - .all - .metrics - .activity - .coindays_destroyed; - - let circulating_supply = &distribution - .utxo_cohorts - .all - .metrics - .supply - .total - .btc - .height; + let all_metrics = &distribution.utxo_cohorts.all.metrics; + let coinblocks_destroyed = &all_metrics.activity.coinblocks_destroyed; + let coindays_destroyed = &all_metrics.activity.coindays_destroyed; + let circulating_supply = &all_metrics.supply.total.btc.height; self.cointime_value_destroyed.compute( starting_indexes.height, diff --git a/crates/brk_computer/src/distribution/block/cohort/received.rs b/crates/brk_computer/src/distribution/block/cohort/received.rs index c4295808e..e36c2325d 100644 --- a/crates/brk_computer/src/distribution/block/cohort/received.rs +++ b/crates/brk_computer/src/distribution/block/cohort/received.rs @@ -19,6 +19,8 @@ pub(crate) fn process_received( empty_addr_count: &mut ByAddressType, activity_counts: &mut AddressTypeToActivityCounts, ) { + let mut aggregated: FxHashMap = FxHashMap::default(); + for (output_type, vec) in received_data.unwrap().into_iter() { if vec.is_empty() { continue; @@ -31,14 +33,13 @@ pub(crate) fn process_received( // Aggregate receives by address - each address processed exactly once // Track (total_value, output_count) for correct UTXO counting - let mut aggregated: FxHashMap = FxHashMap::default(); for (type_index, value) in vec { let entry = aggregated.entry(type_index).or_default(); entry.0 += value; entry.1 += 1; } - for (type_index, (total_value, output_count)) in aggregated { + for (type_index, (total_value, output_count)) in aggregated.drain() { let (addr_data, status) = lookup.get_or_create_for_receive(output_type, type_index); // Track receiving activity - each address in receive aggregation diff --git a/crates/brk_computer/src/distribution/block/cohort/sent.rs b/crates/brk_computer/src/distribution/block/cohort/sent.rs index 7f6ae9dba..f8dadcc58 100644 --- a/crates/brk_computer/src/distribution/block/cohort/sent.rs +++ b/crates/brk_computer/src/distribution/block/cohort/sent.rs @@ -40,9 +40,9 @@ pub(crate) fn process_sent( height_to_timestamp: &[Timestamp], current_height: Height, current_timestamp: Timestamp, + seen_senders: &mut ByAddressType>, ) -> Result<()> { - // Track unique senders per address type (simple set, no extra data needed) - let mut seen_senders: ByAddressType> = ByAddressType::default(); + seen_senders.values_mut().for_each(|set| set.clear()); for (receive_height, by_type) in sent_data.into_iter() { let prev_price = height_to_price[receive_height.to_usize()]; diff --git a/crates/brk_computer/src/distribution/block/utxo/inputs.rs b/crates/brk_computer/src/distribution/block/utxo/inputs.rs index 0a8fe79ee..6efe71ae0 100644 --- a/crates/brk_computer/src/distribution/block/utxo/inputs.rs +++ b/crates/brk_computer/src/distribution/block/utxo/inputs.rs @@ -62,15 +62,15 @@ pub(crate) fn process_inputs( .map(|local_idx| -> Result<_> { let txindex = txinindex_to_txindex[local_idx]; - let prev_height = *txinindex_to_prev_height.get(local_idx).unwrap(); - let value = *txinindex_to_value.get(local_idx).unwrap(); - let input_type = *txinindex_to_outputtype.get(local_idx).unwrap(); + let prev_height = txinindex_to_prev_height[local_idx]; + let value = txinindex_to_value[local_idx]; + let input_type = txinindex_to_outputtype[local_idx]; if input_type.is_not_address() { return Ok((prev_height, value, input_type, None)); } - let typeindex = *txinindex_to_typeindex.get(local_idx).unwrap(); + let typeindex = txinindex_to_typeindex[local_idx]; // Look up address data let addr_data_opt = load_uncached_address_data( diff --git a/crates/brk_computer/src/distribution/block/utxo/outputs.rs b/crates/brk_computer/src/distribution/block/utxo/outputs.rs index 30f6467d4..4d4b706b1 100644 --- a/crates/brk_computer/src/distribution/block/utxo/outputs.rs +++ b/crates/brk_computer/src/distribution/block/utxo/outputs.rs @@ -1,6 +1,7 @@ use brk_cohort::ByAddressType; use brk_error::Result; use brk_types::{FundedAddressData, Sats, TxIndex, TypeIndex}; +use rayon::prelude::*; use smallvec::SmallVec; use crate::distribution::{ @@ -47,7 +48,40 @@ pub(crate) fn process_outputs( ) -> Result { let output_count = txoutdata_vec.len(); - // Pre-allocate result structures + // Phase 1: Parallel address lookups (mmap reads) + let items: Vec<_> = (0..output_count) + .into_par_iter() + .map(|local_idx| -> Result<_> { + let txoutdata = &txoutdata_vec[local_idx]; + let value = txoutdata.value; + let output_type = txoutdata.outputtype; + + if output_type.is_not_address() { + return Ok((value, output_type, None)); + } + + let typeindex = txoutdata.typeindex; + let txindex = txoutindex_to_txindex[local_idx]; + + let addr_data_opt = load_uncached_address_data( + output_type, + typeindex, + first_addressindexes, + cache, + vr, + any_address_indexes, + addresses_data, + )?; + + Ok(( + value, + output_type, + Some((typeindex, txindex, value, addr_data_opt)), + )) + }) + .collect::>>()?; + + // Phase 2: Sequential accumulation let estimated_per_type = (output_count / 8).max(8); let mut transacted = Transacted::default(); let mut received_data = AddressTypeToVec::with_capacity(estimated_per_type); @@ -58,45 +92,26 @@ pub(crate) fn process_outputs( let mut txindex_vecs = AddressTypeToTypeIndexMap::>::with_capacity(estimated_per_type); - // Single pass: read from pre-collected vecs and accumulate - for (local_idx, txoutdata) in txoutdata_vec.iter().enumerate() { - let txindex = txoutindex_to_txindex[local_idx]; - let value = txoutdata.value; - let output_type = txoutdata.outputtype; - + for (value, output_type, addr_info) in items { transacted.iterate(value, output_type); - if output_type.is_not_address() { - continue; + if let Some((typeindex, txindex, value, addr_data_opt)) = addr_info { + received_data + .get_mut(output_type) + .unwrap() + .push((typeindex, value)); + + if let Some(addr_data) = addr_data_opt { + address_data.insert_for_type(output_type, typeindex, addr_data); + } + + txindex_vecs + .get_mut(output_type) + .unwrap() + .entry(typeindex) + .or_default() + .push(txindex); } - - let typeindex = txoutdata.typeindex; - - received_data - .get_mut(output_type) - .unwrap() - .push((typeindex, value)); - - let addr_data_opt = load_uncached_address_data( - output_type, - typeindex, - first_addressindexes, - cache, - vr, - any_address_indexes, - addresses_data, - )?; - - if let Some(addr_data) = addr_data_opt { - address_data.insert_for_type(output_type, typeindex, addr_data); - } - - txindex_vecs - .get_mut(output_type) - .unwrap() - .entry(typeindex) - .or_default() - .push(txindex); } Ok(OutputsResult { diff --git a/crates/brk_computer/src/distribution/cohorts/utxo/groups.rs b/crates/brk_computer/src/distribution/cohorts/utxo/groups.rs index 88a3fa6fc..9fd630a3b 100644 --- a/crates/brk_computer/src/distribution/cohorts/utxo/groups.rs +++ b/crates/brk_computer/src/distribution/cohorts/utxo/groups.rs @@ -1,27 +1,16 @@ -use std::{cmp::Reverse, collections::BinaryHeap, fs, path::Path}; +use std::path::Path; use brk_cohort::{ ByAgeRange, ByAmountRange, ByEpoch, ByGreatEqualAmount, ByLowerThanAmount, ByMaxAge, ByMinAge, - BySpendableType, ByYear, CohortContext, Filter, Filtered, TERM_NAMES, Term, + BySpendableType, ByYear, CohortContext, Filter, Term, }; use brk_error::Result; use brk_traversable::Traversable; -use brk_types::{ - BasisPoints16, Cents, CentsCompact, CostBasisDistribution, Date, Dollars, Height, Indexes, - Sats, Version, -}; +use brk_types::{Dollars, Height, Indexes, Version}; use rayon::prelude::*; -use vecdb::{ - AnyStoredVec, Database, Exit, ReadOnlyClone, ReadableVec, Rw, StorageMode, WritableVec, -}; +use vecdb::{AnyStoredVec, Database, Exit, ReadOnlyClone, ReadableVec, Rw, StorageMode}; -use crate::{ - blocks, - distribution::DynCohortVecs, - indexes, - internal::{PERCENTILES, PERCENTILES_LEN, compute_spot_percentile_rank}, - prices, -}; +use crate::{blocks, distribution::DynCohortVecs, indexes, prices}; use crate::distribution::metrics::{ AdjustedCohortMetrics, AllCohortMetrics, BasicCohortMetrics, CohortMetricsBase, @@ -34,9 +23,6 @@ use crate::distribution::state::UTXOCohortState; const VERSION: Version = Version::new(0); -/// Significant digits for cost basis prices (after rounding to dollars). -const COST_BASIS_PRICE_DIGITS: i32 = 5; - /// All UTXO cohorts organized by filter type. /// /// Each group uses a concrete metrics type matching its required features: @@ -63,6 +49,18 @@ pub struct UTXOCohorts { pub type_: BySpendableType>>, } +macro_rules! collect_separate { + ($self:expr, $method:ident, $trait_ref:ty) => {{ + let mut v: Vec<$trait_ref> = Vec::with_capacity(UTXOCohorts::SEPARATE_COHORT_CAPACITY); + v.extend($self.age_range.$method().map(|x| x as $trait_ref)); + v.extend($self.epoch.$method().map(|x| x as $trait_ref)); + v.extend($self.year.$method().map(|x| x as $trait_ref)); + v.extend($self.amount_range.$method().map(|x| x as $trait_ref)); + v.extend($self.type_.$method().map(|x| x as $trait_ref)); + v + }}; +} + impl UTXOCohorts { /// Import all UTXO cohorts from database. pub(crate) fn forced_import( @@ -236,54 +234,23 @@ impl UTXOCohorts { }) } + /// ~71 separate cohorts (21 age + 5 epoch + 18 year + 15 amount + 12 type) + const SEPARATE_COHORT_CAPACITY: usize = 80; + pub(crate) fn par_iter_separate_mut( &mut self, ) -> impl ParallelIterator { - let mut v: Vec<&mut dyn DynCohortVecs> = Vec::new(); - v.extend( - self.age_range - .iter_mut() - .map(|x| x as &mut dyn DynCohortVecs), - ); - v.extend(self.epoch.iter_mut().map(|x| x as &mut dyn DynCohortVecs)); - v.extend(self.year.iter_mut().map(|x| x as &mut dyn DynCohortVecs)); - v.extend( - self.amount_range - .iter_mut() - .map(|x| x as &mut dyn DynCohortVecs), - ); - v.extend(self.type_.iter_mut().map(|x| x as &mut dyn DynCohortVecs)); - v.into_par_iter() + collect_separate!(self, iter_mut, &mut dyn DynCohortVecs).into_par_iter() } /// Immutable iterator over all separate (stateful) cohorts. pub(crate) fn iter_separate(&self) -> impl Iterator { - let mut v: Vec<&dyn DynCohortVecs> = Vec::new(); - v.extend(self.age_range.iter().map(|x| x as &dyn DynCohortVecs)); - v.extend(self.epoch.iter().map(|x| x as &dyn DynCohortVecs)); - v.extend(self.year.iter().map(|x| x as &dyn DynCohortVecs)); - v.extend(self.amount_range.iter().map(|x| x as &dyn DynCohortVecs)); - v.extend(self.type_.iter().map(|x| x as &dyn DynCohortVecs)); - v.into_iter() + collect_separate!(self, iter, &dyn DynCohortVecs).into_iter() } /// Mutable iterator over all separate cohorts (non-parallel). pub(crate) fn iter_separate_mut(&mut self) -> impl Iterator { - let mut v: Vec<&mut dyn DynCohortVecs> = Vec::new(); - v.extend( - self.age_range - .iter_mut() - .map(|x| x as &mut dyn DynCohortVecs), - ); - v.extend(self.epoch.iter_mut().map(|x| x as &mut dyn DynCohortVecs)); - v.extend(self.year.iter_mut().map(|x| x as &mut dyn DynCohortVecs)); - v.extend( - self.amount_range - .iter_mut() - .map(|x| x as &mut dyn DynCohortVecs), - ); - v.extend(self.type_.iter_mut().map(|x| x as &mut dyn DynCohortVecs)); - v.into_iter() + collect_separate!(self, iter_mut, &mut dyn DynCohortVecs).into_iter() } pub(crate) fn compute_overlapping_vecs( @@ -310,13 +277,9 @@ impl UTXOCohorts { // sth: aggregate of matching age_range { let sth_filter = self.sth.metrics.filter().clone(); - let matching: Vec<_> = age_range + let sources_dyn: Vec<&dyn CohortMetricsBase> = age_range .iter() .filter(|v| sth_filter.includes(v.metrics.filter())) - .collect(); - - let sources_dyn: Vec<&dyn CohortMetricsBase> = matching - .iter() .map(|v| &v.metrics as &dyn CohortMetricsBase) .collect(); self.sth @@ -327,13 +290,9 @@ impl UTXOCohorts { // lth: aggregate of matching age_range { let lth_filter = self.lth.metrics.filter().clone(); - let matching: Vec<_> = age_range + let sources_dyn: Vec<&dyn CohortMetricsBase> = age_range .iter() .filter(|v| lth_filter.includes(v.metrics.filter())) - .collect(); - - let sources_dyn: Vec<&dyn CohortMetricsBase> = matching - .iter() .map(|v| &v.metrics as &dyn CohortMetricsBase) .collect(); self.lth @@ -343,54 +302,36 @@ impl UTXOCohorts { // min_age: base from matching age_range self.min_age - .iter_mut() - .collect::>() - .into_par_iter() + .par_iter_mut() .try_for_each(|vecs| -> Result<()> { let filter = vecs.metrics.filter().clone(); - let matching: Vec<_> = age_range + let sources_dyn: Vec<&dyn CohortMetricsBase> = age_range .iter() .filter(|v| filter.includes(v.metrics.filter())) - .collect(); - - let sources_dyn: Vec<&dyn CohortMetricsBase> = matching - .iter() .map(|v| &v.metrics as &dyn CohortMetricsBase) .collect(); vecs.metrics - .compute_base_from_others(starting_indexes, &sources_dyn, exit)?; - - Ok(()) + .compute_base_from_others(starting_indexes, &sources_dyn, exit) })?; // max_age: base + peak_regret from matching age_range self.max_age - .iter_mut() - .collect::>() - .into_par_iter() + .par_iter_mut() .try_for_each(|vecs| -> Result<()> { let filter = vecs.metrics.filter().clone(); - let matching: Vec<_> = age_range + let sources_dyn: Vec<&dyn CohortMetricsBase> = age_range .iter() .filter(|v| filter.includes(v.metrics.filter())) - .collect(); - - let sources_dyn: Vec<&dyn CohortMetricsBase> = matching - .iter() .map(|v| &v.metrics as &dyn CohortMetricsBase) .collect(); vecs.metrics - .compute_base_from_others(starting_indexes, &sources_dyn, exit)?; - - Ok(()) + .compute_base_from_others(starting_indexes, &sources_dyn, exit) })?; // ge_amount, lt_amount: base only from matching amount_range self.ge_amount - .iter_mut() - .chain(self.lt_amount.iter_mut()) - .collect::>() - .into_par_iter() + .par_iter_mut() + .chain(self.lt_amount.par_iter_mut()) .try_for_each(|vecs| { let filter = vecs.metrics.filter().clone(); let sources_dyn: Vec<&dyn CohortMetricsBase> = amount_range @@ -415,7 +356,7 @@ impl UTXOCohorts { ) -> Result<()> { // 1. Compute all metrics except net_sentiment (all cohorts via DynCohortVecs) { - let mut all: Vec<&mut dyn DynCohortVecs> = Vec::new(); + let mut all: Vec<&mut dyn DynCohortVecs> = Vec::with_capacity(Self::SEPARATE_COHORT_CAPACITY + 3); all.push(&mut self.all); all.push(&mut self.sth); all.push(&mut self.lth); @@ -708,7 +649,7 @@ impl UTXOCohorts { pub(crate) fn par_iter_vecs_mut( &mut self, ) -> impl ParallelIterator { - let mut vecs: Vec<&mut dyn AnyStoredVec> = Vec::new(); + let mut vecs: Vec<&mut dyn AnyStoredVec> = Vec::with_capacity(2048); vecs.extend(self.all.metrics.collect_all_vecs_mut()); vecs.extend(self.sth.metrics.collect_all_vecs_mut()); vecs.extend(self.lth.metrics.collect_all_vecs_mut()); @@ -777,229 +718,6 @@ impl UTXOCohorts { .try_for_each(|v| v.reset_cost_basis_data_if_needed()) } - /// Compute and push percentiles for aggregate cohorts (all, sth, lth). - pub(crate) fn truncate_push_aggregate_percentiles( - &mut self, - height: Height, - spot: Cents, - date_opt: Option, - states_path: &Path, - ) -> Result<()> { - // Collect (filter, entries, total_sats, total_usd) from age_range cohorts. - let age_range_data: Vec<_> = self - .age_range - .iter() - .filter_map(|sub| { - let state = sub.state.as_ref()?; - let mut total_sats: u64 = 0; - let mut total_usd: u128 = 0; - let entries: Vec<(Cents, Sats)> = state - .cost_basis_data_iter() - .map(|(price, &sats)| { - let sats_u64 = u64::from(sats); - let price_u128 = price.as_u128(); - total_sats += sats_u64; - total_usd += price_u128 * sats_u64 as u128; - (price, sats) - }) - .collect(); - Some((sub.filter().clone(), entries, total_sats, total_usd)) - }) - .collect(); - - // Build list of (filter, cost_basis_extended, cohort_name) for aggregate cohorts - struct AggregateTarget<'a> { - filter: Filter, - extended: &'a mut crate::distribution::metrics::CostBasisExtended, - cohort_name: Option<&'static str>, - } - - let mut targets = [ - AggregateTarget { - filter: self.all.metrics.filter().clone(), - extended: &mut self.all.metrics.cost_basis.extended, - cohort_name: Some("all"), - }, - AggregateTarget { - filter: self.sth.metrics.filter().clone(), - extended: &mut self.sth.metrics.cost_basis.extended, - cohort_name: Some(TERM_NAMES.short.id), - }, - AggregateTarget { - filter: self.lth.metrics.filter().clone(), - extended: &mut self.lth.metrics.cost_basis.extended, - cohort_name: Some(TERM_NAMES.long.id), - }, - ]; - - for target in targets.iter_mut() { - let filter = &target.filter; - - let mut total_sats: u64 = 0; - let mut total_usd: u128 = 0; - let relevant: Vec<_> = age_range_data - .iter() - .filter(|(sub_filter, _, _, _)| filter.includes(sub_filter)) - .map(|(_, entries, cohort_sats, cohort_usd)| { - total_sats += cohort_sats; - total_usd += cohort_usd; - entries - }) - .collect(); - - if total_sats == 0 { - let nan_prices = [Cents::ZERO; PERCENTILES_LEN]; - target - .extended - .percentiles - .truncate_push(height, &nan_prices)?; - target - .extended - .invested_capital - .truncate_push(height, &nan_prices)?; - target - .extended - .spot_cost_basis_percentile - .bps - .height - .truncate_push(height, BasisPoints16::ZERO)?; - target - .extended - .spot_invested_capital_percentile - .bps - .height - .truncate_push(height, BasisPoints16::ZERO)?; - continue; - } - - // K-way merge using min-heap - let mut heap: BinaryHeap> = BinaryHeap::new(); - for (cohort_idx, entries) in relevant.iter().enumerate() { - if !entries.is_empty() { - heap.push(Reverse((entries[0].0, cohort_idx, 0))); - } - } - - let sat_targets = PERCENTILES.map(|p| total_sats * u64::from(p) / 100); - let usd_targets = PERCENTILES.map(|p| total_usd * u128::from(p) / 100); - - let mut sat_result = [Cents::ZERO; PERCENTILES_LEN]; - let mut usd_result = [Cents::ZERO; PERCENTILES_LEN]; - - let mut cumsum_sats: u64 = 0; - let mut cumsum_usd: u128 = 0; - let mut sat_idx = 0; - let mut usd_idx = 0; - - let mut current_price: Option = None; - let mut sats_at_price: u64 = 0; - let mut usd_at_price: u128 = 0; - - let collect_merged = date_opt.is_some(); - let max_unique_prices = if collect_merged { - relevant.iter().map(|e| e.len()).max().unwrap_or(0) - } else { - 0 - }; - let mut merged: Vec<(CentsCompact, Sats)> = Vec::with_capacity(max_unique_prices); - - let mut finalize_price = |price: Cents, sats: u64, usd: u128| { - cumsum_sats += sats; - cumsum_usd += usd; - - if sat_idx < PERCENTILES_LEN || usd_idx < PERCENTILES_LEN { - while sat_idx < PERCENTILES_LEN && cumsum_sats >= sat_targets[sat_idx] { - sat_result[sat_idx] = price; - sat_idx += 1; - } - while usd_idx < PERCENTILES_LEN && cumsum_usd >= usd_targets[usd_idx] { - usd_result[usd_idx] = price; - usd_idx += 1; - } - } - - if collect_merged { - let rounded: CentsCompact = - price.round_to_dollar(COST_BASIS_PRICE_DIGITS).into(); - if let Some((last_price, last_sats)) = merged.last_mut() - && *last_price == rounded - { - *last_sats += Sats::from(sats); - } else { - merged.push((rounded, Sats::from(sats))); - } - } - }; - - while let Some(Reverse((price, cohort_idx, entry_idx))) = heap.pop() { - let entries = relevant[cohort_idx]; - let (_, amount) = entries[entry_idx]; - let amount_u64 = u64::from(amount); - let price_u128 = price.as_u128(); - - if let Some(prev_price) = current_price - && prev_price != price - { - finalize_price(prev_price, sats_at_price, usd_at_price); - sats_at_price = 0; - usd_at_price = 0; - } - - current_price = Some(price); - sats_at_price += amount_u64; - usd_at_price += price_u128 * amount_u64 as u128; - - let next_idx = entry_idx + 1; - if next_idx < entries.len() { - heap.push(Reverse((entries[next_idx].0, cohort_idx, next_idx))); - } - } - - if let Some(price) = current_price { - finalize_price(price, sats_at_price, usd_at_price); - } - - target - .extended - .percentiles - .truncate_push(height, &sat_result)?; - target - .extended - .invested_capital - .truncate_push(height, &usd_result)?; - - let rank = compute_spot_percentile_rank(&sat_result, spot); - target - .extended - .spot_cost_basis_percentile - .bps - .height - .truncate_push(height, rank)?; - let rank = compute_spot_percentile_rank(&usd_result, spot); - target - .extended - .spot_invested_capital_percentile - .bps - .height - .truncate_push(height, rank)?; - - // Write daily cost basis snapshot - if let Some(date) = date_opt - && let Some(cohort_name) = target.cohort_name - { - let dir = states_path.join(format!("utxo_{cohort_name}_cost_basis/by_date")); - fs::create_dir_all(&dir)?; - let path = dir.join(date.to_string()); - fs::write( - path, - CostBasisDistribution::serialize_iter(merged.into_iter())?, - )?; - } - } - - Ok(()) - } - /// Validate computed versions for all cohorts. pub(crate) fn validate_computed_versions(&mut self, base_version: Version) -> Result<()> { // Validate separate cohorts diff --git a/crates/brk_computer/src/distribution/cohorts/utxo/mod.rs b/crates/brk_computer/src/distribution/cohorts/utxo/mod.rs index ba23c4f16..88e7d0151 100644 --- a/crates/brk_computer/src/distribution/cohorts/utxo/mod.rs +++ b/crates/brk_computer/src/distribution/cohorts/utxo/mod.rs @@ -1,4 +1,5 @@ mod groups; +mod percentiles; mod receive; mod send; mod tick_tock; diff --git a/crates/brk_computer/src/distribution/cohorts/utxo/percentiles.rs b/crates/brk_computer/src/distribution/cohorts/utxo/percentiles.rs new file mode 100644 index 000000000..2a3bbe3c2 --- /dev/null +++ b/crates/brk_computer/src/distribution/cohorts/utxo/percentiles.rs @@ -0,0 +1,322 @@ +use std::{cmp::Reverse, collections::BinaryHeap, fs, path::Path}; + +use brk_cohort::{Filtered, TERM_NAMES}; +use brk_error::Result; +use brk_types::{ + BasisPoints16, Cents, CentsCompact, CostBasisDistribution, Date, Height, Sats, +}; +use vecdb::WritableVec; + +use crate::internal::{PERCENTILES, PERCENTILES_LEN, compute_spot_percentile_rank}; + +use crate::distribution::metrics::{CohortMetricsBase, CostBasisExtended}; + +use super::groups::UTXOCohorts; + +/// Significant digits for cost basis prices (after rounding to dollars). +const COST_BASIS_PRICE_DIGITS: i32 = 5; + +impl UTXOCohorts { + /// Compute and push percentiles for aggregate cohorts (all, sth, lth). + /// + /// Single K-way merge pass over all age_range cohorts computes percentiles + /// for all 3 targets simultaneously, since each cohort belongs to exactly + /// one of STH/LTH and always contributes to ALL. + /// + /// Uses BinaryHeap with direct BTreeMap iterators — O(log K) merge + /// with zero intermediate Vec allocation. + pub(crate) fn truncate_push_aggregate_percentiles( + &mut self, + height: Height, + spot: Cents, + date_opt: Option, + states_path: &Path, + ) -> Result<()> { + let collect_merged = date_opt.is_some(); + + // Phase 1: compute totals + merge. + // Scoped so age_range borrows release before push_target borrows self.all/sth/lth. + let targets = { + let sth_filter = self.sth.metrics.filter().clone(); + let mut totals = AllSthLth::<(u64, u128)>::default(); + + // Collect BTreeMap refs from age_range, skip empty, compute totals. + let maps: Vec<_> = self + .age_range + .iter() + .filter_map(|sub| { + let state = sub.state.as_ref()?; + let map = state.cost_basis_map(); + if map.is_empty() { + return None; + } + let is_sth = sth_filter.includes(sub.filter()); + let mut cs = 0u64; + let mut cu = 0u128; + for (&price, &sats) in map.iter() { + let s = u64::from(sats); + cs += s; + cu += price.as_u128() * s as u128; + } + totals.all.0 += cs; + totals.all.1 += cu; + let term = totals.term_mut(is_sth); + term.0 += cs; + term.1 += cu; + Some((map, is_sth)) + }) + .collect(); + + let cap = if collect_merged { + maps.iter().map(|(m, _)| m.len()).max().unwrap_or(0) + } else { + 0 + }; + let all_has_data = totals.all.0 > 0; + let mut targets = totals.map(|(sats, usd)| PercTarget::new(sats, usd, cap)); + + // K-way merge via BinaryHeap + BTreeMap iterators (no Vec copies) + if all_has_data { + let mut iters: Vec<_> = maps + .iter() + .map(|(map, is_sth)| (map.iter().peekable(), *is_sth)) + .collect(); + + let mut heap: BinaryHeap> = + BinaryHeap::with_capacity(iters.len()); + for (i, (iter, _)) in iters.iter_mut().enumerate() { + if let Some(&(&price, _)) = iter.peek() { + heap.push(Reverse((price, i))); + } + } + + let mut current_price: Option = None; + let mut early_exit = false; + + while let Some(Reverse((price, ci))) = heap.pop() { + let (ref mut iter, is_sth) = iters[ci]; + let (_, &sats) = iter.next().unwrap(); + let amount = u64::from(sats); + let usd = Cents::from(price).as_u128() * amount as u128; + + if let Some(prev) = current_price + && prev != price + { + targets + .for_each_mut(|t| t.finalize_price(prev.into(), collect_merged)); + if !collect_merged && targets.all_match(|t| t.done()) { + early_exit = true; + break; + } + } + + current_price = Some(price); + targets.all.accumulate(amount, usd); + targets.term_mut(is_sth).accumulate(amount, usd); + + if let Some(&(&next_price, _)) = iter.peek() { + heap.push(Reverse((next_price, ci))); + } + } + + if !early_exit + && let Some(price) = current_price + { + targets.for_each_mut(|t| t.finalize_price(price.into(), collect_merged)); + } + } + + targets + }; + + // Phase 2: push results (borrows self.all/sth/lth mutably) + push_target( + height, spot, date_opt, states_path, targets.all, + &mut self.all.metrics.cost_basis.extended, "all", + )?; + push_target( + height, spot, date_opt, states_path, targets.sth, + &mut self.sth.metrics.cost_basis.extended, TERM_NAMES.short.id, + )?; + push_target( + height, spot, date_opt, states_path, targets.lth, + &mut self.lth.metrics.cost_basis.extended, TERM_NAMES.long.id, + )?; + + Ok(()) + } +} + +struct AllSthLth { + all: T, + sth: T, + lth: T, +} + +impl Default for AllSthLth { + fn default() -> Self { + Self { + all: T::default(), + sth: T::default(), + lth: T::default(), + } + } +} + +impl AllSthLth { + fn term_mut(&mut self, is_sth: bool) -> &mut T { + if is_sth { &mut self.sth } else { &mut self.lth } + } + + fn map(self, mut f: impl FnMut(T) -> U) -> AllSthLth { + AllSthLth { + all: f(self.all), + sth: f(self.sth), + lth: f(self.lth), + } + } + + fn for_each_mut(&mut self, mut f: impl FnMut(&mut T)) { + f(&mut self.all); + f(&mut self.sth); + f(&mut self.lth); + } + + fn all_match(&self, mut f: impl FnMut(&T) -> bool) -> bool { + f(&self.all) && f(&self.sth) && f(&self.lth) + } +} + +struct PercTarget { + total_sats: u64, + total_usd: u128, + cum_sats: u64, + cum_usd: u128, + sat_idx: usize, + usd_idx: usize, + sat_targets: [u64; PERCENTILES_LEN], + usd_targets: [u128; PERCENTILES_LEN], + sat_result: [Cents; PERCENTILES_LEN], + usd_result: [Cents; PERCENTILES_LEN], + price_sats: u64, + price_usd: u128, + merged: Vec<(CentsCompact, Sats)>, +} + +impl PercTarget { + fn new(total_sats: u64, total_usd: u128, merged_cap: usize) -> Self { + Self { + sat_targets: if total_sats > 0 { + PERCENTILES.map(|p| total_sats * u64::from(p) / 100) + } else { + [0; PERCENTILES_LEN] + }, + usd_targets: if total_usd > 0 { + PERCENTILES.map(|p| total_usd * u128::from(p) / 100) + } else { + [0; PERCENTILES_LEN] + }, + total_sats, + total_usd, + cum_sats: 0, + cum_usd: 0, + sat_idx: 0, + usd_idx: 0, + sat_result: [Cents::ZERO; PERCENTILES_LEN], + usd_result: [Cents::ZERO; PERCENTILES_LEN], + price_sats: 0, + price_usd: 0, + merged: Vec::with_capacity(merged_cap), + } + } + + #[inline] + fn accumulate(&mut self, amount: u64, usd: u128) { + self.price_sats += amount; + self.price_usd += usd; + } + + fn finalize_price(&mut self, price: Cents, collect_merged: bool) { + if collect_merged && self.price_sats > 0 { + let rounded: CentsCompact = price.round_to_dollar(COST_BASIS_PRICE_DIGITS).into(); + if let Some((lp, ls)) = self.merged.last_mut() + && *lp == rounded + { + *ls += Sats::from(self.price_sats); + } else { + self.merged.push((rounded, Sats::from(self.price_sats))); + } + } + + self.cum_sats += self.price_sats; + self.cum_usd += self.price_usd; + if self.total_sats > 0 { + while self.sat_idx < PERCENTILES_LEN + && self.cum_sats >= self.sat_targets[self.sat_idx] + { + self.sat_result[self.sat_idx] = price; + self.sat_idx += 1; + } + } + if self.total_usd > 0 { + while self.usd_idx < PERCENTILES_LEN + && self.cum_usd >= self.usd_targets[self.usd_idx] + { + self.usd_result[self.usd_idx] = price; + self.usd_idx += 1; + } + } + self.price_sats = 0; + self.price_usd = 0; + } + + fn done(&self) -> bool { + (self.total_sats == 0 || self.sat_idx >= PERCENTILES_LEN) + && (self.total_usd == 0 || self.usd_idx >= PERCENTILES_LEN) + } +} + +#[allow(clippy::too_many_arguments)] +fn push_target( + height: Height, + spot: Cents, + date_opt: Option, + states_path: &Path, + target: PercTarget, + ext: &mut CostBasisExtended, + name: &str, +) -> Result<()> { + ext.percentiles.truncate_push(height, &target.sat_result)?; + ext.invested_capital + .truncate_push(height, &target.usd_result)?; + + let sat_rank = if target.total_sats > 0 { + compute_spot_percentile_rank(&target.sat_result, spot) + } else { + BasisPoints16::ZERO + }; + ext.spot_cost_basis_percentile + .bps + .height + .truncate_push(height, sat_rank)?; + + let usd_rank = if target.total_usd > 0 { + compute_spot_percentile_rank(&target.usd_result, spot) + } else { + BasisPoints16::ZERO + }; + ext.spot_invested_capital_percentile + .bps + .height + .truncate_push(height, usd_rank)?; + + if let Some(date) = date_opt { + let dir = states_path.join(format!("utxo_{name}_cost_basis/by_date")); + fs::create_dir_all(&dir)?; + fs::write( + dir.join(date.to_string()), + CostBasisDistribution::serialize_iter(target.merged.into_iter())?, + )?; + } + Ok(()) +} diff --git a/crates/brk_computer/src/distribution/cohorts/utxo/receive.rs b/crates/brk_computer/src/distribution/cohorts/utxo/receive.rs index b5c2ecc89..0b091d19c 100644 --- a/crates/brk_computer/src/distribution/cohorts/utxo/receive.rs +++ b/crates/brk_computer/src/distribution/cohorts/utxo/receive.rs @@ -1,4 +1,4 @@ -use brk_types::{Cents, Height, Timestamp}; +use brk_types::{CostBasisSnapshot, Cents, Height, Timestamp}; use vecdb::Rw; use crate::distribution::state::Transacted; @@ -23,25 +23,28 @@ impl UTXOCohorts { ) { let supply_state = received.spendable_supply; + // Pre-compute snapshot once for the 3 cohorts sharing the same supply_state + let snapshot = CostBasisSnapshot::from_utxo(price, &supply_state); + // New UTXOs go into up_to_1h, current epoch, and current year self.age_range .up_to_1h .state .as_mut() .unwrap() - .receive_utxo(&supply_state, price); + .receive_utxo_snapshot(&supply_state, &snapshot); self.epoch .mut_vec_from_height(height) .state .as_mut() .unwrap() - .receive_utxo(&supply_state, price); + .receive_utxo_snapshot(&supply_state, &snapshot); self.year .mut_vec_from_timestamp(timestamp) .state .as_mut() .unwrap() - .receive_utxo(&supply_state, price); + .receive_utxo_snapshot(&supply_state, &snapshot); // Update output type cohorts self.type_.iter_typed_mut().for_each(|(output_type, vecs)| { diff --git a/crates/brk_computer/src/distribution/cohorts/utxo/send.rs b/crates/brk_computer/src/distribution/cohorts/utxo/send.rs index 9e125b137..51efb03f3 100644 --- a/crates/brk_computer/src/distribution/cohorts/utxo/send.rs +++ b/crates/brk_computer/src/distribution/cohorts/utxo/send.rs @@ -4,7 +4,7 @@ use vecdb::{Rw, VecIndex}; use crate::distribution::{ compute::PriceRangeMax, - state::{BlockState, Transacted}, + state::{BlockState, CohortState, Transacted}, }; use super::groups::UTXOCohorts; @@ -50,47 +50,49 @@ impl UTXOCohorts { // This is the max price between receive and send heights let peak_price = price_range_max.max_between(receive_height, send_height); - // Update age range cohort (direct index lookup) - self.age_range - .get_mut(age) - .state - .as_mut() - .unwrap() - .send_utxo( - &sent.spendable_supply, - current_price, - prev_price, - peak_price, - age, - ); - - // Update epoch cohort (direct lookup by height) - self.epoch - .mut_vec_from_height(receive_height) - .state - .as_mut() - .unwrap() - .send_utxo( - &sent.spendable_supply, - current_price, - prev_price, - peak_price, - age, - ); - - // Update year cohort (direct lookup by timestamp) - self.year - .mut_vec_from_timestamp(block_state.timestamp) - .state - .as_mut() - .unwrap() - .send_utxo( - &sent.spendable_supply, - current_price, - prev_price, - peak_price, - age, - ); + // Pre-compute once for age_range, epoch, year (all share sent.spendable_supply) + if let Some(pre) = CohortState::precompute_send( + &sent.spendable_supply, + current_price, + prev_price, + peak_price, + age, + ) { + self.age_range + .get_mut(age) + .state + .as_mut() + .unwrap() + .send_utxo_precomputed(&sent.spendable_supply, &pre); + self.epoch + .mut_vec_from_height(receive_height) + .state + .as_mut() + .unwrap() + .send_utxo_precomputed(&sent.spendable_supply, &pre); + self.year + .mut_vec_from_timestamp(block_state.timestamp) + .state + .as_mut() + .unwrap() + .send_utxo_precomputed(&sent.spendable_supply, &pre); + } else if sent.spendable_supply.utxo_count > 0 { + // Zero-value UTXOs: just subtract supply + self.age_range.get_mut(age).state.as_mut().unwrap().supply -= + &sent.spendable_supply; + self.epoch + .mut_vec_from_height(receive_height) + .state + .as_mut() + .unwrap() + .supply -= &sent.spendable_supply; + self.year + .mut_vec_from_timestamp(block_state.timestamp) + .state + .as_mut() + .unwrap() + .supply -= &sent.spendable_supply; + } // Update output type cohorts sent.by_type diff --git a/crates/brk_computer/src/distribution/cohorts/utxo/tick_tock.rs b/crates/brk_computer/src/distribution/cohorts/utxo/tick_tock.rs index a0da35b3a..ca25557c4 100644 --- a/crates/brk_computer/src/distribution/cohorts/utxo/tick_tock.rs +++ b/crates/brk_computer/src/distribution/cohorts/utxo/tick_tock.rs @@ -1,5 +1,5 @@ use brk_cohort::AGE_BOUNDARIES; -use brk_types::{ONE_HOUR_IN_SEC, Timestamp}; +use brk_types::{CostBasisSnapshot, ONE_HOUR_IN_SEC, Timestamp}; use vecdb::Rw; use crate::distribution::state::BlockState; @@ -63,11 +63,13 @@ impl UTXOCohorts { // Move supply from younger cohort to older cohort for block_state in &chain_state[start_idx..end_idx] { + let snapshot = + CostBasisSnapshot::from_utxo(block_state.price, &block_state.supply); if let Some(state) = age_cohorts[boundary_idx].as_mut() { - state.decrement(&block_state.supply, block_state.price); + state.decrement_snapshot(&snapshot); } if let Some(state) = age_cohorts[boundary_idx + 1].as_mut() { - state.increment(&block_state.supply, block_state.price); + state.increment_snapshot(&snapshot); } } } diff --git a/crates/brk_computer/src/distribution/compute/block_loop.rs b/crates/brk_computer/src/distribution/compute/block_loop.rs index 550305aab..a394255e3 100644 --- a/crates/brk_computer/src/distribution/compute/block_loop.rs +++ b/crates/brk_computer/src/distribution/compute/block_loop.rs @@ -200,8 +200,9 @@ pub(crate) fn process_blocks( let mut cache = AddressCache::new(); debug!("AddressCache created, entering main loop"); - // Reusable hashsets for received addresses (avoid per-block allocation) + // Reusable hashsets (avoid per-block allocation) let mut received_addresses = ByAddressType::>::default(); + let mut seen_senders = ByAddressType::>::default(); // Track earliest chain_state modification from sends (for incremental supply_state writes) let mut min_supply_modified: Option = None; @@ -259,7 +260,7 @@ pub(crate) fn process_blocks( if input_count > 1 { txin_iters.collect_block_inputs(first_txinindex + 1, input_count - 1, height) } else { - (Vec::new(), Vec::new(), Vec::new(), Vec::new()) + (&[][..], &[][..], &[][..], &[][..]) }; // Process outputs and inputs in parallel with tick-tock @@ -274,7 +275,7 @@ pub(crate) fn process_blocks( // Process outputs (receive) process_outputs( txoutindex_to_txindex, - &txoutdata_vec, + txoutdata_vec, &first_addressindexes, &cache, &vr, @@ -288,10 +289,10 @@ pub(crate) fn process_blocks( process_inputs( input_count - 1, &txinindex_to_txindex[1..], // Skip coinbase - &input_values, - &input_outputtypes, - &input_typeindexes, - &input_prev_heights, + input_values, + input_outputtypes, + input_typeindexes, + input_prev_heights, &first_addressindexes, &cache, &vr, @@ -346,7 +347,7 @@ pub(crate) fn process_blocks( // Push current block state before processing cohort updates chain_state.push(BlockState { - supply: transacted.spendable_supply.clone(), + supply: transacted.spendable_supply, price: block_price, timestamp, }); @@ -396,6 +397,7 @@ pub(crate) fn process_blocks( height_to_timestamp_vec, height, timestamp, + &mut seen_senders, ) .unwrap(); }); @@ -510,15 +512,21 @@ fn push_cohort_states( height: Height, height_price: Cents, ) -> Result<()> { - utxo_cohorts.par_iter_separate_mut().try_for_each(|v| { - v.truncate_push(height)?; - v.compute_then_truncate_push_unrealized_states(height, height_price) - })?; - - address_cohorts.par_iter_separate_mut().try_for_each(|v| { - v.truncate_push(height)?; - v.compute_then_truncate_push_unrealized_states(height, height_price) - })?; - + let (r1, r2) = rayon::join( + || { + utxo_cohorts.par_iter_separate_mut().try_for_each(|v| { + v.truncate_push(height)?; + v.compute_then_truncate_push_unrealized_states(height, height_price) + }) + }, + || { + address_cohorts.par_iter_separate_mut().try_for_each(|v| { + v.truncate_push(height)?; + v.compute_then_truncate_push_unrealized_states(height, height_price) + }) + }, + ); + r1?; + r2?; Ok(()) } diff --git a/crates/brk_computer/src/distribution/compute/readers.rs b/crates/brk_computer/src/distribution/compute/readers.rs index 5a83cd977..c0c48db85 100644 --- a/crates/brk_computer/src/distribution/compute/readers.rs +++ b/crates/brk_computer/src/distribution/compute/readers.rs @@ -25,6 +25,7 @@ pub struct TxOutReaders<'a> { values_buf: Vec, outputtypes_buf: Vec, typeindexes_buf: Vec, + txoutdata_buf: Vec, } impl<'a> TxOutReaders<'a> { @@ -34,6 +35,7 @@ impl<'a> TxOutReaders<'a> { values_buf: Vec::new(), outputtypes_buf: Vec::new(), typeindexes_buf: Vec::new(), + txoutdata_buf: Vec::new(), } } @@ -42,7 +44,7 @@ impl<'a> TxOutReaders<'a> { &mut self, first_txoutindex: usize, output_count: usize, - ) -> Vec { + ) -> &[TxOutData] { let end = first_txoutindex + output_count; self.indexer.vecs.outputs.value.collect_range_into_at( first_txoutindex, @@ -60,25 +62,32 @@ impl<'a> TxOutReaders<'a> { &mut self.typeindexes_buf, ); - self.values_buf - .iter() - .zip(&self.outputtypes_buf) - .zip(&self.typeindexes_buf) - .map(|((&value, &outputtype), &typeindex)| TxOutData { - value, - outputtype, - typeindex, - }) - .collect() + self.txoutdata_buf.clear(); + self.txoutdata_buf.extend( + self.values_buf + .iter() + .zip(&self.outputtypes_buf) + .zip(&self.typeindexes_buf) + .map(|((&value, &outputtype), &typeindex)| TxOutData { + value, + outputtype, + typeindex, + }), + ); + &self.txoutdata_buf } } -/// Readers for txin vectors. Reuses outpoint buffer across blocks. +/// Readers for txin vectors. Reuses all buffers across blocks. pub struct TxInReaders<'a> { indexer: &'a Indexer, txins: &'a inputs::Vecs, txindex_to_height: &'a mut RangeMap, outpoints_buf: Vec, + values_buf: Vec, + prev_heights_buf: Vec, + outputtypes_buf: Vec, + typeindexes_buf: Vec, } impl<'a> TxInReaders<'a> { @@ -92,45 +101,45 @@ impl<'a> TxInReaders<'a> { txins, txindex_to_height, outpoints_buf: Vec::new(), + values_buf: Vec::new(), + prev_heights_buf: Vec::new(), + outputtypes_buf: Vec::new(), + typeindexes_buf: Vec::new(), } } - /// Collect input data for a block range using bulk reads. - /// Outpoint buffer is reused across blocks; returned vecs are fresh (caller-owned). + /// Collect input data for a block range using bulk reads with buffer reuse. pub(crate) fn collect_block_inputs( &mut self, first_txinindex: usize, input_count: usize, current_height: Height, - ) -> (Vec, Vec, Vec, Vec) { + ) -> (&[Sats], &[Height], &[OutputType], &[TypeIndex]) { let end = first_txinindex + input_count; - let values: Vec = self - .txins - .spent - .value - .collect_range_at(first_txinindex, end); + self.txins.spent.value.collect_range_into_at( + first_txinindex, + end, + &mut self.values_buf, + ); self.indexer.vecs.inputs.outpoint.collect_range_into_at( first_txinindex, end, &mut self.outpoints_buf, ); - let outputtypes: Vec = self - .indexer - .vecs - .inputs - .outputtype - .collect_range_at(first_txinindex, end); - let typeindexes: Vec = self - .indexer - .vecs - .inputs - .typeindex - .collect_range_at(first_txinindex, end); + self.indexer.vecs.inputs.outputtype.collect_range_into_at( + first_txinindex, + end, + &mut self.outputtypes_buf, + ); + self.indexer.vecs.inputs.typeindex.collect_range_into_at( + first_txinindex, + end, + &mut self.typeindexes_buf, + ); - let prev_heights: Vec = self - .outpoints_buf - .iter() - .map(|outpoint| { + self.prev_heights_buf.clear(); + self.prev_heights_buf.extend( + self.outpoints_buf.iter().map(|outpoint| { if outpoint.is_coinbase() { current_height } else { @@ -138,10 +147,15 @@ impl<'a> TxInReaders<'a> { .get(outpoint.txindex()) .unwrap_or(current_height) } - }) - .collect(); + }), + ); - (values, prev_heights, outputtypes, typeindexes) + ( + &self.values_buf, + &self.prev_heights_buf, + &self.outputtypes_buf, + &self.typeindexes_buf, + ) } } diff --git a/crates/brk_computer/src/distribution/compute/write.rs b/crates/brk_computer/src/distribution/compute/write.rs index 9ca1ff348..874f1b75d 100644 --- a/crates/brk_computer/src/distribution/compute/write.rs +++ b/crates/brk_computer/src/distribution/compute/write.rs @@ -70,7 +70,7 @@ pub(crate) fn write( vecs.supply_state .truncate_if_needed(Height::from(truncate_to))?; for block_state in &chain_state[truncate_to..] { - vecs.supply_state.push(block_state.supply.clone()); + vecs.supply_state.push(block_state.supply); } vecs.any_address_indexes diff --git a/crates/brk_computer/src/distribution/metrics/activity.rs b/crates/brk_computer/src/distribution/metrics/activity.rs index fb43807e1..61a474950 100644 --- a/crates/brk_computer/src/distribution/metrics/activity.rs +++ b/crates/brk_computer/src/distribution/metrics/activity.rs @@ -109,30 +109,19 @@ impl ActivityMetrics { others: &[&Self], exit: &Exit, ) -> Result<()> { - self.sent.base.sats.height.compute_sum_of_others( - starting_indexes.height, - &others - .iter() - .map(|v| &v.sent.base.sats.height) - .collect::>(), - exit, - )?; - self.satblocks_destroyed.compute_sum_of_others( - starting_indexes.height, - &others - .iter() - .map(|v| &v.satblocks_destroyed) - .collect::>(), - exit, - )?; - self.satdays_destroyed.compute_sum_of_others( - starting_indexes.height, - &others - .iter() - .map(|v| &v.satdays_destroyed) - .collect::>(), - exit, - )?; + macro_rules! sum_others { + ($($field:tt).+) => { + self.$($field).+.compute_sum_of_others( + starting_indexes.height, + &others.iter().map(|v| &v.$($field).+).collect::>(), + exit, + )? + }; + } + + sum_others!(sent.base.sats.height); + sum_others!(satblocks_destroyed); + sum_others!(satdays_destroyed); Ok(()) } diff --git a/crates/brk_computer/src/distribution/metrics/cohort/basic.rs b/crates/brk_computer/src/distribution/metrics/cohort/basic.rs index 4a2bb1248..27a3a3dc5 100644 --- a/crates/brk_computer/src/distribution/metrics/cohort/basic.rs +++ b/crates/brk_computer/src/distribution/metrics/cohort/basic.rs @@ -157,36 +157,22 @@ impl BasicCohortMetrics { others: &[&Self], exit: &Exit, ) -> Result<()> { - self.supply.compute_from_stateful( - starting_indexes, - &others.iter().map(|v| &*v.supply).collect::>(), - exit, - )?; - self.outputs.compute_from_stateful( - starting_indexes, - &others.iter().map(|v| &*v.outputs).collect::>(), - exit, - )?; - self.activity.compute_from_stateful( - starting_indexes, - &others.iter().map(|v| &*v.activity).collect::>(), - exit, - )?; - self.realized.compute_from_stateful( - starting_indexes, - &others.iter().map(|v| &*v.realized).collect::>(), - exit, - )?; - self.unrealized.compute_from_stateful( - starting_indexes, - &others.iter().map(|v| &*v.unrealized).collect::>(), - exit, - )?; - self.cost_basis.compute_from_stateful( - starting_indexes, - &others.iter().map(|v| &*v.cost_basis).collect::>(), - exit, - )?; + macro_rules! aggregate { + ($field:ident) => { + self.$field.compute_from_stateful( + starting_indexes, + &others.iter().map(|v| &*v.$field).collect::>(), + exit, + )? + }; + } + + aggregate!(supply); + aggregate!(outputs); + aggregate!(activity); + aggregate!(realized); + aggregate!(unrealized); + aggregate!(cost_basis); Ok(()) } } diff --git a/crates/brk_computer/src/distribution/metrics/mod.rs b/crates/brk_computer/src/distribution/metrics/mod.rs index 1ee6812c4..602f1a9a9 100644 --- a/crates/brk_computer/src/distribution/metrics/mod.rs +++ b/crates/brk_computer/src/distribution/metrics/mod.rs @@ -187,42 +187,22 @@ pub trait CohortMetricsBase: Send + Sync { where Self: Sized, { - self.supply_mut().compute_from_stateful( - starting_indexes, - &others.iter().map(|v| v.supply()).collect::>(), - exit, - )?; - self.outputs_mut().compute_from_stateful( - starting_indexes, - &others.iter().map(|v| v.outputs()).collect::>(), - exit, - )?; - self.activity_mut().compute_from_stateful( - starting_indexes, - &others.iter().map(|v| v.activity()).collect::>(), - exit, - )?; - self.realized_base_mut().compute_from_stateful( - starting_indexes, - &others.iter().map(|v| v.realized_base()).collect::>(), - exit, - )?; - self.unrealized_base_mut().compute_from_stateful( - starting_indexes, - &others - .iter() - .map(|v| v.unrealized_base()) - .collect::>(), - exit, - )?; - self.cost_basis_base_mut().compute_from_stateful( - starting_indexes, - &others - .iter() - .map(|v| v.cost_basis_base()) - .collect::>(), - exit, - )?; + macro_rules! aggregate { + ($self_mut:ident, $accessor:ident) => { + self.$self_mut().compute_from_stateful( + starting_indexes, + &others.iter().map(|v| v.$accessor()).collect::>(), + exit, + )? + }; + } + + aggregate!(supply_mut, supply); + aggregate!(outputs_mut, outputs); + aggregate!(activity_mut, activity); + aggregate!(realized_base_mut, realized_base); + aggregate!(unrealized_base_mut, unrealized_base); + aggregate!(cost_basis_base_mut, cost_basis_base); Ok(()) } } diff --git a/crates/brk_computer/src/distribution/metrics/realized/base.rs b/crates/brk_computer/src/distribution/metrics/realized/base.rs index 03e283277..ea70aadd7 100644 --- a/crates/brk_computer/src/distribution/metrics/realized/base.rs +++ b/crates/brk_computer/src/distribution/metrics/realized/base.rs @@ -233,21 +233,24 @@ impl RealizedBase { } pub(crate) fn min_stateful_height_len(&self) -> usize { - self.realized_cap - .height - .len() - .min(self.realized_profit.height.len()) - .min(self.realized_loss.height.len()) - .min(self.investor_price.cents.height.len()) - .min(self.cap_raw.len()) - .min(self.investor_cap_raw.len()) - .min(self.profit_value_created.height.len()) - .min(self.profit_value_destroyed.height.len()) - .min(self.loss_value_created.height.len()) - .min(self.loss_value_destroyed.height.len()) - .min(self.peak_regret.height.len()) - .min(self.sent_in_profit.base.sats.height.len()) - .min(self.sent_in_loss.base.sats.height.len()) + [ + self.realized_cap.height.len(), + self.realized_profit.height.len(), + self.realized_loss.height.len(), + self.investor_price.cents.height.len(), + self.cap_raw.len(), + self.investor_cap_raw.len(), + self.profit_value_created.height.len(), + self.profit_value_destroyed.height.len(), + self.loss_value_created.height.len(), + self.loss_value_destroyed.height.len(), + self.peak_regret.height.len(), + self.sent_in_profit.base.sats.height.len(), + self.sent_in_loss.base.sats.height.len(), + ] + .into_iter() + .min() + .unwrap() } pub(crate) fn truncate_push(&mut self, height: Height, state: &RealizedState) -> Result<()> { @@ -320,30 +323,19 @@ impl RealizedBase { others: &[&Self], exit: &Exit, ) -> Result<()> { - self.realized_cap_cents.height.compute_sum_of_others( - starting_indexes.height, - &others - .iter() - .map(|v| &v.realized_cap_cents.height) - .collect::>(), - exit, - )?; - self.realized_profit.height.compute_sum_of_others( - starting_indexes.height, - &others - .iter() - .map(|v| &v.realized_profit.height) - .collect::>(), - exit, - )?; - self.realized_loss.height.compute_sum_of_others( - starting_indexes.height, - &others - .iter() - .map(|v| &v.realized_loss.height) - .collect::>(), - exit, - )?; + macro_rules! sum_others { + ($($field:tt).+) => { + self.$($field).+.compute_sum_of_others( + starting_indexes.height, + &others.iter().map(|v| &v.$($field).+).collect::>(), + exit, + )? + }; + } + + sum_others!(realized_cap_cents.height); + sum_others!(realized_profit.height); + sum_others!(realized_loss.height); // Aggregate raw values for investor_price computation let investor_price_dep_version = others @@ -404,62 +396,13 @@ impl RealizedBase { self.investor_price.cents.height.write()?; } - self.profit_value_created.height.compute_sum_of_others( - starting_indexes.height, - &others - .iter() - .map(|v| &v.profit_value_created.height) - .collect::>(), - exit, - )?; - self.profit_value_destroyed.height.compute_sum_of_others( - starting_indexes.height, - &others - .iter() - .map(|v| &v.profit_value_destroyed.height) - .collect::>(), - exit, - )?; - self.loss_value_created.height.compute_sum_of_others( - starting_indexes.height, - &others - .iter() - .map(|v| &v.loss_value_created.height) - .collect::>(), - exit, - )?; - self.loss_value_destroyed.height.compute_sum_of_others( - starting_indexes.height, - &others - .iter() - .map(|v| &v.loss_value_destroyed.height) - .collect::>(), - exit, - )?; - self.peak_regret.height.compute_sum_of_others( - starting_indexes.height, - &others - .iter() - .map(|v| &v.peak_regret.height) - .collect::>(), - exit, - )?; - self.sent_in_profit.base.sats.height.compute_sum_of_others( - starting_indexes.height, - &others - .iter() - .map(|v| &v.sent_in_profit.base.sats.height) - .collect::>(), - exit, - )?; - self.sent_in_loss.base.sats.height.compute_sum_of_others( - starting_indexes.height, - &others - .iter() - .map(|v| &v.sent_in_loss.base.sats.height) - .collect::>(), - exit, - )?; + sum_others!(profit_value_created.height); + sum_others!(profit_value_destroyed.height); + sum_others!(loss_value_created.height); + sum_others!(loss_value_destroyed.height); + sum_others!(peak_regret.height); + sum_others!(sent_in_profit.base.sats.height); + sum_others!(sent_in_loss.base.sats.height); Ok(()) } diff --git a/crates/brk_computer/src/distribution/metrics/unrealized/base.rs b/crates/brk_computer/src/distribution/metrics/unrealized/base.rs index d56d75eec..326e9d915 100644 --- a/crates/brk_computer/src/distribution/metrics/unrealized/base.rs +++ b/crates/brk_computer/src/distribution/metrics/unrealized/base.rs @@ -186,60 +186,22 @@ impl UnrealizedBase { others: &[&Self], exit: &Exit, ) -> Result<()> { - self.supply_in_profit.sats.height.compute_sum_of_others( - starting_indexes.height, - &others - .iter() - .map(|v| &v.supply_in_profit.sats.height) - .collect::>(), - exit, - )?; - self.supply_in_loss.sats.height.compute_sum_of_others( - starting_indexes.height, - &others - .iter() - .map(|v| &v.supply_in_loss.sats.height) - .collect::>(), - exit, - )?; - self.unrealized_profit.cents.height.compute_sum_of_others( - starting_indexes.height, - &others - .iter() - .map(|v| &v.unrealized_profit.cents.height) - .collect::>(), - exit, - )?; - self.unrealized_loss.cents.height.compute_sum_of_others( - starting_indexes.height, - &others - .iter() - .map(|v| &v.unrealized_loss.cents.height) - .collect::>(), - exit, - )?; - self.invested_capital_in_profit - .cents - .height - .compute_sum_of_others( - starting_indexes.height, - &others - .iter() - .map(|v| &v.invested_capital_in_profit.cents.height) - .collect::>(), - exit, - )?; - self.invested_capital_in_loss - .cents - .height - .compute_sum_of_others( - starting_indexes.height, - &others - .iter() - .map(|v| &v.invested_capital_in_loss.cents.height) - .collect::>(), - exit, - )?; + macro_rules! sum_others { + ($($field:tt).+) => { + self.$($field).+.compute_sum_of_others( + starting_indexes.height, + &others.iter().map(|v| &v.$($field).+).collect::>(), + exit, + )? + }; + } + + sum_others!(supply_in_profit.sats.height); + sum_others!(supply_in_loss.sats.height); + sum_others!(unrealized_profit.cents.height); + sum_others!(unrealized_loss.cents.height); + sum_others!(invested_capital_in_profit.cents.height); + sum_others!(invested_capital_in_loss.cents.height); // Raw values for aggregation let start = self diff --git a/crates/brk_computer/src/distribution/state/cohort/base.rs b/crates/brk_computer/src/distribution/state/cohort/base.rs index 644c9c76b..6b9addba0 100644 --- a/crates/brk_computer/src/distribution/state/cohort/base.rs +++ b/crates/brk_computer/src/distribution/state/cohort/base.rs @@ -1,10 +1,20 @@ -use std::path::Path; +use std::{collections::BTreeMap, path::Path}; use brk_error::Result; -use brk_types::{Age, Cents, CentsSats, CostBasisSnapshot, Height, Sats, SupplyState}; +use brk_types::{Age, Cents, CentsCompact, CentsSats, CentsSquaredSats, CostBasisSnapshot, Height, Sats, SupplyState}; use super::super::cost_basis::{CostBasisData, Percentiles, RealizedState, UnrealizedState}; +pub struct SendPrecomputed { + pub sats: Sats, + pub prev_price: Cents, + pub age: Age, + pub current_ps: CentsSats, + pub prev_ps: CentsSats, + pub ath_ps: CentsSats, + pub prev_investor_cap: CentsSquaredSats, +} + pub struct CohortState { pub supply: SupplyState, pub realized: RealizedState, @@ -73,10 +83,6 @@ impl CohortState { self.realized.reset_single_iteration_values(); } - pub(crate) fn increment(&mut self, supply: &SupplyState, price: Cents) { - self.increment_snapshot(&CostBasisSnapshot::from_utxo(price, supply)); - } - pub(crate) fn increment_snapshot(&mut self, s: &CostBasisSnapshot) { self.supply += &s.supply_state; @@ -92,10 +98,6 @@ impl CohortState { } } - pub(crate) fn decrement(&mut self, supply: &SupplyState, price: Cents) { - self.decrement_snapshot(&CostBasisSnapshot::from_utxo(price, supply)); - } - pub(crate) fn decrement_snapshot(&mut self, s: &CostBasisSnapshot) { self.supply -= &s.supply_state; @@ -112,19 +114,27 @@ impl CohortState { } pub(crate) fn receive_utxo(&mut self, supply: &SupplyState, price: Cents) { + self.receive_utxo_snapshot(supply, &CostBasisSnapshot::from_utxo(price, supply)); + } + + /// Like receive_utxo but takes a pre-computed snapshot to avoid redundant multiplication + /// when the same supply/price is used across multiple cohorts. + pub(crate) fn receive_utxo_snapshot( + &mut self, + supply: &SupplyState, + snapshot: &CostBasisSnapshot, + ) { self.supply += supply; if supply.value > Sats::ZERO { - let sats = supply.value; + self.realized.receive(snapshot.realized_price, supply.value); - // Compute once using typed values - let price_sats = CentsSats::from_price_sats(price, sats); - let investor_cap = price_sats.to_investor_cap(price); - - self.realized.receive(price, sats); - - self.cost_basis_data - .increment(price, sats, price_sats, investor_cap); + self.cost_basis_data.increment( + snapshot.realized_price, + supply.value, + snapshot.price_sats, + snapshot.investor_cap, + ); } } @@ -160,6 +170,51 @@ impl CohortState { } } + /// Pre-computed values for send_utxo when the same supply/prices are shared + /// across multiple cohorts (age_range, epoch, year). + pub(crate) fn precompute_send( + supply: &SupplyState, + current_price: Cents, + prev_price: Cents, + ath: Cents, + age: Age, + ) -> Option { + if supply.utxo_count == 0 || supply.value == Sats::ZERO { + return None; + } + let sats = supply.value; + let current_ps = CentsSats::from_price_sats(current_price, sats); + let prev_ps = CentsSats::from_price_sats(prev_price, sats); + let ath_ps = CentsSats::from_price_sats(ath, sats); + let prev_investor_cap = prev_ps.to_investor_cap(prev_price); + Some(SendPrecomputed { + sats, + prev_price, + age, + current_ps, + prev_ps, + ath_ps, + prev_investor_cap, + }) + } + + pub(crate) fn send_utxo_precomputed( + &mut self, + supply: &SupplyState, + pre: &SendPrecomputed, + ) { + self.supply -= supply; + self.sent += pre.sats; + self.satblocks_destroyed += pre.age.satblocks_destroyed(pre.sats); + self.satdays_destroyed += pre.age.satdays_destroyed(pre.sats); + + self.realized + .send(pre.sats, pre.current_ps, pre.prev_ps, pre.ath_ps, pre.prev_investor_cap); + + self.cost_basis_data + .decrement(pre.prev_price, pre.sats, pre.prev_ps, pre.prev_investor_cap); + } + pub(crate) fn send_utxo( &mut self, supply: &SupplyState, @@ -168,33 +223,10 @@ impl CohortState { ath: Cents, age: Age, ) { - if supply.utxo_count == 0 { - return; - } - - self.supply -= supply; - - if supply.value > Sats::ZERO { - self.sent += supply.value; - self.satblocks_destroyed += age.satblocks_destroyed(supply.value); - self.satdays_destroyed += age.satdays_destroyed(supply.value); - - let cp = current_price; - let pp = prev_price; - let ath_price = ath; - let sats = supply.value; - - // Compute ONCE using typed values - let current_ps = CentsSats::from_price_sats(cp, sats); - let prev_ps = CentsSats::from_price_sats(pp, sats); - let ath_ps = CentsSats::from_price_sats(ath_price, sats); - let prev_investor_cap = prev_ps.to_investor_cap(pp); - - self.realized - .send(sats, current_ps, prev_ps, ath_ps, prev_investor_cap); - - self.cost_basis_data - .decrement(pp, sats, prev_ps, prev_investor_cap); + if let Some(pre) = Self::precompute_send(supply, current_price, prev_price, ath, age) { + self.send_utxo_precomputed(supply, &pre); + } else if supply.utxo_count > 0 { + self.supply -= supply; } } @@ -263,7 +295,7 @@ impl CohortState { self.cost_basis_data.write(height, cleanup) } - pub(crate) fn cost_basis_data_iter(&self) -> impl Iterator { - self.cost_basis_data.iter().map(|(k, v)| (k.into(), v)) + pub(crate) fn cost_basis_map(&self) -> &BTreeMap { + self.cost_basis_data.map() } } diff --git a/crates/brk_computer/src/distribution/state/cost_basis/data.rs b/crates/brk_computer/src/distribution/state/cost_basis/data.rs index 3408440c1..8669419a3 100644 --- a/crates/brk_computer/src/distribution/state/cost_basis/data.rs +++ b/crates/brk_computer/src/distribution/state/cost_basis/data.rs @@ -34,6 +34,8 @@ pub struct CostBasisData { percentiles_dirty: bool, cached_percentiles: Option, rounding_digits: Option, + /// Monotonically increasing counter, bumped on each apply_pending with actual changes. + generation: u64, } const STATE_TO_KEEP: usize = 10; @@ -49,6 +51,7 @@ impl CostBasisData { percentiles_dirty: true, cached_percentiles: None, rounding_digits: None, + generation: 0, } } @@ -93,15 +96,9 @@ impl CostBasisData { && self.pending_raw.investor_cap_dec == CentsSquaredSats::ZERO } - pub(crate) fn iter(&self) -> impl Iterator { + pub(crate) fn map(&self) -> &CostBasisMap { self.assert_pending_empty(); - self.state - .as_ref() - .unwrap() - .base - .map - .iter() - .map(|(&k, v)| (k, v)) + &self.state.as_ref().unwrap().base.map } pub(crate) fn is_empty(&self) -> bool { @@ -183,18 +180,14 @@ impl CostBasisData { } pub(crate) fn apply_pending(&mut self) { - if !self.pending.is_empty() { - self.percentiles_dirty = true; + if self.pending.is_empty() && self.pending_raw_is_zero() { + return; } + self.generation = self.generation.wrapping_add(1); + self.percentiles_dirty = true; + let map = &mut self.state.as_mut().unwrap().base.map; for (cents, (inc, dec)) in self.pending.drain() { - let entry = self - .state - .as_mut() - .unwrap() - .base - .map - .entry(cents) - .or_default(); + let entry = map.entry(cents).or_default(); *entry += inc; if *entry < dec { panic!( @@ -211,7 +204,7 @@ impl CostBasisData { } *entry -= dec; if *entry == Sats::ZERO { - self.state.as_mut().unwrap().base.map.remove(¢s); + map.remove(¢s); } } @@ -267,7 +260,8 @@ impl CostBasisData { if !self.percentiles_dirty { return self.cached_percentiles; } - self.cached_percentiles = Percentiles::compute(self.iter().map(|(k, &v)| (k, v))); + self.cached_percentiles = + Percentiles::compute_from_map(&self.state.as_ref().unwrap().base.map); self.percentiles_dirty = false; self.cached_percentiles } diff --git a/crates/brk_computer/src/distribution/state/cost_basis/percentiles.rs b/crates/brk_computer/src/distribution/state/cost_basis/percentiles.rs index d5ce601a1..73b9ed8f0 100644 --- a/crates/brk_computer/src/distribution/state/cost_basis/percentiles.rs +++ b/crates/brk_computer/src/distribution/state/cost_basis/percentiles.rs @@ -1,7 +1,9 @@ -use brk_types::{Cents, CentsCompact, Sats}; +use brk_types::Cents; use crate::internal::{PERCENTILES, PERCENTILES_LEN}; +use super::CostBasisMap; + #[derive(Clone, Copy, Debug)] pub struct Percentiles { /// Sat-weighted: percentiles by coin count @@ -11,19 +13,17 @@ pub struct Percentiles { } impl Percentiles { - /// Compute both sat-weighted and USD-weighted percentiles in a single pass. - /// Takes an iterator over (price, sats) pairs, assumed sorted by price ascending. - pub(crate) fn compute(iter: impl Iterator) -> Option { - // Collect to allow two passes: one for totals, one for percentiles - let entries: Vec<_> = iter.collect(); - if entries.is_empty() { + /// Compute both sat-weighted and USD-weighted percentiles in two passes over the BTreeMap. + /// Avoids intermediate Vec allocation by iterating the map directly. + pub(crate) fn compute_from_map(map: &CostBasisMap) -> Option { + if map.is_empty() { return None; } - // Compute totals + // First pass: compute totals let mut total_sats: u64 = 0; let mut total_usd: u128 = 0; - for &(cents, sats) in &entries { + for (¢s, &sats) in map.iter() { total_sats += u64::from(sats); total_usd += cents.as_u128() * sats.as_u128(); } @@ -32,6 +32,12 @@ impl Percentiles { return None; } + // Precompute targets to avoid repeated multiplication in the inner loop + let sat_targets: [u64; PERCENTILES_LEN] = + PERCENTILES.map(|p| total_sats * u64::from(p) / 100); + let usd_targets: [u128; PERCENTILES_LEN] = + PERCENTILES.map(|p| total_usd * u128::from(p) / 100); + let mut sat_weighted = [Cents::ZERO; PERCENTILES_LEN]; let mut usd_weighted = [Cents::ZERO; PERCENTILES_LEN]; let mut cumsum_sats: u64 = 0; @@ -39,20 +45,17 @@ impl Percentiles { let mut sat_idx = 0; let mut usd_idx = 0; - for (cents, sats) in entries { + // Second pass: compute percentiles + for (¢s, &sats) in map.iter() { cumsum_sats += u64::from(sats); cumsum_usd += cents.as_u128() * sats.as_u128(); - while sat_idx < PERCENTILES_LEN - && cumsum_sats >= total_sats * u64::from(PERCENTILES[sat_idx]) / 100 - { + while sat_idx < PERCENTILES_LEN && cumsum_sats >= sat_targets[sat_idx] { sat_weighted[sat_idx] = cents.into(); sat_idx += 1; } - while usd_idx < PERCENTILES_LEN - && cumsum_usd >= total_usd * u128::from(PERCENTILES[usd_idx]) / 100 - { + while usd_idx < PERCENTILES_LEN && cumsum_usd >= usd_targets[usd_idx] { usd_weighted[usd_idx] = cents.into(); usd_idx += 1; } diff --git a/crates/brk_computer/src/internal/aggregate/distribution.rs b/crates/brk_computer/src/internal/aggregate/distribution.rs index 2cad6fe9a..8c700665b 100644 --- a/crates/brk_computer/src/internal/aggregate/distribution.rs +++ b/crates/brk_computer/src/internal/aggregate/distribution.rs @@ -6,7 +6,9 @@ use vecdb::{ VecIndex, VecValue, Version, }; -use crate::internal::{ComputedVecValue, DistributionStats}; +use crate::internal::{ + ComputedVecValue, DistributionStats, compute_aggregations, compute_aggregations_nblock_window, +}; #[derive(Traversable)] pub struct Distribution { @@ -50,7 +52,7 @@ impl Distribution { where A: VecIndex + VecValue + brk_types::CheckedSub, { - crate::internal::compute_aggregations( + compute_aggregations( max_from, source, first_indexes, @@ -87,7 +89,7 @@ impl Distribution { where A: VecIndex + VecValue + brk_types::CheckedSub, { - crate::internal::compute_aggregations_nblock_window( + compute_aggregations_nblock_window( max_from, source, first_indexes, diff --git a/crates/brk_computer/src/internal/aggregate/full.rs b/crates/brk_computer/src/internal/aggregate/full.rs index 66c299bdd..577434427 100644 --- a/crates/brk_computer/src/internal/aggregate/full.rs +++ b/crates/brk_computer/src/internal/aggregate/full.rs @@ -6,7 +6,7 @@ use vecdb::{ VecIndex, VecValue, Version, }; -use crate::internal::ComputedVecValue; +use crate::internal::{ComputedVecValue, compute_aggregations}; use super::Distribution; @@ -43,7 +43,7 @@ impl Full { where A: VecIndex + VecValue + brk_types::CheckedSub, { - crate::internal::compute_aggregations( + compute_aggregations( max_from, source, first_indexes, diff --git a/crates/brk_computer/src/internal/algo/sliding_distribution.rs b/crates/brk_computer/src/internal/algo/sliding_distribution.rs index 62a41bc0e..c2e4417b9 100644 --- a/crates/brk_computer/src/internal/algo/sliding_distribution.rs +++ b/crates/brk_computer/src/internal/algo/sliding_distribution.rs @@ -68,11 +68,8 @@ where } else { 0 }; - let partial_values: Vec = values - .collect_range_at(range_start, end) - .into_iter() - .map(|a| f64::from(a)) - .collect(); + let mut partial_values: Vec = Vec::with_capacity(end - range_start); + values.for_each_range_at(range_start, end, |a: A| partial_values.push(f64::from(a))); let capacity = if skip > 0 && skip < end { let first_start = window_starts.collect_one_at(skip).unwrap().to_usize(); diff --git a/crates/brk_computer/src/internal/algo/sliding_median.rs b/crates/brk_computer/src/internal/algo/sliding_median.rs index 3be0282e6..b4045b576 100644 --- a/crates/brk_computer/src/internal/algo/sliding_median.rs +++ b/crates/brk_computer/src/internal/algo/sliding_median.rs @@ -45,11 +45,8 @@ where } else { 0 }; - let partial_values: Vec = values - .collect_range_at(range_start, end) - .into_iter() - .map(|a| f64::from(a)) - .collect(); + let mut partial_values: Vec = Vec::with_capacity(end - range_start); + values.for_each_range_at(range_start, end, |a: A| partial_values.push(f64::from(a))); let capacity = if skip > 0 && skip < end { let first_start = window_starts.collect_one_at(skip).unwrap().to_usize(); diff --git a/crates/brk_computer/src/internal/algo/sliding_window.rs b/crates/brk_computer/src/internal/algo/sliding_window.rs index c62346f8b..cb610aaa9 100644 --- a/crates/brk_computer/src/internal/algo/sliding_window.rs +++ b/crates/brk_computer/src/internal/algo/sliding_window.rs @@ -39,9 +39,8 @@ impl SortedBlocks { // Find the block where value belongs: first block whose max >= value let block_idx = self .blocks - .iter() - .position(|b| *b.last().unwrap() >= value) - .unwrap_or(self.blocks.len() - 1); + .partition_point(|b| *b.last().unwrap() < value) + .min(self.blocks.len() - 1); let block = &mut self.blocks[block_idx]; let pos = block.partition_point(|a| *a < value); diff --git a/crates/brk_computer/src/internal/algo/tdigest.rs b/crates/brk_computer/src/internal/algo/tdigest.rs index 38caf3fc6..a18b67b95 100644 --- a/crates/brk_computer/src/internal/algo/tdigest.rs +++ b/crates/brk_computer/src/internal/algo/tdigest.rs @@ -126,25 +126,26 @@ impl TDigest { return; } - let total: f64 = self.centroids.iter().map(|c| c.weight).sum(); - let mut merged: Vec = Vec::with_capacity(self.centroids.len()); + let total = self.count as f64; let mut cum = 0.0; + let mut write_idx = 0; - for c in &self.centroids { - if let Some(last) = merged.last_mut() { - let q = (cum + last.weight / 2.0) / total; - let limit = (4.0 * self.compression * q * (1.0 - q)).floor().max(1.0); - if last.weight + c.weight <= limit { - let new_weight = last.weight + c.weight; - last.mean = (last.mean * last.weight + c.mean * c.weight) / new_weight; - last.weight = new_weight; - continue; - } + for read_idx in 1..self.centroids.len() { + let c = self.centroids[read_idx]; + let last = &mut self.centroids[write_idx]; + let q = (cum + last.weight / 2.0) / total; + let limit = (4.0 * self.compression * q * (1.0 - q)).floor().max(1.0); + if last.weight + c.weight <= limit { + let new_weight = last.weight + c.weight; + last.mean = (last.mean * last.weight + c.mean * c.weight) / new_weight; + last.weight = new_weight; + } else { cum += last.weight; + write_idx += 1; + self.centroids[write_idx] = c; } - merged.push(*c); } - self.centroids = merged; + self.centroids.truncate(write_idx + 1); } /// Batch quantile query in a single pass. `qs` must be sorted ascending. @@ -167,7 +168,7 @@ impl TDigest { return; } - let total: f64 = self.centroids.iter().map(|c| c.weight).sum(); + let total = self.count as f64; let mut cum = 0.0; let mut ci = 0; diff --git a/crates/brk_computer/src/internal/from_height/percent.rs b/crates/brk_computer/src/internal/from_height/percent.rs index aa715728a..627aad382 100644 --- a/crates/brk_computer/src/internal/from_height/percent.rs +++ b/crates/brk_computer/src/internal/from_height/percent.rs @@ -33,20 +33,16 @@ impl PercentFromHeight { indexes: &indexes::Vecs, ) -> Result { let bps = ComputedFromHeight::forced_import(db, &format!("{name}_bps"), version, indexes)?; + let bps_clone = bps.height.read_only_boxed_clone(); let ratio = LazyFromHeight::from_computed::( &format!("{name}_ratio"), version, - bps.height.read_only_boxed_clone(), + bps_clone.clone(), &bps, ); - let percent = LazyFromHeight::from_computed::( - name, - version, - bps.height.read_only_boxed_clone(), - &bps, - ); + let percent = LazyFromHeight::from_computed::(name, version, bps_clone, &bps); Ok(Self { bps, diff --git a/crates/brk_computer/src/internal/from_height/ratio/extension.rs b/crates/brk_computer/src/internal/from_height/ratio/extension.rs index acda024c2..a2430e4f0 100644 --- a/crates/brk_computer/src/internal/from_height/ratio/extension.rs +++ b/crates/brk_computer/src/internal/from_height/ratio/extension.rs @@ -8,7 +8,7 @@ use vecdb::{ use crate::{ blocks, indexes, - internal::{ComputedFromHeightStdDevExtended, Price, TDigest}, + internal::{ComputedFromHeightStdDevExtended, Price, PriceTimesRatioBp32Cents, TDigest}, }; use super::{super::ComputedFromHeight, ComputedFromHeightRatio}; @@ -200,8 +200,6 @@ impl ComputedFromHeightRatioExtension { metric_price: &impl ReadableVec, exit: &Exit, ) -> Result<()> { - use crate::internal::PriceTimesRatioBp32Cents; - macro_rules! compute_band { ($usd_field:ident, $band_source:expr) => { self.$usd_field diff --git a/crates/brk_computer/src/internal/from_height/stddev/extended.rs b/crates/brk_computer/src/internal/from_height/stddev/extended.rs index b6a77d1d7..4828c74b3 100644 --- a/crates/brk_computer/src/internal/from_height/stddev/extended.rs +++ b/crates/brk_computer/src/internal/from_height/stddev/extended.rs @@ -6,9 +6,10 @@ use vecdb::{ WritableVec, }; -use crate::{blocks, indexes}; - -use crate::internal::{ComputedFromHeight, Price}; +use crate::{ + blocks, indexes, + internal::{ComputedFromHeight, Price, PriceTimesRatioCents}, +}; use super::ComputedFromHeightStdDev; @@ -172,8 +173,7 @@ impl ComputedFromHeightStdDevExtended { const MULTIPLIERS: [f32; 12] = [ 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, -0.5, -1.0, -1.5, -2.0, -2.5, -3.0, ]; - let band_vecs: Vec<_> = self.mut_band_height_vecs().collect(); - for (vec, mult) in band_vecs.into_iter().zip(MULTIPLIERS) { + for (vec, mult) in self.mut_band_height_vecs().zip(MULTIPLIERS) { for (offset, _) in source_data.iter().enumerate() { let index = start + offset; let average = sma_data[offset]; @@ -214,8 +214,6 @@ impl ComputedFromHeightStdDevExtended { metric_price: &impl ReadableVec, exit: &Exit, ) -> Result<()> { - use crate::internal::PriceTimesRatioCents; - macro_rules! compute_band { ($usd_field:ident, $band_source:expr) => { self.$usd_field diff --git a/crates/brk_computer/src/internal/from_height/stddev/mod.rs b/crates/brk_computer/src/internal/from_height/stddev/mod.rs index ee23d514a..c816ca2cb 100644 --- a/crates/brk_computer/src/internal/from_height/stddev/mod.rs +++ b/crates/brk_computer/src/internal/from_height/stddev/mod.rs @@ -52,6 +52,19 @@ impl ComputedFromHeightStdDev { exit: &Exit, source: &impl ReadableVec, ) -> Result<()> { + if self.days == usize::MAX { + self.sma + .height + .compute_sma_(starting_indexes.height, source, usize::MAX, exit, None)?; + self.sd.height.compute_expanding_sd( + starting_indexes.height, + source, + &self.sma.height, + exit, + )?; + return Ok(()); + } + let window_starts = blocks.count.start_vec(self.days); self.sma.height.compute_rolling_average( diff --git a/crates/brk_computer/src/market/dca/compute.rs b/crates/brk_computer/src/market/dca/compute.rs index ce901c9be..df0f28bc4 100644 --- a/crates/brk_computer/src/market/dca/compute.rs +++ b/crates/brk_computer/src/market/dca/compute.rs @@ -144,11 +144,10 @@ impl Vecs { } // Lump sum by period - returns (compute from lookback price) - let lookback_dca2 = lookback.price_lookback.as_dca_period(); for (returns, (lookback_price, _)) in self .period_lump_sum_return .iter_mut() - .zip(lookback_dca2.iter_with_days()) + .zip(lookback_dca.iter_with_days()) { returns.compute_binary::( starting_indexes.height, diff --git a/crates/brk_computer/src/market/indicators/compute.rs b/crates/brk_computer/src/market/indicators/compute.rs index 397dcbef4..a39494db8 100644 --- a/crates/brk_computer/src/market/indicators/compute.rs +++ b/crates/brk_computer/src/market/indicators/compute.rs @@ -2,35 +2,26 @@ use brk_error::Result; use brk_types::{BasisPoints16, Dollars, Indexes}; use vecdb::Exit; -use super::{super::range, Vecs}; -use crate::{ - blocks, distribution, - internal::{RatioDollarsBp32, Windows}, - mining, prices, transactions, +use super::{ + super::{moving_average, range, returns}, + Vecs, gini, macd, rsi, }; +use crate::{blocks, distribution, internal::RatioDollarsBp32, mining, prices, transactions}; -fn tf_multiplier(tf: &str) -> usize { - match tf { - "24h" => 1, - "1w" => 7, - "1m" => 30, - "1y" => 365, - _ => unreachable!(), - } -} +const TF_MULTIPLIERS: [usize; 4] = [1, 7, 30, 365]; impl Vecs { #[allow(clippy::too_many_arguments)] pub(crate) fn compute( &mut self, rewards: &mining::RewardsVecs, - returns: &super::super::returns::Vecs, + returns: &returns::Vecs, range: &range::Vecs, prices: &prices::Vecs, blocks: &blocks::Vecs, distribution: &distribution::Vecs, transactions: &transactions::Vecs, - moving_average: &super::super::moving_average::Vecs, + moving_average: &moving_average::Vecs, starting_indexes: &Indexes, exit: &Exit, ) -> Result<()> { @@ -72,22 +63,23 @@ impl Vecs { } // RSI per timeframe - for (tf, rsi_chain) in Windows::<()>::SUFFIXES + let return_sources = [ + &returns.price_return._24h.ratio.height, + &returns.price_return._1w.ratio.height, + &returns.price_return._1m.ratio.height, + &returns.price_return._1y.ratio.height, + ]; + for ((rsi_chain, ret), &m) in self + .rsi + .as_mut_array() .into_iter() - .zip(self.rsi.as_mut_array()) + .zip(return_sources) + .zip(&TF_MULTIPLIERS) { - let m = tf_multiplier(tf); - let returns_source = match tf { - "24h" => &returns.price_return._24h.ratio.height, - "1w" => &returns.price_return._1w.ratio.height, - "1m" => &returns.price_return._1m.ratio.height, - "1y" => &returns.price_return._1y.ratio.height, - _ => unreachable!(), - }; - super::rsi::compute( + rsi::compute( rsi_chain, blocks, - returns_source, + ret, 14 * m, 3 * m, starting_indexes, @@ -96,12 +88,8 @@ impl Vecs { } // MACD per timeframe - for (tf, macd_chain) in Windows::<()>::SUFFIXES - .into_iter() - .zip(self.macd.as_mut_array()) - { - let m = tf_multiplier(tf); - super::macd::compute( + for (macd_chain, &m) in self.macd.as_mut_array().into_iter().zip(&TF_MULTIPLIERS) { + macd::compute( macd_chain, blocks, prices, @@ -114,21 +102,22 @@ impl Vecs { } // Gini (per height) - super::gini::compute(&mut self.gini, distribution, starting_indexes, exit)?; + gini::compute(&mut self.gini, distribution, starting_indexes, exit)?; // NVT: market_cap / tx_volume_24h + let market_cap = &distribution + .utxo_cohorts + .all + .metrics + .supply + .total + .usd + .height; self.nvt .bps .compute_binary::( starting_indexes.height, - &distribution - .utxo_cohorts - .all - .metrics - .supply - .total - .usd - .height, + market_cap, &transactions.volume.sent_sum.rolling._24h.usd.height, exit, )?; diff --git a/crates/brk_computer/src/market/returns/compute.rs b/crates/brk_computer/src/market/returns/compute.rs index 81845b63f..674048a5e 100644 --- a/crates/brk_computer/src/market/returns/compute.rs +++ b/crates/brk_computer/src/market/returns/compute.rs @@ -46,24 +46,13 @@ impl Vecs { let _24h_price_return_ratio = &self.price_return._24h.ratio.height; - self.price_return_24h_sd_1w.compute_all( - blocks, - starting_indexes, - exit, - _24h_price_return_ratio, - )?; - self.price_return_24h_sd_1m.compute_all( - blocks, - starting_indexes, - exit, - _24h_price_return_ratio, - )?; - self.price_return_24h_sd_1y.compute_all( - blocks, - starting_indexes, - exit, - _24h_price_return_ratio, - )?; + for sd in [ + &mut self.price_return_24h_sd_1w, + &mut self.price_return_24h_sd_1m, + &mut self.price_return_24h_sd_1y, + ] { + sd.compute_all(blocks, starting_indexes, exit, _24h_price_return_ratio)?; + } // Downside returns: min(return, 0) self.price_downside_24h.compute_transform( @@ -77,24 +66,13 @@ impl Vecs { )?; // Downside deviation (SD of downside returns) - self.price_downside_24h_sd_1w.compute_all( - blocks, - starting_indexes, - exit, - &self.price_downside_24h, - )?; - self.price_downside_24h_sd_1m.compute_all( - blocks, - starting_indexes, - exit, - &self.price_downside_24h, - )?; - self.price_downside_24h_sd_1y.compute_all( - blocks, - starting_indexes, - exit, - &self.price_downside_24h, - )?; + for sd in [ + &mut self.price_downside_24h_sd_1w, + &mut self.price_downside_24h_sd_1m, + &mut self.price_downside_24h_sd_1y, + ] { + sd.compute_all(blocks, starting_indexes, exit, &self.price_downside_24h)?; + } Ok(()) } diff --git a/crates/brk_computer/src/market/volatility/compute.rs b/crates/brk_computer/src/market/volatility/compute.rs index 6a8abf2c0..af0ee1b66 100644 --- a/crates/brk_computer/src/market/volatility/compute.rs +++ b/crates/brk_computer/src/market/volatility/compute.rs @@ -30,78 +30,66 @@ impl Vecs { &self.price_volatility_1y.height, ), ] { - compute_ratio(&mut out.height, starting_indexes_height, ret, vol, exit)?; + compute_divided( + &mut out.height, + starting_indexes_height, + ret, + vol, + 1.0, + exit, + )?; } // Sortino ratios: returns / downside volatility (sd * sqrt(days)) - compute_sortino( - &mut self.price_sortino_1w.height, - starting_indexes_height, - &returns.price_return._1w.ratio.height, - &returns.price_downside_24h_sd_1w.sd.height, - 7.0_f32.sqrt(), - exit, - )?; - compute_sortino( - &mut self.price_sortino_1m.height, - starting_indexes_height, - &returns.price_return._1m.ratio.height, - &returns.price_downside_24h_sd_1m.sd.height, - 30.0_f32.sqrt(), - exit, - )?; - compute_sortino( - &mut self.price_sortino_1y.height, - starting_indexes_height, - &returns.price_return._1y.ratio.height, - &returns.price_downside_24h_sd_1y.sd.height, - 365.0_f32.sqrt(), - exit, - )?; + for (out, ret, sd, sqrt_days) in [ + ( + &mut self.price_sortino_1w, + &returns.price_return._1w.ratio.height, + &returns.price_downside_24h_sd_1w.sd.height, + 7.0_f32.sqrt(), + ), + ( + &mut self.price_sortino_1m, + &returns.price_return._1m.ratio.height, + &returns.price_downside_24h_sd_1m.sd.height, + 30.0_f32.sqrt(), + ), + ( + &mut self.price_sortino_1y, + &returns.price_return._1y.ratio.height, + &returns.price_downside_24h_sd_1y.sd.height, + 365.0_f32.sqrt(), + ), + ] { + compute_divided( + &mut out.height, + starting_indexes_height, + ret, + sd, + sqrt_days, + exit, + )?; + } Ok(()) } } -fn compute_ratio( +fn compute_divided( out: &mut EagerVec>, starting_indexes_height: Height, ret: &impl ReadableVec, - vol: &impl ReadableVec, + divisor: &impl ReadableVec, + divisor_scale: f32, exit: &Exit, ) -> Result<()> { out.compute_transform2( starting_indexes_height, ret, - vol, - |(h, ret, vol, ..)| { - let ratio = if *vol == 0.0 { 0.0 } else { *ret / *vol }; - (h, StoredF32::from(ratio)) - }, - exit, - )?; - Ok(()) -} - -fn compute_sortino( - out: &mut EagerVec>, - starting_indexes_height: Height, - ret: &impl ReadableVec, - sd: &impl ReadableVec, - sqrt_days: f32, - exit: &Exit, -) -> Result<()> { - out.compute_transform2( - starting_indexes_height, - ret, - sd, - |(h, ret, sd, ..)| { - let downside_vol = (*sd) * sqrt_days; - let ratio = if downside_vol == 0.0 { - 0.0 - } else { - (*ret) / downside_vol - }; + divisor, + |(h, ret, div, ..)| { + let denom = (*div) * divisor_scale; + let ratio = if denom == 0.0 { 0.0 } else { (*ret) / denom }; (h, StoredF32::from(ratio)) }, exit, diff --git a/crates/brk_computer/src/mining/hashrate/compute.rs b/crates/brk_computer/src/mining/hashrate/compute.rs index e9218922c..2f2cc8425 100644 --- a/crates/brk_computer/src/mining/hashrate/compute.rs +++ b/crates/brk_computer/src/mining/hashrate/compute.rs @@ -34,33 +34,15 @@ impl Vecs { exit, )?; - self.hash_rate_sma_1w.height.compute_rolling_average( - starting_indexes.height, - &count_vecs.height_1w_ago, - &self.hash_rate.height, - exit, - )?; - - self.hash_rate_sma_1m.height.compute_rolling_average( - starting_indexes.height, - &count_vecs.height_1m_ago, - &self.hash_rate.height, - exit, - )?; - - self.hash_rate_sma_2m.height.compute_rolling_average( - starting_indexes.height, - &count_vecs.height_2m_ago, - &self.hash_rate.height, - exit, - )?; - - self.hash_rate_sma_1y.height.compute_rolling_average( - starting_indexes.height, - &count_vecs.height_1y_ago, - &self.hash_rate.height, - exit, - )?; + let hash_rate = &self.hash_rate.height; + for (sma, window) in [ + (&mut self.hash_rate_sma_1w.height, &count_vecs.height_1w_ago), + (&mut self.hash_rate_sma_1m.height, &count_vecs.height_1m_ago), + (&mut self.hash_rate_sma_2m.height, &count_vecs.height_2m_ago), + (&mut self.hash_rate_sma_1y.height, &count_vecs.height_1y_ago), + ] { + sma.compute_rolling_average(starting_indexes.height, window, hash_rate, exit)?; + } self.hash_rate_ath.height.compute_all_time_high( starting_indexes.height, @@ -121,33 +103,26 @@ impl Vecs { exit, )?; - self.hash_price_ths_min.height.compute_all_time_low_( - starting_indexes.height, - &self.hash_price_ths.height, - exit, - true, - )?; - - self.hash_price_phs_min.height.compute_all_time_low_( - starting_indexes.height, - &self.hash_price_phs.height, - exit, - true, - )?; - - self.hash_value_ths_min.height.compute_all_time_low_( - starting_indexes.height, - &self.hash_value_ths.height, - exit, - true, - )?; - - self.hash_value_phs_min.height.compute_all_time_low_( - starting_indexes.height, - &self.hash_value_phs.height, - exit, - true, - )?; + for (min_vec, src_vec) in [ + ( + &mut self.hash_price_ths_min.height, + &self.hash_price_ths.height, + ), + ( + &mut self.hash_price_phs_min.height, + &self.hash_price_phs.height, + ), + ( + &mut self.hash_value_ths_min.height, + &self.hash_value_ths.height, + ), + ( + &mut self.hash_value_phs_min.height, + &self.hash_value_phs.height, + ), + ] { + min_vec.compute_all_time_low_(starting_indexes.height, src_vec, exit, true)?; + } self.hash_price_rebound .compute_binary::( diff --git a/crates/brk_computer/src/mining/rewards/compute.rs b/crates/brk_computer/src/mining/rewards/compute.rs index 1d797e506..331bfea4f 100644 --- a/crates/brk_computer/src/mining/rewards/compute.rs +++ b/crates/brk_computer/src/mining/rewards/compute.rs @@ -90,8 +90,7 @@ impl Vecs { ( height, coinbase.checked_sub(fees).unwrap_or_else(|| { - dbg!(height, coinbase, fees); - panic!() + panic!("coinbase {coinbase:?} < fees {fees:?} at {height:?}") }), ) }, diff --git a/crates/brk_computer/src/prices/compute.rs b/crates/brk_computer/src/prices/compute.rs index 254d0b576..17cf6fede 100644 --- a/crates/brk_computer/src/prices/compute.rs +++ b/crates/brk_computer/src/prices/compute.rs @@ -188,22 +188,19 @@ impl Vecs { .copied() .unwrap_or(TxIndex::from(total_txs)); + let next_out_first = out_firsts + .get(idx + 1) + .copied() + .unwrap_or(TxOutIndex::from(total_outputs)) + .to_usize(); let out_start = if first_txindex.to_usize() + 1 < next_first_txindex.to_usize() { let target = first_txindex.to_usize() + 1; txout_cursor.advance(target - txout_cursor.position()); txout_cursor.next().unwrap().to_usize() } else { - out_firsts - .get(idx + 1) - .copied() - .unwrap_or(TxOutIndex::from(total_outputs)) - .to_usize() + next_out_first }; - let out_end = out_firsts - .get(idx + 1) - .copied() - .unwrap_or(TxOutIndex::from(total_outputs)) - .to_usize(); + let out_end = next_out_first; indexer .vecs diff --git a/crates/brk_computer/src/supply/compute.rs b/crates/brk_computer/src/supply/compute.rs index 3db46c840..155b0f1f4 100644 --- a/crates/brk_computer/src/supply/compute.rs +++ b/crates/brk_computer/src/supply/compute.rs @@ -55,19 +55,20 @@ impl Vecs { exit, )?; + let realized_cap = &distribution + .utxo_cohorts + .all + .metrics + .realized + .realized_cap + .height; self.realized_cap_growth_rate .bps .height .compute_rolling_ratio_change( starting_indexes.height, &blocks.count.height_1y_ago, - &distribution - .utxo_cohorts - .all - .metrics - .realized - .realized_cap - .height, + realized_cap, exit, )?; diff --git a/crates/brk_types/src/basis_points_16.rs b/crates/brk_types/src/basis_points_16.rs index 66f4b7f92..28d001ca7 100644 --- a/crates/brk_types/src/basis_points_16.rs +++ b/crates/brk_types/src/basis_points_16.rs @@ -79,8 +79,9 @@ impl From for u16 { impl From for BasisPoints16 { #[inline] fn from(value: f32) -> Self { + let value = value.max(0.0); debug_assert!( - value >= 0.0 && value <= u16::MAX as f32 / 10000.0, + value <= u16::MAX as f32 / 10000.0, "f32 out of BasisPoints16 range: {value}" ); Self((value * 10000.0).round() as u16) @@ -92,8 +93,9 @@ impl From for BasisPoints16 { impl From for BasisPoints16 { #[inline] fn from(value: f64) -> Self { + let value = value.max(0.0); debug_assert!( - value >= 0.0 && value <= u16::MAX as f64 / 10000.0, + value <= u16::MAX as f64 / 10000.0, "f64 out of BasisPoints16 range: {value}" ); Self((value * 10000.0).round() as u16) diff --git a/crates/brk_types/src/fundedaddressdata.rs b/crates/brk_types/src/fundedaddressdata.rs index fa980903c..6fe673471 100644 --- a/crates/brk_types/src/fundedaddressdata.rs +++ b/crates/brk_types/src/fundedaddressdata.rs @@ -24,7 +24,7 @@ impl CostBasisSnapshot { let price_sats = CentsSats::from_price_sats(price, supply.value); Self { realized_price: price, - supply_state: supply.clone(), + supply_state: *supply, price_sats, investor_cap: price_sats.to_investor_cap(price), } diff --git a/crates/brk_types/src/supply_state.rs b/crates/brk_types/src/supply_state.rs index 37c0d105d..4da00ecd4 100644 --- a/crates/brk_types/src/supply_state.rs +++ b/crates/brk_types/src/supply_state.rs @@ -10,7 +10,7 @@ use vecdb::{Bytes, Formattable}; use crate::{CheckedSub, FundedAddressData, Sats}; /// Current supply state tracking UTXO count and total value -#[derive(Debug, Default, Clone, Serialize, Deserialize, JsonSchema)] +#[derive(Debug, Default, Clone, Copy, Serialize, Deserialize, JsonSchema)] pub struct SupplyState { /// Number of unspent transaction outputs pub utxo_count: u64, diff --git a/modules/brk-client/index.js b/modules/brk-client/index.js index 9ec4f0339..138fdde79 100644 --- a/modules/brk-client/index.js +++ b/modules/brk-client/index.js @@ -2587,10 +2587,10 @@ function createAverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90RollingSumPatter max: createMetricPattern18(client, _m(acc, 'max')), median: createMetricPattern18(client, _m(acc, 'median')), min: createMetricPattern18(client, _m(acc, 'min')), - pct10: createMetricPattern18(client, _m(acc, 'pct10')), - pct25: createMetricPattern18(client, _m(acc, 'pct25')), - pct75: createMetricPattern18(client, _m(acc, 'pct75')), - pct90: createMetricPattern18(client, _m(acc, 'pct90')), + pct10: createMetricPattern18(client, _m(acc, 'p10')), + pct25: createMetricPattern18(client, _m(acc, 'p25')), + pct75: createMetricPattern18(client, _m(acc, 'p75')), + pct90: createMetricPattern18(client, _m(acc, 'p90')), rolling: createAverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern(client, acc), sum: createMetricPattern18(client, _m(acc, 'sum')), }; @@ -2923,10 +2923,10 @@ function createAverageMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, acc) { max: createMetricPattern18(client, _m(acc, 'max')), median: createMetricPattern18(client, _m(acc, 'median')), min: createMetricPattern18(client, _m(acc, 'min')), - pct10: createMetricPattern18(client, _m(acc, 'pct10')), - pct25: createMetricPattern18(client, _m(acc, 'pct25')), - pct75: createMetricPattern18(client, _m(acc, 'pct75')), - pct90: createMetricPattern18(client, _m(acc, 'pct90')), + pct10: createMetricPattern18(client, _m(acc, 'p10')), + pct25: createMetricPattern18(client, _m(acc, 'p25')), + pct75: createMetricPattern18(client, _m(acc, 'p75')), + pct90: createMetricPattern18(client, _m(acc, 'p90')), }; } diff --git a/packages/brk_client/brk_client/__init__.py b/packages/brk_client/brk_client/__init__.py index 841a161bc..4008d53b5 100644 --- a/packages/brk_client/brk_client/__init__.py +++ b/packages/brk_client/brk_client/__init__.py @@ -2548,10 +2548,10 @@ class AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90RollingSumPattern: self.max: MetricPattern18[StoredU64] = MetricPattern18(client, _m(acc, 'max')) self.median: MetricPattern18[StoredU64] = MetricPattern18(client, _m(acc, 'median')) self.min: MetricPattern18[StoredU64] = MetricPattern18(client, _m(acc, 'min')) - self.pct10: MetricPattern18[StoredU64] = MetricPattern18(client, _m(acc, 'pct10')) - self.pct25: MetricPattern18[StoredU64] = MetricPattern18(client, _m(acc, 'pct25')) - self.pct75: MetricPattern18[StoredU64] = MetricPattern18(client, _m(acc, 'pct75')) - self.pct90: MetricPattern18[StoredU64] = MetricPattern18(client, _m(acc, 'pct90')) + self.pct10: MetricPattern18[StoredU64] = MetricPattern18(client, _m(acc, 'p10')) + self.pct25: MetricPattern18[StoredU64] = MetricPattern18(client, _m(acc, 'p25')) + self.pct75: MetricPattern18[StoredU64] = MetricPattern18(client, _m(acc, 'p75')) + self.pct90: MetricPattern18[StoredU64] = MetricPattern18(client, _m(acc, 'p90')) self.rolling: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern = AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern(client, acc) self.sum: MetricPattern18[StoredU64] = MetricPattern18(client, _m(acc, 'sum')) @@ -2700,10 +2700,10 @@ class AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern(Generic[T]): self.max: MetricPattern18[T] = MetricPattern18(client, _m(acc, 'max')) self.median: MetricPattern18[T] = MetricPattern18(client, _m(acc, 'median')) self.min: MetricPattern18[T] = MetricPattern18(client, _m(acc, 'min')) - self.pct10: MetricPattern18[T] = MetricPattern18(client, _m(acc, 'pct10')) - self.pct25: MetricPattern18[T] = MetricPattern18(client, _m(acc, 'pct25')) - self.pct75: MetricPattern18[T] = MetricPattern18(client, _m(acc, 'pct75')) - self.pct90: MetricPattern18[T] = MetricPattern18(client, _m(acc, 'pct90')) + self.pct10: MetricPattern18[T] = MetricPattern18(client, _m(acc, 'p10')) + self.pct25: MetricPattern18[T] = MetricPattern18(client, _m(acc, 'p25')) + self.pct75: MetricPattern18[T] = MetricPattern18(client, _m(acc, 'p75')) + self.pct90: MetricPattern18[T] = MetricPattern18(client, _m(acc, 'p90')) class _10y2y3y4y5y6y8yPattern: """Pattern struct for repeated tree structure."""