diff --git a/Cargo.lock b/Cargo.lock index a1f72530f..55c9b4d42 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -388,6 +388,7 @@ dependencies = [ "brk_cohort", "brk_query", "brk_types", + "indexmap", "oas3", "serde", "serde_json", @@ -658,6 +659,7 @@ version = "0.1.2" dependencies = [ "brk_traversable_derive", "brk_types", + "indexmap", "schemars", "serde", "serde_json", @@ -681,6 +683,7 @@ dependencies = [ "brk_error", "byteview", "derive_more", + "indexmap", "itoa", "jiff", "rapidhash", @@ -2432,9 +2435,9 @@ dependencies = [ [[package]] name = "rawdb" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bf9c16af7a93d15280ceb0d502657f9ec524cce61c946a1c98390740270820d" +checksum = "32158f67cfcd5359af3294b26cc4acbd8e412106ab1d6e470038b5284df362e7" dependencies = [ "libc", "log", @@ -3252,9 +3255,9 @@ checksum = "8f54a172d0620933a27a4360d3db3e2ae0dd6cceae9730751a036bbf182c4b23" [[package]] name = "vecdb" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66b361b0614c0d367441dcbc7c28a885b7b088a8d379e23ad845d81324f2c5f6" +checksum = "05c9f596e212ac69076b58735d340dd944f83531b5a83061020d4a922b73016d" dependencies = [ "ctrlc", "log", @@ -3273,9 +3276,9 @@ dependencies = [ [[package]] name = "vecdb_derive" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "962dfcd7fc848c27f6ee051cf1a4dfd55d72a37d443fb525268eff41da9cacf8" +checksum = "63c4ecf88e970a6275bad540fc68e022ed86987d817ef6711a7c57889aa2dfdf" dependencies = [ "quote", "syn", diff --git a/Cargo.toml b/Cargo.toml index 7181b6925..18299430f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -66,13 +66,14 @@ byteview = "0.10.0" color-eyre = "0.6.5" derive_more = { version = "2.1.1", features = ["deref", "deref_mut"] } fjall = "3.0.1" +indexmap = { version = "2.13.0", features = ["serde"] } jiff = { version = "0.2.18", features = ["perf-inline", "tz-system"], default-features = false } minreq = { version = "2.14.1", features = ["https", "json-using-serde"] } owo-colors = "4.2.3" parking_lot = "0.12.5" rayon = "1.11.0" rustc-hash = "2.1.1" -schemars = "1.2.0" +schemars = { version = "1.2.0", features = ["indexmap2"] } serde = "1.0.228" serde_bytes = "0.11.19" serde_derive = "1.0.228" @@ -82,7 +83,7 @@ tokio = { version = "1.49.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" -vecdb = { version = "0.6.3", features = ["derive", "serde_json", "pco", "schemars"] } +vecdb = { version = "0.6.4", features = ["derive", "serde_json", "pco", "schemars"] } # vecdb = { path = "../anydb/crates/vecdb", features = ["derive", "serde_json", "pco", "schemars"] } [workspace.metadata.release] diff --git a/crates/brk_bindgen/Cargo.toml b/crates/brk_bindgen/Cargo.toml index dec77bf70..b53a2dc81 100644 --- a/crates/brk_bindgen/Cargo.toml +++ b/crates/brk_bindgen/Cargo.toml @@ -11,6 +11,7 @@ repository.workspace = true brk_cohort = { workspace = true } brk_query = { workspace = true } brk_types = { workspace = true } +indexmap = { workspace = true } oas3 = "0.20" serde = { workspace = true } serde_json = { workspace = true } diff --git a/crates/brk_bindgen/src/analysis/patterns.rs b/crates/brk_bindgen/src/analysis/patterns.rs index b64cf18a5..5afadff55 100644 --- a/crates/brk_bindgen/src/analysis/patterns.rs +++ b/crates/brk_bindgen/src/analysis/patterns.rs @@ -50,7 +50,7 @@ pub fn detect_structural_patterns( BTreeMap, ) { let mut ctx = PatternContext::new(); - resolve_branch_patterns(tree, "root", &mut ctx); + resolve_branch_patterns(tree, &mut ctx); let (generic_patterns, generic_mappings, type_mappings) = detect_generic_patterns(&ctx.signature_to_pattern); @@ -249,17 +249,19 @@ fn replace_inner_type(type_str: &str, replacement: &str) -> String { /// Recursively resolve branch patterns bottom-up. fn resolve_branch_patterns( node: &TreeNode, - field_name: &str, ctx: &mut PatternContext, ) -> Option<(String, Vec)> { let TreeNode::Branch(children) = node else { return None; }; + // Convert to sorted BTreeMap for consistent pattern detection + let sorted_children: BTreeMap<_, _> = children.iter().collect(); + let mut fields: Vec = Vec::new(); let mut child_fields_vec: Vec> = Vec::new(); - for (child_name, child_node) in children { + for (child_name, child_node) in sorted_children { let (rust_type, json_type, indexes, child_fields) = match child_node { TreeNode::Leaf(leaf) => ( leaf.kind().to_string(), @@ -268,9 +270,8 @@ fn resolve_branch_patterns( Vec::new(), ), TreeNode::Branch(_) => { - let (pattern_name, child_pattern_fields) = - resolve_branch_patterns(child_node, child_name, ctx) - .unwrap_or_else(|| ("Unknown".to_string(), Vec::new())); + let (pattern_name, child_pattern_fields) = resolve_branch_patterns(child_node, ctx) + .unwrap_or_else(|| ("Unknown".to_string(), Vec::new())); ( pattern_name.clone(), pattern_name, @@ -289,7 +290,7 @@ fn resolve_branch_patterns( child_fields_vec.push(child_fields); } - fields.sort_by(|a, b| a.name.cmp(&b.name)); + // Fields are already sorted since we iterated over BTreeMap *ctx.signature_counts.entry(fields.clone()).or_insert(0) += 1; ctx.signature_to_child_fields @@ -300,10 +301,17 @@ fn resolve_branch_patterns( existing.clone() } else { let normalized = normalize_fields_for_naming(&fields); + // Generate stable name from first word of each field (deduped, sorted) + let first_words: BTreeSet = fields + .iter() + .filter_map(|f| f.name.split('_').next()) + .map(to_pascal_case) + .collect(); + let combined: String = first_words.into_iter().collect(); let name = ctx .normalized_to_name .entry(normalized) - .or_insert_with(|| generate_pattern_name(field_name, &mut ctx.name_counts)) + .or_insert_with(|| generate_pattern_name(&combined, &mut ctx.name_counts)) .clone(); ctx.signature_to_pattern .insert(fields.clone(), name.clone()); diff --git a/crates/brk_bindgen/src/analysis/tree.rs b/crates/brk_bindgen/src/analysis/tree.rs index ecfee4a5b..4ddd67eae 100644 --- a/crates/brk_bindgen/src/analysis/tree.rs +++ b/crates/brk_bindgen/src/analysis/tree.rs @@ -6,6 +6,7 @@ use std::collections::{BTreeMap, BTreeSet}; use brk_types::{Index, TreeNode, extract_json_type}; +use indexmap::IndexMap; use crate::{IndexSetPattern, PatternField, child_type_name}; @@ -26,8 +27,9 @@ fn get_shortest_leaf_name(node: &TreeNode) -> Option { } /// Get the field signature for a branch node's children. +/// Fields are sorted alphabetically for consistent pattern matching. pub fn get_node_fields( - children: &BTreeMap, + children: &IndexMap, pattern_lookup: &BTreeMap, String>, ) -> Vec { let mut fields: Vec = children @@ -57,6 +59,7 @@ pub fn get_node_fields( } }) .collect(); + // Sort for consistent pattern matching (display order preserved in IndexMap) fields.sort_by(|a, b| a.name.cmp(&b.name)); fields } @@ -298,7 +301,7 @@ pub fn infer_accumulated_name(parent_acc: &str, field_name: &str, descendant_lea /// Get fields with child field information for generic pattern lookup. pub fn get_fields_with_child_info( - children: &BTreeMap, + children: &IndexMap, parent_name: &str, pattern_lookup: &BTreeMap, String>, ) -> Vec<(PatternField, Option>)> { @@ -344,7 +347,6 @@ pub fn get_fields_with_child_info( mod tests { use super::*; use brk_types::{MetricLeaf, MetricLeafWithSchema, TreeNode}; - use std::collections::BTreeMap; fn make_leaf(name: &str) -> TreeNode { let leaf = MetricLeaf { @@ -356,7 +358,7 @@ mod tests { } fn make_branch(children: Vec<(&str, TreeNode)>) -> TreeNode { - let map: BTreeMap = children + let map: IndexMap = children .into_iter() .map(|(k, v)| (k.to_string(), v)) .collect(); diff --git a/crates/brk_client/examples/fetch_prices.rs b/crates/brk_client/examples/fetch_prices.rs index a3a2ca592..f9c4959c6 100644 --- a/crates/brk_client/examples/fetch_prices.rs +++ b/crates/brk_client/examples/fetch_prices.rs @@ -34,7 +34,7 @@ fn main() -> Result<()> { .fetch()?; for ohlc in ohlcs.data { - let avg = (*ohlc.open + *ohlc.close) / 2; + let avg = (u64::from(*ohlc.open) + u64::from(*ohlc.close)) / 2; let avg = Dollars::from(avg); writeln!(writer, "{avg}").map_err(|e| brk_client::BrkError { message: e.to_string(), diff --git a/crates/brk_client/src/lib.rs b/crates/brk_client/src/lib.rs index 0418290b5..217eaf9e1 100644 --- a/crates/brk_client/src/lib.rs +++ b/crates/brk_client/src/lib.rs @@ -858,28 +858,41 @@ impl MetricPattern for MetricPattern32 { fn get(&self // Reusable pattern structs /// Pattern struct for repeated tree structure. -pub struct RealizedPattern3 { +pub struct AdjustedAthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern { pub adjusted_sopr: MetricPattern6, pub adjusted_sopr_30d_ema: MetricPattern6, pub adjusted_sopr_7d_ema: MetricPattern6, pub adjusted_value_created: MetricPattern1, pub adjusted_value_destroyed: MetricPattern1, + pub ath_regret: CumulativeSumPattern, + pub cap_raw: MetricPattern11, + pub capitulation_flow: MetricPattern1, + pub investor_cap_raw: MetricPattern11, + pub investor_price: DollarsSatsPattern, + pub investor_price_cents: MetricPattern1, + pub investor_price_extra: RatioPattern, + pub loss_value_created: MetricPattern1, + pub loss_value_destroyed: MetricPattern1, pub mvrv: MetricPattern4, - pub neg_realized_loss: BitcoinPattern2, - pub net_realized_pnl: BlockCountPattern, + pub neg_realized_loss: CumulativeSumPattern2, + pub net_realized_pnl: CumulativeSumPattern, pub net_realized_pnl_cumulative_30d_delta: MetricPattern4, pub net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: MetricPattern4, pub net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: MetricPattern4, - pub net_realized_pnl_rel_to_realized_cap: BlockCountPattern, + pub net_realized_pnl_rel_to_realized_cap: CumulativeSumPattern, + pub profit_flow: MetricPattern1, + pub profit_value_created: MetricPattern1, + pub profit_value_destroyed: MetricPattern1, pub realized_cap: MetricPattern1, pub realized_cap_30d_delta: MetricPattern4, + pub realized_cap_cents: MetricPattern1, pub realized_cap_rel_to_own_market_cap: MetricPattern1, - pub realized_loss: BlockCountPattern, - pub realized_loss_rel_to_realized_cap: BlockCountPattern, - pub realized_price: ActivePricePattern, - pub realized_price_extra: ActivePriceRatioPattern, - pub realized_profit: BlockCountPattern, - pub realized_profit_rel_to_realized_cap: BlockCountPattern, + pub realized_loss: CumulativeSumPattern, + pub realized_loss_rel_to_realized_cap: CumulativeSumPattern, + pub realized_price: DollarsSatsPattern, + pub realized_price_extra: RatioPattern, + pub realized_profit: CumulativeSumPattern, + pub realized_profit_rel_to_realized_cap: CumulativeSumPattern, pub realized_profit_to_loss_ratio: MetricPattern6, pub realized_value: MetricPattern1, pub sell_side_risk_ratio: MetricPattern6, @@ -893,7 +906,7 @@ pub struct RealizedPattern3 { pub value_destroyed: MetricPattern1, } -impl RealizedPattern3 { +impl AdjustedAthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -902,22 +915,35 @@ impl RealizedPattern3 { adjusted_sopr_7d_ema: MetricPattern6::new(client.clone(), _m(&acc, "adjusted_sopr_7d_ema")), adjusted_value_created: MetricPattern1::new(client.clone(), _m(&acc, "adjusted_value_created")), adjusted_value_destroyed: MetricPattern1::new(client.clone(), _m(&acc, "adjusted_value_destroyed")), + ath_regret: CumulativeSumPattern::new(client.clone(), _m(&acc, "realized_ath_regret")), + cap_raw: MetricPattern11::new(client.clone(), _m(&acc, "cap_raw")), + capitulation_flow: MetricPattern1::new(client.clone(), _m(&acc, "capitulation_flow")), + investor_cap_raw: MetricPattern11::new(client.clone(), _m(&acc, "investor_cap_raw")), + investor_price: DollarsSatsPattern::new(client.clone(), _m(&acc, "investor_price")), + investor_price_cents: MetricPattern1::new(client.clone(), _m(&acc, "investor_price_cents")), + investor_price_extra: 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")), mvrv: MetricPattern4::new(client.clone(), _m(&acc, "mvrv")), - neg_realized_loss: BitcoinPattern2::new(client.clone(), _m(&acc, "neg_realized_loss")), - net_realized_pnl: BlockCountPattern::new(client.clone(), _m(&acc, "net_realized_pnl")), + neg_realized_loss: CumulativeSumPattern2::new(client.clone(), _m(&acc, "neg_realized_loss")), + net_realized_pnl: CumulativeSumPattern::new(client.clone(), _m(&acc, "net_realized_pnl")), net_realized_pnl_cumulative_30d_delta: MetricPattern4::new(client.clone(), _m(&acc, "net_realized_pnl_cumulative_30d_delta")), net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: MetricPattern4::new(client.clone(), _m(&acc, "net_realized_pnl_cumulative_30d_delta_rel_to_market_cap")), net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: MetricPattern4::new(client.clone(), _m(&acc, "net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap")), - net_realized_pnl_rel_to_realized_cap: BlockCountPattern::new(client.clone(), _m(&acc, "net_realized_pnl_rel_to_realized_cap")), + net_realized_pnl_rel_to_realized_cap: CumulativeSumPattern::new(client.clone(), _m(&acc, "net_realized_pnl_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")), realized_cap: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap")), realized_cap_30d_delta: MetricPattern4::new(client.clone(), _m(&acc, "realized_cap_30d_delta")), + realized_cap_cents: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap_cents")), realized_cap_rel_to_own_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap_rel_to_own_market_cap")), - realized_loss: BlockCountPattern::new(client.clone(), _m(&acc, "realized_loss")), - realized_loss_rel_to_realized_cap: BlockCountPattern::new(client.clone(), _m(&acc, "realized_loss_rel_to_realized_cap")), - realized_price: ActivePricePattern::new(client.clone(), _m(&acc, "realized_price")), - realized_price_extra: ActivePriceRatioPattern::new(client.clone(), _m(&acc, "realized_price_ratio")), - realized_profit: BlockCountPattern::new(client.clone(), _m(&acc, "realized_profit")), - realized_profit_rel_to_realized_cap: BlockCountPattern::new(client.clone(), _m(&acc, "realized_profit_rel_to_realized_cap")), + realized_loss: CumulativeSumPattern::new(client.clone(), _m(&acc, "realized_loss")), + realized_loss_rel_to_realized_cap: CumulativeSumPattern::new(client.clone(), _m(&acc, "realized_loss_rel_to_realized_cap")), + realized_price: DollarsSatsPattern::new(client.clone(), _m(&acc, "realized_price")), + realized_price_extra: RatioPattern::new(client.clone(), _m(&acc, "realized_price_ratio")), + realized_profit: CumulativeSumPattern::new(client.clone(), _m(&acc, "realized_profit")), + realized_profit_rel_to_realized_cap: CumulativeSumPattern::new(client.clone(), _m(&acc, "realized_profit_rel_to_realized_cap")), realized_profit_to_loss_ratio: MetricPattern6::new(client.clone(), _m(&acc, "realized_profit_to_loss_ratio")), realized_value: MetricPattern1::new(client.clone(), _m(&acc, "realized_value")), sell_side_risk_ratio: MetricPattern6::new(client.clone(), _m(&acc, "sell_side_risk_ratio")), @@ -934,27 +960,40 @@ impl RealizedPattern3 { } /// Pattern struct for repeated tree structure. -pub struct RealizedPattern4 { +pub struct AdjustedAthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern2 { pub adjusted_sopr: MetricPattern6, pub adjusted_sopr_30d_ema: MetricPattern6, pub adjusted_sopr_7d_ema: MetricPattern6, pub adjusted_value_created: MetricPattern1, pub adjusted_value_destroyed: MetricPattern1, + pub ath_regret: CumulativeSumPattern, + pub cap_raw: MetricPattern11, + pub capitulation_flow: MetricPattern1, + pub investor_cap_raw: MetricPattern11, + pub investor_price: DollarsSatsPattern, + pub investor_price_cents: MetricPattern1, + pub investor_price_extra: RatioPattern2, + pub loss_value_created: MetricPattern1, + pub loss_value_destroyed: MetricPattern1, pub mvrv: MetricPattern4, - pub neg_realized_loss: BitcoinPattern2, - pub net_realized_pnl: BlockCountPattern, + pub neg_realized_loss: CumulativeSumPattern2, + pub net_realized_pnl: CumulativeSumPattern, pub net_realized_pnl_cumulative_30d_delta: MetricPattern4, pub net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: MetricPattern4, pub net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: MetricPattern4, - pub net_realized_pnl_rel_to_realized_cap: BlockCountPattern, + pub net_realized_pnl_rel_to_realized_cap: CumulativeSumPattern, + pub profit_flow: MetricPattern1, + pub profit_value_created: MetricPattern1, + pub profit_value_destroyed: MetricPattern1, pub realized_cap: MetricPattern1, pub realized_cap_30d_delta: MetricPattern4, - pub realized_loss: BlockCountPattern, - pub realized_loss_rel_to_realized_cap: BlockCountPattern, - pub realized_price: ActivePricePattern, - pub realized_price_extra: RealizedPriceExtraPattern, - pub realized_profit: BlockCountPattern, - pub realized_profit_rel_to_realized_cap: BlockCountPattern, + pub realized_cap_cents: MetricPattern1, + pub realized_loss: CumulativeSumPattern, + pub realized_loss_rel_to_realized_cap: CumulativeSumPattern, + pub realized_price: DollarsSatsPattern, + pub realized_price_extra: RatioPattern2, + pub realized_profit: CumulativeSumPattern, + pub realized_profit_rel_to_realized_cap: CumulativeSumPattern, pub realized_value: MetricPattern1, pub sell_side_risk_ratio: MetricPattern6, pub sell_side_risk_ratio_30d_ema: MetricPattern6, @@ -967,7 +1006,7 @@ pub struct RealizedPattern4 { pub value_destroyed: MetricPattern1, } -impl RealizedPattern4 { +impl AdjustedAthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern2 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -976,21 +1015,34 @@ impl RealizedPattern4 { adjusted_sopr_7d_ema: MetricPattern6::new(client.clone(), _m(&acc, "adjusted_sopr_7d_ema")), adjusted_value_created: MetricPattern1::new(client.clone(), _m(&acc, "adjusted_value_created")), adjusted_value_destroyed: MetricPattern1::new(client.clone(), _m(&acc, "adjusted_value_destroyed")), + ath_regret: CumulativeSumPattern::new(client.clone(), _m(&acc, "realized_ath_regret")), + cap_raw: MetricPattern11::new(client.clone(), _m(&acc, "cap_raw")), + capitulation_flow: MetricPattern1::new(client.clone(), _m(&acc, "capitulation_flow")), + investor_cap_raw: MetricPattern11::new(client.clone(), _m(&acc, "investor_cap_raw")), + investor_price: DollarsSatsPattern::new(client.clone(), _m(&acc, "investor_price")), + investor_price_cents: MetricPattern1::new(client.clone(), _m(&acc, "investor_price_cents")), + investor_price_extra: RatioPattern2::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")), mvrv: MetricPattern4::new(client.clone(), _m(&acc, "mvrv")), - neg_realized_loss: BitcoinPattern2::new(client.clone(), _m(&acc, "neg_realized_loss")), - net_realized_pnl: BlockCountPattern::new(client.clone(), _m(&acc, "net_realized_pnl")), + neg_realized_loss: CumulativeSumPattern2::new(client.clone(), _m(&acc, "neg_realized_loss")), + net_realized_pnl: CumulativeSumPattern::new(client.clone(), _m(&acc, "net_realized_pnl")), net_realized_pnl_cumulative_30d_delta: MetricPattern4::new(client.clone(), _m(&acc, "net_realized_pnl_cumulative_30d_delta")), net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: MetricPattern4::new(client.clone(), _m(&acc, "net_realized_pnl_cumulative_30d_delta_rel_to_market_cap")), net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: MetricPattern4::new(client.clone(), _m(&acc, "net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap")), - net_realized_pnl_rel_to_realized_cap: BlockCountPattern::new(client.clone(), _m(&acc, "net_realized_pnl_rel_to_realized_cap")), + net_realized_pnl_rel_to_realized_cap: CumulativeSumPattern::new(client.clone(), _m(&acc, "net_realized_pnl_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")), realized_cap: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap")), realized_cap_30d_delta: MetricPattern4::new(client.clone(), _m(&acc, "realized_cap_30d_delta")), - realized_loss: BlockCountPattern::new(client.clone(), _m(&acc, "realized_loss")), - realized_loss_rel_to_realized_cap: BlockCountPattern::new(client.clone(), _m(&acc, "realized_loss_rel_to_realized_cap")), - realized_price: ActivePricePattern::new(client.clone(), _m(&acc, "realized_price")), - realized_price_extra: RealizedPriceExtraPattern::new(client.clone(), _m(&acc, "realized_price_ratio")), - realized_profit: BlockCountPattern::new(client.clone(), _m(&acc, "realized_profit")), - realized_profit_rel_to_realized_cap: BlockCountPattern::new(client.clone(), _m(&acc, "realized_profit_rel_to_realized_cap")), + realized_cap_cents: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap_cents")), + realized_loss: CumulativeSumPattern::new(client.clone(), _m(&acc, "realized_loss")), + realized_loss_rel_to_realized_cap: CumulativeSumPattern::new(client.clone(), _m(&acc, "realized_loss_rel_to_realized_cap")), + realized_price: DollarsSatsPattern::new(client.clone(), _m(&acc, "realized_price")), + realized_price_extra: RatioPattern2::new(client.clone(), _m(&acc, "realized_price_ratio")), + realized_profit: CumulativeSumPattern::new(client.clone(), _m(&acc, "realized_profit")), + realized_profit_rel_to_realized_cap: CumulativeSumPattern::new(client.clone(), _m(&acc, "realized_profit_rel_to_realized_cap")), realized_value: MetricPattern1::new(client.clone(), _m(&acc, "realized_value")), sell_side_risk_ratio: MetricPattern6::new(client.clone(), _m(&acc, "sell_side_risk_ratio")), sell_side_risk_ratio_30d_ema: MetricPattern6::new(client.clone(), _m(&acc, "sell_side_risk_ratio_30d_ema")), @@ -1006,66 +1058,246 @@ impl RealizedPattern4 { } /// Pattern struct for repeated tree structure. -pub struct Ratio1ySdPattern { - pub _0sd_usd: _0sdUsdPattern, +pub struct AthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern2 { + pub ath_regret: CumulativeSumPattern, + pub cap_raw: MetricPattern11, + pub capitulation_flow: MetricPattern1, + pub investor_cap_raw: MetricPattern11, + pub investor_price: DollarsSatsPattern, + pub investor_price_cents: MetricPattern1, + pub investor_price_extra: RatioPattern, + pub loss_value_created: MetricPattern1, + pub loss_value_destroyed: MetricPattern1, + pub mvrv: MetricPattern4, + pub neg_realized_loss: CumulativeSumPattern2, + pub net_realized_pnl: CumulativeSumPattern, + pub net_realized_pnl_cumulative_30d_delta: MetricPattern4, + pub net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: MetricPattern4, + pub net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: MetricPattern4, + pub net_realized_pnl_rel_to_realized_cap: CumulativeSumPattern, + pub profit_flow: MetricPattern1, + pub profit_value_created: MetricPattern1, + pub profit_value_destroyed: MetricPattern1, + pub realized_cap: MetricPattern1, + pub realized_cap_30d_delta: MetricPattern4, + pub realized_cap_cents: MetricPattern1, + pub realized_cap_rel_to_own_market_cap: MetricPattern1, + pub realized_loss: CumulativeSumPattern, + pub realized_loss_rel_to_realized_cap: CumulativeSumPattern, + pub realized_price: DollarsSatsPattern, + pub realized_price_extra: RatioPattern, + pub realized_profit: CumulativeSumPattern, + pub realized_profit_rel_to_realized_cap: CumulativeSumPattern, + pub realized_profit_to_loss_ratio: MetricPattern6, + pub realized_value: MetricPattern1, + pub sell_side_risk_ratio: MetricPattern6, + pub sell_side_risk_ratio_30d_ema: MetricPattern6, + pub sell_side_risk_ratio_7d_ema: MetricPattern6, + pub sopr: MetricPattern6, + pub sopr_30d_ema: MetricPattern6, + pub sopr_7d_ema: MetricPattern6, + pub total_realized_pnl: MetricPattern1, + pub value_created: MetricPattern1, + pub value_destroyed: MetricPattern1, +} + +impl AthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern2 { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + ath_regret: CumulativeSumPattern::new(client.clone(), _m(&acc, "realized_ath_regret")), + cap_raw: MetricPattern11::new(client.clone(), _m(&acc, "cap_raw")), + capitulation_flow: MetricPattern1::new(client.clone(), _m(&acc, "capitulation_flow")), + investor_cap_raw: MetricPattern11::new(client.clone(), _m(&acc, "investor_cap_raw")), + investor_price: DollarsSatsPattern::new(client.clone(), _m(&acc, "investor_price")), + investor_price_cents: MetricPattern1::new(client.clone(), _m(&acc, "investor_price_cents")), + investor_price_extra: 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")), + mvrv: MetricPattern4::new(client.clone(), _m(&acc, "mvrv")), + neg_realized_loss: CumulativeSumPattern2::new(client.clone(), _m(&acc, "neg_realized_loss")), + net_realized_pnl: CumulativeSumPattern::new(client.clone(), _m(&acc, "net_realized_pnl")), + net_realized_pnl_cumulative_30d_delta: MetricPattern4::new(client.clone(), _m(&acc, "net_realized_pnl_cumulative_30d_delta")), + net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: MetricPattern4::new(client.clone(), _m(&acc, "net_realized_pnl_cumulative_30d_delta_rel_to_market_cap")), + net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: MetricPattern4::new(client.clone(), _m(&acc, "net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap")), + net_realized_pnl_rel_to_realized_cap: CumulativeSumPattern::new(client.clone(), _m(&acc, "net_realized_pnl_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")), + realized_cap: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap")), + realized_cap_30d_delta: MetricPattern4::new(client.clone(), _m(&acc, "realized_cap_30d_delta")), + realized_cap_cents: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap_cents")), + realized_cap_rel_to_own_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap_rel_to_own_market_cap")), + realized_loss: CumulativeSumPattern::new(client.clone(), _m(&acc, "realized_loss")), + realized_loss_rel_to_realized_cap: CumulativeSumPattern::new(client.clone(), _m(&acc, "realized_loss_rel_to_realized_cap")), + realized_price: DollarsSatsPattern::new(client.clone(), _m(&acc, "realized_price")), + realized_price_extra: RatioPattern::new(client.clone(), _m(&acc, "realized_price_ratio")), + realized_profit: CumulativeSumPattern::new(client.clone(), _m(&acc, "realized_profit")), + realized_profit_rel_to_realized_cap: CumulativeSumPattern::new(client.clone(), _m(&acc, "realized_profit_rel_to_realized_cap")), + realized_profit_to_loss_ratio: MetricPattern6::new(client.clone(), _m(&acc, "realized_profit_to_loss_ratio")), + realized_value: MetricPattern1::new(client.clone(), _m(&acc, "realized_value")), + sell_side_risk_ratio: MetricPattern6::new(client.clone(), _m(&acc, "sell_side_risk_ratio")), + sell_side_risk_ratio_30d_ema: MetricPattern6::new(client.clone(), _m(&acc, "sell_side_risk_ratio_30d_ema")), + sell_side_risk_ratio_7d_ema: MetricPattern6::new(client.clone(), _m(&acc, "sell_side_risk_ratio_7d_ema")), + sopr: MetricPattern6::new(client.clone(), _m(&acc, "sopr")), + sopr_30d_ema: MetricPattern6::new(client.clone(), _m(&acc, "sopr_30d_ema")), + sopr_7d_ema: MetricPattern6::new(client.clone(), _m(&acc, "sopr_7d_ema")), + total_realized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "total_realized_pnl")), + value_created: MetricPattern1::new(client.clone(), _m(&acc, "value_created")), + value_destroyed: MetricPattern1::new(client.clone(), _m(&acc, "value_destroyed")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct AthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern { + pub ath_regret: CumulativeSumPattern, + pub cap_raw: MetricPattern11, + pub capitulation_flow: MetricPattern1, + pub investor_cap_raw: MetricPattern11, + pub investor_price: DollarsSatsPattern, + pub investor_price_cents: MetricPattern1, + pub investor_price_extra: RatioPattern2, + pub loss_value_created: MetricPattern1, + pub loss_value_destroyed: MetricPattern1, + pub mvrv: MetricPattern4, + pub neg_realized_loss: CumulativeSumPattern2, + pub net_realized_pnl: CumulativeSumPattern, + pub net_realized_pnl_cumulative_30d_delta: MetricPattern4, + pub net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: MetricPattern4, + pub net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: MetricPattern4, + pub net_realized_pnl_rel_to_realized_cap: CumulativeSumPattern, + pub profit_flow: MetricPattern1, + pub profit_value_created: MetricPattern1, + pub profit_value_destroyed: MetricPattern1, + pub realized_cap: MetricPattern1, + pub realized_cap_30d_delta: MetricPattern4, + pub realized_cap_cents: MetricPattern1, + pub realized_loss: CumulativeSumPattern, + pub realized_loss_rel_to_realized_cap: CumulativeSumPattern, + pub realized_price: DollarsSatsPattern, + pub realized_price_extra: RatioPattern2, + pub realized_profit: CumulativeSumPattern, + pub realized_profit_rel_to_realized_cap: CumulativeSumPattern, + pub realized_value: MetricPattern1, + pub sell_side_risk_ratio: MetricPattern6, + pub sell_side_risk_ratio_30d_ema: MetricPattern6, + pub sell_side_risk_ratio_7d_ema: MetricPattern6, + pub sopr: MetricPattern6, + pub sopr_30d_ema: MetricPattern6, + pub sopr_7d_ema: MetricPattern6, + pub total_realized_pnl: MetricPattern1, + pub value_created: MetricPattern1, + pub value_destroyed: MetricPattern1, +} + +impl AthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + ath_regret: CumulativeSumPattern::new(client.clone(), _m(&acc, "realized_ath_regret")), + cap_raw: MetricPattern11::new(client.clone(), _m(&acc, "cap_raw")), + capitulation_flow: MetricPattern1::new(client.clone(), _m(&acc, "capitulation_flow")), + investor_cap_raw: MetricPattern11::new(client.clone(), _m(&acc, "investor_cap_raw")), + investor_price: DollarsSatsPattern::new(client.clone(), _m(&acc, "investor_price")), + investor_price_cents: MetricPattern1::new(client.clone(), _m(&acc, "investor_price_cents")), + investor_price_extra: RatioPattern2::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")), + mvrv: MetricPattern4::new(client.clone(), _m(&acc, "mvrv")), + neg_realized_loss: CumulativeSumPattern2::new(client.clone(), _m(&acc, "neg_realized_loss")), + net_realized_pnl: CumulativeSumPattern::new(client.clone(), _m(&acc, "net_realized_pnl")), + net_realized_pnl_cumulative_30d_delta: MetricPattern4::new(client.clone(), _m(&acc, "net_realized_pnl_cumulative_30d_delta")), + net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: MetricPattern4::new(client.clone(), _m(&acc, "net_realized_pnl_cumulative_30d_delta_rel_to_market_cap")), + net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: MetricPattern4::new(client.clone(), _m(&acc, "net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap")), + net_realized_pnl_rel_to_realized_cap: CumulativeSumPattern::new(client.clone(), _m(&acc, "net_realized_pnl_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")), + realized_cap: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap")), + realized_cap_30d_delta: MetricPattern4::new(client.clone(), _m(&acc, "realized_cap_30d_delta")), + realized_cap_cents: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap_cents")), + realized_loss: CumulativeSumPattern::new(client.clone(), _m(&acc, "realized_loss")), + realized_loss_rel_to_realized_cap: CumulativeSumPattern::new(client.clone(), _m(&acc, "realized_loss_rel_to_realized_cap")), + realized_price: DollarsSatsPattern::new(client.clone(), _m(&acc, "realized_price")), + realized_price_extra: RatioPattern2::new(client.clone(), _m(&acc, "realized_price_ratio")), + realized_profit: CumulativeSumPattern::new(client.clone(), _m(&acc, "realized_profit")), + realized_profit_rel_to_realized_cap: CumulativeSumPattern::new(client.clone(), _m(&acc, "realized_profit_rel_to_realized_cap")), + realized_value: MetricPattern1::new(client.clone(), _m(&acc, "realized_value")), + sell_side_risk_ratio: MetricPattern6::new(client.clone(), _m(&acc, "sell_side_risk_ratio")), + sell_side_risk_ratio_30d_ema: MetricPattern6::new(client.clone(), _m(&acc, "sell_side_risk_ratio_30d_ema")), + sell_side_risk_ratio_7d_ema: MetricPattern6::new(client.clone(), _m(&acc, "sell_side_risk_ratio_7d_ema")), + sopr: MetricPattern6::new(client.clone(), _m(&acc, "sopr")), + sopr_30d_ema: MetricPattern6::new(client.clone(), _m(&acc, "sopr_30d_ema")), + sopr_7d_ema: MetricPattern6::new(client.clone(), _m(&acc, "sopr_7d_ema")), + total_realized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "total_realized_pnl")), + value_created: MetricPattern1::new(client.clone(), _m(&acc, "value_created")), + value_destroyed: MetricPattern1::new(client.clone(), _m(&acc, "value_destroyed")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern { + pub _0sd_usd: DollarsSatsPattern2, pub m0_5sd: MetricPattern4, - pub m0_5sd_usd: _0sdUsdPattern, + pub m0_5sd_usd: DollarsSatsPattern2, pub m1_5sd: MetricPattern4, - pub m1_5sd_usd: _0sdUsdPattern, + pub m1_5sd_usd: DollarsSatsPattern2, pub m1sd: MetricPattern4, - pub m1sd_usd: _0sdUsdPattern, + pub m1sd_usd: DollarsSatsPattern2, pub m2_5sd: MetricPattern4, - pub m2_5sd_usd: _0sdUsdPattern, + pub m2_5sd_usd: DollarsSatsPattern2, pub m2sd: MetricPattern4, - pub m2sd_usd: _0sdUsdPattern, + pub m2sd_usd: DollarsSatsPattern2, pub m3sd: MetricPattern4, - pub m3sd_usd: _0sdUsdPattern, + pub m3sd_usd: DollarsSatsPattern2, pub p0_5sd: MetricPattern4, - pub p0_5sd_usd: _0sdUsdPattern, + pub p0_5sd_usd: DollarsSatsPattern2, pub p1_5sd: MetricPattern4, - pub p1_5sd_usd: _0sdUsdPattern, + pub p1_5sd_usd: DollarsSatsPattern2, pub p1sd: MetricPattern4, - pub p1sd_usd: _0sdUsdPattern, + pub p1sd_usd: DollarsSatsPattern2, pub p2_5sd: MetricPattern4, - pub p2_5sd_usd: _0sdUsdPattern, + pub p2_5sd_usd: DollarsSatsPattern2, pub p2sd: MetricPattern4, - pub p2sd_usd: _0sdUsdPattern, + pub p2sd_usd: DollarsSatsPattern2, pub p3sd: MetricPattern4, - pub p3sd_usd: _0sdUsdPattern, + pub p3sd_usd: DollarsSatsPattern2, pub sd: MetricPattern4, pub sma: MetricPattern4, pub zscore: MetricPattern4, } -impl Ratio1ySdPattern { +impl _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - _0sd_usd: _0sdUsdPattern::new(client.clone(), _m(&acc, "0sd_usd")), + _0sd_usd: DollarsSatsPattern2::new(client.clone(), _m(&acc, "0sd_usd")), m0_5sd: MetricPattern4::new(client.clone(), _m(&acc, "m0_5sd")), - m0_5sd_usd: _0sdUsdPattern::new(client.clone(), _m(&acc, "m0_5sd_usd")), + m0_5sd_usd: DollarsSatsPattern2::new(client.clone(), _m(&acc, "m0_5sd_usd")), m1_5sd: MetricPattern4::new(client.clone(), _m(&acc, "m1_5sd")), - m1_5sd_usd: _0sdUsdPattern::new(client.clone(), _m(&acc, "m1_5sd_usd")), + m1_5sd_usd: DollarsSatsPattern2::new(client.clone(), _m(&acc, "m1_5sd_usd")), m1sd: MetricPattern4::new(client.clone(), _m(&acc, "m1sd")), - m1sd_usd: _0sdUsdPattern::new(client.clone(), _m(&acc, "m1sd_usd")), + m1sd_usd: DollarsSatsPattern2::new(client.clone(), _m(&acc, "m1sd_usd")), m2_5sd: MetricPattern4::new(client.clone(), _m(&acc, "m2_5sd")), - m2_5sd_usd: _0sdUsdPattern::new(client.clone(), _m(&acc, "m2_5sd_usd")), + m2_5sd_usd: DollarsSatsPattern2::new(client.clone(), _m(&acc, "m2_5sd_usd")), m2sd: MetricPattern4::new(client.clone(), _m(&acc, "m2sd")), - m2sd_usd: _0sdUsdPattern::new(client.clone(), _m(&acc, "m2sd_usd")), + m2sd_usd: DollarsSatsPattern2::new(client.clone(), _m(&acc, "m2sd_usd")), m3sd: MetricPattern4::new(client.clone(), _m(&acc, "m3sd")), - m3sd_usd: _0sdUsdPattern::new(client.clone(), _m(&acc, "m3sd_usd")), + m3sd_usd: DollarsSatsPattern2::new(client.clone(), _m(&acc, "m3sd_usd")), p0_5sd: MetricPattern4::new(client.clone(), _m(&acc, "p0_5sd")), - p0_5sd_usd: _0sdUsdPattern::new(client.clone(), _m(&acc, "p0_5sd_usd")), + p0_5sd_usd: DollarsSatsPattern2::new(client.clone(), _m(&acc, "p0_5sd_usd")), p1_5sd: MetricPattern4::new(client.clone(), _m(&acc, "p1_5sd")), - p1_5sd_usd: _0sdUsdPattern::new(client.clone(), _m(&acc, "p1_5sd_usd")), + p1_5sd_usd: DollarsSatsPattern2::new(client.clone(), _m(&acc, "p1_5sd_usd")), p1sd: MetricPattern4::new(client.clone(), _m(&acc, "p1sd")), - p1sd_usd: _0sdUsdPattern::new(client.clone(), _m(&acc, "p1sd_usd")), + p1sd_usd: DollarsSatsPattern2::new(client.clone(), _m(&acc, "p1sd_usd")), p2_5sd: MetricPattern4::new(client.clone(), _m(&acc, "p2_5sd")), - p2_5sd_usd: _0sdUsdPattern::new(client.clone(), _m(&acc, "p2_5sd_usd")), + p2_5sd_usd: DollarsSatsPattern2::new(client.clone(), _m(&acc, "p2_5sd_usd")), p2sd: MetricPattern4::new(client.clone(), _m(&acc, "p2sd")), - p2sd_usd: _0sdUsdPattern::new(client.clone(), _m(&acc, "p2sd_usd")), + p2sd_usd: DollarsSatsPattern2::new(client.clone(), _m(&acc, "p2sd_usd")), p3sd: MetricPattern4::new(client.clone(), _m(&acc, "p3sd")), - p3sd_usd: _0sdUsdPattern::new(client.clone(), _m(&acc, "p3sd_usd")), + p3sd_usd: DollarsSatsPattern2::new(client.clone(), _m(&acc, "p3sd_usd")), sd: MetricPattern4::new(client.clone(), _m(&acc, "sd")), sma: MetricPattern4::new(client.clone(), _m(&acc, "sma")), zscore: MetricPattern4::new(client.clone(), _m(&acc, "zscore")), @@ -1074,287 +1306,9 @@ impl Ratio1ySdPattern { } /// Pattern struct for repeated tree structure. -pub struct RealizedPattern2 { - pub mvrv: MetricPattern4, - pub neg_realized_loss: BitcoinPattern2, - pub net_realized_pnl: BlockCountPattern, - pub net_realized_pnl_cumulative_30d_delta: MetricPattern4, - pub net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: MetricPattern4, - pub net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: MetricPattern4, - pub net_realized_pnl_rel_to_realized_cap: BlockCountPattern, - pub realized_cap: MetricPattern1, - pub realized_cap_30d_delta: MetricPattern4, - pub realized_cap_rel_to_own_market_cap: MetricPattern1, - pub realized_loss: BlockCountPattern, - pub realized_loss_rel_to_realized_cap: BlockCountPattern, - pub realized_price: ActivePricePattern, - pub realized_price_extra: ActivePriceRatioPattern, - pub realized_profit: BlockCountPattern, - pub realized_profit_rel_to_realized_cap: BlockCountPattern, - pub realized_profit_to_loss_ratio: MetricPattern6, - pub realized_value: MetricPattern1, - pub sell_side_risk_ratio: MetricPattern6, - pub sell_side_risk_ratio_30d_ema: MetricPattern6, - pub sell_side_risk_ratio_7d_ema: MetricPattern6, - pub sopr: MetricPattern6, - pub sopr_30d_ema: MetricPattern6, - pub sopr_7d_ema: MetricPattern6, - pub total_realized_pnl: MetricPattern1, - pub value_created: MetricPattern1, - pub value_destroyed: MetricPattern1, -} - -impl RealizedPattern2 { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - mvrv: MetricPattern4::new(client.clone(), _m(&acc, "mvrv")), - neg_realized_loss: BitcoinPattern2::new(client.clone(), _m(&acc, "neg_realized_loss")), - net_realized_pnl: BlockCountPattern::new(client.clone(), _m(&acc, "net_realized_pnl")), - net_realized_pnl_cumulative_30d_delta: MetricPattern4::new(client.clone(), _m(&acc, "net_realized_pnl_cumulative_30d_delta")), - net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: MetricPattern4::new(client.clone(), _m(&acc, "net_realized_pnl_cumulative_30d_delta_rel_to_market_cap")), - net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: MetricPattern4::new(client.clone(), _m(&acc, "net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap")), - net_realized_pnl_rel_to_realized_cap: BlockCountPattern::new(client.clone(), _m(&acc, "net_realized_pnl_rel_to_realized_cap")), - realized_cap: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap")), - realized_cap_30d_delta: MetricPattern4::new(client.clone(), _m(&acc, "realized_cap_30d_delta")), - realized_cap_rel_to_own_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap_rel_to_own_market_cap")), - realized_loss: BlockCountPattern::new(client.clone(), _m(&acc, "realized_loss")), - realized_loss_rel_to_realized_cap: BlockCountPattern::new(client.clone(), _m(&acc, "realized_loss_rel_to_realized_cap")), - realized_price: ActivePricePattern::new(client.clone(), _m(&acc, "realized_price")), - realized_price_extra: ActivePriceRatioPattern::new(client.clone(), _m(&acc, "realized_price_ratio")), - realized_profit: BlockCountPattern::new(client.clone(), _m(&acc, "realized_profit")), - realized_profit_rel_to_realized_cap: BlockCountPattern::new(client.clone(), _m(&acc, "realized_profit_rel_to_realized_cap")), - realized_profit_to_loss_ratio: MetricPattern6::new(client.clone(), _m(&acc, "realized_profit_to_loss_ratio")), - realized_value: MetricPattern1::new(client.clone(), _m(&acc, "realized_value")), - sell_side_risk_ratio: MetricPattern6::new(client.clone(), _m(&acc, "sell_side_risk_ratio")), - sell_side_risk_ratio_30d_ema: MetricPattern6::new(client.clone(), _m(&acc, "sell_side_risk_ratio_30d_ema")), - sell_side_risk_ratio_7d_ema: MetricPattern6::new(client.clone(), _m(&acc, "sell_side_risk_ratio_7d_ema")), - sopr: MetricPattern6::new(client.clone(), _m(&acc, "sopr")), - sopr_30d_ema: MetricPattern6::new(client.clone(), _m(&acc, "sopr_30d_ema")), - sopr_7d_ema: MetricPattern6::new(client.clone(), _m(&acc, "sopr_7d_ema")), - total_realized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "total_realized_pnl")), - value_created: MetricPattern1::new(client.clone(), _m(&acc, "value_created")), - value_destroyed: MetricPattern1::new(client.clone(), _m(&acc, "value_destroyed")), - } - } -} - -/// Pattern struct for repeated tree structure. -pub struct RealizedPattern { - pub mvrv: MetricPattern4, - pub neg_realized_loss: BitcoinPattern2, - pub net_realized_pnl: BlockCountPattern, - pub net_realized_pnl_cumulative_30d_delta: MetricPattern4, - pub net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: MetricPattern4, - pub net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: MetricPattern4, - pub net_realized_pnl_rel_to_realized_cap: BlockCountPattern, - pub realized_cap: MetricPattern1, - pub realized_cap_30d_delta: MetricPattern4, - pub realized_loss: BlockCountPattern, - pub realized_loss_rel_to_realized_cap: BlockCountPattern, - pub realized_price: ActivePricePattern, - pub realized_price_extra: RealizedPriceExtraPattern, - pub realized_profit: BlockCountPattern, - pub realized_profit_rel_to_realized_cap: BlockCountPattern, - pub realized_value: MetricPattern1, - pub sell_side_risk_ratio: MetricPattern6, - pub sell_side_risk_ratio_30d_ema: MetricPattern6, - pub sell_side_risk_ratio_7d_ema: MetricPattern6, - pub sopr: MetricPattern6, - pub sopr_30d_ema: MetricPattern6, - pub sopr_7d_ema: MetricPattern6, - pub total_realized_pnl: MetricPattern1, - pub value_created: MetricPattern1, - pub value_destroyed: MetricPattern1, -} - -impl RealizedPattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - mvrv: MetricPattern4::new(client.clone(), _m(&acc, "mvrv")), - neg_realized_loss: BitcoinPattern2::new(client.clone(), _m(&acc, "neg_realized_loss")), - net_realized_pnl: BlockCountPattern::new(client.clone(), _m(&acc, "net_realized_pnl")), - net_realized_pnl_cumulative_30d_delta: MetricPattern4::new(client.clone(), _m(&acc, "net_realized_pnl_cumulative_30d_delta")), - net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: MetricPattern4::new(client.clone(), _m(&acc, "net_realized_pnl_cumulative_30d_delta_rel_to_market_cap")), - net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: MetricPattern4::new(client.clone(), _m(&acc, "net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap")), - net_realized_pnl_rel_to_realized_cap: BlockCountPattern::new(client.clone(), _m(&acc, "net_realized_pnl_rel_to_realized_cap")), - realized_cap: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap")), - realized_cap_30d_delta: MetricPattern4::new(client.clone(), _m(&acc, "realized_cap_30d_delta")), - realized_loss: BlockCountPattern::new(client.clone(), _m(&acc, "realized_loss")), - realized_loss_rel_to_realized_cap: BlockCountPattern::new(client.clone(), _m(&acc, "realized_loss_rel_to_realized_cap")), - realized_price: ActivePricePattern::new(client.clone(), _m(&acc, "realized_price")), - realized_price_extra: RealizedPriceExtraPattern::new(client.clone(), _m(&acc, "realized_price_ratio")), - realized_profit: BlockCountPattern::new(client.clone(), _m(&acc, "realized_profit")), - realized_profit_rel_to_realized_cap: BlockCountPattern::new(client.clone(), _m(&acc, "realized_profit_rel_to_realized_cap")), - realized_value: MetricPattern1::new(client.clone(), _m(&acc, "realized_value")), - sell_side_risk_ratio: MetricPattern6::new(client.clone(), _m(&acc, "sell_side_risk_ratio")), - sell_side_risk_ratio_30d_ema: MetricPattern6::new(client.clone(), _m(&acc, "sell_side_risk_ratio_30d_ema")), - sell_side_risk_ratio_7d_ema: MetricPattern6::new(client.clone(), _m(&acc, "sell_side_risk_ratio_7d_ema")), - sopr: MetricPattern6::new(client.clone(), _m(&acc, "sopr")), - sopr_30d_ema: MetricPattern6::new(client.clone(), _m(&acc, "sopr_30d_ema")), - sopr_7d_ema: MetricPattern6::new(client.clone(), _m(&acc, "sopr_7d_ema")), - total_realized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "total_realized_pnl")), - value_created: MetricPattern1::new(client.clone(), _m(&acc, "value_created")), - value_destroyed: MetricPattern1::new(client.clone(), _m(&acc, "value_destroyed")), - } - } -} - -/// Pattern struct for repeated tree structure. -pub struct Price111dSmaPattern { - pub price: _0sdUsdPattern, - pub ratio: MetricPattern4, - pub ratio_1m_sma: MetricPattern4, - pub ratio_1w_sma: MetricPattern4, - pub ratio_1y_sd: Ratio1ySdPattern, - pub ratio_2y_sd: Ratio1ySdPattern, - pub ratio_4y_sd: Ratio1ySdPattern, - pub ratio_pct1: MetricPattern4, - pub ratio_pct1_usd: _0sdUsdPattern, - pub ratio_pct2: MetricPattern4, - pub ratio_pct2_usd: _0sdUsdPattern, - pub ratio_pct5: MetricPattern4, - pub ratio_pct5_usd: _0sdUsdPattern, - pub ratio_pct95: MetricPattern4, - pub ratio_pct95_usd: _0sdUsdPattern, - pub ratio_pct98: MetricPattern4, - pub ratio_pct98_usd: _0sdUsdPattern, - pub ratio_pct99: MetricPattern4, - pub ratio_pct99_usd: _0sdUsdPattern, - pub ratio_sd: Ratio1ySdPattern, -} - -impl Price111dSmaPattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - price: _0sdUsdPattern::new(client.clone(), acc.clone()), - ratio: MetricPattern4::new(client.clone(), _m(&acc, "ratio")), - ratio_1m_sma: MetricPattern4::new(client.clone(), _m(&acc, "ratio_1m_sma")), - ratio_1w_sma: MetricPattern4::new(client.clone(), _m(&acc, "ratio_1w_sma")), - ratio_1y_sd: Ratio1ySdPattern::new(client.clone(), _m(&acc, "ratio_1y")), - ratio_2y_sd: Ratio1ySdPattern::new(client.clone(), _m(&acc, "ratio_2y")), - ratio_4y_sd: Ratio1ySdPattern::new(client.clone(), _m(&acc, "ratio_4y")), - ratio_pct1: MetricPattern4::new(client.clone(), _m(&acc, "ratio_pct1")), - ratio_pct1_usd: _0sdUsdPattern::new(client.clone(), _m(&acc, "ratio_pct1_usd")), - ratio_pct2: MetricPattern4::new(client.clone(), _m(&acc, "ratio_pct2")), - ratio_pct2_usd: _0sdUsdPattern::new(client.clone(), _m(&acc, "ratio_pct2_usd")), - ratio_pct5: MetricPattern4::new(client.clone(), _m(&acc, "ratio_pct5")), - ratio_pct5_usd: _0sdUsdPattern::new(client.clone(), _m(&acc, "ratio_pct5_usd")), - ratio_pct95: MetricPattern4::new(client.clone(), _m(&acc, "ratio_pct95")), - ratio_pct95_usd: _0sdUsdPattern::new(client.clone(), _m(&acc, "ratio_pct95_usd")), - ratio_pct98: MetricPattern4::new(client.clone(), _m(&acc, "ratio_pct98")), - ratio_pct98_usd: _0sdUsdPattern::new(client.clone(), _m(&acc, "ratio_pct98_usd")), - ratio_pct99: MetricPattern4::new(client.clone(), _m(&acc, "ratio_pct99")), - ratio_pct99_usd: _0sdUsdPattern::new(client.clone(), _m(&acc, "ratio_pct99_usd")), - ratio_sd: Ratio1ySdPattern::new(client.clone(), _m(&acc, "ratio")), - } - } -} - -/// Pattern struct for repeated tree structure. -pub struct PercentilesPattern { - pub pct05: _0sdUsdPattern, - pub pct10: _0sdUsdPattern, - pub pct15: _0sdUsdPattern, - pub pct20: _0sdUsdPattern, - pub pct25: _0sdUsdPattern, - pub pct30: _0sdUsdPattern, - pub pct35: _0sdUsdPattern, - pub pct40: _0sdUsdPattern, - pub pct45: _0sdUsdPattern, - pub pct50: _0sdUsdPattern, - pub pct55: _0sdUsdPattern, - pub pct60: _0sdUsdPattern, - pub pct65: _0sdUsdPattern, - pub pct70: _0sdUsdPattern, - pub pct75: _0sdUsdPattern, - pub pct80: _0sdUsdPattern, - pub pct85: _0sdUsdPattern, - pub pct90: _0sdUsdPattern, - pub pct95: _0sdUsdPattern, -} - -impl PercentilesPattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - pct05: _0sdUsdPattern::new(client.clone(), _m(&acc, "pct05")), - pct10: _0sdUsdPattern::new(client.clone(), _m(&acc, "pct10")), - pct15: _0sdUsdPattern::new(client.clone(), _m(&acc, "pct15")), - pct20: _0sdUsdPattern::new(client.clone(), _m(&acc, "pct20")), - pct25: _0sdUsdPattern::new(client.clone(), _m(&acc, "pct25")), - pct30: _0sdUsdPattern::new(client.clone(), _m(&acc, "pct30")), - pct35: _0sdUsdPattern::new(client.clone(), _m(&acc, "pct35")), - pct40: _0sdUsdPattern::new(client.clone(), _m(&acc, "pct40")), - pct45: _0sdUsdPattern::new(client.clone(), _m(&acc, "pct45")), - pct50: _0sdUsdPattern::new(client.clone(), _m(&acc, "pct50")), - pct55: _0sdUsdPattern::new(client.clone(), _m(&acc, "pct55")), - pct60: _0sdUsdPattern::new(client.clone(), _m(&acc, "pct60")), - pct65: _0sdUsdPattern::new(client.clone(), _m(&acc, "pct65")), - pct70: _0sdUsdPattern::new(client.clone(), _m(&acc, "pct70")), - pct75: _0sdUsdPattern::new(client.clone(), _m(&acc, "pct75")), - pct80: _0sdUsdPattern::new(client.clone(), _m(&acc, "pct80")), - pct85: _0sdUsdPattern::new(client.clone(), _m(&acc, "pct85")), - pct90: _0sdUsdPattern::new(client.clone(), _m(&acc, "pct90")), - pct95: _0sdUsdPattern::new(client.clone(), _m(&acc, "pct95")), - } - } -} - -/// Pattern struct for repeated tree structure. -pub struct ActivePriceRatioPattern { - pub ratio: MetricPattern4, - pub ratio_1m_sma: MetricPattern4, - pub ratio_1w_sma: MetricPattern4, - pub ratio_1y_sd: Ratio1ySdPattern, - pub ratio_2y_sd: Ratio1ySdPattern, - pub ratio_4y_sd: Ratio1ySdPattern, - pub ratio_pct1: MetricPattern4, - pub ratio_pct1_usd: _0sdUsdPattern, - pub ratio_pct2: MetricPattern4, - pub ratio_pct2_usd: _0sdUsdPattern, - pub ratio_pct5: MetricPattern4, - pub ratio_pct5_usd: _0sdUsdPattern, - pub ratio_pct95: MetricPattern4, - pub ratio_pct95_usd: _0sdUsdPattern, - pub ratio_pct98: MetricPattern4, - pub ratio_pct98_usd: _0sdUsdPattern, - pub ratio_pct99: MetricPattern4, - pub ratio_pct99_usd: _0sdUsdPattern, - pub ratio_sd: Ratio1ySdPattern, -} - -impl ActivePriceRatioPattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - ratio: MetricPattern4::new(client.clone(), acc.clone()), - ratio_1m_sma: MetricPattern4::new(client.clone(), _m(&acc, "1m_sma")), - ratio_1w_sma: MetricPattern4::new(client.clone(), _m(&acc, "1w_sma")), - ratio_1y_sd: Ratio1ySdPattern::new(client.clone(), _m(&acc, "1y")), - ratio_2y_sd: Ratio1ySdPattern::new(client.clone(), _m(&acc, "2y")), - ratio_4y_sd: Ratio1ySdPattern::new(client.clone(), _m(&acc, "4y")), - ratio_pct1: MetricPattern4::new(client.clone(), _m(&acc, "pct1")), - ratio_pct1_usd: _0sdUsdPattern::new(client.clone(), _m(&acc, "pct1_usd")), - ratio_pct2: MetricPattern4::new(client.clone(), _m(&acc, "pct2")), - ratio_pct2_usd: _0sdUsdPattern::new(client.clone(), _m(&acc, "pct2_usd")), - ratio_pct5: MetricPattern4::new(client.clone(), _m(&acc, "pct5")), - ratio_pct5_usd: _0sdUsdPattern::new(client.clone(), _m(&acc, "pct5_usd")), - ratio_pct95: MetricPattern4::new(client.clone(), _m(&acc, "pct95")), - ratio_pct95_usd: _0sdUsdPattern::new(client.clone(), _m(&acc, "pct95_usd")), - ratio_pct98: MetricPattern4::new(client.clone(), _m(&acc, "pct98")), - ratio_pct98_usd: _0sdUsdPattern::new(client.clone(), _m(&acc, "pct98_usd")), - ratio_pct99: MetricPattern4::new(client.clone(), _m(&acc, "pct99")), - ratio_pct99_usd: _0sdUsdPattern::new(client.clone(), _m(&acc, "pct99_usd")), - ratio_sd: Ratio1ySdPattern::new(client.clone(), acc.clone()), - } - } -} - -/// Pattern struct for repeated tree structure. -pub struct RelativePattern5 { +pub struct InvestedNegNetNuplSupplyUnrealizedPattern2 { + pub invested_capital_in_loss_pct: MetricPattern1, + pub invested_capital_in_profit_pct: MetricPattern1, pub neg_unrealized_loss_rel_to_market_cap: MetricPattern1, pub neg_unrealized_loss_rel_to_own_market_cap: MetricPattern1, pub neg_unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1, @@ -1375,10 +1329,12 @@ pub struct RelativePattern5 { pub unrealized_profit_rel_to_own_total_unrealized_pnl: MetricPattern1, } -impl RelativePattern5 { +impl InvestedNegNetNuplSupplyUnrealizedPattern2 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { + invested_capital_in_loss_pct: MetricPattern1::new(client.clone(), _m(&acc, "invested_capital_in_loss_pct")), + invested_capital_in_profit_pct: MetricPattern1::new(client.clone(), _m(&acc, "invested_capital_in_profit_pct")), neg_unrealized_loss_rel_to_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "neg_unrealized_loss_rel_to_market_cap")), neg_unrealized_loss_rel_to_own_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "neg_unrealized_loss_rel_to_own_market_cap")), neg_unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "neg_unrealized_loss_rel_to_own_total_unrealized_pnl")), @@ -1402,7 +1358,205 @@ impl RelativePattern5 { } /// Pattern struct for repeated tree structure. -pub struct AaopoolPattern { +pub struct PriceRatioPattern { + pub price: DollarsSatsPattern2, + pub ratio: MetricPattern4, + pub ratio_1m_sma: MetricPattern4, + pub ratio_1w_sma: MetricPattern4, + pub ratio_1y_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern, + pub ratio_2y_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern, + pub ratio_4y_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern, + pub ratio_pct1: MetricPattern4, + pub ratio_pct1_usd: DollarsSatsPattern2, + pub ratio_pct2: MetricPattern4, + pub ratio_pct2_usd: DollarsSatsPattern2, + pub ratio_pct5: MetricPattern4, + pub ratio_pct5_usd: DollarsSatsPattern2, + pub ratio_pct95: MetricPattern4, + pub ratio_pct95_usd: DollarsSatsPattern2, + pub ratio_pct98: MetricPattern4, + pub ratio_pct98_usd: DollarsSatsPattern2, + pub ratio_pct99: MetricPattern4, + pub ratio_pct99_usd: DollarsSatsPattern2, + pub ratio_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern, +} + +impl PriceRatioPattern { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + price: DollarsSatsPattern2::new(client.clone(), acc.clone()), + ratio: MetricPattern4::new(client.clone(), _m(&acc, "ratio")), + ratio_1m_sma: MetricPattern4::new(client.clone(), _m(&acc, "ratio_1m_sma")), + ratio_1w_sma: MetricPattern4::new(client.clone(), _m(&acc, "ratio_1w_sma")), + ratio_1y_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern::new(client.clone(), _m(&acc, "ratio_1y")), + ratio_2y_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern::new(client.clone(), _m(&acc, "ratio_2y")), + ratio_4y_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern::new(client.clone(), _m(&acc, "ratio_4y")), + ratio_pct1: MetricPattern4::new(client.clone(), _m(&acc, "ratio_pct1")), + ratio_pct1_usd: DollarsSatsPattern2::new(client.clone(), _m(&acc, "ratio_pct1_usd")), + ratio_pct2: MetricPattern4::new(client.clone(), _m(&acc, "ratio_pct2")), + ratio_pct2_usd: DollarsSatsPattern2::new(client.clone(), _m(&acc, "ratio_pct2_usd")), + ratio_pct5: MetricPattern4::new(client.clone(), _m(&acc, "ratio_pct5")), + ratio_pct5_usd: DollarsSatsPattern2::new(client.clone(), _m(&acc, "ratio_pct5_usd")), + ratio_pct95: MetricPattern4::new(client.clone(), _m(&acc, "ratio_pct95")), + ratio_pct95_usd: DollarsSatsPattern2::new(client.clone(), _m(&acc, "ratio_pct95_usd")), + ratio_pct98: MetricPattern4::new(client.clone(), _m(&acc, "ratio_pct98")), + ratio_pct98_usd: DollarsSatsPattern2::new(client.clone(), _m(&acc, "ratio_pct98_usd")), + ratio_pct99: MetricPattern4::new(client.clone(), _m(&acc, "ratio_pct99")), + ratio_pct99_usd: DollarsSatsPattern2::new(client.clone(), _m(&acc, "ratio_pct99_usd")), + ratio_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern::new(client.clone(), _m(&acc, "ratio")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern { + pub pct05: DollarsSatsPattern2, + pub pct10: DollarsSatsPattern2, + pub pct15: DollarsSatsPattern2, + pub pct20: DollarsSatsPattern2, + pub pct25: DollarsSatsPattern2, + pub pct30: DollarsSatsPattern2, + pub pct35: DollarsSatsPattern2, + pub pct40: DollarsSatsPattern2, + pub pct45: DollarsSatsPattern2, + pub pct50: DollarsSatsPattern2, + pub pct55: DollarsSatsPattern2, + pub pct60: DollarsSatsPattern2, + pub pct65: DollarsSatsPattern2, + pub pct70: DollarsSatsPattern2, + pub pct75: DollarsSatsPattern2, + pub pct80: DollarsSatsPattern2, + pub pct85: DollarsSatsPattern2, + pub pct90: DollarsSatsPattern2, + pub pct95: DollarsSatsPattern2, +} + +impl Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + pct05: DollarsSatsPattern2::new(client.clone(), _m(&acc, "pct05")), + pct10: DollarsSatsPattern2::new(client.clone(), _m(&acc, "pct10")), + pct15: DollarsSatsPattern2::new(client.clone(), _m(&acc, "pct15")), + pct20: DollarsSatsPattern2::new(client.clone(), _m(&acc, "pct20")), + pct25: DollarsSatsPattern2::new(client.clone(), _m(&acc, "pct25")), + pct30: DollarsSatsPattern2::new(client.clone(), _m(&acc, "pct30")), + pct35: DollarsSatsPattern2::new(client.clone(), _m(&acc, "pct35")), + pct40: DollarsSatsPattern2::new(client.clone(), _m(&acc, "pct40")), + pct45: DollarsSatsPattern2::new(client.clone(), _m(&acc, "pct45")), + pct50: DollarsSatsPattern2::new(client.clone(), _m(&acc, "pct50")), + pct55: DollarsSatsPattern2::new(client.clone(), _m(&acc, "pct55")), + pct60: DollarsSatsPattern2::new(client.clone(), _m(&acc, "pct60")), + pct65: DollarsSatsPattern2::new(client.clone(), _m(&acc, "pct65")), + pct70: DollarsSatsPattern2::new(client.clone(), _m(&acc, "pct70")), + pct75: DollarsSatsPattern2::new(client.clone(), _m(&acc, "pct75")), + pct80: DollarsSatsPattern2::new(client.clone(), _m(&acc, "pct80")), + pct85: DollarsSatsPattern2::new(client.clone(), _m(&acc, "pct85")), + pct90: DollarsSatsPattern2::new(client.clone(), _m(&acc, "pct90")), + pct95: DollarsSatsPattern2::new(client.clone(), _m(&acc, "pct95")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct RatioPattern { + pub ratio: MetricPattern4, + pub ratio_1m_sma: MetricPattern4, + pub ratio_1w_sma: MetricPattern4, + pub ratio_1y_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern, + pub ratio_2y_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern, + pub ratio_4y_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern, + pub ratio_pct1: MetricPattern4, + pub ratio_pct1_usd: DollarsSatsPattern2, + pub ratio_pct2: MetricPattern4, + pub ratio_pct2_usd: DollarsSatsPattern2, + pub ratio_pct5: MetricPattern4, + pub ratio_pct5_usd: DollarsSatsPattern2, + pub ratio_pct95: MetricPattern4, + pub ratio_pct95_usd: DollarsSatsPattern2, + pub ratio_pct98: MetricPattern4, + pub ratio_pct98_usd: DollarsSatsPattern2, + pub ratio_pct99: MetricPattern4, + pub ratio_pct99_usd: DollarsSatsPattern2, + pub ratio_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern, +} + +impl RatioPattern { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + ratio: MetricPattern4::new(client.clone(), acc.clone()), + ratio_1m_sma: MetricPattern4::new(client.clone(), _m(&acc, "1m_sma")), + ratio_1w_sma: MetricPattern4::new(client.clone(), _m(&acc, "1w_sma")), + ratio_1y_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern::new(client.clone(), _m(&acc, "1y")), + ratio_2y_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern::new(client.clone(), _m(&acc, "2y")), + ratio_4y_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern::new(client.clone(), _m(&acc, "4y")), + ratio_pct1: MetricPattern4::new(client.clone(), _m(&acc, "pct1")), + ratio_pct1_usd: DollarsSatsPattern2::new(client.clone(), _m(&acc, "pct1_usd")), + ratio_pct2: MetricPattern4::new(client.clone(), _m(&acc, "pct2")), + ratio_pct2_usd: DollarsSatsPattern2::new(client.clone(), _m(&acc, "pct2_usd")), + ratio_pct5: MetricPattern4::new(client.clone(), _m(&acc, "pct5")), + ratio_pct5_usd: DollarsSatsPattern2::new(client.clone(), _m(&acc, "pct5_usd")), + ratio_pct95: MetricPattern4::new(client.clone(), _m(&acc, "pct95")), + ratio_pct95_usd: DollarsSatsPattern2::new(client.clone(), _m(&acc, "pct95_usd")), + ratio_pct98: MetricPattern4::new(client.clone(), _m(&acc, "pct98")), + ratio_pct98_usd: DollarsSatsPattern2::new(client.clone(), _m(&acc, "pct98_usd")), + ratio_pct99: MetricPattern4::new(client.clone(), _m(&acc, "pct99")), + ratio_pct99_usd: DollarsSatsPattern2::new(client.clone(), _m(&acc, "pct99_usd")), + ratio_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern::new(client.clone(), acc.clone()), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern { + pub ath_regret: MetricPattern1, + pub greed_index: MetricPattern1, + pub invested_capital_in_loss: MetricPattern1, + pub invested_capital_in_loss_raw: MetricPattern11, + pub invested_capital_in_profit: MetricPattern1, + pub invested_capital_in_profit_raw: MetricPattern11, + pub investor_cap_in_loss_raw: MetricPattern11, + pub investor_cap_in_profit_raw: MetricPattern11, + pub neg_unrealized_loss: MetricPattern1, + pub net_sentiment: MetricPattern1, + pub net_unrealized_pnl: MetricPattern1, + pub pain_index: MetricPattern1, + pub supply_in_loss: BitcoinDollarsSatsPattern4, + pub supply_in_profit: BitcoinDollarsSatsPattern4, + pub total_unrealized_pnl: MetricPattern1, + pub unrealized_loss: MetricPattern1, + pub unrealized_profit: MetricPattern1, +} + +impl AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + ath_regret: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_ath_regret")), + greed_index: MetricPattern1::new(client.clone(), _m(&acc, "greed_index")), + invested_capital_in_loss: MetricPattern1::new(client.clone(), _m(&acc, "invested_capital_in_loss")), + invested_capital_in_loss_raw: MetricPattern11::new(client.clone(), _m(&acc, "invested_capital_in_loss_raw")), + invested_capital_in_profit: MetricPattern1::new(client.clone(), _m(&acc, "invested_capital_in_profit")), + invested_capital_in_profit_raw: MetricPattern11::new(client.clone(), _m(&acc, "invested_capital_in_profit_raw")), + investor_cap_in_loss_raw: MetricPattern11::new(client.clone(), _m(&acc, "investor_cap_in_loss_raw")), + investor_cap_in_profit_raw: MetricPattern11::new(client.clone(), _m(&acc, "investor_cap_in_profit_raw")), + neg_unrealized_loss: MetricPattern1::new(client.clone(), _m(&acc, "neg_unrealized_loss")), + net_sentiment: MetricPattern1::new(client.clone(), _m(&acc, "net_sentiment")), + net_unrealized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "net_unrealized_pnl")), + pain_index: MetricPattern1::new(client.clone(), _m(&acc, "pain_index")), + supply_in_loss: BitcoinDollarsSatsPattern4::new(client.clone(), _m(&acc, "supply_in_loss")), + supply_in_profit: BitcoinDollarsSatsPattern4::new(client.clone(), _m(&acc, "supply_in_profit")), + total_unrealized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "total_unrealized_pnl")), + unrealized_loss: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_loss")), + unrealized_profit: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_profit")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern { pub _1m_blocks_mined: MetricPattern1, pub _1m_dominance: MetricPattern1, pub _1w_blocks_mined: MetricPattern1, @@ -1411,16 +1565,16 @@ pub struct AaopoolPattern { pub _1y_dominance: MetricPattern1, pub _24h_blocks_mined: MetricPattern1, pub _24h_dominance: MetricPattern1, - pub blocks_mined: BlockCountPattern, + pub blocks_mined: CumulativeSumPattern, pub blocks_since_block: MetricPattern1, - pub coinbase: CoinbasePattern2, + pub coinbase: BitcoinDollarsSatsPattern6, pub days_since_block: MetricPattern4, pub dominance: MetricPattern1, - pub fee: UnclaimedRewardsPattern, - pub subsidy: UnclaimedRewardsPattern, + pub fee: BitcoinDollarsSatsPattern3, + pub subsidy: BitcoinDollarsSatsPattern3, } -impl AaopoolPattern { +impl _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -1432,55 +1586,127 @@ impl AaopoolPattern { _1y_dominance: MetricPattern1::new(client.clone(), _m(&acc, "1y_dominance")), _24h_blocks_mined: MetricPattern1::new(client.clone(), _m(&acc, "24h_blocks_mined")), _24h_dominance: MetricPattern1::new(client.clone(), _m(&acc, "24h_dominance")), - blocks_mined: BlockCountPattern::new(client.clone(), _m(&acc, "blocks_mined")), + blocks_mined: CumulativeSumPattern::new(client.clone(), _m(&acc, "blocks_mined")), blocks_since_block: MetricPattern1::new(client.clone(), _m(&acc, "blocks_since_block")), - coinbase: CoinbasePattern2::new(client.clone(), _m(&acc, "coinbase")), + coinbase: BitcoinDollarsSatsPattern6::new(client.clone(), _m(&acc, "coinbase")), days_since_block: MetricPattern4::new(client.clone(), _m(&acc, "days_since_block")), dominance: MetricPattern1::new(client.clone(), _m(&acc, "dominance")), - fee: UnclaimedRewardsPattern::new(client.clone(), _m(&acc, "fee")), - subsidy: UnclaimedRewardsPattern::new(client.clone(), _m(&acc, "subsidy")), + fee: BitcoinDollarsSatsPattern3::new(client.clone(), _m(&acc, "fee")), + subsidy: BitcoinDollarsSatsPattern3::new(client.clone(), _m(&acc, "subsidy")), } } } /// Pattern struct for repeated tree structure. -pub struct PeriodLumpSumStackPattern { - pub _10y: _2015Pattern, - pub _1m: _2015Pattern, - pub _1w: _2015Pattern, - pub _1y: _2015Pattern, - pub _2y: _2015Pattern, - pub _3m: _2015Pattern, - pub _3y: _2015Pattern, - pub _4y: _2015Pattern, - pub _5y: _2015Pattern, - pub _6m: _2015Pattern, - pub _6y: _2015Pattern, - pub _8y: _2015Pattern, +pub struct _10y1m1w1y2y3m3y4y5y6m6y8yPattern3 { + pub _10y: BitcoinDollarsSatsPattern5, + pub _1m: BitcoinDollarsSatsPattern5, + pub _1w: BitcoinDollarsSatsPattern5, + pub _1y: BitcoinDollarsSatsPattern5, + pub _2y: BitcoinDollarsSatsPattern5, + pub _3m: BitcoinDollarsSatsPattern5, + pub _3y: BitcoinDollarsSatsPattern5, + pub _4y: BitcoinDollarsSatsPattern5, + pub _5y: BitcoinDollarsSatsPattern5, + pub _6m: BitcoinDollarsSatsPattern5, + pub _6y: BitcoinDollarsSatsPattern5, + pub _8y: BitcoinDollarsSatsPattern5, } -impl PeriodLumpSumStackPattern { +impl _10y1m1w1y2y3m3y4y5y6m6y8yPattern3 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - _10y: _2015Pattern::new(client.clone(), _p("10y", &acc)), - _1m: _2015Pattern::new(client.clone(), _p("1m", &acc)), - _1w: _2015Pattern::new(client.clone(), _p("1w", &acc)), - _1y: _2015Pattern::new(client.clone(), _p("1y", &acc)), - _2y: _2015Pattern::new(client.clone(), _p("2y", &acc)), - _3m: _2015Pattern::new(client.clone(), _p("3m", &acc)), - _3y: _2015Pattern::new(client.clone(), _p("3y", &acc)), - _4y: _2015Pattern::new(client.clone(), _p("4y", &acc)), - _5y: _2015Pattern::new(client.clone(), _p("5y", &acc)), - _6m: _2015Pattern::new(client.clone(), _p("6m", &acc)), - _6y: _2015Pattern::new(client.clone(), _p("6y", &acc)), - _8y: _2015Pattern::new(client.clone(), _p("8y", &acc)), + _10y: BitcoinDollarsSatsPattern5::new(client.clone(), _p("10y", &acc)), + _1m: BitcoinDollarsSatsPattern5::new(client.clone(), _p("1m", &acc)), + _1w: BitcoinDollarsSatsPattern5::new(client.clone(), _p("1w", &acc)), + _1y: BitcoinDollarsSatsPattern5::new(client.clone(), _p("1y", &acc)), + _2y: BitcoinDollarsSatsPattern5::new(client.clone(), _p("2y", &acc)), + _3m: BitcoinDollarsSatsPattern5::new(client.clone(), _p("3m", &acc)), + _3y: BitcoinDollarsSatsPattern5::new(client.clone(), _p("3y", &acc)), + _4y: BitcoinDollarsSatsPattern5::new(client.clone(), _p("4y", &acc)), + _5y: BitcoinDollarsSatsPattern5::new(client.clone(), _p("5y", &acc)), + _6m: BitcoinDollarsSatsPattern5::new(client.clone(), _p("6m", &acc)), + _6y: BitcoinDollarsSatsPattern5::new(client.clone(), _p("6y", &acc)), + _8y: BitcoinDollarsSatsPattern5::new(client.clone(), _p("8y", &acc)), } } } /// Pattern struct for repeated tree structure. -pub struct PeriodDaysInLossPattern { +pub struct InvestedNegNetNuplSupplyUnrealizedPattern { + pub invested_capital_in_loss_pct: MetricPattern1, + pub invested_capital_in_profit_pct: MetricPattern1, + pub neg_unrealized_loss_rel_to_market_cap: MetricPattern1, + pub net_unrealized_pnl_rel_to_market_cap: MetricPattern1, + pub nupl: MetricPattern1, + pub supply_in_loss_rel_to_circulating_supply: MetricPattern1, + pub supply_in_loss_rel_to_own_supply: MetricPattern1, + pub supply_in_profit_rel_to_circulating_supply: MetricPattern1, + pub supply_in_profit_rel_to_own_supply: MetricPattern1, + pub supply_rel_to_circulating_supply: MetricPattern4, + pub unrealized_loss_rel_to_market_cap: MetricPattern1, + pub unrealized_profit_rel_to_market_cap: MetricPattern1, +} + +impl InvestedNegNetNuplSupplyUnrealizedPattern { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + invested_capital_in_loss_pct: MetricPattern1::new(client.clone(), _m(&acc, "invested_capital_in_loss_pct")), + invested_capital_in_profit_pct: MetricPattern1::new(client.clone(), _m(&acc, "invested_capital_in_profit_pct")), + neg_unrealized_loss_rel_to_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "neg_unrealized_loss_rel_to_market_cap")), + net_unrealized_pnl_rel_to_market_cap: MetricPattern1::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: MetricPattern1::new(client.clone(), _m(&acc, "supply_in_loss_rel_to_circulating_supply")), + supply_in_loss_rel_to_own_supply: MetricPattern1::new(client.clone(), _m(&acc, "supply_in_loss_rel_to_own_supply")), + supply_in_profit_rel_to_circulating_supply: MetricPattern1::new(client.clone(), _m(&acc, "supply_in_profit_rel_to_circulating_supply")), + supply_in_profit_rel_to_own_supply: MetricPattern1::new(client.clone(), _m(&acc, "supply_in_profit_rel_to_own_supply")), + supply_rel_to_circulating_supply: MetricPattern4::new(client.clone(), _m(&acc, "supply_rel_to_circulating_supply")), + unrealized_loss_rel_to_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_loss_rel_to_market_cap")), + unrealized_profit_rel_to_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_profit_rel_to_market_cap")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct InvestedNegNetSupplyUnrealizedPattern { + pub invested_capital_in_loss_pct: MetricPattern1, + pub invested_capital_in_profit_pct: MetricPattern1, + pub neg_unrealized_loss_rel_to_own_market_cap: MetricPattern1, + pub neg_unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1, + pub net_unrealized_pnl_rel_to_own_market_cap: MetricPattern1, + pub net_unrealized_pnl_rel_to_own_total_unrealized_pnl: MetricPattern1, + pub supply_in_loss_rel_to_own_supply: MetricPattern1, + pub supply_in_profit_rel_to_own_supply: MetricPattern1, + pub unrealized_loss_rel_to_own_market_cap: MetricPattern1, + pub unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1, + pub unrealized_profit_rel_to_own_market_cap: MetricPattern1, + pub unrealized_profit_rel_to_own_total_unrealized_pnl: MetricPattern1, +} + +impl InvestedNegNetSupplyUnrealizedPattern { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + invested_capital_in_loss_pct: MetricPattern1::new(client.clone(), _m(&acc, "invested_capital_in_loss_pct")), + invested_capital_in_profit_pct: MetricPattern1::new(client.clone(), _m(&acc, "invested_capital_in_profit_pct")), + neg_unrealized_loss_rel_to_own_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "neg_unrealized_loss_rel_to_own_market_cap")), + neg_unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "neg_unrealized_loss_rel_to_own_total_unrealized_pnl")), + net_unrealized_pnl_rel_to_own_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "net_unrealized_pnl_rel_to_own_market_cap")), + net_unrealized_pnl_rel_to_own_total_unrealized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "net_unrealized_pnl_rel_to_own_total_unrealized_pnl")), + supply_in_loss_rel_to_own_supply: MetricPattern1::new(client.clone(), _m(&acc, "supply_in_loss_rel_to_own_supply")), + supply_in_profit_rel_to_own_supply: MetricPattern1::new(client.clone(), _m(&acc, "supply_in_profit_rel_to_own_supply")), + unrealized_loss_rel_to_own_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_loss_rel_to_own_market_cap")), + unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_loss_rel_to_own_total_unrealized_pnl")), + unrealized_profit_rel_to_own_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_profit_rel_to_own_market_cap")), + unrealized_profit_rel_to_own_total_unrealized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_profit_rel_to_own_total_unrealized_pnl")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct _10y1m1w1y2y3m3y4y5y6m6y8yPattern2 { pub _10y: MetricPattern4, pub _1m: MetricPattern4, pub _1w: MetricPattern4, @@ -1495,7 +1721,7 @@ pub struct PeriodDaysInLossPattern { pub _8y: MetricPattern4, } -impl PeriodDaysInLossPattern { +impl _10y1m1w1y2y3m3y4y5y6m6y8yPattern2 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -1516,7 +1742,7 @@ impl PeriodDaysInLossPattern { } /// Pattern struct for repeated tree structure. -pub struct ClassDaysInLossPattern { +pub struct _201520162017201820192020202120222023202420252026Pattern2 { pub _2015: MetricPattern4, pub _2016: MetricPattern4, pub _2017: MetricPattern4, @@ -1531,7 +1757,7 @@ pub struct ClassDaysInLossPattern { pub _2026: MetricPattern4, } -impl ClassDaysInLossPattern { +impl _201520162017201820192020202120222023202420252026Pattern2 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -1552,7 +1778,7 @@ impl ClassDaysInLossPattern { } /// Pattern struct for repeated tree structure. -pub struct BitcoinPattern { +pub struct AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern { pub average: MetricPattern2, pub base: MetricPattern11, pub cumulative: MetricPattern2, @@ -1566,7 +1792,7 @@ pub struct BitcoinPattern { pub sum: MetricPattern2, } -impl BitcoinPattern { +impl AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -1586,7 +1812,7 @@ impl BitcoinPattern { } /// Pattern struct for repeated tree structure. -pub struct DollarsPattern { +pub struct AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2 { pub average: MetricPattern2, pub base: MetricPattern11, pub cumulative: MetricPattern1, @@ -1600,7 +1826,7 @@ pub struct DollarsPattern { pub sum: MetricPattern2, } -impl DollarsPattern { +impl AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -1620,71 +1846,7 @@ impl DollarsPattern { } /// Pattern struct for repeated tree structure. -pub struct RelativePattern { - pub neg_unrealized_loss_rel_to_market_cap: MetricPattern1, - pub net_unrealized_pnl_rel_to_market_cap: MetricPattern1, - pub nupl: MetricPattern1, - pub supply_in_loss_rel_to_circulating_supply: MetricPattern1, - pub supply_in_loss_rel_to_own_supply: MetricPattern1, - pub supply_in_profit_rel_to_circulating_supply: MetricPattern1, - pub supply_in_profit_rel_to_own_supply: MetricPattern1, - pub supply_rel_to_circulating_supply: MetricPattern4, - pub unrealized_loss_rel_to_market_cap: MetricPattern1, - pub unrealized_profit_rel_to_market_cap: MetricPattern1, -} - -impl RelativePattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - neg_unrealized_loss_rel_to_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "neg_unrealized_loss_rel_to_market_cap")), - net_unrealized_pnl_rel_to_market_cap: MetricPattern1::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: MetricPattern1::new(client.clone(), _m(&acc, "supply_in_loss_rel_to_circulating_supply")), - supply_in_loss_rel_to_own_supply: MetricPattern1::new(client.clone(), _m(&acc, "supply_in_loss_rel_to_own_supply")), - supply_in_profit_rel_to_circulating_supply: MetricPattern1::new(client.clone(), _m(&acc, "supply_in_profit_rel_to_circulating_supply")), - supply_in_profit_rel_to_own_supply: MetricPattern1::new(client.clone(), _m(&acc, "supply_in_profit_rel_to_own_supply")), - supply_rel_to_circulating_supply: MetricPattern4::new(client.clone(), _m(&acc, "supply_rel_to_circulating_supply")), - unrealized_loss_rel_to_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_loss_rel_to_market_cap")), - unrealized_profit_rel_to_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_profit_rel_to_market_cap")), - } - } -} - -/// Pattern struct for repeated tree structure. -pub struct RelativePattern2 { - pub neg_unrealized_loss_rel_to_own_market_cap: MetricPattern1, - pub neg_unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1, - pub net_unrealized_pnl_rel_to_own_market_cap: MetricPattern1, - pub net_unrealized_pnl_rel_to_own_total_unrealized_pnl: MetricPattern1, - pub supply_in_loss_rel_to_own_supply: MetricPattern1, - pub supply_in_profit_rel_to_own_supply: MetricPattern1, - pub unrealized_loss_rel_to_own_market_cap: MetricPattern1, - pub unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1, - pub unrealized_profit_rel_to_own_market_cap: MetricPattern1, - pub unrealized_profit_rel_to_own_total_unrealized_pnl: MetricPattern1, -} - -impl RelativePattern2 { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - neg_unrealized_loss_rel_to_own_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "neg_unrealized_loss_rel_to_own_market_cap")), - neg_unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "neg_unrealized_loss_rel_to_own_total_unrealized_pnl")), - net_unrealized_pnl_rel_to_own_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "net_unrealized_pnl_rel_to_own_market_cap")), - net_unrealized_pnl_rel_to_own_total_unrealized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "net_unrealized_pnl_rel_to_own_total_unrealized_pnl")), - supply_in_loss_rel_to_own_supply: MetricPattern1::new(client.clone(), _m(&acc, "supply_in_loss_rel_to_own_supply")), - supply_in_profit_rel_to_own_supply: MetricPattern1::new(client.clone(), _m(&acc, "supply_in_profit_rel_to_own_supply")), - unrealized_loss_rel_to_own_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_loss_rel_to_own_market_cap")), - unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_loss_rel_to_own_total_unrealized_pnl")), - unrealized_profit_rel_to_own_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_profit_rel_to_own_market_cap")), - unrealized_profit_rel_to_own_total_unrealized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_profit_rel_to_own_total_unrealized_pnl")), - } - } -} - -/// Pattern struct for repeated tree structure. -pub struct CountPattern2 { +pub struct AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2 { pub average: MetricPattern1, pub cumulative: MetricPattern1, pub max: MetricPattern1, @@ -1697,7 +1859,7 @@ pub struct CountPattern2 { pub sum: MetricPattern1, } -impl CountPattern2 { +impl AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -1716,7 +1878,7 @@ impl CountPattern2 { } /// Pattern struct for repeated tree structure. -pub struct AddrCountPattern { +pub struct AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern { pub all: MetricPattern1, pub p2a: MetricPattern1, pub p2pk33: MetricPattern1, @@ -1728,7 +1890,7 @@ pub struct AddrCountPattern { pub p2wsh: MetricPattern1, } -impl AddrCountPattern { +impl AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -1746,7 +1908,7 @@ impl AddrCountPattern { } /// Pattern struct for repeated tree structure. -pub struct FeeRatePattern { +pub struct AverageMaxMedianMinPct10Pct25Pct75Pct90TxindexPattern { pub average: MetricPattern1, pub max: MetricPattern1, pub median: MetricPattern11, @@ -1758,7 +1920,7 @@ pub struct FeeRatePattern { pub txindex: MetricPattern27, } -impl FeeRatePattern { +impl AverageMaxMedianMinPct10Pct25Pct75Pct90TxindexPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -1776,7 +1938,7 @@ impl FeeRatePattern { } /// Pattern struct for repeated tree structure. -pub struct FullnessPattern { +pub struct AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern { pub average: MetricPattern2, pub base: MetricPattern11, pub max: MetricPattern2, @@ -1788,7 +1950,7 @@ pub struct FullnessPattern { pub pct90: MetricPattern6, } -impl FullnessPattern { +impl AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -1806,35 +1968,35 @@ impl FullnessPattern { } /// Pattern struct for repeated tree structure. -pub struct _0satsPattern { - pub activity: ActivityPattern2, +pub struct ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern { + pub activity: CoinblocksCoindaysSatblocksSatdaysSentPattern, pub addr_count: MetricPattern1, - pub cost_basis: CostBasisPattern, - pub outputs: OutputsPattern, - pub realized: RealizedPattern, - pub relative: RelativePattern, - pub supply: SupplyPattern2, - pub unrealized: UnrealizedPattern, + pub cost_basis: MaxMinPattern, + pub outputs: UtxoPattern, + pub realized: AthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern, + pub relative: InvestedNegNetNuplSupplyUnrealizedPattern, + pub supply: HalvedTotalPattern, + pub unrealized: AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern, } -impl _0satsPattern { +impl ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - activity: ActivityPattern2::new(client.clone(), acc.clone()), + activity: CoinblocksCoindaysSatblocksSatdaysSentPattern::new(client.clone(), acc.clone()), addr_count: MetricPattern1::new(client.clone(), _m(&acc, "addr_count")), - cost_basis: CostBasisPattern::new(client.clone(), acc.clone()), - outputs: OutputsPattern::new(client.clone(), _m(&acc, "utxo_count")), - realized: RealizedPattern::new(client.clone(), acc.clone()), - relative: RelativePattern::new(client.clone(), acc.clone()), - supply: SupplyPattern2::new(client.clone(), _m(&acc, "supply")), - unrealized: UnrealizedPattern::new(client.clone(), acc.clone()), + cost_basis: MaxMinPattern::new(client.clone(), acc.clone()), + outputs: UtxoPattern::new(client.clone(), _m(&acc, "utxo_count")), + realized: AthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern::new(client.clone(), acc.clone()), + relative: InvestedNegNetNuplSupplyUnrealizedPattern::new(client.clone(), acc.clone()), + supply: HalvedTotalPattern::new(client.clone(), _m(&acc, "supply")), + unrealized: AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern::new(client.clone(), acc.clone()), } } } /// Pattern struct for repeated tree structure. -pub struct PeriodCagrPattern { +pub struct _10y2y3y4y5y6y8yPattern { pub _10y: MetricPattern4, pub _2y: MetricPattern4, pub _3y: MetricPattern4, @@ -1844,7 +2006,7 @@ pub struct PeriodCagrPattern { pub _8y: MetricPattern4, } -impl PeriodCagrPattern { +impl _10y2y3y4y5y6y8yPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -1860,190 +2022,232 @@ impl PeriodCagrPattern { } /// Pattern struct for repeated tree structure. -pub struct _100btcPattern { - pub activity: ActivityPattern2, - pub cost_basis: CostBasisPattern, - pub outputs: OutputsPattern, - pub realized: RealizedPattern, - pub relative: RelativePattern, - pub supply: SupplyPattern2, - pub unrealized: UnrealizedPattern, +pub struct ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern { + pub activity: CoinblocksCoindaysSatblocksSatdaysSentPattern, + pub cost_basis: InvestedMaxMinPercentilesSpotPattern, + pub outputs: UtxoPattern, + pub realized: AthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern2, + pub relative: InvestedNegNetSupplyUnrealizedPattern, + pub supply: HalvedTotalPattern, + pub unrealized: AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern, } -impl _100btcPattern { +impl ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - activity: ActivityPattern2::new(client.clone(), acc.clone()), - cost_basis: CostBasisPattern::new(client.clone(), acc.clone()), - outputs: OutputsPattern::new(client.clone(), _m(&acc, "utxo_count")), - realized: RealizedPattern::new(client.clone(), acc.clone()), - relative: RelativePattern::new(client.clone(), acc.clone()), - supply: SupplyPattern2::new(client.clone(), _m(&acc, "supply")), - unrealized: UnrealizedPattern::new(client.clone(), acc.clone()), + activity: CoinblocksCoindaysSatblocksSatdaysSentPattern::new(client.clone(), acc.clone()), + cost_basis: InvestedMaxMinPercentilesSpotPattern::new(client.clone(), acc.clone()), + outputs: UtxoPattern::new(client.clone(), _m(&acc, "utxo_count")), + realized: AthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern2::new(client.clone(), acc.clone()), + relative: InvestedNegNetSupplyUnrealizedPattern::new(client.clone(), acc.clone()), + supply: HalvedTotalPattern::new(client.clone(), _m(&acc, "supply")), + unrealized: AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern::new(client.clone(), acc.clone()), } } } /// Pattern struct for repeated tree structure. -pub struct _0satsPattern2 { - pub activity: ActivityPattern2, - pub cost_basis: CostBasisPattern, - pub outputs: OutputsPattern, - pub realized: RealizedPattern, - pub relative: RelativePattern4, - pub supply: SupplyPattern2, - pub unrealized: UnrealizedPattern, +pub struct ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5 { + pub activity: CoinblocksCoindaysSatblocksSatdaysSentPattern, + pub cost_basis: MaxMinPattern, + pub outputs: UtxoPattern, + pub realized: AdjustedAthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern2, + pub relative: InvestedNegNetNuplSupplyUnrealizedPattern, + pub supply: HalvedTotalPattern, + pub unrealized: AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern, } -impl _0satsPattern2 { +impl ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - activity: ActivityPattern2::new(client.clone(), acc.clone()), - cost_basis: CostBasisPattern::new(client.clone(), acc.clone()), - outputs: OutputsPattern::new(client.clone(), _m(&acc, "utxo_count")), - realized: RealizedPattern::new(client.clone(), acc.clone()), - relative: RelativePattern4::new(client.clone(), _m(&acc, "supply_in")), - supply: SupplyPattern2::new(client.clone(), _m(&acc, "supply")), - unrealized: UnrealizedPattern::new(client.clone(), acc.clone()), + activity: CoinblocksCoindaysSatblocksSatdaysSentPattern::new(client.clone(), acc.clone()), + cost_basis: MaxMinPattern::new(client.clone(), acc.clone()), + outputs: UtxoPattern::new(client.clone(), _m(&acc, "utxo_count")), + realized: AdjustedAthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern2::new(client.clone(), acc.clone()), + relative: InvestedNegNetNuplSupplyUnrealizedPattern::new(client.clone(), acc.clone()), + supply: HalvedTotalPattern::new(client.clone(), _m(&acc, "supply")), + unrealized: AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern::new(client.clone(), acc.clone()), } } } /// Pattern struct for repeated tree structure. -pub struct _10yPattern { - pub activity: ActivityPattern2, - pub cost_basis: CostBasisPattern, - pub outputs: OutputsPattern, - pub realized: RealizedPattern4, - pub relative: RelativePattern, - pub supply: SupplyPattern2, - pub unrealized: UnrealizedPattern, +pub struct ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 { + pub activity: CoinblocksCoindaysSatblocksSatdaysSentPattern, + pub cost_basis: MaxMinPattern, + pub outputs: UtxoPattern, + pub realized: AthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern, + pub relative: InvestedNegNetNuplSupplyUnrealizedPattern, + pub supply: HalvedTotalPattern, + pub unrealized: AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern, } -impl _10yPattern { +impl ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - activity: ActivityPattern2::new(client.clone(), acc.clone()), - cost_basis: CostBasisPattern::new(client.clone(), acc.clone()), - outputs: OutputsPattern::new(client.clone(), _m(&acc, "utxo_count")), - realized: RealizedPattern4::new(client.clone(), acc.clone()), - relative: RelativePattern::new(client.clone(), acc.clone()), - supply: SupplyPattern2::new(client.clone(), _m(&acc, "supply")), - unrealized: UnrealizedPattern::new(client.clone(), acc.clone()), + activity: CoinblocksCoindaysSatblocksSatdaysSentPattern::new(client.clone(), acc.clone()), + cost_basis: MaxMinPattern::new(client.clone(), acc.clone()), + outputs: UtxoPattern::new(client.clone(), _m(&acc, "utxo_count")), + realized: AthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern::new(client.clone(), acc.clone()), + relative: InvestedNegNetNuplSupplyUnrealizedPattern::new(client.clone(), acc.clone()), + supply: HalvedTotalPattern::new(client.clone(), _m(&acc, "supply")), + unrealized: AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern::new(client.clone(), acc.clone()), } } } /// Pattern struct for repeated tree structure. -pub struct _10yTo12yPattern { - pub activity: ActivityPattern2, - pub cost_basis: CostBasisPattern2, - pub outputs: OutputsPattern, - pub realized: RealizedPattern2, - pub relative: RelativePattern2, - pub supply: SupplyPattern2, - pub unrealized: UnrealizedPattern, +pub struct ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 { + pub activity: CoinblocksCoindaysSatblocksSatdaysSentPattern, + pub cost_basis: MaxMinPattern, + pub outputs: UtxoPattern, + pub realized: AthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern, + pub relative: InvestedSupplyPattern, + pub supply: HalvedTotalPattern, + pub unrealized: AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern, } -impl _10yTo12yPattern { +impl ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - activity: ActivityPattern2::new(client.clone(), acc.clone()), - cost_basis: CostBasisPattern2::new(client.clone(), acc.clone()), - outputs: OutputsPattern::new(client.clone(), _m(&acc, "utxo_count")), - realized: RealizedPattern2::new(client.clone(), acc.clone()), - relative: RelativePattern2::new(client.clone(), acc.clone()), - supply: SupplyPattern2::new(client.clone(), _m(&acc, "supply")), - unrealized: UnrealizedPattern::new(client.clone(), acc.clone()), + activity: CoinblocksCoindaysSatblocksSatdaysSentPattern::new(client.clone(), acc.clone()), + cost_basis: MaxMinPattern::new(client.clone(), acc.clone()), + outputs: UtxoPattern::new(client.clone(), _m(&acc, "utxo_count")), + realized: AthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern::new(client.clone(), acc.clone()), + relative: InvestedSupplyPattern::new(client.clone(), acc.clone()), + supply: HalvedTotalPattern::new(client.clone(), _m(&acc, "supply")), + unrealized: AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern::new(client.clone(), acc.clone()), } } } /// Pattern struct for repeated tree structure. -pub struct UnrealizedPattern { - pub neg_unrealized_loss: MetricPattern1, - pub net_unrealized_pnl: MetricPattern1, - pub supply_in_loss: ActiveSupplyPattern, - pub supply_in_profit: ActiveSupplyPattern, - pub total_unrealized_pnl: MetricPattern1, - pub unrealized_loss: MetricPattern1, - pub unrealized_profit: MetricPattern1, +pub struct ActivityCostOutputsRealizedSupplyUnrealizedPattern { + pub activity: CoinblocksCoindaysSatblocksSatdaysSentPattern, + pub cost_basis: MaxMinPattern, + pub outputs: UtxoPattern, + pub realized: AthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern, + pub supply: HalvedTotalPattern, + pub unrealized: AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern, } -impl UnrealizedPattern { +impl ActivityCostOutputsRealizedSupplyUnrealizedPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - neg_unrealized_loss: MetricPattern1::new(client.clone(), _m(&acc, "neg_unrealized_loss")), - net_unrealized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "net_unrealized_pnl")), - supply_in_loss: ActiveSupplyPattern::new(client.clone(), _m(&acc, "supply_in_loss")), - supply_in_profit: ActiveSupplyPattern::new(client.clone(), _m(&acc, "supply_in_profit")), - total_unrealized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "total_unrealized_pnl")), - unrealized_loss: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_loss")), - unrealized_profit: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_profit")), + activity: CoinblocksCoindaysSatblocksSatdaysSentPattern::new(client.clone(), acc.clone()), + cost_basis: MaxMinPattern::new(client.clone(), acc.clone()), + outputs: UtxoPattern::new(client.clone(), _m(&acc, "utxo_count")), + realized: AthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern::new(client.clone(), acc.clone()), + supply: HalvedTotalPattern::new(client.clone(), _m(&acc, "supply")), + unrealized: AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern::new(client.clone(), acc.clone()), } } } /// Pattern struct for repeated tree structure. -pub struct AllPattern { - pub balance_decreased: FullnessPattern, - pub balance_increased: FullnessPattern, - pub both: FullnessPattern, - pub reactivated: FullnessPattern, - pub receiving: FullnessPattern, - pub sending: FullnessPattern, +pub struct BalanceBothReactivatedReceivingSendingPattern { + pub balance_decreased: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern, + pub balance_increased: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern, + pub both: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern, + pub reactivated: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern, + pub receiving: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern, + pub sending: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern, } -impl AllPattern { +impl BalanceBothReactivatedReceivingSendingPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - balance_decreased: FullnessPattern::new(client.clone(), _m(&acc, "balance_decreased")), - balance_increased: FullnessPattern::new(client.clone(), _m(&acc, "balance_increased")), - both: FullnessPattern::new(client.clone(), _m(&acc, "both")), - reactivated: FullnessPattern::new(client.clone(), _m(&acc, "reactivated")), - receiving: FullnessPattern::new(client.clone(), _m(&acc, "receiving")), - sending: FullnessPattern::new(client.clone(), _m(&acc, "sending")), + balance_decreased: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern::new(client.clone(), _m(&acc, "balance_decreased")), + balance_increased: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern::new(client.clone(), _m(&acc, "balance_increased")), + both: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern::new(client.clone(), _m(&acc, "both")), + reactivated: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern::new(client.clone(), _m(&acc, "reactivated")), + receiving: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern::new(client.clone(), _m(&acc, "receiving")), + sending: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern::new(client.clone(), _m(&acc, "sending")), } } } /// Pattern struct for repeated tree structure. -pub struct ActivityPattern2 { - pub coinblocks_destroyed: BlockCountPattern, - pub coindays_destroyed: BlockCountPattern, +pub struct InvestedMaxMinPercentilesSpotPattern { + pub invested_capital: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern, + pub max: DollarsSatsPattern, + pub min: DollarsSatsPattern, + pub percentiles: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern, + pub spot_cost_basis_percentile: MetricPattern4, + pub spot_invested_capital_percentile: MetricPattern4, +} + +impl InvestedMaxMinPercentilesSpotPattern { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + invested_capital: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern::new(client.clone(), _m(&acc, "invested_capital")), + max: DollarsSatsPattern::new(client.clone(), _m(&acc, "max_cost_basis")), + min: DollarsSatsPattern::new(client.clone(), _m(&acc, "min_cost_basis")), + percentiles: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern::new(client.clone(), _m(&acc, "cost_basis")), + spot_cost_basis_percentile: MetricPattern4::new(client.clone(), _m(&acc, "spot_cost_basis_percentile")), + spot_invested_capital_percentile: MetricPattern4::new(client.clone(), _m(&acc, "spot_invested_capital_percentile")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct CoinblocksCoindaysSatblocksSatdaysSentPattern { + pub coinblocks_destroyed: CumulativeSumPattern, + pub coindays_destroyed: CumulativeSumPattern, pub satblocks_destroyed: MetricPattern11, pub satdays_destroyed: MetricPattern11, - pub sent: UnclaimedRewardsPattern, + pub sent: BitcoinDollarsSatsPattern3, } -impl ActivityPattern2 { +impl CoinblocksCoindaysSatblocksSatdaysSentPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - coinblocks_destroyed: BlockCountPattern::new(client.clone(), _m(&acc, "coinblocks_destroyed")), - coindays_destroyed: BlockCountPattern::new(client.clone(), _m(&acc, "coindays_destroyed")), + coinblocks_destroyed: CumulativeSumPattern::new(client.clone(), _m(&acc, "coinblocks_destroyed")), + coindays_destroyed: CumulativeSumPattern::new(client.clone(), _m(&acc, "coindays_destroyed")), satblocks_destroyed: MetricPattern11::new(client.clone(), _m(&acc, "satblocks_destroyed")), satdays_destroyed: MetricPattern11::new(client.clone(), _m(&acc, "satdays_destroyed")), - sent: UnclaimedRewardsPattern::new(client.clone(), _m(&acc, "sent")), + sent: BitcoinDollarsSatsPattern3::new(client.clone(), _m(&acc, "sent")), } } } /// Pattern struct for repeated tree structure. -pub struct SplitPattern2 { +pub struct InvestedSupplyPattern { + pub invested_capital_in_loss_pct: MetricPattern1, + pub invested_capital_in_profit_pct: MetricPattern1, + pub supply_in_loss_rel_to_own_supply: MetricPattern1, + pub supply_in_profit_rel_to_own_supply: MetricPattern1, +} + +impl InvestedSupplyPattern { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + invested_capital_in_loss_pct: MetricPattern1::new(client.clone(), _m(&acc, "invested_capital_in_loss_pct")), + invested_capital_in_profit_pct: MetricPattern1::new(client.clone(), _m(&acc, "invested_capital_in_profit_pct")), + supply_in_loss_rel_to_own_supply: MetricPattern1::new(client.clone(), _m(&acc, "supply_in_loss_rel_to_own_supply")), + supply_in_profit_rel_to_own_supply: MetricPattern1::new(client.clone(), _m(&acc, "supply_in_profit_rel_to_own_supply")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct CloseHighLowOpenPattern2 { pub close: MetricPattern1, pub high: MetricPattern1, pub low: MetricPattern1, pub open: MetricPattern1, } -impl SplitPattern2 { +impl CloseHighLowOpenPattern2 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -2056,13 +2260,13 @@ impl SplitPattern2 { } /// Pattern struct for repeated tree structure. -pub struct SegwitAdoptionPattern { +pub struct BaseCumulativeSumPattern { pub base: MetricPattern11, pub cumulative: MetricPattern2, pub sum: MetricPattern2, } -impl SegwitAdoptionPattern { +impl BaseCumulativeSumPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -2074,13 +2278,31 @@ impl SegwitAdoptionPattern { } /// Pattern struct for repeated tree structure. -pub struct ActiveSupplyPattern { +pub struct BitcoinDollarsSatsPattern2 { + pub bitcoin: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern, + pub dollars: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2, + pub sats: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2, +} + +impl BitcoinDollarsSatsPattern2 { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + bitcoin: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern::new(client.clone(), _m(&acc, "btc")), + dollars: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), _m(&acc, "usd")), + sats: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), acc.clone()), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct BitcoinDollarsSatsPattern4 { pub bitcoin: MetricPattern1, pub dollars: MetricPattern1, pub sats: MetricPattern1, } -impl ActiveSupplyPattern { +impl BitcoinDollarsSatsPattern4 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -2092,13 +2314,13 @@ impl ActiveSupplyPattern { } /// Pattern struct for repeated tree structure. -pub struct _2015Pattern { +pub struct BitcoinDollarsSatsPattern5 { pub bitcoin: MetricPattern4, pub dollars: MetricPattern4, pub sats: MetricPattern4, } -impl _2015Pattern { +impl BitcoinDollarsSatsPattern5 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -2110,84 +2332,48 @@ impl _2015Pattern { } /// Pattern struct for repeated tree structure. -pub struct CoinbasePattern { - pub bitcoin: BitcoinPattern, - pub dollars: DollarsPattern, - pub sats: DollarsPattern, +pub struct BitcoinDollarsSatsPattern6 { + pub bitcoin: CumulativeSumPattern, + pub dollars: CumulativeSumPattern, + pub sats: CumulativeSumPattern, } -impl CoinbasePattern { +impl BitcoinDollarsSatsPattern6 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - bitcoin: BitcoinPattern::new(client.clone(), _m(&acc, "btc")), - dollars: DollarsPattern::new(client.clone(), _m(&acc, "usd")), - sats: DollarsPattern::new(client.clone(), acc.clone()), + bitcoin: CumulativeSumPattern::new(client.clone(), _m(&acc, "btc")), + dollars: CumulativeSumPattern::new(client.clone(), _m(&acc, "usd")), + sats: CumulativeSumPattern::new(client.clone(), acc.clone()), } } } /// Pattern struct for repeated tree structure. -pub struct UnclaimedRewardsPattern { - pub bitcoin: BitcoinPattern2, - pub dollars: BlockCountPattern, - pub sats: BlockCountPattern, +pub struct BitcoinDollarsSatsPattern3 { + pub bitcoin: CumulativeSumPattern2, + pub dollars: CumulativeSumPattern, + pub sats: CumulativeSumPattern, } -impl UnclaimedRewardsPattern { +impl BitcoinDollarsSatsPattern3 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - bitcoin: BitcoinPattern2::new(client.clone(), _m(&acc, "btc")), - dollars: BlockCountPattern::new(client.clone(), _m(&acc, "usd")), - sats: BlockCountPattern::new(client.clone(), acc.clone()), + bitcoin: CumulativeSumPattern2::new(client.clone(), _m(&acc, "btc")), + dollars: CumulativeSumPattern::new(client.clone(), _m(&acc, "usd")), + sats: CumulativeSumPattern::new(client.clone(), acc.clone()), } } } /// Pattern struct for repeated tree structure. -pub struct CoinbasePattern2 { - pub bitcoin: BlockCountPattern, - pub dollars: BlockCountPattern, - pub sats: BlockCountPattern, -} - -impl CoinbasePattern2 { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - bitcoin: BlockCountPattern::new(client.clone(), _m(&acc, "btc")), - dollars: BlockCountPattern::new(client.clone(), _m(&acc, "usd")), - sats: BlockCountPattern::new(client.clone(), acc.clone()), - } - } -} - -/// Pattern struct for repeated tree structure. -pub struct CostBasisPattern2 { - pub max: ActivePricePattern, - pub min: ActivePricePattern, - pub percentiles: PercentilesPattern, -} - -impl CostBasisPattern2 { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - max: ActivePricePattern::new(client.clone(), _m(&acc, "max_cost_basis")), - min: ActivePricePattern::new(client.clone(), _m(&acc, "min_cost_basis")), - percentiles: PercentilesPattern::new(client.clone(), _m(&acc, "cost_basis")), - } - } -} - -/// Pattern struct for repeated tree structure. -pub struct ActivePricePattern { +pub struct DollarsSatsPattern { pub dollars: MetricPattern1, pub sats: MetricPattern1, } -impl ActivePricePattern { +impl DollarsSatsPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -2198,12 +2384,12 @@ impl ActivePricePattern { } /// Pattern struct for repeated tree structure. -pub struct _0sdUsdPattern { +pub struct DollarsSatsPattern2 { pub dollars: MetricPattern4, pub sats: MetricPattern4, } -impl _0sdUsdPattern { +impl DollarsSatsPattern2 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -2214,44 +2400,44 @@ impl _0sdUsdPattern { } /// Pattern struct for repeated tree structure. -pub struct SupplyPattern2 { - pub halved: ActiveSupplyPattern, - pub total: ActiveSupplyPattern, +pub struct HalvedTotalPattern { + pub halved: BitcoinDollarsSatsPattern4, + pub total: BitcoinDollarsSatsPattern4, } -impl SupplyPattern2 { +impl HalvedTotalPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - halved: ActiveSupplyPattern::new(client.clone(), _m(&acc, "halved")), - total: ActiveSupplyPattern::new(client.clone(), acc.clone()), + halved: BitcoinDollarsSatsPattern4::new(client.clone(), _m(&acc, "halved")), + total: BitcoinDollarsSatsPattern4::new(client.clone(), acc.clone()), } } } /// Pattern struct for repeated tree structure. -pub struct CostBasisPattern { - pub max: ActivePricePattern, - pub min: ActivePricePattern, +pub struct MaxMinPattern { + pub max: DollarsSatsPattern, + pub min: DollarsSatsPattern, } -impl CostBasisPattern { +impl MaxMinPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - max: ActivePricePattern::new(client.clone(), _m(&acc, "max_cost_basis")), - min: ActivePricePattern::new(client.clone(), _m(&acc, "min_cost_basis")), + max: DollarsSatsPattern::new(client.clone(), _m(&acc, "max_cost_basis")), + min: DollarsSatsPattern::new(client.clone(), _m(&acc, "min_cost_basis")), } } } /// Pattern struct for repeated tree structure. -pub struct _1dReturns1mSdPattern { +pub struct SdSmaPattern { pub sd: MetricPattern4, pub sma: MetricPattern4, } -impl _1dReturns1mSdPattern { +impl SdSmaPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -2262,28 +2448,12 @@ impl _1dReturns1mSdPattern { } /// Pattern struct for repeated tree structure. -pub struct RelativePattern4 { - pub supply_in_loss_rel_to_own_supply: MetricPattern1, - pub supply_in_profit_rel_to_own_supply: MetricPattern1, -} - -impl RelativePattern4 { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - supply_in_loss_rel_to_own_supply: MetricPattern1::new(client.clone(), _m(&acc, "loss_rel_to_own_supply")), - supply_in_profit_rel_to_own_supply: MetricPattern1::new(client.clone(), _m(&acc, "profit_rel_to_own_supply")), - } - } -} - -/// Pattern struct for repeated tree structure. -pub struct BlockCountPattern { +pub struct CumulativeSumPattern { pub cumulative: MetricPattern1, pub sum: MetricPattern1, } -impl BlockCountPattern { +impl CumulativeSumPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -2294,12 +2464,12 @@ impl BlockCountPattern { } /// Pattern struct for repeated tree structure. -pub struct BitcoinPattern2 { +pub struct CumulativeSumPattern2 { pub cumulative: MetricPattern2, pub sum: MetricPattern1, } -impl BitcoinPattern2 { +impl CumulativeSumPattern2 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -2310,27 +2480,27 @@ impl BitcoinPattern2 { } /// Pattern struct for repeated tree structure. -pub struct SatsPattern { +pub struct OhlcSplitPattern2 { pub ohlc: MetricPattern1, - pub split: SplitPattern2, + pub split: CloseHighLowOpenPattern2, } -impl SatsPattern { +impl OhlcSplitPattern2 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { ohlc: MetricPattern1::new(client.clone(), _m(&acc, "ohlc_sats")), - split: SplitPattern2::new(client.clone(), _m(&acc, "sats")), + split: CloseHighLowOpenPattern2::new(client.clone(), _m(&acc, "sats")), } } } /// Pattern struct for repeated tree structure. -pub struct RealizedPriceExtraPattern { +pub struct RatioPattern2 { pub ratio: MetricPattern4, } -impl RealizedPriceExtraPattern { +impl RatioPattern2 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -2340,11 +2510,11 @@ impl RealizedPriceExtraPattern { } /// Pattern struct for repeated tree structure. -pub struct OutputsPattern { +pub struct UtxoPattern { pub utxo_count: MetricPattern1, } -impl OutputsPattern { +impl UtxoPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -2357,84 +2527,41 @@ impl OutputsPattern { /// Metrics tree node. pub struct MetricsTree { - pub addresses: MetricsTree_Addresses, pub blocks: MetricsTree_Blocks, + pub transactions: MetricsTree_Transactions, + pub inputs: MetricsTree_Inputs, + pub outputs: MetricsTree_Outputs, + pub addresses: MetricsTree_Addresses, + pub scripts: MetricsTree_Scripts, + pub positions: MetricsTree_Positions, pub cointime: MetricsTree_Cointime, pub constants: MetricsTree_Constants, - pub distribution: MetricsTree_Distribution, pub indexes: MetricsTree_Indexes, - pub inputs: MetricsTree_Inputs, pub market: MetricsTree_Market, - pub outputs: MetricsTree_Outputs, pub pools: MetricsTree_Pools, - pub positions: MetricsTree_Positions, pub price: MetricsTree_Price, - pub scripts: MetricsTree_Scripts, + pub distribution: MetricsTree_Distribution, pub supply: MetricsTree_Supply, - pub transactions: MetricsTree_Transactions, } impl MetricsTree { pub fn new(client: Arc, base_path: String) -> Self { Self { - addresses: MetricsTree_Addresses::new(client.clone(), format!("{base_path}_addresses")), blocks: MetricsTree_Blocks::new(client.clone(), format!("{base_path}_blocks")), + 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")), + scripts: MetricsTree_Scripts::new(client.clone(), format!("{base_path}_scripts")), + positions: MetricsTree_Positions::new(client.clone(), format!("{base_path}_positions")), cointime: MetricsTree_Cointime::new(client.clone(), format!("{base_path}_cointime")), constants: MetricsTree_Constants::new(client.clone(), format!("{base_path}_constants")), - distribution: MetricsTree_Distribution::new(client.clone(), format!("{base_path}_distribution")), indexes: MetricsTree_Indexes::new(client.clone(), format!("{base_path}_indexes")), - inputs: MetricsTree_Inputs::new(client.clone(), format!("{base_path}_inputs")), market: MetricsTree_Market::new(client.clone(), format!("{base_path}_market")), - outputs: MetricsTree_Outputs::new(client.clone(), format!("{base_path}_outputs")), pools: MetricsTree_Pools::new(client.clone(), format!("{base_path}_pools")), - positions: MetricsTree_Positions::new(client.clone(), format!("{base_path}_positions")), price: MetricsTree_Price::new(client.clone(), format!("{base_path}_price")), - scripts: MetricsTree_Scripts::new(client.clone(), format!("{base_path}_scripts")), + distribution: MetricsTree_Distribution::new(client.clone(), format!("{base_path}_distribution")), supply: MetricsTree_Supply::new(client.clone(), format!("{base_path}_supply")), - transactions: MetricsTree_Transactions::new(client.clone(), format!("{base_path}_transactions")), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Addresses { - pub first_p2aaddressindex: MetricPattern11, - pub first_p2pk33addressindex: MetricPattern11, - pub first_p2pk65addressindex: MetricPattern11, - pub first_p2pkhaddressindex: MetricPattern11, - pub first_p2shaddressindex: MetricPattern11, - pub first_p2traddressindex: MetricPattern11, - pub first_p2wpkhaddressindex: MetricPattern11, - pub first_p2wshaddressindex: MetricPattern11, - pub p2abytes: MetricPattern16, - pub p2pk33bytes: MetricPattern18, - pub p2pk65bytes: MetricPattern19, - pub p2pkhbytes: MetricPattern20, - pub p2shbytes: MetricPattern21, - pub p2trbytes: MetricPattern22, - pub p2wpkhbytes: MetricPattern23, - pub p2wshbytes: MetricPattern24, -} - -impl MetricsTree_Addresses { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - first_p2aaddressindex: MetricPattern11::new(client.clone(), "first_p2aaddressindex".to_string()), - first_p2pk33addressindex: MetricPattern11::new(client.clone(), "first_p2pk33addressindex".to_string()), - first_p2pk65addressindex: MetricPattern11::new(client.clone(), "first_p2pk65addressindex".to_string()), - first_p2pkhaddressindex: MetricPattern11::new(client.clone(), "first_p2pkhaddressindex".to_string()), - first_p2shaddressindex: MetricPattern11::new(client.clone(), "first_p2shaddressindex".to_string()), - first_p2traddressindex: MetricPattern11::new(client.clone(), "first_p2traddressindex".to_string()), - first_p2wpkhaddressindex: MetricPattern11::new(client.clone(), "first_p2wpkhaddressindex".to_string()), - first_p2wshaddressindex: MetricPattern11::new(client.clone(), "first_p2wshaddressindex".to_string()), - p2abytes: MetricPattern16::new(client.clone(), "p2abytes".to_string()), - p2pk33bytes: MetricPattern18::new(client.clone(), "p2pk33bytes".to_string()), - p2pk65bytes: MetricPattern19::new(client.clone(), "p2pk65bytes".to_string()), - p2pkhbytes: MetricPattern20::new(client.clone(), "p2pkhbytes".to_string()), - p2shbytes: MetricPattern21::new(client.clone(), "p2shbytes".to_string()), - p2trbytes: MetricPattern22::new(client.clone(), "p2trbytes".to_string()), - p2wpkhbytes: MetricPattern23::new(client.clone(), "p2wpkhbytes".to_string()), - p2wshbytes: MetricPattern24::new(client.clone(), "p2wshbytes".to_string()), } } } @@ -2442,148 +2569,148 @@ impl MetricsTree_Addresses { /// Metrics tree node. pub struct MetricsTree_Blocks { pub blockhash: MetricPattern11, - pub count: MetricsTree_Blocks_Count, pub difficulty: MetricsTree_Blocks_Difficulty, - pub fullness: FullnessPattern, - pub halving: MetricsTree_Blocks_Halving, - pub interval: FullnessPattern, - pub mining: MetricsTree_Blocks_Mining, - pub rewards: MetricsTree_Blocks_Rewards, - pub size: MetricsTree_Blocks_Size, pub time: MetricsTree_Blocks_Time, pub total_size: MetricPattern11, - pub vbytes: DollarsPattern, - pub weight: DollarsPattern, + pub weight: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2, + pub count: MetricsTree_Blocks_Count, + pub interval: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern, + pub mining: MetricsTree_Blocks_Mining, + pub rewards: MetricsTree_Blocks_Rewards, + pub halving: MetricsTree_Blocks_Halving, + pub vbytes: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2, + pub size: MetricsTree_Blocks_Size, + pub fullness: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern, } impl MetricsTree_Blocks { pub fn new(client: Arc, base_path: String) -> Self { Self { blockhash: MetricPattern11::new(client.clone(), "blockhash".to_string()), - count: MetricsTree_Blocks_Count::new(client.clone(), format!("{base_path}_count")), difficulty: MetricsTree_Blocks_Difficulty::new(client.clone(), format!("{base_path}_difficulty")), - fullness: FullnessPattern::new(client.clone(), "block_fullness".to_string()), - halving: MetricsTree_Blocks_Halving::new(client.clone(), format!("{base_path}_halving")), - interval: FullnessPattern::new(client.clone(), "block_interval".to_string()), - mining: MetricsTree_Blocks_Mining::new(client.clone(), format!("{base_path}_mining")), - rewards: MetricsTree_Blocks_Rewards::new(client.clone(), format!("{base_path}_rewards")), - size: MetricsTree_Blocks_Size::new(client.clone(), format!("{base_path}_size")), time: MetricsTree_Blocks_Time::new(client.clone(), format!("{base_path}_time")), total_size: MetricPattern11::new(client.clone(), "total_size".to_string()), - vbytes: DollarsPattern::new(client.clone(), "block_vbytes".to_string()), - weight: DollarsPattern::new(client.clone(), "block_weight".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Blocks_Count { - pub _1m_block_count: MetricPattern1, - pub _1m_start: MetricPattern11, - pub _1w_block_count: MetricPattern1, - pub _1w_start: MetricPattern11, - pub _1y_block_count: MetricPattern1, - pub _1y_start: MetricPattern11, - pub _24h_block_count: MetricPattern1, - pub _24h_start: MetricPattern11, - pub block_count: BlockCountPattern, - pub block_count_target: MetricPattern4, -} - -impl MetricsTree_Blocks_Count { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - _1m_block_count: MetricPattern1::new(client.clone(), "1m_block_count".to_string()), - _1m_start: MetricPattern11::new(client.clone(), "1m_start".to_string()), - _1w_block_count: MetricPattern1::new(client.clone(), "1w_block_count".to_string()), - _1w_start: MetricPattern11::new(client.clone(), "1w_start".to_string()), - _1y_block_count: MetricPattern1::new(client.clone(), "1y_block_count".to_string()), - _1y_start: MetricPattern11::new(client.clone(), "1y_start".to_string()), - _24h_block_count: MetricPattern1::new(client.clone(), "24h_block_count".to_string()), - _24h_start: MetricPattern11::new(client.clone(), "24h_start".to_string()), - block_count: BlockCountPattern::new(client.clone(), "block_count".to_string()), - block_count_target: MetricPattern4::new(client.clone(), "block_count_target".to_string()), + weight: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), "block_weight".to_string()), + count: MetricsTree_Blocks_Count::new(client.clone(), format!("{base_path}_count")), + interval: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern::new(client.clone(), "block_interval".to_string()), + mining: MetricsTree_Blocks_Mining::new(client.clone(), format!("{base_path}_mining")), + rewards: MetricsTree_Blocks_Rewards::new(client.clone(), format!("{base_path}_rewards")), + halving: MetricsTree_Blocks_Halving::new(client.clone(), format!("{base_path}_halving")), + vbytes: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), "block_vbytes".to_string()), + size: MetricsTree_Blocks_Size::new(client.clone(), format!("{base_path}_size")), + fullness: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern::new(client.clone(), "block_fullness".to_string()), } } } /// Metrics tree node. pub struct MetricsTree_Blocks_Difficulty { - pub adjustment: MetricPattern1, + pub raw: MetricPattern1, pub as_hash: MetricPattern1, + pub adjustment: MetricPattern1, + pub epoch: MetricPattern4, pub blocks_before_next_adjustment: MetricPattern1, pub days_before_next_adjustment: MetricPattern1, - pub epoch: MetricPattern4, - pub raw: MetricPattern1, } impl MetricsTree_Blocks_Difficulty { pub fn new(client: Arc, base_path: String) -> Self { Self { - adjustment: MetricPattern1::new(client.clone(), "difficulty_adjustment".to_string()), + raw: MetricPattern1::new(client.clone(), "difficulty".to_string()), as_hash: MetricPattern1::new(client.clone(), "difficulty_as_hash".to_string()), + adjustment: MetricPattern1::new(client.clone(), "difficulty_adjustment".to_string()), + epoch: MetricPattern4::new(client.clone(), "difficultyepoch".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()), - epoch: MetricPattern4::new(client.clone(), "difficultyepoch".to_string()), - raw: MetricPattern1::new(client.clone(), "difficulty".to_string()), } } } /// Metrics tree node. -pub struct MetricsTree_Blocks_Halving { - pub blocks_before_next_halving: MetricPattern1, - pub days_before_next_halving: MetricPattern1, - pub epoch: MetricPattern4, +pub struct MetricsTree_Blocks_Time { + pub timestamp: MetricPattern1, + pub date: MetricPattern11, + pub timestamp_monotonic: MetricPattern11, } -impl MetricsTree_Blocks_Halving { +impl MetricsTree_Blocks_Time { pub fn new(client: Arc, base_path: String) -> Self { Self { - 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()), - epoch: MetricPattern4::new(client.clone(), "halvingepoch".to_string()), + timestamp: MetricPattern1::new(client.clone(), "timestamp".to_string()), + date: MetricPattern11::new(client.clone(), "date".to_string()), + timestamp_monotonic: MetricPattern11::new(client.clone(), "timestamp_monotonic".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Blocks_Count { + pub block_count_target: MetricPattern4, + pub block_count: CumulativeSumPattern, + pub _24h_start: MetricPattern11, + pub _1w_start: MetricPattern11, + pub _1m_start: MetricPattern11, + pub _1y_start: MetricPattern11, + pub _24h_block_count: MetricPattern1, + pub _1w_block_count: MetricPattern1, + pub _1m_block_count: MetricPattern1, + pub _1y_block_count: MetricPattern1, +} + +impl MetricsTree_Blocks_Count { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + block_count_target: MetricPattern4::new(client.clone(), "block_count_target".to_string()), + block_count: CumulativeSumPattern::new(client.clone(), "block_count".to_string()), + _24h_start: MetricPattern11::new(client.clone(), "24h_start".to_string()), + _1w_start: MetricPattern11::new(client.clone(), "1w_start".to_string()), + _1m_start: MetricPattern11::new(client.clone(), "1m_start".to_string()), + _1y_start: MetricPattern11::new(client.clone(), "1y_start".to_string()), + _24h_block_count: MetricPattern1::new(client.clone(), "24h_block_count".to_string()), + _1w_block_count: MetricPattern1::new(client.clone(), "1w_block_count".to_string()), + _1m_block_count: MetricPattern1::new(client.clone(), "1m_block_count".to_string()), + _1y_block_count: MetricPattern1::new(client.clone(), "1y_block_count".to_string()), } } } /// Metrics tree node. pub struct MetricsTree_Blocks_Mining { + pub hash_rate: MetricPattern1, + pub hash_rate_1w_sma: MetricPattern4, + pub hash_rate_1m_sma: MetricPattern4, + pub hash_rate_2m_sma: MetricPattern4, + pub hash_rate_1y_sma: MetricPattern4, + pub hash_price_ths: MetricPattern1, + pub hash_price_ths_min: MetricPattern1, pub hash_price_phs: MetricPattern1, pub hash_price_phs_min: MetricPattern1, pub hash_price_rebound: MetricPattern1, - pub hash_price_ths: MetricPattern1, - pub hash_price_ths_min: MetricPattern1, - pub hash_rate: MetricPattern1, - pub hash_rate_1m_sma: MetricPattern4, - pub hash_rate_1w_sma: MetricPattern4, - pub hash_rate_1y_sma: MetricPattern4, - pub hash_rate_2m_sma: MetricPattern4, + pub hash_value_ths: MetricPattern1, + pub hash_value_ths_min: MetricPattern1, pub hash_value_phs: MetricPattern1, pub hash_value_phs_min: MetricPattern1, pub hash_value_rebound: MetricPattern1, - pub hash_value_ths: MetricPattern1, - pub hash_value_ths_min: MetricPattern1, } impl MetricsTree_Blocks_Mining { pub fn new(client: Arc, base_path: String) -> Self { Self { + hash_rate: MetricPattern1::new(client.clone(), "hash_rate".to_string()), + hash_rate_1w_sma: MetricPattern4::new(client.clone(), "hash_rate_1w_sma".to_string()), + hash_rate_1m_sma: MetricPattern4::new(client.clone(), "hash_rate_1m_sma".to_string()), + hash_rate_2m_sma: MetricPattern4::new(client.clone(), "hash_rate_2m_sma".to_string()), + hash_rate_1y_sma: MetricPattern4::new(client.clone(), "hash_rate_1y_sma".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_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: MetricPattern1::new(client.clone(), "hash_price_rebound".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_rate: MetricPattern1::new(client.clone(), "hash_rate".to_string()), - hash_rate_1m_sma: MetricPattern4::new(client.clone(), "hash_rate_1m_sma".to_string()), - hash_rate_1w_sma: MetricPattern4::new(client.clone(), "hash_rate_1w_sma".to_string()), - hash_rate_1y_sma: MetricPattern4::new(client.clone(), "hash_rate_1y_sma".to_string()), - hash_rate_2m_sma: MetricPattern4::new(client.clone(), "hash_rate_2m_sma".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_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: MetricPattern1::new(client.clone(), "hash_value_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()), } } } @@ -2591,54 +2718,71 @@ impl MetricsTree_Blocks_Mining { /// Metrics tree node. pub struct MetricsTree_Blocks_Rewards { pub _24h_coinbase_sum: MetricsTree_Blocks_Rewards_24hCoinbaseSum, - pub coinbase: CoinbasePattern, + pub coinbase: BitcoinDollarsSatsPattern2, + pub subsidy: BitcoinDollarsSatsPattern2, + pub unclaimed_rewards: BitcoinDollarsSatsPattern3, pub fee_dominance: MetricPattern6, - pub subsidy: CoinbasePattern, pub subsidy_dominance: MetricPattern6, pub subsidy_usd_1y_sma: MetricPattern4, - pub unclaimed_rewards: UnclaimedRewardsPattern, } impl MetricsTree_Blocks_Rewards { pub fn new(client: Arc, base_path: String) -> Self { Self { _24h_coinbase_sum: MetricsTree_Blocks_Rewards_24hCoinbaseSum::new(client.clone(), format!("{base_path}_24h_coinbase_sum")), - coinbase: CoinbasePattern::new(client.clone(), "coinbase".to_string()), + coinbase: BitcoinDollarsSatsPattern2::new(client.clone(), "coinbase".to_string()), + subsidy: BitcoinDollarsSatsPattern2::new(client.clone(), "subsidy".to_string()), + unclaimed_rewards: BitcoinDollarsSatsPattern3::new(client.clone(), "unclaimed_rewards".to_string()), fee_dominance: MetricPattern6::new(client.clone(), "fee_dominance".to_string()), - subsidy: CoinbasePattern::new(client.clone(), "subsidy".to_string()), subsidy_dominance: MetricPattern6::new(client.clone(), "subsidy_dominance".to_string()), subsidy_usd_1y_sma: MetricPattern4::new(client.clone(), "subsidy_usd_1y_sma".to_string()), - unclaimed_rewards: UnclaimedRewardsPattern::new(client.clone(), "unclaimed_rewards".to_string()), } } } /// Metrics tree node. pub struct MetricsTree_Blocks_Rewards_24hCoinbaseSum { + pub sats: MetricPattern11, pub bitcoin: MetricPattern11, pub dollars: MetricPattern11, - pub sats: MetricPattern11, } impl MetricsTree_Blocks_Rewards_24hCoinbaseSum { pub fn new(client: Arc, base_path: String) -> Self { Self { + sats: MetricPattern11::new(client.clone(), "24h_coinbase_sum".to_string()), bitcoin: MetricPattern11::new(client.clone(), "24h_coinbase_sum_btc".to_string()), dollars: MetricPattern11::new(client.clone(), "24h_coinbase_sum_usd".to_string()), - sats: MetricPattern11::new(client.clone(), "24h_coinbase_sum".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Blocks_Halving { + pub epoch: MetricPattern4, + pub blocks_before_next_halving: MetricPattern1, + pub days_before_next_halving: MetricPattern1, +} + +impl MetricsTree_Blocks_Halving { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + epoch: MetricPattern4::new(client.clone(), "halvingepoch".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()), } } } /// Metrics tree node. pub struct MetricsTree_Blocks_Size { - pub average: MetricPattern2, pub cumulative: MetricPattern1, - pub max: MetricPattern2, - pub median: MetricPattern6, + pub average: MetricPattern2, pub min: MetricPattern2, + pub max: MetricPattern2, pub pct10: MetricPattern6, pub pct25: MetricPattern6, + pub median: MetricPattern6, pub pct75: MetricPattern6, pub pct90: MetricPattern6, pub sum: MetricPattern2, @@ -2647,13 +2791,13 @@ pub struct MetricsTree_Blocks_Size { impl MetricsTree_Blocks_Size { pub fn new(client: Arc, base_path: String) -> Self { Self { - average: MetricPattern2::new(client.clone(), "block_size_average".to_string()), cumulative: MetricPattern1::new(client.clone(), "block_size_cumulative".to_string()), - max: MetricPattern2::new(client.clone(), "block_size_max".to_string()), - median: MetricPattern6::new(client.clone(), "block_size_median".to_string()), + average: MetricPattern2::new(client.clone(), "block_size_average".to_string()), min: MetricPattern2::new(client.clone(), "block_size_min".to_string()), + max: MetricPattern2::new(client.clone(), "block_size_max".to_string()), pct10: MetricPattern6::new(client.clone(), "block_size_pct10".to_string()), pct25: MetricPattern6::new(client.clone(), "block_size_pct25".to_string()), + median: MetricPattern6::new(client.clone(), "block_size_median".to_string()), pct75: MetricPattern6::new(client.clone(), "block_size_pct75".to_string()), pct90: MetricPattern6::new(client.clone(), "block_size_pct90".to_string()), sum: MetricPattern2::new(client.clone(), "block_size_sum".to_string()), @@ -2662,18 +2806,386 @@ impl MetricsTree_Blocks_Size { } /// Metrics tree node. -pub struct MetricsTree_Blocks_Time { - pub date: MetricPattern11, - pub timestamp: MetricPattern1, - pub timestamp_monotonic: MetricPattern11, +pub struct MetricsTree_Transactions { + pub first_txindex: MetricPattern11, + pub height: MetricPattern27, + pub txid: MetricPattern27, + pub txversion: MetricPattern27, + pub rawlocktime: MetricPattern27, + pub base_size: MetricPattern27, + pub total_size: MetricPattern27, + pub is_explicitly_rbf: MetricPattern27, + pub first_txinindex: MetricPattern27, + pub first_txoutindex: MetricPattern27, + pub count: MetricsTree_Transactions_Count, + pub size: MetricsTree_Transactions_Size, + pub fees: MetricsTree_Transactions_Fees, + pub versions: MetricsTree_Transactions_Versions, + pub volume: MetricsTree_Transactions_Volume, } -impl MetricsTree_Blocks_Time { +impl MetricsTree_Transactions { pub fn new(client: Arc, base_path: String) -> Self { Self { - date: MetricPattern11::new(client.clone(), "date".to_string()), - timestamp: MetricPattern1::new(client.clone(), "timestamp".to_string()), - timestamp_monotonic: MetricPattern11::new(client.clone(), "timestamp_monotonic".to_string()), + first_txindex: MetricPattern11::new(client.clone(), "first_txindex".to_string()), + height: MetricPattern27::new(client.clone(), "height".to_string()), + txid: MetricPattern27::new(client.clone(), "txid".to_string()), + txversion: MetricPattern27::new(client.clone(), "txversion".to_string()), + rawlocktime: MetricPattern27::new(client.clone(), "rawlocktime".to_string()), + base_size: MetricPattern27::new(client.clone(), "base_size".to_string()), + total_size: MetricPattern27::new(client.clone(), "total_size".to_string()), + is_explicitly_rbf: MetricPattern27::new(client.clone(), "is_explicitly_rbf".to_string()), + first_txinindex: MetricPattern27::new(client.clone(), "first_txinindex".to_string()), + first_txoutindex: MetricPattern27::new(client.clone(), "first_txoutindex".to_string()), + 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")), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Transactions_Count { + pub tx_count: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2, + pub is_coinbase: MetricPattern27, +} + +impl MetricsTree_Transactions_Count { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + tx_count: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), "tx_count".to_string()), + is_coinbase: MetricPattern27::new(client.clone(), "is_coinbase".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Transactions_Size { + pub vsize: AverageMaxMedianMinPct10Pct25Pct75Pct90TxindexPattern, + pub weight: AverageMaxMedianMinPct10Pct25Pct75Pct90TxindexPattern, +} + +impl MetricsTree_Transactions_Size { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + vsize: AverageMaxMedianMinPct10Pct25Pct75Pct90TxindexPattern::new(client.clone(), "tx_vsize".to_string()), + weight: AverageMaxMedianMinPct10Pct25Pct75Pct90TxindexPattern::new(client.clone(), "tx_weight".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Transactions_Fees { + pub input_value: MetricPattern27, + pub output_value: MetricPattern27, + pub fee: MetricsTree_Transactions_Fees_Fee, + pub fee_rate: AverageMaxMedianMinPct10Pct25Pct75Pct90TxindexPattern, +} + +impl MetricsTree_Transactions_Fees { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + input_value: MetricPattern27::new(client.clone(), "input_value".to_string()), + output_value: MetricPattern27::new(client.clone(), "output_value".to_string()), + fee: MetricsTree_Transactions_Fees_Fee::new(client.clone(), format!("{base_path}_fee")), + fee_rate: AverageMaxMedianMinPct10Pct25Pct75Pct90TxindexPattern::new(client.clone(), "fee_rate".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Transactions_Fees_Fee { + pub txindex: MetricPattern27, + pub sats: AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2, + pub bitcoin: AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2, + pub dollars: AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2, +} + +impl MetricsTree_Transactions_Fees_Fee { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + txindex: MetricPattern27::new(client.clone(), "fee".to_string()), + sats: AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), "fee".to_string()), + bitcoin: AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), "fee_btc".to_string()), + dollars: AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), "fee_usd".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Transactions_Versions { + pub v1: CumulativeSumPattern, + pub v2: CumulativeSumPattern, + pub v3: CumulativeSumPattern, +} + +impl MetricsTree_Transactions_Versions { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + v1: CumulativeSumPattern::new(client.clone(), "tx_v1".to_string()), + v2: CumulativeSumPattern::new(client.clone(), "tx_v2".to_string()), + v3: CumulativeSumPattern::new(client.clone(), "tx_v3".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Transactions_Volume { + pub sent_sum: BitcoinDollarsSatsPattern4, + pub received_sum: BitcoinDollarsSatsPattern4, + pub annualized_volume: BitcoinDollarsSatsPattern5, + pub tx_per_sec: MetricPattern4, + pub outputs_per_sec: MetricPattern4, + pub inputs_per_sec: MetricPattern4, +} + +impl MetricsTree_Transactions_Volume { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + sent_sum: BitcoinDollarsSatsPattern4::new(client.clone(), "sent_sum".to_string()), + received_sum: BitcoinDollarsSatsPattern4::new(client.clone(), "received_sum".to_string()), + annualized_volume: BitcoinDollarsSatsPattern5::new(client.clone(), "annualized_volume".to_string()), + tx_per_sec: MetricPattern4::new(client.clone(), "tx_per_sec".to_string()), + outputs_per_sec: MetricPattern4::new(client.clone(), "outputs_per_sec".to_string()), + inputs_per_sec: MetricPattern4::new(client.clone(), "inputs_per_sec".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Inputs { + pub first_txinindex: MetricPattern11, + pub outpoint: MetricPattern12, + pub txindex: MetricPattern12, + pub outputtype: MetricPattern12, + pub typeindex: MetricPattern12, + pub spent: MetricsTree_Inputs_Spent, + pub count: AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2, +} + +impl MetricsTree_Inputs { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + first_txinindex: MetricPattern11::new(client.clone(), "first_txinindex".to_string()), + outpoint: MetricPattern12::new(client.clone(), "outpoint".to_string()), + txindex: MetricPattern12::new(client.clone(), "txindex".to_string()), + outputtype: MetricPattern12::new(client.clone(), "outputtype".to_string()), + typeindex: MetricPattern12::new(client.clone(), "typeindex".to_string()), + spent: MetricsTree_Inputs_Spent::new(client.clone(), format!("{base_path}_spent")), + count: AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), "input_count".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Inputs_Spent { + pub txoutindex: MetricPattern12, + pub value: MetricPattern12, +} + +impl MetricsTree_Inputs_Spent { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + txoutindex: MetricPattern12::new(client.clone(), "txoutindex".to_string()), + value: MetricPattern12::new(client.clone(), "value".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Outputs { + pub first_txoutindex: MetricPattern11, + pub value: MetricPattern15, + pub outputtype: MetricPattern15, + pub typeindex: MetricPattern15, + pub txindex: MetricPattern15, + pub spent: MetricsTree_Outputs_Spent, + pub count: MetricsTree_Outputs_Count, +} + +impl MetricsTree_Outputs { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + first_txoutindex: MetricPattern11::new(client.clone(), "first_txoutindex".to_string()), + value: MetricPattern15::new(client.clone(), "value".to_string()), + outputtype: MetricPattern15::new(client.clone(), "outputtype".to_string()), + typeindex: MetricPattern15::new(client.clone(), "typeindex".to_string()), + txindex: MetricPattern15::new(client.clone(), "txindex".to_string()), + spent: MetricsTree_Outputs_Spent::new(client.clone(), format!("{base_path}_spent")), + count: MetricsTree_Outputs_Count::new(client.clone(), format!("{base_path}_count")), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Outputs_Spent { + pub txinindex: MetricPattern15, +} + +impl MetricsTree_Outputs_Spent { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + txinindex: MetricPattern15::new(client.clone(), "txinindex".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Outputs_Count { + pub total_count: AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2, + pub utxo_count: MetricPattern1, +} + +impl MetricsTree_Outputs_Count { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + total_count: AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), "output_count".to_string()), + utxo_count: MetricPattern1::new(client.clone(), "exact_utxo_count".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Addresses { + pub first_p2pk65addressindex: MetricPattern11, + pub first_p2pk33addressindex: MetricPattern11, + pub first_p2pkhaddressindex: MetricPattern11, + pub first_p2shaddressindex: MetricPattern11, + pub first_p2wpkhaddressindex: MetricPattern11, + pub first_p2wshaddressindex: MetricPattern11, + pub first_p2traddressindex: MetricPattern11, + pub first_p2aaddressindex: MetricPattern11, + pub p2pk65bytes: MetricPattern19, + pub p2pk33bytes: MetricPattern18, + pub p2pkhbytes: MetricPattern20, + pub p2shbytes: MetricPattern21, + pub p2wpkhbytes: MetricPattern23, + pub p2wshbytes: MetricPattern24, + pub p2trbytes: MetricPattern22, + pub p2abytes: MetricPattern16, +} + +impl MetricsTree_Addresses { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + first_p2pk65addressindex: MetricPattern11::new(client.clone(), "first_p2pk65addressindex".to_string()), + first_p2pk33addressindex: MetricPattern11::new(client.clone(), "first_p2pk33addressindex".to_string()), + first_p2pkhaddressindex: MetricPattern11::new(client.clone(), "first_p2pkhaddressindex".to_string()), + first_p2shaddressindex: MetricPattern11::new(client.clone(), "first_p2shaddressindex".to_string()), + first_p2wpkhaddressindex: MetricPattern11::new(client.clone(), "first_p2wpkhaddressindex".to_string()), + first_p2wshaddressindex: MetricPattern11::new(client.clone(), "first_p2wshaddressindex".to_string()), + first_p2traddressindex: MetricPattern11::new(client.clone(), "first_p2traddressindex".to_string()), + first_p2aaddressindex: MetricPattern11::new(client.clone(), "first_p2aaddressindex".to_string()), + p2pk65bytes: MetricPattern19::new(client.clone(), "p2pk65bytes".to_string()), + p2pk33bytes: MetricPattern18::new(client.clone(), "p2pk33bytes".to_string()), + p2pkhbytes: MetricPattern20::new(client.clone(), "p2pkhbytes".to_string()), + p2shbytes: MetricPattern21::new(client.clone(), "p2shbytes".to_string()), + p2wpkhbytes: MetricPattern23::new(client.clone(), "p2wpkhbytes".to_string()), + p2wshbytes: MetricPattern24::new(client.clone(), "p2wshbytes".to_string()), + p2trbytes: MetricPattern22::new(client.clone(), "p2trbytes".to_string()), + p2abytes: MetricPattern16::new(client.clone(), "p2abytes".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Scripts { + pub first_emptyoutputindex: MetricPattern11, + pub first_opreturnindex: MetricPattern11, + pub first_p2msoutputindex: MetricPattern11, + pub first_unknownoutputindex: MetricPattern11, + pub empty_to_txindex: MetricPattern9, + pub opreturn_to_txindex: MetricPattern14, + pub p2ms_to_txindex: MetricPattern17, + pub unknown_to_txindex: MetricPattern28, + pub count: MetricsTree_Scripts_Count, + pub value: MetricsTree_Scripts_Value, +} + +impl MetricsTree_Scripts { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + first_emptyoutputindex: MetricPattern11::new(client.clone(), "first_emptyoutputindex".to_string()), + first_opreturnindex: MetricPattern11::new(client.clone(), "first_opreturnindex".to_string()), + first_p2msoutputindex: MetricPattern11::new(client.clone(), "first_p2msoutputindex".to_string()), + first_unknownoutputindex: MetricPattern11::new(client.clone(), "first_unknownoutputindex".to_string()), + empty_to_txindex: MetricPattern9::new(client.clone(), "txindex".to_string()), + opreturn_to_txindex: MetricPattern14::new(client.clone(), "txindex".to_string()), + p2ms_to_txindex: MetricPattern17::new(client.clone(), "txindex".to_string()), + unknown_to_txindex: MetricPattern28::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")), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Scripts_Count { + pub p2a: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2, + pub p2ms: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2, + pub p2pk33: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2, + pub p2pk65: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2, + pub p2pkh: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2, + pub p2sh: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2, + pub p2tr: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2, + pub p2wpkh: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2, + pub p2wsh: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2, + pub opreturn: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2, + pub emptyoutput: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2, + pub unknownoutput: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2, + pub segwit: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2, + pub taproot_adoption: BaseCumulativeSumPattern, + pub segwit_adoption: BaseCumulativeSumPattern, +} + +impl MetricsTree_Scripts_Count { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + p2a: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), "p2a_count".to_string()), + p2ms: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), "p2ms_count".to_string()), + p2pk33: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), "p2pk33_count".to_string()), + p2pk65: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), "p2pk65_count".to_string()), + p2pkh: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), "p2pkh_count".to_string()), + p2sh: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), "p2sh_count".to_string()), + p2tr: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), "p2tr_count".to_string()), + p2wpkh: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), "p2wpkh_count".to_string()), + p2wsh: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), "p2wsh_count".to_string()), + opreturn: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), "opreturn_count".to_string()), + emptyoutput: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), "emptyoutput_count".to_string()), + unknownoutput: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), "unknownoutput_count".to_string()), + segwit: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), "segwit_count".to_string()), + taproot_adoption: BaseCumulativeSumPattern::new(client.clone(), "taproot_adoption".to_string()), + segwit_adoption: BaseCumulativeSumPattern::new(client.clone(), "segwit_adoption".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Scripts_Value { + pub opreturn: BitcoinDollarsSatsPattern2, +} + +impl MetricsTree_Scripts_Value { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + opreturn: BitcoinDollarsSatsPattern2::new(client.clone(), "opreturn_value".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Positions { + pub block_position: MetricPattern11, + pub tx_position: MetricPattern27, +} + +impl MetricsTree_Positions { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + block_position: MetricPattern11::new(client.clone(), "position".to_string()), + tx_position: MetricPattern27::new(client.clone(), "position".to_string()), } } } @@ -2681,45 +3193,127 @@ impl MetricsTree_Blocks_Time { /// Metrics tree node. pub struct MetricsTree_Cointime { pub activity: MetricsTree_Cointime_Activity, - pub adjusted: MetricsTree_Cointime_Adjusted, - pub cap: MetricsTree_Cointime_Cap, - pub pricing: MetricsTree_Cointime_Pricing, - pub reserve_risk: MetricsTree_Cointime_ReserveRisk, pub supply: MetricsTree_Cointime_Supply, pub value: MetricsTree_Cointime_Value, + pub cap: MetricsTree_Cointime_Cap, + pub pricing: MetricsTree_Cointime_Pricing, + pub adjusted: MetricsTree_Cointime_Adjusted, + pub reserve_risk: MetricsTree_Cointime_ReserveRisk, } impl MetricsTree_Cointime { pub fn new(client: Arc, base_path: String) -> Self { Self { activity: MetricsTree_Cointime_Activity::new(client.clone(), format!("{base_path}_activity")), - adjusted: MetricsTree_Cointime_Adjusted::new(client.clone(), format!("{base_path}_adjusted")), - cap: MetricsTree_Cointime_Cap::new(client.clone(), format!("{base_path}_cap")), - pricing: MetricsTree_Cointime_Pricing::new(client.clone(), format!("{base_path}_pricing")), - reserve_risk: MetricsTree_Cointime_ReserveRisk::new(client.clone(), format!("{base_path}_reserve_risk")), 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")), } } } /// Metrics tree node. pub struct MetricsTree_Cointime_Activity { - pub activity_to_vaultedness_ratio: MetricPattern1, - pub coinblocks_created: BlockCountPattern, - pub coinblocks_stored: BlockCountPattern, + pub coinblocks_created: CumulativeSumPattern, + pub coinblocks_stored: CumulativeSumPattern, pub liveliness: MetricPattern1, pub vaultedness: MetricPattern1, + pub activity_to_vaultedness_ratio: MetricPattern1, } impl MetricsTree_Cointime_Activity { pub fn new(client: Arc, base_path: String) -> Self { Self { - activity_to_vaultedness_ratio: MetricPattern1::new(client.clone(), "activity_to_vaultedness_ratio".to_string()), - coinblocks_created: BlockCountPattern::new(client.clone(), "coinblocks_created".to_string()), - coinblocks_stored: BlockCountPattern::new(client.clone(), "coinblocks_stored".to_string()), + coinblocks_created: CumulativeSumPattern::new(client.clone(), "coinblocks_created".to_string()), + coinblocks_stored: CumulativeSumPattern::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()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Cointime_Supply { + pub vaulted_supply: BitcoinDollarsSatsPattern4, + pub active_supply: BitcoinDollarsSatsPattern4, +} + +impl MetricsTree_Cointime_Supply { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + vaulted_supply: BitcoinDollarsSatsPattern4::new(client.clone(), "vaulted_supply".to_string()), + active_supply: BitcoinDollarsSatsPattern4::new(client.clone(), "active_supply".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Cointime_Value { + pub cointime_value_destroyed: CumulativeSumPattern, + pub cointime_value_created: CumulativeSumPattern, + pub cointime_value_stored: CumulativeSumPattern, + pub vocdd: CumulativeSumPattern, +} + +impl MetricsTree_Cointime_Value { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + cointime_value_destroyed: CumulativeSumPattern::new(client.clone(), "cointime_value_destroyed".to_string()), + cointime_value_created: CumulativeSumPattern::new(client.clone(), "cointime_value_created".to_string()), + cointime_value_stored: CumulativeSumPattern::new(client.clone(), "cointime_value_stored".to_string()), + vocdd: CumulativeSumPattern::new(client.clone(), "vocdd".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Cointime_Cap { + pub thermo_cap: MetricPattern1, + pub investor_cap: MetricPattern1, + pub vaulted_cap: MetricPattern1, + pub active_cap: MetricPattern1, + pub cointime_cap: MetricPattern1, +} + +impl MetricsTree_Cointime_Cap { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + thermo_cap: MetricPattern1::new(client.clone(), "thermo_cap".to_string()), + investor_cap: MetricPattern1::new(client.clone(), "investor_cap".to_string()), + vaulted_cap: MetricPattern1::new(client.clone(), "vaulted_cap".to_string()), + active_cap: MetricPattern1::new(client.clone(), "active_cap".to_string()), + cointime_cap: MetricPattern1::new(client.clone(), "cointime_cap".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Cointime_Pricing { + pub vaulted_price: DollarsSatsPattern, + pub vaulted_price_ratio: RatioPattern, + pub active_price: DollarsSatsPattern, + pub active_price_ratio: RatioPattern, + pub true_market_mean: DollarsSatsPattern, + pub true_market_mean_ratio: RatioPattern, + pub cointime_price: DollarsSatsPattern, + pub cointime_price_ratio: RatioPattern, +} + +impl MetricsTree_Cointime_Pricing { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + vaulted_price: DollarsSatsPattern::new(client.clone(), "vaulted_price".to_string()), + vaulted_price_ratio: RatioPattern::new(client.clone(), "vaulted_price_ratio".to_string()), + active_price: DollarsSatsPattern::new(client.clone(), "active_price".to_string()), + active_price_ratio: RatioPattern::new(client.clone(), "active_price_ratio".to_string()), + true_market_mean: DollarsSatsPattern::new(client.clone(), "true_market_mean".to_string()), + true_market_mean_ratio: RatioPattern::new(client.clone(), "true_market_mean_ratio".to_string()), + cointime_price: DollarsSatsPattern::new(client.clone(), "cointime_price".to_string()), + cointime_price_ratio: RatioPattern::new(client.clone(), "cointime_price_ratio".to_string()), } } } @@ -2741,101 +3335,19 @@ impl MetricsTree_Cointime_Adjusted { } } -/// Metrics tree node. -pub struct MetricsTree_Cointime_Cap { - pub active_cap: MetricPattern1, - pub cointime_cap: MetricPattern1, - pub investor_cap: MetricPattern1, - pub thermo_cap: MetricPattern1, - pub vaulted_cap: MetricPattern1, -} - -impl MetricsTree_Cointime_Cap { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - active_cap: MetricPattern1::new(client.clone(), "active_cap".to_string()), - cointime_cap: MetricPattern1::new(client.clone(), "cointime_cap".to_string()), - investor_cap: MetricPattern1::new(client.clone(), "investor_cap".to_string()), - thermo_cap: MetricPattern1::new(client.clone(), "thermo_cap".to_string()), - vaulted_cap: MetricPattern1::new(client.clone(), "vaulted_cap".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Cointime_Pricing { - pub active_price: ActivePricePattern, - pub active_price_ratio: ActivePriceRatioPattern, - pub cointime_price: ActivePricePattern, - pub cointime_price_ratio: ActivePriceRatioPattern, - pub true_market_mean: ActivePricePattern, - pub true_market_mean_ratio: ActivePriceRatioPattern, - pub vaulted_price: ActivePricePattern, - pub vaulted_price_ratio: ActivePriceRatioPattern, -} - -impl MetricsTree_Cointime_Pricing { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - active_price: ActivePricePattern::new(client.clone(), "active_price".to_string()), - active_price_ratio: ActivePriceRatioPattern::new(client.clone(), "active_price_ratio".to_string()), - cointime_price: ActivePricePattern::new(client.clone(), "cointime_price".to_string()), - cointime_price_ratio: ActivePriceRatioPattern::new(client.clone(), "cointime_price_ratio".to_string()), - true_market_mean: ActivePricePattern::new(client.clone(), "true_market_mean".to_string()), - true_market_mean_ratio: ActivePriceRatioPattern::new(client.clone(), "true_market_mean_ratio".to_string()), - vaulted_price: ActivePricePattern::new(client.clone(), "vaulted_price".to_string()), - vaulted_price_ratio: ActivePriceRatioPattern::new(client.clone(), "vaulted_price_ratio".to_string()), - } - } -} - /// Metrics tree node. pub struct MetricsTree_Cointime_ReserveRisk { + pub vocdd_365d_sma: MetricPattern6, pub hodl_bank: MetricPattern6, pub reserve_risk: MetricPattern4, - pub vocdd_365d_sma: MetricPattern6, } impl MetricsTree_Cointime_ReserveRisk { pub fn new(client: Arc, base_path: String) -> Self { Self { + vocdd_365d_sma: MetricPattern6::new(client.clone(), "vocdd_365d_sma".to_string()), hodl_bank: MetricPattern6::new(client.clone(), "hodl_bank".to_string()), reserve_risk: MetricPattern4::new(client.clone(), "reserve_risk".to_string()), - vocdd_365d_sma: MetricPattern6::new(client.clone(), "vocdd_365d_sma".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Cointime_Supply { - pub active_supply: ActiveSupplyPattern, - pub vaulted_supply: ActiveSupplyPattern, -} - -impl MetricsTree_Cointime_Supply { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - active_supply: ActiveSupplyPattern::new(client.clone(), "active_supply".to_string()), - vaulted_supply: ActiveSupplyPattern::new(client.clone(), "vaulted_supply".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Cointime_Value { - pub cointime_value_created: BlockCountPattern, - pub cointime_value_destroyed: BlockCountPattern, - pub cointime_value_stored: BlockCountPattern, - pub vocdd: BlockCountPattern, -} - -impl MetricsTree_Cointime_Value { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - cointime_value_created: BlockCountPattern::new(client.clone(), "cointime_value_created".to_string()), - cointime_value_destroyed: BlockCountPattern::new(client.clone(), "cointime_value_destroyed".to_string()), - cointime_value_stored: BlockCountPattern::new(client.clone(), "cointime_value_stored".to_string()), - vocdd: BlockCountPattern::new(client.clone(), "vocdd".to_string()), } } } @@ -2844,18 +3356,18 @@ impl MetricsTree_Cointime_Value { pub struct MetricsTree_Constants { pub constant_0: MetricPattern1, pub constant_1: MetricPattern1, - pub constant_100: MetricPattern1, pub constant_2: MetricPattern1, - pub constant_20: MetricPattern1, pub constant_3: MetricPattern1, + pub constant_4: MetricPattern1, + pub constant_20: MetricPattern1, pub constant_30: MetricPattern1, pub constant_38_2: MetricPattern1, - pub constant_4: MetricPattern1, pub constant_50: MetricPattern1, - pub constant_600: MetricPattern1, pub constant_61_8: MetricPattern1, pub constant_70: MetricPattern1, pub constant_80: MetricPattern1, + pub constant_100: MetricPattern1, + pub constant_600: MetricPattern1, pub constant_minus_1: MetricPattern1, pub constant_minus_2: MetricPattern1, pub constant_minus_3: MetricPattern1, @@ -2867,18 +3379,18 @@ impl MetricsTree_Constants { Self { constant_0: MetricPattern1::new(client.clone(), "constant_0".to_string()), constant_1: MetricPattern1::new(client.clone(), "constant_1".to_string()), - constant_100: MetricPattern1::new(client.clone(), "constant_100".to_string()), constant_2: MetricPattern1::new(client.clone(), "constant_2".to_string()), - constant_20: MetricPattern1::new(client.clone(), "constant_20".to_string()), constant_3: MetricPattern1::new(client.clone(), "constant_3".to_string()), + constant_4: MetricPattern1::new(client.clone(), "constant_4".to_string()), + constant_20: MetricPattern1::new(client.clone(), "constant_20".to_string()), constant_30: MetricPattern1::new(client.clone(), "constant_30".to_string()), constant_38_2: MetricPattern1::new(client.clone(), "constant_38_2".to_string()), - constant_4: MetricPattern1::new(client.clone(), "constant_4".to_string()), constant_50: MetricPattern1::new(client.clone(), "constant_50".to_string()), - constant_600: MetricPattern1::new(client.clone(), "constant_600".to_string()), constant_61_8: MetricPattern1::new(client.clone(), "constant_61_8".to_string()), constant_70: MetricPattern1::new(client.clone(), "constant_70".to_string()), constant_80: MetricPattern1::new(client.clone(), "constant_80".to_string()), + constant_100: MetricPattern1::new(client.clone(), "constant_100".to_string()), + constant_600: MetricPattern1::new(client.clone(), "constant_600".to_string()), constant_minus_1: MetricPattern1::new(client.clone(), "constant_minus_1".to_string()), constant_minus_2: MetricPattern1::new(client.clone(), "constant_minus_2".to_string()), constant_minus_3: MetricPattern1::new(client.clone(), "constant_minus_3".to_string()), @@ -2887,875 +3399,47 @@ impl MetricsTree_Constants { } } -/// Metrics tree node. -pub struct MetricsTree_Distribution { - pub addr_count: AddrCountPattern, - pub address_activity: MetricsTree_Distribution_AddressActivity, - pub address_cohorts: MetricsTree_Distribution_AddressCohorts, - pub addresses_data: MetricsTree_Distribution_AddressesData, - pub any_address_indexes: MetricsTree_Distribution_AnyAddressIndexes, - pub chain_state: MetricPattern11, - pub empty_addr_count: AddrCountPattern, - pub emptyaddressindex: MetricPattern32, - pub growth_rate: MetricsTree_Distribution_GrowthRate, - pub loadedaddressindex: MetricPattern31, - pub new_addr_count: MetricsTree_Distribution_NewAddrCount, - pub total_addr_count: AddrCountPattern, - pub utxo_cohorts: MetricsTree_Distribution_UtxoCohorts, -} - -impl MetricsTree_Distribution { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - addr_count: AddrCountPattern::new(client.clone(), "addr_count".to_string()), - address_activity: MetricsTree_Distribution_AddressActivity::new(client.clone(), format!("{base_path}_address_activity")), - address_cohorts: MetricsTree_Distribution_AddressCohorts::new(client.clone(), format!("{base_path}_address_cohorts")), - addresses_data: MetricsTree_Distribution_AddressesData::new(client.clone(), format!("{base_path}_addresses_data")), - any_address_indexes: MetricsTree_Distribution_AnyAddressIndexes::new(client.clone(), format!("{base_path}_any_address_indexes")), - chain_state: MetricPattern11::new(client.clone(), "chain".to_string()), - empty_addr_count: AddrCountPattern::new(client.clone(), "empty_addr_count".to_string()), - emptyaddressindex: MetricPattern32::new(client.clone(), "emptyaddressindex".to_string()), - growth_rate: MetricsTree_Distribution_GrowthRate::new(client.clone(), format!("{base_path}_growth_rate")), - loadedaddressindex: MetricPattern31::new(client.clone(), "loadedaddressindex".to_string()), - new_addr_count: MetricsTree_Distribution_NewAddrCount::new(client.clone(), format!("{base_path}_new_addr_count")), - total_addr_count: AddrCountPattern::new(client.clone(), "total_addr_count".to_string()), - utxo_cohorts: MetricsTree_Distribution_UtxoCohorts::new(client.clone(), format!("{base_path}_utxo_cohorts")), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Distribution_AddressActivity { - pub all: AllPattern, - pub p2a: AllPattern, - pub p2pk33: AllPattern, - pub p2pk65: AllPattern, - pub p2pkh: AllPattern, - pub p2sh: AllPattern, - pub p2tr: AllPattern, - pub p2wpkh: AllPattern, - pub p2wsh: AllPattern, -} - -impl MetricsTree_Distribution_AddressActivity { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - all: AllPattern::new(client.clone(), "address_activity".to_string()), - p2a: AllPattern::new(client.clone(), "p2a_address_activity".to_string()), - p2pk33: AllPattern::new(client.clone(), "p2pk33_address_activity".to_string()), - p2pk65: AllPattern::new(client.clone(), "p2pk65_address_activity".to_string()), - p2pkh: AllPattern::new(client.clone(), "p2pkh_address_activity".to_string()), - p2sh: AllPattern::new(client.clone(), "p2sh_address_activity".to_string()), - p2tr: AllPattern::new(client.clone(), "p2tr_address_activity".to_string()), - p2wpkh: AllPattern::new(client.clone(), "p2wpkh_address_activity".to_string()), - p2wsh: AllPattern::new(client.clone(), "p2wsh_address_activity".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Distribution_AddressCohorts { - pub amount_range: MetricsTree_Distribution_AddressCohorts_AmountRange, - pub ge_amount: MetricsTree_Distribution_AddressCohorts_GeAmount, - pub lt_amount: MetricsTree_Distribution_AddressCohorts_LtAmount, -} - -impl MetricsTree_Distribution_AddressCohorts { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - amount_range: MetricsTree_Distribution_AddressCohorts_AmountRange::new(client.clone(), format!("{base_path}_amount_range")), - ge_amount: MetricsTree_Distribution_AddressCohorts_GeAmount::new(client.clone(), format!("{base_path}_ge_amount")), - lt_amount: MetricsTree_Distribution_AddressCohorts_LtAmount::new(client.clone(), format!("{base_path}_lt_amount")), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Distribution_AddressCohorts_AmountRange { - pub _0sats: _0satsPattern, - pub _100btc_to_1k_btc: _0satsPattern, - pub _100k_btc_or_more: _0satsPattern, - pub _100k_sats_to_1m_sats: _0satsPattern, - pub _100sats_to_1k_sats: _0satsPattern, - pub _10btc_to_100btc: _0satsPattern, - pub _10k_btc_to_100k_btc: _0satsPattern, - pub _10k_sats_to_100k_sats: _0satsPattern, - pub _10m_sats_to_1btc: _0satsPattern, - pub _10sats_to_100sats: _0satsPattern, - pub _1btc_to_10btc: _0satsPattern, - pub _1k_btc_to_10k_btc: _0satsPattern, - pub _1k_sats_to_10k_sats: _0satsPattern, - pub _1m_sats_to_10m_sats: _0satsPattern, - pub _1sat_to_10sats: _0satsPattern, -} - -impl MetricsTree_Distribution_AddressCohorts_AmountRange { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - _0sats: _0satsPattern::new(client.clone(), "addrs_with_0sats".to_string()), - _100btc_to_1k_btc: _0satsPattern::new(client.clone(), "addrs_above_100btc_under_1k_btc".to_string()), - _100k_btc_or_more: _0satsPattern::new(client.clone(), "addrs_above_100k_btc".to_string()), - _100k_sats_to_1m_sats: _0satsPattern::new(client.clone(), "addrs_above_100k_sats_under_1m_sats".to_string()), - _100sats_to_1k_sats: _0satsPattern::new(client.clone(), "addrs_above_100sats_under_1k_sats".to_string()), - _10btc_to_100btc: _0satsPattern::new(client.clone(), "addrs_above_10btc_under_100btc".to_string()), - _10k_btc_to_100k_btc: _0satsPattern::new(client.clone(), "addrs_above_10k_btc_under_100k_btc".to_string()), - _10k_sats_to_100k_sats: _0satsPattern::new(client.clone(), "addrs_above_10k_sats_under_100k_sats".to_string()), - _10m_sats_to_1btc: _0satsPattern::new(client.clone(), "addrs_above_10m_sats_under_1btc".to_string()), - _10sats_to_100sats: _0satsPattern::new(client.clone(), "addrs_above_10sats_under_100sats".to_string()), - _1btc_to_10btc: _0satsPattern::new(client.clone(), "addrs_above_1btc_under_10btc".to_string()), - _1k_btc_to_10k_btc: _0satsPattern::new(client.clone(), "addrs_above_1k_btc_under_10k_btc".to_string()), - _1k_sats_to_10k_sats: _0satsPattern::new(client.clone(), "addrs_above_1k_sats_under_10k_sats".to_string()), - _1m_sats_to_10m_sats: _0satsPattern::new(client.clone(), "addrs_above_1m_sats_under_10m_sats".to_string()), - _1sat_to_10sats: _0satsPattern::new(client.clone(), "addrs_above_1sat_under_10sats".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Distribution_AddressCohorts_GeAmount { - pub _100btc: _0satsPattern, - pub _100k_sats: _0satsPattern, - pub _100sats: _0satsPattern, - pub _10btc: _0satsPattern, - pub _10k_btc: _0satsPattern, - pub _10k_sats: _0satsPattern, - pub _10m_sats: _0satsPattern, - pub _10sats: _0satsPattern, - pub _1btc: _0satsPattern, - pub _1k_btc: _0satsPattern, - pub _1k_sats: _0satsPattern, - pub _1m_sats: _0satsPattern, - pub _1sat: _0satsPattern, -} - -impl MetricsTree_Distribution_AddressCohorts_GeAmount { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - _100btc: _0satsPattern::new(client.clone(), "addrs_over_100btc".to_string()), - _100k_sats: _0satsPattern::new(client.clone(), "addrs_over_100k_sats".to_string()), - _100sats: _0satsPattern::new(client.clone(), "addrs_over_100sats".to_string()), - _10btc: _0satsPattern::new(client.clone(), "addrs_over_10btc".to_string()), - _10k_btc: _0satsPattern::new(client.clone(), "addrs_over_10k_btc".to_string()), - _10k_sats: _0satsPattern::new(client.clone(), "addrs_over_10k_sats".to_string()), - _10m_sats: _0satsPattern::new(client.clone(), "addrs_over_10m_sats".to_string()), - _10sats: _0satsPattern::new(client.clone(), "addrs_over_10sats".to_string()), - _1btc: _0satsPattern::new(client.clone(), "addrs_over_1btc".to_string()), - _1k_btc: _0satsPattern::new(client.clone(), "addrs_over_1k_btc".to_string()), - _1k_sats: _0satsPattern::new(client.clone(), "addrs_over_1k_sats".to_string()), - _1m_sats: _0satsPattern::new(client.clone(), "addrs_over_1m_sats".to_string()), - _1sat: _0satsPattern::new(client.clone(), "addrs_over_1sat".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Distribution_AddressCohorts_LtAmount { - pub _100btc: _0satsPattern, - pub _100k_btc: _0satsPattern, - pub _100k_sats: _0satsPattern, - pub _100sats: _0satsPattern, - pub _10btc: _0satsPattern, - pub _10k_btc: _0satsPattern, - pub _10k_sats: _0satsPattern, - pub _10m_sats: _0satsPattern, - pub _10sats: _0satsPattern, - pub _1btc: _0satsPattern, - pub _1k_btc: _0satsPattern, - pub _1k_sats: _0satsPattern, - pub _1m_sats: _0satsPattern, -} - -impl MetricsTree_Distribution_AddressCohorts_LtAmount { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - _100btc: _0satsPattern::new(client.clone(), "addrs_under_100btc".to_string()), - _100k_btc: _0satsPattern::new(client.clone(), "addrs_under_100k_btc".to_string()), - _100k_sats: _0satsPattern::new(client.clone(), "addrs_under_100k_sats".to_string()), - _100sats: _0satsPattern::new(client.clone(), "addrs_under_100sats".to_string()), - _10btc: _0satsPattern::new(client.clone(), "addrs_under_10btc".to_string()), - _10k_btc: _0satsPattern::new(client.clone(), "addrs_under_10k_btc".to_string()), - _10k_sats: _0satsPattern::new(client.clone(), "addrs_under_10k_sats".to_string()), - _10m_sats: _0satsPattern::new(client.clone(), "addrs_under_10m_sats".to_string()), - _10sats: _0satsPattern::new(client.clone(), "addrs_under_10sats".to_string()), - _1btc: _0satsPattern::new(client.clone(), "addrs_under_1btc".to_string()), - _1k_btc: _0satsPattern::new(client.clone(), "addrs_under_1k_btc".to_string()), - _1k_sats: _0satsPattern::new(client.clone(), "addrs_under_1k_sats".to_string()), - _1m_sats: _0satsPattern::new(client.clone(), "addrs_under_1m_sats".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Distribution_AddressesData { - pub empty: MetricPattern32, - pub loaded: MetricPattern31, -} - -impl MetricsTree_Distribution_AddressesData { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - empty: MetricPattern32::new(client.clone(), "emptyaddressdata".to_string()), - loaded: MetricPattern31::new(client.clone(), "loadedaddressdata".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Distribution_AnyAddressIndexes { - pub p2a: MetricPattern16, - pub p2pk33: MetricPattern18, - pub p2pk65: MetricPattern19, - pub p2pkh: MetricPattern20, - pub p2sh: MetricPattern21, - pub p2tr: MetricPattern22, - pub p2wpkh: MetricPattern23, - pub p2wsh: MetricPattern24, -} - -impl MetricsTree_Distribution_AnyAddressIndexes { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - p2a: MetricPattern16::new(client.clone(), "anyaddressindex".to_string()), - p2pk33: MetricPattern18::new(client.clone(), "anyaddressindex".to_string()), - p2pk65: MetricPattern19::new(client.clone(), "anyaddressindex".to_string()), - p2pkh: MetricPattern20::new(client.clone(), "anyaddressindex".to_string()), - p2sh: MetricPattern21::new(client.clone(), "anyaddressindex".to_string()), - p2tr: MetricPattern22::new(client.clone(), "anyaddressindex".to_string()), - p2wpkh: MetricPattern23::new(client.clone(), "anyaddressindex".to_string()), - p2wsh: MetricPattern24::new(client.clone(), "anyaddressindex".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Distribution_GrowthRate { - pub all: FullnessPattern, - pub p2a: FullnessPattern, - pub p2pk33: FullnessPattern, - pub p2pk65: FullnessPattern, - pub p2pkh: FullnessPattern, - pub p2sh: FullnessPattern, - pub p2tr: FullnessPattern, - pub p2wpkh: FullnessPattern, - pub p2wsh: FullnessPattern, -} - -impl MetricsTree_Distribution_GrowthRate { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - all: FullnessPattern::new(client.clone(), "growth_rate".to_string()), - p2a: FullnessPattern::new(client.clone(), "p2a_growth_rate".to_string()), - p2pk33: FullnessPattern::new(client.clone(), "p2pk33_growth_rate".to_string()), - p2pk65: FullnessPattern::new(client.clone(), "p2pk65_growth_rate".to_string()), - p2pkh: FullnessPattern::new(client.clone(), "p2pkh_growth_rate".to_string()), - p2sh: FullnessPattern::new(client.clone(), "p2sh_growth_rate".to_string()), - p2tr: FullnessPattern::new(client.clone(), "p2tr_growth_rate".to_string()), - p2wpkh: FullnessPattern::new(client.clone(), "p2wpkh_growth_rate".to_string()), - p2wsh: FullnessPattern::new(client.clone(), "p2wsh_growth_rate".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Distribution_NewAddrCount { - pub all: DollarsPattern, - pub p2a: DollarsPattern, - pub p2pk33: DollarsPattern, - pub p2pk65: DollarsPattern, - pub p2pkh: DollarsPattern, - pub p2sh: DollarsPattern, - pub p2tr: DollarsPattern, - pub p2wpkh: DollarsPattern, - pub p2wsh: DollarsPattern, -} - -impl MetricsTree_Distribution_NewAddrCount { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - all: DollarsPattern::new(client.clone(), "new_addr_count".to_string()), - p2a: DollarsPattern::new(client.clone(), "p2a_new_addr_count".to_string()), - p2pk33: DollarsPattern::new(client.clone(), "p2pk33_new_addr_count".to_string()), - p2pk65: DollarsPattern::new(client.clone(), "p2pk65_new_addr_count".to_string()), - p2pkh: DollarsPattern::new(client.clone(), "p2pkh_new_addr_count".to_string()), - p2sh: DollarsPattern::new(client.clone(), "p2sh_new_addr_count".to_string()), - p2tr: DollarsPattern::new(client.clone(), "p2tr_new_addr_count".to_string()), - p2wpkh: DollarsPattern::new(client.clone(), "p2wpkh_new_addr_count".to_string()), - p2wsh: DollarsPattern::new(client.clone(), "p2wsh_new_addr_count".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Distribution_UtxoCohorts { - pub age_range: MetricsTree_Distribution_UtxoCohorts_AgeRange, - pub all: MetricsTree_Distribution_UtxoCohorts_All, - pub amount_range: MetricsTree_Distribution_UtxoCohorts_AmountRange, - pub epoch: MetricsTree_Distribution_UtxoCohorts_Epoch, - pub ge_amount: MetricsTree_Distribution_UtxoCohorts_GeAmount, - pub lt_amount: MetricsTree_Distribution_UtxoCohorts_LtAmount, - pub max_age: MetricsTree_Distribution_UtxoCohorts_MaxAge, - pub min_age: MetricsTree_Distribution_UtxoCohorts_MinAge, - pub term: MetricsTree_Distribution_UtxoCohorts_Term, - pub type_: MetricsTree_Distribution_UtxoCohorts_Type, - pub year: MetricsTree_Distribution_UtxoCohorts_Year, -} - -impl MetricsTree_Distribution_UtxoCohorts { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - age_range: MetricsTree_Distribution_UtxoCohorts_AgeRange::new(client.clone(), format!("{base_path}_age_range")), - all: MetricsTree_Distribution_UtxoCohorts_All::new(client.clone(), format!("{base_path}_all")), - amount_range: MetricsTree_Distribution_UtxoCohorts_AmountRange::new(client.clone(), format!("{base_path}_amount_range")), - epoch: MetricsTree_Distribution_UtxoCohorts_Epoch::new(client.clone(), format!("{base_path}_epoch")), - ge_amount: MetricsTree_Distribution_UtxoCohorts_GeAmount::new(client.clone(), format!("{base_path}_ge_amount")), - lt_amount: MetricsTree_Distribution_UtxoCohorts_LtAmount::new(client.clone(), format!("{base_path}_lt_amount")), - 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")), - term: MetricsTree_Distribution_UtxoCohorts_Term::new(client.clone(), format!("{base_path}_term")), - type_: MetricsTree_Distribution_UtxoCohorts_Type::new(client.clone(), format!("{base_path}_type_")), - year: MetricsTree_Distribution_UtxoCohorts_Year::new(client.clone(), format!("{base_path}_year")), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Distribution_UtxoCohorts_AgeRange { - pub _10y_to_12y: _10yTo12yPattern, - pub _12y_to_15y: _10yTo12yPattern, - pub _1d_to_1w: _10yTo12yPattern, - pub _1h_to_1d: _10yTo12yPattern, - pub _1m_to_2m: _10yTo12yPattern, - pub _1w_to_1m: _10yTo12yPattern, - pub _1y_to_2y: _10yTo12yPattern, - pub _2m_to_3m: _10yTo12yPattern, - pub _2y_to_3y: _10yTo12yPattern, - pub _3m_to_4m: _10yTo12yPattern, - pub _3y_to_4y: _10yTo12yPattern, - pub _4m_to_5m: _10yTo12yPattern, - pub _4y_to_5y: _10yTo12yPattern, - pub _5m_to_6m: _10yTo12yPattern, - pub _5y_to_6y: _10yTo12yPattern, - pub _6m_to_1y: _10yTo12yPattern, - pub _6y_to_7y: _10yTo12yPattern, - pub _7y_to_8y: _10yTo12yPattern, - pub _8y_to_10y: _10yTo12yPattern, - pub from_15y: _10yTo12yPattern, - pub up_to_1h: _10yTo12yPattern, -} - -impl MetricsTree_Distribution_UtxoCohorts_AgeRange { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - _10y_to_12y: _10yTo12yPattern::new(client.clone(), "utxos_10y_to_12y_old".to_string()), - _12y_to_15y: _10yTo12yPattern::new(client.clone(), "utxos_12y_to_15y_old".to_string()), - _1d_to_1w: _10yTo12yPattern::new(client.clone(), "utxos_1d_to_1w_old".to_string()), - _1h_to_1d: _10yTo12yPattern::new(client.clone(), "utxos_1h_to_1d_old".to_string()), - _1m_to_2m: _10yTo12yPattern::new(client.clone(), "utxos_1m_to_2m_old".to_string()), - _1w_to_1m: _10yTo12yPattern::new(client.clone(), "utxos_1w_to_1m_old".to_string()), - _1y_to_2y: _10yTo12yPattern::new(client.clone(), "utxos_1y_to_2y_old".to_string()), - _2m_to_3m: _10yTo12yPattern::new(client.clone(), "utxos_2m_to_3m_old".to_string()), - _2y_to_3y: _10yTo12yPattern::new(client.clone(), "utxos_2y_to_3y_old".to_string()), - _3m_to_4m: _10yTo12yPattern::new(client.clone(), "utxos_3m_to_4m_old".to_string()), - _3y_to_4y: _10yTo12yPattern::new(client.clone(), "utxos_3y_to_4y_old".to_string()), - _4m_to_5m: _10yTo12yPattern::new(client.clone(), "utxos_4m_to_5m_old".to_string()), - _4y_to_5y: _10yTo12yPattern::new(client.clone(), "utxos_4y_to_5y_old".to_string()), - _5m_to_6m: _10yTo12yPattern::new(client.clone(), "utxos_5m_to_6m_old".to_string()), - _5y_to_6y: _10yTo12yPattern::new(client.clone(), "utxos_5y_to_6y_old".to_string()), - _6m_to_1y: _10yTo12yPattern::new(client.clone(), "utxos_6m_to_1y_old".to_string()), - _6y_to_7y: _10yTo12yPattern::new(client.clone(), "utxos_6y_to_7y_old".to_string()), - _7y_to_8y: _10yTo12yPattern::new(client.clone(), "utxos_7y_to_8y_old".to_string()), - _8y_to_10y: _10yTo12yPattern::new(client.clone(), "utxos_8y_to_10y_old".to_string()), - from_15y: _10yTo12yPattern::new(client.clone(), "utxos_over_15y_old".to_string()), - up_to_1h: _10yTo12yPattern::new(client.clone(), "utxos_under_1h_old".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Distribution_UtxoCohorts_All { - pub activity: ActivityPattern2, - pub cost_basis: MetricsTree_Distribution_UtxoCohorts_All_CostBasis, - pub outputs: OutputsPattern, - pub realized: RealizedPattern3, - pub relative: MetricsTree_Distribution_UtxoCohorts_All_Relative, - pub supply: SupplyPattern2, - pub unrealized: UnrealizedPattern, -} - -impl MetricsTree_Distribution_UtxoCohorts_All { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - activity: ActivityPattern2::new(client.clone(), "".to_string()), - cost_basis: MetricsTree_Distribution_UtxoCohorts_All_CostBasis::new(client.clone(), format!("{base_path}_cost_basis")), - outputs: OutputsPattern::new(client.clone(), "utxo_count".to_string()), - realized: RealizedPattern3::new(client.clone(), "".to_string()), - relative: MetricsTree_Distribution_UtxoCohorts_All_Relative::new(client.clone(), format!("{base_path}_relative")), - supply: SupplyPattern2::new(client.clone(), "supply".to_string()), - unrealized: UnrealizedPattern::new(client.clone(), "".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Distribution_UtxoCohorts_All_CostBasis { - pub max: ActivePricePattern, - pub min: ActivePricePattern, - pub percentiles: PercentilesPattern, -} - -impl MetricsTree_Distribution_UtxoCohorts_All_CostBasis { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - max: ActivePricePattern::new(client.clone(), "max_cost_basis".to_string()), - min: ActivePricePattern::new(client.clone(), "min_cost_basis".to_string()), - percentiles: PercentilesPattern::new(client.clone(), "cost_basis".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Distribution_UtxoCohorts_All_Relative { - pub neg_unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1, - pub net_unrealized_pnl_rel_to_own_total_unrealized_pnl: MetricPattern1, - pub supply_in_loss_rel_to_own_supply: MetricPattern1, - pub supply_in_profit_rel_to_own_supply: MetricPattern1, - pub unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1, - pub unrealized_profit_rel_to_own_total_unrealized_pnl: MetricPattern1, -} - -impl MetricsTree_Distribution_UtxoCohorts_All_Relative { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - neg_unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1::new(client.clone(), "neg_unrealized_loss_rel_to_own_total_unrealized_pnl".to_string()), - net_unrealized_pnl_rel_to_own_total_unrealized_pnl: MetricPattern1::new(client.clone(), "net_unrealized_pnl_rel_to_own_total_unrealized_pnl".to_string()), - supply_in_loss_rel_to_own_supply: MetricPattern1::new(client.clone(), "supply_in_loss_rel_to_own_supply".to_string()), - supply_in_profit_rel_to_own_supply: MetricPattern1::new(client.clone(), "supply_in_profit_rel_to_own_supply".to_string()), - unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1::new(client.clone(), "unrealized_loss_rel_to_own_total_unrealized_pnl".to_string()), - unrealized_profit_rel_to_own_total_unrealized_pnl: MetricPattern1::new(client.clone(), "unrealized_profit_rel_to_own_total_unrealized_pnl".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Distribution_UtxoCohorts_AmountRange { - pub _0sats: _0satsPattern2, - pub _100btc_to_1k_btc: _0satsPattern2, - pub _100k_btc_or_more: _0satsPattern2, - pub _100k_sats_to_1m_sats: _0satsPattern2, - pub _100sats_to_1k_sats: _0satsPattern2, - pub _10btc_to_100btc: _0satsPattern2, - pub _10k_btc_to_100k_btc: _0satsPattern2, - pub _10k_sats_to_100k_sats: _0satsPattern2, - pub _10m_sats_to_1btc: _0satsPattern2, - pub _10sats_to_100sats: _0satsPattern2, - pub _1btc_to_10btc: _0satsPattern2, - pub _1k_btc_to_10k_btc: _0satsPattern2, - pub _1k_sats_to_10k_sats: _0satsPattern2, - pub _1m_sats_to_10m_sats: _0satsPattern2, - pub _1sat_to_10sats: _0satsPattern2, -} - -impl MetricsTree_Distribution_UtxoCohorts_AmountRange { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - _0sats: _0satsPattern2::new(client.clone(), "utxos_with_0sats".to_string()), - _100btc_to_1k_btc: _0satsPattern2::new(client.clone(), "utxos_above_100btc_under_1k_btc".to_string()), - _100k_btc_or_more: _0satsPattern2::new(client.clone(), "utxos_above_100k_btc".to_string()), - _100k_sats_to_1m_sats: _0satsPattern2::new(client.clone(), "utxos_above_100k_sats_under_1m_sats".to_string()), - _100sats_to_1k_sats: _0satsPattern2::new(client.clone(), "utxos_above_100sats_under_1k_sats".to_string()), - _10btc_to_100btc: _0satsPattern2::new(client.clone(), "utxos_above_10btc_under_100btc".to_string()), - _10k_btc_to_100k_btc: _0satsPattern2::new(client.clone(), "utxos_above_10k_btc_under_100k_btc".to_string()), - _10k_sats_to_100k_sats: _0satsPattern2::new(client.clone(), "utxos_above_10k_sats_under_100k_sats".to_string()), - _10m_sats_to_1btc: _0satsPattern2::new(client.clone(), "utxos_above_10m_sats_under_1btc".to_string()), - _10sats_to_100sats: _0satsPattern2::new(client.clone(), "utxos_above_10sats_under_100sats".to_string()), - _1btc_to_10btc: _0satsPattern2::new(client.clone(), "utxos_above_1btc_under_10btc".to_string()), - _1k_btc_to_10k_btc: _0satsPattern2::new(client.clone(), "utxos_above_1k_btc_under_10k_btc".to_string()), - _1k_sats_to_10k_sats: _0satsPattern2::new(client.clone(), "utxos_above_1k_sats_under_10k_sats".to_string()), - _1m_sats_to_10m_sats: _0satsPattern2::new(client.clone(), "utxos_above_1m_sats_under_10m_sats".to_string()), - _1sat_to_10sats: _0satsPattern2::new(client.clone(), "utxos_above_1sat_under_10sats".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Distribution_UtxoCohorts_Epoch { - pub _0: _0satsPattern2, - pub _1: _0satsPattern2, - pub _2: _0satsPattern2, - pub _3: _0satsPattern2, - pub _4: _0satsPattern2, -} - -impl MetricsTree_Distribution_UtxoCohorts_Epoch { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - _0: _0satsPattern2::new(client.clone(), "epoch_0".to_string()), - _1: _0satsPattern2::new(client.clone(), "epoch_1".to_string()), - _2: _0satsPattern2::new(client.clone(), "epoch_2".to_string()), - _3: _0satsPattern2::new(client.clone(), "epoch_3".to_string()), - _4: _0satsPattern2::new(client.clone(), "epoch_4".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Distribution_UtxoCohorts_GeAmount { - pub _100btc: _100btcPattern, - pub _100k_sats: _100btcPattern, - pub _100sats: _100btcPattern, - pub _10btc: _100btcPattern, - pub _10k_btc: _100btcPattern, - pub _10k_sats: _100btcPattern, - pub _10m_sats: _100btcPattern, - pub _10sats: _100btcPattern, - pub _1btc: _100btcPattern, - pub _1k_btc: _100btcPattern, - pub _1k_sats: _100btcPattern, - pub _1m_sats: _100btcPattern, - pub _1sat: _100btcPattern, -} - -impl MetricsTree_Distribution_UtxoCohorts_GeAmount { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - _100btc: _100btcPattern::new(client.clone(), "utxos_over_100btc".to_string()), - _100k_sats: _100btcPattern::new(client.clone(), "utxos_over_100k_sats".to_string()), - _100sats: _100btcPattern::new(client.clone(), "utxos_over_100sats".to_string()), - _10btc: _100btcPattern::new(client.clone(), "utxos_over_10btc".to_string()), - _10k_btc: _100btcPattern::new(client.clone(), "utxos_over_10k_btc".to_string()), - _10k_sats: _100btcPattern::new(client.clone(), "utxos_over_10k_sats".to_string()), - _10m_sats: _100btcPattern::new(client.clone(), "utxos_over_10m_sats".to_string()), - _10sats: _100btcPattern::new(client.clone(), "utxos_over_10sats".to_string()), - _1btc: _100btcPattern::new(client.clone(), "utxos_over_1btc".to_string()), - _1k_btc: _100btcPattern::new(client.clone(), "utxos_over_1k_btc".to_string()), - _1k_sats: _100btcPattern::new(client.clone(), "utxos_over_1k_sats".to_string()), - _1m_sats: _100btcPattern::new(client.clone(), "utxos_over_1m_sats".to_string()), - _1sat: _100btcPattern::new(client.clone(), "utxos_over_1sat".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Distribution_UtxoCohorts_LtAmount { - pub _100btc: _100btcPattern, - pub _100k_btc: _100btcPattern, - pub _100k_sats: _100btcPattern, - pub _100sats: _100btcPattern, - pub _10btc: _100btcPattern, - pub _10k_btc: _100btcPattern, - pub _10k_sats: _100btcPattern, - pub _10m_sats: _100btcPattern, - pub _10sats: _100btcPattern, - pub _1btc: _100btcPattern, - pub _1k_btc: _100btcPattern, - pub _1k_sats: _100btcPattern, - pub _1m_sats: _100btcPattern, -} - -impl MetricsTree_Distribution_UtxoCohorts_LtAmount { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - _100btc: _100btcPattern::new(client.clone(), "utxos_under_100btc".to_string()), - _100k_btc: _100btcPattern::new(client.clone(), "utxos_under_100k_btc".to_string()), - _100k_sats: _100btcPattern::new(client.clone(), "utxos_under_100k_sats".to_string()), - _100sats: _100btcPattern::new(client.clone(), "utxos_under_100sats".to_string()), - _10btc: _100btcPattern::new(client.clone(), "utxos_under_10btc".to_string()), - _10k_btc: _100btcPattern::new(client.clone(), "utxos_under_10k_btc".to_string()), - _10k_sats: _100btcPattern::new(client.clone(), "utxos_under_10k_sats".to_string()), - _10m_sats: _100btcPattern::new(client.clone(), "utxos_under_10m_sats".to_string()), - _10sats: _100btcPattern::new(client.clone(), "utxos_under_10sats".to_string()), - _1btc: _100btcPattern::new(client.clone(), "utxos_under_1btc".to_string()), - _1k_btc: _100btcPattern::new(client.clone(), "utxos_under_1k_btc".to_string()), - _1k_sats: _100btcPattern::new(client.clone(), "utxos_under_1k_sats".to_string()), - _1m_sats: _100btcPattern::new(client.clone(), "utxos_under_1m_sats".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Distribution_UtxoCohorts_MaxAge { - pub _10y: _10yPattern, - pub _12y: _10yPattern, - pub _15y: _10yPattern, - pub _1m: _10yPattern, - pub _1w: _10yPattern, - pub _1y: _10yPattern, - pub _2m: _10yPattern, - pub _2y: _10yPattern, - pub _3m: _10yPattern, - pub _3y: _10yPattern, - pub _4m: _10yPattern, - pub _4y: _10yPattern, - pub _5m: _10yPattern, - pub _5y: _10yPattern, - pub _6m: _10yPattern, - pub _6y: _10yPattern, - pub _7y: _10yPattern, - pub _8y: _10yPattern, -} - -impl MetricsTree_Distribution_UtxoCohorts_MaxAge { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - _10y: _10yPattern::new(client.clone(), "utxos_under_10y_old".to_string()), - _12y: _10yPattern::new(client.clone(), "utxos_under_12y_old".to_string()), - _15y: _10yPattern::new(client.clone(), "utxos_under_15y_old".to_string()), - _1m: _10yPattern::new(client.clone(), "utxos_under_1m_old".to_string()), - _1w: _10yPattern::new(client.clone(), "utxos_under_1w_old".to_string()), - _1y: _10yPattern::new(client.clone(), "utxos_under_1y_old".to_string()), - _2m: _10yPattern::new(client.clone(), "utxos_under_2m_old".to_string()), - _2y: _10yPattern::new(client.clone(), "utxos_under_2y_old".to_string()), - _3m: _10yPattern::new(client.clone(), "utxos_under_3m_old".to_string()), - _3y: _10yPattern::new(client.clone(), "utxos_under_3y_old".to_string()), - _4m: _10yPattern::new(client.clone(), "utxos_under_4m_old".to_string()), - _4y: _10yPattern::new(client.clone(), "utxos_under_4y_old".to_string()), - _5m: _10yPattern::new(client.clone(), "utxos_under_5m_old".to_string()), - _5y: _10yPattern::new(client.clone(), "utxos_under_5y_old".to_string()), - _6m: _10yPattern::new(client.clone(), "utxos_under_6m_old".to_string()), - _6y: _10yPattern::new(client.clone(), "utxos_under_6y_old".to_string()), - _7y: _10yPattern::new(client.clone(), "utxos_under_7y_old".to_string()), - _8y: _10yPattern::new(client.clone(), "utxos_under_8y_old".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Distribution_UtxoCohorts_MinAge { - pub _10y: _100btcPattern, - pub _12y: _100btcPattern, - pub _1d: _100btcPattern, - pub _1m: _100btcPattern, - pub _1w: _100btcPattern, - pub _1y: _100btcPattern, - pub _2m: _100btcPattern, - pub _2y: _100btcPattern, - pub _3m: _100btcPattern, - pub _3y: _100btcPattern, - pub _4m: _100btcPattern, - pub _4y: _100btcPattern, - pub _5m: _100btcPattern, - pub _5y: _100btcPattern, - pub _6m: _100btcPattern, - pub _6y: _100btcPattern, - pub _7y: _100btcPattern, - pub _8y: _100btcPattern, -} - -impl MetricsTree_Distribution_UtxoCohorts_MinAge { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - _10y: _100btcPattern::new(client.clone(), "utxos_over_10y_old".to_string()), - _12y: _100btcPattern::new(client.clone(), "utxos_over_12y_old".to_string()), - _1d: _100btcPattern::new(client.clone(), "utxos_over_1d_old".to_string()), - _1m: _100btcPattern::new(client.clone(), "utxos_over_1m_old".to_string()), - _1w: _100btcPattern::new(client.clone(), "utxos_over_1w_old".to_string()), - _1y: _100btcPattern::new(client.clone(), "utxos_over_1y_old".to_string()), - _2m: _100btcPattern::new(client.clone(), "utxos_over_2m_old".to_string()), - _2y: _100btcPattern::new(client.clone(), "utxos_over_2y_old".to_string()), - _3m: _100btcPattern::new(client.clone(), "utxos_over_3m_old".to_string()), - _3y: _100btcPattern::new(client.clone(), "utxos_over_3y_old".to_string()), - _4m: _100btcPattern::new(client.clone(), "utxos_over_4m_old".to_string()), - _4y: _100btcPattern::new(client.clone(), "utxos_over_4y_old".to_string()), - _5m: _100btcPattern::new(client.clone(), "utxos_over_5m_old".to_string()), - _5y: _100btcPattern::new(client.clone(), "utxos_over_5y_old".to_string()), - _6m: _100btcPattern::new(client.clone(), "utxos_over_6m_old".to_string()), - _6y: _100btcPattern::new(client.clone(), "utxos_over_6y_old".to_string()), - _7y: _100btcPattern::new(client.clone(), "utxos_over_7y_old".to_string()), - _8y: _100btcPattern::new(client.clone(), "utxos_over_8y_old".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Distribution_UtxoCohorts_Term { - pub long: MetricsTree_Distribution_UtxoCohorts_Term_Long, - pub short: MetricsTree_Distribution_UtxoCohorts_Term_Short, -} - -impl MetricsTree_Distribution_UtxoCohorts_Term { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - long: MetricsTree_Distribution_UtxoCohorts_Term_Long::new(client.clone(), format!("{base_path}_long")), - short: MetricsTree_Distribution_UtxoCohorts_Term_Short::new(client.clone(), format!("{base_path}_short")), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Distribution_UtxoCohorts_Term_Long { - pub activity: ActivityPattern2, - pub cost_basis: CostBasisPattern2, - pub outputs: OutputsPattern, - pub realized: RealizedPattern2, - pub relative: RelativePattern5, - pub supply: SupplyPattern2, - pub unrealized: UnrealizedPattern, -} - -impl MetricsTree_Distribution_UtxoCohorts_Term_Long { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - activity: ActivityPattern2::new(client.clone(), "lth".to_string()), - cost_basis: CostBasisPattern2::new(client.clone(), "lth".to_string()), - outputs: OutputsPattern::new(client.clone(), "lth_utxo_count".to_string()), - realized: RealizedPattern2::new(client.clone(), "lth".to_string()), - relative: RelativePattern5::new(client.clone(), "lth".to_string()), - supply: SupplyPattern2::new(client.clone(), "lth_supply".to_string()), - unrealized: UnrealizedPattern::new(client.clone(), "lth".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Distribution_UtxoCohorts_Term_Short { - pub activity: ActivityPattern2, - pub cost_basis: CostBasisPattern2, - pub outputs: OutputsPattern, - pub realized: RealizedPattern3, - pub relative: RelativePattern5, - pub supply: SupplyPattern2, - pub unrealized: UnrealizedPattern, -} - -impl MetricsTree_Distribution_UtxoCohorts_Term_Short { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - activity: ActivityPattern2::new(client.clone(), "sth".to_string()), - cost_basis: CostBasisPattern2::new(client.clone(), "sth".to_string()), - outputs: OutputsPattern::new(client.clone(), "sth_utxo_count".to_string()), - realized: RealizedPattern3::new(client.clone(), "sth".to_string()), - relative: RelativePattern5::new(client.clone(), "sth".to_string()), - supply: SupplyPattern2::new(client.clone(), "sth_supply".to_string()), - unrealized: UnrealizedPattern::new(client.clone(), "sth".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Distribution_UtxoCohorts_Type { - pub empty: _0satsPattern2, - pub p2a: _0satsPattern2, - pub p2ms: _0satsPattern2, - pub p2pk33: _0satsPattern2, - pub p2pk65: _0satsPattern2, - pub p2pkh: _0satsPattern2, - pub p2sh: _0satsPattern2, - pub p2tr: _0satsPattern2, - pub p2wpkh: _0satsPattern2, - pub p2wsh: _0satsPattern2, - pub unknown: _0satsPattern2, -} - -impl MetricsTree_Distribution_UtxoCohorts_Type { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - empty: _0satsPattern2::new(client.clone(), "empty_outputs".to_string()), - p2a: _0satsPattern2::new(client.clone(), "p2a".to_string()), - p2ms: _0satsPattern2::new(client.clone(), "p2ms".to_string()), - p2pk33: _0satsPattern2::new(client.clone(), "p2pk33".to_string()), - p2pk65: _0satsPattern2::new(client.clone(), "p2pk65".to_string()), - p2pkh: _0satsPattern2::new(client.clone(), "p2pkh".to_string()), - p2sh: _0satsPattern2::new(client.clone(), "p2sh".to_string()), - p2tr: _0satsPattern2::new(client.clone(), "p2tr".to_string()), - p2wpkh: _0satsPattern2::new(client.clone(), "p2wpkh".to_string()), - p2wsh: _0satsPattern2::new(client.clone(), "p2wsh".to_string()), - unknown: _0satsPattern2::new(client.clone(), "unknown_outputs".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Distribution_UtxoCohorts_Year { - pub _2009: _0satsPattern2, - pub _2010: _0satsPattern2, - pub _2011: _0satsPattern2, - pub _2012: _0satsPattern2, - pub _2013: _0satsPattern2, - pub _2014: _0satsPattern2, - pub _2015: _0satsPattern2, - pub _2016: _0satsPattern2, - pub _2017: _0satsPattern2, - pub _2018: _0satsPattern2, - pub _2019: _0satsPattern2, - pub _2020: _0satsPattern2, - pub _2021: _0satsPattern2, - pub _2022: _0satsPattern2, - pub _2023: _0satsPattern2, - pub _2024: _0satsPattern2, - pub _2025: _0satsPattern2, - pub _2026: _0satsPattern2, -} - -impl MetricsTree_Distribution_UtxoCohorts_Year { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - _2009: _0satsPattern2::new(client.clone(), "year_2009".to_string()), - _2010: _0satsPattern2::new(client.clone(), "year_2010".to_string()), - _2011: _0satsPattern2::new(client.clone(), "year_2011".to_string()), - _2012: _0satsPattern2::new(client.clone(), "year_2012".to_string()), - _2013: _0satsPattern2::new(client.clone(), "year_2013".to_string()), - _2014: _0satsPattern2::new(client.clone(), "year_2014".to_string()), - _2015: _0satsPattern2::new(client.clone(), "year_2015".to_string()), - _2016: _0satsPattern2::new(client.clone(), "year_2016".to_string()), - _2017: _0satsPattern2::new(client.clone(), "year_2017".to_string()), - _2018: _0satsPattern2::new(client.clone(), "year_2018".to_string()), - _2019: _0satsPattern2::new(client.clone(), "year_2019".to_string()), - _2020: _0satsPattern2::new(client.clone(), "year_2020".to_string()), - _2021: _0satsPattern2::new(client.clone(), "year_2021".to_string()), - _2022: _0satsPattern2::new(client.clone(), "year_2022".to_string()), - _2023: _0satsPattern2::new(client.clone(), "year_2023".to_string()), - _2024: _0satsPattern2::new(client.clone(), "year_2024".to_string()), - _2025: _0satsPattern2::new(client.clone(), "year_2025".to_string()), - _2026: _0satsPattern2::new(client.clone(), "year_2026".to_string()), - } - } -} - /// Metrics tree node. pub struct MetricsTree_Indexes { pub address: MetricsTree_Indexes_Address, - pub dateindex: MetricsTree_Indexes_Dateindex, - pub decadeindex: MetricsTree_Indexes_Decadeindex, + pub height: MetricsTree_Indexes_Height, pub difficultyepoch: MetricsTree_Indexes_Difficultyepoch, pub halvingepoch: MetricsTree_Indexes_Halvingepoch, - pub height: MetricsTree_Indexes_Height, + pub dateindex: MetricsTree_Indexes_Dateindex, + pub weekindex: MetricsTree_Indexes_Weekindex, pub monthindex: MetricsTree_Indexes_Monthindex, pub quarterindex: MetricsTree_Indexes_Quarterindex, pub semesterindex: MetricsTree_Indexes_Semesterindex, + pub yearindex: MetricsTree_Indexes_Yearindex, + pub decadeindex: MetricsTree_Indexes_Decadeindex, pub txindex: MetricsTree_Indexes_Txindex, pub txinindex: MetricsTree_Indexes_Txinindex, pub txoutindex: MetricsTree_Indexes_Txoutindex, - pub weekindex: MetricsTree_Indexes_Weekindex, - pub yearindex: MetricsTree_Indexes_Yearindex, } impl MetricsTree_Indexes { pub fn new(client: Arc, base_path: String) -> Self { Self { address: MetricsTree_Indexes_Address::new(client.clone(), format!("{base_path}_address")), - dateindex: MetricsTree_Indexes_Dateindex::new(client.clone(), format!("{base_path}_dateindex")), - decadeindex: MetricsTree_Indexes_Decadeindex::new(client.clone(), format!("{base_path}_decadeindex")), + 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")), - height: MetricsTree_Indexes_Height::new(client.clone(), format!("{base_path}_height")), + dateindex: MetricsTree_Indexes_Dateindex::new(client.clone(), format!("{base_path}_dateindex")), + weekindex: MetricsTree_Indexes_Weekindex::new(client.clone(), format!("{base_path}_weekindex")), monthindex: MetricsTree_Indexes_Monthindex::new(client.clone(), format!("{base_path}_monthindex")), quarterindex: MetricsTree_Indexes_Quarterindex::new(client.clone(), format!("{base_path}_quarterindex")), semesterindex: MetricsTree_Indexes_Semesterindex::new(client.clone(), format!("{base_path}_semesterindex")), + yearindex: MetricsTree_Indexes_Yearindex::new(client.clone(), format!("{base_path}_yearindex")), + decadeindex: MetricsTree_Indexes_Decadeindex::new(client.clone(), format!("{base_path}_decadeindex")), 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")), - weekindex: MetricsTree_Indexes_Weekindex::new(client.clone(), format!("{base_path}_weekindex")), - yearindex: MetricsTree_Indexes_Yearindex::new(client.clone(), format!("{base_path}_yearindex")), } } } /// Metrics tree node. pub struct MetricsTree_Indexes_Address { - pub empty: MetricsTree_Indexes_Address_Empty, - pub opreturn: MetricsTree_Indexes_Address_Opreturn, - pub p2a: MetricsTree_Indexes_Address_P2a, - pub p2ms: MetricsTree_Indexes_Address_P2ms, pub p2pk33: MetricsTree_Indexes_Address_P2pk33, pub p2pk65: MetricsTree_Indexes_Address_P2pk65, pub p2pkh: MetricsTree_Indexes_Address_P2pkh, @@ -3763,16 +3447,16 @@ pub struct MetricsTree_Indexes_Address { pub p2tr: MetricsTree_Indexes_Address_P2tr, pub p2wpkh: MetricsTree_Indexes_Address_P2wpkh, pub p2wsh: MetricsTree_Indexes_Address_P2wsh, + pub p2a: MetricsTree_Indexes_Address_P2a, + pub p2ms: MetricsTree_Indexes_Address_P2ms, + pub empty: MetricsTree_Indexes_Address_Empty, pub unknown: MetricsTree_Indexes_Address_Unknown, + pub opreturn: MetricsTree_Indexes_Address_Opreturn, } impl MetricsTree_Indexes_Address { pub fn new(client: Arc, base_path: String) -> Self { Self { - empty: MetricsTree_Indexes_Address_Empty::new(client.clone(), format!("{base_path}_empty")), - opreturn: MetricsTree_Indexes_Address_Opreturn::new(client.clone(), format!("{base_path}_opreturn")), - p2a: MetricsTree_Indexes_Address_P2a::new(client.clone(), format!("{base_path}_p2a")), - p2ms: MetricsTree_Indexes_Address_P2ms::new(client.clone(), format!("{base_path}_p2ms")), 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")), @@ -3780,59 +3464,11 @@ impl MetricsTree_Indexes_Address { 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")), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Indexes_Address_Empty { - pub identity: MetricPattern9, -} - -impl MetricsTree_Indexes_Address_Empty { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - identity: MetricPattern9::new(client.clone(), "emptyoutputindex".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Indexes_Address_Opreturn { - pub identity: MetricPattern14, -} - -impl MetricsTree_Indexes_Address_Opreturn { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - identity: MetricPattern14::new(client.clone(), "opreturnindex".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Indexes_Address_P2a { - pub identity: MetricPattern16, -} - -impl MetricsTree_Indexes_Address_P2a { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - identity: MetricPattern16::new(client.clone(), "p2aaddressindex".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Indexes_Address_P2ms { - pub identity: MetricPattern17, -} - -impl MetricsTree_Indexes_Address_P2ms { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - identity: MetricPattern17::new(client.clone(), "p2msoutputindex".to_string()), + opreturn: MetricsTree_Indexes_Address_Opreturn::new(client.clone(), format!("{base_path}_opreturn")), } } } @@ -3928,6 +3564,45 @@ impl MetricsTree_Indexes_Address_P2wsh { } } +/// Metrics tree node. +pub struct MetricsTree_Indexes_Address_P2a { + pub identity: MetricPattern16, +} + +impl MetricsTree_Indexes_Address_P2a { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + identity: MetricPattern16::new(client.clone(), "p2aaddressindex".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Indexes_Address_P2ms { + pub identity: MetricPattern17, +} + +impl MetricsTree_Indexes_Address_P2ms { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + identity: MetricPattern17::new(client.clone(), "p2msoutputindex".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Indexes_Address_Empty { + pub identity: MetricPattern9, +} + +impl MetricsTree_Indexes_Address_Empty { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + identity: MetricPattern9::new(client.clone(), "emptyoutputindex".to_string()), + } + } +} + /// Metrics tree node. pub struct MetricsTree_Indexes_Address_Unknown { pub identity: MetricPattern28, @@ -3942,106 +3617,119 @@ impl MetricsTree_Indexes_Address_Unknown { } /// Metrics tree node. -pub struct MetricsTree_Indexes_Dateindex { - pub date: MetricPattern6, - pub first_height: MetricPattern6, - pub height_count: MetricPattern6, - pub identity: MetricPattern6, - pub monthindex: MetricPattern6, - pub weekindex: MetricPattern6, +pub struct MetricsTree_Indexes_Address_Opreturn { + pub identity: MetricPattern14, } -impl MetricsTree_Indexes_Dateindex { +impl MetricsTree_Indexes_Address_Opreturn { pub fn new(client: Arc, base_path: String) -> Self { Self { - date: MetricPattern6::new(client.clone(), "date".to_string()), - first_height: MetricPattern6::new(client.clone(), "first_height".to_string()), - height_count: MetricPattern6::new(client.clone(), "height_count".to_string()), - identity: MetricPattern6::new(client.clone(), "dateindex".to_string()), - monthindex: MetricPattern6::new(client.clone(), "monthindex".to_string()), - weekindex: MetricPattern6::new(client.clone(), "weekindex".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Indexes_Decadeindex { - pub date: MetricPattern7, - pub first_yearindex: MetricPattern7, - pub identity: MetricPattern7, - pub yearindex_count: MetricPattern7, -} - -impl MetricsTree_Indexes_Decadeindex { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - date: MetricPattern7::new(client.clone(), "date".to_string()), - first_yearindex: MetricPattern7::new(client.clone(), "first_yearindex".to_string()), - identity: MetricPattern7::new(client.clone(), "decadeindex".to_string()), - yearindex_count: MetricPattern7::new(client.clone(), "yearindex_count".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Indexes_Difficultyepoch { - pub first_height: MetricPattern8, - pub height_count: MetricPattern8, - pub identity: MetricPattern8, -} - -impl MetricsTree_Indexes_Difficultyepoch { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - first_height: MetricPattern8::new(client.clone(), "first_height".to_string()), - height_count: MetricPattern8::new(client.clone(), "height_count".to_string()), - identity: MetricPattern8::new(client.clone(), "difficultyepoch".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Indexes_Halvingepoch { - pub first_height: MetricPattern10, - pub identity: MetricPattern10, -} - -impl MetricsTree_Indexes_Halvingepoch { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - first_height: MetricPattern10::new(client.clone(), "first_height".to_string()), - identity: MetricPattern10::new(client.clone(), "halvingepoch".to_string()), + identity: MetricPattern14::new(client.clone(), "opreturnindex".to_string()), } } } /// Metrics tree node. pub struct MetricsTree_Indexes_Height { + pub identity: MetricPattern11, pub dateindex: MetricPattern11, pub difficultyepoch: MetricPattern11, pub halvingepoch: MetricPattern11, - pub identity: MetricPattern11, pub txindex_count: MetricPattern11, } impl MetricsTree_Indexes_Height { pub fn new(client: Arc, base_path: String) -> Self { Self { + identity: MetricPattern11::new(client.clone(), "height".to_string()), dateindex: MetricPattern11::new(client.clone(), "dateindex".to_string()), difficultyepoch: MetricPattern11::new(client.clone(), "difficultyepoch".to_string()), halvingepoch: MetricPattern11::new(client.clone(), "halvingepoch".to_string()), - identity: MetricPattern11::new(client.clone(), "height".to_string()), txindex_count: MetricPattern11::new(client.clone(), "txindex_count".to_string()), } } } +/// Metrics tree node. +pub struct MetricsTree_Indexes_Difficultyepoch { + pub identity: MetricPattern8, + pub first_height: MetricPattern8, + pub height_count: MetricPattern8, +} + +impl MetricsTree_Indexes_Difficultyepoch { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + identity: MetricPattern8::new(client.clone(), "difficultyepoch".to_string()), + first_height: MetricPattern8::new(client.clone(), "first_height".to_string()), + height_count: MetricPattern8::new(client.clone(), "height_count".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Indexes_Halvingepoch { + pub identity: MetricPattern10, + pub first_height: MetricPattern10, +} + +impl MetricsTree_Indexes_Halvingepoch { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + identity: MetricPattern10::new(client.clone(), "halvingepoch".to_string()), + first_height: MetricPattern10::new(client.clone(), "first_height".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Indexes_Dateindex { + pub identity: MetricPattern6, + pub date: MetricPattern6, + pub first_height: MetricPattern6, + pub height_count: MetricPattern6, + pub weekindex: MetricPattern6, + pub monthindex: MetricPattern6, +} + +impl MetricsTree_Indexes_Dateindex { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + identity: MetricPattern6::new(client.clone(), "dateindex".to_string()), + date: MetricPattern6::new(client.clone(), "date".to_string()), + first_height: MetricPattern6::new(client.clone(), "first_height".to_string()), + height_count: MetricPattern6::new(client.clone(), "height_count".to_string()), + weekindex: MetricPattern6::new(client.clone(), "weekindex".to_string()), + monthindex: MetricPattern6::new(client.clone(), "monthindex".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Indexes_Weekindex { + pub identity: MetricPattern29, + pub date: MetricPattern29, + pub first_dateindex: MetricPattern29, + pub dateindex_count: MetricPattern29, +} + +impl MetricsTree_Indexes_Weekindex { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + identity: MetricPattern29::new(client.clone(), "weekindex".to_string()), + date: MetricPattern29::new(client.clone(), "date".to_string()), + first_dateindex: MetricPattern29::new(client.clone(), "first_dateindex".to_string()), + dateindex_count: MetricPattern29::new(client.clone(), "dateindex_count".to_string()), + } + } +} + /// Metrics tree node. pub struct MetricsTree_Indexes_Monthindex { - pub date: MetricPattern13, - pub dateindex_count: MetricPattern13, - pub first_dateindex: MetricPattern13, pub identity: MetricPattern13, + pub date: MetricPattern13, + pub first_dateindex: MetricPattern13, + pub dateindex_count: MetricPattern13, pub quarterindex: MetricPattern13, pub semesterindex: MetricPattern13, pub yearindex: MetricPattern13, @@ -4050,10 +3738,10 @@ pub struct MetricsTree_Indexes_Monthindex { impl MetricsTree_Indexes_Monthindex { pub fn new(client: Arc, base_path: String) -> Self { Self { - date: MetricPattern13::new(client.clone(), "date".to_string()), - dateindex_count: MetricPattern13::new(client.clone(), "dateindex_count".to_string()), - first_dateindex: MetricPattern13::new(client.clone(), "first_dateindex".to_string()), identity: MetricPattern13::new(client.clone(), "monthindex".to_string()), + date: MetricPattern13::new(client.clone(), "date".to_string()), + first_dateindex: MetricPattern13::new(client.clone(), "first_dateindex".to_string()), + dateindex_count: MetricPattern13::new(client.clone(), "dateindex_count".to_string()), quarterindex: MetricPattern13::new(client.clone(), "quarterindex".to_string()), semesterindex: MetricPattern13::new(client.clone(), "semesterindex".to_string()), yearindex: MetricPattern13::new(client.clone(), "yearindex".to_string()), @@ -4063,18 +3751,18 @@ impl MetricsTree_Indexes_Monthindex { /// Metrics tree node. pub struct MetricsTree_Indexes_Quarterindex { + pub identity: MetricPattern25, pub date: MetricPattern25, pub first_monthindex: MetricPattern25, - pub identity: MetricPattern25, pub monthindex_count: MetricPattern25, } impl MetricsTree_Indexes_Quarterindex { pub fn new(client: Arc, base_path: String) -> Self { Self { + identity: MetricPattern25::new(client.clone(), "quarterindex".to_string()), date: MetricPattern25::new(client.clone(), "date".to_string()), first_monthindex: MetricPattern25::new(client.clone(), "first_monthindex".to_string()), - identity: MetricPattern25::new(client.clone(), "quarterindex".to_string()), monthindex_count: MetricPattern25::new(client.clone(), "monthindex_count".to_string()), } } @@ -4082,23 +3770,63 @@ impl MetricsTree_Indexes_Quarterindex { /// Metrics tree node. pub struct MetricsTree_Indexes_Semesterindex { + pub identity: MetricPattern26, pub date: MetricPattern26, pub first_monthindex: MetricPattern26, - pub identity: MetricPattern26, pub monthindex_count: MetricPattern26, } impl MetricsTree_Indexes_Semesterindex { pub fn new(client: Arc, base_path: String) -> Self { Self { + identity: MetricPattern26::new(client.clone(), "semesterindex".to_string()), date: MetricPattern26::new(client.clone(), "date".to_string()), first_monthindex: MetricPattern26::new(client.clone(), "first_monthindex".to_string()), - identity: MetricPattern26::new(client.clone(), "semesterindex".to_string()), monthindex_count: MetricPattern26::new(client.clone(), "monthindex_count".to_string()), } } } +/// Metrics tree node. +pub struct MetricsTree_Indexes_Yearindex { + pub identity: MetricPattern30, + pub date: MetricPattern30, + pub first_monthindex: MetricPattern30, + pub monthindex_count: MetricPattern30, + pub decadeindex: MetricPattern30, +} + +impl MetricsTree_Indexes_Yearindex { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + identity: MetricPattern30::new(client.clone(), "yearindex".to_string()), + date: MetricPattern30::new(client.clone(), "date".to_string()), + first_monthindex: MetricPattern30::new(client.clone(), "first_monthindex".to_string()), + monthindex_count: MetricPattern30::new(client.clone(), "monthindex_count".to_string()), + decadeindex: MetricPattern30::new(client.clone(), "decadeindex".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Indexes_Decadeindex { + pub identity: MetricPattern7, + pub date: MetricPattern7, + pub first_yearindex: MetricPattern7, + pub yearindex_count: MetricPattern7, +} + +impl MetricsTree_Indexes_Decadeindex { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + identity: MetricPattern7::new(client.clone(), "decadeindex".to_string()), + date: MetricPattern7::new(client.clone(), "date".to_string()), + first_yearindex: MetricPattern7::new(client.clone(), "first_yearindex".to_string()), + yearindex_count: MetricPattern7::new(client.clone(), "yearindex_count".to_string()), + } + } +} + /// Metrics tree node. pub struct MetricsTree_Indexes_Txindex { pub identity: MetricPattern27, @@ -4142,255 +3870,456 @@ impl MetricsTree_Indexes_Txoutindex { } } -/// Metrics tree node. -pub struct MetricsTree_Indexes_Weekindex { - pub date: MetricPattern29, - pub dateindex_count: MetricPattern29, - pub first_dateindex: MetricPattern29, - pub identity: MetricPattern29, -} - -impl MetricsTree_Indexes_Weekindex { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - date: MetricPattern29::new(client.clone(), "date".to_string()), - dateindex_count: MetricPattern29::new(client.clone(), "dateindex_count".to_string()), - first_dateindex: MetricPattern29::new(client.clone(), "first_dateindex".to_string()), - identity: MetricPattern29::new(client.clone(), "weekindex".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Indexes_Yearindex { - pub date: MetricPattern30, - pub decadeindex: MetricPattern30, - pub first_monthindex: MetricPattern30, - pub identity: MetricPattern30, - pub monthindex_count: MetricPattern30, -} - -impl MetricsTree_Indexes_Yearindex { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - date: MetricPattern30::new(client.clone(), "date".to_string()), - decadeindex: MetricPattern30::new(client.clone(), "decadeindex".to_string()), - first_monthindex: MetricPattern30::new(client.clone(), "first_monthindex".to_string()), - identity: MetricPattern30::new(client.clone(), "yearindex".to_string()), - monthindex_count: MetricPattern30::new(client.clone(), "monthindex_count".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Inputs { - pub count: CountPattern2, - pub first_txinindex: MetricPattern11, - pub outpoint: MetricPattern12, - pub outputtype: MetricPattern12, - pub spent: MetricsTree_Inputs_Spent, - pub txindex: MetricPattern12, - pub typeindex: MetricPattern12, -} - -impl MetricsTree_Inputs { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - count: CountPattern2::new(client.clone(), "input_count".to_string()), - first_txinindex: MetricPattern11::new(client.clone(), "first_txinindex".to_string()), - outpoint: MetricPattern12::new(client.clone(), "outpoint".to_string()), - outputtype: MetricPattern12::new(client.clone(), "outputtype".to_string()), - spent: MetricsTree_Inputs_Spent::new(client.clone(), format!("{base_path}_spent")), - txindex: MetricPattern12::new(client.clone(), "txindex".to_string()), - typeindex: MetricPattern12::new(client.clone(), "typeindex".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Inputs_Spent { - pub txoutindex: MetricPattern12, - pub value: MetricPattern12, -} - -impl MetricsTree_Inputs_Spent { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - txoutindex: MetricPattern12::new(client.clone(), "txoutindex".to_string()), - value: MetricPattern12::new(client.clone(), "value".to_string()), - } - } -} - /// Metrics tree node. pub struct MetricsTree_Market { pub ath: MetricsTree_Market_Ath, - pub dca: MetricsTree_Market_Dca, - pub indicators: MetricsTree_Market_Indicators, pub lookback: MetricsTree_Market_Lookback, - pub moving_average: MetricsTree_Market_MovingAverage, - pub range: MetricsTree_Market_Range, pub returns: MetricsTree_Market_Returns, pub volatility: MetricsTree_Market_Volatility, + pub range: MetricsTree_Market_Range, + pub moving_average: MetricsTree_Market_MovingAverage, + pub dca: MetricsTree_Market_Dca, + pub indicators: MetricsTree_Market_Indicators, } impl MetricsTree_Market { pub fn new(client: Arc, base_path: String) -> Self { Self { ath: MetricsTree_Market_Ath::new(client.clone(), format!("{base_path}_ath")), - dca: MetricsTree_Market_Dca::new(client.clone(), format!("{base_path}_dca")), - indicators: MetricsTree_Market_Indicators::new(client.clone(), format!("{base_path}_indicators")), lookback: MetricsTree_Market_Lookback::new(client.clone(), format!("{base_path}_lookback")), - moving_average: MetricsTree_Market_MovingAverage::new(client.clone(), format!("{base_path}_moving_average")), - range: MetricsTree_Market_Range::new(client.clone(), format!("{base_path}_range")), 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")), + dca: MetricsTree_Market_Dca::new(client.clone(), format!("{base_path}_dca")), + indicators: MetricsTree_Market_Indicators::new(client.clone(), format!("{base_path}_indicators")), } } } /// Metrics tree node. pub struct MetricsTree_Market_Ath { + pub price_ath: DollarsSatsPattern, + pub price_drawdown: MetricPattern3, pub days_since_price_ath: MetricPattern4, + pub years_since_price_ath: MetricPattern4, pub max_days_between_price_aths: MetricPattern4, pub max_years_between_price_aths: MetricPattern4, - pub price_ath: ActivePricePattern, - pub price_drawdown: MetricPattern3, - pub years_since_price_ath: MetricPattern4, } impl MetricsTree_Market_Ath { pub fn new(client: Arc, base_path: String) -> Self { Self { + price_ath: DollarsSatsPattern::new(client.clone(), "price_ath".to_string()), + price_drawdown: MetricPattern3::new(client.clone(), "price_drawdown".to_string()), days_since_price_ath: MetricPattern4::new(client.clone(), "days_since_price_ath".to_string()), + years_since_price_ath: MetricPattern4::new(client.clone(), "years_since_price_ath".to_string()), max_days_between_price_aths: MetricPattern4::new(client.clone(), "max_days_between_price_aths".to_string()), max_years_between_price_aths: MetricPattern4::new(client.clone(), "max_years_between_price_aths".to_string()), - price_ath: ActivePricePattern::new(client.clone(), "price_ath".to_string()), - price_drawdown: MetricPattern3::new(client.clone(), "price_drawdown".to_string()), - years_since_price_ath: MetricPattern4::new(client.clone(), "years_since_price_ath".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Market_Lookback { + pub _1d: DollarsSatsPattern2, + pub _1w: DollarsSatsPattern2, + pub _1m: DollarsSatsPattern2, + pub _3m: DollarsSatsPattern2, + pub _6m: DollarsSatsPattern2, + pub _1y: DollarsSatsPattern2, + pub _2y: DollarsSatsPattern2, + pub _3y: DollarsSatsPattern2, + pub _4y: DollarsSatsPattern2, + pub _5y: DollarsSatsPattern2, + pub _6y: DollarsSatsPattern2, + pub _8y: DollarsSatsPattern2, + pub _10y: DollarsSatsPattern2, +} + +impl MetricsTree_Market_Lookback { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + _1d: DollarsSatsPattern2::new(client.clone(), "price_1d_ago".to_string()), + _1w: DollarsSatsPattern2::new(client.clone(), "price_1w_ago".to_string()), + _1m: DollarsSatsPattern2::new(client.clone(), "price_1m_ago".to_string()), + _3m: DollarsSatsPattern2::new(client.clone(), "price_3m_ago".to_string()), + _6m: DollarsSatsPattern2::new(client.clone(), "price_6m_ago".to_string()), + _1y: DollarsSatsPattern2::new(client.clone(), "price_1y_ago".to_string()), + _2y: DollarsSatsPattern2::new(client.clone(), "price_2y_ago".to_string()), + _3y: DollarsSatsPattern2::new(client.clone(), "price_3y_ago".to_string()), + _4y: DollarsSatsPattern2::new(client.clone(), "price_4y_ago".to_string()), + _5y: DollarsSatsPattern2::new(client.clone(), "price_5y_ago".to_string()), + _6y: DollarsSatsPattern2::new(client.clone(), "price_6y_ago".to_string()), + _8y: DollarsSatsPattern2::new(client.clone(), "price_8y_ago".to_string()), + _10y: DollarsSatsPattern2::new(client.clone(), "price_10y_ago".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Market_Returns { + pub price_returns: MetricsTree_Market_Returns_PriceReturns, + pub cagr: _10y2y3y4y5y6y8yPattern, + pub _1d_returns_1w_sd: SdSmaPattern, + pub _1d_returns_1m_sd: SdSmaPattern, + pub _1d_returns_1y_sd: SdSmaPattern, + pub downside_returns: MetricPattern6, + pub downside_1w_sd: SdSmaPattern, + pub downside_1m_sd: SdSmaPattern, + pub downside_1y_sd: SdSmaPattern, +} + +impl MetricsTree_Market_Returns { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + price_returns: MetricsTree_Market_Returns_PriceReturns::new(client.clone(), format!("{base_path}_price_returns")), + cagr: _10y2y3y4y5y6y8yPattern::new(client.clone(), "cagr".to_string()), + _1d_returns_1w_sd: SdSmaPattern::new(client.clone(), "1d_returns_1w_sd".to_string()), + _1d_returns_1m_sd: SdSmaPattern::new(client.clone(), "1d_returns_1m_sd".to_string()), + _1d_returns_1y_sd: SdSmaPattern::new(client.clone(), "1d_returns_1y_sd".to_string()), + downside_returns: MetricPattern6::new(client.clone(), "downside_returns".to_string()), + downside_1w_sd: SdSmaPattern::new(client.clone(), "downside_1w_sd".to_string()), + downside_1m_sd: SdSmaPattern::new(client.clone(), "downside_1m_sd".to_string()), + downside_1y_sd: SdSmaPattern::new(client.clone(), "downside_1y_sd".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Market_Returns_PriceReturns { + pub _1d: MetricPattern4, + pub _1w: MetricPattern4, + pub _1m: MetricPattern4, + pub _3m: MetricPattern4, + pub _6m: MetricPattern4, + pub _1y: MetricPattern4, + pub _2y: MetricPattern4, + pub _3y: MetricPattern4, + pub _4y: MetricPattern4, + pub _5y: MetricPattern4, + pub _6y: MetricPattern4, + pub _8y: MetricPattern4, + pub _10y: MetricPattern4, +} + +impl MetricsTree_Market_Returns_PriceReturns { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + _1d: MetricPattern4::new(client.clone(), "1d_price_returns".to_string()), + _1w: MetricPattern4::new(client.clone(), "1w_price_returns".to_string()), + _1m: MetricPattern4::new(client.clone(), "1m_price_returns".to_string()), + _3m: MetricPattern4::new(client.clone(), "3m_price_returns".to_string()), + _6m: MetricPattern4::new(client.clone(), "6m_price_returns".to_string()), + _1y: MetricPattern4::new(client.clone(), "1y_price_returns".to_string()), + _2y: MetricPattern4::new(client.clone(), "2y_price_returns".to_string()), + _3y: MetricPattern4::new(client.clone(), "3y_price_returns".to_string()), + _4y: MetricPattern4::new(client.clone(), "4y_price_returns".to_string()), + _5y: MetricPattern4::new(client.clone(), "5y_price_returns".to_string()), + _6y: MetricPattern4::new(client.clone(), "6y_price_returns".to_string()), + _8y: MetricPattern4::new(client.clone(), "8y_price_returns".to_string()), + _10y: MetricPattern4::new(client.clone(), "10y_price_returns".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Market_Volatility { + pub price_1w_volatility: MetricPattern4, + pub price_1m_volatility: MetricPattern4, + pub price_1y_volatility: MetricPattern4, + pub sharpe_1w: MetricPattern6, + pub sharpe_1m: MetricPattern6, + pub sharpe_1y: MetricPattern6, + pub sortino_1w: MetricPattern6, + pub sortino_1m: MetricPattern6, + pub sortino_1y: MetricPattern6, +} + +impl MetricsTree_Market_Volatility { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + price_1w_volatility: MetricPattern4::new(client.clone(), "price_1w_volatility".to_string()), + price_1m_volatility: MetricPattern4::new(client.clone(), "price_1m_volatility".to_string()), + price_1y_volatility: MetricPattern4::new(client.clone(), "price_1y_volatility".to_string()), + sharpe_1w: MetricPattern6::new(client.clone(), "sharpe_1w".to_string()), + sharpe_1m: MetricPattern6::new(client.clone(), "sharpe_1m".to_string()), + sharpe_1y: MetricPattern6::new(client.clone(), "sharpe_1y".to_string()), + sortino_1w: MetricPattern6::new(client.clone(), "sortino_1w".to_string()), + sortino_1m: MetricPattern6::new(client.clone(), "sortino_1m".to_string()), + sortino_1y: MetricPattern6::new(client.clone(), "sortino_1y".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Market_Range { + pub price_1w_min: DollarsSatsPattern2, + pub price_1w_max: DollarsSatsPattern2, + pub price_2w_min: DollarsSatsPattern2, + pub price_2w_max: DollarsSatsPattern2, + pub price_1m_min: DollarsSatsPattern2, + pub price_1m_max: DollarsSatsPattern2, + pub price_1y_min: DollarsSatsPattern2, + pub price_1y_max: DollarsSatsPattern2, + pub price_true_range: MetricPattern6, + pub price_true_range_2w_sum: MetricPattern6, + pub price_2w_choppiness_index: MetricPattern4, +} + +impl MetricsTree_Market_Range { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + price_1w_min: DollarsSatsPattern2::new(client.clone(), "price_1w_min".to_string()), + price_1w_max: DollarsSatsPattern2::new(client.clone(), "price_1w_max".to_string()), + price_2w_min: DollarsSatsPattern2::new(client.clone(), "price_2w_min".to_string()), + price_2w_max: DollarsSatsPattern2::new(client.clone(), "price_2w_max".to_string()), + price_1m_min: DollarsSatsPattern2::new(client.clone(), "price_1m_min".to_string()), + price_1m_max: DollarsSatsPattern2::new(client.clone(), "price_1m_max".to_string()), + price_1y_min: DollarsSatsPattern2::new(client.clone(), "price_1y_min".to_string()), + price_1y_max: DollarsSatsPattern2::new(client.clone(), "price_1y_max".to_string()), + price_true_range: MetricPattern6::new(client.clone(), "price_true_range".to_string()), + price_true_range_2w_sum: MetricPattern6::new(client.clone(), "price_true_range_2w_sum".to_string()), + price_2w_choppiness_index: MetricPattern4::new(client.clone(), "price_2w_choppiness_index".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Market_MovingAverage { + pub price_1w_sma: PriceRatioPattern, + pub price_8d_sma: PriceRatioPattern, + pub price_13d_sma: PriceRatioPattern, + pub price_21d_sma: PriceRatioPattern, + pub price_1m_sma: PriceRatioPattern, + pub price_34d_sma: PriceRatioPattern, + pub price_55d_sma: PriceRatioPattern, + pub price_89d_sma: PriceRatioPattern, + pub price_111d_sma: PriceRatioPattern, + pub price_144d_sma: PriceRatioPattern, + pub price_200d_sma: PriceRatioPattern, + pub price_350d_sma: PriceRatioPattern, + pub price_1y_sma: PriceRatioPattern, + pub price_2y_sma: PriceRatioPattern, + pub price_200w_sma: PriceRatioPattern, + pub price_4y_sma: PriceRatioPattern, + pub price_1w_ema: PriceRatioPattern, + pub price_8d_ema: PriceRatioPattern, + pub price_12d_ema: PriceRatioPattern, + pub price_13d_ema: PriceRatioPattern, + pub price_21d_ema: PriceRatioPattern, + pub price_26d_ema: PriceRatioPattern, + pub price_1m_ema: PriceRatioPattern, + pub price_34d_ema: PriceRatioPattern, + pub price_55d_ema: PriceRatioPattern, + pub price_89d_ema: PriceRatioPattern, + pub price_144d_ema: PriceRatioPattern, + pub price_200d_ema: PriceRatioPattern, + pub price_1y_ema: PriceRatioPattern, + pub price_2y_ema: PriceRatioPattern, + pub price_200w_ema: PriceRatioPattern, + pub price_4y_ema: PriceRatioPattern, + pub price_200d_sma_x2_4: DollarsSatsPattern2, + pub price_200d_sma_x0_8: DollarsSatsPattern2, + pub price_350d_sma_x2: DollarsSatsPattern2, +} + +impl MetricsTree_Market_MovingAverage { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + price_1w_sma: PriceRatioPattern::new(client.clone(), "price_1w_sma".to_string()), + price_8d_sma: PriceRatioPattern::new(client.clone(), "price_8d_sma".to_string()), + price_13d_sma: PriceRatioPattern::new(client.clone(), "price_13d_sma".to_string()), + price_21d_sma: PriceRatioPattern::new(client.clone(), "price_21d_sma".to_string()), + price_1m_sma: PriceRatioPattern::new(client.clone(), "price_1m_sma".to_string()), + price_34d_sma: PriceRatioPattern::new(client.clone(), "price_34d_sma".to_string()), + price_55d_sma: PriceRatioPattern::new(client.clone(), "price_55d_sma".to_string()), + price_89d_sma: PriceRatioPattern::new(client.clone(), "price_89d_sma".to_string()), + price_111d_sma: PriceRatioPattern::new(client.clone(), "price_111d_sma".to_string()), + price_144d_sma: PriceRatioPattern::new(client.clone(), "price_144d_sma".to_string()), + price_200d_sma: PriceRatioPattern::new(client.clone(), "price_200d_sma".to_string()), + price_350d_sma: PriceRatioPattern::new(client.clone(), "price_350d_sma".to_string()), + price_1y_sma: PriceRatioPattern::new(client.clone(), "price_1y_sma".to_string()), + price_2y_sma: PriceRatioPattern::new(client.clone(), "price_2y_sma".to_string()), + price_200w_sma: PriceRatioPattern::new(client.clone(), "price_200w_sma".to_string()), + price_4y_sma: PriceRatioPattern::new(client.clone(), "price_4y_sma".to_string()), + price_1w_ema: PriceRatioPattern::new(client.clone(), "price_1w_ema".to_string()), + price_8d_ema: PriceRatioPattern::new(client.clone(), "price_8d_ema".to_string()), + price_12d_ema: PriceRatioPattern::new(client.clone(), "price_12d_ema".to_string()), + price_13d_ema: PriceRatioPattern::new(client.clone(), "price_13d_ema".to_string()), + price_21d_ema: PriceRatioPattern::new(client.clone(), "price_21d_ema".to_string()), + price_26d_ema: PriceRatioPattern::new(client.clone(), "price_26d_ema".to_string()), + price_1m_ema: PriceRatioPattern::new(client.clone(), "price_1m_ema".to_string()), + price_34d_ema: PriceRatioPattern::new(client.clone(), "price_34d_ema".to_string()), + price_55d_ema: PriceRatioPattern::new(client.clone(), "price_55d_ema".to_string()), + price_89d_ema: PriceRatioPattern::new(client.clone(), "price_89d_ema".to_string()), + price_144d_ema: PriceRatioPattern::new(client.clone(), "price_144d_ema".to_string()), + price_200d_ema: PriceRatioPattern::new(client.clone(), "price_200d_ema".to_string()), + price_1y_ema: PriceRatioPattern::new(client.clone(), "price_1y_ema".to_string()), + price_2y_ema: PriceRatioPattern::new(client.clone(), "price_2y_ema".to_string()), + price_200w_ema: PriceRatioPattern::new(client.clone(), "price_200w_ema".to_string()), + price_4y_ema: PriceRatioPattern::new(client.clone(), "price_4y_ema".to_string()), + price_200d_sma_x2_4: DollarsSatsPattern2::new(client.clone(), "price_200d_sma_x2_4".to_string()), + price_200d_sma_x0_8: DollarsSatsPattern2::new(client.clone(), "price_200d_sma_x0_8".to_string()), + price_350d_sma_x2: DollarsSatsPattern2::new(client.clone(), "price_350d_sma_x2".to_string()), } } } /// Metrics tree node. pub struct MetricsTree_Market_Dca { + pub period_stack: _10y1m1w1y2y3m3y4y5y6m6y8yPattern3, + pub period_average_price: MetricsTree_Market_Dca_PeriodAveragePrice, + pub period_returns: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2, + pub period_cagr: _10y2y3y4y5y6y8yPattern, + pub period_days_in_profit: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2, + pub period_days_in_loss: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2, + pub period_max_drawdown: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2, + pub period_max_return: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2, + pub period_lump_sum_stack: _10y1m1w1y2y3m3y4y5y6m6y8yPattern3, + pub period_lump_sum_returns: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2, + pub period_lump_sum_days_in_profit: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2, + pub period_lump_sum_days_in_loss: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2, + pub period_lump_sum_max_drawdown: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2, + pub period_lump_sum_max_return: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2, + pub class_stack: MetricsTree_Market_Dca_ClassStack, pub class_average_price: MetricsTree_Market_Dca_ClassAveragePrice, - pub class_days_in_loss: MetricsTree_Market_Dca_ClassDaysInLoss, + pub class_returns: _201520162017201820192020202120222023202420252026Pattern2, pub class_days_in_profit: MetricsTree_Market_Dca_ClassDaysInProfit, + pub class_days_in_loss: MetricsTree_Market_Dca_ClassDaysInLoss, pub class_max_drawdown: MetricsTree_Market_Dca_ClassMaxDrawdown, pub class_max_return: MetricsTree_Market_Dca_ClassMaxReturn, - pub class_returns: ClassDaysInLossPattern, - pub class_stack: MetricsTree_Market_Dca_ClassStack, - pub period_average_price: MetricsTree_Market_Dca_PeriodAveragePrice, - pub period_cagr: PeriodCagrPattern, - pub period_days_in_loss: PeriodDaysInLossPattern, - pub period_days_in_profit: PeriodDaysInLossPattern, - pub period_lump_sum_days_in_loss: PeriodDaysInLossPattern, - pub period_lump_sum_days_in_profit: PeriodDaysInLossPattern, - pub period_lump_sum_max_drawdown: PeriodDaysInLossPattern, - pub period_lump_sum_max_return: PeriodDaysInLossPattern, - pub period_lump_sum_returns: PeriodDaysInLossPattern, - pub period_lump_sum_stack: PeriodLumpSumStackPattern, - pub period_max_drawdown: PeriodDaysInLossPattern, - pub period_max_return: PeriodDaysInLossPattern, - pub period_returns: PeriodDaysInLossPattern, - pub period_stack: PeriodLumpSumStackPattern, } impl MetricsTree_Market_Dca { pub fn new(client: Arc, base_path: String) -> Self { Self { + period_stack: _10y1m1w1y2y3m3y4y5y6m6y8yPattern3::new(client.clone(), "dca_stack".to_string()), + period_average_price: MetricsTree_Market_Dca_PeriodAveragePrice::new(client.clone(), format!("{base_path}_period_average_price")), + period_returns: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2::new(client.clone(), "dca_returns".to_string()), + period_cagr: _10y2y3y4y5y6y8yPattern::new(client.clone(), "dca_cagr".to_string()), + period_days_in_profit: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2::new(client.clone(), "dca_days_in_profit".to_string()), + period_days_in_loss: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2::new(client.clone(), "dca_days_in_loss".to_string()), + period_max_drawdown: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2::new(client.clone(), "dca_max_drawdown".to_string()), + period_max_return: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2::new(client.clone(), "dca_max_return".to_string()), + period_lump_sum_stack: _10y1m1w1y2y3m3y4y5y6m6y8yPattern3::new(client.clone(), "lump_sum_stack".to_string()), + period_lump_sum_returns: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2::new(client.clone(), "lump_sum_returns".to_string()), + period_lump_sum_days_in_profit: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2::new(client.clone(), "lump_sum_days_in_profit".to_string()), + period_lump_sum_days_in_loss: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2::new(client.clone(), "lump_sum_days_in_loss".to_string()), + period_lump_sum_max_drawdown: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2::new(client.clone(), "lump_sum_max_drawdown".to_string()), + period_lump_sum_max_return: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2::new(client.clone(), "lump_sum_max_return".to_string()), + class_stack: MetricsTree_Market_Dca_ClassStack::new(client.clone(), format!("{base_path}_class_stack")), class_average_price: MetricsTree_Market_Dca_ClassAveragePrice::new(client.clone(), format!("{base_path}_class_average_price")), - class_days_in_loss: MetricsTree_Market_Dca_ClassDaysInLoss::new(client.clone(), format!("{base_path}_class_days_in_loss")), + class_returns: _201520162017201820192020202120222023202420252026Pattern2::new(client.clone(), "dca_class".to_string()), class_days_in_profit: MetricsTree_Market_Dca_ClassDaysInProfit::new(client.clone(), format!("{base_path}_class_days_in_profit")), + class_days_in_loss: MetricsTree_Market_Dca_ClassDaysInLoss::new(client.clone(), format!("{base_path}_class_days_in_loss")), class_max_drawdown: MetricsTree_Market_Dca_ClassMaxDrawdown::new(client.clone(), format!("{base_path}_class_max_drawdown")), class_max_return: MetricsTree_Market_Dca_ClassMaxReturn::new(client.clone(), format!("{base_path}_class_max_return")), - class_returns: ClassDaysInLossPattern::new(client.clone(), "dca_class".to_string()), - class_stack: MetricsTree_Market_Dca_ClassStack::new(client.clone(), format!("{base_path}_class_stack")), - period_average_price: MetricsTree_Market_Dca_PeriodAveragePrice::new(client.clone(), format!("{base_path}_period_average_price")), - period_cagr: PeriodCagrPattern::new(client.clone(), "dca_cagr".to_string()), - period_days_in_loss: PeriodDaysInLossPattern::new(client.clone(), "dca_days_in_loss".to_string()), - period_days_in_profit: PeriodDaysInLossPattern::new(client.clone(), "dca_days_in_profit".to_string()), - period_lump_sum_days_in_loss: PeriodDaysInLossPattern::new(client.clone(), "lump_sum_days_in_loss".to_string()), - period_lump_sum_days_in_profit: PeriodDaysInLossPattern::new(client.clone(), "lump_sum_days_in_profit".to_string()), - period_lump_sum_max_drawdown: PeriodDaysInLossPattern::new(client.clone(), "lump_sum_max_drawdown".to_string()), - period_lump_sum_max_return: PeriodDaysInLossPattern::new(client.clone(), "lump_sum_max_return".to_string()), - period_lump_sum_returns: PeriodDaysInLossPattern::new(client.clone(), "lump_sum_returns".to_string()), - period_lump_sum_stack: PeriodLumpSumStackPattern::new(client.clone(), "lump_sum_stack".to_string()), - period_max_drawdown: PeriodDaysInLossPattern::new(client.clone(), "dca_max_drawdown".to_string()), - period_max_return: PeriodDaysInLossPattern::new(client.clone(), "dca_max_return".to_string()), - period_returns: PeriodDaysInLossPattern::new(client.clone(), "dca_returns".to_string()), - period_stack: PeriodLumpSumStackPattern::new(client.clone(), "dca_stack".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Market_Dca_PeriodAveragePrice { + pub _1w: DollarsSatsPattern2, + pub _1m: DollarsSatsPattern2, + pub _3m: DollarsSatsPattern2, + pub _6m: DollarsSatsPattern2, + pub _1y: DollarsSatsPattern2, + pub _2y: DollarsSatsPattern2, + pub _3y: DollarsSatsPattern2, + pub _4y: DollarsSatsPattern2, + pub _5y: DollarsSatsPattern2, + pub _6y: DollarsSatsPattern2, + pub _8y: DollarsSatsPattern2, + pub _10y: DollarsSatsPattern2, +} + +impl MetricsTree_Market_Dca_PeriodAveragePrice { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + _1w: DollarsSatsPattern2::new(client.clone(), "1w_dca_average_price".to_string()), + _1m: DollarsSatsPattern2::new(client.clone(), "1m_dca_average_price".to_string()), + _3m: DollarsSatsPattern2::new(client.clone(), "3m_dca_average_price".to_string()), + _6m: DollarsSatsPattern2::new(client.clone(), "6m_dca_average_price".to_string()), + _1y: DollarsSatsPattern2::new(client.clone(), "1y_dca_average_price".to_string()), + _2y: DollarsSatsPattern2::new(client.clone(), "2y_dca_average_price".to_string()), + _3y: DollarsSatsPattern2::new(client.clone(), "3y_dca_average_price".to_string()), + _4y: DollarsSatsPattern2::new(client.clone(), "4y_dca_average_price".to_string()), + _5y: DollarsSatsPattern2::new(client.clone(), "5y_dca_average_price".to_string()), + _6y: DollarsSatsPattern2::new(client.clone(), "6y_dca_average_price".to_string()), + _8y: DollarsSatsPattern2::new(client.clone(), "8y_dca_average_price".to_string()), + _10y: DollarsSatsPattern2::new(client.clone(), "10y_dca_average_price".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Market_Dca_ClassStack { + pub _2015: BitcoinDollarsSatsPattern5, + pub _2016: BitcoinDollarsSatsPattern5, + pub _2017: BitcoinDollarsSatsPattern5, + pub _2018: BitcoinDollarsSatsPattern5, + pub _2019: BitcoinDollarsSatsPattern5, + pub _2020: BitcoinDollarsSatsPattern5, + pub _2021: BitcoinDollarsSatsPattern5, + pub _2022: BitcoinDollarsSatsPattern5, + pub _2023: BitcoinDollarsSatsPattern5, + pub _2024: BitcoinDollarsSatsPattern5, + pub _2025: BitcoinDollarsSatsPattern5, + pub _2026: BitcoinDollarsSatsPattern5, +} + +impl MetricsTree_Market_Dca_ClassStack { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + _2015: BitcoinDollarsSatsPattern5::new(client.clone(), "dca_class_2015_stack".to_string()), + _2016: BitcoinDollarsSatsPattern5::new(client.clone(), "dca_class_2016_stack".to_string()), + _2017: BitcoinDollarsSatsPattern5::new(client.clone(), "dca_class_2017_stack".to_string()), + _2018: BitcoinDollarsSatsPattern5::new(client.clone(), "dca_class_2018_stack".to_string()), + _2019: BitcoinDollarsSatsPattern5::new(client.clone(), "dca_class_2019_stack".to_string()), + _2020: BitcoinDollarsSatsPattern5::new(client.clone(), "dca_class_2020_stack".to_string()), + _2021: BitcoinDollarsSatsPattern5::new(client.clone(), "dca_class_2021_stack".to_string()), + _2022: BitcoinDollarsSatsPattern5::new(client.clone(), "dca_class_2022_stack".to_string()), + _2023: BitcoinDollarsSatsPattern5::new(client.clone(), "dca_class_2023_stack".to_string()), + _2024: BitcoinDollarsSatsPattern5::new(client.clone(), "dca_class_2024_stack".to_string()), + _2025: BitcoinDollarsSatsPattern5::new(client.clone(), "dca_class_2025_stack".to_string()), + _2026: BitcoinDollarsSatsPattern5::new(client.clone(), "dca_class_2026_stack".to_string()), } } } /// Metrics tree node. pub struct MetricsTree_Market_Dca_ClassAveragePrice { - pub _2015: _0sdUsdPattern, - pub _2016: _0sdUsdPattern, - pub _2017: _0sdUsdPattern, - pub _2018: _0sdUsdPattern, - pub _2019: _0sdUsdPattern, - pub _2020: _0sdUsdPattern, - pub _2021: _0sdUsdPattern, - pub _2022: _0sdUsdPattern, - pub _2023: _0sdUsdPattern, - pub _2024: _0sdUsdPattern, - pub _2025: _0sdUsdPattern, - pub _2026: _0sdUsdPattern, + pub _2015: DollarsSatsPattern2, + pub _2016: DollarsSatsPattern2, + pub _2017: DollarsSatsPattern2, + pub _2018: DollarsSatsPattern2, + pub _2019: DollarsSatsPattern2, + pub _2020: DollarsSatsPattern2, + pub _2021: DollarsSatsPattern2, + pub _2022: DollarsSatsPattern2, + pub _2023: DollarsSatsPattern2, + pub _2024: DollarsSatsPattern2, + pub _2025: DollarsSatsPattern2, + pub _2026: DollarsSatsPattern2, } impl MetricsTree_Market_Dca_ClassAveragePrice { pub fn new(client: Arc, base_path: String) -> Self { Self { - _2015: _0sdUsdPattern::new(client.clone(), "dca_class_2015_average_price".to_string()), - _2016: _0sdUsdPattern::new(client.clone(), "dca_class_2016_average_price".to_string()), - _2017: _0sdUsdPattern::new(client.clone(), "dca_class_2017_average_price".to_string()), - _2018: _0sdUsdPattern::new(client.clone(), "dca_class_2018_average_price".to_string()), - _2019: _0sdUsdPattern::new(client.clone(), "dca_class_2019_average_price".to_string()), - _2020: _0sdUsdPattern::new(client.clone(), "dca_class_2020_average_price".to_string()), - _2021: _0sdUsdPattern::new(client.clone(), "dca_class_2021_average_price".to_string()), - _2022: _0sdUsdPattern::new(client.clone(), "dca_class_2022_average_price".to_string()), - _2023: _0sdUsdPattern::new(client.clone(), "dca_class_2023_average_price".to_string()), - _2024: _0sdUsdPattern::new(client.clone(), "dca_class_2024_average_price".to_string()), - _2025: _0sdUsdPattern::new(client.clone(), "dca_class_2025_average_price".to_string()), - _2026: _0sdUsdPattern::new(client.clone(), "dca_class_2026_average_price".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Market_Dca_ClassDaysInLoss { - pub _2015: MetricPattern4, - pub _2016: MetricPattern4, - pub _2017: MetricPattern4, - pub _2018: MetricPattern4, - pub _2019: MetricPattern4, - pub _2020: MetricPattern4, - pub _2021: MetricPattern4, - pub _2022: MetricPattern4, - pub _2023: MetricPattern4, - pub _2024: MetricPattern4, - pub _2025: MetricPattern4, - pub _2026: MetricPattern4, -} - -impl MetricsTree_Market_Dca_ClassDaysInLoss { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - _2015: MetricPattern4::new(client.clone(), "dca_class_2015_days_in_loss".to_string()), - _2016: MetricPattern4::new(client.clone(), "dca_class_2016_days_in_loss".to_string()), - _2017: MetricPattern4::new(client.clone(), "dca_class_2017_days_in_loss".to_string()), - _2018: MetricPattern4::new(client.clone(), "dca_class_2018_days_in_loss".to_string()), - _2019: MetricPattern4::new(client.clone(), "dca_class_2019_days_in_loss".to_string()), - _2020: MetricPattern4::new(client.clone(), "dca_class_2020_days_in_loss".to_string()), - _2021: MetricPattern4::new(client.clone(), "dca_class_2021_days_in_loss".to_string()), - _2022: MetricPattern4::new(client.clone(), "dca_class_2022_days_in_loss".to_string()), - _2023: MetricPattern4::new(client.clone(), "dca_class_2023_days_in_loss".to_string()), - _2024: MetricPattern4::new(client.clone(), "dca_class_2024_days_in_loss".to_string()), - _2025: MetricPattern4::new(client.clone(), "dca_class_2025_days_in_loss".to_string()), - _2026: MetricPattern4::new(client.clone(), "dca_class_2026_days_in_loss".to_string()), + _2015: DollarsSatsPattern2::new(client.clone(), "dca_class_2015_average_price".to_string()), + _2016: DollarsSatsPattern2::new(client.clone(), "dca_class_2016_average_price".to_string()), + _2017: DollarsSatsPattern2::new(client.clone(), "dca_class_2017_average_price".to_string()), + _2018: DollarsSatsPattern2::new(client.clone(), "dca_class_2018_average_price".to_string()), + _2019: DollarsSatsPattern2::new(client.clone(), "dca_class_2019_average_price".to_string()), + _2020: DollarsSatsPattern2::new(client.clone(), "dca_class_2020_average_price".to_string()), + _2021: DollarsSatsPattern2::new(client.clone(), "dca_class_2021_average_price".to_string()), + _2022: DollarsSatsPattern2::new(client.clone(), "dca_class_2022_average_price".to_string()), + _2023: DollarsSatsPattern2::new(client.clone(), "dca_class_2023_average_price".to_string()), + _2024: DollarsSatsPattern2::new(client.clone(), "dca_class_2024_average_price".to_string()), + _2025: DollarsSatsPattern2::new(client.clone(), "dca_class_2025_average_price".to_string()), + _2026: DollarsSatsPattern2::new(client.clone(), "dca_class_2026_average_price".to_string()), } } } @@ -4430,6 +4359,41 @@ impl MetricsTree_Market_Dca_ClassDaysInProfit { } } +/// Metrics tree node. +pub struct MetricsTree_Market_Dca_ClassDaysInLoss { + pub _2015: MetricPattern4, + pub _2016: MetricPattern4, + pub _2017: MetricPattern4, + pub _2018: MetricPattern4, + pub _2019: MetricPattern4, + pub _2020: MetricPattern4, + pub _2021: MetricPattern4, + pub _2022: MetricPattern4, + pub _2023: MetricPattern4, + pub _2024: MetricPattern4, + pub _2025: MetricPattern4, + pub _2026: MetricPattern4, +} + +impl MetricsTree_Market_Dca_ClassDaysInLoss { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + _2015: MetricPattern4::new(client.clone(), "dca_class_2015_days_in_loss".to_string()), + _2016: MetricPattern4::new(client.clone(), "dca_class_2016_days_in_loss".to_string()), + _2017: MetricPattern4::new(client.clone(), "dca_class_2017_days_in_loss".to_string()), + _2018: MetricPattern4::new(client.clone(), "dca_class_2018_days_in_loss".to_string()), + _2019: MetricPattern4::new(client.clone(), "dca_class_2019_days_in_loss".to_string()), + _2020: MetricPattern4::new(client.clone(), "dca_class_2020_days_in_loss".to_string()), + _2021: MetricPattern4::new(client.clone(), "dca_class_2021_days_in_loss".to_string()), + _2022: MetricPattern4::new(client.clone(), "dca_class_2022_days_in_loss".to_string()), + _2023: MetricPattern4::new(client.clone(), "dca_class_2023_days_in_loss".to_string()), + _2024: MetricPattern4::new(client.clone(), "dca_class_2024_days_in_loss".to_string()), + _2025: MetricPattern4::new(client.clone(), "dca_class_2025_days_in_loss".to_string()), + _2026: MetricPattern4::new(client.clone(), "dca_class_2026_days_in_loss".to_string()), + } + } +} + /// Metrics tree node. pub struct MetricsTree_Market_Dca_ClassMaxDrawdown { pub _2015: MetricPattern4, @@ -4500,420 +4464,51 @@ impl MetricsTree_Market_Dca_ClassMaxReturn { } } -/// Metrics tree node. -pub struct MetricsTree_Market_Dca_ClassStack { - pub _2015: _2015Pattern, - pub _2016: _2015Pattern, - pub _2017: _2015Pattern, - pub _2018: _2015Pattern, - pub _2019: _2015Pattern, - pub _2020: _2015Pattern, - pub _2021: _2015Pattern, - pub _2022: _2015Pattern, - pub _2023: _2015Pattern, - pub _2024: _2015Pattern, - pub _2025: _2015Pattern, - pub _2026: _2015Pattern, -} - -impl MetricsTree_Market_Dca_ClassStack { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - _2015: _2015Pattern::new(client.clone(), "dca_class_2015_stack".to_string()), - _2016: _2015Pattern::new(client.clone(), "dca_class_2016_stack".to_string()), - _2017: _2015Pattern::new(client.clone(), "dca_class_2017_stack".to_string()), - _2018: _2015Pattern::new(client.clone(), "dca_class_2018_stack".to_string()), - _2019: _2015Pattern::new(client.clone(), "dca_class_2019_stack".to_string()), - _2020: _2015Pattern::new(client.clone(), "dca_class_2020_stack".to_string()), - _2021: _2015Pattern::new(client.clone(), "dca_class_2021_stack".to_string()), - _2022: _2015Pattern::new(client.clone(), "dca_class_2022_stack".to_string()), - _2023: _2015Pattern::new(client.clone(), "dca_class_2023_stack".to_string()), - _2024: _2015Pattern::new(client.clone(), "dca_class_2024_stack".to_string()), - _2025: _2015Pattern::new(client.clone(), "dca_class_2025_stack".to_string()), - _2026: _2015Pattern::new(client.clone(), "dca_class_2026_stack".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Market_Dca_PeriodAveragePrice { - pub _10y: _0sdUsdPattern, - pub _1m: _0sdUsdPattern, - pub _1w: _0sdUsdPattern, - pub _1y: _0sdUsdPattern, - pub _2y: _0sdUsdPattern, - pub _3m: _0sdUsdPattern, - pub _3y: _0sdUsdPattern, - pub _4y: _0sdUsdPattern, - pub _5y: _0sdUsdPattern, - pub _6m: _0sdUsdPattern, - pub _6y: _0sdUsdPattern, - pub _8y: _0sdUsdPattern, -} - -impl MetricsTree_Market_Dca_PeriodAveragePrice { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - _10y: _0sdUsdPattern::new(client.clone(), "10y_dca_average_price".to_string()), - _1m: _0sdUsdPattern::new(client.clone(), "1m_dca_average_price".to_string()), - _1w: _0sdUsdPattern::new(client.clone(), "1w_dca_average_price".to_string()), - _1y: _0sdUsdPattern::new(client.clone(), "1y_dca_average_price".to_string()), - _2y: _0sdUsdPattern::new(client.clone(), "2y_dca_average_price".to_string()), - _3m: _0sdUsdPattern::new(client.clone(), "3m_dca_average_price".to_string()), - _3y: _0sdUsdPattern::new(client.clone(), "3y_dca_average_price".to_string()), - _4y: _0sdUsdPattern::new(client.clone(), "4y_dca_average_price".to_string()), - _5y: _0sdUsdPattern::new(client.clone(), "5y_dca_average_price".to_string()), - _6m: _0sdUsdPattern::new(client.clone(), "6m_dca_average_price".to_string()), - _6y: _0sdUsdPattern::new(client.clone(), "6y_dca_average_price".to_string()), - _8y: _0sdUsdPattern::new(client.clone(), "8y_dca_average_price".to_string()), - } - } -} - /// Metrics tree node. pub struct MetricsTree_Market_Indicators { - pub gini: MetricPattern6, - pub macd_histogram: MetricPattern6, - pub macd_line: MetricPattern6, - pub macd_signal: MetricPattern6, - pub nvt: MetricPattern4, - pub pi_cycle: MetricPattern6, pub puell_multiple: MetricPattern4, - pub rsi_14d: MetricPattern6, - pub rsi_14d_max: MetricPattern6, - pub rsi_14d_min: MetricPattern6, - pub rsi_average_gain_14d: MetricPattern6, - pub rsi_average_loss_14d: MetricPattern6, + pub nvt: MetricPattern4, pub rsi_gains: MetricPattern6, pub rsi_losses: MetricPattern6, - pub stoch_d: MetricPattern6, - pub stoch_k: MetricPattern6, + pub rsi_average_gain_14d: MetricPattern6, + pub rsi_average_loss_14d: MetricPattern6, + pub rsi_14d: MetricPattern6, + pub rsi_14d_min: MetricPattern6, + pub rsi_14d_max: MetricPattern6, pub stoch_rsi: MetricPattern6, - pub stoch_rsi_d: MetricPattern6, pub stoch_rsi_k: MetricPattern6, + pub stoch_rsi_d: MetricPattern6, + pub stoch_k: MetricPattern6, + pub stoch_d: MetricPattern6, + pub pi_cycle: MetricPattern6, + pub macd_line: MetricPattern6, + pub macd_signal: MetricPattern6, + pub macd_histogram: MetricPattern6, + pub gini: MetricPattern6, } impl MetricsTree_Market_Indicators { pub fn new(client: Arc, base_path: String) -> Self { Self { - gini: MetricPattern6::new(client.clone(), "gini".to_string()), - macd_histogram: MetricPattern6::new(client.clone(), "macd_histogram".to_string()), - macd_line: MetricPattern6::new(client.clone(), "macd_line".to_string()), - macd_signal: MetricPattern6::new(client.clone(), "macd_signal".to_string()), - nvt: MetricPattern4::new(client.clone(), "nvt".to_string()), - pi_cycle: MetricPattern6::new(client.clone(), "pi_cycle".to_string()), puell_multiple: MetricPattern4::new(client.clone(), "puell_multiple".to_string()), - rsi_14d: MetricPattern6::new(client.clone(), "rsi_14d".to_string()), - rsi_14d_max: MetricPattern6::new(client.clone(), "rsi_14d_max".to_string()), - rsi_14d_min: MetricPattern6::new(client.clone(), "rsi_14d_min".to_string()), - rsi_average_gain_14d: MetricPattern6::new(client.clone(), "rsi_average_gain_14d".to_string()), - rsi_average_loss_14d: MetricPattern6::new(client.clone(), "rsi_average_loss_14d".to_string()), + nvt: MetricPattern4::new(client.clone(), "nvt".to_string()), rsi_gains: MetricPattern6::new(client.clone(), "rsi_gains".to_string()), rsi_losses: MetricPattern6::new(client.clone(), "rsi_losses".to_string()), - stoch_d: MetricPattern6::new(client.clone(), "stoch_d".to_string()), - stoch_k: MetricPattern6::new(client.clone(), "stoch_k".to_string()), + rsi_average_gain_14d: MetricPattern6::new(client.clone(), "rsi_average_gain_14d".to_string()), + rsi_average_loss_14d: MetricPattern6::new(client.clone(), "rsi_average_loss_14d".to_string()), + rsi_14d: MetricPattern6::new(client.clone(), "rsi_14d".to_string()), + rsi_14d_min: MetricPattern6::new(client.clone(), "rsi_14d_min".to_string()), + rsi_14d_max: MetricPattern6::new(client.clone(), "rsi_14d_max".to_string()), stoch_rsi: MetricPattern6::new(client.clone(), "stoch_rsi".to_string()), - stoch_rsi_d: MetricPattern6::new(client.clone(), "stoch_rsi_d".to_string()), stoch_rsi_k: MetricPattern6::new(client.clone(), "stoch_rsi_k".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Market_Lookback { - pub _10y: _0sdUsdPattern, - pub _1d: _0sdUsdPattern, - pub _1m: _0sdUsdPattern, - pub _1w: _0sdUsdPattern, - pub _1y: _0sdUsdPattern, - pub _2y: _0sdUsdPattern, - pub _3m: _0sdUsdPattern, - pub _3y: _0sdUsdPattern, - pub _4y: _0sdUsdPattern, - pub _5y: _0sdUsdPattern, - pub _6m: _0sdUsdPattern, - pub _6y: _0sdUsdPattern, - pub _8y: _0sdUsdPattern, -} - -impl MetricsTree_Market_Lookback { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - _10y: _0sdUsdPattern::new(client.clone(), "price_10y_ago".to_string()), - _1d: _0sdUsdPattern::new(client.clone(), "price_1d_ago".to_string()), - _1m: _0sdUsdPattern::new(client.clone(), "price_1m_ago".to_string()), - _1w: _0sdUsdPattern::new(client.clone(), "price_1w_ago".to_string()), - _1y: _0sdUsdPattern::new(client.clone(), "price_1y_ago".to_string()), - _2y: _0sdUsdPattern::new(client.clone(), "price_2y_ago".to_string()), - _3m: _0sdUsdPattern::new(client.clone(), "price_3m_ago".to_string()), - _3y: _0sdUsdPattern::new(client.clone(), "price_3y_ago".to_string()), - _4y: _0sdUsdPattern::new(client.clone(), "price_4y_ago".to_string()), - _5y: _0sdUsdPattern::new(client.clone(), "price_5y_ago".to_string()), - _6m: _0sdUsdPattern::new(client.clone(), "price_6m_ago".to_string()), - _6y: _0sdUsdPattern::new(client.clone(), "price_6y_ago".to_string()), - _8y: _0sdUsdPattern::new(client.clone(), "price_8y_ago".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Market_MovingAverage { - pub price_111d_sma: Price111dSmaPattern, - pub price_12d_ema: Price111dSmaPattern, - pub price_13d_ema: Price111dSmaPattern, - pub price_13d_sma: Price111dSmaPattern, - pub price_144d_ema: Price111dSmaPattern, - pub price_144d_sma: Price111dSmaPattern, - pub price_1m_ema: Price111dSmaPattern, - pub price_1m_sma: Price111dSmaPattern, - pub price_1w_ema: Price111dSmaPattern, - pub price_1w_sma: Price111dSmaPattern, - pub price_1y_ema: Price111dSmaPattern, - pub price_1y_sma: Price111dSmaPattern, - pub price_200d_ema: Price111dSmaPattern, - pub price_200d_sma: Price111dSmaPattern, - pub price_200d_sma_x0_8: _0sdUsdPattern, - pub price_200d_sma_x2_4: _0sdUsdPattern, - pub price_200w_ema: Price111dSmaPattern, - pub price_200w_sma: Price111dSmaPattern, - pub price_21d_ema: Price111dSmaPattern, - pub price_21d_sma: Price111dSmaPattern, - pub price_26d_ema: Price111dSmaPattern, - pub price_2y_ema: Price111dSmaPattern, - pub price_2y_sma: Price111dSmaPattern, - pub price_34d_ema: Price111dSmaPattern, - pub price_34d_sma: Price111dSmaPattern, - pub price_350d_sma: Price111dSmaPattern, - pub price_350d_sma_x2: _0sdUsdPattern, - pub price_4y_ema: Price111dSmaPattern, - pub price_4y_sma: Price111dSmaPattern, - pub price_55d_ema: Price111dSmaPattern, - pub price_55d_sma: Price111dSmaPattern, - pub price_89d_ema: Price111dSmaPattern, - pub price_89d_sma: Price111dSmaPattern, - pub price_8d_ema: Price111dSmaPattern, - pub price_8d_sma: Price111dSmaPattern, -} - -impl MetricsTree_Market_MovingAverage { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - price_111d_sma: Price111dSmaPattern::new(client.clone(), "price_111d_sma".to_string()), - price_12d_ema: Price111dSmaPattern::new(client.clone(), "price_12d_ema".to_string()), - price_13d_ema: Price111dSmaPattern::new(client.clone(), "price_13d_ema".to_string()), - price_13d_sma: Price111dSmaPattern::new(client.clone(), "price_13d_sma".to_string()), - price_144d_ema: Price111dSmaPattern::new(client.clone(), "price_144d_ema".to_string()), - price_144d_sma: Price111dSmaPattern::new(client.clone(), "price_144d_sma".to_string()), - price_1m_ema: Price111dSmaPattern::new(client.clone(), "price_1m_ema".to_string()), - price_1m_sma: Price111dSmaPattern::new(client.clone(), "price_1m_sma".to_string()), - price_1w_ema: Price111dSmaPattern::new(client.clone(), "price_1w_ema".to_string()), - price_1w_sma: Price111dSmaPattern::new(client.clone(), "price_1w_sma".to_string()), - price_1y_ema: Price111dSmaPattern::new(client.clone(), "price_1y_ema".to_string()), - price_1y_sma: Price111dSmaPattern::new(client.clone(), "price_1y_sma".to_string()), - price_200d_ema: Price111dSmaPattern::new(client.clone(), "price_200d_ema".to_string()), - price_200d_sma: Price111dSmaPattern::new(client.clone(), "price_200d_sma".to_string()), - price_200d_sma_x0_8: _0sdUsdPattern::new(client.clone(), "price_200d_sma_x0_8".to_string()), - price_200d_sma_x2_4: _0sdUsdPattern::new(client.clone(), "price_200d_sma_x2_4".to_string()), - price_200w_ema: Price111dSmaPattern::new(client.clone(), "price_200w_ema".to_string()), - price_200w_sma: Price111dSmaPattern::new(client.clone(), "price_200w_sma".to_string()), - price_21d_ema: Price111dSmaPattern::new(client.clone(), "price_21d_ema".to_string()), - price_21d_sma: Price111dSmaPattern::new(client.clone(), "price_21d_sma".to_string()), - price_26d_ema: Price111dSmaPattern::new(client.clone(), "price_26d_ema".to_string()), - price_2y_ema: Price111dSmaPattern::new(client.clone(), "price_2y_ema".to_string()), - price_2y_sma: Price111dSmaPattern::new(client.clone(), "price_2y_sma".to_string()), - price_34d_ema: Price111dSmaPattern::new(client.clone(), "price_34d_ema".to_string()), - price_34d_sma: Price111dSmaPattern::new(client.clone(), "price_34d_sma".to_string()), - price_350d_sma: Price111dSmaPattern::new(client.clone(), "price_350d_sma".to_string()), - price_350d_sma_x2: _0sdUsdPattern::new(client.clone(), "price_350d_sma_x2".to_string()), - price_4y_ema: Price111dSmaPattern::new(client.clone(), "price_4y_ema".to_string()), - price_4y_sma: Price111dSmaPattern::new(client.clone(), "price_4y_sma".to_string()), - price_55d_ema: Price111dSmaPattern::new(client.clone(), "price_55d_ema".to_string()), - price_55d_sma: Price111dSmaPattern::new(client.clone(), "price_55d_sma".to_string()), - price_89d_ema: Price111dSmaPattern::new(client.clone(), "price_89d_ema".to_string()), - price_89d_sma: Price111dSmaPattern::new(client.clone(), "price_89d_sma".to_string()), - price_8d_ema: Price111dSmaPattern::new(client.clone(), "price_8d_ema".to_string()), - price_8d_sma: Price111dSmaPattern::new(client.clone(), "price_8d_sma".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Market_Range { - pub price_1m_max: _0sdUsdPattern, - pub price_1m_min: _0sdUsdPattern, - pub price_1w_max: _0sdUsdPattern, - pub price_1w_min: _0sdUsdPattern, - pub price_1y_max: _0sdUsdPattern, - pub price_1y_min: _0sdUsdPattern, - pub price_2w_choppiness_index: MetricPattern4, - pub price_2w_max: _0sdUsdPattern, - pub price_2w_min: _0sdUsdPattern, - pub price_true_range: MetricPattern6, - pub price_true_range_2w_sum: MetricPattern6, -} - -impl MetricsTree_Market_Range { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - price_1m_max: _0sdUsdPattern::new(client.clone(), "price_1m_max".to_string()), - price_1m_min: _0sdUsdPattern::new(client.clone(), "price_1m_min".to_string()), - price_1w_max: _0sdUsdPattern::new(client.clone(), "price_1w_max".to_string()), - price_1w_min: _0sdUsdPattern::new(client.clone(), "price_1w_min".to_string()), - price_1y_max: _0sdUsdPattern::new(client.clone(), "price_1y_max".to_string()), - price_1y_min: _0sdUsdPattern::new(client.clone(), "price_1y_min".to_string()), - price_2w_choppiness_index: MetricPattern4::new(client.clone(), "price_2w_choppiness_index".to_string()), - price_2w_max: _0sdUsdPattern::new(client.clone(), "price_2w_max".to_string()), - price_2w_min: _0sdUsdPattern::new(client.clone(), "price_2w_min".to_string()), - price_true_range: MetricPattern6::new(client.clone(), "price_true_range".to_string()), - price_true_range_2w_sum: MetricPattern6::new(client.clone(), "price_true_range_2w_sum".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Market_Returns { - pub _1d_returns_1m_sd: _1dReturns1mSdPattern, - pub _1d_returns_1w_sd: _1dReturns1mSdPattern, - pub _1d_returns_1y_sd: _1dReturns1mSdPattern, - pub cagr: PeriodCagrPattern, - pub downside_1m_sd: _1dReturns1mSdPattern, - pub downside_1w_sd: _1dReturns1mSdPattern, - pub downside_1y_sd: _1dReturns1mSdPattern, - pub downside_returns: MetricPattern6, - pub price_returns: MetricsTree_Market_Returns_PriceReturns, -} - -impl MetricsTree_Market_Returns { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - _1d_returns_1m_sd: _1dReturns1mSdPattern::new(client.clone(), "1d_returns_1m_sd".to_string()), - _1d_returns_1w_sd: _1dReturns1mSdPattern::new(client.clone(), "1d_returns_1w_sd".to_string()), - _1d_returns_1y_sd: _1dReturns1mSdPattern::new(client.clone(), "1d_returns_1y_sd".to_string()), - cagr: PeriodCagrPattern::new(client.clone(), "cagr".to_string()), - downside_1m_sd: _1dReturns1mSdPattern::new(client.clone(), "downside_1m_sd".to_string()), - downside_1w_sd: _1dReturns1mSdPattern::new(client.clone(), "downside_1w_sd".to_string()), - downside_1y_sd: _1dReturns1mSdPattern::new(client.clone(), "downside_1y_sd".to_string()), - downside_returns: MetricPattern6::new(client.clone(), "downside_returns".to_string()), - price_returns: MetricsTree_Market_Returns_PriceReturns::new(client.clone(), format!("{base_path}_price_returns")), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Market_Returns_PriceReturns { - pub _10y: MetricPattern4, - pub _1d: MetricPattern4, - pub _1m: MetricPattern4, - pub _1w: MetricPattern4, - pub _1y: MetricPattern4, - pub _2y: MetricPattern4, - pub _3m: MetricPattern4, - pub _3y: MetricPattern4, - pub _4y: MetricPattern4, - pub _5y: MetricPattern4, - pub _6m: MetricPattern4, - pub _6y: MetricPattern4, - pub _8y: MetricPattern4, -} - -impl MetricsTree_Market_Returns_PriceReturns { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - _10y: MetricPattern4::new(client.clone(), "10y_price_returns".to_string()), - _1d: MetricPattern4::new(client.clone(), "1d_price_returns".to_string()), - _1m: MetricPattern4::new(client.clone(), "1m_price_returns".to_string()), - _1w: MetricPattern4::new(client.clone(), "1w_price_returns".to_string()), - _1y: MetricPattern4::new(client.clone(), "1y_price_returns".to_string()), - _2y: MetricPattern4::new(client.clone(), "2y_price_returns".to_string()), - _3m: MetricPattern4::new(client.clone(), "3m_price_returns".to_string()), - _3y: MetricPattern4::new(client.clone(), "3y_price_returns".to_string()), - _4y: MetricPattern4::new(client.clone(), "4y_price_returns".to_string()), - _5y: MetricPattern4::new(client.clone(), "5y_price_returns".to_string()), - _6m: MetricPattern4::new(client.clone(), "6m_price_returns".to_string()), - _6y: MetricPattern4::new(client.clone(), "6y_price_returns".to_string()), - _8y: MetricPattern4::new(client.clone(), "8y_price_returns".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Market_Volatility { - pub price_1m_volatility: MetricPattern4, - pub price_1w_volatility: MetricPattern4, - pub price_1y_volatility: MetricPattern4, - pub sharpe_1m: MetricPattern6, - pub sharpe_1w: MetricPattern6, - pub sharpe_1y: MetricPattern6, - pub sortino_1m: MetricPattern6, - pub sortino_1w: MetricPattern6, - pub sortino_1y: MetricPattern6, -} - -impl MetricsTree_Market_Volatility { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - price_1m_volatility: MetricPattern4::new(client.clone(), "price_1m_volatility".to_string()), - price_1w_volatility: MetricPattern4::new(client.clone(), "price_1w_volatility".to_string()), - price_1y_volatility: MetricPattern4::new(client.clone(), "price_1y_volatility".to_string()), - sharpe_1m: MetricPattern6::new(client.clone(), "sharpe_1m".to_string()), - sharpe_1w: MetricPattern6::new(client.clone(), "sharpe_1w".to_string()), - sharpe_1y: MetricPattern6::new(client.clone(), "sharpe_1y".to_string()), - sortino_1m: MetricPattern6::new(client.clone(), "sortino_1m".to_string()), - sortino_1w: MetricPattern6::new(client.clone(), "sortino_1w".to_string()), - sortino_1y: MetricPattern6::new(client.clone(), "sortino_1y".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Outputs { - pub count: MetricsTree_Outputs_Count, - pub first_txoutindex: MetricPattern11, - pub outputtype: MetricPattern15, - pub spent: MetricsTree_Outputs_Spent, - pub txindex: MetricPattern15, - pub typeindex: MetricPattern15, - pub value: MetricPattern15, -} - -impl MetricsTree_Outputs { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - count: MetricsTree_Outputs_Count::new(client.clone(), format!("{base_path}_count")), - first_txoutindex: MetricPattern11::new(client.clone(), "first_txoutindex".to_string()), - outputtype: MetricPattern15::new(client.clone(), "outputtype".to_string()), - spent: MetricsTree_Outputs_Spent::new(client.clone(), format!("{base_path}_spent")), - txindex: MetricPattern15::new(client.clone(), "txindex".to_string()), - typeindex: MetricPattern15::new(client.clone(), "typeindex".to_string()), - value: MetricPattern15::new(client.clone(), "value".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Outputs_Count { - pub total_count: CountPattern2, - pub utxo_count: MetricPattern1, -} - -impl MetricsTree_Outputs_Count { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - total_count: CountPattern2::new(client.clone(), "output_count".to_string()), - utxo_count: MetricPattern1::new(client.clone(), "exact_utxo_count".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Outputs_Spent { - pub txinindex: MetricPattern15, -} - -impl MetricsTree_Outputs_Spent { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - txinindex: MetricPattern15::new(client.clone(), "txinindex".to_string()), + stoch_rsi_d: MetricPattern6::new(client.clone(), "stoch_rsi_d".to_string()), + stoch_k: MetricPattern6::new(client.clone(), "stoch_k".to_string()), + stoch_d: MetricPattern6::new(client.clone(), "stoch_d".to_string()), + pi_cycle: MetricPattern6::new(client.clone(), "pi_cycle".to_string()), + macd_line: MetricPattern6::new(client.clone(), "macd_line".to_string()), + macd_signal: MetricPattern6::new(client.clone(), "macd_signal".to_string()), + macd_histogram: MetricPattern6::new(client.clone(), "macd_histogram".to_string()), + gini: MetricPattern6::new(client.clone(), "gini".to_string()), } } } @@ -4935,342 +4530,327 @@ impl MetricsTree_Pools { /// Metrics tree node. pub struct MetricsTree_Pools_Vecs { - pub aaopool: AaopoolPattern, - pub antpool: AaopoolPattern, - pub arkpool: AaopoolPattern, - pub asicminer: AaopoolPattern, - pub axbt: AaopoolPattern, - pub batpool: AaopoolPattern, - pub bcmonster: AaopoolPattern, - pub bcpoolio: AaopoolPattern, - pub binancepool: AaopoolPattern, - pub bitalo: AaopoolPattern, - pub bitclub: AaopoolPattern, - pub bitcoinaffiliatenetwork: AaopoolPattern, - pub bitcoincom: AaopoolPattern, - pub bitcoinindia: AaopoolPattern, - pub bitcoinrussia: AaopoolPattern, - pub bitcoinukraine: AaopoolPattern, - pub bitfarms: AaopoolPattern, - pub bitfufupool: AaopoolPattern, - pub bitfury: AaopoolPattern, - pub bitminter: AaopoolPattern, - pub bitparking: AaopoolPattern, - pub bitsolo: AaopoolPattern, - pub bixin: AaopoolPattern, - pub blockfills: AaopoolPattern, - pub braiinspool: AaopoolPattern, - pub bravomining: AaopoolPattern, - pub btcc: AaopoolPattern, - pub btccom: AaopoolPattern, - pub btcdig: AaopoolPattern, - pub btcguild: AaopoolPattern, - pub btclab: AaopoolPattern, - pub btcmp: AaopoolPattern, - pub btcnuggets: AaopoolPattern, - pub btcpoolparty: AaopoolPattern, - pub btcserv: AaopoolPattern, - pub btctop: AaopoolPattern, - pub btpool: AaopoolPattern, - pub bwpool: AaopoolPattern, - pub bytepool: AaopoolPattern, - pub canoe: AaopoolPattern, - pub canoepool: AaopoolPattern, - pub carbonnegative: AaopoolPattern, - pub ckpool: AaopoolPattern, - pub cloudhashing: AaopoolPattern, - pub coinlab: AaopoolPattern, - pub cointerra: AaopoolPattern, - pub connectbtc: AaopoolPattern, - pub dcex: AaopoolPattern, - pub dcexploration: AaopoolPattern, - pub digitalbtc: AaopoolPattern, - pub digitalxmintsy: AaopoolPattern, - pub dpool: AaopoolPattern, - pub eclipsemc: AaopoolPattern, - pub eightbaochi: AaopoolPattern, - pub ekanembtc: AaopoolPattern, - pub eligius: AaopoolPattern, - pub emcdpool: AaopoolPattern, - pub entrustcharitypool: AaopoolPattern, - pub eobot: AaopoolPattern, - pub exxbw: AaopoolPattern, - pub f2pool: AaopoolPattern, - pub fiftyeightcoin: AaopoolPattern, - pub foundryusa: AaopoolPattern, - pub futurebitapollosolo: AaopoolPattern, - pub gbminers: AaopoolPattern, - pub ghashio: AaopoolPattern, - pub givemecoins: AaopoolPattern, - pub gogreenlight: AaopoolPattern, - pub haominer: AaopoolPattern, - pub haozhuzhu: AaopoolPattern, - pub hashbx: AaopoolPattern, - pub hashpool: AaopoolPattern, - pub helix: AaopoolPattern, - pub hhtt: AaopoolPattern, - pub hotpool: AaopoolPattern, - pub hummerpool: AaopoolPattern, - pub huobipool: AaopoolPattern, - pub innopolistech: AaopoolPattern, - pub kanopool: AaopoolPattern, - pub kncminer: AaopoolPattern, - pub kucoinpool: AaopoolPattern, - pub lubiancom: AaopoolPattern, - pub luckypool: AaopoolPattern, - pub luxor: AaopoolPattern, - pub marapool: AaopoolPattern, - pub maxbtc: AaopoolPattern, - pub maxipool: AaopoolPattern, - pub megabigpower: AaopoolPattern, - pub minerium: AaopoolPattern, - pub miningcity: AaopoolPattern, - pub miningdutch: AaopoolPattern, - pub miningkings: AaopoolPattern, - pub miningsquared: AaopoolPattern, - pub mmpool: AaopoolPattern, - pub mtred: AaopoolPattern, - pub multicoinco: AaopoolPattern, - pub multipool: AaopoolPattern, - pub mybtccoinpool: AaopoolPattern, - pub neopool: AaopoolPattern, - pub nexious: AaopoolPattern, - pub nicehash: AaopoolPattern, - pub nmcbit: AaopoolPattern, - pub novablock: AaopoolPattern, - pub ocean: AaopoolPattern, - pub okexpool: AaopoolPattern, - pub okkong: AaopoolPattern, - pub okminer: AaopoolPattern, - pub okpooltop: AaopoolPattern, - pub onehash: AaopoolPattern, - pub onem1x: AaopoolPattern, - pub onethash: AaopoolPattern, - pub ozcoin: AaopoolPattern, - pub parasite: AaopoolPattern, - pub patels: AaopoolPattern, - pub pegapool: AaopoolPattern, - pub phashio: AaopoolPattern, - pub phoenix: AaopoolPattern, - pub polmine: AaopoolPattern, - pub pool175btc: AaopoolPattern, - pub pool50btc: AaopoolPattern, - pub poolin: AaopoolPattern, - pub portlandhodl: AaopoolPattern, - pub publicpool: AaopoolPattern, - pub purebtccom: AaopoolPattern, - pub rawpool: AaopoolPattern, - pub rigpool: AaopoolPattern, - pub sbicrypto: AaopoolPattern, - pub secpool: AaopoolPattern, - pub secretsuperstar: AaopoolPattern, - pub sevenpool: AaopoolPattern, - pub shawnp0wers: AaopoolPattern, - pub sigmapoolcom: AaopoolPattern, - pub simplecoinus: AaopoolPattern, - pub solock: AaopoolPattern, - pub spiderpool: AaopoolPattern, - pub stminingcorp: AaopoolPattern, - pub tangpool: AaopoolPattern, - pub tatmaspool: AaopoolPattern, - pub tbdice: AaopoolPattern, - pub telco214: AaopoolPattern, - pub terrapool: AaopoolPattern, - pub tiger: AaopoolPattern, - pub tigerpoolnet: AaopoolPattern, - pub titan: AaopoolPattern, - pub transactioncoinmining: AaopoolPattern, - pub trickysbtcpool: AaopoolPattern, - pub triplemining: AaopoolPattern, - pub twentyoneinc: AaopoolPattern, - pub ultimuspool: AaopoolPattern, - pub unknown: AaopoolPattern, - pub unomp: AaopoolPattern, - pub viabtc: AaopoolPattern, - pub waterhole: AaopoolPattern, - pub wayicn: AaopoolPattern, - pub whitepool: AaopoolPattern, - pub wk057: AaopoolPattern, - pub yourbtcnet: AaopoolPattern, - pub zulupool: AaopoolPattern, + pub unknown: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub blockfills: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub ultimuspool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub terrapool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub luxor: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub onethash: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub btccom: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub bitfarms: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub huobipool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub wayicn: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub canoepool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub btctop: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub bitcoincom: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub pool175btc: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub gbminers: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub axbt: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub asicminer: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub bitminter: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub bitcoinrussia: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub btcserv: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub simplecoinus: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub btcguild: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub eligius: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub ozcoin: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub eclipsemc: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub maxbtc: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub triplemining: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub coinlab: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub pool50btc: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub ghashio: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub stminingcorp: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub bitparking: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub mmpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub polmine: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub kncminer: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub bitalo: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub f2pool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub hhtt: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub megabigpower: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub mtred: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub nmcbit: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub yourbtcnet: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub givemecoins: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub braiinspool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub antpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub multicoinco: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub bcpoolio: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub cointerra: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub kanopool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub solock: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub ckpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub nicehash: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub bitclub: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub bitcoinaffiliatenetwork: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub btcc: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub bwpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub exxbw: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub bitsolo: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub bitfury: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub twentyoneinc: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub digitalbtc: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub eightbaochi: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub mybtccoinpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub tbdice: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub hashpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub nexious: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub bravomining: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub hotpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub okexpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub bcmonster: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub onehash: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub bixin: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub tatmaspool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub viabtc: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub connectbtc: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub batpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub waterhole: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub dcexploration: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub dcex: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub btpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub fiftyeightcoin: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub bitcoinindia: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub shawnp0wers: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub phashio: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub rigpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub haozhuzhu: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub sevenpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub miningkings: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub hashbx: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub dpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub rawpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub haominer: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub helix: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub bitcoinukraine: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub poolin: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub secretsuperstar: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub tigerpoolnet: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub sigmapoolcom: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub okpooltop: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub hummerpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub tangpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub bytepool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub spiderpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub novablock: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub miningcity: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub binancepool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub minerium: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub lubiancom: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub okkong: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub aaopool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub emcdpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub foundryusa: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub sbicrypto: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub arkpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub purebtccom: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub marapool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub kucoinpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub entrustcharitypool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub okminer: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub titan: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub pegapool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub btcnuggets: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub cloudhashing: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub digitalxmintsy: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub telco214: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub btcpoolparty: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub multipool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub transactioncoinmining: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub btcdig: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub trickysbtcpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub btcmp: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub eobot: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub unomp: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub patels: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub gogreenlight: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub ekanembtc: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub canoe: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub tiger: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub onem1x: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub zulupool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub secpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub ocean: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub whitepool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub wk057: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub futurebitapollosolo: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub carbonnegative: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub portlandhodl: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub phoenix: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub neopool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub maxipool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub bitfufupool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub luckypool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub miningdutch: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub publicpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub miningsquared: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub innopolistech: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub btclab: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, + pub parasite: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern, } impl MetricsTree_Pools_Vecs { pub fn new(client: Arc, base_path: String) -> Self { Self { - aaopool: AaopoolPattern::new(client.clone(), "aaopool".to_string()), - antpool: AaopoolPattern::new(client.clone(), "antpool".to_string()), - arkpool: AaopoolPattern::new(client.clone(), "arkpool".to_string()), - asicminer: AaopoolPattern::new(client.clone(), "asicminer".to_string()), - axbt: AaopoolPattern::new(client.clone(), "axbt".to_string()), - batpool: AaopoolPattern::new(client.clone(), "batpool".to_string()), - bcmonster: AaopoolPattern::new(client.clone(), "bcmonster".to_string()), - bcpoolio: AaopoolPattern::new(client.clone(), "bcpoolio".to_string()), - binancepool: AaopoolPattern::new(client.clone(), "binancepool".to_string()), - bitalo: AaopoolPattern::new(client.clone(), "bitalo".to_string()), - bitclub: AaopoolPattern::new(client.clone(), "bitclub".to_string()), - bitcoinaffiliatenetwork: AaopoolPattern::new(client.clone(), "bitcoinaffiliatenetwork".to_string()), - bitcoincom: AaopoolPattern::new(client.clone(), "bitcoincom".to_string()), - bitcoinindia: AaopoolPattern::new(client.clone(), "bitcoinindia".to_string()), - bitcoinrussia: AaopoolPattern::new(client.clone(), "bitcoinrussia".to_string()), - bitcoinukraine: AaopoolPattern::new(client.clone(), "bitcoinukraine".to_string()), - bitfarms: AaopoolPattern::new(client.clone(), "bitfarms".to_string()), - bitfufupool: AaopoolPattern::new(client.clone(), "bitfufupool".to_string()), - bitfury: AaopoolPattern::new(client.clone(), "bitfury".to_string()), - bitminter: AaopoolPattern::new(client.clone(), "bitminter".to_string()), - bitparking: AaopoolPattern::new(client.clone(), "bitparking".to_string()), - bitsolo: AaopoolPattern::new(client.clone(), "bitsolo".to_string()), - bixin: AaopoolPattern::new(client.clone(), "bixin".to_string()), - blockfills: AaopoolPattern::new(client.clone(), "blockfills".to_string()), - braiinspool: AaopoolPattern::new(client.clone(), "braiinspool".to_string()), - bravomining: AaopoolPattern::new(client.clone(), "bravomining".to_string()), - btcc: AaopoolPattern::new(client.clone(), "btcc".to_string()), - btccom: AaopoolPattern::new(client.clone(), "btccom".to_string()), - btcdig: AaopoolPattern::new(client.clone(), "btcdig".to_string()), - btcguild: AaopoolPattern::new(client.clone(), "btcguild".to_string()), - btclab: AaopoolPattern::new(client.clone(), "btclab".to_string()), - btcmp: AaopoolPattern::new(client.clone(), "btcmp".to_string()), - btcnuggets: AaopoolPattern::new(client.clone(), "btcnuggets".to_string()), - btcpoolparty: AaopoolPattern::new(client.clone(), "btcpoolparty".to_string()), - btcserv: AaopoolPattern::new(client.clone(), "btcserv".to_string()), - btctop: AaopoolPattern::new(client.clone(), "btctop".to_string()), - btpool: AaopoolPattern::new(client.clone(), "btpool".to_string()), - bwpool: AaopoolPattern::new(client.clone(), "bwpool".to_string()), - bytepool: AaopoolPattern::new(client.clone(), "bytepool".to_string()), - canoe: AaopoolPattern::new(client.clone(), "canoe".to_string()), - canoepool: AaopoolPattern::new(client.clone(), "canoepool".to_string()), - carbonnegative: AaopoolPattern::new(client.clone(), "carbonnegative".to_string()), - ckpool: AaopoolPattern::new(client.clone(), "ckpool".to_string()), - cloudhashing: AaopoolPattern::new(client.clone(), "cloudhashing".to_string()), - coinlab: AaopoolPattern::new(client.clone(), "coinlab".to_string()), - cointerra: AaopoolPattern::new(client.clone(), "cointerra".to_string()), - connectbtc: AaopoolPattern::new(client.clone(), "connectbtc".to_string()), - dcex: AaopoolPattern::new(client.clone(), "dcex".to_string()), - dcexploration: AaopoolPattern::new(client.clone(), "dcexploration".to_string()), - digitalbtc: AaopoolPattern::new(client.clone(), "digitalbtc".to_string()), - digitalxmintsy: AaopoolPattern::new(client.clone(), "digitalxmintsy".to_string()), - dpool: AaopoolPattern::new(client.clone(), "dpool".to_string()), - eclipsemc: AaopoolPattern::new(client.clone(), "eclipsemc".to_string()), - eightbaochi: AaopoolPattern::new(client.clone(), "eightbaochi".to_string()), - ekanembtc: AaopoolPattern::new(client.clone(), "ekanembtc".to_string()), - eligius: AaopoolPattern::new(client.clone(), "eligius".to_string()), - emcdpool: AaopoolPattern::new(client.clone(), "emcdpool".to_string()), - entrustcharitypool: AaopoolPattern::new(client.clone(), "entrustcharitypool".to_string()), - eobot: AaopoolPattern::new(client.clone(), "eobot".to_string()), - exxbw: AaopoolPattern::new(client.clone(), "exxbw".to_string()), - f2pool: AaopoolPattern::new(client.clone(), "f2pool".to_string()), - fiftyeightcoin: AaopoolPattern::new(client.clone(), "fiftyeightcoin".to_string()), - foundryusa: AaopoolPattern::new(client.clone(), "foundryusa".to_string()), - futurebitapollosolo: AaopoolPattern::new(client.clone(), "futurebitapollosolo".to_string()), - gbminers: AaopoolPattern::new(client.clone(), "gbminers".to_string()), - ghashio: AaopoolPattern::new(client.clone(), "ghashio".to_string()), - givemecoins: AaopoolPattern::new(client.clone(), "givemecoins".to_string()), - gogreenlight: AaopoolPattern::new(client.clone(), "gogreenlight".to_string()), - haominer: AaopoolPattern::new(client.clone(), "haominer".to_string()), - haozhuzhu: AaopoolPattern::new(client.clone(), "haozhuzhu".to_string()), - hashbx: AaopoolPattern::new(client.clone(), "hashbx".to_string()), - hashpool: AaopoolPattern::new(client.clone(), "hashpool".to_string()), - helix: AaopoolPattern::new(client.clone(), "helix".to_string()), - hhtt: AaopoolPattern::new(client.clone(), "hhtt".to_string()), - hotpool: AaopoolPattern::new(client.clone(), "hotpool".to_string()), - hummerpool: AaopoolPattern::new(client.clone(), "hummerpool".to_string()), - huobipool: AaopoolPattern::new(client.clone(), "huobipool".to_string()), - innopolistech: AaopoolPattern::new(client.clone(), "innopolistech".to_string()), - kanopool: AaopoolPattern::new(client.clone(), "kanopool".to_string()), - kncminer: AaopoolPattern::new(client.clone(), "kncminer".to_string()), - kucoinpool: AaopoolPattern::new(client.clone(), "kucoinpool".to_string()), - lubiancom: AaopoolPattern::new(client.clone(), "lubiancom".to_string()), - luckypool: AaopoolPattern::new(client.clone(), "luckypool".to_string()), - luxor: AaopoolPattern::new(client.clone(), "luxor".to_string()), - marapool: AaopoolPattern::new(client.clone(), "marapool".to_string()), - maxbtc: AaopoolPattern::new(client.clone(), "maxbtc".to_string()), - maxipool: AaopoolPattern::new(client.clone(), "maxipool".to_string()), - megabigpower: AaopoolPattern::new(client.clone(), "megabigpower".to_string()), - minerium: AaopoolPattern::new(client.clone(), "minerium".to_string()), - miningcity: AaopoolPattern::new(client.clone(), "miningcity".to_string()), - miningdutch: AaopoolPattern::new(client.clone(), "miningdutch".to_string()), - miningkings: AaopoolPattern::new(client.clone(), "miningkings".to_string()), - miningsquared: AaopoolPattern::new(client.clone(), "miningsquared".to_string()), - mmpool: AaopoolPattern::new(client.clone(), "mmpool".to_string()), - mtred: AaopoolPattern::new(client.clone(), "mtred".to_string()), - multicoinco: AaopoolPattern::new(client.clone(), "multicoinco".to_string()), - multipool: AaopoolPattern::new(client.clone(), "multipool".to_string()), - mybtccoinpool: AaopoolPattern::new(client.clone(), "mybtccoinpool".to_string()), - neopool: AaopoolPattern::new(client.clone(), "neopool".to_string()), - nexious: AaopoolPattern::new(client.clone(), "nexious".to_string()), - nicehash: AaopoolPattern::new(client.clone(), "nicehash".to_string()), - nmcbit: AaopoolPattern::new(client.clone(), "nmcbit".to_string()), - novablock: AaopoolPattern::new(client.clone(), "novablock".to_string()), - ocean: AaopoolPattern::new(client.clone(), "ocean".to_string()), - okexpool: AaopoolPattern::new(client.clone(), "okexpool".to_string()), - okkong: AaopoolPattern::new(client.clone(), "okkong".to_string()), - okminer: AaopoolPattern::new(client.clone(), "okminer".to_string()), - okpooltop: AaopoolPattern::new(client.clone(), "okpooltop".to_string()), - onehash: AaopoolPattern::new(client.clone(), "onehash".to_string()), - onem1x: AaopoolPattern::new(client.clone(), "onem1x".to_string()), - onethash: AaopoolPattern::new(client.clone(), "onethash".to_string()), - ozcoin: AaopoolPattern::new(client.clone(), "ozcoin".to_string()), - parasite: AaopoolPattern::new(client.clone(), "parasite".to_string()), - patels: AaopoolPattern::new(client.clone(), "patels".to_string()), - pegapool: AaopoolPattern::new(client.clone(), "pegapool".to_string()), - phashio: AaopoolPattern::new(client.clone(), "phashio".to_string()), - phoenix: AaopoolPattern::new(client.clone(), "phoenix".to_string()), - polmine: AaopoolPattern::new(client.clone(), "polmine".to_string()), - pool175btc: AaopoolPattern::new(client.clone(), "pool175btc".to_string()), - pool50btc: AaopoolPattern::new(client.clone(), "pool50btc".to_string()), - poolin: AaopoolPattern::new(client.clone(), "poolin".to_string()), - portlandhodl: AaopoolPattern::new(client.clone(), "portlandhodl".to_string()), - publicpool: AaopoolPattern::new(client.clone(), "publicpool".to_string()), - purebtccom: AaopoolPattern::new(client.clone(), "purebtccom".to_string()), - rawpool: AaopoolPattern::new(client.clone(), "rawpool".to_string()), - rigpool: AaopoolPattern::new(client.clone(), "rigpool".to_string()), - sbicrypto: AaopoolPattern::new(client.clone(), "sbicrypto".to_string()), - secpool: AaopoolPattern::new(client.clone(), "secpool".to_string()), - secretsuperstar: AaopoolPattern::new(client.clone(), "secretsuperstar".to_string()), - sevenpool: AaopoolPattern::new(client.clone(), "sevenpool".to_string()), - shawnp0wers: AaopoolPattern::new(client.clone(), "shawnp0wers".to_string()), - sigmapoolcom: AaopoolPattern::new(client.clone(), "sigmapoolcom".to_string()), - simplecoinus: AaopoolPattern::new(client.clone(), "simplecoinus".to_string()), - solock: AaopoolPattern::new(client.clone(), "solock".to_string()), - spiderpool: AaopoolPattern::new(client.clone(), "spiderpool".to_string()), - stminingcorp: AaopoolPattern::new(client.clone(), "stminingcorp".to_string()), - tangpool: AaopoolPattern::new(client.clone(), "tangpool".to_string()), - tatmaspool: AaopoolPattern::new(client.clone(), "tatmaspool".to_string()), - tbdice: AaopoolPattern::new(client.clone(), "tbdice".to_string()), - telco214: AaopoolPattern::new(client.clone(), "telco214".to_string()), - terrapool: AaopoolPattern::new(client.clone(), "terrapool".to_string()), - tiger: AaopoolPattern::new(client.clone(), "tiger".to_string()), - tigerpoolnet: AaopoolPattern::new(client.clone(), "tigerpoolnet".to_string()), - titan: AaopoolPattern::new(client.clone(), "titan".to_string()), - transactioncoinmining: AaopoolPattern::new(client.clone(), "transactioncoinmining".to_string()), - trickysbtcpool: AaopoolPattern::new(client.clone(), "trickysbtcpool".to_string()), - triplemining: AaopoolPattern::new(client.clone(), "triplemining".to_string()), - twentyoneinc: AaopoolPattern::new(client.clone(), "twentyoneinc".to_string()), - ultimuspool: AaopoolPattern::new(client.clone(), "ultimuspool".to_string()), - unknown: AaopoolPattern::new(client.clone(), "unknown".to_string()), - unomp: AaopoolPattern::new(client.clone(), "unomp".to_string()), - viabtc: AaopoolPattern::new(client.clone(), "viabtc".to_string()), - waterhole: AaopoolPattern::new(client.clone(), "waterhole".to_string()), - wayicn: AaopoolPattern::new(client.clone(), "wayicn".to_string()), - whitepool: AaopoolPattern::new(client.clone(), "whitepool".to_string()), - wk057: AaopoolPattern::new(client.clone(), "wk057".to_string()), - yourbtcnet: AaopoolPattern::new(client.clone(), "yourbtcnet".to_string()), - zulupool: AaopoolPattern::new(client.clone(), "zulupool".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Positions { - pub block_position: MetricPattern11, - pub tx_position: MetricPattern27, -} - -impl MetricsTree_Positions { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - block_position: MetricPattern11::new(client.clone(), "position".to_string()), - tx_position: MetricPattern27::new(client.clone(), "position".to_string()), + unknown: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "unknown".to_string()), + blockfills: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "blockfills".to_string()), + ultimuspool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "ultimuspool".to_string()), + terrapool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "terrapool".to_string()), + luxor: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "luxor".to_string()), + onethash: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "onethash".to_string()), + btccom: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "btccom".to_string()), + bitfarms: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "bitfarms".to_string()), + huobipool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "huobipool".to_string()), + wayicn: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "wayicn".to_string()), + canoepool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "canoepool".to_string()), + btctop: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "btctop".to_string()), + bitcoincom: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "bitcoincom".to_string()), + pool175btc: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "pool175btc".to_string()), + gbminers: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "gbminers".to_string()), + axbt: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "axbt".to_string()), + asicminer: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "asicminer".to_string()), + bitminter: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "bitminter".to_string()), + bitcoinrussia: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "bitcoinrussia".to_string()), + btcserv: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "btcserv".to_string()), + simplecoinus: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "simplecoinus".to_string()), + btcguild: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "btcguild".to_string()), + eligius: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "eligius".to_string()), + ozcoin: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "ozcoin".to_string()), + eclipsemc: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "eclipsemc".to_string()), + maxbtc: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "maxbtc".to_string()), + triplemining: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "triplemining".to_string()), + coinlab: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "coinlab".to_string()), + pool50btc: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "pool50btc".to_string()), + ghashio: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "ghashio".to_string()), + stminingcorp: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "stminingcorp".to_string()), + bitparking: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "bitparking".to_string()), + mmpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "mmpool".to_string()), + polmine: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "polmine".to_string()), + kncminer: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "kncminer".to_string()), + bitalo: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "bitalo".to_string()), + f2pool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "f2pool".to_string()), + hhtt: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "hhtt".to_string()), + megabigpower: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "megabigpower".to_string()), + mtred: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "mtred".to_string()), + nmcbit: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "nmcbit".to_string()), + yourbtcnet: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "yourbtcnet".to_string()), + givemecoins: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "givemecoins".to_string()), + braiinspool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "braiinspool".to_string()), + antpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "antpool".to_string()), + multicoinco: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "multicoinco".to_string()), + bcpoolio: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "bcpoolio".to_string()), + cointerra: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "cointerra".to_string()), + kanopool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "kanopool".to_string()), + solock: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "solock".to_string()), + ckpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "ckpool".to_string()), + nicehash: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "nicehash".to_string()), + bitclub: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "bitclub".to_string()), + bitcoinaffiliatenetwork: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "bitcoinaffiliatenetwork".to_string()), + btcc: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "btcc".to_string()), + bwpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "bwpool".to_string()), + exxbw: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "exxbw".to_string()), + bitsolo: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "bitsolo".to_string()), + bitfury: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "bitfury".to_string()), + twentyoneinc: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "twentyoneinc".to_string()), + digitalbtc: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "digitalbtc".to_string()), + eightbaochi: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "eightbaochi".to_string()), + mybtccoinpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "mybtccoinpool".to_string()), + tbdice: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "tbdice".to_string()), + hashpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "hashpool".to_string()), + nexious: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "nexious".to_string()), + bravomining: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "bravomining".to_string()), + hotpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "hotpool".to_string()), + okexpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "okexpool".to_string()), + bcmonster: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "bcmonster".to_string()), + onehash: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "onehash".to_string()), + bixin: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "bixin".to_string()), + tatmaspool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "tatmaspool".to_string()), + viabtc: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "viabtc".to_string()), + connectbtc: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "connectbtc".to_string()), + batpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "batpool".to_string()), + waterhole: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "waterhole".to_string()), + dcexploration: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "dcexploration".to_string()), + dcex: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "dcex".to_string()), + btpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "btpool".to_string()), + fiftyeightcoin: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "fiftyeightcoin".to_string()), + bitcoinindia: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "bitcoinindia".to_string()), + shawnp0wers: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "shawnp0wers".to_string()), + phashio: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "phashio".to_string()), + rigpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "rigpool".to_string()), + haozhuzhu: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "haozhuzhu".to_string()), + sevenpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "sevenpool".to_string()), + miningkings: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "miningkings".to_string()), + hashbx: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "hashbx".to_string()), + dpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "dpool".to_string()), + rawpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "rawpool".to_string()), + haominer: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "haominer".to_string()), + helix: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "helix".to_string()), + bitcoinukraine: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "bitcoinukraine".to_string()), + poolin: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "poolin".to_string()), + secretsuperstar: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "secretsuperstar".to_string()), + tigerpoolnet: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "tigerpoolnet".to_string()), + sigmapoolcom: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "sigmapoolcom".to_string()), + okpooltop: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "okpooltop".to_string()), + hummerpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "hummerpool".to_string()), + tangpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "tangpool".to_string()), + bytepool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "bytepool".to_string()), + spiderpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "spiderpool".to_string()), + novablock: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "novablock".to_string()), + miningcity: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "miningcity".to_string()), + binancepool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "binancepool".to_string()), + minerium: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "minerium".to_string()), + lubiancom: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "lubiancom".to_string()), + okkong: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "okkong".to_string()), + aaopool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "aaopool".to_string()), + emcdpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "emcdpool".to_string()), + foundryusa: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "foundryusa".to_string()), + sbicrypto: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "sbicrypto".to_string()), + arkpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "arkpool".to_string()), + purebtccom: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "purebtccom".to_string()), + marapool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "marapool".to_string()), + kucoinpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "kucoinpool".to_string()), + entrustcharitypool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "entrustcharitypool".to_string()), + okminer: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "okminer".to_string()), + titan: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "titan".to_string()), + pegapool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "pegapool".to_string()), + btcnuggets: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "btcnuggets".to_string()), + cloudhashing: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "cloudhashing".to_string()), + digitalxmintsy: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "digitalxmintsy".to_string()), + telco214: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "telco214".to_string()), + btcpoolparty: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "btcpoolparty".to_string()), + multipool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "multipool".to_string()), + transactioncoinmining: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "transactioncoinmining".to_string()), + btcdig: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "btcdig".to_string()), + trickysbtcpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "trickysbtcpool".to_string()), + btcmp: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "btcmp".to_string()), + eobot: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "eobot".to_string()), + unomp: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "unomp".to_string()), + patels: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "patels".to_string()), + gogreenlight: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "gogreenlight".to_string()), + ekanembtc: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "ekanembtc".to_string()), + canoe: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "canoe".to_string()), + tiger: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "tiger".to_string()), + onem1x: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "onem1x".to_string()), + zulupool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "zulupool".to_string()), + secpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "secpool".to_string()), + ocean: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "ocean".to_string()), + whitepool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "whitepool".to_string()), + wk057: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "wk057".to_string()), + futurebitapollosolo: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "futurebitapollosolo".to_string()), + carbonnegative: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "carbonnegative".to_string()), + portlandhodl: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "portlandhodl".to_string()), + phoenix: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "phoenix".to_string()), + neopool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "neopool".to_string()), + maxipool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "maxipool".to_string()), + bitfufupool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "bitfufupool".to_string()), + luckypool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "luckypool".to_string()), + miningdutch: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "miningdutch".to_string()), + publicpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "publicpool".to_string()), + miningsquared: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "miningsquared".to_string()), + innopolistech: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "innopolistech".to_string()), + btclab: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "btclab".to_string()), + parasite: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern::new(client.clone(), "parasite".to_string()), } } } @@ -5278,203 +4858,929 @@ impl MetricsTree_Positions { /// Metrics tree node. pub struct MetricsTree_Price { pub cents: MetricsTree_Price_Cents, - pub sats: SatsPattern, pub usd: MetricsTree_Price_Usd, + pub sats: OhlcSplitPattern2, } impl MetricsTree_Price { pub fn new(client: Arc, base_path: String) -> Self { Self { cents: MetricsTree_Price_Cents::new(client.clone(), format!("{base_path}_cents")), - sats: SatsPattern::new(client.clone(), "price".to_string()), usd: MetricsTree_Price_Usd::new(client.clone(), format!("{base_path}_usd")), + sats: OhlcSplitPattern2::new(client.clone(), "price".to_string()), } } } /// Metrics tree node. pub struct MetricsTree_Price_Cents { - pub ohlc: MetricPattern5, pub split: MetricsTree_Price_Cents_Split, + pub ohlc: MetricPattern5, } impl MetricsTree_Price_Cents { pub fn new(client: Arc, base_path: String) -> Self { Self { - ohlc: MetricPattern5::new(client.clone(), "ohlc_cents".to_string()), split: MetricsTree_Price_Cents_Split::new(client.clone(), format!("{base_path}_split")), + ohlc: MetricPattern5::new(client.clone(), "ohlc_cents".to_string()), } } } /// Metrics tree node. pub struct MetricsTree_Price_Cents_Split { - pub close: MetricPattern5, - pub high: MetricPattern5, - pub low: MetricPattern5, - pub open: MetricPattern5, + pub open: MetricPattern5, + pub high: MetricPattern5, + pub low: MetricPattern5, + pub close: MetricPattern5, } impl MetricsTree_Price_Cents_Split { pub fn new(client: Arc, base_path: String) -> Self { Self { - close: MetricPattern5::new(client.clone(), "price_close_cents".to_string()), + open: MetricPattern5::new(client.clone(), "price_open_cents".to_string()), high: MetricPattern5::new(client.clone(), "price_high_cents".to_string()), low: MetricPattern5::new(client.clone(), "price_low_cents".to_string()), - open: MetricPattern5::new(client.clone(), "price_open_cents".to_string()), + close: MetricPattern5::new(client.clone(), "price_close_cents".to_string()), } } } /// Metrics tree node. pub struct MetricsTree_Price_Usd { + pub split: CloseHighLowOpenPattern2, pub ohlc: MetricPattern1, - pub split: SplitPattern2, } impl MetricsTree_Price_Usd { pub fn new(client: Arc, base_path: String) -> Self { Self { + split: CloseHighLowOpenPattern2::new(client.clone(), "price".to_string()), ohlc: MetricPattern1::new(client.clone(), "price_ohlc".to_string()), - split: SplitPattern2::new(client.clone(), "price".to_string()), } } } /// Metrics tree node. -pub struct MetricsTree_Scripts { - pub count: MetricsTree_Scripts_Count, - pub empty_to_txindex: MetricPattern9, - pub first_emptyoutputindex: MetricPattern11, - pub first_opreturnindex: MetricPattern11, - pub first_p2msoutputindex: MetricPattern11, - pub first_unknownoutputindex: MetricPattern11, - pub opreturn_to_txindex: MetricPattern14, - pub p2ms_to_txindex: MetricPattern17, - pub unknown_to_txindex: MetricPattern28, - pub value: MetricsTree_Scripts_Value, +pub struct MetricsTree_Distribution { + pub chain_state: MetricPattern11, + pub any_address_indexes: MetricsTree_Distribution_AnyAddressIndexes, + pub addresses_data: MetricsTree_Distribution_AddressesData, + pub utxo_cohorts: MetricsTree_Distribution_UtxoCohorts, + pub address_cohorts: MetricsTree_Distribution_AddressCohorts, + pub addr_count: AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern, + pub empty_addr_count: AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern, + pub address_activity: MetricsTree_Distribution_AddressActivity, + pub total_addr_count: AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern, + pub new_addr_count: MetricsTree_Distribution_NewAddrCount, + pub growth_rate: MetricsTree_Distribution_GrowthRate, + pub loadedaddressindex: MetricPattern31, + pub emptyaddressindex: MetricPattern32, } -impl MetricsTree_Scripts { +impl MetricsTree_Distribution { pub fn new(client: Arc, base_path: String) -> Self { Self { - count: MetricsTree_Scripts_Count::new(client.clone(), format!("{base_path}_count")), - empty_to_txindex: MetricPattern9::new(client.clone(), "txindex".to_string()), - first_emptyoutputindex: MetricPattern11::new(client.clone(), "first_emptyoutputindex".to_string()), - first_opreturnindex: MetricPattern11::new(client.clone(), "first_opreturnindex".to_string()), - first_p2msoutputindex: MetricPattern11::new(client.clone(), "first_p2msoutputindex".to_string()), - first_unknownoutputindex: MetricPattern11::new(client.clone(), "first_unknownoutputindex".to_string()), - opreturn_to_txindex: MetricPattern14::new(client.clone(), "txindex".to_string()), - p2ms_to_txindex: MetricPattern17::new(client.clone(), "txindex".to_string()), - unknown_to_txindex: MetricPattern28::new(client.clone(), "txindex".to_string()), - value: MetricsTree_Scripts_Value::new(client.clone(), format!("{base_path}_value")), + chain_state: MetricPattern11::new(client.clone(), "chain".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: AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern::new(client.clone(), "total_addr_count".to_string()), + 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")), + loadedaddressindex: MetricPattern31::new(client.clone(), "loadedaddressindex".to_string()), + emptyaddressindex: MetricPattern32::new(client.clone(), "emptyaddressindex".to_string()), } } } /// Metrics tree node. -pub struct MetricsTree_Scripts_Count { - pub emptyoutput: DollarsPattern, - pub opreturn: DollarsPattern, - pub p2a: DollarsPattern, - pub p2ms: DollarsPattern, - pub p2pk33: DollarsPattern, - pub p2pk65: DollarsPattern, - pub p2pkh: DollarsPattern, - pub p2sh: DollarsPattern, - pub p2tr: DollarsPattern, - pub p2wpkh: DollarsPattern, - pub p2wsh: DollarsPattern, - pub segwit: DollarsPattern, - pub segwit_adoption: SegwitAdoptionPattern, - pub taproot_adoption: SegwitAdoptionPattern, - pub unknownoutput: DollarsPattern, +pub struct MetricsTree_Distribution_AnyAddressIndexes { + pub p2a: MetricPattern16, + pub p2pk33: MetricPattern18, + pub p2pk65: MetricPattern19, + pub p2pkh: MetricPattern20, + pub p2sh: MetricPattern21, + pub p2tr: MetricPattern22, + pub p2wpkh: MetricPattern23, + pub p2wsh: MetricPattern24, } -impl MetricsTree_Scripts_Count { +impl MetricsTree_Distribution_AnyAddressIndexes { pub fn new(client: Arc, base_path: String) -> Self { Self { - emptyoutput: DollarsPattern::new(client.clone(), "emptyoutput_count".to_string()), - opreturn: DollarsPattern::new(client.clone(), "opreturn_count".to_string()), - p2a: DollarsPattern::new(client.clone(), "p2a_count".to_string()), - p2ms: DollarsPattern::new(client.clone(), "p2ms_count".to_string()), - p2pk33: DollarsPattern::new(client.clone(), "p2pk33_count".to_string()), - p2pk65: DollarsPattern::new(client.clone(), "p2pk65_count".to_string()), - p2pkh: DollarsPattern::new(client.clone(), "p2pkh_count".to_string()), - p2sh: DollarsPattern::new(client.clone(), "p2sh_count".to_string()), - p2tr: DollarsPattern::new(client.clone(), "p2tr_count".to_string()), - p2wpkh: DollarsPattern::new(client.clone(), "p2wpkh_count".to_string()), - p2wsh: DollarsPattern::new(client.clone(), "p2wsh_count".to_string()), - segwit: DollarsPattern::new(client.clone(), "segwit_count".to_string()), - segwit_adoption: SegwitAdoptionPattern::new(client.clone(), "segwit_adoption".to_string()), - taproot_adoption: SegwitAdoptionPattern::new(client.clone(), "taproot_adoption".to_string()), - unknownoutput: DollarsPattern::new(client.clone(), "unknownoutput_count".to_string()), + p2a: MetricPattern16::new(client.clone(), "anyaddressindex".to_string()), + p2pk33: MetricPattern18::new(client.clone(), "anyaddressindex".to_string()), + p2pk65: MetricPattern19::new(client.clone(), "anyaddressindex".to_string()), + p2pkh: MetricPattern20::new(client.clone(), "anyaddressindex".to_string()), + p2sh: MetricPattern21::new(client.clone(), "anyaddressindex".to_string()), + p2tr: MetricPattern22::new(client.clone(), "anyaddressindex".to_string()), + p2wpkh: MetricPattern23::new(client.clone(), "anyaddressindex".to_string()), + p2wsh: MetricPattern24::new(client.clone(), "anyaddressindex".to_string()), } } } /// Metrics tree node. -pub struct MetricsTree_Scripts_Value { - pub opreturn: CoinbasePattern, +pub struct MetricsTree_Distribution_AddressesData { + pub loaded: MetricPattern31, + pub empty: MetricPattern32, } -impl MetricsTree_Scripts_Value { +impl MetricsTree_Distribution_AddressesData { pub fn new(client: Arc, base_path: String) -> Self { Self { - opreturn: CoinbasePattern::new(client.clone(), "opreturn_value".to_string()), + loaded: MetricPattern31::new(client.clone(), "loadedaddressdata".to_string()), + empty: MetricPattern32::new(client.clone(), "emptyaddressdata".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Distribution_UtxoCohorts { + pub all: MetricsTree_Distribution_UtxoCohorts_All, + pub age_range: MetricsTree_Distribution_UtxoCohorts_AgeRange, + pub epoch: MetricsTree_Distribution_UtxoCohorts_Epoch, + pub year: MetricsTree_Distribution_UtxoCohorts_Year, + pub min_age: MetricsTree_Distribution_UtxoCohorts_MinAge, + pub ge_amount: MetricsTree_Distribution_UtxoCohorts_GeAmount, + pub amount_range: MetricsTree_Distribution_UtxoCohorts_AmountRange, + pub term: MetricsTree_Distribution_UtxoCohorts_Term, + pub type_: MetricsTree_Distribution_UtxoCohorts_Type, + pub max_age: MetricsTree_Distribution_UtxoCohorts_MaxAge, + pub lt_amount: MetricsTree_Distribution_UtxoCohorts_LtAmount, +} + +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")), + age_range: MetricsTree_Distribution_UtxoCohorts_AgeRange::new(client.clone(), format!("{base_path}_age_range")), + epoch: MetricsTree_Distribution_UtxoCohorts_Epoch::new(client.clone(), format!("{base_path}_epoch")), + year: MetricsTree_Distribution_UtxoCohorts_Year::new(client.clone(), format!("{base_path}_year")), + 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")), + term: MetricsTree_Distribution_UtxoCohorts_Term::new(client.clone(), format!("{base_path}_term")), + type_: MetricsTree_Distribution_UtxoCohorts_Type::new(client.clone(), format!("{base_path}_type_")), + max_age: MetricsTree_Distribution_UtxoCohorts_MaxAge::new(client.clone(), format!("{base_path}_max_age")), + lt_amount: MetricsTree_Distribution_UtxoCohorts_LtAmount::new(client.clone(), format!("{base_path}_lt_amount")), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Distribution_UtxoCohorts_All { + pub supply: HalvedTotalPattern, + pub outputs: UtxoPattern, + pub activity: CoinblocksCoindaysSatblocksSatdaysSentPattern, + pub realized: AdjustedAthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern, + pub unrealized: AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern, + pub cost_basis: InvestedMaxMinPercentilesSpotPattern, + pub relative: MetricsTree_Distribution_UtxoCohorts_All_Relative, +} + +impl MetricsTree_Distribution_UtxoCohorts_All { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + supply: HalvedTotalPattern::new(client.clone(), "supply".to_string()), + outputs: UtxoPattern::new(client.clone(), "utxo_count".to_string()), + activity: CoinblocksCoindaysSatblocksSatdaysSentPattern::new(client.clone(), "".to_string()), + realized: AdjustedAthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern::new(client.clone(), "".to_string()), + unrealized: AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern::new(client.clone(), "".to_string()), + cost_basis: InvestedMaxMinPercentilesSpotPattern::new(client.clone(), "".to_string()), + relative: MetricsTree_Distribution_UtxoCohorts_All_Relative::new(client.clone(), format!("{base_path}_relative")), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Distribution_UtxoCohorts_All_Relative { + pub supply_in_profit_rel_to_own_supply: MetricPattern1, + pub supply_in_loss_rel_to_own_supply: MetricPattern1, + pub unrealized_profit_rel_to_own_total_unrealized_pnl: MetricPattern1, + pub unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1, + pub neg_unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1, + pub net_unrealized_pnl_rel_to_own_total_unrealized_pnl: MetricPattern1, + pub invested_capital_in_profit_pct: MetricPattern1, + pub invested_capital_in_loss_pct: MetricPattern1, +} + +impl MetricsTree_Distribution_UtxoCohorts_All_Relative { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + supply_in_profit_rel_to_own_supply: MetricPattern1::new(client.clone(), "supply_in_profit_rel_to_own_supply".to_string()), + supply_in_loss_rel_to_own_supply: MetricPattern1::new(client.clone(), "supply_in_loss_rel_to_own_supply".to_string()), + unrealized_profit_rel_to_own_total_unrealized_pnl: MetricPattern1::new(client.clone(), "unrealized_profit_rel_to_own_total_unrealized_pnl".to_string()), + unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1::new(client.clone(), "unrealized_loss_rel_to_own_total_unrealized_pnl".to_string()), + neg_unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1::new(client.clone(), "neg_unrealized_loss_rel_to_own_total_unrealized_pnl".to_string()), + net_unrealized_pnl_rel_to_own_total_unrealized_pnl: MetricPattern1::new(client.clone(), "net_unrealized_pnl_rel_to_own_total_unrealized_pnl".to_string()), + invested_capital_in_profit_pct: MetricPattern1::new(client.clone(), "invested_capital_in_profit_pct".to_string()), + invested_capital_in_loss_pct: MetricPattern1::new(client.clone(), "invested_capital_in_loss_pct".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Distribution_UtxoCohorts_AgeRange { + pub up_to_1h: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _1h_to_1d: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _1d_to_1w: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _1w_to_1m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _1m_to_2m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _2m_to_3m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _3m_to_4m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _4m_to_5m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _5m_to_6m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _6m_to_1y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _1y_to_2y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _2y_to_3y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _3y_to_4y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _4y_to_5y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _5y_to_6y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _6y_to_7y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _7y_to_8y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _8y_to_10y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _10y_to_12y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _12y_to_15y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub from_15y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern, +} + +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()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Distribution_UtxoCohorts_Epoch { + pub _0: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, + pub _1: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, + pub _2: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, + pub _3: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, + pub _4: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, +} + +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()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Distribution_UtxoCohorts_Year { + pub _2009: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, + pub _2010: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, + pub _2011: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, + pub _2012: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, + pub _2013: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, + pub _2014: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, + pub _2015: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, + pub _2016: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, + pub _2017: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, + pub _2018: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, + pub _2019: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, + pub _2020: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, + pub _2021: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, + pub _2022: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, + pub _2023: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, + pub _2024: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, + pub _2025: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, + pub _2026: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, +} + +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()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Distribution_UtxoCohorts_MinAge { + pub _1d: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4, + pub _1w: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4, + pub _1m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4, + pub _2m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4, + pub _3m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4, + pub _4m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4, + pub _5m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4, + pub _6m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4, + pub _1y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4, + pub _2y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4, + pub _3y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4, + pub _4y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4, + pub _5y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4, + pub _6y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4, + pub _7y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4, + pub _8y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4, + pub _10y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4, + pub _12y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4, +} + +impl MetricsTree_Distribution_UtxoCohorts_MinAge { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + _1d: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_over_1d_old".to_string()), + _1w: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_over_1w_old".to_string()), + _1m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_over_1m_old".to_string()), + _2m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_over_2m_old".to_string()), + _3m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_over_3m_old".to_string()), + _4m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_over_4m_old".to_string()), + _5m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_over_5m_old".to_string()), + _6m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_over_6m_old".to_string()), + _1y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_over_1y_old".to_string()), + _2y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_over_2y_old".to_string()), + _3y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_over_3y_old".to_string()), + _4y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_over_4y_old".to_string()), + _5y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_over_5y_old".to_string()), + _6y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_over_6y_old".to_string()), + _7y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_over_7y_old".to_string()), + _8y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_over_8y_old".to_string()), + _10y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_over_10y_old".to_string()), + _12y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_over_12y_old".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Distribution_UtxoCohorts_GeAmount { + pub _1sat: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4, + pub _10sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4, + pub _100sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4, + pub _1k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4, + pub _10k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4, + pub _100k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4, + pub _1m_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4, + pub _10m_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4, + pub _1btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4, + pub _10btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4, + pub _100btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4, + pub _1k_btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4, + pub _10k_btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4, +} + +impl MetricsTree_Distribution_UtxoCohorts_GeAmount { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + _1sat: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_over_1sat".to_string()), + _10sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_over_10sats".to_string()), + _100sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_over_100sats".to_string()), + _1k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_over_1k_sats".to_string()), + _10k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_over_10k_sats".to_string()), + _100k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_over_100k_sats".to_string()), + _1m_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_over_1m_sats".to_string()), + _10m_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_over_10m_sats".to_string()), + _1btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_over_1btc".to_string()), + _10btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_over_10btc".to_string()), + _100btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_over_100btc".to_string()), + _1k_btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_over_1k_btc".to_string()), + _10k_btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_over_10k_btc".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Distribution_UtxoCohorts_AmountRange { + pub _0sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, + pub _1sat_to_10sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, + pub _10sats_to_100sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, + pub _100sats_to_1k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, + pub _1k_sats_to_10k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, + pub _10k_sats_to_100k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, + pub _100k_sats_to_1m_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, + pub _1m_sats_to_10m_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, + pub _10m_sats_to_1btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, + pub _1btc_to_10btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, + pub _10btc_to_100btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, + pub _100btc_to_1k_btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, + pub _1k_btc_to_10k_btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, + pub _10k_btc_to_100k_btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, + pub _100k_btc_or_more: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, +} + +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()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Distribution_UtxoCohorts_Term { + pub short: MetricsTree_Distribution_UtxoCohorts_Term_Short, + pub long: MetricsTree_Distribution_UtxoCohorts_Term_Long, +} + +impl MetricsTree_Distribution_UtxoCohorts_Term { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + short: MetricsTree_Distribution_UtxoCohorts_Term_Short::new(client.clone(), format!("{base_path}_short")), + long: MetricsTree_Distribution_UtxoCohorts_Term_Long::new(client.clone(), format!("{base_path}_long")), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Distribution_UtxoCohorts_Term_Short { + pub supply: HalvedTotalPattern, + pub outputs: UtxoPattern, + pub activity: CoinblocksCoindaysSatblocksSatdaysSentPattern, + pub realized: AdjustedAthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern, + pub unrealized: AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern, + pub cost_basis: InvestedMaxMinPercentilesSpotPattern, + pub relative: InvestedNegNetNuplSupplyUnrealizedPattern2, +} + +impl MetricsTree_Distribution_UtxoCohorts_Term_Short { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + supply: HalvedTotalPattern::new(client.clone(), "sth_supply".to_string()), + outputs: UtxoPattern::new(client.clone(), "sth_utxo_count".to_string()), + activity: CoinblocksCoindaysSatblocksSatdaysSentPattern::new(client.clone(), "sth".to_string()), + realized: AdjustedAthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern::new(client.clone(), "sth".to_string()), + unrealized: AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern::new(client.clone(), "sth".to_string()), + cost_basis: InvestedMaxMinPercentilesSpotPattern::new(client.clone(), "sth".to_string()), + relative: InvestedNegNetNuplSupplyUnrealizedPattern2::new(client.clone(), "sth".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Distribution_UtxoCohorts_Term_Long { + pub supply: HalvedTotalPattern, + pub outputs: UtxoPattern, + pub activity: CoinblocksCoindaysSatblocksSatdaysSentPattern, + pub realized: AthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern2, + pub unrealized: AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern, + pub cost_basis: InvestedMaxMinPercentilesSpotPattern, + pub relative: InvestedNegNetNuplSupplyUnrealizedPattern2, +} + +impl MetricsTree_Distribution_UtxoCohorts_Term_Long { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + supply: HalvedTotalPattern::new(client.clone(), "lth_supply".to_string()), + outputs: UtxoPattern::new(client.clone(), "lth_utxo_count".to_string()), + activity: CoinblocksCoindaysSatblocksSatdaysSentPattern::new(client.clone(), "lth".to_string()), + realized: AthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern2::new(client.clone(), "lth".to_string()), + unrealized: AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern::new(client.clone(), "lth".to_string()), + cost_basis: InvestedMaxMinPercentilesSpotPattern::new(client.clone(), "lth".to_string()), + relative: InvestedNegNetNuplSupplyUnrealizedPattern2::new(client.clone(), "lth".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Distribution_UtxoCohorts_Type { + pub p2pk65: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, + pub p2pk33: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, + pub p2pkh: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, + pub p2ms: ActivityCostOutputsRealizedSupplyUnrealizedPattern, + pub p2sh: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, + pub p2wpkh: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, + pub p2wsh: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, + pub p2tr: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, + pub p2a: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3, + pub unknown: ActivityCostOutputsRealizedSupplyUnrealizedPattern, + pub empty: ActivityCostOutputsRealizedSupplyUnrealizedPattern, +} + +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: ActivityCostOutputsRealizedSupplyUnrealizedPattern::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: ActivityCostOutputsRealizedSupplyUnrealizedPattern::new(client.clone(), "unknown_outputs".to_string()), + empty: ActivityCostOutputsRealizedSupplyUnrealizedPattern::new(client.clone(), "empty_outputs".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Distribution_UtxoCohorts_MaxAge { + pub _1w: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5, + pub _1m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5, + pub _2m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5, + pub _3m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5, + pub _4m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5, + pub _5m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5, + pub _6m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5, + pub _1y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5, + pub _2y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5, + pub _3y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5, + pub _4y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5, + pub _5y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5, + pub _6y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5, + pub _7y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5, + pub _8y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5, + pub _10y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5, + pub _12y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5, + pub _15y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5, +} + +impl MetricsTree_Distribution_UtxoCohorts_MaxAge { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + _1w: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5::new(client.clone(), "utxos_under_1w_old".to_string()), + _1m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5::new(client.clone(), "utxos_under_1m_old".to_string()), + _2m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5::new(client.clone(), "utxos_under_2m_old".to_string()), + _3m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5::new(client.clone(), "utxos_under_3m_old".to_string()), + _4m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5::new(client.clone(), "utxos_under_4m_old".to_string()), + _5m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5::new(client.clone(), "utxos_under_5m_old".to_string()), + _6m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5::new(client.clone(), "utxos_under_6m_old".to_string()), + _1y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5::new(client.clone(), "utxos_under_1y_old".to_string()), + _2y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5::new(client.clone(), "utxos_under_2y_old".to_string()), + _3y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5::new(client.clone(), "utxos_under_3y_old".to_string()), + _4y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5::new(client.clone(), "utxos_under_4y_old".to_string()), + _5y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5::new(client.clone(), "utxos_under_5y_old".to_string()), + _6y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5::new(client.clone(), "utxos_under_6y_old".to_string()), + _7y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5::new(client.clone(), "utxos_under_7y_old".to_string()), + _8y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5::new(client.clone(), "utxos_under_8y_old".to_string()), + _10y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5::new(client.clone(), "utxos_under_10y_old".to_string()), + _12y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5::new(client.clone(), "utxos_under_12y_old".to_string()), + _15y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5::new(client.clone(), "utxos_under_15y_old".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Distribution_UtxoCohorts_LtAmount { + pub _10sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4, + pub _100sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4, + pub _1k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4, + pub _10k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4, + pub _100k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4, + pub _1m_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4, + pub _10m_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4, + pub _1btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4, + pub _10btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4, + pub _100btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4, + pub _1k_btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4, + pub _10k_btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4, + pub _100k_btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4, +} + +impl MetricsTree_Distribution_UtxoCohorts_LtAmount { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + _10sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_under_10sats".to_string()), + _100sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_under_100sats".to_string()), + _1k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_under_1k_sats".to_string()), + _10k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_under_10k_sats".to_string()), + _100k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_under_100k_sats".to_string()), + _1m_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_under_1m_sats".to_string()), + _10m_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_under_10m_sats".to_string()), + _1btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_under_1btc".to_string()), + _10btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_under_10btc".to_string()), + _100btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_under_100btc".to_string()), + _1k_btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_under_1k_btc".to_string()), + _10k_btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_under_10k_btc".to_string()), + _100k_btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4::new(client.clone(), "utxos_under_100k_btc".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Distribution_AddressCohorts { + pub ge_amount: MetricsTree_Distribution_AddressCohorts_GeAmount, + pub amount_range: MetricsTree_Distribution_AddressCohorts_AmountRange, + pub lt_amount: MetricsTree_Distribution_AddressCohorts_LtAmount, +} + +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")), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Distribution_AddressCohorts_GeAmount { + pub _1sat: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _10sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _100sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _1k_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _10k_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _100k_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _1m_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _10m_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _1btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _10btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _100btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _1k_btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _10k_btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern, +} + +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()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Distribution_AddressCohorts_AmountRange { + pub _0sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _1sat_to_10sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _10sats_to_100sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _100sats_to_1k_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _1k_sats_to_10k_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _10k_sats_to_100k_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _100k_sats_to_1m_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _1m_sats_to_10m_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _10m_sats_to_1btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _1btc_to_10btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _10btc_to_100btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _100btc_to_1k_btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _1k_btc_to_10k_btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _10k_btc_to_100k_btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _100k_btc_or_more: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern, +} + +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()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Distribution_AddressCohorts_LtAmount { + pub _10sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _100sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _1k_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _10k_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _100k_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _1m_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _10m_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _1btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _10btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _100btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _1k_btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _10k_btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern, + pub _100k_btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern, +} + +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()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Distribution_AddressActivity { + pub all: BalanceBothReactivatedReceivingSendingPattern, + pub p2pk65: BalanceBothReactivatedReceivingSendingPattern, + pub p2pk33: BalanceBothReactivatedReceivingSendingPattern, + pub p2pkh: BalanceBothReactivatedReceivingSendingPattern, + pub p2sh: BalanceBothReactivatedReceivingSendingPattern, + pub p2wpkh: BalanceBothReactivatedReceivingSendingPattern, + pub p2wsh: BalanceBothReactivatedReceivingSendingPattern, + pub p2tr: BalanceBothReactivatedReceivingSendingPattern, + pub p2a: BalanceBothReactivatedReceivingSendingPattern, +} + +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()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Distribution_NewAddrCount { + pub all: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2, + pub p2pk65: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2, + pub p2pk33: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2, + pub p2pkh: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2, + pub p2sh: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2, + pub p2wpkh: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2, + pub p2wsh: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2, + pub p2tr: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2, + pub p2a: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2, +} + +impl MetricsTree_Distribution_NewAddrCount { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + all: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), "new_addr_count".to_string()), + p2pk65: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), "p2pk65_new_addr_count".to_string()), + p2pk33: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), "p2pk33_new_addr_count".to_string()), + p2pkh: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), "p2pkh_new_addr_count".to_string()), + p2sh: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), "p2sh_new_addr_count".to_string()), + p2wpkh: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), "p2wpkh_new_addr_count".to_string()), + p2wsh: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), "p2wsh_new_addr_count".to_string()), + p2tr: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), "p2tr_new_addr_count".to_string()), + p2a: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), "p2a_new_addr_count".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Distribution_GrowthRate { + pub all: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern, + pub p2pk65: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern, + pub p2pk33: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern, + pub p2pkh: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern, + pub p2sh: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern, + pub p2wpkh: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern, + pub p2wsh: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern, + pub p2tr: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern, + pub p2a: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern, +} + +impl MetricsTree_Distribution_GrowthRate { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + all: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern::new(client.clone(), "growth_rate".to_string()), + p2pk65: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern::new(client.clone(), "p2pk65_growth_rate".to_string()), + p2pk33: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern::new(client.clone(), "p2pk33_growth_rate".to_string()), + p2pkh: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern::new(client.clone(), "p2pkh_growth_rate".to_string()), + p2sh: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern::new(client.clone(), "p2sh_growth_rate".to_string()), + p2wpkh: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern::new(client.clone(), "p2wpkh_growth_rate".to_string()), + p2wsh: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern::new(client.clone(), "p2wsh_growth_rate".to_string()), + p2tr: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern::new(client.clone(), "p2tr_growth_rate".to_string()), + p2a: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern::new(client.clone(), "p2a_growth_rate".to_string()), } } } /// Metrics tree node. pub struct MetricsTree_Supply { - pub burned: MetricsTree_Supply_Burned, pub circulating: MetricsTree_Supply_Circulating, + pub burned: MetricsTree_Supply_Burned, pub inflation: MetricPattern4, - pub market_cap: MetricPattern1, pub velocity: MetricsTree_Supply_Velocity, + pub market_cap: MetricPattern1, } impl MetricsTree_Supply { pub fn new(client: Arc, base_path: String) -> Self { Self { - burned: MetricsTree_Supply_Burned::new(client.clone(), format!("{base_path}_burned")), circulating: MetricsTree_Supply_Circulating::new(client.clone(), format!("{base_path}_circulating")), + burned: MetricsTree_Supply_Burned::new(client.clone(), format!("{base_path}_burned")), inflation: MetricPattern4::new(client.clone(), "inflation_rate".to_string()), - market_cap: MetricPattern1::new(client.clone(), "market_cap".to_string()), velocity: MetricsTree_Supply_Velocity::new(client.clone(), format!("{base_path}_velocity")), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Supply_Burned { - pub opreturn: UnclaimedRewardsPattern, - pub unspendable: UnclaimedRewardsPattern, -} - -impl MetricsTree_Supply_Burned { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - opreturn: UnclaimedRewardsPattern::new(client.clone(), "opreturn_supply".to_string()), - unspendable: UnclaimedRewardsPattern::new(client.clone(), "unspendable_supply".to_string()), + market_cap: MetricPattern1::new(client.clone(), "market_cap".to_string()), } } } /// Metrics tree node. pub struct MetricsTree_Supply_Circulating { + pub sats: MetricPattern3, pub bitcoin: MetricPattern3, pub dollars: MetricPattern3, - pub sats: MetricPattern3, } impl MetricsTree_Supply_Circulating { pub fn new(client: Arc, base_path: String) -> Self { Self { + sats: MetricPattern3::new(client.clone(), "circulating_supply".to_string()), bitcoin: MetricPattern3::new(client.clone(), "circulating_supply_btc".to_string()), dollars: MetricPattern3::new(client.clone(), "circulating_supply_usd".to_string()), - sats: MetricPattern3::new(client.clone(), "circulating_supply".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Supply_Burned { + pub opreturn: BitcoinDollarsSatsPattern3, + pub unspendable: BitcoinDollarsSatsPattern3, +} + +impl MetricsTree_Supply_Burned { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + opreturn: BitcoinDollarsSatsPattern3::new(client.clone(), "opreturn_supply".to_string()), + unspendable: BitcoinDollarsSatsPattern3::new(client.clone(), "unspendable_supply".to_string()), } } } @@ -5494,155 +5800,6 @@ impl MetricsTree_Supply_Velocity { } } -/// Metrics tree node. -pub struct MetricsTree_Transactions { - pub base_size: MetricPattern27, - pub count: MetricsTree_Transactions_Count, - pub fees: MetricsTree_Transactions_Fees, - pub first_txindex: MetricPattern11, - pub first_txinindex: MetricPattern27, - pub first_txoutindex: MetricPattern27, - pub height: MetricPattern27, - pub is_explicitly_rbf: MetricPattern27, - pub rawlocktime: MetricPattern27, - pub size: MetricsTree_Transactions_Size, - pub total_size: MetricPattern27, - pub txid: MetricPattern27, - pub txversion: MetricPattern27, - pub versions: MetricsTree_Transactions_Versions, - pub volume: MetricsTree_Transactions_Volume, -} - -impl MetricsTree_Transactions { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - base_size: MetricPattern27::new(client.clone(), "base_size".to_string()), - count: MetricsTree_Transactions_Count::new(client.clone(), format!("{base_path}_count")), - fees: MetricsTree_Transactions_Fees::new(client.clone(), format!("{base_path}_fees")), - first_txindex: MetricPattern11::new(client.clone(), "first_txindex".to_string()), - first_txinindex: MetricPattern27::new(client.clone(), "first_txinindex".to_string()), - first_txoutindex: MetricPattern27::new(client.clone(), "first_txoutindex".to_string()), - height: MetricPattern27::new(client.clone(), "height".to_string()), - is_explicitly_rbf: MetricPattern27::new(client.clone(), "is_explicitly_rbf".to_string()), - rawlocktime: MetricPattern27::new(client.clone(), "rawlocktime".to_string()), - size: MetricsTree_Transactions_Size::new(client.clone(), format!("{base_path}_size")), - total_size: MetricPattern27::new(client.clone(), "total_size".to_string()), - txid: MetricPattern27::new(client.clone(), "txid".to_string()), - txversion: MetricPattern27::new(client.clone(), "txversion".to_string()), - versions: MetricsTree_Transactions_Versions::new(client.clone(), format!("{base_path}_versions")), - volume: MetricsTree_Transactions_Volume::new(client.clone(), format!("{base_path}_volume")), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Transactions_Count { - pub is_coinbase: MetricPattern27, - pub tx_count: DollarsPattern, -} - -impl MetricsTree_Transactions_Count { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - is_coinbase: MetricPattern27::new(client.clone(), "is_coinbase".to_string()), - tx_count: DollarsPattern::new(client.clone(), "tx_count".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Transactions_Fees { - pub fee: MetricsTree_Transactions_Fees_Fee, - pub fee_rate: FeeRatePattern, - pub input_value: MetricPattern27, - pub output_value: MetricPattern27, -} - -impl MetricsTree_Transactions_Fees { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - fee: MetricsTree_Transactions_Fees_Fee::new(client.clone(), format!("{base_path}_fee")), - fee_rate: FeeRatePattern::new(client.clone(), "fee_rate".to_string()), - input_value: MetricPattern27::new(client.clone(), "input_value".to_string()), - output_value: MetricPattern27::new(client.clone(), "output_value".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Transactions_Fees_Fee { - pub bitcoin: CountPattern2, - pub dollars: CountPattern2, - pub sats: CountPattern2, - pub txindex: MetricPattern27, -} - -impl MetricsTree_Transactions_Fees_Fee { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - bitcoin: CountPattern2::new(client.clone(), "fee_btc".to_string()), - dollars: CountPattern2::new(client.clone(), "fee_usd".to_string()), - sats: CountPattern2::new(client.clone(), "fee".to_string()), - txindex: MetricPattern27::new(client.clone(), "fee".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Transactions_Size { - pub vsize: FeeRatePattern, - pub weight: FeeRatePattern, -} - -impl MetricsTree_Transactions_Size { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - vsize: FeeRatePattern::new(client.clone(), "tx_vsize".to_string()), - weight: FeeRatePattern::new(client.clone(), "tx_weight".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Transactions_Versions { - pub v1: BlockCountPattern, - pub v2: BlockCountPattern, - pub v3: BlockCountPattern, -} - -impl MetricsTree_Transactions_Versions { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - v1: BlockCountPattern::new(client.clone(), "tx_v1".to_string()), - v2: BlockCountPattern::new(client.clone(), "tx_v2".to_string()), - v3: BlockCountPattern::new(client.clone(), "tx_v3".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Transactions_Volume { - pub annualized_volume: _2015Pattern, - pub inputs_per_sec: MetricPattern4, - pub outputs_per_sec: MetricPattern4, - pub received_sum: ActiveSupplyPattern, - pub sent_sum: ActiveSupplyPattern, - pub tx_per_sec: MetricPattern4, -} - -impl MetricsTree_Transactions_Volume { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - annualized_volume: _2015Pattern::new(client.clone(), "annualized_volume".to_string()), - inputs_per_sec: MetricPattern4::new(client.clone(), "inputs_per_sec".to_string()), - outputs_per_sec: MetricPattern4::new(client.clone(), "outputs_per_sec".to_string()), - received_sum: ActiveSupplyPattern::new(client.clone(), "received_sum".to_string()), - sent_sum: ActiveSupplyPattern::new(client.clone(), "sent_sum".to_string()), - tx_per_sec: MetricPattern4::new(client.clone(), "tx_per_sec".to_string()), - } - } -} - /// Main BRK client with metrics tree and API methods. pub struct BrkClient { base: Arc, @@ -5651,7 +5808,7 @@ pub struct BrkClient { impl BrkClient { /// Client version. - pub const VERSION: &'static str = "v0.1.1"; + pub const VERSION: &'static str = "v0.1.2"; /// Create a new client with the given base URL. pub fn new(base_url: impl Into) -> Self { diff --git a/crates/brk_cohort/src/filter.rs b/crates/brk_cohort/src/filter.rs index 626327399..1ddcb23d5 100644 --- a/crates/brk_cohort/src/filter.rs +++ b/crates/brk_cohort/src/filter.rs @@ -102,4 +102,14 @@ impl Filter { ), } } + + /// Whether to compute relative metrics (invested capital %, NUPL ratios, etc.) + /// Returns false for edge-case output types (Empty, P2MS, Unknown) which have + /// too little volume for meaningful ratio/percentage analysis. + pub fn compute_relative(&self) -> bool { + !matches!( + self, + Filter::Type(OutputType::Empty | OutputType::P2MS | OutputType::Unknown) + ) + } } diff --git a/crates/brk_computer/src/cointime/import.rs b/crates/brk_computer/src/cointime/import.rs index 7030d025e..35a4f5baa 100644 --- a/crates/brk_computer/src/cointime/import.rs +++ b/crates/brk_computer/src/cointime/import.rs @@ -29,7 +29,7 @@ impl Vecs { let supply = SupplyVecs::forced_import(&db, v1, indexes, price)?; let value = ValueVecs::forced_import(&db, v1, indexes)?; let cap = CapVecs::forced_import(&db, v1, indexes)?; - let pricing = PricingVecs::forced_import(&db, version, indexes, price)?; + let pricing = PricingVecs::forced_import(&db, version, indexes)?; let adjusted = AdjustedVecs::forced_import(&db, version, indexes)?; let reserve_risk = ReserveRiskVecs::forced_import(&db, v1, indexes, compute_dollars)?; diff --git a/crates/brk_computer/src/cointime/pricing/import.rs b/crates/brk_computer/src/cointime/pricing/import.rs index c6957f3e1..2e997f63e 100644 --- a/crates/brk_computer/src/cointime/pricing/import.rs +++ b/crates/brk_computer/src/cointime/pricing/import.rs @@ -6,7 +6,6 @@ use super::Vecs; use crate::{ indexes, internal::{ComputedFromDateRatio, PriceFromHeight}, - price, }; impl Vecs { @@ -14,7 +13,6 @@ impl Vecs { db: &Database, version: Version, indexes: &indexes::Vecs, - price: Option<&price::Vecs>, ) -> Result { let vaulted_price = PriceFromHeight::forced_import(db, "vaulted_price", version, indexes)?; let vaulted_price_ratio = ComputedFromDateRatio::forced_import( @@ -24,7 +22,6 @@ impl Vecs { version, indexes, true, - price, )?; let active_price = PriceFromHeight::forced_import(db, "active_price", version, indexes)?; @@ -35,7 +32,6 @@ impl Vecs { version, indexes, true, - price, )?; let true_market_mean = @@ -47,7 +43,6 @@ impl Vecs { version, indexes, true, - price, )?; let cointime_price = @@ -59,7 +54,6 @@ impl Vecs { version, indexes, true, - price, )?; Ok(Self { diff --git a/crates/brk_computer/src/distribution/address/address_count.rs b/crates/brk_computer/src/distribution/address/address_count.rs index 57bf0ee7d..84087777b 100644 --- a/crates/brk_computer/src/distribution/address/address_count.rs +++ b/crates/brk_computer/src/distribution/address/address_count.rs @@ -134,18 +134,6 @@ impl AddressTypeToAddrCountVecs { .into_par_iter() } - pub fn write_height(&mut self) -> Result<()> { - self.p2pk65.height.write()?; - self.p2pk33.height.write()?; - self.p2pkh.height.write()?; - self.p2sh.height.write()?; - self.p2wpkh.height.write()?; - self.p2wsh.height.write()?; - self.p2tr.height.write()?; - self.p2a.height.write()?; - Ok(()) - } - pub fn truncate_push_height( &mut self, height: Height, diff --git a/crates/brk_computer/src/distribution/block/cache/address.rs b/crates/brk_computer/src/distribution/block/cache/address.rs index a333c6f1d..a6539e0da 100644 --- a/crates/brk_computer/src/distribution/block/cache/address.rs +++ b/crates/brk_computer/src/distribution/block/cache/address.rs @@ -1,6 +1,5 @@ use brk_cohort::ByAddressType; use brk_types::{AnyAddressDataIndexEnum, LoadedAddressData, OutputType, TypeIndex}; -use vecdb::GenericStoredVec; use crate::distribution::{ address::{AddressTypeToTypeIndexMap, AddressesDataVecs, AnyAddressIndexesVecs}, diff --git a/crates/brk_computer/src/distribution/block/cohort/received.rs b/crates/brk_computer/src/distribution/block/cohort/received.rs index 833546ef1..b3c10a6b1 100644 --- a/crates/brk_computer/src/distribution/block/cohort/received.rs +++ b/crates/brk_computer/src/distribution/block/cohort/received.rs @@ -1,5 +1,5 @@ use brk_cohort::{AmountBucket, ByAddressType}; -use brk_types::{Dollars, Sats, TypeIndex}; +use brk_types::{CentsUnsigned, Sats, TypeIndex}; use rustc_hash::FxHashMap; use crate::distribution::{ @@ -14,7 +14,7 @@ pub fn process_received( received_data: AddressTypeToVec<(TypeIndex, Sats)>, cohorts: &mut AddressCohorts, lookup: &mut AddressLookup<'_>, - price: Option, + price: Option, addr_count: &mut ByAddressType, empty_addr_count: &mut ByAddressType, activity_counts: &mut AddressTypeToActivityCounts, @@ -118,7 +118,7 @@ pub fn process_received( .state .as_mut() .unwrap() - .receive_outputs(addr_data, total_value, price, output_count); + .receive_outputs(addr_data, total_value, price.unwrap(), output_count); } } } diff --git a/crates/brk_computer/src/distribution/block/cohort/sent.rs b/crates/brk_computer/src/distribution/block/cohort/sent.rs index e09d5761a..6d4a8583b 100644 --- a/crates/brk_computer/src/distribution/block/cohort/sent.rs +++ b/crates/brk_computer/src/distribution/block/cohort/sent.rs @@ -1,12 +1,13 @@ use brk_cohort::{AmountBucket, ByAddressType}; use brk_error::Result; -use brk_types::{Age, CheckedSub, Dollars, Height, Sats, Timestamp, TypeIndex}; +use brk_types::{Age, CentsUnsigned, CheckedSub, Height, Sats, Timestamp, TypeIndex}; use rustc_hash::FxHashSet; use vecdb::{unlikely, VecIndex}; use crate::distribution::{ address::{AddressTypeToActivityCounts, HeightToAddressTypeToVec}, cohorts::AddressCohorts, + compute::PriceRangeMax, }; use super::super::cache::AddressLookup; @@ -21,17 +22,21 @@ use super::super::cache::AddressLookup; /// /// Note: Takes separate price/timestamp slices instead of chain_state to allow /// parallel execution with UTXO cohort processing (which mutates chain_state). +/// +/// `price_range_max` is used to compute the peak price during each UTXO's holding period +/// for accurate ATH regret calculation. #[allow(clippy::too_many_arguments)] pub fn process_sent( sent_data: HeightToAddressTypeToVec<(TypeIndex, Sats)>, cohorts: &mut AddressCohorts, lookup: &mut AddressLookup<'_>, - current_price: Option, + current_price: Option, + price_range_max: Option<&PriceRangeMax>, addr_count: &mut ByAddressType, empty_addr_count: &mut ByAddressType, activity_counts: &mut AddressTypeToActivityCounts, received_addresses: &ByAddressType>, - height_to_price: Option<&[Dollars]>, + height_to_price: Option<&[CentsUnsigned]>, height_to_timestamp: &[Timestamp], current_height: Height, current_timestamp: Timestamp, @@ -39,12 +44,17 @@ pub fn process_sent( // Track unique senders per address type (simple set, no extra data needed) let mut seen_senders: ByAddressType> = ByAddressType::default(); - for (prev_height, by_type) in sent_data.into_iter() { - let prev_price = height_to_price.map(|v| v[prev_height.to_usize()]); - let prev_timestamp = height_to_timestamp[prev_height.to_usize()]; - let blocks_old = current_height.to_usize() - prev_height.to_usize(); + for (receive_height, by_type) in sent_data.into_iter() { + let prev_price = height_to_price.map(|v| v[receive_height.to_usize()]); + let prev_timestamp = height_to_timestamp[receive_height.to_usize()]; + let blocks_old = current_height.to_usize() - receive_height.to_usize(); let age = Age::new(current_timestamp, prev_timestamp, blocks_old); + // Compute peak price during holding period for ATH regret + // This is the max HIGH price between receive and send heights + let peak_price: Option = + price_range_max.map(|t| t.max_between(receive_height, current_height)); + for (output_type, vec) in by_type.unwrap().into_iter() { // Cache mutable refs for this address type let type_addr_count = addr_count.get_mut(output_type).unwrap(); @@ -91,11 +101,11 @@ pub fn process_sent( ) { panic!( "process_sent: cohort underflow detected!\n\ - Block context: prev_height={:?}, output_type={:?}, type_index={:?}\n\ + Block context: receive_height={:?}, output_type={:?}, type_index={:?}\n\ prev_balance={}, new_balance={}, value={}\n\ will_be_empty={}, crossing_boundary={}\n\ Address: {:?}", - prev_height, + receive_height, output_type, type_index, prev_balance, @@ -141,7 +151,7 @@ pub fn process_sent( .state .as_mut() .unwrap() - .send(addr_data, value, current_price, prev_price, age)?; + .send(addr_data, value, current_price.unwrap(), prev_price.unwrap(), peak_price.unwrap(), age)?; } } } diff --git a/crates/brk_computer/src/distribution/cohorts/address/groups.rs b/crates/brk_computer/src/distribution/cohorts/address/groups.rs index f36b890d9..f372a31b7 100644 --- a/crates/brk_computer/src/distribution/cohorts/address/groups.rs +++ b/crates/brk_computer/src/distribution/cohorts/address/groups.rs @@ -191,11 +191,11 @@ impl AddressCohorts { }); } - /// Reset price_to_amount for all separate cohorts (called during fresh start). - pub fn reset_separate_price_to_amount(&mut self) -> Result<()> { + /// Reset cost_basis_data for all separate cohorts (called during fresh start). + pub fn reset_separate_cost_basis_data(&mut self) -> Result<()> { self.par_iter_separate_mut().try_for_each(|v| { if let Some(state) = v.state.as_mut() { - state.reset_price_to_amount_if_needed()?; + state.reset_cost_basis_data_if_needed()?; } Ok(()) }) diff --git a/crates/brk_computer/src/distribution/cohorts/address/vecs.rs b/crates/brk_computer/src/distribution/cohorts/address/vecs.rs index 51c73a3af..dd30af437 100644 --- a/crates/brk_computer/src/distribution/cohorts/address/vecs.rs +++ b/crates/brk_computer/src/distribution/cohorts/address/vecs.rs @@ -3,7 +3,7 @@ use std::path::Path; use brk_cohort::{CohortContext, Filter, Filtered}; use brk_error::Result; use brk_traversable::Traversable; -use brk_types::{DateIndex, Dollars, Height, StoredU64, Version}; +use brk_types::{CentsUnsigned, DateIndex, Dollars, Height, StoredU64, Version}; use rayon::prelude::*; use vecdb::{AnyStoredVec, AnyVec, Database, Exit, GenericStoredVec, IterableVec}; @@ -145,7 +145,7 @@ impl DynCohortVecs for AddressCohortVecs { // State files are saved AT height H, so to resume at H+1 we need to import at H // Decrement first, then increment result to match expected starting_height if let Some(mut prev_height) = starting_height.decremented() { - // Import price_to_amount state file (may adjust prev_height to actual file found) + // Import cost_basis_data state file (may adjust prev_height to actual file found) prev_height = state.inner.import_at_or_before(prev_height)?; // Restore supply state from height-indexed vectors @@ -164,15 +164,8 @@ impl DynCohortVecs for AddressCohortVecs { .read_once(prev_height)?; state.addr_count = *self.addr_count.height.read_once(prev_height)?; - // Restore realized cap if present - if let Some(realized_metrics) = self.metrics.realized.as_mut() - && let Some(realized_state) = state.inner.realized.as_mut() - { - realized_state.cap = realized_metrics - .realized_cap - .height - .read_once(prev_height)?; - } + // Restore realized cap from persisted exact values + state.inner.restore_realized_cap(); let result = prev_height.incremented(); self.starting_height = Some(result); @@ -216,9 +209,9 @@ impl DynCohortVecs for AddressCohortVecs { fn compute_then_truncate_push_unrealized_states( &mut self, height: Height, - height_price: Option, + height_price: Option, dateindex: Option, - date_price: Option>, + date_price: Option>, ) -> Result<()> { if let Some(state) = self.state.as_mut() { self.metrics.compute_then_truncate_push_unrealized_states( diff --git a/crates/brk_computer/src/distribution/cohorts/traits.rs b/crates/brk_computer/src/distribution/cohorts/traits.rs index 926b2e9ee..3259e02c3 100644 --- a/crates/brk_computer/src/distribution/cohorts/traits.rs +++ b/crates/brk_computer/src/distribution/cohorts/traits.rs @@ -1,5 +1,5 @@ use brk_error::Result; -use brk_types::{DateIndex, Dollars, Height, Version}; +use brk_types::{CentsUnsigned, DateIndex, Dollars, Height, Version}; use vecdb::{Exit, IterableVec}; use crate::{ComputeIndexes, indexes, price}; @@ -30,9 +30,9 @@ pub trait DynCohortVecs: Send + Sync { fn compute_then_truncate_push_unrealized_states( &mut self, height: Height, - height_price: Option, + height_price: Option, dateindex: Option, - date_price: Option>, + date_price: Option>, ) -> Result<()>; /// First phase of post-processing computations. diff --git a/crates/brk_computer/src/distribution/cohorts/utxo/groups.rs b/crates/brk_computer/src/distribution/cohorts/utxo/groups.rs index 71bcf4e79..dbf43a41b 100644 --- a/crates/brk_computer/src/distribution/cohorts/utxo/groups.rs +++ b/crates/brk_computer/src/distribution/cohorts/utxo/groups.rs @@ -1,4 +1,4 @@ -use std::path::Path; +use std::{cmp::Reverse, collections::BinaryHeap, path::Path}; use brk_cohort::{ ByAgeRange, ByAmountRange, ByEpoch, ByGreatEqualAmount, ByLowerThanAmount, ByMaxAge, ByMinAge, @@ -6,16 +6,16 @@ use brk_cohort::{ }; use brk_error::Result; use brk_traversable::Traversable; -use brk_types::{DateIndex, Dollars, Height, Sats, Version}; +use brk_types::{CentsUnsigned, DateIndex, Dollars, Height, Sats, StoredF32, Version}; use derive_more::{Deref, DerefMut}; use rayon::prelude::*; -use vecdb::{AnyStoredVec, Database, Exit, IterableVec}; +use vecdb::{AnyStoredVec, Database, Exit, GenericStoredVec, IterableVec}; use crate::{ ComputeIndexes, distribution::DynCohortVecs, indexes, - internal::{PERCENTILES, PERCENTILES_LEN}, + internal::{PERCENTILES, PERCENTILES_LEN, compute_spot_percentile_rank}, price, }; @@ -288,13 +288,12 @@ impl UTXOCohorts { } /// Get minimum dateindex from all aggregate cohorts' dateindex-indexed vectors. - /// This checks cost_basis percentiles which are only on aggregate cohorts. + /// This checks cost_basis metrics which are only on aggregate cohorts. pub fn min_aggregate_stateful_dateindex_len(&self) -> usize { self.0 .iter_aggregate() .filter_map(|v| v.metrics.cost_basis.as_ref()) - .filter_map(|cb| cb.percentiles.as_ref()) - .map(|cbp| cbp.min_stateful_dateindex_len()) + .map(|cb| cb.min_stateful_dateindex_len()) .min() .unwrap_or(usize::MAX) } @@ -314,35 +313,47 @@ impl UTXOCohorts { }); } - /// Reset price_to_amount for all separate cohorts (called during fresh start). - pub fn reset_separate_price_to_amount(&mut self) -> Result<()> { + /// Reset cost_basis_data for all separate cohorts (called during fresh start). + pub fn reset_separate_cost_basis_data(&mut self) -> Result<()> { self.par_iter_separate_mut().try_for_each(|v| { if let Some(state) = v.state.as_mut() { - state.reset_price_to_amount_if_needed()?; + state.reset_cost_basis_data_if_needed()?; } Ok(()) }) } /// Compute and push percentiles for aggregate cohorts (all, sth, lth). - /// Computes on-demand by merging age_range cohorts' price_to_amount data. - /// This avoids maintaining redundant aggregate price_to_amount maps. - pub fn truncate_push_aggregate_percentiles(&mut self, dateindex: DateIndex) -> Result<()> { - use std::cmp::Reverse; - use std::collections::BinaryHeap; - - // Collect (filter, supply, price_to_amount as Vec) from age_range cohorts + /// Computes on-demand by merging age_range cohorts' cost_basis_data data. + /// This avoids maintaining redundant aggregate cost_basis_data maps. + /// Computes both sat-weighted (percentiles) and USD-weighted (invested_capital) percentiles. + pub fn truncate_push_aggregate_percentiles( + &mut self, + dateindex: DateIndex, + spot: Dollars, + ) -> Result<()> { + // Collect (filter, entries, total_sats, total_usd) from age_range cohorts. + // Keep data in CentsUnsigned to avoid float conversions until output. + // Compute totals during collection to avoid a second pass. let age_range_data: Vec<_> = self .0 .age_range .iter() .filter_map(|sub| { let state = sub.state.as_ref()?; - let entries: Vec<(Dollars, Sats)> = state - .price_to_amount_iter()? - .map(|(p, &a)| (p, a)) + let mut total_sats: u64 = 0; + let mut total_usd: u128 = 0; + let entries: Vec<(CentsUnsigned, 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(), state.supply.value, entries)) + Some((sub.filter().clone(), entries, total_sats, total_usd)) }) .collect(); @@ -350,72 +361,109 @@ impl UTXOCohorts { for aggregate in self.0.iter_aggregate_mut() { let filter = aggregate.filter().clone(); - // Get cost_basis percentiles storage, skip if not configured - let Some(percentiles) = aggregate - .metrics - .cost_basis - .as_mut() - .and_then(|cb| cb.percentiles.as_mut()) - else { + // Get cost_basis, skip if not configured + let Some(cost_basis) = aggregate.metrics.cost_basis.as_mut() else { continue; }; - // Collect relevant cohort data for this aggregate + // Collect relevant cohort data for this aggregate and sum totals + 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)) + .filter(|(sub_filter, _, _, _)| filter.includes(sub_filter)) + .map(|(_, entries, cohort_sats, cohort_usd)| { + total_sats += cohort_sats; + total_usd += cohort_usd; + entries + }) .collect(); - // Calculate total supply - let total_supply: u64 = relevant.iter().map(|(_, s, _)| u64::from(*s)).sum(); - - if total_supply == 0 { - percentiles.truncate_push(dateindex, &[Dollars::NAN; PERCENTILES_LEN])?; + if total_sats == 0 { + let nan_prices = [Dollars::NAN; PERCENTILES_LEN]; + if let Some(percentiles) = cost_basis.percentiles.as_mut() { + percentiles.truncate_push(dateindex, &nan_prices)?; + } + if let Some(invested_capital) = cost_basis.invested_capital.as_mut() { + invested_capital.truncate_push(dateindex, &nan_prices)?; + } + if let Some(spot_pct) = cost_basis.spot_cost_basis_percentile.as_mut() { + spot_pct + .dateindex + .truncate_push(dateindex, StoredF32::NAN)?; + } + if let Some(spot_pct) = cost_basis.spot_invested_capital_percentile.as_mut() { + spot_pct + .dateindex + .truncate_push(dateindex, StoredF32::NAN)?; + } continue; } // K-way merge using min-heap: O(n log k) where k = number of cohorts - // Each heap entry: (price, amount, cohort_idx, entry_idx) - let mut heap: BinaryHeap> = BinaryHeap::new(); + let mut heap: BinaryHeap> = BinaryHeap::new(); // Initialize heap with first entry from each cohort - for (cohort_idx, (_, _, entries)) in relevant.iter().enumerate() { + for (cohort_idx, entries) in relevant.iter().enumerate() { if !entries.is_empty() { heap.push(Reverse((entries[0].0, cohort_idx, 0))); } } - let targets = PERCENTILES.map(|p| total_supply * u64::from(p) / 100); - let mut result = [Dollars::NAN; PERCENTILES_LEN]; - let mut accumulated = 0u64; - let mut pct_idx = 0; - let mut current_price: Option = None; - let mut amount_at_price = 0u64; + // Compute both sat-weighted and USD-weighted percentiles in one pass + 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 = [Dollars::NAN; PERCENTILES_LEN]; + let mut usd_result = [Dollars::NAN; 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; while let Some(Reverse((price, cohort_idx, entry_idx))) = heap.pop() { - let (_, _, entries) = relevant[cohort_idx]; + let entries = relevant[cohort_idx]; let (_, amount) = entries[entry_idx]; + let amount_u64 = u64::from(amount); + let price_u128 = price.as_u128(); // If price changed, finalize previous price - if let Some(current_price) = current_price - && current_price != price + if let Some(prev_price) = current_price + && prev_price != price { - accumulated += amount_at_price; + cumsum_sats += sats_at_price; + cumsum_usd += usd_at_price; - while pct_idx < PERCENTILES_LEN && accumulated >= targets[pct_idx] { - result[pct_idx] = current_price; - pct_idx += 1; + // Only convert to dollars if we still need percentiles + if sat_idx < PERCENTILES_LEN || usd_idx < PERCENTILES_LEN { + let prev_dollars = prev_price.to_dollars(); + while sat_idx < PERCENTILES_LEN && cumsum_sats >= sat_targets[sat_idx] { + sat_result[sat_idx] = prev_dollars; + sat_idx += 1; + } + while usd_idx < PERCENTILES_LEN && cumsum_usd >= usd_targets[usd_idx] { + usd_result[usd_idx] = prev_dollars; + usd_idx += 1; + } + + // Early exit if all percentiles found + if sat_idx >= PERCENTILES_LEN && usd_idx >= PERCENTILES_LEN { + break; + } } - if pct_idx >= PERCENTILES_LEN { - break; - } - - amount_at_price = 0; + sats_at_price = 0; + usd_at_price = 0; } current_price = Some(price); - amount_at_price += u64::from(amount); + sats_at_price += amount_u64; + usd_at_price += price_u128 * amount_u64 as u128; // Push next entry from this cohort let next_idx = entry_idx + 1; @@ -424,16 +472,41 @@ impl UTXOCohorts { } } - // Finalize last price - if let Some(price) = current_price { - accumulated += amount_at_price; - while pct_idx < PERCENTILES_LEN && accumulated >= targets[pct_idx] { - result[pct_idx] = price; - pct_idx += 1; + // Finalize last price (skip if we already found all percentiles via early exit) + if (sat_idx < PERCENTILES_LEN || usd_idx < PERCENTILES_LEN) + && let Some(price) = current_price + { + cumsum_sats += sats_at_price; + cumsum_usd += usd_at_price; + + let price_dollars = price.to_dollars(); + while sat_idx < PERCENTILES_LEN && cumsum_sats >= sat_targets[sat_idx] { + sat_result[sat_idx] = price_dollars; + sat_idx += 1; + } + while usd_idx < PERCENTILES_LEN && cumsum_usd >= usd_targets[usd_idx] { + usd_result[usd_idx] = price_dollars; + usd_idx += 1; } } - percentiles.truncate_push(dateindex, &result)?; + // Push both sat-weighted and USD-weighted results + if let Some(percentiles) = cost_basis.percentiles.as_mut() { + percentiles.truncate_push(dateindex, &sat_result)?; + } + if let Some(invested_capital) = cost_basis.invested_capital.as_mut() { + invested_capital.truncate_push(dateindex, &usd_result)?; + } + + // Compute and push spot percentile ranks + if let Some(spot_pct) = cost_basis.spot_cost_basis_percentile.as_mut() { + let rank = compute_spot_percentile_rank(&sat_result, spot); + spot_pct.dateindex.truncate_push(dateindex, rank)?; + } + if let Some(spot_pct) = cost_basis.spot_invested_capital_percentile.as_mut() { + let rank = compute_spot_percentile_rank(&usd_result, spot); + spot_pct.dateindex.truncate_push(dateindex, rank)?; + } } Ok(()) diff --git a/crates/brk_computer/src/distribution/cohorts/utxo/receive.rs b/crates/brk_computer/src/distribution/cohorts/utxo/receive.rs index 9bef77d01..c7cb6c0a1 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::{Dollars, Height, Timestamp}; +use brk_types::{CentsUnsigned, Height, Timestamp}; use crate::distribution::state::Transacted; @@ -18,7 +18,7 @@ impl UTXOCohorts { received: Transacted, height: Height, timestamp: Timestamp, - price: Option, + price: Option, ) { let supply_state = received.spendable_supply; @@ -30,7 +30,7 @@ impl UTXOCohorts { ] .into_iter() .for_each(|v| { - v.state.as_mut().unwrap().receive(&supply_state, price); + v.state.as_mut().unwrap().receive_utxo(&supply_state, price); }); // Update output type cohorts @@ -40,7 +40,7 @@ impl UTXOCohorts { vecs.state .as_mut() .unwrap() - .receive(received.by_type.get(output_type), price) + .receive_utxo(received.by_type.get(output_type), price) }); // Update amount range cohorts @@ -53,7 +53,7 @@ impl UTXOCohorts { .state .as_mut() .unwrap() - .receive(supply_state, price); + .receive_utxo(supply_state, price); }); } } diff --git a/crates/brk_computer/src/distribution/cohorts/utxo/send.rs b/crates/brk_computer/src/distribution/cohorts/utxo/send.rs index 14bb99705..d107171cd 100644 --- a/crates/brk_computer/src/distribution/cohorts/utxo/send.rs +++ b/crates/brk_computer/src/distribution/cohorts/utxo/send.rs @@ -1,9 +1,12 @@ -use brk_types::{Age, Height}; +use brk_types::{Age, CentsUnsigned, Height}; use rustc_hash::FxHashMap; use vecdb::VecIndex; use crate::{ - distribution::state::{BlockState, Transacted}, + distribution::{ + compute::PriceRangeMax, + state::{BlockState, Transacted}, + }, utils::OptionExt, }; @@ -14,10 +17,14 @@ impl UTXOCohorts { /// /// Each input references a UTXO created at some previous height. /// We need to update the cohort states based on when that UTXO was created. + /// + /// `price_range_max` is used to compute the peak price during each UTXO's holding period + /// for accurate ATH regret calculation. pub fn send( &mut self, height_to_sent: FxHashMap, chain_state: &mut [BlockState], + price_range_max: Option<&PriceRangeMax>, ) { if chain_state.is_empty() { return; @@ -27,31 +34,44 @@ impl UTXOCohorts { let last_timestamp = last_block.timestamp; let current_price = last_block.price; let chain_len = chain_state.len(); + let send_height = Height::from(chain_len - 1); - for (height, sent) in height_to_sent { + for (receive_height, sent) in height_to_sent { // Update chain_state to reflect spent supply - chain_state[height.to_usize()].supply -= &sent.spendable_supply; + chain_state[receive_height.to_usize()].supply -= &sent.spendable_supply; - let block_state = &chain_state[height.to_usize()]; + let block_state = &chain_state[receive_height.to_usize()]; let prev_price = block_state.price; - let blocks_old = chain_len - 1 - height.to_usize(); + let blocks_old = chain_len - 1 - receive_height.to_usize(); let age = Age::new(last_timestamp, block_state.timestamp, blocks_old); + // Compute peak price during holding period for ATH regret + // This is the max HIGH price between receive and send heights + let peak_price: Option = + price_range_max.map(|t| t.max_between(receive_height, send_height)); + // Update age range cohort (direct index lookup) - self.0.age_range.get_mut(age).state.um().send( + self.0.age_range.get_mut(age).state.um().send_utxo( &sent.spendable_supply, current_price, prev_price, + peak_price, age, ); // Update epoch cohort (direct lookup by height) - self.0.epoch.mut_vec_from_height(height).state.um().send( - &sent.spendable_supply, - current_price, - prev_price, - age, - ); + self.0 + .epoch + .mut_vec_from_height(receive_height) + .state + .um() + .send_utxo( + &sent.spendable_supply, + current_price, + prev_price, + peak_price, + age, + ); // Update year cohort (direct lookup by timestamp) self.0 @@ -59,7 +79,13 @@ impl UTXOCohorts { .mut_vec_from_timestamp(block_state.timestamp) .state .um() - .send(&sent.spendable_supply, current_price, prev_price, age); + .send_utxo( + &sent.spendable_supply, + current_price, + prev_price, + peak_price, + age, + ); // Update output type cohorts sent.by_type @@ -71,7 +97,7 @@ impl UTXOCohorts { .get_mut(output_type) .state .um() - .send(supply_state, current_price, prev_price, age) + .send_utxo(supply_state, current_price, prev_price, peak_price, age) }); // Update amount range cohorts @@ -83,7 +109,7 @@ impl UTXOCohorts { .get_mut(group) .state .um() - .send(supply_state, current_price, prev_price, age); + .send_utxo(supply_state, current_price, prev_price, peak_price, age); }); } } diff --git a/crates/brk_computer/src/distribution/cohorts/utxo/vecs.rs b/crates/brk_computer/src/distribution/cohorts/utxo/vecs.rs index ee84c6777..3fd2515a8 100644 --- a/crates/brk_computer/src/distribution/cohorts/utxo/vecs.rs +++ b/crates/brk_computer/src/distribution/cohorts/utxo/vecs.rs @@ -3,7 +3,7 @@ use std::path::Path; use brk_cohort::{CohortContext, Filter, Filtered, StateLevel}; use brk_error::Result; use brk_traversable::Traversable; -use brk_types::{DateIndex, Dollars, Height, Version}; +use brk_types::{CentsUnsigned, DateIndex, Dollars, Height, Version}; use rayon::prelude::*; use vecdb::{AnyStoredVec, Database, Exit, IterableVec}; @@ -142,7 +142,7 @@ impl DynCohortVecs for UTXOCohortVecs { // State files are saved AT height H, so to resume at H+1 we need to import at H // Decrement first, then increment result to match expected starting_height if let Some(mut prev_height) = starting_height.decremented() { - // Import price_to_amount state file (may adjust prev_height to actual file found) + // Import cost_basis_data state file (may adjust prev_height to actual file found) prev_height = state.import_at_or_before(prev_height)?; // Restore supply state from height-indexed vectors @@ -160,15 +160,8 @@ impl DynCohortVecs for UTXOCohortVecs { .height .read_once(prev_height)?; - // Restore realized cap if present - if let Some(realized_metrics) = self.metrics.realized.as_mut() - && let Some(realized_state) = state.realized.as_mut() - { - realized_state.cap = realized_metrics - .realized_cap - .height - .read_once(prev_height)?; - } + // Restore realized cap from persisted exact values + state.restore_realized_cap(); let result = prev_height.incremented(); self.state_starting_height = Some(result); @@ -204,9 +197,9 @@ impl DynCohortVecs for UTXOCohortVecs { fn compute_then_truncate_push_unrealized_states( &mut self, height: Height, - height_price: Option, + height_price: Option, dateindex: Option, - date_price: Option>, + date_price: Option>, ) -> Result<()> { if let Some(state) = self.state.as_mut() { self.metrics.compute_then_truncate_push_unrealized_states( diff --git a/crates/brk_computer/src/distribution/compute/block_loop.rs b/crates/brk_computer/src/distribution/compute/block_loop.rs index 90b776fdc..4a348447d 100644 --- a/crates/brk_computer/src/distribution/compute/block_loop.rs +++ b/crates/brk_computer/src/distribution/compute/block_loop.rs @@ -3,7 +3,7 @@ use std::thread; use brk_cohort::ByAddressType; use brk_error::Result; use brk_indexer::Indexer; -use brk_types::{DateIndex, Height, OutputType, Sats, TxIndex, TypeIndex}; +use brk_types::{CentsUnsigned, DateIndex, Dollars, Height, OutputType, Sats, TxIndex, TypeIndex}; use rayon::prelude::*; use rustc_hash::FxHashSet; use tracing::info; @@ -75,9 +75,9 @@ pub fn process_blocks( let txindex_to_output_count = &indexes.txindex.output_count; let txindex_to_input_count = &indexes.txindex.input_count; - // From price (optional): - let height_to_price = price.map(|p| &p.usd.split.close.height); - let dateindex_to_price = price.map(|p| &p.usd.split.close.dateindex); + // From price (optional) - use cents for computation: + let height_to_price = price.map(|p| &p.cents.split.height.close); + let dateindex_to_price = price.map(|p| &p.cents.split.dateindex.close); // Access pre-computed vectors from context for thread-safe access let height_to_price_vec = &ctx.height_to_price; @@ -329,6 +329,7 @@ pub fn process_blocks( &mut vecs.address_cohorts, &mut lookup, block_price, + ctx.price_range_max.as_ref(), &mut addr_counts, &mut empty_addr_counts, &mut activity_counts, @@ -344,7 +345,8 @@ pub fn process_blocks( // Main thread: Update UTXO cohorts vecs.utxo_cohorts .receive(transacted, height, timestamp, block_price); - vecs.utxo_cohorts.send(height_to_sent, chain_state); + vecs.utxo_cohorts + .send(height_to_sent, chain_state, ctx.price_range_max.as_ref()); }); // Push to height-indexed vectors @@ -382,8 +384,12 @@ pub fn process_blocks( // Compute and push percentiles for aggregate cohorts (all, sth, lth) if let Some(dateindex) = dateindex_opt { + let spot = date_price + .flatten() + .map(|c| c.to_dollars()) + .unwrap_or(Dollars::NAN); vecs.utxo_cohorts - .truncate_push_aggregate_percentiles(dateindex)?; + .truncate_push_aggregate_percentiles(dateindex, spot)?; } // Periodic checkpoint flush @@ -456,9 +462,9 @@ fn push_cohort_states( utxo_cohorts: &mut UTXOCohorts, address_cohorts: &mut AddressCohorts, height: Height, - height_price: Option, + height_price: Option, dateindex: Option, - date_price: Option>, + date_price: Option>, ) -> Result<()> { // utxo_cohorts.iter_separate_mut().try_for_each(|v| { utxo_cohorts.par_iter_separate_mut().try_for_each(|v| { diff --git a/crates/brk_computer/src/distribution/compute/context.rs b/crates/brk_computer/src/distribution/compute/context.rs index 303c60095..086ee90cb 100644 --- a/crates/brk_computer/src/distribution/compute/context.rs +++ b/crates/brk_computer/src/distribution/compute/context.rs @@ -1,8 +1,99 @@ -use brk_types::{Dollars, Height, Timestamp}; +use std::time::Instant; + +use brk_types::{CentsUnsigned, Height, Timestamp}; +use tracing::debug; use vecdb::VecIndex; use crate::{blocks, price}; +/// Sparse table for O(1) range maximum queries on prices. +/// Uses O(n log n) space (~140MB for 880k blocks). +pub struct PriceRangeMax { + /// Flattened table: table[k * n + i] = max of 2^k elements starting at index i + /// Using flat layout for better cache locality. + table: Vec, + /// Number of elements + n: usize, +} + +impl PriceRangeMax { + /// Build sparse table from high prices. O(n log n) time and space. + pub fn build(prices: &[CentsUnsigned]) -> Self { + let start = Instant::now(); + + let n = prices.len(); + if n == 0 { + return Self { + table: vec![], + n: 0, + }; + } + + // levels = floor(log2(n)) + 1 + let levels = (usize::BITS - n.leading_zeros()) as usize; + + // Allocate flat table: levels * n elements + let mut table = vec![CentsUnsigned::ZERO; levels * n]; + + // Base case: level 0 = original prices + table[..n].copy_from_slice(prices); + + // Build each level from the previous + // table[k][i] = max(table[k-1][i], table[k-1][i + 2^(k-1)]) + for k in 1..levels { + let prev_offset = (k - 1) * n; + let curr_offset = k * n; + let half = 1 << (k - 1); + let end = n.saturating_sub(1 << k) + 1; + + // Use split_at_mut to avoid bounds checks in the loop + let (prev_level, rest) = table.split_at_mut(curr_offset); + let prev = &prev_level[prev_offset..prev_offset + n]; + let curr = &mut rest[..n]; + + for i in 0..end { + curr[i] = prev[i].max(prev[i + half]); + } + } + + let elapsed = start.elapsed(); + debug!( + "PriceRangeMax built: {} heights, {} levels, {:.2}MB, {:.2}ms", + n, + levels, + (levels * n * std::mem::size_of::()) as f64 / 1_000_000.0, + elapsed.as_secs_f64() * 1000.0 + ); + + Self { table, n } + } + + /// Query maximum value in range [l, r] (inclusive). O(1) time. + #[inline] + pub fn range_max(&self, l: usize, r: usize) -> CentsUnsigned { + debug_assert!(l <= r && r < self.n); + + let len = r - l + 1; + // k = floor(log2(len)) + let k = (usize::BITS - len.leading_zeros() - 1) as usize; + let half = 1 << k; + + // max of [l, l + 2^k) and [r - 2^k + 1, r + 1) + let offset = k * self.n; + unsafe { + let a = *self.table.get_unchecked(offset + l); + let b = *self.table.get_unchecked(offset + r + 1 - half); + a.max(b) + } + } + + /// Query maximum value in height range. O(1) time. + #[inline] + pub fn max_between(&self, from: Height, to: Height) -> CentsUnsigned { + self.range_max(from.to_usize(), to.to_usize()) + } +} + /// Context shared across block processing. pub struct ComputeContext { /// Starting height for this computation run @@ -15,7 +106,11 @@ pub struct ComputeContext { pub height_to_timestamp: Vec, /// Pre-computed height -> price mapping (if available) - pub height_to_price: Option>, + pub height_to_price: Option>, + + /// Sparse table for O(1) range max queries on high prices. + /// Used for computing max price during UTXO holding periods (ATH regret). + pub price_range_max: Option, } impl ComputeContext { @@ -29,20 +124,28 @@ impl ComputeContext { let height_to_timestamp: Vec = blocks.time.timestamp_monotonic.into_iter().collect(); - let height_to_price: Option> = price - .map(|p| &p.usd.split.close.height) - .map(|v| v.into_iter().map(|d| *d).collect()); + let height_to_price: Option> = price + .map(|p| &p.cents.split.height.close) + .map(|v| v.into_iter().map(|c| *c).collect()); + + // Build sparse table for O(1) range max queries on HIGH prices + // Used for computing peak price during UTXO holding periods (ATH regret) + let price_range_max = price + .map(|p| &p.cents.split.height.high) + .map(|v| v.into_iter().map(|c| *c).collect::>()) + .map(|prices| PriceRangeMax::build(&prices)); Self { starting_height, last_height, height_to_timestamp, height_to_price, + price_range_max, } } /// Get price at height (None if no price data or height out of range). - pub fn price_at(&self, height: Height) -> Option { + pub fn price_at(&self, height: Height) -> Option { self.height_to_price .as_ref()? .get(height.to_usize()) diff --git a/crates/brk_computer/src/distribution/compute/mod.rs b/crates/brk_computer/src/distribution/compute/mod.rs index a2bba0faa..4d8f11ad7 100644 --- a/crates/brk_computer/src/distribution/compute/mod.rs +++ b/crates/brk_computer/src/distribution/compute/mod.rs @@ -6,7 +6,7 @@ mod recover; mod write; pub use block_loop::process_blocks; -pub use context::ComputeContext; +pub use context::{ComputeContext, PriceRangeMax}; pub use readers::{ TxInIterators, TxOutData, TxOutIterators, VecsReaders, build_txinindex_to_txindex, build_txoutindex_to_txindex, diff --git a/crates/brk_computer/src/distribution/compute/recover.rs b/crates/brk_computer/src/distribution/compute/recover.rs index ba6833e44..119fdadd1 100644 --- a/crates/brk_computer/src/distribution/compute/recover.rs +++ b/crates/brk_computer/src/distribution/compute/recover.rs @@ -108,9 +108,9 @@ pub fn reset_state( utxo_cohorts.reset_separate_state_heights(); address_cohorts.reset_separate_state_heights(); - // Reset price_to_amount for all cohorts - utxo_cohorts.reset_separate_price_to_amount()?; - address_cohorts.reset_separate_price_to_amount()?; + // Reset cost_basis_data for all cohorts + utxo_cohorts.reset_separate_cost_basis_data()?; + address_cohorts.reset_separate_cost_basis_data()?; Ok(RecoveredState { starting_height: Height::ZERO, diff --git a/crates/brk_computer/src/distribution/metrics/activity.rs b/crates/brk_computer/src/distribution/metrics/activity.rs index cd93dd3e6..d0d36614b 100644 --- a/crates/brk_computer/src/distribution/metrics/activity.rs +++ b/crates/brk_computer/src/distribution/metrics/activity.rs @@ -96,14 +96,6 @@ impl ActivityMetrics { Ok(()) } - /// Write height-indexed vectors to disk. - pub fn write(&mut self) -> Result<()> { - self.sent.sats.height.write()?; - self.satblocks_destroyed.write()?; - self.satdays_destroyed.write()?; - Ok(()) - } - /// Returns a parallel iterator over all vecs for parallel writing. pub fn par_iter_mut(&mut self) -> impl ParallelIterator { vec![ diff --git a/crates/brk_computer/src/distribution/metrics/config.rs b/crates/brk_computer/src/distribution/metrics/config.rs index dd2d7d5a2..eeae93bd3 100644 --- a/crates/brk_computer/src/distribution/metrics/config.rs +++ b/crates/brk_computer/src/distribution/metrics/config.rs @@ -41,6 +41,11 @@ impl<'a> ImportConfig<'a> { self.filter.compute_adjusted(self.context) } + /// Whether to compute relative metrics (invested capital %, NUPL ratios, etc.). + pub fn compute_relative(&self) -> bool { + self.filter.compute_relative() + } + /// Get full metric name with filter prefix. pub fn name(&self, suffix: &str) -> String { if self.full_name.is_empty() { diff --git a/crates/brk_computer/src/distribution/metrics/cost_basis.rs b/crates/brk_computer/src/distribution/metrics/cost_basis.rs index 73c53f47b..db1d9973b 100644 --- a/crates/brk_computer/src/distribution/metrics/cost_basis.rs +++ b/crates/brk_computer/src/distribution/metrics/cost_basis.rs @@ -1,6 +1,6 @@ use brk_error::Result; use brk_traversable::Traversable; -use brk_types::{DateIndex, Dollars, Height, Version}; +use brk_types::{DateIndex, Dollars, Height, StoredF32, Version}; use rayon::prelude::*; use vecdb::{AnyStoredVec, AnyVec, Exit, GenericStoredVec}; @@ -8,7 +8,10 @@ use crate::{ ComputeIndexes, distribution::state::CohortState, indexes, - internal::{CostBasisPercentiles, PriceFromHeight}, + internal::{ + ComputedFromDateLast, PERCENTILES_LEN, PercentilesVecs, PriceFromHeight, + compute_spot_percentile_rank, + }, }; use super::ImportConfig; @@ -22,8 +25,17 @@ pub struct CostBasisMetrics { /// Maximum cost basis for any UTXO at this height pub max: PriceFromHeight, - /// Cost basis distribution percentiles (median, quartiles, etc.) - pub percentiles: Option, + /// Cost basis percentiles (sat-weighted) + pub percentiles: Option, + + /// Invested capital percentiles (USD-weighted) + pub invested_capital: Option, + + /// What percentile of cost basis is below spot (sat-weighted) + pub spot_cost_basis_percentile: Option>, + + /// What percentile of invested capital is below spot (USD-weighted) + pub spot_invested_capital_percentile: Option>, } impl CostBasisMetrics { @@ -46,15 +58,46 @@ impl CostBasisMetrics { )?, percentiles: extended .then(|| { - CostBasisPercentiles::forced_import( + PercentilesVecs::forced_import( cfg.db, - &cfg.name(""), + &cfg.name("cost_basis"), cfg.version, cfg.indexes, true, ) }) .transpose()?, + invested_capital: extended + .then(|| { + PercentilesVecs::forced_import( + cfg.db, + &cfg.name("invested_capital"), + cfg.version, + cfg.indexes, + true, + ) + }) + .transpose()?, + spot_cost_basis_percentile: extended + .then(|| { + ComputedFromDateLast::forced_import( + cfg.db, + &cfg.name("spot_cost_basis_percentile"), + cfg.version, + cfg.indexes, + ) + }) + .transpose()?, + spot_invested_capital_percentile: extended + .then(|| { + ComputedFromDateLast::forced_import( + cfg.db, + &cfg.name("spot_invested_capital_percentile"), + cfg.version, + cfg.indexes, + ) + }) + .transpose()?, }) } @@ -69,6 +112,24 @@ impl CostBasisMetrics { .as_ref() .map(|p| p.min_stateful_dateindex_len()) .unwrap_or(usize::MAX) + .min( + self.invested_capital + .as_ref() + .map(|p| p.min_stateful_dateindex_len()) + .unwrap_or(usize::MAX), + ) + .min( + self.spot_cost_basis_percentile + .as_ref() + .map(|v| v.dateindex.len()) + .unwrap_or(usize::MAX), + ) + .min( + self.spot_invested_capital_percentile + .as_ref() + .map(|v| v.dateindex.len()) + .unwrap_or(usize::MAX), + ) } /// Push min/max cost basis from state. @@ -76,15 +137,15 @@ impl CostBasisMetrics { self.min.height.truncate_push( height, state - .price_to_amount_first_key_value() - .map(|(dollars, _)| dollars) + .cost_basis_data_first_key_value() + .map(|(cents, _)| cents.into()) .unwrap_or(Dollars::NAN), )?; self.max.height.truncate_push( height, state - .price_to_amount_last_key_value() - .map(|(dollars, _)| dollars) + .cost_basis_data_last_key_value() + .map(|(cents, _)| cents.into()) .unwrap_or(Dollars::NAN), )?; Ok(()) @@ -96,21 +157,38 @@ impl CostBasisMetrics { &mut self, dateindex: DateIndex, state: &CohortState, + spot: Dollars, ) -> Result<()> { - if let Some(percentiles) = self.percentiles.as_mut() { - let percentile_prices = state.compute_percentile_prices(); - percentiles.truncate_push(dateindex, &percentile_prices)?; - } - Ok(()) - } + let computed = state.compute_percentiles(); + + // Push sat-weighted percentiles and spot rank + let sat_prices = computed + .as_ref() + .map(|p| p.sat_weighted.map(|c| c.to_dollars())) + .unwrap_or([Dollars::NAN; PERCENTILES_LEN]); - /// Write height-indexed vectors to disk. - pub fn write(&mut self) -> Result<()> { - self.min.height.write()?; - self.max.height.write()?; if let Some(percentiles) = self.percentiles.as_mut() { - percentiles.write()?; + percentiles.truncate_push(dateindex, &sat_prices)?; } + if let Some(spot_pct) = self.spot_cost_basis_percentile.as_mut() { + let rank = compute_spot_percentile_rank(&sat_prices, spot); + spot_pct.dateindex.truncate_push(dateindex, rank)?; + } + + // Push USD-weighted percentiles and spot rank + let usd_prices = computed + .as_ref() + .map(|p| p.usd_weighted.map(|c| c.to_dollars())) + .unwrap_or([Dollars::NAN; PERCENTILES_LEN]); + + if let Some(invested_capital) = self.invested_capital.as_mut() { + invested_capital.truncate_push(dateindex, &usd_prices)?; + } + if let Some(spot_pct) = self.spot_invested_capital_percentile.as_mut() { + let rank = compute_spot_percentile_rank(&usd_prices, spot); + spot_pct.dateindex.truncate_push(dateindex, rank)?; + } + Ok(()) } @@ -126,6 +204,21 @@ impl CostBasisMetrics { .map(|v| &mut v.dateindex as &mut dyn AnyStoredVec), ); } + if let Some(invested_capital) = self.invested_capital.as_mut() { + vecs.extend( + invested_capital + .vecs + .iter_mut() + .flatten() + .map(|v| &mut v.dateindex as &mut dyn AnyStoredVec), + ); + } + if let Some(v) = self.spot_cost_basis_percentile.as_mut() { + vecs.push(&mut v.dateindex); + } + if let Some(v) = self.spot_invested_capital_percentile.as_mut() { + vecs.push(&mut v.dateindex); + } vecs.into_par_iter() } @@ -134,6 +227,15 @@ impl CostBasisMetrics { if let Some(percentiles) = self.percentiles.as_mut() { percentiles.validate_computed_version_or_reset(base_version)?; } + if let Some(invested_capital) = self.invested_capital.as_mut() { + invested_capital.validate_computed_version_or_reset(base_version)?; + } + if let Some(v) = self.spot_cost_basis_percentile.as_mut() { + v.dateindex.validate_computed_version_or_reset(base_version)?; + } + if let Some(v) = self.spot_invested_capital_percentile.as_mut() { + v.dateindex.validate_computed_version_or_reset(base_version)?; + } Ok(()) } diff --git a/crates/brk_computer/src/distribution/metrics/mod.rs b/crates/brk_computer/src/distribution/metrics/mod.rs index 0ce788c3f..9aca56cdf 100644 --- a/crates/brk_computer/src/distribution/metrics/mod.rs +++ b/crates/brk_computer/src/distribution/metrics/mod.rs @@ -19,7 +19,7 @@ pub use unrealized::*; use brk_cohort::Filter; use brk_error::Result; use brk_traversable::Traversable; -use brk_types::{DateIndex, Dollars, Height, Version}; +use brk_types::{CentsUnsigned, DateIndex, Dollars, Height, Version}; use rayon::prelude::*; use vecdb::{AnyStoredVec, Exit, IterableVec}; @@ -69,9 +69,20 @@ impl CohortMetrics { .then(|| UnrealizedMetrics::forced_import(cfg)) .transpose()?; - let relative = unrealized - .as_ref() - .map(|u| RelativeMetrics::forced_import(cfg, u, &supply, all_supply)) + let realized = compute_dollars + .then(|| RealizedMetrics::forced_import(cfg)) + .transpose()?; + + let relative = (cfg.compute_relative() && unrealized.is_some()) + .then(|| { + RelativeMetrics::forced_import( + cfg, + unrealized.as_ref().unwrap(), + &supply, + all_supply, + realized.as_ref(), + ) + }) .transpose()?; Ok(Self { @@ -79,9 +90,7 @@ impl CohortMetrics { supply, outputs, activity: ActivityMetrics::forced_import(cfg)?, - realized: compute_dollars - .then(|| RealizedMetrics::forced_import(cfg)) - .transpose()?, + realized, cost_basis: compute_dollars .then(|| CostBasisMetrics::forced_import(cfg)) .transpose()?, @@ -146,27 +155,6 @@ impl CohortMetrics { Ok(()) } - /// Write height-indexed vectors to disk. - pub fn write(&mut self) -> Result<()> { - self.supply.write()?; - self.outputs.write()?; - self.activity.write()?; - - if let Some(realized) = self.realized.as_mut() { - realized.write()?; - } - - if let Some(unrealized) = self.unrealized.as_mut() { - unrealized.write()?; - } - - if let Some(cost_basis) = self.cost_basis.as_mut() { - cost_basis.write()?; - } - - Ok(()) - } - /// Returns a parallel iterator over all vecs for parallel writing. pub fn par_iter_mut(&mut self) -> impl ParallelIterator { let mut vecs: Vec<&mut dyn AnyStoredVec> = Vec::new(); @@ -211,9 +199,9 @@ impl CohortMetrics { pub fn compute_then_truncate_push_unrealized_states( &mut self, height: Height, - height_price: Option, + height_price: Option, dateindex: Option, - date_price: Option>, + date_price: Option>, state: &mut CohortState, ) -> Result<()> { // Apply pending updates before reading @@ -238,7 +226,11 @@ impl CohortMetrics { // Only compute expensive percentiles at date boundaries (~144x reduction) if let Some(dateindex) = dateindex { - cost_basis.truncate_push_percentiles(dateindex, state)?; + let spot = date_price + .unwrap() + .map(|c| c.to_dollars()) + .unwrap_or(Dollars::NAN); + cost_basis.truncate_push_percentiles(dateindex, state, spot)?; } } @@ -323,7 +315,7 @@ impl CohortMetrics { } if let Some(unrealized) = self.unrealized.as_mut() { - unrealized.compute_rest_part1(price, starting_indexes, exit)?; + unrealized.compute_rest(indexes, price, starting_indexes, exit)?; } if let Some(cost_basis) = self.cost_basis.as_mut() { diff --git a/crates/brk_computer/src/distribution/metrics/outputs.rs b/crates/brk_computer/src/distribution/metrics/outputs.rs index 6723060d9..d7d856b0f 100644 --- a/crates/brk_computer/src/distribution/metrics/outputs.rs +++ b/crates/brk_computer/src/distribution/metrics/outputs.rs @@ -40,12 +40,6 @@ impl OutputsMetrics { Ok(()) } - /// Write height-indexed vectors to disk. - pub fn write(&mut self) -> Result<()> { - self.utxo_count.height.write()?; - Ok(()) - } - /// Returns a parallel iterator over all vecs for parallel writing. pub fn par_iter_mut(&mut self) -> impl ParallelIterator { vec![&mut self.utxo_count.height as &mut dyn AnyStoredVec].into_par_iter() diff --git a/crates/brk_computer/src/distribution/metrics/realized.rs b/crates/brk_computer/src/distribution/metrics/realized.rs index 1f0ffde9f..d2e0a12d7 100644 --- a/crates/brk_computer/src/distribution/metrics/realized.rs +++ b/crates/brk_computer/src/distribution/metrics/realized.rs @@ -1,10 +1,13 @@ use brk_error::Result; use brk_traversable::Traversable; -use brk_types::{Bitcoin, DateIndex, Dollars, Height, StoredF32, StoredF64, Version}; +use brk_types::{ + Bitcoin, CentsSats, CentsSquaredSats, CentsUnsigned, DateIndex, Dollars, Height, StoredF32, + StoredF64, Version, +}; use rayon::prelude::*; use vecdb::{ - AnyStoredVec, AnyVec, EagerVec, Exit, GenericStoredVec, Ident, ImportableVec, - IterableCloneableVec, IterableVec, Negate, PcoVec, + AnyStoredVec, AnyVec, BytesVec, EagerVec, Exit, GenericStoredVec, Ident, ImportableVec, + IterableCloneableVec, IterableVec, Negate, PcoVec, TypedVecIterator, }; use crate::{ @@ -12,10 +15,11 @@ use crate::{ distribution::state::RealizedState, indexes, internal::{ - ComputedFromHeightLast, ComputedFromHeightSum, ComputedFromHeightSumCum, ComputedFromDateLast, - ComputedFromDateRatio, DollarsMinus, LazyBinaryFromHeightSum, LazyBinaryFromHeightSumCum, - LazyFromHeightSum, LazyFromHeightSumCum, LazyFromDateLast, PercentageDollarsF32, - PriceFromHeight, StoredF32Identity, + CentsUnsignedToDollars, ComputedFromDateLast, ComputedFromDateRatio, + ComputedFromHeightLast, ComputedFromHeightSum, ComputedFromHeightSumCum, DollarsMinus, + DollarsPlus, LazyBinaryFromHeightSum, LazyBinaryFromHeightSumCum, LazyFromDateLast, + LazyFromHeightLast, LazyFromHeightSum, LazyFromHeightSumCum, LazyPriceFromCents, + PercentageDollarsF32, PriceFromHeight, StoredF32Identity, }, price, }; @@ -26,12 +30,24 @@ use super::ImportConfig; #[derive(Clone, Traversable)] pub struct RealizedMetrics { // === Realized Cap === - pub realized_cap: ComputedFromHeightLast, + pub realized_cap_cents: ComputedFromHeightLast, + pub realized_cap: LazyFromHeightLast, pub realized_price: PriceFromHeight, pub realized_price_extra: ComputedFromDateRatio, pub realized_cap_rel_to_own_market_cap: Option>, pub realized_cap_30d_delta: ComputedFromDateLast, + // === Investor Price (dollar-weighted average acquisition price) === + pub investor_price_cents: ComputedFromHeightLast, + pub investor_price: LazyPriceFromCents, + pub investor_price_extra: ComputedFromDateRatio, + + // === Raw values for aggregation (needed to compute investor_price for aggregated cohorts) === + /// Raw Σ(price × sats) for realized cap aggregation + pub cap_raw: BytesVec, + /// Raw Σ(price² × sats) for investor_price aggregation + pub investor_cap_raw: BytesVec, + // === MVRV (Market Value to Realized Value) === // Proxy for realized_price_extra.ratio (close / realized_price = market_cap / realized_cap) pub mvrv: LazyFromDateLast, @@ -44,17 +60,29 @@ pub struct RealizedMetrics { pub realized_value: ComputedFromHeightSum, // === Realized vs Realized Cap Ratios (lazy) === - pub realized_profit_rel_to_realized_cap: LazyBinaryFromHeightSumCum, + pub realized_profit_rel_to_realized_cap: + LazyBinaryFromHeightSumCum, pub realized_loss_rel_to_realized_cap: LazyBinaryFromHeightSumCum, - pub net_realized_pnl_rel_to_realized_cap: LazyBinaryFromHeightSumCum, + pub net_realized_pnl_rel_to_realized_cap: + LazyBinaryFromHeightSumCum, // === Total Realized PnL === pub total_realized_pnl: LazyFromHeightSum, pub realized_profit_to_loss_ratio: Option>>, - // === Value Created/Destroyed === - pub value_created: ComputedFromHeightSum, - pub value_destroyed: ComputedFromHeightSum, + // === Value Created/Destroyed Splits (stored) === + pub profit_value_created: ComputedFromHeightSum, + pub profit_value_destroyed: ComputedFromHeightSum, + pub loss_value_created: ComputedFromHeightSum, + pub loss_value_destroyed: ComputedFromHeightSum, + + // === Value Created/Destroyed Totals (lazy: profit + loss) === + pub value_created: LazyBinaryFromHeightSum, + pub value_destroyed: LazyBinaryFromHeightSum, + + // === Capitulation/Profit Flow (lazy aliases) === + pub capitulation_flow: LazyFromHeightSum, + pub profit_flow: LazyFromHeightSum, // === Adjusted Value (lazy: cohort - up_to_1h) === pub adjusted_value_created: Option>, @@ -77,24 +105,37 @@ pub struct RealizedMetrics { pub net_realized_pnl_cumulative_30d_delta: ComputedFromDateLast, pub net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: ComputedFromDateLast, pub net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: ComputedFromDateLast, + + // === ATH Regret === + /// Realized ATH regret: Σ((ath - sell_price) × sats) + /// "How much more could have been made by selling at ATH instead" + pub ath_regret: ComputedFromHeightSumCum, } impl RealizedMetrics { /// Import realized metrics from database. pub fn forced_import(cfg: &ImportConfig) -> Result { let v1 = Version::ONE; + let v2 = Version::new(2); let v3 = Version::new(3); let extended = cfg.extended(); let compute_adjusted = cfg.compute_adjusted(); // Import combined types using forced_import which handles height + derived - let realized_cap = ComputedFromHeightLast::forced_import( + let realized_cap_cents = ComputedFromHeightLast::forced_import( cfg.db, - &cfg.name("realized_cap"), + &cfg.name("realized_cap_cents"), cfg.version, cfg.indexes, )?; + let realized_cap = LazyFromHeightLast::from_computed::( + &cfg.name("realized_cap"), + cfg.version, + realized_cap_cents.height.boxed_clone(), + &realized_cap_cents, + ); + let realized_profit = ComputedFromHeightSumCum::forced_import( cfg.db, &cfg.name("realized_profit"), @@ -141,7 +182,7 @@ impl RealizedMetrics { // Construct lazy ratio vecs let realized_profit_rel_to_realized_cap = - LazyBinaryFromHeightSumCum::from_computed_last::( + LazyBinaryFromHeightSumCum::from_computed_lazy_last::( &cfg.name("realized_profit_rel_to_realized_cap"), cfg.version + v1, realized_profit.height.boxed_clone(), @@ -151,7 +192,7 @@ impl RealizedMetrics { ); let realized_loss_rel_to_realized_cap = - LazyBinaryFromHeightSumCum::from_computed_last::( + LazyBinaryFromHeightSumCum::from_computed_lazy_last::( &cfg.name("realized_loss_rel_to_realized_cap"), cfg.version + v1, realized_loss.height.boxed_clone(), @@ -161,7 +202,7 @@ impl RealizedMetrics { ); let net_realized_pnl_rel_to_realized_cap = - LazyBinaryFromHeightSumCum::from_computed_last::( + LazyBinaryFromHeightSumCum::from_computed_lazy_last::( &cfg.name("net_realized_pnl_rel_to_realized_cap"), cfg.version + v1, net_realized_pnl.height.boxed_clone(), @@ -177,25 +218,104 @@ impl RealizedMetrics { cfg.indexes, )?; - let value_created = ComputedFromHeightSum::forced_import( + // Investor price (dollar-weighted average acquisition price) + let investor_price_cents = ComputedFromHeightLast::forced_import( cfg.db, - &cfg.name("value_created"), + &cfg.name("investor_price_cents"), cfg.version, cfg.indexes, )?; - let value_destroyed = ComputedFromHeightSum::forced_import( + let investor_price = LazyPriceFromCents::from_computed( + &cfg.name("investor_price"), + cfg.version, + &investor_price_cents, + ); + + let investor_price_extra = ComputedFromDateRatio::forced_import_from_lazy( cfg.db, - &cfg.name("value_destroyed"), + &cfg.name("investor_price"), + &investor_price.dollars, + cfg.version, + cfg.indexes, + extended, + )?; + + // Raw values for aggregation + let cap_raw = BytesVec::forced_import(cfg.db, &cfg.name("cap_raw"), cfg.version)?; + let investor_cap_raw = + BytesVec::forced_import(cfg.db, &cfg.name("investor_cap_raw"), cfg.version)?; + + // Import the 4 splits (stored) + let profit_value_created = ComputedFromHeightSum::forced_import( + cfg.db, + &cfg.name("profit_value_created"), cfg.version, cfg.indexes, )?; + let profit_value_destroyed = ComputedFromHeightSum::forced_import( + cfg.db, + &cfg.name("profit_value_destroyed"), + cfg.version, + cfg.indexes, + )?; + + let loss_value_created = ComputedFromHeightSum::forced_import( + cfg.db, + &cfg.name("loss_value_created"), + cfg.version, + cfg.indexes, + )?; + + let loss_value_destroyed = ComputedFromHeightSum::forced_import( + cfg.db, + &cfg.name("loss_value_destroyed"), + cfg.version, + cfg.indexes, + )?; + + // Create lazy totals (profit + loss) + let value_created = LazyBinaryFromHeightSum::from_computed::( + &cfg.name("value_created"), + cfg.version, + &profit_value_created, + &loss_value_created, + ); + + let value_destroyed = LazyBinaryFromHeightSum::from_computed::( + &cfg.name("value_destroyed"), + cfg.version, + &profit_value_destroyed, + &loss_value_destroyed, + ); + + // Create lazy aliases + let capitulation_flow = LazyFromHeightSum::from_computed::( + &cfg.name("capitulation_flow"), + cfg.version, + loss_value_destroyed.height.boxed_clone(), + &loss_value_destroyed, + ); + + let profit_flow = LazyFromHeightSum::from_computed::( + &cfg.name("profit_flow"), + cfg.version, + profit_value_destroyed.height.boxed_clone(), + &profit_value_destroyed, + ); + // Create lazy adjusted vecs if compute_adjusted and up_to_1h is available let adjusted_value_created = (compute_adjusted && cfg.up_to_1h_realized.is_some()).then(|| { let up_to_1h = cfg.up_to_1h_realized.unwrap(); - LazyBinaryFromHeightSum::from_computed::( + LazyBinaryFromHeightSum::from_binary::< + DollarsMinus, + Dollars, + Dollars, + Dollars, + Dollars, + >( &cfg.name("adjusted_value_created"), cfg.version, &value_created, @@ -205,7 +325,13 @@ impl RealizedMetrics { let adjusted_value_destroyed = (compute_adjusted && cfg.up_to_1h_realized.is_some()).then(|| { let up_to_1h = cfg.up_to_1h_realized.unwrap(); - LazyBinaryFromHeightSum::from_computed::( + LazyBinaryFromHeightSum::from_binary::< + DollarsMinus, + Dollars, + Dollars, + Dollars, + Dollars, + >( &cfg.name("adjusted_value_destroyed"), cfg.version, &value_destroyed, @@ -221,7 +347,6 @@ impl RealizedMetrics { cfg.version + v1, cfg.indexes, extended, - cfg.price, )?; // MVRV is a lazy proxy for realized_price_extra.ratio @@ -234,6 +359,7 @@ impl RealizedMetrics { Ok(Self { // === Realized Cap === + realized_cap_cents, realized_cap, realized_price, realized_price_extra, @@ -254,6 +380,13 @@ impl RealizedMetrics { cfg.indexes, )?, + // === Investor Price === + investor_price_cents, + investor_price, + investor_price_extra, + cap_raw, + investor_cap_raw, + // === MVRV === mvrv, @@ -281,17 +414,31 @@ impl RealizedMetrics { }) .transpose()?, - // === Value Created/Destroyed === + // === Value Created/Destroyed Splits (stored) === + profit_value_created, + profit_value_destroyed, + loss_value_created, + loss_value_destroyed, + + // === Value Created/Destroyed Totals (lazy: profit + loss) === value_created, value_destroyed, + // === Capitulation/Profit Flow (lazy aliases) === + capitulation_flow, + profit_flow, + // === Adjusted Value (lazy: cohort - up_to_1h) === adjusted_value_created, adjusted_value_destroyed, // === SOPR === sopr: EagerVec::forced_import(cfg.db, &cfg.name("sopr"), cfg.version + v1)?, - sopr_7d_ema: EagerVec::forced_import(cfg.db, &cfg.name("sopr_7d_ema"), cfg.version + v1)?, + sopr_7d_ema: EagerVec::forced_import( + cfg.db, + &cfg.name("sopr_7d_ema"), + cfg.version + v1, + )?, sopr_30d_ema: EagerVec::forced_import( cfg.db, &cfg.name("sopr_30d_ema"), @@ -359,6 +506,15 @@ impl RealizedMetrics { cfg.version + v3, cfg.indexes, )?, + + // === ATH Regret === + // v2: Changed to use max HIGH price during holding period instead of global ATH at send time + ath_regret: ComputedFromHeightSumCum::forced_import( + cfg.db, + &cfg.name("realized_ath_regret"), + cfg.version + v2, + cfg.indexes, + )?, }) } @@ -369,47 +525,73 @@ impl RealizedMetrics { .len() .min(self.realized_profit.height.len()) .min(self.realized_loss.height.len()) - .min(self.value_created.height.len()) - .min(self.value_destroyed.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.ath_regret.height.len()) } /// Push realized state values to height-indexed vectors. + /// State values are CentsUnsigned (deterministic), converted to Dollars for storage. pub fn truncate_push(&mut self, height: Height, state: &RealizedState) -> Result<()> { - self.realized_cap.height.truncate_push(height, state.cap)?; + self.realized_cap_cents + .height + .truncate_push(height, state.cap())?; self.realized_profit .height - .truncate_push(height, state.profit)?; + .truncate_push(height, state.profit().to_dollars())?; self.realized_loss .height - .truncate_push(height, state.loss)?; - self.value_created + .truncate_push(height, state.loss().to_dollars())?; + self.investor_price_cents .height - .truncate_push(height, state.value_created)?; - self.value_destroyed + .truncate_push(height, state.investor_price())?; + // Push raw values for aggregation + self.cap_raw.truncate_push(height, state.cap_raw())?; + self.investor_cap_raw + .truncate_push(height, state.investor_cap_raw())?; + // Push the 4 splits (totals are derived lazily) + self.profit_value_created .height - .truncate_push(height, state.value_destroyed)?; + .truncate_push(height, state.profit_value_created().to_dollars())?; + self.profit_value_destroyed + .height + .truncate_push(height, state.profit_value_destroyed().to_dollars())?; + self.loss_value_created + .height + .truncate_push(height, state.loss_value_created().to_dollars())?; + self.loss_value_destroyed + .height + .truncate_push(height, state.loss_value_destroyed().to_dollars())?; + // ATH regret + self.ath_regret + .height + .truncate_push(height, state.ath_regret().to_dollars())?; Ok(()) } - /// Write height-indexed vectors to disk. - pub fn write(&mut self) -> Result<()> { - self.realized_cap.height.write()?; - self.realized_profit.height.write()?; - self.realized_loss.height.write()?; - self.value_created.height.write()?; - self.value_destroyed.height.write()?; - Ok(()) - } - /// Returns a parallel iterator over all vecs for parallel writing. pub fn par_iter_mut(&mut self) -> impl ParallelIterator { - [ - &mut self.realized_cap.height as &mut dyn AnyStoredVec, + vec![ + &mut self.realized_cap_cents.height as &mut dyn AnyStoredVec, &mut self.realized_profit.height, &mut self.realized_loss.height, - &mut self.value_created.height, - &mut self.value_destroyed.height, + &mut self.investor_price_cents.height, + // Raw values for aggregation + &mut self.cap_raw as &mut dyn AnyStoredVec, + &mut self.investor_cap_raw as &mut dyn AnyStoredVec, + // The 4 splits (totals are derived lazily) + &mut self.profit_value_created.height, + &mut self.profit_value_destroyed.height, + &mut self.loss_value_created.height, + &mut self.loss_value_destroyed.height, + // ATH regret + &mut self.ath_regret.height, ] .into_par_iter() } @@ -427,11 +609,11 @@ impl RealizedMetrics { others: &[&Self], exit: &Exit, ) -> Result<()> { - self.realized_cap.height.compute_sum_of_others( + self.realized_cap_cents.height.compute_sum_of_others( starting_indexes.height, &others .iter() - .map(|v| &v.realized_cap.height) + .map(|v| &v.realized_cap_cents.height) .collect::>(), exit, )?; @@ -451,19 +633,103 @@ impl RealizedMetrics { .collect::>(), exit, )?; - self.value_created.height.compute_sum_of_others( + + // Aggregate raw values for investor_price computation + // (BytesVec doesn't have compute_sum_of_others, so we manually iterate) + // Validate version for investor_price_cents (same pattern as compute_sum_of_others) + let investor_price_dep_version = others + .iter() + .map(|o| o.investor_price_cents.height.version()) + .fold(vecdb::Version::ZERO, |acc, v| acc + v); + self.investor_price_cents + .height + .validate_computed_version_or_reset(investor_price_dep_version)?; + + let mut iters: Vec<_> = others + .iter() + .filter_map(|o| Some((o.cap_raw.iter().ok()?, o.investor_cap_raw.iter().ok()?))) + .collect(); + + // Start from where the target vecs left off (handles fresh/reset vecs) + let start = self + .cap_raw + .len() + .min(self.investor_cap_raw.len()) + .min(self.investor_price_cents.height.len()); + // End at the minimum length across all source vecs + let end = others.iter().map(|o| o.cap_raw.len()).min().unwrap_or(0); + + for i in start..end { + let height = Height::from(i); + + let mut sum_cap = CentsSats::ZERO; + let mut sum_investor_cap = CentsSquaredSats::ZERO; + + for (cap_iter, investor_cap_iter) in &mut iters { + sum_cap += cap_iter.get_unwrap(height); + sum_investor_cap += investor_cap_iter.get_unwrap(height); + } + + self.cap_raw.truncate_push(height, sum_cap)?; + self.investor_cap_raw + .truncate_push(height, sum_investor_cap)?; + + // Compute investor_price from aggregated raw values + let investor_price = if sum_cap.inner() == 0 { + CentsUnsigned::ZERO + } else { + CentsUnsigned::new((sum_investor_cap / sum_cap.inner()) as u64) + }; + self.investor_price_cents + .height + .truncate_push(height, investor_price)?; + } + + // Write to persist computed_version (same pattern as compute_sum_of_others) + { + let _lock = exit.lock(); + self.investor_price_cents.height.write()?; + } + + // Aggregate the 4 splits (totals are derived lazily) + self.profit_value_created.height.compute_sum_of_others( starting_indexes.height, &others .iter() - .map(|v| &v.value_created.height) + .map(|v| &v.profit_value_created.height) .collect::>(), exit, )?; - self.value_destroyed.height.compute_sum_of_others( + self.profit_value_destroyed.height.compute_sum_of_others( starting_indexes.height, &others .iter() - .map(|v| &v.value_destroyed.height) + .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, + )?; + // ATH regret + self.ath_regret.height.compute_sum_of_others( + starting_indexes.height, + &others + .iter() + .map(|v| &v.ath_regret.height) .collect::>(), exit, )?; @@ -478,9 +744,14 @@ impl RealizedMetrics { starting_indexes: &ComputeIndexes, exit: &Exit, ) -> Result<()> { - self.realized_cap.compute_rest(indexes, starting_indexes, exit)?; - self.realized_profit.compute_rest(indexes, starting_indexes, exit)?; - self.realized_loss.compute_rest(indexes, starting_indexes, exit)?; + self.realized_cap_cents + .compute_rest(indexes, starting_indexes, exit)?; + self.realized_profit + .compute_rest(indexes, starting_indexes, exit)?; + self.realized_loss + .compute_rest(indexes, starting_indexes, exit)?; + self.investor_price_cents + .compute_rest(indexes, starting_indexes, exit)?; // net_realized_pnl = profit - loss self.net_realized_pnl @@ -508,8 +779,19 @@ impl RealizedMetrics { Ok(()) })?; - self.value_created.compute_rest(indexes, starting_indexes, exit)?; - self.value_destroyed.compute_rest(indexes, starting_indexes, exit)?; + // Compute derived aggregations for the 4 splits + // (value_created, value_destroyed, capitulation_flow, profit_flow are derived lazily) + self.profit_value_created + .compute_rest(indexes, starting_indexes, exit)?; + self.profit_value_destroyed + .compute_rest(indexes, starting_indexes, exit)?; + self.loss_value_created + .compute_rest(indexes, starting_indexes, exit)?; + self.loss_value_destroyed + .compute_rest(indexes, starting_indexes, exit)?; + // ATH regret + self.ath_regret + .compute_rest(indexes, starting_indexes, exit)?; Ok(()) } @@ -545,6 +827,13 @@ impl RealizedMetrics { exit, Some(&self.realized_price.dateindex.0), )?; + + self.investor_price_extra.compute_rest( + price, + starting_indexes, + exit, + Some(&self.investor_price.dateindex.0), + )?; } // realized_cap_30d_delta @@ -613,8 +902,12 @@ impl RealizedMetrics { exit, )?; - self.sell_side_risk_ratio_7d_ema - .compute_ema(starting_indexes.dateindex, &self.sell_side_risk_ratio, 7, exit)?; + self.sell_side_risk_ratio_7d_ema.compute_ema( + starting_indexes.dateindex, + &self.sell_side_risk_ratio, + 7, + exit, + )?; self.sell_side_risk_ratio_30d_ema.compute_ema( starting_indexes.dateindex, diff --git a/crates/brk_computer/src/distribution/metrics/relative.rs b/crates/brk_computer/src/distribution/metrics/relative.rs index b624b614b..e449b8bc8 100644 --- a/crates/brk_computer/src/distribution/metrics/relative.rs +++ b/crates/brk_computer/src/distribution/metrics/relative.rs @@ -8,7 +8,7 @@ use crate::internal::{ PercentageDollarsF32, PercentageSatsF64, Ratio32, }; -use super::{ImportConfig, SupplyMetrics, UnrealizedMetrics}; +use super::{ImportConfig, RealizedMetrics, SupplyMetrics, UnrealizedMetrics}; /// Relative metrics comparing cohort values to global values. /// All `rel_to_` vecs are lazy - computed on-demand from their sources. @@ -58,6 +58,12 @@ pub struct RelativeMetrics { Option>, pub net_unrealized_pnl_rel_to_own_total_unrealized_pnl: Option>, + + // === Invested Capital in Profit/Loss as % of Realized Cap === + pub invested_capital_in_profit_pct: + Option>, + pub invested_capital_in_loss_pct: + Option>, } impl RelativeMetrics { @@ -65,11 +71,13 @@ impl RelativeMetrics { /// /// All `rel_to_` metrics are lazy - computed on-demand from their sources. /// `all_supply` provides global sources for `*_rel_to_market_cap` and `*_rel_to_circulating_supply`. + /// `realized` provides realized_cap for invested capital percentage metrics. pub fn forced_import( cfg: &ImportConfig, unrealized: &UnrealizedMetrics, supply: &SupplyMetrics, all_supply: Option<&SupplyMetrics>, + realized: Option<&RealizedMetrics>, ) -> Result { let v1 = Version::ONE; let v2 = Version::new(2); @@ -350,6 +358,30 @@ impl RelativeMetrics { &unrealized.total_unrealized_pnl, ) }), + + // === Invested Capital in Profit/Loss as % of Realized Cap === + invested_capital_in_profit_pct: realized.map(|r| { + LazyBinaryFromHeightLast::from_computed_height_date_and_lazy_block_last::< + PercentageDollarsF32, + _, + >( + &cfg.name("invested_capital_in_profit_pct"), + cfg.version, + &unrealized.invested_capital_in_profit, + &r.realized_cap, + ) + }), + invested_capital_in_loss_pct: realized.map(|r| { + LazyBinaryFromHeightLast::from_computed_height_date_and_lazy_block_last::< + PercentageDollarsF32, + _, + >( + &cfg.name("invested_capital_in_loss_pct"), + cfg.version, + &unrealized.invested_capital_in_loss, + &r.realized_cap, + ) + }), }) } } diff --git a/crates/brk_computer/src/distribution/metrics/supply.rs b/crates/brk_computer/src/distribution/metrics/supply.rs index 8d5ccff4c..8062cb3f2 100644 --- a/crates/brk_computer/src/distribution/metrics/supply.rs +++ b/crates/brk_computer/src/distribution/metrics/supply.rs @@ -58,12 +58,6 @@ impl SupplyMetrics { Ok(()) } - /// Write height-indexed vectors to disk. - pub fn write(&mut self) -> Result<()> { - self.total.sats.height.write()?; - Ok(()) - } - /// Returns a parallel iterator over all vecs for parallel writing. pub fn par_iter_mut(&mut self) -> impl ParallelIterator { vec![&mut self.total.sats.height as &mut dyn AnyStoredVec].into_par_iter() diff --git a/crates/brk_computer/src/distribution/metrics/unrealized.rs b/crates/brk_computer/src/distribution/metrics/unrealized.rs index ea129ebb0..e79a2feaa 100644 --- a/crates/brk_computer/src/distribution/metrics/unrealized.rs +++ b/crates/brk_computer/src/distribution/metrics/unrealized.rs @@ -1,16 +1,21 @@ use brk_error::Result; use brk_traversable::Traversable; -use brk_types::{DateIndex, Dollars, Height}; +use brk_types::{CentsSats, CentsSquaredSats, CentsUnsigned, DateIndex, Dollars, Height, Sats}; use rayon::prelude::*; -use vecdb::{AnyStoredVec, AnyVec, Exit, GenericStoredVec, Negate}; +use vecdb::{ + AnyStoredVec, AnyVec, BytesVec, Exit, GenericStoredVec, ImportableVec, Negate, + TypedVecIterator, Version, +}; use crate::{ ComputeIndexes, distribution::state::UnrealizedState, + indexes, internal::{ - ComputedFromHeightAndDateLast, DollarsMinus, DollarsPlus, LazyBinaryFromHeightLast, LazyFromHeightLast, - ValueFromHeightAndDateLast, + ComputedFromHeightAndDateLast, ComputedFromHeightLast, DollarsMinus, DollarsPlus, + LazyBinaryFromHeightLast, LazyFromHeightLast, ValueFromHeightAndDateLast, }, + price, }; use super::ImportConfig; @@ -26,12 +31,39 @@ pub struct UnrealizedMetrics { pub unrealized_profit: ComputedFromHeightAndDateLast, pub unrealized_loss: ComputedFromHeightAndDateLast, + // === Invested Capital in Profit/Loss === + pub invested_capital_in_profit: ComputedFromHeightAndDateLast, + pub invested_capital_in_loss: ComputedFromHeightAndDateLast, + + // === Raw values for precise aggregation (used to compute pain/greed indices) === + /// Σ(price × sats) for UTXOs in profit (raw u128, no indexes) + pub invested_capital_in_profit_raw: BytesVec, + /// Σ(price × sats) for UTXOs in loss (raw u128, no indexes) + pub invested_capital_in_loss_raw: BytesVec, + /// Σ(price² × sats) for UTXOs in profit (raw u128, no indexes) + pub investor_cap_in_profit_raw: BytesVec, + /// Σ(price² × sats) for UTXOs in loss (raw u128, no indexes) + pub investor_cap_in_loss_raw: BytesVec, + + // === Pain/Greed Indices (computed in compute_rest from raw values + spot price) === + /// investor_price_of_losers - spot (average distance underwater, weighted by $) + pub pain_index: ComputedFromHeightLast, + /// spot - investor_price_of_winners (average distance in profit, weighted by $) + pub greed_index: ComputedFromHeightLast, + /// greed_index - pain_index (positive = greedy market, negative = painful market) + pub net_sentiment: ComputedFromHeightLast, + // === Negated === pub neg_unrealized_loss: LazyFromHeightLast, // === Net and Total === pub net_unrealized_pnl: LazyBinaryFromHeightLast, pub total_unrealized_pnl: LazyBinaryFromHeightLast, + + // === ATH Regret === + /// Unrealized ATH regret: (ATH - spot) × supply_in_profit + ATH × supply_in_loss - invested_capital_in_loss + /// "How much more I'd have if I sold at ATH instead of now" (refined formula accounting for cost basis) + pub ath_regret: ComputedFromHeightLast, } impl UnrealizedMetrics { @@ -71,6 +103,56 @@ impl UnrealizedMetrics { cfg.indexes, )?; + // === Invested Capital in Profit/Loss === + let invested_capital_in_profit = ComputedFromHeightAndDateLast::forced_import( + cfg.db, + &cfg.name("invested_capital_in_profit"), + cfg.version, + cfg.indexes, + )?; + let invested_capital_in_loss = ComputedFromHeightAndDateLast::forced_import( + cfg.db, + &cfg.name("invested_capital_in_loss"), + cfg.version, + cfg.indexes, + )?; + + // === Raw values for precise aggregation === + let invested_capital_in_profit_raw = BytesVec::forced_import( + cfg.db, + &cfg.name("invested_capital_in_profit_raw"), + cfg.version, + )?; + let invested_capital_in_loss_raw = BytesVec::forced_import( + cfg.db, + &cfg.name("invested_capital_in_loss_raw"), + cfg.version, + )?; + let investor_cap_in_profit_raw = + BytesVec::forced_import(cfg.db, &cfg.name("investor_cap_in_profit_raw"), cfg.version)?; + let investor_cap_in_loss_raw = + BytesVec::forced_import(cfg.db, &cfg.name("investor_cap_in_loss_raw"), cfg.version)?; + + // === Pain/Greed Indices === + let pain_index = ComputedFromHeightLast::forced_import( + cfg.db, + &cfg.name("pain_index"), + cfg.version, + cfg.indexes, + )?; + let greed_index = ComputedFromHeightLast::forced_import( + cfg.db, + &cfg.name("greed_index"), + cfg.version, + cfg.indexes, + )?; + let net_sentiment = ComputedFromHeightLast::forced_import( + cfg.db, + &cfg.name("net_sentiment"), + cfg.version, + cfg.indexes, + )?; + // === Negated === let neg_unrealized_loss = LazyFromHeightLast::from_computed_height_date::( &cfg.name("neg_unrealized_loss"), @@ -79,27 +161,50 @@ impl UnrealizedMetrics { ); // === Net and Total === - let net_unrealized_pnl = LazyBinaryFromHeightLast::from_computed_height_date_last::( - &cfg.name("net_unrealized_pnl"), - cfg.version, - &unrealized_profit, - &unrealized_loss, - ); - let total_unrealized_pnl = LazyBinaryFromHeightLast::from_computed_height_date_last::( - &cfg.name("total_unrealized_pnl"), - cfg.version, - &unrealized_profit, - &unrealized_loss, - ); + let net_unrealized_pnl = + LazyBinaryFromHeightLast::from_computed_height_date_last::( + &cfg.name("net_unrealized_pnl"), + cfg.version, + &unrealized_profit, + &unrealized_loss, + ); + let total_unrealized_pnl = + LazyBinaryFromHeightLast::from_computed_height_date_last::( + &cfg.name("total_unrealized_pnl"), + cfg.version, + &unrealized_profit, + &unrealized_loss, + ); + + // === ATH Regret === + // v2: Changed to use HIGH prices consistently for ATH instead of mixing HIGH/CLOSE + // v3: Changed to ComputedFromHeightLast to derive dateindex from height (avoids precision loss) + let v3 = Version::new(3); + let ath_regret = ComputedFromHeightLast::forced_import( + cfg.db, + &cfg.name("unrealized_ath_regret"), + cfg.version + v3, + cfg.indexes, + )?; Ok(Self { supply_in_profit, supply_in_loss, unrealized_profit, unrealized_loss, + invested_capital_in_profit, + invested_capital_in_loss, + invested_capital_in_profit_raw, + invested_capital_in_loss_raw, + investor_cap_in_profit_raw, + investor_cap_in_loss_raw, + pain_index, + greed_index, + net_sentiment, neg_unrealized_loss, net_unrealized_pnl, total_unrealized_pnl, + ath_regret, }) } @@ -111,6 +216,12 @@ impl UnrealizedMetrics { .min(self.supply_in_loss.height.len()) .min(self.unrealized_profit.height.len()) .min(self.unrealized_loss.height.len()) + .min(self.invested_capital_in_profit.height.len()) + .min(self.invested_capital_in_loss.height.len()) + .min(self.invested_capital_in_profit_raw.len()) + .min(self.invested_capital_in_loss_raw.len()) + .min(self.investor_cap_in_profit_raw.len()) + .min(self.investor_cap_in_loss_raw.len()) } /// Get minimum length across dateindex-indexed vectors written in block loop. @@ -122,6 +233,8 @@ impl UnrealizedMetrics { .min(self.supply_in_loss.indexes.sats_dateindex.len()) .min(self.unrealized_profit.dateindex.len()) .min(self.unrealized_loss.dateindex.len()) + .min(self.invested_capital_in_profit.dateindex.len()) + .min(self.invested_capital_in_loss.dateindex.len()) } /// Push unrealized state values to height-indexed vectors. @@ -140,10 +253,34 @@ impl UnrealizedMetrics { .truncate_push(height, height_state.supply_in_loss)?; self.unrealized_profit .height - .truncate_push(height, height_state.unrealized_profit)?; + .truncate_push(height, height_state.unrealized_profit.to_dollars())?; self.unrealized_loss .height - .truncate_push(height, height_state.unrealized_loss)?; + .truncate_push(height, height_state.unrealized_loss.to_dollars())?; + self.invested_capital_in_profit + .height + .truncate_push(height, height_state.invested_capital_in_profit.to_dollars())?; + self.invested_capital_in_loss + .height + .truncate_push(height, height_state.invested_capital_in_loss.to_dollars())?; + + // Raw values for aggregation + self.invested_capital_in_profit_raw.truncate_push( + height, + CentsSats::new(height_state.invested_capital_in_profit_raw), + )?; + self.invested_capital_in_loss_raw.truncate_push( + height, + CentsSats::new(height_state.invested_capital_in_loss_raw), + )?; + self.investor_cap_in_profit_raw.truncate_push( + height, + CentsSquaredSats::new(height_state.investor_cap_in_profit_raw), + )?; + self.investor_cap_in_loss_raw.truncate_push( + height, + CentsSquaredSats::new(height_state.investor_cap_in_loss_raw), + )?; if let (Some(dateindex), Some(date_state)) = (dateindex, date_state) { self.supply_in_profit @@ -156,28 +293,22 @@ impl UnrealizedMetrics { .truncate_push(dateindex, date_state.supply_in_loss)?; self.unrealized_profit .dateindex - .truncate_push(dateindex, date_state.unrealized_profit)?; + .truncate_push(dateindex, date_state.unrealized_profit.to_dollars())?; self.unrealized_loss .dateindex - .truncate_push(dateindex, date_state.unrealized_loss)?; + .truncate_push(dateindex, date_state.unrealized_loss.to_dollars())?; + self.invested_capital_in_profit.dateindex.truncate_push( + dateindex, + date_state.invested_capital_in_profit.to_dollars(), + )?; + self.invested_capital_in_loss + .dateindex + .truncate_push(dateindex, date_state.invested_capital_in_loss.to_dollars())?; } Ok(()) } - /// Write height-indexed vectors to disk. - pub fn write(&mut self) -> Result<()> { - self.supply_in_profit.height.write()?; - self.supply_in_loss.height.write()?; - self.unrealized_profit.height.write()?; - self.unrealized_loss.height.write()?; - self.supply_in_profit.indexes.sats_dateindex.write()?; - self.supply_in_loss.indexes.sats_dateindex.write()?; - self.unrealized_profit.dateindex.write()?; - self.unrealized_loss.dateindex.write()?; - Ok(()) - } - /// Returns a parallel iterator over all vecs for parallel writing. pub fn par_iter_mut(&mut self) -> impl ParallelIterator { vec![ @@ -185,10 +316,18 @@ impl UnrealizedMetrics { &mut self.supply_in_loss.height as &mut dyn AnyStoredVec, &mut self.unrealized_profit.height as &mut dyn AnyStoredVec, &mut self.unrealized_loss.height as &mut dyn AnyStoredVec, + &mut self.invested_capital_in_profit.height as &mut dyn AnyStoredVec, + &mut self.invested_capital_in_loss.height as &mut dyn AnyStoredVec, + &mut self.invested_capital_in_profit_raw as &mut dyn AnyStoredVec, + &mut self.invested_capital_in_loss_raw as &mut dyn AnyStoredVec, + &mut self.investor_cap_in_profit_raw as &mut dyn AnyStoredVec, + &mut self.investor_cap_in_loss_raw as &mut dyn AnyStoredVec, &mut self.supply_in_profit.indexes.sats_dateindex as &mut dyn AnyStoredVec, &mut self.supply_in_loss.indexes.sats_dateindex as &mut dyn AnyStoredVec, &mut self.unrealized_profit.rest.dateindex as &mut dyn AnyStoredVec, &mut self.unrealized_loss.rest.dateindex as &mut dyn AnyStoredVec, + &mut self.invested_capital_in_profit.rest.dateindex as &mut dyn AnyStoredVec, + &mut self.invested_capital_in_loss.rest.dateindex as &mut dyn AnyStoredVec, ] .into_par_iter() } @@ -232,6 +371,78 @@ impl UnrealizedMetrics { .collect::>(), exit, )?; + self.invested_capital_in_profit + .height + .compute_sum_of_others( + starting_indexes.height, + &others + .iter() + .map(|v| &v.invested_capital_in_profit.height) + .collect::>(), + exit, + )?; + self.invested_capital_in_loss.height.compute_sum_of_others( + starting_indexes.height, + &others + .iter() + .map(|v| &v.invested_capital_in_loss.height) + .collect::>(), + exit, + )?; + + // Raw values for aggregation - manually sum since BytesVec doesn't have compute_sum_of_others + // Create iterators for each source vec + let mut iters: Vec<_> = others + .iter() + .filter_map(|o| { + Some(( + o.invested_capital_in_profit_raw.iter().ok()?, + o.invested_capital_in_loss_raw.iter().ok()?, + o.investor_cap_in_profit_raw.iter().ok()?, + o.investor_cap_in_loss_raw.iter().ok()?, + )) + }) + .collect(); + + // Start from where the target vecs left off (handles fresh/reset vecs) + let start = self + .invested_capital_in_profit_raw + .len() + .min(self.invested_capital_in_loss_raw.len()) + .min(self.investor_cap_in_profit_raw.len()) + .min(self.investor_cap_in_loss_raw.len()); + // End at the minimum length across all source vecs + let end = others + .iter() + .map(|o| o.invested_capital_in_profit_raw.len()) + .min() + .unwrap_or(0); + + for i in start..end { + let height = Height::from(i); + + let mut sum_invested_profit = CentsSats::ZERO; + let mut sum_invested_loss = CentsSats::ZERO; + let mut sum_investor_profit = CentsSquaredSats::ZERO; + let mut sum_investor_loss = CentsSquaredSats::ZERO; + + for (ip_iter, il_iter, cap_p_iter, cap_l_iter) in &mut iters { + sum_invested_profit += ip_iter.get_unwrap(height); + sum_invested_loss += il_iter.get_unwrap(height); + sum_investor_profit += cap_p_iter.get_unwrap(height); + sum_investor_loss += cap_l_iter.get_unwrap(height); + } + + self.invested_capital_in_profit_raw + .truncate_push(height, sum_invested_profit)?; + self.invested_capital_in_loss_raw + .truncate_push(height, sum_invested_loss)?; + self.investor_cap_in_profit_raw + .truncate_push(height, sum_investor_profit)?; + self.investor_cap_in_loss_raw + .truncate_push(height, sum_investor_loss)?; + } + self.supply_in_profit .indexes .sats_dateindex @@ -270,13 +481,34 @@ impl UnrealizedMetrics { .collect::>(), exit, )?; + self.invested_capital_in_profit + .dateindex + .compute_sum_of_others( + starting_indexes.dateindex, + &others + .iter() + .map(|v| &v.invested_capital_in_profit.dateindex) + .collect::>(), + exit, + )?; + self.invested_capital_in_loss + .dateindex + .compute_sum_of_others( + starting_indexes.dateindex, + &others + .iter() + .map(|v| &v.invested_capital_in_loss.dateindex) + .collect::>(), + exit, + )?; Ok(()) } - /// First phase of computed metrics. - pub fn compute_rest_part1( + /// Compute derived metrics from stored values + price. + pub fn compute_rest( &mut self, - price: Option<&crate::price::Vecs>, + indexes: &indexes::Vecs, + price: Option<&price::Vecs>, starting_indexes: &ComputeIndexes, exit: &Exit, ) -> Result<()> { @@ -286,6 +518,122 @@ impl UnrealizedMetrics { self.supply_in_loss .compute_dollars_from_price(price, starting_indexes, exit)?; + // Compute pain/greed/net from raw values + spot price + let Some(price) = price else { + return Ok(()); + }; + + // Pain index: investor_price_of_losers - spot + self.pain_index + .compute_all(indexes, starting_indexes, exit, |vec| { + Ok(vec.compute_transform3( + starting_indexes.height, + &self.investor_cap_in_loss_raw, + &self.invested_capital_in_loss_raw, + &price.cents.split.height.close, + |(h, investor_cap, invested_cap, spot, ..)| { + if invested_cap.inner() == 0 { + return (h, Dollars::ZERO); + } + let investor_price_losers = investor_cap.inner() / invested_cap.inner(); + let spot_u128 = (*spot).as_u128(); + ( + h, + CentsUnsigned::new((investor_price_losers - spot_u128) as u64) + .to_dollars(), + ) + }, + exit, + )?) + })?; + + // Greed index: spot - investor_price_of_winners + self.greed_index + .compute_all(indexes, starting_indexes, exit, |vec| { + Ok(vec.compute_transform3( + starting_indexes.height, + &self.investor_cap_in_profit_raw, + &self.invested_capital_in_profit_raw, + &price.cents.split.height.close, + |(h, investor_cap, invested_cap, spot, ..)| { + if invested_cap.inner() == 0 { + return (h, Dollars::ZERO); + } + let investor_price_winners = investor_cap.inner() / invested_cap.inner(); + let spot_u128 = (*spot).as_u128(); + ( + h, + CentsUnsigned::new((spot_u128 - investor_price_winners) as u64) + .to_dollars(), + ) + }, + exit, + )?) + })?; + + // Net sentiment: greed - pain + self.net_sentiment + .compute_all(indexes, starting_indexes, exit, |vec| { + Ok(vec.compute_subtract( + starting_indexes.height, + &self.greed_index.height, + &self.pain_index.height, + exit, + )?) + })?; + + // ATH regret: (ATH - spot) × supply_in_profit + ATH × supply_in_loss - invested_capital_in_loss + // This is the refined formula that accounts for cost basis: + // - For UTXOs in profit: regret = ATH - spot (they could have sold at ATH instead of now) + // - For UTXOs in loss: regret = ATH - cost_basis (they could have sold at ATH instead of holding) + // ath = running max of high prices + + // Height computation + { + // Pre-compute ATH as running max of high prices + let height_ath: Vec = { + let mut ath = CentsUnsigned::ZERO; + price + .cents + .split + .height + .high + .into_iter() + .map(|high| { + if *high > ath { + ath = *high; + } + ath + }) + .collect() + }; + + self.ath_regret.height.compute_transform4( + starting_indexes.height, + &price.cents.split.height.close, + &self.supply_in_profit.height, + &self.supply_in_loss.height, + &self.invested_capital_in_loss_raw, + |(h, spot, supply_profit, supply_loss, invested_loss_raw, ..)| { + let ath = height_ath[usize::from(h)]; + // (ATH - spot) × supply_in_profit + ATH × supply_in_loss - invested_capital_in_loss + let ath_u128 = ath.as_u128(); + let spot_u128 = spot.as_u128(); + let profit_regret = (ath_u128 - spot_u128) * supply_profit.as_u128(); + // invested_loss_raw is CentsSats (already in cents*sats scale) + let loss_regret = ath_u128 * supply_loss.as_u128() - invested_loss_raw.inner(); + let regret_raw = profit_regret + loss_regret; + let regret_cents = CentsUnsigned::new((regret_raw / Sats::ONE_BTC_U128) as u64); + (h, regret_cents.to_dollars()) + }, + exit, + )?; + } + + // DateIndex computation: derive from height values using last-value aggregation + self.ath_regret + .compute_rest(indexes, starting_indexes, exit)?; + Ok(()) } } diff --git a/crates/brk_computer/src/distribution/state/block.rs b/crates/brk_computer/src/distribution/state/block.rs index 0f35dba2e..a36dbd4da 100644 --- a/crates/brk_computer/src/distribution/state/block.rs +++ b/crates/brk_computer/src/distribution/state/block.rs @@ -1,6 +1,6 @@ use std::ops::{Add, AddAssign, SubAssign}; -use brk_types::{Dollars, SupplyState, Timestamp}; +use brk_types::{CentsUnsigned, SupplyState, Timestamp}; use serde::Serialize; #[derive(Debug, Clone, Serialize)] @@ -8,7 +8,7 @@ pub struct BlockState { #[serde(flatten)] pub supply: SupplyState, #[serde(skip)] - pub price: Option, + pub price: Option, #[serde(skip)] pub timestamp: Timestamp, } diff --git a/crates/brk_computer/src/distribution/state/cohort/address.rs b/crates/brk_computer/src/distribution/state/cohort/address.rs index c443286a5..4d4b8e748 100644 --- a/crates/brk_computer/src/distribution/state/cohort/address.rs +++ b/crates/brk_computer/src/distribution/state/cohort/address.rs @@ -1,7 +1,7 @@ use std::path::Path; use brk_error::Result; -use brk_types::{Age, Dollars, Height, LoadedAddressData, Sats, SupplyState}; +use brk_types::{Age, CentsUnsigned, Height, LoadedAddressData, Sats, SupplyState}; use vecdb::unlikely; use super::{super::cost_basis::RealizedState, base::CohortState}; @@ -28,12 +28,12 @@ impl AddressCohortState { self.inner.satblocks_destroyed = Sats::ZERO; self.inner.satdays_destroyed = Sats::ZERO; if let Some(realized) = self.inner.realized.as_mut() { - *realized = RealizedState::NAN; + *realized = RealizedState::default(); } } - pub fn reset_price_to_amount_if_needed(&mut self) -> Result<()> { - self.inner.reset_price_to_amount_if_needed() + pub fn reset_cost_basis_data_if_needed(&mut self) -> Result<()> { + self.inner.reset_cost_basis_data_if_needed() } pub fn reset_single_iteration_values(&mut self) { @@ -44,35 +44,23 @@ impl AddressCohortState { &mut self, addressdata: &mut LoadedAddressData, value: Sats, - current_price: Option, - prev_price: Option, + current_price: CentsUnsigned, + prev_price: CentsUnsigned, + ath: CentsUnsigned, age: Age, ) -> Result<()> { - let compute_price = current_price.is_some(); + let prev = addressdata.cost_basis_snapshot(); + addressdata.send(value, Some(prev_price))?; + let current = addressdata.cost_basis_snapshot(); - let prev_realized_price = compute_price.then(|| addressdata.realized_price()); - let prev_supply_state = SupplyState { - utxo_count: addressdata.utxo_count() as u64, - value: addressdata.balance(), - }; - - addressdata.send(value, prev_price)?; - - let supply_state = SupplyState { - utxo_count: addressdata.utxo_count() as u64, - value: addressdata.balance(), - }; - - self.inner.send_( - &SupplyState { - utxo_count: 1, - value, - }, + self.inner.send_address( + &SupplyState { utxo_count: 1, value }, current_price, prev_price, + ath, age, - compute_price.then(|| (addressdata.realized_price(), &supply_state)), - prev_realized_price.map(|prev_price| (prev_price, &prev_supply_state)), + ¤t, + &prev, ); Ok(()) @@ -82,7 +70,7 @@ impl AddressCohortState { &mut self, address_data: &mut LoadedAddressData, value: Sats, - price: Option, + price: CentsUnsigned, ) { self.receive_outputs(address_data, value, price, 1); } @@ -91,50 +79,31 @@ impl AddressCohortState { &mut self, address_data: &mut LoadedAddressData, value: Sats, - price: Option, + price: CentsUnsigned, output_count: u32, ) { - let compute_price = price.is_some(); + let prev = address_data.cost_basis_snapshot(); + address_data.receive_outputs(value, Some(price), output_count); + let current = address_data.cost_basis_snapshot(); - let prev_realized_price = compute_price.then(|| address_data.realized_price()); - let prev_supply_state = SupplyState { - utxo_count: address_data.utxo_count() as u64, - value: address_data.balance(), - }; - - address_data.receive_outputs(value, price, output_count); - - let supply_state = SupplyState { - utxo_count: address_data.utxo_count() as u64, - value: address_data.balance(), - }; - - self.inner.receive_( - &SupplyState { - utxo_count: output_count as u64, - value, - }, + self.inner.receive_address( + &SupplyState { utxo_count: output_count as u64, value }, price, - compute_price.then(|| (address_data.realized_price(), &supply_state)), - prev_realized_price.map(|prev_price| (prev_price, &prev_supply_state)), + ¤t, + &prev, ); } pub fn add(&mut self, addressdata: &LoadedAddressData) { self.addr_count += 1; - self.inner.increment_( - &addressdata.into(), - addressdata.realized_cap, - addressdata.realized_price(), - ); + self.inner.increment_snapshot(&addressdata.cost_basis_snapshot()); } pub fn subtract(&mut self, addressdata: &LoadedAddressData) { - let addr_supply: SupplyState = addressdata.into(); - let realized_price = addressdata.realized_price(); + let snapshot = addressdata.cost_basis_snapshot(); // Check for potential underflow before it happens - if unlikely(self.inner.supply.utxo_count < addr_supply.utxo_count) { + if unlikely(self.inner.supply.utxo_count < snapshot.supply_state.utxo_count) { panic!( "AddressCohortState::subtract underflow!\n\ Cohort state: addr_count={}, supply={}\n\ @@ -142,10 +111,10 @@ impl AddressCohortState { Address supply: {}\n\ Realized price: {}\n\ This means the address is not properly tracked in this cohort.", - self.addr_count, self.inner.supply, addressdata, addr_supply, realized_price + self.addr_count, self.inner.supply, addressdata, snapshot.supply_state, snapshot.realized_price ); } - if unlikely(self.inner.supply.value < addr_supply.value) { + if unlikely(self.inner.supply.value < snapshot.supply_state.value) { panic!( "AddressCohortState::subtract value underflow!\n\ Cohort state: addr_count={}, supply={}\n\ @@ -153,7 +122,7 @@ impl AddressCohortState { Address supply: {}\n\ Realized price: {}\n\ This means the address is not properly tracked in this cohort.", - self.addr_count, self.inner.supply, addressdata, addr_supply, realized_price + self.addr_count, self.inner.supply, addressdata, snapshot.supply_state, snapshot.realized_price ); } @@ -162,12 +131,11 @@ impl AddressCohortState { "AddressCohortState::subtract addr_count underflow! addr_count=0\n\ Address being subtracted: {}\n\ Realized price: {}", - addressdata, realized_price + addressdata, snapshot.realized_price ) }); - self.inner - .decrement_(&addr_supply, addressdata.realized_cap, realized_price); + self.inner.decrement_snapshot(&snapshot); } pub fn write(&mut self, height: Height, cleanup: bool) -> Result<()> { diff --git a/crates/brk_computer/src/distribution/state/cohort/base.rs b/crates/brk_computer/src/distribution/state/cohort/base.rs index cda01f11e..b419a6025 100644 --- a/crates/brk_computer/src/distribution/state/cohort/base.rs +++ b/crates/brk_computer/src/distribution/state/cohort/base.rs @@ -1,93 +1,78 @@ use std::path::Path; use brk_error::Result; -use brk_types::{Age, Dollars, Height, Sats, SupplyState}; - -use crate::internal::PERCENTILES_LEN; +use brk_types::{Age, CentsSats, CentsUnsigned, CostBasisSnapshot, Height, Sats, SupplyState}; use super::super::cost_basis::{ - CachedUnrealizedState, PriceToAmount, RealizedState, UnrealizedState, + CachedUnrealizedState, Percentiles, CostBasisData, RealizedState, UnrealizedState, }; -/// State tracked for each cohort during computation. #[derive(Clone)] pub struct CohortState { - /// Current supply in this cohort pub supply: SupplyState, - - /// Realized cap and profit/loss (requires price data) pub realized: Option, - - /// Amount sent in current block pub sent: Sats, - - /// Satoshi-blocks destroyed (supply * blocks_old when spent) pub satblocks_destroyed: Sats, - - /// Satoshi-days destroyed (supply * days_old when spent) pub satdays_destroyed: Sats, - - /// Price distribution for percentile calculations (requires price data) - price_to_amount: Option, - - /// Cached unrealized state for O(k) incremental updates. + cost_basis_data: Option, cached_unrealized: Option, } impl CohortState { - /// Create new cohort state. pub fn new(path: &Path, name: &str, compute_dollars: bool) -> Self { Self { supply: SupplyState::default(), - realized: compute_dollars.then_some(RealizedState::NAN), + realized: compute_dollars.then_some(RealizedState::default()), sent: Sats::ZERO, satblocks_destroyed: Sats::ZERO, satdays_destroyed: Sats::ZERO, - price_to_amount: compute_dollars.then_some(PriceToAmount::create(path, name)), + cost_basis_data: compute_dollars.then_some(CostBasisData::create(path, name)), cached_unrealized: None, } } - /// Import state from checkpoint. pub fn import_at_or_before(&mut self, height: Height) -> Result { - // Invalidate cache when importing new data self.cached_unrealized = None; - - match self.price_to_amount.as_mut() { + match self.cost_basis_data.as_mut() { Some(p) => p.import_at_or_before(height), None => Ok(height), } } - /// Reset price_to_amount if needed (for starting fresh). - pub fn reset_price_to_amount_if_needed(&mut self) -> Result<()> { - if let Some(p) = self.price_to_amount.as_mut() { + /// Restore realized cap from cost_basis_data after import. + /// Uses the exact persisted values instead of recomputing from the map. + pub fn restore_realized_cap(&mut self) { + if let Some(cost_basis_data) = self.cost_basis_data.as_ref() + && let Some(realized) = self.realized.as_mut() + { + realized.set_cap_raw(cost_basis_data.cap_raw()); + realized.set_investor_cap_raw(cost_basis_data.investor_cap_raw()); + } + } + + pub fn reset_cost_basis_data_if_needed(&mut self) -> Result<()> { + if let Some(p) = self.cost_basis_data.as_mut() { p.clean()?; p.init(); } - // Invalidate cache when data is reset self.cached_unrealized = None; Ok(()) } - /// Apply pending price_to_amount updates. Must be called before reads. pub fn apply_pending(&mut self) { - if let Some(p) = self.price_to_amount.as_mut() { + if let Some(p) = self.cost_basis_data.as_mut() { p.apply_pending(); } } - /// Get first (lowest) price entry in distribution. - pub fn price_to_amount_first_key_value(&self) -> Option<(Dollars, &Sats)> { - self.price_to_amount.as_ref()?.first_key_value() + pub fn cost_basis_data_first_key_value(&self) -> Option<(CentsUnsigned, &Sats)> { + self.cost_basis_data.as_ref()?.first_key_value().map(|(k, v)| (k.into(), v)) } - /// Get last (highest) price entry in distribution. - pub fn price_to_amount_last_key_value(&self) -> Option<(Dollars, &Sats)> { - self.price_to_amount.as_ref()?.last_key_value() + pub fn cost_basis_data_last_key_value(&self) -> Option<(CentsUnsigned, &Sats)> { + self.cost_basis_data.as_ref()?.last_key_value().map(|(k, v)| (k.into(), v)) } - /// Reset per-block values before processing next block. pub fn reset_single_iteration_values(&mut self) { self.sent = Sats::ZERO; self.satdays_destroyed = Sats::ZERO; @@ -97,177 +82,137 @@ impl CohortState { } } - /// Add supply to this cohort (e.g., when UTXO ages into cohort). - pub fn increment(&mut self, supply: &SupplyState, price: Option) { + pub fn increment(&mut self, supply: &SupplyState, price: Option) { + match price { + Some(p) => self.increment_snapshot(&CostBasisSnapshot::from_utxo(p, supply)), + None => self.supply += supply, + } + } + + pub fn increment_snapshot(&mut self, s: &CostBasisSnapshot) { + self.supply += &s.supply_state; + + if s.supply_state.value > Sats::ZERO + && let Some(realized) = self.realized.as_mut() + { + realized.increment_snapshot(s.price_sats, s.investor_cap); + self.cost_basis_data.as_mut().unwrap().increment( + s.realized_price, + s.supply_state.value, + s.price_sats, + s.investor_cap, + ); + + if let Some(cache) = self.cached_unrealized.as_mut() { + cache.on_receive(s.realized_price, s.supply_state.value); + } + } + } + + pub fn decrement(&mut self, supply: &SupplyState, price: Option) { + match price { + Some(p) => self.decrement_snapshot(&CostBasisSnapshot::from_utxo(p, supply)), + None => self.supply -= supply, + } + } + + pub fn decrement_snapshot(&mut self, s: &CostBasisSnapshot) { + self.supply -= &s.supply_state; + + if s.supply_state.value > Sats::ZERO + && let Some(realized) = self.realized.as_mut() + { + realized.decrement_snapshot(s.price_sats, s.investor_cap); + self.cost_basis_data.as_mut().unwrap().decrement( + s.realized_price, + s.supply_state.value, + s.price_sats, + s.investor_cap, + ); + + if let Some(cache) = self.cached_unrealized.as_mut() { + cache.on_send(s.realized_price, s.supply_state.value); + } + } + } + + pub fn receive_utxo(&mut self, supply: &SupplyState, price: Option) { self.supply += supply; if supply.value > Sats::ZERO && let Some(realized) = self.realized.as_mut() { let price = price.unwrap(); - realized.increment(supply, price); - self.price_to_amount - .as_mut() - .unwrap() - .increment(price, supply); + let sats = 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); + + realized.receive(price, sats); + + self.cost_basis_data.as_mut().unwrap().increment( + price, + sats, + price_sats, + investor_cap, + ); - // Update cache for added supply if let Some(cache) = self.cached_unrealized.as_mut() { - cache.on_receive(price, supply.value); + cache.on_receive(price, sats); } } } - /// Add supply with pre-computed realized cap (for address cohorts). - pub fn increment_( + pub fn receive_address( &mut self, supply: &SupplyState, - realized_cap: Dollars, - realized_price: Dollars, + price: CentsUnsigned, + current: &CostBasisSnapshot, + prev: &CostBasisSnapshot, ) { self.supply += supply; if supply.value > Sats::ZERO && let Some(realized) = self.realized.as_mut() { - realized.increment_(realized_cap); - self.price_to_amount - .as_mut() - .unwrap() - .increment(realized_price, supply); + realized.receive(price, supply.value); - // Update cache for added supply - if let Some(cache) = self.cached_unrealized.as_mut() { - cache.on_receive(realized_price, supply.value); - } - } - } + if current.supply_state.value.is_not_zero() { + self.cost_basis_data.as_mut().unwrap().increment( + current.realized_price, + current.supply_state.value, + current.price_sats, + current.investor_cap, + ); - /// Remove supply from this cohort (e.g., when UTXO ages out of cohort). - pub fn decrement(&mut self, supply: &SupplyState, price: Option) { - self.supply -= supply; - - if supply.value > Sats::ZERO - && let Some(realized) = self.realized.as_mut() - { - let price = price.unwrap(); - realized.decrement(supply, price); - self.price_to_amount - .as_mut() - .unwrap() - .decrement(price, supply); - - // Update cache for removed supply - if let Some(cache) = self.cached_unrealized.as_mut() { - cache.on_send(price, supply.value); - } - } - } - - /// Remove supply with pre-computed realized cap (for address cohorts). - pub fn decrement_( - &mut self, - supply: &SupplyState, - realized_cap: Dollars, - realized_price: Dollars, - ) { - self.supply -= supply; - - if supply.value > Sats::ZERO - && let Some(realized) = self.realized.as_mut() - { - realized.decrement_(realized_cap); - self.price_to_amount - .as_mut() - .unwrap() - .decrement(realized_price, supply); - - // Update cache for removed supply - if let Some(cache) = self.cached_unrealized.as_mut() { - cache.on_send(realized_price, supply.value); - } - } - } - - /// Process received output (new UTXO in cohort). - pub fn receive(&mut self, supply: &SupplyState, price: Option) { - self.receive_(supply, price, price.map(|price| (price, supply)), None); - } - - /// Process received output with custom price_to_amount updates (for address cohorts). - pub fn receive_( - &mut self, - supply: &SupplyState, - price: Option, - price_to_amount_increment: Option<(Dollars, &SupplyState)>, - price_to_amount_decrement: Option<(Dollars, &SupplyState)>, - ) { - self.supply += supply; - - if supply.value > Sats::ZERO - && let Some(realized) = self.realized.as_mut() - { - let price = price.unwrap(); - realized.receive(supply, price); - - if let Some((price, supply)) = price_to_amount_increment - && supply.value.is_not_zero() - { - self.price_to_amount - .as_mut() - .unwrap() - .increment(price, supply); - - // Update cache for added supply if let Some(cache) = self.cached_unrealized.as_mut() { - cache.on_receive(price, supply.value); + cache.on_receive(current.realized_price, current.supply_state.value); } } - if let Some((price, supply)) = price_to_amount_decrement - && supply.value.is_not_zero() - { - self.price_to_amount - .as_mut() - .unwrap() - .decrement(price, supply); + if prev.supply_state.value.is_not_zero() { + self.cost_basis_data.as_mut().unwrap().decrement( + prev.realized_price, + prev.supply_state.value, + prev.price_sats, + prev.investor_cap, + ); - // Update cache for removed supply if let Some(cache) = self.cached_unrealized.as_mut() { - cache.on_send(price, supply.value); + cache.on_send(prev.realized_price, prev.supply_state.value); } } } } - /// Process spent input (UTXO leaving cohort). - pub fn send( + pub fn send_utxo( &mut self, supply: &SupplyState, - current_price: Option, - prev_price: Option, + current_price: Option, + prev_price: Option, + ath: Option, age: Age, - ) { - self.send_( - supply, - current_price, - prev_price, - age, - None, - prev_price.map(|prev_price| (prev_price, supply)), - ); - } - - /// Process spent input with custom price_to_amount updates (for address cohorts). - #[allow(clippy::too_many_arguments)] - pub fn send_( - &mut self, - supply: &SupplyState, - current_price: Option, - prev_price: Option, - age: Age, - price_to_amount_increment: Option<(Dollars, &SupplyState)>, - price_to_amount_decrement: Option<(Dollars, &SupplyState)>, ) { if supply.utxo_count == 0 { return; @@ -281,77 +226,118 @@ impl CohortState { self.satdays_destroyed += age.satdays_destroyed(supply.value); if let Some(realized) = self.realized.as_mut() { - let current_price = current_price.unwrap(); - let prev_price = prev_price.unwrap(); - realized.send(supply, current_price, prev_price); + let cp = current_price.unwrap(); + let pp = prev_price.unwrap(); + let ath_price = ath.unwrap(); + let sats = supply.value; - if let Some((price, supply)) = price_to_amount_increment - && supply.value.is_not_zero() - { - self.price_to_amount - .as_mut() - .unwrap() - .increment(price, supply); + // 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); + + realized.send(current_ps, prev_ps, ath_ps, prev_investor_cap); + + self.cost_basis_data.as_mut().unwrap().decrement( + pp, + sats, + prev_ps, + prev_investor_cap, + ); + + if let Some(cache) = self.cached_unrealized.as_mut() { + cache.on_send(pp, sats); + } + } + } + } + + #[allow(clippy::too_many_arguments)] + pub fn send_address( + &mut self, + supply: &SupplyState, + current_price: CentsUnsigned, + prev_price: CentsUnsigned, + ath: CentsUnsigned, + age: Age, + current: &CostBasisSnapshot, + prev: &CostBasisSnapshot, + ) { + 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); + + if let Some(realized) = self.realized.as_mut() { + let sats = supply.value; + + // Compute once for realized.send using typed values + 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); + + realized.send(current_ps, prev_ps, ath_ps, prev_investor_cap); + + if current.supply_state.value.is_not_zero() { + self.cost_basis_data.as_mut().unwrap().increment( + current.realized_price, + current.supply_state.value, + current.price_sats, + current.investor_cap, + ); - // Update cache for added supply if let Some(cache) = self.cached_unrealized.as_mut() { - cache.on_receive(price, supply.value); + cache.on_receive(current.realized_price, current.supply_state.value); } } - if let Some((price, supply)) = price_to_amount_decrement - && supply.value.is_not_zero() - { - self.price_to_amount - .as_mut() - .unwrap() - .decrement(price, supply); + if prev.supply_state.value.is_not_zero() { + self.cost_basis_data.as_mut().unwrap().decrement( + prev.realized_price, + prev.supply_state.value, + prev.price_sats, + prev.investor_cap, + ); - // Update cache for removed supply if let Some(cache) = self.cached_unrealized.as_mut() { - cache.on_send(price, supply.value); + cache.on_send(prev.realized_price, prev.supply_state.value); } } } } } - /// Compute prices at percentile thresholds. - pub fn compute_percentile_prices(&self) -> [Dollars; PERCENTILES_LEN] { - match self.price_to_amount.as_ref() { - Some(p) if !p.is_empty() => p.compute_percentiles(), - _ => [Dollars::NAN; PERCENTILES_LEN], - } + pub fn compute_percentiles(&self) -> Option { + self.cost_basis_data.as_ref()?.compute_percentiles() } - /// Compute unrealized profit/loss at current price. - /// Uses O(k) incremental updates for height_price where k = flip range size. pub fn compute_unrealized_states( &mut self, - height_price: Dollars, - date_price: Option, + height_price: CentsUnsigned, + date_price: Option, ) -> (UnrealizedState, Option) { - let price_to_amount = match self.price_to_amount.as_ref() { + let cost_basis_data = match self.cost_basis_data.as_ref() { Some(p) if !p.is_empty() => p, - _ => { - return ( - UnrealizedState::NAN, - date_price.map(|_| UnrealizedState::NAN), - ); - } + _ => return (UnrealizedState::ZERO, date_price.map(|_| UnrealizedState::ZERO)), }; - // Date unrealized: compute from scratch (only at date boundaries, ~144x less frequent) let date_state = date_price.map(|date_price| { - CachedUnrealizedState::compute_full_standalone(date_price, price_to_amount) + CachedUnrealizedState::compute_full_standalone(date_price.into(), cost_basis_data) }); - // Height unrealized: use incremental cache (O(k) where k = flip range) let height_state = if let Some(cache) = self.cached_unrealized.as_mut() { - cache.get_at_price(height_price, price_to_amount).clone() + cache.get_at_price(height_price, cost_basis_data) } else { - let cache = CachedUnrealizedState::compute_fresh(height_price, price_to_amount); - let state = cache.state.clone(); + let cache = CachedUnrealizedState::compute_fresh(height_price, cost_basis_data); + let state = cache.current_state(); self.cached_unrealized = Some(cache); state }; @@ -359,33 +345,24 @@ impl CohortState { (height_state, date_state) } - /// Flush state to disk at checkpoint. pub fn write(&mut self, height: Height, cleanup: bool) -> Result<()> { - if let Some(p) = self.price_to_amount.as_mut() { + if let Some(p) = self.cost_basis_data.as_mut() { p.write(height, cleanup)?; } Ok(()) } - /// Get first (lowest) price in distribution. - pub fn min_price(&self) -> Option { - self.price_to_amount - .as_ref()? - .first_key_value() - .map(|(k, _)| k) + pub fn min_price(&self) -> Option { + self.cost_basis_data.as_ref()?.first_key_value().map(|(k, _)| k.into()) } - /// Get last (highest) price in distribution. - pub fn max_price(&self) -> Option { - self.price_to_amount - .as_ref()? - .last_key_value() - .map(|(k, _)| k) + pub fn max_price(&self) -> Option { + self.cost_basis_data.as_ref()?.last_key_value().map(|(k, _)| k.into()) } - /// Get iterator over price_to_amount for merged percentile computation. - /// Returns None if price data is not tracked for this cohort. - pub fn price_to_amount_iter(&self) -> Option> { - self.price_to_amount.as_ref().map(|p| p.iter()) + pub fn cost_basis_data_iter( + &self, + ) -> Option> { + self.cost_basis_data.as_ref().map(|p| p.iter().map(|(k, v)| (k.into(), v))) } } diff --git a/crates/brk_computer/src/distribution/state/cohort/utxo.rs b/crates/brk_computer/src/distribution/state/cohort/utxo.rs index eed6b08e9..0280a80bc 100644 --- a/crates/brk_computer/src/distribution/state/cohort/utxo.rs +++ b/crates/brk_computer/src/distribution/state/cohort/utxo.rs @@ -14,8 +14,8 @@ impl UTXOCohortState { Self(CohortState::new(path, name, compute_dollars)) } - pub fn reset_price_to_amount_if_needed(&mut self) -> Result<()> { - self.0.reset_price_to_amount_if_needed() + pub fn reset_cost_basis_data_if_needed(&mut self) -> Result<()> { + self.0.reset_cost_basis_data_if_needed() } /// Reset state for fresh start. @@ -25,7 +25,7 @@ impl UTXOCohortState { self.0.satblocks_destroyed = Sats::ZERO; self.0.satdays_destroyed = Sats::ZERO; if let Some(realized) = self.0.realized.as_mut() { - *realized = RealizedState::NAN; + *realized = RealizedState::default(); } } } diff --git a/crates/brk_computer/src/distribution/state/cost_basis/cost_basis_data.rs b/crates/brk_computer/src/distribution/state/cost_basis/cost_basis_data.rs new file mode 100644 index 000000000..7d1fa6007 --- /dev/null +++ b/crates/brk_computer/src/distribution/state/cost_basis/cost_basis_data.rs @@ -0,0 +1,323 @@ +use std::{ + collections::BTreeMap, + fs, + ops::Bound, + path::{Path, PathBuf}, +}; + +use brk_error::{Error, Result}; +use brk_types::{CentsSats, CentsSquaredSats, CentsUnsigned, CentsUnsignedCompact, Height, Sats}; +use pco::{ + ChunkConfig, + standalone::{simple_compress, simple_decompress}, +}; +use rustc_hash::FxHashMap; +use vecdb::Bytes; + +use crate::utils::OptionExt; + +use super::Percentiles; + +#[derive(Clone, Debug, Default)] +struct PendingRaw { + cap_inc: CentsSats, + cap_dec: CentsSats, + investor_cap_inc: CentsSquaredSats, + investor_cap_dec: CentsSquaredSats, +} + +#[derive(Clone, Debug)] +pub struct CostBasisData { + pathbuf: PathBuf, + state: Option, + pending: FxHashMap, + pending_raw: PendingRaw, +} + +const STATE_TO_KEEP: usize = 10; + +impl CostBasisData { + pub fn create(path: &Path, name: &str) -> Self { + Self { + pathbuf: path.join(format!("{name}_cost_basis")), + state: None, + pending: FxHashMap::default(), + pending_raw: PendingRaw::default(), + } + } + + pub fn import_at_or_before(&mut self, height: Height) -> Result { + let files = self.read_dir(None)?; + let (&height, path) = files.range(..=height).next_back().ok_or(Error::NotFound( + "No cost basis state found at or before height".into(), + ))?; + self.state = Some(State::deserialize(&fs::read(path)?)?); + self.pending.clear(); + self.pending_raw = PendingRaw::default(); + Ok(height) + } + + fn assert_pending_empty(&self) { + assert!( + self.pending.is_empty() && self.pending_raw_is_zero(), + "CostBasisData: pending not empty, call apply_pending first" + ); + } + + fn pending_raw_is_zero(&self) -> bool { + self.pending_raw.cap_inc == CentsSats::ZERO + && self.pending_raw.cap_dec == CentsSats::ZERO + && self.pending_raw.investor_cap_inc == CentsSquaredSats::ZERO + && self.pending_raw.investor_cap_dec == CentsSquaredSats::ZERO + } + + pub fn iter(&self) -> impl Iterator { + self.assert_pending_empty(); + self.state.u().map.iter().map(|(&k, v)| (k, v)) + } + + pub fn range( + &self, + bounds: (Bound, Bound), + ) -> impl Iterator { + self.assert_pending_empty(); + self.state.u().map.range(bounds).map(|(&k, v)| (k, v)) + } + + pub fn is_empty(&self) -> bool { + self.pending.is_empty() && self.state.u().map.is_empty() + } + + pub fn first_key_value(&self) -> Option<(CentsUnsignedCompact, &Sats)> { + self.assert_pending_empty(); + self.state.u().map.first_key_value().map(|(&k, v)| (k, v)) + } + + pub fn last_key_value(&self) -> Option<(CentsUnsignedCompact, &Sats)> { + self.assert_pending_empty(); + self.state.u().map.last_key_value().map(|(&k, v)| (k, v)) + } + + /// Get the exact cap_raw value (not recomputed from map). + pub fn cap_raw(&self) -> CentsSats { + self.assert_pending_empty(); + self.state.u().cap_raw + } + + /// Get the exact investor_cap_raw value (not recomputed from map). + pub fn investor_cap_raw(&self) -> CentsSquaredSats { + self.assert_pending_empty(); + self.state.u().investor_cap_raw + } + + /// Increment with pre-computed typed values + pub fn increment( + &mut self, + price: CentsUnsigned, + sats: Sats, + price_sats: CentsSats, + investor_cap: CentsSquaredSats, + ) { + self.pending.entry(price.into()).or_default().0 += sats; + self.pending_raw.cap_inc += price_sats; + if investor_cap != CentsSquaredSats::ZERO { + self.pending_raw.investor_cap_inc += investor_cap; + } + } + + /// Decrement with pre-computed typed values + pub fn decrement( + &mut self, + price: CentsUnsigned, + sats: Sats, + price_sats: CentsSats, + investor_cap: CentsSquaredSats, + ) { + self.pending.entry(price.into()).or_default().1 += sats; + self.pending_raw.cap_dec += price_sats; + if investor_cap != CentsSquaredSats::ZERO { + self.pending_raw.investor_cap_dec += investor_cap; + } + } + + pub fn apply_pending(&mut self) { + for (cents, (inc, dec)) in self.pending.drain() { + let entry = self.state.um().map.entry(cents).or_default(); + *entry += inc; + if *entry < dec { + panic!( + "CostBasisData::apply_pending underflow!\n\ + Path: {:?}\n\ + Price: {}\n\ + Current + increments: {}\n\ + Trying to decrement by: {}", + self.pathbuf, + cents.to_dollars(), + entry, + dec + ); + } + *entry -= dec; + if *entry == Sats::ZERO { + self.state.um().map.remove(¢s); + } + } + + // Apply raw values + let state = self.state.um(); + state.cap_raw += self.pending_raw.cap_inc; + + // Check for underflow before subtracting + if state.cap_raw.inner() < self.pending_raw.cap_dec.inner() { + panic!( + "CostBasisData::apply_pending cap_raw underflow!\n\ + Path: {:?}\n\ + Current cap_raw (after increments): {}\n\ + Trying to decrement by: {}", + self.pathbuf, state.cap_raw, self.pending_raw.cap_dec + ); + } + state.cap_raw -= self.pending_raw.cap_dec; + + // Only process investor_cap if there are non-zero values + let has_investor_cap = self.pending_raw.investor_cap_inc != CentsSquaredSats::ZERO + || self.pending_raw.investor_cap_dec != CentsSquaredSats::ZERO; + + if has_investor_cap { + state.investor_cap_raw += self.pending_raw.investor_cap_inc; + + if state.investor_cap_raw.inner() < self.pending_raw.investor_cap_dec.inner() { + panic!( + "CostBasisData::apply_pending investor_cap_raw underflow!\n\ + Path: {:?}\n\ + Current investor_cap_raw (after increments): {}\n\ + Trying to decrement by: {}", + self.pathbuf, state.investor_cap_raw, self.pending_raw.investor_cap_dec + ); + } + state.investor_cap_raw -= self.pending_raw.investor_cap_dec; + } + + self.pending_raw = PendingRaw::default(); + } + + pub fn init(&mut self) { + self.state.replace(State::default()); + self.pending.clear(); + self.pending_raw = PendingRaw::default(); + } + + pub fn compute_percentiles(&self) -> Option { + self.assert_pending_empty(); + Percentiles::compute(self.iter().map(|(k, &v)| (k, v))) + } + + pub fn clean(&mut self) -> Result<()> { + let _ = fs::remove_dir_all(&self.pathbuf); + fs::create_dir_all(&self.pathbuf)?; + Ok(()) + } + + fn read_dir(&self, keep_only_before: Option) -> Result> { + Ok(fs::read_dir(&self.pathbuf)? + .filter_map(|entry| { + let path = entry.ok()?.path(); + let name = path.file_name()?.to_str()?; + if let Ok(h) = name.parse::().map(Height::from) { + if keep_only_before.is_none_or(|height| h < height) { + Some((h, path)) + } else { + let _ = fs::remove_file(path); + None + } + } else { + None + } + }) + .collect::>()) + } + + pub fn write(&mut self, height: Height, cleanup: bool) -> Result<()> { + self.apply_pending(); + + if cleanup { + let files = self.read_dir(Some(height))?; + + for (_, path) in files + .iter() + .take(files.len().saturating_sub(STATE_TO_KEEP - 1)) + { + fs::remove_file(path)?; + } + } + + fs::write(self.path_state(height), self.state.u().serialize()?)?; + + Ok(()) + } + + fn path_state(&self, height: Height) -> PathBuf { + self.pathbuf.join(u32::from(height).to_string()) + } +} + +#[derive(Clone, Default, Debug)] +struct State { + map: BTreeMap, + /// Exact realized cap: Σ(price × sats) + cap_raw: CentsSats, + /// Exact investor cap: Σ(price² × sats) + investor_cap_raw: CentsSquaredSats, +} + +impl State { + fn serialize(&self) -> vecdb::Result> { + let keys: Vec = self.map.keys().map(|k| k.inner()).collect(); + let values: Vec = self.map.values().map(|v| u64::from(*v)).collect(); + + let config = ChunkConfig::default(); + let compressed_keys = simple_compress(&keys, &config)?; + let compressed_values = simple_compress(&values, &config)?; + + let mut buffer = Vec::new(); + buffer.extend(keys.len().to_bytes()); + buffer.extend(compressed_keys.len().to_bytes()); + buffer.extend(compressed_values.len().to_bytes()); + buffer.extend(compressed_keys); + buffer.extend(compressed_values); + buffer.extend(self.cap_raw.to_bytes()); + buffer.extend(self.investor_cap_raw.to_bytes()); + + Ok(buffer) + } + + fn deserialize(data: &[u8]) -> vecdb::Result { + let entry_count = usize::from_bytes(&data[0..8])?; + let keys_len = usize::from_bytes(&data[8..16])?; + let values_len = usize::from_bytes(&data[16..24])?; + + let keys_start = 24; + let values_start = keys_start + keys_len; + let raw_start = values_start + values_len; + + let keys: Vec = simple_decompress(&data[keys_start..values_start])?; + let values: Vec = simple_decompress(&data[values_start..raw_start])?; + + let map: BTreeMap = keys + .into_iter() + .zip(values) + .map(|(k, v)| (CentsUnsignedCompact::new(k), Sats::from(v))) + .collect(); + + assert_eq!(map.len(), entry_count); + + let cap_raw = CentsSats::from_bytes(&data[raw_start..raw_start + 16])?; + let investor_cap_raw = CentsSquaredSats::from_bytes(&data[raw_start + 16..raw_start + 32])?; + + Ok(Self { + map, + cap_raw, + investor_cap_raw, + }) + } +} diff --git a/crates/brk_computer/src/distribution/state/cost_basis/mod.rs b/crates/brk_computer/src/distribution/state/cost_basis/mod.rs index ac6add388..c6232f7d1 100644 --- a/crates/brk_computer/src/distribution/state/cost_basis/mod.rs +++ b/crates/brk_computer/src/distribution/state/cost_basis/mod.rs @@ -1,7 +1,9 @@ -mod price_to_amount; +mod cost_basis_data; +mod percentiles; mod realized; mod unrealized; -pub use price_to_amount::*; +pub use cost_basis_data::*; +pub use percentiles::*; pub use realized::*; pub use unrealized::*; diff --git a/crates/brk_computer/src/distribution/state/cost_basis/percentiles.rs b/crates/brk_computer/src/distribution/state/cost_basis/percentiles.rs new file mode 100644 index 000000000..556b0184f --- /dev/null +++ b/crates/brk_computer/src/distribution/state/cost_basis/percentiles.rs @@ -0,0 +1,66 @@ +use brk_types::{CentsUnsigned, CentsUnsignedCompact, Sats}; + +use crate::internal::{PERCENTILES, PERCENTILES_LEN}; + +#[derive(Clone, Copy, Debug)] +pub struct Percentiles { + /// Sat-weighted: percentiles by coin count + pub sat_weighted: [CentsUnsigned; PERCENTILES_LEN], + /// USD-weighted: percentiles by invested capital (sats × price) + pub usd_weighted: [CentsUnsigned; PERCENTILES_LEN], +} + +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 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() { + return None; + } + + // Compute totals + let mut total_sats: u64 = 0; + let mut total_usd: u128 = 0; + for &(cents, sats) in &entries { + total_sats += u64::from(sats); + total_usd += cents.as_u128() * sats.as_u128(); + } + + if total_sats == 0 { + return None; + } + + let mut sat_weighted = [CentsUnsigned::ZERO; PERCENTILES_LEN]; + let mut usd_weighted = [CentsUnsigned::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; + + for (cents, sats) in entries { + 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 + { + sat_weighted[sat_idx] = cents.into(); + sat_idx += 1; + } + + while usd_idx < PERCENTILES_LEN + && cumsum_usd >= total_usd * u128::from(PERCENTILES[usd_idx]) / 100 + { + usd_weighted[usd_idx] = cents.into(); + usd_idx += 1; + } + } + + Some(Self { + sat_weighted, + usd_weighted, + }) + } +} diff --git a/crates/brk_computer/src/distribution/state/cost_basis/price_to_amount.rs b/crates/brk_computer/src/distribution/state/cost_basis/price_to_amount.rs deleted file mode 100644 index c9fea735d..000000000 --- a/crates/brk_computer/src/distribution/state/cost_basis/price_to_amount.rs +++ /dev/null @@ -1,272 +0,0 @@ -use std::{ - collections::BTreeMap, - fs, - ops::Bound, - path::{Path, PathBuf}, -}; - -use brk_error::{Error, Result}; -use brk_types::{CentsCompact, Dollars, Height, Sats, SupplyState}; -use derive_more::{Deref, DerefMut}; -use pco::{standalone::{simple_compress, simple_decompress}, ChunkConfig}; -use rustc_hash::FxHashMap; -use serde::{Deserialize, Serialize}; -use vecdb::Bytes; - -use crate::{ - internal::{PERCENTILES, PERCENTILES_LEN}, - utils::OptionExt, -}; - -#[derive(Clone, Debug)] -pub struct PriceToAmount { - pathbuf: PathBuf, - state: Option, - /// Pending deltas: (total_increment, total_decrement) per price. - /// Flushed to BTreeMap before reads and at end of block. - pending: FxHashMap, -} - -const STATE_AT_: &str = "state_at_"; -const STATE_TO_KEEP: usize = 10; - -impl PriceToAmount { - pub fn create(path: &Path, name: &str) -> Self { - Self { - pathbuf: path.join(format!("{name}_price_to_amount")), - state: None, - pending: FxHashMap::default(), - } - } - - pub fn import_at_or_before(&mut self, height: Height) -> Result { - let files = self.read_dir(None)?; - let (&height, path) = files.range(..=height).next_back().ok_or(Error::NotFound( - "No price state found at or before height".into(), - ))?; - self.state = Some(State::deserialize(&fs::read(path)?)?); - self.pending.clear(); - Ok(height) - } - - fn assert_pending_empty(&self) { - assert!( - self.pending.is_empty(), - "PriceToAmount: pending not empty, call apply_pending first" - ); - } - - pub fn iter(&self) -> impl Iterator { - self.assert_pending_empty(); - self.state.u().iter().map(|(k, v)| (k.to_dollars(), v)) - } - - /// Iterate over entries in a price range with explicit bounds. - pub fn range( - &self, - bounds: (Bound, Bound), - ) -> impl Iterator { - self.assert_pending_empty(); - - let start = match bounds.0 { - Bound::Included(d) => Bound::Included(CentsCompact::from(d)), - Bound::Excluded(d) => Bound::Excluded(CentsCompact::from(d)), - Bound::Unbounded => Bound::Unbounded, - }; - - let end = match bounds.1 { - Bound::Included(d) => Bound::Included(CentsCompact::from(d)), - Bound::Excluded(d) => Bound::Excluded(CentsCompact::from(d)), - Bound::Unbounded => Bound::Unbounded, - }; - - self.state - .u() - .range((start, end)) - .map(|(k, v)| (k.to_dollars(), v)) - } - - pub fn is_empty(&self) -> bool { - self.pending.is_empty() && self.state.u().is_empty() - } - - pub fn first_key_value(&self) -> Option<(Dollars, &Sats)> { - self.assert_pending_empty(); - self.state - .u() - .first_key_value() - .map(|(k, v)| (k.to_dollars(), v)) - } - - pub fn last_key_value(&self) -> Option<(Dollars, &Sats)> { - self.assert_pending_empty(); - self.state - .u() - .last_key_value() - .map(|(k, v)| (k.to_dollars(), v)) - } - - /// Accumulate increment in pending batch. O(1). - pub fn increment(&mut self, price: Dollars, supply_state: &SupplyState) { - self.pending.entry(CentsCompact::from(price)).or_default().0 += supply_state.value; - } - - /// Accumulate decrement in pending batch. O(1). - pub fn decrement(&mut self, price: Dollars, supply_state: &SupplyState) { - self.pending.entry(CentsCompact::from(price)).or_default().1 += supply_state.value; - } - - /// Apply pending deltas to BTreeMap. O(k log n) where k = unique prices in pending. - /// Must be called before any read operations. - pub fn apply_pending(&mut self) { - for (cents, (inc, dec)) in self.pending.drain() { - let entry = self.state.um().entry(cents).or_default(); - *entry += inc; - if *entry < dec { - panic!( - "PriceToAmount::apply_pending underflow!\n\ - Path: {:?}\n\ - Price: {}\n\ - Current + increments: {}\n\ - Trying to decrement by: {}", - self.pathbuf, - cents.to_dollars(), - entry, - dec - ); - } - *entry -= dec; - if *entry == Sats::ZERO { - self.state.um().remove(¢s); - } - } - } - - pub fn init(&mut self) { - self.state.replace(State::default()); - self.pending.clear(); - } - - /// Compute percentile prices by iterating the BTreeMap directly. - /// O(n) where n = number of unique prices. - pub fn compute_percentiles(&self) -> [Dollars; PERCENTILES_LEN] { - self.assert_pending_empty(); - - let state = match self.state.as_ref() { - Some(s) if !s.is_empty() => s, - _ => return [Dollars::NAN; PERCENTILES_LEN], - }; - - let total: u64 = state.values().map(|&s| u64::from(s)).sum(); - if total == 0 { - return [Dollars::NAN; PERCENTILES_LEN]; - } - - let mut result = [Dollars::NAN; PERCENTILES_LEN]; - let mut cumsum = 0u64; - let mut idx = 0; - - for (¢s, &amount) in state.iter() { - cumsum += u64::from(amount); - while idx < PERCENTILES_LEN && cumsum >= total * u64::from(PERCENTILES[idx]) / 100 { - result[idx] = cents.to_dollars(); - idx += 1; - } - } - - result - } - - pub fn clean(&mut self) -> Result<()> { - let _ = fs::remove_dir_all(&self.pathbuf); - fs::create_dir_all(&self.pathbuf)?; - Ok(()) - } - - fn read_dir(&self, keep_only_before: Option) -> Result> { - Ok(fs::read_dir(&self.pathbuf)? - .filter_map(|entry| { - let path = entry.ok()?.path(); - let name = path.file_name()?.to_str()?; - let height_str = name.strip_prefix(STATE_AT_).unwrap_or(name); - if let Ok(h) = height_str.parse::().map(Height::from) { - if keep_only_before.is_none_or(|height| h < height) { - Some((h, path)) - } else { - let _ = fs::remove_file(path); - None - } - } else { - None - } - }) - .collect::>()) - } - - /// Flush state to disk, optionally cleaning up old state files. - pub fn write(&mut self, height: Height, cleanup: bool) -> Result<()> { - self.apply_pending(); - - if cleanup { - let files = self.read_dir(Some(height))?; - - for (_, path) in files - .iter() - .take(files.len().saturating_sub(STATE_TO_KEEP - 1)) - { - fs::remove_file(path)?; - } - } - - fs::write(self.path_state(height), self.state.u().serialize()?)?; - - Ok(()) - } - - fn path_state(&self, height: Height) -> PathBuf { - Self::path_state_(&self.pathbuf, height) - } - fn path_state_(path: &Path, height: Height) -> PathBuf { - path.join(u32::from(height).to_string()) - } -} - -#[derive(Clone, Default, Debug, Deref, DerefMut, Serialize, Deserialize)] -struct State(BTreeMap); - -impl State { - fn serialize(&self) -> vecdb::Result> { - let keys: Vec = self.keys().map(|k| i32::from(*k)).collect(); - let values: Vec = self.values().map(|v| u64::from(*v)).collect(); - - let config = ChunkConfig::default(); - let compressed_keys = simple_compress(&keys, &config)?; - let compressed_values = simple_compress(&values, &config)?; - - let mut buffer = Vec::new(); - buffer.extend(keys.len().to_bytes()); - buffer.extend(compressed_keys.len().to_bytes()); - buffer.extend(compressed_keys); - buffer.extend(compressed_values); - - Ok(buffer) - } - - fn deserialize(data: &[u8]) -> vecdb::Result { - let entry_count = usize::from_bytes(&data[0..8])?; - let keys_len = usize::from_bytes(&data[8..16])?; - - let keys: Vec = simple_decompress(&data[16..16 + keys_len])?; - let values: Vec = simple_decompress(&data[16 + keys_len..])?; - - let map: BTreeMap = keys - .into_iter() - .zip(values) - .map(|(k, v)| (CentsCompact::from(k), Sats::from(v))) - .collect(); - - assert_eq!(map.len(), entry_count); - - Ok(Self(map)) - } -} diff --git a/crates/brk_computer/src/distribution/state/cost_basis/realized.rs b/crates/brk_computer/src/distribution/state/cost_basis/realized.rs index d7f95aa9a..e309cf7ab 100644 --- a/crates/brk_computer/src/distribution/state/cost_basis/realized.rs +++ b/crates/brk_computer/src/distribution/state/cost_basis/realized.rs @@ -1,88 +1,222 @@ use std::cmp::Ordering; -use brk_types::{CheckedSub, Dollars, SupplyState}; +use brk_types::{CentsSats, CentsSquaredSats, CentsUnsigned, Sats}; +/// Realized state using u128 for raw cent*sat values internally. +/// This avoids overflow and defers division to output time for efficiency. #[derive(Debug, Default, Clone)] pub struct RealizedState { - pub cap: Dollars, - pub profit: Dollars, - pub loss: Dollars, - pub value_created: Dollars, - pub value_destroyed: Dollars, + /// Raw realized cap: Σ(price × sats) + cap_raw: u128, + /// Raw investor cap: Σ(price² × sats) + /// investor_price = investor_cap_raw / cap_raw (gives cents directly) + investor_cap_raw: CentsSquaredSats, + /// Raw realized profit (cents * sats) + profit_raw: u128, + /// Raw realized loss (cents * sats) + loss_raw: u128, + /// sell_price × sats for profit cases + profit_value_created_raw: u128, + /// cost_basis × sats for profit cases + profit_value_destroyed_raw: u128, + /// sell_price × sats for loss cases + loss_value_created_raw: u128, + /// cost_basis × sats for loss cases (= capitulation_flow) + loss_value_destroyed_raw: u128, + /// Raw realized ATH regret: Σ((ath - sell_price) × sats) + ath_regret_raw: u128, } impl RealizedState { - pub const NAN: Self = Self { - cap: Dollars::NAN, - profit: Dollars::NAN, - loss: Dollars::NAN, - value_created: Dollars::NAN, - value_destroyed: Dollars::NAN, - }; + /// Get realized cap as CentsUnsigned (divides by ONE_BTC). + #[inline] + pub fn cap(&self) -> CentsUnsigned { + CentsUnsigned::new((self.cap_raw / Sats::ONE_BTC_U128) as u64) + } + + /// Set cap_raw directly from persisted value. + #[inline] + pub fn set_cap_raw(&mut self, cap_raw: CentsSats) { + self.cap_raw = cap_raw.inner(); + } + + /// Set investor_cap_raw directly from persisted value. + #[inline] + pub fn set_investor_cap_raw(&mut self, investor_cap_raw: CentsSquaredSats) { + self.investor_cap_raw = investor_cap_raw; + } + + /// Get investor price as CentsUnsigned. + /// investor_price = Σ(price² × sats) / Σ(price × sats) + /// This is the dollar-weighted average acquisition price. + #[inline] + pub fn investor_price(&self) -> CentsUnsigned { + if self.cap_raw == 0 { + return CentsUnsigned::ZERO; + } + CentsUnsigned::new((self.investor_cap_raw / self.cap_raw) as u64) + } + + /// Get raw realized cap for aggregation. + #[inline] + pub fn cap_raw(&self) -> CentsSats { + CentsSats::new(self.cap_raw) + } + + /// Get raw investor cap for aggregation. + #[inline] + pub fn investor_cap_raw(&self) -> CentsSquaredSats { + self.investor_cap_raw + } + + /// Get realized profit as CentsUnsigned. + #[inline] + pub fn profit(&self) -> CentsUnsigned { + CentsUnsigned::new((self.profit_raw / Sats::ONE_BTC_U128) as u64) + } + + /// Get realized loss as CentsUnsigned. + #[inline] + pub fn loss(&self) -> CentsUnsigned { + CentsUnsigned::new((self.loss_raw / Sats::ONE_BTC_U128) as u64) + } + + /// Get value created as CentsUnsigned (derived from profit + loss splits). + #[inline] + pub fn value_created(&self) -> CentsUnsigned { + let raw = self.profit_value_created_raw + self.loss_value_created_raw; + CentsUnsigned::new((raw / Sats::ONE_BTC_U128) as u64) + } + + /// Get value destroyed as CentsUnsigned (derived from profit + loss splits). + #[inline] + pub fn value_destroyed(&self) -> CentsUnsigned { + let raw = self.profit_value_destroyed_raw + self.loss_value_destroyed_raw; + CentsUnsigned::new((raw / Sats::ONE_BTC_U128) as u64) + } + + /// Get profit value created as CentsUnsigned (sell_price × sats for profit cases). + #[inline] + pub fn profit_value_created(&self) -> CentsUnsigned { + CentsUnsigned::new((self.profit_value_created_raw / Sats::ONE_BTC_U128) as u64) + } + + /// Get profit value destroyed as CentsUnsigned (cost_basis × sats for profit cases). + /// This is also known as profit_flow. + #[inline] + pub fn profit_value_destroyed(&self) -> CentsUnsigned { + CentsUnsigned::new((self.profit_value_destroyed_raw / Sats::ONE_BTC_U128) as u64) + } + + /// Get loss value created as CentsUnsigned (sell_price × sats for loss cases). + #[inline] + pub fn loss_value_created(&self) -> CentsUnsigned { + CentsUnsigned::new((self.loss_value_created_raw / Sats::ONE_BTC_U128) as u64) + } + + /// Get loss value destroyed as CentsUnsigned (cost_basis × sats for loss cases). + /// This is also known as capitulation_flow. + #[inline] + pub fn loss_value_destroyed(&self) -> CentsUnsigned { + CentsUnsigned::new((self.loss_value_destroyed_raw / Sats::ONE_BTC_U128) as u64) + } + + /// Get capitulation flow as CentsUnsigned. + /// This is the invested capital (cost_basis × sats) sold at a loss. + /// Alias for loss_value_destroyed. + #[inline] + pub fn capitulation_flow(&self) -> CentsUnsigned { + self.loss_value_destroyed() + } + + /// Get profit flow as CentsUnsigned. + /// This is the invested capital (cost_basis × sats) sold at a profit. + /// Alias for profit_value_destroyed. + #[inline] + pub fn profit_flow(&self) -> CentsUnsigned { + self.profit_value_destroyed() + } + + /// Get realized ATH regret as CentsUnsigned. + /// This is Σ((ath - sell_price) × sats) - how much more could have been made + /// by selling at ATH instead of when actually sold. + #[inline] + pub fn ath_regret(&self) -> CentsUnsigned { + CentsUnsigned::new((self.ath_regret_raw / Sats::ONE_BTC_U128) as u64) + } pub fn reset_single_iteration_values(&mut self) { - if self.cap != Dollars::NAN { - self.profit = Dollars::ZERO; - self.loss = Dollars::ZERO; - self.value_created = Dollars::ZERO; - self.value_destroyed = Dollars::ZERO; - } + self.profit_raw = 0; + self.loss_raw = 0; + self.profit_value_created_raw = 0; + self.profit_value_destroyed_raw = 0; + self.loss_value_created_raw = 0; + self.loss_value_destroyed_raw = 0; + self.ath_regret_raw = 0; } - pub fn increment(&mut self, supply_state: &SupplyState, price: Dollars) { - if supply_state.value.is_zero() { + /// Increment using pre-computed values (for UTXO path) + #[inline] + pub fn increment(&mut self, price: CentsUnsigned, sats: Sats) { + if sats.is_zero() { return; } - - self.increment_(price * supply_state.value) + let price_sats = CentsSats::from_price_sats(price, sats); + self.cap_raw += price_sats.as_u128(); + self.investor_cap_raw += price_sats.to_investor_cap(price); } - pub fn increment_(&mut self, realized_cap: Dollars) { - if self.cap == Dollars::NAN { - self.cap = Dollars::ZERO; - self.profit = Dollars::ZERO; - self.loss = Dollars::ZERO; - self.value_created = Dollars::ZERO; - self.value_destroyed = Dollars::ZERO; - } - - self.cap += realized_cap; + /// Increment using pre-computed snapshot values (for address path) + #[inline] + pub fn increment_snapshot(&mut self, price_sats: CentsSats, investor_cap: CentsSquaredSats) { + self.cap_raw += price_sats.as_u128(); + self.investor_cap_raw += investor_cap; } - pub fn decrement(&mut self, supply_state: &SupplyState, price: Dollars) { - self.decrement_(price * supply_state.value); + /// Decrement using pre-computed snapshot values (for address path) + #[inline] + pub fn decrement_snapshot(&mut self, price_sats: CentsSats, investor_cap: CentsSquaredSats) { + self.cap_raw -= price_sats.as_u128(); + self.investor_cap_raw -= investor_cap; } - pub fn decrement_(&mut self, realized_cap: Dollars) { - self.cap = self.cap.checked_sub(realized_cap).unwrap(); - } - - pub fn receive(&mut self, supply_state: &SupplyState, current_price: Dollars) { - self.increment(supply_state, current_price); + #[inline] + pub fn receive(&mut self, price: CentsUnsigned, sats: Sats) { + self.increment(price, sats); } + /// Send with pre-computed typed values. Inlines decrement to avoid recomputation. + #[inline] pub fn send( &mut self, - supply_state: &SupplyState, - current_price: Dollars, - prev_price: Dollars, + current_ps: CentsSats, + prev_ps: CentsSats, + ath_ps: CentsSats, + prev_investor_cap: CentsSquaredSats, ) { - let current_value = current_price * supply_state.value; - let prev_value = prev_price * supply_state.value; - - self.value_created += current_value; - self.value_destroyed += prev_value; - - match current_price.cmp(&prev_price) { + match current_ps.cmp(&prev_ps) { Ordering::Greater => { - self.profit += current_value.checked_sub(prev_value).unwrap(); + self.profit_raw += (current_ps - prev_ps).as_u128(); + self.profit_value_created_raw += current_ps.as_u128(); + self.profit_value_destroyed_raw += prev_ps.as_u128(); } Ordering::Less => { - self.loss += prev_value.checked_sub(current_value).unwrap(); + self.loss_raw += (prev_ps - current_ps).as_u128(); + self.loss_value_created_raw += current_ps.as_u128(); + self.loss_value_destroyed_raw += prev_ps.as_u128(); + } + Ordering::Equal => { + // Break-even: count as profit side (arbitrary but consistent) + self.profit_value_created_raw += current_ps.as_u128(); + self.profit_value_destroyed_raw += prev_ps.as_u128(); } - Ordering::Equal => {} } - self.decrement(supply_state, prev_price); + // Track ATH regret: (ath - sell_price) × sats + self.ath_regret_raw += (ath_ps - current_ps).as_u128(); + + // Inline decrement to avoid recomputation + self.cap_raw -= prev_ps.as_u128(); + self.investor_cap_raw -= prev_investor_cap; } } diff --git a/crates/brk_computer/src/distribution/state/cost_basis/unrealized.rs b/crates/brk_computer/src/distribution/state/cost_basis/unrealized.rs index 88a2d86f7..705d8543f 100644 --- a/crates/brk_computer/src/distribution/state/cost_basis/unrealized.rs +++ b/crates/brk_computer/src/distribution/state/cost_basis/unrealized.rs @@ -1,253 +1,328 @@ use std::ops::Bound; -use brk_types::{CentsUnsigned, Dollars, Sats}; -use vecdb::CheckedSub; +use brk_types::{CentsUnsigned, CentsUnsignedCompact, Sats}; -use super::price_to_amount::PriceToAmount; +use super::cost_basis_data::CostBasisData; #[derive(Debug, Default, Clone)] pub struct UnrealizedState { pub supply_in_profit: Sats, pub supply_in_loss: Sats, - pub unrealized_profit: Dollars, - pub unrealized_loss: Dollars, - /// Invested capital in profit: Σ(sats × price) where price <= spot - pub invested_capital_in_profit: Dollars, - /// Invested capital in loss: Σ(sats × price) where price > spot - pub invested_capital_in_loss: Dollars, + pub unrealized_profit: CentsUnsigned, + pub unrealized_loss: CentsUnsigned, + pub invested_capital_in_profit: CentsUnsigned, + pub invested_capital_in_loss: CentsUnsigned, + /// Raw Σ(price² × sats) for UTXOs in profit. Used for aggregation. + pub investor_cap_in_profit_raw: u128, + /// Raw Σ(price² × sats) for UTXOs in loss. Used for aggregation. + pub investor_cap_in_loss_raw: u128, + /// Raw Σ(price × sats) for UTXOs in profit. Used for aggregation. + pub invested_capital_in_profit_raw: u128, + /// Raw Σ(price × sats) for UTXOs in loss. Used for aggregation. + pub invested_capital_in_loss_raw: u128, } impl UnrealizedState { - pub const NAN: Self = Self { - supply_in_profit: Sats::ZERO, - supply_in_loss: Sats::ZERO, - unrealized_profit: Dollars::NAN, - unrealized_loss: Dollars::NAN, - invested_capital_in_profit: Dollars::NAN, - invested_capital_in_loss: Dollars::NAN, - }; - pub const ZERO: Self = Self { supply_in_profit: Sats::ZERO, supply_in_loss: Sats::ZERO, - unrealized_profit: Dollars::ZERO, - unrealized_loss: Dollars::ZERO, - invested_capital_in_profit: Dollars::ZERO, - invested_capital_in_loss: Dollars::ZERO, + unrealized_profit: CentsUnsigned::ZERO, + unrealized_loss: CentsUnsigned::ZERO, + invested_capital_in_profit: CentsUnsigned::ZERO, + invested_capital_in_loss: CentsUnsigned::ZERO, + investor_cap_in_profit_raw: 0, + investor_cap_in_loss_raw: 0, + invested_capital_in_profit_raw: 0, + invested_capital_in_loss_raw: 0, }; + + /// Compute pain_index from raw values. + /// pain_index = investor_price_of_losers - spot + #[inline] + pub fn pain_index(&self, spot: CentsUnsigned) -> CentsUnsigned { + if self.invested_capital_in_loss_raw == 0 { + return CentsUnsigned::ZERO; + } + let investor_price_losers = + self.investor_cap_in_loss_raw / self.invested_capital_in_loss_raw; + CentsUnsigned::new((investor_price_losers - spot.as_u128()) as u64) + } + + /// Compute greed_index from raw values. + /// greed_index = spot - investor_price_of_winners + #[inline] + pub fn greed_index(&self, spot: CentsUnsigned) -> CentsUnsigned { + if self.invested_capital_in_profit_raw == 0 { + return CentsUnsigned::ZERO; + } + let investor_price_winners = + self.investor_cap_in_profit_raw / self.invested_capital_in_profit_raw; + CentsUnsigned::new((spot.as_u128() - investor_price_winners) as u64) + } +} + +/// Internal cache state using u128 for raw cent*sat values. +/// This avoids rounding errors from premature division by ONE_BTC. +/// Division happens only when converting to UnrealizedState output. +#[derive(Debug, Default, Clone)] +struct CachedStateRaw { + supply_in_profit: Sats, + supply_in_loss: Sats, + /// Raw value: sum of (price_cents * sats) for UTXOs in profit + unrealized_profit: u128, + /// Raw value: sum of (price_cents * sats) for UTXOs in loss + unrealized_loss: u128, + /// Raw value: sum of (price_cents * sats) for UTXOs in profit + invested_capital_in_profit: u128, + /// Raw value: sum of (price_cents * sats) for UTXOs in loss + invested_capital_in_loss: u128, + /// Raw value: sum of (price_cents² * sats) for UTXOs in profit + investor_cap_in_profit: u128, + /// Raw value: sum of (price_cents² * sats) for UTXOs in loss + investor_cap_in_loss: u128, +} + +impl CachedStateRaw { + /// Convert raw values to final output by dividing by ONE_BTC. + fn to_output(&self) -> UnrealizedState { + UnrealizedState { + supply_in_profit: self.supply_in_profit, + supply_in_loss: self.supply_in_loss, + unrealized_profit: CentsUnsigned::new( + (self.unrealized_profit / Sats::ONE_BTC_U128) as u64, + ), + unrealized_loss: CentsUnsigned::new( + (self.unrealized_loss / Sats::ONE_BTC_U128) as u64, + ), + invested_capital_in_profit: CentsUnsigned::new( + (self.invested_capital_in_profit / Sats::ONE_BTC_U128) as u64, + ), + invested_capital_in_loss: CentsUnsigned::new( + (self.invested_capital_in_loss / Sats::ONE_BTC_U128) as u64, + ), + investor_cap_in_profit_raw: self.investor_cap_in_profit, + investor_cap_in_loss_raw: self.investor_cap_in_loss, + invested_capital_in_profit_raw: self.invested_capital_in_profit, + invested_capital_in_loss_raw: self.invested_capital_in_loss, + } + } } -/// Cached unrealized state for O(k) incremental updates. -/// k = number of entries in price flip range (typically tiny). #[derive(Debug, Clone)] pub struct CachedUnrealizedState { - pub state: UnrealizedState, - at_price: Dollars, + state: CachedStateRaw, + at_price: CentsUnsignedCompact, } impl CachedUnrealizedState { - /// Create new cache by computing from scratch. O(n). - pub fn compute_fresh(price: Dollars, price_to_amount: &PriceToAmount) -> Self { - let state = Self::compute_full_standalone(price, price_to_amount); - Self { - state, - at_price: price, - } + pub fn compute_fresh(price: CentsUnsigned, cost_basis_data: &CostBasisData) -> Self { + let price: CentsUnsignedCompact = price.into(); + let state = Self::compute_raw(price, cost_basis_data); + Self { state, at_price: price } + } + + /// Get the current cached state as output (without price update). + pub fn current_state(&self) -> UnrealizedState { + self.state.to_output() } - /// Get unrealized state at new_price. O(k) where k = flip range size. pub fn get_at_price( &mut self, - new_price: Dollars, - price_to_amount: &PriceToAmount, - ) -> &UnrealizedState { + new_price: CentsUnsigned, + cost_basis_data: &CostBasisData, + ) -> UnrealizedState { + let new_price: CentsUnsignedCompact = new_price.into(); if new_price != self.at_price { - self.update_for_price_change(new_price, price_to_amount); + self.update_for_price_change(new_price, cost_basis_data); } - &self.state + self.state.to_output() } - /// Update cached state when a receive happens. - /// Determines profit/loss classification relative to cached price. - pub fn on_receive(&mut self, purchase_price: Dollars, sats: Sats) { - let invested_capital = purchase_price * sats; - if purchase_price <= self.at_price { + pub fn on_receive(&mut self, price: CentsUnsigned, sats: Sats) { + let price: CentsUnsignedCompact = price.into(); + let sats_u128 = sats.as_u128(); + let price_u128 = price.as_u128(); + let invested_capital = price_u128 * sats_u128; + let investor_cap = price_u128 * invested_capital; + + if price <= self.at_price { self.state.supply_in_profit += sats; self.state.invested_capital_in_profit += invested_capital; - if purchase_price < self.at_price { - let diff = self.at_price.checked_sub(purchase_price).unwrap(); - self.state.unrealized_profit += diff * sats; + self.state.investor_cap_in_profit += investor_cap; + if price < self.at_price { + let diff = (self.at_price - price).as_u128(); + self.state.unrealized_profit += diff * sats_u128; } } else { self.state.supply_in_loss += sats; self.state.invested_capital_in_loss += invested_capital; - let diff = purchase_price.checked_sub(self.at_price).unwrap(); - self.state.unrealized_loss += diff * sats; + self.state.investor_cap_in_loss += investor_cap; + let diff = (price - self.at_price).as_u128(); + self.state.unrealized_loss += diff * sats_u128; } } - /// Update cached state when a send happens from historical price. - pub fn on_send(&mut self, historical_price: Dollars, sats: Sats) { - let invested_capital = historical_price * sats; - if historical_price <= self.at_price { - // Was in profit + pub fn on_send(&mut self, price: CentsUnsigned, sats: Sats) { + let price: CentsUnsignedCompact = price.into(); + let sats_u128 = sats.as_u128(); + let price_u128 = price.as_u128(); + let invested_capital = price_u128 * sats_u128; + let investor_cap = price_u128 * invested_capital; + + if price <= self.at_price { self.state.supply_in_profit -= sats; - self.state.invested_capital_in_profit = self - .state - .invested_capital_in_profit - .checked_sub(invested_capital) - .unwrap(); - if historical_price < self.at_price { - let diff = self.at_price.checked_sub(historical_price).unwrap(); - let profit_removed = diff * sats; - self.state.unrealized_profit = self - .state - .unrealized_profit - .checked_sub(profit_removed) - .unwrap_or(Dollars::ZERO); + self.state.invested_capital_in_profit -= invested_capital; + self.state.investor_cap_in_profit -= investor_cap; + if price < self.at_price { + let diff = (self.at_price - price).as_u128(); + self.state.unrealized_profit -= diff * sats_u128; } } else { - // Was in loss self.state.supply_in_loss -= sats; - self.state.invested_capital_in_loss = self - .state - .invested_capital_in_loss - .checked_sub(invested_capital) - .unwrap(); - let diff = historical_price.checked_sub(self.at_price).unwrap(); - let loss_removed = diff * sats; - self.state.unrealized_loss = self - .state - .unrealized_loss - .checked_sub(loss_removed) - .unwrap_or(Dollars::ZERO); + self.state.invested_capital_in_loss -= invested_capital; + self.state.investor_cap_in_loss -= investor_cap; + let diff = (price - self.at_price).as_u128(); + self.state.unrealized_loss -= diff * sats_u128; } } - /// Incremental update for price change. O(k) where k = entries in flip range. - fn update_for_price_change(&mut self, new_price: Dollars, price_to_amount: &PriceToAmount) { + fn update_for_price_change( + &mut self, + new_price: CentsUnsignedCompact, + cost_basis_data: &CostBasisData, + ) { let old_price = self.at_price; - let delta_f64 = f64::from(new_price) - f64::from(old_price); - // Update profit/loss for entries that DON'T flip - // Profit changes by delta * supply_in_profit - // Loss changes by -delta * supply_in_loss - if delta_f64 > 0.0 { - // Price went up: profits increase, losses decrease - self.state.unrealized_profit += Dollars::from(delta_f64) * self.state.supply_in_profit; - let loss_decrease = Dollars::from(delta_f64) * self.state.supply_in_loss; - self.state.unrealized_loss = self - .state - .unrealized_loss - .checked_sub(loss_decrease) - .unwrap_or(Dollars::ZERO); - } else if delta_f64 < 0.0 { - // Price went down: profits decrease, losses increase - let profit_decrease = Dollars::from(-delta_f64) * self.state.supply_in_profit; - self.state.unrealized_profit = self - .state - .unrealized_profit - .checked_sub(profit_decrease) - .unwrap_or(Dollars::ZERO); - self.state.unrealized_loss += Dollars::from(-delta_f64) * self.state.supply_in_loss; - } - - // Handle flipped entries (only iterate the small range between prices) if new_price > old_price { - // Price went up: entries where old < price <= new flip from loss to profit + let delta = (new_price - old_price).as_u128(); + + // Save original supply for delta calculation (before crossing UTXOs move) + let original_supply_in_profit = self.state.supply_in_profit.as_u128(); + + // First, process UTXOs crossing from loss to profit + // Range (old_price, new_price] means: old_price < price <= new_price for (price, &sats) in - price_to_amount.range((Bound::Excluded(old_price), Bound::Included(new_price))) + cost_basis_data.range((Bound::Excluded(old_price), Bound::Included(new_price))) { - // Move from loss to profit + let sats_u128 = sats.as_u128(); + let price_u128 = price.as_u128(); + let invested_capital = price_u128 * sats_u128; + let investor_cap = price_u128 * invested_capital; + + // Move between buckets self.state.supply_in_loss -= sats; self.state.supply_in_profit += sats; + self.state.invested_capital_in_loss -= invested_capital; + self.state.invested_capital_in_profit += invested_capital; + self.state.investor_cap_in_loss -= investor_cap; + self.state.investor_cap_in_profit += investor_cap; - // Undo the loss adjustment applied above for this entry - // We decreased loss by delta * sats, but this entry should be removed entirely - // Original loss: (price - old_price) * sats - // After global adjustment: original - delta * sats (negative, wrong) - // Correct: 0 (removed from loss) - // Correction: add back delta * sats, then add original loss - let delta_adj = Dollars::from(delta_f64) * sats; - self.state.unrealized_loss += delta_adj; - if price > old_price { - let original_loss = price.checked_sub(old_price).unwrap() * sats; - self.state.unrealized_loss += original_loss; - } + // Remove their original contribution to unrealized_loss + // (price > old_price is always true due to Bound::Excluded) + let original_loss = (price - old_price).as_u128(); + self.state.unrealized_loss -= original_loss * sats_u128; - // Undo the profit adjustment applied above for this entry - // We increased profit by delta * sats, but this entry was not in profit before - // Correct profit: (new_price - price) * sats - // Correction: subtract delta * sats, add correct profit - let profit_adj = Dollars::from(delta_f64) * sats; - self.state.unrealized_profit = self - .state - .unrealized_profit - .checked_sub(profit_adj) - .unwrap_or(Dollars::ZERO); - if new_price > price { - let correct_profit = new_price.checked_sub(price).unwrap() * sats; - self.state.unrealized_profit += correct_profit; + // Add their new contribution to unrealized_profit (if not at boundary) + if price < new_price { + let new_profit = (new_price - price).as_u128(); + self.state.unrealized_profit += new_profit * sats_u128; } } + + // Apply delta to non-crossing UTXOs only + // Non-crossing profit UTXOs: their profit increases by delta + self.state.unrealized_profit += delta * original_supply_in_profit; + // Non-crossing loss UTXOs: their loss decreases by delta + let non_crossing_loss_sats = + self.state.supply_in_loss.as_u128(); // Already excludes crossing + self.state.unrealized_loss -= delta * non_crossing_loss_sats; } else if new_price < old_price { - // Price went down: entries where new < price <= old flip from profit to loss + let delta = (old_price - new_price).as_u128(); + + // Save original supply for delta calculation (before crossing UTXOs move) + let original_supply_in_loss = self.state.supply_in_loss.as_u128(); + + // First, process UTXOs crossing from profit to loss + // Range (new_price, old_price] means: new_price < price <= old_price for (price, &sats) in - price_to_amount.range((Bound::Excluded(new_price), Bound::Included(old_price))) + cost_basis_data.range((Bound::Excluded(new_price), Bound::Included(old_price))) { - // Move from profit to loss + let sats_u128 = sats.as_u128(); + let price_u128 = price.as_u128(); + let invested_capital = price_u128 * sats_u128; + let investor_cap = price_u128 * invested_capital; + + // Move between buckets self.state.supply_in_profit -= sats; self.state.supply_in_loss += sats; + self.state.invested_capital_in_profit -= invested_capital; + self.state.invested_capital_in_loss += invested_capital; + self.state.investor_cap_in_profit -= investor_cap; + self.state.investor_cap_in_loss += investor_cap; - // Undo the profit adjustment applied above for this entry - let delta_adj = Dollars::from(-delta_f64) * sats; - self.state.unrealized_profit += delta_adj; - if old_price > price { - let original_profit = old_price.checked_sub(price).unwrap() * sats; - self.state.unrealized_profit += original_profit; + // Remove their original contribution to unrealized_profit (if not at boundary) + if price < old_price { + let original_profit = (old_price - price).as_u128(); + self.state.unrealized_profit -= original_profit * sats_u128; } - // Undo the loss adjustment applied above for this entry - let loss_adj = Dollars::from(-delta_f64) * sats; - self.state.unrealized_loss = self - .state - .unrealized_loss - .checked_sub(loss_adj) - .unwrap_or(Dollars::ZERO); - if price > new_price { - let correct_loss = price.checked_sub(new_price).unwrap() * sats; - self.state.unrealized_loss += correct_loss; - } + // Add their new contribution to unrealized_loss + // (price > new_price is always true due to Bound::Excluded) + let new_loss = (price - new_price).as_u128(); + self.state.unrealized_loss += new_loss * sats_u128; } + + // Apply delta to non-crossing UTXOs only + // Non-crossing loss UTXOs: their loss increases by delta + self.state.unrealized_loss += delta * original_supply_in_loss; + // Non-crossing profit UTXOs: their profit decreases by delta + let non_crossing_profit_sats = + self.state.supply_in_profit.as_u128(); // Already excludes crossing + self.state.unrealized_profit -= delta * non_crossing_profit_sats; } self.at_price = new_price; } - /// Full computation from scratch (no cache). O(n). - pub fn compute_full_standalone( - current_price: Dollars, - price_to_amount: &PriceToAmount, - ) -> UnrealizedState { - let mut state = UnrealizedState::ZERO; + /// Compute raw cached state from cost_basis_data. + fn compute_raw( + current_price: CentsUnsignedCompact, + cost_basis_data: &CostBasisData, + ) -> CachedStateRaw { + let mut state = CachedStateRaw::default(); + + for (price, &sats) in cost_basis_data.iter() { + let sats_u128 = sats.as_u128(); + let price_u128 = price.as_u128(); + let invested_capital = price_u128 * sats_u128; + let investor_cap = price_u128 * invested_capital; - for (price, &sats) in price_to_amount.iter() { - let invested_capital = price * sats; if price <= current_price { state.supply_in_profit += sats; state.invested_capital_in_profit += invested_capital; + state.investor_cap_in_profit += investor_cap; if price < current_price { - let diff = current_price.checked_sub(price).unwrap(); - state.unrealized_profit += diff * sats; + let diff = (current_price - price).as_u128(); + state.unrealized_profit += diff * sats_u128; } } else { state.supply_in_loss += sats; state.invested_capital_in_loss += invested_capital; - let diff = price.checked_sub(current_price).unwrap(); - state.unrealized_loss += diff * sats; + state.investor_cap_in_loss += investor_cap; + let diff = (price - current_price).as_u128(); + state.unrealized_loss += diff * sats_u128; } } state } + + /// Compute final UnrealizedState directly (not cached). + /// Used for date_state which doesn't use the cache. + pub fn compute_full_standalone( + current_price: CentsUnsignedCompact, + cost_basis_data: &CostBasisData, + ) -> UnrealizedState { + Self::compute_raw(current_price, cost_basis_data).to_output() + } } diff --git a/crates/brk_computer/src/distribution/vecs.rs b/crates/brk_computer/src/distribution/vecs.rs index 9452e6b24..794195755 100644 --- a/crates/brk_computer/src/distribution/vecs.rs +++ b/crates/brk_computer/src/distribution/vecs.rs @@ -30,7 +30,7 @@ use super::{ compute::aggregates, }; -const VERSION: Version = Version::new(21); +const VERSION: Version = Version::new(22); /// Main struct holding all computed vectors and state for stateful computation. #[derive(Clone, Traversable)] @@ -257,7 +257,7 @@ impl Vecs { } else { // Recover chain_state from stored values let height_to_timestamp = &blocks.time.timestamp_monotonic; - let height_to_price = price.map(|p| &p.usd.split.close.height); + let height_to_price = price.map(|p| &p.cents.split.height.close); let mut height_to_timestamp_iter = height_to_timestamp.into_iter(); let mut height_to_price_iter = height_to_price.map(|v| v.into_iter()); @@ -266,9 +266,10 @@ impl Vecs { let chain_state = (0..recovered_height.to_usize()) .map(|h| { let h = Height::from(h); + let price = height_to_price_iter.as_mut().map(|v| *v.get_unwrap(h)); BlockState { supply: chain_state_iter.get_unwrap(h), - price: height_to_price_iter.as_mut().map(|v| *v.get_unwrap(h)), + price, timestamp: height_to_timestamp_iter.get_unwrap(h), } }) diff --git a/crates/brk_computer/src/internal/multi/from_date/binary_last.rs b/crates/brk_computer/src/internal/multi/from_date/binary_last.rs index f640ac8be..62df62ef9 100644 --- a/crates/brk_computer/src/internal/multi/from_date/binary_last.rs +++ b/crates/brk_computer/src/internal/multi/from_date/binary_last.rs @@ -10,7 +10,7 @@ use vecdb::{BinaryTransform, IterableBoxedVec, IterableCloneableVec, LazyVecFrom use crate::internal::{ ComputedFromHeightLast, ComputedFromHeightSum, ComputedFromDateLast, ComputedVecValue, LazyBinaryComputedFromHeightLast, LazyBinaryComputedFromHeightSum, LazyBinaryTransformLast, - LazyDateDerivedLast, LazyDateDerivedSumCum, NumericValue, + LazyDateDerivedLast, LazyDateDerivedSumCum, LazyFromDateLast, LazyFromHeightLast, NumericValue, }; const VERSION: Version = Version::ZERO; @@ -223,6 +223,45 @@ where } } + pub fn from_lazy_height_and_dateindex_last( + name: &str, + version: Version, + source1: &LazyFromHeightLast, + source2: &ComputedFromDateLast, + ) -> Self + where + F: BinaryTransform, + S1SourceT: ComputedVecValue + JsonSchema, + { + let v = version + VERSION; + + macro_rules! period { + ($p:ident) => { + LazyBinaryTransformLast::from_vecs::( + name, + v, + source1.$p.boxed_clone(), + source2.$p.boxed_clone(), + ) + }; + } + + Self { + dateindex: LazyVecFrom2::transformed::( + name, + v, + source1.dateindex.boxed_clone(), + source2.dateindex.boxed_clone(), + ), + weekindex: period!(weekindex), + monthindex: period!(monthindex), + quarterindex: period!(quarterindex), + semesterindex: period!(semesterindex), + yearindex: period!(yearindex), + decadeindex: period!(decadeindex), + } + } + pub fn from_dateindex_and_height_last>( name: &str, version: Version, @@ -753,4 +792,44 @@ where decadeindex: period!(decadeindex), } } + + /// Create from a ComputedFromDateLast and a LazyFromDateLast. + pub fn from_computed_and_lazy_last( + name: &str, + version: Version, + source1: &ComputedFromDateLast, + source2: &LazyFromDateLast, + ) -> Self + where + F: BinaryTransform, + S2SourceT: ComputedVecValue + JsonSchema, + { + let v = version + VERSION; + + macro_rules! period { + ($p:ident) => { + LazyBinaryTransformLast::from_vecs::( + name, + v, + source1.rest.$p.boxed_clone(), + source2.$p.boxed_clone(), + ) + }; + } + + Self { + dateindex: LazyVecFrom2::transformed::( + name, + v, + source1.dateindex.boxed_clone(), + source2.dateindex.boxed_clone(), + ), + weekindex: period!(weekindex), + monthindex: period!(monthindex), + quarterindex: period!(quarterindex), + semesterindex: period!(semesterindex), + yearindex: period!(yearindex), + decadeindex: period!(decadeindex), + } + } } diff --git a/crates/brk_computer/src/internal/multi/from_date/binary_sum.rs b/crates/brk_computer/src/internal/multi/from_date/binary_sum.rs index 24e9da216..ee7c951c8 100644 --- a/crates/brk_computer/src/internal/multi/from_date/binary_sum.rs +++ b/crates/brk_computer/src/internal/multi/from_date/binary_sum.rs @@ -58,4 +58,37 @@ where decadeindex: period!(decadeindex), } } + + /// Create from two LazyBinaryFromDateSum sources. + pub fn from_binary( + name: &str, + version: Version, + source1: &LazyBinaryFromDateSum, + source2: &LazyBinaryFromDateSum, + ) -> Self + where + F: BinaryTransform, + S1aT: ComputedVecValue + JsonSchema, + S1bT: ComputedVecValue + JsonSchema, + S2aT: ComputedVecValue + JsonSchema, + S2bT: ComputedVecValue + JsonSchema, + { + let v = version + VERSION; + + macro_rules! period { + ($p:ident) => { + LazyBinaryTransformSum::from_boxed::(name, v, source1.$p.boxed_clone(), source2.$p.boxed_clone()) + }; + } + + Self { + dateindex: period!(dateindex), + weekindex: period!(weekindex), + monthindex: period!(monthindex), + quarterindex: period!(quarterindex), + semesterindex: period!(semesterindex), + yearindex: period!(yearindex), + decadeindex: period!(decadeindex), + } + } } diff --git a/crates/brk_computer/src/internal/multi/from_date/binary_sum_cum.rs b/crates/brk_computer/src/internal/multi/from_date/binary_sum_cum.rs index 293f64302..0b407af27 100644 --- a/crates/brk_computer/src/internal/multi/from_date/binary_sum_cum.rs +++ b/crates/brk_computer/src/internal/multi/from_date/binary_sum_cum.rs @@ -10,7 +10,7 @@ use vecdb::{BinaryTransform, IterableCloneableVec}; use crate::internal::{ ComputedFromHeightLast, ComputedFromHeightSumCum, ComputedHeightDerivedLast, ComputedHeightDerivedSumCum, ComputedVecValue, LazyBinaryTransformSumCum, LazyDateDerivedFull, - LazyDateDerivedSumCum, NumericValue, SumCum, + LazyDateDerivedSumCum, LazyFromHeightLast, NumericValue, SumCum, }; const VERSION: Version = Version::ZERO; @@ -278,4 +278,47 @@ where decadeindex: period!(decadeindex), } } + + // --- Methods accepting SumCum + LazyLast sources --- + + pub fn from_computed_lazy_last( + name: &str, + version: Version, + source1: &ComputedFromHeightSumCum, + source2: &LazyFromHeightLast, + ) -> Self + where + F: BinaryTransform, + S1T: PartialOrd, + S2T: NumericValue, + S2ST: ComputedVecValue + JsonSchema, + { + let v = version + VERSION; + + macro_rules! period { + ($p:ident) => { + LazyBinaryTransformSumCum::from_sources_last_sum_raw::( + name, v, + source1.rest.$p.sum.boxed_clone(), + source1.rest.$p.cumulative.boxed_clone(), + source2.rest.dates.$p.boxed_clone(), + ) + }; + } + + Self { + dateindex: LazyBinaryTransformSumCum::from_sources_last_sum_raw::( + name, v, + source1.dateindex.boxed_sum(), + source1.dateindex.boxed_cumulative(), + source2.rest.dates.dateindex.boxed_clone(), + ), + weekindex: period!(weekindex), + monthindex: period!(monthindex), + quarterindex: period!(quarterindex), + semesterindex: period!(semesterindex), + yearindex: period!(yearindex), + decadeindex: period!(decadeindex), + } + } } diff --git a/crates/brk_computer/src/internal/multi/from_date/lazy_binary_price.rs b/crates/brk_computer/src/internal/multi/from_date/lazy_binary_price.rs index 4eda54f6d..2e12cb247 100644 --- a/crates/brk_computer/src/internal/multi/from_date/lazy_binary_price.rs +++ b/crates/brk_computer/src/internal/multi/from_date/lazy_binary_price.rs @@ -10,7 +10,7 @@ use schemars::JsonSchema; use vecdb::{BinaryTransform, IterableCloneableVec, LazyVecFrom1}; use super::{ComputedFromDateLast, LazyBinaryFromDateLast}; -use crate::internal::{ComputedFromHeightLast, ComputedVecValue, DollarsToSatsFract, LazyTransformLast, NumericValue}; +use crate::internal::{ComputedFromHeightLast, ComputedVecValue, DollarsToSatsFract, LazyFromHeightLast, LazyTransformLast, NumericValue}; /// Lazy binary price with both USD and sats representations. /// @@ -71,6 +71,23 @@ where Self::from_dollars(name, version, dollars) } + /// Create from lazy height-based price and dateindex-based ratio sources. + pub fn from_lazy_height_and_dateindex_last( + name: &str, + version: Version, + source1: &LazyFromHeightLast, + source2: &ComputedFromDateLast, + ) -> Self + where + F: BinaryTransform, + S1SourceT: ComputedVecValue + JsonSchema, + { + let dollars = LazyBinaryFromDateLast::from_lazy_height_and_dateindex_last::( + name, version, source1, source2, + ); + Self::from_dollars(name, version, dollars) + } + /// Create from two computed dateindex sources. pub fn from_computed_both_last>( name: &str, diff --git a/crates/brk_computer/src/internal/multi/from_date/percentiles.rs b/crates/brk_computer/src/internal/multi/from_date/percentiles.rs index f9c7f3bf4..7ae6018be 100644 --- a/crates/brk_computer/src/internal/multi/from_date/percentiles.rs +++ b/crates/brk_computer/src/internal/multi/from_date/percentiles.rs @@ -1,6 +1,6 @@ use brk_error::Result; use brk_traversable::{Traversable, TreeNode}; -use brk_types::{DateIndex, Dollars, Version}; +use brk_types::{DateIndex, Dollars, StoredF32, Version}; use rayon::prelude::*; use vecdb::{ AnyExportableVec, AnyStoredVec, AnyVec, Database, EagerVec, Exit, GenericStoredVec, PcoVec, @@ -15,28 +15,77 @@ pub const PERCENTILES: [u8; 19] = [ ]; pub const PERCENTILES_LEN: usize = PERCENTILES.len(); +/// Compute spot percentile rank by interpolating within percentile bands. +/// Returns a value between 0 and 100 indicating where spot sits in the distribution. +pub fn compute_spot_percentile_rank(percentile_prices: &[Dollars; PERCENTILES_LEN], spot: Dollars) -> StoredF32 { + if spot.is_nan() || percentile_prices[0].is_nan() { + return StoredF32::NAN; + } + + let spot_f64 = f64::from(spot); + + // Below lowest percentile (p5) - extrapolate towards 0 + let p5 = f64::from(percentile_prices[0]); + if spot_f64 <= p5 { + if p5 == 0.0 { + return StoredF32::from(0.0); + } + // Linear extrapolation: rank = 5 * (spot / p5) + return StoredF32::from((5.0 * spot_f64 / p5).max(0.0)); + } + + // Above highest percentile (p95) - extrapolate towards 100 + let p95 = f64::from(percentile_prices[PERCENTILES_LEN - 1]); + let p90 = f64::from(percentile_prices[PERCENTILES_LEN - 2]); + if spot_f64 >= p95 { + if p95 == p90 { + return StoredF32::from(100.0); + } + // Linear extrapolation using p90-p95 slope + let slope = 5.0 / (p95 - p90); + return StoredF32::from((95.0 + (spot_f64 - p95) * slope).min(100.0)); + } + + // Find the band containing spot and interpolate + for i in 0..PERCENTILES_LEN - 1 { + let lower = f64::from(percentile_prices[i]); + let upper = f64::from(percentile_prices[i + 1]); + + if spot_f64 >= lower && spot_f64 <= upper { + let lower_pct = f64::from(PERCENTILES[i]); + let upper_pct = f64::from(PERCENTILES[i + 1]); + + if upper == lower { + return StoredF32::from(lower_pct); + } + + // Linear interpolation + let ratio = (spot_f64 - lower) / (upper - lower); + return StoredF32::from(lower_pct + ratio * (upper_pct - lower_pct)); + } + } + + StoredF32::NAN +} + #[derive(Clone)] -pub struct CostBasisPercentiles { +pub struct PercentilesVecs { pub vecs: [Option; PERCENTILES_LEN], } const VERSION: Version = Version::ZERO; -impl CostBasisPercentiles { +impl PercentilesVecs { pub fn forced_import( db: &Database, - name: &str, + prefix: &str, version: Version, indexes: &indexes::Vecs, compute: bool, ) -> Result { let vecs = PERCENTILES.map(|p| { compute.then(|| { - let metric_name = if name.is_empty() { - format!("cost_basis_pct{p:02}") - } else { - format!("{name}_cost_basis_pct{p:02}") - }; + let metric_name = format!("{prefix}_pct{p:02}"); Price::forced_import(db, &metric_name, version + VERSION, indexes).unwrap() }) }); @@ -88,7 +137,7 @@ impl CostBasisPercentiles { } } -impl CostBasisPercentiles { +impl PercentilesVecs { pub fn write(&mut self) -> Result<()> { for vec in self.vecs.iter_mut().flatten() { vec.dateindex.write()?; @@ -115,7 +164,7 @@ impl CostBasisPercentiles { } } -impl Traversable for CostBasisPercentiles { +impl Traversable for PercentilesVecs { fn to_tree_node(&self) -> TreeNode { TreeNode::Branch( PERCENTILES diff --git a/crates/brk_computer/src/internal/multi/from_date/ratio.rs b/crates/brk_computer/src/internal/multi/from_date/ratio.rs index 0751ffc29..4c66fb729 100644 --- a/crates/brk_computer/src/internal/multi/from_date/ratio.rs +++ b/crates/brk_computer/src/internal/multi/from_date/ratio.rs @@ -17,7 +17,8 @@ use crate::{ }; use super::{ComputedFromDateLast, Price}; -use crate::internal::ComputedFromHeightLast; +use crate::internal::{ComputedFromHeightLast, ComputedVecValue, LazyFromHeightLast}; +use schemars::JsonSchema; #[derive(Clone, Traversable)] pub struct ComputedFromDateRatio { @@ -56,7 +57,6 @@ impl ComputedFromDateRatio { version: Version, indexes: &indexes::Vecs, extended: bool, - price_vecs: Option<&price::Vecs>, ) -> Result { let v = version + VERSION; @@ -81,7 +81,8 @@ impl ComputedFromDateRatio { v, indexes, StandardDeviationVecsOptions::default().add_all(), - price_vecs, + metric_price, + price.as_ref().map(|p| &p.dollars), ) .unwrap() }; @@ -142,6 +143,82 @@ impl ComputedFromDateRatio { }) } + pub fn forced_import_from_lazy( + db: &Database, + name: &str, + metric_price: &LazyFromHeightLast, + version: Version, + indexes: &indexes::Vecs, + extended: bool, + ) -> Result { + let v = version + VERSION; + + macro_rules! import { + ($suffix:expr) => { + ComputedFromDateLast::forced_import(db, &format!("{name}_{}", $suffix), v, indexes) + .unwrap() + }; + } + + macro_rules! import_sd { + ($suffix:expr, $days:expr) => { + ComputedFromDateStdDev::forced_import_from_lazy( + db, + &format!("{name}_{}", $suffix), + $days, + v, + indexes, + StandardDeviationVecsOptions::default().add_all(), + Some(metric_price), + ) + .unwrap() + }; + } + + let ratio_pct99 = extended.then(|| import!("ratio_pct99")); + let ratio_pct98 = extended.then(|| import!("ratio_pct98")); + let ratio_pct95 = extended.then(|| import!("ratio_pct95")); + let ratio_pct5 = extended.then(|| import!("ratio_pct5")); + let ratio_pct2 = extended.then(|| import!("ratio_pct2")); + let ratio_pct1 = extended.then(|| import!("ratio_pct1")); + + macro_rules! lazy_usd { + ($ratio:expr, $suffix:expr) => { + $ratio.as_ref().map(|r| { + LazyBinaryPrice::from_lazy_height_and_dateindex_last::( + &format!("{name}_{}", $suffix), + v, + metric_price, + r, + ) + }) + }; + } + + Ok(Self { + ratio: import!("ratio"), + ratio_1w_sma: extended.then(|| import!("ratio_1w_sma")), + ratio_1m_sma: extended.then(|| import!("ratio_1m_sma")), + ratio_sd: extended.then(|| import_sd!("ratio", usize::MAX)), + ratio_1y_sd: extended.then(|| import_sd!("ratio_1y", 365)), + ratio_2y_sd: extended.then(|| import_sd!("ratio_2y", 2 * 365)), + ratio_4y_sd: extended.then(|| import_sd!("ratio_4y", 4 * 365)), + ratio_pct99_usd: lazy_usd!(&ratio_pct99, "ratio_pct99_usd"), + ratio_pct98_usd: lazy_usd!(&ratio_pct98, "ratio_pct98_usd"), + ratio_pct95_usd: lazy_usd!(&ratio_pct95, "ratio_pct95_usd"), + ratio_pct5_usd: lazy_usd!(&ratio_pct5, "ratio_pct5_usd"), + ratio_pct2_usd: lazy_usd!(&ratio_pct2, "ratio_pct2_usd"), + ratio_pct1_usd: lazy_usd!(&ratio_pct1, "ratio_pct1_usd"), + price: None, + ratio_pct99, + ratio_pct98, + ratio_pct95, + ratio_pct5, + ratio_pct2, + ratio_pct1, + }) + } + pub fn compute_all( &mut self, price: &price::Vecs, diff --git a/crates/brk_computer/src/internal/multi/from_date/stddev.rs b/crates/brk_computer/src/internal/multi/from_date/stddev.rs index b05dd197a..e9a070bef 100644 --- a/crates/brk_computer/src/internal/multi/from_date/stddev.rs +++ b/crates/brk_computer/src/internal/multi/from_date/stddev.rs @@ -2,15 +2,19 @@ use std::mem; use brk_error::Result; use brk_traversable::Traversable; -use brk_types::{Close, Date, DateIndex, Dollars, StoredF32, Version}; +use brk_types::{Date, DateIndex, Dollars, StoredF32, Version}; +use schemars::JsonSchema; use vecdb::{ AnyStoredVec, AnyVec, CollectableVec, Database, EagerVec, Exit, GenericStoredVec, IterableVec, PcoVec, VecIndex, }; -use crate::{ComputeIndexes, indexes, price}; +use crate::{ComputeIndexes, indexes}; -use crate::internal::{ClosePriceTimesRatio, ComputedFromDateLast, LazyBinaryPrice}; +use crate::internal::{ + ComputedFromDateLast, ComputedFromHeightLast, ComputedVecValue, LazyBinaryPrice, + LazyFromHeightLast, PriceTimesRatio, +}; #[derive(Clone, Traversable)] pub struct ComputedFromDateStdDev { @@ -35,19 +39,19 @@ pub struct ComputedFromDateStdDev { pub m2_5sd: Option>, pub m3sd: Option>, - pub _0sd_usd: Option, StoredF32>>, - pub p0_5sd_usd: Option, StoredF32>>, - pub p1sd_usd: Option, StoredF32>>, - pub p1_5sd_usd: Option, StoredF32>>, - pub p2sd_usd: Option, StoredF32>>, - pub p2_5sd_usd: Option, StoredF32>>, - pub p3sd_usd: Option, StoredF32>>, - pub m0_5sd_usd: Option, StoredF32>>, - pub m1sd_usd: Option, StoredF32>>, - pub m1_5sd_usd: Option, StoredF32>>, - pub m2sd_usd: Option, StoredF32>>, - pub m2_5sd_usd: Option, StoredF32>>, - pub m3sd_usd: Option, StoredF32>>, + pub _0sd_usd: Option>, + pub p0_5sd_usd: Option>, + pub p1sd_usd: Option>, + pub p1_5sd_usd: Option>, + pub p2sd_usd: Option>, + pub p2_5sd_usd: Option>, + pub p3sd_usd: Option>, + pub m0_5sd_usd: Option>, + pub m1sd_usd: Option>, + pub m1_5sd_usd: Option>, + pub m2sd_usd: Option>, + pub m2_5sd_usd: Option>, + pub m3sd_usd: Option>, } #[derive(Debug, Default)] @@ -103,9 +107,10 @@ impl ComputedFromDateStdDev { parent_version: Version, indexes: &indexes::Vecs, options: StandardDeviationVecsOptions, - price_vecs: Option<&price::Vecs>, + metric_price: Option<&ComputedFromHeightLast>, + date_price: Option<&ComputedFromDateLast>, ) -> Result { - let version = parent_version + Version::ONE; + let version = parent_version + Version::TWO; macro_rules! import { ($suffix:expr) => { @@ -133,20 +138,33 @@ impl ComputedFromDateStdDev { let m2_5sd = options.bands().then(|| import!("m2_5sd")); let m3sd = options.bands().then(|| import!("m3sd")); + // Create USD bands using the metric price (the denominator of the ratio). + // This converts ratio bands back to USD: usd_band = metric_price * ratio_band macro_rules! lazy_usd { ($band:expr, $suffix:expr) => { - price_vecs - .map(|p| &p.usd.split.close) - .zip($band.as_ref()) - .filter(|_| options.price_bands()) - .map(|(p, b)| { - LazyBinaryPrice::from_computed_both_last::( + if !options.price_bands() { + None + } else if let Some(mp) = metric_price { + $band.as_ref().map(|b| { + LazyBinaryPrice::from_height_and_dateindex_last::( &format!("{name}_{}", $suffix), version, - p, + mp, b, ) }) + } else if let Some(dp) = date_price { + $band.as_ref().map(|b| { + LazyBinaryPrice::from_computed_both_last::( + &format!("{name}_{}", $suffix), + version, + dp, + b, + ) + }) + } else { + None + } }; } @@ -395,4 +413,91 @@ impl ComputedFromDateStdDev { ) -> impl Iterator>> { self.mut_stateful_computed().map(|c| &mut c.dateindex) } + + #[allow(clippy::too_many_arguments)] + pub fn forced_import_from_lazy( + db: &Database, + name: &str, + days: usize, + parent_version: Version, + indexes: &indexes::Vecs, + options: StandardDeviationVecsOptions, + metric_price: Option<&LazyFromHeightLast>, + ) -> Result { + let version = parent_version + Version::TWO; + + macro_rules! import { + ($suffix:expr) => { + ComputedFromDateLast::forced_import( + db, + &format!("{name}_{}", $suffix), + version, + indexes, + ) + .unwrap() + }; + } + + let sma_vec = Some(import!("sma")); + let p0_5sd = options.bands().then(|| import!("p0_5sd")); + let p1sd = options.bands().then(|| import!("p1sd")); + let p1_5sd = options.bands().then(|| import!("p1_5sd")); + let p2sd = options.bands().then(|| import!("p2sd")); + let p2_5sd = options.bands().then(|| import!("p2_5sd")); + let p3sd = options.bands().then(|| import!("p3sd")); + let m0_5sd = options.bands().then(|| import!("m0_5sd")); + let m1sd = options.bands().then(|| import!("m1sd")); + let m1_5sd = options.bands().then(|| import!("m1_5sd")); + let m2sd = options.bands().then(|| import!("m2sd")); + let m2_5sd = options.bands().then(|| import!("m2_5sd")); + let m3sd = options.bands().then(|| import!("m3sd")); + + macro_rules! lazy_usd { + ($band:expr, $suffix:expr) => { + metric_price + .zip($band.as_ref()) + .filter(|_| options.price_bands()) + .map(|(mp, b)| { + LazyBinaryPrice::from_lazy_height_and_dateindex_last::( + &format!("{name}_{}", $suffix), + version, + mp, + b, + ) + }) + }; + } + + Ok(Self { + days, + sd: import!("sd"), + zscore: options.zscore().then(|| import!("zscore")), + _0sd_usd: lazy_usd!(&sma_vec, "0sd_usd"), + p0_5sd_usd: lazy_usd!(&p0_5sd, "p0_5sd_usd"), + p1sd_usd: lazy_usd!(&p1sd, "p1sd_usd"), + p1_5sd_usd: lazy_usd!(&p1_5sd, "p1_5sd_usd"), + p2sd_usd: lazy_usd!(&p2sd, "p2sd_usd"), + p2_5sd_usd: lazy_usd!(&p2_5sd, "p2_5sd_usd"), + p3sd_usd: lazy_usd!(&p3sd, "p3sd_usd"), + m0_5sd_usd: lazy_usd!(&m0_5sd, "m0_5sd_usd"), + m1sd_usd: lazy_usd!(&m1sd, "m1sd_usd"), + m1_5sd_usd: lazy_usd!(&m1_5sd, "m1_5sd_usd"), + m2sd_usd: lazy_usd!(&m2sd, "m2sd_usd"), + m2_5sd_usd: lazy_usd!(&m2_5sd, "m2_5sd_usd"), + m3sd_usd: lazy_usd!(&m3sd, "m3sd_usd"), + sma: sma_vec, + p0_5sd, + p1sd, + p1_5sd, + p2sd, + p2_5sd, + p3sd, + m0_5sd, + m1sd, + m1_5sd, + m2sd, + m2_5sd, + m3sd, + }) + } } diff --git a/crates/brk_computer/src/internal/multi/from_height/binary_last.rs b/crates/brk_computer/src/internal/multi/from_height/binary_last.rs index 3b8ed6e28..64374efce 100644 --- a/crates/brk_computer/src/internal/multi/from_height/binary_last.rs +++ b/crates/brk_computer/src/internal/multi/from_height/binary_last.rs @@ -9,7 +9,7 @@ use vecdb::{BinaryTransform, IterableBoxedVec, IterableCloneableVec, LazyVecFrom use crate::internal::{ ComputedFromHeightLast, ComputedFromHeightSumCum, ComputedFromHeightAndDateLast, ComputedVecValue, LazyBinaryComputedFromHeightLast, LazyBinaryFromDateLast, LazyBinaryHeightDerivedLast, - LazyBinaryTransformLast, LazyDateDerivedLast, NumericValue, + LazyBinaryTransformLast, LazyDateDerivedLast, LazyFromHeightLast, NumericValue, }; #[derive(Clone, Deref, DerefMut, Traversable)] @@ -369,4 +369,31 @@ where }, } } + + /// Create from a ComputedFromHeightAndDateLast and a LazyFromHeightLast. + pub fn from_computed_height_date_and_lazy_block_last( + name: &str, + version: Version, + source1: &ComputedFromHeightAndDateLast, + source2: &LazyFromHeightLast, + ) -> Self + where + F: BinaryTransform, + S1T: PartialOrd, + S2SourceT: ComputedVecValue + JsonSchema, + { + let v = version + VERSION; + + Self { + height: LazyVecFrom2::transformed::( + name, + v, + source1.height.boxed_clone(), + source2.height.boxed_clone(), + ), + rest: LazyBinaryHeightDerivedLast::from_computed_height_date_and_lazy_block_last::( + name, v, source1, source2, + ), + } + } } diff --git a/crates/brk_computer/src/internal/multi/from_height/binary_sum.rs b/crates/brk_computer/src/internal/multi/from_height/binary_sum.rs index 7997eb9d3..38a84203b 100644 --- a/crates/brk_computer/src/internal/multi/from_height/binary_sum.rs +++ b/crates/brk_computer/src/internal/multi/from_height/binary_sum.rs @@ -68,4 +68,36 @@ where rest: LazyBinaryHeightDerivedSum::from_derived::(name, v, &source1.rest, &source2.rest), } } + + /// Create from two LazyBinaryFromHeightSum sources. + pub fn from_binary( + name: &str, + version: Version, + source1: &LazyBinaryFromHeightSum, + source2: &LazyBinaryFromHeightSum, + ) -> Self + where + F: BinaryTransform, + S1aT: ComputedVecValue + JsonSchema, + S1bT: ComputedVecValue + JsonSchema, + S2aT: ComputedVecValue + JsonSchema, + S2bT: ComputedVecValue + JsonSchema, + { + let v = version + VERSION; + + Self { + height: LazyVecFrom2::transformed::( + name, + v, + source1.height.boxed_clone(), + source2.height.boxed_clone(), + ), + rest: LazyBinaryHeightDerivedSum::from_binary::( + name, + v, + &source1.rest, + &source2.rest, + ), + } + } } diff --git a/crates/brk_computer/src/internal/multi/from_height/binary_sum_cum.rs b/crates/brk_computer/src/internal/multi/from_height/binary_sum_cum.rs index 7d9cb507c..6a27ef95d 100644 --- a/crates/brk_computer/src/internal/multi/from_height/binary_sum_cum.rs +++ b/crates/brk_computer/src/internal/multi/from_height/binary_sum_cum.rs @@ -8,7 +8,7 @@ use vecdb::{BinaryTransform, IterableBoxedVec, IterableCloneableVec, LazyVecFrom use crate::internal::{ ComputedFromHeightLast, ComputedFromHeightSumCum, ComputedHeightDerivedLast, ComputedHeightDerivedSumCum, - ComputedVecValue, LazyBinaryHeightDerivedSumCum, NumericValue, + ComputedVecValue, LazyBinaryHeightDerivedSumCum, LazyFromHeightLast, NumericValue, }; #[derive(Clone, Deref, DerefMut, Traversable)] @@ -207,4 +207,33 @@ where rest: LazyBinaryHeightDerivedSumCum::from_computed_derived_last::(name, v, source1, source2), } } + + // --- Methods accepting SumCum + LazyLast sources --- + + pub fn from_computed_lazy_last( + name: &str, + version: Version, + height_source1: IterableBoxedVec, + height_source2: IterableBoxedVec, + source1: &ComputedFromHeightSumCum, + source2: &LazyFromHeightLast, + ) -> Self + where + F: BinaryTransform, + S1T: PartialOrd, + S2T: NumericValue, + S2ST: ComputedVecValue + JsonSchema, + { + let v = version + VERSION; + Self { + height: LazyVecFrom2::transformed::(name, v, height_source1, height_source2), + height_cumulative: LazyVecFrom2::transformed::( + &format!("{name}_cumulative"), + v, + source1.height_cumulative.boxed_clone(), + source2.height.boxed_clone(), + ), + rest: LazyBinaryHeightDerivedSumCum::from_computed_lazy_last::(name, v, source1, source2), + } + } } diff --git a/crates/brk_computer/src/internal/multi/from_height/lazy_price_from_cents.rs b/crates/brk_computer/src/internal/multi/from_height/lazy_price_from_cents.rs new file mode 100644 index 000000000..946374608 --- /dev/null +++ b/crates/brk_computer/src/internal/multi/from_height/lazy_price_from_cents.rs @@ -0,0 +1,47 @@ +//! Lazy price wrapper for height-based metrics with both USD and sats representations. +//! Derives both from a cents base metric. + +use brk_traversable::Traversable; +use brk_types::{CentsUnsigned, Dollars, SatsFract, Version}; +use derive_more::{Deref, DerefMut}; +use vecdb::IterableCloneableVec; + +use super::{ComputedFromHeightLast, LazyFromHeightLast}; +use crate::internal::{CentsUnsignedToDollars, CentsUnsignedToSatsFract}; + +/// Lazy price metric (height-based) with both USD and sats representations. +/// Both are lazily derived from a cents base metric. +/// +/// Derefs to the dollars metric, so existing code works unchanged. +/// Access `.sats` for the sats exchange rate version. +#[derive(Clone, Deref, DerefMut, Traversable)] +#[traversable(merge)] +pub struct LazyPriceFromCents { + #[deref] + #[deref_mut] + #[traversable(flatten)] + pub dollars: LazyFromHeightLast, + pub sats: LazyFromHeightLast, +} + +impl LazyPriceFromCents { + pub fn from_computed( + name: &str, + version: Version, + cents: &ComputedFromHeightLast, + ) -> Self { + let dollars = LazyFromHeightLast::from_computed::( + name, + version, + cents.height.boxed_clone(), + cents, + ); + let sats = LazyFromHeightLast::from_computed::( + &format!("{name}_sats"), + version, + cents.height.boxed_clone(), + cents, + ); + Self { dollars, sats } + } +} diff --git a/crates/brk_computer/src/internal/multi/from_height/mod.rs b/crates/brk_computer/src/internal/multi/from_height/mod.rs index 154ca39aa..c3bd18d5f 100644 --- a/crates/brk_computer/src/internal/multi/from_height/mod.rs +++ b/crates/brk_computer/src/internal/multi/from_height/mod.rs @@ -16,6 +16,7 @@ mod lazy_binary_computed_sum_cum; mod lazy_computed_full; mod lazy_computed_sum_cum; mod lazy_last; +mod lazy_price_from_cents; mod lazy_sum; mod price; mod unary_last; @@ -51,6 +52,7 @@ pub use lazy_binary_computed_sum_cum::*; pub use lazy_computed_full::*; pub use lazy_computed_sum_cum::*; pub use lazy_last::*; +pub use lazy_price_from_cents::*; pub use lazy_sum::*; pub use price::*; pub use unary_last::*; diff --git a/crates/brk_computer/src/internal/multi/height_derived/binary_last.rs b/crates/brk_computer/src/internal/multi/height_derived/binary_last.rs index ce2fa0f17..092eeba19 100644 --- a/crates/brk_computer/src/internal/multi/height_derived/binary_last.rs +++ b/crates/brk_computer/src/internal/multi/height_derived/binary_last.rs @@ -8,7 +8,7 @@ use vecdb::{BinaryTransform, IterableCloneableVec}; use crate::internal::{ ComputedFromHeightLast, ComputedFromHeightSumCum, ComputedFromHeightAndDateLast, ComputedVecValue, - LazyBinaryFromDateLast, LazyBinaryTransformLast, NumericValue, + LazyBinaryFromDateLast, LazyBinaryTransformLast, LazyFromHeightLast, NumericValue, }; #[derive(Clone, Deref, DerefMut, Traversable)] @@ -141,4 +141,34 @@ where ), } } + + /// Create from a ComputedFromHeightAndDateLast and a LazyFromHeightLast. + pub fn from_computed_height_date_and_lazy_block_last( + name: &str, + version: Version, + source1: &ComputedFromHeightAndDateLast, + source2: &LazyFromHeightLast, + ) -> Self + where + F: BinaryTransform, + S1T: PartialOrd, + S2SourceT: ComputedVecValue + JsonSchema, + { + let v = version + VERSION; + + Self { + dates: LazyBinaryFromDateLast::from_computed_and_lazy_last::( + name, + v, + &source1.rest, + &source2.rest.dates, + ), + difficultyepoch: LazyBinaryTransformLast::from_vecs::( + name, + v, + source1.difficultyepoch.boxed_clone(), + source2.rest.difficultyepoch.boxed_clone(), + ), + } + } } diff --git a/crates/brk_computer/src/internal/multi/height_derived/binary_sum.rs b/crates/brk_computer/src/internal/multi/height_derived/binary_sum.rs index fe12500a5..58381aaa3 100644 --- a/crates/brk_computer/src/internal/multi/height_derived/binary_sum.rs +++ b/crates/brk_computer/src/internal/multi/height_derived/binary_sum.rs @@ -48,4 +48,36 @@ where ), } } + + /// Create from two LazyBinaryHeightDerivedSum sources. + pub fn from_binary( + name: &str, + version: Version, + source1: &LazyBinaryHeightDerivedSum, + source2: &LazyBinaryHeightDerivedSum, + ) -> Self + where + F: BinaryTransform, + S1aT: ComputedVecValue + JsonSchema, + S1bT: ComputedVecValue + JsonSchema, + S2aT: ComputedVecValue + JsonSchema, + S2bT: ComputedVecValue + JsonSchema, + { + let v = version + VERSION; + + Self { + dates: LazyBinaryFromDateSum::from_binary::( + name, + v, + &source1.dates, + &source2.dates, + ), + difficultyepoch: LazyBinaryTransformSum::from_boxed::( + name, + v, + source1.difficultyepoch.boxed_clone(), + source2.difficultyepoch.boxed_clone(), + ), + } + } } diff --git a/crates/brk_computer/src/internal/multi/height_derived/binary_sum_cum.rs b/crates/brk_computer/src/internal/multi/height_derived/binary_sum_cum.rs index 6a690274e..85695f9cf 100644 --- a/crates/brk_computer/src/internal/multi/height_derived/binary_sum_cum.rs +++ b/crates/brk_computer/src/internal/multi/height_derived/binary_sum_cum.rs @@ -9,7 +9,7 @@ use vecdb::{BinaryTransform, IterableCloneableVec}; use crate::internal::{ ComputedFromHeightLast, ComputedFromHeightSumCum, ComputedHeightDerivedLast, ComputedHeightDerivedSumCum, ComputedVecValue, LazyBinaryFromDateSumCum, LazyBinaryTransformSumCum, LazyFull, LazyDateDerivedFull, - LazyDateDerivedSumCum, LazySumCum, NumericValue, SumCum, + LazyDateDerivedSumCum, LazyFromHeightLast, LazySumCum, NumericValue, SumCum, }; const VERSION: Version = Version::ZERO; @@ -221,4 +221,32 @@ where ), } } + + // --- Methods accepting SumCum + LazyLast sources --- + + pub fn from_computed_lazy_last( + name: &str, + version: Version, + source1: &ComputedFromHeightSumCum, + source2: &LazyFromHeightLast, + ) -> Self + where + F: BinaryTransform, + S1T: PartialOrd, + S2T: NumericValue, + S2ST: ComputedVecValue + schemars::JsonSchema, + { + let v = version + VERSION; + + Self { + dates: LazyBinaryFromDateSumCum::from_computed_lazy_last::(name, v, source1, source2), + difficultyepoch: LazyBinaryTransformSumCum::from_sources_last_sum_raw::( + name, + v, + source1.difficultyepoch.sum.boxed_clone(), + source1.difficultyepoch.cumulative.boxed_clone(), + source2.rest.difficultyepoch.boxed_clone(), + ), + } + } } diff --git a/crates/brk_computer/src/internal/single/transform/cents_unsigned_to_dollars.rs b/crates/brk_computer/src/internal/single/transform/cents_unsigned_to_dollars.rs new file mode 100644 index 000000000..6e36040a2 --- /dev/null +++ b/crates/brk_computer/src/internal/single/transform/cents_unsigned_to_dollars.rs @@ -0,0 +1,12 @@ +use brk_types::{CentsUnsigned, Dollars}; +use vecdb::UnaryTransform; + +/// CentsUnsigned -> Dollars (convert cents to dollars for display) +pub struct CentsUnsignedToDollars; + +impl UnaryTransform for CentsUnsignedToDollars { + #[inline(always)] + fn apply(cents: CentsUnsigned) -> Dollars { + cents.into() + } +} diff --git a/crates/brk_computer/src/internal/single/transform/cents_unsigned_to_sats_fract.rs b/crates/brk_computer/src/internal/single/transform/cents_unsigned_to_sats_fract.rs new file mode 100644 index 000000000..731e090e6 --- /dev/null +++ b/crates/brk_computer/src/internal/single/transform/cents_unsigned_to_sats_fract.rs @@ -0,0 +1,19 @@ +use brk_types::{CentsUnsigned, SatsFract}; +use vecdb::UnaryTransform; + +/// CentsUnsigned -> SatsFract (exchange rate: sats per dollar at this price level) +/// Formula: sats = 100_000_000 / dollars = 100_000_000 / (cents / 100) = 10_000_000_000 / cents +pub struct CentsUnsignedToSatsFract; + +impl UnaryTransform for CentsUnsignedToSatsFract { + #[inline(always)] + fn apply(cents: CentsUnsigned) -> SatsFract { + let cents_f64 = cents.inner() as f64; + if cents_f64 == 0.0 { + SatsFract::NAN + } else { + // sats = 1 BTC * 100 / cents = 10_000_000_000 / cents + SatsFract::new(SatsFract::SATS_PER_BTC * 100.0 / cents_f64) + } + } +} diff --git a/crates/brk_computer/src/internal/single/transform/close_price_times_ratio.rs b/crates/brk_computer/src/internal/single/transform/close_price_times_ratio.rs deleted file mode 100644 index 320d8bfd4..000000000 --- a/crates/brk_computer/src/internal/single/transform/close_price_times_ratio.rs +++ /dev/null @@ -1,13 +0,0 @@ -use brk_types::{Close, Dollars, StoredF32}; -use vecdb::BinaryTransform; - -/// Close * StoredF32 -> Dollars (price × ratio) -/// Same as PriceTimesRatio but accepts Close price source. -pub struct ClosePriceTimesRatio; - -impl BinaryTransform, StoredF32, Dollars> for ClosePriceTimesRatio { - #[inline(always)] - fn apply(price: Close, ratio: StoredF32) -> Dollars { - *price * ratio - } -} diff --git a/crates/brk_computer/src/internal/single/transform/mod.rs b/crates/brk_computer/src/internal/single/transform/mod.rs index e4e2b6634..df206b6cb 100644 --- a/crates/brk_computer/src/internal/single/transform/mod.rs +++ b/crates/brk_computer/src/internal/single/transform/mod.rs @@ -1,4 +1,5 @@ -mod close_price_times_ratio; +mod cents_unsigned_to_dollars; +mod cents_unsigned_to_sats_fract; mod close_price_times_sats; mod difference_f32; mod dollar_halve; @@ -40,7 +41,8 @@ mod volatility_sqrt365; mod volatility_sqrt7; mod weight_to_fullness; -pub use close_price_times_ratio::*; +pub use cents_unsigned_to_dollars::*; +pub use cents_unsigned_to_sats_fract::*; pub use close_price_times_sats::*; pub use difference_f32::*; pub use dollar_halve::*; diff --git a/crates/brk_computer/src/market/import.rs b/crates/brk_computer/src/market/import.rs index b90191a8c..312571396 100644 --- a/crates/brk_computer/src/market/import.rs +++ b/crates/brk_computer/src/market/import.rs @@ -33,7 +33,7 @@ impl Vecs { let returns = ReturnsVecs::forced_import(&db, version, indexes, price, &lookback)?; let volatility = VolatilityVecs::forced_import(version, &returns); let range = RangeVecs::forced_import(&db, version, indexes)?; - let moving_average = MovingAverageVecs::forced_import(&db, version, indexes, Some(price))?; + let moving_average = MovingAverageVecs::forced_import(&db, version, indexes)?; let dca = DcaVecs::forced_import(&db, version, indexes, price, &lookback)?; let indicators = IndicatorsVecs::forced_import( &db, diff --git a/crates/brk_computer/src/market/moving_average/import.rs b/crates/brk_computer/src/market/moving_average/import.rs index 9313ec91d..1392b00e5 100644 --- a/crates/brk_computer/src/market/moving_average/import.rs +++ b/crates/brk_computer/src/market/moving_average/import.rs @@ -6,7 +6,6 @@ use super::Vecs; use crate::{ indexes, internal::{ComputedFromDateRatio, DollarsTimesTenths, LazyPrice}, - price, }; impl Vecs { @@ -14,7 +13,6 @@ impl Vecs { db: &Database, version: Version, indexes: &indexes::Vecs, - price: Option<&price::Vecs>, ) -> Result { let price_1w_sma = ComputedFromDateRatio::forced_import( db, @@ -23,7 +21,6 @@ impl Vecs { version, indexes, true, - price, )?; let price_8d_sma = ComputedFromDateRatio::forced_import( db, @@ -32,7 +29,6 @@ impl Vecs { version, indexes, true, - price, )?; let price_13d_sma = ComputedFromDateRatio::forced_import( db, @@ -41,7 +37,6 @@ impl Vecs { version, indexes, true, - price, )?; let price_21d_sma = ComputedFromDateRatio::forced_import( db, @@ -50,7 +45,6 @@ impl Vecs { version, indexes, true, - price, )?; let price_1m_sma = ComputedFromDateRatio::forced_import( db, @@ -59,7 +53,6 @@ impl Vecs { version, indexes, true, - price, )?; let price_34d_sma = ComputedFromDateRatio::forced_import( db, @@ -68,7 +61,6 @@ impl Vecs { version, indexes, true, - price, )?; let price_55d_sma = ComputedFromDateRatio::forced_import( db, @@ -77,7 +69,6 @@ impl Vecs { version, indexes, true, - price, )?; let price_89d_sma = ComputedFromDateRatio::forced_import( db, @@ -86,7 +77,6 @@ impl Vecs { version, indexes, true, - price, )?; let price_111d_sma = ComputedFromDateRatio::forced_import( db, @@ -95,7 +85,6 @@ impl Vecs { version, indexes, true, - price, )?; let price_144d_sma = ComputedFromDateRatio::forced_import( db, @@ -104,7 +93,6 @@ impl Vecs { version, indexes, true, - price, )?; let price_200d_sma = ComputedFromDateRatio::forced_import( db, @@ -113,7 +101,6 @@ impl Vecs { version, indexes, true, - price, )?; let price_350d_sma = ComputedFromDateRatio::forced_import( db, @@ -122,7 +109,6 @@ impl Vecs { version, indexes, true, - price, )?; let price_1y_sma = ComputedFromDateRatio::forced_import( db, @@ -131,7 +117,6 @@ impl Vecs { version, indexes, true, - price, )?; let price_2y_sma = ComputedFromDateRatio::forced_import( db, @@ -140,7 +125,6 @@ impl Vecs { version, indexes, true, - price, )?; let price_200w_sma = ComputedFromDateRatio::forced_import( db, @@ -149,7 +133,6 @@ impl Vecs { version, indexes, true, - price, )?; let price_4y_sma = ComputedFromDateRatio::forced_import( db, @@ -158,7 +141,6 @@ impl Vecs { version, indexes, true, - price, )?; let price_1w_ema = ComputedFromDateRatio::forced_import( @@ -168,7 +150,6 @@ impl Vecs { version, indexes, true, - price, )?; let price_8d_ema = ComputedFromDateRatio::forced_import( db, @@ -177,7 +158,6 @@ impl Vecs { version, indexes, true, - price, )?; let price_12d_ema = ComputedFromDateRatio::forced_import( db, @@ -186,7 +166,6 @@ impl Vecs { version, indexes, true, - price, )?; let price_13d_ema = ComputedFromDateRatio::forced_import( db, @@ -195,7 +174,6 @@ impl Vecs { version, indexes, true, - price, )?; let price_21d_ema = ComputedFromDateRatio::forced_import( db, @@ -204,7 +182,6 @@ impl Vecs { version, indexes, true, - price, )?; let price_26d_ema = ComputedFromDateRatio::forced_import( db, @@ -213,7 +190,6 @@ impl Vecs { version, indexes, true, - price, )?; let price_1m_ema = ComputedFromDateRatio::forced_import( db, @@ -222,7 +198,6 @@ impl Vecs { version, indexes, true, - price, )?; let price_34d_ema = ComputedFromDateRatio::forced_import( db, @@ -231,7 +206,6 @@ impl Vecs { version, indexes, true, - price, )?; let price_55d_ema = ComputedFromDateRatio::forced_import( db, @@ -240,7 +214,6 @@ impl Vecs { version, indexes, true, - price, )?; let price_89d_ema = ComputedFromDateRatio::forced_import( db, @@ -249,7 +222,6 @@ impl Vecs { version, indexes, true, - price, )?; let price_144d_ema = ComputedFromDateRatio::forced_import( db, @@ -258,7 +230,6 @@ impl Vecs { version, indexes, true, - price, )?; let price_200d_ema = ComputedFromDateRatio::forced_import( db, @@ -267,7 +238,6 @@ impl Vecs { version, indexes, true, - price, )?; let price_1y_ema = ComputedFromDateRatio::forced_import( db, @@ -276,7 +246,6 @@ impl Vecs { version, indexes, true, - price, )?; let price_2y_ema = ComputedFromDateRatio::forced_import( db, @@ -285,7 +254,6 @@ impl Vecs { version, indexes, true, - price, )?; let price_200w_ema = ComputedFromDateRatio::forced_import( db, @@ -294,7 +262,6 @@ impl Vecs { version, indexes, true, - price, )?; let price_4y_ema = ComputedFromDateRatio::forced_import( db, @@ -303,7 +270,6 @@ impl Vecs { version, indexes, true, - price, )?; let price_200d_sma_source = price_200d_sma.price.as_ref().unwrap(); diff --git a/crates/brk_computer/src/market/returns/import.rs b/crates/brk_computer/src/market/returns/import.rs index 7776123e0..1348ff45d 100644 --- a/crates/brk_computer/src/market/returns/import.rs +++ b/crates/brk_computer/src/market/returns/import.rs @@ -49,6 +49,7 @@ impl Vecs { indexes, StandardDeviationVecsOptions::default(), None, + None, )?; let _1d_returns_1m_sd = ComputedFromDateStdDev::forced_import( db, @@ -58,6 +59,7 @@ impl Vecs { indexes, StandardDeviationVecsOptions::default(), None, + None, )?; let _1d_returns_1y_sd = ComputedFromDateStdDev::forced_import( db, @@ -67,6 +69,7 @@ impl Vecs { indexes, StandardDeviationVecsOptions::default(), None, + None, )?; let downside_returns = EagerVec::forced_import(db, "downside_returns", version)?; @@ -78,6 +81,7 @@ impl Vecs { indexes, StandardDeviationVecsOptions::default(), None, + None, )?; let downside_1m_sd = ComputedFromDateStdDev::forced_import( db, @@ -87,6 +91,7 @@ impl Vecs { indexes, StandardDeviationVecsOptions::default(), None, + None, )?; let downside_1y_sd = ComputedFromDateStdDev::forced_import( db, @@ -96,6 +101,7 @@ impl Vecs { indexes, StandardDeviationVecsOptions::default(), None, + None, )?; Ok(Self { diff --git a/crates/brk_computer/src/price/cents/import.rs b/crates/brk_computer/src/price/cents/import.rs index 4d5f0d504..d1e2f865b 100644 --- a/crates/brk_computer/src/price/cents/import.rs +++ b/crates/brk_computer/src/price/cents/import.rs @@ -1,5 +1,5 @@ use brk_error::Result; -use brk_types::{DateIndex, Height, OHLCCents, Version}; +use brk_types::{DateIndex, Height, OHLCCentsUnsigned, Version}; use vecdb::{Database, IterableCloneableVec, LazyVecFrom1}; use super::Vecs; @@ -7,7 +7,7 @@ use crate::internal::{ComputedHeightAndDateBytes, LazyHeightAndDateOHLC, LazyOHL impl Vecs { pub fn forced_import(db: &Database, version: Version) -> Result { - let ohlc: ComputedHeightAndDateBytes = + let ohlc: ComputedHeightAndDateBytes = ComputedHeightAndDateBytes::forced_import(db, "ohlc_cents", version)?; let components = LazyHeightAndDateOHLC { @@ -16,25 +16,25 @@ impl Vecs { "price_open_cents", version, ohlc.height.boxed_clone(), - |h: Height, iter| iter.get(h).map(|o: OHLCCents| o.open), + |h: Height, iter| iter.get(h).map(|o: OHLCCentsUnsigned| o.open), ), high: LazyVecFrom1::init( "price_high_cents", version, ohlc.height.boxed_clone(), - |h: Height, iter| iter.get(h).map(|o: OHLCCents| o.high), + |h: Height, iter| iter.get(h).map(|o: OHLCCentsUnsigned| o.high), ), low: LazyVecFrom1::init( "price_low_cents", version, ohlc.height.boxed_clone(), - |h: Height, iter| iter.get(h).map(|o: OHLCCents| o.low), + |h: Height, iter| iter.get(h).map(|o: OHLCCentsUnsigned| o.low), ), close: LazyVecFrom1::init( "price_close_cents", version, ohlc.height.boxed_clone(), - |h: Height, iter| iter.get(h).map(|o: OHLCCents| o.close), + |h: Height, iter| iter.get(h).map(|o: OHLCCentsUnsigned| o.close), ), }, dateindex: LazyOHLC { @@ -42,25 +42,25 @@ impl Vecs { "price_open_cents", version, ohlc.dateindex.boxed_clone(), - |di: DateIndex, iter| iter.get(di).map(|o: OHLCCents| o.open), + |di: DateIndex, iter| iter.get(di).map(|o: OHLCCentsUnsigned| o.open), ), high: LazyVecFrom1::init( "price_high_cents", version, ohlc.dateindex.boxed_clone(), - |di: DateIndex, iter| iter.get(di).map(|o: OHLCCents| o.high), + |di: DateIndex, iter| iter.get(di).map(|o: OHLCCentsUnsigned| o.high), ), low: LazyVecFrom1::init( "price_low_cents", version, ohlc.dateindex.boxed_clone(), - |di: DateIndex, iter| iter.get(di).map(|o: OHLCCents| o.low), + |di: DateIndex, iter| iter.get(di).map(|o: OHLCCentsUnsigned| o.low), ), close: LazyVecFrom1::init( "price_close_cents", version, ohlc.dateindex.boxed_clone(), - |di: DateIndex, iter| iter.get(di).map(|o: OHLCCents| o.close), + |di: DateIndex, iter| iter.get(di).map(|o: OHLCCentsUnsigned| o.close), ), }, }; diff --git a/crates/brk_computer/src/price/cents/vecs.rs b/crates/brk_computer/src/price/cents/vecs.rs index 1c567ff14..93831922b 100644 --- a/crates/brk_computer/src/price/cents/vecs.rs +++ b/crates/brk_computer/src/price/cents/vecs.rs @@ -1,10 +1,10 @@ use brk_traversable::Traversable; -use brk_types::{Cents, OHLCCents}; +use brk_types::{CentsUnsigned, OHLCCentsUnsigned}; use crate::internal::{ComputedHeightAndDateBytes, LazyHeightAndDateOHLC}; #[derive(Clone, Traversable)] pub struct Vecs { - pub split: LazyHeightAndDateOHLC, - pub ohlc: ComputedHeightAndDateBytes, + pub split: LazyHeightAndDateOHLC, + pub ohlc: ComputedHeightAndDateBytes, } diff --git a/crates/brk_computer/src/price/fetch.rs b/crates/brk_computer/src/price/fetch.rs index 290aa3b46..396a49375 100644 --- a/crates/brk_computer/src/price/fetch.rs +++ b/crates/brk_computer/src/price/fetch.rs @@ -1,6 +1,6 @@ use brk_error::Result; use brk_indexer::Indexer; -use brk_types::{DateIndex, Height, OHLCCents}; +use brk_types::{DateIndex, Height, OHLCCentsUnsigned}; use vecdb::{ AnyStoredVec, AnyVec, Exit, GenericStoredVec, IterableVec, TypedVecIterator, VecIndex, }; @@ -61,7 +61,7 @@ impl Vecs { let index = starting_indexes .dateindex .min(DateIndex::from(self.cents.ohlc.dateindex.len())); - let mut prev = Some(index.decremented().map_or(OHLCCents::default(), |prev_i| { + let mut prev = Some(index.decremented().map_or(OHLCCentsUnsigned::default(), |prev_i| { self.cents.ohlc.dateindex.iter().unwrap().get_unwrap(prev_i) })); indexes diff --git a/crates/brk_fetcher/src/binance.rs b/crates/brk_fetcher/src/binance.rs index 6a7ef63d6..f3aaebd79 100644 --- a/crates/brk_fetcher/src/binance.rs +++ b/crates/brk_fetcher/src/binance.rs @@ -6,7 +6,7 @@ use std::{ }; use brk_error::{Error, Result}; -use brk_types::{Date, Height, OHLCCents, Timestamp}; +use brk_types::{Date, Height, OHLCCentsUnsigned, Timestamp}; use serde_json::Value; use tracing::info; @@ -18,9 +18,9 @@ use crate::{ #[derive(Clone)] pub struct Binance { path: Option, - _1mn: Option>, - _1d: Option>, - har: Option>, + _1mn: Option>, + _1d: Option>, + har: Option>, } impl Binance { @@ -37,7 +37,7 @@ impl Binance { &mut self, timestamp: Timestamp, previous_timestamp: Option, - ) -> Result { + ) -> Result { // Try live API data first if self._1mn.is_none() || self._1mn.as_ref().unwrap().last_key_value().unwrap().0 <= ×tamp @@ -69,7 +69,7 @@ impl Binance { ) } - pub fn fetch_1mn() -> Result> { + pub fn fetch_1mn() -> Result> { default_retry(|_| { let url = Self::url("interval=1m&limit=1000"); info!("Fetching {url} ..."); @@ -79,7 +79,7 @@ impl Binance { }) } - pub fn get_from_1d(&mut self, date: &Date) -> Result { + pub fn get_from_1d(&mut self, date: &Date) -> Result { if self._1d.is_none() || self._1d.as_ref().unwrap().last_key_value().unwrap().0 <= date { self._1d.replace(Self::fetch_1d()?); } @@ -92,7 +92,7 @@ impl Binance { .ok_or(Error::NotFound("Couldn't find date".into())) } - pub fn fetch_1d() -> Result> { + pub fn fetch_1d() -> Result> { default_retry(|_| { let url = Self::url("interval=1d"); info!("Fetching {url} ..."); @@ -102,7 +102,7 @@ impl Binance { }) } - fn read_har(&self) -> Result> { + fn read_har(&self) -> Result> { if self.path.is_none() { return Err(Error::NotFound("HAR path not configured".into())); } @@ -179,7 +179,7 @@ impl Binance { }) } - fn parse_ohlc_array(json: &Value) -> Result> { + fn parse_ohlc_array(json: &Value) -> Result> { let result = json .as_array() .ok_or(Error::Parse("Expected JSON array".into()))? @@ -193,7 +193,7 @@ impl Binance { Ok(result) } - fn parse_date_ohlc_array(json: &Value) -> Result> { + fn parse_date_ohlc_array(json: &Value) -> Result> { Self::parse_ohlc_array(json).map(|map| { map.into_iter() .map(|(ts, ohlc)| (date_from_timestamp(ts), ohlc)) @@ -218,7 +218,7 @@ impl PriceSource for Binance { "Binance" } - fn get_date(&mut self, date: Date) -> Option> { + fn get_date(&mut self, date: Date) -> Option> { Some(self.get_from_1d(&date)) } @@ -226,11 +226,11 @@ impl PriceSource for Binance { &mut self, timestamp: Timestamp, previous_timestamp: Option, - ) -> Option> { + ) -> Option> { Some(self.get_from_1mn(timestamp, previous_timestamp)) } - fn get_height(&mut self, _height: Height) -> Option> { + fn get_height(&mut self, _height: Height) -> Option> { None // Binance doesn't support height-based queries } diff --git a/crates/brk_fetcher/src/brk.rs b/crates/brk_fetcher/src/brk.rs index 88f6437de..7de8cc001 100644 --- a/crates/brk_fetcher/src/brk.rs +++ b/crates/brk_fetcher/src/brk.rs @@ -2,8 +2,8 @@ use std::collections::BTreeMap; use brk_error::{Error, Result}; use brk_types::{ - Cents, CheckedSub, Close, Date, DateIndex, Dollars, Height, High, Low, OHLCCents, Open, - Timestamp, + CentsUnsigned, CheckedSub, Close, Date, DateIndex, Dollars, Height, High, Low, + OHLCCentsUnsigned, Open, Timestamp, }; use serde_json::Value; use tracing::info; @@ -13,15 +13,15 @@ use crate::{PriceSource, check_response, default_retry}; #[derive(Default, Clone)] #[allow(clippy::upper_case_acronyms)] pub struct BRK { - height_to_ohlc: BTreeMap>, - dateindex_to_ohlc: BTreeMap>, + height_to_ohlc: BTreeMap>, + dateindex_to_ohlc: BTreeMap>, } const API_URL: &str = "https://bitview.space/api/vecs"; const CHUNK_SIZE: usize = 10_000; impl BRK { - pub fn get_from_height(&mut self, height: Height) -> Result { + pub fn get_from_height(&mut self, height: Height) -> Result { let key = height.checked_sub(height % CHUNK_SIZE).unwrap(); #[allow(clippy::map_entry)] @@ -40,7 +40,7 @@ impl BRK { .ok_or(Error::NotFound("Couldn't find height in BRK".into())) } - fn fetch_height_prices(height: Height) -> Result> { + fn fetch_height_prices(height: Height) -> Result> { default_retry(|_| { let url = format!( "{API_URL}/height-to-price-ohlc?from={}&to={}", @@ -60,7 +60,7 @@ impl BRK { }) } - pub fn get_from_date(&mut self, date: Date) -> Result { + pub fn get_from_date(&mut self, date: Date) -> Result { let dateindex = DateIndex::try_from(date)?; let key = dateindex.checked_sub(dateindex % CHUNK_SIZE).unwrap(); @@ -81,7 +81,7 @@ impl BRK { .ok_or(Error::NotFound("Couldn't find date in BRK".into())) } - fn fetch_date_prices(dateindex: DateIndex) -> Result> { + fn fetch_date_prices(dateindex: DateIndex) -> Result> { default_retry(|_| { let url = format!( "{API_URL}/dateindex-to-price-ohlc?from={}&to={}", @@ -101,13 +101,13 @@ impl BRK { }) } - fn value_to_ohlc(value: &Value) -> Result { + fn value_to_ohlc(value: &Value) -> Result { let ohlc = value .as_array() .ok_or(Error::Parse("Expected OHLC array".into()))?; let get_value = |index: usize| -> Result<_> { - Ok(Cents::from(Dollars::from( + Ok(CentsUnsigned::from(Dollars::from( ohlc.get(index) .ok_or(Error::Parse("Missing OHLC value at index".into()))? .as_f64() @@ -115,7 +115,7 @@ impl BRK { ))) }; - Ok(OHLCCents::from(( + Ok(OHLCCentsUnsigned::from(( Open::new(get_value(0)?), High::new(get_value(1)?), Low::new(get_value(2)?), @@ -134,7 +134,7 @@ impl PriceSource for BRK { "BRK" } - fn get_date(&mut self, date: Date) -> Option> { + fn get_date(&mut self, date: Date) -> Option> { Some(self.get_from_date(date)) } @@ -142,11 +142,11 @@ impl PriceSource for BRK { &mut self, _timestamp: Timestamp, _previous_timestamp: Option, - ) -> Option> { + ) -> Option> { None // BRK doesn't support timestamp-based queries } - fn get_height(&mut self, height: Height) -> Option> { + fn get_height(&mut self, height: Height) -> Option> { Some(self.get_from_height(height)) } diff --git a/crates/brk_fetcher/src/kraken.rs b/crates/brk_fetcher/src/kraken.rs index ee20f8920..e3f3f3d06 100644 --- a/crates/brk_fetcher/src/kraken.rs +++ b/crates/brk_fetcher/src/kraken.rs @@ -1,7 +1,7 @@ use std::collections::BTreeMap; use brk_error::{Error, Result}; -use brk_types::{Date, Height, OHLCCents, Timestamp}; +use brk_types::{Date, Height, OHLCCentsUnsigned, Timestamp}; use serde_json::Value; use tracing::info; @@ -12,8 +12,8 @@ use crate::{ #[derive(Default, Clone)] pub struct Kraken { - _1mn: Option>, - _1d: Option>, + _1mn: Option>, + _1d: Option>, } impl Kraken { @@ -21,7 +21,7 @@ impl Kraken { &mut self, timestamp: Timestamp, previous_timestamp: Option, - ) -> Result { + ) -> Result { if self._1mn.is_none() || self._1mn.as_ref().unwrap().last_key_value().unwrap().0 <= ×tamp { @@ -35,7 +35,7 @@ impl Kraken { ) } - pub fn fetch_1mn() -> Result> { + pub fn fetch_1mn() -> Result> { default_retry(|_| { let url = Self::url(1); info!("Fetching {url} ..."); @@ -45,7 +45,7 @@ impl Kraken { }) } - fn get_from_1d(&mut self, date: &Date) -> Result { + fn get_from_1d(&mut self, date: &Date) -> Result { if self._1d.is_none() || self._1d.as_ref().unwrap().last_key_value().unwrap().0 <= date { self._1d.replace(Self::fetch_1d()?); } @@ -57,7 +57,7 @@ impl Kraken { .ok_or(Error::NotFound("Couldn't find date".into())) } - pub fn fetch_1d() -> Result> { + pub fn fetch_1d() -> Result> { default_retry(|_| { let url = Self::url(1440); info!("Fetching {url} ..."); @@ -68,7 +68,7 @@ impl Kraken { } /// Parse Kraken's nested JSON response: { result: { XXBTZUSD: [...] } } - fn parse_ohlc_response(json: &Value) -> Result> { + fn parse_ohlc_response(json: &Value) -> Result> { let result = json .get("result") .and_then(|r| r.get("XXBTZUSD")) @@ -84,7 +84,7 @@ impl Kraken { Ok(result) } - fn parse_date_ohlc_response(json: &Value) -> Result> { + fn parse_date_ohlc_response(json: &Value) -> Result> { Self::parse_ohlc_response(json).map(|map| { map.into_iter() .map(|(ts, ohlc)| (date_from_timestamp(ts), ohlc)) @@ -109,7 +109,7 @@ impl PriceSource for Kraken { "Kraken" } - fn get_date(&mut self, date: Date) -> Option> { + fn get_date(&mut self, date: Date) -> Option> { Some(self.get_from_1d(&date)) } @@ -117,11 +117,11 @@ impl PriceSource for Kraken { &mut self, timestamp: Timestamp, previous_timestamp: Option, - ) -> Option> { + ) -> Option> { Some(self.get_from_1mn(timestamp, previous_timestamp)) } - fn get_height(&mut self, _height: Height) -> Option> { + fn get_height(&mut self, _height: Height) -> Option> { None // Kraken doesn't support height-based queries } diff --git a/crates/brk_fetcher/src/lib.rs b/crates/brk_fetcher/src/lib.rs index abacf1823..28efca81f 100644 --- a/crates/brk_fetcher/src/lib.rs +++ b/crates/brk_fetcher/src/lib.rs @@ -3,7 +3,7 @@ use std::{path::Path, thread::sleep, time::Duration}; use brk_error::{Error, Result}; -use brk_types::{Date, Height, OHLCCents, Timestamp}; +use brk_types::{Date, Height, OHLCCentsUnsigned, Timestamp}; use tracing::info; mod binance; @@ -66,9 +66,9 @@ impl Fetcher { } /// Try fetching from each source in order, return first success - fn try_sources(&mut self, mut fetch: F) -> Option> + fn try_sources(&mut self, mut fetch: F) -> Option> where - F: FnMut(&mut dyn PriceSource) -> Option>, + F: FnMut(&mut dyn PriceSource) -> Option>, { if let Some(Ok(ohlc)) = fetch(&mut self.binance) { return Some(Ok(ohlc)); @@ -82,7 +82,7 @@ impl Fetcher { None } - pub fn get_date(&mut self, date: Date) -> Result { + pub fn get_date(&mut self, date: Date) -> Result { self.fetch_with_retry( |source| source.get_date(date), || format!("Failed to fetch price for date {date}"), @@ -94,7 +94,7 @@ impl Fetcher { height: Height, timestamp: Timestamp, previous_timestamp: Option, - ) -> Result { + ) -> Result { let timestamp = timestamp.floor_seconds(); let previous_timestamp = previous_timestamp.map(|t| t.floor_seconds()); @@ -133,9 +133,9 @@ How to fix this: } /// Try each source in order, with retries on total failure - fn fetch_with_retry(&mut self, mut fetch: F, error_message: E) -> Result + fn fetch_with_retry(&mut self, mut fetch: F, error_message: E) -> Result where - F: FnMut(&mut dyn PriceSource) -> Option>, + F: FnMut(&mut dyn PriceSource) -> Option>, E: Fn() -> String, { for retry in 0..=MAX_RETRIES { diff --git a/crates/brk_fetcher/src/ohlc.rs b/crates/brk_fetcher/src/ohlc.rs index a0f9c77fd..c093e0603 100644 --- a/crates/brk_fetcher/src/ohlc.rs +++ b/crates/brk_fetcher/src/ohlc.rs @@ -1,11 +1,11 @@ use std::collections::BTreeMap; use brk_error::{Error, Result}; -use brk_types::{Cents, Close, Date, Dollars, High, Low, OHLCCents, Open, Timestamp}; +use brk_types::{CentsUnsigned, Close, Date, Dollars, High, Low, OHLCCentsUnsigned, Open, Timestamp}; /// Parse OHLC value from a JSON array element at given index -pub fn parse_cents(array: &[serde_json::Value], index: usize) -> Cents { - Cents::from(Dollars::from( +pub fn parse_cents(array: &[serde_json::Value], index: usize) -> CentsUnsigned { + CentsUnsigned::from(Dollars::from( array .get(index) .and_then(|v| v.as_str()) @@ -14,9 +14,9 @@ pub fn parse_cents(array: &[serde_json::Value], index: usize) -> Cents { )) } -/// Build OHLCCents from array indices 1-4 (open, high, low, close) -pub fn ohlc_from_array(array: &[serde_json::Value]) -> OHLCCents { - OHLCCents::from(( +/// Build OHLCCentsUnsigned from array indices 1-4 (open, high, low, close) +pub fn ohlc_from_array(array: &[serde_json::Value]) -> OHLCCentsUnsigned { + OHLCCentsUnsigned::from(( Open::new(parse_cents(array, 1)), High::new(parse_cents(array, 2)), Low::new(parse_cents(array, 3)), @@ -27,13 +27,13 @@ pub fn ohlc_from_array(array: &[serde_json::Value]) -> OHLCCents { /// Compute OHLC for a block from a time series of minute data. /// Aggregates all candles between previous_timestamp and timestamp. pub fn compute_ohlc_from_range( - tree: &BTreeMap, + tree: &BTreeMap, timestamp: Timestamp, previous_timestamp: Option, source_name: &str, -) -> Result { +) -> Result { let previous_ohlc = previous_timestamp - .map_or(Some(OHLCCents::default()), |t| tree.get(&t).cloned()); + .map_or(Some(OHLCCentsUnsigned::default()), |t| tree.get(&t).cloned()); let last_ohlc = tree.get(×tamp); @@ -44,7 +44,7 @@ pub fn compute_ohlc_from_range( } let previous_ohlc = previous_ohlc.unwrap(); - let mut result = OHLCCents::from(previous_ohlc.close); + let mut result = OHLCCentsUnsigned::from(previous_ohlc.close); let start = previous_timestamp.unwrap_or(Timestamp::new(0)); let end = timestamp; diff --git a/crates/brk_fetcher/src/source.rs b/crates/brk_fetcher/src/source.rs index 0d4c8f8ea..36bfc12ac 100644 --- a/crates/brk_fetcher/src/source.rs +++ b/crates/brk_fetcher/src/source.rs @@ -1,7 +1,7 @@ use std::time::{Duration, Instant}; use brk_error::{Error, Result}; -use brk_types::{Date, Height, OHLCCents, Timestamp}; +use brk_types::{Date, Height, OHLCCentsUnsigned, Timestamp}; use tracing::info; /// Default cooldown period for unhealthy sources (5 minutes) @@ -12,17 +12,17 @@ pub trait PriceSource { fn name(&self) -> &'static str; /// Fetch daily OHLC for a date. Returns None if this source doesn't support date queries. - fn get_date(&mut self, date: Date) -> Option>; + fn get_date(&mut self, date: Date) -> Option>; /// Fetch minute OHLC for a timestamp range. Returns None if unsupported. fn get_1mn( &mut self, timestamp: Timestamp, previous_timestamp: Option, - ) -> Option>; + ) -> Option>; /// Fetch OHLC by block height. Returns None if unsupported. - fn get_height(&mut self, height: Height) -> Option>; + fn get_height(&mut self, height: Height) -> Option>; /// Check if the source is reachable fn ping(&self) -> Result<()>; @@ -115,7 +115,7 @@ impl PriceSource for TrackedSource { self.source.name() } - fn get_date(&mut self, date: Date) -> Option> { + fn get_date(&mut self, date: Date) -> Option> { self.try_fetch(|s| s.get_date(date)) } @@ -123,11 +123,11 @@ impl PriceSource for TrackedSource { &mut self, timestamp: Timestamp, previous_timestamp: Option, - ) -> Option> { + ) -> Option> { self.try_fetch(|s| s.get_1mn(timestamp, previous_timestamp)) } - fn get_height(&mut self, height: Height) -> Option> { + fn get_height(&mut self, height: Height) -> Option> { self.try_fetch(|s| s.get_height(height)) } diff --git a/crates/brk_server/src/api/openapi/compact.rs b/crates/brk_server/src/api/openapi/compact.rs index 45a558f16..ddb168e2d 100644 --- a/crates/brk_server/src/api/openapi/compact.rs +++ b/crates/brk_server/src/api/openapi/compact.rs @@ -21,19 +21,54 @@ impl ApiJson { /// Removes redundant fields while preserving essential API information. /// /// Transformations applied (in order): -/// 1. Remove error responses (304, 400, 404, 500) -/// 2. Compact responses to "returns": "Type" -/// 3. Remove per-endpoint tags and style -/// 4. Simplify parameter schema to type, remove param descriptions -/// 5. Remove summary -/// 6. Remove examples, replace $ref with type -/// 7. Flatten single-item allOf -/// 8. Flatten anyOf to type array -/// 9. Remove format -/// 10. Remove property descriptions -/// 11. Simplify properties to direct types +/// 1. Remove deprecated endpoints +/// 2. Remove contact/license from info +/// 3. Remove *Param schemas +/// 3. Remove error responses (304, 400, 404, 500) +/// 4. Compact responses to "returns": "Type" +/// 5. Remove per-endpoint tags and style +/// 6. Simplify parameter schema to type, remove param descriptions +/// 7. Remove summary and operationId +/// 8. Remove examples, replace $ref with type +/// 9. Flatten single-item allOf +/// 10. Flatten anyOf to type array +/// 11. Remove format +/// 12. Remove property descriptions +/// 13. Simplify properties to direct types +/// 14. Remove min/max constraints +/// 15. Trim descriptions to first paragraph, strip mempool.space links +/// 16. Remove required arrays from schemas +/// 17. Remove redundant "type": "object" when properties exist +/// 18. Flatten single-element type arrays +/// 19. Replace large enums (>20 values) with string type fn compact_json(json: &str) -> String { let mut spec: Value = serde_json::from_str(json).expect("Invalid OpenAPI JSON"); + + // Step 1: Remove deprecated endpoints from paths + if let Some(Value::Object(paths)) = spec.get_mut("paths") { + paths.retain(|_, v| { + if let Value::Object(path_obj) = v + && let Some(Value::Object(get_obj)) = path_obj.get("get") + { + return get_obj.get("deprecated") != Some(&Value::Bool(true)); + } + true + }); + } + + // Step 2: Remove contact/license from info + if let Some(Value::Object(info)) = spec.get_mut("info") { + info.remove("contact"); + info.remove("license"); + } + + // Step 3: Remove *Param schemas from components + if let Some(Value::Object(components)) = spec.get_mut("components") + && let Some(Value::Object(schemas)) = components.get_mut("schemas") + { + schemas.retain(|name, _| !name.ends_with("Param")); + } + compact_value(&mut spec); serde_json::to_string(&spec).unwrap() } @@ -70,8 +105,9 @@ fn compact_value(value: &mut Value) { } } - // Step 5: Remove summary + // Step 7: Remove summary and operationId obj.remove("summary"); + obj.remove("operationId"); // Step 6: Remove examples, replace $ref with type obj.remove("example"); @@ -113,10 +149,45 @@ fn compact_value(value: &mut Value) { } } - // Step 9: Remove format + // Step 11: Remove format obj.remove("format"); - // Step 10 & 11: Simplify properties (remove descriptions, simplify to direct types) + // Step 14: Remove min/max constraints + obj.remove("minimum"); + obj.remove("maximum"); + + // Step 16: Remove required arrays from schemas (but keep boolean required on params) + if let Some(Value::Array(_)) = obj.get("required") { + obj.remove("required"); + } + + // Step 17: Flatten single-element type arrays: ["object"] -> "object" + if let Some(Value::Array(arr)) = obj.get("type").cloned() + && arr.len() == 1 + { + obj.insert("type".to_string(), arr.into_iter().next().unwrap()); + } + + // Step 18: Remove "type": "object" when properties exist (it's redundant) + if obj.contains_key("properties") + && obj.get("type") == Some(&Value::String("object".to_string())) + { + obj.remove("type"); + } + + // Step 19: Replace large enums (>20 values) with just string type + if let Some(Value::Array(enum_values)) = obj.get("enum") + && enum_values.len() > 20 + { + obj.remove("enum"); + } + + // Step 15: Strip mempool.space links and keep only first paragraph of descriptions + if let Some(Value::String(desc)) = obj.get_mut("description") { + *desc = trim_description(desc); + } + + // Step 12 & 13: Simplify properties (remove descriptions, simplify to direct types) if let Some(Value::Object(props)) = obj.get_mut("properties") { simplify_properties(props); } @@ -135,6 +206,23 @@ fn compact_value(value: &mut Value) { } } +/// Trim description to first paragraph and strip mempool.space endpoint links. +fn trim_description(desc: &str) -> String { + // First, strip mempool.space docs links (endpoint pattern with asterisks) + let desc = if let Some(idx) = desc.find("*[Mempool.space docs]") { + desc[..idx].trim() + } else { + desc + }; + + // Keep only the first paragraph (up to \n\n) + if let Some(idx) = desc.find("\n\n") { + desc[..idx].trim().to_string() + } else { + desc.trim().to_string() + } +} + fn extract_return_type(responses: &Map) -> Option { let resp_200 = responses.get("200")?; let content = resp_200.get("content")?; @@ -226,11 +314,27 @@ fn simplify_properties(props: &mut Map) { } fn simplify_property_value(obj: &mut Map) -> Value { - // Remove validation constraints - for key in &["default", "minItems", "maxItems", "uniqueItems"] { + // Remove validation constraints, format, and examples + for key in &[ + "default", + "minItems", + "maxItems", + "uniqueItems", + "minimum", + "maximum", + "format", + "examples", + "example", + "description", + ] { obj.remove(*key); } + // Remove "items": true (means any type, not useful) + if obj.get("items") == Some(&Value::Bool(true)) { + obj.remove("items"); + } + // Handle $ref - convert to type (runs before recursion would) if let Some(Value::String(ref_path)) = obj.remove("$ref") { let type_name = ref_path.split('/').next_back().unwrap_or("any"); diff --git a/crates/brk_traversable/Cargo.toml b/crates/brk_traversable/Cargo.toml index 690b46139..976b36650 100644 --- a/crates/brk_traversable/Cargo.toml +++ b/crates/brk_traversable/Cargo.toml @@ -17,6 +17,7 @@ zstd = ["vecdb/zstd"] [dependencies] brk_types = { workspace = true } brk_traversable_derive = { workspace = true, optional = true } +indexmap = { workspace = true } schemars = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } diff --git a/crates/brk_traversable/src/lib.rs b/crates/brk_traversable/src/lib.rs index 1be8608b6..2f5a85513 100644 --- a/crates/brk_traversable/src/lib.rs +++ b/crates/brk_traversable/src/lib.rs @@ -1,5 +1,6 @@ use std::{collections::BTreeMap, fmt::Display}; +pub use indexmap::IndexMap; pub use brk_types::{Index, MetricLeaf, MetricLeafWithSchema, TreeNode}; #[cfg(feature = "derive")] @@ -197,7 +198,7 @@ impl Traversable for Option { fn to_tree_node(&self) -> TreeNode { match self { Some(inner) => inner.to_tree_node(), - None => TreeNode::Branch(BTreeMap::new()), + None => TreeNode::Branch(IndexMap::new()), } } @@ -233,7 +234,7 @@ impl Traversable for BTreeMap { /// (e.g., Unpriced variants where dollar fields are not needed) impl Traversable for () { fn to_tree_node(&self) -> TreeNode { - TreeNode::Branch(BTreeMap::new()) + TreeNode::Branch(IndexMap::new()) } fn iter_any_exportable(&self) -> impl Iterator { diff --git a/crates/brk_traversable_derive/src/lib.rs b/crates/brk_traversable_derive/src/lib.rs index 9cbd21fc1..d7a15c7c8 100644 --- a/crates/brk_traversable_derive/src/lib.rs +++ b/crates/brk_traversable_derive/src/lib.rs @@ -94,7 +94,7 @@ pub fn derive_traversable(input: TokenStream) -> TokenStream { return TokenStream::from(quote! { impl #impl_generics Traversable for #name #ty_generics { fn to_tree_node(&self) -> brk_traversable::TreeNode { - brk_traversable::TreeNode::Branch(std::collections::BTreeMap::new()) + brk_traversable::TreeNode::Branch(brk_traversable::IndexMap::new()) } fn iter_any_exportable(&self) -> impl Iterator { @@ -362,8 +362,8 @@ fn generate_field_traversals(infos: &[FieldInfo], merge: bool) -> proc_macro2::T // No flatten fields - use merge_entry for each to handle duplicates ( quote! { - let mut collected: std::collections::BTreeMap = - std::collections::BTreeMap::new(); + let mut collected: brk_traversable::IndexMap = + brk_traversable::IndexMap::new(); for entry in [#(#normal_entries,)*].into_iter().flatten() { brk_traversable::TreeNode::merge_node(&mut collected, entry.0, entry.1) .expect("Conflicting values for same key"); @@ -375,8 +375,8 @@ fn generate_field_traversals(infos: &[FieldInfo], merge: bool) -> proc_macro2::T // Only flatten fields - explicit type annotation needed ( quote! { - let mut collected: std::collections::BTreeMap = - std::collections::BTreeMap::new(); + let mut collected: brk_traversable::IndexMap = + brk_traversable::IndexMap::new(); }, quote! { #(#flatten_entries)* }, ) @@ -384,8 +384,8 @@ fn generate_field_traversals(infos: &[FieldInfo], merge: bool) -> proc_macro2::T // Both normal and flatten fields - use merge_entry for normal fields ( quote! { - let mut collected: std::collections::BTreeMap = - std::collections::BTreeMap::new(); + let mut collected: brk_traversable::IndexMap = + brk_traversable::IndexMap::new(); for entry in [#(#normal_entries,)*].into_iter().flatten() { brk_traversable::TreeNode::merge_node(&mut collected, entry.0, entry.1) .expect("Conflicting values for same key"); diff --git a/crates/brk_types/Cargo.toml b/crates/brk_types/Cargo.toml index fb33ff170..31f984939 100644 --- a/crates/brk_types/Cargo.toml +++ b/crates/brk_types/Cargo.toml @@ -12,6 +12,7 @@ bitcoin = { workspace = true } brk_error = { workspace = true, features = ["bitcoin", "jiff", "serde_json", "vecdb"] } byteview = { workspace = true } derive_more = { workspace = true } +indexmap = { workspace = true } itoa = "1.0.17" jiff = { workspace = true } rapidhash = "4.2.1" diff --git a/crates/brk_types/src/cents_sats.rs b/crates/brk_types/src/cents_sats.rs new file mode 100644 index 000000000..f60ea58ce --- /dev/null +++ b/crates/brk_types/src/cents_sats.rs @@ -0,0 +1,138 @@ +use std::ops::{Add, AddAssign, Div, Sub, SubAssign}; + +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; +use vecdb::{Bytes, Formattable}; + +use super::{CentsSquaredSats, CentsUnsigned, Sats}; + +/// Cents × Sats (u128) - price in cents multiplied by amount in sats. +/// Uses u128 because large amounts at any price can overflow u64. +#[derive( + Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize, JsonSchema, +)] +pub struct CentsSats(u128); + +impl CentsSats { + pub const ZERO: Self = Self(0); + + #[inline(always)] + pub const fn new(value: u128) -> Self { + Self(value) + } + + /// Compute from price and sats using widening multiplication + #[inline(always)] + pub fn from_price_sats(price: CentsUnsigned, sats: Sats) -> Self { + Self(price.inner() as u128 * sats.as_u128()) + } + + #[inline(always)] + pub const fn inner(self) -> u128 { + self.0 + } + + #[inline(always)] + pub const fn as_u128(self) -> u128 { + self.0 + } + + /// Convert to CentsUnsigned by dividing by ONE_BTC. + #[inline(always)] + pub fn to_cents(self) -> CentsUnsigned { + CentsUnsigned::new((self.0 / Sats::ONE_BTC_U128) as u64) + } + + /// Get the realized price (cents per BTC) given the sats amount. + #[inline(always)] + pub fn realized_price(self, sats: Sats) -> CentsUnsigned { + if sats.is_zero() { + return CentsUnsigned::ZERO; + } + let result = self.0 / sats.as_u128(); + CentsUnsigned::new(result.min(u32::MAX as u128) as u64) + } + + /// Compute investor cap (price² × sats) = price × (price × sats) + #[inline(always)] + pub fn to_investor_cap(self, price: CentsUnsigned) -> CentsSquaredSats { + CentsSquaredSats::new(price.inner() as u128 * self.0) + } +} + +impl Add for CentsSats { + type Output = Self; + #[inline(always)] + fn add(self, rhs: Self) -> Self { + Self(self.0 + rhs.0) + } +} + +impl AddAssign for CentsSats { + #[inline(always)] + fn add_assign(&mut self, rhs: Self) { + self.0 += rhs.0; + } +} + +impl Sub for CentsSats { + type Output = Self; + #[inline(always)] + fn sub(self, rhs: Self) -> Self { + Self(self.0 - rhs.0) + } +} + +impl SubAssign for CentsSats { + #[inline(always)] + fn sub_assign(&mut self, rhs: Self) { + self.0 -= rhs.0; + } +} + +impl From for CentsSats { + #[inline(always)] + fn from(value: u128) -> Self { + Self(value) + } +} + +impl From for u128 { + #[inline(always)] + fn from(value: CentsSats) -> Self { + value.0 + } +} + +impl Div for CentsSats { + type Output = Self; + #[inline(always)] + fn div(self, rhs: usize) -> Self { + Self(self.0 / rhs as u128) + } +} + +impl Formattable for CentsSats { + #[inline(always)] + fn may_need_escaping() -> bool { + false + } +} + +impl Bytes for CentsSats { + type Array = [u8; 16]; + + fn to_bytes(&self) -> Self::Array { + self.0.to_le_bytes() + } + + fn from_bytes(bytes: &[u8]) -> vecdb::Result { + Ok(Self(u128::from_bytes(bytes)?)) + } +} + +impl std::fmt::Display for CentsSats { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.0) + } +} diff --git a/crates/brk_types/src/cents_signed_compact.rs b/crates/brk_types/src/cents_signed_compact.rs deleted file mode 100644 index 2b5b9df38..000000000 --- a/crates/brk_types/src/cents_signed_compact.rs +++ /dev/null @@ -1,91 +0,0 @@ -use serde::{Deserialize, Serialize}; - -use super::Dollars; - -/// Compact signed cents (i32) - memory-efficient for map keys. -/// Supports prices from -$21,474,836.47 to $21,474,836.47 (i32 range / 100). -#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)] -pub struct CentsSignedCompact(i32); - -impl CentsSignedCompact { - pub const ZERO: Self = Self(0); - - #[inline] - pub const fn new(value: i32) -> Self { - Self(value) - } - - #[inline] - pub const fn inner(self) -> i32 { - self.0 - } - - #[inline] - pub fn is_negative(self) -> bool { - self.0 < 0 - } - - #[inline] - pub fn to_dollars(self) -> Dollars { - Dollars::from(self.0 as f64 / 100.0) - } - - #[inline] - pub fn checked_sub(self, rhs: Self) -> Option { - self.0.checked_sub(rhs.0).map(Self) - } -} - -impl From for CentsSignedCompact { - #[inline] - fn from(value: Dollars) -> Self { - let f = f64::from(value); - if f.is_nan() { - Self::ZERO - } else { - let cents = (f * 100.0).round(); - debug_assert!( - cents >= i32::MIN as f64 && cents <= i32::MAX as f64, - "Price ${} exceeds CentsSignedCompact range (~$21.5M)", - f - ); - Self(cents as i32) - } - } -} - -impl From for Dollars { - #[inline] - fn from(value: CentsSignedCompact) -> Self { - value.to_dollars() - } -} - -impl From for CentsSignedCompact { - #[inline] - fn from(value: i32) -> Self { - Self(value) - } -} - -impl From for i32 { - #[inline] - fn from(value: CentsSignedCompact) -> Self { - value.0 - } -} - -impl From for f64 { - #[inline] - fn from(value: CentsSignedCompact) -> Self { - value.0 as f64 - } -} - -impl std::fmt::Display for CentsSignedCompact { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - let mut buf = itoa::Buffer::new(); - let str = buf.format(self.0); - f.write_str(str) - } -} diff --git a/crates/brk_types/src/cents_squared_sats.rs b/crates/brk_types/src/cents_squared_sats.rs new file mode 100644 index 000000000..439715504 --- /dev/null +++ b/crates/brk_types/src/cents_squared_sats.rs @@ -0,0 +1,133 @@ +use std::ops::{Add, AddAssign, Div, Sub, SubAssign}; + +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; +use vecdb::{Bytes, Formattable}; + +/// Raw cents squared (u128) - stores cents² × sats without division. +/// Used for precise accumulation of investor cap values: Σ(price² × sats). +/// investor_price = investor_cap_raw / realized_cap_raw +#[derive( + Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize, JsonSchema, +)] +pub struct CentsSquaredSats(u128); + +impl CentsSquaredSats { + pub const ZERO: Self = Self(0); + + #[inline(always)] + pub const fn new(value: u128) -> Self { + Self(value) + } + + #[inline(always)] + pub const fn inner(self) -> u128 { + self.0 + } +} + +impl Div for CentsSquaredSats { + type Output = u128; + #[inline(always)] + fn div(self, rhs: u128) -> u128 { + self.0 / rhs + } +} + +impl AddAssign for CentsSquaredSats { + #[inline(always)] + fn add_assign(&mut self, rhs: u128) { + self.0 += rhs; + } +} + +impl SubAssign for CentsSquaredSats { + #[inline(always)] + fn sub_assign(&mut self, rhs: u128) { + self.0 -= rhs; + } +} + +impl Add for CentsSquaredSats { + type Output = Self; + #[inline(always)] + fn add(self, rhs: Self) -> Self { + Self(self.0 + rhs.0) + } +} + +impl AddAssign for CentsSquaredSats { + #[inline(always)] + fn add_assign(&mut self, rhs: Self) { + self.0 += rhs.0; + } +} + +impl Sub for CentsSquaredSats { + type Output = Self; + #[inline(always)] + fn sub(self, rhs: Self) -> Self { + Self(self.0 - rhs.0) + } +} + +impl SubAssign for CentsSquaredSats { + #[inline(always)] + fn sub_assign(&mut self, rhs: Self) { + self.0 -= rhs.0; + } +} + +impl From for CentsSquaredSats { + #[inline(always)] + fn from(value: u128) -> Self { + Self(value) + } +} + +impl From for u128 { + #[inline(always)] + fn from(value: CentsSquaredSats) -> Self { + value.0 + } +} + +impl From for CentsSquaredSats { + #[inline(always)] + fn from(value: usize) -> Self { + Self(value as u128) + } +} + +impl Div for CentsSquaredSats { + type Output = Self; + #[inline(always)] + fn div(self, rhs: usize) -> Self { + Self(self.0 / rhs as u128) + } +} + +impl Formattable for CentsSquaredSats { + #[inline(always)] + fn may_need_escaping() -> bool { + false + } +} + +impl Bytes for CentsSquaredSats { + type Array = [u8; 16]; + + fn to_bytes(&self) -> Self::Array { + self.0.to_le_bytes() + } + + fn from_bytes(bytes: &[u8]) -> vecdb::Result { + Ok(Self(u128::from_bytes(bytes)?)) + } +} + +impl std::fmt::Display for CentsSquaredSats { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.0) + } +} diff --git a/crates/brk_types/src/cents_unsigned.rs b/crates/brk_types/src/cents_unsigned.rs index f25b81ceb..b06a3860f 100644 --- a/crates/brk_types/src/cents_unsigned.rs +++ b/crates/brk_types/src/cents_unsigned.rs @@ -4,7 +4,7 @@ use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use vecdb::{Formattable, Pco}; -use super::Dollars; +use super::{CentsSats, Dollars, Sats}; /// Unsigned cents (u64) - for values that should never be negative. /// Used for invested capital, realized cap, etc. @@ -33,11 +33,16 @@ impl CentsUnsigned { Self(value) } - #[inline] + #[inline(always)] pub const fn inner(self) -> u64 { self.0 } + #[inline(always)] + pub const fn as_u128(self) -> u128 { + self.0 as u128 + } + #[inline] pub fn checked_sub(self, rhs: Self) -> Option { self.0.checked_sub(rhs.0).map(Self) @@ -84,6 +89,13 @@ impl From for CentsUnsigned { } } +impl From for CentsUnsigned { + #[inline] + fn from(value: usize) -> Self { + Self(value as u64) + } +} + impl From for u64 { #[inline] fn from(value: CentsUnsigned) -> Self { @@ -113,6 +125,17 @@ impl From for f64 { } } +impl From for CentsUnsigned { + #[inline] + fn from(value: f64) -> Self { + if value.is_nan() || value < 0.0 { + Self::ZERO + } else { + Self(value as u64) + } + } +} + impl Add for CentsUnsigned { type Output = Self; #[inline] @@ -167,6 +190,14 @@ impl Mul for CentsUnsigned { } } +impl Mul for CentsUnsigned { + type Output = CentsSats; + #[inline] + fn mul(self, sats: Sats) -> CentsSats { + CentsSats::new(self.as_u128() * sats.as_u128()) + } +} + impl Div for CentsUnsigned { type Output = Self; #[inline] diff --git a/crates/brk_types/src/cents_unsigned_compact.rs b/crates/brk_types/src/cents_unsigned_compact.rs index 045f7d6ed..c00e40f41 100644 --- a/crates/brk_types/src/cents_unsigned_compact.rs +++ b/crates/brk_types/src/cents_unsigned_compact.rs @@ -1,6 +1,8 @@ +use std::ops::Sub; + use serde::{Deserialize, Serialize}; -use super::Dollars; +use super::{CentsUnsigned, Dollars}; /// Compact unsigned cents (u32) - memory-efficient for map keys. /// Supports values from $0.00 to $42,949,672.95 (u32::MAX / 100). @@ -21,6 +23,11 @@ impl CentsUnsignedCompact { self.0 } + #[inline(always)] + pub const fn as_u128(self) -> u128 { + self.0 as u128 + } + #[inline] pub fn to_dollars(self) -> Dollars { Dollars::from(self.0 as f64 / 100.0) @@ -83,6 +90,34 @@ impl From for f64 { } } +impl From for CentsUnsignedCompact { + #[inline] + fn from(value: CentsUnsigned) -> Self { + let v = value.inner(); + debug_assert!( + v <= u32::MAX as u64, + "CentsUnsigned {} exceeds CentsUnsignedCompact max", + v + ); + Self(v as u32) + } +} + +impl From for CentsUnsigned { + #[inline] + fn from(value: CentsUnsignedCompact) -> Self { + CentsUnsigned::new(value.0 as u64) + } +} + +impl Sub for CentsUnsignedCompact { + type Output = Self; + #[inline(always)] + fn sub(self, rhs: Self) -> Self { + Self(self.0 - rhs.0) + } +} + impl std::fmt::Display for CentsUnsignedCompact { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let mut buf = itoa::Buffer::new(); diff --git a/crates/brk_types/src/dollars.rs b/crates/brk_types/src/dollars.rs index f5d0a57cb..ac277441f 100644 --- a/crates/brk_types/src/dollars.rs +++ b/crates/brk_types/src/dollars.rs @@ -13,7 +13,7 @@ use vecdb::{CheckedSub, Formattable, Pco}; use crate::{Low, Open}; -use super::{Bitcoin, Cents, Close, High, Sats, StoredF32, StoredF64}; +use super::{Bitcoin, CentsSigned, Close, High, Sats, StoredF32, StoredF64}; /// US Dollar amount as floating point #[derive(Debug, Default, Clone, Copy, Deref, Serialize, Deserialize, Pco, JsonSchema)] @@ -38,7 +38,7 @@ impl Dollars { } pub fn round_to(self, digits: i32) -> Self { - Self::from(Cents::from(self).round_to(digits)) + Self::from(CentsSigned::from(self).round_to(digits)) } pub fn is_negative(&self) -> bool { @@ -68,13 +68,6 @@ impl From for Dollars { } } -impl From for Dollars { - #[inline] - fn from(value: Cents) -> Self { - Self(f64::from(value) / 100.0) - } -} - impl From for f32 { #[inline] fn from(value: Dollars) -> Self { @@ -127,14 +120,14 @@ impl From for Dollars { impl Add for Dollars { type Output = Self; fn add(self, rhs: Self) -> Self::Output { - Self::from(Cents::from(self) + Cents::from(rhs)) + Self::from(CentsSigned::from(self) + CentsSigned::from(rhs)) } } impl Sub for Dollars { type Output = Self; fn sub(self, rhs: Self) -> Self::Output { - Self::from(Cents::from(self) - Cents::from(rhs)) + Self::from(CentsSigned::from(self) - CentsSigned::from(rhs)) } } @@ -177,7 +170,7 @@ impl Div for Dollars { if self.is_nan() || rhs == 0 { Dollars::NAN } else { - Self::from(Cents::from(self) / rhs) + Self::from(CentsSigned::from(self) / rhs) } } } @@ -195,7 +188,7 @@ impl Div for Dollars { if self.is_nan() || rhs == 0.0 { Dollars::NAN } else { - Dollars::from(Cents::from(Self::from(self.0 / rhs))) + Dollars::from(CentsSigned::from(Self::from(self.0 / rhs))) } } } @@ -214,28 +207,28 @@ impl Div for Dollars { impl Mul for Dollars { type Output = Self; fn mul(self, rhs: Dollars) -> Self::Output { - Self::from(Cents::from(self) * Cents::from(rhs)) + Self::from(CentsSigned::from(self) * CentsSigned::from(rhs)) } } impl Mul> for Dollars { type Output = Self; fn mul(self, rhs: Close) -> Self::Output { - Self::from(Cents::from(self) * Cents::from(*rhs)) + Self::from(CentsSigned::from(self) * CentsSigned::from(*rhs)) } } impl Mul for Close { type Output = Dollars; fn mul(self, rhs: Dollars) -> Self::Output { - Dollars::from(Cents::from(*self) * Cents::from(rhs)) + Dollars::from(CentsSigned::from(*self) * CentsSigned::from(rhs)) } } impl Mul for Close { type Output = Dollars; fn mul(self, rhs: usize) -> Self::Output { - Dollars::from(Cents::from(*self) * rhs) + Dollars::from(CentsSigned::from(*self) * rhs) } } @@ -277,8 +270,8 @@ impl Mul for Dollars { if self.is_nan() { self } else { - Self::from(Cents::from( - u128::from(rhs) * u128::from(Cents::from(self)) / Sats::ONE_BTC_U128, + Self::from(CentsSigned::from( + u128::from(rhs) * u128::from(CentsSigned::from(self)) / Sats::ONE_BTC_U128, )) } } @@ -301,7 +294,7 @@ impl Mul for Dollars { impl Mul for Dollars { type Output = Self; fn mul(self, rhs: i64) -> Self::Output { - Self::from(Cents::from(self) * rhs) + Self::from(CentsSigned::from(self) * rhs) } } @@ -311,15 +304,22 @@ impl Mul for Dollars { if self.is_nan() { self } else { - Self::from(Cents::from(self) * rhs) + Self::from(CentsSigned::from(self) * rhs) } } } +impl From for Dollars { + #[inline] + fn from(value: u64) -> Self { + Self::from(CentsSigned::from(value)) + } +} + impl From for Dollars { #[inline] fn from(value: u128) -> Self { - Self::from(Cents::from(value)) + Self::from(CentsSigned::from(value)) } } @@ -340,13 +340,13 @@ impl From> for u128 { impl From for u128 { #[inline] fn from(value: Dollars) -> Self { - u128::from(Cents::from(value)) + u128::from(CentsSigned::from(value)) } } impl AddAssign for Dollars { fn add_assign(&mut self, rhs: Self) { - *self = Dollars::from(Cents::from(*self) + Cents::from(rhs)); + *self = Dollars::from(CentsSigned::from(*self) + CentsSigned::from(rhs)); } } @@ -355,8 +355,8 @@ impl CheckedSub for Dollars { if self.is_nan() { Some(self) } else { - Cents::from(self) - .checked_sub(Cents::from(rhs)) + CentsSigned::from(self) + .checked_sub(CentsSigned::from(rhs)) .map(Dollars::from) } } @@ -365,7 +365,9 @@ impl CheckedSub for Dollars { impl CheckedSub for Dollars { fn checked_sub(self, rhs: usize) -> Option { Some(Dollars::from( - Cents::from(self).checked_sub(Cents::from(rhs)).unwrap(), + CentsSigned::from(self) + .checked_sub(CentsSigned::from(rhs)) + .unwrap(), )) } } diff --git a/crates/brk_types/src/lib.rs b/crates/brk_types/src/lib.rs index 12619bb96..7184d60ac 100644 --- a/crates/brk_types/src/lib.rs +++ b/crates/brk_types/src/lib.rs @@ -4,7 +4,6 @@ pub use vecdb::{CheckedSub, Exit, PrintableIndex, Version}; mod address; mod addressbytes; -mod age; mod addresschainstats; mod addresshash; mod addressindexoutpoint; @@ -14,6 +13,7 @@ mod addressparam; mod addressstats; mod addresstxidsparam; mod addressvalidation; +mod age; mod anyaddressindex; mod bitcoin; mod blkmetadata; @@ -35,12 +35,11 @@ mod blockstatus; mod blocktimestamp; mod blockweightentry; mod bytes; -mod cents; -mod centscompact; mod cents_signed; -mod cents_signed_compact; mod cents_unsigned; mod cents_unsigned_compact; +mod cents_sats; +mod cents_squared_sats; mod datarange; mod datarangeformat; mod date; @@ -48,10 +47,10 @@ mod dateindex; mod decadeindex; mod deser; mod difficultyadjustment; -mod diskusage; mod difficultyadjustmententry; mod difficultyentry; mod difficultyepoch; +mod diskusage; mod dollars; mod emptyaddressdata; mod emptyaddressindex; @@ -81,22 +80,21 @@ mod mempoolinfo; mod metric; mod metriccount; mod metricdata; +mod metricoutput; mod metricparam; mod metrics; -mod metricoutput; mod metricselection; mod metricselectionlegacy; mod metricspaginated; mod metricwithindex; mod monthindex; mod ohlc; -mod oracle_bins; mod opreturnindex; mod option_ext; +mod oracle_bins; mod outpoint; mod output; mod outputtype; -mod pairoutputindex; mod p2aaddressindex; mod p2abytes; mod p2msoutputindex; @@ -116,16 +114,17 @@ mod p2wshaddressindex; mod p2wshbytes; mod pagination; mod paginationindex; +mod pairoutputindex; mod percentile; mod pool; mod pooldetail; -mod port; mod poolinfo; mod pools; mod poolslug; mod poolslugparam; mod poolssummary; mod poolstats; +mod port; mod quarterindex; mod rawlocktime; mod recommendedfees; @@ -145,9 +144,9 @@ mod stored_u64; mod stored_u8; mod supply_state; mod syncstatus; +mod term; mod timeperiod; mod timeperiodparam; -mod term; mod timestamp; mod timestampparam; mod treenode; @@ -180,7 +179,6 @@ mod yearindex; pub use address::*; pub use addressbytes::*; -pub use age::*; pub use addresschainstats::*; pub use addresshash::*; pub use addressindexoutpoint::*; @@ -190,6 +188,7 @@ pub use addressparam::*; pub use addressstats::*; pub use addresstxidsparam::*; pub use addressvalidation::*; +pub use age::*; pub use anyaddressindex::*; pub use bitcoin::*; pub use blkmetadata::*; @@ -211,12 +210,11 @@ pub use blockstatus::*; pub use blocktimestamp::*; pub use blockweightentry::*; pub use bytes::*; -pub use cents::*; -pub use centscompact::*; pub use cents_signed::*; -pub use cents_signed_compact::*; pub use cents_unsigned::*; pub use cents_unsigned_compact::*; +pub use cents_sats::*; +pub use cents_squared_sats::*; pub use datarange::*; pub use datarangeformat::*; pub use date::*; @@ -224,10 +222,10 @@ pub use dateindex::*; pub use decadeindex::*; pub use deser::*; pub use difficultyadjustment::*; -pub use diskusage::*; pub use difficultyadjustmententry::*; pub use difficultyentry::*; pub use difficultyepoch::*; +pub use diskusage::*; pub use dollars::*; pub use emptyaddressdata::*; pub use emptyaddressindex::*; @@ -257,22 +255,21 @@ pub use mempoolinfo::*; pub use metric::*; pub use metriccount::*; pub use metricdata::*; +pub use metricoutput::*; pub use metricparam::*; pub use metrics::*; -pub use metricoutput::*; pub use metricselection::*; pub use metricselectionlegacy::*; pub use metricspaginated::*; pub use metricwithindex::*; pub use monthindex::*; pub use ohlc::*; -pub use oracle_bins::*; pub use opreturnindex::*; pub use option_ext::*; +pub use oracle_bins::*; pub use outpoint::*; pub use output::*; pub use outputtype::*; -pub use pairoutputindex::*; pub use p2aaddressindex::*; pub use p2abytes::*; pub use p2msoutputindex::*; @@ -292,16 +289,17 @@ pub use p2wshaddressindex::*; pub use p2wshbytes::*; pub use pagination::*; pub use paginationindex::*; +pub use pairoutputindex::*; pub use percentile::*; pub use pool::*; pub use pooldetail::*; pub use poolinfo::*; -pub use port::*; pub use pools::*; pub use poolslug::*; pub use poolslugparam::*; pub use poolssummary::*; pub use poolstats::*; +pub use port::*; pub use quarterindex::*; pub use rawlocktime::*; pub use recommendedfees::*; @@ -312,8 +310,8 @@ pub use semesterindex::*; pub use stored_bool::*; pub use stored_f32::*; pub use stored_f64::*; -pub use stored_i16::*; pub use stored_i8::*; +pub use stored_i16::*; pub use stored_string::*; pub use stored_u8::*; pub use stored_u16::*; diff --git a/crates/brk_types/src/loadedaddressdata.rs b/crates/brk_types/src/loadedaddressdata.rs index 119bb5876..5deceefe4 100644 --- a/crates/brk_types/src/loadedaddressdata.rs +++ b/crates/brk_types/src/loadedaddressdata.rs @@ -1,9 +1,35 @@ use brk_error::{Error, Result}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use vecdb::{Bytes, CheckedSub, Formattable}; +use vecdb::{Bytes, Formattable}; -use crate::{Bitcoin, Dollars, EmptyAddressData, Sats}; +use crate::{CentsSats, CentsSquaredSats, CentsUnsigned, EmptyAddressData, Sats, SupplyState}; + +/// Snapshot of cost basis related state. +/// Uses CentsSats (u64) for single-UTXO values, CentsSquaredSats (u128) for investor cap. +#[derive(Clone, Debug)] +pub struct CostBasisSnapshot { + pub realized_price: CentsUnsigned, + pub supply_state: SupplyState, + /// price × sats (fits u64 for individual UTXOs) + pub price_sats: CentsSats, + /// price² × sats (needs u128) + pub investor_cap: CentsSquaredSats, +} + +impl CostBasisSnapshot { + /// Create from a single UTXO (computes caps from price × value) + #[inline] + pub fn from_utxo(price: CentsUnsigned, supply: &SupplyState) -> Self { + let price_sats = CentsSats::from_price_sats(price, supply.value); + Self { + realized_price: price, + supply_state: supply.clone(), + price_sats, + investor_cap: price_sats.to_investor_cap(price), + } + } +} /// Data for a loaded (non-empty) address with current balance #[derive(Debug, Default, Clone, Serialize, Deserialize, JsonSchema)] @@ -21,8 +47,10 @@ pub struct LoadedAddressData { pub received: Sats, /// Satoshis sent by this address pub sent: Sats, - /// The realized capitalization of this address - pub realized_cap: Dollars, + /// The realized capitalization: Σ(price × sats) + pub realized_cap_raw: CentsSats, + /// The investor capitalization: Σ(price² × sats) + pub investor_cap_raw: CentsSquaredSats, } impl LoadedAddressData { @@ -30,21 +58,22 @@ impl LoadedAddressData { (u64::from(self.received) - u64::from(self.sent)).into() } - /// Max realized price for CentsCompact (i32::MAX / 100) - const MAX_REALIZED_PRICE: f64 = 21_000_000.0; + pub fn realized_price(&self) -> CentsUnsigned { + self.realized_cap_raw.realized_price(self.balance()) + } - pub fn realized_price(&self) -> Dollars { - let p = (self.realized_cap / Bitcoin::from(self.balance())).round_to(4); - if p.is_negative() { - dbg!(( - self.realized_cap, - self.balance(), - Bitcoin::from(self.balance()), - p - )); - panic!(""); + pub fn cost_basis_snapshot(&self) -> CostBasisSnapshot { + let realized_price = self.realized_price(); + CostBasisSnapshot { + realized_price, + supply_state: SupplyState { + utxo_count: self.utxo_count() as u64, + value: self.balance(), + }, + // Use exact value to avoid rounding errors from realized_price × balance + price_sats: CentsSats::new(self.realized_cap_raw.inner()), + investor_cap: self.investor_cap_raw, } - p.min(Dollars::from(Self::MAX_REALIZED_PRICE)) } #[inline] @@ -75,44 +104,35 @@ impl LoadedAddressData { self.funded_txo_count == self.spent_txo_count } - pub fn receive(&mut self, amount: Sats, price: Option) { + pub fn receive(&mut self, amount: Sats, price: Option) { self.receive_outputs(amount, price, 1); } - pub fn receive_outputs(&mut self, amount: Sats, price: Option, output_count: u32) { + pub fn receive_outputs( + &mut self, + amount: Sats, + price: Option, + output_count: u32, + ) { self.received += amount; self.funded_txo_count += output_count; if let Some(price) = price { - let added = price * amount; - self.realized_cap += added; - if added.is_negative() || self.realized_cap.is_negative() { - dbg!((self.realized_cap, price, amount, added)); - panic!(); - } + let ps = CentsSats::from_price_sats(price, amount); + self.realized_cap_raw += ps; + self.investor_cap_raw += ps.to_investor_cap(price); } } - pub fn send(&mut self, amount: Sats, previous_price: Option) -> Result<()> { + pub fn send(&mut self, amount: Sats, previous_price: Option) -> Result<()> { if self.balance() < amount { return Err(Error::Internal("Previous amount smaller than sent amount")); } self.sent += amount; self.spent_txo_count += 1; - if let Some(previous_price) = previous_price { - let subtracted = previous_price * amount; - let realized_cap = self.realized_cap.checked_sub(subtracted).unwrap(); - if self.realized_cap.is_negative() || realized_cap.is_negative() { - dbg!(( - self, - realized_cap, - previous_price, - amount, - previous_price * amount, - subtracted - )); - panic!(); - } - self.realized_cap = realized_cap; + if let Some(price) = previous_price { + let ps = CentsSats::from_price_sats(price, amount); + self.realized_cap_raw -= ps; + self.investor_cap_raw -= ps.to_investor_cap(price); } Ok(()) } @@ -135,7 +155,8 @@ impl From<&EmptyAddressData> for LoadedAddressData { padding: 0, received: value.transfered, sent: value.transfered, - realized_cap: Dollars::ZERO, + realized_cap_raw: CentsSats::ZERO, + investor_cap_raw: CentsSquaredSats::ZERO, } } } @@ -144,13 +165,14 @@ impl std::fmt::Display for LoadedAddressData { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!( f, - "tx_count: {}, funded_txo_count: {}, spent_txo_count: {}, received: {}, sent: {}, realized_cap: {}", + "tx_count: {}, funded_txo_count: {}, spent_txo_count: {}, received: {}, sent: {}, realized_cap_raw: {}, investor_cap_raw: {}", self.tx_count, self.funded_txo_count, self.spent_txo_count, self.received, self.sent, - self.realized_cap, + self.realized_cap_raw, + self.investor_cap_raw, ) } } @@ -173,7 +195,8 @@ impl Bytes for LoadedAddressData { arr[12..16].copy_from_slice(self.padding.to_bytes().as_ref()); arr[16..24].copy_from_slice(self.received.to_bytes().as_ref()); arr[24..32].copy_from_slice(self.sent.to_bytes().as_ref()); - arr[32..40].copy_from_slice(self.realized_cap.to_bytes().as_ref()); + arr[32..48].copy_from_slice(self.realized_cap_raw.to_bytes().as_ref()); + arr[48..64].copy_from_slice(self.investor_cap_raw.to_bytes().as_ref()); arr } @@ -185,7 +208,8 @@ impl Bytes for LoadedAddressData { padding: u32::from_bytes(&bytes[12..16])?, received: Sats::from_bytes(&bytes[16..24])?, sent: Sats::from_bytes(&bytes[24..32])?, - realized_cap: Dollars::from_bytes(&bytes[32..40])?, + realized_cap_raw: CentsSats::from_bytes(&bytes[32..48])?, + investor_cap_raw: CentsSquaredSats::from_bytes(&bytes[48..64])?, }) } } diff --git a/crates/brk_types/src/ohlc.rs b/crates/brk_types/src/ohlc.rs index 844a9091c..3f1b5fe3e 100644 --- a/crates/brk_types/src/ohlc.rs +++ b/crates/brk_types/src/ohlc.rs @@ -15,21 +15,21 @@ use vecdb::{Bytes, Formattable, Pco, TransparentPco}; use crate::StoredF64; -use super::{Cents, Dollars, Sats}; +use super::{CentsUnsigned, Dollars, Sats}; /// OHLC (Open, High, Low, Close) data in cents #[derive(Debug, Default, Clone, JsonSchema)] #[repr(C)] -pub struct OHLCCents { - pub open: Open, - pub high: High, - pub low: Low, - pub close: Close, +pub struct OHLCCentsUnsigned { + pub open: Open, + pub high: High, + pub low: Low, + pub close: Close, } -impl From<(Open, High, Low, Close)> for OHLCCents { +impl From<(Open, High, Low, Close)> for OHLCCentsUnsigned { #[inline] - fn from(value: (Open, High, Low, Close)) -> Self { + fn from(value: (Open, High, Low, Close)) -> Self { Self { open: value.0, high: value.1, @@ -39,9 +39,9 @@ impl From<(Open, High, Low, Close)> for OHLCCents { } } -impl From> for OHLCCents { +impl From> for OHLCCentsUnsigned { #[inline] - fn from(value: Close) -> Self { + fn from(value: Close) -> Self { Self { open: Open::from(value), high: High::from(value), @@ -51,7 +51,7 @@ impl From> for OHLCCents { } } -impl Serialize for OHLCCents { +impl Serialize for OHLCCentsUnsigned { fn serialize(&self, serializer: S) -> Result where S: Serializer, @@ -113,11 +113,11 @@ macro_rules! impl_ohlc_deserialize { }; } -impl_ohlc_deserialize!(OHLCCents, Cents); +impl_ohlc_deserialize!(OHLCCentsUnsigned, CentsUnsigned); impl_ohlc_deserialize!(OHLCDollars, Dollars); impl_ohlc_deserialize!(OHLCSats, Sats); -impl Display for OHLCCents { +impl Display for OHLCCentsUnsigned { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!( f, @@ -127,14 +127,14 @@ impl Display for OHLCCents { } } -impl Formattable for OHLCCents { +impl Formattable for OHLCCentsUnsigned { #[inline(always)] fn may_need_escaping() -> bool { true } } -impl Bytes for OHLCCents { +impl Bytes for OHLCCentsUnsigned { type Array = [u8; size_of::()]; fn to_bytes(&self) -> Self::Array { @@ -148,15 +148,15 @@ impl Bytes for OHLCCents { fn from_bytes(bytes: &[u8]) -> vecdb::Result { Ok(Self { - open: Open::::from_bytes(&bytes[0..8])?, - high: High::::from_bytes(&bytes[8..16])?, - low: Low::::from_bytes(&bytes[16..24])?, - close: Close::::from_bytes(&bytes[24..32])?, + open: Open::::from_bytes(&bytes[0..8])?, + high: High::::from_bytes(&bytes[8..16])?, + low: Low::::from_bytes(&bytes[16..24])?, + close: Close::::from_bytes(&bytes[24..32])?, }) } } -impl Add for OHLCCents { +impl Add for OHLCCentsUnsigned { type Output = Self; fn add(self, rhs: Self) -> Self::Output { Self { @@ -223,16 +223,16 @@ impl From> for OHLCDollars { } } -impl From for OHLCDollars { +impl From for OHLCDollars { #[inline] - fn from(value: OHLCCents) -> Self { + fn from(value: OHLCCentsUnsigned) -> Self { Self::from(&value) } } -impl From<&OHLCCents> for OHLCDollars { +impl From<&OHLCCentsUnsigned> for OHLCDollars { #[inline] - fn from(value: &OHLCCents) -> Self { + fn from(value: &OHLCCentsUnsigned) -> Self { Self { open: value.open.into(), high: value.high.into(), @@ -451,9 +451,9 @@ where } } -impl From> for Open { +impl From> for Open { #[inline] - fn from(value: Open) -> Self { + fn from(value: Open) -> Self { Self(Dollars::from(*value)) } } @@ -582,9 +582,9 @@ where } } -impl From> for High { +impl From> for High { #[inline] - fn from(value: High) -> Self { + fn from(value: High) -> Self { Self(Dollars::from(*value)) } } @@ -713,9 +713,9 @@ where } } -impl From> for Low { +impl From> for Low { #[inline] - fn from(value: Low) -> Self { + fn from(value: Low) -> Self { Self(Dollars::from(*value)) } } @@ -861,9 +861,9 @@ where // #[inline] // fn from(value: Close) -> Self { // Self(B::from(*value)) -impl From> for Close { +impl From> for Close { #[inline] - fn from(value: Close) -> Self { + fn from(value: Close) -> Self { Self(Dollars::from(*value)) } } diff --git a/crates/brk_types/src/sats.rs b/crates/brk_types/src/sats.rs index 424c9658d..258b8cbca 100644 --- a/crates/brk_types/src/sats.rs +++ b/crates/brk_types/src/sats.rs @@ -11,7 +11,7 @@ use vecdb::{CheckedSub, Formattable, Pco, SaturatingAdd}; use crate::StoredF64; -use super::{Bitcoin, Cents, Dollars, Height}; +use super::{Bitcoin, CentsUnsigned, Dollars, Height}; /// Satoshis #[derive( @@ -52,6 +52,7 @@ impl Sats { pub const MAX: Self = Self(u64::MAX); pub const COINBASE: Self = Self(u64::MAX); pub const FIFTY_BTC: Self = Self(50_00_000_000); + pub const ONE_BTC_U64: u64 = 1_00_000_000; pub const ONE_BTC_U128: u128 = 1_00_000_000; pub fn new(sats: u64) -> Self { @@ -66,6 +67,11 @@ impl Sats { *self != Self::ZERO } + #[inline(always)] + pub const fn as_u128(self) -> u128 { + self.0 as u128 + } + pub fn is_max(&self) -> bool { *self == Self::MAX } @@ -210,7 +216,7 @@ impl Sum for Sats { impl Div for Sats { type Output = Self; fn div(self, rhs: Dollars) -> Self::Output { - let raw_cents = u64::from(Cents::from(rhs)); + let raw_cents = u64::from(CentsUnsigned::from(rhs)); if raw_cents != 0 { Self(self.0 * 100 / raw_cents) } else { diff --git a/crates/brk_types/src/treenode.rs b/crates/brk_types/src/treenode.rs index 94f1054c1..b9ce1f535 100644 --- a/crates/brk_types/src/treenode.rs +++ b/crates/brk_types/src/treenode.rs @@ -1,5 +1,6 @@ -use std::collections::{BTreeMap, BTreeSet}; +use std::collections::BTreeSet; +use indexmap::IndexMap; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; @@ -130,7 +131,7 @@ impl Eq for MetricLeafWithSchema {} #[serde(untagged)] pub enum TreeNode { /// Branch node containing subcategories - Branch(BTreeMap), + Branch(IndexMap), /// Leaf node containing metric metadata with schema Leaf(MetricLeafWithSchema), } @@ -146,7 +147,7 @@ impl TreeNode { } } - pub fn as_mut_branch(&mut self) -> &mut BTreeMap { + pub fn as_mut_branch(&mut self) -> &mut IndexMap { match self { Self::Branch(b) => b, _ => panic!(), @@ -156,7 +157,7 @@ impl TreeNode { /// Wraps a node in a Branch with the given key. /// Used by #[traversable(wrap = "...")] to produce Branch { key: inner }. pub fn wrap(key: &str, inner: Self) -> Self { - let mut map = BTreeMap::new(); + let mut map = IndexMap::new(); map.insert(key.to_string(), inner); Self::Branch(map) } @@ -171,7 +172,7 @@ impl TreeNode { return Some(self); }; - let mut merged: BTreeMap = BTreeMap::new(); + let mut merged: IndexMap = IndexMap::new(); for (key, node) in tree { match node { @@ -194,7 +195,7 @@ impl TreeNode { /// If all entries in the map are leaves with the same metric name, /// collapse them into a single leaf with merged indexes. - fn try_collapse_same_name_leaves(map: BTreeMap) -> Self { + fn try_collapse_same_name_leaves(map: IndexMap) -> Self { if map.is_empty() { return Self::Branch(map); } @@ -238,7 +239,7 @@ impl TreeNode { /// Merges a node into the target map at the given key (consuming version). /// Returns None if there's a conflict. pub fn merge_node( - target: &mut BTreeMap, + target: &mut IndexMap, key: String, node: TreeNode, ) -> Option<()> { @@ -261,7 +262,7 @@ impl TreeNode { } (existing @ Self::Leaf(_), Self::Branch(branch)) => { let Self::Leaf(leaf) = - std::mem::replace(existing, Self::Branch(BTreeMap::new())) + std::mem::replace(existing, Self::Branch(IndexMap::new())) else { unreachable!() }; diff --git a/docs/README.md b/docs/README.md index 0576e205e..5df84fbc8 100644 --- a/docs/README.md +++ b/docs/README.md @@ -3,6 +3,7 @@ [![MIT Licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/bitcoinresearchkit/brk/blob/main/docs/LICENSE.md) [![Crates.io](https://img.shields.io/crates/v/brk.svg)](https://crates.io/crates/brk) [![docs.rs](https://img.shields.io/docsrs/brk)](https://docs.rs/brk) +[![Supported by OpenSats](https://img.shields.io/badge/supported%20by-opensats-ff7b00)](https://opensats.org/) Open-source on-chain analytics for Bitcoin. Combines functionality of [Glassnode](https://glassnode.com) (on-chain metrics), [mempool.space](https://mempool.space) (block explorer), and [electrs](https://github.com/romanz/electrs) (address index) into a single self-hostable package. [Bitview](https://bitview.space) is an analytics interface built entirely on BRK. @@ -26,7 +27,7 @@ Browse metrics and charts visually. Use it free at [Bitview](https://bitview.spa Query thousands of metrics and blockchain data in JSON or CSV. Freely accessible at [Bitview](https://bitview.space/api). -[Documentation](https://bitview.space/api) · [JavaScript](https://www.npmjs.com/package/brk-client) · [Python](https://pypi.org/project/brk-client) · [Rust](https://crates.io/crates/brk_client) +[Documentation](https://bitview.space/api) · [JavaScript](https://www.npmjs.com/package/brk-client) · [Python](https://pypi.org/project/brk-client) · [Rust](https://crates.io/crates/brk_client) · [LLM](https://bitview.space/api.json) ### Self-host @@ -45,8 +46,8 @@ Build custom applications in Rust. Use the full stack or individual components ( - [Changelog](./CHANGELOG.md) - [Support](./SUPPORT.md) - [Contributing](https://github.com/bitcoinresearchkit/brk/issues) - -[Discord](https://discord.gg/WACpShCB7M) · [Nostr](https://primal.net/p/nprofile1qqsfw5dacngjlahye34krvgz7u0yghhjgk7gxzl5ptm9v6n2y3sn03sqxu2e6) +- [Discord](https://discord.gg/WACpShCB7M) +- [Nostr](https://primal.net/p/nprofile1qqsfw5dacngjlahye34krvgz7u0yghhjgk7gxzl5ptm9v6n2y3sn03sqxu2e6) Development supported by [OpenSats](https://opensats.org/). diff --git a/modules/brk-client/index.js b/modules/brk-client/index.js index 507e46f4b..59b18c833 100644 --- a/modules/brk-client/index.js +++ b/modules/brk-client/index.js @@ -167,11 +167,29 @@ * @property {number} timestamp * @property {number} avgWeight */ -/** @typedef {number} Cents */ +/** + * Cents × Sats (u128) - price in cents multiplied by amount in sats. + * Uses u128 because large amounts at any price can overflow u64. + * + * @typedef {number} CentsSats + */ +/** + * Raw cents squared (u128) - stores cents² × sats without division. + * Used for precise accumulation of investor cap values: Σ(price² × sats). + * investor_price = investor_cap_raw / realized_cap_raw + * + * @typedef {number} CentsSquaredSats + */ +/** + * Unsigned cents (u64) - for values that should never be negative. + * Used for invested capital, realized cap, etc. + * + * @typedef {number} CentsUnsigned + */ /** * Closing price value for a time period * - * @typedef {Cents} Close + * @typedef {CentsUnsigned} Close */ /** * Data range with output format for API query parameters @@ -302,7 +320,7 @@ /** * Highest price value for a time period * - * @typedef {Cents} High + * @typedef {CentsUnsigned} High */ /** * Aggregation dimension for querying metrics. Includes time-based (date, week, month, year), @@ -335,13 +353,14 @@ * @property {number} spentTxoCount - Number of transaction outputs spent by this address * @property {Sats} received - Satoshis received by this address * @property {Sats} sent - Satoshis sent by this address - * @property {Dollars} realizedCap - The realized capitalization of this address + * @property {CentsSats} realizedCapRaw - The realized capitalization: Σ(price × sats) + * @property {CentsSquaredSats} investorCapRaw - The investor capitalization: Σ(price² × sats) */ /** @typedef {TypeIndex} LoadedAddressIndex */ /** * Lowest price value for a time period * - * @typedef {Cents} Low + * @typedef {CentsUnsigned} Low */ /** * Block info in a mempool.space like format for fee estimation. @@ -425,7 +444,7 @@ /** * OHLC (Open, High, Low, Close) data in cents * - * @typedef {Object} OHLCCents + * @typedef {Object} OHLCCentsUnsigned * @property {Open} open * @property {High} high * @property {Low} low @@ -453,7 +472,7 @@ /** * Opening price value for a time period * - * @typedef {Cents} Open + * @typedef {CentsUnsigned} Open */ /** @typedef {number} OutPoint */ /** @@ -1350,28 +1369,41 @@ function createMetricPattern32(client, name) { return _mp(client, name, _i32); } // Reusable structural pattern factories /** - * @typedef {Object} RealizedPattern3 + * @typedef {Object} AdjustedAthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern * @property {MetricPattern6} adjustedSopr * @property {MetricPattern6} adjustedSopr30dEma * @property {MetricPattern6} adjustedSopr7dEma * @property {MetricPattern1} adjustedValueCreated * @property {MetricPattern1} adjustedValueDestroyed + * @property {CumulativeSumPattern} athRegret + * @property {MetricPattern11} capRaw + * @property {MetricPattern1} capitulationFlow + * @property {MetricPattern11} investorCapRaw + * @property {DollarsSatsPattern} investorPrice + * @property {MetricPattern1} investorPriceCents + * @property {RatioPattern} investorPriceExtra + * @property {MetricPattern1} lossValueCreated + * @property {MetricPattern1} lossValueDestroyed * @property {MetricPattern4} mvrv - * @property {BitcoinPattern2} negRealizedLoss - * @property {BlockCountPattern} netRealizedPnl + * @property {CumulativeSumPattern2} negRealizedLoss + * @property {CumulativeSumPattern} netRealizedPnl * @property {MetricPattern4} netRealizedPnlCumulative30dDelta * @property {MetricPattern4} netRealizedPnlCumulative30dDeltaRelToMarketCap * @property {MetricPattern4} netRealizedPnlCumulative30dDeltaRelToRealizedCap - * @property {BlockCountPattern} netRealizedPnlRelToRealizedCap + * @property {CumulativeSumPattern} netRealizedPnlRelToRealizedCap + * @property {MetricPattern1} profitFlow + * @property {MetricPattern1} profitValueCreated + * @property {MetricPattern1} profitValueDestroyed * @property {MetricPattern1} realizedCap * @property {MetricPattern4} realizedCap30dDelta + * @property {MetricPattern1} realizedCapCents * @property {MetricPattern1} realizedCapRelToOwnMarketCap - * @property {BlockCountPattern} realizedLoss - * @property {BlockCountPattern} realizedLossRelToRealizedCap - * @property {ActivePricePattern} realizedPrice - * @property {ActivePriceRatioPattern} realizedPriceExtra - * @property {BlockCountPattern} realizedProfit - * @property {BlockCountPattern} realizedProfitRelToRealizedCap + * @property {CumulativeSumPattern} realizedLoss + * @property {CumulativeSumPattern} realizedLossRelToRealizedCap + * @property {DollarsSatsPattern} realizedPrice + * @property {RatioPattern} realizedPriceExtra + * @property {CumulativeSumPattern} realizedProfit + * @property {CumulativeSumPattern} realizedProfitRelToRealizedCap * @property {MetricPattern6} realizedProfitToLossRatio * @property {MetricPattern1} realizedValue * @property {MetricPattern6} sellSideRiskRatio @@ -1386,34 +1418,47 @@ function createMetricPattern32(client, name) { return _mp(client, name, _i32); } */ /** - * Create a RealizedPattern3 pattern node + * Create a AdjustedAthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {RealizedPattern3} + * @returns {AdjustedAthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern} */ -function createRealizedPattern3(client, acc) { +function createAdjustedAthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern(client, acc) { return { adjustedSopr: createMetricPattern6(client, _m(acc, 'adjusted_sopr')), adjustedSopr30dEma: createMetricPattern6(client, _m(acc, 'adjusted_sopr_30d_ema')), adjustedSopr7dEma: createMetricPattern6(client, _m(acc, 'adjusted_sopr_7d_ema')), adjustedValueCreated: createMetricPattern1(client, _m(acc, 'adjusted_value_created')), adjustedValueDestroyed: createMetricPattern1(client, _m(acc, 'adjusted_value_destroyed')), + athRegret: createCumulativeSumPattern(client, _m(acc, 'realized_ath_regret')), + capRaw: createMetricPattern11(client, _m(acc, 'cap_raw')), + capitulationFlow: createMetricPattern1(client, _m(acc, 'capitulation_flow')), + investorCapRaw: createMetricPattern11(client, _m(acc, 'investor_cap_raw')), + investorPrice: createDollarsSatsPattern(client, _m(acc, 'investor_price')), + investorPriceCents: createMetricPattern1(client, _m(acc, 'investor_price_cents')), + investorPriceExtra: createRatioPattern(client, _m(acc, 'investor_price_ratio')), + lossValueCreated: createMetricPattern1(client, _m(acc, 'loss_value_created')), + lossValueDestroyed: createMetricPattern1(client, _m(acc, 'loss_value_destroyed')), mvrv: createMetricPattern4(client, _m(acc, 'mvrv')), - negRealizedLoss: createBitcoinPattern2(client, _m(acc, 'neg_realized_loss')), - netRealizedPnl: createBlockCountPattern(client, _m(acc, 'net_realized_pnl')), + negRealizedLoss: createCumulativeSumPattern2(client, _m(acc, 'neg_realized_loss')), + netRealizedPnl: createCumulativeSumPattern(client, _m(acc, 'net_realized_pnl')), netRealizedPnlCumulative30dDelta: createMetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta')), netRealizedPnlCumulative30dDeltaRelToMarketCap: createMetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_market_cap')), netRealizedPnlCumulative30dDeltaRelToRealizedCap: createMetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap')), - netRealizedPnlRelToRealizedCap: createBlockCountPattern(client, _m(acc, 'net_realized_pnl_rel_to_realized_cap')), + netRealizedPnlRelToRealizedCap: createCumulativeSumPattern(client, _m(acc, 'net_realized_pnl_rel_to_realized_cap')), + profitFlow: createMetricPattern1(client, _m(acc, 'profit_flow')), + profitValueCreated: createMetricPattern1(client, _m(acc, 'profit_value_created')), + profitValueDestroyed: createMetricPattern1(client, _m(acc, 'profit_value_destroyed')), realizedCap: createMetricPattern1(client, _m(acc, 'realized_cap')), realizedCap30dDelta: createMetricPattern4(client, _m(acc, 'realized_cap_30d_delta')), + realizedCapCents: createMetricPattern1(client, _m(acc, 'realized_cap_cents')), realizedCapRelToOwnMarketCap: createMetricPattern1(client, _m(acc, 'realized_cap_rel_to_own_market_cap')), - realizedLoss: createBlockCountPattern(client, _m(acc, 'realized_loss')), - realizedLossRelToRealizedCap: createBlockCountPattern(client, _m(acc, 'realized_loss_rel_to_realized_cap')), - realizedPrice: createActivePricePattern(client, _m(acc, 'realized_price')), - realizedPriceExtra: createActivePriceRatioPattern(client, _m(acc, 'realized_price_ratio')), - realizedProfit: createBlockCountPattern(client, _m(acc, 'realized_profit')), - realizedProfitRelToRealizedCap: createBlockCountPattern(client, _m(acc, 'realized_profit_rel_to_realized_cap')), + realizedLoss: createCumulativeSumPattern(client, _m(acc, 'realized_loss')), + realizedLossRelToRealizedCap: createCumulativeSumPattern(client, _m(acc, 'realized_loss_rel_to_realized_cap')), + realizedPrice: createDollarsSatsPattern(client, _m(acc, 'realized_price')), + realizedPriceExtra: createRatioPattern(client, _m(acc, 'realized_price_ratio')), + realizedProfit: createCumulativeSumPattern(client, _m(acc, 'realized_profit')), + realizedProfitRelToRealizedCap: createCumulativeSumPattern(client, _m(acc, 'realized_profit_rel_to_realized_cap')), realizedProfitToLossRatio: createMetricPattern6(client, _m(acc, 'realized_profit_to_loss_ratio')), realizedValue: createMetricPattern1(client, _m(acc, 'realized_value')), sellSideRiskRatio: createMetricPattern6(client, _m(acc, 'sell_side_risk_ratio')), @@ -1429,27 +1474,40 @@ function createRealizedPattern3(client, acc) { } /** - * @typedef {Object} RealizedPattern4 + * @typedef {Object} AdjustedAthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern2 * @property {MetricPattern6} adjustedSopr * @property {MetricPattern6} adjustedSopr30dEma * @property {MetricPattern6} adjustedSopr7dEma * @property {MetricPattern1} adjustedValueCreated * @property {MetricPattern1} adjustedValueDestroyed + * @property {CumulativeSumPattern} athRegret + * @property {MetricPattern11} capRaw + * @property {MetricPattern1} capitulationFlow + * @property {MetricPattern11} investorCapRaw + * @property {DollarsSatsPattern} investorPrice + * @property {MetricPattern1} investorPriceCents + * @property {RatioPattern2} investorPriceExtra + * @property {MetricPattern1} lossValueCreated + * @property {MetricPattern1} lossValueDestroyed * @property {MetricPattern4} mvrv - * @property {BitcoinPattern2} negRealizedLoss - * @property {BlockCountPattern} netRealizedPnl + * @property {CumulativeSumPattern2} negRealizedLoss + * @property {CumulativeSumPattern} netRealizedPnl * @property {MetricPattern4} netRealizedPnlCumulative30dDelta * @property {MetricPattern4} netRealizedPnlCumulative30dDeltaRelToMarketCap * @property {MetricPattern4} netRealizedPnlCumulative30dDeltaRelToRealizedCap - * @property {BlockCountPattern} netRealizedPnlRelToRealizedCap + * @property {CumulativeSumPattern} netRealizedPnlRelToRealizedCap + * @property {MetricPattern1} profitFlow + * @property {MetricPattern1} profitValueCreated + * @property {MetricPattern1} profitValueDestroyed * @property {MetricPattern1} realizedCap * @property {MetricPattern4} realizedCap30dDelta - * @property {BlockCountPattern} realizedLoss - * @property {BlockCountPattern} realizedLossRelToRealizedCap - * @property {ActivePricePattern} realizedPrice - * @property {RealizedPriceExtraPattern} realizedPriceExtra - * @property {BlockCountPattern} realizedProfit - * @property {BlockCountPattern} realizedProfitRelToRealizedCap + * @property {MetricPattern1} realizedCapCents + * @property {CumulativeSumPattern} realizedLoss + * @property {CumulativeSumPattern} realizedLossRelToRealizedCap + * @property {DollarsSatsPattern} realizedPrice + * @property {RatioPattern2} realizedPriceExtra + * @property {CumulativeSumPattern} realizedProfit + * @property {CumulativeSumPattern} realizedProfitRelToRealizedCap * @property {MetricPattern1} realizedValue * @property {MetricPattern6} sellSideRiskRatio * @property {MetricPattern6} sellSideRiskRatio30dEma @@ -1463,33 +1521,46 @@ function createRealizedPattern3(client, acc) { */ /** - * Create a RealizedPattern4 pattern node + * Create a AdjustedAthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern2 pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {RealizedPattern4} + * @returns {AdjustedAthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern2} */ -function createRealizedPattern4(client, acc) { +function createAdjustedAthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern2(client, acc) { return { adjustedSopr: createMetricPattern6(client, _m(acc, 'adjusted_sopr')), adjustedSopr30dEma: createMetricPattern6(client, _m(acc, 'adjusted_sopr_30d_ema')), adjustedSopr7dEma: createMetricPattern6(client, _m(acc, 'adjusted_sopr_7d_ema')), adjustedValueCreated: createMetricPattern1(client, _m(acc, 'adjusted_value_created')), adjustedValueDestroyed: createMetricPattern1(client, _m(acc, 'adjusted_value_destroyed')), + athRegret: createCumulativeSumPattern(client, _m(acc, 'realized_ath_regret')), + capRaw: createMetricPattern11(client, _m(acc, 'cap_raw')), + capitulationFlow: createMetricPattern1(client, _m(acc, 'capitulation_flow')), + investorCapRaw: createMetricPattern11(client, _m(acc, 'investor_cap_raw')), + investorPrice: createDollarsSatsPattern(client, _m(acc, 'investor_price')), + investorPriceCents: createMetricPattern1(client, _m(acc, 'investor_price_cents')), + investorPriceExtra: createRatioPattern2(client, _m(acc, 'investor_price_ratio')), + lossValueCreated: createMetricPattern1(client, _m(acc, 'loss_value_created')), + lossValueDestroyed: createMetricPattern1(client, _m(acc, 'loss_value_destroyed')), mvrv: createMetricPattern4(client, _m(acc, 'mvrv')), - negRealizedLoss: createBitcoinPattern2(client, _m(acc, 'neg_realized_loss')), - netRealizedPnl: createBlockCountPattern(client, _m(acc, 'net_realized_pnl')), + negRealizedLoss: createCumulativeSumPattern2(client, _m(acc, 'neg_realized_loss')), + netRealizedPnl: createCumulativeSumPattern(client, _m(acc, 'net_realized_pnl')), netRealizedPnlCumulative30dDelta: createMetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta')), netRealizedPnlCumulative30dDeltaRelToMarketCap: createMetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_market_cap')), netRealizedPnlCumulative30dDeltaRelToRealizedCap: createMetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap')), - netRealizedPnlRelToRealizedCap: createBlockCountPattern(client, _m(acc, 'net_realized_pnl_rel_to_realized_cap')), + netRealizedPnlRelToRealizedCap: createCumulativeSumPattern(client, _m(acc, 'net_realized_pnl_rel_to_realized_cap')), + profitFlow: createMetricPattern1(client, _m(acc, 'profit_flow')), + profitValueCreated: createMetricPattern1(client, _m(acc, 'profit_value_created')), + profitValueDestroyed: createMetricPattern1(client, _m(acc, 'profit_value_destroyed')), realizedCap: createMetricPattern1(client, _m(acc, 'realized_cap')), realizedCap30dDelta: createMetricPattern4(client, _m(acc, 'realized_cap_30d_delta')), - realizedLoss: createBlockCountPattern(client, _m(acc, 'realized_loss')), - realizedLossRelToRealizedCap: createBlockCountPattern(client, _m(acc, 'realized_loss_rel_to_realized_cap')), - realizedPrice: createActivePricePattern(client, _m(acc, 'realized_price')), - realizedPriceExtra: createRealizedPriceExtraPattern(client, _m(acc, 'realized_price_ratio')), - realizedProfit: createBlockCountPattern(client, _m(acc, 'realized_profit')), - realizedProfitRelToRealizedCap: createBlockCountPattern(client, _m(acc, 'realized_profit_rel_to_realized_cap')), + realizedCapCents: createMetricPattern1(client, _m(acc, 'realized_cap_cents')), + realizedLoss: createCumulativeSumPattern(client, _m(acc, 'realized_loss')), + realizedLossRelToRealizedCap: createCumulativeSumPattern(client, _m(acc, 'realized_loss_rel_to_realized_cap')), + realizedPrice: createDollarsSatsPattern(client, _m(acc, 'realized_price')), + realizedPriceExtra: createRatioPattern2(client, _m(acc, 'realized_price_ratio')), + realizedProfit: createCumulativeSumPattern(client, _m(acc, 'realized_profit')), + realizedProfitRelToRealizedCap: createCumulativeSumPattern(client, _m(acc, 'realized_profit_rel_to_realized_cap')), realizedValue: createMetricPattern1(client, _m(acc, 'realized_value')), sellSideRiskRatio: createMetricPattern6(client, _m(acc, 'sell_side_risk_ratio')), sellSideRiskRatio30dEma: createMetricPattern6(client, _m(acc, 'sell_side_risk_ratio_30d_ema')), @@ -1504,70 +1575,256 @@ function createRealizedPattern4(client, acc) { } /** - * @typedef {Object} Ratio1ySdPattern - * @property {_0sdUsdPattern} _0sdUsd + * @typedef {Object} AthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern2 + * @property {CumulativeSumPattern} athRegret + * @property {MetricPattern11} capRaw + * @property {MetricPattern1} capitulationFlow + * @property {MetricPattern11} investorCapRaw + * @property {DollarsSatsPattern} investorPrice + * @property {MetricPattern1} investorPriceCents + * @property {RatioPattern} investorPriceExtra + * @property {MetricPattern1} lossValueCreated + * @property {MetricPattern1} lossValueDestroyed + * @property {MetricPattern4} mvrv + * @property {CumulativeSumPattern2} negRealizedLoss + * @property {CumulativeSumPattern} netRealizedPnl + * @property {MetricPattern4} netRealizedPnlCumulative30dDelta + * @property {MetricPattern4} netRealizedPnlCumulative30dDeltaRelToMarketCap + * @property {MetricPattern4} netRealizedPnlCumulative30dDeltaRelToRealizedCap + * @property {CumulativeSumPattern} netRealizedPnlRelToRealizedCap + * @property {MetricPattern1} profitFlow + * @property {MetricPattern1} profitValueCreated + * @property {MetricPattern1} profitValueDestroyed + * @property {MetricPattern1} realizedCap + * @property {MetricPattern4} realizedCap30dDelta + * @property {MetricPattern1} realizedCapCents + * @property {MetricPattern1} realizedCapRelToOwnMarketCap + * @property {CumulativeSumPattern} realizedLoss + * @property {CumulativeSumPattern} realizedLossRelToRealizedCap + * @property {DollarsSatsPattern} realizedPrice + * @property {RatioPattern} realizedPriceExtra + * @property {CumulativeSumPattern} realizedProfit + * @property {CumulativeSumPattern} realizedProfitRelToRealizedCap + * @property {MetricPattern6} realizedProfitToLossRatio + * @property {MetricPattern1} realizedValue + * @property {MetricPattern6} sellSideRiskRatio + * @property {MetricPattern6} sellSideRiskRatio30dEma + * @property {MetricPattern6} sellSideRiskRatio7dEma + * @property {MetricPattern6} sopr + * @property {MetricPattern6} sopr30dEma + * @property {MetricPattern6} sopr7dEma + * @property {MetricPattern1} totalRealizedPnl + * @property {MetricPattern1} valueCreated + * @property {MetricPattern1} valueDestroyed + */ + +/** + * Create a AthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern2 pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {AthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern2} + */ +function createAthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern2(client, acc) { + return { + athRegret: createCumulativeSumPattern(client, _m(acc, 'realized_ath_regret')), + capRaw: createMetricPattern11(client, _m(acc, 'cap_raw')), + capitulationFlow: createMetricPattern1(client, _m(acc, 'capitulation_flow')), + investorCapRaw: createMetricPattern11(client, _m(acc, 'investor_cap_raw')), + investorPrice: createDollarsSatsPattern(client, _m(acc, 'investor_price')), + investorPriceCents: createMetricPattern1(client, _m(acc, 'investor_price_cents')), + investorPriceExtra: createRatioPattern(client, _m(acc, 'investor_price_ratio')), + lossValueCreated: createMetricPattern1(client, _m(acc, 'loss_value_created')), + lossValueDestroyed: createMetricPattern1(client, _m(acc, 'loss_value_destroyed')), + mvrv: createMetricPattern4(client, _m(acc, 'mvrv')), + negRealizedLoss: createCumulativeSumPattern2(client, _m(acc, 'neg_realized_loss')), + netRealizedPnl: createCumulativeSumPattern(client, _m(acc, 'net_realized_pnl')), + netRealizedPnlCumulative30dDelta: createMetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta')), + netRealizedPnlCumulative30dDeltaRelToMarketCap: createMetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_market_cap')), + netRealizedPnlCumulative30dDeltaRelToRealizedCap: createMetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap')), + netRealizedPnlRelToRealizedCap: createCumulativeSumPattern(client, _m(acc, 'net_realized_pnl_rel_to_realized_cap')), + profitFlow: createMetricPattern1(client, _m(acc, 'profit_flow')), + profitValueCreated: createMetricPattern1(client, _m(acc, 'profit_value_created')), + profitValueDestroyed: createMetricPattern1(client, _m(acc, 'profit_value_destroyed')), + realizedCap: createMetricPattern1(client, _m(acc, 'realized_cap')), + realizedCap30dDelta: createMetricPattern4(client, _m(acc, 'realized_cap_30d_delta')), + realizedCapCents: createMetricPattern1(client, _m(acc, 'realized_cap_cents')), + realizedCapRelToOwnMarketCap: createMetricPattern1(client, _m(acc, 'realized_cap_rel_to_own_market_cap')), + realizedLoss: createCumulativeSumPattern(client, _m(acc, 'realized_loss')), + realizedLossRelToRealizedCap: createCumulativeSumPattern(client, _m(acc, 'realized_loss_rel_to_realized_cap')), + realizedPrice: createDollarsSatsPattern(client, _m(acc, 'realized_price')), + realizedPriceExtra: createRatioPattern(client, _m(acc, 'realized_price_ratio')), + realizedProfit: createCumulativeSumPattern(client, _m(acc, 'realized_profit')), + realizedProfitRelToRealizedCap: createCumulativeSumPattern(client, _m(acc, 'realized_profit_rel_to_realized_cap')), + realizedProfitToLossRatio: createMetricPattern6(client, _m(acc, 'realized_profit_to_loss_ratio')), + realizedValue: createMetricPattern1(client, _m(acc, 'realized_value')), + sellSideRiskRatio: createMetricPattern6(client, _m(acc, 'sell_side_risk_ratio')), + sellSideRiskRatio30dEma: createMetricPattern6(client, _m(acc, 'sell_side_risk_ratio_30d_ema')), + sellSideRiskRatio7dEma: createMetricPattern6(client, _m(acc, 'sell_side_risk_ratio_7d_ema')), + sopr: createMetricPattern6(client, _m(acc, 'sopr')), + sopr30dEma: createMetricPattern6(client, _m(acc, 'sopr_30d_ema')), + sopr7dEma: createMetricPattern6(client, _m(acc, 'sopr_7d_ema')), + totalRealizedPnl: createMetricPattern1(client, _m(acc, 'total_realized_pnl')), + valueCreated: createMetricPattern1(client, _m(acc, 'value_created')), + valueDestroyed: createMetricPattern1(client, _m(acc, 'value_destroyed')), + }; +} + +/** + * @typedef {Object} AthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern + * @property {CumulativeSumPattern} athRegret + * @property {MetricPattern11} capRaw + * @property {MetricPattern1} capitulationFlow + * @property {MetricPattern11} investorCapRaw + * @property {DollarsSatsPattern} investorPrice + * @property {MetricPattern1} investorPriceCents + * @property {RatioPattern2} investorPriceExtra + * @property {MetricPattern1} lossValueCreated + * @property {MetricPattern1} lossValueDestroyed + * @property {MetricPattern4} mvrv + * @property {CumulativeSumPattern2} negRealizedLoss + * @property {CumulativeSumPattern} netRealizedPnl + * @property {MetricPattern4} netRealizedPnlCumulative30dDelta + * @property {MetricPattern4} netRealizedPnlCumulative30dDeltaRelToMarketCap + * @property {MetricPattern4} netRealizedPnlCumulative30dDeltaRelToRealizedCap + * @property {CumulativeSumPattern} netRealizedPnlRelToRealizedCap + * @property {MetricPattern1} profitFlow + * @property {MetricPattern1} profitValueCreated + * @property {MetricPattern1} profitValueDestroyed + * @property {MetricPattern1} realizedCap + * @property {MetricPattern4} realizedCap30dDelta + * @property {MetricPattern1} realizedCapCents + * @property {CumulativeSumPattern} realizedLoss + * @property {CumulativeSumPattern} realizedLossRelToRealizedCap + * @property {DollarsSatsPattern} realizedPrice + * @property {RatioPattern2} realizedPriceExtra + * @property {CumulativeSumPattern} realizedProfit + * @property {CumulativeSumPattern} realizedProfitRelToRealizedCap + * @property {MetricPattern1} realizedValue + * @property {MetricPattern6} sellSideRiskRatio + * @property {MetricPattern6} sellSideRiskRatio30dEma + * @property {MetricPattern6} sellSideRiskRatio7dEma + * @property {MetricPattern6} sopr + * @property {MetricPattern6} sopr30dEma + * @property {MetricPattern6} sopr7dEma + * @property {MetricPattern1} totalRealizedPnl + * @property {MetricPattern1} valueCreated + * @property {MetricPattern1} valueDestroyed + */ + +/** + * Create a AthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {AthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern} + */ +function createAthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern(client, acc) { + return { + athRegret: createCumulativeSumPattern(client, _m(acc, 'realized_ath_regret')), + capRaw: createMetricPattern11(client, _m(acc, 'cap_raw')), + capitulationFlow: createMetricPattern1(client, _m(acc, 'capitulation_flow')), + investorCapRaw: createMetricPattern11(client, _m(acc, 'investor_cap_raw')), + investorPrice: createDollarsSatsPattern(client, _m(acc, 'investor_price')), + investorPriceCents: createMetricPattern1(client, _m(acc, 'investor_price_cents')), + investorPriceExtra: createRatioPattern2(client, _m(acc, 'investor_price_ratio')), + lossValueCreated: createMetricPattern1(client, _m(acc, 'loss_value_created')), + lossValueDestroyed: createMetricPattern1(client, _m(acc, 'loss_value_destroyed')), + mvrv: createMetricPattern4(client, _m(acc, 'mvrv')), + negRealizedLoss: createCumulativeSumPattern2(client, _m(acc, 'neg_realized_loss')), + netRealizedPnl: createCumulativeSumPattern(client, _m(acc, 'net_realized_pnl')), + netRealizedPnlCumulative30dDelta: createMetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta')), + netRealizedPnlCumulative30dDeltaRelToMarketCap: createMetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_market_cap')), + netRealizedPnlCumulative30dDeltaRelToRealizedCap: createMetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap')), + netRealizedPnlRelToRealizedCap: createCumulativeSumPattern(client, _m(acc, 'net_realized_pnl_rel_to_realized_cap')), + profitFlow: createMetricPattern1(client, _m(acc, 'profit_flow')), + profitValueCreated: createMetricPattern1(client, _m(acc, 'profit_value_created')), + profitValueDestroyed: createMetricPattern1(client, _m(acc, 'profit_value_destroyed')), + realizedCap: createMetricPattern1(client, _m(acc, 'realized_cap')), + realizedCap30dDelta: createMetricPattern4(client, _m(acc, 'realized_cap_30d_delta')), + realizedCapCents: createMetricPattern1(client, _m(acc, 'realized_cap_cents')), + realizedLoss: createCumulativeSumPattern(client, _m(acc, 'realized_loss')), + realizedLossRelToRealizedCap: createCumulativeSumPattern(client, _m(acc, 'realized_loss_rel_to_realized_cap')), + realizedPrice: createDollarsSatsPattern(client, _m(acc, 'realized_price')), + realizedPriceExtra: createRatioPattern2(client, _m(acc, 'realized_price_ratio')), + realizedProfit: createCumulativeSumPattern(client, _m(acc, 'realized_profit')), + realizedProfitRelToRealizedCap: createCumulativeSumPattern(client, _m(acc, 'realized_profit_rel_to_realized_cap')), + realizedValue: createMetricPattern1(client, _m(acc, 'realized_value')), + sellSideRiskRatio: createMetricPattern6(client, _m(acc, 'sell_side_risk_ratio')), + sellSideRiskRatio30dEma: createMetricPattern6(client, _m(acc, 'sell_side_risk_ratio_30d_ema')), + sellSideRiskRatio7dEma: createMetricPattern6(client, _m(acc, 'sell_side_risk_ratio_7d_ema')), + sopr: createMetricPattern6(client, _m(acc, 'sopr')), + sopr30dEma: createMetricPattern6(client, _m(acc, 'sopr_30d_ema')), + sopr7dEma: createMetricPattern6(client, _m(acc, 'sopr_7d_ema')), + totalRealizedPnl: createMetricPattern1(client, _m(acc, 'total_realized_pnl')), + valueCreated: createMetricPattern1(client, _m(acc, 'value_created')), + valueDestroyed: createMetricPattern1(client, _m(acc, 'value_destroyed')), + }; +} + +/** + * @typedef {Object} _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern + * @property {DollarsSatsPattern2} _0sdUsd * @property {MetricPattern4} m05sd - * @property {_0sdUsdPattern} m05sdUsd + * @property {DollarsSatsPattern2} m05sdUsd * @property {MetricPattern4} m15sd - * @property {_0sdUsdPattern} m15sdUsd + * @property {DollarsSatsPattern2} m15sdUsd * @property {MetricPattern4} m1sd - * @property {_0sdUsdPattern} m1sdUsd + * @property {DollarsSatsPattern2} m1sdUsd * @property {MetricPattern4} m25sd - * @property {_0sdUsdPattern} m25sdUsd + * @property {DollarsSatsPattern2} m25sdUsd * @property {MetricPattern4} m2sd - * @property {_0sdUsdPattern} m2sdUsd + * @property {DollarsSatsPattern2} m2sdUsd * @property {MetricPattern4} m3sd - * @property {_0sdUsdPattern} m3sdUsd + * @property {DollarsSatsPattern2} m3sdUsd * @property {MetricPattern4} p05sd - * @property {_0sdUsdPattern} p05sdUsd + * @property {DollarsSatsPattern2} p05sdUsd * @property {MetricPattern4} p15sd - * @property {_0sdUsdPattern} p15sdUsd + * @property {DollarsSatsPattern2} p15sdUsd * @property {MetricPattern4} p1sd - * @property {_0sdUsdPattern} p1sdUsd + * @property {DollarsSatsPattern2} p1sdUsd * @property {MetricPattern4} p25sd - * @property {_0sdUsdPattern} p25sdUsd + * @property {DollarsSatsPattern2} p25sdUsd * @property {MetricPattern4} p2sd - * @property {_0sdUsdPattern} p2sdUsd + * @property {DollarsSatsPattern2} p2sdUsd * @property {MetricPattern4} p3sd - * @property {_0sdUsdPattern} p3sdUsd + * @property {DollarsSatsPattern2} p3sdUsd * @property {MetricPattern4} sd * @property {MetricPattern4} sma * @property {MetricPattern4} zscore */ /** - * Create a Ratio1ySdPattern pattern node + * Create a _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {Ratio1ySdPattern} + * @returns {_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern} */ -function createRatio1ySdPattern(client, acc) { +function create_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern(client, acc) { return { - _0sdUsd: create_0sdUsdPattern(client, _m(acc, '0sd_usd')), + _0sdUsd: createDollarsSatsPattern2(client, _m(acc, '0sd_usd')), m05sd: createMetricPattern4(client, _m(acc, 'm0_5sd')), - m05sdUsd: create_0sdUsdPattern(client, _m(acc, 'm0_5sd_usd')), + m05sdUsd: createDollarsSatsPattern2(client, _m(acc, 'm0_5sd_usd')), m15sd: createMetricPattern4(client, _m(acc, 'm1_5sd')), - m15sdUsd: create_0sdUsdPattern(client, _m(acc, 'm1_5sd_usd')), + m15sdUsd: createDollarsSatsPattern2(client, _m(acc, 'm1_5sd_usd')), m1sd: createMetricPattern4(client, _m(acc, 'm1sd')), - m1sdUsd: create_0sdUsdPattern(client, _m(acc, 'm1sd_usd')), + m1sdUsd: createDollarsSatsPattern2(client, _m(acc, 'm1sd_usd')), m25sd: createMetricPattern4(client, _m(acc, 'm2_5sd')), - m25sdUsd: create_0sdUsdPattern(client, _m(acc, 'm2_5sd_usd')), + m25sdUsd: createDollarsSatsPattern2(client, _m(acc, 'm2_5sd_usd')), m2sd: createMetricPattern4(client, _m(acc, 'm2sd')), - m2sdUsd: create_0sdUsdPattern(client, _m(acc, 'm2sd_usd')), + m2sdUsd: createDollarsSatsPattern2(client, _m(acc, 'm2sd_usd')), m3sd: createMetricPattern4(client, _m(acc, 'm3sd')), - m3sdUsd: create_0sdUsdPattern(client, _m(acc, 'm3sd_usd')), + m3sdUsd: createDollarsSatsPattern2(client, _m(acc, 'm3sd_usd')), p05sd: createMetricPattern4(client, _m(acc, 'p0_5sd')), - p05sdUsd: create_0sdUsdPattern(client, _m(acc, 'p0_5sd_usd')), + p05sdUsd: createDollarsSatsPattern2(client, _m(acc, 'p0_5sd_usd')), p15sd: createMetricPattern4(client, _m(acc, 'p1_5sd')), - p15sdUsd: create_0sdUsdPattern(client, _m(acc, 'p1_5sd_usd')), + p15sdUsd: createDollarsSatsPattern2(client, _m(acc, 'p1_5sd_usd')), p1sd: createMetricPattern4(client, _m(acc, 'p1sd')), - p1sdUsd: create_0sdUsdPattern(client, _m(acc, 'p1sd_usd')), + p1sdUsd: createDollarsSatsPattern2(client, _m(acc, 'p1sd_usd')), p25sd: createMetricPattern4(client, _m(acc, 'p2_5sd')), - p25sdUsd: create_0sdUsdPattern(client, _m(acc, 'p2_5sd_usd')), + p25sdUsd: createDollarsSatsPattern2(client, _m(acc, 'p2_5sd_usd')), p2sd: createMetricPattern4(client, _m(acc, 'p2sd')), - p2sdUsd: create_0sdUsdPattern(client, _m(acc, 'p2sd_usd')), + p2sdUsd: createDollarsSatsPattern2(client, _m(acc, 'p2sd_usd')), p3sd: createMetricPattern4(client, _m(acc, 'p3sd')), - p3sdUsd: create_0sdUsdPattern(client, _m(acc, 'p3sd_usd')), + p3sdUsd: createDollarsSatsPattern2(client, _m(acc, 'p3sd_usd')), sd: createMetricPattern4(client, _m(acc, 'sd')), sma: createMetricPattern4(client, _m(acc, 'sma')), zscore: createMetricPattern4(client, _m(acc, 'zscore')), @@ -1575,302 +1832,9 @@ function createRatio1ySdPattern(client, acc) { } /** - * @typedef {Object} RealizedPattern2 - * @property {MetricPattern4} mvrv - * @property {BitcoinPattern2} negRealizedLoss - * @property {BlockCountPattern} netRealizedPnl - * @property {MetricPattern4} netRealizedPnlCumulative30dDelta - * @property {MetricPattern4} netRealizedPnlCumulative30dDeltaRelToMarketCap - * @property {MetricPattern4} netRealizedPnlCumulative30dDeltaRelToRealizedCap - * @property {BlockCountPattern} netRealizedPnlRelToRealizedCap - * @property {MetricPattern1} realizedCap - * @property {MetricPattern4} realizedCap30dDelta - * @property {MetricPattern1} realizedCapRelToOwnMarketCap - * @property {BlockCountPattern} realizedLoss - * @property {BlockCountPattern} realizedLossRelToRealizedCap - * @property {ActivePricePattern} realizedPrice - * @property {ActivePriceRatioPattern} realizedPriceExtra - * @property {BlockCountPattern} realizedProfit - * @property {BlockCountPattern} realizedProfitRelToRealizedCap - * @property {MetricPattern6} realizedProfitToLossRatio - * @property {MetricPattern1} realizedValue - * @property {MetricPattern6} sellSideRiskRatio - * @property {MetricPattern6} sellSideRiskRatio30dEma - * @property {MetricPattern6} sellSideRiskRatio7dEma - * @property {MetricPattern6} sopr - * @property {MetricPattern6} sopr30dEma - * @property {MetricPattern6} sopr7dEma - * @property {MetricPattern1} totalRealizedPnl - * @property {MetricPattern1} valueCreated - * @property {MetricPattern1} valueDestroyed - */ - -/** - * Create a RealizedPattern2 pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {RealizedPattern2} - */ -function createRealizedPattern2(client, acc) { - return { - mvrv: createMetricPattern4(client, _m(acc, 'mvrv')), - negRealizedLoss: createBitcoinPattern2(client, _m(acc, 'neg_realized_loss')), - netRealizedPnl: createBlockCountPattern(client, _m(acc, 'net_realized_pnl')), - netRealizedPnlCumulative30dDelta: createMetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta')), - netRealizedPnlCumulative30dDeltaRelToMarketCap: createMetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_market_cap')), - netRealizedPnlCumulative30dDeltaRelToRealizedCap: createMetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap')), - netRealizedPnlRelToRealizedCap: createBlockCountPattern(client, _m(acc, 'net_realized_pnl_rel_to_realized_cap')), - realizedCap: createMetricPattern1(client, _m(acc, 'realized_cap')), - realizedCap30dDelta: createMetricPattern4(client, _m(acc, 'realized_cap_30d_delta')), - realizedCapRelToOwnMarketCap: createMetricPattern1(client, _m(acc, 'realized_cap_rel_to_own_market_cap')), - realizedLoss: createBlockCountPattern(client, _m(acc, 'realized_loss')), - realizedLossRelToRealizedCap: createBlockCountPattern(client, _m(acc, 'realized_loss_rel_to_realized_cap')), - realizedPrice: createActivePricePattern(client, _m(acc, 'realized_price')), - realizedPriceExtra: createActivePriceRatioPattern(client, _m(acc, 'realized_price_ratio')), - realizedProfit: createBlockCountPattern(client, _m(acc, 'realized_profit')), - realizedProfitRelToRealizedCap: createBlockCountPattern(client, _m(acc, 'realized_profit_rel_to_realized_cap')), - realizedProfitToLossRatio: createMetricPattern6(client, _m(acc, 'realized_profit_to_loss_ratio')), - realizedValue: createMetricPattern1(client, _m(acc, 'realized_value')), - sellSideRiskRatio: createMetricPattern6(client, _m(acc, 'sell_side_risk_ratio')), - sellSideRiskRatio30dEma: createMetricPattern6(client, _m(acc, 'sell_side_risk_ratio_30d_ema')), - sellSideRiskRatio7dEma: createMetricPattern6(client, _m(acc, 'sell_side_risk_ratio_7d_ema')), - sopr: createMetricPattern6(client, _m(acc, 'sopr')), - sopr30dEma: createMetricPattern6(client, _m(acc, 'sopr_30d_ema')), - sopr7dEma: createMetricPattern6(client, _m(acc, 'sopr_7d_ema')), - totalRealizedPnl: createMetricPattern1(client, _m(acc, 'total_realized_pnl')), - valueCreated: createMetricPattern1(client, _m(acc, 'value_created')), - valueDestroyed: createMetricPattern1(client, _m(acc, 'value_destroyed')), - }; -} - -/** - * @typedef {Object} RealizedPattern - * @property {MetricPattern4} mvrv - * @property {BitcoinPattern2} negRealizedLoss - * @property {BlockCountPattern} netRealizedPnl - * @property {MetricPattern4} netRealizedPnlCumulative30dDelta - * @property {MetricPattern4} netRealizedPnlCumulative30dDeltaRelToMarketCap - * @property {MetricPattern4} netRealizedPnlCumulative30dDeltaRelToRealizedCap - * @property {BlockCountPattern} netRealizedPnlRelToRealizedCap - * @property {MetricPattern1} realizedCap - * @property {MetricPattern4} realizedCap30dDelta - * @property {BlockCountPattern} realizedLoss - * @property {BlockCountPattern} realizedLossRelToRealizedCap - * @property {ActivePricePattern} realizedPrice - * @property {RealizedPriceExtraPattern} realizedPriceExtra - * @property {BlockCountPattern} realizedProfit - * @property {BlockCountPattern} realizedProfitRelToRealizedCap - * @property {MetricPattern1} realizedValue - * @property {MetricPattern6} sellSideRiskRatio - * @property {MetricPattern6} sellSideRiskRatio30dEma - * @property {MetricPattern6} sellSideRiskRatio7dEma - * @property {MetricPattern6} sopr - * @property {MetricPattern6} sopr30dEma - * @property {MetricPattern6} sopr7dEma - * @property {MetricPattern1} totalRealizedPnl - * @property {MetricPattern1} valueCreated - * @property {MetricPattern1} valueDestroyed - */ - -/** - * Create a RealizedPattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {RealizedPattern} - */ -function createRealizedPattern(client, acc) { - return { - mvrv: createMetricPattern4(client, _m(acc, 'mvrv')), - negRealizedLoss: createBitcoinPattern2(client, _m(acc, 'neg_realized_loss')), - netRealizedPnl: createBlockCountPattern(client, _m(acc, 'net_realized_pnl')), - netRealizedPnlCumulative30dDelta: createMetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta')), - netRealizedPnlCumulative30dDeltaRelToMarketCap: createMetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_market_cap')), - netRealizedPnlCumulative30dDeltaRelToRealizedCap: createMetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap')), - netRealizedPnlRelToRealizedCap: createBlockCountPattern(client, _m(acc, 'net_realized_pnl_rel_to_realized_cap')), - realizedCap: createMetricPattern1(client, _m(acc, 'realized_cap')), - realizedCap30dDelta: createMetricPattern4(client, _m(acc, 'realized_cap_30d_delta')), - realizedLoss: createBlockCountPattern(client, _m(acc, 'realized_loss')), - realizedLossRelToRealizedCap: createBlockCountPattern(client, _m(acc, 'realized_loss_rel_to_realized_cap')), - realizedPrice: createActivePricePattern(client, _m(acc, 'realized_price')), - realizedPriceExtra: createRealizedPriceExtraPattern(client, _m(acc, 'realized_price_ratio')), - realizedProfit: createBlockCountPattern(client, _m(acc, 'realized_profit')), - realizedProfitRelToRealizedCap: createBlockCountPattern(client, _m(acc, 'realized_profit_rel_to_realized_cap')), - realizedValue: createMetricPattern1(client, _m(acc, 'realized_value')), - sellSideRiskRatio: createMetricPattern6(client, _m(acc, 'sell_side_risk_ratio')), - sellSideRiskRatio30dEma: createMetricPattern6(client, _m(acc, 'sell_side_risk_ratio_30d_ema')), - sellSideRiskRatio7dEma: createMetricPattern6(client, _m(acc, 'sell_side_risk_ratio_7d_ema')), - sopr: createMetricPattern6(client, _m(acc, 'sopr')), - sopr30dEma: createMetricPattern6(client, _m(acc, 'sopr_30d_ema')), - sopr7dEma: createMetricPattern6(client, _m(acc, 'sopr_7d_ema')), - totalRealizedPnl: createMetricPattern1(client, _m(acc, 'total_realized_pnl')), - valueCreated: createMetricPattern1(client, _m(acc, 'value_created')), - valueDestroyed: createMetricPattern1(client, _m(acc, 'value_destroyed')), - }; -} - -/** - * @typedef {Object} Price111dSmaPattern - * @property {_0sdUsdPattern} price - * @property {MetricPattern4} ratio - * @property {MetricPattern4} ratio1mSma - * @property {MetricPattern4} ratio1wSma - * @property {Ratio1ySdPattern} ratio1ySd - * @property {Ratio1ySdPattern} ratio2ySd - * @property {Ratio1ySdPattern} ratio4ySd - * @property {MetricPattern4} ratioPct1 - * @property {_0sdUsdPattern} ratioPct1Usd - * @property {MetricPattern4} ratioPct2 - * @property {_0sdUsdPattern} ratioPct2Usd - * @property {MetricPattern4} ratioPct5 - * @property {_0sdUsdPattern} ratioPct5Usd - * @property {MetricPattern4} ratioPct95 - * @property {_0sdUsdPattern} ratioPct95Usd - * @property {MetricPattern4} ratioPct98 - * @property {_0sdUsdPattern} ratioPct98Usd - * @property {MetricPattern4} ratioPct99 - * @property {_0sdUsdPattern} ratioPct99Usd - * @property {Ratio1ySdPattern} ratioSd - */ - -/** - * Create a Price111dSmaPattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {Price111dSmaPattern} - */ -function createPrice111dSmaPattern(client, acc) { - return { - price: create_0sdUsdPattern(client, acc), - ratio: createMetricPattern4(client, _m(acc, 'ratio')), - ratio1mSma: createMetricPattern4(client, _m(acc, 'ratio_1m_sma')), - ratio1wSma: createMetricPattern4(client, _m(acc, 'ratio_1w_sma')), - ratio1ySd: createRatio1ySdPattern(client, _m(acc, 'ratio_1y')), - ratio2ySd: createRatio1ySdPattern(client, _m(acc, 'ratio_2y')), - ratio4ySd: createRatio1ySdPattern(client, _m(acc, 'ratio_4y')), - ratioPct1: createMetricPattern4(client, _m(acc, 'ratio_pct1')), - ratioPct1Usd: create_0sdUsdPattern(client, _m(acc, 'ratio_pct1_usd')), - ratioPct2: createMetricPattern4(client, _m(acc, 'ratio_pct2')), - ratioPct2Usd: create_0sdUsdPattern(client, _m(acc, 'ratio_pct2_usd')), - ratioPct5: createMetricPattern4(client, _m(acc, 'ratio_pct5')), - ratioPct5Usd: create_0sdUsdPattern(client, _m(acc, 'ratio_pct5_usd')), - ratioPct95: createMetricPattern4(client, _m(acc, 'ratio_pct95')), - ratioPct95Usd: create_0sdUsdPattern(client, _m(acc, 'ratio_pct95_usd')), - ratioPct98: createMetricPattern4(client, _m(acc, 'ratio_pct98')), - ratioPct98Usd: create_0sdUsdPattern(client, _m(acc, 'ratio_pct98_usd')), - ratioPct99: createMetricPattern4(client, _m(acc, 'ratio_pct99')), - ratioPct99Usd: create_0sdUsdPattern(client, _m(acc, 'ratio_pct99_usd')), - ratioSd: createRatio1ySdPattern(client, _m(acc, 'ratio')), - }; -} - -/** - * @typedef {Object} PercentilesPattern - * @property {_0sdUsdPattern} pct05 - * @property {_0sdUsdPattern} pct10 - * @property {_0sdUsdPattern} pct15 - * @property {_0sdUsdPattern} pct20 - * @property {_0sdUsdPattern} pct25 - * @property {_0sdUsdPattern} pct30 - * @property {_0sdUsdPattern} pct35 - * @property {_0sdUsdPattern} pct40 - * @property {_0sdUsdPattern} pct45 - * @property {_0sdUsdPattern} pct50 - * @property {_0sdUsdPattern} pct55 - * @property {_0sdUsdPattern} pct60 - * @property {_0sdUsdPattern} pct65 - * @property {_0sdUsdPattern} pct70 - * @property {_0sdUsdPattern} pct75 - * @property {_0sdUsdPattern} pct80 - * @property {_0sdUsdPattern} pct85 - * @property {_0sdUsdPattern} pct90 - * @property {_0sdUsdPattern} pct95 - */ - -/** - * Create a PercentilesPattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {PercentilesPattern} - */ -function createPercentilesPattern(client, acc) { - return { - pct05: create_0sdUsdPattern(client, _m(acc, 'pct05')), - pct10: create_0sdUsdPattern(client, _m(acc, 'pct10')), - pct15: create_0sdUsdPattern(client, _m(acc, 'pct15')), - pct20: create_0sdUsdPattern(client, _m(acc, 'pct20')), - pct25: create_0sdUsdPattern(client, _m(acc, 'pct25')), - pct30: create_0sdUsdPattern(client, _m(acc, 'pct30')), - pct35: create_0sdUsdPattern(client, _m(acc, 'pct35')), - pct40: create_0sdUsdPattern(client, _m(acc, 'pct40')), - pct45: create_0sdUsdPattern(client, _m(acc, 'pct45')), - pct50: create_0sdUsdPattern(client, _m(acc, 'pct50')), - pct55: create_0sdUsdPattern(client, _m(acc, 'pct55')), - pct60: create_0sdUsdPattern(client, _m(acc, 'pct60')), - pct65: create_0sdUsdPattern(client, _m(acc, 'pct65')), - pct70: create_0sdUsdPattern(client, _m(acc, 'pct70')), - pct75: create_0sdUsdPattern(client, _m(acc, 'pct75')), - pct80: create_0sdUsdPattern(client, _m(acc, 'pct80')), - pct85: create_0sdUsdPattern(client, _m(acc, 'pct85')), - pct90: create_0sdUsdPattern(client, _m(acc, 'pct90')), - pct95: create_0sdUsdPattern(client, _m(acc, 'pct95')), - }; -} - -/** - * @typedef {Object} ActivePriceRatioPattern - * @property {MetricPattern4} ratio - * @property {MetricPattern4} ratio1mSma - * @property {MetricPattern4} ratio1wSma - * @property {Ratio1ySdPattern} ratio1ySd - * @property {Ratio1ySdPattern} ratio2ySd - * @property {Ratio1ySdPattern} ratio4ySd - * @property {MetricPattern4} ratioPct1 - * @property {_0sdUsdPattern} ratioPct1Usd - * @property {MetricPattern4} ratioPct2 - * @property {_0sdUsdPattern} ratioPct2Usd - * @property {MetricPattern4} ratioPct5 - * @property {_0sdUsdPattern} ratioPct5Usd - * @property {MetricPattern4} ratioPct95 - * @property {_0sdUsdPattern} ratioPct95Usd - * @property {MetricPattern4} ratioPct98 - * @property {_0sdUsdPattern} ratioPct98Usd - * @property {MetricPattern4} ratioPct99 - * @property {_0sdUsdPattern} ratioPct99Usd - * @property {Ratio1ySdPattern} ratioSd - */ - -/** - * Create a ActivePriceRatioPattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {ActivePriceRatioPattern} - */ -function createActivePriceRatioPattern(client, acc) { - return { - ratio: createMetricPattern4(client, acc), - ratio1mSma: createMetricPattern4(client, _m(acc, '1m_sma')), - ratio1wSma: createMetricPattern4(client, _m(acc, '1w_sma')), - ratio1ySd: createRatio1ySdPattern(client, _m(acc, '1y')), - ratio2ySd: createRatio1ySdPattern(client, _m(acc, '2y')), - ratio4ySd: createRatio1ySdPattern(client, _m(acc, '4y')), - ratioPct1: createMetricPattern4(client, _m(acc, 'pct1')), - ratioPct1Usd: create_0sdUsdPattern(client, _m(acc, 'pct1_usd')), - ratioPct2: createMetricPattern4(client, _m(acc, 'pct2')), - ratioPct2Usd: create_0sdUsdPattern(client, _m(acc, 'pct2_usd')), - ratioPct5: createMetricPattern4(client, _m(acc, 'pct5')), - ratioPct5Usd: create_0sdUsdPattern(client, _m(acc, 'pct5_usd')), - ratioPct95: createMetricPattern4(client, _m(acc, 'pct95')), - ratioPct95Usd: create_0sdUsdPattern(client, _m(acc, 'pct95_usd')), - ratioPct98: createMetricPattern4(client, _m(acc, 'pct98')), - ratioPct98Usd: create_0sdUsdPattern(client, _m(acc, 'pct98_usd')), - ratioPct99: createMetricPattern4(client, _m(acc, 'pct99')), - ratioPct99Usd: create_0sdUsdPattern(client, _m(acc, 'pct99_usd')), - ratioSd: createRatio1ySdPattern(client, acc), - }; -} - -/** - * @typedef {Object} RelativePattern5 + * @typedef {Object} InvestedNegNetNuplSupplyUnrealizedPattern2 + * @property {MetricPattern1} investedCapitalInLossPct + * @property {MetricPattern1} investedCapitalInProfitPct * @property {MetricPattern1} negUnrealizedLossRelToMarketCap * @property {MetricPattern1} negUnrealizedLossRelToOwnMarketCap * @property {MetricPattern1} negUnrealizedLossRelToOwnTotalUnrealizedPnl @@ -1892,13 +1856,15 @@ function createActivePriceRatioPattern(client, acc) { */ /** - * Create a RelativePattern5 pattern node + * Create a InvestedNegNetNuplSupplyUnrealizedPattern2 pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {RelativePattern5} + * @returns {InvestedNegNetNuplSupplyUnrealizedPattern2} */ -function createRelativePattern5(client, acc) { +function createInvestedNegNetNuplSupplyUnrealizedPattern2(client, acc) { return { + investedCapitalInLossPct: createMetricPattern1(client, _m(acc, 'invested_capital_in_loss_pct')), + investedCapitalInProfitPct: createMetricPattern1(client, _m(acc, 'invested_capital_in_profit_pct')), negUnrealizedLossRelToMarketCap: createMetricPattern1(client, _m(acc, 'neg_unrealized_loss_rel_to_market_cap')), negUnrealizedLossRelToOwnMarketCap: createMetricPattern1(client, _m(acc, 'neg_unrealized_loss_rel_to_own_market_cap')), negUnrealizedLossRelToOwnTotalUnrealizedPnl: createMetricPattern1(client, _m(acc, 'neg_unrealized_loss_rel_to_own_total_unrealized_pnl')), @@ -1921,7 +1887,217 @@ function createRelativePattern5(client, acc) { } /** - * @typedef {Object} AaopoolPattern + * @typedef {Object} PriceRatioPattern + * @property {DollarsSatsPattern2} price + * @property {MetricPattern4} ratio + * @property {MetricPattern4} ratio1mSma + * @property {MetricPattern4} ratio1wSma + * @property {_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern} ratio1ySd + * @property {_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern} ratio2ySd + * @property {_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern} ratio4ySd + * @property {MetricPattern4} ratioPct1 + * @property {DollarsSatsPattern2} ratioPct1Usd + * @property {MetricPattern4} ratioPct2 + * @property {DollarsSatsPattern2} ratioPct2Usd + * @property {MetricPattern4} ratioPct5 + * @property {DollarsSatsPattern2} ratioPct5Usd + * @property {MetricPattern4} ratioPct95 + * @property {DollarsSatsPattern2} ratioPct95Usd + * @property {MetricPattern4} ratioPct98 + * @property {DollarsSatsPattern2} ratioPct98Usd + * @property {MetricPattern4} ratioPct99 + * @property {DollarsSatsPattern2} ratioPct99Usd + * @property {_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern} ratioSd + */ + +/** + * Create a PriceRatioPattern pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {PriceRatioPattern} + */ +function createPriceRatioPattern(client, acc) { + return { + price: createDollarsSatsPattern2(client, acc), + ratio: createMetricPattern4(client, _m(acc, 'ratio')), + ratio1mSma: createMetricPattern4(client, _m(acc, 'ratio_1m_sma')), + ratio1wSma: createMetricPattern4(client, _m(acc, 'ratio_1w_sma')), + ratio1ySd: create_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern(client, _m(acc, 'ratio_1y')), + ratio2ySd: create_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern(client, _m(acc, 'ratio_2y')), + ratio4ySd: create_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern(client, _m(acc, 'ratio_4y')), + ratioPct1: createMetricPattern4(client, _m(acc, 'ratio_pct1')), + ratioPct1Usd: createDollarsSatsPattern2(client, _m(acc, 'ratio_pct1_usd')), + ratioPct2: createMetricPattern4(client, _m(acc, 'ratio_pct2')), + ratioPct2Usd: createDollarsSatsPattern2(client, _m(acc, 'ratio_pct2_usd')), + ratioPct5: createMetricPattern4(client, _m(acc, 'ratio_pct5')), + ratioPct5Usd: createDollarsSatsPattern2(client, _m(acc, 'ratio_pct5_usd')), + ratioPct95: createMetricPattern4(client, _m(acc, 'ratio_pct95')), + ratioPct95Usd: createDollarsSatsPattern2(client, _m(acc, 'ratio_pct95_usd')), + ratioPct98: createMetricPattern4(client, _m(acc, 'ratio_pct98')), + ratioPct98Usd: createDollarsSatsPattern2(client, _m(acc, 'ratio_pct98_usd')), + ratioPct99: createMetricPattern4(client, _m(acc, 'ratio_pct99')), + ratioPct99Usd: createDollarsSatsPattern2(client, _m(acc, 'ratio_pct99_usd')), + ratioSd: create_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern(client, _m(acc, 'ratio')), + }; +} + +/** + * @typedef {Object} Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern + * @property {DollarsSatsPattern2} pct05 + * @property {DollarsSatsPattern2} pct10 + * @property {DollarsSatsPattern2} pct15 + * @property {DollarsSatsPattern2} pct20 + * @property {DollarsSatsPattern2} pct25 + * @property {DollarsSatsPattern2} pct30 + * @property {DollarsSatsPattern2} pct35 + * @property {DollarsSatsPattern2} pct40 + * @property {DollarsSatsPattern2} pct45 + * @property {DollarsSatsPattern2} pct50 + * @property {DollarsSatsPattern2} pct55 + * @property {DollarsSatsPattern2} pct60 + * @property {DollarsSatsPattern2} pct65 + * @property {DollarsSatsPattern2} pct70 + * @property {DollarsSatsPattern2} pct75 + * @property {DollarsSatsPattern2} pct80 + * @property {DollarsSatsPattern2} pct85 + * @property {DollarsSatsPattern2} pct90 + * @property {DollarsSatsPattern2} pct95 + */ + +/** + * Create a Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern} + */ +function createPct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern(client, acc) { + return { + pct05: createDollarsSatsPattern2(client, _m(acc, 'pct05')), + pct10: createDollarsSatsPattern2(client, _m(acc, 'pct10')), + pct15: createDollarsSatsPattern2(client, _m(acc, 'pct15')), + pct20: createDollarsSatsPattern2(client, _m(acc, 'pct20')), + pct25: createDollarsSatsPattern2(client, _m(acc, 'pct25')), + pct30: createDollarsSatsPattern2(client, _m(acc, 'pct30')), + pct35: createDollarsSatsPattern2(client, _m(acc, 'pct35')), + pct40: createDollarsSatsPattern2(client, _m(acc, 'pct40')), + pct45: createDollarsSatsPattern2(client, _m(acc, 'pct45')), + pct50: createDollarsSatsPattern2(client, _m(acc, 'pct50')), + pct55: createDollarsSatsPattern2(client, _m(acc, 'pct55')), + pct60: createDollarsSatsPattern2(client, _m(acc, 'pct60')), + pct65: createDollarsSatsPattern2(client, _m(acc, 'pct65')), + pct70: createDollarsSatsPattern2(client, _m(acc, 'pct70')), + pct75: createDollarsSatsPattern2(client, _m(acc, 'pct75')), + pct80: createDollarsSatsPattern2(client, _m(acc, 'pct80')), + pct85: createDollarsSatsPattern2(client, _m(acc, 'pct85')), + pct90: createDollarsSatsPattern2(client, _m(acc, 'pct90')), + pct95: createDollarsSatsPattern2(client, _m(acc, 'pct95')), + }; +} + +/** + * @typedef {Object} RatioPattern + * @property {MetricPattern4} ratio + * @property {MetricPattern4} ratio1mSma + * @property {MetricPattern4} ratio1wSma + * @property {_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern} ratio1ySd + * @property {_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern} ratio2ySd + * @property {_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern} ratio4ySd + * @property {MetricPattern4} ratioPct1 + * @property {DollarsSatsPattern2} ratioPct1Usd + * @property {MetricPattern4} ratioPct2 + * @property {DollarsSatsPattern2} ratioPct2Usd + * @property {MetricPattern4} ratioPct5 + * @property {DollarsSatsPattern2} ratioPct5Usd + * @property {MetricPattern4} ratioPct95 + * @property {DollarsSatsPattern2} ratioPct95Usd + * @property {MetricPattern4} ratioPct98 + * @property {DollarsSatsPattern2} ratioPct98Usd + * @property {MetricPattern4} ratioPct99 + * @property {DollarsSatsPattern2} ratioPct99Usd + * @property {_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern} ratioSd + */ + +/** + * Create a RatioPattern pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {RatioPattern} + */ +function createRatioPattern(client, acc) { + return { + ratio: createMetricPattern4(client, acc), + ratio1mSma: createMetricPattern4(client, _m(acc, '1m_sma')), + ratio1wSma: createMetricPattern4(client, _m(acc, '1w_sma')), + ratio1ySd: create_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern(client, _m(acc, '1y')), + ratio2ySd: create_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern(client, _m(acc, '2y')), + ratio4ySd: create_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern(client, _m(acc, '4y')), + ratioPct1: createMetricPattern4(client, _m(acc, 'pct1')), + ratioPct1Usd: createDollarsSatsPattern2(client, _m(acc, 'pct1_usd')), + ratioPct2: createMetricPattern4(client, _m(acc, 'pct2')), + ratioPct2Usd: createDollarsSatsPattern2(client, _m(acc, 'pct2_usd')), + ratioPct5: createMetricPattern4(client, _m(acc, 'pct5')), + ratioPct5Usd: createDollarsSatsPattern2(client, _m(acc, 'pct5_usd')), + ratioPct95: createMetricPattern4(client, _m(acc, 'pct95')), + ratioPct95Usd: createDollarsSatsPattern2(client, _m(acc, 'pct95_usd')), + ratioPct98: createMetricPattern4(client, _m(acc, 'pct98')), + ratioPct98Usd: createDollarsSatsPattern2(client, _m(acc, 'pct98_usd')), + ratioPct99: createMetricPattern4(client, _m(acc, 'pct99')), + ratioPct99Usd: createDollarsSatsPattern2(client, _m(acc, 'pct99_usd')), + ratioSd: create_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern(client, acc), + }; +} + +/** + * @typedef {Object} AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern + * @property {MetricPattern1} athRegret + * @property {MetricPattern1} greedIndex + * @property {MetricPattern1} investedCapitalInLoss + * @property {MetricPattern11} investedCapitalInLossRaw + * @property {MetricPattern1} investedCapitalInProfit + * @property {MetricPattern11} investedCapitalInProfitRaw + * @property {MetricPattern11} investorCapInLossRaw + * @property {MetricPattern11} investorCapInProfitRaw + * @property {MetricPattern1} negUnrealizedLoss + * @property {MetricPattern1} netSentiment + * @property {MetricPattern1} netUnrealizedPnl + * @property {MetricPattern1} painIndex + * @property {BitcoinDollarsSatsPattern4} supplyInLoss + * @property {BitcoinDollarsSatsPattern4} supplyInProfit + * @property {MetricPattern1} totalUnrealizedPnl + * @property {MetricPattern1} unrealizedLoss + * @property {MetricPattern1} unrealizedProfit + */ + +/** + * Create a AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern} + */ +function createAthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern(client, acc) { + return { + athRegret: createMetricPattern1(client, _m(acc, 'unrealized_ath_regret')), + greedIndex: createMetricPattern1(client, _m(acc, 'greed_index')), + investedCapitalInLoss: createMetricPattern1(client, _m(acc, 'invested_capital_in_loss')), + investedCapitalInLossRaw: createMetricPattern11(client, _m(acc, 'invested_capital_in_loss_raw')), + investedCapitalInProfit: createMetricPattern1(client, _m(acc, 'invested_capital_in_profit')), + investedCapitalInProfitRaw: createMetricPattern11(client, _m(acc, 'invested_capital_in_profit_raw')), + investorCapInLossRaw: createMetricPattern11(client, _m(acc, 'investor_cap_in_loss_raw')), + investorCapInProfitRaw: createMetricPattern11(client, _m(acc, 'investor_cap_in_profit_raw')), + negUnrealizedLoss: createMetricPattern1(client, _m(acc, 'neg_unrealized_loss')), + netSentiment: createMetricPattern1(client, _m(acc, 'net_sentiment')), + netUnrealizedPnl: createMetricPattern1(client, _m(acc, 'net_unrealized_pnl')), + painIndex: createMetricPattern1(client, _m(acc, 'pain_index')), + supplyInLoss: createBitcoinDollarsSatsPattern4(client, _m(acc, 'supply_in_loss')), + supplyInProfit: createBitcoinDollarsSatsPattern4(client, _m(acc, 'supply_in_profit')), + totalUnrealizedPnl: createMetricPattern1(client, _m(acc, 'total_unrealized_pnl')), + unrealizedLoss: createMetricPattern1(client, _m(acc, 'unrealized_loss')), + unrealizedProfit: createMetricPattern1(client, _m(acc, 'unrealized_profit')), + }; +} + +/** + * @typedef {Object} _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern * @property {MetricPattern1} _1mBlocksMined * @property {MetricPattern1} _1mDominance * @property {MetricPattern1} _1wBlocksMined @@ -1930,22 +2106,22 @@ function createRelativePattern5(client, acc) { * @property {MetricPattern1} _1yDominance * @property {MetricPattern1} _24hBlocksMined * @property {MetricPattern1} _24hDominance - * @property {BlockCountPattern} blocksMined + * @property {CumulativeSumPattern} blocksMined * @property {MetricPattern1} blocksSinceBlock - * @property {CoinbasePattern2} coinbase + * @property {BitcoinDollarsSatsPattern6} coinbase * @property {MetricPattern4} daysSinceBlock * @property {MetricPattern1} dominance - * @property {UnclaimedRewardsPattern} fee - * @property {UnclaimedRewardsPattern} subsidy + * @property {BitcoinDollarsSatsPattern3} fee + * @property {BitcoinDollarsSatsPattern3} subsidy */ /** - * Create a AaopoolPattern pattern node + * Create a _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {AaopoolPattern} + * @returns {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} */ -function createAaopoolPattern(client, acc) { +function create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, acc) { return { _1mBlocksMined: createMetricPattern1(client, _m(acc, '1m_blocks_mined')), _1mDominance: createMetricPattern1(client, _m(acc, '1m_dominance')), @@ -1955,58 +2131,136 @@ function createAaopoolPattern(client, acc) { _1yDominance: createMetricPattern1(client, _m(acc, '1y_dominance')), _24hBlocksMined: createMetricPattern1(client, _m(acc, '24h_blocks_mined')), _24hDominance: createMetricPattern1(client, _m(acc, '24h_dominance')), - blocksMined: createBlockCountPattern(client, _m(acc, 'blocks_mined')), + blocksMined: createCumulativeSumPattern(client, _m(acc, 'blocks_mined')), blocksSinceBlock: createMetricPattern1(client, _m(acc, 'blocks_since_block')), - coinbase: createCoinbasePattern2(client, _m(acc, 'coinbase')), + coinbase: createBitcoinDollarsSatsPattern6(client, _m(acc, 'coinbase')), daysSinceBlock: createMetricPattern4(client, _m(acc, 'days_since_block')), dominance: createMetricPattern1(client, _m(acc, 'dominance')), - fee: createUnclaimedRewardsPattern(client, _m(acc, 'fee')), - subsidy: createUnclaimedRewardsPattern(client, _m(acc, 'subsidy')), + fee: createBitcoinDollarsSatsPattern3(client, _m(acc, 'fee')), + subsidy: createBitcoinDollarsSatsPattern3(client, _m(acc, 'subsidy')), }; } /** - * @typedef {Object} PeriodLumpSumStackPattern - * @property {_2015Pattern} _10y - * @property {_2015Pattern} _1m - * @property {_2015Pattern} _1w - * @property {_2015Pattern} _1y - * @property {_2015Pattern} _2y - * @property {_2015Pattern} _3m - * @property {_2015Pattern} _3y - * @property {_2015Pattern} _4y - * @property {_2015Pattern} _5y - * @property {_2015Pattern} _6m - * @property {_2015Pattern} _6y - * @property {_2015Pattern} _8y + * @typedef {Object} _10y1m1w1y2y3m3y4y5y6m6y8yPattern3 + * @property {BitcoinDollarsSatsPattern5} _10y + * @property {BitcoinDollarsSatsPattern5} _1m + * @property {BitcoinDollarsSatsPattern5} _1w + * @property {BitcoinDollarsSatsPattern5} _1y + * @property {BitcoinDollarsSatsPattern5} _2y + * @property {BitcoinDollarsSatsPattern5} _3m + * @property {BitcoinDollarsSatsPattern5} _3y + * @property {BitcoinDollarsSatsPattern5} _4y + * @property {BitcoinDollarsSatsPattern5} _5y + * @property {BitcoinDollarsSatsPattern5} _6m + * @property {BitcoinDollarsSatsPattern5} _6y + * @property {BitcoinDollarsSatsPattern5} _8y */ /** - * Create a PeriodLumpSumStackPattern pattern node + * Create a _10y1m1w1y2y3m3y4y5y6m6y8yPattern3 pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {PeriodLumpSumStackPattern} + * @returns {_10y1m1w1y2y3m3y4y5y6m6y8yPattern3} */ -function createPeriodLumpSumStackPattern(client, acc) { +function create_10y1m1w1y2y3m3y4y5y6m6y8yPattern3(client, acc) { return { - _10y: create_2015Pattern(client, _p('10y', acc)), - _1m: create_2015Pattern(client, _p('1m', acc)), - _1w: create_2015Pattern(client, _p('1w', acc)), - _1y: create_2015Pattern(client, _p('1y', acc)), - _2y: create_2015Pattern(client, _p('2y', acc)), - _3m: create_2015Pattern(client, _p('3m', acc)), - _3y: create_2015Pattern(client, _p('3y', acc)), - _4y: create_2015Pattern(client, _p('4y', acc)), - _5y: create_2015Pattern(client, _p('5y', acc)), - _6m: create_2015Pattern(client, _p('6m', acc)), - _6y: create_2015Pattern(client, _p('6y', acc)), - _8y: create_2015Pattern(client, _p('8y', acc)), + _10y: createBitcoinDollarsSatsPattern5(client, _p('10y', acc)), + _1m: createBitcoinDollarsSatsPattern5(client, _p('1m', acc)), + _1w: createBitcoinDollarsSatsPattern5(client, _p('1w', acc)), + _1y: createBitcoinDollarsSatsPattern5(client, _p('1y', acc)), + _2y: createBitcoinDollarsSatsPattern5(client, _p('2y', acc)), + _3m: createBitcoinDollarsSatsPattern5(client, _p('3m', acc)), + _3y: createBitcoinDollarsSatsPattern5(client, _p('3y', acc)), + _4y: createBitcoinDollarsSatsPattern5(client, _p('4y', acc)), + _5y: createBitcoinDollarsSatsPattern5(client, _p('5y', acc)), + _6m: createBitcoinDollarsSatsPattern5(client, _p('6m', acc)), + _6y: createBitcoinDollarsSatsPattern5(client, _p('6y', acc)), + _8y: createBitcoinDollarsSatsPattern5(client, _p('8y', acc)), + }; +} + +/** + * @typedef {Object} InvestedNegNetNuplSupplyUnrealizedPattern + * @property {MetricPattern1} investedCapitalInLossPct + * @property {MetricPattern1} investedCapitalInProfitPct + * @property {MetricPattern1} negUnrealizedLossRelToMarketCap + * @property {MetricPattern1} netUnrealizedPnlRelToMarketCap + * @property {MetricPattern1} nupl + * @property {MetricPattern1} supplyInLossRelToCirculatingSupply + * @property {MetricPattern1} supplyInLossRelToOwnSupply + * @property {MetricPattern1} supplyInProfitRelToCirculatingSupply + * @property {MetricPattern1} supplyInProfitRelToOwnSupply + * @property {MetricPattern4} supplyRelToCirculatingSupply + * @property {MetricPattern1} unrealizedLossRelToMarketCap + * @property {MetricPattern1} unrealizedProfitRelToMarketCap + */ + +/** + * Create a InvestedNegNetNuplSupplyUnrealizedPattern pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {InvestedNegNetNuplSupplyUnrealizedPattern} + */ +function createInvestedNegNetNuplSupplyUnrealizedPattern(client, acc) { + return { + investedCapitalInLossPct: createMetricPattern1(client, _m(acc, 'invested_capital_in_loss_pct')), + investedCapitalInProfitPct: createMetricPattern1(client, _m(acc, 'invested_capital_in_profit_pct')), + negUnrealizedLossRelToMarketCap: createMetricPattern1(client, _m(acc, 'neg_unrealized_loss_rel_to_market_cap')), + netUnrealizedPnlRelToMarketCap: createMetricPattern1(client, _m(acc, 'net_unrealized_pnl_rel_to_market_cap')), + nupl: createMetricPattern1(client, _m(acc, 'nupl')), + supplyInLossRelToCirculatingSupply: createMetricPattern1(client, _m(acc, 'supply_in_loss_rel_to_circulating_supply')), + supplyInLossRelToOwnSupply: createMetricPattern1(client, _m(acc, 'supply_in_loss_rel_to_own_supply')), + supplyInProfitRelToCirculatingSupply: createMetricPattern1(client, _m(acc, 'supply_in_profit_rel_to_circulating_supply')), + supplyInProfitRelToOwnSupply: createMetricPattern1(client, _m(acc, 'supply_in_profit_rel_to_own_supply')), + supplyRelToCirculatingSupply: createMetricPattern4(client, _m(acc, 'supply_rel_to_circulating_supply')), + unrealizedLossRelToMarketCap: createMetricPattern1(client, _m(acc, 'unrealized_loss_rel_to_market_cap')), + unrealizedProfitRelToMarketCap: createMetricPattern1(client, _m(acc, 'unrealized_profit_rel_to_market_cap')), + }; +} + +/** + * @typedef {Object} InvestedNegNetSupplyUnrealizedPattern + * @property {MetricPattern1} investedCapitalInLossPct + * @property {MetricPattern1} investedCapitalInProfitPct + * @property {MetricPattern1} negUnrealizedLossRelToOwnMarketCap + * @property {MetricPattern1} negUnrealizedLossRelToOwnTotalUnrealizedPnl + * @property {MetricPattern1} netUnrealizedPnlRelToOwnMarketCap + * @property {MetricPattern1} netUnrealizedPnlRelToOwnTotalUnrealizedPnl + * @property {MetricPattern1} supplyInLossRelToOwnSupply + * @property {MetricPattern1} supplyInProfitRelToOwnSupply + * @property {MetricPattern1} unrealizedLossRelToOwnMarketCap + * @property {MetricPattern1} unrealizedLossRelToOwnTotalUnrealizedPnl + * @property {MetricPattern1} unrealizedProfitRelToOwnMarketCap + * @property {MetricPattern1} unrealizedProfitRelToOwnTotalUnrealizedPnl + */ + +/** + * Create a InvestedNegNetSupplyUnrealizedPattern pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {InvestedNegNetSupplyUnrealizedPattern} + */ +function createInvestedNegNetSupplyUnrealizedPattern(client, acc) { + return { + investedCapitalInLossPct: createMetricPattern1(client, _m(acc, 'invested_capital_in_loss_pct')), + investedCapitalInProfitPct: createMetricPattern1(client, _m(acc, 'invested_capital_in_profit_pct')), + negUnrealizedLossRelToOwnMarketCap: createMetricPattern1(client, _m(acc, 'neg_unrealized_loss_rel_to_own_market_cap')), + negUnrealizedLossRelToOwnTotalUnrealizedPnl: createMetricPattern1(client, _m(acc, 'neg_unrealized_loss_rel_to_own_total_unrealized_pnl')), + netUnrealizedPnlRelToOwnMarketCap: createMetricPattern1(client, _m(acc, 'net_unrealized_pnl_rel_to_own_market_cap')), + netUnrealizedPnlRelToOwnTotalUnrealizedPnl: createMetricPattern1(client, _m(acc, 'net_unrealized_pnl_rel_to_own_total_unrealized_pnl')), + supplyInLossRelToOwnSupply: createMetricPattern1(client, _m(acc, 'supply_in_loss_rel_to_own_supply')), + supplyInProfitRelToOwnSupply: createMetricPattern1(client, _m(acc, 'supply_in_profit_rel_to_own_supply')), + unrealizedLossRelToOwnMarketCap: createMetricPattern1(client, _m(acc, 'unrealized_loss_rel_to_own_market_cap')), + unrealizedLossRelToOwnTotalUnrealizedPnl: createMetricPattern1(client, _m(acc, 'unrealized_loss_rel_to_own_total_unrealized_pnl')), + unrealizedProfitRelToOwnMarketCap: createMetricPattern1(client, _m(acc, 'unrealized_profit_rel_to_own_market_cap')), + unrealizedProfitRelToOwnTotalUnrealizedPnl: createMetricPattern1(client, _m(acc, 'unrealized_profit_rel_to_own_total_unrealized_pnl')), }; } /** * @template T - * @typedef {Object} PeriodDaysInLossPattern + * @typedef {Object} _10y1m1w1y2y3m3y4y5y6m6y8yPattern2 * @property {MetricPattern4} _10y * @property {MetricPattern4} _1m * @property {MetricPattern4} _1w @@ -2022,13 +2276,13 @@ function createPeriodLumpSumStackPattern(client, acc) { */ /** - * Create a PeriodDaysInLossPattern pattern node + * Create a _10y1m1w1y2y3m3y4y5y6m6y8yPattern2 pattern node * @template T * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {PeriodDaysInLossPattern} + * @returns {_10y1m1w1y2y3m3y4y5y6m6y8yPattern2} */ -function createPeriodDaysInLossPattern(client, acc) { +function create_10y1m1w1y2y3m3y4y5y6m6y8yPattern2(client, acc) { return { _10y: createMetricPattern4(client, _p('10y', acc)), _1m: createMetricPattern4(client, _p('1m', acc)), @@ -2047,7 +2301,7 @@ function createPeriodDaysInLossPattern(client, acc) { /** * @template T - * @typedef {Object} ClassDaysInLossPattern + * @typedef {Object} _201520162017201820192020202120222023202420252026Pattern2 * @property {MetricPattern4} _2015 * @property {MetricPattern4} _2016 * @property {MetricPattern4} _2017 @@ -2063,13 +2317,13 @@ function createPeriodDaysInLossPattern(client, acc) { */ /** - * Create a ClassDaysInLossPattern pattern node + * Create a _201520162017201820192020202120222023202420252026Pattern2 pattern node * @template T * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {ClassDaysInLossPattern} + * @returns {_201520162017201820192020202120222023202420252026Pattern2} */ -function createClassDaysInLossPattern(client, acc) { +function create_201520162017201820192020202120222023202420252026Pattern2(client, acc) { return { _2015: createMetricPattern4(client, _m(acc, '2015_returns')), _2016: createMetricPattern4(client, _m(acc, '2016_returns')), @@ -2087,7 +2341,7 @@ function createClassDaysInLossPattern(client, acc) { } /** - * @typedef {Object} BitcoinPattern + * @typedef {Object} AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern * @property {MetricPattern2} average * @property {MetricPattern11} base * @property {MetricPattern2} cumulative @@ -2102,12 +2356,12 @@ function createClassDaysInLossPattern(client, acc) { */ /** - * Create a BitcoinPattern pattern node + * Create a AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {BitcoinPattern} + * @returns {AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern} */ -function createBitcoinPattern(client, acc) { +function createAverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern(client, acc) { return { average: createMetricPattern2(client, _m(acc, 'average')), base: createMetricPattern11(client, acc), @@ -2125,7 +2379,7 @@ function createBitcoinPattern(client, acc) { /** * @template T - * @typedef {Object} DollarsPattern + * @typedef {Object} AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2 * @property {MetricPattern2} average * @property {MetricPattern11} base * @property {MetricPattern1} cumulative @@ -2140,13 +2394,13 @@ function createBitcoinPattern(client, acc) { */ /** - * Create a DollarsPattern pattern node + * Create a AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2 pattern node * @template T * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {DollarsPattern} + * @returns {AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} */ -function createDollarsPattern(client, acc) { +function createAverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, acc) { return { average: createMetricPattern2(client, _m(acc, 'average')), base: createMetricPattern11(client, acc), @@ -2162,79 +2416,9 @@ function createDollarsPattern(client, acc) { }; } -/** - * @typedef {Object} RelativePattern - * @property {MetricPattern1} negUnrealizedLossRelToMarketCap - * @property {MetricPattern1} netUnrealizedPnlRelToMarketCap - * @property {MetricPattern1} nupl - * @property {MetricPattern1} supplyInLossRelToCirculatingSupply - * @property {MetricPattern1} supplyInLossRelToOwnSupply - * @property {MetricPattern1} supplyInProfitRelToCirculatingSupply - * @property {MetricPattern1} supplyInProfitRelToOwnSupply - * @property {MetricPattern4} supplyRelToCirculatingSupply - * @property {MetricPattern1} unrealizedLossRelToMarketCap - * @property {MetricPattern1} unrealizedProfitRelToMarketCap - */ - -/** - * Create a RelativePattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {RelativePattern} - */ -function createRelativePattern(client, acc) { - return { - negUnrealizedLossRelToMarketCap: createMetricPattern1(client, _m(acc, 'neg_unrealized_loss_rel_to_market_cap')), - netUnrealizedPnlRelToMarketCap: createMetricPattern1(client, _m(acc, 'net_unrealized_pnl_rel_to_market_cap')), - nupl: createMetricPattern1(client, _m(acc, 'nupl')), - supplyInLossRelToCirculatingSupply: createMetricPattern1(client, _m(acc, 'supply_in_loss_rel_to_circulating_supply')), - supplyInLossRelToOwnSupply: createMetricPattern1(client, _m(acc, 'supply_in_loss_rel_to_own_supply')), - supplyInProfitRelToCirculatingSupply: createMetricPattern1(client, _m(acc, 'supply_in_profit_rel_to_circulating_supply')), - supplyInProfitRelToOwnSupply: createMetricPattern1(client, _m(acc, 'supply_in_profit_rel_to_own_supply')), - supplyRelToCirculatingSupply: createMetricPattern4(client, _m(acc, 'supply_rel_to_circulating_supply')), - unrealizedLossRelToMarketCap: createMetricPattern1(client, _m(acc, 'unrealized_loss_rel_to_market_cap')), - unrealizedProfitRelToMarketCap: createMetricPattern1(client, _m(acc, 'unrealized_profit_rel_to_market_cap')), - }; -} - -/** - * @typedef {Object} RelativePattern2 - * @property {MetricPattern1} negUnrealizedLossRelToOwnMarketCap - * @property {MetricPattern1} negUnrealizedLossRelToOwnTotalUnrealizedPnl - * @property {MetricPattern1} netUnrealizedPnlRelToOwnMarketCap - * @property {MetricPattern1} netUnrealizedPnlRelToOwnTotalUnrealizedPnl - * @property {MetricPattern1} supplyInLossRelToOwnSupply - * @property {MetricPattern1} supplyInProfitRelToOwnSupply - * @property {MetricPattern1} unrealizedLossRelToOwnMarketCap - * @property {MetricPattern1} unrealizedLossRelToOwnTotalUnrealizedPnl - * @property {MetricPattern1} unrealizedProfitRelToOwnMarketCap - * @property {MetricPattern1} unrealizedProfitRelToOwnTotalUnrealizedPnl - */ - -/** - * Create a RelativePattern2 pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {RelativePattern2} - */ -function createRelativePattern2(client, acc) { - return { - negUnrealizedLossRelToOwnMarketCap: createMetricPattern1(client, _m(acc, 'neg_unrealized_loss_rel_to_own_market_cap')), - negUnrealizedLossRelToOwnTotalUnrealizedPnl: createMetricPattern1(client, _m(acc, 'neg_unrealized_loss_rel_to_own_total_unrealized_pnl')), - netUnrealizedPnlRelToOwnMarketCap: createMetricPattern1(client, _m(acc, 'net_unrealized_pnl_rel_to_own_market_cap')), - netUnrealizedPnlRelToOwnTotalUnrealizedPnl: createMetricPattern1(client, _m(acc, 'net_unrealized_pnl_rel_to_own_total_unrealized_pnl')), - supplyInLossRelToOwnSupply: createMetricPattern1(client, _m(acc, 'supply_in_loss_rel_to_own_supply')), - supplyInProfitRelToOwnSupply: createMetricPattern1(client, _m(acc, 'supply_in_profit_rel_to_own_supply')), - unrealizedLossRelToOwnMarketCap: createMetricPattern1(client, _m(acc, 'unrealized_loss_rel_to_own_market_cap')), - unrealizedLossRelToOwnTotalUnrealizedPnl: createMetricPattern1(client, _m(acc, 'unrealized_loss_rel_to_own_total_unrealized_pnl')), - unrealizedProfitRelToOwnMarketCap: createMetricPattern1(client, _m(acc, 'unrealized_profit_rel_to_own_market_cap')), - unrealizedProfitRelToOwnTotalUnrealizedPnl: createMetricPattern1(client, _m(acc, 'unrealized_profit_rel_to_own_total_unrealized_pnl')), - }; -} - /** * @template T - * @typedef {Object} CountPattern2 + * @typedef {Object} AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2 * @property {MetricPattern1} average * @property {MetricPattern1} cumulative * @property {MetricPattern1} max @@ -2248,13 +2432,13 @@ function createRelativePattern2(client, acc) { */ /** - * Create a CountPattern2 pattern node + * Create a AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2 pattern node * @template T * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {CountPattern2} + * @returns {AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} */ -function createCountPattern2(client, acc) { +function createAverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, acc) { return { average: createMetricPattern1(client, _m(acc, 'average')), cumulative: createMetricPattern1(client, _m(acc, 'cumulative')), @@ -2270,7 +2454,7 @@ function createCountPattern2(client, acc) { } /** - * @typedef {Object} AddrCountPattern + * @typedef {Object} AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern * @property {MetricPattern1} all * @property {MetricPattern1} p2a * @property {MetricPattern1} p2pk33 @@ -2283,12 +2467,12 @@ function createCountPattern2(client, acc) { */ /** - * Create a AddrCountPattern pattern node + * Create a AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {AddrCountPattern} + * @returns {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern} */ -function createAddrCountPattern(client, acc) { +function createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern(client, acc) { return { all: createMetricPattern1(client, acc), p2a: createMetricPattern1(client, _p('p2a', acc)), @@ -2304,7 +2488,7 @@ function createAddrCountPattern(client, acc) { /** * @template T - * @typedef {Object} FeeRatePattern + * @typedef {Object} AverageMaxMedianMinPct10Pct25Pct75Pct90TxindexPattern * @property {MetricPattern1} average * @property {MetricPattern1} max * @property {MetricPattern11} median @@ -2317,13 +2501,13 @@ function createAddrCountPattern(client, acc) { */ /** - * Create a FeeRatePattern pattern node + * Create a AverageMaxMedianMinPct10Pct25Pct75Pct90TxindexPattern pattern node * @template T * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {FeeRatePattern} + * @returns {AverageMaxMedianMinPct10Pct25Pct75Pct90TxindexPattern} */ -function createFeeRatePattern(client, acc) { +function createAverageMaxMedianMinPct10Pct25Pct75Pct90TxindexPattern(client, acc) { return { average: createMetricPattern1(client, _m(acc, 'average')), max: createMetricPattern1(client, _m(acc, 'max')), @@ -2339,7 +2523,7 @@ function createFeeRatePattern(client, acc) { /** * @template T - * @typedef {Object} FullnessPattern + * @typedef {Object} AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern * @property {MetricPattern2} average * @property {MetricPattern11} base * @property {MetricPattern2} max @@ -2352,13 +2536,13 @@ function createFeeRatePattern(client, acc) { */ /** - * Create a FullnessPattern pattern node + * Create a AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern pattern node * @template T * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {FullnessPattern} + * @returns {AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern} */ -function createFullnessPattern(client, acc) { +function createAverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, acc) { return { average: createMetricPattern2(client, _m(acc, 'average')), base: createMetricPattern11(client, acc), @@ -2373,38 +2557,38 @@ function createFullnessPattern(client, acc) { } /** - * @typedef {Object} _0satsPattern - * @property {ActivityPattern2} activity + * @typedef {Object} ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern + * @property {CoinblocksCoindaysSatblocksSatdaysSentPattern} activity * @property {MetricPattern1} addrCount - * @property {CostBasisPattern} costBasis - * @property {OutputsPattern} outputs - * @property {RealizedPattern} realized - * @property {RelativePattern} relative - * @property {SupplyPattern2} supply - * @property {UnrealizedPattern} unrealized + * @property {MaxMinPattern} costBasis + * @property {UtxoPattern} outputs + * @property {AthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern} realized + * @property {InvestedNegNetNuplSupplyUnrealizedPattern} relative + * @property {HalvedTotalPattern} supply + * @property {AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern} unrealized */ /** - * Create a _0satsPattern pattern node + * Create a ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {_0satsPattern} + * @returns {ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern} */ -function create_0satsPattern(client, acc) { +function createActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, acc) { return { - activity: createActivityPattern2(client, acc), + activity: createCoinblocksCoindaysSatblocksSatdaysSentPattern(client, acc), addrCount: createMetricPattern1(client, _m(acc, 'addr_count')), - costBasis: createCostBasisPattern(client, acc), - outputs: createOutputsPattern(client, _m(acc, 'utxo_count')), - realized: createRealizedPattern(client, acc), - relative: createRelativePattern(client, acc), - supply: createSupplyPattern2(client, _m(acc, 'supply')), - unrealized: createUnrealizedPattern(client, acc), + costBasis: createMaxMinPattern(client, acc), + outputs: createUtxoPattern(client, _m(acc, 'utxo_count')), + realized: createAthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern(client, acc), + relative: createInvestedNegNetNuplSupplyUnrealizedPattern(client, acc), + supply: createHalvedTotalPattern(client, _m(acc, 'supply')), + unrealized: createAthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern(client, acc), }; } /** - * @typedef {Object} PeriodCagrPattern + * @typedef {Object} _10y2y3y4y5y6y8yPattern * @property {MetricPattern4} _10y * @property {MetricPattern4} _2y * @property {MetricPattern4} _3y @@ -2415,12 +2599,12 @@ function create_0satsPattern(client, acc) { */ /** - * Create a PeriodCagrPattern pattern node + * Create a _10y2y3y4y5y6y8yPattern pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {PeriodCagrPattern} + * @returns {_10y2y3y4y5y6y8yPattern} */ -function createPeriodCagrPattern(client, acc) { +function create_10y2y3y4y5y6y8yPattern(client, acc) { return { _10y: createMetricPattern4(client, _p('10y', acc)), _2y: createMetricPattern4(client, _p('2y', acc)), @@ -2433,205 +2617,253 @@ function createPeriodCagrPattern(client, acc) { } /** - * @typedef {Object} _100btcPattern - * @property {ActivityPattern2} activity - * @property {CostBasisPattern} costBasis - * @property {OutputsPattern} outputs - * @property {RealizedPattern} realized - * @property {RelativePattern} relative - * @property {SupplyPattern2} supply - * @property {UnrealizedPattern} unrealized + * @typedef {Object} ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern + * @property {CoinblocksCoindaysSatblocksSatdaysSentPattern} activity + * @property {InvestedMaxMinPercentilesSpotPattern} costBasis + * @property {UtxoPattern} outputs + * @property {AthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern2} realized + * @property {InvestedNegNetSupplyUnrealizedPattern} relative + * @property {HalvedTotalPattern} supply + * @property {AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern} unrealized */ /** - * Create a _100btcPattern pattern node + * Create a ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {_100btcPattern} + * @returns {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern} */ -function create_100btcPattern(client, acc) { +function createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, acc) { return { - activity: createActivityPattern2(client, acc), - costBasis: createCostBasisPattern(client, acc), - outputs: createOutputsPattern(client, _m(acc, 'utxo_count')), - realized: createRealizedPattern(client, acc), - relative: createRelativePattern(client, acc), - supply: createSupplyPattern2(client, _m(acc, 'supply')), - unrealized: createUnrealizedPattern(client, acc), + activity: createCoinblocksCoindaysSatblocksSatdaysSentPattern(client, acc), + costBasis: createInvestedMaxMinPercentilesSpotPattern(client, acc), + outputs: createUtxoPattern(client, _m(acc, 'utxo_count')), + realized: createAthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern2(client, acc), + relative: createInvestedNegNetSupplyUnrealizedPattern(client, acc), + supply: createHalvedTotalPattern(client, _m(acc, 'supply')), + unrealized: createAthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern(client, acc), }; } /** - * @typedef {Object} _0satsPattern2 - * @property {ActivityPattern2} activity - * @property {CostBasisPattern} costBasis - * @property {OutputsPattern} outputs - * @property {RealizedPattern} realized - * @property {RelativePattern4} relative - * @property {SupplyPattern2} supply - * @property {UnrealizedPattern} unrealized + * @typedef {Object} ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5 + * @property {CoinblocksCoindaysSatblocksSatdaysSentPattern} activity + * @property {MaxMinPattern} costBasis + * @property {UtxoPattern} outputs + * @property {AdjustedAthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern2} realized + * @property {InvestedNegNetNuplSupplyUnrealizedPattern} relative + * @property {HalvedTotalPattern} supply + * @property {AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern} unrealized */ /** - * Create a _0satsPattern2 pattern node + * Create a ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5 pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {_0satsPattern2} + * @returns {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5} */ -function create_0satsPattern2(client, acc) { +function createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5(client, acc) { return { - activity: createActivityPattern2(client, acc), - costBasis: createCostBasisPattern(client, acc), - outputs: createOutputsPattern(client, _m(acc, 'utxo_count')), - realized: createRealizedPattern(client, acc), - relative: createRelativePattern4(client, _m(acc, 'supply_in')), - supply: createSupplyPattern2(client, _m(acc, 'supply')), - unrealized: createUnrealizedPattern(client, acc), + activity: createCoinblocksCoindaysSatblocksSatdaysSentPattern(client, acc), + costBasis: createMaxMinPattern(client, acc), + outputs: createUtxoPattern(client, _m(acc, 'utxo_count')), + realized: createAdjustedAthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern2(client, acc), + relative: createInvestedNegNetNuplSupplyUnrealizedPattern(client, acc), + supply: createHalvedTotalPattern(client, _m(acc, 'supply')), + unrealized: createAthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern(client, acc), }; } /** - * @typedef {Object} _10yPattern - * @property {ActivityPattern2} activity - * @property {CostBasisPattern} costBasis - * @property {OutputsPattern} outputs - * @property {RealizedPattern4} realized - * @property {RelativePattern} relative - * @property {SupplyPattern2} supply - * @property {UnrealizedPattern} unrealized + * @typedef {Object} ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 + * @property {CoinblocksCoindaysSatblocksSatdaysSentPattern} activity + * @property {MaxMinPattern} costBasis + * @property {UtxoPattern} outputs + * @property {AthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern} realized + * @property {InvestedNegNetNuplSupplyUnrealizedPattern} relative + * @property {HalvedTotalPattern} supply + * @property {AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern} unrealized */ /** - * Create a _10yPattern pattern node + * Create a ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {_10yPattern} + * @returns {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} */ -function create_10yPattern(client, acc) { +function createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, acc) { return { - activity: createActivityPattern2(client, acc), - costBasis: createCostBasisPattern(client, acc), - outputs: createOutputsPattern(client, _m(acc, 'utxo_count')), - realized: createRealizedPattern4(client, acc), - relative: createRelativePattern(client, acc), - supply: createSupplyPattern2(client, _m(acc, 'supply')), - unrealized: createUnrealizedPattern(client, acc), + activity: createCoinblocksCoindaysSatblocksSatdaysSentPattern(client, acc), + costBasis: createMaxMinPattern(client, acc), + outputs: createUtxoPattern(client, _m(acc, 'utxo_count')), + realized: createAthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern(client, acc), + relative: createInvestedNegNetNuplSupplyUnrealizedPattern(client, acc), + supply: createHalvedTotalPattern(client, _m(acc, 'supply')), + unrealized: createAthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern(client, acc), }; } /** - * @typedef {Object} _10yTo12yPattern - * @property {ActivityPattern2} activity - * @property {CostBasisPattern2} costBasis - * @property {OutputsPattern} outputs - * @property {RealizedPattern2} realized - * @property {RelativePattern2} relative - * @property {SupplyPattern2} supply - * @property {UnrealizedPattern} unrealized + * @typedef {Object} ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 + * @property {CoinblocksCoindaysSatblocksSatdaysSentPattern} activity + * @property {MaxMinPattern} costBasis + * @property {UtxoPattern} outputs + * @property {AthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern} realized + * @property {InvestedSupplyPattern} relative + * @property {HalvedTotalPattern} supply + * @property {AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern} unrealized */ /** - * Create a _10yTo12yPattern pattern node + * Create a ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {_10yTo12yPattern} + * @returns {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} */ -function create_10yTo12yPattern(client, acc) { +function createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, acc) { return { - activity: createActivityPattern2(client, acc), - costBasis: createCostBasisPattern2(client, acc), - outputs: createOutputsPattern(client, _m(acc, 'utxo_count')), - realized: createRealizedPattern2(client, acc), - relative: createRelativePattern2(client, acc), - supply: createSupplyPattern2(client, _m(acc, 'supply')), - unrealized: createUnrealizedPattern(client, acc), + activity: createCoinblocksCoindaysSatblocksSatdaysSentPattern(client, acc), + costBasis: createMaxMinPattern(client, acc), + outputs: createUtxoPattern(client, _m(acc, 'utxo_count')), + realized: createAthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern(client, acc), + relative: createInvestedSupplyPattern(client, acc), + supply: createHalvedTotalPattern(client, _m(acc, 'supply')), + unrealized: createAthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern(client, acc), }; } /** - * @typedef {Object} UnrealizedPattern - * @property {MetricPattern1} negUnrealizedLoss - * @property {MetricPattern1} netUnrealizedPnl - * @property {ActiveSupplyPattern} supplyInLoss - * @property {ActiveSupplyPattern} supplyInProfit - * @property {MetricPattern1} totalUnrealizedPnl - * @property {MetricPattern1} unrealizedLoss - * @property {MetricPattern1} unrealizedProfit + * @typedef {Object} ActivityCostOutputsRealizedSupplyUnrealizedPattern + * @property {CoinblocksCoindaysSatblocksSatdaysSentPattern} activity + * @property {MaxMinPattern} costBasis + * @property {UtxoPattern} outputs + * @property {AthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern} realized + * @property {HalvedTotalPattern} supply + * @property {AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern} unrealized */ /** - * Create a UnrealizedPattern pattern node + * Create a ActivityCostOutputsRealizedSupplyUnrealizedPattern pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {UnrealizedPattern} + * @returns {ActivityCostOutputsRealizedSupplyUnrealizedPattern} */ -function createUnrealizedPattern(client, acc) { +function createActivityCostOutputsRealizedSupplyUnrealizedPattern(client, acc) { return { - negUnrealizedLoss: createMetricPattern1(client, _m(acc, 'neg_unrealized_loss')), - netUnrealizedPnl: createMetricPattern1(client, _m(acc, 'net_unrealized_pnl')), - supplyInLoss: createActiveSupplyPattern(client, _m(acc, 'supply_in_loss')), - supplyInProfit: createActiveSupplyPattern(client, _m(acc, 'supply_in_profit')), - totalUnrealizedPnl: createMetricPattern1(client, _m(acc, 'total_unrealized_pnl')), - unrealizedLoss: createMetricPattern1(client, _m(acc, 'unrealized_loss')), - unrealizedProfit: createMetricPattern1(client, _m(acc, 'unrealized_profit')), + activity: createCoinblocksCoindaysSatblocksSatdaysSentPattern(client, acc), + costBasis: createMaxMinPattern(client, acc), + outputs: createUtxoPattern(client, _m(acc, 'utxo_count')), + realized: createAthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern(client, acc), + supply: createHalvedTotalPattern(client, _m(acc, 'supply')), + unrealized: createAthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern(client, acc), }; } /** - * @typedef {Object} AllPattern - * @property {FullnessPattern} balanceDecreased - * @property {FullnessPattern} balanceIncreased - * @property {FullnessPattern} both - * @property {FullnessPattern} reactivated - * @property {FullnessPattern} receiving - * @property {FullnessPattern} sending + * @typedef {Object} BalanceBothReactivatedReceivingSendingPattern + * @property {AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern} balanceDecreased + * @property {AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern} balanceIncreased + * @property {AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern} both + * @property {AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern} reactivated + * @property {AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern} receiving + * @property {AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern} sending */ /** - * Create a AllPattern pattern node + * Create a BalanceBothReactivatedReceivingSendingPattern pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {AllPattern} + * @returns {BalanceBothReactivatedReceivingSendingPattern} */ -function createAllPattern(client, acc) { +function createBalanceBothReactivatedReceivingSendingPattern(client, acc) { return { - balanceDecreased: createFullnessPattern(client, _m(acc, 'balance_decreased')), - balanceIncreased: createFullnessPattern(client, _m(acc, 'balance_increased')), - both: createFullnessPattern(client, _m(acc, 'both')), - reactivated: createFullnessPattern(client, _m(acc, 'reactivated')), - receiving: createFullnessPattern(client, _m(acc, 'receiving')), - sending: createFullnessPattern(client, _m(acc, 'sending')), + balanceDecreased: createAverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, _m(acc, 'balance_decreased')), + balanceIncreased: createAverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, _m(acc, 'balance_increased')), + both: createAverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, _m(acc, 'both')), + reactivated: createAverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, _m(acc, 'reactivated')), + receiving: createAverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, _m(acc, 'receiving')), + sending: createAverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, _m(acc, 'sending')), }; } /** - * @typedef {Object} ActivityPattern2 - * @property {BlockCountPattern} coinblocksDestroyed - * @property {BlockCountPattern} coindaysDestroyed + * @typedef {Object} InvestedMaxMinPercentilesSpotPattern + * @property {Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern} investedCapital + * @property {DollarsSatsPattern} max + * @property {DollarsSatsPattern} min + * @property {Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern} percentiles + * @property {MetricPattern4} spotCostBasisPercentile + * @property {MetricPattern4} spotInvestedCapitalPercentile + */ + +/** + * Create a InvestedMaxMinPercentilesSpotPattern pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {InvestedMaxMinPercentilesSpotPattern} + */ +function createInvestedMaxMinPercentilesSpotPattern(client, acc) { + return { + investedCapital: createPct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern(client, _m(acc, 'invested_capital')), + max: createDollarsSatsPattern(client, _m(acc, 'max_cost_basis')), + min: createDollarsSatsPattern(client, _m(acc, 'min_cost_basis')), + percentiles: createPct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern(client, _m(acc, 'cost_basis')), + spotCostBasisPercentile: createMetricPattern4(client, _m(acc, 'spot_cost_basis_percentile')), + spotInvestedCapitalPercentile: createMetricPattern4(client, _m(acc, 'spot_invested_capital_percentile')), + }; +} + +/** + * @typedef {Object} CoinblocksCoindaysSatblocksSatdaysSentPattern + * @property {CumulativeSumPattern} coinblocksDestroyed + * @property {CumulativeSumPattern} coindaysDestroyed * @property {MetricPattern11} satblocksDestroyed * @property {MetricPattern11} satdaysDestroyed - * @property {UnclaimedRewardsPattern} sent + * @property {BitcoinDollarsSatsPattern3} sent */ /** - * Create a ActivityPattern2 pattern node + * Create a CoinblocksCoindaysSatblocksSatdaysSentPattern pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {ActivityPattern2} + * @returns {CoinblocksCoindaysSatblocksSatdaysSentPattern} */ -function createActivityPattern2(client, acc) { +function createCoinblocksCoindaysSatblocksSatdaysSentPattern(client, acc) { return { - coinblocksDestroyed: createBlockCountPattern(client, _m(acc, 'coinblocks_destroyed')), - coindaysDestroyed: createBlockCountPattern(client, _m(acc, 'coindays_destroyed')), + coinblocksDestroyed: createCumulativeSumPattern(client, _m(acc, 'coinblocks_destroyed')), + coindaysDestroyed: createCumulativeSumPattern(client, _m(acc, 'coindays_destroyed')), satblocksDestroyed: createMetricPattern11(client, _m(acc, 'satblocks_destroyed')), satdaysDestroyed: createMetricPattern11(client, _m(acc, 'satdays_destroyed')), - sent: createUnclaimedRewardsPattern(client, _m(acc, 'sent')), + sent: createBitcoinDollarsSatsPattern3(client, _m(acc, 'sent')), + }; +} + +/** + * @typedef {Object} InvestedSupplyPattern + * @property {MetricPattern1} investedCapitalInLossPct + * @property {MetricPattern1} investedCapitalInProfitPct + * @property {MetricPattern1} supplyInLossRelToOwnSupply + * @property {MetricPattern1} supplyInProfitRelToOwnSupply + */ + +/** + * Create a InvestedSupplyPattern pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {InvestedSupplyPattern} + */ +function createInvestedSupplyPattern(client, acc) { + return { + investedCapitalInLossPct: createMetricPattern1(client, _m(acc, 'invested_capital_in_loss_pct')), + investedCapitalInProfitPct: createMetricPattern1(client, _m(acc, 'invested_capital_in_profit_pct')), + supplyInLossRelToOwnSupply: createMetricPattern1(client, _m(acc, 'supply_in_loss_rel_to_own_supply')), + supplyInProfitRelToOwnSupply: createMetricPattern1(client, _m(acc, 'supply_in_profit_rel_to_own_supply')), }; } /** * @template T - * @typedef {Object} SplitPattern2 + * @typedef {Object} CloseHighLowOpenPattern2 * @property {MetricPattern1} close * @property {MetricPattern1} high * @property {MetricPattern1} low @@ -2639,13 +2871,13 @@ function createActivityPattern2(client, acc) { */ /** - * Create a SplitPattern2 pattern node + * Create a CloseHighLowOpenPattern2 pattern node * @template T * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {SplitPattern2} + * @returns {CloseHighLowOpenPattern2} */ -function createSplitPattern2(client, acc) { +function createCloseHighLowOpenPattern2(client, acc) { return { close: createMetricPattern1(client, _m(acc, 'close')), high: createMetricPattern1(client, _m(acc, 'high')), @@ -2655,19 +2887,19 @@ function createSplitPattern2(client, acc) { } /** - * @typedef {Object} SegwitAdoptionPattern + * @typedef {Object} BaseCumulativeSumPattern * @property {MetricPattern11} base * @property {MetricPattern2} cumulative * @property {MetricPattern2} sum */ /** - * Create a SegwitAdoptionPattern pattern node + * Create a BaseCumulativeSumPattern pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {SegwitAdoptionPattern} + * @returns {BaseCumulativeSumPattern} */ -function createSegwitAdoptionPattern(client, acc) { +function createBaseCumulativeSumPattern(client, acc) { return { base: createMetricPattern11(client, acc), cumulative: createMetricPattern2(client, _m(acc, 'cumulative')), @@ -2676,19 +2908,40 @@ function createSegwitAdoptionPattern(client, acc) { } /** - * @typedef {Object} ActiveSupplyPattern + * @typedef {Object} BitcoinDollarsSatsPattern2 + * @property {AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern} bitcoin + * @property {AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} dollars + * @property {AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} sats + */ + +/** + * Create a BitcoinDollarsSatsPattern2 pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {BitcoinDollarsSatsPattern2} + */ +function createBitcoinDollarsSatsPattern2(client, acc) { + return { + bitcoin: createAverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern(client, _m(acc, 'btc')), + dollars: createAverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, _m(acc, 'usd')), + sats: createAverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, acc), + }; +} + +/** + * @typedef {Object} BitcoinDollarsSatsPattern4 * @property {MetricPattern1} bitcoin * @property {MetricPattern1} dollars * @property {MetricPattern1} sats */ /** - * Create a ActiveSupplyPattern pattern node + * Create a BitcoinDollarsSatsPattern4 pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {ActiveSupplyPattern} + * @returns {BitcoinDollarsSatsPattern4} */ -function createActiveSupplyPattern(client, acc) { +function createBitcoinDollarsSatsPattern4(client, acc) { return { bitcoin: createMetricPattern1(client, _m(acc, 'btc')), dollars: createMetricPattern1(client, _m(acc, 'usd')), @@ -2697,19 +2950,19 @@ function createActiveSupplyPattern(client, acc) { } /** - * @typedef {Object} _2015Pattern + * @typedef {Object} BitcoinDollarsSatsPattern5 * @property {MetricPattern4} bitcoin * @property {MetricPattern4} dollars * @property {MetricPattern4} sats */ /** - * Create a _2015Pattern pattern node + * Create a BitcoinDollarsSatsPattern5 pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {_2015Pattern} + * @returns {BitcoinDollarsSatsPattern5} */ -function create_2015Pattern(client, acc) { +function createBitcoinDollarsSatsPattern5(client, acc) { return { bitcoin: createMetricPattern4(client, _m(acc, 'btc')), dollars: createMetricPattern4(client, _m(acc, 'usd')), @@ -2718,102 +2971,60 @@ function create_2015Pattern(client, acc) { } /** - * @typedef {Object} CoinbasePattern - * @property {BitcoinPattern} bitcoin - * @property {DollarsPattern} dollars - * @property {DollarsPattern} sats + * @typedef {Object} BitcoinDollarsSatsPattern6 + * @property {CumulativeSumPattern} bitcoin + * @property {CumulativeSumPattern} dollars + * @property {CumulativeSumPattern} sats */ /** - * Create a CoinbasePattern pattern node + * Create a BitcoinDollarsSatsPattern6 pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {CoinbasePattern} + * @returns {BitcoinDollarsSatsPattern6} */ -function createCoinbasePattern(client, acc) { +function createBitcoinDollarsSatsPattern6(client, acc) { return { - bitcoin: createBitcoinPattern(client, _m(acc, 'btc')), - dollars: createDollarsPattern(client, _m(acc, 'usd')), - sats: createDollarsPattern(client, acc), + bitcoin: createCumulativeSumPattern(client, _m(acc, 'btc')), + dollars: createCumulativeSumPattern(client, _m(acc, 'usd')), + sats: createCumulativeSumPattern(client, acc), }; } /** - * @typedef {Object} UnclaimedRewardsPattern - * @property {BitcoinPattern2} bitcoin - * @property {BlockCountPattern} dollars - * @property {BlockCountPattern} sats + * @typedef {Object} BitcoinDollarsSatsPattern3 + * @property {CumulativeSumPattern2} bitcoin + * @property {CumulativeSumPattern} dollars + * @property {CumulativeSumPattern} sats */ /** - * Create a UnclaimedRewardsPattern pattern node + * Create a BitcoinDollarsSatsPattern3 pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {UnclaimedRewardsPattern} + * @returns {BitcoinDollarsSatsPattern3} */ -function createUnclaimedRewardsPattern(client, acc) { +function createBitcoinDollarsSatsPattern3(client, acc) { return { - bitcoin: createBitcoinPattern2(client, _m(acc, 'btc')), - dollars: createBlockCountPattern(client, _m(acc, 'usd')), - sats: createBlockCountPattern(client, acc), + bitcoin: createCumulativeSumPattern2(client, _m(acc, 'btc')), + dollars: createCumulativeSumPattern(client, _m(acc, 'usd')), + sats: createCumulativeSumPattern(client, acc), }; } /** - * @typedef {Object} CoinbasePattern2 - * @property {BlockCountPattern} bitcoin - * @property {BlockCountPattern} dollars - * @property {BlockCountPattern} sats - */ - -/** - * Create a CoinbasePattern2 pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {CoinbasePattern2} - */ -function createCoinbasePattern2(client, acc) { - return { - bitcoin: createBlockCountPattern(client, _m(acc, 'btc')), - dollars: createBlockCountPattern(client, _m(acc, 'usd')), - sats: createBlockCountPattern(client, acc), - }; -} - -/** - * @typedef {Object} CostBasisPattern2 - * @property {ActivePricePattern} max - * @property {ActivePricePattern} min - * @property {PercentilesPattern} percentiles - */ - -/** - * Create a CostBasisPattern2 pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {CostBasisPattern2} - */ -function createCostBasisPattern2(client, acc) { - return { - max: createActivePricePattern(client, _m(acc, 'max_cost_basis')), - min: createActivePricePattern(client, _m(acc, 'min_cost_basis')), - percentiles: createPercentilesPattern(client, _m(acc, 'cost_basis')), - }; -} - -/** - * @typedef {Object} ActivePricePattern + * @typedef {Object} DollarsSatsPattern * @property {MetricPattern1} dollars * @property {MetricPattern1} sats */ /** - * Create a ActivePricePattern pattern node + * Create a DollarsSatsPattern pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {ActivePricePattern} + * @returns {DollarsSatsPattern} */ -function createActivePricePattern(client, acc) { +function createDollarsSatsPattern(client, acc) { return { dollars: createMetricPattern1(client, acc), sats: createMetricPattern1(client, _m(acc, 'sats')), @@ -2821,18 +3032,18 @@ function createActivePricePattern(client, acc) { } /** - * @typedef {Object} _0sdUsdPattern + * @typedef {Object} DollarsSatsPattern2 * @property {MetricPattern4} dollars * @property {MetricPattern4} sats */ /** - * Create a _0sdUsdPattern pattern node + * Create a DollarsSatsPattern2 pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {_0sdUsdPattern} + * @returns {DollarsSatsPattern2} */ -function create_0sdUsdPattern(client, acc) { +function createDollarsSatsPattern2(client, acc) { return { dollars: createMetricPattern4(client, acc), sats: createMetricPattern4(client, _m(acc, 'sats')), @@ -2840,96 +3051,77 @@ function create_0sdUsdPattern(client, acc) { } /** - * @typedef {Object} SupplyPattern2 - * @property {ActiveSupplyPattern} halved - * @property {ActiveSupplyPattern} total + * @typedef {Object} HalvedTotalPattern + * @property {BitcoinDollarsSatsPattern4} halved + * @property {BitcoinDollarsSatsPattern4} total */ /** - * Create a SupplyPattern2 pattern node + * Create a HalvedTotalPattern pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {SupplyPattern2} + * @returns {HalvedTotalPattern} */ -function createSupplyPattern2(client, acc) { +function createHalvedTotalPattern(client, acc) { return { - halved: createActiveSupplyPattern(client, _m(acc, 'halved')), - total: createActiveSupplyPattern(client, acc), + halved: createBitcoinDollarsSatsPattern4(client, _m(acc, 'halved')), + total: createBitcoinDollarsSatsPattern4(client, acc), }; } /** - * @typedef {Object} CostBasisPattern - * @property {ActivePricePattern} max - * @property {ActivePricePattern} min + * @typedef {Object} MaxMinPattern + * @property {DollarsSatsPattern} max + * @property {DollarsSatsPattern} min */ /** - * Create a CostBasisPattern pattern node + * Create a MaxMinPattern pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {CostBasisPattern} + * @returns {MaxMinPattern} */ -function createCostBasisPattern(client, acc) { +function createMaxMinPattern(client, acc) { return { - max: createActivePricePattern(client, _m(acc, 'max_cost_basis')), - min: createActivePricePattern(client, _m(acc, 'min_cost_basis')), + max: createDollarsSatsPattern(client, _m(acc, 'max_cost_basis')), + min: createDollarsSatsPattern(client, _m(acc, 'min_cost_basis')), }; } /** - * @typedef {Object} _1dReturns1mSdPattern + * @typedef {Object} SdSmaPattern * @property {MetricPattern4} sd * @property {MetricPattern4} sma */ /** - * Create a _1dReturns1mSdPattern pattern node + * Create a SdSmaPattern pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {_1dReturns1mSdPattern} + * @returns {SdSmaPattern} */ -function create_1dReturns1mSdPattern(client, acc) { +function createSdSmaPattern(client, acc) { return { sd: createMetricPattern4(client, _m(acc, 'sd')), sma: createMetricPattern4(client, _m(acc, 'sma')), }; } -/** - * @typedef {Object} RelativePattern4 - * @property {MetricPattern1} supplyInLossRelToOwnSupply - * @property {MetricPattern1} supplyInProfitRelToOwnSupply - */ - -/** - * Create a RelativePattern4 pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {RelativePattern4} - */ -function createRelativePattern4(client, acc) { - return { - supplyInLossRelToOwnSupply: createMetricPattern1(client, _m(acc, 'loss_rel_to_own_supply')), - supplyInProfitRelToOwnSupply: createMetricPattern1(client, _m(acc, 'profit_rel_to_own_supply')), - }; -} - /** * @template T - * @typedef {Object} BlockCountPattern + * @typedef {Object} CumulativeSumPattern * @property {MetricPattern1} cumulative * @property {MetricPattern1} sum */ /** - * Create a BlockCountPattern pattern node + * Create a CumulativeSumPattern pattern node * @template T * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {BlockCountPattern} + * @returns {CumulativeSumPattern} */ -function createBlockCountPattern(client, acc) { +function createCumulativeSumPattern(client, acc) { return { cumulative: createMetricPattern1(client, _m(acc, 'cumulative')), sum: createMetricPattern1(client, acc), @@ -2938,19 +3130,19 @@ function createBlockCountPattern(client, acc) { /** * @template T - * @typedef {Object} BitcoinPattern2 + * @typedef {Object} CumulativeSumPattern2 * @property {MetricPattern2} cumulative * @property {MetricPattern1} sum */ /** - * Create a BitcoinPattern2 pattern node + * Create a CumulativeSumPattern2 pattern node * @template T * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {BitcoinPattern2} + * @returns {CumulativeSumPattern2} */ -function createBitcoinPattern2(client, acc) { +function createCumulativeSumPattern2(client, acc) { return { cumulative: createMetricPattern2(client, _m(acc, 'cumulative')), sum: createMetricPattern1(client, acc), @@ -2959,54 +3151,54 @@ function createBitcoinPattern2(client, acc) { /** * @template T - * @typedef {Object} SatsPattern + * @typedef {Object} OhlcSplitPattern2 * @property {MetricPattern1} ohlc - * @property {SplitPattern2} split + * @property {CloseHighLowOpenPattern2} split */ /** - * Create a SatsPattern pattern node + * Create a OhlcSplitPattern2 pattern node * @template T * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {SatsPattern} + * @returns {OhlcSplitPattern2} */ -function createSatsPattern(client, acc) { +function createOhlcSplitPattern2(client, acc) { return { ohlc: createMetricPattern1(client, _m(acc, 'ohlc_sats')), - split: createSplitPattern2(client, _m(acc, 'sats')), + split: createCloseHighLowOpenPattern2(client, _m(acc, 'sats')), }; } /** - * @typedef {Object} RealizedPriceExtraPattern + * @typedef {Object} RatioPattern2 * @property {MetricPattern4} ratio */ /** - * Create a RealizedPriceExtraPattern pattern node + * Create a RatioPattern2 pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {RealizedPriceExtraPattern} + * @returns {RatioPattern2} */ -function createRealizedPriceExtraPattern(client, acc) { +function createRatioPattern2(client, acc) { return { ratio: createMetricPattern4(client, acc), }; } /** - * @typedef {Object} OutputsPattern + * @typedef {Object} UtxoPattern * @property {MetricPattern1} utxoCount */ /** - * Create a OutputsPattern pattern node + * Create a UtxoPattern pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {OutputsPattern} + * @returns {UtxoPattern} */ -function createOutputsPattern(client, acc) { +function createUtxoPattern(client, acc) { return { utxoCount: createMetricPattern1(client, acc), }; @@ -3016,167 +3208,349 @@ function createOutputsPattern(client, acc) { /** * @typedef {Object} MetricsTree - * @property {MetricsTree_Addresses} addresses * @property {MetricsTree_Blocks} blocks + * @property {MetricsTree_Transactions} transactions + * @property {MetricsTree_Inputs} inputs + * @property {MetricsTree_Outputs} outputs + * @property {MetricsTree_Addresses} addresses + * @property {MetricsTree_Scripts} scripts + * @property {MetricsTree_Positions} positions * @property {MetricsTree_Cointime} cointime * @property {MetricsTree_Constants} constants - * @property {MetricsTree_Distribution} distribution * @property {MetricsTree_Indexes} indexes - * @property {MetricsTree_Inputs} inputs * @property {MetricsTree_Market} market - * @property {MetricsTree_Outputs} outputs * @property {MetricsTree_Pools} pools - * @property {MetricsTree_Positions} positions * @property {MetricsTree_Price} price - * @property {MetricsTree_Scripts} scripts + * @property {MetricsTree_Distribution} distribution * @property {MetricsTree_Supply} supply - * @property {MetricsTree_Transactions} transactions - */ - -/** - * @typedef {Object} MetricsTree_Addresses - * @property {MetricPattern11} firstP2aaddressindex - * @property {MetricPattern11} firstP2pk33addressindex - * @property {MetricPattern11} firstP2pk65addressindex - * @property {MetricPattern11} firstP2pkhaddressindex - * @property {MetricPattern11} firstP2shaddressindex - * @property {MetricPattern11} firstP2traddressindex - * @property {MetricPattern11} firstP2wpkhaddressindex - * @property {MetricPattern11} firstP2wshaddressindex - * @property {MetricPattern16} p2abytes - * @property {MetricPattern18} p2pk33bytes - * @property {MetricPattern19} p2pk65bytes - * @property {MetricPattern20} p2pkhbytes - * @property {MetricPattern21} p2shbytes - * @property {MetricPattern22} p2trbytes - * @property {MetricPattern23} p2wpkhbytes - * @property {MetricPattern24} p2wshbytes */ /** * @typedef {Object} MetricsTree_Blocks * @property {MetricPattern11} blockhash - * @property {MetricsTree_Blocks_Count} count * @property {MetricsTree_Blocks_Difficulty} difficulty - * @property {FullnessPattern} fullness - * @property {MetricsTree_Blocks_Halving} halving - * @property {FullnessPattern} interval - * @property {MetricsTree_Blocks_Mining} mining - * @property {MetricsTree_Blocks_Rewards} rewards - * @property {MetricsTree_Blocks_Size} size * @property {MetricsTree_Blocks_Time} time * @property {MetricPattern11} totalSize - * @property {DollarsPattern} vbytes - * @property {DollarsPattern} weight - */ - -/** - * @typedef {Object} MetricsTree_Blocks_Count - * @property {MetricPattern1} _1mBlockCount - * @property {MetricPattern11} _1mStart - * @property {MetricPattern1} _1wBlockCount - * @property {MetricPattern11} _1wStart - * @property {MetricPattern1} _1yBlockCount - * @property {MetricPattern11} _1yStart - * @property {MetricPattern1} _24hBlockCount - * @property {MetricPattern11} _24hStart - * @property {BlockCountPattern} blockCount - * @property {MetricPattern4} blockCountTarget + * @property {AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} weight + * @property {MetricsTree_Blocks_Count} count + * @property {AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern} interval + * @property {MetricsTree_Blocks_Mining} mining + * @property {MetricsTree_Blocks_Rewards} rewards + * @property {MetricsTree_Blocks_Halving} halving + * @property {AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} vbytes + * @property {MetricsTree_Blocks_Size} size + * @property {AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern} fullness */ /** * @typedef {Object} MetricsTree_Blocks_Difficulty - * @property {MetricPattern1} adjustment + * @property {MetricPattern1} raw * @property {MetricPattern1} asHash + * @property {MetricPattern1} adjustment + * @property {MetricPattern4} epoch * @property {MetricPattern1} blocksBeforeNextAdjustment * @property {MetricPattern1} daysBeforeNextAdjustment - * @property {MetricPattern4} epoch - * @property {MetricPattern1} raw */ /** - * @typedef {Object} MetricsTree_Blocks_Halving - * @property {MetricPattern1} blocksBeforeNextHalving - * @property {MetricPattern1} daysBeforeNextHalving - * @property {MetricPattern4} epoch + * @typedef {Object} MetricsTree_Blocks_Time + * @property {MetricPattern1} timestamp + * @property {MetricPattern11} date + * @property {MetricPattern11} timestampMonotonic + */ + +/** + * @typedef {Object} MetricsTree_Blocks_Count + * @property {MetricPattern4} blockCountTarget + * @property {CumulativeSumPattern} blockCount + * @property {MetricPattern11} _24hStart + * @property {MetricPattern11} _1wStart + * @property {MetricPattern11} _1mStart + * @property {MetricPattern11} _1yStart + * @property {MetricPattern1} _24hBlockCount + * @property {MetricPattern1} _1wBlockCount + * @property {MetricPattern1} _1mBlockCount + * @property {MetricPattern1} _1yBlockCount */ /** * @typedef {Object} MetricsTree_Blocks_Mining + * @property {MetricPattern1} hashRate + * @property {MetricPattern4} hashRate1wSma + * @property {MetricPattern4} hashRate1mSma + * @property {MetricPattern4} hashRate2mSma + * @property {MetricPattern4} hashRate1ySma + * @property {MetricPattern1} hashPriceThs + * @property {MetricPattern1} hashPriceThsMin * @property {MetricPattern1} hashPricePhs * @property {MetricPattern1} hashPricePhsMin * @property {MetricPattern1} hashPriceRebound - * @property {MetricPattern1} hashPriceThs - * @property {MetricPattern1} hashPriceThsMin - * @property {MetricPattern1} hashRate - * @property {MetricPattern4} hashRate1mSma - * @property {MetricPattern4} hashRate1wSma - * @property {MetricPattern4} hashRate1ySma - * @property {MetricPattern4} hashRate2mSma + * @property {MetricPattern1} hashValueThs + * @property {MetricPattern1} hashValueThsMin * @property {MetricPattern1} hashValuePhs * @property {MetricPattern1} hashValuePhsMin * @property {MetricPattern1} hashValueRebound - * @property {MetricPattern1} hashValueThs - * @property {MetricPattern1} hashValueThsMin */ /** * @typedef {Object} MetricsTree_Blocks_Rewards * @property {MetricsTree_Blocks_Rewards_24hCoinbaseSum} _24hCoinbaseSum - * @property {CoinbasePattern} coinbase + * @property {BitcoinDollarsSatsPattern2} coinbase + * @property {BitcoinDollarsSatsPattern2} subsidy + * @property {BitcoinDollarsSatsPattern3} unclaimedRewards * @property {MetricPattern6} feeDominance - * @property {CoinbasePattern} subsidy * @property {MetricPattern6} subsidyDominance * @property {MetricPattern4} subsidyUsd1ySma - * @property {UnclaimedRewardsPattern} unclaimedRewards */ /** * @typedef {Object} MetricsTree_Blocks_Rewards_24hCoinbaseSum + * @property {MetricPattern11} sats * @property {MetricPattern11} bitcoin * @property {MetricPattern11} dollars - * @property {MetricPattern11} sats + */ + +/** + * @typedef {Object} MetricsTree_Blocks_Halving + * @property {MetricPattern4} epoch + * @property {MetricPattern1} blocksBeforeNextHalving + * @property {MetricPattern1} daysBeforeNextHalving */ /** * @typedef {Object} MetricsTree_Blocks_Size - * @property {MetricPattern2} average * @property {MetricPattern1} cumulative - * @property {MetricPattern2} max - * @property {MetricPattern6} median + * @property {MetricPattern2} average * @property {MetricPattern2} min + * @property {MetricPattern2} max * @property {MetricPattern6} pct10 * @property {MetricPattern6} pct25 + * @property {MetricPattern6} median * @property {MetricPattern6} pct75 * @property {MetricPattern6} pct90 * @property {MetricPattern2} sum */ /** - * @typedef {Object} MetricsTree_Blocks_Time - * @property {MetricPattern11} date - * @property {MetricPattern1} timestamp - * @property {MetricPattern11} timestampMonotonic + * @typedef {Object} MetricsTree_Transactions + * @property {MetricPattern11} firstTxindex + * @property {MetricPattern27} height + * @property {MetricPattern27} txid + * @property {MetricPattern27} txversion + * @property {MetricPattern27} rawlocktime + * @property {MetricPattern27} baseSize + * @property {MetricPattern27} totalSize + * @property {MetricPattern27} isExplicitlyRbf + * @property {MetricPattern27} firstTxinindex + * @property {MetricPattern27} firstTxoutindex + * @property {MetricsTree_Transactions_Count} count + * @property {MetricsTree_Transactions_Size} size + * @property {MetricsTree_Transactions_Fees} fees + * @property {MetricsTree_Transactions_Versions} versions + * @property {MetricsTree_Transactions_Volume} volume + */ + +/** + * @typedef {Object} MetricsTree_Transactions_Count + * @property {AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} txCount + * @property {MetricPattern27} isCoinbase + */ + +/** + * @typedef {Object} MetricsTree_Transactions_Size + * @property {AverageMaxMedianMinPct10Pct25Pct75Pct90TxindexPattern} vsize + * @property {AverageMaxMedianMinPct10Pct25Pct75Pct90TxindexPattern} weight + */ + +/** + * @typedef {Object} MetricsTree_Transactions_Fees + * @property {MetricPattern27} inputValue + * @property {MetricPattern27} outputValue + * @property {MetricsTree_Transactions_Fees_Fee} fee + * @property {AverageMaxMedianMinPct10Pct25Pct75Pct90TxindexPattern} feeRate + */ + +/** + * @typedef {Object} MetricsTree_Transactions_Fees_Fee + * @property {MetricPattern27} txindex + * @property {AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} sats + * @property {AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} bitcoin + * @property {AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} dollars + */ + +/** + * @typedef {Object} MetricsTree_Transactions_Versions + * @property {CumulativeSumPattern} v1 + * @property {CumulativeSumPattern} v2 + * @property {CumulativeSumPattern} v3 + */ + +/** + * @typedef {Object} MetricsTree_Transactions_Volume + * @property {BitcoinDollarsSatsPattern4} sentSum + * @property {BitcoinDollarsSatsPattern4} receivedSum + * @property {BitcoinDollarsSatsPattern5} annualizedVolume + * @property {MetricPattern4} txPerSec + * @property {MetricPattern4} outputsPerSec + * @property {MetricPattern4} inputsPerSec + */ + +/** + * @typedef {Object} MetricsTree_Inputs + * @property {MetricPattern11} firstTxinindex + * @property {MetricPattern12} outpoint + * @property {MetricPattern12} txindex + * @property {MetricPattern12} outputtype + * @property {MetricPattern12} typeindex + * @property {MetricsTree_Inputs_Spent} spent + * @property {AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} count + */ + +/** + * @typedef {Object} MetricsTree_Inputs_Spent + * @property {MetricPattern12} txoutindex + * @property {MetricPattern12} value + */ + +/** + * @typedef {Object} MetricsTree_Outputs + * @property {MetricPattern11} firstTxoutindex + * @property {MetricPattern15} value + * @property {MetricPattern15} outputtype + * @property {MetricPattern15} typeindex + * @property {MetricPattern15} txindex + * @property {MetricsTree_Outputs_Spent} spent + * @property {MetricsTree_Outputs_Count} count + */ + +/** + * @typedef {Object} MetricsTree_Outputs_Spent + * @property {MetricPattern15} txinindex + */ + +/** + * @typedef {Object} MetricsTree_Outputs_Count + * @property {AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} totalCount + * @property {MetricPattern1} utxoCount + */ + +/** + * @typedef {Object} MetricsTree_Addresses + * @property {MetricPattern11} firstP2pk65addressindex + * @property {MetricPattern11} firstP2pk33addressindex + * @property {MetricPattern11} firstP2pkhaddressindex + * @property {MetricPattern11} firstP2shaddressindex + * @property {MetricPattern11} firstP2wpkhaddressindex + * @property {MetricPattern11} firstP2wshaddressindex + * @property {MetricPattern11} firstP2traddressindex + * @property {MetricPattern11} firstP2aaddressindex + * @property {MetricPattern19} p2pk65bytes + * @property {MetricPattern18} p2pk33bytes + * @property {MetricPattern20} p2pkhbytes + * @property {MetricPattern21} p2shbytes + * @property {MetricPattern23} p2wpkhbytes + * @property {MetricPattern24} p2wshbytes + * @property {MetricPattern22} p2trbytes + * @property {MetricPattern16} p2abytes + */ + +/** + * @typedef {Object} MetricsTree_Scripts + * @property {MetricPattern11} firstEmptyoutputindex + * @property {MetricPattern11} firstOpreturnindex + * @property {MetricPattern11} firstP2msoutputindex + * @property {MetricPattern11} firstUnknownoutputindex + * @property {MetricPattern9} emptyToTxindex + * @property {MetricPattern14} opreturnToTxindex + * @property {MetricPattern17} p2msToTxindex + * @property {MetricPattern28} unknownToTxindex + * @property {MetricsTree_Scripts_Count} count + * @property {MetricsTree_Scripts_Value} value + */ + +/** + * @typedef {Object} MetricsTree_Scripts_Count + * @property {AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} p2a + * @property {AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} p2ms + * @property {AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} p2pk33 + * @property {AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} p2pk65 + * @property {AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} p2pkh + * @property {AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} p2sh + * @property {AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} p2tr + * @property {AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} p2wpkh + * @property {AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} p2wsh + * @property {AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} opreturn + * @property {AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} emptyoutput + * @property {AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} unknownoutput + * @property {AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} segwit + * @property {BaseCumulativeSumPattern} taprootAdoption + * @property {BaseCumulativeSumPattern} segwitAdoption + */ + +/** + * @typedef {Object} MetricsTree_Scripts_Value + * @property {BitcoinDollarsSatsPattern2} opreturn + */ + +/** + * @typedef {Object} MetricsTree_Positions + * @property {MetricPattern11} blockPosition + * @property {MetricPattern27} txPosition */ /** * @typedef {Object} MetricsTree_Cointime * @property {MetricsTree_Cointime_Activity} activity - * @property {MetricsTree_Cointime_Adjusted} adjusted - * @property {MetricsTree_Cointime_Cap} cap - * @property {MetricsTree_Cointime_Pricing} pricing - * @property {MetricsTree_Cointime_ReserveRisk} reserveRisk * @property {MetricsTree_Cointime_Supply} supply * @property {MetricsTree_Cointime_Value} value + * @property {MetricsTree_Cointime_Cap} cap + * @property {MetricsTree_Cointime_Pricing} pricing + * @property {MetricsTree_Cointime_Adjusted} adjusted + * @property {MetricsTree_Cointime_ReserveRisk} reserveRisk */ /** * @typedef {Object} MetricsTree_Cointime_Activity - * @property {MetricPattern1} activityToVaultednessRatio - * @property {BlockCountPattern} coinblocksCreated - * @property {BlockCountPattern} coinblocksStored + * @property {CumulativeSumPattern} coinblocksCreated + * @property {CumulativeSumPattern} coinblocksStored * @property {MetricPattern1} liveliness * @property {MetricPattern1} vaultedness + * @property {MetricPattern1} activityToVaultednessRatio + */ + +/** + * @typedef {Object} MetricsTree_Cointime_Supply + * @property {BitcoinDollarsSatsPattern4} vaultedSupply + * @property {BitcoinDollarsSatsPattern4} activeSupply + */ + +/** + * @typedef {Object} MetricsTree_Cointime_Value + * @property {CumulativeSumPattern} cointimeValueDestroyed + * @property {CumulativeSumPattern} cointimeValueCreated + * @property {CumulativeSumPattern} cointimeValueStored + * @property {CumulativeSumPattern} vocdd + */ + +/** + * @typedef {Object} MetricsTree_Cointime_Cap + * @property {MetricPattern1} thermoCap + * @property {MetricPattern1} investorCap + * @property {MetricPattern1} vaultedCap + * @property {MetricPattern1} activeCap + * @property {MetricPattern1} cointimeCap + */ + +/** + * @typedef {Object} MetricsTree_Cointime_Pricing + * @property {DollarsSatsPattern} vaultedPrice + * @property {RatioPattern} vaultedPriceRatio + * @property {DollarsSatsPattern} activePrice + * @property {RatioPattern} activePriceRatio + * @property {DollarsSatsPattern} trueMarketMean + * @property {RatioPattern} trueMarketMeanRatio + * @property {DollarsSatsPattern} cointimePrice + * @property {RatioPattern} cointimePriceRatio */ /** @@ -3186,467 +3560,55 @@ function createOutputsPattern(client, acc) { * @property {MetricPattern4} cointimeAdjTxUsdVelocity */ -/** - * @typedef {Object} MetricsTree_Cointime_Cap - * @property {MetricPattern1} activeCap - * @property {MetricPattern1} cointimeCap - * @property {MetricPattern1} investorCap - * @property {MetricPattern1} thermoCap - * @property {MetricPattern1} vaultedCap - */ - -/** - * @typedef {Object} MetricsTree_Cointime_Pricing - * @property {ActivePricePattern} activePrice - * @property {ActivePriceRatioPattern} activePriceRatio - * @property {ActivePricePattern} cointimePrice - * @property {ActivePriceRatioPattern} cointimePriceRatio - * @property {ActivePricePattern} trueMarketMean - * @property {ActivePriceRatioPattern} trueMarketMeanRatio - * @property {ActivePricePattern} vaultedPrice - * @property {ActivePriceRatioPattern} vaultedPriceRatio - */ - /** * @typedef {Object} MetricsTree_Cointime_ReserveRisk + * @property {MetricPattern6} vocdd365dSma * @property {MetricPattern6} hodlBank * @property {MetricPattern4} reserveRisk - * @property {MetricPattern6} vocdd365dSma - */ - -/** - * @typedef {Object} MetricsTree_Cointime_Supply - * @property {ActiveSupplyPattern} activeSupply - * @property {ActiveSupplyPattern} vaultedSupply - */ - -/** - * @typedef {Object} MetricsTree_Cointime_Value - * @property {BlockCountPattern} cointimeValueCreated - * @property {BlockCountPattern} cointimeValueDestroyed - * @property {BlockCountPattern} cointimeValueStored - * @property {BlockCountPattern} vocdd */ /** * @typedef {Object} MetricsTree_Constants * @property {MetricPattern1} constant0 * @property {MetricPattern1} constant1 - * @property {MetricPattern1} constant100 * @property {MetricPattern1} constant2 - * @property {MetricPattern1} constant20 * @property {MetricPattern1} constant3 + * @property {MetricPattern1} constant4 + * @property {MetricPattern1} constant20 * @property {MetricPattern1} constant30 * @property {MetricPattern1} constant382 - * @property {MetricPattern1} constant4 * @property {MetricPattern1} constant50 - * @property {MetricPattern1} constant600 * @property {MetricPattern1} constant618 * @property {MetricPattern1} constant70 * @property {MetricPattern1} constant80 + * @property {MetricPattern1} constant100 + * @property {MetricPattern1} constant600 * @property {MetricPattern1} constantMinus1 * @property {MetricPattern1} constantMinus2 * @property {MetricPattern1} constantMinus3 * @property {MetricPattern1} constantMinus4 */ -/** - * @typedef {Object} MetricsTree_Distribution - * @property {AddrCountPattern} addrCount - * @property {MetricsTree_Distribution_AddressActivity} addressActivity - * @property {MetricsTree_Distribution_AddressCohorts} addressCohorts - * @property {MetricsTree_Distribution_AddressesData} addressesData - * @property {MetricsTree_Distribution_AnyAddressIndexes} anyAddressIndexes - * @property {MetricPattern11} chainState - * @property {AddrCountPattern} emptyAddrCount - * @property {MetricPattern32} emptyaddressindex - * @property {MetricsTree_Distribution_GrowthRate} growthRate - * @property {MetricPattern31} loadedaddressindex - * @property {MetricsTree_Distribution_NewAddrCount} newAddrCount - * @property {AddrCountPattern} totalAddrCount - * @property {MetricsTree_Distribution_UtxoCohorts} utxoCohorts - */ - -/** - * @typedef {Object} MetricsTree_Distribution_AddressActivity - * @property {AllPattern} all - * @property {AllPattern} p2a - * @property {AllPattern} p2pk33 - * @property {AllPattern} p2pk65 - * @property {AllPattern} p2pkh - * @property {AllPattern} p2sh - * @property {AllPattern} p2tr - * @property {AllPattern} p2wpkh - * @property {AllPattern} p2wsh - */ - -/** - * @typedef {Object} MetricsTree_Distribution_AddressCohorts - * @property {MetricsTree_Distribution_AddressCohorts_AmountRange} amountRange - * @property {MetricsTree_Distribution_AddressCohorts_GeAmount} geAmount - * @property {MetricsTree_Distribution_AddressCohorts_LtAmount} ltAmount - */ - -/** - * @typedef {Object} MetricsTree_Distribution_AddressCohorts_AmountRange - * @property {_0satsPattern} _0sats - * @property {_0satsPattern} _100btcTo1kBtc - * @property {_0satsPattern} _100kBtcOrMore - * @property {_0satsPattern} _100kSatsTo1mSats - * @property {_0satsPattern} _100satsTo1kSats - * @property {_0satsPattern} _10btcTo100btc - * @property {_0satsPattern} _10kBtcTo100kBtc - * @property {_0satsPattern} _10kSatsTo100kSats - * @property {_0satsPattern} _10mSatsTo1btc - * @property {_0satsPattern} _10satsTo100sats - * @property {_0satsPattern} _1btcTo10btc - * @property {_0satsPattern} _1kBtcTo10kBtc - * @property {_0satsPattern} _1kSatsTo10kSats - * @property {_0satsPattern} _1mSatsTo10mSats - * @property {_0satsPattern} _1satTo10sats - */ - -/** - * @typedef {Object} MetricsTree_Distribution_AddressCohorts_GeAmount - * @property {_0satsPattern} _100btc - * @property {_0satsPattern} _100kSats - * @property {_0satsPattern} _100sats - * @property {_0satsPattern} _10btc - * @property {_0satsPattern} _10kBtc - * @property {_0satsPattern} _10kSats - * @property {_0satsPattern} _10mSats - * @property {_0satsPattern} _10sats - * @property {_0satsPattern} _1btc - * @property {_0satsPattern} _1kBtc - * @property {_0satsPattern} _1kSats - * @property {_0satsPattern} _1mSats - * @property {_0satsPattern} _1sat - */ - -/** - * @typedef {Object} MetricsTree_Distribution_AddressCohorts_LtAmount - * @property {_0satsPattern} _100btc - * @property {_0satsPattern} _100kBtc - * @property {_0satsPattern} _100kSats - * @property {_0satsPattern} _100sats - * @property {_0satsPattern} _10btc - * @property {_0satsPattern} _10kBtc - * @property {_0satsPattern} _10kSats - * @property {_0satsPattern} _10mSats - * @property {_0satsPattern} _10sats - * @property {_0satsPattern} _1btc - * @property {_0satsPattern} _1kBtc - * @property {_0satsPattern} _1kSats - * @property {_0satsPattern} _1mSats - */ - -/** - * @typedef {Object} MetricsTree_Distribution_AddressesData - * @property {MetricPattern32} empty - * @property {MetricPattern31} loaded - */ - -/** - * @typedef {Object} MetricsTree_Distribution_AnyAddressIndexes - * @property {MetricPattern16} p2a - * @property {MetricPattern18} p2pk33 - * @property {MetricPattern19} p2pk65 - * @property {MetricPattern20} p2pkh - * @property {MetricPattern21} p2sh - * @property {MetricPattern22} p2tr - * @property {MetricPattern23} p2wpkh - * @property {MetricPattern24} p2wsh - */ - -/** - * @typedef {Object} MetricsTree_Distribution_GrowthRate - * @property {FullnessPattern} all - * @property {FullnessPattern} p2a - * @property {FullnessPattern} p2pk33 - * @property {FullnessPattern} p2pk65 - * @property {FullnessPattern} p2pkh - * @property {FullnessPattern} p2sh - * @property {FullnessPattern} p2tr - * @property {FullnessPattern} p2wpkh - * @property {FullnessPattern} p2wsh - */ - -/** - * @typedef {Object} MetricsTree_Distribution_NewAddrCount - * @property {DollarsPattern} all - * @property {DollarsPattern} p2a - * @property {DollarsPattern} p2pk33 - * @property {DollarsPattern} p2pk65 - * @property {DollarsPattern} p2pkh - * @property {DollarsPattern} p2sh - * @property {DollarsPattern} p2tr - * @property {DollarsPattern} p2wpkh - * @property {DollarsPattern} p2wsh - */ - -/** - * @typedef {Object} MetricsTree_Distribution_UtxoCohorts - * @property {MetricsTree_Distribution_UtxoCohorts_AgeRange} ageRange - * @property {MetricsTree_Distribution_UtxoCohorts_All} all - * @property {MetricsTree_Distribution_UtxoCohorts_AmountRange} amountRange - * @property {MetricsTree_Distribution_UtxoCohorts_Epoch} epoch - * @property {MetricsTree_Distribution_UtxoCohorts_GeAmount} geAmount - * @property {MetricsTree_Distribution_UtxoCohorts_LtAmount} ltAmount - * @property {MetricsTree_Distribution_UtxoCohorts_MaxAge} maxAge - * @property {MetricsTree_Distribution_UtxoCohorts_MinAge} minAge - * @property {MetricsTree_Distribution_UtxoCohorts_Term} term - * @property {MetricsTree_Distribution_UtxoCohorts_Type} type - * @property {MetricsTree_Distribution_UtxoCohorts_Year} year - */ - -/** - * @typedef {Object} MetricsTree_Distribution_UtxoCohorts_AgeRange - * @property {_10yTo12yPattern} _10yTo12y - * @property {_10yTo12yPattern} _12yTo15y - * @property {_10yTo12yPattern} _1dTo1w - * @property {_10yTo12yPattern} _1hTo1d - * @property {_10yTo12yPattern} _1mTo2m - * @property {_10yTo12yPattern} _1wTo1m - * @property {_10yTo12yPattern} _1yTo2y - * @property {_10yTo12yPattern} _2mTo3m - * @property {_10yTo12yPattern} _2yTo3y - * @property {_10yTo12yPattern} _3mTo4m - * @property {_10yTo12yPattern} _3yTo4y - * @property {_10yTo12yPattern} _4mTo5m - * @property {_10yTo12yPattern} _4yTo5y - * @property {_10yTo12yPattern} _5mTo6m - * @property {_10yTo12yPattern} _5yTo6y - * @property {_10yTo12yPattern} _6mTo1y - * @property {_10yTo12yPattern} _6yTo7y - * @property {_10yTo12yPattern} _7yTo8y - * @property {_10yTo12yPattern} _8yTo10y - * @property {_10yTo12yPattern} from15y - * @property {_10yTo12yPattern} upTo1h - */ - -/** - * @typedef {Object} MetricsTree_Distribution_UtxoCohorts_All - * @property {ActivityPattern2} activity - * @property {MetricsTree_Distribution_UtxoCohorts_All_CostBasis} costBasis - * @property {OutputsPattern} outputs - * @property {RealizedPattern3} realized - * @property {MetricsTree_Distribution_UtxoCohorts_All_Relative} relative - * @property {SupplyPattern2} supply - * @property {UnrealizedPattern} unrealized - */ - -/** - * @typedef {Object} MetricsTree_Distribution_UtxoCohorts_All_CostBasis - * @property {ActivePricePattern} max - * @property {ActivePricePattern} min - * @property {PercentilesPattern} percentiles - */ - -/** - * @typedef {Object} MetricsTree_Distribution_UtxoCohorts_All_Relative - * @property {MetricPattern1} negUnrealizedLossRelToOwnTotalUnrealizedPnl - * @property {MetricPattern1} netUnrealizedPnlRelToOwnTotalUnrealizedPnl - * @property {MetricPattern1} supplyInLossRelToOwnSupply - * @property {MetricPattern1} supplyInProfitRelToOwnSupply - * @property {MetricPattern1} unrealizedLossRelToOwnTotalUnrealizedPnl - * @property {MetricPattern1} unrealizedProfitRelToOwnTotalUnrealizedPnl - */ - -/** - * @typedef {Object} MetricsTree_Distribution_UtxoCohorts_AmountRange - * @property {_0satsPattern2} _0sats - * @property {_0satsPattern2} _100btcTo1kBtc - * @property {_0satsPattern2} _100kBtcOrMore - * @property {_0satsPattern2} _100kSatsTo1mSats - * @property {_0satsPattern2} _100satsTo1kSats - * @property {_0satsPattern2} _10btcTo100btc - * @property {_0satsPattern2} _10kBtcTo100kBtc - * @property {_0satsPattern2} _10kSatsTo100kSats - * @property {_0satsPattern2} _10mSatsTo1btc - * @property {_0satsPattern2} _10satsTo100sats - * @property {_0satsPattern2} _1btcTo10btc - * @property {_0satsPattern2} _1kBtcTo10kBtc - * @property {_0satsPattern2} _1kSatsTo10kSats - * @property {_0satsPattern2} _1mSatsTo10mSats - * @property {_0satsPattern2} _1satTo10sats - */ - -/** - * @typedef {Object} MetricsTree_Distribution_UtxoCohorts_Epoch - * @property {_0satsPattern2} _0 - * @property {_0satsPattern2} _1 - * @property {_0satsPattern2} _2 - * @property {_0satsPattern2} _3 - * @property {_0satsPattern2} _4 - */ - -/** - * @typedef {Object} MetricsTree_Distribution_UtxoCohorts_GeAmount - * @property {_100btcPattern} _100btc - * @property {_100btcPattern} _100kSats - * @property {_100btcPattern} _100sats - * @property {_100btcPattern} _10btc - * @property {_100btcPattern} _10kBtc - * @property {_100btcPattern} _10kSats - * @property {_100btcPattern} _10mSats - * @property {_100btcPattern} _10sats - * @property {_100btcPattern} _1btc - * @property {_100btcPattern} _1kBtc - * @property {_100btcPattern} _1kSats - * @property {_100btcPattern} _1mSats - * @property {_100btcPattern} _1sat - */ - -/** - * @typedef {Object} MetricsTree_Distribution_UtxoCohorts_LtAmount - * @property {_100btcPattern} _100btc - * @property {_100btcPattern} _100kBtc - * @property {_100btcPattern} _100kSats - * @property {_100btcPattern} _100sats - * @property {_100btcPattern} _10btc - * @property {_100btcPattern} _10kBtc - * @property {_100btcPattern} _10kSats - * @property {_100btcPattern} _10mSats - * @property {_100btcPattern} _10sats - * @property {_100btcPattern} _1btc - * @property {_100btcPattern} _1kBtc - * @property {_100btcPattern} _1kSats - * @property {_100btcPattern} _1mSats - */ - -/** - * @typedef {Object} MetricsTree_Distribution_UtxoCohorts_MaxAge - * @property {_10yPattern} _10y - * @property {_10yPattern} _12y - * @property {_10yPattern} _15y - * @property {_10yPattern} _1m - * @property {_10yPattern} _1w - * @property {_10yPattern} _1y - * @property {_10yPattern} _2m - * @property {_10yPattern} _2y - * @property {_10yPattern} _3m - * @property {_10yPattern} _3y - * @property {_10yPattern} _4m - * @property {_10yPattern} _4y - * @property {_10yPattern} _5m - * @property {_10yPattern} _5y - * @property {_10yPattern} _6m - * @property {_10yPattern} _6y - * @property {_10yPattern} _7y - * @property {_10yPattern} _8y - */ - -/** - * @typedef {Object} MetricsTree_Distribution_UtxoCohorts_MinAge - * @property {_100btcPattern} _10y - * @property {_100btcPattern} _12y - * @property {_100btcPattern} _1d - * @property {_100btcPattern} _1m - * @property {_100btcPattern} _1w - * @property {_100btcPattern} _1y - * @property {_100btcPattern} _2m - * @property {_100btcPattern} _2y - * @property {_100btcPattern} _3m - * @property {_100btcPattern} _3y - * @property {_100btcPattern} _4m - * @property {_100btcPattern} _4y - * @property {_100btcPattern} _5m - * @property {_100btcPattern} _5y - * @property {_100btcPattern} _6m - * @property {_100btcPattern} _6y - * @property {_100btcPattern} _7y - * @property {_100btcPattern} _8y - */ - -/** - * @typedef {Object} MetricsTree_Distribution_UtxoCohorts_Term - * @property {MetricsTree_Distribution_UtxoCohorts_Term_Long} long - * @property {MetricsTree_Distribution_UtxoCohorts_Term_Short} short - */ - -/** - * @typedef {Object} MetricsTree_Distribution_UtxoCohorts_Term_Long - * @property {ActivityPattern2} activity - * @property {CostBasisPattern2} costBasis - * @property {OutputsPattern} outputs - * @property {RealizedPattern2} realized - * @property {RelativePattern5} relative - * @property {SupplyPattern2} supply - * @property {UnrealizedPattern} unrealized - */ - -/** - * @typedef {Object} MetricsTree_Distribution_UtxoCohorts_Term_Short - * @property {ActivityPattern2} activity - * @property {CostBasisPattern2} costBasis - * @property {OutputsPattern} outputs - * @property {RealizedPattern3} realized - * @property {RelativePattern5} relative - * @property {SupplyPattern2} supply - * @property {UnrealizedPattern} unrealized - */ - -/** - * @typedef {Object} MetricsTree_Distribution_UtxoCohorts_Type - * @property {_0satsPattern2} empty - * @property {_0satsPattern2} p2a - * @property {_0satsPattern2} p2ms - * @property {_0satsPattern2} p2pk33 - * @property {_0satsPattern2} p2pk65 - * @property {_0satsPattern2} p2pkh - * @property {_0satsPattern2} p2sh - * @property {_0satsPattern2} p2tr - * @property {_0satsPattern2} p2wpkh - * @property {_0satsPattern2} p2wsh - * @property {_0satsPattern2} unknown - */ - -/** - * @typedef {Object} MetricsTree_Distribution_UtxoCohorts_Year - * @property {_0satsPattern2} _2009 - * @property {_0satsPattern2} _2010 - * @property {_0satsPattern2} _2011 - * @property {_0satsPattern2} _2012 - * @property {_0satsPattern2} _2013 - * @property {_0satsPattern2} _2014 - * @property {_0satsPattern2} _2015 - * @property {_0satsPattern2} _2016 - * @property {_0satsPattern2} _2017 - * @property {_0satsPattern2} _2018 - * @property {_0satsPattern2} _2019 - * @property {_0satsPattern2} _2020 - * @property {_0satsPattern2} _2021 - * @property {_0satsPattern2} _2022 - * @property {_0satsPattern2} _2023 - * @property {_0satsPattern2} _2024 - * @property {_0satsPattern2} _2025 - * @property {_0satsPattern2} _2026 - */ - /** * @typedef {Object} MetricsTree_Indexes * @property {MetricsTree_Indexes_Address} address - * @property {MetricsTree_Indexes_Dateindex} dateindex - * @property {MetricsTree_Indexes_Decadeindex} decadeindex + * @property {MetricsTree_Indexes_Height} height * @property {MetricsTree_Indexes_Difficultyepoch} difficultyepoch * @property {MetricsTree_Indexes_Halvingepoch} halvingepoch - * @property {MetricsTree_Indexes_Height} height + * @property {MetricsTree_Indexes_Dateindex} dateindex + * @property {MetricsTree_Indexes_Weekindex} weekindex * @property {MetricsTree_Indexes_Monthindex} monthindex * @property {MetricsTree_Indexes_Quarterindex} quarterindex * @property {MetricsTree_Indexes_Semesterindex} semesterindex + * @property {MetricsTree_Indexes_Yearindex} yearindex + * @property {MetricsTree_Indexes_Decadeindex} decadeindex * @property {MetricsTree_Indexes_Txindex} txindex * @property {MetricsTree_Indexes_Txinindex} txinindex * @property {MetricsTree_Indexes_Txoutindex} txoutindex - * @property {MetricsTree_Indexes_Weekindex} weekindex - * @property {MetricsTree_Indexes_Yearindex} yearindex */ /** * @typedef {Object} MetricsTree_Indexes_Address - * @property {MetricsTree_Indexes_Address_Empty} empty - * @property {MetricsTree_Indexes_Address_Opreturn} opreturn - * @property {MetricsTree_Indexes_Address_P2a} p2a - * @property {MetricsTree_Indexes_Address_P2ms} p2ms * @property {MetricsTree_Indexes_Address_P2pk33} p2pk33 * @property {MetricsTree_Indexes_Address_P2pk65} p2pk65 * @property {MetricsTree_Indexes_Address_P2pkh} p2pkh @@ -3654,27 +3616,11 @@ function createOutputsPattern(client, acc) { * @property {MetricsTree_Indexes_Address_P2tr} p2tr * @property {MetricsTree_Indexes_Address_P2wpkh} p2wpkh * @property {MetricsTree_Indexes_Address_P2wsh} p2wsh + * @property {MetricsTree_Indexes_Address_P2a} p2a + * @property {MetricsTree_Indexes_Address_P2ms} p2ms + * @property {MetricsTree_Indexes_Address_Empty} empty * @property {MetricsTree_Indexes_Address_Unknown} unknown - */ - -/** - * @typedef {Object} MetricsTree_Indexes_Address_Empty - * @property {MetricPattern9} identity - */ - -/** - * @typedef {Object} MetricsTree_Indexes_Address_Opreturn - * @property {MetricPattern14} identity - */ - -/** - * @typedef {Object} MetricsTree_Indexes_Address_P2a - * @property {MetricPattern16} identity - */ - -/** - * @typedef {Object} MetricsTree_Indexes_Address_P2ms - * @property {MetricPattern17} identity + * @property {MetricsTree_Indexes_Address_Opreturn} opreturn */ /** @@ -3712,57 +3658,77 @@ function createOutputsPattern(client, acc) { * @property {MetricPattern24} identity */ +/** + * @typedef {Object} MetricsTree_Indexes_Address_P2a + * @property {MetricPattern16} identity + */ + +/** + * @typedef {Object} MetricsTree_Indexes_Address_P2ms + * @property {MetricPattern17} identity + */ + +/** + * @typedef {Object} MetricsTree_Indexes_Address_Empty + * @property {MetricPattern9} identity + */ + /** * @typedef {Object} MetricsTree_Indexes_Address_Unknown * @property {MetricPattern28} identity */ /** - * @typedef {Object} MetricsTree_Indexes_Dateindex - * @property {MetricPattern6} date - * @property {MetricPattern6} firstHeight - * @property {MetricPattern6} heightCount - * @property {MetricPattern6} identity - * @property {MetricPattern6} monthindex - * @property {MetricPattern6} weekindex - */ - -/** - * @typedef {Object} MetricsTree_Indexes_Decadeindex - * @property {MetricPattern7} date - * @property {MetricPattern7} firstYearindex - * @property {MetricPattern7} identity - * @property {MetricPattern7} yearindexCount - */ - -/** - * @typedef {Object} MetricsTree_Indexes_Difficultyepoch - * @property {MetricPattern8} firstHeight - * @property {MetricPattern8} heightCount - * @property {MetricPattern8} identity - */ - -/** - * @typedef {Object} MetricsTree_Indexes_Halvingepoch - * @property {MetricPattern10} firstHeight - * @property {MetricPattern10} identity + * @typedef {Object} MetricsTree_Indexes_Address_Opreturn + * @property {MetricPattern14} identity */ /** * @typedef {Object} MetricsTree_Indexes_Height + * @property {MetricPattern11} identity * @property {MetricPattern11} dateindex * @property {MetricPattern11} difficultyepoch * @property {MetricPattern11} halvingepoch - * @property {MetricPattern11} identity * @property {MetricPattern11} txindexCount */ +/** + * @typedef {Object} MetricsTree_Indexes_Difficultyepoch + * @property {MetricPattern8} identity + * @property {MetricPattern8} firstHeight + * @property {MetricPattern8} heightCount + */ + +/** + * @typedef {Object} MetricsTree_Indexes_Halvingepoch + * @property {MetricPattern10} identity + * @property {MetricPattern10} firstHeight + */ + +/** + * @typedef {Object} MetricsTree_Indexes_Dateindex + * @property {MetricPattern6} identity + * @property {MetricPattern6} date + * @property {MetricPattern6} firstHeight + * @property {MetricPattern6} heightCount + * @property {MetricPattern6} weekindex + * @property {MetricPattern6} monthindex + */ + +/** + * @typedef {Object} MetricsTree_Indexes_Weekindex + * @property {MetricPattern29} identity + * @property {MetricPattern29} date + * @property {MetricPattern29} firstDateindex + * @property {MetricPattern29} dateindexCount + */ + /** * @typedef {Object} MetricsTree_Indexes_Monthindex - * @property {MetricPattern13} date - * @property {MetricPattern13} dateindexCount - * @property {MetricPattern13} firstDateindex * @property {MetricPattern13} identity + * @property {MetricPattern13} date + * @property {MetricPattern13} firstDateindex + * @property {MetricPattern13} dateindexCount * @property {MetricPattern13} quarterindex * @property {MetricPattern13} semesterindex * @property {MetricPattern13} yearindex @@ -3770,20 +3736,37 @@ function createOutputsPattern(client, acc) { /** * @typedef {Object} MetricsTree_Indexes_Quarterindex + * @property {MetricPattern25} identity * @property {MetricPattern25} date * @property {MetricPattern25} firstMonthindex - * @property {MetricPattern25} identity * @property {MetricPattern25} monthindexCount */ /** * @typedef {Object} MetricsTree_Indexes_Semesterindex + * @property {MetricPattern26} identity * @property {MetricPattern26} date * @property {MetricPattern26} firstMonthindex - * @property {MetricPattern26} identity * @property {MetricPattern26} monthindexCount */ +/** + * @typedef {Object} MetricsTree_Indexes_Yearindex + * @property {MetricPattern30} identity + * @property {MetricPattern30} date + * @property {MetricPattern30} firstMonthindex + * @property {MetricPattern30} monthindexCount + * @property {MetricPattern30} decadeindex + */ + +/** + * @typedef {Object} MetricsTree_Indexes_Decadeindex + * @property {MetricPattern7} identity + * @property {MetricPattern7} date + * @property {MetricPattern7} firstYearindex + * @property {MetricPattern7} yearindexCount + */ + /** * @typedef {Object} MetricsTree_Indexes_Txindex * @property {MetricPattern27} identity @@ -3801,105 +3784,217 @@ function createOutputsPattern(client, acc) { * @property {MetricPattern15} identity */ -/** - * @typedef {Object} MetricsTree_Indexes_Weekindex - * @property {MetricPattern29} date - * @property {MetricPattern29} dateindexCount - * @property {MetricPattern29} firstDateindex - * @property {MetricPattern29} identity - */ - -/** - * @typedef {Object} MetricsTree_Indexes_Yearindex - * @property {MetricPattern30} date - * @property {MetricPattern30} decadeindex - * @property {MetricPattern30} firstMonthindex - * @property {MetricPattern30} identity - * @property {MetricPattern30} monthindexCount - */ - -/** - * @typedef {Object} MetricsTree_Inputs - * @property {CountPattern2} count - * @property {MetricPattern11} firstTxinindex - * @property {MetricPattern12} outpoint - * @property {MetricPattern12} outputtype - * @property {MetricsTree_Inputs_Spent} spent - * @property {MetricPattern12} txindex - * @property {MetricPattern12} typeindex - */ - -/** - * @typedef {Object} MetricsTree_Inputs_Spent - * @property {MetricPattern12} txoutindex - * @property {MetricPattern12} value - */ - /** * @typedef {Object} MetricsTree_Market * @property {MetricsTree_Market_Ath} ath - * @property {MetricsTree_Market_Dca} dca - * @property {MetricsTree_Market_Indicators} indicators * @property {MetricsTree_Market_Lookback} lookback - * @property {MetricsTree_Market_MovingAverage} movingAverage - * @property {MetricsTree_Market_Range} range * @property {MetricsTree_Market_Returns} returns * @property {MetricsTree_Market_Volatility} volatility + * @property {MetricsTree_Market_Range} range + * @property {MetricsTree_Market_MovingAverage} movingAverage + * @property {MetricsTree_Market_Dca} dca + * @property {MetricsTree_Market_Indicators} indicators */ /** * @typedef {Object} MetricsTree_Market_Ath + * @property {DollarsSatsPattern} priceAth + * @property {MetricPattern3} priceDrawdown * @property {MetricPattern4} daysSincePriceAth + * @property {MetricPattern4} yearsSincePriceAth * @property {MetricPattern4} maxDaysBetweenPriceAths * @property {MetricPattern4} maxYearsBetweenPriceAths - * @property {ActivePricePattern} priceAth - * @property {MetricPattern3} priceDrawdown - * @property {MetricPattern4} yearsSincePriceAth + */ + +/** + * @typedef {Object} MetricsTree_Market_Lookback + * @property {DollarsSatsPattern2} _1d + * @property {DollarsSatsPattern2} _1w + * @property {DollarsSatsPattern2} _1m + * @property {DollarsSatsPattern2} _3m + * @property {DollarsSatsPattern2} _6m + * @property {DollarsSatsPattern2} _1y + * @property {DollarsSatsPattern2} _2y + * @property {DollarsSatsPattern2} _3y + * @property {DollarsSatsPattern2} _4y + * @property {DollarsSatsPattern2} _5y + * @property {DollarsSatsPattern2} _6y + * @property {DollarsSatsPattern2} _8y + * @property {DollarsSatsPattern2} _10y + */ + +/** + * @typedef {Object} MetricsTree_Market_Returns + * @property {MetricsTree_Market_Returns_PriceReturns} priceReturns + * @property {_10y2y3y4y5y6y8yPattern} cagr + * @property {SdSmaPattern} _1dReturns1wSd + * @property {SdSmaPattern} _1dReturns1mSd + * @property {SdSmaPattern} _1dReturns1ySd + * @property {MetricPattern6} downsideReturns + * @property {SdSmaPattern} downside1wSd + * @property {SdSmaPattern} downside1mSd + * @property {SdSmaPattern} downside1ySd + */ + +/** + * @typedef {Object} MetricsTree_Market_Returns_PriceReturns + * @property {MetricPattern4} _1d + * @property {MetricPattern4} _1w + * @property {MetricPattern4} _1m + * @property {MetricPattern4} _3m + * @property {MetricPattern4} _6m + * @property {MetricPattern4} _1y + * @property {MetricPattern4} _2y + * @property {MetricPattern4} _3y + * @property {MetricPattern4} _4y + * @property {MetricPattern4} _5y + * @property {MetricPattern4} _6y + * @property {MetricPattern4} _8y + * @property {MetricPattern4} _10y + */ + +/** + * @typedef {Object} MetricsTree_Market_Volatility + * @property {MetricPattern4} price1wVolatility + * @property {MetricPattern4} price1mVolatility + * @property {MetricPattern4} price1yVolatility + * @property {MetricPattern6} sharpe1w + * @property {MetricPattern6} sharpe1m + * @property {MetricPattern6} sharpe1y + * @property {MetricPattern6} sortino1w + * @property {MetricPattern6} sortino1m + * @property {MetricPattern6} sortino1y + */ + +/** + * @typedef {Object} MetricsTree_Market_Range + * @property {DollarsSatsPattern2} price1wMin + * @property {DollarsSatsPattern2} price1wMax + * @property {DollarsSatsPattern2} price2wMin + * @property {DollarsSatsPattern2} price2wMax + * @property {DollarsSatsPattern2} price1mMin + * @property {DollarsSatsPattern2} price1mMax + * @property {DollarsSatsPattern2} price1yMin + * @property {DollarsSatsPattern2} price1yMax + * @property {MetricPattern6} priceTrueRange + * @property {MetricPattern6} priceTrueRange2wSum + * @property {MetricPattern4} price2wChoppinessIndex + */ + +/** + * @typedef {Object} MetricsTree_Market_MovingAverage + * @property {PriceRatioPattern} price1wSma + * @property {PriceRatioPattern} price8dSma + * @property {PriceRatioPattern} price13dSma + * @property {PriceRatioPattern} price21dSma + * @property {PriceRatioPattern} price1mSma + * @property {PriceRatioPattern} price34dSma + * @property {PriceRatioPattern} price55dSma + * @property {PriceRatioPattern} price89dSma + * @property {PriceRatioPattern} price111dSma + * @property {PriceRatioPattern} price144dSma + * @property {PriceRatioPattern} price200dSma + * @property {PriceRatioPattern} price350dSma + * @property {PriceRatioPattern} price1ySma + * @property {PriceRatioPattern} price2ySma + * @property {PriceRatioPattern} price200wSma + * @property {PriceRatioPattern} price4ySma + * @property {PriceRatioPattern} price1wEma + * @property {PriceRatioPattern} price8dEma + * @property {PriceRatioPattern} price12dEma + * @property {PriceRatioPattern} price13dEma + * @property {PriceRatioPattern} price21dEma + * @property {PriceRatioPattern} price26dEma + * @property {PriceRatioPattern} price1mEma + * @property {PriceRatioPattern} price34dEma + * @property {PriceRatioPattern} price55dEma + * @property {PriceRatioPattern} price89dEma + * @property {PriceRatioPattern} price144dEma + * @property {PriceRatioPattern} price200dEma + * @property {PriceRatioPattern} price1yEma + * @property {PriceRatioPattern} price2yEma + * @property {PriceRatioPattern} price200wEma + * @property {PriceRatioPattern} price4yEma + * @property {DollarsSatsPattern2} price200dSmaX24 + * @property {DollarsSatsPattern2} price200dSmaX08 + * @property {DollarsSatsPattern2} price350dSmaX2 */ /** * @typedef {Object} MetricsTree_Market_Dca + * @property {_10y1m1w1y2y3m3y4y5y6m6y8yPattern3} periodStack + * @property {MetricsTree_Market_Dca_PeriodAveragePrice} periodAveragePrice + * @property {_10y1m1w1y2y3m3y4y5y6m6y8yPattern2} periodReturns + * @property {_10y2y3y4y5y6y8yPattern} periodCagr + * @property {_10y1m1w1y2y3m3y4y5y6m6y8yPattern2} periodDaysInProfit + * @property {_10y1m1w1y2y3m3y4y5y6m6y8yPattern2} periodDaysInLoss + * @property {_10y1m1w1y2y3m3y4y5y6m6y8yPattern2} periodMaxDrawdown + * @property {_10y1m1w1y2y3m3y4y5y6m6y8yPattern2} periodMaxReturn + * @property {_10y1m1w1y2y3m3y4y5y6m6y8yPattern3} periodLumpSumStack + * @property {_10y1m1w1y2y3m3y4y5y6m6y8yPattern2} periodLumpSumReturns + * @property {_10y1m1w1y2y3m3y4y5y6m6y8yPattern2} periodLumpSumDaysInProfit + * @property {_10y1m1w1y2y3m3y4y5y6m6y8yPattern2} periodLumpSumDaysInLoss + * @property {_10y1m1w1y2y3m3y4y5y6m6y8yPattern2} periodLumpSumMaxDrawdown + * @property {_10y1m1w1y2y3m3y4y5y6m6y8yPattern2} periodLumpSumMaxReturn + * @property {MetricsTree_Market_Dca_ClassStack} classStack * @property {MetricsTree_Market_Dca_ClassAveragePrice} classAveragePrice - * @property {MetricsTree_Market_Dca_ClassDaysInLoss} classDaysInLoss + * @property {_201520162017201820192020202120222023202420252026Pattern2} classReturns * @property {MetricsTree_Market_Dca_ClassDaysInProfit} classDaysInProfit + * @property {MetricsTree_Market_Dca_ClassDaysInLoss} classDaysInLoss * @property {MetricsTree_Market_Dca_ClassMaxDrawdown} classMaxDrawdown * @property {MetricsTree_Market_Dca_ClassMaxReturn} classMaxReturn - * @property {ClassDaysInLossPattern} classReturns - * @property {MetricsTree_Market_Dca_ClassStack} classStack - * @property {MetricsTree_Market_Dca_PeriodAveragePrice} periodAveragePrice - * @property {PeriodCagrPattern} periodCagr - * @property {PeriodDaysInLossPattern} periodDaysInLoss - * @property {PeriodDaysInLossPattern} periodDaysInProfit - * @property {PeriodDaysInLossPattern} periodLumpSumDaysInLoss - * @property {PeriodDaysInLossPattern} periodLumpSumDaysInProfit - * @property {PeriodDaysInLossPattern} periodLumpSumMaxDrawdown - * @property {PeriodDaysInLossPattern} periodLumpSumMaxReturn - * @property {PeriodDaysInLossPattern} periodLumpSumReturns - * @property {PeriodLumpSumStackPattern} periodLumpSumStack - * @property {PeriodDaysInLossPattern} periodMaxDrawdown - * @property {PeriodDaysInLossPattern} periodMaxReturn - * @property {PeriodDaysInLossPattern} periodReturns - * @property {PeriodLumpSumStackPattern} periodStack + */ + +/** + * @typedef {Object} MetricsTree_Market_Dca_PeriodAveragePrice + * @property {DollarsSatsPattern2} _1w + * @property {DollarsSatsPattern2} _1m + * @property {DollarsSatsPattern2} _3m + * @property {DollarsSatsPattern2} _6m + * @property {DollarsSatsPattern2} _1y + * @property {DollarsSatsPattern2} _2y + * @property {DollarsSatsPattern2} _3y + * @property {DollarsSatsPattern2} _4y + * @property {DollarsSatsPattern2} _5y + * @property {DollarsSatsPattern2} _6y + * @property {DollarsSatsPattern2} _8y + * @property {DollarsSatsPattern2} _10y + */ + +/** + * @typedef {Object} MetricsTree_Market_Dca_ClassStack + * @property {BitcoinDollarsSatsPattern5} _2015 + * @property {BitcoinDollarsSatsPattern5} _2016 + * @property {BitcoinDollarsSatsPattern5} _2017 + * @property {BitcoinDollarsSatsPattern5} _2018 + * @property {BitcoinDollarsSatsPattern5} _2019 + * @property {BitcoinDollarsSatsPattern5} _2020 + * @property {BitcoinDollarsSatsPattern5} _2021 + * @property {BitcoinDollarsSatsPattern5} _2022 + * @property {BitcoinDollarsSatsPattern5} _2023 + * @property {BitcoinDollarsSatsPattern5} _2024 + * @property {BitcoinDollarsSatsPattern5} _2025 + * @property {BitcoinDollarsSatsPattern5} _2026 */ /** * @typedef {Object} MetricsTree_Market_Dca_ClassAveragePrice - * @property {_0sdUsdPattern} _2015 - * @property {_0sdUsdPattern} _2016 - * @property {_0sdUsdPattern} _2017 - * @property {_0sdUsdPattern} _2018 - * @property {_0sdUsdPattern} _2019 - * @property {_0sdUsdPattern} _2020 - * @property {_0sdUsdPattern} _2021 - * @property {_0sdUsdPattern} _2022 - * @property {_0sdUsdPattern} _2023 - * @property {_0sdUsdPattern} _2024 - * @property {_0sdUsdPattern} _2025 - * @property {_0sdUsdPattern} _2026 + * @property {DollarsSatsPattern2} _2015 + * @property {DollarsSatsPattern2} _2016 + * @property {DollarsSatsPattern2} _2017 + * @property {DollarsSatsPattern2} _2018 + * @property {DollarsSatsPattern2} _2019 + * @property {DollarsSatsPattern2} _2020 + * @property {DollarsSatsPattern2} _2021 + * @property {DollarsSatsPattern2} _2022 + * @property {DollarsSatsPattern2} _2023 + * @property {DollarsSatsPattern2} _2024 + * @property {DollarsSatsPattern2} _2025 + * @property {DollarsSatsPattern2} _2026 */ /** - * @typedef {Object} MetricsTree_Market_Dca_ClassDaysInLoss + * @typedef {Object} MetricsTree_Market_Dca_ClassDaysInProfit * @property {MetricPattern4} _2015 * @property {MetricPattern4} _2016 * @property {MetricPattern4} _2017 @@ -3915,7 +4010,7 @@ function createOutputsPattern(client, acc) { */ /** - * @typedef {Object} MetricsTree_Market_Dca_ClassDaysInProfit + * @typedef {Object} MetricsTree_Market_Dca_ClassDaysInLoss * @property {MetricPattern4} _2015 * @property {MetricPattern4} _2016 * @property {MetricPattern4} _2017 @@ -3962,195 +4057,27 @@ function createOutputsPattern(client, acc) { * @property {MetricPattern4} _2026 */ -/** - * @typedef {Object} MetricsTree_Market_Dca_ClassStack - * @property {_2015Pattern} _2015 - * @property {_2015Pattern} _2016 - * @property {_2015Pattern} _2017 - * @property {_2015Pattern} _2018 - * @property {_2015Pattern} _2019 - * @property {_2015Pattern} _2020 - * @property {_2015Pattern} _2021 - * @property {_2015Pattern} _2022 - * @property {_2015Pattern} _2023 - * @property {_2015Pattern} _2024 - * @property {_2015Pattern} _2025 - * @property {_2015Pattern} _2026 - */ - -/** - * @typedef {Object} MetricsTree_Market_Dca_PeriodAveragePrice - * @property {_0sdUsdPattern} _10y - * @property {_0sdUsdPattern} _1m - * @property {_0sdUsdPattern} _1w - * @property {_0sdUsdPattern} _1y - * @property {_0sdUsdPattern} _2y - * @property {_0sdUsdPattern} _3m - * @property {_0sdUsdPattern} _3y - * @property {_0sdUsdPattern} _4y - * @property {_0sdUsdPattern} _5y - * @property {_0sdUsdPattern} _6m - * @property {_0sdUsdPattern} _6y - * @property {_0sdUsdPattern} _8y - */ - /** * @typedef {Object} MetricsTree_Market_Indicators - * @property {MetricPattern6} gini - * @property {MetricPattern6} macdHistogram - * @property {MetricPattern6} macdLine - * @property {MetricPattern6} macdSignal - * @property {MetricPattern4} nvt - * @property {MetricPattern6} piCycle * @property {MetricPattern4} puellMultiple - * @property {MetricPattern6} rsi14d - * @property {MetricPattern6} rsi14dMax - * @property {MetricPattern6} rsi14dMin - * @property {MetricPattern6} rsiAverageGain14d - * @property {MetricPattern6} rsiAverageLoss14d + * @property {MetricPattern4} nvt * @property {MetricPattern6} rsiGains * @property {MetricPattern6} rsiLosses - * @property {MetricPattern6} stochD - * @property {MetricPattern6} stochK + * @property {MetricPattern6} rsiAverageGain14d + * @property {MetricPattern6} rsiAverageLoss14d + * @property {MetricPattern6} rsi14d + * @property {MetricPattern6} rsi14dMin + * @property {MetricPattern6} rsi14dMax * @property {MetricPattern6} stochRsi - * @property {MetricPattern6} stochRsiD * @property {MetricPattern6} stochRsiK - */ - -/** - * @typedef {Object} MetricsTree_Market_Lookback - * @property {_0sdUsdPattern} _10y - * @property {_0sdUsdPattern} _1d - * @property {_0sdUsdPattern} _1m - * @property {_0sdUsdPattern} _1w - * @property {_0sdUsdPattern} _1y - * @property {_0sdUsdPattern} _2y - * @property {_0sdUsdPattern} _3m - * @property {_0sdUsdPattern} _3y - * @property {_0sdUsdPattern} _4y - * @property {_0sdUsdPattern} _5y - * @property {_0sdUsdPattern} _6m - * @property {_0sdUsdPattern} _6y - * @property {_0sdUsdPattern} _8y - */ - -/** - * @typedef {Object} MetricsTree_Market_MovingAverage - * @property {Price111dSmaPattern} price111dSma - * @property {Price111dSmaPattern} price12dEma - * @property {Price111dSmaPattern} price13dEma - * @property {Price111dSmaPattern} price13dSma - * @property {Price111dSmaPattern} price144dEma - * @property {Price111dSmaPattern} price144dSma - * @property {Price111dSmaPattern} price1mEma - * @property {Price111dSmaPattern} price1mSma - * @property {Price111dSmaPattern} price1wEma - * @property {Price111dSmaPattern} price1wSma - * @property {Price111dSmaPattern} price1yEma - * @property {Price111dSmaPattern} price1ySma - * @property {Price111dSmaPattern} price200dEma - * @property {Price111dSmaPattern} price200dSma - * @property {_0sdUsdPattern} price200dSmaX08 - * @property {_0sdUsdPattern} price200dSmaX24 - * @property {Price111dSmaPattern} price200wEma - * @property {Price111dSmaPattern} price200wSma - * @property {Price111dSmaPattern} price21dEma - * @property {Price111dSmaPattern} price21dSma - * @property {Price111dSmaPattern} price26dEma - * @property {Price111dSmaPattern} price2yEma - * @property {Price111dSmaPattern} price2ySma - * @property {Price111dSmaPattern} price34dEma - * @property {Price111dSmaPattern} price34dSma - * @property {Price111dSmaPattern} price350dSma - * @property {_0sdUsdPattern} price350dSmaX2 - * @property {Price111dSmaPattern} price4yEma - * @property {Price111dSmaPattern} price4ySma - * @property {Price111dSmaPattern} price55dEma - * @property {Price111dSmaPattern} price55dSma - * @property {Price111dSmaPattern} price89dEma - * @property {Price111dSmaPattern} price89dSma - * @property {Price111dSmaPattern} price8dEma - * @property {Price111dSmaPattern} price8dSma - */ - -/** - * @typedef {Object} MetricsTree_Market_Range - * @property {_0sdUsdPattern} price1mMax - * @property {_0sdUsdPattern} price1mMin - * @property {_0sdUsdPattern} price1wMax - * @property {_0sdUsdPattern} price1wMin - * @property {_0sdUsdPattern} price1yMax - * @property {_0sdUsdPattern} price1yMin - * @property {MetricPattern4} price2wChoppinessIndex - * @property {_0sdUsdPattern} price2wMax - * @property {_0sdUsdPattern} price2wMin - * @property {MetricPattern6} priceTrueRange - * @property {MetricPattern6} priceTrueRange2wSum - */ - -/** - * @typedef {Object} MetricsTree_Market_Returns - * @property {_1dReturns1mSdPattern} _1dReturns1mSd - * @property {_1dReturns1mSdPattern} _1dReturns1wSd - * @property {_1dReturns1mSdPattern} _1dReturns1ySd - * @property {PeriodCagrPattern} cagr - * @property {_1dReturns1mSdPattern} downside1mSd - * @property {_1dReturns1mSdPattern} downside1wSd - * @property {_1dReturns1mSdPattern} downside1ySd - * @property {MetricPattern6} downsideReturns - * @property {MetricsTree_Market_Returns_PriceReturns} priceReturns - */ - -/** - * @typedef {Object} MetricsTree_Market_Returns_PriceReturns - * @property {MetricPattern4} _10y - * @property {MetricPattern4} _1d - * @property {MetricPattern4} _1m - * @property {MetricPattern4} _1w - * @property {MetricPattern4} _1y - * @property {MetricPattern4} _2y - * @property {MetricPattern4} _3m - * @property {MetricPattern4} _3y - * @property {MetricPattern4} _4y - * @property {MetricPattern4} _5y - * @property {MetricPattern4} _6m - * @property {MetricPattern4} _6y - * @property {MetricPattern4} _8y - */ - -/** - * @typedef {Object} MetricsTree_Market_Volatility - * @property {MetricPattern4} price1mVolatility - * @property {MetricPattern4} price1wVolatility - * @property {MetricPattern4} price1yVolatility - * @property {MetricPattern6} sharpe1m - * @property {MetricPattern6} sharpe1w - * @property {MetricPattern6} sharpe1y - * @property {MetricPattern6} sortino1m - * @property {MetricPattern6} sortino1w - * @property {MetricPattern6} sortino1y - */ - -/** - * @typedef {Object} MetricsTree_Outputs - * @property {MetricsTree_Outputs_Count} count - * @property {MetricPattern11} firstTxoutindex - * @property {MetricPattern15} outputtype - * @property {MetricsTree_Outputs_Spent} spent - * @property {MetricPattern15} txindex - * @property {MetricPattern15} typeindex - * @property {MetricPattern15} value - */ - -/** - * @typedef {Object} MetricsTree_Outputs_Count - * @property {CountPattern2} totalCount - * @property {MetricPattern1} utxoCount - */ - -/** - * @typedef {Object} MetricsTree_Outputs_Spent - * @property {MetricPattern15} txinindex + * @property {MetricPattern6} stochRsiD + * @property {MetricPattern6} stochK + * @property {MetricPattern6} stochD + * @property {MetricPattern6} piCycle + * @property {MetricPattern6} macdLine + * @property {MetricPattern6} macdSignal + * @property {MetricPattern6} macdHistogram + * @property {MetricPattern6} gini */ /** @@ -4161,257 +4088,581 @@ function createOutputsPattern(client, acc) { /** * @typedef {Object} MetricsTree_Pools_Vecs - * @property {AaopoolPattern} aaopool - * @property {AaopoolPattern} antpool - * @property {AaopoolPattern} arkpool - * @property {AaopoolPattern} asicminer - * @property {AaopoolPattern} axbt - * @property {AaopoolPattern} batpool - * @property {AaopoolPattern} bcmonster - * @property {AaopoolPattern} bcpoolio - * @property {AaopoolPattern} binancepool - * @property {AaopoolPattern} bitalo - * @property {AaopoolPattern} bitclub - * @property {AaopoolPattern} bitcoinaffiliatenetwork - * @property {AaopoolPattern} bitcoincom - * @property {AaopoolPattern} bitcoinindia - * @property {AaopoolPattern} bitcoinrussia - * @property {AaopoolPattern} bitcoinukraine - * @property {AaopoolPattern} bitfarms - * @property {AaopoolPattern} bitfufupool - * @property {AaopoolPattern} bitfury - * @property {AaopoolPattern} bitminter - * @property {AaopoolPattern} bitparking - * @property {AaopoolPattern} bitsolo - * @property {AaopoolPattern} bixin - * @property {AaopoolPattern} blockfills - * @property {AaopoolPattern} braiinspool - * @property {AaopoolPattern} bravomining - * @property {AaopoolPattern} btcc - * @property {AaopoolPattern} btccom - * @property {AaopoolPattern} btcdig - * @property {AaopoolPattern} btcguild - * @property {AaopoolPattern} btclab - * @property {AaopoolPattern} btcmp - * @property {AaopoolPattern} btcnuggets - * @property {AaopoolPattern} btcpoolparty - * @property {AaopoolPattern} btcserv - * @property {AaopoolPattern} btctop - * @property {AaopoolPattern} btpool - * @property {AaopoolPattern} bwpool - * @property {AaopoolPattern} bytepool - * @property {AaopoolPattern} canoe - * @property {AaopoolPattern} canoepool - * @property {AaopoolPattern} carbonnegative - * @property {AaopoolPattern} ckpool - * @property {AaopoolPattern} cloudhashing - * @property {AaopoolPattern} coinlab - * @property {AaopoolPattern} cointerra - * @property {AaopoolPattern} connectbtc - * @property {AaopoolPattern} dcex - * @property {AaopoolPattern} dcexploration - * @property {AaopoolPattern} digitalbtc - * @property {AaopoolPattern} digitalxmintsy - * @property {AaopoolPattern} dpool - * @property {AaopoolPattern} eclipsemc - * @property {AaopoolPattern} eightbaochi - * @property {AaopoolPattern} ekanembtc - * @property {AaopoolPattern} eligius - * @property {AaopoolPattern} emcdpool - * @property {AaopoolPattern} entrustcharitypool - * @property {AaopoolPattern} eobot - * @property {AaopoolPattern} exxbw - * @property {AaopoolPattern} f2pool - * @property {AaopoolPattern} fiftyeightcoin - * @property {AaopoolPattern} foundryusa - * @property {AaopoolPattern} futurebitapollosolo - * @property {AaopoolPattern} gbminers - * @property {AaopoolPattern} ghashio - * @property {AaopoolPattern} givemecoins - * @property {AaopoolPattern} gogreenlight - * @property {AaopoolPattern} haominer - * @property {AaopoolPattern} haozhuzhu - * @property {AaopoolPattern} hashbx - * @property {AaopoolPattern} hashpool - * @property {AaopoolPattern} helix - * @property {AaopoolPattern} hhtt - * @property {AaopoolPattern} hotpool - * @property {AaopoolPattern} hummerpool - * @property {AaopoolPattern} huobipool - * @property {AaopoolPattern} innopolistech - * @property {AaopoolPattern} kanopool - * @property {AaopoolPattern} kncminer - * @property {AaopoolPattern} kucoinpool - * @property {AaopoolPattern} lubiancom - * @property {AaopoolPattern} luckypool - * @property {AaopoolPattern} luxor - * @property {AaopoolPattern} marapool - * @property {AaopoolPattern} maxbtc - * @property {AaopoolPattern} maxipool - * @property {AaopoolPattern} megabigpower - * @property {AaopoolPattern} minerium - * @property {AaopoolPattern} miningcity - * @property {AaopoolPattern} miningdutch - * @property {AaopoolPattern} miningkings - * @property {AaopoolPattern} miningsquared - * @property {AaopoolPattern} mmpool - * @property {AaopoolPattern} mtred - * @property {AaopoolPattern} multicoinco - * @property {AaopoolPattern} multipool - * @property {AaopoolPattern} mybtccoinpool - * @property {AaopoolPattern} neopool - * @property {AaopoolPattern} nexious - * @property {AaopoolPattern} nicehash - * @property {AaopoolPattern} nmcbit - * @property {AaopoolPattern} novablock - * @property {AaopoolPattern} ocean - * @property {AaopoolPattern} okexpool - * @property {AaopoolPattern} okkong - * @property {AaopoolPattern} okminer - * @property {AaopoolPattern} okpooltop - * @property {AaopoolPattern} onehash - * @property {AaopoolPattern} onem1x - * @property {AaopoolPattern} onethash - * @property {AaopoolPattern} ozcoin - * @property {AaopoolPattern} parasite - * @property {AaopoolPattern} patels - * @property {AaopoolPattern} pegapool - * @property {AaopoolPattern} phashio - * @property {AaopoolPattern} phoenix - * @property {AaopoolPattern} polmine - * @property {AaopoolPattern} pool175btc - * @property {AaopoolPattern} pool50btc - * @property {AaopoolPattern} poolin - * @property {AaopoolPattern} portlandhodl - * @property {AaopoolPattern} publicpool - * @property {AaopoolPattern} purebtccom - * @property {AaopoolPattern} rawpool - * @property {AaopoolPattern} rigpool - * @property {AaopoolPattern} sbicrypto - * @property {AaopoolPattern} secpool - * @property {AaopoolPattern} secretsuperstar - * @property {AaopoolPattern} sevenpool - * @property {AaopoolPattern} shawnp0wers - * @property {AaopoolPattern} sigmapoolcom - * @property {AaopoolPattern} simplecoinus - * @property {AaopoolPattern} solock - * @property {AaopoolPattern} spiderpool - * @property {AaopoolPattern} stminingcorp - * @property {AaopoolPattern} tangpool - * @property {AaopoolPattern} tatmaspool - * @property {AaopoolPattern} tbdice - * @property {AaopoolPattern} telco214 - * @property {AaopoolPattern} terrapool - * @property {AaopoolPattern} tiger - * @property {AaopoolPattern} tigerpoolnet - * @property {AaopoolPattern} titan - * @property {AaopoolPattern} transactioncoinmining - * @property {AaopoolPattern} trickysbtcpool - * @property {AaopoolPattern} triplemining - * @property {AaopoolPattern} twentyoneinc - * @property {AaopoolPattern} ultimuspool - * @property {AaopoolPattern} unknown - * @property {AaopoolPattern} unomp - * @property {AaopoolPattern} viabtc - * @property {AaopoolPattern} waterhole - * @property {AaopoolPattern} wayicn - * @property {AaopoolPattern} whitepool - * @property {AaopoolPattern} wk057 - * @property {AaopoolPattern} yourbtcnet - * @property {AaopoolPattern} zulupool - */ - -/** - * @typedef {Object} MetricsTree_Positions - * @property {MetricPattern11} blockPosition - * @property {MetricPattern27} txPosition + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} unknown + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} blockfills + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} ultimuspool + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} terrapool + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} luxor + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} onethash + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} btccom + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} bitfarms + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} huobipool + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} wayicn + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} canoepool + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} btctop + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} bitcoincom + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} pool175btc + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} gbminers + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} axbt + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} asicminer + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} bitminter + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} bitcoinrussia + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} btcserv + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} simplecoinus + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} btcguild + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} eligius + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} ozcoin + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} eclipsemc + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} maxbtc + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} triplemining + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} coinlab + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} pool50btc + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} ghashio + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} stminingcorp + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} bitparking + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} mmpool + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} polmine + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} kncminer + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} bitalo + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} f2pool + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} hhtt + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} megabigpower + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} mtred + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} nmcbit + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} yourbtcnet + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} givemecoins + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} braiinspool + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} antpool + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} multicoinco + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} bcpoolio + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} cointerra + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} kanopool + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} solock + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} ckpool + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} nicehash + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} bitclub + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} bitcoinaffiliatenetwork + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} btcc + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} bwpool + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} exxbw + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} bitsolo + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} bitfury + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} twentyoneinc + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} digitalbtc + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} eightbaochi + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} mybtccoinpool + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} tbdice + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} hashpool + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} nexious + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} bravomining + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} hotpool + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} okexpool + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} bcmonster + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} onehash + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} bixin + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} tatmaspool + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} viabtc + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} connectbtc + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} batpool + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} waterhole + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} dcexploration + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} dcex + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} btpool + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} fiftyeightcoin + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} bitcoinindia + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} shawnp0wers + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} phashio + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} rigpool + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} haozhuzhu + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} sevenpool + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} miningkings + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} hashbx + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} dpool + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} rawpool + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} haominer + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} helix + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} bitcoinukraine + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} poolin + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} secretsuperstar + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} tigerpoolnet + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} sigmapoolcom + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} okpooltop + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} hummerpool + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} tangpool + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} bytepool + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} spiderpool + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} novablock + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} miningcity + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} binancepool + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} minerium + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} lubiancom + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} okkong + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} aaopool + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} emcdpool + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} foundryusa + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} sbicrypto + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} arkpool + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} purebtccom + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} marapool + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} kucoinpool + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} entrustcharitypool + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} okminer + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} titan + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} pegapool + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} btcnuggets + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} cloudhashing + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} digitalxmintsy + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} telco214 + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} btcpoolparty + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} multipool + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} transactioncoinmining + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} btcdig + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} trickysbtcpool + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} btcmp + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} eobot + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} unomp + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} patels + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} gogreenlight + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} ekanembtc + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} canoe + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} tiger + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} onem1x + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} zulupool + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} secpool + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} ocean + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} whitepool + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} wk057 + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} futurebitapollosolo + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} carbonnegative + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} portlandhodl + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} phoenix + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} neopool + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} maxipool + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} bitfufupool + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} luckypool + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} miningdutch + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} publicpool + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} miningsquared + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} innopolistech + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} btclab + * @property {_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern} parasite */ /** * @typedef {Object} MetricsTree_Price * @property {MetricsTree_Price_Cents} cents - * @property {SatsPattern} sats * @property {MetricsTree_Price_Usd} usd + * @property {OhlcSplitPattern2} sats */ /** * @typedef {Object} MetricsTree_Price_Cents - * @property {MetricPattern5} ohlc * @property {MetricsTree_Price_Cents_Split} split + * @property {MetricPattern5} ohlc */ /** * @typedef {Object} MetricsTree_Price_Cents_Split - * @property {MetricPattern5} close - * @property {MetricPattern5} high - * @property {MetricPattern5} low - * @property {MetricPattern5} open + * @property {MetricPattern5} open + * @property {MetricPattern5} high + * @property {MetricPattern5} low + * @property {MetricPattern5} close */ /** * @typedef {Object} MetricsTree_Price_Usd + * @property {CloseHighLowOpenPattern2} split * @property {MetricPattern1} ohlc - * @property {SplitPattern2} split */ /** - * @typedef {Object} MetricsTree_Scripts - * @property {MetricsTree_Scripts_Count} count - * @property {MetricPattern9} emptyToTxindex - * @property {MetricPattern11} firstEmptyoutputindex - * @property {MetricPattern11} firstOpreturnindex - * @property {MetricPattern11} firstP2msoutputindex - * @property {MetricPattern11} firstUnknownoutputindex - * @property {MetricPattern14} opreturnToTxindex - * @property {MetricPattern17} p2msToTxindex - * @property {MetricPattern28} unknownToTxindex - * @property {MetricsTree_Scripts_Value} value + * @typedef {Object} MetricsTree_Distribution + * @property {MetricPattern11} chainState + * @property {MetricsTree_Distribution_AnyAddressIndexes} anyAddressIndexes + * @property {MetricsTree_Distribution_AddressesData} addressesData + * @property {MetricsTree_Distribution_UtxoCohorts} utxoCohorts + * @property {MetricsTree_Distribution_AddressCohorts} addressCohorts + * @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern} addrCount + * @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern} emptyAddrCount + * @property {MetricsTree_Distribution_AddressActivity} addressActivity + * @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern} totalAddrCount + * @property {MetricsTree_Distribution_NewAddrCount} newAddrCount + * @property {MetricsTree_Distribution_GrowthRate} growthRate + * @property {MetricPattern31} loadedaddressindex + * @property {MetricPattern32} emptyaddressindex */ /** - * @typedef {Object} MetricsTree_Scripts_Count - * @property {DollarsPattern} emptyoutput - * @property {DollarsPattern} opreturn - * @property {DollarsPattern} p2a - * @property {DollarsPattern} p2ms - * @property {DollarsPattern} p2pk33 - * @property {DollarsPattern} p2pk65 - * @property {DollarsPattern} p2pkh - * @property {DollarsPattern} p2sh - * @property {DollarsPattern} p2tr - * @property {DollarsPattern} p2wpkh - * @property {DollarsPattern} p2wsh - * @property {DollarsPattern} segwit - * @property {SegwitAdoptionPattern} segwitAdoption - * @property {SegwitAdoptionPattern} taprootAdoption - * @property {DollarsPattern} unknownoutput + * @typedef {Object} MetricsTree_Distribution_AnyAddressIndexes + * @property {MetricPattern16} p2a + * @property {MetricPattern18} p2pk33 + * @property {MetricPattern19} p2pk65 + * @property {MetricPattern20} p2pkh + * @property {MetricPattern21} p2sh + * @property {MetricPattern22} p2tr + * @property {MetricPattern23} p2wpkh + * @property {MetricPattern24} p2wsh */ /** - * @typedef {Object} MetricsTree_Scripts_Value - * @property {CoinbasePattern} opreturn + * @typedef {Object} MetricsTree_Distribution_AddressesData + * @property {MetricPattern31} loaded + * @property {MetricPattern32} empty + */ + +/** + * @typedef {Object} MetricsTree_Distribution_UtxoCohorts + * @property {MetricsTree_Distribution_UtxoCohorts_All} all + * @property {MetricsTree_Distribution_UtxoCohorts_AgeRange} ageRange + * @property {MetricsTree_Distribution_UtxoCohorts_Epoch} epoch + * @property {MetricsTree_Distribution_UtxoCohorts_Year} year + * @property {MetricsTree_Distribution_UtxoCohorts_MinAge} minAge + * @property {MetricsTree_Distribution_UtxoCohorts_GeAmount} geAmount + * @property {MetricsTree_Distribution_UtxoCohorts_AmountRange} amountRange + * @property {MetricsTree_Distribution_UtxoCohorts_Term} term + * @property {MetricsTree_Distribution_UtxoCohorts_Type} type + * @property {MetricsTree_Distribution_UtxoCohorts_MaxAge} maxAge + * @property {MetricsTree_Distribution_UtxoCohorts_LtAmount} ltAmount + */ + +/** + * @typedef {Object} MetricsTree_Distribution_UtxoCohorts_All + * @property {HalvedTotalPattern} supply + * @property {UtxoPattern} outputs + * @property {CoinblocksCoindaysSatblocksSatdaysSentPattern} activity + * @property {AdjustedAthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern} realized + * @property {AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern} unrealized + * @property {InvestedMaxMinPercentilesSpotPattern} costBasis + * @property {MetricsTree_Distribution_UtxoCohorts_All_Relative} relative + */ + +/** + * @typedef {Object} MetricsTree_Distribution_UtxoCohorts_All_Relative + * @property {MetricPattern1} supplyInProfitRelToOwnSupply + * @property {MetricPattern1} supplyInLossRelToOwnSupply + * @property {MetricPattern1} unrealizedProfitRelToOwnTotalUnrealizedPnl + * @property {MetricPattern1} unrealizedLossRelToOwnTotalUnrealizedPnl + * @property {MetricPattern1} negUnrealizedLossRelToOwnTotalUnrealizedPnl + * @property {MetricPattern1} netUnrealizedPnlRelToOwnTotalUnrealizedPnl + * @property {MetricPattern1} investedCapitalInProfitPct + * @property {MetricPattern1} investedCapitalInLossPct + */ + +/** + * @typedef {Object} MetricsTree_Distribution_UtxoCohorts_AgeRange + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern} upTo1h + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern} _1hTo1d + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern} _1dTo1w + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern} _1wTo1m + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern} _1mTo2m + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern} _2mTo3m + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern} _3mTo4m + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern} _4mTo5m + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern} _5mTo6m + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern} _6mTo1y + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern} _1yTo2y + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern} _2yTo3y + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern} _3yTo4y + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern} _4yTo5y + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern} _5yTo6y + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern} _6yTo7y + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern} _7yTo8y + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern} _8yTo10y + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern} _10yTo12y + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern} _12yTo15y + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern} from15y + */ + +/** + * @typedef {Object} MetricsTree_Distribution_UtxoCohorts_Epoch + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} _0 + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} _1 + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} _2 + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} _3 + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} _4 + */ + +/** + * @typedef {Object} MetricsTree_Distribution_UtxoCohorts_Year + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} _2009 + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} _2010 + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} _2011 + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} _2012 + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} _2013 + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} _2014 + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} _2015 + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} _2016 + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} _2017 + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} _2018 + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} _2019 + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} _2020 + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} _2021 + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} _2022 + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} _2023 + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} _2024 + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} _2025 + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} _2026 + */ + +/** + * @typedef {Object} MetricsTree_Distribution_UtxoCohorts_MinAge + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} _1d + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} _1w + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} _1m + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} _2m + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} _3m + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} _4m + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} _5m + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} _6m + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} _1y + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} _2y + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} _3y + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} _4y + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} _5y + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} _6y + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} _7y + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} _8y + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} _10y + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} _12y + */ + +/** + * @typedef {Object} MetricsTree_Distribution_UtxoCohorts_GeAmount + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} _1sat + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} _10sats + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} _100sats + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} _1kSats + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} _10kSats + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} _100kSats + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} _1mSats + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} _10mSats + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} _1btc + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} _10btc + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} _100btc + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} _1kBtc + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} _10kBtc + */ + +/** + * @typedef {Object} MetricsTree_Distribution_UtxoCohorts_AmountRange + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} _0sats + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} _1satTo10sats + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} _10satsTo100sats + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} _100satsTo1kSats + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} _1kSatsTo10kSats + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} _10kSatsTo100kSats + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} _100kSatsTo1mSats + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} _1mSatsTo10mSats + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} _10mSatsTo1btc + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} _1btcTo10btc + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} _10btcTo100btc + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} _100btcTo1kBtc + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} _1kBtcTo10kBtc + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} _10kBtcTo100kBtc + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} _100kBtcOrMore + */ + +/** + * @typedef {Object} MetricsTree_Distribution_UtxoCohorts_Term + * @property {MetricsTree_Distribution_UtxoCohorts_Term_Short} short + * @property {MetricsTree_Distribution_UtxoCohorts_Term_Long} long + */ + +/** + * @typedef {Object} MetricsTree_Distribution_UtxoCohorts_Term_Short + * @property {HalvedTotalPattern} supply + * @property {UtxoPattern} outputs + * @property {CoinblocksCoindaysSatblocksSatdaysSentPattern} activity + * @property {AdjustedAthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern} realized + * @property {AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern} unrealized + * @property {InvestedMaxMinPercentilesSpotPattern} costBasis + * @property {InvestedNegNetNuplSupplyUnrealizedPattern2} relative + */ + +/** + * @typedef {Object} MetricsTree_Distribution_UtxoCohorts_Term_Long + * @property {HalvedTotalPattern} supply + * @property {UtxoPattern} outputs + * @property {CoinblocksCoindaysSatblocksSatdaysSentPattern} activity + * @property {AthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern2} realized + * @property {AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern} unrealized + * @property {InvestedMaxMinPercentilesSpotPattern} costBasis + * @property {InvestedNegNetNuplSupplyUnrealizedPattern2} relative + */ + +/** + * @typedef {Object} MetricsTree_Distribution_UtxoCohorts_Type + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} p2pk65 + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} p2pk33 + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} p2pkh + * @property {ActivityCostOutputsRealizedSupplyUnrealizedPattern} p2ms + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} p2sh + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} p2wpkh + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} p2wsh + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} p2tr + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} p2a + * @property {ActivityCostOutputsRealizedSupplyUnrealizedPattern} unknown + * @property {ActivityCostOutputsRealizedSupplyUnrealizedPattern} empty + */ + +/** + * @typedef {Object} MetricsTree_Distribution_UtxoCohorts_MaxAge + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5} _1w + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5} _1m + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5} _2m + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5} _3m + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5} _4m + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5} _5m + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5} _6m + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5} _1y + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5} _2y + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5} _3y + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5} _4y + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5} _5y + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5} _6y + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5} _7y + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5} _8y + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5} _10y + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5} _12y + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5} _15y + */ + +/** + * @typedef {Object} MetricsTree_Distribution_UtxoCohorts_LtAmount + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} _10sats + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} _100sats + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} _1kSats + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} _10kSats + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} _100kSats + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} _1mSats + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} _10mSats + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} _1btc + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} _10btc + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} _100btc + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} _1kBtc + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} _10kBtc + * @property {ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} _100kBtc + */ + +/** + * @typedef {Object} MetricsTree_Distribution_AddressCohorts + * @property {MetricsTree_Distribution_AddressCohorts_GeAmount} geAmount + * @property {MetricsTree_Distribution_AddressCohorts_AmountRange} amountRange + * @property {MetricsTree_Distribution_AddressCohorts_LtAmount} ltAmount + */ + +/** + * @typedef {Object} MetricsTree_Distribution_AddressCohorts_GeAmount + * @property {ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern} _1sat + * @property {ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern} _10sats + * @property {ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern} _100sats + * @property {ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern} _1kSats + * @property {ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern} _10kSats + * @property {ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern} _100kSats + * @property {ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern} _1mSats + * @property {ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern} _10mSats + * @property {ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern} _1btc + * @property {ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern} _10btc + * @property {ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern} _100btc + * @property {ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern} _1kBtc + * @property {ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern} _10kBtc + */ + +/** + * @typedef {Object} MetricsTree_Distribution_AddressCohorts_AmountRange + * @property {ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern} _0sats + * @property {ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern} _1satTo10sats + * @property {ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern} _10satsTo100sats + * @property {ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern} _100satsTo1kSats + * @property {ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern} _1kSatsTo10kSats + * @property {ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern} _10kSatsTo100kSats + * @property {ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern} _100kSatsTo1mSats + * @property {ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern} _1mSatsTo10mSats + * @property {ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern} _10mSatsTo1btc + * @property {ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern} _1btcTo10btc + * @property {ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern} _10btcTo100btc + * @property {ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern} _100btcTo1kBtc + * @property {ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern} _1kBtcTo10kBtc + * @property {ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern} _10kBtcTo100kBtc + * @property {ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern} _100kBtcOrMore + */ + +/** + * @typedef {Object} MetricsTree_Distribution_AddressCohorts_LtAmount + * @property {ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern} _10sats + * @property {ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern} _100sats + * @property {ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern} _1kSats + * @property {ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern} _10kSats + * @property {ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern} _100kSats + * @property {ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern} _1mSats + * @property {ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern} _10mSats + * @property {ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern} _1btc + * @property {ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern} _10btc + * @property {ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern} _100btc + * @property {ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern} _1kBtc + * @property {ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern} _10kBtc + * @property {ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern} _100kBtc + */ + +/** + * @typedef {Object} MetricsTree_Distribution_AddressActivity + * @property {BalanceBothReactivatedReceivingSendingPattern} all + * @property {BalanceBothReactivatedReceivingSendingPattern} p2pk65 + * @property {BalanceBothReactivatedReceivingSendingPattern} p2pk33 + * @property {BalanceBothReactivatedReceivingSendingPattern} p2pkh + * @property {BalanceBothReactivatedReceivingSendingPattern} p2sh + * @property {BalanceBothReactivatedReceivingSendingPattern} p2wpkh + * @property {BalanceBothReactivatedReceivingSendingPattern} p2wsh + * @property {BalanceBothReactivatedReceivingSendingPattern} p2tr + * @property {BalanceBothReactivatedReceivingSendingPattern} p2a + */ + +/** + * @typedef {Object} MetricsTree_Distribution_NewAddrCount + * @property {AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} all + * @property {AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} p2pk65 + * @property {AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} p2pk33 + * @property {AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} p2pkh + * @property {AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} p2sh + * @property {AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} p2wpkh + * @property {AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} p2wsh + * @property {AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} p2tr + * @property {AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} p2a + */ + +/** + * @typedef {Object} MetricsTree_Distribution_GrowthRate + * @property {AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern} all + * @property {AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern} p2pk65 + * @property {AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern} p2pk33 + * @property {AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern} p2pkh + * @property {AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern} p2sh + * @property {AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern} p2wpkh + * @property {AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern} p2wsh + * @property {AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern} p2tr + * @property {AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern} p2a */ /** * @typedef {Object} MetricsTree_Supply - * @property {MetricsTree_Supply_Burned} burned * @property {MetricsTree_Supply_Circulating} circulating + * @property {MetricsTree_Supply_Burned} burned * @property {MetricPattern4} inflation - * @property {MetricPattern1} marketCap * @property {MetricsTree_Supply_Velocity} velocity - */ - -/** - * @typedef {Object} MetricsTree_Supply_Burned - * @property {UnclaimedRewardsPattern} opreturn - * @property {UnclaimedRewardsPattern} unspendable + * @property {MetricPattern1} marketCap */ /** * @typedef {Object} MetricsTree_Supply_Circulating + * @property {MetricPattern3} sats * @property {MetricPattern3} bitcoin * @property {MetricPattern3} dollars - * @property {MetricPattern3} sats + */ + +/** + * @typedef {Object} MetricsTree_Supply_Burned + * @property {BitcoinDollarsSatsPattern3} opreturn + * @property {BitcoinDollarsSatsPattern3} unspendable */ /** @@ -4420,76 +4671,12 @@ function createOutputsPattern(client, acc) { * @property {MetricPattern4} usd */ -/** - * @typedef {Object} MetricsTree_Transactions - * @property {MetricPattern27} baseSize - * @property {MetricsTree_Transactions_Count} count - * @property {MetricsTree_Transactions_Fees} fees - * @property {MetricPattern11} firstTxindex - * @property {MetricPattern27} firstTxinindex - * @property {MetricPattern27} firstTxoutindex - * @property {MetricPattern27} height - * @property {MetricPattern27} isExplicitlyRbf - * @property {MetricPattern27} rawlocktime - * @property {MetricsTree_Transactions_Size} size - * @property {MetricPattern27} totalSize - * @property {MetricPattern27} txid - * @property {MetricPattern27} txversion - * @property {MetricsTree_Transactions_Versions} versions - * @property {MetricsTree_Transactions_Volume} volume - */ - -/** - * @typedef {Object} MetricsTree_Transactions_Count - * @property {MetricPattern27} isCoinbase - * @property {DollarsPattern} txCount - */ - -/** - * @typedef {Object} MetricsTree_Transactions_Fees - * @property {MetricsTree_Transactions_Fees_Fee} fee - * @property {FeeRatePattern} feeRate - * @property {MetricPattern27} inputValue - * @property {MetricPattern27} outputValue - */ - -/** - * @typedef {Object} MetricsTree_Transactions_Fees_Fee - * @property {CountPattern2} bitcoin - * @property {CountPattern2} dollars - * @property {CountPattern2} sats - * @property {MetricPattern27} txindex - */ - -/** - * @typedef {Object} MetricsTree_Transactions_Size - * @property {FeeRatePattern} vsize - * @property {FeeRatePattern} weight - */ - -/** - * @typedef {Object} MetricsTree_Transactions_Versions - * @property {BlockCountPattern} v1 - * @property {BlockCountPattern} v2 - * @property {BlockCountPattern} v3 - */ - -/** - * @typedef {Object} MetricsTree_Transactions_Volume - * @property {_2015Pattern} annualizedVolume - * @property {MetricPattern4} inputsPerSec - * @property {MetricPattern4} outputsPerSec - * @property {ActiveSupplyPattern} receivedSum - * @property {ActiveSupplyPattern} sentSum - * @property {MetricPattern4} txPerSec - */ - /** * Main BRK client with metrics tree and API methods * @extends BrkClientBase */ class BrkClient extends BrkClientBase { - VERSION = "v0.1.1"; + VERSION = "v0.1.2"; INDEXES = /** @type {const} */ ([ "dateindex", @@ -5418,480 +5605,276 @@ class BrkClient extends BrkClientBase { */ _buildTree(basePath) { return { - addresses: { - firstP2aaddressindex: createMetricPattern11(this, 'first_p2aaddressindex'), - firstP2pk33addressindex: createMetricPattern11(this, 'first_p2pk33addressindex'), - firstP2pk65addressindex: createMetricPattern11(this, 'first_p2pk65addressindex'), - firstP2pkhaddressindex: createMetricPattern11(this, 'first_p2pkhaddressindex'), - firstP2shaddressindex: createMetricPattern11(this, 'first_p2shaddressindex'), - firstP2traddressindex: createMetricPattern11(this, 'first_p2traddressindex'), - firstP2wpkhaddressindex: createMetricPattern11(this, 'first_p2wpkhaddressindex'), - firstP2wshaddressindex: createMetricPattern11(this, 'first_p2wshaddressindex'), - p2abytes: createMetricPattern16(this, 'p2abytes'), - p2pk33bytes: createMetricPattern18(this, 'p2pk33bytes'), - p2pk65bytes: createMetricPattern19(this, 'p2pk65bytes'), - p2pkhbytes: createMetricPattern20(this, 'p2pkhbytes'), - p2shbytes: createMetricPattern21(this, 'p2shbytes'), - p2trbytes: createMetricPattern22(this, 'p2trbytes'), - p2wpkhbytes: createMetricPattern23(this, 'p2wpkhbytes'), - p2wshbytes: createMetricPattern24(this, 'p2wshbytes'), - }, blocks: { blockhash: createMetricPattern11(this, 'blockhash'), - count: { - _1mBlockCount: createMetricPattern1(this, '1m_block_count'), - _1mStart: createMetricPattern11(this, '1m_start'), - _1wBlockCount: createMetricPattern1(this, '1w_block_count'), - _1wStart: createMetricPattern11(this, '1w_start'), - _1yBlockCount: createMetricPattern1(this, '1y_block_count'), - _1yStart: createMetricPattern11(this, '1y_start'), - _24hBlockCount: createMetricPattern1(this, '24h_block_count'), - _24hStart: createMetricPattern11(this, '24h_start'), - blockCount: createBlockCountPattern(this, 'block_count'), - blockCountTarget: createMetricPattern4(this, 'block_count_target'), - }, difficulty: { - adjustment: createMetricPattern1(this, 'difficulty_adjustment'), + raw: createMetricPattern1(this, 'difficulty'), asHash: createMetricPattern1(this, 'difficulty_as_hash'), + adjustment: createMetricPattern1(this, 'difficulty_adjustment'), + epoch: createMetricPattern4(this, 'difficultyepoch'), blocksBeforeNextAdjustment: createMetricPattern1(this, 'blocks_before_next_difficulty_adjustment'), daysBeforeNextAdjustment: createMetricPattern1(this, 'days_before_next_difficulty_adjustment'), - epoch: createMetricPattern4(this, 'difficultyepoch'), - raw: createMetricPattern1(this, 'difficulty'), }, - fullness: createFullnessPattern(this, 'block_fullness'), - halving: { - blocksBeforeNextHalving: createMetricPattern1(this, 'blocks_before_next_halving'), - daysBeforeNextHalving: createMetricPattern1(this, 'days_before_next_halving'), - epoch: createMetricPattern4(this, 'halvingepoch'), + time: { + timestamp: createMetricPattern1(this, 'timestamp'), + date: createMetricPattern11(this, 'date'), + timestampMonotonic: createMetricPattern11(this, 'timestamp_monotonic'), }, - interval: createFullnessPattern(this, 'block_interval'), + totalSize: createMetricPattern11(this, 'total_size'), + weight: createAverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(this, 'block_weight'), + count: { + blockCountTarget: createMetricPattern4(this, 'block_count_target'), + blockCount: createCumulativeSumPattern(this, 'block_count'), + _24hStart: createMetricPattern11(this, '24h_start'), + _1wStart: createMetricPattern11(this, '1w_start'), + _1mStart: createMetricPattern11(this, '1m_start'), + _1yStart: createMetricPattern11(this, '1y_start'), + _24hBlockCount: createMetricPattern1(this, '24h_block_count'), + _1wBlockCount: createMetricPattern1(this, '1w_block_count'), + _1mBlockCount: createMetricPattern1(this, '1m_block_count'), + _1yBlockCount: createMetricPattern1(this, '1y_block_count'), + }, + interval: createAverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern(this, 'block_interval'), mining: { + hashRate: createMetricPattern1(this, 'hash_rate'), + hashRate1wSma: createMetricPattern4(this, 'hash_rate_1w_sma'), + hashRate1mSma: createMetricPattern4(this, 'hash_rate_1m_sma'), + hashRate2mSma: createMetricPattern4(this, 'hash_rate_2m_sma'), + hashRate1ySma: createMetricPattern4(this, 'hash_rate_1y_sma'), + hashPriceThs: createMetricPattern1(this, 'hash_price_ths'), + hashPriceThsMin: createMetricPattern1(this, 'hash_price_ths_min'), hashPricePhs: createMetricPattern1(this, 'hash_price_phs'), hashPricePhsMin: createMetricPattern1(this, 'hash_price_phs_min'), hashPriceRebound: createMetricPattern1(this, 'hash_price_rebound'), - hashPriceThs: createMetricPattern1(this, 'hash_price_ths'), - hashPriceThsMin: createMetricPattern1(this, 'hash_price_ths_min'), - hashRate: createMetricPattern1(this, 'hash_rate'), - hashRate1mSma: createMetricPattern4(this, 'hash_rate_1m_sma'), - hashRate1wSma: createMetricPattern4(this, 'hash_rate_1w_sma'), - hashRate1ySma: createMetricPattern4(this, 'hash_rate_1y_sma'), - hashRate2mSma: createMetricPattern4(this, 'hash_rate_2m_sma'), + hashValueThs: createMetricPattern1(this, 'hash_value_ths'), + hashValueThsMin: createMetricPattern1(this, 'hash_value_ths_min'), hashValuePhs: createMetricPattern1(this, 'hash_value_phs'), hashValuePhsMin: createMetricPattern1(this, 'hash_value_phs_min'), hashValueRebound: createMetricPattern1(this, 'hash_value_rebound'), - hashValueThs: createMetricPattern1(this, 'hash_value_ths'), - hashValueThsMin: createMetricPattern1(this, 'hash_value_ths_min'), }, rewards: { _24hCoinbaseSum: { + sats: createMetricPattern11(this, '24h_coinbase_sum'), bitcoin: createMetricPattern11(this, '24h_coinbase_sum_btc'), dollars: createMetricPattern11(this, '24h_coinbase_sum_usd'), - sats: createMetricPattern11(this, '24h_coinbase_sum'), }, - coinbase: createCoinbasePattern(this, 'coinbase'), + coinbase: createBitcoinDollarsSatsPattern2(this, 'coinbase'), + subsidy: createBitcoinDollarsSatsPattern2(this, 'subsidy'), + unclaimedRewards: createBitcoinDollarsSatsPattern3(this, 'unclaimed_rewards'), feeDominance: createMetricPattern6(this, 'fee_dominance'), - subsidy: createCoinbasePattern(this, 'subsidy'), subsidyDominance: createMetricPattern6(this, 'subsidy_dominance'), subsidyUsd1ySma: createMetricPattern4(this, 'subsidy_usd_1y_sma'), - unclaimedRewards: createUnclaimedRewardsPattern(this, 'unclaimed_rewards'), }, + halving: { + epoch: createMetricPattern4(this, 'halvingepoch'), + blocksBeforeNextHalving: createMetricPattern1(this, 'blocks_before_next_halving'), + daysBeforeNextHalving: createMetricPattern1(this, 'days_before_next_halving'), + }, + vbytes: createAverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(this, 'block_vbytes'), size: { - average: createMetricPattern2(this, 'block_size_average'), cumulative: createMetricPattern1(this, 'block_size_cumulative'), - max: createMetricPattern2(this, 'block_size_max'), - median: createMetricPattern6(this, 'block_size_median'), + average: createMetricPattern2(this, 'block_size_average'), min: createMetricPattern2(this, 'block_size_min'), + max: createMetricPattern2(this, 'block_size_max'), pct10: createMetricPattern6(this, 'block_size_pct10'), pct25: createMetricPattern6(this, 'block_size_pct25'), + median: createMetricPattern6(this, 'block_size_median'), pct75: createMetricPattern6(this, 'block_size_pct75'), pct90: createMetricPattern6(this, 'block_size_pct90'), sum: createMetricPattern2(this, 'block_size_sum'), }, - time: { - date: createMetricPattern11(this, 'date'), - timestamp: createMetricPattern1(this, 'timestamp'), - timestampMonotonic: createMetricPattern11(this, 'timestamp_monotonic'), + fullness: createAverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern(this, 'block_fullness'), + }, + transactions: { + firstTxindex: createMetricPattern11(this, 'first_txindex'), + height: createMetricPattern27(this, 'height'), + txid: createMetricPattern27(this, 'txid'), + txversion: createMetricPattern27(this, 'txversion'), + rawlocktime: createMetricPattern27(this, 'rawlocktime'), + baseSize: createMetricPattern27(this, 'base_size'), + totalSize: createMetricPattern27(this, 'total_size'), + isExplicitlyRbf: createMetricPattern27(this, 'is_explicitly_rbf'), + firstTxinindex: createMetricPattern27(this, 'first_txinindex'), + firstTxoutindex: createMetricPattern27(this, 'first_txoutindex'), + count: { + txCount: createAverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(this, 'tx_count'), + isCoinbase: createMetricPattern27(this, 'is_coinbase'), }, - totalSize: createMetricPattern11(this, 'total_size'), - vbytes: createDollarsPattern(this, 'block_vbytes'), - weight: createDollarsPattern(this, 'block_weight'), + size: { + vsize: createAverageMaxMedianMinPct10Pct25Pct75Pct90TxindexPattern(this, 'tx_vsize'), + weight: createAverageMaxMedianMinPct10Pct25Pct75Pct90TxindexPattern(this, 'tx_weight'), + }, + fees: { + inputValue: createMetricPattern27(this, 'input_value'), + outputValue: createMetricPattern27(this, 'output_value'), + fee: { + txindex: createMetricPattern27(this, 'fee'), + sats: createAverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(this, 'fee'), + bitcoin: createAverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(this, 'fee_btc'), + dollars: createAverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(this, 'fee_usd'), + }, + feeRate: createAverageMaxMedianMinPct10Pct25Pct75Pct90TxindexPattern(this, 'fee_rate'), + }, + versions: { + v1: createCumulativeSumPattern(this, 'tx_v1'), + v2: createCumulativeSumPattern(this, 'tx_v2'), + v3: createCumulativeSumPattern(this, 'tx_v3'), + }, + volume: { + sentSum: createBitcoinDollarsSatsPattern4(this, 'sent_sum'), + receivedSum: createBitcoinDollarsSatsPattern4(this, 'received_sum'), + annualizedVolume: createBitcoinDollarsSatsPattern5(this, 'annualized_volume'), + txPerSec: createMetricPattern4(this, 'tx_per_sec'), + outputsPerSec: createMetricPattern4(this, 'outputs_per_sec'), + inputsPerSec: createMetricPattern4(this, 'inputs_per_sec'), + }, + }, + inputs: { + firstTxinindex: createMetricPattern11(this, 'first_txinindex'), + outpoint: createMetricPattern12(this, 'outpoint'), + txindex: createMetricPattern12(this, 'txindex'), + outputtype: createMetricPattern12(this, 'outputtype'), + typeindex: createMetricPattern12(this, 'typeindex'), + spent: { + txoutindex: createMetricPattern12(this, 'txoutindex'), + value: createMetricPattern12(this, 'value'), + }, + count: createAverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(this, 'input_count'), + }, + outputs: { + firstTxoutindex: createMetricPattern11(this, 'first_txoutindex'), + value: createMetricPattern15(this, 'value'), + outputtype: createMetricPattern15(this, 'outputtype'), + typeindex: createMetricPattern15(this, 'typeindex'), + txindex: createMetricPattern15(this, 'txindex'), + spent: { + txinindex: createMetricPattern15(this, 'txinindex'), + }, + count: { + totalCount: createAverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(this, 'output_count'), + utxoCount: createMetricPattern1(this, 'exact_utxo_count'), + }, + }, + addresses: { + firstP2pk65addressindex: createMetricPattern11(this, 'first_p2pk65addressindex'), + firstP2pk33addressindex: createMetricPattern11(this, 'first_p2pk33addressindex'), + firstP2pkhaddressindex: createMetricPattern11(this, 'first_p2pkhaddressindex'), + firstP2shaddressindex: createMetricPattern11(this, 'first_p2shaddressindex'), + firstP2wpkhaddressindex: createMetricPattern11(this, 'first_p2wpkhaddressindex'), + firstP2wshaddressindex: createMetricPattern11(this, 'first_p2wshaddressindex'), + firstP2traddressindex: createMetricPattern11(this, 'first_p2traddressindex'), + firstP2aaddressindex: createMetricPattern11(this, 'first_p2aaddressindex'), + p2pk65bytes: createMetricPattern19(this, 'p2pk65bytes'), + p2pk33bytes: createMetricPattern18(this, 'p2pk33bytes'), + p2pkhbytes: createMetricPattern20(this, 'p2pkhbytes'), + p2shbytes: createMetricPattern21(this, 'p2shbytes'), + p2wpkhbytes: createMetricPattern23(this, 'p2wpkhbytes'), + p2wshbytes: createMetricPattern24(this, 'p2wshbytes'), + p2trbytes: createMetricPattern22(this, 'p2trbytes'), + p2abytes: createMetricPattern16(this, 'p2abytes'), + }, + scripts: { + firstEmptyoutputindex: createMetricPattern11(this, 'first_emptyoutputindex'), + firstOpreturnindex: createMetricPattern11(this, 'first_opreturnindex'), + firstP2msoutputindex: createMetricPattern11(this, 'first_p2msoutputindex'), + firstUnknownoutputindex: createMetricPattern11(this, 'first_unknownoutputindex'), + emptyToTxindex: createMetricPattern9(this, 'txindex'), + opreturnToTxindex: createMetricPattern14(this, 'txindex'), + p2msToTxindex: createMetricPattern17(this, 'txindex'), + unknownToTxindex: createMetricPattern28(this, 'txindex'), + count: { + p2a: createAverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(this, 'p2a_count'), + p2ms: createAverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(this, 'p2ms_count'), + p2pk33: createAverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(this, 'p2pk33_count'), + p2pk65: createAverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(this, 'p2pk65_count'), + p2pkh: createAverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(this, 'p2pkh_count'), + p2sh: createAverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(this, 'p2sh_count'), + p2tr: createAverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(this, 'p2tr_count'), + p2wpkh: createAverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(this, 'p2wpkh_count'), + p2wsh: createAverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(this, 'p2wsh_count'), + opreturn: createAverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(this, 'opreturn_count'), + emptyoutput: createAverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(this, 'emptyoutput_count'), + unknownoutput: createAverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(this, 'unknownoutput_count'), + segwit: createAverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(this, 'segwit_count'), + taprootAdoption: createBaseCumulativeSumPattern(this, 'taproot_adoption'), + segwitAdoption: createBaseCumulativeSumPattern(this, 'segwit_adoption'), + }, + value: { + opreturn: createBitcoinDollarsSatsPattern2(this, 'opreturn_value'), + }, + }, + positions: { + blockPosition: createMetricPattern11(this, 'position'), + txPosition: createMetricPattern27(this, 'position'), }, cointime: { activity: { - activityToVaultednessRatio: createMetricPattern1(this, 'activity_to_vaultedness_ratio'), - coinblocksCreated: createBlockCountPattern(this, 'coinblocks_created'), - coinblocksStored: createBlockCountPattern(this, 'coinblocks_stored'), + coinblocksCreated: createCumulativeSumPattern(this, 'coinblocks_created'), + coinblocksStored: createCumulativeSumPattern(this, 'coinblocks_stored'), liveliness: createMetricPattern1(this, 'liveliness'), vaultedness: createMetricPattern1(this, 'vaultedness'), + activityToVaultednessRatio: createMetricPattern1(this, 'activity_to_vaultedness_ratio'), + }, + supply: { + vaultedSupply: createBitcoinDollarsSatsPattern4(this, 'vaulted_supply'), + activeSupply: createBitcoinDollarsSatsPattern4(this, 'active_supply'), + }, + value: { + cointimeValueDestroyed: createCumulativeSumPattern(this, 'cointime_value_destroyed'), + cointimeValueCreated: createCumulativeSumPattern(this, 'cointime_value_created'), + cointimeValueStored: createCumulativeSumPattern(this, 'cointime_value_stored'), + vocdd: createCumulativeSumPattern(this, 'vocdd'), + }, + cap: { + thermoCap: createMetricPattern1(this, 'thermo_cap'), + investorCap: createMetricPattern1(this, 'investor_cap'), + vaultedCap: createMetricPattern1(this, 'vaulted_cap'), + activeCap: createMetricPattern1(this, 'active_cap'), + cointimeCap: createMetricPattern1(this, 'cointime_cap'), + }, + pricing: { + vaultedPrice: createDollarsSatsPattern(this, 'vaulted_price'), + vaultedPriceRatio: createRatioPattern(this, 'vaulted_price_ratio'), + activePrice: createDollarsSatsPattern(this, 'active_price'), + activePriceRatio: createRatioPattern(this, 'active_price_ratio'), + trueMarketMean: createDollarsSatsPattern(this, 'true_market_mean'), + trueMarketMeanRatio: createRatioPattern(this, 'true_market_mean_ratio'), + cointimePrice: createDollarsSatsPattern(this, 'cointime_price'), + cointimePriceRatio: createRatioPattern(this, 'cointime_price_ratio'), }, adjusted: { cointimeAdjInflationRate: createMetricPattern4(this, 'cointime_adj_inflation_rate'), cointimeAdjTxBtcVelocity: createMetricPattern4(this, 'cointime_adj_tx_btc_velocity'), cointimeAdjTxUsdVelocity: createMetricPattern4(this, 'cointime_adj_tx_usd_velocity'), }, - cap: { - activeCap: createMetricPattern1(this, 'active_cap'), - cointimeCap: createMetricPattern1(this, 'cointime_cap'), - investorCap: createMetricPattern1(this, 'investor_cap'), - thermoCap: createMetricPattern1(this, 'thermo_cap'), - vaultedCap: createMetricPattern1(this, 'vaulted_cap'), - }, - pricing: { - activePrice: createActivePricePattern(this, 'active_price'), - activePriceRatio: createActivePriceRatioPattern(this, 'active_price_ratio'), - cointimePrice: createActivePricePattern(this, 'cointime_price'), - cointimePriceRatio: createActivePriceRatioPattern(this, 'cointime_price_ratio'), - trueMarketMean: createActivePricePattern(this, 'true_market_mean'), - trueMarketMeanRatio: createActivePriceRatioPattern(this, 'true_market_mean_ratio'), - vaultedPrice: createActivePricePattern(this, 'vaulted_price'), - vaultedPriceRatio: createActivePriceRatioPattern(this, 'vaulted_price_ratio'), - }, reserveRisk: { + vocdd365dSma: createMetricPattern6(this, 'vocdd_365d_sma'), hodlBank: createMetricPattern6(this, 'hodl_bank'), reserveRisk: createMetricPattern4(this, 'reserve_risk'), - vocdd365dSma: createMetricPattern6(this, 'vocdd_365d_sma'), - }, - supply: { - activeSupply: createActiveSupplyPattern(this, 'active_supply'), - vaultedSupply: createActiveSupplyPattern(this, 'vaulted_supply'), - }, - value: { - cointimeValueCreated: createBlockCountPattern(this, 'cointime_value_created'), - cointimeValueDestroyed: createBlockCountPattern(this, 'cointime_value_destroyed'), - cointimeValueStored: createBlockCountPattern(this, 'cointime_value_stored'), - vocdd: createBlockCountPattern(this, 'vocdd'), }, }, constants: { constant0: createMetricPattern1(this, 'constant_0'), constant1: createMetricPattern1(this, 'constant_1'), - constant100: createMetricPattern1(this, 'constant_100'), constant2: createMetricPattern1(this, 'constant_2'), - constant20: createMetricPattern1(this, 'constant_20'), constant3: createMetricPattern1(this, 'constant_3'), + constant4: createMetricPattern1(this, 'constant_4'), + constant20: createMetricPattern1(this, 'constant_20'), constant30: createMetricPattern1(this, 'constant_30'), constant382: createMetricPattern1(this, 'constant_38_2'), - constant4: createMetricPattern1(this, 'constant_4'), constant50: createMetricPattern1(this, 'constant_50'), - constant600: createMetricPattern1(this, 'constant_600'), constant618: createMetricPattern1(this, 'constant_61_8'), constant70: createMetricPattern1(this, 'constant_70'), constant80: createMetricPattern1(this, 'constant_80'), + constant100: createMetricPattern1(this, 'constant_100'), + constant600: createMetricPattern1(this, 'constant_600'), constantMinus1: createMetricPattern1(this, 'constant_minus_1'), constantMinus2: createMetricPattern1(this, 'constant_minus_2'), constantMinus3: createMetricPattern1(this, 'constant_minus_3'), constantMinus4: createMetricPattern1(this, 'constant_minus_4'), }, - distribution: { - addrCount: createAddrCountPattern(this, 'addr_count'), - addressActivity: { - all: createAllPattern(this, 'address_activity'), - p2a: createAllPattern(this, 'p2a_address_activity'), - p2pk33: createAllPattern(this, 'p2pk33_address_activity'), - p2pk65: createAllPattern(this, 'p2pk65_address_activity'), - p2pkh: createAllPattern(this, 'p2pkh_address_activity'), - p2sh: createAllPattern(this, 'p2sh_address_activity'), - p2tr: createAllPattern(this, 'p2tr_address_activity'), - p2wpkh: createAllPattern(this, 'p2wpkh_address_activity'), - p2wsh: createAllPattern(this, 'p2wsh_address_activity'), - }, - addressCohorts: { - amountRange: { - _0sats: create_0satsPattern(this, 'addrs_with_0sats'), - _100btcTo1kBtc: create_0satsPattern(this, 'addrs_above_100btc_under_1k_btc'), - _100kBtcOrMore: create_0satsPattern(this, 'addrs_above_100k_btc'), - _100kSatsTo1mSats: create_0satsPattern(this, 'addrs_above_100k_sats_under_1m_sats'), - _100satsTo1kSats: create_0satsPattern(this, 'addrs_above_100sats_under_1k_sats'), - _10btcTo100btc: create_0satsPattern(this, 'addrs_above_10btc_under_100btc'), - _10kBtcTo100kBtc: create_0satsPattern(this, 'addrs_above_10k_btc_under_100k_btc'), - _10kSatsTo100kSats: create_0satsPattern(this, 'addrs_above_10k_sats_under_100k_sats'), - _10mSatsTo1btc: create_0satsPattern(this, 'addrs_above_10m_sats_under_1btc'), - _10satsTo100sats: create_0satsPattern(this, 'addrs_above_10sats_under_100sats'), - _1btcTo10btc: create_0satsPattern(this, 'addrs_above_1btc_under_10btc'), - _1kBtcTo10kBtc: create_0satsPattern(this, 'addrs_above_1k_btc_under_10k_btc'), - _1kSatsTo10kSats: create_0satsPattern(this, 'addrs_above_1k_sats_under_10k_sats'), - _1mSatsTo10mSats: create_0satsPattern(this, 'addrs_above_1m_sats_under_10m_sats'), - _1satTo10sats: create_0satsPattern(this, 'addrs_above_1sat_under_10sats'), - }, - geAmount: { - _100btc: create_0satsPattern(this, 'addrs_over_100btc'), - _100kSats: create_0satsPattern(this, 'addrs_over_100k_sats'), - _100sats: create_0satsPattern(this, 'addrs_over_100sats'), - _10btc: create_0satsPattern(this, 'addrs_over_10btc'), - _10kBtc: create_0satsPattern(this, 'addrs_over_10k_btc'), - _10kSats: create_0satsPattern(this, 'addrs_over_10k_sats'), - _10mSats: create_0satsPattern(this, 'addrs_over_10m_sats'), - _10sats: create_0satsPattern(this, 'addrs_over_10sats'), - _1btc: create_0satsPattern(this, 'addrs_over_1btc'), - _1kBtc: create_0satsPattern(this, 'addrs_over_1k_btc'), - _1kSats: create_0satsPattern(this, 'addrs_over_1k_sats'), - _1mSats: create_0satsPattern(this, 'addrs_over_1m_sats'), - _1sat: create_0satsPattern(this, 'addrs_over_1sat'), - }, - ltAmount: { - _100btc: create_0satsPattern(this, 'addrs_under_100btc'), - _100kBtc: create_0satsPattern(this, 'addrs_under_100k_btc'), - _100kSats: create_0satsPattern(this, 'addrs_under_100k_sats'), - _100sats: create_0satsPattern(this, 'addrs_under_100sats'), - _10btc: create_0satsPattern(this, 'addrs_under_10btc'), - _10kBtc: create_0satsPattern(this, 'addrs_under_10k_btc'), - _10kSats: create_0satsPattern(this, 'addrs_under_10k_sats'), - _10mSats: create_0satsPattern(this, 'addrs_under_10m_sats'), - _10sats: create_0satsPattern(this, 'addrs_under_10sats'), - _1btc: create_0satsPattern(this, 'addrs_under_1btc'), - _1kBtc: create_0satsPattern(this, 'addrs_under_1k_btc'), - _1kSats: create_0satsPattern(this, 'addrs_under_1k_sats'), - _1mSats: create_0satsPattern(this, 'addrs_under_1m_sats'), - }, - }, - addressesData: { - empty: createMetricPattern32(this, 'emptyaddressdata'), - loaded: createMetricPattern31(this, 'loadedaddressdata'), - }, - anyAddressIndexes: { - p2a: createMetricPattern16(this, 'anyaddressindex'), - p2pk33: createMetricPattern18(this, 'anyaddressindex'), - p2pk65: createMetricPattern19(this, 'anyaddressindex'), - p2pkh: createMetricPattern20(this, 'anyaddressindex'), - p2sh: createMetricPattern21(this, 'anyaddressindex'), - p2tr: createMetricPattern22(this, 'anyaddressindex'), - p2wpkh: createMetricPattern23(this, 'anyaddressindex'), - p2wsh: createMetricPattern24(this, 'anyaddressindex'), - }, - chainState: createMetricPattern11(this, 'chain'), - emptyAddrCount: createAddrCountPattern(this, 'empty_addr_count'), - emptyaddressindex: createMetricPattern32(this, 'emptyaddressindex'), - growthRate: { - all: createFullnessPattern(this, 'growth_rate'), - p2a: createFullnessPattern(this, 'p2a_growth_rate'), - p2pk33: createFullnessPattern(this, 'p2pk33_growth_rate'), - p2pk65: createFullnessPattern(this, 'p2pk65_growth_rate'), - p2pkh: createFullnessPattern(this, 'p2pkh_growth_rate'), - p2sh: createFullnessPattern(this, 'p2sh_growth_rate'), - p2tr: createFullnessPattern(this, 'p2tr_growth_rate'), - p2wpkh: createFullnessPattern(this, 'p2wpkh_growth_rate'), - p2wsh: createFullnessPattern(this, 'p2wsh_growth_rate'), - }, - loadedaddressindex: createMetricPattern31(this, 'loadedaddressindex'), - newAddrCount: { - all: createDollarsPattern(this, 'new_addr_count'), - p2a: createDollarsPattern(this, 'p2a_new_addr_count'), - p2pk33: createDollarsPattern(this, 'p2pk33_new_addr_count'), - p2pk65: createDollarsPattern(this, 'p2pk65_new_addr_count'), - p2pkh: createDollarsPattern(this, 'p2pkh_new_addr_count'), - p2sh: createDollarsPattern(this, 'p2sh_new_addr_count'), - p2tr: createDollarsPattern(this, 'p2tr_new_addr_count'), - p2wpkh: createDollarsPattern(this, 'p2wpkh_new_addr_count'), - p2wsh: createDollarsPattern(this, 'p2wsh_new_addr_count'), - }, - totalAddrCount: createAddrCountPattern(this, 'total_addr_count'), - utxoCohorts: { - ageRange: { - _10yTo12y: create_10yTo12yPattern(this, 'utxos_10y_to_12y_old'), - _12yTo15y: create_10yTo12yPattern(this, 'utxos_12y_to_15y_old'), - _1dTo1w: create_10yTo12yPattern(this, 'utxos_1d_to_1w_old'), - _1hTo1d: create_10yTo12yPattern(this, 'utxos_1h_to_1d_old'), - _1mTo2m: create_10yTo12yPattern(this, 'utxos_1m_to_2m_old'), - _1wTo1m: create_10yTo12yPattern(this, 'utxos_1w_to_1m_old'), - _1yTo2y: create_10yTo12yPattern(this, 'utxos_1y_to_2y_old'), - _2mTo3m: create_10yTo12yPattern(this, 'utxos_2m_to_3m_old'), - _2yTo3y: create_10yTo12yPattern(this, 'utxos_2y_to_3y_old'), - _3mTo4m: create_10yTo12yPattern(this, 'utxos_3m_to_4m_old'), - _3yTo4y: create_10yTo12yPattern(this, 'utxos_3y_to_4y_old'), - _4mTo5m: create_10yTo12yPattern(this, 'utxos_4m_to_5m_old'), - _4yTo5y: create_10yTo12yPattern(this, 'utxos_4y_to_5y_old'), - _5mTo6m: create_10yTo12yPattern(this, 'utxos_5m_to_6m_old'), - _5yTo6y: create_10yTo12yPattern(this, 'utxos_5y_to_6y_old'), - _6mTo1y: create_10yTo12yPattern(this, 'utxos_6m_to_1y_old'), - _6yTo7y: create_10yTo12yPattern(this, 'utxos_6y_to_7y_old'), - _7yTo8y: create_10yTo12yPattern(this, 'utxos_7y_to_8y_old'), - _8yTo10y: create_10yTo12yPattern(this, 'utxos_8y_to_10y_old'), - from15y: create_10yTo12yPattern(this, 'utxos_over_15y_old'), - upTo1h: create_10yTo12yPattern(this, 'utxos_under_1h_old'), - }, - all: { - activity: createActivityPattern2(this, ''), - costBasis: { - max: createActivePricePattern(this, 'max_cost_basis'), - min: createActivePricePattern(this, 'min_cost_basis'), - percentiles: createPercentilesPattern(this, 'cost_basis'), - }, - outputs: createOutputsPattern(this, 'utxo_count'), - realized: createRealizedPattern3(this, ''), - relative: { - negUnrealizedLossRelToOwnTotalUnrealizedPnl: createMetricPattern1(this, 'neg_unrealized_loss_rel_to_own_total_unrealized_pnl'), - netUnrealizedPnlRelToOwnTotalUnrealizedPnl: createMetricPattern1(this, 'net_unrealized_pnl_rel_to_own_total_unrealized_pnl'), - supplyInLossRelToOwnSupply: createMetricPattern1(this, 'supply_in_loss_rel_to_own_supply'), - supplyInProfitRelToOwnSupply: createMetricPattern1(this, 'supply_in_profit_rel_to_own_supply'), - unrealizedLossRelToOwnTotalUnrealizedPnl: createMetricPattern1(this, 'unrealized_loss_rel_to_own_total_unrealized_pnl'), - unrealizedProfitRelToOwnTotalUnrealizedPnl: createMetricPattern1(this, 'unrealized_profit_rel_to_own_total_unrealized_pnl'), - }, - supply: createSupplyPattern2(this, 'supply'), - unrealized: createUnrealizedPattern(this, ''), - }, - amountRange: { - _0sats: create_0satsPattern2(this, 'utxos_with_0sats'), - _100btcTo1kBtc: create_0satsPattern2(this, 'utxos_above_100btc_under_1k_btc'), - _100kBtcOrMore: create_0satsPattern2(this, 'utxos_above_100k_btc'), - _100kSatsTo1mSats: create_0satsPattern2(this, 'utxos_above_100k_sats_under_1m_sats'), - _100satsTo1kSats: create_0satsPattern2(this, 'utxos_above_100sats_under_1k_sats'), - _10btcTo100btc: create_0satsPattern2(this, 'utxos_above_10btc_under_100btc'), - _10kBtcTo100kBtc: create_0satsPattern2(this, 'utxos_above_10k_btc_under_100k_btc'), - _10kSatsTo100kSats: create_0satsPattern2(this, 'utxos_above_10k_sats_under_100k_sats'), - _10mSatsTo1btc: create_0satsPattern2(this, 'utxos_above_10m_sats_under_1btc'), - _10satsTo100sats: create_0satsPattern2(this, 'utxos_above_10sats_under_100sats'), - _1btcTo10btc: create_0satsPattern2(this, 'utxos_above_1btc_under_10btc'), - _1kBtcTo10kBtc: create_0satsPattern2(this, 'utxos_above_1k_btc_under_10k_btc'), - _1kSatsTo10kSats: create_0satsPattern2(this, 'utxos_above_1k_sats_under_10k_sats'), - _1mSatsTo10mSats: create_0satsPattern2(this, 'utxos_above_1m_sats_under_10m_sats'), - _1satTo10sats: create_0satsPattern2(this, 'utxos_above_1sat_under_10sats'), - }, - epoch: { - _0: create_0satsPattern2(this, 'epoch_0'), - _1: create_0satsPattern2(this, 'epoch_1'), - _2: create_0satsPattern2(this, 'epoch_2'), - _3: create_0satsPattern2(this, 'epoch_3'), - _4: create_0satsPattern2(this, 'epoch_4'), - }, - geAmount: { - _100btc: create_100btcPattern(this, 'utxos_over_100btc'), - _100kSats: create_100btcPattern(this, 'utxos_over_100k_sats'), - _100sats: create_100btcPattern(this, 'utxos_over_100sats'), - _10btc: create_100btcPattern(this, 'utxos_over_10btc'), - _10kBtc: create_100btcPattern(this, 'utxos_over_10k_btc'), - _10kSats: create_100btcPattern(this, 'utxos_over_10k_sats'), - _10mSats: create_100btcPattern(this, 'utxos_over_10m_sats'), - _10sats: create_100btcPattern(this, 'utxos_over_10sats'), - _1btc: create_100btcPattern(this, 'utxos_over_1btc'), - _1kBtc: create_100btcPattern(this, 'utxos_over_1k_btc'), - _1kSats: create_100btcPattern(this, 'utxos_over_1k_sats'), - _1mSats: create_100btcPattern(this, 'utxos_over_1m_sats'), - _1sat: create_100btcPattern(this, 'utxos_over_1sat'), - }, - ltAmount: { - _100btc: create_100btcPattern(this, 'utxos_under_100btc'), - _100kBtc: create_100btcPattern(this, 'utxos_under_100k_btc'), - _100kSats: create_100btcPattern(this, 'utxos_under_100k_sats'), - _100sats: create_100btcPattern(this, 'utxos_under_100sats'), - _10btc: create_100btcPattern(this, 'utxos_under_10btc'), - _10kBtc: create_100btcPattern(this, 'utxos_under_10k_btc'), - _10kSats: create_100btcPattern(this, 'utxos_under_10k_sats'), - _10mSats: create_100btcPattern(this, 'utxos_under_10m_sats'), - _10sats: create_100btcPattern(this, 'utxos_under_10sats'), - _1btc: create_100btcPattern(this, 'utxos_under_1btc'), - _1kBtc: create_100btcPattern(this, 'utxos_under_1k_btc'), - _1kSats: create_100btcPattern(this, 'utxos_under_1k_sats'), - _1mSats: create_100btcPattern(this, 'utxos_under_1m_sats'), - }, - maxAge: { - _10y: create_10yPattern(this, 'utxos_under_10y_old'), - _12y: create_10yPattern(this, 'utxos_under_12y_old'), - _15y: create_10yPattern(this, 'utxos_under_15y_old'), - _1m: create_10yPattern(this, 'utxos_under_1m_old'), - _1w: create_10yPattern(this, 'utxos_under_1w_old'), - _1y: create_10yPattern(this, 'utxos_under_1y_old'), - _2m: create_10yPattern(this, 'utxos_under_2m_old'), - _2y: create_10yPattern(this, 'utxos_under_2y_old'), - _3m: create_10yPattern(this, 'utxos_under_3m_old'), - _3y: create_10yPattern(this, 'utxos_under_3y_old'), - _4m: create_10yPattern(this, 'utxos_under_4m_old'), - _4y: create_10yPattern(this, 'utxos_under_4y_old'), - _5m: create_10yPattern(this, 'utxos_under_5m_old'), - _5y: create_10yPattern(this, 'utxos_under_5y_old'), - _6m: create_10yPattern(this, 'utxos_under_6m_old'), - _6y: create_10yPattern(this, 'utxos_under_6y_old'), - _7y: create_10yPattern(this, 'utxos_under_7y_old'), - _8y: create_10yPattern(this, 'utxos_under_8y_old'), - }, - minAge: { - _10y: create_100btcPattern(this, 'utxos_over_10y_old'), - _12y: create_100btcPattern(this, 'utxos_over_12y_old'), - _1d: create_100btcPattern(this, 'utxos_over_1d_old'), - _1m: create_100btcPattern(this, 'utxos_over_1m_old'), - _1w: create_100btcPattern(this, 'utxos_over_1w_old'), - _1y: create_100btcPattern(this, 'utxos_over_1y_old'), - _2m: create_100btcPattern(this, 'utxos_over_2m_old'), - _2y: create_100btcPattern(this, 'utxos_over_2y_old'), - _3m: create_100btcPattern(this, 'utxos_over_3m_old'), - _3y: create_100btcPattern(this, 'utxos_over_3y_old'), - _4m: create_100btcPattern(this, 'utxos_over_4m_old'), - _4y: create_100btcPattern(this, 'utxos_over_4y_old'), - _5m: create_100btcPattern(this, 'utxos_over_5m_old'), - _5y: create_100btcPattern(this, 'utxos_over_5y_old'), - _6m: create_100btcPattern(this, 'utxos_over_6m_old'), - _6y: create_100btcPattern(this, 'utxos_over_6y_old'), - _7y: create_100btcPattern(this, 'utxos_over_7y_old'), - _8y: create_100btcPattern(this, 'utxos_over_8y_old'), - }, - term: { - long: { - activity: createActivityPattern2(this, 'lth'), - costBasis: createCostBasisPattern2(this, 'lth'), - outputs: createOutputsPattern(this, 'lth_utxo_count'), - realized: createRealizedPattern2(this, 'lth'), - relative: createRelativePattern5(this, 'lth'), - supply: createSupplyPattern2(this, 'lth_supply'), - unrealized: createUnrealizedPattern(this, 'lth'), - }, - short: { - activity: createActivityPattern2(this, 'sth'), - costBasis: createCostBasisPattern2(this, 'sth'), - outputs: createOutputsPattern(this, 'sth_utxo_count'), - realized: createRealizedPattern3(this, 'sth'), - relative: createRelativePattern5(this, 'sth'), - supply: createSupplyPattern2(this, 'sth_supply'), - unrealized: createUnrealizedPattern(this, 'sth'), - }, - }, - type: { - empty: create_0satsPattern2(this, 'empty_outputs'), - p2a: create_0satsPattern2(this, 'p2a'), - p2ms: create_0satsPattern2(this, 'p2ms'), - p2pk33: create_0satsPattern2(this, 'p2pk33'), - p2pk65: create_0satsPattern2(this, 'p2pk65'), - p2pkh: create_0satsPattern2(this, 'p2pkh'), - p2sh: create_0satsPattern2(this, 'p2sh'), - p2tr: create_0satsPattern2(this, 'p2tr'), - p2wpkh: create_0satsPattern2(this, 'p2wpkh'), - p2wsh: create_0satsPattern2(this, 'p2wsh'), - unknown: create_0satsPattern2(this, 'unknown_outputs'), - }, - year: { - _2009: create_0satsPattern2(this, 'year_2009'), - _2010: create_0satsPattern2(this, 'year_2010'), - _2011: create_0satsPattern2(this, 'year_2011'), - _2012: create_0satsPattern2(this, 'year_2012'), - _2013: create_0satsPattern2(this, 'year_2013'), - _2014: create_0satsPattern2(this, 'year_2014'), - _2015: create_0satsPattern2(this, 'year_2015'), - _2016: create_0satsPattern2(this, 'year_2016'), - _2017: create_0satsPattern2(this, 'year_2017'), - _2018: create_0satsPattern2(this, 'year_2018'), - _2019: create_0satsPattern2(this, 'year_2019'), - _2020: create_0satsPattern2(this, 'year_2020'), - _2021: create_0satsPattern2(this, 'year_2021'), - _2022: create_0satsPattern2(this, 'year_2022'), - _2023: create_0satsPattern2(this, 'year_2023'), - _2024: create_0satsPattern2(this, 'year_2024'), - _2025: create_0satsPattern2(this, 'year_2025'), - _2026: create_0satsPattern2(this, 'year_2026'), - }, - }, - }, indexes: { address: { - empty: { - identity: createMetricPattern9(this, 'emptyoutputindex'), - }, - opreturn: { - identity: createMetricPattern14(this, 'opreturnindex'), - }, - p2a: { - identity: createMetricPattern16(this, 'p2aaddressindex'), - }, - p2ms: { - identity: createMetricPattern17(this, 'p2msoutputindex'), - }, p2pk33: { identity: createMetricPattern18(this, 'p2pk33addressindex'), }, @@ -5913,61 +5896,86 @@ class BrkClient extends BrkClientBase { p2wsh: { identity: createMetricPattern24(this, 'p2wshaddressindex'), }, + p2a: { + identity: createMetricPattern16(this, 'p2aaddressindex'), + }, + p2ms: { + identity: createMetricPattern17(this, 'p2msoutputindex'), + }, + empty: { + identity: createMetricPattern9(this, 'emptyoutputindex'), + }, unknown: { identity: createMetricPattern28(this, 'unknownoutputindex'), }, - }, - dateindex: { - date: createMetricPattern6(this, 'date'), - firstHeight: createMetricPattern6(this, 'first_height'), - heightCount: createMetricPattern6(this, 'height_count'), - identity: createMetricPattern6(this, 'dateindex'), - monthindex: createMetricPattern6(this, 'monthindex'), - weekindex: createMetricPattern6(this, 'weekindex'), - }, - decadeindex: { - date: createMetricPattern7(this, 'date'), - firstYearindex: createMetricPattern7(this, 'first_yearindex'), - identity: createMetricPattern7(this, 'decadeindex'), - yearindexCount: createMetricPattern7(this, 'yearindex_count'), - }, - difficultyepoch: { - firstHeight: createMetricPattern8(this, 'first_height'), - heightCount: createMetricPattern8(this, 'height_count'), - identity: createMetricPattern8(this, 'difficultyepoch'), - }, - halvingepoch: { - firstHeight: createMetricPattern10(this, 'first_height'), - identity: createMetricPattern10(this, 'halvingepoch'), + opreturn: { + identity: createMetricPattern14(this, 'opreturnindex'), + }, }, height: { + identity: createMetricPattern11(this, 'height'), dateindex: createMetricPattern11(this, 'dateindex'), difficultyepoch: createMetricPattern11(this, 'difficultyepoch'), halvingepoch: createMetricPattern11(this, 'halvingepoch'), - identity: createMetricPattern11(this, 'height'), txindexCount: createMetricPattern11(this, 'txindex_count'), }, + difficultyepoch: { + identity: createMetricPattern8(this, 'difficultyepoch'), + firstHeight: createMetricPattern8(this, 'first_height'), + heightCount: createMetricPattern8(this, 'height_count'), + }, + halvingepoch: { + identity: createMetricPattern10(this, 'halvingepoch'), + firstHeight: createMetricPattern10(this, 'first_height'), + }, + dateindex: { + identity: createMetricPattern6(this, 'dateindex'), + date: createMetricPattern6(this, 'date'), + firstHeight: createMetricPattern6(this, 'first_height'), + heightCount: createMetricPattern6(this, 'height_count'), + weekindex: createMetricPattern6(this, 'weekindex'), + monthindex: createMetricPattern6(this, 'monthindex'), + }, + weekindex: { + identity: createMetricPattern29(this, 'weekindex'), + date: createMetricPattern29(this, 'date'), + firstDateindex: createMetricPattern29(this, 'first_dateindex'), + dateindexCount: createMetricPattern29(this, 'dateindex_count'), + }, monthindex: { - date: createMetricPattern13(this, 'date'), - dateindexCount: createMetricPattern13(this, 'dateindex_count'), - firstDateindex: createMetricPattern13(this, 'first_dateindex'), identity: createMetricPattern13(this, 'monthindex'), + date: createMetricPattern13(this, 'date'), + firstDateindex: createMetricPattern13(this, 'first_dateindex'), + dateindexCount: createMetricPattern13(this, 'dateindex_count'), quarterindex: createMetricPattern13(this, 'quarterindex'), semesterindex: createMetricPattern13(this, 'semesterindex'), yearindex: createMetricPattern13(this, 'yearindex'), }, quarterindex: { + identity: createMetricPattern25(this, 'quarterindex'), date: createMetricPattern25(this, 'date'), firstMonthindex: createMetricPattern25(this, 'first_monthindex'), - identity: createMetricPattern25(this, 'quarterindex'), monthindexCount: createMetricPattern25(this, 'monthindex_count'), }, semesterindex: { + identity: createMetricPattern26(this, 'semesterindex'), date: createMetricPattern26(this, 'date'), firstMonthindex: createMetricPattern26(this, 'first_monthindex'), - identity: createMetricPattern26(this, 'semesterindex'), monthindexCount: createMetricPattern26(this, 'monthindex_count'), }, + yearindex: { + identity: createMetricPattern30(this, 'yearindex'), + date: createMetricPattern30(this, 'date'), + firstMonthindex: createMetricPattern30(this, 'first_monthindex'), + monthindexCount: createMetricPattern30(this, 'monthindex_count'), + decadeindex: createMetricPattern30(this, 'decadeindex'), + }, + decadeindex: { + identity: createMetricPattern7(this, 'decadeindex'), + date: createMetricPattern7(this, 'date'), + firstYearindex: createMetricPattern7(this, 'first_yearindex'), + yearindexCount: createMetricPattern7(this, 'yearindex_count'), + }, txindex: { identity: createMetricPattern27(this, 'txindex'), inputCount: createMetricPattern27(this, 'input_count'), @@ -5979,55 +5987,187 @@ class BrkClient extends BrkClientBase { txoutindex: { identity: createMetricPattern15(this, 'txoutindex'), }, - weekindex: { - date: createMetricPattern29(this, 'date'), - dateindexCount: createMetricPattern29(this, 'dateindex_count'), - firstDateindex: createMetricPattern29(this, 'first_dateindex'), - identity: createMetricPattern29(this, 'weekindex'), - }, - yearindex: { - date: createMetricPattern30(this, 'date'), - decadeindex: createMetricPattern30(this, 'decadeindex'), - firstMonthindex: createMetricPattern30(this, 'first_monthindex'), - identity: createMetricPattern30(this, 'yearindex'), - monthindexCount: createMetricPattern30(this, 'monthindex_count'), - }, - }, - inputs: { - count: createCountPattern2(this, 'input_count'), - firstTxinindex: createMetricPattern11(this, 'first_txinindex'), - outpoint: createMetricPattern12(this, 'outpoint'), - outputtype: createMetricPattern12(this, 'outputtype'), - spent: { - txoutindex: createMetricPattern12(this, 'txoutindex'), - value: createMetricPattern12(this, 'value'), - }, - txindex: createMetricPattern12(this, 'txindex'), - typeindex: createMetricPattern12(this, 'typeindex'), }, market: { ath: { + priceAth: createDollarsSatsPattern(this, 'price_ath'), + priceDrawdown: createMetricPattern3(this, 'price_drawdown'), daysSincePriceAth: createMetricPattern4(this, 'days_since_price_ath'), + yearsSincePriceAth: createMetricPattern4(this, 'years_since_price_ath'), maxDaysBetweenPriceAths: createMetricPattern4(this, 'max_days_between_price_aths'), maxYearsBetweenPriceAths: createMetricPattern4(this, 'max_years_between_price_aths'), - priceAth: createActivePricePattern(this, 'price_ath'), - priceDrawdown: createMetricPattern3(this, 'price_drawdown'), - yearsSincePriceAth: createMetricPattern4(this, 'years_since_price_ath'), + }, + lookback: { + _1d: createDollarsSatsPattern2(this, 'price_1d_ago'), + _1w: createDollarsSatsPattern2(this, 'price_1w_ago'), + _1m: createDollarsSatsPattern2(this, 'price_1m_ago'), + _3m: createDollarsSatsPattern2(this, 'price_3m_ago'), + _6m: createDollarsSatsPattern2(this, 'price_6m_ago'), + _1y: createDollarsSatsPattern2(this, 'price_1y_ago'), + _2y: createDollarsSatsPattern2(this, 'price_2y_ago'), + _3y: createDollarsSatsPattern2(this, 'price_3y_ago'), + _4y: createDollarsSatsPattern2(this, 'price_4y_ago'), + _5y: createDollarsSatsPattern2(this, 'price_5y_ago'), + _6y: createDollarsSatsPattern2(this, 'price_6y_ago'), + _8y: createDollarsSatsPattern2(this, 'price_8y_ago'), + _10y: createDollarsSatsPattern2(this, 'price_10y_ago'), + }, + returns: { + priceReturns: { + _1d: createMetricPattern4(this, '1d_price_returns'), + _1w: createMetricPattern4(this, '1w_price_returns'), + _1m: createMetricPattern4(this, '1m_price_returns'), + _3m: createMetricPattern4(this, '3m_price_returns'), + _6m: createMetricPattern4(this, '6m_price_returns'), + _1y: createMetricPattern4(this, '1y_price_returns'), + _2y: createMetricPattern4(this, '2y_price_returns'), + _3y: createMetricPattern4(this, '3y_price_returns'), + _4y: createMetricPattern4(this, '4y_price_returns'), + _5y: createMetricPattern4(this, '5y_price_returns'), + _6y: createMetricPattern4(this, '6y_price_returns'), + _8y: createMetricPattern4(this, '8y_price_returns'), + _10y: createMetricPattern4(this, '10y_price_returns'), + }, + cagr: create_10y2y3y4y5y6y8yPattern(this, 'cagr'), + _1dReturns1wSd: createSdSmaPattern(this, '1d_returns_1w_sd'), + _1dReturns1mSd: createSdSmaPattern(this, '1d_returns_1m_sd'), + _1dReturns1ySd: createSdSmaPattern(this, '1d_returns_1y_sd'), + downsideReturns: createMetricPattern6(this, 'downside_returns'), + downside1wSd: createSdSmaPattern(this, 'downside_1w_sd'), + downside1mSd: createSdSmaPattern(this, 'downside_1m_sd'), + downside1ySd: createSdSmaPattern(this, 'downside_1y_sd'), + }, + volatility: { + price1wVolatility: createMetricPattern4(this, 'price_1w_volatility'), + price1mVolatility: createMetricPattern4(this, 'price_1m_volatility'), + price1yVolatility: createMetricPattern4(this, 'price_1y_volatility'), + sharpe1w: createMetricPattern6(this, 'sharpe_1w'), + sharpe1m: createMetricPattern6(this, 'sharpe_1m'), + sharpe1y: createMetricPattern6(this, 'sharpe_1y'), + sortino1w: createMetricPattern6(this, 'sortino_1w'), + sortino1m: createMetricPattern6(this, 'sortino_1m'), + sortino1y: createMetricPattern6(this, 'sortino_1y'), + }, + range: { + price1wMin: createDollarsSatsPattern2(this, 'price_1w_min'), + price1wMax: createDollarsSatsPattern2(this, 'price_1w_max'), + price2wMin: createDollarsSatsPattern2(this, 'price_2w_min'), + price2wMax: createDollarsSatsPattern2(this, 'price_2w_max'), + price1mMin: createDollarsSatsPattern2(this, 'price_1m_min'), + price1mMax: createDollarsSatsPattern2(this, 'price_1m_max'), + price1yMin: createDollarsSatsPattern2(this, 'price_1y_min'), + price1yMax: createDollarsSatsPattern2(this, 'price_1y_max'), + priceTrueRange: createMetricPattern6(this, 'price_true_range'), + priceTrueRange2wSum: createMetricPattern6(this, 'price_true_range_2w_sum'), + price2wChoppinessIndex: createMetricPattern4(this, 'price_2w_choppiness_index'), + }, + movingAverage: { + price1wSma: createPriceRatioPattern(this, 'price_1w_sma'), + price8dSma: createPriceRatioPattern(this, 'price_8d_sma'), + price13dSma: createPriceRatioPattern(this, 'price_13d_sma'), + price21dSma: createPriceRatioPattern(this, 'price_21d_sma'), + price1mSma: createPriceRatioPattern(this, 'price_1m_sma'), + price34dSma: createPriceRatioPattern(this, 'price_34d_sma'), + price55dSma: createPriceRatioPattern(this, 'price_55d_sma'), + price89dSma: createPriceRatioPattern(this, 'price_89d_sma'), + price111dSma: createPriceRatioPattern(this, 'price_111d_sma'), + price144dSma: createPriceRatioPattern(this, 'price_144d_sma'), + price200dSma: createPriceRatioPattern(this, 'price_200d_sma'), + price350dSma: createPriceRatioPattern(this, 'price_350d_sma'), + price1ySma: createPriceRatioPattern(this, 'price_1y_sma'), + price2ySma: createPriceRatioPattern(this, 'price_2y_sma'), + price200wSma: createPriceRatioPattern(this, 'price_200w_sma'), + price4ySma: createPriceRatioPattern(this, 'price_4y_sma'), + price1wEma: createPriceRatioPattern(this, 'price_1w_ema'), + price8dEma: createPriceRatioPattern(this, 'price_8d_ema'), + price12dEma: createPriceRatioPattern(this, 'price_12d_ema'), + price13dEma: createPriceRatioPattern(this, 'price_13d_ema'), + price21dEma: createPriceRatioPattern(this, 'price_21d_ema'), + price26dEma: createPriceRatioPattern(this, 'price_26d_ema'), + price1mEma: createPriceRatioPattern(this, 'price_1m_ema'), + price34dEma: createPriceRatioPattern(this, 'price_34d_ema'), + price55dEma: createPriceRatioPattern(this, 'price_55d_ema'), + price89dEma: createPriceRatioPattern(this, 'price_89d_ema'), + price144dEma: createPriceRatioPattern(this, 'price_144d_ema'), + price200dEma: createPriceRatioPattern(this, 'price_200d_ema'), + price1yEma: createPriceRatioPattern(this, 'price_1y_ema'), + price2yEma: createPriceRatioPattern(this, 'price_2y_ema'), + price200wEma: createPriceRatioPattern(this, 'price_200w_ema'), + price4yEma: createPriceRatioPattern(this, 'price_4y_ema'), + price200dSmaX24: createDollarsSatsPattern2(this, 'price_200d_sma_x2_4'), + price200dSmaX08: createDollarsSatsPattern2(this, 'price_200d_sma_x0_8'), + price350dSmaX2: createDollarsSatsPattern2(this, 'price_350d_sma_x2'), }, dca: { + periodStack: create_10y1m1w1y2y3m3y4y5y6m6y8yPattern3(this, 'dca_stack'), + periodAveragePrice: { + _1w: createDollarsSatsPattern2(this, '1w_dca_average_price'), + _1m: createDollarsSatsPattern2(this, '1m_dca_average_price'), + _3m: createDollarsSatsPattern2(this, '3m_dca_average_price'), + _6m: createDollarsSatsPattern2(this, '6m_dca_average_price'), + _1y: createDollarsSatsPattern2(this, '1y_dca_average_price'), + _2y: createDollarsSatsPattern2(this, '2y_dca_average_price'), + _3y: createDollarsSatsPattern2(this, '3y_dca_average_price'), + _4y: createDollarsSatsPattern2(this, '4y_dca_average_price'), + _5y: createDollarsSatsPattern2(this, '5y_dca_average_price'), + _6y: createDollarsSatsPattern2(this, '6y_dca_average_price'), + _8y: createDollarsSatsPattern2(this, '8y_dca_average_price'), + _10y: createDollarsSatsPattern2(this, '10y_dca_average_price'), + }, + periodReturns: create_10y1m1w1y2y3m3y4y5y6m6y8yPattern2(this, 'dca_returns'), + periodCagr: create_10y2y3y4y5y6y8yPattern(this, 'dca_cagr'), + periodDaysInProfit: create_10y1m1w1y2y3m3y4y5y6m6y8yPattern2(this, 'dca_days_in_profit'), + periodDaysInLoss: create_10y1m1w1y2y3m3y4y5y6m6y8yPattern2(this, 'dca_days_in_loss'), + periodMaxDrawdown: create_10y1m1w1y2y3m3y4y5y6m6y8yPattern2(this, 'dca_max_drawdown'), + periodMaxReturn: create_10y1m1w1y2y3m3y4y5y6m6y8yPattern2(this, 'dca_max_return'), + periodLumpSumStack: create_10y1m1w1y2y3m3y4y5y6m6y8yPattern3(this, 'lump_sum_stack'), + periodLumpSumReturns: create_10y1m1w1y2y3m3y4y5y6m6y8yPattern2(this, 'lump_sum_returns'), + periodLumpSumDaysInProfit: create_10y1m1w1y2y3m3y4y5y6m6y8yPattern2(this, 'lump_sum_days_in_profit'), + periodLumpSumDaysInLoss: create_10y1m1w1y2y3m3y4y5y6m6y8yPattern2(this, 'lump_sum_days_in_loss'), + periodLumpSumMaxDrawdown: create_10y1m1w1y2y3m3y4y5y6m6y8yPattern2(this, 'lump_sum_max_drawdown'), + periodLumpSumMaxReturn: create_10y1m1w1y2y3m3y4y5y6m6y8yPattern2(this, 'lump_sum_max_return'), + classStack: { + _2015: createBitcoinDollarsSatsPattern5(this, 'dca_class_2015_stack'), + _2016: createBitcoinDollarsSatsPattern5(this, 'dca_class_2016_stack'), + _2017: createBitcoinDollarsSatsPattern5(this, 'dca_class_2017_stack'), + _2018: createBitcoinDollarsSatsPattern5(this, 'dca_class_2018_stack'), + _2019: createBitcoinDollarsSatsPattern5(this, 'dca_class_2019_stack'), + _2020: createBitcoinDollarsSatsPattern5(this, 'dca_class_2020_stack'), + _2021: createBitcoinDollarsSatsPattern5(this, 'dca_class_2021_stack'), + _2022: createBitcoinDollarsSatsPattern5(this, 'dca_class_2022_stack'), + _2023: createBitcoinDollarsSatsPattern5(this, 'dca_class_2023_stack'), + _2024: createBitcoinDollarsSatsPattern5(this, 'dca_class_2024_stack'), + _2025: createBitcoinDollarsSatsPattern5(this, 'dca_class_2025_stack'), + _2026: createBitcoinDollarsSatsPattern5(this, 'dca_class_2026_stack'), + }, classAveragePrice: { - _2015: create_0sdUsdPattern(this, 'dca_class_2015_average_price'), - _2016: create_0sdUsdPattern(this, 'dca_class_2016_average_price'), - _2017: create_0sdUsdPattern(this, 'dca_class_2017_average_price'), - _2018: create_0sdUsdPattern(this, 'dca_class_2018_average_price'), - _2019: create_0sdUsdPattern(this, 'dca_class_2019_average_price'), - _2020: create_0sdUsdPattern(this, 'dca_class_2020_average_price'), - _2021: create_0sdUsdPattern(this, 'dca_class_2021_average_price'), - _2022: create_0sdUsdPattern(this, 'dca_class_2022_average_price'), - _2023: create_0sdUsdPattern(this, 'dca_class_2023_average_price'), - _2024: create_0sdUsdPattern(this, 'dca_class_2024_average_price'), - _2025: create_0sdUsdPattern(this, 'dca_class_2025_average_price'), - _2026: create_0sdUsdPattern(this, 'dca_class_2026_average_price'), + _2015: createDollarsSatsPattern2(this, 'dca_class_2015_average_price'), + _2016: createDollarsSatsPattern2(this, 'dca_class_2016_average_price'), + _2017: createDollarsSatsPattern2(this, 'dca_class_2017_average_price'), + _2018: createDollarsSatsPattern2(this, 'dca_class_2018_average_price'), + _2019: createDollarsSatsPattern2(this, 'dca_class_2019_average_price'), + _2020: createDollarsSatsPattern2(this, 'dca_class_2020_average_price'), + _2021: createDollarsSatsPattern2(this, 'dca_class_2021_average_price'), + _2022: createDollarsSatsPattern2(this, 'dca_class_2022_average_price'), + _2023: createDollarsSatsPattern2(this, 'dca_class_2023_average_price'), + _2024: createDollarsSatsPattern2(this, 'dca_class_2024_average_price'), + _2025: createDollarsSatsPattern2(this, 'dca_class_2025_average_price'), + _2026: createDollarsSatsPattern2(this, 'dca_class_2026_average_price'), + }, + classReturns: create_201520162017201820192020202120222023202420252026Pattern2(this, 'dca_class'), + classDaysInProfit: { + _2015: createMetricPattern4(this, 'dca_class_2015_days_in_profit'), + _2016: createMetricPattern4(this, 'dca_class_2016_days_in_profit'), + _2017: createMetricPattern4(this, 'dca_class_2017_days_in_profit'), + _2018: createMetricPattern4(this, 'dca_class_2018_days_in_profit'), + _2019: createMetricPattern4(this, 'dca_class_2019_days_in_profit'), + _2020: createMetricPattern4(this, 'dca_class_2020_days_in_profit'), + _2021: createMetricPattern4(this, 'dca_class_2021_days_in_profit'), + _2022: createMetricPattern4(this, 'dca_class_2022_days_in_profit'), + _2023: createMetricPattern4(this, 'dca_class_2023_days_in_profit'), + _2024: createMetricPattern4(this, 'dca_class_2024_days_in_profit'), + _2025: createMetricPattern4(this, 'dca_class_2025_days_in_profit'), + _2026: createMetricPattern4(this, 'dca_class_2026_days_in_profit'), }, classDaysInLoss: { _2015: createMetricPattern4(this, 'dca_class_2015_days_in_loss'), @@ -6043,20 +6183,6 @@ class BrkClient extends BrkClientBase { _2025: createMetricPattern4(this, 'dca_class_2025_days_in_loss'), _2026: createMetricPattern4(this, 'dca_class_2026_days_in_loss'), }, - classDaysInProfit: { - _2015: createMetricPattern4(this, 'dca_class_2015_days_in_profit'), - _2016: createMetricPattern4(this, 'dca_class_2016_days_in_profit'), - _2017: createMetricPattern4(this, 'dca_class_2017_days_in_profit'), - _2018: createMetricPattern4(this, 'dca_class_2018_days_in_profit'), - _2019: createMetricPattern4(this, 'dca_class_2019_days_in_profit'), - _2020: createMetricPattern4(this, 'dca_class_2020_days_in_profit'), - _2021: createMetricPattern4(this, 'dca_class_2021_days_in_profit'), - _2022: createMetricPattern4(this, 'dca_class_2022_days_in_profit'), - _2023: createMetricPattern4(this, 'dca_class_2023_days_in_profit'), - _2024: createMetricPattern4(this, 'dca_class_2024_days_in_profit'), - _2025: createMetricPattern4(this, 'dca_class_2025_days_in_profit'), - _2026: createMetricPattern4(this, 'dca_class_2026_days_in_profit'), - }, classMaxDrawdown: { _2015: createMetricPattern4(this, 'dca_class_2015_max_drawdown'), _2016: createMetricPattern4(this, 'dca_class_2016_max_drawdown'), @@ -6085,459 +6211,518 @@ class BrkClient extends BrkClientBase { _2025: createMetricPattern4(this, 'dca_class_2025_max_return'), _2026: createMetricPattern4(this, 'dca_class_2026_max_return'), }, - classReturns: createClassDaysInLossPattern(this, 'dca_class'), - classStack: { - _2015: create_2015Pattern(this, 'dca_class_2015_stack'), - _2016: create_2015Pattern(this, 'dca_class_2016_stack'), - _2017: create_2015Pattern(this, 'dca_class_2017_stack'), - _2018: create_2015Pattern(this, 'dca_class_2018_stack'), - _2019: create_2015Pattern(this, 'dca_class_2019_stack'), - _2020: create_2015Pattern(this, 'dca_class_2020_stack'), - _2021: create_2015Pattern(this, 'dca_class_2021_stack'), - _2022: create_2015Pattern(this, 'dca_class_2022_stack'), - _2023: create_2015Pattern(this, 'dca_class_2023_stack'), - _2024: create_2015Pattern(this, 'dca_class_2024_stack'), - _2025: create_2015Pattern(this, 'dca_class_2025_stack'), - _2026: create_2015Pattern(this, 'dca_class_2026_stack'), - }, - periodAveragePrice: { - _10y: create_0sdUsdPattern(this, '10y_dca_average_price'), - _1m: create_0sdUsdPattern(this, '1m_dca_average_price'), - _1w: create_0sdUsdPattern(this, '1w_dca_average_price'), - _1y: create_0sdUsdPattern(this, '1y_dca_average_price'), - _2y: create_0sdUsdPattern(this, '2y_dca_average_price'), - _3m: create_0sdUsdPattern(this, '3m_dca_average_price'), - _3y: create_0sdUsdPattern(this, '3y_dca_average_price'), - _4y: create_0sdUsdPattern(this, '4y_dca_average_price'), - _5y: create_0sdUsdPattern(this, '5y_dca_average_price'), - _6m: create_0sdUsdPattern(this, '6m_dca_average_price'), - _6y: create_0sdUsdPattern(this, '6y_dca_average_price'), - _8y: create_0sdUsdPattern(this, '8y_dca_average_price'), - }, - periodCagr: createPeriodCagrPattern(this, 'dca_cagr'), - periodDaysInLoss: createPeriodDaysInLossPattern(this, 'dca_days_in_loss'), - periodDaysInProfit: createPeriodDaysInLossPattern(this, 'dca_days_in_profit'), - periodLumpSumDaysInLoss: createPeriodDaysInLossPattern(this, 'lump_sum_days_in_loss'), - periodLumpSumDaysInProfit: createPeriodDaysInLossPattern(this, 'lump_sum_days_in_profit'), - periodLumpSumMaxDrawdown: createPeriodDaysInLossPattern(this, 'lump_sum_max_drawdown'), - periodLumpSumMaxReturn: createPeriodDaysInLossPattern(this, 'lump_sum_max_return'), - periodLumpSumReturns: createPeriodDaysInLossPattern(this, 'lump_sum_returns'), - periodLumpSumStack: createPeriodLumpSumStackPattern(this, 'lump_sum_stack'), - periodMaxDrawdown: createPeriodDaysInLossPattern(this, 'dca_max_drawdown'), - periodMaxReturn: createPeriodDaysInLossPattern(this, 'dca_max_return'), - periodReturns: createPeriodDaysInLossPattern(this, 'dca_returns'), - periodStack: createPeriodLumpSumStackPattern(this, 'dca_stack'), }, indicators: { - gini: createMetricPattern6(this, 'gini'), - macdHistogram: createMetricPattern6(this, 'macd_histogram'), - macdLine: createMetricPattern6(this, 'macd_line'), - macdSignal: createMetricPattern6(this, 'macd_signal'), - nvt: createMetricPattern4(this, 'nvt'), - piCycle: createMetricPattern6(this, 'pi_cycle'), puellMultiple: createMetricPattern4(this, 'puell_multiple'), - rsi14d: createMetricPattern6(this, 'rsi_14d'), - rsi14dMax: createMetricPattern6(this, 'rsi_14d_max'), - rsi14dMin: createMetricPattern6(this, 'rsi_14d_min'), - rsiAverageGain14d: createMetricPattern6(this, 'rsi_average_gain_14d'), - rsiAverageLoss14d: createMetricPattern6(this, 'rsi_average_loss_14d'), + nvt: createMetricPattern4(this, 'nvt'), rsiGains: createMetricPattern6(this, 'rsi_gains'), rsiLosses: createMetricPattern6(this, 'rsi_losses'), - stochD: createMetricPattern6(this, 'stoch_d'), - stochK: createMetricPattern6(this, 'stoch_k'), + rsiAverageGain14d: createMetricPattern6(this, 'rsi_average_gain_14d'), + rsiAverageLoss14d: createMetricPattern6(this, 'rsi_average_loss_14d'), + rsi14d: createMetricPattern6(this, 'rsi_14d'), + rsi14dMin: createMetricPattern6(this, 'rsi_14d_min'), + rsi14dMax: createMetricPattern6(this, 'rsi_14d_max'), stochRsi: createMetricPattern6(this, 'stoch_rsi'), - stochRsiD: createMetricPattern6(this, 'stoch_rsi_d'), stochRsiK: createMetricPattern6(this, 'stoch_rsi_k'), + stochRsiD: createMetricPattern6(this, 'stoch_rsi_d'), + stochK: createMetricPattern6(this, 'stoch_k'), + stochD: createMetricPattern6(this, 'stoch_d'), + piCycle: createMetricPattern6(this, 'pi_cycle'), + macdLine: createMetricPattern6(this, 'macd_line'), + macdSignal: createMetricPattern6(this, 'macd_signal'), + macdHistogram: createMetricPattern6(this, 'macd_histogram'), + gini: createMetricPattern6(this, 'gini'), }, - lookback: { - _10y: create_0sdUsdPattern(this, 'price_10y_ago'), - _1d: create_0sdUsdPattern(this, 'price_1d_ago'), - _1m: create_0sdUsdPattern(this, 'price_1m_ago'), - _1w: create_0sdUsdPattern(this, 'price_1w_ago'), - _1y: create_0sdUsdPattern(this, 'price_1y_ago'), - _2y: create_0sdUsdPattern(this, 'price_2y_ago'), - _3m: create_0sdUsdPattern(this, 'price_3m_ago'), - _3y: create_0sdUsdPattern(this, 'price_3y_ago'), - _4y: create_0sdUsdPattern(this, 'price_4y_ago'), - _5y: create_0sdUsdPattern(this, 'price_5y_ago'), - _6m: create_0sdUsdPattern(this, 'price_6m_ago'), - _6y: create_0sdUsdPattern(this, 'price_6y_ago'), - _8y: create_0sdUsdPattern(this, 'price_8y_ago'), - }, - movingAverage: { - price111dSma: createPrice111dSmaPattern(this, 'price_111d_sma'), - price12dEma: createPrice111dSmaPattern(this, 'price_12d_ema'), - price13dEma: createPrice111dSmaPattern(this, 'price_13d_ema'), - price13dSma: createPrice111dSmaPattern(this, 'price_13d_sma'), - price144dEma: createPrice111dSmaPattern(this, 'price_144d_ema'), - price144dSma: createPrice111dSmaPattern(this, 'price_144d_sma'), - price1mEma: createPrice111dSmaPattern(this, 'price_1m_ema'), - price1mSma: createPrice111dSmaPattern(this, 'price_1m_sma'), - price1wEma: createPrice111dSmaPattern(this, 'price_1w_ema'), - price1wSma: createPrice111dSmaPattern(this, 'price_1w_sma'), - price1yEma: createPrice111dSmaPattern(this, 'price_1y_ema'), - price1ySma: createPrice111dSmaPattern(this, 'price_1y_sma'), - price200dEma: createPrice111dSmaPattern(this, 'price_200d_ema'), - price200dSma: createPrice111dSmaPattern(this, 'price_200d_sma'), - price200dSmaX08: create_0sdUsdPattern(this, 'price_200d_sma_x0_8'), - price200dSmaX24: create_0sdUsdPattern(this, 'price_200d_sma_x2_4'), - price200wEma: createPrice111dSmaPattern(this, 'price_200w_ema'), - price200wSma: createPrice111dSmaPattern(this, 'price_200w_sma'), - price21dEma: createPrice111dSmaPattern(this, 'price_21d_ema'), - price21dSma: createPrice111dSmaPattern(this, 'price_21d_sma'), - price26dEma: createPrice111dSmaPattern(this, 'price_26d_ema'), - price2yEma: createPrice111dSmaPattern(this, 'price_2y_ema'), - price2ySma: createPrice111dSmaPattern(this, 'price_2y_sma'), - price34dEma: createPrice111dSmaPattern(this, 'price_34d_ema'), - price34dSma: createPrice111dSmaPattern(this, 'price_34d_sma'), - price350dSma: createPrice111dSmaPattern(this, 'price_350d_sma'), - price350dSmaX2: create_0sdUsdPattern(this, 'price_350d_sma_x2'), - price4yEma: createPrice111dSmaPattern(this, 'price_4y_ema'), - price4ySma: createPrice111dSmaPattern(this, 'price_4y_sma'), - price55dEma: createPrice111dSmaPattern(this, 'price_55d_ema'), - price55dSma: createPrice111dSmaPattern(this, 'price_55d_sma'), - price89dEma: createPrice111dSmaPattern(this, 'price_89d_ema'), - price89dSma: createPrice111dSmaPattern(this, 'price_89d_sma'), - price8dEma: createPrice111dSmaPattern(this, 'price_8d_ema'), - price8dSma: createPrice111dSmaPattern(this, 'price_8d_sma'), - }, - range: { - price1mMax: create_0sdUsdPattern(this, 'price_1m_max'), - price1mMin: create_0sdUsdPattern(this, 'price_1m_min'), - price1wMax: create_0sdUsdPattern(this, 'price_1w_max'), - price1wMin: create_0sdUsdPattern(this, 'price_1w_min'), - price1yMax: create_0sdUsdPattern(this, 'price_1y_max'), - price1yMin: create_0sdUsdPattern(this, 'price_1y_min'), - price2wChoppinessIndex: createMetricPattern4(this, 'price_2w_choppiness_index'), - price2wMax: create_0sdUsdPattern(this, 'price_2w_max'), - price2wMin: create_0sdUsdPattern(this, 'price_2w_min'), - priceTrueRange: createMetricPattern6(this, 'price_true_range'), - priceTrueRange2wSum: createMetricPattern6(this, 'price_true_range_2w_sum'), - }, - returns: { - _1dReturns1mSd: create_1dReturns1mSdPattern(this, '1d_returns_1m_sd'), - _1dReturns1wSd: create_1dReturns1mSdPattern(this, '1d_returns_1w_sd'), - _1dReturns1ySd: create_1dReturns1mSdPattern(this, '1d_returns_1y_sd'), - cagr: createPeriodCagrPattern(this, 'cagr'), - downside1mSd: create_1dReturns1mSdPattern(this, 'downside_1m_sd'), - downside1wSd: create_1dReturns1mSdPattern(this, 'downside_1w_sd'), - downside1ySd: create_1dReturns1mSdPattern(this, 'downside_1y_sd'), - downsideReturns: createMetricPattern6(this, 'downside_returns'), - priceReturns: { - _10y: createMetricPattern4(this, '10y_price_returns'), - _1d: createMetricPattern4(this, '1d_price_returns'), - _1m: createMetricPattern4(this, '1m_price_returns'), - _1w: createMetricPattern4(this, '1w_price_returns'), - _1y: createMetricPattern4(this, '1y_price_returns'), - _2y: createMetricPattern4(this, '2y_price_returns'), - _3m: createMetricPattern4(this, '3m_price_returns'), - _3y: createMetricPattern4(this, '3y_price_returns'), - _4y: createMetricPattern4(this, '4y_price_returns'), - _5y: createMetricPattern4(this, '5y_price_returns'), - _6m: createMetricPattern4(this, '6m_price_returns'), - _6y: createMetricPattern4(this, '6y_price_returns'), - _8y: createMetricPattern4(this, '8y_price_returns'), - }, - }, - volatility: { - price1mVolatility: createMetricPattern4(this, 'price_1m_volatility'), - price1wVolatility: createMetricPattern4(this, 'price_1w_volatility'), - price1yVolatility: createMetricPattern4(this, 'price_1y_volatility'), - sharpe1m: createMetricPattern6(this, 'sharpe_1m'), - sharpe1w: createMetricPattern6(this, 'sharpe_1w'), - sharpe1y: createMetricPattern6(this, 'sharpe_1y'), - sortino1m: createMetricPattern6(this, 'sortino_1m'), - sortino1w: createMetricPattern6(this, 'sortino_1w'), - sortino1y: createMetricPattern6(this, 'sortino_1y'), - }, - }, - outputs: { - count: { - totalCount: createCountPattern2(this, 'output_count'), - utxoCount: createMetricPattern1(this, 'exact_utxo_count'), - }, - firstTxoutindex: createMetricPattern11(this, 'first_txoutindex'), - outputtype: createMetricPattern15(this, 'outputtype'), - spent: { - txinindex: createMetricPattern15(this, 'txinindex'), - }, - txindex: createMetricPattern15(this, 'txindex'), - typeindex: createMetricPattern15(this, 'typeindex'), - value: createMetricPattern15(this, 'value'), }, pools: { heightToPool: createMetricPattern11(this, 'pool'), vecs: { - aaopool: createAaopoolPattern(this, 'aaopool'), - antpool: createAaopoolPattern(this, 'antpool'), - arkpool: createAaopoolPattern(this, 'arkpool'), - asicminer: createAaopoolPattern(this, 'asicminer'), - axbt: createAaopoolPattern(this, 'axbt'), - batpool: createAaopoolPattern(this, 'batpool'), - bcmonster: createAaopoolPattern(this, 'bcmonster'), - bcpoolio: createAaopoolPattern(this, 'bcpoolio'), - binancepool: createAaopoolPattern(this, 'binancepool'), - bitalo: createAaopoolPattern(this, 'bitalo'), - bitclub: createAaopoolPattern(this, 'bitclub'), - bitcoinaffiliatenetwork: createAaopoolPattern(this, 'bitcoinaffiliatenetwork'), - bitcoincom: createAaopoolPattern(this, 'bitcoincom'), - bitcoinindia: createAaopoolPattern(this, 'bitcoinindia'), - bitcoinrussia: createAaopoolPattern(this, 'bitcoinrussia'), - bitcoinukraine: createAaopoolPattern(this, 'bitcoinukraine'), - bitfarms: createAaopoolPattern(this, 'bitfarms'), - bitfufupool: createAaopoolPattern(this, 'bitfufupool'), - bitfury: createAaopoolPattern(this, 'bitfury'), - bitminter: createAaopoolPattern(this, 'bitminter'), - bitparking: createAaopoolPattern(this, 'bitparking'), - bitsolo: createAaopoolPattern(this, 'bitsolo'), - bixin: createAaopoolPattern(this, 'bixin'), - blockfills: createAaopoolPattern(this, 'blockfills'), - braiinspool: createAaopoolPattern(this, 'braiinspool'), - bravomining: createAaopoolPattern(this, 'bravomining'), - btcc: createAaopoolPattern(this, 'btcc'), - btccom: createAaopoolPattern(this, 'btccom'), - btcdig: createAaopoolPattern(this, 'btcdig'), - btcguild: createAaopoolPattern(this, 'btcguild'), - btclab: createAaopoolPattern(this, 'btclab'), - btcmp: createAaopoolPattern(this, 'btcmp'), - btcnuggets: createAaopoolPattern(this, 'btcnuggets'), - btcpoolparty: createAaopoolPattern(this, 'btcpoolparty'), - btcserv: createAaopoolPattern(this, 'btcserv'), - btctop: createAaopoolPattern(this, 'btctop'), - btpool: createAaopoolPattern(this, 'btpool'), - bwpool: createAaopoolPattern(this, 'bwpool'), - bytepool: createAaopoolPattern(this, 'bytepool'), - canoe: createAaopoolPattern(this, 'canoe'), - canoepool: createAaopoolPattern(this, 'canoepool'), - carbonnegative: createAaopoolPattern(this, 'carbonnegative'), - ckpool: createAaopoolPattern(this, 'ckpool'), - cloudhashing: createAaopoolPattern(this, 'cloudhashing'), - coinlab: createAaopoolPattern(this, 'coinlab'), - cointerra: createAaopoolPattern(this, 'cointerra'), - connectbtc: createAaopoolPattern(this, 'connectbtc'), - dcex: createAaopoolPattern(this, 'dcex'), - dcexploration: createAaopoolPattern(this, 'dcexploration'), - digitalbtc: createAaopoolPattern(this, 'digitalbtc'), - digitalxmintsy: createAaopoolPattern(this, 'digitalxmintsy'), - dpool: createAaopoolPattern(this, 'dpool'), - eclipsemc: createAaopoolPattern(this, 'eclipsemc'), - eightbaochi: createAaopoolPattern(this, 'eightbaochi'), - ekanembtc: createAaopoolPattern(this, 'ekanembtc'), - eligius: createAaopoolPattern(this, 'eligius'), - emcdpool: createAaopoolPattern(this, 'emcdpool'), - entrustcharitypool: createAaopoolPattern(this, 'entrustcharitypool'), - eobot: createAaopoolPattern(this, 'eobot'), - exxbw: createAaopoolPattern(this, 'exxbw'), - f2pool: createAaopoolPattern(this, 'f2pool'), - fiftyeightcoin: createAaopoolPattern(this, 'fiftyeightcoin'), - foundryusa: createAaopoolPattern(this, 'foundryusa'), - futurebitapollosolo: createAaopoolPattern(this, 'futurebitapollosolo'), - gbminers: createAaopoolPattern(this, 'gbminers'), - ghashio: createAaopoolPattern(this, 'ghashio'), - givemecoins: createAaopoolPattern(this, 'givemecoins'), - gogreenlight: createAaopoolPattern(this, 'gogreenlight'), - haominer: createAaopoolPattern(this, 'haominer'), - haozhuzhu: createAaopoolPattern(this, 'haozhuzhu'), - hashbx: createAaopoolPattern(this, 'hashbx'), - hashpool: createAaopoolPattern(this, 'hashpool'), - helix: createAaopoolPattern(this, 'helix'), - hhtt: createAaopoolPattern(this, 'hhtt'), - hotpool: createAaopoolPattern(this, 'hotpool'), - hummerpool: createAaopoolPattern(this, 'hummerpool'), - huobipool: createAaopoolPattern(this, 'huobipool'), - innopolistech: createAaopoolPattern(this, 'innopolistech'), - kanopool: createAaopoolPattern(this, 'kanopool'), - kncminer: createAaopoolPattern(this, 'kncminer'), - kucoinpool: createAaopoolPattern(this, 'kucoinpool'), - lubiancom: createAaopoolPattern(this, 'lubiancom'), - luckypool: createAaopoolPattern(this, 'luckypool'), - luxor: createAaopoolPattern(this, 'luxor'), - marapool: createAaopoolPattern(this, 'marapool'), - maxbtc: createAaopoolPattern(this, 'maxbtc'), - maxipool: createAaopoolPattern(this, 'maxipool'), - megabigpower: createAaopoolPattern(this, 'megabigpower'), - minerium: createAaopoolPattern(this, 'minerium'), - miningcity: createAaopoolPattern(this, 'miningcity'), - miningdutch: createAaopoolPattern(this, 'miningdutch'), - miningkings: createAaopoolPattern(this, 'miningkings'), - miningsquared: createAaopoolPattern(this, 'miningsquared'), - mmpool: createAaopoolPattern(this, 'mmpool'), - mtred: createAaopoolPattern(this, 'mtred'), - multicoinco: createAaopoolPattern(this, 'multicoinco'), - multipool: createAaopoolPattern(this, 'multipool'), - mybtccoinpool: createAaopoolPattern(this, 'mybtccoinpool'), - neopool: createAaopoolPattern(this, 'neopool'), - nexious: createAaopoolPattern(this, 'nexious'), - nicehash: createAaopoolPattern(this, 'nicehash'), - nmcbit: createAaopoolPattern(this, 'nmcbit'), - novablock: createAaopoolPattern(this, 'novablock'), - ocean: createAaopoolPattern(this, 'ocean'), - okexpool: createAaopoolPattern(this, 'okexpool'), - okkong: createAaopoolPattern(this, 'okkong'), - okminer: createAaopoolPattern(this, 'okminer'), - okpooltop: createAaopoolPattern(this, 'okpooltop'), - onehash: createAaopoolPattern(this, 'onehash'), - onem1x: createAaopoolPattern(this, 'onem1x'), - onethash: createAaopoolPattern(this, 'onethash'), - ozcoin: createAaopoolPattern(this, 'ozcoin'), - parasite: createAaopoolPattern(this, 'parasite'), - patels: createAaopoolPattern(this, 'patels'), - pegapool: createAaopoolPattern(this, 'pegapool'), - phashio: createAaopoolPattern(this, 'phashio'), - phoenix: createAaopoolPattern(this, 'phoenix'), - polmine: createAaopoolPattern(this, 'polmine'), - pool175btc: createAaopoolPattern(this, 'pool175btc'), - pool50btc: createAaopoolPattern(this, 'pool50btc'), - poolin: createAaopoolPattern(this, 'poolin'), - portlandhodl: createAaopoolPattern(this, 'portlandhodl'), - publicpool: createAaopoolPattern(this, 'publicpool'), - purebtccom: createAaopoolPattern(this, 'purebtccom'), - rawpool: createAaopoolPattern(this, 'rawpool'), - rigpool: createAaopoolPattern(this, 'rigpool'), - sbicrypto: createAaopoolPattern(this, 'sbicrypto'), - secpool: createAaopoolPattern(this, 'secpool'), - secretsuperstar: createAaopoolPattern(this, 'secretsuperstar'), - sevenpool: createAaopoolPattern(this, 'sevenpool'), - shawnp0wers: createAaopoolPattern(this, 'shawnp0wers'), - sigmapoolcom: createAaopoolPattern(this, 'sigmapoolcom'), - simplecoinus: createAaopoolPattern(this, 'simplecoinus'), - solock: createAaopoolPattern(this, 'solock'), - spiderpool: createAaopoolPattern(this, 'spiderpool'), - stminingcorp: createAaopoolPattern(this, 'stminingcorp'), - tangpool: createAaopoolPattern(this, 'tangpool'), - tatmaspool: createAaopoolPattern(this, 'tatmaspool'), - tbdice: createAaopoolPattern(this, 'tbdice'), - telco214: createAaopoolPattern(this, 'telco214'), - terrapool: createAaopoolPattern(this, 'terrapool'), - tiger: createAaopoolPattern(this, 'tiger'), - tigerpoolnet: createAaopoolPattern(this, 'tigerpoolnet'), - titan: createAaopoolPattern(this, 'titan'), - transactioncoinmining: createAaopoolPattern(this, 'transactioncoinmining'), - trickysbtcpool: createAaopoolPattern(this, 'trickysbtcpool'), - triplemining: createAaopoolPattern(this, 'triplemining'), - twentyoneinc: createAaopoolPattern(this, 'twentyoneinc'), - ultimuspool: createAaopoolPattern(this, 'ultimuspool'), - unknown: createAaopoolPattern(this, 'unknown'), - unomp: createAaopoolPattern(this, 'unomp'), - viabtc: createAaopoolPattern(this, 'viabtc'), - waterhole: createAaopoolPattern(this, 'waterhole'), - wayicn: createAaopoolPattern(this, 'wayicn'), - whitepool: createAaopoolPattern(this, 'whitepool'), - wk057: createAaopoolPattern(this, 'wk057'), - yourbtcnet: createAaopoolPattern(this, 'yourbtcnet'), - zulupool: createAaopoolPattern(this, 'zulupool'), + unknown: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'unknown'), + blockfills: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'blockfills'), + ultimuspool: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'ultimuspool'), + terrapool: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'terrapool'), + luxor: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'luxor'), + onethash: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'onethash'), + btccom: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'btccom'), + bitfarms: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'bitfarms'), + huobipool: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'huobipool'), + wayicn: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'wayicn'), + canoepool: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'canoepool'), + btctop: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'btctop'), + bitcoincom: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'bitcoincom'), + pool175btc: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'pool175btc'), + gbminers: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'gbminers'), + axbt: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'axbt'), + asicminer: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'asicminer'), + bitminter: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'bitminter'), + bitcoinrussia: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'bitcoinrussia'), + btcserv: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'btcserv'), + simplecoinus: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'simplecoinus'), + btcguild: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'btcguild'), + eligius: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'eligius'), + ozcoin: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'ozcoin'), + eclipsemc: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'eclipsemc'), + maxbtc: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'maxbtc'), + triplemining: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'triplemining'), + coinlab: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'coinlab'), + pool50btc: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'pool50btc'), + ghashio: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'ghashio'), + stminingcorp: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'stminingcorp'), + bitparking: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'bitparking'), + mmpool: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'mmpool'), + polmine: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'polmine'), + kncminer: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'kncminer'), + bitalo: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'bitalo'), + f2pool: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'f2pool'), + hhtt: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'hhtt'), + megabigpower: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'megabigpower'), + mtred: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'mtred'), + nmcbit: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'nmcbit'), + yourbtcnet: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'yourbtcnet'), + givemecoins: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'givemecoins'), + braiinspool: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'braiinspool'), + antpool: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'antpool'), + multicoinco: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'multicoinco'), + bcpoolio: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'bcpoolio'), + cointerra: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'cointerra'), + kanopool: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'kanopool'), + solock: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'solock'), + ckpool: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'ckpool'), + nicehash: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'nicehash'), + bitclub: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'bitclub'), + bitcoinaffiliatenetwork: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'bitcoinaffiliatenetwork'), + btcc: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'btcc'), + bwpool: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'bwpool'), + exxbw: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'exxbw'), + bitsolo: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'bitsolo'), + bitfury: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'bitfury'), + twentyoneinc: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'twentyoneinc'), + digitalbtc: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'digitalbtc'), + eightbaochi: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'eightbaochi'), + mybtccoinpool: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'mybtccoinpool'), + tbdice: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'tbdice'), + hashpool: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'hashpool'), + nexious: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'nexious'), + bravomining: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'bravomining'), + hotpool: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'hotpool'), + okexpool: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'okexpool'), + bcmonster: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'bcmonster'), + onehash: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'onehash'), + bixin: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'bixin'), + tatmaspool: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'tatmaspool'), + viabtc: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'viabtc'), + connectbtc: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'connectbtc'), + batpool: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'batpool'), + waterhole: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'waterhole'), + dcexploration: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'dcexploration'), + dcex: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'dcex'), + btpool: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'btpool'), + fiftyeightcoin: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'fiftyeightcoin'), + bitcoinindia: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'bitcoinindia'), + shawnp0wers: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'shawnp0wers'), + phashio: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'phashio'), + rigpool: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'rigpool'), + haozhuzhu: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'haozhuzhu'), + sevenpool: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'sevenpool'), + miningkings: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'miningkings'), + hashbx: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'hashbx'), + dpool: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'dpool'), + rawpool: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'rawpool'), + haominer: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'haominer'), + helix: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'helix'), + bitcoinukraine: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'bitcoinukraine'), + poolin: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'poolin'), + secretsuperstar: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'secretsuperstar'), + tigerpoolnet: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'tigerpoolnet'), + sigmapoolcom: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'sigmapoolcom'), + okpooltop: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'okpooltop'), + hummerpool: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'hummerpool'), + tangpool: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'tangpool'), + bytepool: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'bytepool'), + spiderpool: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'spiderpool'), + novablock: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'novablock'), + miningcity: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'miningcity'), + binancepool: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'binancepool'), + minerium: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'minerium'), + lubiancom: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'lubiancom'), + okkong: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'okkong'), + aaopool: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'aaopool'), + emcdpool: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'emcdpool'), + foundryusa: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'foundryusa'), + sbicrypto: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'sbicrypto'), + arkpool: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'arkpool'), + purebtccom: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'purebtccom'), + marapool: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'marapool'), + kucoinpool: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'kucoinpool'), + entrustcharitypool: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'entrustcharitypool'), + okminer: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'okminer'), + titan: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'titan'), + pegapool: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'pegapool'), + btcnuggets: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'btcnuggets'), + cloudhashing: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'cloudhashing'), + digitalxmintsy: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'digitalxmintsy'), + telco214: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'telco214'), + btcpoolparty: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'btcpoolparty'), + multipool: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'multipool'), + transactioncoinmining: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'transactioncoinmining'), + btcdig: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'btcdig'), + trickysbtcpool: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'trickysbtcpool'), + btcmp: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'btcmp'), + eobot: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'eobot'), + unomp: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'unomp'), + patels: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'patels'), + gogreenlight: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'gogreenlight'), + ekanembtc: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'ekanembtc'), + canoe: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'canoe'), + tiger: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'tiger'), + onem1x: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'onem1x'), + zulupool: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'zulupool'), + secpool: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'secpool'), + ocean: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'ocean'), + whitepool: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'whitepool'), + wk057: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'wk057'), + futurebitapollosolo: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'futurebitapollosolo'), + carbonnegative: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'carbonnegative'), + portlandhodl: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'portlandhodl'), + phoenix: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'phoenix'), + neopool: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'neopool'), + maxipool: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'maxipool'), + bitfufupool: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'bitfufupool'), + luckypool: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'luckypool'), + miningdutch: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'miningdutch'), + publicpool: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'publicpool'), + miningsquared: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'miningsquared'), + innopolistech: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'innopolistech'), + btclab: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'btclab'), + parasite: create_1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(this, 'parasite'), }, }, - positions: { - blockPosition: createMetricPattern11(this, 'position'), - txPosition: createMetricPattern27(this, 'position'), - }, price: { cents: { - ohlc: createMetricPattern5(this, 'ohlc_cents'), split: { - close: createMetricPattern5(this, 'price_close_cents'), + open: createMetricPattern5(this, 'price_open_cents'), high: createMetricPattern5(this, 'price_high_cents'), low: createMetricPattern5(this, 'price_low_cents'), - open: createMetricPattern5(this, 'price_open_cents'), + close: createMetricPattern5(this, 'price_close_cents'), + }, + ohlc: createMetricPattern5(this, 'ohlc_cents'), + }, + usd: { + split: createCloseHighLowOpenPattern2(this, 'price'), + ohlc: createMetricPattern1(this, 'price_ohlc'), + }, + sats: createOhlcSplitPattern2(this, 'price'), + }, + distribution: { + chainState: createMetricPattern11(this, 'chain'), + anyAddressIndexes: { + p2a: createMetricPattern16(this, 'anyaddressindex'), + p2pk33: createMetricPattern18(this, 'anyaddressindex'), + p2pk65: createMetricPattern19(this, 'anyaddressindex'), + p2pkh: createMetricPattern20(this, 'anyaddressindex'), + p2sh: createMetricPattern21(this, 'anyaddressindex'), + p2tr: createMetricPattern22(this, 'anyaddressindex'), + p2wpkh: createMetricPattern23(this, 'anyaddressindex'), + p2wsh: createMetricPattern24(this, 'anyaddressindex'), + }, + addressesData: { + loaded: createMetricPattern31(this, 'loadedaddressdata'), + empty: createMetricPattern32(this, 'emptyaddressdata'), + }, + utxoCohorts: { + all: { + supply: createHalvedTotalPattern(this, 'supply'), + outputs: createUtxoPattern(this, 'utxo_count'), + activity: createCoinblocksCoindaysSatblocksSatdaysSentPattern(this, ''), + realized: createAdjustedAthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern(this, ''), + unrealized: createAthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern(this, ''), + costBasis: createInvestedMaxMinPercentilesSpotPattern(this, ''), + relative: { + supplyInProfitRelToOwnSupply: createMetricPattern1(this, 'supply_in_profit_rel_to_own_supply'), + supplyInLossRelToOwnSupply: createMetricPattern1(this, 'supply_in_loss_rel_to_own_supply'), + unrealizedProfitRelToOwnTotalUnrealizedPnl: createMetricPattern1(this, 'unrealized_profit_rel_to_own_total_unrealized_pnl'), + unrealizedLossRelToOwnTotalUnrealizedPnl: createMetricPattern1(this, 'unrealized_loss_rel_to_own_total_unrealized_pnl'), + negUnrealizedLossRelToOwnTotalUnrealizedPnl: createMetricPattern1(this, 'neg_unrealized_loss_rel_to_own_total_unrealized_pnl'), + netUnrealizedPnlRelToOwnTotalUnrealizedPnl: createMetricPattern1(this, 'net_unrealized_pnl_rel_to_own_total_unrealized_pnl'), + investedCapitalInProfitPct: createMetricPattern1(this, 'invested_capital_in_profit_pct'), + investedCapitalInLossPct: createMetricPattern1(this, 'invested_capital_in_loss_pct'), + }, + }, + ageRange: { + upTo1h: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'utxos_under_1h_old'), + _1hTo1d: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'utxos_1h_to_1d_old'), + _1dTo1w: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'utxos_1d_to_1w_old'), + _1wTo1m: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'utxos_1w_to_1m_old'), + _1mTo2m: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'utxos_1m_to_2m_old'), + _2mTo3m: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'utxos_2m_to_3m_old'), + _3mTo4m: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'utxos_3m_to_4m_old'), + _4mTo5m: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'utxos_4m_to_5m_old'), + _5mTo6m: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'utxos_5m_to_6m_old'), + _6mTo1y: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'utxos_6m_to_1y_old'), + _1yTo2y: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'utxos_1y_to_2y_old'), + _2yTo3y: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'utxos_2y_to_3y_old'), + _3yTo4y: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'utxos_3y_to_4y_old'), + _4yTo5y: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'utxos_4y_to_5y_old'), + _5yTo6y: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'utxos_5y_to_6y_old'), + _6yTo7y: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'utxos_6y_to_7y_old'), + _7yTo8y: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'utxos_7y_to_8y_old'), + _8yTo10y: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'utxos_8y_to_10y_old'), + _10yTo12y: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'utxos_10y_to_12y_old'), + _12yTo15y: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'utxos_12y_to_15y_old'), + from15y: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'utxos_over_15y_old'), + }, + epoch: { + _0: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'epoch_0'), + _1: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'epoch_1'), + _2: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'epoch_2'), + _3: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'epoch_3'), + _4: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'epoch_4'), + }, + year: { + _2009: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'year_2009'), + _2010: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'year_2010'), + _2011: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'year_2011'), + _2012: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'year_2012'), + _2013: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'year_2013'), + _2014: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'year_2014'), + _2015: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'year_2015'), + _2016: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'year_2016'), + _2017: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'year_2017'), + _2018: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'year_2018'), + _2019: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'year_2019'), + _2020: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'year_2020'), + _2021: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'year_2021'), + _2022: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'year_2022'), + _2023: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'year_2023'), + _2024: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'year_2024'), + _2025: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'year_2025'), + _2026: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'year_2026'), + }, + minAge: { + _1d: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(this, 'utxos_over_1d_old'), + _1w: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(this, 'utxos_over_1w_old'), + _1m: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(this, 'utxos_over_1m_old'), + _2m: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(this, 'utxos_over_2m_old'), + _3m: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(this, 'utxos_over_3m_old'), + _4m: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(this, 'utxos_over_4m_old'), + _5m: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(this, 'utxos_over_5m_old'), + _6m: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(this, 'utxos_over_6m_old'), + _1y: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(this, 'utxos_over_1y_old'), + _2y: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(this, 'utxos_over_2y_old'), + _3y: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(this, 'utxos_over_3y_old'), + _4y: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(this, 'utxos_over_4y_old'), + _5y: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(this, 'utxos_over_5y_old'), + _6y: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(this, 'utxos_over_6y_old'), + _7y: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(this, 'utxos_over_7y_old'), + _8y: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(this, 'utxos_over_8y_old'), + _10y: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(this, 'utxos_over_10y_old'), + _12y: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(this, 'utxos_over_12y_old'), + }, + geAmount: { + _1sat: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(this, 'utxos_over_1sat'), + _10sats: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(this, 'utxos_over_10sats'), + _100sats: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(this, 'utxos_over_100sats'), + _1kSats: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(this, 'utxos_over_1k_sats'), + _10kSats: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(this, 'utxos_over_10k_sats'), + _100kSats: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(this, 'utxos_over_100k_sats'), + _1mSats: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(this, 'utxos_over_1m_sats'), + _10mSats: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(this, 'utxos_over_10m_sats'), + _1btc: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(this, 'utxos_over_1btc'), + _10btc: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(this, 'utxos_over_10btc'), + _100btc: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(this, 'utxos_over_100btc'), + _1kBtc: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(this, 'utxos_over_1k_btc'), + _10kBtc: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(this, 'utxos_over_10k_btc'), + }, + amountRange: { + _0sats: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'utxos_with_0sats'), + _1satTo10sats: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'utxos_above_1sat_under_10sats'), + _10satsTo100sats: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'utxos_above_10sats_under_100sats'), + _100satsTo1kSats: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'utxos_above_100sats_under_1k_sats'), + _1kSatsTo10kSats: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'utxos_above_1k_sats_under_10k_sats'), + _10kSatsTo100kSats: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'utxos_above_10k_sats_under_100k_sats'), + _100kSatsTo1mSats: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'utxos_above_100k_sats_under_1m_sats'), + _1mSatsTo10mSats: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'utxos_above_1m_sats_under_10m_sats'), + _10mSatsTo1btc: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'utxos_above_10m_sats_under_1btc'), + _1btcTo10btc: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'utxos_above_1btc_under_10btc'), + _10btcTo100btc: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'utxos_above_10btc_under_100btc'), + _100btcTo1kBtc: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'utxos_above_100btc_under_1k_btc'), + _1kBtcTo10kBtc: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'utxos_above_1k_btc_under_10k_btc'), + _10kBtcTo100kBtc: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'utxos_above_10k_btc_under_100k_btc'), + _100kBtcOrMore: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'utxos_above_100k_btc'), + }, + term: { + short: { + supply: createHalvedTotalPattern(this, 'sth_supply'), + outputs: createUtxoPattern(this, 'sth_utxo_count'), + activity: createCoinblocksCoindaysSatblocksSatdaysSentPattern(this, 'sth'), + realized: createAdjustedAthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern(this, 'sth'), + unrealized: createAthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern(this, 'sth'), + costBasis: createInvestedMaxMinPercentilesSpotPattern(this, 'sth'), + relative: createInvestedNegNetNuplSupplyUnrealizedPattern2(this, 'sth'), + }, + long: { + supply: createHalvedTotalPattern(this, 'lth_supply'), + outputs: createUtxoPattern(this, 'lth_utxo_count'), + activity: createCoinblocksCoindaysSatblocksSatdaysSentPattern(this, 'lth'), + realized: createAthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern2(this, 'lth'), + unrealized: createAthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern(this, 'lth'), + costBasis: createInvestedMaxMinPercentilesSpotPattern(this, 'lth'), + relative: createInvestedNegNetNuplSupplyUnrealizedPattern2(this, 'lth'), + }, + }, + type: { + p2pk65: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'p2pk65'), + p2pk33: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'p2pk33'), + p2pkh: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'p2pkh'), + p2ms: createActivityCostOutputsRealizedSupplyUnrealizedPattern(this, 'p2ms'), + p2sh: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'p2sh'), + p2wpkh: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'p2wpkh'), + p2wsh: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'p2wsh'), + p2tr: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'p2tr'), + p2a: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(this, 'p2a'), + unknown: createActivityCostOutputsRealizedSupplyUnrealizedPattern(this, 'unknown_outputs'), + empty: createActivityCostOutputsRealizedSupplyUnrealizedPattern(this, 'empty_outputs'), + }, + maxAge: { + _1w: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5(this, 'utxos_under_1w_old'), + _1m: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5(this, 'utxos_under_1m_old'), + _2m: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5(this, 'utxos_under_2m_old'), + _3m: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5(this, 'utxos_under_3m_old'), + _4m: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5(this, 'utxos_under_4m_old'), + _5m: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5(this, 'utxos_under_5m_old'), + _6m: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5(this, 'utxos_under_6m_old'), + _1y: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5(this, 'utxos_under_1y_old'), + _2y: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5(this, 'utxos_under_2y_old'), + _3y: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5(this, 'utxos_under_3y_old'), + _4y: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5(this, 'utxos_under_4y_old'), + _5y: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5(this, 'utxos_under_5y_old'), + _6y: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5(this, 'utxos_under_6y_old'), + _7y: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5(this, 'utxos_under_7y_old'), + _8y: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5(this, 'utxos_under_8y_old'), + _10y: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5(this, 'utxos_under_10y_old'), + _12y: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5(this, 'utxos_under_12y_old'), + _15y: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5(this, 'utxos_under_15y_old'), + }, + ltAmount: { + _10sats: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(this, 'utxos_under_10sats'), + _100sats: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(this, 'utxos_under_100sats'), + _1kSats: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(this, 'utxos_under_1k_sats'), + _10kSats: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(this, 'utxos_under_10k_sats'), + _100kSats: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(this, 'utxos_under_100k_sats'), + _1mSats: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(this, 'utxos_under_1m_sats'), + _10mSats: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(this, 'utxos_under_10m_sats'), + _1btc: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(this, 'utxos_under_1btc'), + _10btc: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(this, 'utxos_under_10btc'), + _100btc: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(this, 'utxos_under_100btc'), + _1kBtc: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(this, 'utxos_under_1k_btc'), + _10kBtc: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(this, 'utxos_under_10k_btc'), + _100kBtc: createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(this, 'utxos_under_100k_btc'), }, }, - sats: createSatsPattern(this, 'price'), - usd: { - ohlc: createMetricPattern1(this, 'price_ohlc'), - split: createSplitPattern2(this, 'price'), + addressCohorts: { + geAmount: { + _1sat: createActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'addrs_over_1sat'), + _10sats: createActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'addrs_over_10sats'), + _100sats: createActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'addrs_over_100sats'), + _1kSats: createActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'addrs_over_1k_sats'), + _10kSats: createActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'addrs_over_10k_sats'), + _100kSats: createActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'addrs_over_100k_sats'), + _1mSats: createActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'addrs_over_1m_sats'), + _10mSats: createActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'addrs_over_10m_sats'), + _1btc: createActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'addrs_over_1btc'), + _10btc: createActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'addrs_over_10btc'), + _100btc: createActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'addrs_over_100btc'), + _1kBtc: createActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'addrs_over_1k_btc'), + _10kBtc: createActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'addrs_over_10k_btc'), + }, + amountRange: { + _0sats: createActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'addrs_with_0sats'), + _1satTo10sats: createActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'addrs_above_1sat_under_10sats'), + _10satsTo100sats: createActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'addrs_above_10sats_under_100sats'), + _100satsTo1kSats: createActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'addrs_above_100sats_under_1k_sats'), + _1kSatsTo10kSats: createActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'addrs_above_1k_sats_under_10k_sats'), + _10kSatsTo100kSats: createActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'addrs_above_10k_sats_under_100k_sats'), + _100kSatsTo1mSats: createActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'addrs_above_100k_sats_under_1m_sats'), + _1mSatsTo10mSats: createActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'addrs_above_1m_sats_under_10m_sats'), + _10mSatsTo1btc: createActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'addrs_above_10m_sats_under_1btc'), + _1btcTo10btc: createActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'addrs_above_1btc_under_10btc'), + _10btcTo100btc: createActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'addrs_above_10btc_under_100btc'), + _100btcTo1kBtc: createActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'addrs_above_100btc_under_1k_btc'), + _1kBtcTo10kBtc: createActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'addrs_above_1k_btc_under_10k_btc'), + _10kBtcTo100kBtc: createActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'addrs_above_10k_btc_under_100k_btc'), + _100kBtcOrMore: createActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'addrs_above_100k_btc'), + }, + ltAmount: { + _10sats: createActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'addrs_under_10sats'), + _100sats: createActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'addrs_under_100sats'), + _1kSats: createActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'addrs_under_1k_sats'), + _10kSats: createActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'addrs_under_10k_sats'), + _100kSats: createActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'addrs_under_100k_sats'), + _1mSats: createActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'addrs_under_1m_sats'), + _10mSats: createActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'addrs_under_10m_sats'), + _1btc: createActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'addrs_under_1btc'), + _10btc: createActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'addrs_under_10btc'), + _100btc: createActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'addrs_under_100btc'), + _1kBtc: createActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'addrs_under_1k_btc'), + _10kBtc: createActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'addrs_under_10k_btc'), + _100kBtc: createActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(this, 'addrs_under_100k_btc'), + }, }, - }, - scripts: { - count: { - emptyoutput: createDollarsPattern(this, 'emptyoutput_count'), - opreturn: createDollarsPattern(this, 'opreturn_count'), - p2a: createDollarsPattern(this, 'p2a_count'), - p2ms: createDollarsPattern(this, 'p2ms_count'), - p2pk33: createDollarsPattern(this, 'p2pk33_count'), - p2pk65: createDollarsPattern(this, 'p2pk65_count'), - p2pkh: createDollarsPattern(this, 'p2pkh_count'), - p2sh: createDollarsPattern(this, 'p2sh_count'), - p2tr: createDollarsPattern(this, 'p2tr_count'), - p2wpkh: createDollarsPattern(this, 'p2wpkh_count'), - p2wsh: createDollarsPattern(this, 'p2wsh_count'), - segwit: createDollarsPattern(this, 'segwit_count'), - segwitAdoption: createSegwitAdoptionPattern(this, 'segwit_adoption'), - taprootAdoption: createSegwitAdoptionPattern(this, 'taproot_adoption'), - unknownoutput: createDollarsPattern(this, 'unknownoutput_count'), + addrCount: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern(this, 'addr_count'), + emptyAddrCount: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern(this, 'empty_addr_count'), + addressActivity: { + all: createBalanceBothReactivatedReceivingSendingPattern(this, 'address_activity'), + p2pk65: createBalanceBothReactivatedReceivingSendingPattern(this, 'p2pk65_address_activity'), + p2pk33: createBalanceBothReactivatedReceivingSendingPattern(this, 'p2pk33_address_activity'), + p2pkh: createBalanceBothReactivatedReceivingSendingPattern(this, 'p2pkh_address_activity'), + p2sh: createBalanceBothReactivatedReceivingSendingPattern(this, 'p2sh_address_activity'), + p2wpkh: createBalanceBothReactivatedReceivingSendingPattern(this, 'p2wpkh_address_activity'), + p2wsh: createBalanceBothReactivatedReceivingSendingPattern(this, 'p2wsh_address_activity'), + p2tr: createBalanceBothReactivatedReceivingSendingPattern(this, 'p2tr_address_activity'), + p2a: createBalanceBothReactivatedReceivingSendingPattern(this, 'p2a_address_activity'), }, - emptyToTxindex: createMetricPattern9(this, 'txindex'), - firstEmptyoutputindex: createMetricPattern11(this, 'first_emptyoutputindex'), - firstOpreturnindex: createMetricPattern11(this, 'first_opreturnindex'), - firstP2msoutputindex: createMetricPattern11(this, 'first_p2msoutputindex'), - firstUnknownoutputindex: createMetricPattern11(this, 'first_unknownoutputindex'), - opreturnToTxindex: createMetricPattern14(this, 'txindex'), - p2msToTxindex: createMetricPattern17(this, 'txindex'), - unknownToTxindex: createMetricPattern28(this, 'txindex'), - value: { - opreturn: createCoinbasePattern(this, 'opreturn_value'), + totalAddrCount: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern(this, 'total_addr_count'), + newAddrCount: { + all: createAverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(this, 'new_addr_count'), + p2pk65: createAverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(this, 'p2pk65_new_addr_count'), + p2pk33: createAverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(this, 'p2pk33_new_addr_count'), + p2pkh: createAverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(this, 'p2pkh_new_addr_count'), + p2sh: createAverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(this, 'p2sh_new_addr_count'), + p2wpkh: createAverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(this, 'p2wpkh_new_addr_count'), + p2wsh: createAverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(this, 'p2wsh_new_addr_count'), + p2tr: createAverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(this, 'p2tr_new_addr_count'), + p2a: createAverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(this, 'p2a_new_addr_count'), }, + growthRate: { + all: createAverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern(this, 'growth_rate'), + p2pk65: createAverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern(this, 'p2pk65_growth_rate'), + p2pk33: createAverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern(this, 'p2pk33_growth_rate'), + p2pkh: createAverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern(this, 'p2pkh_growth_rate'), + p2sh: createAverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern(this, 'p2sh_growth_rate'), + p2wpkh: createAverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern(this, 'p2wpkh_growth_rate'), + p2wsh: createAverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern(this, 'p2wsh_growth_rate'), + p2tr: createAverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern(this, 'p2tr_growth_rate'), + p2a: createAverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern(this, 'p2a_growth_rate'), + }, + loadedaddressindex: createMetricPattern31(this, 'loadedaddressindex'), + emptyaddressindex: createMetricPattern32(this, 'emptyaddressindex'), }, supply: { - burned: { - opreturn: createUnclaimedRewardsPattern(this, 'opreturn_supply'), - unspendable: createUnclaimedRewardsPattern(this, 'unspendable_supply'), - }, circulating: { + sats: createMetricPattern3(this, 'circulating_supply'), bitcoin: createMetricPattern3(this, 'circulating_supply_btc'), dollars: createMetricPattern3(this, 'circulating_supply_usd'), - sats: createMetricPattern3(this, 'circulating_supply'), + }, + burned: { + opreturn: createBitcoinDollarsSatsPattern3(this, 'opreturn_supply'), + unspendable: createBitcoinDollarsSatsPattern3(this, 'unspendable_supply'), }, inflation: createMetricPattern4(this, 'inflation_rate'), - marketCap: createMetricPattern1(this, 'market_cap'), velocity: { btc: createMetricPattern4(this, 'btc_velocity'), usd: createMetricPattern4(this, 'usd_velocity'), }, - }, - transactions: { - baseSize: createMetricPattern27(this, 'base_size'), - count: { - isCoinbase: createMetricPattern27(this, 'is_coinbase'), - txCount: createDollarsPattern(this, 'tx_count'), - }, - fees: { - fee: { - bitcoin: createCountPattern2(this, 'fee_btc'), - dollars: createCountPattern2(this, 'fee_usd'), - sats: createCountPattern2(this, 'fee'), - txindex: createMetricPattern27(this, 'fee'), - }, - feeRate: createFeeRatePattern(this, 'fee_rate'), - inputValue: createMetricPattern27(this, 'input_value'), - outputValue: createMetricPattern27(this, 'output_value'), - }, - firstTxindex: createMetricPattern11(this, 'first_txindex'), - firstTxinindex: createMetricPattern27(this, 'first_txinindex'), - firstTxoutindex: createMetricPattern27(this, 'first_txoutindex'), - height: createMetricPattern27(this, 'height'), - isExplicitlyRbf: createMetricPattern27(this, 'is_explicitly_rbf'), - rawlocktime: createMetricPattern27(this, 'rawlocktime'), - size: { - vsize: createFeeRatePattern(this, 'tx_vsize'), - weight: createFeeRatePattern(this, 'tx_weight'), - }, - totalSize: createMetricPattern27(this, 'total_size'), - txid: createMetricPattern27(this, 'txid'), - txversion: createMetricPattern27(this, 'txversion'), - versions: { - v1: createBlockCountPattern(this, 'tx_v1'), - v2: createBlockCountPattern(this, 'tx_v2'), - v3: createBlockCountPattern(this, 'tx_v3'), - }, - volume: { - annualizedVolume: create_2015Pattern(this, 'annualized_volume'), - inputsPerSec: createMetricPattern4(this, 'inputs_per_sec'), - outputsPerSec: createMetricPattern4(this, 'outputs_per_sec'), - receivedSum: createActiveSupplyPattern(this, 'received_sum'), - sentSum: createActiveSupplyPattern(this, 'sent_sum'), - txPerSec: createMetricPattern4(this, 'tx_per_sec'), - }, + marketCap: createMetricPattern1(this, 'market_cap'), }, }; } diff --git a/packages/brk_client/brk_client/__init__.py b/packages/brk_client/brk_client/__init__.py index c99c44998..49f92a10a 100644 --- a/packages/brk_client/brk_client/__init__.py +++ b/packages/brk_client/brk_client/__init__.py @@ -40,9 +40,18 @@ BlockHash = str TxIndex = int # Transaction or block weight in weight units (WU) Weight = int -Cents = int +# Cents × Sats (u128) - price in cents multiplied by amount in sats. +# Uses u128 because large amounts at any price can overflow u64. +CentsSats = int +# Raw cents squared (u128) - stores cents² × sats without division. +# Used for precise accumulation of investor cap values: Σ(price² × sats). +# investor_price = investor_cap_raw / realized_cap_raw +CentsSquaredSats = int +# Unsigned cents (u64) - for values that should never be negative. +# Used for invested capital, realized cap, etc. +CentsUnsigned = int # Closing price value for a time period -Close = Cents +Close = CentsUnsigned # Output format for API responses Format = Literal["json", "csv"] # Maximum number of results to return. Defaults to 100 if not specified. @@ -62,10 +71,10 @@ HalvingEpoch = int # Hex-encoded string Hex = str # Highest price value for a time period -High = Cents +High = CentsUnsigned LoadedAddressIndex = TypeIndex # Lowest price value for a time period -Low = Cents +Low = CentsUnsigned # Virtual size in vbytes (weight / 4, rounded up) VSize = int # Metric name @@ -74,7 +83,7 @@ Metric = str Metrics = str MonthIndex = int # Opening price value for a time period -Open = Cents +Open = CentsUnsigned OpReturnIndex = TypeIndex OutPoint = int # Type (P2PKH, P2WPKH, P2SH, P2TR, etc.) @@ -510,14 +519,16 @@ class LoadedAddressData(TypedDict): spent_txo_count: Number of transaction outputs spent by this address received: Satoshis received by this address sent: Satoshis sent by this address - realized_cap: The realized capitalization of this address + realized_cap_raw: The realized capitalization: Σ(price × sats) + investor_cap_raw: The investor capitalization: Σ(price² × sats) """ tx_count: int funded_txo_count: int spent_txo_count: int received: Sats sent: Sats - realized_cap: Dollars + realized_cap_raw: CentsSats + investor_cap_raw: CentsSquaredSats class MempoolBlock(TypedDict): """ @@ -614,7 +625,7 @@ class MetricWithIndex(TypedDict): metric: Metric index: Index -class OHLCCents(TypedDict): +class OHLCCentsUnsigned(TypedDict): """ OHLC (Open, High, Low, Close) data in cents """ @@ -1815,7 +1826,7 @@ class MetricPattern32(Generic[T]): # Reusable structural pattern classes -class RealizedPattern3: +class AdjustedAthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -1825,22 +1836,35 @@ class RealizedPattern3: self.adjusted_sopr_7d_ema: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, 'adjusted_sopr_7d_ema')) self.adjusted_value_created: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'adjusted_value_created')) self.adjusted_value_destroyed: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'adjusted_value_destroyed')) + self.ath_regret: CumulativeSumPattern[Dollars] = CumulativeSumPattern(client, _m(acc, 'realized_ath_regret')) + self.cap_raw: MetricPattern11[CentsSats] = MetricPattern11(client, _m(acc, 'cap_raw')) + self.capitulation_flow: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'capitulation_flow')) + self.investor_cap_raw: MetricPattern11[CentsSquaredSats] = MetricPattern11(client, _m(acc, 'investor_cap_raw')) + self.investor_price: DollarsSatsPattern = DollarsSatsPattern(client, _m(acc, 'investor_price')) + self.investor_price_cents: MetricPattern1[CentsUnsigned] = MetricPattern1(client, _m(acc, 'investor_price_cents')) + self.investor_price_extra: RatioPattern = RatioPattern(client, _m(acc, 'investor_price_ratio')) + self.loss_value_created: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'loss_value_created')) + self.loss_value_destroyed: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'loss_value_destroyed')) self.mvrv: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'mvrv')) - self.neg_realized_loss: BitcoinPattern2[Dollars] = BitcoinPattern2(client, _m(acc, 'neg_realized_loss')) - self.net_realized_pnl: BlockCountPattern[Dollars] = BlockCountPattern(client, _m(acc, 'net_realized_pnl')) + self.neg_realized_loss: CumulativeSumPattern2[Dollars] = CumulativeSumPattern2(client, _m(acc, 'neg_realized_loss')) + self.net_realized_pnl: CumulativeSumPattern[Dollars] = CumulativeSumPattern(client, _m(acc, 'net_realized_pnl')) self.net_realized_pnl_cumulative_30d_delta: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta')) self.net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_market_cap')) self.net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap')) - self.net_realized_pnl_rel_to_realized_cap: BlockCountPattern[StoredF32] = BlockCountPattern(client, _m(acc, 'net_realized_pnl_rel_to_realized_cap')) + self.net_realized_pnl_rel_to_realized_cap: CumulativeSumPattern[StoredF32] = CumulativeSumPattern(client, _m(acc, 'net_realized_pnl_rel_to_realized_cap')) + self.profit_flow: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'profit_flow')) + self.profit_value_created: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'profit_value_created')) + self.profit_value_destroyed: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'profit_value_destroyed')) self.realized_cap: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_cap')) self.realized_cap_30d_delta: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'realized_cap_30d_delta')) + self.realized_cap_cents: MetricPattern1[CentsUnsigned] = MetricPattern1(client, _m(acc, 'realized_cap_cents')) self.realized_cap_rel_to_own_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'realized_cap_rel_to_own_market_cap')) - self.realized_loss: BlockCountPattern[Dollars] = BlockCountPattern(client, _m(acc, 'realized_loss')) - self.realized_loss_rel_to_realized_cap: BlockCountPattern[StoredF32] = BlockCountPattern(client, _m(acc, 'realized_loss_rel_to_realized_cap')) - self.realized_price: ActivePricePattern = ActivePricePattern(client, _m(acc, 'realized_price')) - self.realized_price_extra: ActivePriceRatioPattern = ActivePriceRatioPattern(client, _m(acc, 'realized_price_ratio')) - self.realized_profit: BlockCountPattern[Dollars] = BlockCountPattern(client, _m(acc, 'realized_profit')) - self.realized_profit_rel_to_realized_cap: BlockCountPattern[StoredF32] = BlockCountPattern(client, _m(acc, 'realized_profit_rel_to_realized_cap')) + self.realized_loss: CumulativeSumPattern[Dollars] = CumulativeSumPattern(client, _m(acc, 'realized_loss')) + self.realized_loss_rel_to_realized_cap: CumulativeSumPattern[StoredF32] = CumulativeSumPattern(client, _m(acc, 'realized_loss_rel_to_realized_cap')) + self.realized_price: DollarsSatsPattern = DollarsSatsPattern(client, _m(acc, 'realized_price')) + self.realized_price_extra: RatioPattern = RatioPattern(client, _m(acc, 'realized_price_ratio')) + self.realized_profit: CumulativeSumPattern[Dollars] = CumulativeSumPattern(client, _m(acc, 'realized_profit')) + self.realized_profit_rel_to_realized_cap: CumulativeSumPattern[StoredF32] = CumulativeSumPattern(client, _m(acc, 'realized_profit_rel_to_realized_cap')) self.realized_profit_to_loss_ratio: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, 'realized_profit_to_loss_ratio')) self.realized_value: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_value')) self.sell_side_risk_ratio: MetricPattern6[StoredF32] = MetricPattern6(client, _m(acc, 'sell_side_risk_ratio')) @@ -1853,7 +1877,7 @@ class RealizedPattern3: self.value_created: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_created')) self.value_destroyed: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_destroyed')) -class RealizedPattern4: +class AdjustedAthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern2: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -1863,21 +1887,34 @@ class RealizedPattern4: self.adjusted_sopr_7d_ema: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, 'adjusted_sopr_7d_ema')) self.adjusted_value_created: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'adjusted_value_created')) self.adjusted_value_destroyed: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'adjusted_value_destroyed')) + self.ath_regret: CumulativeSumPattern[Dollars] = CumulativeSumPattern(client, _m(acc, 'realized_ath_regret')) + self.cap_raw: MetricPattern11[CentsSats] = MetricPattern11(client, _m(acc, 'cap_raw')) + self.capitulation_flow: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'capitulation_flow')) + self.investor_cap_raw: MetricPattern11[CentsSquaredSats] = MetricPattern11(client, _m(acc, 'investor_cap_raw')) + self.investor_price: DollarsSatsPattern = DollarsSatsPattern(client, _m(acc, 'investor_price')) + self.investor_price_cents: MetricPattern1[CentsUnsigned] = MetricPattern1(client, _m(acc, 'investor_price_cents')) + self.investor_price_extra: RatioPattern2 = RatioPattern2(client, _m(acc, 'investor_price_ratio')) + self.loss_value_created: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'loss_value_created')) + self.loss_value_destroyed: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'loss_value_destroyed')) self.mvrv: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'mvrv')) - self.neg_realized_loss: BitcoinPattern2[Dollars] = BitcoinPattern2(client, _m(acc, 'neg_realized_loss')) - self.net_realized_pnl: BlockCountPattern[Dollars] = BlockCountPattern(client, _m(acc, 'net_realized_pnl')) + self.neg_realized_loss: CumulativeSumPattern2[Dollars] = CumulativeSumPattern2(client, _m(acc, 'neg_realized_loss')) + self.net_realized_pnl: CumulativeSumPattern[Dollars] = CumulativeSumPattern(client, _m(acc, 'net_realized_pnl')) self.net_realized_pnl_cumulative_30d_delta: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta')) self.net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_market_cap')) self.net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap')) - self.net_realized_pnl_rel_to_realized_cap: BlockCountPattern[StoredF32] = BlockCountPattern(client, _m(acc, 'net_realized_pnl_rel_to_realized_cap')) + self.net_realized_pnl_rel_to_realized_cap: CumulativeSumPattern[StoredF32] = CumulativeSumPattern(client, _m(acc, 'net_realized_pnl_rel_to_realized_cap')) + self.profit_flow: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'profit_flow')) + self.profit_value_created: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'profit_value_created')) + self.profit_value_destroyed: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'profit_value_destroyed')) self.realized_cap: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_cap')) self.realized_cap_30d_delta: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'realized_cap_30d_delta')) - self.realized_loss: BlockCountPattern[Dollars] = BlockCountPattern(client, _m(acc, 'realized_loss')) - self.realized_loss_rel_to_realized_cap: BlockCountPattern[StoredF32] = BlockCountPattern(client, _m(acc, 'realized_loss_rel_to_realized_cap')) - self.realized_price: ActivePricePattern = ActivePricePattern(client, _m(acc, 'realized_price')) - self.realized_price_extra: RealizedPriceExtraPattern = RealizedPriceExtraPattern(client, _m(acc, 'realized_price_ratio')) - self.realized_profit: BlockCountPattern[Dollars] = BlockCountPattern(client, _m(acc, 'realized_profit')) - self.realized_profit_rel_to_realized_cap: BlockCountPattern[StoredF32] = BlockCountPattern(client, _m(acc, 'realized_profit_rel_to_realized_cap')) + self.realized_cap_cents: MetricPattern1[CentsUnsigned] = MetricPattern1(client, _m(acc, 'realized_cap_cents')) + self.realized_loss: CumulativeSumPattern[Dollars] = CumulativeSumPattern(client, _m(acc, 'realized_loss')) + self.realized_loss_rel_to_realized_cap: CumulativeSumPattern[StoredF32] = CumulativeSumPattern(client, _m(acc, 'realized_loss_rel_to_realized_cap')) + self.realized_price: DollarsSatsPattern = DollarsSatsPattern(client, _m(acc, 'realized_price')) + self.realized_price_extra: RatioPattern2 = RatioPattern2(client, _m(acc, 'realized_price_ratio')) + self.realized_profit: CumulativeSumPattern[Dollars] = CumulativeSumPattern(client, _m(acc, 'realized_profit')) + self.realized_profit_rel_to_realized_cap: CumulativeSumPattern[StoredF32] = CumulativeSumPattern(client, _m(acc, 'realized_profit_rel_to_realized_cap')) self.realized_value: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_value')) self.sell_side_risk_ratio: MetricPattern6[StoredF32] = MetricPattern6(client, _m(acc, 'sell_side_risk_ratio')) self.sell_side_risk_ratio_30d_ema: MetricPattern6[StoredF32] = MetricPattern6(client, _m(acc, 'sell_side_risk_ratio_30d_ema')) @@ -1889,185 +1926,137 @@ class RealizedPattern4: self.value_created: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_created')) self.value_destroyed: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_destroyed')) -class Ratio1ySdPattern: +class AthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern2: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self._0sd_usd: _0sdUsdPattern = _0sdUsdPattern(client, _m(acc, '0sd_usd')) + self.ath_regret: CumulativeSumPattern[Dollars] = CumulativeSumPattern(client, _m(acc, 'realized_ath_regret')) + self.cap_raw: MetricPattern11[CentsSats] = MetricPattern11(client, _m(acc, 'cap_raw')) + self.capitulation_flow: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'capitulation_flow')) + self.investor_cap_raw: MetricPattern11[CentsSquaredSats] = MetricPattern11(client, _m(acc, 'investor_cap_raw')) + self.investor_price: DollarsSatsPattern = DollarsSatsPattern(client, _m(acc, 'investor_price')) + self.investor_price_cents: MetricPattern1[CentsUnsigned] = MetricPattern1(client, _m(acc, 'investor_price_cents')) + self.investor_price_extra: RatioPattern = RatioPattern(client, _m(acc, 'investor_price_ratio')) + self.loss_value_created: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'loss_value_created')) + self.loss_value_destroyed: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'loss_value_destroyed')) + self.mvrv: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'mvrv')) + self.neg_realized_loss: CumulativeSumPattern2[Dollars] = CumulativeSumPattern2(client, _m(acc, 'neg_realized_loss')) + self.net_realized_pnl: CumulativeSumPattern[Dollars] = CumulativeSumPattern(client, _m(acc, 'net_realized_pnl')) + self.net_realized_pnl_cumulative_30d_delta: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta')) + self.net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_market_cap')) + self.net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap')) + self.net_realized_pnl_rel_to_realized_cap: CumulativeSumPattern[StoredF32] = CumulativeSumPattern(client, _m(acc, 'net_realized_pnl_rel_to_realized_cap')) + self.profit_flow: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'profit_flow')) + self.profit_value_created: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'profit_value_created')) + self.profit_value_destroyed: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'profit_value_destroyed')) + self.realized_cap: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_cap')) + self.realized_cap_30d_delta: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'realized_cap_30d_delta')) + self.realized_cap_cents: MetricPattern1[CentsUnsigned] = MetricPattern1(client, _m(acc, 'realized_cap_cents')) + self.realized_cap_rel_to_own_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'realized_cap_rel_to_own_market_cap')) + self.realized_loss: CumulativeSumPattern[Dollars] = CumulativeSumPattern(client, _m(acc, 'realized_loss')) + self.realized_loss_rel_to_realized_cap: CumulativeSumPattern[StoredF32] = CumulativeSumPattern(client, _m(acc, 'realized_loss_rel_to_realized_cap')) + self.realized_price: DollarsSatsPattern = DollarsSatsPattern(client, _m(acc, 'realized_price')) + self.realized_price_extra: RatioPattern = RatioPattern(client, _m(acc, 'realized_price_ratio')) + self.realized_profit: CumulativeSumPattern[Dollars] = CumulativeSumPattern(client, _m(acc, 'realized_profit')) + self.realized_profit_rel_to_realized_cap: CumulativeSumPattern[StoredF32] = CumulativeSumPattern(client, _m(acc, 'realized_profit_rel_to_realized_cap')) + self.realized_profit_to_loss_ratio: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, 'realized_profit_to_loss_ratio')) + self.realized_value: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_value')) + self.sell_side_risk_ratio: MetricPattern6[StoredF32] = MetricPattern6(client, _m(acc, 'sell_side_risk_ratio')) + self.sell_side_risk_ratio_30d_ema: MetricPattern6[StoredF32] = MetricPattern6(client, _m(acc, 'sell_side_risk_ratio_30d_ema')) + self.sell_side_risk_ratio_7d_ema: MetricPattern6[StoredF32] = MetricPattern6(client, _m(acc, 'sell_side_risk_ratio_7d_ema')) + self.sopr: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, 'sopr')) + self.sopr_30d_ema: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, 'sopr_30d_ema')) + self.sopr_7d_ema: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, 'sopr_7d_ema')) + self.total_realized_pnl: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'total_realized_pnl')) + self.value_created: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_created')) + self.value_destroyed: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_destroyed')) + +class AthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.ath_regret: CumulativeSumPattern[Dollars] = CumulativeSumPattern(client, _m(acc, 'realized_ath_regret')) + self.cap_raw: MetricPattern11[CentsSats] = MetricPattern11(client, _m(acc, 'cap_raw')) + self.capitulation_flow: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'capitulation_flow')) + self.investor_cap_raw: MetricPattern11[CentsSquaredSats] = MetricPattern11(client, _m(acc, 'investor_cap_raw')) + self.investor_price: DollarsSatsPattern = DollarsSatsPattern(client, _m(acc, 'investor_price')) + self.investor_price_cents: MetricPattern1[CentsUnsigned] = MetricPattern1(client, _m(acc, 'investor_price_cents')) + self.investor_price_extra: RatioPattern2 = RatioPattern2(client, _m(acc, 'investor_price_ratio')) + self.loss_value_created: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'loss_value_created')) + self.loss_value_destroyed: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'loss_value_destroyed')) + self.mvrv: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'mvrv')) + self.neg_realized_loss: CumulativeSumPattern2[Dollars] = CumulativeSumPattern2(client, _m(acc, 'neg_realized_loss')) + self.net_realized_pnl: CumulativeSumPattern[Dollars] = CumulativeSumPattern(client, _m(acc, 'net_realized_pnl')) + self.net_realized_pnl_cumulative_30d_delta: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta')) + self.net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_market_cap')) + self.net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap')) + self.net_realized_pnl_rel_to_realized_cap: CumulativeSumPattern[StoredF32] = CumulativeSumPattern(client, _m(acc, 'net_realized_pnl_rel_to_realized_cap')) + self.profit_flow: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'profit_flow')) + self.profit_value_created: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'profit_value_created')) + self.profit_value_destroyed: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'profit_value_destroyed')) + self.realized_cap: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_cap')) + self.realized_cap_30d_delta: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'realized_cap_30d_delta')) + self.realized_cap_cents: MetricPattern1[CentsUnsigned] = MetricPattern1(client, _m(acc, 'realized_cap_cents')) + self.realized_loss: CumulativeSumPattern[Dollars] = CumulativeSumPattern(client, _m(acc, 'realized_loss')) + self.realized_loss_rel_to_realized_cap: CumulativeSumPattern[StoredF32] = CumulativeSumPattern(client, _m(acc, 'realized_loss_rel_to_realized_cap')) + self.realized_price: DollarsSatsPattern = DollarsSatsPattern(client, _m(acc, 'realized_price')) + self.realized_price_extra: RatioPattern2 = RatioPattern2(client, _m(acc, 'realized_price_ratio')) + self.realized_profit: CumulativeSumPattern[Dollars] = CumulativeSumPattern(client, _m(acc, 'realized_profit')) + self.realized_profit_rel_to_realized_cap: CumulativeSumPattern[StoredF32] = CumulativeSumPattern(client, _m(acc, 'realized_profit_rel_to_realized_cap')) + self.realized_value: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_value')) + self.sell_side_risk_ratio: MetricPattern6[StoredF32] = MetricPattern6(client, _m(acc, 'sell_side_risk_ratio')) + self.sell_side_risk_ratio_30d_ema: MetricPattern6[StoredF32] = MetricPattern6(client, _m(acc, 'sell_side_risk_ratio_30d_ema')) + self.sell_side_risk_ratio_7d_ema: MetricPattern6[StoredF32] = MetricPattern6(client, _m(acc, 'sell_side_risk_ratio_7d_ema')) + self.sopr: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, 'sopr')) + self.sopr_30d_ema: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, 'sopr_30d_ema')) + self.sopr_7d_ema: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, 'sopr_7d_ema')) + self.total_realized_pnl: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'total_realized_pnl')) + self.value_created: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_created')) + self.value_destroyed: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_destroyed')) + +class _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self._0sd_usd: DollarsSatsPattern2 = DollarsSatsPattern2(client, _m(acc, '0sd_usd')) self.m0_5sd: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'm0_5sd')) - self.m0_5sd_usd: _0sdUsdPattern = _0sdUsdPattern(client, _m(acc, 'm0_5sd_usd')) + self.m0_5sd_usd: DollarsSatsPattern2 = DollarsSatsPattern2(client, _m(acc, 'm0_5sd_usd')) self.m1_5sd: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'm1_5sd')) - self.m1_5sd_usd: _0sdUsdPattern = _0sdUsdPattern(client, _m(acc, 'm1_5sd_usd')) + self.m1_5sd_usd: DollarsSatsPattern2 = DollarsSatsPattern2(client, _m(acc, 'm1_5sd_usd')) self.m1sd: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'm1sd')) - self.m1sd_usd: _0sdUsdPattern = _0sdUsdPattern(client, _m(acc, 'm1sd_usd')) + self.m1sd_usd: DollarsSatsPattern2 = DollarsSatsPattern2(client, _m(acc, 'm1sd_usd')) self.m2_5sd: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'm2_5sd')) - self.m2_5sd_usd: _0sdUsdPattern = _0sdUsdPattern(client, _m(acc, 'm2_5sd_usd')) + self.m2_5sd_usd: DollarsSatsPattern2 = DollarsSatsPattern2(client, _m(acc, 'm2_5sd_usd')) self.m2sd: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'm2sd')) - self.m2sd_usd: _0sdUsdPattern = _0sdUsdPattern(client, _m(acc, 'm2sd_usd')) + self.m2sd_usd: DollarsSatsPattern2 = DollarsSatsPattern2(client, _m(acc, 'm2sd_usd')) self.m3sd: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'm3sd')) - self.m3sd_usd: _0sdUsdPattern = _0sdUsdPattern(client, _m(acc, 'm3sd_usd')) + self.m3sd_usd: DollarsSatsPattern2 = DollarsSatsPattern2(client, _m(acc, 'm3sd_usd')) self.p0_5sd: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'p0_5sd')) - self.p0_5sd_usd: _0sdUsdPattern = _0sdUsdPattern(client, _m(acc, 'p0_5sd_usd')) + self.p0_5sd_usd: DollarsSatsPattern2 = DollarsSatsPattern2(client, _m(acc, 'p0_5sd_usd')) self.p1_5sd: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'p1_5sd')) - self.p1_5sd_usd: _0sdUsdPattern = _0sdUsdPattern(client, _m(acc, 'p1_5sd_usd')) + self.p1_5sd_usd: DollarsSatsPattern2 = DollarsSatsPattern2(client, _m(acc, 'p1_5sd_usd')) self.p1sd: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'p1sd')) - self.p1sd_usd: _0sdUsdPattern = _0sdUsdPattern(client, _m(acc, 'p1sd_usd')) + self.p1sd_usd: DollarsSatsPattern2 = DollarsSatsPattern2(client, _m(acc, 'p1sd_usd')) self.p2_5sd: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'p2_5sd')) - self.p2_5sd_usd: _0sdUsdPattern = _0sdUsdPattern(client, _m(acc, 'p2_5sd_usd')) + self.p2_5sd_usd: DollarsSatsPattern2 = DollarsSatsPattern2(client, _m(acc, 'p2_5sd_usd')) self.p2sd: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'p2sd')) - self.p2sd_usd: _0sdUsdPattern = _0sdUsdPattern(client, _m(acc, 'p2sd_usd')) + self.p2sd_usd: DollarsSatsPattern2 = DollarsSatsPattern2(client, _m(acc, 'p2sd_usd')) self.p3sd: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'p3sd')) - self.p3sd_usd: _0sdUsdPattern = _0sdUsdPattern(client, _m(acc, 'p3sd_usd')) + self.p3sd_usd: DollarsSatsPattern2 = DollarsSatsPattern2(client, _m(acc, 'p3sd_usd')) self.sd: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'sd')) self.sma: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'sma')) self.zscore: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'zscore')) -class RealizedPattern2: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.mvrv: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'mvrv')) - self.neg_realized_loss: BitcoinPattern2[Dollars] = BitcoinPattern2(client, _m(acc, 'neg_realized_loss')) - self.net_realized_pnl: BlockCountPattern[Dollars] = BlockCountPattern(client, _m(acc, 'net_realized_pnl')) - self.net_realized_pnl_cumulative_30d_delta: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta')) - self.net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_market_cap')) - self.net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap')) - self.net_realized_pnl_rel_to_realized_cap: BlockCountPattern[StoredF32] = BlockCountPattern(client, _m(acc, 'net_realized_pnl_rel_to_realized_cap')) - self.realized_cap: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_cap')) - self.realized_cap_30d_delta: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'realized_cap_30d_delta')) - self.realized_cap_rel_to_own_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'realized_cap_rel_to_own_market_cap')) - self.realized_loss: BlockCountPattern[Dollars] = BlockCountPattern(client, _m(acc, 'realized_loss')) - self.realized_loss_rel_to_realized_cap: BlockCountPattern[StoredF32] = BlockCountPattern(client, _m(acc, 'realized_loss_rel_to_realized_cap')) - self.realized_price: ActivePricePattern = ActivePricePattern(client, _m(acc, 'realized_price')) - self.realized_price_extra: ActivePriceRatioPattern = ActivePriceRatioPattern(client, _m(acc, 'realized_price_ratio')) - self.realized_profit: BlockCountPattern[Dollars] = BlockCountPattern(client, _m(acc, 'realized_profit')) - self.realized_profit_rel_to_realized_cap: BlockCountPattern[StoredF32] = BlockCountPattern(client, _m(acc, 'realized_profit_rel_to_realized_cap')) - self.realized_profit_to_loss_ratio: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, 'realized_profit_to_loss_ratio')) - self.realized_value: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_value')) - self.sell_side_risk_ratio: MetricPattern6[StoredF32] = MetricPattern6(client, _m(acc, 'sell_side_risk_ratio')) - self.sell_side_risk_ratio_30d_ema: MetricPattern6[StoredF32] = MetricPattern6(client, _m(acc, 'sell_side_risk_ratio_30d_ema')) - self.sell_side_risk_ratio_7d_ema: MetricPattern6[StoredF32] = MetricPattern6(client, _m(acc, 'sell_side_risk_ratio_7d_ema')) - self.sopr: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, 'sopr')) - self.sopr_30d_ema: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, 'sopr_30d_ema')) - self.sopr_7d_ema: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, 'sopr_7d_ema')) - self.total_realized_pnl: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'total_realized_pnl')) - self.value_created: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_created')) - self.value_destroyed: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_destroyed')) - -class RealizedPattern: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.mvrv: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'mvrv')) - self.neg_realized_loss: BitcoinPattern2[Dollars] = BitcoinPattern2(client, _m(acc, 'neg_realized_loss')) - self.net_realized_pnl: BlockCountPattern[Dollars] = BlockCountPattern(client, _m(acc, 'net_realized_pnl')) - self.net_realized_pnl_cumulative_30d_delta: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta')) - self.net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_market_cap')) - self.net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap')) - self.net_realized_pnl_rel_to_realized_cap: BlockCountPattern[StoredF32] = BlockCountPattern(client, _m(acc, 'net_realized_pnl_rel_to_realized_cap')) - self.realized_cap: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_cap')) - self.realized_cap_30d_delta: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'realized_cap_30d_delta')) - self.realized_loss: BlockCountPattern[Dollars] = BlockCountPattern(client, _m(acc, 'realized_loss')) - self.realized_loss_rel_to_realized_cap: BlockCountPattern[StoredF32] = BlockCountPattern(client, _m(acc, 'realized_loss_rel_to_realized_cap')) - self.realized_price: ActivePricePattern = ActivePricePattern(client, _m(acc, 'realized_price')) - self.realized_price_extra: RealizedPriceExtraPattern = RealizedPriceExtraPattern(client, _m(acc, 'realized_price_ratio')) - self.realized_profit: BlockCountPattern[Dollars] = BlockCountPattern(client, _m(acc, 'realized_profit')) - self.realized_profit_rel_to_realized_cap: BlockCountPattern[StoredF32] = BlockCountPattern(client, _m(acc, 'realized_profit_rel_to_realized_cap')) - self.realized_value: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_value')) - self.sell_side_risk_ratio: MetricPattern6[StoredF32] = MetricPattern6(client, _m(acc, 'sell_side_risk_ratio')) - self.sell_side_risk_ratio_30d_ema: MetricPattern6[StoredF32] = MetricPattern6(client, _m(acc, 'sell_side_risk_ratio_30d_ema')) - self.sell_side_risk_ratio_7d_ema: MetricPattern6[StoredF32] = MetricPattern6(client, _m(acc, 'sell_side_risk_ratio_7d_ema')) - self.sopr: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, 'sopr')) - self.sopr_30d_ema: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, 'sopr_30d_ema')) - self.sopr_7d_ema: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, 'sopr_7d_ema')) - self.total_realized_pnl: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'total_realized_pnl')) - self.value_created: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_created')) - self.value_destroyed: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_destroyed')) - -class Price111dSmaPattern: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.price: _0sdUsdPattern = _0sdUsdPattern(client, acc) - self.ratio: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'ratio')) - self.ratio_1m_sma: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'ratio_1m_sma')) - self.ratio_1w_sma: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'ratio_1w_sma')) - self.ratio_1y_sd: Ratio1ySdPattern = Ratio1ySdPattern(client, _m(acc, 'ratio_1y')) - self.ratio_2y_sd: Ratio1ySdPattern = Ratio1ySdPattern(client, _m(acc, 'ratio_2y')) - self.ratio_4y_sd: Ratio1ySdPattern = Ratio1ySdPattern(client, _m(acc, 'ratio_4y')) - self.ratio_pct1: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'ratio_pct1')) - self.ratio_pct1_usd: _0sdUsdPattern = _0sdUsdPattern(client, _m(acc, 'ratio_pct1_usd')) - self.ratio_pct2: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'ratio_pct2')) - self.ratio_pct2_usd: _0sdUsdPattern = _0sdUsdPattern(client, _m(acc, 'ratio_pct2_usd')) - self.ratio_pct5: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'ratio_pct5')) - self.ratio_pct5_usd: _0sdUsdPattern = _0sdUsdPattern(client, _m(acc, 'ratio_pct5_usd')) - self.ratio_pct95: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'ratio_pct95')) - self.ratio_pct95_usd: _0sdUsdPattern = _0sdUsdPattern(client, _m(acc, 'ratio_pct95_usd')) - self.ratio_pct98: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'ratio_pct98')) - self.ratio_pct98_usd: _0sdUsdPattern = _0sdUsdPattern(client, _m(acc, 'ratio_pct98_usd')) - self.ratio_pct99: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'ratio_pct99')) - self.ratio_pct99_usd: _0sdUsdPattern = _0sdUsdPattern(client, _m(acc, 'ratio_pct99_usd')) - self.ratio_sd: Ratio1ySdPattern = Ratio1ySdPattern(client, _m(acc, 'ratio')) - -class PercentilesPattern: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.pct05: _0sdUsdPattern = _0sdUsdPattern(client, _m(acc, 'pct05')) - self.pct10: _0sdUsdPattern = _0sdUsdPattern(client, _m(acc, 'pct10')) - self.pct15: _0sdUsdPattern = _0sdUsdPattern(client, _m(acc, 'pct15')) - self.pct20: _0sdUsdPattern = _0sdUsdPattern(client, _m(acc, 'pct20')) - self.pct25: _0sdUsdPattern = _0sdUsdPattern(client, _m(acc, 'pct25')) - self.pct30: _0sdUsdPattern = _0sdUsdPattern(client, _m(acc, 'pct30')) - self.pct35: _0sdUsdPattern = _0sdUsdPattern(client, _m(acc, 'pct35')) - self.pct40: _0sdUsdPattern = _0sdUsdPattern(client, _m(acc, 'pct40')) - self.pct45: _0sdUsdPattern = _0sdUsdPattern(client, _m(acc, 'pct45')) - self.pct50: _0sdUsdPattern = _0sdUsdPattern(client, _m(acc, 'pct50')) - self.pct55: _0sdUsdPattern = _0sdUsdPattern(client, _m(acc, 'pct55')) - self.pct60: _0sdUsdPattern = _0sdUsdPattern(client, _m(acc, 'pct60')) - self.pct65: _0sdUsdPattern = _0sdUsdPattern(client, _m(acc, 'pct65')) - self.pct70: _0sdUsdPattern = _0sdUsdPattern(client, _m(acc, 'pct70')) - self.pct75: _0sdUsdPattern = _0sdUsdPattern(client, _m(acc, 'pct75')) - self.pct80: _0sdUsdPattern = _0sdUsdPattern(client, _m(acc, 'pct80')) - self.pct85: _0sdUsdPattern = _0sdUsdPattern(client, _m(acc, 'pct85')) - self.pct90: _0sdUsdPattern = _0sdUsdPattern(client, _m(acc, 'pct90')) - self.pct95: _0sdUsdPattern = _0sdUsdPattern(client, _m(acc, 'pct95')) - -class ActivePriceRatioPattern: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.ratio: MetricPattern4[StoredF32] = MetricPattern4(client, acc) - self.ratio_1m_sma: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, '1m_sma')) - self.ratio_1w_sma: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, '1w_sma')) - self.ratio_1y_sd: Ratio1ySdPattern = Ratio1ySdPattern(client, _m(acc, '1y')) - self.ratio_2y_sd: Ratio1ySdPattern = Ratio1ySdPattern(client, _m(acc, '2y')) - self.ratio_4y_sd: Ratio1ySdPattern = Ratio1ySdPattern(client, _m(acc, '4y')) - self.ratio_pct1: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'pct1')) - self.ratio_pct1_usd: _0sdUsdPattern = _0sdUsdPattern(client, _m(acc, 'pct1_usd')) - self.ratio_pct2: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'pct2')) - self.ratio_pct2_usd: _0sdUsdPattern = _0sdUsdPattern(client, _m(acc, 'pct2_usd')) - self.ratio_pct5: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'pct5')) - self.ratio_pct5_usd: _0sdUsdPattern = _0sdUsdPattern(client, _m(acc, 'pct5_usd')) - self.ratio_pct95: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'pct95')) - self.ratio_pct95_usd: _0sdUsdPattern = _0sdUsdPattern(client, _m(acc, 'pct95_usd')) - self.ratio_pct98: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'pct98')) - self.ratio_pct98_usd: _0sdUsdPattern = _0sdUsdPattern(client, _m(acc, 'pct98_usd')) - self.ratio_pct99: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'pct99')) - self.ratio_pct99_usd: _0sdUsdPattern = _0sdUsdPattern(client, _m(acc, 'pct99_usd')) - self.ratio_sd: Ratio1ySdPattern = Ratio1ySdPattern(client, acc) - -class RelativePattern5: +class InvestedNegNetNuplSupplyUnrealizedPattern2: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" + self.invested_capital_in_loss_pct: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'invested_capital_in_loss_pct')) + self.invested_capital_in_profit_pct: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'invested_capital_in_profit_pct')) self.neg_unrealized_loss_rel_to_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'neg_unrealized_loss_rel_to_market_cap')) self.neg_unrealized_loss_rel_to_own_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'neg_unrealized_loss_rel_to_own_market_cap')) self.neg_unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'neg_unrealized_loss_rel_to_own_total_unrealized_pnl')) @@ -2087,7 +2076,106 @@ class RelativePattern5: self.unrealized_profit_rel_to_own_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'unrealized_profit_rel_to_own_market_cap')) self.unrealized_profit_rel_to_own_total_unrealized_pnl: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'unrealized_profit_rel_to_own_total_unrealized_pnl')) -class AaopoolPattern: +class PriceRatioPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.price: DollarsSatsPattern2 = DollarsSatsPattern2(client, acc) + self.ratio: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'ratio')) + self.ratio_1m_sma: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'ratio_1m_sma')) + self.ratio_1w_sma: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'ratio_1w_sma')) + self.ratio_1y_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern = _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern(client, _m(acc, 'ratio_1y')) + self.ratio_2y_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern = _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern(client, _m(acc, 'ratio_2y')) + self.ratio_4y_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern = _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern(client, _m(acc, 'ratio_4y')) + self.ratio_pct1: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'ratio_pct1')) + self.ratio_pct1_usd: DollarsSatsPattern2 = DollarsSatsPattern2(client, _m(acc, 'ratio_pct1_usd')) + self.ratio_pct2: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'ratio_pct2')) + self.ratio_pct2_usd: DollarsSatsPattern2 = DollarsSatsPattern2(client, _m(acc, 'ratio_pct2_usd')) + self.ratio_pct5: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'ratio_pct5')) + self.ratio_pct5_usd: DollarsSatsPattern2 = DollarsSatsPattern2(client, _m(acc, 'ratio_pct5_usd')) + self.ratio_pct95: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'ratio_pct95')) + self.ratio_pct95_usd: DollarsSatsPattern2 = DollarsSatsPattern2(client, _m(acc, 'ratio_pct95_usd')) + self.ratio_pct98: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'ratio_pct98')) + self.ratio_pct98_usd: DollarsSatsPattern2 = DollarsSatsPattern2(client, _m(acc, 'ratio_pct98_usd')) + self.ratio_pct99: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'ratio_pct99')) + self.ratio_pct99_usd: DollarsSatsPattern2 = DollarsSatsPattern2(client, _m(acc, 'ratio_pct99_usd')) + self.ratio_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern = _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern(client, _m(acc, 'ratio')) + +class Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.pct05: DollarsSatsPattern2 = DollarsSatsPattern2(client, _m(acc, 'pct05')) + self.pct10: DollarsSatsPattern2 = DollarsSatsPattern2(client, _m(acc, 'pct10')) + self.pct15: DollarsSatsPattern2 = DollarsSatsPattern2(client, _m(acc, 'pct15')) + self.pct20: DollarsSatsPattern2 = DollarsSatsPattern2(client, _m(acc, 'pct20')) + self.pct25: DollarsSatsPattern2 = DollarsSatsPattern2(client, _m(acc, 'pct25')) + self.pct30: DollarsSatsPattern2 = DollarsSatsPattern2(client, _m(acc, 'pct30')) + self.pct35: DollarsSatsPattern2 = DollarsSatsPattern2(client, _m(acc, 'pct35')) + self.pct40: DollarsSatsPattern2 = DollarsSatsPattern2(client, _m(acc, 'pct40')) + self.pct45: DollarsSatsPattern2 = DollarsSatsPattern2(client, _m(acc, 'pct45')) + self.pct50: DollarsSatsPattern2 = DollarsSatsPattern2(client, _m(acc, 'pct50')) + self.pct55: DollarsSatsPattern2 = DollarsSatsPattern2(client, _m(acc, 'pct55')) + self.pct60: DollarsSatsPattern2 = DollarsSatsPattern2(client, _m(acc, 'pct60')) + self.pct65: DollarsSatsPattern2 = DollarsSatsPattern2(client, _m(acc, 'pct65')) + self.pct70: DollarsSatsPattern2 = DollarsSatsPattern2(client, _m(acc, 'pct70')) + self.pct75: DollarsSatsPattern2 = DollarsSatsPattern2(client, _m(acc, 'pct75')) + self.pct80: DollarsSatsPattern2 = DollarsSatsPattern2(client, _m(acc, 'pct80')) + self.pct85: DollarsSatsPattern2 = DollarsSatsPattern2(client, _m(acc, 'pct85')) + self.pct90: DollarsSatsPattern2 = DollarsSatsPattern2(client, _m(acc, 'pct90')) + self.pct95: DollarsSatsPattern2 = DollarsSatsPattern2(client, _m(acc, 'pct95')) + +class RatioPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.ratio: MetricPattern4[StoredF32] = MetricPattern4(client, acc) + self.ratio_1m_sma: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, '1m_sma')) + self.ratio_1w_sma: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, '1w_sma')) + self.ratio_1y_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern = _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern(client, _m(acc, '1y')) + self.ratio_2y_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern = _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern(client, _m(acc, '2y')) + self.ratio_4y_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern = _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern(client, _m(acc, '4y')) + self.ratio_pct1: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'pct1')) + self.ratio_pct1_usd: DollarsSatsPattern2 = DollarsSatsPattern2(client, _m(acc, 'pct1_usd')) + self.ratio_pct2: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'pct2')) + self.ratio_pct2_usd: DollarsSatsPattern2 = DollarsSatsPattern2(client, _m(acc, 'pct2_usd')) + self.ratio_pct5: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'pct5')) + self.ratio_pct5_usd: DollarsSatsPattern2 = DollarsSatsPattern2(client, _m(acc, 'pct5_usd')) + self.ratio_pct95: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'pct95')) + self.ratio_pct95_usd: DollarsSatsPattern2 = DollarsSatsPattern2(client, _m(acc, 'pct95_usd')) + self.ratio_pct98: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'pct98')) + self.ratio_pct98_usd: DollarsSatsPattern2 = DollarsSatsPattern2(client, _m(acc, 'pct98_usd')) + self.ratio_pct99: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'pct99')) + self.ratio_pct99_usd: DollarsSatsPattern2 = DollarsSatsPattern2(client, _m(acc, 'pct99_usd')) + self.ratio_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern = _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern(client, acc) + +class AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.ath_regret: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'unrealized_ath_regret')) + self.greed_index: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'greed_index')) + self.invested_capital_in_loss: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'invested_capital_in_loss')) + self.invested_capital_in_loss_raw: MetricPattern11[CentsSats] = MetricPattern11(client, _m(acc, 'invested_capital_in_loss_raw')) + self.invested_capital_in_profit: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'invested_capital_in_profit')) + self.invested_capital_in_profit_raw: MetricPattern11[CentsSats] = MetricPattern11(client, _m(acc, 'invested_capital_in_profit_raw')) + self.investor_cap_in_loss_raw: MetricPattern11[CentsSquaredSats] = MetricPattern11(client, _m(acc, 'investor_cap_in_loss_raw')) + self.investor_cap_in_profit_raw: MetricPattern11[CentsSquaredSats] = MetricPattern11(client, _m(acc, 'investor_cap_in_profit_raw')) + self.neg_unrealized_loss: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'neg_unrealized_loss')) + self.net_sentiment: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'net_sentiment')) + self.net_unrealized_pnl: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'net_unrealized_pnl')) + self.pain_index: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'pain_index')) + self.supply_in_loss: BitcoinDollarsSatsPattern4 = BitcoinDollarsSatsPattern4(client, _m(acc, 'supply_in_loss')) + self.supply_in_profit: BitcoinDollarsSatsPattern4 = BitcoinDollarsSatsPattern4(client, _m(acc, 'supply_in_profit')) + self.total_unrealized_pnl: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'total_unrealized_pnl')) + self.unrealized_loss: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'unrealized_loss')) + self.unrealized_profit: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'unrealized_profit')) + +class _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -2100,33 +2188,69 @@ class AaopoolPattern: self._1y_dominance: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, '1y_dominance')) self._24h_blocks_mined: MetricPattern1[StoredU32] = MetricPattern1(client, _m(acc, '24h_blocks_mined')) self._24h_dominance: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, '24h_dominance')) - self.blocks_mined: BlockCountPattern[StoredU32] = BlockCountPattern(client, _m(acc, 'blocks_mined')) + self.blocks_mined: CumulativeSumPattern[StoredU32] = CumulativeSumPattern(client, _m(acc, 'blocks_mined')) self.blocks_since_block: MetricPattern1[StoredU32] = MetricPattern1(client, _m(acc, 'blocks_since_block')) - self.coinbase: CoinbasePattern2 = CoinbasePattern2(client, _m(acc, 'coinbase')) + self.coinbase: BitcoinDollarsSatsPattern6 = BitcoinDollarsSatsPattern6(client, _m(acc, 'coinbase')) self.days_since_block: MetricPattern4[StoredU16] = MetricPattern4(client, _m(acc, 'days_since_block')) self.dominance: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'dominance')) - self.fee: UnclaimedRewardsPattern = UnclaimedRewardsPattern(client, _m(acc, 'fee')) - self.subsidy: UnclaimedRewardsPattern = UnclaimedRewardsPattern(client, _m(acc, 'subsidy')) + self.fee: BitcoinDollarsSatsPattern3 = BitcoinDollarsSatsPattern3(client, _m(acc, 'fee')) + self.subsidy: BitcoinDollarsSatsPattern3 = BitcoinDollarsSatsPattern3(client, _m(acc, 'subsidy')) -class PeriodLumpSumStackPattern: +class _10y1m1w1y2y3m3y4y5y6m6y8yPattern3: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self._10y: _2015Pattern = _2015Pattern(client, _p('10y', acc)) - self._1m: _2015Pattern = _2015Pattern(client, _p('1m', acc)) - self._1w: _2015Pattern = _2015Pattern(client, _p('1w', acc)) - self._1y: _2015Pattern = _2015Pattern(client, _p('1y', acc)) - self._2y: _2015Pattern = _2015Pattern(client, _p('2y', acc)) - self._3m: _2015Pattern = _2015Pattern(client, _p('3m', acc)) - self._3y: _2015Pattern = _2015Pattern(client, _p('3y', acc)) - self._4y: _2015Pattern = _2015Pattern(client, _p('4y', acc)) - self._5y: _2015Pattern = _2015Pattern(client, _p('5y', acc)) - self._6m: _2015Pattern = _2015Pattern(client, _p('6m', acc)) - self._6y: _2015Pattern = _2015Pattern(client, _p('6y', acc)) - self._8y: _2015Pattern = _2015Pattern(client, _p('8y', acc)) + self._10y: BitcoinDollarsSatsPattern5 = BitcoinDollarsSatsPattern5(client, _p('10y', acc)) + self._1m: BitcoinDollarsSatsPattern5 = BitcoinDollarsSatsPattern5(client, _p('1m', acc)) + self._1w: BitcoinDollarsSatsPattern5 = BitcoinDollarsSatsPattern5(client, _p('1w', acc)) + self._1y: BitcoinDollarsSatsPattern5 = BitcoinDollarsSatsPattern5(client, _p('1y', acc)) + self._2y: BitcoinDollarsSatsPattern5 = BitcoinDollarsSatsPattern5(client, _p('2y', acc)) + self._3m: BitcoinDollarsSatsPattern5 = BitcoinDollarsSatsPattern5(client, _p('3m', acc)) + self._3y: BitcoinDollarsSatsPattern5 = BitcoinDollarsSatsPattern5(client, _p('3y', acc)) + self._4y: BitcoinDollarsSatsPattern5 = BitcoinDollarsSatsPattern5(client, _p('4y', acc)) + self._5y: BitcoinDollarsSatsPattern5 = BitcoinDollarsSatsPattern5(client, _p('5y', acc)) + self._6m: BitcoinDollarsSatsPattern5 = BitcoinDollarsSatsPattern5(client, _p('6m', acc)) + self._6y: BitcoinDollarsSatsPattern5 = BitcoinDollarsSatsPattern5(client, _p('6y', acc)) + self._8y: BitcoinDollarsSatsPattern5 = BitcoinDollarsSatsPattern5(client, _p('8y', acc)) -class PeriodDaysInLossPattern(Generic[T]): +class InvestedNegNetNuplSupplyUnrealizedPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.invested_capital_in_loss_pct: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'invested_capital_in_loss_pct')) + self.invested_capital_in_profit_pct: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'invested_capital_in_profit_pct')) + self.neg_unrealized_loss_rel_to_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'neg_unrealized_loss_rel_to_market_cap')) + self.net_unrealized_pnl_rel_to_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'net_unrealized_pnl_rel_to_market_cap')) + self.nupl: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'nupl')) + self.supply_in_loss_rel_to_circulating_supply: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'supply_in_loss_rel_to_circulating_supply')) + self.supply_in_loss_rel_to_own_supply: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'supply_in_loss_rel_to_own_supply')) + self.supply_in_profit_rel_to_circulating_supply: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'supply_in_profit_rel_to_circulating_supply')) + self.supply_in_profit_rel_to_own_supply: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'supply_in_profit_rel_to_own_supply')) + self.supply_rel_to_circulating_supply: MetricPattern4[StoredF64] = MetricPattern4(client, _m(acc, 'supply_rel_to_circulating_supply')) + self.unrealized_loss_rel_to_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'unrealized_loss_rel_to_market_cap')) + self.unrealized_profit_rel_to_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'unrealized_profit_rel_to_market_cap')) + +class InvestedNegNetSupplyUnrealizedPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.invested_capital_in_loss_pct: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'invested_capital_in_loss_pct')) + self.invested_capital_in_profit_pct: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'invested_capital_in_profit_pct')) + self.neg_unrealized_loss_rel_to_own_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'neg_unrealized_loss_rel_to_own_market_cap')) + self.neg_unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'neg_unrealized_loss_rel_to_own_total_unrealized_pnl')) + self.net_unrealized_pnl_rel_to_own_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'net_unrealized_pnl_rel_to_own_market_cap')) + self.net_unrealized_pnl_rel_to_own_total_unrealized_pnl: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'net_unrealized_pnl_rel_to_own_total_unrealized_pnl')) + self.supply_in_loss_rel_to_own_supply: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'supply_in_loss_rel_to_own_supply')) + self.supply_in_profit_rel_to_own_supply: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'supply_in_profit_rel_to_own_supply')) + self.unrealized_loss_rel_to_own_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'unrealized_loss_rel_to_own_market_cap')) + self.unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'unrealized_loss_rel_to_own_total_unrealized_pnl')) + self.unrealized_profit_rel_to_own_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'unrealized_profit_rel_to_own_market_cap')) + self.unrealized_profit_rel_to_own_total_unrealized_pnl: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'unrealized_profit_rel_to_own_total_unrealized_pnl')) + +class _10y1m1w1y2y3m3y4y5y6m6y8yPattern2(Generic[T]): """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -2144,7 +2268,7 @@ class PeriodDaysInLossPattern(Generic[T]): self._6y: MetricPattern4[T] = MetricPattern4(client, _p('6y', acc)) self._8y: MetricPattern4[T] = MetricPattern4(client, _p('8y', acc)) -class ClassDaysInLossPattern(Generic[T]): +class _201520162017201820192020202120222023202420252026Pattern2(Generic[T]): """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -2162,7 +2286,7 @@ class ClassDaysInLossPattern(Generic[T]): self._2025: MetricPattern4[T] = MetricPattern4(client, _m(acc, '2025_returns')) self._2026: MetricPattern4[T] = MetricPattern4(client, _m(acc, '2026_returns')) -class BitcoinPattern: +class AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -2179,7 +2303,7 @@ class BitcoinPattern: self.pct90: MetricPattern6[Bitcoin] = MetricPattern6(client, _m(acc, 'pct90')) self.sum: MetricPattern2[Bitcoin] = MetricPattern2(client, _m(acc, 'sum')) -class DollarsPattern(Generic[T]): +class AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(Generic[T]): """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -2196,39 +2320,7 @@ class DollarsPattern(Generic[T]): self.pct90: MetricPattern6[T] = MetricPattern6(client, _m(acc, 'pct90')) self.sum: MetricPattern2[T] = MetricPattern2(client, _m(acc, 'sum')) -class RelativePattern: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.neg_unrealized_loss_rel_to_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'neg_unrealized_loss_rel_to_market_cap')) - self.net_unrealized_pnl_rel_to_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'net_unrealized_pnl_rel_to_market_cap')) - self.nupl: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'nupl')) - self.supply_in_loss_rel_to_circulating_supply: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'supply_in_loss_rel_to_circulating_supply')) - self.supply_in_loss_rel_to_own_supply: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'supply_in_loss_rel_to_own_supply')) - self.supply_in_profit_rel_to_circulating_supply: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'supply_in_profit_rel_to_circulating_supply')) - self.supply_in_profit_rel_to_own_supply: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'supply_in_profit_rel_to_own_supply')) - self.supply_rel_to_circulating_supply: MetricPattern4[StoredF64] = MetricPattern4(client, _m(acc, 'supply_rel_to_circulating_supply')) - self.unrealized_loss_rel_to_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'unrealized_loss_rel_to_market_cap')) - self.unrealized_profit_rel_to_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'unrealized_profit_rel_to_market_cap')) - -class RelativePattern2: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.neg_unrealized_loss_rel_to_own_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'neg_unrealized_loss_rel_to_own_market_cap')) - self.neg_unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'neg_unrealized_loss_rel_to_own_total_unrealized_pnl')) - self.net_unrealized_pnl_rel_to_own_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'net_unrealized_pnl_rel_to_own_market_cap')) - self.net_unrealized_pnl_rel_to_own_total_unrealized_pnl: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'net_unrealized_pnl_rel_to_own_total_unrealized_pnl')) - self.supply_in_loss_rel_to_own_supply: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'supply_in_loss_rel_to_own_supply')) - self.supply_in_profit_rel_to_own_supply: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'supply_in_profit_rel_to_own_supply')) - self.unrealized_loss_rel_to_own_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'unrealized_loss_rel_to_own_market_cap')) - self.unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'unrealized_loss_rel_to_own_total_unrealized_pnl')) - self.unrealized_profit_rel_to_own_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'unrealized_profit_rel_to_own_market_cap')) - self.unrealized_profit_rel_to_own_total_unrealized_pnl: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'unrealized_profit_rel_to_own_total_unrealized_pnl')) - -class CountPattern2(Generic[T]): +class AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(Generic[T]): """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -2244,7 +2336,7 @@ class CountPattern2(Generic[T]): self.pct90: MetricPattern11[T] = MetricPattern11(client, _m(acc, 'pct90')) self.sum: MetricPattern1[T] = MetricPattern1(client, _m(acc, 'sum')) -class AddrCountPattern: +class AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -2259,7 +2351,7 @@ class AddrCountPattern: self.p2wpkh: MetricPattern1[StoredU64] = MetricPattern1(client, _p('p2wpkh', acc)) self.p2wsh: MetricPattern1[StoredU64] = MetricPattern1(client, _p('p2wsh', acc)) -class FeeRatePattern(Generic[T]): +class AverageMaxMedianMinPct10Pct25Pct75Pct90TxindexPattern(Generic[T]): """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -2274,7 +2366,7 @@ class FeeRatePattern(Generic[T]): self.pct90: MetricPattern11[T] = MetricPattern11(client, _m(acc, 'pct90')) self.txindex: MetricPattern27[T] = MetricPattern27(client, acc) -class FullnessPattern(Generic[T]): +class AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern(Generic[T]): """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -2289,21 +2381,21 @@ class FullnessPattern(Generic[T]): self.pct75: MetricPattern6[T] = MetricPattern6(client, _m(acc, 'pct75')) self.pct90: MetricPattern6[T] = MetricPattern6(client, _m(acc, 'pct90')) -class _0satsPattern: +class ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.activity: ActivityPattern2 = ActivityPattern2(client, acc) + self.activity: CoinblocksCoindaysSatblocksSatdaysSentPattern = CoinblocksCoindaysSatblocksSatdaysSentPattern(client, acc) self.addr_count: MetricPattern1[StoredU64] = MetricPattern1(client, _m(acc, 'addr_count')) - self.cost_basis: CostBasisPattern = CostBasisPattern(client, acc) - self.outputs: OutputsPattern = OutputsPattern(client, _m(acc, 'utxo_count')) - self.realized: RealizedPattern = RealizedPattern(client, acc) - self.relative: RelativePattern = RelativePattern(client, acc) - self.supply: SupplyPattern2 = SupplyPattern2(client, _m(acc, 'supply')) - self.unrealized: UnrealizedPattern = UnrealizedPattern(client, acc) + self.cost_basis: MaxMinPattern = MaxMinPattern(client, acc) + self.outputs: UtxoPattern = UtxoPattern(client, _m(acc, 'utxo_count')) + self.realized: AthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern = AthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern(client, acc) + self.relative: InvestedNegNetNuplSupplyUnrealizedPattern = InvestedNegNetNuplSupplyUnrealizedPattern(client, acc) + self.supply: HalvedTotalPattern = HalvedTotalPattern(client, _m(acc, 'supply')) + self.unrealized: AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern = AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern(client, acc) -class PeriodCagrPattern: +class _10y2y3y4y5y6y8yPattern: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -2316,95 +2408,116 @@ class PeriodCagrPattern: self._6y: MetricPattern4[StoredF32] = MetricPattern4(client, _p('6y', acc)) self._8y: MetricPattern4[StoredF32] = MetricPattern4(client, _p('8y', acc)) -class _100btcPattern: +class ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.activity: ActivityPattern2 = ActivityPattern2(client, acc) - self.cost_basis: CostBasisPattern = CostBasisPattern(client, acc) - self.outputs: OutputsPattern = OutputsPattern(client, _m(acc, 'utxo_count')) - self.realized: RealizedPattern = RealizedPattern(client, acc) - self.relative: RelativePattern = RelativePattern(client, acc) - self.supply: SupplyPattern2 = SupplyPattern2(client, _m(acc, 'supply')) - self.unrealized: UnrealizedPattern = UnrealizedPattern(client, acc) + self.activity: CoinblocksCoindaysSatblocksSatdaysSentPattern = CoinblocksCoindaysSatblocksSatdaysSentPattern(client, acc) + self.cost_basis: InvestedMaxMinPercentilesSpotPattern = InvestedMaxMinPercentilesSpotPattern(client, acc) + self.outputs: UtxoPattern = UtxoPattern(client, _m(acc, 'utxo_count')) + self.realized: AthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern2 = AthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern2(client, acc) + self.relative: InvestedNegNetSupplyUnrealizedPattern = InvestedNegNetSupplyUnrealizedPattern(client, acc) + self.supply: HalvedTotalPattern = HalvedTotalPattern(client, _m(acc, 'supply')) + self.unrealized: AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern = AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern(client, acc) -class _0satsPattern2: +class ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.activity: ActivityPattern2 = ActivityPattern2(client, acc) - self.cost_basis: CostBasisPattern = CostBasisPattern(client, acc) - self.outputs: OutputsPattern = OutputsPattern(client, _m(acc, 'utxo_count')) - self.realized: RealizedPattern = RealizedPattern(client, acc) - self.relative: RelativePattern4 = RelativePattern4(client, _m(acc, 'supply_in')) - self.supply: SupplyPattern2 = SupplyPattern2(client, _m(acc, 'supply')) - self.unrealized: UnrealizedPattern = UnrealizedPattern(client, acc) + self.activity: CoinblocksCoindaysSatblocksSatdaysSentPattern = CoinblocksCoindaysSatblocksSatdaysSentPattern(client, acc) + self.cost_basis: MaxMinPattern = MaxMinPattern(client, acc) + self.outputs: UtxoPattern = UtxoPattern(client, _m(acc, 'utxo_count')) + self.realized: AdjustedAthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern2 = AdjustedAthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern2(client, acc) + self.relative: InvestedNegNetNuplSupplyUnrealizedPattern = InvestedNegNetNuplSupplyUnrealizedPattern(client, acc) + self.supply: HalvedTotalPattern = HalvedTotalPattern(client, _m(acc, 'supply')) + self.unrealized: AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern = AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern(client, acc) -class _10yPattern: +class ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.activity: ActivityPattern2 = ActivityPattern2(client, acc) - self.cost_basis: CostBasisPattern = CostBasisPattern(client, acc) - self.outputs: OutputsPattern = OutputsPattern(client, _m(acc, 'utxo_count')) - self.realized: RealizedPattern4 = RealizedPattern4(client, acc) - self.relative: RelativePattern = RelativePattern(client, acc) - self.supply: SupplyPattern2 = SupplyPattern2(client, _m(acc, 'supply')) - self.unrealized: UnrealizedPattern = UnrealizedPattern(client, acc) + self.activity: CoinblocksCoindaysSatblocksSatdaysSentPattern = CoinblocksCoindaysSatblocksSatdaysSentPattern(client, acc) + self.cost_basis: MaxMinPattern = MaxMinPattern(client, acc) + self.outputs: UtxoPattern = UtxoPattern(client, _m(acc, 'utxo_count')) + self.realized: AthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern = AthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern(client, acc) + self.relative: InvestedNegNetNuplSupplyUnrealizedPattern = InvestedNegNetNuplSupplyUnrealizedPattern(client, acc) + self.supply: HalvedTotalPattern = HalvedTotalPattern(client, _m(acc, 'supply')) + self.unrealized: AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern = AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern(client, acc) -class _10yTo12yPattern: +class ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.activity: ActivityPattern2 = ActivityPattern2(client, acc) - self.cost_basis: CostBasisPattern2 = CostBasisPattern2(client, acc) - self.outputs: OutputsPattern = OutputsPattern(client, _m(acc, 'utxo_count')) - self.realized: RealizedPattern2 = RealizedPattern2(client, acc) - self.relative: RelativePattern2 = RelativePattern2(client, acc) - self.supply: SupplyPattern2 = SupplyPattern2(client, _m(acc, 'supply')) - self.unrealized: UnrealizedPattern = UnrealizedPattern(client, acc) + self.activity: CoinblocksCoindaysSatblocksSatdaysSentPattern = CoinblocksCoindaysSatblocksSatdaysSentPattern(client, acc) + self.cost_basis: MaxMinPattern = MaxMinPattern(client, acc) + self.outputs: UtxoPattern = UtxoPattern(client, _m(acc, 'utxo_count')) + self.realized: AthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern = AthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern(client, acc) + self.relative: InvestedSupplyPattern = InvestedSupplyPattern(client, acc) + self.supply: HalvedTotalPattern = HalvedTotalPattern(client, _m(acc, 'supply')) + self.unrealized: AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern = AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern(client, acc) -class UnrealizedPattern: +class ActivityCostOutputsRealizedSupplyUnrealizedPattern: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.neg_unrealized_loss: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'neg_unrealized_loss')) - self.net_unrealized_pnl: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'net_unrealized_pnl')) - self.supply_in_loss: ActiveSupplyPattern = ActiveSupplyPattern(client, _m(acc, 'supply_in_loss')) - self.supply_in_profit: ActiveSupplyPattern = ActiveSupplyPattern(client, _m(acc, 'supply_in_profit')) - self.total_unrealized_pnl: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'total_unrealized_pnl')) - self.unrealized_loss: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'unrealized_loss')) - self.unrealized_profit: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'unrealized_profit')) + self.activity: CoinblocksCoindaysSatblocksSatdaysSentPattern = CoinblocksCoindaysSatblocksSatdaysSentPattern(client, acc) + self.cost_basis: MaxMinPattern = MaxMinPattern(client, acc) + self.outputs: UtxoPattern = UtxoPattern(client, _m(acc, 'utxo_count')) + self.realized: AthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern = AthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern(client, acc) + self.supply: HalvedTotalPattern = HalvedTotalPattern(client, _m(acc, 'supply')) + self.unrealized: AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern = AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern(client, acc) -class AllPattern: +class BalanceBothReactivatedReceivingSendingPattern: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.balance_decreased: FullnessPattern[StoredU32] = FullnessPattern(client, _m(acc, 'balance_decreased')) - self.balance_increased: FullnessPattern[StoredU32] = FullnessPattern(client, _m(acc, 'balance_increased')) - self.both: FullnessPattern[StoredU32] = FullnessPattern(client, _m(acc, 'both')) - self.reactivated: FullnessPattern[StoredU32] = FullnessPattern(client, _m(acc, 'reactivated')) - self.receiving: FullnessPattern[StoredU32] = FullnessPattern(client, _m(acc, 'receiving')) - self.sending: FullnessPattern[StoredU32] = FullnessPattern(client, _m(acc, 'sending')) + self.balance_decreased: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern[StoredU32] = AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, _m(acc, 'balance_decreased')) + self.balance_increased: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern[StoredU32] = AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, _m(acc, 'balance_increased')) + self.both: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern[StoredU32] = AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, _m(acc, 'both')) + self.reactivated: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern[StoredU32] = AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, _m(acc, 'reactivated')) + self.receiving: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern[StoredU32] = AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, _m(acc, 'receiving')) + self.sending: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern[StoredU32] = AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, _m(acc, 'sending')) -class ActivityPattern2: +class InvestedMaxMinPercentilesSpotPattern: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.coinblocks_destroyed: BlockCountPattern[StoredF64] = BlockCountPattern(client, _m(acc, 'coinblocks_destroyed')) - self.coindays_destroyed: BlockCountPattern[StoredF64] = BlockCountPattern(client, _m(acc, 'coindays_destroyed')) + self.invested_capital: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern = Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern(client, _m(acc, 'invested_capital')) + self.max: DollarsSatsPattern = DollarsSatsPattern(client, _m(acc, 'max_cost_basis')) + self.min: DollarsSatsPattern = DollarsSatsPattern(client, _m(acc, 'min_cost_basis')) + self.percentiles: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern = Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern(client, _m(acc, 'cost_basis')) + self.spot_cost_basis_percentile: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'spot_cost_basis_percentile')) + self.spot_invested_capital_percentile: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'spot_invested_capital_percentile')) + +class CoinblocksCoindaysSatblocksSatdaysSentPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.coinblocks_destroyed: CumulativeSumPattern[StoredF64] = CumulativeSumPattern(client, _m(acc, 'coinblocks_destroyed')) + self.coindays_destroyed: CumulativeSumPattern[StoredF64] = CumulativeSumPattern(client, _m(acc, 'coindays_destroyed')) self.satblocks_destroyed: MetricPattern11[Sats] = MetricPattern11(client, _m(acc, 'satblocks_destroyed')) self.satdays_destroyed: MetricPattern11[Sats] = MetricPattern11(client, _m(acc, 'satdays_destroyed')) - self.sent: UnclaimedRewardsPattern = UnclaimedRewardsPattern(client, _m(acc, 'sent')) + self.sent: BitcoinDollarsSatsPattern3 = BitcoinDollarsSatsPattern3(client, _m(acc, 'sent')) -class SplitPattern2(Generic[T]): +class InvestedSupplyPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.invested_capital_in_loss_pct: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'invested_capital_in_loss_pct')) + self.invested_capital_in_profit_pct: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'invested_capital_in_profit_pct')) + self.supply_in_loss_rel_to_own_supply: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'supply_in_loss_rel_to_own_supply')) + self.supply_in_profit_rel_to_own_supply: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'supply_in_profit_rel_to_own_supply')) + +class CloseHighLowOpenPattern2(Generic[T]): """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -2414,7 +2527,7 @@ class SplitPattern2(Generic[T]): self.low: MetricPattern1[T] = MetricPattern1(client, _m(acc, 'low')) self.open: MetricPattern1[T] = MetricPattern1(client, _m(acc, 'open')) -class SegwitAdoptionPattern: +class BaseCumulativeSumPattern: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -2423,7 +2536,16 @@ class SegwitAdoptionPattern: self.cumulative: MetricPattern2[StoredF32] = MetricPattern2(client, _m(acc, 'cumulative')) self.sum: MetricPattern2[StoredF32] = MetricPattern2(client, _m(acc, 'sum')) -class ActiveSupplyPattern: +class BitcoinDollarsSatsPattern2: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.bitcoin: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern = AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern(client, _m(acc, 'btc')) + self.dollars: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2[Dollars] = AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, _m(acc, 'usd')) + self.sats: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2[Sats] = AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, acc) + +class BitcoinDollarsSatsPattern4: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -2432,7 +2554,7 @@ class ActiveSupplyPattern: self.dollars: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'usd')) self.sats: MetricPattern1[Sats] = MetricPattern1(client, acc) -class _2015Pattern: +class BitcoinDollarsSatsPattern5: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -2441,43 +2563,25 @@ class _2015Pattern: self.dollars: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'usd')) self.sats: MetricPattern4[Sats] = MetricPattern4(client, acc) -class CoinbasePattern: +class BitcoinDollarsSatsPattern6: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.bitcoin: BitcoinPattern = BitcoinPattern(client, _m(acc, 'btc')) - self.dollars: DollarsPattern[Dollars] = DollarsPattern(client, _m(acc, 'usd')) - self.sats: DollarsPattern[Sats] = DollarsPattern(client, acc) + self.bitcoin: CumulativeSumPattern[Bitcoin] = CumulativeSumPattern(client, _m(acc, 'btc')) + self.dollars: CumulativeSumPattern[Dollars] = CumulativeSumPattern(client, _m(acc, 'usd')) + self.sats: CumulativeSumPattern[Sats] = CumulativeSumPattern(client, acc) -class UnclaimedRewardsPattern: +class BitcoinDollarsSatsPattern3: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.bitcoin: BitcoinPattern2[Bitcoin] = BitcoinPattern2(client, _m(acc, 'btc')) - self.dollars: BlockCountPattern[Dollars] = BlockCountPattern(client, _m(acc, 'usd')) - self.sats: BlockCountPattern[Sats] = BlockCountPattern(client, acc) + self.bitcoin: CumulativeSumPattern2[Bitcoin] = CumulativeSumPattern2(client, _m(acc, 'btc')) + self.dollars: CumulativeSumPattern[Dollars] = CumulativeSumPattern(client, _m(acc, 'usd')) + self.sats: CumulativeSumPattern[Sats] = CumulativeSumPattern(client, acc) -class CoinbasePattern2: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.bitcoin: BlockCountPattern[Bitcoin] = BlockCountPattern(client, _m(acc, 'btc')) - self.dollars: BlockCountPattern[Dollars] = BlockCountPattern(client, _m(acc, 'usd')) - self.sats: BlockCountPattern[Sats] = BlockCountPattern(client, acc) - -class CostBasisPattern2: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.max: ActivePricePattern = ActivePricePattern(client, _m(acc, 'max_cost_basis')) - self.min: ActivePricePattern = ActivePricePattern(client, _m(acc, 'min_cost_basis')) - self.percentiles: PercentilesPattern = PercentilesPattern(client, _m(acc, 'cost_basis')) - -class ActivePricePattern: +class DollarsSatsPattern: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -2485,7 +2589,7 @@ class ActivePricePattern: self.dollars: MetricPattern1[Dollars] = MetricPattern1(client, acc) self.sats: MetricPattern1[SatsFract] = MetricPattern1(client, _m(acc, 'sats')) -class _0sdUsdPattern: +class DollarsSatsPattern2: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -2493,23 +2597,23 @@ class _0sdUsdPattern: self.dollars: MetricPattern4[Dollars] = MetricPattern4(client, acc) self.sats: MetricPattern4[SatsFract] = MetricPattern4(client, _m(acc, 'sats')) -class SupplyPattern2: +class HalvedTotalPattern: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.halved: ActiveSupplyPattern = ActiveSupplyPattern(client, _m(acc, 'halved')) - self.total: ActiveSupplyPattern = ActiveSupplyPattern(client, acc) + self.halved: BitcoinDollarsSatsPattern4 = BitcoinDollarsSatsPattern4(client, _m(acc, 'halved')) + self.total: BitcoinDollarsSatsPattern4 = BitcoinDollarsSatsPattern4(client, acc) -class CostBasisPattern: +class MaxMinPattern: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.max: ActivePricePattern = ActivePricePattern(client, _m(acc, 'max_cost_basis')) - self.min: ActivePricePattern = ActivePricePattern(client, _m(acc, 'min_cost_basis')) + self.max: DollarsSatsPattern = DollarsSatsPattern(client, _m(acc, 'max_cost_basis')) + self.min: DollarsSatsPattern = DollarsSatsPattern(client, _m(acc, 'min_cost_basis')) -class _1dReturns1mSdPattern: +class SdSmaPattern: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -2517,15 +2621,7 @@ class _1dReturns1mSdPattern: self.sd: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'sd')) self.sma: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'sma')) -class RelativePattern4: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.supply_in_loss_rel_to_own_supply: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'loss_rel_to_own_supply')) - self.supply_in_profit_rel_to_own_supply: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'profit_rel_to_own_supply')) - -class BlockCountPattern(Generic[T]): +class CumulativeSumPattern(Generic[T]): """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -2533,7 +2629,7 @@ class BlockCountPattern(Generic[T]): self.cumulative: MetricPattern1[T] = MetricPattern1(client, _m(acc, 'cumulative')) self.sum: MetricPattern1[T] = MetricPattern1(client, acc) -class BitcoinPattern2(Generic[T]): +class CumulativeSumPattern2(Generic[T]): """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -2541,22 +2637,22 @@ class BitcoinPattern2(Generic[T]): self.cumulative: MetricPattern2[T] = MetricPattern2(client, _m(acc, 'cumulative')) self.sum: MetricPattern1[T] = MetricPattern1(client, acc) -class SatsPattern(Generic[T]): +class OhlcSplitPattern2(Generic[T]): """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" self.ohlc: MetricPattern1[T] = MetricPattern1(client, _m(acc, 'ohlc_sats')) - self.split: SplitPattern2[T] = SplitPattern2(client, _m(acc, 'sats')) + self.split: CloseHighLowOpenPattern2[T] = CloseHighLowOpenPattern2(client, _m(acc, 'sats')) -class RealizedPriceExtraPattern: +class RatioPattern2: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" self.ratio: MetricPattern4[StoredF32] = MetricPattern4(client, acc) -class OutputsPattern: +class UtxoPattern: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -2565,151 +2661,353 @@ class OutputsPattern: # Metrics tree classes -class MetricsTree_Addresses: +class MetricsTree_Blocks_Difficulty: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.first_p2aaddressindex: MetricPattern11[P2AAddressIndex] = MetricPattern11(client, 'first_p2aaddressindex') - self.first_p2pk33addressindex: MetricPattern11[P2PK33AddressIndex] = MetricPattern11(client, 'first_p2pk33addressindex') - self.first_p2pk65addressindex: MetricPattern11[P2PK65AddressIndex] = MetricPattern11(client, 'first_p2pk65addressindex') - self.first_p2pkhaddressindex: MetricPattern11[P2PKHAddressIndex] = MetricPattern11(client, 'first_p2pkhaddressindex') - self.first_p2shaddressindex: MetricPattern11[P2SHAddressIndex] = MetricPattern11(client, 'first_p2shaddressindex') - self.first_p2traddressindex: MetricPattern11[P2TRAddressIndex] = MetricPattern11(client, 'first_p2traddressindex') - self.first_p2wpkhaddressindex: MetricPattern11[P2WPKHAddressIndex] = MetricPattern11(client, 'first_p2wpkhaddressindex') - self.first_p2wshaddressindex: MetricPattern11[P2WSHAddressIndex] = MetricPattern11(client, 'first_p2wshaddressindex') - self.p2abytes: MetricPattern16[P2ABytes] = MetricPattern16(client, 'p2abytes') - self.p2pk33bytes: MetricPattern18[P2PK33Bytes] = MetricPattern18(client, 'p2pk33bytes') - self.p2pk65bytes: MetricPattern19[P2PK65Bytes] = MetricPattern19(client, 'p2pk65bytes') - self.p2pkhbytes: MetricPattern20[P2PKHBytes] = MetricPattern20(client, 'p2pkhbytes') - self.p2shbytes: MetricPattern21[P2SHBytes] = MetricPattern21(client, 'p2shbytes') - self.p2trbytes: MetricPattern22[P2TRBytes] = MetricPattern22(client, 'p2trbytes') - self.p2wpkhbytes: MetricPattern23[P2WPKHBytes] = MetricPattern23(client, 'p2wpkhbytes') - self.p2wshbytes: MetricPattern24[P2WSHBytes] = MetricPattern24(client, 'p2wshbytes') + self.raw: MetricPattern1[StoredF64] = MetricPattern1(client, 'difficulty') + self.as_hash: MetricPattern1[StoredF32] = MetricPattern1(client, 'difficulty_as_hash') + self.adjustment: MetricPattern1[StoredF32] = MetricPattern1(client, 'difficulty_adjustment') + self.epoch: MetricPattern4[DifficultyEpoch] = MetricPattern4(client, 'difficultyepoch') + self.blocks_before_next_adjustment: MetricPattern1[StoredU32] = MetricPattern1(client, 'blocks_before_next_difficulty_adjustment') + self.days_before_next_adjustment: MetricPattern1[StoredF32] = MetricPattern1(client, 'days_before_next_difficulty_adjustment') + +class MetricsTree_Blocks_Time: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.timestamp: MetricPattern1[Timestamp] = MetricPattern1(client, 'timestamp') + self.date: MetricPattern11[Date] = MetricPattern11(client, 'date') + self.timestamp_monotonic: MetricPattern11[Timestamp] = MetricPattern11(client, 'timestamp_monotonic') class MetricsTree_Blocks_Count: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self._1m_block_count: MetricPattern1[StoredU32] = MetricPattern1(client, '1m_block_count') - self._1m_start: MetricPattern11[Height] = MetricPattern11(client, '1m_start') - self._1w_block_count: MetricPattern1[StoredU32] = MetricPattern1(client, '1w_block_count') + self.block_count_target: MetricPattern4[StoredU64] = MetricPattern4(client, 'block_count_target') + self.block_count: CumulativeSumPattern[StoredU32] = CumulativeSumPattern(client, 'block_count') + self._24h_start: MetricPattern11[Height] = MetricPattern11(client, '24h_start') self._1w_start: MetricPattern11[Height] = MetricPattern11(client, '1w_start') - self._1y_block_count: MetricPattern1[StoredU32] = MetricPattern1(client, '1y_block_count') + self._1m_start: MetricPattern11[Height] = MetricPattern11(client, '1m_start') self._1y_start: MetricPattern11[Height] = MetricPattern11(client, '1y_start') self._24h_block_count: MetricPattern1[StoredU32] = MetricPattern1(client, '24h_block_count') - self._24h_start: MetricPattern11[Height] = MetricPattern11(client, '24h_start') - self.block_count: BlockCountPattern[StoredU32] = BlockCountPattern(client, 'block_count') - self.block_count_target: MetricPattern4[StoredU64] = MetricPattern4(client, 'block_count_target') - -class MetricsTree_Blocks_Difficulty: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.adjustment: MetricPattern1[StoredF32] = MetricPattern1(client, 'difficulty_adjustment') - self.as_hash: MetricPattern1[StoredF32] = MetricPattern1(client, 'difficulty_as_hash') - self.blocks_before_next_adjustment: MetricPattern1[StoredU32] = MetricPattern1(client, 'blocks_before_next_difficulty_adjustment') - self.days_before_next_adjustment: MetricPattern1[StoredF32] = MetricPattern1(client, 'days_before_next_difficulty_adjustment') - self.epoch: MetricPattern4[DifficultyEpoch] = MetricPattern4(client, 'difficultyepoch') - self.raw: MetricPattern1[StoredF64] = MetricPattern1(client, 'difficulty') - -class MetricsTree_Blocks_Halving: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.blocks_before_next_halving: MetricPattern1[StoredU32] = MetricPattern1(client, 'blocks_before_next_halving') - self.days_before_next_halving: MetricPattern1[StoredF32] = MetricPattern1(client, 'days_before_next_halving') - self.epoch: MetricPattern4[HalvingEpoch] = MetricPattern4(client, 'halvingepoch') + self._1w_block_count: MetricPattern1[StoredU32] = MetricPattern1(client, '1w_block_count') + self._1m_block_count: MetricPattern1[StoredU32] = MetricPattern1(client, '1m_block_count') + self._1y_block_count: MetricPattern1[StoredU32] = MetricPattern1(client, '1y_block_count') class MetricsTree_Blocks_Mining: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): + self.hash_rate: MetricPattern1[StoredF64] = MetricPattern1(client, 'hash_rate') + self.hash_rate_1w_sma: MetricPattern4[StoredF64] = MetricPattern4(client, 'hash_rate_1w_sma') + self.hash_rate_1m_sma: MetricPattern4[StoredF32] = MetricPattern4(client, 'hash_rate_1m_sma') + self.hash_rate_2m_sma: MetricPattern4[StoredF32] = MetricPattern4(client, 'hash_rate_2m_sma') + self.hash_rate_1y_sma: MetricPattern4[StoredF32] = MetricPattern4(client, 'hash_rate_1y_sma') + self.hash_price_ths: MetricPattern1[StoredF32] = MetricPattern1(client, 'hash_price_ths') + self.hash_price_ths_min: MetricPattern1[StoredF32] = MetricPattern1(client, 'hash_price_ths_min') self.hash_price_phs: MetricPattern1[StoredF32] = MetricPattern1(client, 'hash_price_phs') self.hash_price_phs_min: MetricPattern1[StoredF32] = MetricPattern1(client, 'hash_price_phs_min') self.hash_price_rebound: MetricPattern1[StoredF32] = MetricPattern1(client, 'hash_price_rebound') - self.hash_price_ths: MetricPattern1[StoredF32] = MetricPattern1(client, 'hash_price_ths') - self.hash_price_ths_min: MetricPattern1[StoredF32] = MetricPattern1(client, 'hash_price_ths_min') - self.hash_rate: MetricPattern1[StoredF64] = MetricPattern1(client, 'hash_rate') - self.hash_rate_1m_sma: MetricPattern4[StoredF32] = MetricPattern4(client, 'hash_rate_1m_sma') - self.hash_rate_1w_sma: MetricPattern4[StoredF64] = MetricPattern4(client, 'hash_rate_1w_sma') - self.hash_rate_1y_sma: MetricPattern4[StoredF32] = MetricPattern4(client, 'hash_rate_1y_sma') - self.hash_rate_2m_sma: MetricPattern4[StoredF32] = MetricPattern4(client, 'hash_rate_2m_sma') + self.hash_value_ths: MetricPattern1[StoredF32] = MetricPattern1(client, 'hash_value_ths') + self.hash_value_ths_min: MetricPattern1[StoredF32] = MetricPattern1(client, 'hash_value_ths_min') self.hash_value_phs: MetricPattern1[StoredF32] = MetricPattern1(client, 'hash_value_phs') self.hash_value_phs_min: MetricPattern1[StoredF32] = MetricPattern1(client, 'hash_value_phs_min') self.hash_value_rebound: MetricPattern1[StoredF32] = MetricPattern1(client, 'hash_value_rebound') - self.hash_value_ths: MetricPattern1[StoredF32] = MetricPattern1(client, 'hash_value_ths') - self.hash_value_ths_min: MetricPattern1[StoredF32] = MetricPattern1(client, 'hash_value_ths_min') class MetricsTree_Blocks_Rewards_24hCoinbaseSum: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): + self.sats: MetricPattern11[Sats] = MetricPattern11(client, '24h_coinbase_sum') self.bitcoin: MetricPattern11[Bitcoin] = MetricPattern11(client, '24h_coinbase_sum_btc') self.dollars: MetricPattern11[Dollars] = MetricPattern11(client, '24h_coinbase_sum_usd') - self.sats: MetricPattern11[Sats] = MetricPattern11(client, '24h_coinbase_sum') class MetricsTree_Blocks_Rewards: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): self._24h_coinbase_sum: MetricsTree_Blocks_Rewards_24hCoinbaseSum = MetricsTree_Blocks_Rewards_24hCoinbaseSum(client) - self.coinbase: CoinbasePattern = CoinbasePattern(client, 'coinbase') + self.coinbase: BitcoinDollarsSatsPattern2 = BitcoinDollarsSatsPattern2(client, 'coinbase') + self.subsidy: BitcoinDollarsSatsPattern2 = BitcoinDollarsSatsPattern2(client, 'subsidy') + self.unclaimed_rewards: BitcoinDollarsSatsPattern3 = BitcoinDollarsSatsPattern3(client, 'unclaimed_rewards') self.fee_dominance: MetricPattern6[StoredF32] = MetricPattern6(client, 'fee_dominance') - self.subsidy: CoinbasePattern = CoinbasePattern(client, 'subsidy') self.subsidy_dominance: MetricPattern6[StoredF32] = MetricPattern6(client, 'subsidy_dominance') self.subsidy_usd_1y_sma: MetricPattern4[Dollars] = MetricPattern4(client, 'subsidy_usd_1y_sma') - self.unclaimed_rewards: UnclaimedRewardsPattern = UnclaimedRewardsPattern(client, 'unclaimed_rewards') + +class MetricsTree_Blocks_Halving: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.epoch: MetricPattern4[HalvingEpoch] = MetricPattern4(client, 'halvingepoch') + self.blocks_before_next_halving: MetricPattern1[StoredU32] = MetricPattern1(client, 'blocks_before_next_halving') + self.days_before_next_halving: MetricPattern1[StoredF32] = MetricPattern1(client, 'days_before_next_halving') class MetricsTree_Blocks_Size: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.average: MetricPattern2[StoredU64] = MetricPattern2(client, 'block_size_average') self.cumulative: MetricPattern1[StoredU64] = MetricPattern1(client, 'block_size_cumulative') - self.max: MetricPattern2[StoredU64] = MetricPattern2(client, 'block_size_max') - self.median: MetricPattern6[StoredU64] = MetricPattern6(client, 'block_size_median') + self.average: MetricPattern2[StoredU64] = MetricPattern2(client, 'block_size_average') self.min: MetricPattern2[StoredU64] = MetricPattern2(client, 'block_size_min') + self.max: MetricPattern2[StoredU64] = MetricPattern2(client, 'block_size_max') self.pct10: MetricPattern6[StoredU64] = MetricPattern6(client, 'block_size_pct10') self.pct25: MetricPattern6[StoredU64] = MetricPattern6(client, 'block_size_pct25') + self.median: MetricPattern6[StoredU64] = MetricPattern6(client, 'block_size_median') self.pct75: MetricPattern6[StoredU64] = MetricPattern6(client, 'block_size_pct75') self.pct90: MetricPattern6[StoredU64] = MetricPattern6(client, 'block_size_pct90') self.sum: MetricPattern2[StoredU64] = MetricPattern2(client, 'block_size_sum') -class MetricsTree_Blocks_Time: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.date: MetricPattern11[Date] = MetricPattern11(client, 'date') - self.timestamp: MetricPattern1[Timestamp] = MetricPattern1(client, 'timestamp') - self.timestamp_monotonic: MetricPattern11[Timestamp] = MetricPattern11(client, 'timestamp_monotonic') - class MetricsTree_Blocks: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): self.blockhash: MetricPattern11[BlockHash] = MetricPattern11(client, 'blockhash') - self.count: MetricsTree_Blocks_Count = MetricsTree_Blocks_Count(client) self.difficulty: MetricsTree_Blocks_Difficulty = MetricsTree_Blocks_Difficulty(client) - self.fullness: FullnessPattern[StoredF32] = FullnessPattern(client, 'block_fullness') - self.halving: MetricsTree_Blocks_Halving = MetricsTree_Blocks_Halving(client) - self.interval: FullnessPattern[Timestamp] = FullnessPattern(client, 'block_interval') - self.mining: MetricsTree_Blocks_Mining = MetricsTree_Blocks_Mining(client) - self.rewards: MetricsTree_Blocks_Rewards = MetricsTree_Blocks_Rewards(client) - self.size: MetricsTree_Blocks_Size = MetricsTree_Blocks_Size(client) self.time: MetricsTree_Blocks_Time = MetricsTree_Blocks_Time(client) self.total_size: MetricPattern11[StoredU64] = MetricPattern11(client, 'total_size') - self.vbytes: DollarsPattern[StoredU64] = DollarsPattern(client, 'block_vbytes') - self.weight: DollarsPattern[Weight] = DollarsPattern(client, 'block_weight') + self.weight: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2[Weight] = AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, 'block_weight') + self.count: MetricsTree_Blocks_Count = MetricsTree_Blocks_Count(client) + self.interval: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern[Timestamp] = AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, 'block_interval') + self.mining: MetricsTree_Blocks_Mining = MetricsTree_Blocks_Mining(client) + self.rewards: MetricsTree_Blocks_Rewards = MetricsTree_Blocks_Rewards(client) + self.halving: MetricsTree_Blocks_Halving = MetricsTree_Blocks_Halving(client) + self.vbytes: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2[StoredU64] = AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, 'block_vbytes') + self.size: MetricsTree_Blocks_Size = MetricsTree_Blocks_Size(client) + self.fullness: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern[StoredF32] = AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, 'block_fullness') + +class MetricsTree_Transactions_Count: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.tx_count: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2[StoredU64] = AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, 'tx_count') + self.is_coinbase: MetricPattern27[StoredBool] = MetricPattern27(client, 'is_coinbase') + +class MetricsTree_Transactions_Size: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.vsize: AverageMaxMedianMinPct10Pct25Pct75Pct90TxindexPattern[VSize] = AverageMaxMedianMinPct10Pct25Pct75Pct90TxindexPattern(client, 'tx_vsize') + self.weight: AverageMaxMedianMinPct10Pct25Pct75Pct90TxindexPattern[Weight] = AverageMaxMedianMinPct10Pct25Pct75Pct90TxindexPattern(client, 'tx_weight') + +class MetricsTree_Transactions_Fees_Fee: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.txindex: MetricPattern27[Sats] = MetricPattern27(client, 'fee') + self.sats: AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2[Sats] = AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, 'fee') + self.bitcoin: AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2[Bitcoin] = AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, 'fee_btc') + self.dollars: AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2[Dollars] = AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, 'fee_usd') + +class MetricsTree_Transactions_Fees: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.input_value: MetricPattern27[Sats] = MetricPattern27(client, 'input_value') + self.output_value: MetricPattern27[Sats] = MetricPattern27(client, 'output_value') + self.fee: MetricsTree_Transactions_Fees_Fee = MetricsTree_Transactions_Fees_Fee(client) + self.fee_rate: AverageMaxMedianMinPct10Pct25Pct75Pct90TxindexPattern[FeeRate] = AverageMaxMedianMinPct10Pct25Pct75Pct90TxindexPattern(client, 'fee_rate') + +class MetricsTree_Transactions_Versions: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.v1: CumulativeSumPattern[StoredU64] = CumulativeSumPattern(client, 'tx_v1') + self.v2: CumulativeSumPattern[StoredU64] = CumulativeSumPattern(client, 'tx_v2') + self.v3: CumulativeSumPattern[StoredU64] = CumulativeSumPattern(client, 'tx_v3') + +class MetricsTree_Transactions_Volume: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.sent_sum: BitcoinDollarsSatsPattern4 = BitcoinDollarsSatsPattern4(client, 'sent_sum') + self.received_sum: BitcoinDollarsSatsPattern4 = BitcoinDollarsSatsPattern4(client, 'received_sum') + self.annualized_volume: BitcoinDollarsSatsPattern5 = BitcoinDollarsSatsPattern5(client, 'annualized_volume') + self.tx_per_sec: MetricPattern4[StoredF32] = MetricPattern4(client, 'tx_per_sec') + self.outputs_per_sec: MetricPattern4[StoredF32] = MetricPattern4(client, 'outputs_per_sec') + self.inputs_per_sec: MetricPattern4[StoredF32] = MetricPattern4(client, 'inputs_per_sec') + +class MetricsTree_Transactions: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.first_txindex: MetricPattern11[TxIndex] = MetricPattern11(client, 'first_txindex') + self.height: MetricPattern27[Height] = MetricPattern27(client, 'height') + self.txid: MetricPattern27[Txid] = MetricPattern27(client, 'txid') + self.txversion: MetricPattern27[TxVersion] = MetricPattern27(client, 'txversion') + self.rawlocktime: MetricPattern27[RawLockTime] = MetricPattern27(client, 'rawlocktime') + self.base_size: MetricPattern27[StoredU32] = MetricPattern27(client, 'base_size') + self.total_size: MetricPattern27[StoredU32] = MetricPattern27(client, 'total_size') + self.is_explicitly_rbf: MetricPattern27[StoredBool] = MetricPattern27(client, 'is_explicitly_rbf') + self.first_txinindex: MetricPattern27[TxInIndex] = MetricPattern27(client, 'first_txinindex') + self.first_txoutindex: MetricPattern27[TxOutIndex] = MetricPattern27(client, 'first_txoutindex') + self.count: MetricsTree_Transactions_Count = MetricsTree_Transactions_Count(client) + self.size: MetricsTree_Transactions_Size = MetricsTree_Transactions_Size(client) + self.fees: MetricsTree_Transactions_Fees = MetricsTree_Transactions_Fees(client) + self.versions: MetricsTree_Transactions_Versions = MetricsTree_Transactions_Versions(client) + self.volume: MetricsTree_Transactions_Volume = MetricsTree_Transactions_Volume(client) + +class MetricsTree_Inputs_Spent: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.txoutindex: MetricPattern12[TxOutIndex] = MetricPattern12(client, 'txoutindex') + self.value: MetricPattern12[Sats] = MetricPattern12(client, 'value') + +class MetricsTree_Inputs: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.first_txinindex: MetricPattern11[TxInIndex] = MetricPattern11(client, 'first_txinindex') + self.outpoint: MetricPattern12[OutPoint] = MetricPattern12(client, 'outpoint') + self.txindex: MetricPattern12[TxIndex] = MetricPattern12(client, 'txindex') + self.outputtype: MetricPattern12[OutputType] = MetricPattern12(client, 'outputtype') + self.typeindex: MetricPattern12[TypeIndex] = MetricPattern12(client, 'typeindex') + self.spent: MetricsTree_Inputs_Spent = MetricsTree_Inputs_Spent(client) + self.count: AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2[StoredU64] = AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, 'input_count') + +class MetricsTree_Outputs_Spent: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.txinindex: MetricPattern15[TxInIndex] = MetricPattern15(client, 'txinindex') + +class MetricsTree_Outputs_Count: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.total_count: AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2[StoredU64] = AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, 'output_count') + self.utxo_count: MetricPattern1[StoredU64] = MetricPattern1(client, 'exact_utxo_count') + +class MetricsTree_Outputs: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.first_txoutindex: MetricPattern11[TxOutIndex] = MetricPattern11(client, 'first_txoutindex') + self.value: MetricPattern15[Sats] = MetricPattern15(client, 'value') + self.outputtype: MetricPattern15[OutputType] = MetricPattern15(client, 'outputtype') + self.typeindex: MetricPattern15[TypeIndex] = MetricPattern15(client, 'typeindex') + self.txindex: MetricPattern15[TxIndex] = MetricPattern15(client, 'txindex') + self.spent: MetricsTree_Outputs_Spent = MetricsTree_Outputs_Spent(client) + self.count: MetricsTree_Outputs_Count = MetricsTree_Outputs_Count(client) + +class MetricsTree_Addresses: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.first_p2pk65addressindex: MetricPattern11[P2PK65AddressIndex] = MetricPattern11(client, 'first_p2pk65addressindex') + self.first_p2pk33addressindex: MetricPattern11[P2PK33AddressIndex] = MetricPattern11(client, 'first_p2pk33addressindex') + self.first_p2pkhaddressindex: MetricPattern11[P2PKHAddressIndex] = MetricPattern11(client, 'first_p2pkhaddressindex') + self.first_p2shaddressindex: MetricPattern11[P2SHAddressIndex] = MetricPattern11(client, 'first_p2shaddressindex') + self.first_p2wpkhaddressindex: MetricPattern11[P2WPKHAddressIndex] = MetricPattern11(client, 'first_p2wpkhaddressindex') + self.first_p2wshaddressindex: MetricPattern11[P2WSHAddressIndex] = MetricPattern11(client, 'first_p2wshaddressindex') + self.first_p2traddressindex: MetricPattern11[P2TRAddressIndex] = MetricPattern11(client, 'first_p2traddressindex') + self.first_p2aaddressindex: MetricPattern11[P2AAddressIndex] = MetricPattern11(client, 'first_p2aaddressindex') + self.p2pk65bytes: MetricPattern19[P2PK65Bytes] = MetricPattern19(client, 'p2pk65bytes') + self.p2pk33bytes: MetricPattern18[P2PK33Bytes] = MetricPattern18(client, 'p2pk33bytes') + self.p2pkhbytes: MetricPattern20[P2PKHBytes] = MetricPattern20(client, 'p2pkhbytes') + self.p2shbytes: MetricPattern21[P2SHBytes] = MetricPattern21(client, 'p2shbytes') + self.p2wpkhbytes: MetricPattern23[P2WPKHBytes] = MetricPattern23(client, 'p2wpkhbytes') + self.p2wshbytes: MetricPattern24[P2WSHBytes] = MetricPattern24(client, 'p2wshbytes') + self.p2trbytes: MetricPattern22[P2TRBytes] = MetricPattern22(client, 'p2trbytes') + self.p2abytes: MetricPattern16[P2ABytes] = MetricPattern16(client, 'p2abytes') + +class MetricsTree_Scripts_Count: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.p2a: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2[StoredU64] = AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, 'p2a_count') + self.p2ms: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2[StoredU64] = AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, 'p2ms_count') + self.p2pk33: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2[StoredU64] = AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, 'p2pk33_count') + self.p2pk65: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2[StoredU64] = AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, 'p2pk65_count') + self.p2pkh: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2[StoredU64] = AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, 'p2pkh_count') + self.p2sh: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2[StoredU64] = AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, 'p2sh_count') + self.p2tr: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2[StoredU64] = AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, 'p2tr_count') + self.p2wpkh: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2[StoredU64] = AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, 'p2wpkh_count') + self.p2wsh: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2[StoredU64] = AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, 'p2wsh_count') + self.opreturn: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2[StoredU64] = AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, 'opreturn_count') + self.emptyoutput: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2[StoredU64] = AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, 'emptyoutput_count') + self.unknownoutput: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2[StoredU64] = AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, 'unknownoutput_count') + self.segwit: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2[StoredU64] = AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, 'segwit_count') + self.taproot_adoption: BaseCumulativeSumPattern = BaseCumulativeSumPattern(client, 'taproot_adoption') + self.segwit_adoption: BaseCumulativeSumPattern = BaseCumulativeSumPattern(client, 'segwit_adoption') + +class MetricsTree_Scripts_Value: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.opreturn: BitcoinDollarsSatsPattern2 = BitcoinDollarsSatsPattern2(client, 'opreturn_value') + +class MetricsTree_Scripts: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.first_emptyoutputindex: MetricPattern11[EmptyOutputIndex] = MetricPattern11(client, 'first_emptyoutputindex') + self.first_opreturnindex: MetricPattern11[OpReturnIndex] = MetricPattern11(client, 'first_opreturnindex') + self.first_p2msoutputindex: MetricPattern11[P2MSOutputIndex] = MetricPattern11(client, 'first_p2msoutputindex') + self.first_unknownoutputindex: MetricPattern11[UnknownOutputIndex] = MetricPattern11(client, 'first_unknownoutputindex') + self.empty_to_txindex: MetricPattern9[TxIndex] = MetricPattern9(client, 'txindex') + self.opreturn_to_txindex: MetricPattern14[TxIndex] = MetricPattern14(client, 'txindex') + self.p2ms_to_txindex: MetricPattern17[TxIndex] = MetricPattern17(client, 'txindex') + self.unknown_to_txindex: MetricPattern28[TxIndex] = MetricPattern28(client, 'txindex') + self.count: MetricsTree_Scripts_Count = MetricsTree_Scripts_Count(client) + self.value: MetricsTree_Scripts_Value = MetricsTree_Scripts_Value(client) + +class MetricsTree_Positions: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.block_position: MetricPattern11[BlkPosition] = MetricPattern11(client, 'position') + self.tx_position: MetricPattern27[BlkPosition] = MetricPattern27(client, 'position') class MetricsTree_Cointime_Activity: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.activity_to_vaultedness_ratio: MetricPattern1[StoredF64] = MetricPattern1(client, 'activity_to_vaultedness_ratio') - self.coinblocks_created: BlockCountPattern[StoredF64] = BlockCountPattern(client, 'coinblocks_created') - self.coinblocks_stored: BlockCountPattern[StoredF64] = BlockCountPattern(client, 'coinblocks_stored') + self.coinblocks_created: CumulativeSumPattern[StoredF64] = CumulativeSumPattern(client, 'coinblocks_created') + self.coinblocks_stored: CumulativeSumPattern[StoredF64] = CumulativeSumPattern(client, 'coinblocks_stored') self.liveliness: MetricPattern1[StoredF64] = MetricPattern1(client, 'liveliness') self.vaultedness: MetricPattern1[StoredF64] = MetricPattern1(client, 'vaultedness') + self.activity_to_vaultedness_ratio: MetricPattern1[StoredF64] = MetricPattern1(client, 'activity_to_vaultedness_ratio') + +class MetricsTree_Cointime_Supply: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.vaulted_supply: BitcoinDollarsSatsPattern4 = BitcoinDollarsSatsPattern4(client, 'vaulted_supply') + self.active_supply: BitcoinDollarsSatsPattern4 = BitcoinDollarsSatsPattern4(client, 'active_supply') + +class MetricsTree_Cointime_Value: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.cointime_value_destroyed: CumulativeSumPattern[StoredF64] = CumulativeSumPattern(client, 'cointime_value_destroyed') + self.cointime_value_created: CumulativeSumPattern[StoredF64] = CumulativeSumPattern(client, 'cointime_value_created') + self.cointime_value_stored: CumulativeSumPattern[StoredF64] = CumulativeSumPattern(client, 'cointime_value_stored') + self.vocdd: CumulativeSumPattern[StoredF64] = CumulativeSumPattern(client, 'vocdd') + +class MetricsTree_Cointime_Cap: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.thermo_cap: MetricPattern1[Dollars] = MetricPattern1(client, 'thermo_cap') + self.investor_cap: MetricPattern1[Dollars] = MetricPattern1(client, 'investor_cap') + self.vaulted_cap: MetricPattern1[Dollars] = MetricPattern1(client, 'vaulted_cap') + self.active_cap: MetricPattern1[Dollars] = MetricPattern1(client, 'active_cap') + self.cointime_cap: MetricPattern1[Dollars] = MetricPattern1(client, 'cointime_cap') + +class MetricsTree_Cointime_Pricing: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.vaulted_price: DollarsSatsPattern = DollarsSatsPattern(client, 'vaulted_price') + self.vaulted_price_ratio: RatioPattern = RatioPattern(client, 'vaulted_price_ratio') + self.active_price: DollarsSatsPattern = DollarsSatsPattern(client, 'active_price') + self.active_price_ratio: RatioPattern = RatioPattern(client, 'active_price_ratio') + self.true_market_mean: DollarsSatsPattern = DollarsSatsPattern(client, 'true_market_mean') + self.true_market_mean_ratio: RatioPattern = RatioPattern(client, 'true_market_mean_ratio') + self.cointime_price: DollarsSatsPattern = DollarsSatsPattern(client, 'cointime_price') + self.cointime_price_ratio: RatioPattern = RatioPattern(client, 'cointime_price_ratio') class MetricsTree_Cointime_Adjusted: """Metrics tree node.""" @@ -2719,64 +3017,25 @@ class MetricsTree_Cointime_Adjusted: self.cointime_adj_tx_btc_velocity: MetricPattern4[StoredF64] = MetricPattern4(client, 'cointime_adj_tx_btc_velocity') self.cointime_adj_tx_usd_velocity: MetricPattern4[StoredF64] = MetricPattern4(client, 'cointime_adj_tx_usd_velocity') -class MetricsTree_Cointime_Cap: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.active_cap: MetricPattern1[Dollars] = MetricPattern1(client, 'active_cap') - self.cointime_cap: MetricPattern1[Dollars] = MetricPattern1(client, 'cointime_cap') - self.investor_cap: MetricPattern1[Dollars] = MetricPattern1(client, 'investor_cap') - self.thermo_cap: MetricPattern1[Dollars] = MetricPattern1(client, 'thermo_cap') - self.vaulted_cap: MetricPattern1[Dollars] = MetricPattern1(client, 'vaulted_cap') - -class MetricsTree_Cointime_Pricing: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.active_price: ActivePricePattern = ActivePricePattern(client, 'active_price') - self.active_price_ratio: ActivePriceRatioPattern = ActivePriceRatioPattern(client, 'active_price_ratio') - self.cointime_price: ActivePricePattern = ActivePricePattern(client, 'cointime_price') - self.cointime_price_ratio: ActivePriceRatioPattern = ActivePriceRatioPattern(client, 'cointime_price_ratio') - self.true_market_mean: ActivePricePattern = ActivePricePattern(client, 'true_market_mean') - self.true_market_mean_ratio: ActivePriceRatioPattern = ActivePriceRatioPattern(client, 'true_market_mean_ratio') - self.vaulted_price: ActivePricePattern = ActivePricePattern(client, 'vaulted_price') - self.vaulted_price_ratio: ActivePriceRatioPattern = ActivePriceRatioPattern(client, 'vaulted_price_ratio') - class MetricsTree_Cointime_ReserveRisk: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): + self.vocdd_365d_sma: MetricPattern6[StoredF64] = MetricPattern6(client, 'vocdd_365d_sma') self.hodl_bank: MetricPattern6[StoredF64] = MetricPattern6(client, 'hodl_bank') self.reserve_risk: MetricPattern4[StoredF64] = MetricPattern4(client, 'reserve_risk') - self.vocdd_365d_sma: MetricPattern6[StoredF64] = MetricPattern6(client, 'vocdd_365d_sma') - -class MetricsTree_Cointime_Supply: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.active_supply: ActiveSupplyPattern = ActiveSupplyPattern(client, 'active_supply') - self.vaulted_supply: ActiveSupplyPattern = ActiveSupplyPattern(client, 'vaulted_supply') - -class MetricsTree_Cointime_Value: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.cointime_value_created: BlockCountPattern[StoredF64] = BlockCountPattern(client, 'cointime_value_created') - self.cointime_value_destroyed: BlockCountPattern[StoredF64] = BlockCountPattern(client, 'cointime_value_destroyed') - self.cointime_value_stored: BlockCountPattern[StoredF64] = BlockCountPattern(client, 'cointime_value_stored') - self.vocdd: BlockCountPattern[StoredF64] = BlockCountPattern(client, 'vocdd') class MetricsTree_Cointime: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): self.activity: MetricsTree_Cointime_Activity = MetricsTree_Cointime_Activity(client) - self.adjusted: MetricsTree_Cointime_Adjusted = MetricsTree_Cointime_Adjusted(client) - self.cap: MetricsTree_Cointime_Cap = MetricsTree_Cointime_Cap(client) - self.pricing: MetricsTree_Cointime_Pricing = MetricsTree_Cointime_Pricing(client) - self.reserve_risk: MetricsTree_Cointime_ReserveRisk = MetricsTree_Cointime_ReserveRisk(client) self.supply: MetricsTree_Cointime_Supply = MetricsTree_Cointime_Supply(client) self.value: MetricsTree_Cointime_Value = MetricsTree_Cointime_Value(client) + self.cap: MetricsTree_Cointime_Cap = MetricsTree_Cointime_Cap(client) + self.pricing: MetricsTree_Cointime_Pricing = MetricsTree_Cointime_Pricing(client) + self.adjusted: MetricsTree_Cointime_Adjusted = MetricsTree_Cointime_Adjusted(client) + self.reserve_risk: MetricsTree_Cointime_ReserveRisk = MetricsTree_Cointime_ReserveRisk(client) class MetricsTree_Constants: """Metrics tree node.""" @@ -2784,446 +3043,23 @@ class MetricsTree_Constants: def __init__(self, client: BrkClientBase, base_path: str = ''): self.constant_0: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_0') self.constant_1: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_1') - self.constant_100: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_100') self.constant_2: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_2') - self.constant_20: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_20') self.constant_3: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_3') + self.constant_4: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_4') + self.constant_20: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_20') self.constant_30: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_30') self.constant_38_2: MetricPattern1[StoredF32] = MetricPattern1(client, 'constant_38_2') - self.constant_4: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_4') self.constant_50: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_50') - self.constant_600: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_600') self.constant_61_8: MetricPattern1[StoredF32] = MetricPattern1(client, 'constant_61_8') self.constant_70: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_70') self.constant_80: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_80') + self.constant_100: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_100') + self.constant_600: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_600') self.constant_minus_1: MetricPattern1[StoredI8] = MetricPattern1(client, 'constant_minus_1') self.constant_minus_2: MetricPattern1[StoredI8] = MetricPattern1(client, 'constant_minus_2') self.constant_minus_3: MetricPattern1[StoredI8] = MetricPattern1(client, 'constant_minus_3') self.constant_minus_4: MetricPattern1[StoredI8] = MetricPattern1(client, 'constant_minus_4') -class MetricsTree_Distribution_AddressActivity: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.all: AllPattern = AllPattern(client, 'address_activity') - self.p2a: AllPattern = AllPattern(client, 'p2a_address_activity') - self.p2pk33: AllPattern = AllPattern(client, 'p2pk33_address_activity') - self.p2pk65: AllPattern = AllPattern(client, 'p2pk65_address_activity') - self.p2pkh: AllPattern = AllPattern(client, 'p2pkh_address_activity') - self.p2sh: AllPattern = AllPattern(client, 'p2sh_address_activity') - self.p2tr: AllPattern = AllPattern(client, 'p2tr_address_activity') - self.p2wpkh: AllPattern = AllPattern(client, 'p2wpkh_address_activity') - self.p2wsh: AllPattern = AllPattern(client, 'p2wsh_address_activity') - -class MetricsTree_Distribution_AddressCohorts_AmountRange: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self._0sats: _0satsPattern = _0satsPattern(client, 'addrs_with_0sats') - self._100btc_to_1k_btc: _0satsPattern = _0satsPattern(client, 'addrs_above_100btc_under_1k_btc') - self._100k_btc_or_more: _0satsPattern = _0satsPattern(client, 'addrs_above_100k_btc') - self._100k_sats_to_1m_sats: _0satsPattern = _0satsPattern(client, 'addrs_above_100k_sats_under_1m_sats') - self._100sats_to_1k_sats: _0satsPattern = _0satsPattern(client, 'addrs_above_100sats_under_1k_sats') - self._10btc_to_100btc: _0satsPattern = _0satsPattern(client, 'addrs_above_10btc_under_100btc') - self._10k_btc_to_100k_btc: _0satsPattern = _0satsPattern(client, 'addrs_above_10k_btc_under_100k_btc') - self._10k_sats_to_100k_sats: _0satsPattern = _0satsPattern(client, 'addrs_above_10k_sats_under_100k_sats') - self._10m_sats_to_1btc: _0satsPattern = _0satsPattern(client, 'addrs_above_10m_sats_under_1btc') - self._10sats_to_100sats: _0satsPattern = _0satsPattern(client, 'addrs_above_10sats_under_100sats') - self._1btc_to_10btc: _0satsPattern = _0satsPattern(client, 'addrs_above_1btc_under_10btc') - self._1k_btc_to_10k_btc: _0satsPattern = _0satsPattern(client, 'addrs_above_1k_btc_under_10k_btc') - self._1k_sats_to_10k_sats: _0satsPattern = _0satsPattern(client, 'addrs_above_1k_sats_under_10k_sats') - self._1m_sats_to_10m_sats: _0satsPattern = _0satsPattern(client, 'addrs_above_1m_sats_under_10m_sats') - self._1sat_to_10sats: _0satsPattern = _0satsPattern(client, 'addrs_above_1sat_under_10sats') - -class MetricsTree_Distribution_AddressCohorts_GeAmount: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self._100btc: _0satsPattern = _0satsPattern(client, 'addrs_over_100btc') - self._100k_sats: _0satsPattern = _0satsPattern(client, 'addrs_over_100k_sats') - self._100sats: _0satsPattern = _0satsPattern(client, 'addrs_over_100sats') - self._10btc: _0satsPattern = _0satsPattern(client, 'addrs_over_10btc') - self._10k_btc: _0satsPattern = _0satsPattern(client, 'addrs_over_10k_btc') - self._10k_sats: _0satsPattern = _0satsPattern(client, 'addrs_over_10k_sats') - self._10m_sats: _0satsPattern = _0satsPattern(client, 'addrs_over_10m_sats') - self._10sats: _0satsPattern = _0satsPattern(client, 'addrs_over_10sats') - self._1btc: _0satsPattern = _0satsPattern(client, 'addrs_over_1btc') - self._1k_btc: _0satsPattern = _0satsPattern(client, 'addrs_over_1k_btc') - self._1k_sats: _0satsPattern = _0satsPattern(client, 'addrs_over_1k_sats') - self._1m_sats: _0satsPattern = _0satsPattern(client, 'addrs_over_1m_sats') - self._1sat: _0satsPattern = _0satsPattern(client, 'addrs_over_1sat') - -class MetricsTree_Distribution_AddressCohorts_LtAmount: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self._100btc: _0satsPattern = _0satsPattern(client, 'addrs_under_100btc') - self._100k_btc: _0satsPattern = _0satsPattern(client, 'addrs_under_100k_btc') - self._100k_sats: _0satsPattern = _0satsPattern(client, 'addrs_under_100k_sats') - self._100sats: _0satsPattern = _0satsPattern(client, 'addrs_under_100sats') - self._10btc: _0satsPattern = _0satsPattern(client, 'addrs_under_10btc') - self._10k_btc: _0satsPattern = _0satsPattern(client, 'addrs_under_10k_btc') - self._10k_sats: _0satsPattern = _0satsPattern(client, 'addrs_under_10k_sats') - self._10m_sats: _0satsPattern = _0satsPattern(client, 'addrs_under_10m_sats') - self._10sats: _0satsPattern = _0satsPattern(client, 'addrs_under_10sats') - self._1btc: _0satsPattern = _0satsPattern(client, 'addrs_under_1btc') - self._1k_btc: _0satsPattern = _0satsPattern(client, 'addrs_under_1k_btc') - self._1k_sats: _0satsPattern = _0satsPattern(client, 'addrs_under_1k_sats') - self._1m_sats: _0satsPattern = _0satsPattern(client, 'addrs_under_1m_sats') - -class MetricsTree_Distribution_AddressCohorts: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.amount_range: MetricsTree_Distribution_AddressCohorts_AmountRange = MetricsTree_Distribution_AddressCohorts_AmountRange(client) - self.ge_amount: MetricsTree_Distribution_AddressCohorts_GeAmount = MetricsTree_Distribution_AddressCohorts_GeAmount(client) - self.lt_amount: MetricsTree_Distribution_AddressCohorts_LtAmount = MetricsTree_Distribution_AddressCohorts_LtAmount(client) - -class MetricsTree_Distribution_AddressesData: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.empty: MetricPattern32[EmptyAddressData] = MetricPattern32(client, 'emptyaddressdata') - self.loaded: MetricPattern31[LoadedAddressData] = MetricPattern31(client, 'loadedaddressdata') - -class MetricsTree_Distribution_AnyAddressIndexes: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.p2a: MetricPattern16[AnyAddressIndex] = MetricPattern16(client, 'anyaddressindex') - self.p2pk33: MetricPattern18[AnyAddressIndex] = MetricPattern18(client, 'anyaddressindex') - self.p2pk65: MetricPattern19[AnyAddressIndex] = MetricPattern19(client, 'anyaddressindex') - self.p2pkh: MetricPattern20[AnyAddressIndex] = MetricPattern20(client, 'anyaddressindex') - self.p2sh: MetricPattern21[AnyAddressIndex] = MetricPattern21(client, 'anyaddressindex') - self.p2tr: MetricPattern22[AnyAddressIndex] = MetricPattern22(client, 'anyaddressindex') - self.p2wpkh: MetricPattern23[AnyAddressIndex] = MetricPattern23(client, 'anyaddressindex') - self.p2wsh: MetricPattern24[AnyAddressIndex] = MetricPattern24(client, 'anyaddressindex') - -class MetricsTree_Distribution_GrowthRate: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.all: FullnessPattern[StoredF32] = FullnessPattern(client, 'growth_rate') - self.p2a: FullnessPattern[StoredF32] = FullnessPattern(client, 'p2a_growth_rate') - self.p2pk33: FullnessPattern[StoredF32] = FullnessPattern(client, 'p2pk33_growth_rate') - self.p2pk65: FullnessPattern[StoredF32] = FullnessPattern(client, 'p2pk65_growth_rate') - self.p2pkh: FullnessPattern[StoredF32] = FullnessPattern(client, 'p2pkh_growth_rate') - self.p2sh: FullnessPattern[StoredF32] = FullnessPattern(client, 'p2sh_growth_rate') - self.p2tr: FullnessPattern[StoredF32] = FullnessPattern(client, 'p2tr_growth_rate') - self.p2wpkh: FullnessPattern[StoredF32] = FullnessPattern(client, 'p2wpkh_growth_rate') - self.p2wsh: FullnessPattern[StoredF32] = FullnessPattern(client, 'p2wsh_growth_rate') - -class MetricsTree_Distribution_NewAddrCount: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.all: DollarsPattern[StoredU64] = DollarsPattern(client, 'new_addr_count') - self.p2a: DollarsPattern[StoredU64] = DollarsPattern(client, 'p2a_new_addr_count') - self.p2pk33: DollarsPattern[StoredU64] = DollarsPattern(client, 'p2pk33_new_addr_count') - self.p2pk65: DollarsPattern[StoredU64] = DollarsPattern(client, 'p2pk65_new_addr_count') - self.p2pkh: DollarsPattern[StoredU64] = DollarsPattern(client, 'p2pkh_new_addr_count') - self.p2sh: DollarsPattern[StoredU64] = DollarsPattern(client, 'p2sh_new_addr_count') - self.p2tr: DollarsPattern[StoredU64] = DollarsPattern(client, 'p2tr_new_addr_count') - self.p2wpkh: DollarsPattern[StoredU64] = DollarsPattern(client, 'p2wpkh_new_addr_count') - self.p2wsh: DollarsPattern[StoredU64] = DollarsPattern(client, 'p2wsh_new_addr_count') - -class MetricsTree_Distribution_UtxoCohorts_AgeRange: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self._10y_to_12y: _10yTo12yPattern = _10yTo12yPattern(client, 'utxos_10y_to_12y_old') - self._12y_to_15y: _10yTo12yPattern = _10yTo12yPattern(client, 'utxos_12y_to_15y_old') - self._1d_to_1w: _10yTo12yPattern = _10yTo12yPattern(client, 'utxos_1d_to_1w_old') - self._1h_to_1d: _10yTo12yPattern = _10yTo12yPattern(client, 'utxos_1h_to_1d_old') - self._1m_to_2m: _10yTo12yPattern = _10yTo12yPattern(client, 'utxos_1m_to_2m_old') - self._1w_to_1m: _10yTo12yPattern = _10yTo12yPattern(client, 'utxos_1w_to_1m_old') - self._1y_to_2y: _10yTo12yPattern = _10yTo12yPattern(client, 'utxos_1y_to_2y_old') - self._2m_to_3m: _10yTo12yPattern = _10yTo12yPattern(client, 'utxos_2m_to_3m_old') - self._2y_to_3y: _10yTo12yPattern = _10yTo12yPattern(client, 'utxos_2y_to_3y_old') - self._3m_to_4m: _10yTo12yPattern = _10yTo12yPattern(client, 'utxos_3m_to_4m_old') - self._3y_to_4y: _10yTo12yPattern = _10yTo12yPattern(client, 'utxos_3y_to_4y_old') - self._4m_to_5m: _10yTo12yPattern = _10yTo12yPattern(client, 'utxos_4m_to_5m_old') - self._4y_to_5y: _10yTo12yPattern = _10yTo12yPattern(client, 'utxos_4y_to_5y_old') - self._5m_to_6m: _10yTo12yPattern = _10yTo12yPattern(client, 'utxos_5m_to_6m_old') - self._5y_to_6y: _10yTo12yPattern = _10yTo12yPattern(client, 'utxos_5y_to_6y_old') - self._6m_to_1y: _10yTo12yPattern = _10yTo12yPattern(client, 'utxos_6m_to_1y_old') - self._6y_to_7y: _10yTo12yPattern = _10yTo12yPattern(client, 'utxos_6y_to_7y_old') - self._7y_to_8y: _10yTo12yPattern = _10yTo12yPattern(client, 'utxos_7y_to_8y_old') - self._8y_to_10y: _10yTo12yPattern = _10yTo12yPattern(client, 'utxos_8y_to_10y_old') - self.from_15y: _10yTo12yPattern = _10yTo12yPattern(client, 'utxos_over_15y_old') - self.up_to_1h: _10yTo12yPattern = _10yTo12yPattern(client, 'utxos_under_1h_old') - -class MetricsTree_Distribution_UtxoCohorts_All_CostBasis: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.max: ActivePricePattern = ActivePricePattern(client, 'max_cost_basis') - self.min: ActivePricePattern = ActivePricePattern(client, 'min_cost_basis') - self.percentiles: PercentilesPattern = PercentilesPattern(client, 'cost_basis') - -class MetricsTree_Distribution_UtxoCohorts_All_Relative: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.neg_unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1[StoredF32] = MetricPattern1(client, 'neg_unrealized_loss_rel_to_own_total_unrealized_pnl') - self.net_unrealized_pnl_rel_to_own_total_unrealized_pnl: MetricPattern1[StoredF32] = MetricPattern1(client, 'net_unrealized_pnl_rel_to_own_total_unrealized_pnl') - self.supply_in_loss_rel_to_own_supply: MetricPattern1[StoredF64] = MetricPattern1(client, 'supply_in_loss_rel_to_own_supply') - self.supply_in_profit_rel_to_own_supply: MetricPattern1[StoredF64] = MetricPattern1(client, 'supply_in_profit_rel_to_own_supply') - self.unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1[StoredF32] = MetricPattern1(client, 'unrealized_loss_rel_to_own_total_unrealized_pnl') - self.unrealized_profit_rel_to_own_total_unrealized_pnl: MetricPattern1[StoredF32] = MetricPattern1(client, 'unrealized_profit_rel_to_own_total_unrealized_pnl') - -class MetricsTree_Distribution_UtxoCohorts_All: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.activity: ActivityPattern2 = ActivityPattern2(client, '') - self.cost_basis: MetricsTree_Distribution_UtxoCohorts_All_CostBasis = MetricsTree_Distribution_UtxoCohorts_All_CostBasis(client) - self.outputs: OutputsPattern = OutputsPattern(client, 'utxo_count') - self.realized: RealizedPattern3 = RealizedPattern3(client, '') - self.relative: MetricsTree_Distribution_UtxoCohorts_All_Relative = MetricsTree_Distribution_UtxoCohorts_All_Relative(client) - self.supply: SupplyPattern2 = SupplyPattern2(client, 'supply') - self.unrealized: UnrealizedPattern = UnrealizedPattern(client, '') - -class MetricsTree_Distribution_UtxoCohorts_AmountRange: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self._0sats: _0satsPattern2 = _0satsPattern2(client, 'utxos_with_0sats') - self._100btc_to_1k_btc: _0satsPattern2 = _0satsPattern2(client, 'utxos_above_100btc_under_1k_btc') - self._100k_btc_or_more: _0satsPattern2 = _0satsPattern2(client, 'utxos_above_100k_btc') - self._100k_sats_to_1m_sats: _0satsPattern2 = _0satsPattern2(client, 'utxos_above_100k_sats_under_1m_sats') - self._100sats_to_1k_sats: _0satsPattern2 = _0satsPattern2(client, 'utxos_above_100sats_under_1k_sats') - self._10btc_to_100btc: _0satsPattern2 = _0satsPattern2(client, 'utxos_above_10btc_under_100btc') - self._10k_btc_to_100k_btc: _0satsPattern2 = _0satsPattern2(client, 'utxos_above_10k_btc_under_100k_btc') - self._10k_sats_to_100k_sats: _0satsPattern2 = _0satsPattern2(client, 'utxos_above_10k_sats_under_100k_sats') - self._10m_sats_to_1btc: _0satsPattern2 = _0satsPattern2(client, 'utxos_above_10m_sats_under_1btc') - self._10sats_to_100sats: _0satsPattern2 = _0satsPattern2(client, 'utxos_above_10sats_under_100sats') - self._1btc_to_10btc: _0satsPattern2 = _0satsPattern2(client, 'utxos_above_1btc_under_10btc') - self._1k_btc_to_10k_btc: _0satsPattern2 = _0satsPattern2(client, 'utxos_above_1k_btc_under_10k_btc') - self._1k_sats_to_10k_sats: _0satsPattern2 = _0satsPattern2(client, 'utxos_above_1k_sats_under_10k_sats') - self._1m_sats_to_10m_sats: _0satsPattern2 = _0satsPattern2(client, 'utxos_above_1m_sats_under_10m_sats') - self._1sat_to_10sats: _0satsPattern2 = _0satsPattern2(client, 'utxos_above_1sat_under_10sats') - -class MetricsTree_Distribution_UtxoCohorts_Epoch: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self._0: _0satsPattern2 = _0satsPattern2(client, 'epoch_0') - self._1: _0satsPattern2 = _0satsPattern2(client, 'epoch_1') - self._2: _0satsPattern2 = _0satsPattern2(client, 'epoch_2') - self._3: _0satsPattern2 = _0satsPattern2(client, 'epoch_3') - self._4: _0satsPattern2 = _0satsPattern2(client, 'epoch_4') - -class MetricsTree_Distribution_UtxoCohorts_GeAmount: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self._100btc: _100btcPattern = _100btcPattern(client, 'utxos_over_100btc') - self._100k_sats: _100btcPattern = _100btcPattern(client, 'utxos_over_100k_sats') - self._100sats: _100btcPattern = _100btcPattern(client, 'utxos_over_100sats') - self._10btc: _100btcPattern = _100btcPattern(client, 'utxos_over_10btc') - self._10k_btc: _100btcPattern = _100btcPattern(client, 'utxos_over_10k_btc') - self._10k_sats: _100btcPattern = _100btcPattern(client, 'utxos_over_10k_sats') - self._10m_sats: _100btcPattern = _100btcPattern(client, 'utxos_over_10m_sats') - self._10sats: _100btcPattern = _100btcPattern(client, 'utxos_over_10sats') - self._1btc: _100btcPattern = _100btcPattern(client, 'utxos_over_1btc') - self._1k_btc: _100btcPattern = _100btcPattern(client, 'utxos_over_1k_btc') - self._1k_sats: _100btcPattern = _100btcPattern(client, 'utxos_over_1k_sats') - self._1m_sats: _100btcPattern = _100btcPattern(client, 'utxos_over_1m_sats') - self._1sat: _100btcPattern = _100btcPattern(client, 'utxos_over_1sat') - -class MetricsTree_Distribution_UtxoCohorts_LtAmount: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self._100btc: _100btcPattern = _100btcPattern(client, 'utxos_under_100btc') - self._100k_btc: _100btcPattern = _100btcPattern(client, 'utxos_under_100k_btc') - self._100k_sats: _100btcPattern = _100btcPattern(client, 'utxos_under_100k_sats') - self._100sats: _100btcPattern = _100btcPattern(client, 'utxos_under_100sats') - self._10btc: _100btcPattern = _100btcPattern(client, 'utxos_under_10btc') - self._10k_btc: _100btcPattern = _100btcPattern(client, 'utxos_under_10k_btc') - self._10k_sats: _100btcPattern = _100btcPattern(client, 'utxos_under_10k_sats') - self._10m_sats: _100btcPattern = _100btcPattern(client, 'utxos_under_10m_sats') - self._10sats: _100btcPattern = _100btcPattern(client, 'utxos_under_10sats') - self._1btc: _100btcPattern = _100btcPattern(client, 'utxos_under_1btc') - self._1k_btc: _100btcPattern = _100btcPattern(client, 'utxos_under_1k_btc') - self._1k_sats: _100btcPattern = _100btcPattern(client, 'utxos_under_1k_sats') - self._1m_sats: _100btcPattern = _100btcPattern(client, 'utxos_under_1m_sats') - -class MetricsTree_Distribution_UtxoCohorts_MaxAge: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self._10y: _10yPattern = _10yPattern(client, 'utxos_under_10y_old') - self._12y: _10yPattern = _10yPattern(client, 'utxos_under_12y_old') - self._15y: _10yPattern = _10yPattern(client, 'utxos_under_15y_old') - self._1m: _10yPattern = _10yPattern(client, 'utxos_under_1m_old') - self._1w: _10yPattern = _10yPattern(client, 'utxos_under_1w_old') - self._1y: _10yPattern = _10yPattern(client, 'utxos_under_1y_old') - self._2m: _10yPattern = _10yPattern(client, 'utxos_under_2m_old') - self._2y: _10yPattern = _10yPattern(client, 'utxos_under_2y_old') - self._3m: _10yPattern = _10yPattern(client, 'utxos_under_3m_old') - self._3y: _10yPattern = _10yPattern(client, 'utxos_under_3y_old') - self._4m: _10yPattern = _10yPattern(client, 'utxos_under_4m_old') - self._4y: _10yPattern = _10yPattern(client, 'utxos_under_4y_old') - self._5m: _10yPattern = _10yPattern(client, 'utxos_under_5m_old') - self._5y: _10yPattern = _10yPattern(client, 'utxos_under_5y_old') - self._6m: _10yPattern = _10yPattern(client, 'utxos_under_6m_old') - self._6y: _10yPattern = _10yPattern(client, 'utxos_under_6y_old') - self._7y: _10yPattern = _10yPattern(client, 'utxos_under_7y_old') - self._8y: _10yPattern = _10yPattern(client, 'utxos_under_8y_old') - -class MetricsTree_Distribution_UtxoCohorts_MinAge: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self._10y: _100btcPattern = _100btcPattern(client, 'utxos_over_10y_old') - self._12y: _100btcPattern = _100btcPattern(client, 'utxos_over_12y_old') - self._1d: _100btcPattern = _100btcPattern(client, 'utxos_over_1d_old') - self._1m: _100btcPattern = _100btcPattern(client, 'utxos_over_1m_old') - self._1w: _100btcPattern = _100btcPattern(client, 'utxos_over_1w_old') - self._1y: _100btcPattern = _100btcPattern(client, 'utxos_over_1y_old') - self._2m: _100btcPattern = _100btcPattern(client, 'utxos_over_2m_old') - self._2y: _100btcPattern = _100btcPattern(client, 'utxos_over_2y_old') - self._3m: _100btcPattern = _100btcPattern(client, 'utxos_over_3m_old') - self._3y: _100btcPattern = _100btcPattern(client, 'utxos_over_3y_old') - self._4m: _100btcPattern = _100btcPattern(client, 'utxos_over_4m_old') - self._4y: _100btcPattern = _100btcPattern(client, 'utxos_over_4y_old') - self._5m: _100btcPattern = _100btcPattern(client, 'utxos_over_5m_old') - self._5y: _100btcPattern = _100btcPattern(client, 'utxos_over_5y_old') - self._6m: _100btcPattern = _100btcPattern(client, 'utxos_over_6m_old') - self._6y: _100btcPattern = _100btcPattern(client, 'utxos_over_6y_old') - self._7y: _100btcPattern = _100btcPattern(client, 'utxos_over_7y_old') - self._8y: _100btcPattern = _100btcPattern(client, 'utxos_over_8y_old') - -class MetricsTree_Distribution_UtxoCohorts_Term_Long: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.activity: ActivityPattern2 = ActivityPattern2(client, 'lth') - self.cost_basis: CostBasisPattern2 = CostBasisPattern2(client, 'lth') - self.outputs: OutputsPattern = OutputsPattern(client, 'lth_utxo_count') - self.realized: RealizedPattern2 = RealizedPattern2(client, 'lth') - self.relative: RelativePattern5 = RelativePattern5(client, 'lth') - self.supply: SupplyPattern2 = SupplyPattern2(client, 'lth_supply') - self.unrealized: UnrealizedPattern = UnrealizedPattern(client, 'lth') - -class MetricsTree_Distribution_UtxoCohorts_Term_Short: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.activity: ActivityPattern2 = ActivityPattern2(client, 'sth') - self.cost_basis: CostBasisPattern2 = CostBasisPattern2(client, 'sth') - self.outputs: OutputsPattern = OutputsPattern(client, 'sth_utxo_count') - self.realized: RealizedPattern3 = RealizedPattern3(client, 'sth') - self.relative: RelativePattern5 = RelativePattern5(client, 'sth') - self.supply: SupplyPattern2 = SupplyPattern2(client, 'sth_supply') - self.unrealized: UnrealizedPattern = UnrealizedPattern(client, 'sth') - -class MetricsTree_Distribution_UtxoCohorts_Term: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.long: MetricsTree_Distribution_UtxoCohorts_Term_Long = MetricsTree_Distribution_UtxoCohorts_Term_Long(client) - self.short: MetricsTree_Distribution_UtxoCohorts_Term_Short = MetricsTree_Distribution_UtxoCohorts_Term_Short(client) - -class MetricsTree_Distribution_UtxoCohorts_Type: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.empty: _0satsPattern2 = _0satsPattern2(client, 'empty_outputs') - self.p2a: _0satsPattern2 = _0satsPattern2(client, 'p2a') - self.p2ms: _0satsPattern2 = _0satsPattern2(client, 'p2ms') - self.p2pk33: _0satsPattern2 = _0satsPattern2(client, 'p2pk33') - self.p2pk65: _0satsPattern2 = _0satsPattern2(client, 'p2pk65') - self.p2pkh: _0satsPattern2 = _0satsPattern2(client, 'p2pkh') - self.p2sh: _0satsPattern2 = _0satsPattern2(client, 'p2sh') - self.p2tr: _0satsPattern2 = _0satsPattern2(client, 'p2tr') - self.p2wpkh: _0satsPattern2 = _0satsPattern2(client, 'p2wpkh') - self.p2wsh: _0satsPattern2 = _0satsPattern2(client, 'p2wsh') - self.unknown: _0satsPattern2 = _0satsPattern2(client, 'unknown_outputs') - -class MetricsTree_Distribution_UtxoCohorts_Year: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self._2009: _0satsPattern2 = _0satsPattern2(client, 'year_2009') - self._2010: _0satsPattern2 = _0satsPattern2(client, 'year_2010') - self._2011: _0satsPattern2 = _0satsPattern2(client, 'year_2011') - self._2012: _0satsPattern2 = _0satsPattern2(client, 'year_2012') - self._2013: _0satsPattern2 = _0satsPattern2(client, 'year_2013') - self._2014: _0satsPattern2 = _0satsPattern2(client, 'year_2014') - self._2015: _0satsPattern2 = _0satsPattern2(client, 'year_2015') - self._2016: _0satsPattern2 = _0satsPattern2(client, 'year_2016') - self._2017: _0satsPattern2 = _0satsPattern2(client, 'year_2017') - self._2018: _0satsPattern2 = _0satsPattern2(client, 'year_2018') - self._2019: _0satsPattern2 = _0satsPattern2(client, 'year_2019') - self._2020: _0satsPattern2 = _0satsPattern2(client, 'year_2020') - self._2021: _0satsPattern2 = _0satsPattern2(client, 'year_2021') - self._2022: _0satsPattern2 = _0satsPattern2(client, 'year_2022') - self._2023: _0satsPattern2 = _0satsPattern2(client, 'year_2023') - self._2024: _0satsPattern2 = _0satsPattern2(client, 'year_2024') - self._2025: _0satsPattern2 = _0satsPattern2(client, 'year_2025') - self._2026: _0satsPattern2 = _0satsPattern2(client, 'year_2026') - -class MetricsTree_Distribution_UtxoCohorts: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.age_range: MetricsTree_Distribution_UtxoCohorts_AgeRange = MetricsTree_Distribution_UtxoCohorts_AgeRange(client) - self.all: MetricsTree_Distribution_UtxoCohorts_All = MetricsTree_Distribution_UtxoCohorts_All(client) - self.amount_range: MetricsTree_Distribution_UtxoCohorts_AmountRange = MetricsTree_Distribution_UtxoCohorts_AmountRange(client) - self.epoch: MetricsTree_Distribution_UtxoCohorts_Epoch = MetricsTree_Distribution_UtxoCohorts_Epoch(client) - self.ge_amount: MetricsTree_Distribution_UtxoCohorts_GeAmount = MetricsTree_Distribution_UtxoCohorts_GeAmount(client) - self.lt_amount: MetricsTree_Distribution_UtxoCohorts_LtAmount = MetricsTree_Distribution_UtxoCohorts_LtAmount(client) - self.max_age: MetricsTree_Distribution_UtxoCohorts_MaxAge = MetricsTree_Distribution_UtxoCohorts_MaxAge(client) - self.min_age: MetricsTree_Distribution_UtxoCohorts_MinAge = MetricsTree_Distribution_UtxoCohorts_MinAge(client) - self.term: MetricsTree_Distribution_UtxoCohorts_Term = MetricsTree_Distribution_UtxoCohorts_Term(client) - self.type_: MetricsTree_Distribution_UtxoCohorts_Type = MetricsTree_Distribution_UtxoCohorts_Type(client) - self.year: MetricsTree_Distribution_UtxoCohorts_Year = MetricsTree_Distribution_UtxoCohorts_Year(client) - -class MetricsTree_Distribution: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.addr_count: AddrCountPattern = AddrCountPattern(client, 'addr_count') - self.address_activity: MetricsTree_Distribution_AddressActivity = MetricsTree_Distribution_AddressActivity(client) - self.address_cohorts: MetricsTree_Distribution_AddressCohorts = MetricsTree_Distribution_AddressCohorts(client) - self.addresses_data: MetricsTree_Distribution_AddressesData = MetricsTree_Distribution_AddressesData(client) - self.any_address_indexes: MetricsTree_Distribution_AnyAddressIndexes = MetricsTree_Distribution_AnyAddressIndexes(client) - self.chain_state: MetricPattern11[SupplyState] = MetricPattern11(client, 'chain') - self.empty_addr_count: AddrCountPattern = AddrCountPattern(client, 'empty_addr_count') - self.emptyaddressindex: MetricPattern32[EmptyAddressIndex] = MetricPattern32(client, 'emptyaddressindex') - self.growth_rate: MetricsTree_Distribution_GrowthRate = MetricsTree_Distribution_GrowthRate(client) - self.loadedaddressindex: MetricPattern31[LoadedAddressIndex] = MetricPattern31(client, 'loadedaddressindex') - self.new_addr_count: MetricsTree_Distribution_NewAddrCount = MetricsTree_Distribution_NewAddrCount(client) - self.total_addr_count: AddrCountPattern = AddrCountPattern(client, 'total_addr_count') - self.utxo_cohorts: MetricsTree_Distribution_UtxoCohorts = MetricsTree_Distribution_UtxoCohorts(client) - -class MetricsTree_Indexes_Address_Empty: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.identity: MetricPattern9[EmptyOutputIndex] = MetricPattern9(client, 'emptyoutputindex') - -class MetricsTree_Indexes_Address_Opreturn: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.identity: MetricPattern14[OpReturnIndex] = MetricPattern14(client, 'opreturnindex') - -class MetricsTree_Indexes_Address_P2a: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.identity: MetricPattern16[P2AAddressIndex] = MetricPattern16(client, 'p2aaddressindex') - -class MetricsTree_Indexes_Address_P2ms: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.identity: MetricPattern17[P2MSOutputIndex] = MetricPattern17(client, 'p2msoutputindex') - class MetricsTree_Indexes_Address_P2pk33: """Metrics tree node.""" @@ -3266,20 +3102,40 @@ class MetricsTree_Indexes_Address_P2wsh: def __init__(self, client: BrkClientBase, base_path: str = ''): self.identity: MetricPattern24[P2WSHAddressIndex] = MetricPattern24(client, 'p2wshaddressindex') +class MetricsTree_Indexes_Address_P2a: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.identity: MetricPattern16[P2AAddressIndex] = MetricPattern16(client, 'p2aaddressindex') + +class MetricsTree_Indexes_Address_P2ms: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.identity: MetricPattern17[P2MSOutputIndex] = MetricPattern17(client, 'p2msoutputindex') + +class MetricsTree_Indexes_Address_Empty: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.identity: MetricPattern9[EmptyOutputIndex] = MetricPattern9(client, 'emptyoutputindex') + class MetricsTree_Indexes_Address_Unknown: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): self.identity: MetricPattern28[UnknownOutputIndex] = MetricPattern28(client, 'unknownoutputindex') +class MetricsTree_Indexes_Address_Opreturn: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.identity: MetricPattern14[OpReturnIndex] = MetricPattern14(client, 'opreturnindex') + class MetricsTree_Indexes_Address: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.empty: MetricsTree_Indexes_Address_Empty = MetricsTree_Indexes_Address_Empty(client) - self.opreturn: MetricsTree_Indexes_Address_Opreturn = MetricsTree_Indexes_Address_Opreturn(client) - self.p2a: MetricsTree_Indexes_Address_P2a = MetricsTree_Indexes_Address_P2a(client) - self.p2ms: MetricsTree_Indexes_Address_P2ms = MetricsTree_Indexes_Address_P2ms(client) self.p2pk33: MetricsTree_Indexes_Address_P2pk33 = MetricsTree_Indexes_Address_P2pk33(client) self.p2pk65: MetricsTree_Indexes_Address_P2pk65 = MetricsTree_Indexes_Address_P2pk65(client) self.p2pkh: MetricsTree_Indexes_Address_P2pkh = MetricsTree_Indexes_Address_P2pkh(client) @@ -3287,61 +3143,65 @@ class MetricsTree_Indexes_Address: self.p2tr: MetricsTree_Indexes_Address_P2tr = MetricsTree_Indexes_Address_P2tr(client) self.p2wpkh: MetricsTree_Indexes_Address_P2wpkh = MetricsTree_Indexes_Address_P2wpkh(client) self.p2wsh: MetricsTree_Indexes_Address_P2wsh = MetricsTree_Indexes_Address_P2wsh(client) + self.p2a: MetricsTree_Indexes_Address_P2a = MetricsTree_Indexes_Address_P2a(client) + self.p2ms: MetricsTree_Indexes_Address_P2ms = MetricsTree_Indexes_Address_P2ms(client) + self.empty: MetricsTree_Indexes_Address_Empty = MetricsTree_Indexes_Address_Empty(client) self.unknown: MetricsTree_Indexes_Address_Unknown = MetricsTree_Indexes_Address_Unknown(client) - -class MetricsTree_Indexes_Dateindex: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.date: MetricPattern6[Date] = MetricPattern6(client, 'date') - self.first_height: MetricPattern6[Height] = MetricPattern6(client, 'first_height') - self.height_count: MetricPattern6[StoredU64] = MetricPattern6(client, 'height_count') - self.identity: MetricPattern6[DateIndex] = MetricPattern6(client, 'dateindex') - self.monthindex: MetricPattern6[MonthIndex] = MetricPattern6(client, 'monthindex') - self.weekindex: MetricPattern6[WeekIndex] = MetricPattern6(client, 'weekindex') - -class MetricsTree_Indexes_Decadeindex: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.date: MetricPattern7[Date] = MetricPattern7(client, 'date') - self.first_yearindex: MetricPattern7[YearIndex] = MetricPattern7(client, 'first_yearindex') - self.identity: MetricPattern7[DecadeIndex] = MetricPattern7(client, 'decadeindex') - self.yearindex_count: MetricPattern7[StoredU64] = MetricPattern7(client, 'yearindex_count') - -class MetricsTree_Indexes_Difficultyepoch: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.first_height: MetricPattern8[Height] = MetricPattern8(client, 'first_height') - self.height_count: MetricPattern8[StoredU64] = MetricPattern8(client, 'height_count') - self.identity: MetricPattern8[DifficultyEpoch] = MetricPattern8(client, 'difficultyepoch') - -class MetricsTree_Indexes_Halvingepoch: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.first_height: MetricPattern10[Height] = MetricPattern10(client, 'first_height') - self.identity: MetricPattern10[HalvingEpoch] = MetricPattern10(client, 'halvingepoch') + self.opreturn: MetricsTree_Indexes_Address_Opreturn = MetricsTree_Indexes_Address_Opreturn(client) class MetricsTree_Indexes_Height: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): + self.identity: MetricPattern11[Height] = MetricPattern11(client, 'height') self.dateindex: MetricPattern11[DateIndex] = MetricPattern11(client, 'dateindex') self.difficultyepoch: MetricPattern11[DifficultyEpoch] = MetricPattern11(client, 'difficultyepoch') self.halvingepoch: MetricPattern11[HalvingEpoch] = MetricPattern11(client, 'halvingepoch') - self.identity: MetricPattern11[Height] = MetricPattern11(client, 'height') self.txindex_count: MetricPattern11[StoredU64] = MetricPattern11(client, 'txindex_count') +class MetricsTree_Indexes_Difficultyepoch: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.identity: MetricPattern8[DifficultyEpoch] = MetricPattern8(client, 'difficultyepoch') + self.first_height: MetricPattern8[Height] = MetricPattern8(client, 'first_height') + self.height_count: MetricPattern8[StoredU64] = MetricPattern8(client, 'height_count') + +class MetricsTree_Indexes_Halvingepoch: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.identity: MetricPattern10[HalvingEpoch] = MetricPattern10(client, 'halvingepoch') + self.first_height: MetricPattern10[Height] = MetricPattern10(client, 'first_height') + +class MetricsTree_Indexes_Dateindex: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.identity: MetricPattern6[DateIndex] = MetricPattern6(client, 'dateindex') + self.date: MetricPattern6[Date] = MetricPattern6(client, 'date') + self.first_height: MetricPattern6[Height] = MetricPattern6(client, 'first_height') + self.height_count: MetricPattern6[StoredU64] = MetricPattern6(client, 'height_count') + self.weekindex: MetricPattern6[WeekIndex] = MetricPattern6(client, 'weekindex') + self.monthindex: MetricPattern6[MonthIndex] = MetricPattern6(client, 'monthindex') + +class MetricsTree_Indexes_Weekindex: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.identity: MetricPattern29[WeekIndex] = MetricPattern29(client, 'weekindex') + self.date: MetricPattern29[Date] = MetricPattern29(client, 'date') + self.first_dateindex: MetricPattern29[DateIndex] = MetricPattern29(client, 'first_dateindex') + self.dateindex_count: MetricPattern29[StoredU64] = MetricPattern29(client, 'dateindex_count') + class MetricsTree_Indexes_Monthindex: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.date: MetricPattern13[Date] = MetricPattern13(client, 'date') - self.dateindex_count: MetricPattern13[StoredU64] = MetricPattern13(client, 'dateindex_count') - self.first_dateindex: MetricPattern13[DateIndex] = MetricPattern13(client, 'first_dateindex') self.identity: MetricPattern13[MonthIndex] = MetricPattern13(client, 'monthindex') + self.date: MetricPattern13[Date] = MetricPattern13(client, 'date') + self.first_dateindex: MetricPattern13[DateIndex] = MetricPattern13(client, 'first_dateindex') + self.dateindex_count: MetricPattern13[StoredU64] = MetricPattern13(client, 'dateindex_count') self.quarterindex: MetricPattern13[QuarterIndex] = MetricPattern13(client, 'quarterindex') self.semesterindex: MetricPattern13[SemesterIndex] = MetricPattern13(client, 'semesterindex') self.yearindex: MetricPattern13[YearIndex] = MetricPattern13(client, 'yearindex') @@ -3350,20 +3210,39 @@ class MetricsTree_Indexes_Quarterindex: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): + self.identity: MetricPattern25[QuarterIndex] = MetricPattern25(client, 'quarterindex') self.date: MetricPattern25[Date] = MetricPattern25(client, 'date') self.first_monthindex: MetricPattern25[MonthIndex] = MetricPattern25(client, 'first_monthindex') - self.identity: MetricPattern25[QuarterIndex] = MetricPattern25(client, 'quarterindex') self.monthindex_count: MetricPattern25[StoredU64] = MetricPattern25(client, 'monthindex_count') class MetricsTree_Indexes_Semesterindex: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): + self.identity: MetricPattern26[SemesterIndex] = MetricPattern26(client, 'semesterindex') self.date: MetricPattern26[Date] = MetricPattern26(client, 'date') self.first_monthindex: MetricPattern26[MonthIndex] = MetricPattern26(client, 'first_monthindex') - self.identity: MetricPattern26[SemesterIndex] = MetricPattern26(client, 'semesterindex') self.monthindex_count: MetricPattern26[StoredU64] = MetricPattern26(client, 'monthindex_count') +class MetricsTree_Indexes_Yearindex: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.identity: MetricPattern30[YearIndex] = MetricPattern30(client, 'yearindex') + self.date: MetricPattern30[Date] = MetricPattern30(client, 'date') + self.first_monthindex: MetricPattern30[MonthIndex] = MetricPattern30(client, 'first_monthindex') + self.monthindex_count: MetricPattern30[StoredU64] = MetricPattern30(client, 'monthindex_count') + self.decadeindex: MetricPattern30[DecadeIndex] = MetricPattern30(client, 'decadeindex') + +class MetricsTree_Indexes_Decadeindex: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.identity: MetricPattern7[DecadeIndex] = MetricPattern7(client, 'decadeindex') + self.date: MetricPattern7[Date] = MetricPattern7(client, 'date') + self.first_yearindex: MetricPattern7[YearIndex] = MetricPattern7(client, 'first_yearindex') + self.yearindex_count: MetricPattern7[StoredU64] = MetricPattern7(client, 'yearindex_count') + class MetricsTree_Indexes_Txindex: """Metrics tree node.""" @@ -3384,107 +3263,206 @@ class MetricsTree_Indexes_Txoutindex: def __init__(self, client: BrkClientBase, base_path: str = ''): self.identity: MetricPattern15[TxOutIndex] = MetricPattern15(client, 'txoutindex') -class MetricsTree_Indexes_Weekindex: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.date: MetricPattern29[Date] = MetricPattern29(client, 'date') - self.dateindex_count: MetricPattern29[StoredU64] = MetricPattern29(client, 'dateindex_count') - self.first_dateindex: MetricPattern29[DateIndex] = MetricPattern29(client, 'first_dateindex') - self.identity: MetricPattern29[WeekIndex] = MetricPattern29(client, 'weekindex') - -class MetricsTree_Indexes_Yearindex: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.date: MetricPattern30[Date] = MetricPattern30(client, 'date') - self.decadeindex: MetricPattern30[DecadeIndex] = MetricPattern30(client, 'decadeindex') - self.first_monthindex: MetricPattern30[MonthIndex] = MetricPattern30(client, 'first_monthindex') - self.identity: MetricPattern30[YearIndex] = MetricPattern30(client, 'yearindex') - self.monthindex_count: MetricPattern30[StoredU64] = MetricPattern30(client, 'monthindex_count') - class MetricsTree_Indexes: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): self.address: MetricsTree_Indexes_Address = MetricsTree_Indexes_Address(client) - self.dateindex: MetricsTree_Indexes_Dateindex = MetricsTree_Indexes_Dateindex(client) - self.decadeindex: MetricsTree_Indexes_Decadeindex = MetricsTree_Indexes_Decadeindex(client) + self.height: MetricsTree_Indexes_Height = MetricsTree_Indexes_Height(client) self.difficultyepoch: MetricsTree_Indexes_Difficultyepoch = MetricsTree_Indexes_Difficultyepoch(client) self.halvingepoch: MetricsTree_Indexes_Halvingepoch = MetricsTree_Indexes_Halvingepoch(client) - self.height: MetricsTree_Indexes_Height = MetricsTree_Indexes_Height(client) + self.dateindex: MetricsTree_Indexes_Dateindex = MetricsTree_Indexes_Dateindex(client) + self.weekindex: MetricsTree_Indexes_Weekindex = MetricsTree_Indexes_Weekindex(client) self.monthindex: MetricsTree_Indexes_Monthindex = MetricsTree_Indexes_Monthindex(client) self.quarterindex: MetricsTree_Indexes_Quarterindex = MetricsTree_Indexes_Quarterindex(client) self.semesterindex: MetricsTree_Indexes_Semesterindex = MetricsTree_Indexes_Semesterindex(client) + self.yearindex: MetricsTree_Indexes_Yearindex = MetricsTree_Indexes_Yearindex(client) + self.decadeindex: MetricsTree_Indexes_Decadeindex = MetricsTree_Indexes_Decadeindex(client) self.txindex: MetricsTree_Indexes_Txindex = MetricsTree_Indexes_Txindex(client) self.txinindex: MetricsTree_Indexes_Txinindex = MetricsTree_Indexes_Txinindex(client) self.txoutindex: MetricsTree_Indexes_Txoutindex = MetricsTree_Indexes_Txoutindex(client) - self.weekindex: MetricsTree_Indexes_Weekindex = MetricsTree_Indexes_Weekindex(client) - self.yearindex: MetricsTree_Indexes_Yearindex = MetricsTree_Indexes_Yearindex(client) - -class MetricsTree_Inputs_Spent: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.txoutindex: MetricPattern12[TxOutIndex] = MetricPattern12(client, 'txoutindex') - self.value: MetricPattern12[Sats] = MetricPattern12(client, 'value') - -class MetricsTree_Inputs: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.count: CountPattern2[StoredU64] = CountPattern2(client, 'input_count') - self.first_txinindex: MetricPattern11[TxInIndex] = MetricPattern11(client, 'first_txinindex') - self.outpoint: MetricPattern12[OutPoint] = MetricPattern12(client, 'outpoint') - self.outputtype: MetricPattern12[OutputType] = MetricPattern12(client, 'outputtype') - self.spent: MetricsTree_Inputs_Spent = MetricsTree_Inputs_Spent(client) - self.txindex: MetricPattern12[TxIndex] = MetricPattern12(client, 'txindex') - self.typeindex: MetricPattern12[TypeIndex] = MetricPattern12(client, 'typeindex') class MetricsTree_Market_Ath: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): + self.price_ath: DollarsSatsPattern = DollarsSatsPattern(client, 'price_ath') + self.price_drawdown: MetricPattern3[StoredF32] = MetricPattern3(client, 'price_drawdown') self.days_since_price_ath: MetricPattern4[StoredU16] = MetricPattern4(client, 'days_since_price_ath') + self.years_since_price_ath: MetricPattern4[StoredF32] = MetricPattern4(client, 'years_since_price_ath') self.max_days_between_price_aths: MetricPattern4[StoredU16] = MetricPattern4(client, 'max_days_between_price_aths') self.max_years_between_price_aths: MetricPattern4[StoredF32] = MetricPattern4(client, 'max_years_between_price_aths') - self.price_ath: ActivePricePattern = ActivePricePattern(client, 'price_ath') - self.price_drawdown: MetricPattern3[StoredF32] = MetricPattern3(client, 'price_drawdown') - self.years_since_price_ath: MetricPattern4[StoredF32] = MetricPattern4(client, 'years_since_price_ath') + +class MetricsTree_Market_Lookback: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._1d: DollarsSatsPattern2 = DollarsSatsPattern2(client, 'price_1d_ago') + self._1w: DollarsSatsPattern2 = DollarsSatsPattern2(client, 'price_1w_ago') + self._1m: DollarsSatsPattern2 = DollarsSatsPattern2(client, 'price_1m_ago') + self._3m: DollarsSatsPattern2 = DollarsSatsPattern2(client, 'price_3m_ago') + self._6m: DollarsSatsPattern2 = DollarsSatsPattern2(client, 'price_6m_ago') + self._1y: DollarsSatsPattern2 = DollarsSatsPattern2(client, 'price_1y_ago') + self._2y: DollarsSatsPattern2 = DollarsSatsPattern2(client, 'price_2y_ago') + self._3y: DollarsSatsPattern2 = DollarsSatsPattern2(client, 'price_3y_ago') + self._4y: DollarsSatsPattern2 = DollarsSatsPattern2(client, 'price_4y_ago') + self._5y: DollarsSatsPattern2 = DollarsSatsPattern2(client, 'price_5y_ago') + self._6y: DollarsSatsPattern2 = DollarsSatsPattern2(client, 'price_6y_ago') + self._8y: DollarsSatsPattern2 = DollarsSatsPattern2(client, 'price_8y_ago') + self._10y: DollarsSatsPattern2 = DollarsSatsPattern2(client, 'price_10y_ago') + +class MetricsTree_Market_Returns_PriceReturns: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._1d: MetricPattern4[StoredF32] = MetricPattern4(client, '1d_price_returns') + self._1w: MetricPattern4[StoredF32] = MetricPattern4(client, '1w_price_returns') + self._1m: MetricPattern4[StoredF32] = MetricPattern4(client, '1m_price_returns') + self._3m: MetricPattern4[StoredF32] = MetricPattern4(client, '3m_price_returns') + self._6m: MetricPattern4[StoredF32] = MetricPattern4(client, '6m_price_returns') + self._1y: MetricPattern4[StoredF32] = MetricPattern4(client, '1y_price_returns') + self._2y: MetricPattern4[StoredF32] = MetricPattern4(client, '2y_price_returns') + self._3y: MetricPattern4[StoredF32] = MetricPattern4(client, '3y_price_returns') + self._4y: MetricPattern4[StoredF32] = MetricPattern4(client, '4y_price_returns') + self._5y: MetricPattern4[StoredF32] = MetricPattern4(client, '5y_price_returns') + self._6y: MetricPattern4[StoredF32] = MetricPattern4(client, '6y_price_returns') + self._8y: MetricPattern4[StoredF32] = MetricPattern4(client, '8y_price_returns') + self._10y: MetricPattern4[StoredF32] = MetricPattern4(client, '10y_price_returns') + +class MetricsTree_Market_Returns: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.price_returns: MetricsTree_Market_Returns_PriceReturns = MetricsTree_Market_Returns_PriceReturns(client) + self.cagr: _10y2y3y4y5y6y8yPattern = _10y2y3y4y5y6y8yPattern(client, 'cagr') + self._1d_returns_1w_sd: SdSmaPattern = SdSmaPattern(client, '1d_returns_1w_sd') + self._1d_returns_1m_sd: SdSmaPattern = SdSmaPattern(client, '1d_returns_1m_sd') + self._1d_returns_1y_sd: SdSmaPattern = SdSmaPattern(client, '1d_returns_1y_sd') + self.downside_returns: MetricPattern6[StoredF32] = MetricPattern6(client, 'downside_returns') + self.downside_1w_sd: SdSmaPattern = SdSmaPattern(client, 'downside_1w_sd') + self.downside_1m_sd: SdSmaPattern = SdSmaPattern(client, 'downside_1m_sd') + self.downside_1y_sd: SdSmaPattern = SdSmaPattern(client, 'downside_1y_sd') + +class MetricsTree_Market_Volatility: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.price_1w_volatility: MetricPattern4[StoredF32] = MetricPattern4(client, 'price_1w_volatility') + self.price_1m_volatility: MetricPattern4[StoredF32] = MetricPattern4(client, 'price_1m_volatility') + self.price_1y_volatility: MetricPattern4[StoredF32] = MetricPattern4(client, 'price_1y_volatility') + self.sharpe_1w: MetricPattern6[StoredF32] = MetricPattern6(client, 'sharpe_1w') + self.sharpe_1m: MetricPattern6[StoredF32] = MetricPattern6(client, 'sharpe_1m') + self.sharpe_1y: MetricPattern6[StoredF32] = MetricPattern6(client, 'sharpe_1y') + self.sortino_1w: MetricPattern6[StoredF32] = MetricPattern6(client, 'sortino_1w') + self.sortino_1m: MetricPattern6[StoredF32] = MetricPattern6(client, 'sortino_1m') + self.sortino_1y: MetricPattern6[StoredF32] = MetricPattern6(client, 'sortino_1y') + +class MetricsTree_Market_Range: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.price_1w_min: DollarsSatsPattern2 = DollarsSatsPattern2(client, 'price_1w_min') + self.price_1w_max: DollarsSatsPattern2 = DollarsSatsPattern2(client, 'price_1w_max') + self.price_2w_min: DollarsSatsPattern2 = DollarsSatsPattern2(client, 'price_2w_min') + self.price_2w_max: DollarsSatsPattern2 = DollarsSatsPattern2(client, 'price_2w_max') + self.price_1m_min: DollarsSatsPattern2 = DollarsSatsPattern2(client, 'price_1m_min') + self.price_1m_max: DollarsSatsPattern2 = DollarsSatsPattern2(client, 'price_1m_max') + self.price_1y_min: DollarsSatsPattern2 = DollarsSatsPattern2(client, 'price_1y_min') + self.price_1y_max: DollarsSatsPattern2 = DollarsSatsPattern2(client, 'price_1y_max') + self.price_true_range: MetricPattern6[StoredF32] = MetricPattern6(client, 'price_true_range') + self.price_true_range_2w_sum: MetricPattern6[StoredF32] = MetricPattern6(client, 'price_true_range_2w_sum') + self.price_2w_choppiness_index: MetricPattern4[StoredF32] = MetricPattern4(client, 'price_2w_choppiness_index') + +class MetricsTree_Market_MovingAverage: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.price_1w_sma: PriceRatioPattern = PriceRatioPattern(client, 'price_1w_sma') + self.price_8d_sma: PriceRatioPattern = PriceRatioPattern(client, 'price_8d_sma') + self.price_13d_sma: PriceRatioPattern = PriceRatioPattern(client, 'price_13d_sma') + self.price_21d_sma: PriceRatioPattern = PriceRatioPattern(client, 'price_21d_sma') + self.price_1m_sma: PriceRatioPattern = PriceRatioPattern(client, 'price_1m_sma') + self.price_34d_sma: PriceRatioPattern = PriceRatioPattern(client, 'price_34d_sma') + self.price_55d_sma: PriceRatioPattern = PriceRatioPattern(client, 'price_55d_sma') + self.price_89d_sma: PriceRatioPattern = PriceRatioPattern(client, 'price_89d_sma') + self.price_111d_sma: PriceRatioPattern = PriceRatioPattern(client, 'price_111d_sma') + self.price_144d_sma: PriceRatioPattern = PriceRatioPattern(client, 'price_144d_sma') + self.price_200d_sma: PriceRatioPattern = PriceRatioPattern(client, 'price_200d_sma') + self.price_350d_sma: PriceRatioPattern = PriceRatioPattern(client, 'price_350d_sma') + self.price_1y_sma: PriceRatioPattern = PriceRatioPattern(client, 'price_1y_sma') + self.price_2y_sma: PriceRatioPattern = PriceRatioPattern(client, 'price_2y_sma') + self.price_200w_sma: PriceRatioPattern = PriceRatioPattern(client, 'price_200w_sma') + self.price_4y_sma: PriceRatioPattern = PriceRatioPattern(client, 'price_4y_sma') + self.price_1w_ema: PriceRatioPattern = PriceRatioPattern(client, 'price_1w_ema') + self.price_8d_ema: PriceRatioPattern = PriceRatioPattern(client, 'price_8d_ema') + self.price_12d_ema: PriceRatioPattern = PriceRatioPattern(client, 'price_12d_ema') + self.price_13d_ema: PriceRatioPattern = PriceRatioPattern(client, 'price_13d_ema') + self.price_21d_ema: PriceRatioPattern = PriceRatioPattern(client, 'price_21d_ema') + self.price_26d_ema: PriceRatioPattern = PriceRatioPattern(client, 'price_26d_ema') + self.price_1m_ema: PriceRatioPattern = PriceRatioPattern(client, 'price_1m_ema') + self.price_34d_ema: PriceRatioPattern = PriceRatioPattern(client, 'price_34d_ema') + self.price_55d_ema: PriceRatioPattern = PriceRatioPattern(client, 'price_55d_ema') + self.price_89d_ema: PriceRatioPattern = PriceRatioPattern(client, 'price_89d_ema') + self.price_144d_ema: PriceRatioPattern = PriceRatioPattern(client, 'price_144d_ema') + self.price_200d_ema: PriceRatioPattern = PriceRatioPattern(client, 'price_200d_ema') + self.price_1y_ema: PriceRatioPattern = PriceRatioPattern(client, 'price_1y_ema') + self.price_2y_ema: PriceRatioPattern = PriceRatioPattern(client, 'price_2y_ema') + self.price_200w_ema: PriceRatioPattern = PriceRatioPattern(client, 'price_200w_ema') + self.price_4y_ema: PriceRatioPattern = PriceRatioPattern(client, 'price_4y_ema') + self.price_200d_sma_x2_4: DollarsSatsPattern2 = DollarsSatsPattern2(client, 'price_200d_sma_x2_4') + self.price_200d_sma_x0_8: DollarsSatsPattern2 = DollarsSatsPattern2(client, 'price_200d_sma_x0_8') + self.price_350d_sma_x2: DollarsSatsPattern2 = DollarsSatsPattern2(client, 'price_350d_sma_x2') + +class MetricsTree_Market_Dca_PeriodAveragePrice: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._1w: DollarsSatsPattern2 = DollarsSatsPattern2(client, '1w_dca_average_price') + self._1m: DollarsSatsPattern2 = DollarsSatsPattern2(client, '1m_dca_average_price') + self._3m: DollarsSatsPattern2 = DollarsSatsPattern2(client, '3m_dca_average_price') + self._6m: DollarsSatsPattern2 = DollarsSatsPattern2(client, '6m_dca_average_price') + self._1y: DollarsSatsPattern2 = DollarsSatsPattern2(client, '1y_dca_average_price') + self._2y: DollarsSatsPattern2 = DollarsSatsPattern2(client, '2y_dca_average_price') + self._3y: DollarsSatsPattern2 = DollarsSatsPattern2(client, '3y_dca_average_price') + self._4y: DollarsSatsPattern2 = DollarsSatsPattern2(client, '4y_dca_average_price') + self._5y: DollarsSatsPattern2 = DollarsSatsPattern2(client, '5y_dca_average_price') + self._6y: DollarsSatsPattern2 = DollarsSatsPattern2(client, '6y_dca_average_price') + self._8y: DollarsSatsPattern2 = DollarsSatsPattern2(client, '8y_dca_average_price') + self._10y: DollarsSatsPattern2 = DollarsSatsPattern2(client, '10y_dca_average_price') + +class MetricsTree_Market_Dca_ClassStack: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._2015: BitcoinDollarsSatsPattern5 = BitcoinDollarsSatsPattern5(client, 'dca_class_2015_stack') + self._2016: BitcoinDollarsSatsPattern5 = BitcoinDollarsSatsPattern5(client, 'dca_class_2016_stack') + self._2017: BitcoinDollarsSatsPattern5 = BitcoinDollarsSatsPattern5(client, 'dca_class_2017_stack') + self._2018: BitcoinDollarsSatsPattern5 = BitcoinDollarsSatsPattern5(client, 'dca_class_2018_stack') + self._2019: BitcoinDollarsSatsPattern5 = BitcoinDollarsSatsPattern5(client, 'dca_class_2019_stack') + self._2020: BitcoinDollarsSatsPattern5 = BitcoinDollarsSatsPattern5(client, 'dca_class_2020_stack') + self._2021: BitcoinDollarsSatsPattern5 = BitcoinDollarsSatsPattern5(client, 'dca_class_2021_stack') + self._2022: BitcoinDollarsSatsPattern5 = BitcoinDollarsSatsPattern5(client, 'dca_class_2022_stack') + self._2023: BitcoinDollarsSatsPattern5 = BitcoinDollarsSatsPattern5(client, 'dca_class_2023_stack') + self._2024: BitcoinDollarsSatsPattern5 = BitcoinDollarsSatsPattern5(client, 'dca_class_2024_stack') + self._2025: BitcoinDollarsSatsPattern5 = BitcoinDollarsSatsPattern5(client, 'dca_class_2025_stack') + self._2026: BitcoinDollarsSatsPattern5 = BitcoinDollarsSatsPattern5(client, 'dca_class_2026_stack') class MetricsTree_Market_Dca_ClassAveragePrice: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self._2015: _0sdUsdPattern = _0sdUsdPattern(client, 'dca_class_2015_average_price') - self._2016: _0sdUsdPattern = _0sdUsdPattern(client, 'dca_class_2016_average_price') - self._2017: _0sdUsdPattern = _0sdUsdPattern(client, 'dca_class_2017_average_price') - self._2018: _0sdUsdPattern = _0sdUsdPattern(client, 'dca_class_2018_average_price') - self._2019: _0sdUsdPattern = _0sdUsdPattern(client, 'dca_class_2019_average_price') - self._2020: _0sdUsdPattern = _0sdUsdPattern(client, 'dca_class_2020_average_price') - self._2021: _0sdUsdPattern = _0sdUsdPattern(client, 'dca_class_2021_average_price') - self._2022: _0sdUsdPattern = _0sdUsdPattern(client, 'dca_class_2022_average_price') - self._2023: _0sdUsdPattern = _0sdUsdPattern(client, 'dca_class_2023_average_price') - self._2024: _0sdUsdPattern = _0sdUsdPattern(client, 'dca_class_2024_average_price') - self._2025: _0sdUsdPattern = _0sdUsdPattern(client, 'dca_class_2025_average_price') - self._2026: _0sdUsdPattern = _0sdUsdPattern(client, 'dca_class_2026_average_price') - -class MetricsTree_Market_Dca_ClassDaysInLoss: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self._2015: MetricPattern4[StoredU32] = MetricPattern4(client, 'dca_class_2015_days_in_loss') - self._2016: MetricPattern4[StoredU32] = MetricPattern4(client, 'dca_class_2016_days_in_loss') - self._2017: MetricPattern4[StoredU32] = MetricPattern4(client, 'dca_class_2017_days_in_loss') - self._2018: MetricPattern4[StoredU32] = MetricPattern4(client, 'dca_class_2018_days_in_loss') - self._2019: MetricPattern4[StoredU32] = MetricPattern4(client, 'dca_class_2019_days_in_loss') - self._2020: MetricPattern4[StoredU32] = MetricPattern4(client, 'dca_class_2020_days_in_loss') - self._2021: MetricPattern4[StoredU32] = MetricPattern4(client, 'dca_class_2021_days_in_loss') - self._2022: MetricPattern4[StoredU32] = MetricPattern4(client, 'dca_class_2022_days_in_loss') - self._2023: MetricPattern4[StoredU32] = MetricPattern4(client, 'dca_class_2023_days_in_loss') - self._2024: MetricPattern4[StoredU32] = MetricPattern4(client, 'dca_class_2024_days_in_loss') - self._2025: MetricPattern4[StoredU32] = MetricPattern4(client, 'dca_class_2025_days_in_loss') - self._2026: MetricPattern4[StoredU32] = MetricPattern4(client, 'dca_class_2026_days_in_loss') + self._2015: DollarsSatsPattern2 = DollarsSatsPattern2(client, 'dca_class_2015_average_price') + self._2016: DollarsSatsPattern2 = DollarsSatsPattern2(client, 'dca_class_2016_average_price') + self._2017: DollarsSatsPattern2 = DollarsSatsPattern2(client, 'dca_class_2017_average_price') + self._2018: DollarsSatsPattern2 = DollarsSatsPattern2(client, 'dca_class_2018_average_price') + self._2019: DollarsSatsPattern2 = DollarsSatsPattern2(client, 'dca_class_2019_average_price') + self._2020: DollarsSatsPattern2 = DollarsSatsPattern2(client, 'dca_class_2020_average_price') + self._2021: DollarsSatsPattern2 = DollarsSatsPattern2(client, 'dca_class_2021_average_price') + self._2022: DollarsSatsPattern2 = DollarsSatsPattern2(client, 'dca_class_2022_average_price') + self._2023: DollarsSatsPattern2 = DollarsSatsPattern2(client, 'dca_class_2023_average_price') + self._2024: DollarsSatsPattern2 = DollarsSatsPattern2(client, 'dca_class_2024_average_price') + self._2025: DollarsSatsPattern2 = DollarsSatsPattern2(client, 'dca_class_2025_average_price') + self._2026: DollarsSatsPattern2 = DollarsSatsPattern2(client, 'dca_class_2026_average_price') class MetricsTree_Market_Dca_ClassDaysInProfit: """Metrics tree node.""" @@ -3503,6 +3481,23 @@ class MetricsTree_Market_Dca_ClassDaysInProfit: self._2025: MetricPattern4[StoredU32] = MetricPattern4(client, 'dca_class_2025_days_in_profit') self._2026: MetricPattern4[StoredU32] = MetricPattern4(client, 'dca_class_2026_days_in_profit') +class MetricsTree_Market_Dca_ClassDaysInLoss: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._2015: MetricPattern4[StoredU32] = MetricPattern4(client, 'dca_class_2015_days_in_loss') + self._2016: MetricPattern4[StoredU32] = MetricPattern4(client, 'dca_class_2016_days_in_loss') + self._2017: MetricPattern4[StoredU32] = MetricPattern4(client, 'dca_class_2017_days_in_loss') + self._2018: MetricPattern4[StoredU32] = MetricPattern4(client, 'dca_class_2018_days_in_loss') + self._2019: MetricPattern4[StoredU32] = MetricPattern4(client, 'dca_class_2019_days_in_loss') + self._2020: MetricPattern4[StoredU32] = MetricPattern4(client, 'dca_class_2020_days_in_loss') + self._2021: MetricPattern4[StoredU32] = MetricPattern4(client, 'dca_class_2021_days_in_loss') + self._2022: MetricPattern4[StoredU32] = MetricPattern4(client, 'dca_class_2022_days_in_loss') + self._2023: MetricPattern4[StoredU32] = MetricPattern4(client, 'dca_class_2023_days_in_loss') + self._2024: MetricPattern4[StoredU32] = MetricPattern4(client, 'dca_class_2024_days_in_loss') + self._2025: MetricPattern4[StoredU32] = MetricPattern4(client, 'dca_class_2025_days_in_loss') + self._2026: MetricPattern4[StoredU32] = MetricPattern4(client, 'dca_class_2026_days_in_loss') + class MetricsTree_Market_Dca_ClassMaxDrawdown: """Metrics tree node.""" @@ -3537,410 +3532,231 @@ class MetricsTree_Market_Dca_ClassMaxReturn: self._2025: MetricPattern4[StoredF32] = MetricPattern4(client, 'dca_class_2025_max_return') self._2026: MetricPattern4[StoredF32] = MetricPattern4(client, 'dca_class_2026_max_return') -class MetricsTree_Market_Dca_ClassStack: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self._2015: _2015Pattern = _2015Pattern(client, 'dca_class_2015_stack') - self._2016: _2015Pattern = _2015Pattern(client, 'dca_class_2016_stack') - self._2017: _2015Pattern = _2015Pattern(client, 'dca_class_2017_stack') - self._2018: _2015Pattern = _2015Pattern(client, 'dca_class_2018_stack') - self._2019: _2015Pattern = _2015Pattern(client, 'dca_class_2019_stack') - self._2020: _2015Pattern = _2015Pattern(client, 'dca_class_2020_stack') - self._2021: _2015Pattern = _2015Pattern(client, 'dca_class_2021_stack') - self._2022: _2015Pattern = _2015Pattern(client, 'dca_class_2022_stack') - self._2023: _2015Pattern = _2015Pattern(client, 'dca_class_2023_stack') - self._2024: _2015Pattern = _2015Pattern(client, 'dca_class_2024_stack') - self._2025: _2015Pattern = _2015Pattern(client, 'dca_class_2025_stack') - self._2026: _2015Pattern = _2015Pattern(client, 'dca_class_2026_stack') - -class MetricsTree_Market_Dca_PeriodAveragePrice: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self._10y: _0sdUsdPattern = _0sdUsdPattern(client, '10y_dca_average_price') - self._1m: _0sdUsdPattern = _0sdUsdPattern(client, '1m_dca_average_price') - self._1w: _0sdUsdPattern = _0sdUsdPattern(client, '1w_dca_average_price') - self._1y: _0sdUsdPattern = _0sdUsdPattern(client, '1y_dca_average_price') - self._2y: _0sdUsdPattern = _0sdUsdPattern(client, '2y_dca_average_price') - self._3m: _0sdUsdPattern = _0sdUsdPattern(client, '3m_dca_average_price') - self._3y: _0sdUsdPattern = _0sdUsdPattern(client, '3y_dca_average_price') - self._4y: _0sdUsdPattern = _0sdUsdPattern(client, '4y_dca_average_price') - self._5y: _0sdUsdPattern = _0sdUsdPattern(client, '5y_dca_average_price') - self._6m: _0sdUsdPattern = _0sdUsdPattern(client, '6m_dca_average_price') - self._6y: _0sdUsdPattern = _0sdUsdPattern(client, '6y_dca_average_price') - self._8y: _0sdUsdPattern = _0sdUsdPattern(client, '8y_dca_average_price') - class MetricsTree_Market_Dca: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): + self.period_stack: _10y1m1w1y2y3m3y4y5y6m6y8yPattern3 = _10y1m1w1y2y3m3y4y5y6m6y8yPattern3(client, 'dca_stack') + self.period_average_price: MetricsTree_Market_Dca_PeriodAveragePrice = MetricsTree_Market_Dca_PeriodAveragePrice(client) + self.period_returns: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2[StoredF32] = _10y1m1w1y2y3m3y4y5y6m6y8yPattern2(client, 'dca_returns') + self.period_cagr: _10y2y3y4y5y6y8yPattern = _10y2y3y4y5y6y8yPattern(client, 'dca_cagr') + self.period_days_in_profit: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2[StoredU32] = _10y1m1w1y2y3m3y4y5y6m6y8yPattern2(client, 'dca_days_in_profit') + self.period_days_in_loss: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2[StoredU32] = _10y1m1w1y2y3m3y4y5y6m6y8yPattern2(client, 'dca_days_in_loss') + self.period_max_drawdown: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2[StoredF32] = _10y1m1w1y2y3m3y4y5y6m6y8yPattern2(client, 'dca_max_drawdown') + self.period_max_return: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2[StoredF32] = _10y1m1w1y2y3m3y4y5y6m6y8yPattern2(client, 'dca_max_return') + self.period_lump_sum_stack: _10y1m1w1y2y3m3y4y5y6m6y8yPattern3 = _10y1m1w1y2y3m3y4y5y6m6y8yPattern3(client, 'lump_sum_stack') + self.period_lump_sum_returns: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2[StoredF32] = _10y1m1w1y2y3m3y4y5y6m6y8yPattern2(client, 'lump_sum_returns') + self.period_lump_sum_days_in_profit: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2[StoredU32] = _10y1m1w1y2y3m3y4y5y6m6y8yPattern2(client, 'lump_sum_days_in_profit') + self.period_lump_sum_days_in_loss: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2[StoredU32] = _10y1m1w1y2y3m3y4y5y6m6y8yPattern2(client, 'lump_sum_days_in_loss') + self.period_lump_sum_max_drawdown: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2[StoredF32] = _10y1m1w1y2y3m3y4y5y6m6y8yPattern2(client, 'lump_sum_max_drawdown') + self.period_lump_sum_max_return: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2[StoredF32] = _10y1m1w1y2y3m3y4y5y6m6y8yPattern2(client, 'lump_sum_max_return') + self.class_stack: MetricsTree_Market_Dca_ClassStack = MetricsTree_Market_Dca_ClassStack(client) self.class_average_price: MetricsTree_Market_Dca_ClassAveragePrice = MetricsTree_Market_Dca_ClassAveragePrice(client) - self.class_days_in_loss: MetricsTree_Market_Dca_ClassDaysInLoss = MetricsTree_Market_Dca_ClassDaysInLoss(client) + self.class_returns: _201520162017201820192020202120222023202420252026Pattern2[StoredF32] = _201520162017201820192020202120222023202420252026Pattern2(client, 'dca_class') self.class_days_in_profit: MetricsTree_Market_Dca_ClassDaysInProfit = MetricsTree_Market_Dca_ClassDaysInProfit(client) + self.class_days_in_loss: MetricsTree_Market_Dca_ClassDaysInLoss = MetricsTree_Market_Dca_ClassDaysInLoss(client) self.class_max_drawdown: MetricsTree_Market_Dca_ClassMaxDrawdown = MetricsTree_Market_Dca_ClassMaxDrawdown(client) self.class_max_return: MetricsTree_Market_Dca_ClassMaxReturn = MetricsTree_Market_Dca_ClassMaxReturn(client) - self.class_returns: ClassDaysInLossPattern[StoredF32] = ClassDaysInLossPattern(client, 'dca_class') - self.class_stack: MetricsTree_Market_Dca_ClassStack = MetricsTree_Market_Dca_ClassStack(client) - self.period_average_price: MetricsTree_Market_Dca_PeriodAveragePrice = MetricsTree_Market_Dca_PeriodAveragePrice(client) - self.period_cagr: PeriodCagrPattern = PeriodCagrPattern(client, 'dca_cagr') - self.period_days_in_loss: PeriodDaysInLossPattern[StoredU32] = PeriodDaysInLossPattern(client, 'dca_days_in_loss') - self.period_days_in_profit: PeriodDaysInLossPattern[StoredU32] = PeriodDaysInLossPattern(client, 'dca_days_in_profit') - self.period_lump_sum_days_in_loss: PeriodDaysInLossPattern[StoredU32] = PeriodDaysInLossPattern(client, 'lump_sum_days_in_loss') - self.period_lump_sum_days_in_profit: PeriodDaysInLossPattern[StoredU32] = PeriodDaysInLossPattern(client, 'lump_sum_days_in_profit') - self.period_lump_sum_max_drawdown: PeriodDaysInLossPattern[StoredF32] = PeriodDaysInLossPattern(client, 'lump_sum_max_drawdown') - self.period_lump_sum_max_return: PeriodDaysInLossPattern[StoredF32] = PeriodDaysInLossPattern(client, 'lump_sum_max_return') - self.period_lump_sum_returns: PeriodDaysInLossPattern[StoredF32] = PeriodDaysInLossPattern(client, 'lump_sum_returns') - self.period_lump_sum_stack: PeriodLumpSumStackPattern = PeriodLumpSumStackPattern(client, 'lump_sum_stack') - self.period_max_drawdown: PeriodDaysInLossPattern[StoredF32] = PeriodDaysInLossPattern(client, 'dca_max_drawdown') - self.period_max_return: PeriodDaysInLossPattern[StoredF32] = PeriodDaysInLossPattern(client, 'dca_max_return') - self.period_returns: PeriodDaysInLossPattern[StoredF32] = PeriodDaysInLossPattern(client, 'dca_returns') - self.period_stack: PeriodLumpSumStackPattern = PeriodLumpSumStackPattern(client, 'dca_stack') class MetricsTree_Market_Indicators: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.gini: MetricPattern6[StoredF32] = MetricPattern6(client, 'gini') - self.macd_histogram: MetricPattern6[StoredF32] = MetricPattern6(client, 'macd_histogram') - self.macd_line: MetricPattern6[StoredF32] = MetricPattern6(client, 'macd_line') - self.macd_signal: MetricPattern6[StoredF32] = MetricPattern6(client, 'macd_signal') - self.nvt: MetricPattern4[StoredF32] = MetricPattern4(client, 'nvt') - self.pi_cycle: MetricPattern6[StoredF32] = MetricPattern6(client, 'pi_cycle') self.puell_multiple: MetricPattern4[StoredF32] = MetricPattern4(client, 'puell_multiple') - self.rsi_14d: MetricPattern6[StoredF32] = MetricPattern6(client, 'rsi_14d') - self.rsi_14d_max: MetricPattern6[StoredF32] = MetricPattern6(client, 'rsi_14d_max') - self.rsi_14d_min: MetricPattern6[StoredF32] = MetricPattern6(client, 'rsi_14d_min') - self.rsi_average_gain_14d: MetricPattern6[StoredF32] = MetricPattern6(client, 'rsi_average_gain_14d') - self.rsi_average_loss_14d: MetricPattern6[StoredF32] = MetricPattern6(client, 'rsi_average_loss_14d') + self.nvt: MetricPattern4[StoredF32] = MetricPattern4(client, 'nvt') self.rsi_gains: MetricPattern6[StoredF32] = MetricPattern6(client, 'rsi_gains') self.rsi_losses: MetricPattern6[StoredF32] = MetricPattern6(client, 'rsi_losses') - self.stoch_d: MetricPattern6[StoredF32] = MetricPattern6(client, 'stoch_d') - self.stoch_k: MetricPattern6[StoredF32] = MetricPattern6(client, 'stoch_k') + self.rsi_average_gain_14d: MetricPattern6[StoredF32] = MetricPattern6(client, 'rsi_average_gain_14d') + self.rsi_average_loss_14d: MetricPattern6[StoredF32] = MetricPattern6(client, 'rsi_average_loss_14d') + self.rsi_14d: MetricPattern6[StoredF32] = MetricPattern6(client, 'rsi_14d') + self.rsi_14d_min: MetricPattern6[StoredF32] = MetricPattern6(client, 'rsi_14d_min') + self.rsi_14d_max: MetricPattern6[StoredF32] = MetricPattern6(client, 'rsi_14d_max') self.stoch_rsi: MetricPattern6[StoredF32] = MetricPattern6(client, 'stoch_rsi') - self.stoch_rsi_d: MetricPattern6[StoredF32] = MetricPattern6(client, 'stoch_rsi_d') self.stoch_rsi_k: MetricPattern6[StoredF32] = MetricPattern6(client, 'stoch_rsi_k') - -class MetricsTree_Market_Lookback: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self._10y: _0sdUsdPattern = _0sdUsdPattern(client, 'price_10y_ago') - self._1d: _0sdUsdPattern = _0sdUsdPattern(client, 'price_1d_ago') - self._1m: _0sdUsdPattern = _0sdUsdPattern(client, 'price_1m_ago') - self._1w: _0sdUsdPattern = _0sdUsdPattern(client, 'price_1w_ago') - self._1y: _0sdUsdPattern = _0sdUsdPattern(client, 'price_1y_ago') - self._2y: _0sdUsdPattern = _0sdUsdPattern(client, 'price_2y_ago') - self._3m: _0sdUsdPattern = _0sdUsdPattern(client, 'price_3m_ago') - self._3y: _0sdUsdPattern = _0sdUsdPattern(client, 'price_3y_ago') - self._4y: _0sdUsdPattern = _0sdUsdPattern(client, 'price_4y_ago') - self._5y: _0sdUsdPattern = _0sdUsdPattern(client, 'price_5y_ago') - self._6m: _0sdUsdPattern = _0sdUsdPattern(client, 'price_6m_ago') - self._6y: _0sdUsdPattern = _0sdUsdPattern(client, 'price_6y_ago') - self._8y: _0sdUsdPattern = _0sdUsdPattern(client, 'price_8y_ago') - -class MetricsTree_Market_MovingAverage: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.price_111d_sma: Price111dSmaPattern = Price111dSmaPattern(client, 'price_111d_sma') - self.price_12d_ema: Price111dSmaPattern = Price111dSmaPattern(client, 'price_12d_ema') - self.price_13d_ema: Price111dSmaPattern = Price111dSmaPattern(client, 'price_13d_ema') - self.price_13d_sma: Price111dSmaPattern = Price111dSmaPattern(client, 'price_13d_sma') - self.price_144d_ema: Price111dSmaPattern = Price111dSmaPattern(client, 'price_144d_ema') - self.price_144d_sma: Price111dSmaPattern = Price111dSmaPattern(client, 'price_144d_sma') - self.price_1m_ema: Price111dSmaPattern = Price111dSmaPattern(client, 'price_1m_ema') - self.price_1m_sma: Price111dSmaPattern = Price111dSmaPattern(client, 'price_1m_sma') - self.price_1w_ema: Price111dSmaPattern = Price111dSmaPattern(client, 'price_1w_ema') - self.price_1w_sma: Price111dSmaPattern = Price111dSmaPattern(client, 'price_1w_sma') - self.price_1y_ema: Price111dSmaPattern = Price111dSmaPattern(client, 'price_1y_ema') - self.price_1y_sma: Price111dSmaPattern = Price111dSmaPattern(client, 'price_1y_sma') - self.price_200d_ema: Price111dSmaPattern = Price111dSmaPattern(client, 'price_200d_ema') - self.price_200d_sma: Price111dSmaPattern = Price111dSmaPattern(client, 'price_200d_sma') - self.price_200d_sma_x0_8: _0sdUsdPattern = _0sdUsdPattern(client, 'price_200d_sma_x0_8') - self.price_200d_sma_x2_4: _0sdUsdPattern = _0sdUsdPattern(client, 'price_200d_sma_x2_4') - self.price_200w_ema: Price111dSmaPattern = Price111dSmaPattern(client, 'price_200w_ema') - self.price_200w_sma: Price111dSmaPattern = Price111dSmaPattern(client, 'price_200w_sma') - self.price_21d_ema: Price111dSmaPattern = Price111dSmaPattern(client, 'price_21d_ema') - self.price_21d_sma: Price111dSmaPattern = Price111dSmaPattern(client, 'price_21d_sma') - self.price_26d_ema: Price111dSmaPattern = Price111dSmaPattern(client, 'price_26d_ema') - self.price_2y_ema: Price111dSmaPattern = Price111dSmaPattern(client, 'price_2y_ema') - self.price_2y_sma: Price111dSmaPattern = Price111dSmaPattern(client, 'price_2y_sma') - self.price_34d_ema: Price111dSmaPattern = Price111dSmaPattern(client, 'price_34d_ema') - self.price_34d_sma: Price111dSmaPattern = Price111dSmaPattern(client, 'price_34d_sma') - self.price_350d_sma: Price111dSmaPattern = Price111dSmaPattern(client, 'price_350d_sma') - self.price_350d_sma_x2: _0sdUsdPattern = _0sdUsdPattern(client, 'price_350d_sma_x2') - self.price_4y_ema: Price111dSmaPattern = Price111dSmaPattern(client, 'price_4y_ema') - self.price_4y_sma: Price111dSmaPattern = Price111dSmaPattern(client, 'price_4y_sma') - self.price_55d_ema: Price111dSmaPattern = Price111dSmaPattern(client, 'price_55d_ema') - self.price_55d_sma: Price111dSmaPattern = Price111dSmaPattern(client, 'price_55d_sma') - self.price_89d_ema: Price111dSmaPattern = Price111dSmaPattern(client, 'price_89d_ema') - self.price_89d_sma: Price111dSmaPattern = Price111dSmaPattern(client, 'price_89d_sma') - self.price_8d_ema: Price111dSmaPattern = Price111dSmaPattern(client, 'price_8d_ema') - self.price_8d_sma: Price111dSmaPattern = Price111dSmaPattern(client, 'price_8d_sma') - -class MetricsTree_Market_Range: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.price_1m_max: _0sdUsdPattern = _0sdUsdPattern(client, 'price_1m_max') - self.price_1m_min: _0sdUsdPattern = _0sdUsdPattern(client, 'price_1m_min') - self.price_1w_max: _0sdUsdPattern = _0sdUsdPattern(client, 'price_1w_max') - self.price_1w_min: _0sdUsdPattern = _0sdUsdPattern(client, 'price_1w_min') - self.price_1y_max: _0sdUsdPattern = _0sdUsdPattern(client, 'price_1y_max') - self.price_1y_min: _0sdUsdPattern = _0sdUsdPattern(client, 'price_1y_min') - self.price_2w_choppiness_index: MetricPattern4[StoredF32] = MetricPattern4(client, 'price_2w_choppiness_index') - self.price_2w_max: _0sdUsdPattern = _0sdUsdPattern(client, 'price_2w_max') - self.price_2w_min: _0sdUsdPattern = _0sdUsdPattern(client, 'price_2w_min') - self.price_true_range: MetricPattern6[StoredF32] = MetricPattern6(client, 'price_true_range') - self.price_true_range_2w_sum: MetricPattern6[StoredF32] = MetricPattern6(client, 'price_true_range_2w_sum') - -class MetricsTree_Market_Returns_PriceReturns: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self._10y: MetricPattern4[StoredF32] = MetricPattern4(client, '10y_price_returns') - self._1d: MetricPattern4[StoredF32] = MetricPattern4(client, '1d_price_returns') - self._1m: MetricPattern4[StoredF32] = MetricPattern4(client, '1m_price_returns') - self._1w: MetricPattern4[StoredF32] = MetricPattern4(client, '1w_price_returns') - self._1y: MetricPattern4[StoredF32] = MetricPattern4(client, '1y_price_returns') - self._2y: MetricPattern4[StoredF32] = MetricPattern4(client, '2y_price_returns') - self._3m: MetricPattern4[StoredF32] = MetricPattern4(client, '3m_price_returns') - self._3y: MetricPattern4[StoredF32] = MetricPattern4(client, '3y_price_returns') - self._4y: MetricPattern4[StoredF32] = MetricPattern4(client, '4y_price_returns') - self._5y: MetricPattern4[StoredF32] = MetricPattern4(client, '5y_price_returns') - self._6m: MetricPattern4[StoredF32] = MetricPattern4(client, '6m_price_returns') - self._6y: MetricPattern4[StoredF32] = MetricPattern4(client, '6y_price_returns') - self._8y: MetricPattern4[StoredF32] = MetricPattern4(client, '8y_price_returns') - -class MetricsTree_Market_Returns: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self._1d_returns_1m_sd: _1dReturns1mSdPattern = _1dReturns1mSdPattern(client, '1d_returns_1m_sd') - self._1d_returns_1w_sd: _1dReturns1mSdPattern = _1dReturns1mSdPattern(client, '1d_returns_1w_sd') - self._1d_returns_1y_sd: _1dReturns1mSdPattern = _1dReturns1mSdPattern(client, '1d_returns_1y_sd') - self.cagr: PeriodCagrPattern = PeriodCagrPattern(client, 'cagr') - self.downside_1m_sd: _1dReturns1mSdPattern = _1dReturns1mSdPattern(client, 'downside_1m_sd') - self.downside_1w_sd: _1dReturns1mSdPattern = _1dReturns1mSdPattern(client, 'downside_1w_sd') - self.downside_1y_sd: _1dReturns1mSdPattern = _1dReturns1mSdPattern(client, 'downside_1y_sd') - self.downside_returns: MetricPattern6[StoredF32] = MetricPattern6(client, 'downside_returns') - self.price_returns: MetricsTree_Market_Returns_PriceReturns = MetricsTree_Market_Returns_PriceReturns(client) - -class MetricsTree_Market_Volatility: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.price_1m_volatility: MetricPattern4[StoredF32] = MetricPattern4(client, 'price_1m_volatility') - self.price_1w_volatility: MetricPattern4[StoredF32] = MetricPattern4(client, 'price_1w_volatility') - self.price_1y_volatility: MetricPattern4[StoredF32] = MetricPattern4(client, 'price_1y_volatility') - self.sharpe_1m: MetricPattern6[StoredF32] = MetricPattern6(client, 'sharpe_1m') - self.sharpe_1w: MetricPattern6[StoredF32] = MetricPattern6(client, 'sharpe_1w') - self.sharpe_1y: MetricPattern6[StoredF32] = MetricPattern6(client, 'sharpe_1y') - self.sortino_1m: MetricPattern6[StoredF32] = MetricPattern6(client, 'sortino_1m') - self.sortino_1w: MetricPattern6[StoredF32] = MetricPattern6(client, 'sortino_1w') - self.sortino_1y: MetricPattern6[StoredF32] = MetricPattern6(client, 'sortino_1y') + self.stoch_rsi_d: MetricPattern6[StoredF32] = MetricPattern6(client, 'stoch_rsi_d') + self.stoch_k: MetricPattern6[StoredF32] = MetricPattern6(client, 'stoch_k') + self.stoch_d: MetricPattern6[StoredF32] = MetricPattern6(client, 'stoch_d') + self.pi_cycle: MetricPattern6[StoredF32] = MetricPattern6(client, 'pi_cycle') + self.macd_line: MetricPattern6[StoredF32] = MetricPattern6(client, 'macd_line') + self.macd_signal: MetricPattern6[StoredF32] = MetricPattern6(client, 'macd_signal') + self.macd_histogram: MetricPattern6[StoredF32] = MetricPattern6(client, 'macd_histogram') + self.gini: MetricPattern6[StoredF32] = MetricPattern6(client, 'gini') class MetricsTree_Market: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): self.ath: MetricsTree_Market_Ath = MetricsTree_Market_Ath(client) - self.dca: MetricsTree_Market_Dca = MetricsTree_Market_Dca(client) - self.indicators: MetricsTree_Market_Indicators = MetricsTree_Market_Indicators(client) self.lookback: MetricsTree_Market_Lookback = MetricsTree_Market_Lookback(client) - self.moving_average: MetricsTree_Market_MovingAverage = MetricsTree_Market_MovingAverage(client) - self.range: MetricsTree_Market_Range = MetricsTree_Market_Range(client) self.returns: MetricsTree_Market_Returns = MetricsTree_Market_Returns(client) self.volatility: MetricsTree_Market_Volatility = MetricsTree_Market_Volatility(client) - -class MetricsTree_Outputs_Count: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.total_count: CountPattern2[StoredU64] = CountPattern2(client, 'output_count') - self.utxo_count: MetricPattern1[StoredU64] = MetricPattern1(client, 'exact_utxo_count') - -class MetricsTree_Outputs_Spent: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.txinindex: MetricPattern15[TxInIndex] = MetricPattern15(client, 'txinindex') - -class MetricsTree_Outputs: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.count: MetricsTree_Outputs_Count = MetricsTree_Outputs_Count(client) - self.first_txoutindex: MetricPattern11[TxOutIndex] = MetricPattern11(client, 'first_txoutindex') - self.outputtype: MetricPattern15[OutputType] = MetricPattern15(client, 'outputtype') - self.spent: MetricsTree_Outputs_Spent = MetricsTree_Outputs_Spent(client) - self.txindex: MetricPattern15[TxIndex] = MetricPattern15(client, 'txindex') - self.typeindex: MetricPattern15[TypeIndex] = MetricPattern15(client, 'typeindex') - self.value: MetricPattern15[Sats] = MetricPattern15(client, 'value') + self.range: MetricsTree_Market_Range = MetricsTree_Market_Range(client) + self.moving_average: MetricsTree_Market_MovingAverage = MetricsTree_Market_MovingAverage(client) + self.dca: MetricsTree_Market_Dca = MetricsTree_Market_Dca(client) + self.indicators: MetricsTree_Market_Indicators = MetricsTree_Market_Indicators(client) class MetricsTree_Pools_Vecs: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.aaopool: AaopoolPattern = AaopoolPattern(client, 'aaopool') - self.antpool: AaopoolPattern = AaopoolPattern(client, 'antpool') - self.arkpool: AaopoolPattern = AaopoolPattern(client, 'arkpool') - self.asicminer: AaopoolPattern = AaopoolPattern(client, 'asicminer') - self.axbt: AaopoolPattern = AaopoolPattern(client, 'axbt') - self.batpool: AaopoolPattern = AaopoolPattern(client, 'batpool') - self.bcmonster: AaopoolPattern = AaopoolPattern(client, 'bcmonster') - self.bcpoolio: AaopoolPattern = AaopoolPattern(client, 'bcpoolio') - self.binancepool: AaopoolPattern = AaopoolPattern(client, 'binancepool') - self.bitalo: AaopoolPattern = AaopoolPattern(client, 'bitalo') - self.bitclub: AaopoolPattern = AaopoolPattern(client, 'bitclub') - self.bitcoinaffiliatenetwork: AaopoolPattern = AaopoolPattern(client, 'bitcoinaffiliatenetwork') - self.bitcoincom: AaopoolPattern = AaopoolPattern(client, 'bitcoincom') - self.bitcoinindia: AaopoolPattern = AaopoolPattern(client, 'bitcoinindia') - self.bitcoinrussia: AaopoolPattern = AaopoolPattern(client, 'bitcoinrussia') - self.bitcoinukraine: AaopoolPattern = AaopoolPattern(client, 'bitcoinukraine') - self.bitfarms: AaopoolPattern = AaopoolPattern(client, 'bitfarms') - self.bitfufupool: AaopoolPattern = AaopoolPattern(client, 'bitfufupool') - self.bitfury: AaopoolPattern = AaopoolPattern(client, 'bitfury') - self.bitminter: AaopoolPattern = AaopoolPattern(client, 'bitminter') - self.bitparking: AaopoolPattern = AaopoolPattern(client, 'bitparking') - self.bitsolo: AaopoolPattern = AaopoolPattern(client, 'bitsolo') - self.bixin: AaopoolPattern = AaopoolPattern(client, 'bixin') - self.blockfills: AaopoolPattern = AaopoolPattern(client, 'blockfills') - self.braiinspool: AaopoolPattern = AaopoolPattern(client, 'braiinspool') - self.bravomining: AaopoolPattern = AaopoolPattern(client, 'bravomining') - self.btcc: AaopoolPattern = AaopoolPattern(client, 'btcc') - self.btccom: AaopoolPattern = AaopoolPattern(client, 'btccom') - self.btcdig: AaopoolPattern = AaopoolPattern(client, 'btcdig') - self.btcguild: AaopoolPattern = AaopoolPattern(client, 'btcguild') - self.btclab: AaopoolPattern = AaopoolPattern(client, 'btclab') - self.btcmp: AaopoolPattern = AaopoolPattern(client, 'btcmp') - self.btcnuggets: AaopoolPattern = AaopoolPattern(client, 'btcnuggets') - self.btcpoolparty: AaopoolPattern = AaopoolPattern(client, 'btcpoolparty') - self.btcserv: AaopoolPattern = AaopoolPattern(client, 'btcserv') - self.btctop: AaopoolPattern = AaopoolPattern(client, 'btctop') - self.btpool: AaopoolPattern = AaopoolPattern(client, 'btpool') - self.bwpool: AaopoolPattern = AaopoolPattern(client, 'bwpool') - self.bytepool: AaopoolPattern = AaopoolPattern(client, 'bytepool') - self.canoe: AaopoolPattern = AaopoolPattern(client, 'canoe') - self.canoepool: AaopoolPattern = AaopoolPattern(client, 'canoepool') - self.carbonnegative: AaopoolPattern = AaopoolPattern(client, 'carbonnegative') - self.ckpool: AaopoolPattern = AaopoolPattern(client, 'ckpool') - self.cloudhashing: AaopoolPattern = AaopoolPattern(client, 'cloudhashing') - self.coinlab: AaopoolPattern = AaopoolPattern(client, 'coinlab') - self.cointerra: AaopoolPattern = AaopoolPattern(client, 'cointerra') - self.connectbtc: AaopoolPattern = AaopoolPattern(client, 'connectbtc') - self.dcex: AaopoolPattern = AaopoolPattern(client, 'dcex') - self.dcexploration: AaopoolPattern = AaopoolPattern(client, 'dcexploration') - self.digitalbtc: AaopoolPattern = AaopoolPattern(client, 'digitalbtc') - self.digitalxmintsy: AaopoolPattern = AaopoolPattern(client, 'digitalxmintsy') - self.dpool: AaopoolPattern = AaopoolPattern(client, 'dpool') - self.eclipsemc: AaopoolPattern = AaopoolPattern(client, 'eclipsemc') - self.eightbaochi: AaopoolPattern = AaopoolPattern(client, 'eightbaochi') - self.ekanembtc: AaopoolPattern = AaopoolPattern(client, 'ekanembtc') - self.eligius: AaopoolPattern = AaopoolPattern(client, 'eligius') - self.emcdpool: AaopoolPattern = AaopoolPattern(client, 'emcdpool') - self.entrustcharitypool: AaopoolPattern = AaopoolPattern(client, 'entrustcharitypool') - self.eobot: AaopoolPattern = AaopoolPattern(client, 'eobot') - self.exxbw: AaopoolPattern = AaopoolPattern(client, 'exxbw') - self.f2pool: AaopoolPattern = AaopoolPattern(client, 'f2pool') - self.fiftyeightcoin: AaopoolPattern = AaopoolPattern(client, 'fiftyeightcoin') - self.foundryusa: AaopoolPattern = AaopoolPattern(client, 'foundryusa') - self.futurebitapollosolo: AaopoolPattern = AaopoolPattern(client, 'futurebitapollosolo') - self.gbminers: AaopoolPattern = AaopoolPattern(client, 'gbminers') - self.ghashio: AaopoolPattern = AaopoolPattern(client, 'ghashio') - self.givemecoins: AaopoolPattern = AaopoolPattern(client, 'givemecoins') - self.gogreenlight: AaopoolPattern = AaopoolPattern(client, 'gogreenlight') - self.haominer: AaopoolPattern = AaopoolPattern(client, 'haominer') - self.haozhuzhu: AaopoolPattern = AaopoolPattern(client, 'haozhuzhu') - self.hashbx: AaopoolPattern = AaopoolPattern(client, 'hashbx') - self.hashpool: AaopoolPattern = AaopoolPattern(client, 'hashpool') - self.helix: AaopoolPattern = AaopoolPattern(client, 'helix') - self.hhtt: AaopoolPattern = AaopoolPattern(client, 'hhtt') - self.hotpool: AaopoolPattern = AaopoolPattern(client, 'hotpool') - self.hummerpool: AaopoolPattern = AaopoolPattern(client, 'hummerpool') - self.huobipool: AaopoolPattern = AaopoolPattern(client, 'huobipool') - self.innopolistech: AaopoolPattern = AaopoolPattern(client, 'innopolistech') - self.kanopool: AaopoolPattern = AaopoolPattern(client, 'kanopool') - self.kncminer: AaopoolPattern = AaopoolPattern(client, 'kncminer') - self.kucoinpool: AaopoolPattern = AaopoolPattern(client, 'kucoinpool') - self.lubiancom: AaopoolPattern = AaopoolPattern(client, 'lubiancom') - self.luckypool: AaopoolPattern = AaopoolPattern(client, 'luckypool') - self.luxor: AaopoolPattern = AaopoolPattern(client, 'luxor') - self.marapool: AaopoolPattern = AaopoolPattern(client, 'marapool') - self.maxbtc: AaopoolPattern = AaopoolPattern(client, 'maxbtc') - self.maxipool: AaopoolPattern = AaopoolPattern(client, 'maxipool') - self.megabigpower: AaopoolPattern = AaopoolPattern(client, 'megabigpower') - self.minerium: AaopoolPattern = AaopoolPattern(client, 'minerium') - self.miningcity: AaopoolPattern = AaopoolPattern(client, 'miningcity') - self.miningdutch: AaopoolPattern = AaopoolPattern(client, 'miningdutch') - self.miningkings: AaopoolPattern = AaopoolPattern(client, 'miningkings') - self.miningsquared: AaopoolPattern = AaopoolPattern(client, 'miningsquared') - self.mmpool: AaopoolPattern = AaopoolPattern(client, 'mmpool') - self.mtred: AaopoolPattern = AaopoolPattern(client, 'mtred') - self.multicoinco: AaopoolPattern = AaopoolPattern(client, 'multicoinco') - self.multipool: AaopoolPattern = AaopoolPattern(client, 'multipool') - self.mybtccoinpool: AaopoolPattern = AaopoolPattern(client, 'mybtccoinpool') - self.neopool: AaopoolPattern = AaopoolPattern(client, 'neopool') - self.nexious: AaopoolPattern = AaopoolPattern(client, 'nexious') - self.nicehash: AaopoolPattern = AaopoolPattern(client, 'nicehash') - self.nmcbit: AaopoolPattern = AaopoolPattern(client, 'nmcbit') - self.novablock: AaopoolPattern = AaopoolPattern(client, 'novablock') - self.ocean: AaopoolPattern = AaopoolPattern(client, 'ocean') - self.okexpool: AaopoolPattern = AaopoolPattern(client, 'okexpool') - self.okkong: AaopoolPattern = AaopoolPattern(client, 'okkong') - self.okminer: AaopoolPattern = AaopoolPattern(client, 'okminer') - self.okpooltop: AaopoolPattern = AaopoolPattern(client, 'okpooltop') - self.onehash: AaopoolPattern = AaopoolPattern(client, 'onehash') - self.onem1x: AaopoolPattern = AaopoolPattern(client, 'onem1x') - self.onethash: AaopoolPattern = AaopoolPattern(client, 'onethash') - self.ozcoin: AaopoolPattern = AaopoolPattern(client, 'ozcoin') - self.parasite: AaopoolPattern = AaopoolPattern(client, 'parasite') - self.patels: AaopoolPattern = AaopoolPattern(client, 'patels') - self.pegapool: AaopoolPattern = AaopoolPattern(client, 'pegapool') - self.phashio: AaopoolPattern = AaopoolPattern(client, 'phashio') - self.phoenix: AaopoolPattern = AaopoolPattern(client, 'phoenix') - self.polmine: AaopoolPattern = AaopoolPattern(client, 'polmine') - self.pool175btc: AaopoolPattern = AaopoolPattern(client, 'pool175btc') - self.pool50btc: AaopoolPattern = AaopoolPattern(client, 'pool50btc') - self.poolin: AaopoolPattern = AaopoolPattern(client, 'poolin') - self.portlandhodl: AaopoolPattern = AaopoolPattern(client, 'portlandhodl') - self.publicpool: AaopoolPattern = AaopoolPattern(client, 'publicpool') - self.purebtccom: AaopoolPattern = AaopoolPattern(client, 'purebtccom') - self.rawpool: AaopoolPattern = AaopoolPattern(client, 'rawpool') - self.rigpool: AaopoolPattern = AaopoolPattern(client, 'rigpool') - self.sbicrypto: AaopoolPattern = AaopoolPattern(client, 'sbicrypto') - self.secpool: AaopoolPattern = AaopoolPattern(client, 'secpool') - self.secretsuperstar: AaopoolPattern = AaopoolPattern(client, 'secretsuperstar') - self.sevenpool: AaopoolPattern = AaopoolPattern(client, 'sevenpool') - self.shawnp0wers: AaopoolPattern = AaopoolPattern(client, 'shawnp0wers') - self.sigmapoolcom: AaopoolPattern = AaopoolPattern(client, 'sigmapoolcom') - self.simplecoinus: AaopoolPattern = AaopoolPattern(client, 'simplecoinus') - self.solock: AaopoolPattern = AaopoolPattern(client, 'solock') - self.spiderpool: AaopoolPattern = AaopoolPattern(client, 'spiderpool') - self.stminingcorp: AaopoolPattern = AaopoolPattern(client, 'stminingcorp') - self.tangpool: AaopoolPattern = AaopoolPattern(client, 'tangpool') - self.tatmaspool: AaopoolPattern = AaopoolPattern(client, 'tatmaspool') - self.tbdice: AaopoolPattern = AaopoolPattern(client, 'tbdice') - self.telco214: AaopoolPattern = AaopoolPattern(client, 'telco214') - self.terrapool: AaopoolPattern = AaopoolPattern(client, 'terrapool') - self.tiger: AaopoolPattern = AaopoolPattern(client, 'tiger') - self.tigerpoolnet: AaopoolPattern = AaopoolPattern(client, 'tigerpoolnet') - self.titan: AaopoolPattern = AaopoolPattern(client, 'titan') - self.transactioncoinmining: AaopoolPattern = AaopoolPattern(client, 'transactioncoinmining') - self.trickysbtcpool: AaopoolPattern = AaopoolPattern(client, 'trickysbtcpool') - self.triplemining: AaopoolPattern = AaopoolPattern(client, 'triplemining') - self.twentyoneinc: AaopoolPattern = AaopoolPattern(client, 'twentyoneinc') - self.ultimuspool: AaopoolPattern = AaopoolPattern(client, 'ultimuspool') - self.unknown: AaopoolPattern = AaopoolPattern(client, 'unknown') - self.unomp: AaopoolPattern = AaopoolPattern(client, 'unomp') - self.viabtc: AaopoolPattern = AaopoolPattern(client, 'viabtc') - self.waterhole: AaopoolPattern = AaopoolPattern(client, 'waterhole') - self.wayicn: AaopoolPattern = AaopoolPattern(client, 'wayicn') - self.whitepool: AaopoolPattern = AaopoolPattern(client, 'whitepool') - self.wk057: AaopoolPattern = AaopoolPattern(client, 'wk057') - self.yourbtcnet: AaopoolPattern = AaopoolPattern(client, 'yourbtcnet') - self.zulupool: AaopoolPattern = AaopoolPattern(client, 'zulupool') + self.unknown: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'unknown') + self.blockfills: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'blockfills') + self.ultimuspool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'ultimuspool') + self.terrapool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'terrapool') + self.luxor: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'luxor') + self.onethash: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'onethash') + self.btccom: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'btccom') + self.bitfarms: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'bitfarms') + self.huobipool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'huobipool') + self.wayicn: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'wayicn') + self.canoepool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'canoepool') + self.btctop: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'btctop') + self.bitcoincom: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'bitcoincom') + self.pool175btc: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'pool175btc') + self.gbminers: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'gbminers') + self.axbt: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'axbt') + self.asicminer: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'asicminer') + self.bitminter: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'bitminter') + self.bitcoinrussia: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'bitcoinrussia') + self.btcserv: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'btcserv') + self.simplecoinus: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'simplecoinus') + self.btcguild: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'btcguild') + self.eligius: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'eligius') + self.ozcoin: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'ozcoin') + self.eclipsemc: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'eclipsemc') + self.maxbtc: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'maxbtc') + self.triplemining: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'triplemining') + self.coinlab: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'coinlab') + self.pool50btc: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'pool50btc') + self.ghashio: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'ghashio') + self.stminingcorp: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'stminingcorp') + self.bitparking: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'bitparking') + self.mmpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'mmpool') + self.polmine: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'polmine') + self.kncminer: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'kncminer') + self.bitalo: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'bitalo') + self.f2pool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'f2pool') + self.hhtt: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'hhtt') + self.megabigpower: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'megabigpower') + self.mtred: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'mtred') + self.nmcbit: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'nmcbit') + self.yourbtcnet: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'yourbtcnet') + self.givemecoins: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'givemecoins') + self.braiinspool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'braiinspool') + self.antpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'antpool') + self.multicoinco: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'multicoinco') + self.bcpoolio: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'bcpoolio') + self.cointerra: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'cointerra') + self.kanopool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'kanopool') + self.solock: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'solock') + self.ckpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'ckpool') + self.nicehash: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'nicehash') + self.bitclub: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'bitclub') + self.bitcoinaffiliatenetwork: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'bitcoinaffiliatenetwork') + self.btcc: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'btcc') + self.bwpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'bwpool') + self.exxbw: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'exxbw') + self.bitsolo: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'bitsolo') + self.bitfury: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'bitfury') + self.twentyoneinc: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'twentyoneinc') + self.digitalbtc: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'digitalbtc') + self.eightbaochi: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'eightbaochi') + self.mybtccoinpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'mybtccoinpool') + self.tbdice: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'tbdice') + self.hashpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'hashpool') + self.nexious: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'nexious') + self.bravomining: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'bravomining') + self.hotpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'hotpool') + self.okexpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'okexpool') + self.bcmonster: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'bcmonster') + self.onehash: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'onehash') + self.bixin: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'bixin') + self.tatmaspool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'tatmaspool') + self.viabtc: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'viabtc') + self.connectbtc: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'connectbtc') + self.batpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'batpool') + self.waterhole: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'waterhole') + self.dcexploration: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'dcexploration') + self.dcex: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'dcex') + self.btpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'btpool') + self.fiftyeightcoin: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'fiftyeightcoin') + self.bitcoinindia: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'bitcoinindia') + self.shawnp0wers: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'shawnp0wers') + self.phashio: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'phashio') + self.rigpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'rigpool') + self.haozhuzhu: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'haozhuzhu') + self.sevenpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'sevenpool') + self.miningkings: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'miningkings') + self.hashbx: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'hashbx') + self.dpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'dpool') + self.rawpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'rawpool') + self.haominer: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'haominer') + self.helix: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'helix') + self.bitcoinukraine: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'bitcoinukraine') + self.poolin: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'poolin') + self.secretsuperstar: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'secretsuperstar') + self.tigerpoolnet: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'tigerpoolnet') + self.sigmapoolcom: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'sigmapoolcom') + self.okpooltop: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'okpooltop') + self.hummerpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'hummerpool') + self.tangpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'tangpool') + self.bytepool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'bytepool') + self.spiderpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'spiderpool') + self.novablock: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'novablock') + self.miningcity: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'miningcity') + self.binancepool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'binancepool') + self.minerium: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'minerium') + self.lubiancom: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'lubiancom') + self.okkong: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'okkong') + self.aaopool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'aaopool') + self.emcdpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'emcdpool') + self.foundryusa: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'foundryusa') + self.sbicrypto: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'sbicrypto') + self.arkpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'arkpool') + self.purebtccom: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'purebtccom') + self.marapool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'marapool') + self.kucoinpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'kucoinpool') + self.entrustcharitypool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'entrustcharitypool') + self.okminer: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'okminer') + self.titan: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'titan') + self.pegapool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'pegapool') + self.btcnuggets: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'btcnuggets') + self.cloudhashing: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'cloudhashing') + self.digitalxmintsy: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'digitalxmintsy') + self.telco214: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'telco214') + self.btcpoolparty: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'btcpoolparty') + self.multipool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'multipool') + self.transactioncoinmining: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'transactioncoinmining') + self.btcdig: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'btcdig') + self.trickysbtcpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'trickysbtcpool') + self.btcmp: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'btcmp') + self.eobot: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'eobot') + self.unomp: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'unomp') + self.patels: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'patels') + self.gogreenlight: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'gogreenlight') + self.ekanembtc: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'ekanembtc') + self.canoe: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'canoe') + self.tiger: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'tiger') + self.onem1x: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'onem1x') + self.zulupool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'zulupool') + self.secpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'secpool') + self.ocean: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'ocean') + self.whitepool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'whitepool') + self.wk057: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'wk057') + self.futurebitapollosolo: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'futurebitapollosolo') + self.carbonnegative: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'carbonnegative') + self.portlandhodl: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'portlandhodl') + self.phoenix: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'phoenix') + self.neopool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'neopool') + self.maxipool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'maxipool') + self.bitfufupool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'bitfufupool') + self.luckypool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'luckypool') + self.miningdutch: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'miningdutch') + self.publicpool: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'publicpool') + self.miningsquared: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'miningsquared') + self.innopolistech: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'innopolistech') + self.btclab: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'btclab') + self.parasite: _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern = _1m1w1y24hBlocksCoinbaseDaysDominanceFeeSubsidyPattern(client, 'parasite') class MetricsTree_Pools: """Metrics tree node.""" @@ -3949,99 +3765,444 @@ class MetricsTree_Pools: self.height_to_pool: MetricPattern11[PoolSlug] = MetricPattern11(client, 'pool') self.vecs: MetricsTree_Pools_Vecs = MetricsTree_Pools_Vecs(client) -class MetricsTree_Positions: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.block_position: MetricPattern11[BlkPosition] = MetricPattern11(client, 'position') - self.tx_position: MetricPattern27[BlkPosition] = MetricPattern27(client, 'position') - class MetricsTree_Price_Cents_Split: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.close: MetricPattern5[Cents] = MetricPattern5(client, 'price_close_cents') - self.high: MetricPattern5[Cents] = MetricPattern5(client, 'price_high_cents') - self.low: MetricPattern5[Cents] = MetricPattern5(client, 'price_low_cents') - self.open: MetricPattern5[Cents] = MetricPattern5(client, 'price_open_cents') + self.open: MetricPattern5[CentsUnsigned] = MetricPattern5(client, 'price_open_cents') + self.high: MetricPattern5[CentsUnsigned] = MetricPattern5(client, 'price_high_cents') + self.low: MetricPattern5[CentsUnsigned] = MetricPattern5(client, 'price_low_cents') + self.close: MetricPattern5[CentsUnsigned] = MetricPattern5(client, 'price_close_cents') class MetricsTree_Price_Cents: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.ohlc: MetricPattern5[OHLCCents] = MetricPattern5(client, 'ohlc_cents') self.split: MetricsTree_Price_Cents_Split = MetricsTree_Price_Cents_Split(client) + self.ohlc: MetricPattern5[OHLCCentsUnsigned] = MetricPattern5(client, 'ohlc_cents') class MetricsTree_Price_Usd: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): + self.split: CloseHighLowOpenPattern2[Dollars] = CloseHighLowOpenPattern2(client, 'price') self.ohlc: MetricPattern1[OHLCDollars] = MetricPattern1(client, 'price_ohlc') - self.split: SplitPattern2[Dollars] = SplitPattern2(client, 'price') class MetricsTree_Price: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): self.cents: MetricsTree_Price_Cents = MetricsTree_Price_Cents(client) - self.sats: SatsPattern[OHLCSats] = SatsPattern(client, 'price') self.usd: MetricsTree_Price_Usd = MetricsTree_Price_Usd(client) + self.sats: OhlcSplitPattern2[OHLCSats] = OhlcSplitPattern2(client, 'price') -class MetricsTree_Scripts_Count: +class MetricsTree_Distribution_AnyAddressIndexes: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.emptyoutput: DollarsPattern[StoredU64] = DollarsPattern(client, 'emptyoutput_count') - self.opreturn: DollarsPattern[StoredU64] = DollarsPattern(client, 'opreturn_count') - self.p2a: DollarsPattern[StoredU64] = DollarsPattern(client, 'p2a_count') - self.p2ms: DollarsPattern[StoredU64] = DollarsPattern(client, 'p2ms_count') - self.p2pk33: DollarsPattern[StoredU64] = DollarsPattern(client, 'p2pk33_count') - self.p2pk65: DollarsPattern[StoredU64] = DollarsPattern(client, 'p2pk65_count') - self.p2pkh: DollarsPattern[StoredU64] = DollarsPattern(client, 'p2pkh_count') - self.p2sh: DollarsPattern[StoredU64] = DollarsPattern(client, 'p2sh_count') - self.p2tr: DollarsPattern[StoredU64] = DollarsPattern(client, 'p2tr_count') - self.p2wpkh: DollarsPattern[StoredU64] = DollarsPattern(client, 'p2wpkh_count') - self.p2wsh: DollarsPattern[StoredU64] = DollarsPattern(client, 'p2wsh_count') - self.segwit: DollarsPattern[StoredU64] = DollarsPattern(client, 'segwit_count') - self.segwit_adoption: SegwitAdoptionPattern = SegwitAdoptionPattern(client, 'segwit_adoption') - self.taproot_adoption: SegwitAdoptionPattern = SegwitAdoptionPattern(client, 'taproot_adoption') - self.unknownoutput: DollarsPattern[StoredU64] = DollarsPattern(client, 'unknownoutput_count') + self.p2a: MetricPattern16[AnyAddressIndex] = MetricPattern16(client, 'anyaddressindex') + self.p2pk33: MetricPattern18[AnyAddressIndex] = MetricPattern18(client, 'anyaddressindex') + self.p2pk65: MetricPattern19[AnyAddressIndex] = MetricPattern19(client, 'anyaddressindex') + self.p2pkh: MetricPattern20[AnyAddressIndex] = MetricPattern20(client, 'anyaddressindex') + self.p2sh: MetricPattern21[AnyAddressIndex] = MetricPattern21(client, 'anyaddressindex') + self.p2tr: MetricPattern22[AnyAddressIndex] = MetricPattern22(client, 'anyaddressindex') + self.p2wpkh: MetricPattern23[AnyAddressIndex] = MetricPattern23(client, 'anyaddressindex') + self.p2wsh: MetricPattern24[AnyAddressIndex] = MetricPattern24(client, 'anyaddressindex') -class MetricsTree_Scripts_Value: +class MetricsTree_Distribution_AddressesData: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.opreturn: CoinbasePattern = CoinbasePattern(client, 'opreturn_value') + self.loaded: MetricPattern31[LoadedAddressData] = MetricPattern31(client, 'loadedaddressdata') + self.empty: MetricPattern32[EmptyAddressData] = MetricPattern32(client, 'emptyaddressdata') -class MetricsTree_Scripts: +class MetricsTree_Distribution_UtxoCohorts_All_Relative: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.count: MetricsTree_Scripts_Count = MetricsTree_Scripts_Count(client) - self.empty_to_txindex: MetricPattern9[TxIndex] = MetricPattern9(client, 'txindex') - self.first_emptyoutputindex: MetricPattern11[EmptyOutputIndex] = MetricPattern11(client, 'first_emptyoutputindex') - self.first_opreturnindex: MetricPattern11[OpReturnIndex] = MetricPattern11(client, 'first_opreturnindex') - self.first_p2msoutputindex: MetricPattern11[P2MSOutputIndex] = MetricPattern11(client, 'first_p2msoutputindex') - self.first_unknownoutputindex: MetricPattern11[UnknownOutputIndex] = MetricPattern11(client, 'first_unknownoutputindex') - self.opreturn_to_txindex: MetricPattern14[TxIndex] = MetricPattern14(client, 'txindex') - self.p2ms_to_txindex: MetricPattern17[TxIndex] = MetricPattern17(client, 'txindex') - self.unknown_to_txindex: MetricPattern28[TxIndex] = MetricPattern28(client, 'txindex') - self.value: MetricsTree_Scripts_Value = MetricsTree_Scripts_Value(client) + self.supply_in_profit_rel_to_own_supply: MetricPattern1[StoredF64] = MetricPattern1(client, 'supply_in_profit_rel_to_own_supply') + self.supply_in_loss_rel_to_own_supply: MetricPattern1[StoredF64] = MetricPattern1(client, 'supply_in_loss_rel_to_own_supply') + self.unrealized_profit_rel_to_own_total_unrealized_pnl: MetricPattern1[StoredF32] = MetricPattern1(client, 'unrealized_profit_rel_to_own_total_unrealized_pnl') + self.unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1[StoredF32] = MetricPattern1(client, 'unrealized_loss_rel_to_own_total_unrealized_pnl') + self.neg_unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1[StoredF32] = MetricPattern1(client, 'neg_unrealized_loss_rel_to_own_total_unrealized_pnl') + self.net_unrealized_pnl_rel_to_own_total_unrealized_pnl: MetricPattern1[StoredF32] = MetricPattern1(client, 'net_unrealized_pnl_rel_to_own_total_unrealized_pnl') + self.invested_capital_in_profit_pct: MetricPattern1[StoredF32] = MetricPattern1(client, 'invested_capital_in_profit_pct') + self.invested_capital_in_loss_pct: MetricPattern1[StoredF32] = MetricPattern1(client, 'invested_capital_in_loss_pct') -class MetricsTree_Supply_Burned: +class MetricsTree_Distribution_UtxoCohorts_All: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.opreturn: UnclaimedRewardsPattern = UnclaimedRewardsPattern(client, 'opreturn_supply') - self.unspendable: UnclaimedRewardsPattern = UnclaimedRewardsPattern(client, 'unspendable_supply') + self.supply: HalvedTotalPattern = HalvedTotalPattern(client, 'supply') + self.outputs: UtxoPattern = UtxoPattern(client, 'utxo_count') + self.activity: CoinblocksCoindaysSatblocksSatdaysSentPattern = CoinblocksCoindaysSatblocksSatdaysSentPattern(client, '') + self.realized: AdjustedAthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern = AdjustedAthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern(client, '') + self.unrealized: AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern = AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern(client, '') + self.cost_basis: InvestedMaxMinPercentilesSpotPattern = InvestedMaxMinPercentilesSpotPattern(client, '') + self.relative: MetricsTree_Distribution_UtxoCohorts_All_Relative = MetricsTree_Distribution_UtxoCohorts_All_Relative(client) + +class MetricsTree_Distribution_UtxoCohorts_AgeRange: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.up_to_1h: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_under_1h_old') + self._1h_to_1d: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_1h_to_1d_old') + self._1d_to_1w: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_1d_to_1w_old') + self._1w_to_1m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_1w_to_1m_old') + self._1m_to_2m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_1m_to_2m_old') + self._2m_to_3m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_2m_to_3m_old') + self._3m_to_4m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_3m_to_4m_old') + self._4m_to_5m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_4m_to_5m_old') + self._5m_to_6m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_5m_to_6m_old') + self._6m_to_1y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_6m_to_1y_old') + self._1y_to_2y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_1y_to_2y_old') + self._2y_to_3y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_2y_to_3y_old') + self._3y_to_4y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_3y_to_4y_old') + self._4y_to_5y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_4y_to_5y_old') + self._5y_to_6y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_5y_to_6y_old') + self._6y_to_7y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_6y_to_7y_old') + self._7y_to_8y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_7y_to_8y_old') + self._8y_to_10y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_8y_to_10y_old') + self._10y_to_12y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_10y_to_12y_old') + self._12y_to_15y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_12y_to_15y_old') + self.from_15y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_over_15y_old') + +class MetricsTree_Distribution_UtxoCohorts_Epoch: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._0: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'epoch_0') + self._1: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'epoch_1') + self._2: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'epoch_2') + self._3: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'epoch_3') + self._4: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'epoch_4') + +class MetricsTree_Distribution_UtxoCohorts_Year: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._2009: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'year_2009') + self._2010: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'year_2010') + self._2011: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'year_2011') + self._2012: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'year_2012') + self._2013: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'year_2013') + self._2014: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'year_2014') + self._2015: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'year_2015') + self._2016: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'year_2016') + self._2017: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'year_2017') + self._2018: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'year_2018') + self._2019: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'year_2019') + self._2020: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'year_2020') + self._2021: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'year_2021') + self._2022: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'year_2022') + self._2023: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'year_2023') + self._2024: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'year_2024') + self._2025: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'year_2025') + self._2026: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'year_2026') + +class MetricsTree_Distribution_UtxoCohorts_MinAge: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._1d: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_1d_old') + self._1w: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_1w_old') + self._1m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_1m_old') + self._2m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_2m_old') + self._3m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_3m_old') + self._4m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_4m_old') + self._5m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_5m_old') + self._6m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_6m_old') + self._1y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_1y_old') + self._2y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_2y_old') + self._3y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_3y_old') + self._4y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_4y_old') + self._5y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_5y_old') + self._6y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_6y_old') + self._7y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_7y_old') + self._8y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_8y_old') + self._10y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_10y_old') + self._12y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_12y_old') + +class MetricsTree_Distribution_UtxoCohorts_GeAmount: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._1sat: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_1sat') + self._10sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_10sats') + self._100sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_100sats') + self._1k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_1k_sats') + self._10k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_10k_sats') + self._100k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_100k_sats') + self._1m_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_1m_sats') + self._10m_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_10m_sats') + self._1btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_1btc') + self._10btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_10btc') + self._100btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_100btc') + self._1k_btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_1k_btc') + self._10k_btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_10k_btc') + +class MetricsTree_Distribution_UtxoCohorts_AmountRange: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._0sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_with_0sats') + self._1sat_to_10sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_above_1sat_under_10sats') + self._10sats_to_100sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_above_10sats_under_100sats') + self._100sats_to_1k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_above_100sats_under_1k_sats') + self._1k_sats_to_10k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_above_1k_sats_under_10k_sats') + self._10k_sats_to_100k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_above_10k_sats_under_100k_sats') + self._100k_sats_to_1m_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_above_100k_sats_under_1m_sats') + self._1m_sats_to_10m_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_above_1m_sats_under_10m_sats') + self._10m_sats_to_1btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_above_10m_sats_under_1btc') + self._1btc_to_10btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_above_1btc_under_10btc') + self._10btc_to_100btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_above_10btc_under_100btc') + self._100btc_to_1k_btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_above_100btc_under_1k_btc') + self._1k_btc_to_10k_btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_above_1k_btc_under_10k_btc') + self._10k_btc_to_100k_btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_above_10k_btc_under_100k_btc') + self._100k_btc_or_more: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_above_100k_btc') + +class MetricsTree_Distribution_UtxoCohorts_Term_Short: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.supply: HalvedTotalPattern = HalvedTotalPattern(client, 'sth_supply') + self.outputs: UtxoPattern = UtxoPattern(client, 'sth_utxo_count') + self.activity: CoinblocksCoindaysSatblocksSatdaysSentPattern = CoinblocksCoindaysSatblocksSatdaysSentPattern(client, 'sth') + self.realized: AdjustedAthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern = AdjustedAthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern(client, 'sth') + self.unrealized: AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern = AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern(client, 'sth') + self.cost_basis: InvestedMaxMinPercentilesSpotPattern = InvestedMaxMinPercentilesSpotPattern(client, 'sth') + self.relative: InvestedNegNetNuplSupplyUnrealizedPattern2 = InvestedNegNetNuplSupplyUnrealizedPattern2(client, 'sth') + +class MetricsTree_Distribution_UtxoCohorts_Term_Long: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.supply: HalvedTotalPattern = HalvedTotalPattern(client, 'lth_supply') + self.outputs: UtxoPattern = UtxoPattern(client, 'lth_utxo_count') + self.activity: CoinblocksCoindaysSatblocksSatdaysSentPattern = CoinblocksCoindaysSatblocksSatdaysSentPattern(client, 'lth') + self.realized: AthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern2 = AthCapCapitulationInvestorLossMvrvNegNetProfitRealizedSellSoprTotalValuePattern2(client, 'lth') + self.unrealized: AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern = AthGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern(client, 'lth') + self.cost_basis: InvestedMaxMinPercentilesSpotPattern = InvestedMaxMinPercentilesSpotPattern(client, 'lth') + self.relative: InvestedNegNetNuplSupplyUnrealizedPattern2 = InvestedNegNetNuplSupplyUnrealizedPattern2(client, 'lth') + +class MetricsTree_Distribution_UtxoCohorts_Term: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.short: MetricsTree_Distribution_UtxoCohorts_Term_Short = MetricsTree_Distribution_UtxoCohorts_Term_Short(client) + self.long: MetricsTree_Distribution_UtxoCohorts_Term_Long = MetricsTree_Distribution_UtxoCohorts_Term_Long(client) + +class MetricsTree_Distribution_UtxoCohorts_Type: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.p2pk65: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'p2pk65') + self.p2pk33: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'p2pk33') + self.p2pkh: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'p2pkh') + self.p2ms: ActivityCostOutputsRealizedSupplyUnrealizedPattern = ActivityCostOutputsRealizedSupplyUnrealizedPattern(client, 'p2ms') + self.p2sh: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'p2sh') + self.p2wpkh: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'p2wpkh') + self.p2wsh: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'p2wsh') + self.p2tr: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'p2tr') + self.p2a: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'p2a') + self.unknown: ActivityCostOutputsRealizedSupplyUnrealizedPattern = ActivityCostOutputsRealizedSupplyUnrealizedPattern(client, 'unknown_outputs') + self.empty: ActivityCostOutputsRealizedSupplyUnrealizedPattern = ActivityCostOutputsRealizedSupplyUnrealizedPattern(client, 'empty_outputs') + +class MetricsTree_Distribution_UtxoCohorts_MaxAge: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._1w: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5(client, 'utxos_under_1w_old') + self._1m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5(client, 'utxos_under_1m_old') + self._2m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5(client, 'utxos_under_2m_old') + self._3m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5(client, 'utxos_under_3m_old') + self._4m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5(client, 'utxos_under_4m_old') + self._5m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5(client, 'utxos_under_5m_old') + self._6m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5(client, 'utxos_under_6m_old') + self._1y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5(client, 'utxos_under_1y_old') + self._2y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5(client, 'utxos_under_2y_old') + self._3y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5(client, 'utxos_under_3y_old') + self._4y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5(client, 'utxos_under_4y_old') + self._5y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5(client, 'utxos_under_5y_old') + self._6y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5(client, 'utxos_under_6y_old') + self._7y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5(client, 'utxos_under_7y_old') + self._8y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5(client, 'utxos_under_8y_old') + self._10y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5(client, 'utxos_under_10y_old') + self._12y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5(client, 'utxos_under_12y_old') + self._15y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5(client, 'utxos_under_15y_old') + +class MetricsTree_Distribution_UtxoCohorts_LtAmount: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._10sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_under_10sats') + self._100sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_under_100sats') + self._1k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_under_1k_sats') + self._10k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_under_10k_sats') + self._100k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_under_100k_sats') + self._1m_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_under_1m_sats') + self._10m_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_under_10m_sats') + self._1btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_under_1btc') + self._10btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_under_10btc') + self._100btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_under_100btc') + self._1k_btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_under_1k_btc') + self._10k_btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_under_10k_btc') + self._100k_btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_under_100k_btc') + +class MetricsTree_Distribution_UtxoCohorts: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.all: MetricsTree_Distribution_UtxoCohorts_All = MetricsTree_Distribution_UtxoCohorts_All(client) + self.age_range: MetricsTree_Distribution_UtxoCohorts_AgeRange = MetricsTree_Distribution_UtxoCohorts_AgeRange(client) + self.epoch: MetricsTree_Distribution_UtxoCohorts_Epoch = MetricsTree_Distribution_UtxoCohorts_Epoch(client) + self.year: MetricsTree_Distribution_UtxoCohorts_Year = MetricsTree_Distribution_UtxoCohorts_Year(client) + self.min_age: MetricsTree_Distribution_UtxoCohorts_MinAge = MetricsTree_Distribution_UtxoCohorts_MinAge(client) + self.ge_amount: MetricsTree_Distribution_UtxoCohorts_GeAmount = MetricsTree_Distribution_UtxoCohorts_GeAmount(client) + self.amount_range: MetricsTree_Distribution_UtxoCohorts_AmountRange = MetricsTree_Distribution_UtxoCohorts_AmountRange(client) + self.term: MetricsTree_Distribution_UtxoCohorts_Term = MetricsTree_Distribution_UtxoCohorts_Term(client) + self.type_: MetricsTree_Distribution_UtxoCohorts_Type = MetricsTree_Distribution_UtxoCohorts_Type(client) + self.max_age: MetricsTree_Distribution_UtxoCohorts_MaxAge = MetricsTree_Distribution_UtxoCohorts_MaxAge(client) + self.lt_amount: MetricsTree_Distribution_UtxoCohorts_LtAmount = MetricsTree_Distribution_UtxoCohorts_LtAmount(client) + +class MetricsTree_Distribution_AddressCohorts_GeAmount: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._1sat: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_over_1sat') + self._10sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_over_10sats') + self._100sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_over_100sats') + self._1k_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_over_1k_sats') + self._10k_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_over_10k_sats') + self._100k_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_over_100k_sats') + self._1m_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_over_1m_sats') + self._10m_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_over_10m_sats') + self._1btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_over_1btc') + self._10btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_over_10btc') + self._100btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_over_100btc') + self._1k_btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_over_1k_btc') + self._10k_btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_over_10k_btc') + +class MetricsTree_Distribution_AddressCohorts_AmountRange: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._0sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_with_0sats') + self._1sat_to_10sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_above_1sat_under_10sats') + self._10sats_to_100sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_above_10sats_under_100sats') + self._100sats_to_1k_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_above_100sats_under_1k_sats') + self._1k_sats_to_10k_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_above_1k_sats_under_10k_sats') + self._10k_sats_to_100k_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_above_10k_sats_under_100k_sats') + self._100k_sats_to_1m_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_above_100k_sats_under_1m_sats') + self._1m_sats_to_10m_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_above_1m_sats_under_10m_sats') + self._10m_sats_to_1btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_above_10m_sats_under_1btc') + self._1btc_to_10btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_above_1btc_under_10btc') + self._10btc_to_100btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_above_10btc_under_100btc') + self._100btc_to_1k_btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_above_100btc_under_1k_btc') + self._1k_btc_to_10k_btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_above_1k_btc_under_10k_btc') + self._10k_btc_to_100k_btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_above_10k_btc_under_100k_btc') + self._100k_btc_or_more: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_above_100k_btc') + +class MetricsTree_Distribution_AddressCohorts_LtAmount: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._10sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_under_10sats') + self._100sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_under_100sats') + self._1k_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_under_1k_sats') + self._10k_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_under_10k_sats') + self._100k_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_under_100k_sats') + self._1m_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_under_1m_sats') + self._10m_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_under_10m_sats') + self._1btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_under_1btc') + self._10btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_under_10btc') + self._100btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_under_100btc') + self._1k_btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_under_1k_btc') + self._10k_btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_under_10k_btc') + self._100k_btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_under_100k_btc') + +class MetricsTree_Distribution_AddressCohorts: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.ge_amount: MetricsTree_Distribution_AddressCohorts_GeAmount = MetricsTree_Distribution_AddressCohorts_GeAmount(client) + self.amount_range: MetricsTree_Distribution_AddressCohorts_AmountRange = MetricsTree_Distribution_AddressCohorts_AmountRange(client) + self.lt_amount: MetricsTree_Distribution_AddressCohorts_LtAmount = MetricsTree_Distribution_AddressCohorts_LtAmount(client) + +class MetricsTree_Distribution_AddressActivity: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.all: BalanceBothReactivatedReceivingSendingPattern = BalanceBothReactivatedReceivingSendingPattern(client, 'address_activity') + self.p2pk65: BalanceBothReactivatedReceivingSendingPattern = BalanceBothReactivatedReceivingSendingPattern(client, 'p2pk65_address_activity') + self.p2pk33: BalanceBothReactivatedReceivingSendingPattern = BalanceBothReactivatedReceivingSendingPattern(client, 'p2pk33_address_activity') + self.p2pkh: BalanceBothReactivatedReceivingSendingPattern = BalanceBothReactivatedReceivingSendingPattern(client, 'p2pkh_address_activity') + self.p2sh: BalanceBothReactivatedReceivingSendingPattern = BalanceBothReactivatedReceivingSendingPattern(client, 'p2sh_address_activity') + self.p2wpkh: BalanceBothReactivatedReceivingSendingPattern = BalanceBothReactivatedReceivingSendingPattern(client, 'p2wpkh_address_activity') + self.p2wsh: BalanceBothReactivatedReceivingSendingPattern = BalanceBothReactivatedReceivingSendingPattern(client, 'p2wsh_address_activity') + self.p2tr: BalanceBothReactivatedReceivingSendingPattern = BalanceBothReactivatedReceivingSendingPattern(client, 'p2tr_address_activity') + self.p2a: BalanceBothReactivatedReceivingSendingPattern = BalanceBothReactivatedReceivingSendingPattern(client, 'p2a_address_activity') + +class MetricsTree_Distribution_NewAddrCount: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.all: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2[StoredU64] = AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, 'new_addr_count') + self.p2pk65: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2[StoredU64] = AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, 'p2pk65_new_addr_count') + self.p2pk33: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2[StoredU64] = AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, 'p2pk33_new_addr_count') + self.p2pkh: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2[StoredU64] = AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, 'p2pkh_new_addr_count') + self.p2sh: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2[StoredU64] = AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, 'p2sh_new_addr_count') + self.p2wpkh: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2[StoredU64] = AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, 'p2wpkh_new_addr_count') + self.p2wsh: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2[StoredU64] = AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, 'p2wsh_new_addr_count') + self.p2tr: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2[StoredU64] = AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, 'p2tr_new_addr_count') + self.p2a: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2[StoredU64] = AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, 'p2a_new_addr_count') + +class MetricsTree_Distribution_GrowthRate: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.all: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern[StoredF32] = AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, 'growth_rate') + self.p2pk65: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern[StoredF32] = AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, 'p2pk65_growth_rate') + self.p2pk33: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern[StoredF32] = AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, 'p2pk33_growth_rate') + self.p2pkh: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern[StoredF32] = AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, 'p2pkh_growth_rate') + self.p2sh: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern[StoredF32] = AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, 'p2sh_growth_rate') + self.p2wpkh: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern[StoredF32] = AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, 'p2wpkh_growth_rate') + self.p2wsh: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern[StoredF32] = AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, 'p2wsh_growth_rate') + self.p2tr: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern[StoredF32] = AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, 'p2tr_growth_rate') + self.p2a: AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern[StoredF32] = AverageBaseMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, 'p2a_growth_rate') + +class MetricsTree_Distribution: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.chain_state: MetricPattern11[SupplyState] = MetricPattern11(client, 'chain') + self.any_address_indexes: MetricsTree_Distribution_AnyAddressIndexes = MetricsTree_Distribution_AnyAddressIndexes(client) + self.addresses_data: MetricsTree_Distribution_AddressesData = MetricsTree_Distribution_AddressesData(client) + self.utxo_cohorts: MetricsTree_Distribution_UtxoCohorts = MetricsTree_Distribution_UtxoCohorts(client) + self.address_cohorts: MetricsTree_Distribution_AddressCohorts = MetricsTree_Distribution_AddressCohorts(client) + self.addr_count: AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern = AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern(client, 'addr_count') + self.empty_addr_count: AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern = AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern(client, 'empty_addr_count') + self.address_activity: MetricsTree_Distribution_AddressActivity = MetricsTree_Distribution_AddressActivity(client) + self.total_addr_count: AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern = AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern(client, 'total_addr_count') + self.new_addr_count: MetricsTree_Distribution_NewAddrCount = MetricsTree_Distribution_NewAddrCount(client) + self.growth_rate: MetricsTree_Distribution_GrowthRate = MetricsTree_Distribution_GrowthRate(client) + self.loadedaddressindex: MetricPattern31[LoadedAddressIndex] = MetricPattern31(client, 'loadedaddressindex') + self.emptyaddressindex: MetricPattern32[EmptyAddressIndex] = MetricPattern32(client, 'emptyaddressindex') class MetricsTree_Supply_Circulating: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): + self.sats: MetricPattern3[Sats] = MetricPattern3(client, 'circulating_supply') self.bitcoin: MetricPattern3[Bitcoin] = MetricPattern3(client, 'circulating_supply_btc') self.dollars: MetricPattern3[Dollars] = MetricPattern3(client, 'circulating_supply_usd') - self.sats: MetricPattern3[Sats] = MetricPattern3(client, 'circulating_supply') + +class MetricsTree_Supply_Burned: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.opreturn: BitcoinDollarsSatsPattern3 = BitcoinDollarsSatsPattern3(client, 'opreturn_supply') + self.unspendable: BitcoinDollarsSatsPattern3 = BitcoinDollarsSatsPattern3(client, 'unspendable_supply') class MetricsTree_Supply_Velocity: """Metrics tree node.""" @@ -4054,107 +4215,36 @@ class MetricsTree_Supply: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.burned: MetricsTree_Supply_Burned = MetricsTree_Supply_Burned(client) self.circulating: MetricsTree_Supply_Circulating = MetricsTree_Supply_Circulating(client) + self.burned: MetricsTree_Supply_Burned = MetricsTree_Supply_Burned(client) self.inflation: MetricPattern4[StoredF32] = MetricPattern4(client, 'inflation_rate') - self.market_cap: MetricPattern1[Dollars] = MetricPattern1(client, 'market_cap') self.velocity: MetricsTree_Supply_Velocity = MetricsTree_Supply_Velocity(client) - -class MetricsTree_Transactions_Count: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.is_coinbase: MetricPattern27[StoredBool] = MetricPattern27(client, 'is_coinbase') - self.tx_count: DollarsPattern[StoredU64] = DollarsPattern(client, 'tx_count') - -class MetricsTree_Transactions_Fees_Fee: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.bitcoin: CountPattern2[Bitcoin] = CountPattern2(client, 'fee_btc') - self.dollars: CountPattern2[Dollars] = CountPattern2(client, 'fee_usd') - self.sats: CountPattern2[Sats] = CountPattern2(client, 'fee') - self.txindex: MetricPattern27[Sats] = MetricPattern27(client, 'fee') - -class MetricsTree_Transactions_Fees: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.fee: MetricsTree_Transactions_Fees_Fee = MetricsTree_Transactions_Fees_Fee(client) - self.fee_rate: FeeRatePattern[FeeRate] = FeeRatePattern(client, 'fee_rate') - self.input_value: MetricPattern27[Sats] = MetricPattern27(client, 'input_value') - self.output_value: MetricPattern27[Sats] = MetricPattern27(client, 'output_value') - -class MetricsTree_Transactions_Size: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.vsize: FeeRatePattern[VSize] = FeeRatePattern(client, 'tx_vsize') - self.weight: FeeRatePattern[Weight] = FeeRatePattern(client, 'tx_weight') - -class MetricsTree_Transactions_Versions: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.v1: BlockCountPattern[StoredU64] = BlockCountPattern(client, 'tx_v1') - self.v2: BlockCountPattern[StoredU64] = BlockCountPattern(client, 'tx_v2') - self.v3: BlockCountPattern[StoredU64] = BlockCountPattern(client, 'tx_v3') - -class MetricsTree_Transactions_Volume: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.annualized_volume: _2015Pattern = _2015Pattern(client, 'annualized_volume') - self.inputs_per_sec: MetricPattern4[StoredF32] = MetricPattern4(client, 'inputs_per_sec') - self.outputs_per_sec: MetricPattern4[StoredF32] = MetricPattern4(client, 'outputs_per_sec') - self.received_sum: ActiveSupplyPattern = ActiveSupplyPattern(client, 'received_sum') - self.sent_sum: ActiveSupplyPattern = ActiveSupplyPattern(client, 'sent_sum') - self.tx_per_sec: MetricPattern4[StoredF32] = MetricPattern4(client, 'tx_per_sec') - -class MetricsTree_Transactions: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.base_size: MetricPattern27[StoredU32] = MetricPattern27(client, 'base_size') - self.count: MetricsTree_Transactions_Count = MetricsTree_Transactions_Count(client) - self.fees: MetricsTree_Transactions_Fees = MetricsTree_Transactions_Fees(client) - self.first_txindex: MetricPattern11[TxIndex] = MetricPattern11(client, 'first_txindex') - self.first_txinindex: MetricPattern27[TxInIndex] = MetricPattern27(client, 'first_txinindex') - self.first_txoutindex: MetricPattern27[TxOutIndex] = MetricPattern27(client, 'first_txoutindex') - self.height: MetricPattern27[Height] = MetricPattern27(client, 'height') - self.is_explicitly_rbf: MetricPattern27[StoredBool] = MetricPattern27(client, 'is_explicitly_rbf') - self.rawlocktime: MetricPattern27[RawLockTime] = MetricPattern27(client, 'rawlocktime') - self.size: MetricsTree_Transactions_Size = MetricsTree_Transactions_Size(client) - self.total_size: MetricPattern27[StoredU32] = MetricPattern27(client, 'total_size') - self.txid: MetricPattern27[Txid] = MetricPattern27(client, 'txid') - self.txversion: MetricPattern27[TxVersion] = MetricPattern27(client, 'txversion') - self.versions: MetricsTree_Transactions_Versions = MetricsTree_Transactions_Versions(client) - self.volume: MetricsTree_Transactions_Volume = MetricsTree_Transactions_Volume(client) + self.market_cap: MetricPattern1[Dollars] = MetricPattern1(client, 'market_cap') class MetricsTree: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.addresses: MetricsTree_Addresses = MetricsTree_Addresses(client) self.blocks: MetricsTree_Blocks = MetricsTree_Blocks(client) + self.transactions: MetricsTree_Transactions = MetricsTree_Transactions(client) + self.inputs: MetricsTree_Inputs = MetricsTree_Inputs(client) + self.outputs: MetricsTree_Outputs = MetricsTree_Outputs(client) + self.addresses: MetricsTree_Addresses = MetricsTree_Addresses(client) + self.scripts: MetricsTree_Scripts = MetricsTree_Scripts(client) + self.positions: MetricsTree_Positions = MetricsTree_Positions(client) self.cointime: MetricsTree_Cointime = MetricsTree_Cointime(client) self.constants: MetricsTree_Constants = MetricsTree_Constants(client) - self.distribution: MetricsTree_Distribution = MetricsTree_Distribution(client) self.indexes: MetricsTree_Indexes = MetricsTree_Indexes(client) - self.inputs: MetricsTree_Inputs = MetricsTree_Inputs(client) self.market: MetricsTree_Market = MetricsTree_Market(client) - self.outputs: MetricsTree_Outputs = MetricsTree_Outputs(client) self.pools: MetricsTree_Pools = MetricsTree_Pools(client) - self.positions: MetricsTree_Positions = MetricsTree_Positions(client) self.price: MetricsTree_Price = MetricsTree_Price(client) - self.scripts: MetricsTree_Scripts = MetricsTree_Scripts(client) + self.distribution: MetricsTree_Distribution = MetricsTree_Distribution(client) self.supply: MetricsTree_Supply = MetricsTree_Supply(client) - self.transactions: MetricsTree_Transactions = MetricsTree_Transactions(client) class BrkClient(BrkClientBase): """Main BRK client with metrics tree and API methods.""" - VERSION = "v0.1.1" + VERSION = "v0.1.2" INDEXES = [ "dateindex", diff --git a/website/scripts/chart/index.js b/website/scripts/chart/index.js index 25d6299ac..7c6658d7c 100644 --- a/website/scripts/chart/index.js +++ b/website/scripts/chart/index.js @@ -33,7 +33,6 @@ import { style } from "../utils/elements.js"; /** * @template T * @typedef {Object} Series - * @property {string} key * @property {string} id * @property {number} paneIndex * @property {PersistedValue} active @@ -448,16 +447,12 @@ export function createChart({ parent, id: chartId, brk, fitContent }) { }; const serieses = { - /** @type {Map>} */ - activeStates: new Map(), - /** @type {Map>} */ - byKey: new Map(), + /** @type {Set} */ + all: new Set(), refreshAll() { - serieses.byKey.forEach((set) => { - set.forEach((s) => { - if (s.active.value) s.fetch?.(); - }); + serieses.all.forEach((s) => { + if (s.active.value) s.fetch?.(); }); }, @@ -503,17 +498,12 @@ export function createChart({ parent, id: chartId, brk, fitContent }) { const key = customKey ?? stringToId(name); const id = `${unit.id}-${key}`; - // Reuse existing state if same name (links legends across panes, regardless of unit) - const existingActive = serieses.activeStates.get(key); - const active = - existingActive ?? - createPersistedValue({ - defaultValue: defaultActive ?? true, - storageKey: key, - urlKey: key, - ...serdeBool, - }); - if (!existingActive) serieses.activeStates.set(key, active); + const active = createPersistedValue({ + defaultValue: defaultActive ?? true, + storageKey: `${chartId}-p${paneIndex}-${key}`, + urlKey: `${paneIndex === 0 ? "t" : "b"}-${key}`, + ...serdeBool, + }); setOrder(-order); @@ -533,18 +523,9 @@ export function createChart({ parent, id: chartId, brk, fitContent }) { setActive(value) { const wasActive = active.value; active.set(value); - const linkedSeries = serieses.byKey.get(key); - linkedSeries?.forEach((s) => { - value ? s.show() : s.hide(); - }); - document.querySelectorAll(`[data-series="${key}"]`).forEach((el) => { - if (el instanceof HTMLInputElement && el.type === "checkbox") { - el.checked = value; - } - }); - // Fetch data for ALL linked series, not just this one + value ? show() : hide(); if (value && !wasActive) { - linkedSeries?.forEach((s) => s.fetch?.()); + _fetch?.(); } panes.updateVisibility(); }, @@ -555,7 +536,6 @@ export function createChart({ parent, id: chartId, brk, fitContent }) { tame, hasData: () => hasData, fetch: () => _fetch?.(), - key, id, paneIndex, url: null, @@ -563,18 +543,12 @@ export function createChart({ parent, id: chartId, brk, fitContent }) { update, remove() { onRemove(); - serieses.byKey.get(key)?.delete(series); + serieses.all.delete(series); panes.seriesByHome.get(paneIndex)?.delete(series); }, }; - // Register series for cross-pane linking (by name only) - let keySet = serieses.byKey.get(key); - if (!keySet) { - keySet = new Set(); - serieses.byKey.set(key, keySet); - } - keySet.add(series); + serieses.all.add(series); /** @param {ChartableIndex} idx */ function setupIndexEffect(idx) { @@ -1312,35 +1286,28 @@ export function createChart({ parent, id: chartId, brk, fitContent }) { deserialize: (s) => /** @type {"lin" | "log"} */ (s), }); - /** @param {"lin" | "log"} value */ - const applyScale = (value) => { - panes.whenReady(paneIndex, () => { - try { - ichart - .panes() - .at(paneIndex) - ?.priceScale("right") - .applyOptions({ - mode: value === "lin" ? 0 : 1, - }); - } catch {} - }); + /** @param {IPaneApi