diff --git a/crates/brk_bindgen/src/analysis/positions.rs b/crates/brk_bindgen/src/analysis/positions.rs index 454136e8f..cf833ef29 100644 --- a/crates/brk_bindgen/src/analysis/positions.rs +++ b/crates/brk_bindgen/src/analysis/positions.rs @@ -24,6 +24,8 @@ struct InstanceAnalysis { field_parts: BTreeMap, /// Whether this instance appears to be suffix mode is_suffix_mode: bool, + /// Whether children have no common prefix/suffix (outlier naming like sopr/asopr) + has_outlier: bool, } /// Analyze all pattern instances and determine their modes. @@ -54,9 +56,127 @@ pub fn analyze_pattern_modes( } } + // Second pass: fill mixed-empty field_parts now that pattern modes are known. + fill_mixed_empty_field_parts(tree, "", pattern_lookup, patterns, &mut node_bases); + + // Re-collect analyses from updated node_bases and re-determine pattern modes + let mut all_analyses2: BTreeMap> = BTreeMap::new(); + collect_updated_analyses(tree, "", pattern_lookup, &node_bases, &mut all_analyses2); + for pattern in patterns.iter_mut() { + if let Some(analyses) = all_analyses2.get(&pattern.name) { + pattern.mode = determine_pattern_mode(analyses, &pattern.fields); + } + } + node_bases } +/// Re-collect instance analyses from updated node_bases for pattern mode redetermination. +fn collect_updated_analyses( + node: &TreeNode, + path: &str, + pattern_lookup: &BTreeMap, String>, + node_bases: &BTreeMap, + all_analyses: &mut BTreeMap>, +) { + let TreeNode::Branch(children) = node else { + return; + }; + + for (field_name, child_node) in children { + let child_path = build_child_path(path, field_name); + collect_updated_analyses(child_node, &child_path, pattern_lookup, node_bases, all_analyses); + } + + let fields = get_node_fields(children, pattern_lookup); + if let Some(pattern_name) = pattern_lookup.get(&fields) { + if let Some(base_result) = node_bases.get(path) { + all_analyses + .entry(pattern_name.clone()) + .or_default() + .push(InstanceAnalysis { + base: base_result.base.clone(), + field_parts: base_result.field_parts.clone(), + is_suffix_mode: base_result.is_suffix_mode, + has_outlier: base_result.has_outlier, + }); + } + } +} + +/// Second pass: fill empty field_parts for nodes that have a mix of empty and +/// non-empty parts, using shortest leaf names for children that need disc. +fn fill_mixed_empty_field_parts( + node: &TreeNode, + path: &str, + pattern_lookup: &BTreeMap, String>, + patterns: &[StructuralPattern], + node_bases: &mut BTreeMap, +) { + let TreeNode::Branch(children) = node else { + return; + }; + + // Recurse first (bottom-up) + for (field_name, child_node) in children { + let child_path = build_child_path(path, field_name); + fill_mixed_empty_field_parts(child_node, &child_path, pattern_lookup, patterns, node_bases); + } + + // Check if this node has mixed empty/non-empty field_parts + let Some(base_result) = node_bases.get(path) else { + return; + }; + let has_empty = base_result.field_parts.values().any(|v| v.is_empty()); + let has_nonempty = base_result.field_parts.values().any(|v| !v.is_empty()); + if !has_empty || !has_nonempty { + return; + } + + let prefix = format!("{}_", base_result.base); + let mut updates: Vec<(String, String)> = Vec::new(); + + for (field_name, child_node) in children { + let part = base_result.field_parts.get(field_name.as_str()); + if !part.is_some_and(|p| p.is_empty()) { + continue; + } + + // Check if the child's pattern is templated (needs disc from parent) + let child_pattern_is_templated = if let TreeNode::Branch(ch) = child_node { + let child_fields = get_node_fields(ch, pattern_lookup); + pattern_lookup + .get(&child_fields) + .and_then(|name| patterns.iter().find(|p| &p.name == name)) + .is_some_and(|p| p.is_templated()) + } else { + false + }; + + // Only fill if the child needs disc (templated) or is a leaf + let is_leaf = matches!(child_node, TreeNode::Leaf(_)); + if !child_pattern_is_templated && !is_leaf { + continue; + } + + if let Some(leaf) = get_shortest_leaf_name(child_node) + && let Some(suffix) = leaf.strip_prefix(&prefix) + && !suffix.is_empty() + && suffix.contains(field_name.trim_start_matches('_')) + && suffix.len() > field_name.trim_start_matches('_').len() + { + updates.push((field_name.clone(), suffix.to_string())); + } + } + + if !updates.is_empty() { + let base_result = node_bases.get_mut(path).unwrap(); + for (field_name, suffix) in updates { + base_result.field_parts.insert(field_name, suffix); + } + } +} + /// Recursively collect instance analyses bottom-up. /// Returns the "base" for this node (used by parent for its analysis). /// @@ -98,52 +218,52 @@ fn collect_instance_analyses( // When some field_parts are empty (children returned the same base), // replace empty parts with discriminators derived from shortest leaf names. - let has_empty = analysis.field_parts.values().any(|v| v.is_empty()); - let has_nonempty = analysis.field_parts.values().any(|v| !v.is_empty()); - if has_empty && has_nonempty { - // Mixed case: some fields have parts, some don't. - // Use shortest leaf to derive discriminators for empty fields. + let all_empty = analysis.field_parts.len() > 1 + && analysis.field_parts.values().all(|v| v.is_empty()); + if all_empty { + // All-empty case: all children returned the same base. + // Use shortest leaf to derive field_parts for fields whose key + // matches the metric suffix (e.g., pct1 → suffix "pct1"). let prefix = format!("{}_", analysis.base); + let mut any_filled = false; for (field_name, child_node) in children { if let Some(part) = analysis.field_parts.get(field_name) && part.is_empty() && let Some(leaf) = get_shortest_leaf_name(child_node) && let Some(suffix) = leaf.strip_prefix(&prefix) && !suffix.is_empty() - // Only use if the suffix starts with the field key, - // avoiding internal sub-field names like "0sd" from a Price child && suffix.starts_with(field_name.trim_start_matches('_')) { analysis .field_parts .insert(field_name.clone(), suffix.to_string()); + any_filled = true; } } - } else if has_empty && analysis.field_parts.len() > 1 { - // All-empty case: all children returned the same base. - // Re-analyze using shortest leaf names which may differentiate. - let mut leaf_bases: BTreeMap = BTreeMap::new(); - for (field_name, child_node) in children { - if let Some(leaf) = get_shortest_leaf_name(child_node) { - leaf_bases.insert(field_name.clone(), leaf); - } - } - if leaf_bases.len() == child_bases.len() { - let leaf_analysis = analyze_instance(&leaf_bases); - if !leaf_analysis.field_parts.values().all(|v| v.is_empty()) { - analysis.field_parts = leaf_analysis.field_parts; + + // If no fields could be filled and all children are the same type, + // mark as outlier so the tree inlines instead of using identity + // (handles patterns like period windows where field keys differ + // from metric suffixes: all/_4y don't match 0sd/0sd_4y). + // When children are different types (like absolute/rate), identity + // is correct — each child handles its own suffixes internally. + if !any_filled { + let child_fields = get_node_fields(children, pattern_lookup); + let all_same_type = child_fields + .windows(2) + .all(|w| w[0].rust_type == w[1].rust_type); + if all_same_type { + analysis.has_outlier = true; } } } // Store the base result for this node - // Note: has_outlier is false because we use recursive base computation - // which gives correct bases without needing outlier detection node_bases.insert( path.to_string(), PatternBaseResult { base: analysis.base.clone(), - has_outlier: false, + has_outlier: analysis.has_outlier, is_suffix_mode: analysis.is_suffix_mode, field_parts: analysis.field_parts.clone(), }, @@ -158,8 +278,14 @@ fn collect_instance_analyses( .push(analysis.clone()); } - // Return the base for parent - Some(analysis.base) + // Return the base for parent. + // For outlier nodes (no common prefix among children), return the + // shortest leaf name so the parent can still detect naming patterns. + if analysis.has_outlier { + Some(get_shortest_leaf_name(node).unwrap_or(analysis.base)) + } else { + Some(analysis.base) + } } } } @@ -179,14 +305,13 @@ fn try_detect_template( return None; } - // Strategy 1: Find an embedded discriminator (shortest non-empty field_part - // that differs between instances and appears as substring in other parts) - if let Some(mode) = try_embedded_disc(majority, fields) { + // Strategy 1: suffix discriminator (e.g., ratio_sd vs ratio_sd_4y) + if let Some(mode) = try_suffix_disc(majority, fields) { return Some(mode); } - // Strategy 2: Find a common suffix difference across ALL field_parts - try_suffix_disc(majority, fields) + // Strategy 2: embedded discriminator (e.g., ratio_pct99_bps vs ratio_pct1_bps) + try_embedded_disc(majority, fields) } /// Strategy 1: embedded discriminator (e.g., pct99 inside ratio_pct99_bps) @@ -241,9 +366,11 @@ fn try_suffix_disc( ) -> Option { let first = &majority[0]; - // For each other instance, check if ALL field_parts differ from the first - // by the same suffix. Use the first field to detect the suffix. - let ref_field = &fields[0].name; + // Use a non-empty field to detect the suffix + let ref_field = fields + .iter() + .find(|f| first.field_parts.get(&f.name).is_some_and(|v| !v.is_empty())) + .map(|f| &f.name)?; let ref_first = first.field_parts.get(ref_field)?; // Build templates from the first instance @@ -268,8 +395,13 @@ fn try_suffix_disc( let other_part = analysis.field_parts.get(&field.name)?; if first_part.is_empty() { - // Identity field — must stay empty in all instances - if !other_part.is_empty() { + // Identity field — must be empty OR equal to the suffix + if other_part.is_empty() { + // stays empty — ok + } else if other_part == suffix { + // empty in first, equals suffix in other — disc IS the part + templates.insert(field.name.clone(), "{disc}".to_string()); + } else { return None; } } else { @@ -312,11 +444,11 @@ fn analyze_instance(child_bases: &BTreeMap) -> InstanceAnalysis // period windows (all/_4y/_2y/_1y) where children differ by a suffix // that corresponds to the tree key. if field_parts.len() > 1 && field_parts.values().all(|v| v.is_empty()) { - // Can't differentiate — this pattern is non-parameterizable return InstanceAnalysis { base, field_parts, is_suffix_mode: true, + has_outlier: false, }; } @@ -324,6 +456,7 @@ fn analyze_instance(child_bases: &BTreeMap) -> InstanceAnalysis base, field_parts, is_suffix_mode: true, + has_outlier: false, }; } @@ -345,12 +478,13 @@ fn analyze_instance(child_bases: &BTreeMap) -> InstanceAnalysis base, field_parts, is_suffix_mode: false, + has_outlier: false, }; } // No common prefix or suffix - use empty base so _m(base, relative) returns just the relative. - // This handles cases like utxo_cohorts.all.activity where children have completely - // different bases (coinblocks_destroyed, coindays_destroyed, etc.) + // No common prefix or suffix — outlier naming (e.g., sopr/asopr/adj_). + // Children have unrelated metric names that can't be parameterized. let field_parts = child_bases .iter() .map(|(k, v)| (k.clone(), v.clone())) @@ -360,6 +494,7 @@ fn analyze_instance(child_bases: &BTreeMap) -> InstanceAnalysis base: String::new(), field_parts, is_suffix_mode: true, + has_outlier: true, } } @@ -372,6 +507,12 @@ fn determine_pattern_mode( ) -> Option { analyses.first()?; + // If any instance has outlier naming (no common prefix/suffix among children), + // the pattern can't be parameterized. + if analyses.iter().any(|a| a.has_outlier) { + return None; + } + // Pick the majority mode let suffix_count = analyses.iter().filter(|a| a.is_suffix_mode).count(); let is_suffix = suffix_count * 2 >= analyses.len(); @@ -521,6 +662,7 @@ mod tests { .into_iter() .collect(), is_suffix_mode: true, + has_outlier: false, }; let suffix2 = InstanceAnalysis { base: "sth_cost_basis".to_string(), @@ -532,6 +674,7 @@ mod tests { .into_iter() .collect(), is_suffix_mode: true, + has_outlier: false, }; let suffix3 = InstanceAnalysis { base: "utxo_cost_basis".to_string(), @@ -543,6 +686,7 @@ mod tests { .into_iter() .collect(), is_suffix_mode: true, + has_outlier: false, }; // 1 prefix mode instance (minority - root level) @@ -556,6 +700,7 @@ mod tests { .into_iter() .collect(), is_suffix_mode: false, + has_outlier: false, }; let analyses = vec![suffix1, suffix2, suffix3, prefix1]; @@ -606,6 +751,7 @@ mod tests { .into_iter() .collect(), is_suffix_mode: true, + has_outlier: false, }; let instance2 = InstanceAnalysis { base: "metric_b".to_string(), @@ -616,6 +762,7 @@ mod tests { .into_iter() .collect(), is_suffix_mode: true, + has_outlier: false, }; let analyses = vec![instance1, instance2]; @@ -631,4 +778,366 @@ mod tests { PatternMode::Templated { .. } => panic!("Expected suffix mode, got templated"), } } + + #[test] + fn test_embedded_disc_percentile_bands() { + use std::collections::BTreeSet; + let fields = vec![ + PatternField { name: "bps".into(), rust_type: "T".into(), json_type: "n".into(), indexes: BTreeSet::new(), type_param: None }, + PatternField { name: "price".into(), rust_type: "T".into(), json_type: "n".into(), indexes: BTreeSet::new(), type_param: None }, + PatternField { name: "ratio".into(), rust_type: "T".into(), json_type: "n".into(), indexes: BTreeSet::new(), type_param: None }, + ]; + let pct99 = InstanceAnalysis { + base: "realized_price".into(), + field_parts: [("bps".into(), "ratio_pct99_bps".into()), ("price".into(), "pct99".into()), ("ratio".into(), "ratio_pct99".into())].into_iter().collect(), + is_suffix_mode: true, has_outlier: false, + }; + let pct1 = InstanceAnalysis { + base: "realized_price".into(), + field_parts: [("bps".into(), "ratio_pct1_bps".into()), ("price".into(), "pct1".into()), ("ratio".into(), "ratio_pct1".into())].into_iter().collect(), + is_suffix_mode: true, has_outlier: false, + }; + let mode = determine_pattern_mode(&[pct99, pct1], &fields); + assert!(mode.is_some()); + match mode.unwrap() { + PatternMode::Templated { templates } => { + assert_eq!(templates.get("bps").unwrap(), "ratio_{disc}_bps"); + assert_eq!(templates.get("price").unwrap(), "{disc}"); + assert_eq!(templates.get("ratio").unwrap(), "ratio_{disc}"); + } + other => panic!("Expected Templated, got {:?}", other), + } + } + + #[test] + fn test_suffix_disc_period_windows() { + use std::collections::BTreeSet; + let fields = vec![ + PatternField { name: "p1sd".into(), rust_type: "T".into(), json_type: "n".into(), indexes: BTreeSet::new(), type_param: None }, + PatternField { name: "sd".into(), rust_type: "T".into(), json_type: "n".into(), indexes: BTreeSet::new(), type_param: None }, + PatternField { name: "zscore".into(), rust_type: "T".into(), json_type: "n".into(), indexes: BTreeSet::new(), type_param: None }, + ]; + let all_time = InstanceAnalysis { + base: "realized_price".into(), + field_parts: [("p1sd".into(), "p1sd".into()), ("sd".into(), "ratio_sd".into()), ("zscore".into(), "ratio_zscore".into())].into_iter().collect(), + is_suffix_mode: true, has_outlier: false, + }; + let four_year = InstanceAnalysis { + base: "realized_price".into(), + field_parts: [("p1sd".into(), "p1sd_4y".into()), ("sd".into(), "ratio_sd_4y".into()), ("zscore".into(), "ratio_zscore_4y".into())].into_iter().collect(), + is_suffix_mode: true, has_outlier: false, + }; + let mode = determine_pattern_mode(&[all_time, four_year], &fields); + assert!(mode.is_some()); + match mode.unwrap() { + PatternMode::Templated { templates } => { + assert_eq!(templates.get("p1sd").unwrap(), "p1sd{disc}"); + assert_eq!(templates.get("sd").unwrap(), "ratio_sd{disc}"); + assert_eq!(templates.get("zscore").unwrap(), "ratio_zscore{disc}"); + } + other => panic!("Expected Templated, got {:?}", other), + } + } + + #[test] + fn test_suffix_disc_with_empty_fields() { + use std::collections::BTreeSet; + let fields = vec![ + PatternField { name: "band".into(), rust_type: "T".into(), json_type: "n".into(), indexes: BTreeSet::new(), type_param: None }, + PatternField { name: "sd".into(), rust_type: "T".into(), json_type: "n".into(), indexes: BTreeSet::new(), type_param: None }, + ]; + let all_time = InstanceAnalysis { + base: "price".into(), + field_parts: [("band".into(), "".into()), ("sd".into(), "ratio_sd".into())].into_iter().collect(), + is_suffix_mode: true, has_outlier: false, + }; + let four_year = InstanceAnalysis { + base: "price".into(), + field_parts: [("band".into(), "".into()), ("sd".into(), "ratio_sd_4y".into())].into_iter().collect(), + is_suffix_mode: true, has_outlier: false, + }; + let mode = determine_pattern_mode(&[all_time, four_year], &fields); + assert!(mode.is_some()); + match mode.unwrap() { + PatternMode::Templated { templates } => { + assert_eq!(templates.get("band").unwrap(), ""); + assert_eq!(templates.get("sd").unwrap(), "ratio_sd{disc}"); + } + other => panic!("Expected Templated, got {:?}", other), + } + } + + #[test] + fn test_suffix_disc_empty_to_nonempty() { + use std::collections::BTreeSet; + let fields = vec![ + PatternField { name: "all".into(), rust_type: "T".into(), json_type: "n".into(), indexes: BTreeSet::new(), type_param: None }, + PatternField { name: "sth".into(), rust_type: "T".into(), json_type: "n".into(), indexes: BTreeSet::new(), type_param: None }, + ]; + let regular = InstanceAnalysis { + base: "supply".into(), + field_parts: [("all".into(), "".into()), ("sth".into(), "sth_".into())].into_iter().collect(), + is_suffix_mode: true, has_outlier: false, + }; + let profitability = InstanceAnalysis { + base: "utxos_in_profit".into(), + field_parts: [("all".into(), "supply".into()), ("sth".into(), "sth_supply".into())].into_iter().collect(), + is_suffix_mode: true, has_outlier: false, + }; + let mode = determine_pattern_mode(&[regular, profitability], &fields); + assert!(mode.is_some()); + match mode.unwrap() { + PatternMode::Templated { templates } => { + assert_eq!(templates.get("all").unwrap(), "{disc}"); + assert_eq!(templates.get("sth").unwrap(), "sth_{disc}"); + } + other => panic!("Expected Templated, got {:?}", other), + } + } + + #[test] + fn test_outlier_rejects_pattern() { + use std::collections::BTreeSet; + let fields = vec![ + PatternField { name: "ratio".into(), rust_type: "T".into(), json_type: "n".into(), indexes: BTreeSet::new(), type_param: None }, + PatternField { name: "value".into(), rust_type: "T".into(), json_type: "n".into(), indexes: BTreeSet::new(), type_param: None }, + ]; + // SOPR case: one instance has outlier naming (no common prefix) + let normal = InstanceAnalysis { + base: "metric".into(), + field_parts: [("ratio".into(), "ratio".into()), ("value".into(), "value".into())].into_iter().collect(), + is_suffix_mode: true, has_outlier: false, + }; + let outlier = InstanceAnalysis { + base: "".into(), + field_parts: [("ratio".into(), "asopr".into()), ("value".into(), "adj_value".into())].into_iter().collect(), + is_suffix_mode: true, has_outlier: true, + }; + let mode = determine_pattern_mode(&[normal, outlier], &fields); + assert!(mode.is_none(), "Pattern with outlier instance should be non-parameterizable"); + } + + #[test] + fn test_unanimity_rejects_disagreeing_instances() { + use std::collections::BTreeSet; + let fields = vec![ + PatternField { name: "a".into(), rust_type: "T".into(), json_type: "n".into(), indexes: BTreeSet::new(), type_param: None }, + PatternField { name: "b".into(), rust_type: "T".into(), json_type: "n".into(), indexes: BTreeSet::new(), type_param: None }, + ]; + let inst1 = InstanceAnalysis { + base: "x".into(), + field_parts: [("a".into(), "foo".into()), ("b".into(), "bar".into())].into_iter().collect(), + is_suffix_mode: true, has_outlier: false, + }; + let inst2 = InstanceAnalysis { + base: "y".into(), + field_parts: [("a".into(), "baz".into()), ("b".into(), "qux".into())].into_iter().collect(), + is_suffix_mode: true, has_outlier: false, + }; + let mode = determine_pattern_mode(&[inst1, inst2], &fields); + assert!(mode.is_none(), "Should be non-parameterizable when no pattern detected"); + } + + #[test] + fn test_all_empty_different_types_uses_identity() { + // AbsoluteRatePattern: absolute (_1m1w1y24hPattern) and rate (_1m1w1y24hPattern2) + // have different types. Both return the same base → all-empty field_parts. + // Should keep identity (empty parts) so both children receive acc unchanged. + use std::collections::BTreeSet; + let fields = vec![ + PatternField { name: "absolute".into(), rust_type: "TypeA".into(), json_type: "n".into(), indexes: BTreeSet::new(), type_param: None }, + PatternField { name: "rate".into(), rust_type: "TypeB".into(), json_type: "n".into(), indexes: BTreeSet::new(), type_param: None }, + ]; + let inst = InstanceAnalysis { + base: "supply_delta".into(), + field_parts: [("absolute".into(), "".into()), ("rate".into(), "".into())].into_iter().collect(), + is_suffix_mode: true, has_outlier: false, + }; + let mode = determine_pattern_mode(&[inst], &fields); + assert!(mode.is_some()); + match mode.unwrap() { + PatternMode::Suffix { relatives } => { + assert_eq!(relatives.get("absolute"), Some(&"".to_string()), "absolute should be identity"); + assert_eq!(relatives.get("rate"), Some(&"".to_string()), "rate should be identity"); + } + other => panic!("Expected Suffix with identity, got {:?}", other), + } + } + + #[test] + fn test_all_empty_same_type_marks_outlier() { + // RatioPerBlockStdDevBands: all children are the same type (StdDevPerBlockExtended) + // and all return the same base → all-empty field_parts. + // Should be marked as outlier so the tree inlines instead of using a + // factory that can't differentiate the children. + let mut child_bases = BTreeMap::new(); + child_bases.insert("all".to_string(), "realized_price".to_string()); + child_bases.insert("_4y".to_string(), "realized_price".to_string()); + child_bases.insert("_2y".to_string(), "realized_price".to_string()); + child_bases.insert("_1y".to_string(), "realized_price".to_string()); + + let analysis = analyze_instance(&child_bases); + + assert_eq!(analysis.base, "realized_price"); + assert!( + analysis.field_parts.values().all(|v| v.is_empty()), + "All field_parts should be empty when children return same base" + ); + // Note: has_outlier is set by collect_instance_analyses based on + // all_same_type check, not by analyze_instance directly. + // The test for outlier detection is via determine_pattern_mode + // with has_outlier flag set. + } + + #[test] + fn test_non_parameterizable_cascade() { + // When a pattern has outlier instances, determine_pattern_mode returns None. + // Parent patterns containing non-parameterizable children should also + // be detected via metadata.is_parameterizable (recursive check). + use std::collections::BTreeSet; + let fields = vec![ + PatternField { name: "a".into(), rust_type: "T".into(), json_type: "n".into(), indexes: BTreeSet::new(), type_param: None }, + ]; + let inst = InstanceAnalysis { + base: "".into(), + field_parts: [("a".into(), "standalone_name".into())].into_iter().collect(), + is_suffix_mode: true, has_outlier: true, + }; + let mode = determine_pattern_mode(&[inst], &fields); + assert!(mode.is_none(), "Pattern with outlier should be non-parameterizable"); + } + + #[test] + fn test_extract_disc_from_instance() { + // StdDevPerBlockExtended 4y instance: field_parts include "0sd_4y", "p1sd_4y", "ratio_sd_4y". + // Templates are "0sd{disc}", "p1sd{disc}", "ratio_sd{disc}". + // The extracted disc should be "_4y", not "0sd_4y" (the shortest field_part). + use crate::StructuralPattern; + use std::collections::BTreeSet; + + let pattern = StructuralPattern { + name: "TestPattern".into(), + fields: vec![ + PatternField { name: "_0sd".into(), rust_type: "T".into(), json_type: "n".into(), indexes: BTreeSet::new(), type_param: None }, + PatternField { name: "p1sd".into(), rust_type: "T".into(), json_type: "n".into(), indexes: BTreeSet::new(), type_param: None }, + PatternField { name: "sd".into(), rust_type: "T".into(), json_type: "n".into(), indexes: BTreeSet::new(), type_param: None }, + ], + mode: Some(PatternMode::Templated { + templates: [ + ("_0sd".into(), "0sd{disc}".into()), + ("p1sd".into(), "p1sd{disc}".into()), + ("sd".into(), "ratio_sd{disc}".into()), + ] + .into_iter() + .collect(), + }), + is_generic: false, + }; + + // 4y instance + let field_parts_4y: BTreeMap = [ + ("_0sd".into(), "0sd_4y".into()), + ("p1sd".into(), "p1sd_4y".into()), + ("sd".into(), "ratio_sd_4y".into()), + ] + .into_iter() + .collect(); + + let disc = pattern.extract_disc_from_instance(&field_parts_4y); + assert_eq!(disc, Some("4y".to_string())); + + // All-time instance (no period suffix) + let field_parts_all: BTreeMap = [ + ("_0sd".into(), "0sd".into()), + ("p1sd".into(), "p1sd".into()), + ("sd".into(), "ratio_sd".into()), + ] + .into_iter() + .collect(); + + let disc = pattern.extract_disc_from_instance(&field_parts_all); + assert_eq!(disc, Some(String::new())); + } + + #[test] + fn test_mixed_empty_fills_with_longer_suffix() { + // CapLossMvrvNetPriceProfitSoprPattern: "loss" field is empty but its + // shortest leaf is "realized_loss" which contains "loss" and is longer. + // Should fill with "realized_loss". But "supply" field whose suffix equals + // the field name exactly should NOT be filled (identity). + let mut child_bases = BTreeMap::new(); + child_bases.insert("cap".to_string(), "utxos_realized_cap".to_string()); + child_bases.insert("loss".to_string(), "utxos".to_string()); // returns parent base + child_bases.insert("mvrv".to_string(), "utxos_mvrv".to_string()); + child_bases.insert("price".to_string(), "utxos_realized_price".to_string()); + child_bases.insert("supply".to_string(), "utxos".to_string()); // returns parent base + + let analysis = analyze_instance(&child_bases); + assert_eq!(analysis.base, "utxos"); + + // loss and supply should be empty from common prefix analysis + assert_eq!(analysis.field_parts.get("loss"), Some(&"".to_string())); + assert_eq!(analysis.field_parts.get("supply"), Some(&"".to_string())); + // others should be non-empty + assert_eq!(analysis.field_parts.get("cap"), Some(&"realized_cap".to_string())); + assert_eq!(analysis.field_parts.get("mvrv"), Some(&"mvrv".to_string())); + assert_eq!(analysis.field_parts.get("price"), Some(&"realized_price".to_string())); + } + + #[test] + fn test_mixed_empty_fills_loss_from_shortest_leaf() { + // Integration test: "loss" child returns same base as parent (because + // its children like neg_realized_loss break the prefix). The mixed-empty + // fix should fill it from shortest leaf "utxos_realized_loss". + use brk_types::{MetricLeaf, MetricLeafWithSchema, TreeNode}; + + fn leaf(name: &str) -> TreeNode { + TreeNode::Leaf(MetricLeafWithSchema::new( + MetricLeaf::new(name.into(), "f32".into(), std::collections::BTreeSet::new()), + serde_json::Value::Null, + )) + } + + let parent = TreeNode::Branch( + [ + ("cap".into(), leaf("utxos_realized_cap")), + ( + "loss".into(), + TreeNode::Branch( + [ + ("base".into(), leaf("utxos_realized_loss")), + ("negative".into(), leaf("utxos_neg_realized_loss")), + ] + .into_iter() + .collect(), + ), + ), + ("mvrv".into(), leaf("utxos_mvrv")), + ] + .into_iter() + .collect(), + ); + + let mut all_analyses = BTreeMap::new(); + let mut node_bases = BTreeMap::new(); + let pattern_lookup = BTreeMap::new(); + + collect_instance_analyses( + &parent, + "test", + &pattern_lookup, + &mut all_analyses, + &mut node_bases, + ); + + let result = node_bases.get("test").expect("should have node_bases entry"); + assert_eq!(result.base, "utxos"); + assert!(!result.has_outlier); + assert_eq!(result.field_parts.get("cap"), Some(&"realized_cap".to_string())); + assert_eq!(result.field_parts.get("mvrv"), Some(&"mvrv".to_string())); + // loss stays empty after first pass (child returned same base as parent). + // The second pass (fill_mixed_empty_field_parts) fills it for templated + // children, but that requires pattern_lookup which this test doesn't set up. + assert_eq!(result.field_parts.get("loss"), Some(&"".to_string())); + } } diff --git a/crates/brk_bindgen/src/generate/tree.rs b/crates/brk_bindgen/src/generate/tree.rs index 0571b7595..98d063ebb 100644 --- a/crates/brk_bindgen/src/generate/tree.rs +++ b/crates/brk_bindgen/src/generate/tree.rs @@ -127,10 +127,18 @@ pub fn prepare_tree_node<'a>( && p.field_parts_match(&base_result.field_parts) }); + // Check if the matching pattern is fully parameterizable (including children) + let is_parameterizable = child_fields + .as_ref() + .and_then(|cf| metadata.find_pattern_by_fields(cf)) + .is_none_or(|p| metadata.is_parameterizable(&p.name)); + // should_inline determines if we generate an inline struct type - // We inline if: it's a branch AND (doesn't match any pattern OR pattern incompatible OR has outlier) let should_inline = !is_leaf - && (!matches_any_pattern || !pattern_compatible || base_result.has_outlier); + && (!matches_any_pattern + || !pattern_compatible + || !is_parameterizable + || base_result.has_outlier); // Inline type name (only used when should_inline is true) let inline_type_name = if should_inline { diff --git a/crates/brk_bindgen/src/generators/javascript/client.rs b/crates/brk_bindgen/src/generators/javascript/client.rs index 497fb8e32..534b5a3b3 100644 --- a/crates/brk_bindgen/src/generators/javascript/client.rs +++ b/crates/brk_bindgen/src/generators/javascript/client.rs @@ -701,6 +701,10 @@ pub fn generate_structural_patterns( } writeln!(output, " */\n").unwrap(); + // Skip factory for non-parameterizable patterns (inlined at tree level) + if !metadata.is_parameterizable(&pattern.name) { + continue; + } writeln!(output, "/**").unwrap(); writeln!(output, " * Create a {} pattern node", pattern.name).unwrap(); diff --git a/crates/brk_bindgen/src/generators/javascript/tree.rs b/crates/brk_bindgen/src/generators/javascript/tree.rs index 79b4d8fed..33670b556 100644 --- a/crates/brk_bindgen/src/generators/javascript/tree.rs +++ b/crates/brk_bindgen/src/generators/javascript/tree.rs @@ -222,15 +222,12 @@ fn generate_tree_initializer( } else { // Use pattern factory let pattern = metadata.find_pattern(&child.field.rust_type); - if pattern.is_some_and(|p| p.is_templated()) { - // Templated: extract discriminator from field_parts - let disc = child - .base_result - .field_parts - .values() - .filter(|v| !v.is_empty()) - .min_by_key(|v| v.len()) - .cloned() + if let Some(pat) = pattern + && pat.is_templated() + { + // Templated: extract discriminator using the pattern's templates + let disc = pat + .extract_disc_from_instance(&child.base_result.field_parts) .unwrap_or_default(); writeln!( output, diff --git a/crates/brk_bindgen/src/generators/rust/client.rs b/crates/brk_bindgen/src/generators/rust/client.rs index 4afa21d5f..8fbaa4640 100644 --- a/crates/brk_bindgen/src/generators/rust/client.rs +++ b/crates/brk_bindgen/src/generators/rust/client.rs @@ -534,7 +534,11 @@ pub fn generate_pattern_structs( writeln!(output, "}}\n").unwrap(); - // Generate impl block with constructor for ALL patterns + // Skip constructor for non-parameterizable patterns (inlined at tree level) + if !metadata.is_parameterizable(&pattern.name) { + continue; + } + let impl_generic = if pattern.is_generic { "" } else { diff --git a/crates/brk_bindgen/src/generators/rust/tree.rs b/crates/brk_bindgen/src/generators/rust/tree.rs index 832299ea7..6d611d391 100644 --- a/crates/brk_bindgen/src/generators/rust/tree.rs +++ b/crates/brk_bindgen/src/generators/rust/tree.rs @@ -99,15 +99,11 @@ fn generate_tree_node( } else { // Pattern type - use ::new() constructor let pattern = metadata.find_pattern(&child.field.rust_type); - if pattern.is_some_and(|p| p.is_templated()) { - // Templated pattern: pass base and disc - let disc = child - .base_result - .field_parts - .values() - .filter(|v| !v.is_empty()) - .min_by_key(|v| v.len()) - .cloned() + if let Some(pat) = pattern + && pat.is_templated() + { + let disc = pat + .extract_disc_from_instance(&child.base_result.field_parts) .unwrap_or_default(); writeln!( output, diff --git a/crates/brk_bindgen/src/types/metadata.rs b/crates/brk_bindgen/src/types/metadata.rs index 32fba12b7..9f78c6461 100644 --- a/crates/brk_bindgen/src/types/metadata.rs +++ b/crates/brk_bindgen/src/types/metadata.rs @@ -69,10 +69,17 @@ impl ClientMetadata { self.find_pattern(name).is_some_and(|p| p.is_generic) } - /// Check if a pattern by name is parameterizable (has a mode). + /// Check if a pattern is fully parameterizable (recursively). + /// Returns false if the pattern or any nested branch pattern has no mode. pub fn is_parameterizable(&self, name: &str) -> bool { - self.find_pattern(name) - .is_some_and(|p| p.is_parameterizable()) + self.find_pattern(name).is_some_and(|p| { + p.is_parameterizable() + && p.fields.iter().all(|f| { + !f.is_branch() + || self.find_pattern(&f.rust_type).is_none() + || self.is_parameterizable(&f.rust_type) + }) + }) } /// Check if child fields match ANY pattern (parameterizable or not). diff --git a/crates/brk_bindgen/src/types/structs.rs b/crates/brk_bindgen/src/types/structs.rs index 699bcaad5..ef44233ce 100644 --- a/crates/brk_bindgen/src/types/structs.rs +++ b/crates/brk_bindgen/src/types/structs.rs @@ -61,6 +61,29 @@ impl StructuralPattern { matches!(&self.mode, Some(PatternMode::Templated { .. })) } + /// Extract the discriminator value from a concrete instance's field_parts. + /// Uses the pattern's templates to reverse-match and find the disc. + pub fn extract_disc_from_instance( + &self, + instance_field_parts: &BTreeMap, + ) -> Option { + let templates = match &self.mode { + Some(PatternMode::Templated { templates }) => templates, + _ => return None, + }; + // Find a template with {disc} and extract the disc from the instance value. + // Strip leading underscore since _m() handles separators. + for (field_name, template) in templates { + if let Some(value) = instance_field_parts.get(field_name) { + if let Some(disc) = extract_disc(template, value) { + return Some(disc.trim_start_matches('_').to_string()); + } + } + } + // If no template matched (all empty templates), disc is empty + Some(String::new()) + } + /// Check if the given instance field parts match this pattern's field parts. pub fn field_parts_match(&self, instance_field_parts: &BTreeMap) -> bool { match &self.mode { diff --git a/crates/brk_client/src/lib.rs b/crates/brk_client/src/lib.rs index dac0f6e26..56f35b0c6 100644 --- a/crates/brk_client/src/lib.rs +++ b/crates/brk_client/src/lib.rs @@ -1008,29 +1008,6 @@ pub struct _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern { pub zscore: MetricPattern1, } -impl _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String, disc: String) -> Self { - Self { - _0sd: CentsSatsUsdPattern::new(client.clone(), _m(&acc, &format!("0sd{disc}", disc=disc))), - m0_5sd: PriceRatioPattern::new(client.clone(), acc.clone(), _m("m0_5sd", &disc)), - m1_5sd: PriceRatioPattern::new(client.clone(), acc.clone(), _m("m1_5sd", &disc)), - m1sd: PriceRatioPattern::new(client.clone(), acc.clone(), _m("m1sd", &disc)), - m2_5sd: PriceRatioPattern::new(client.clone(), acc.clone(), _m("m2_5sd", &disc)), - m2sd: PriceRatioPattern::new(client.clone(), acc.clone(), _m("m2sd", &disc)), - m3sd: PriceRatioPattern::new(client.clone(), acc.clone(), _m("m3sd", &disc)), - p0_5sd: PriceRatioPattern::new(client.clone(), acc.clone(), _m("p0_5sd", &disc)), - p1_5sd: PriceRatioPattern::new(client.clone(), acc.clone(), _m("p1_5sd", &disc)), - p1sd: PriceRatioPattern::new(client.clone(), acc.clone(), _m("p1sd", &disc)), - p2_5sd: PriceRatioPattern::new(client.clone(), acc.clone(), _m("p2_5sd", &disc)), - p2sd: PriceRatioPattern::new(client.clone(), acc.clone(), _m("p2sd", &disc)), - p3sd: PriceRatioPattern::new(client.clone(), acc.clone(), _m("p3sd", &disc)), - sd: MetricPattern1::new(client.clone(), _m(&acc, &format!("ratio_sd{disc}", disc=disc))), - zscore: MetricPattern1::new(client.clone(), _m(&acc, &format!("ratio_zscore{disc}", disc=disc))), - } - } -} - /// Pattern struct for repeated tree structure. pub struct _10y1m1w1y2y3m3y4y5y6m6y8yPattern2 { pub _10y: BpsPercentRatioPattern, @@ -1119,26 +1096,6 @@ pub struct CapGrossInvestorLossMvrvNetPeakPriceProfitSellSoprPattern { pub sopr: AdjustedRatioValuePattern, } -impl CapGrossInvestorLossMvrvNetPeakPriceProfitSellSoprPattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - cap: CentsDeltaRelUsdPattern::new(client.clone(), format!("{acc}_cap")), - gross_pnl: BaseCumulativeSumPattern3::new(client.clone(), format!("{acc}_gross_pnl")), - investor: LowerPriceUpperPattern::new(client.clone(), format!("{acc}_investor")), - loss: BaseCapitulationCumulativeNegativeRelSumValuePattern::new(client.clone(), format!("{acc}_loss")), - mvrv: MetricPattern1::new(client.clone(), format!("{acc}_mvrv")), - net_pnl: BaseChangeCumulativeDeltaRelSumPattern::new(client.clone(), format!("{acc}_net_pnl")), - peak_regret: BaseCumulativeRelPattern::new(client.clone(), format!("{acc}_peak_regret")), - price: BpsCentsPercentilesRatioSatsSmaStdUsdPattern::new(client.clone(), format!("{acc}_price")), - profit: BaseCumulativeDistributionRelSumValuePattern::new(client.clone(), format!("{acc}_profit")), - profit_to_loss_ratio: _1m1w1y24hPattern::new(client.clone(), format!("{acc}_profit_to_loss_ratio")), - sell_side_risk_ratio: _1m1w1y24hPattern6::new(client.clone(), format!("{acc}_sell_side_risk_ratio")), - sopr: AdjustedRatioValuePattern::new(client.clone(), format!("{acc}_sopr")), - } - } -} - /// Pattern struct for repeated tree structure. pub struct AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90RollingSumPattern { pub average: MetricPattern18, @@ -1339,22 +1296,6 @@ pub struct BaseCapitulationCumulativeNegativeRelSumValuePattern { pub value_destroyed: BaseCumulativeSumPattern, } -impl BaseCapitulationCumulativeNegativeRelSumValuePattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - base: CentsUsdPattern2::new(client.clone(), _m(&acc, "realized_loss")), - capitulation_flow: MetricPattern1::new(client.clone(), _m(&acc, "capitulation_flow")), - cumulative: CentsUsdPattern2::new(client.clone(), _m(&acc, "realized_loss_cumulative")), - negative: MetricPattern1::new(client.clone(), _m(&acc, "neg_realized_loss")), - rel_to_rcap: BpsPercentRatioPattern4::new(client.clone(), _m(&acc, "realized_loss_rel_to_rcap")), - sum: _1m1w1y24hPattern4::new(client.clone(), _m(&acc, "realized_loss_sum")), - value_created: BaseCumulativeSumPattern::new(client.clone(), _m(&acc, "loss_value_created")), - value_destroyed: BaseCumulativeSumPattern::new(client.clone(), _m(&acc, "loss_value_destroyed")), - } - } -} - /// Pattern struct for repeated tree structure. pub struct BpsCentsPercentilesRatioSatsSmaStdUsdPattern { pub bps: MetricPattern1, @@ -1367,22 +1308,6 @@ pub struct BpsCentsPercentilesRatioSatsSmaStdUsdPattern { pub usd: MetricPattern1, } -impl BpsCentsPercentilesRatioSatsSmaStdUsdPattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - bps: MetricPattern1::new(client.clone(), _m(&acc, "ratio_bps")), - cents: MetricPattern1::new(client.clone(), _m(&acc, "cents")), - percentiles: Pct1Pct2Pct5Pct95Pct98Pct99Pattern::new(client.clone(), acc.clone()), - ratio: MetricPattern1::new(client.clone(), _m(&acc, "ratio")), - sats: MetricPattern1::new(client.clone(), _m(&acc, "sats")), - sma: _1m1w1y2y4yAllPattern::new(client.clone(), _m(&acc, "ratio_sma")), - std_dev: _1y2y4yAllPattern::new(client.clone(), acc.clone()), - usd: MetricPattern1::new(client.clone(), acc.clone()), - } - } -} - /// Pattern struct for repeated tree structure. pub struct AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern2 { pub average: MetricPattern18, @@ -1474,21 +1399,6 @@ pub struct BaseCumulativeDistributionRelSumValuePattern { pub value_destroyed: BaseCumulativeSumPattern, } -impl BaseCumulativeDistributionRelSumValuePattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - base: CentsUsdPattern2::new(client.clone(), _m(&acc, "realized_profit")), - cumulative: CentsUsdPattern2::new(client.clone(), _m(&acc, "realized_profit_cumulative")), - distribution_flow: MetricPattern1::new(client.clone(), _m(&acc, "distribution_flow")), - rel_to_rcap: BpsPercentRatioPattern4::new(client.clone(), _m(&acc, "realized_profit_rel_to_rcap")), - sum: _1m1w1y24hPattern4::new(client.clone(), _m(&acc, "realized_profit_sum")), - value_created: BaseCumulativeSumPattern::new(client.clone(), _m(&acc, "profit_value_created")), - value_destroyed: BaseCumulativeSumPattern::new(client.clone(), _m(&acc, "profit_value_destroyed")), - } - } -} - /// Pattern struct for repeated tree structure. pub struct BaseCumulativeNegativeRelSumPattern2 { pub base: CentsUsdPattern2, @@ -1531,12 +1441,12 @@ impl CapLossMvrvNetPriceProfitSoprPattern { pub fn new(client: Arc, acc: String) -> Self { Self { cap: CentsDeltaUsdPattern::new(client.clone(), _m(&acc, "realized_cap")), - loss: BaseCumulativeNegativeSumPattern::new(client.clone(), acc.clone(), String::new()), + loss: BaseCumulativeNegativeSumPattern::new(client.clone(), acc.clone(), "realized_loss".to_string()), mvrv: MetricPattern1::new(client.clone(), _m(&acc, "mvrv")), net_pnl: BaseCumulativeDeltaSumPattern::new(client.clone(), _m(&acc, "net_realized_pnl")), price: BpsCentsRatioSatsUsdPattern::new(client.clone(), _m(&acc, "realized_price")), profit: BaseCumulativeSumPattern3::new(client.clone(), _m(&acc, "realized_profit")), - sopr: RatioValuePattern::new(client.clone(), _m(&acc, "sopr_24h")), + sopr: RatioValuePattern::new(client.clone(), acc.clone()), } } } @@ -1552,21 +1462,6 @@ pub struct GrossInvestedLossNetNuplProfitSentimentPattern2 { pub sentiment: GreedNetPainPattern, } -impl GrossInvestedLossNetNuplProfitSentimentPattern2 { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - gross_pnl: CentsUsdPattern2::new(client.clone(), _m(&acc, "unrealized_gross_pnl")), - invested_capital: InPattern::new(client.clone(), _m(&acc, "invested_capital_in")), - loss: BaseCumulativeNegativeRelSumPattern2::new(client.clone(), acc.clone()), - net_pnl: CentsRelUsdPattern2::new(client.clone(), _m(&acc, "net_unrealized_pnl")), - nupl: BpsRatioPattern::new(client.clone(), _m(&acc, "nupl")), - profit: BaseCumulativeRelSumPattern2::new(client.clone(), _m(&acc, "unrealized_profit")), - sentiment: GreedNetPainPattern::new(client.clone(), acc.clone()), - } - } -} - /// Pattern struct for repeated tree structure. pub struct _1m1w1y2y4yAllPattern { pub _1m: BpsRatioPattern2, @@ -1968,19 +1863,6 @@ pub struct EmaHistogramLineSignalPattern { pub signal: MetricPattern1, } -impl EmaHistogramLineSignalPattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - ema_fast: MetricPattern1::new(client.clone(), format!("{acc}_ema_fast")), - ema_slow: MetricPattern1::new(client.clone(), format!("{acc}_ema_slow")), - histogram: MetricPattern1::new(client.clone(), format!("{acc}_histogram")), - line: MetricPattern1::new(client.clone(), format!("{acc}_line")), - signal: MetricPattern1::new(client.clone(), format!("{acc}_signal")), - } - } -} - /// Pattern struct for repeated tree structure. pub struct InvestedMaxMinPercentilesSupplyPattern { pub invested_capital: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern, @@ -1990,19 +1872,6 @@ pub struct InvestedMaxMinPercentilesSupplyPattern { pub supply_density: BpsPercentRatioPattern3, } -impl InvestedMaxMinPercentilesSupplyPattern { - /// 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: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "cost_basis_max")), - min: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "cost_basis_min")), - percentiles: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern::new(client.clone(), _m(&acc, "cost_basis")), - supply_density: BpsPercentRatioPattern3::new(client.clone(), _m(&acc, "supply_density")), - } - } -} - /// Pattern struct for repeated tree structure. pub struct MvrvNuplRealizedSupplyPattern { pub mvrv: MetricPattern1, @@ -2018,9 +1887,9 @@ impl MvrvNuplRealizedSupplyPattern { Self { mvrv: MetricPattern1::new(client.clone(), _m(&acc, "mvrv")), nupl: BpsRatioPattern::new(client.clone(), _m(&acc, "nupl")), - realized_cap: AllSthPattern::new(client.clone(), _m(&acc, "realized_cap")), + realized_cap: AllSthPattern::new(client.clone(), acc.clone()), realized_price: BpsCentsRatioSatsUsdPattern::new(client.clone(), _m(&acc, "realized_price")), - supply: AllSthPattern2::new(client.clone(), _m(&acc, "supply")), + supply: AllSthPattern2::new(client.clone(), acc.clone()), } } } @@ -2197,18 +2066,6 @@ pub struct _1y2y4yAllPattern { pub all: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern, } -impl _1y2y4yAllPattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - _1y: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern::new(client.clone(), acc.clone(), "1y".to_string()), - _2y: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern::new(client.clone(), acc.clone(), "2y".to_string()), - _4y: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern::new(client.clone(), acc.clone(), "4y".to_string()), - all: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern::new(client.clone(), acc.clone(), String::new()), - } - } -} - /// Pattern struct for repeated tree structure. pub struct AdjustedRatioValuePattern { pub adjusted: RatioValuePattern2, @@ -2217,18 +2074,6 @@ pub struct AdjustedRatioValuePattern { pub value_destroyed: BaseCumulativeSumPattern, } -impl AdjustedRatioValuePattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - adjusted: RatioValuePattern2::new(client.clone(), acc.clone()), - ratio: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "sopr")), - value_created: BaseCumulativeSumPattern::new(client.clone(), _m(&acc, "value_created")), - value_destroyed: BaseCumulativeSumPattern::new(client.clone(), _m(&acc, "value_destroyed")), - } - } -} - /// Pattern struct for repeated tree structure. pub struct BaseCumulativeDeltaSumPattern { pub base: CentsUsdPattern, @@ -2357,18 +2202,6 @@ pub struct CoindaysCoinyearsDormancySentPattern { pub sent: BaseCumulativeInSumPattern, } -impl CoindaysCoinyearsDormancySentPattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - coindays_destroyed: BaseCumulativeSumPattern::new(client.clone(), _m(&acc, "coindays_destroyed")), - coinyears_destroyed: MetricPattern1::new(client.clone(), _m(&acc, "coinyears_destroyed")), - dormancy: MetricPattern1::new(client.clone(), _m(&acc, "dormancy")), - sent: BaseCumulativeInSumPattern::new(client.clone(), _m(&acc, "sent")), - } - } -} - /// Pattern struct for repeated tree structure. pub struct LossNetNuplProfitPattern { pub loss: BaseCumulativeNegativeSumPattern, @@ -2381,7 +2214,7 @@ impl LossNetNuplProfitPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - loss: BaseCumulativeNegativeSumPattern::new(client.clone(), acc.clone(), String::new()), + loss: BaseCumulativeNegativeSumPattern::new(client.clone(), acc.clone(), "unrealized_loss".to_string()), net_pnl: CentsUsdPattern::new(client.clone(), _m(&acc, "net_unrealized_pnl")), nupl: BpsRatioPattern::new(client.clone(), _m(&acc, "nupl")), profit: BaseCumulativeSumPattern3::new(client.clone(), _m(&acc, "unrealized_profit")), @@ -2708,17 +2541,6 @@ pub struct GreedNetPainPattern { pub pain_index: CentsUsdPattern2, } -impl GreedNetPainPattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - greed_index: CentsUsdPattern2::new(client.clone(), _m(&acc, "greed_index")), - net: CentsUsdPattern::new(client.clone(), _m(&acc, "net_sentiment")), - pain_index: CentsUsdPattern2::new(client.clone(), _m(&acc, "pain_index")), - } - } -} - /// Pattern struct for repeated tree structure. pub struct LossNuplProfitPattern { pub loss: BaseCumulativeNegativeSumPattern, @@ -2730,7 +2552,7 @@ impl LossNuplProfitPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - loss: BaseCumulativeNegativeSumPattern::new(client.clone(), acc.clone(), String::new()), + loss: BaseCumulativeNegativeSumPattern::new(client.clone(), acc.clone(), "unrealized_loss".to_string()), nupl: BpsRatioPattern::new(client.clone(), _m(&acc, "nupl")), profit: BaseCumulativeSumPattern3::new(client.clone(), _m(&acc, "unrealized_profit")), } @@ -2744,17 +2566,6 @@ pub struct LowerPriceUpperPattern { pub upper_price_band: CentsSatsUsdPattern, } -impl LowerPriceUpperPattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - lower_price_band: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "lower_price_band")), - price: BpsCentsPercentilesRatioSatsUsdPattern::new(client.clone(), _m(&acc, "investor_price")), - upper_price_band: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "upper_price_band")), - } - } -} - /// Pattern struct for repeated tree structure. pub struct RatioValuePattern2 { pub ratio: _1m1w1y24hPattern, @@ -2762,17 +2573,6 @@ pub struct RatioValuePattern2 { pub value_destroyed: BaseCumulativeSumPattern, } -impl RatioValuePattern2 { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - ratio: _1m1w1y24hPattern::new(client.clone(), format!("{acc}_ratio")), - value_created: BaseCumulativeSumPattern::new(client.clone(), format!("{acc}_value_created")), - value_destroyed: BaseCumulativeSumPattern::new(client.clone(), format!("{acc}_value_destroyed")), - } - } -} - /// Pattern struct for repeated tree structure. pub struct RatioValuePattern { pub ratio: _24hPattern, @@ -2838,7 +2638,7 @@ impl AbsoluteRatePattern { pub fn new(client: Arc, acc: String) -> Self { Self { absolute: _1m1w1y24hPattern::new(client.clone(), acc.clone()), - rate: _1m1w1y24hPattern2::new(client.clone(), _m(&acc, "rate")), + rate: _1m1w1y24hPattern2::new(client.clone(), acc.clone()), } } } @@ -2854,7 +2654,7 @@ impl AbsoluteRatePattern2 { pub fn new(client: Arc, acc: String) -> Self { Self { absolute: _1m1w1y24hPattern3::new(client.clone(), acc.clone()), - rate: _1m1w1y24hPattern2::new(client.clone(), _m(&acc, "rate")), + rate: _1m1w1y24hPattern2::new(client.clone(), acc.clone()), } } } @@ -3057,16 +2857,6 @@ pub struct SdSmaPattern { pub sma: MetricPattern1, } -impl SdSmaPattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - sd: MetricPattern1::new(client.clone(), format!("{acc}_sd")), - sma: MetricPattern1::new(client.clone(), format!("{acc}_sma")), - } - } -} - /// Pattern struct for repeated tree structure. pub struct ValuePattern { pub value_created: BaseCumulativeSumPattern, @@ -6469,9 +6259,9 @@ impl MetricsTree_Cohorts_Utxo { pub struct MetricsTree_Cohorts_Utxo_All { pub supply: MetricsTree_Cohorts_Utxo_All_Supply, pub outputs: UnspentPattern, - pub activity: CoindaysCoinyearsDormancySentPattern, + pub activity: MetricsTree_Cohorts_Utxo_All_Activity, pub realized: MetricsTree_Cohorts_Utxo_All_Realized, - pub cost_basis: InvestedMaxMinPercentilesSupplyPattern, + pub cost_basis: MetricsTree_Cohorts_Utxo_All_CostBasis, pub unrealized: MetricsTree_Cohorts_Utxo_All_Unrealized, } @@ -6480,9 +6270,9 @@ impl MetricsTree_Cohorts_Utxo_All { Self { supply: MetricsTree_Cohorts_Utxo_All_Supply::new(client.clone(), format!("{base_path}_supply")), outputs: UnspentPattern::new(client.clone(), "utxo_count".to_string()), - activity: CoindaysCoinyearsDormancySentPattern::new(client.clone(), "".to_string()), + activity: MetricsTree_Cohorts_Utxo_All_Activity::new(client.clone(), format!("{base_path}_activity")), realized: MetricsTree_Cohorts_Utxo_All_Realized::new(client.clone(), format!("{base_path}_realized")), - cost_basis: InvestedMaxMinPercentilesSupplyPattern::new(client.clone(), "".to_string()), + cost_basis: MetricsTree_Cohorts_Utxo_All_CostBasis::new(client.clone(), format!("{base_path}_cost_basis")), unrealized: MetricsTree_Cohorts_Utxo_All_Unrealized::new(client.clone(), format!("{base_path}_unrealized")), } } @@ -6509,19 +6299,38 @@ impl MetricsTree_Cohorts_Utxo_All_Supply { } } +/// Metrics tree node. +pub struct MetricsTree_Cohorts_Utxo_All_Activity { + pub sent: BaseCumulativeInSumPattern, + pub coindays_destroyed: BaseCumulativeSumPattern, + pub coinyears_destroyed: MetricPattern1, + pub dormancy: MetricPattern1, +} + +impl MetricsTree_Cohorts_Utxo_All_Activity { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + sent: BaseCumulativeInSumPattern::new(client.clone(), "sent".to_string()), + coindays_destroyed: BaseCumulativeSumPattern::new(client.clone(), "coindays_destroyed".to_string()), + coinyears_destroyed: MetricPattern1::new(client.clone(), "coinyears_destroyed".to_string()), + dormancy: MetricPattern1::new(client.clone(), "dormancy".to_string()), + } + } +} + /// Metrics tree node. pub struct MetricsTree_Cohorts_Utxo_All_Realized { pub cap: CentsDeltaRelUsdPattern, - pub profit: BaseCumulativeDistributionRelSumValuePattern, - pub loss: BaseCapitulationCumulativeNegativeRelSumValuePattern, - pub price: BpsCentsPercentilesRatioSatsSmaStdUsdPattern, + pub profit: MetricsTree_Cohorts_Utxo_All_Realized_Profit, + pub loss: MetricsTree_Cohorts_Utxo_All_Realized_Loss, + pub price: MetricsTree_Cohorts_Utxo_All_Realized_Price, pub mvrv: MetricPattern1, - pub sopr: AdjustedRatioValuePattern, + pub sopr: MetricsTree_Cohorts_Utxo_All_Realized_Sopr, pub net_pnl: BaseChangeCumulativeDeltaRelSumPattern, pub gross_pnl: BaseCumulativeSumPattern3, pub sell_side_risk_ratio: _1m1w1y24hPattern6, pub peak_regret: BaseCumulativeRelPattern, - pub investor: LowerPriceUpperPattern, + pub investor: MetricsTree_Cohorts_Utxo_All_Realized_Investor, pub profit_to_loss_ratio: _1m1w1y24hPattern, } @@ -6529,21 +6338,357 @@ impl MetricsTree_Cohorts_Utxo_All_Realized { pub fn new(client: Arc, base_path: String) -> Self { Self { cap: CentsDeltaRelUsdPattern::new(client.clone(), "realized_cap".to_string()), - profit: BaseCumulativeDistributionRelSumValuePattern::new(client.clone(), "".to_string()), - loss: BaseCapitulationCumulativeNegativeRelSumValuePattern::new(client.clone(), "".to_string()), - price: BpsCentsPercentilesRatioSatsSmaStdUsdPattern::new(client.clone(), "realized_price".to_string()), + profit: MetricsTree_Cohorts_Utxo_All_Realized_Profit::new(client.clone(), format!("{base_path}_profit")), + loss: MetricsTree_Cohorts_Utxo_All_Realized_Loss::new(client.clone(), format!("{base_path}_loss")), + price: MetricsTree_Cohorts_Utxo_All_Realized_Price::new(client.clone(), format!("{base_path}_price")), mvrv: MetricPattern1::new(client.clone(), "mvrv".to_string()), - sopr: AdjustedRatioValuePattern::new(client.clone(), "".to_string()), + sopr: MetricsTree_Cohorts_Utxo_All_Realized_Sopr::new(client.clone(), format!("{base_path}_sopr")), net_pnl: BaseChangeCumulativeDeltaRelSumPattern::new(client.clone(), "net".to_string()), gross_pnl: BaseCumulativeSumPattern3::new(client.clone(), "realized_gross_pnl".to_string()), sell_side_risk_ratio: _1m1w1y24hPattern6::new(client.clone(), "sell_side_risk_ratio".to_string()), peak_regret: BaseCumulativeRelPattern::new(client.clone(), "realized_peak_regret".to_string()), - investor: LowerPriceUpperPattern::new(client.clone(), "".to_string()), + investor: MetricsTree_Cohorts_Utxo_All_Realized_Investor::new(client.clone(), format!("{base_path}_investor")), profit_to_loss_ratio: _1m1w1y24hPattern::new(client.clone(), "realized_profit_to_loss_ratio".to_string()), } } } +/// Metrics tree node. +pub struct MetricsTree_Cohorts_Utxo_All_Realized_Profit { + pub base: CentsUsdPattern2, + pub cumulative: CentsUsdPattern2, + pub sum: _1m1w1y24hPattern4, + pub rel_to_rcap: BpsPercentRatioPattern4, + pub value_created: BaseCumulativeSumPattern, + pub value_destroyed: BaseCumulativeSumPattern, + pub distribution_flow: MetricPattern1, +} + +impl MetricsTree_Cohorts_Utxo_All_Realized_Profit { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + base: CentsUsdPattern2::new(client.clone(), "realized_profit".to_string()), + cumulative: CentsUsdPattern2::new(client.clone(), "realized_profit_cumulative".to_string()), + sum: _1m1w1y24hPattern4::new(client.clone(), "realized_profit_sum".to_string()), + rel_to_rcap: BpsPercentRatioPattern4::new(client.clone(), "realized_profit_rel_to_rcap".to_string()), + value_created: BaseCumulativeSumPattern::new(client.clone(), "profit_value_created".to_string()), + value_destroyed: BaseCumulativeSumPattern::new(client.clone(), "profit_value_destroyed".to_string()), + distribution_flow: MetricPattern1::new(client.clone(), "distribution_flow".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Cohorts_Utxo_All_Realized_Loss { + pub base: CentsUsdPattern2, + pub cumulative: CentsUsdPattern2, + pub sum: _1m1w1y24hPattern4, + pub negative: MetricPattern1, + pub rel_to_rcap: BpsPercentRatioPattern4, + pub value_created: BaseCumulativeSumPattern, + pub value_destroyed: BaseCumulativeSumPattern, + pub capitulation_flow: MetricPattern1, +} + +impl MetricsTree_Cohorts_Utxo_All_Realized_Loss { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + base: CentsUsdPattern2::new(client.clone(), "realized_loss".to_string()), + cumulative: CentsUsdPattern2::new(client.clone(), "realized_loss_cumulative".to_string()), + sum: _1m1w1y24hPattern4::new(client.clone(), "realized_loss_sum".to_string()), + negative: MetricPattern1::new(client.clone(), "neg_realized_loss".to_string()), + rel_to_rcap: BpsPercentRatioPattern4::new(client.clone(), "realized_loss_rel_to_rcap".to_string()), + value_created: BaseCumulativeSumPattern::new(client.clone(), "loss_value_created".to_string()), + value_destroyed: BaseCumulativeSumPattern::new(client.clone(), "loss_value_destroyed".to_string()), + capitulation_flow: MetricPattern1::new(client.clone(), "capitulation_flow".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Cohorts_Utxo_All_Realized_Price { + pub usd: MetricPattern1, + pub cents: MetricPattern1, + pub sats: MetricPattern1, + pub bps: MetricPattern1, + pub ratio: MetricPattern1, + pub percentiles: Pct1Pct2Pct5Pct95Pct98Pct99Pattern, + pub sma: _1m1w1y2y4yAllPattern, + pub std_dev: MetricsTree_Cohorts_Utxo_All_Realized_Price_StdDev, +} + +impl MetricsTree_Cohorts_Utxo_All_Realized_Price { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + usd: MetricPattern1::new(client.clone(), "realized_price".to_string()), + cents: MetricPattern1::new(client.clone(), "realized_price_cents".to_string()), + sats: MetricPattern1::new(client.clone(), "realized_price_sats".to_string()), + bps: MetricPattern1::new(client.clone(), "realized_price_ratio_bps".to_string()), + ratio: MetricPattern1::new(client.clone(), "realized_price_ratio".to_string()), + percentiles: Pct1Pct2Pct5Pct95Pct98Pct99Pattern::new(client.clone(), "realized_price".to_string()), + sma: _1m1w1y2y4yAllPattern::new(client.clone(), "realized_price_ratio_sma".to_string()), + std_dev: MetricsTree_Cohorts_Utxo_All_Realized_Price_StdDev::new(client.clone(), format!("{base_path}_std_dev")), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Cohorts_Utxo_All_Realized_Price_StdDev { + pub all: MetricsTree_Cohorts_Utxo_All_Realized_Price_StdDev_All, + pub _4y: MetricsTree_Cohorts_Utxo_All_Realized_Price_StdDev_4y, + pub _2y: MetricsTree_Cohorts_Utxo_All_Realized_Price_StdDev_2y, + pub _1y: MetricsTree_Cohorts_Utxo_All_Realized_Price_StdDev_1y, +} + +impl MetricsTree_Cohorts_Utxo_All_Realized_Price_StdDev { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + all: MetricsTree_Cohorts_Utxo_All_Realized_Price_StdDev_All::new(client.clone(), format!("{base_path}_all")), + _4y: MetricsTree_Cohorts_Utxo_All_Realized_Price_StdDev_4y::new(client.clone(), format!("{base_path}_4y")), + _2y: MetricsTree_Cohorts_Utxo_All_Realized_Price_StdDev_2y::new(client.clone(), format!("{base_path}_2y")), + _1y: MetricsTree_Cohorts_Utxo_All_Realized_Price_StdDev_1y::new(client.clone(), format!("{base_path}_1y")), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Cohorts_Utxo_All_Realized_Price_StdDev_All { + pub sd: MetricPattern1, + pub zscore: MetricPattern1, + pub _0sd: CentsSatsUsdPattern, + pub p0_5sd: PriceRatioPattern, + pub p1sd: PriceRatioPattern, + pub p1_5sd: PriceRatioPattern, + pub p2sd: PriceRatioPattern, + pub p2_5sd: PriceRatioPattern, + pub p3sd: PriceRatioPattern, + pub m0_5sd: PriceRatioPattern, + pub m1sd: PriceRatioPattern, + pub m1_5sd: PriceRatioPattern, + pub m2sd: PriceRatioPattern, + pub m2_5sd: PriceRatioPattern, + pub m3sd: PriceRatioPattern, +} + +impl MetricsTree_Cohorts_Utxo_All_Realized_Price_StdDev_All { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + sd: MetricPattern1::new(client.clone(), "realized_price_ratio_sd".to_string()), + zscore: MetricPattern1::new(client.clone(), "realized_price_ratio_zscore".to_string()), + _0sd: CentsSatsUsdPattern::new(client.clone(), "realized_price_0sd".to_string()), + p0_5sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "p0_5sd".to_string().to_string()), + p1sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "p1sd".to_string().to_string()), + p1_5sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "p1_5sd".to_string().to_string()), + p2sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "p2sd".to_string().to_string()), + p2_5sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "p2_5sd".to_string().to_string()), + p3sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "p3sd".to_string().to_string()), + m0_5sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "m0_5sd".to_string().to_string()), + m1sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "m1sd".to_string().to_string()), + m1_5sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "m1_5sd".to_string().to_string()), + m2sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "m2sd".to_string().to_string()), + m2_5sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "m2_5sd".to_string().to_string()), + m3sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "m3sd".to_string().to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Cohorts_Utxo_All_Realized_Price_StdDev_4y { + pub sd: MetricPattern1, + pub zscore: MetricPattern1, + pub _0sd: CentsSatsUsdPattern, + pub p0_5sd: PriceRatioPattern, + pub p1sd: PriceRatioPattern, + pub p1_5sd: PriceRatioPattern, + pub p2sd: PriceRatioPattern, + pub p2_5sd: PriceRatioPattern, + pub p3sd: PriceRatioPattern, + pub m0_5sd: PriceRatioPattern, + pub m1sd: PriceRatioPattern, + pub m1_5sd: PriceRatioPattern, + pub m2sd: PriceRatioPattern, + pub m2_5sd: PriceRatioPattern, + pub m3sd: PriceRatioPattern, +} + +impl MetricsTree_Cohorts_Utxo_All_Realized_Price_StdDev_4y { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + sd: MetricPattern1::new(client.clone(), "realized_price_ratio_sd_4y".to_string()), + zscore: MetricPattern1::new(client.clone(), "realized_price_ratio_zscore_4y".to_string()), + _0sd: CentsSatsUsdPattern::new(client.clone(), "realized_price_0sd_4y".to_string()), + p0_5sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "p0_5sd_4y".to_string().to_string()), + p1sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "p1sd_4y".to_string().to_string()), + p1_5sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "p1_5sd_4y".to_string().to_string()), + p2sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "p2sd_4y".to_string().to_string()), + p2_5sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "p2_5sd_4y".to_string().to_string()), + p3sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "p3sd_4y".to_string().to_string()), + m0_5sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "m0_5sd_4y".to_string().to_string()), + m1sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "m1sd_4y".to_string().to_string()), + m1_5sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "m1_5sd_4y".to_string().to_string()), + m2sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "m2sd_4y".to_string().to_string()), + m2_5sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "m2_5sd_4y".to_string().to_string()), + m3sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "m3sd_4y".to_string().to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Cohorts_Utxo_All_Realized_Price_StdDev_2y { + pub sd: MetricPattern1, + pub zscore: MetricPattern1, + pub _0sd: CentsSatsUsdPattern, + pub p0_5sd: PriceRatioPattern, + pub p1sd: PriceRatioPattern, + pub p1_5sd: PriceRatioPattern, + pub p2sd: PriceRatioPattern, + pub p2_5sd: PriceRatioPattern, + pub p3sd: PriceRatioPattern, + pub m0_5sd: PriceRatioPattern, + pub m1sd: PriceRatioPattern, + pub m1_5sd: PriceRatioPattern, + pub m2sd: PriceRatioPattern, + pub m2_5sd: PriceRatioPattern, + pub m3sd: PriceRatioPattern, +} + +impl MetricsTree_Cohorts_Utxo_All_Realized_Price_StdDev_2y { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + sd: MetricPattern1::new(client.clone(), "realized_price_ratio_sd_2y".to_string()), + zscore: MetricPattern1::new(client.clone(), "realized_price_ratio_zscore_2y".to_string()), + _0sd: CentsSatsUsdPattern::new(client.clone(), "realized_price_0sd_2y".to_string()), + p0_5sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "p0_5sd_2y".to_string().to_string()), + p1sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "p1sd_2y".to_string().to_string()), + p1_5sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "p1_5sd_2y".to_string().to_string()), + p2sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "p2sd_2y".to_string().to_string()), + p2_5sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "p2_5sd_2y".to_string().to_string()), + p3sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "p3sd_2y".to_string().to_string()), + m0_5sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "m0_5sd_2y".to_string().to_string()), + m1sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "m1sd_2y".to_string().to_string()), + m1_5sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "m1_5sd_2y".to_string().to_string()), + m2sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "m2sd_2y".to_string().to_string()), + m2_5sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "m2_5sd_2y".to_string().to_string()), + m3sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "m3sd_2y".to_string().to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Cohorts_Utxo_All_Realized_Price_StdDev_1y { + pub sd: MetricPattern1, + pub zscore: MetricPattern1, + pub _0sd: CentsSatsUsdPattern, + pub p0_5sd: PriceRatioPattern, + pub p1sd: PriceRatioPattern, + pub p1_5sd: PriceRatioPattern, + pub p2sd: PriceRatioPattern, + pub p2_5sd: PriceRatioPattern, + pub p3sd: PriceRatioPattern, + pub m0_5sd: PriceRatioPattern, + pub m1sd: PriceRatioPattern, + pub m1_5sd: PriceRatioPattern, + pub m2sd: PriceRatioPattern, + pub m2_5sd: PriceRatioPattern, + pub m3sd: PriceRatioPattern, +} + +impl MetricsTree_Cohorts_Utxo_All_Realized_Price_StdDev_1y { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + sd: MetricPattern1::new(client.clone(), "realized_price_ratio_sd_1y".to_string()), + zscore: MetricPattern1::new(client.clone(), "realized_price_ratio_zscore_1y".to_string()), + _0sd: CentsSatsUsdPattern::new(client.clone(), "realized_price_0sd_1y".to_string()), + p0_5sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "p0_5sd_1y".to_string().to_string()), + p1sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "p1sd_1y".to_string().to_string()), + p1_5sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "p1_5sd_1y".to_string().to_string()), + p2sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "p2sd_1y".to_string().to_string()), + p2_5sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "p2_5sd_1y".to_string().to_string()), + p3sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "p3sd_1y".to_string().to_string()), + m0_5sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "m0_5sd_1y".to_string().to_string()), + m1sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "m1sd_1y".to_string().to_string()), + m1_5sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "m1_5sd_1y".to_string().to_string()), + m2sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "m2sd_1y".to_string().to_string()), + m2_5sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "m2_5sd_1y".to_string().to_string()), + m3sd: PriceRatioPattern::new(client.clone(), "realized_price".to_string(), "m3sd_1y".to_string().to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Cohorts_Utxo_All_Realized_Sopr { + pub value_created: BaseCumulativeSumPattern, + pub value_destroyed: BaseCumulativeSumPattern, + pub ratio: _1m1w1y24hPattern, + pub adjusted: MetricsTree_Cohorts_Utxo_All_Realized_Sopr_Adjusted, +} + +impl MetricsTree_Cohorts_Utxo_All_Realized_Sopr { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + value_created: BaseCumulativeSumPattern::new(client.clone(), "value_created".to_string()), + value_destroyed: BaseCumulativeSumPattern::new(client.clone(), "value_destroyed".to_string()), + ratio: _1m1w1y24hPattern::new(client.clone(), "sopr".to_string()), + adjusted: MetricsTree_Cohorts_Utxo_All_Realized_Sopr_Adjusted::new(client.clone(), format!("{base_path}_adjusted")), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Cohorts_Utxo_All_Realized_Sopr_Adjusted { + pub ratio: _1m1w1y24hPattern, + pub value_created: BaseCumulativeSumPattern, + pub value_destroyed: BaseCumulativeSumPattern, +} + +impl MetricsTree_Cohorts_Utxo_All_Realized_Sopr_Adjusted { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + ratio: _1m1w1y24hPattern::new(client.clone(), "asopr".to_string()), + value_created: BaseCumulativeSumPattern::new(client.clone(), "adj_value_created".to_string()), + value_destroyed: BaseCumulativeSumPattern::new(client.clone(), "adj_value_destroyed".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Cohorts_Utxo_All_Realized_Investor { + pub price: BpsCentsPercentilesRatioSatsUsdPattern, + pub lower_price_band: CentsSatsUsdPattern, + pub upper_price_band: CentsSatsUsdPattern, +} + +impl MetricsTree_Cohorts_Utxo_All_Realized_Investor { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + price: BpsCentsPercentilesRatioSatsUsdPattern::new(client.clone(), "investor_price".to_string()), + lower_price_band: CentsSatsUsdPattern::new(client.clone(), "lower_price_band".to_string()), + upper_price_band: CentsSatsUsdPattern::new(client.clone(), "upper_price_band".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Cohorts_Utxo_All_CostBasis { + pub min: CentsSatsUsdPattern, + pub max: CentsSatsUsdPattern, + pub percentiles: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern, + pub invested_capital: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern, + pub supply_density: BpsPercentRatioPattern3, +} + +impl MetricsTree_Cohorts_Utxo_All_CostBasis { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + min: CentsSatsUsdPattern::new(client.clone(), "cost_basis_min".to_string()), + max: CentsSatsUsdPattern::new(client.clone(), "cost_basis_max".to_string()), + percentiles: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern::new(client.clone(), "cost_basis".to_string()), + invested_capital: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern::new(client.clone(), "invested_capital".to_string()), + supply_density: BpsPercentRatioPattern3::new(client.clone(), "supply_density".to_string()), + } + } +} + /// Metrics tree node. pub struct MetricsTree_Cohorts_Utxo_All_Unrealized { pub nupl: BpsRatioPattern, @@ -6552,7 +6697,7 @@ pub struct MetricsTree_Cohorts_Utxo_All_Unrealized { pub net_pnl: MetricsTree_Cohorts_Utxo_All_Unrealized_NetPnl, pub gross_pnl: CentsUsdPattern2, pub invested_capital: InPattern, - pub sentiment: GreedNetPainPattern, + pub sentiment: MetricsTree_Cohorts_Utxo_All_Unrealized_Sentiment, } impl MetricsTree_Cohorts_Utxo_All_Unrealized { @@ -6564,7 +6709,7 @@ impl MetricsTree_Cohorts_Utxo_All_Unrealized { net_pnl: MetricsTree_Cohorts_Utxo_All_Unrealized_NetPnl::new(client.clone(), format!("{base_path}_net_pnl")), gross_pnl: CentsUsdPattern2::new(client.clone(), "unrealized_gross_pnl".to_string()), invested_capital: InPattern::new(client.clone(), "invested_capital_in".to_string()), - sentiment: GreedNetPainPattern::new(client.clone(), "".to_string()), + sentiment: MetricsTree_Cohorts_Utxo_All_Unrealized_Sentiment::new(client.clone(), format!("{base_path}_sentiment")), } } } @@ -6630,14 +6775,31 @@ impl MetricsTree_Cohorts_Utxo_All_Unrealized_NetPnl { } } +/// Metrics tree node. +pub struct MetricsTree_Cohorts_Utxo_All_Unrealized_Sentiment { + pub pain_index: CentsUsdPattern2, + pub greed_index: CentsUsdPattern2, + pub net: CentsUsdPattern, +} + +impl MetricsTree_Cohorts_Utxo_All_Unrealized_Sentiment { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + pain_index: CentsUsdPattern2::new(client.clone(), "pain_index".to_string()), + greed_index: CentsUsdPattern2::new(client.clone(), "greed_index".to_string()), + net: CentsUsdPattern::new(client.clone(), "net_sentiment".to_string()), + } + } +} + /// Metrics tree node. pub struct MetricsTree_Cohorts_Utxo_Sth { pub supply: DeltaHalfInRelTotalPattern2, pub outputs: UnspentPattern, - pub activity: CoindaysCoinyearsDormancySentPattern, + pub activity: MetricsTree_Cohorts_Utxo_Sth_Activity, pub realized: MetricsTree_Cohorts_Utxo_Sth_Realized, - pub cost_basis: InvestedMaxMinPercentilesSupplyPattern, - pub unrealized: GrossInvestedLossNetNuplProfitSentimentPattern2, + pub cost_basis: MetricsTree_Cohorts_Utxo_Sth_CostBasis, + pub unrealized: MetricsTree_Cohorts_Utxo_Sth_Unrealized, } impl MetricsTree_Cohorts_Utxo_Sth { @@ -6645,10 +6807,29 @@ impl MetricsTree_Cohorts_Utxo_Sth { Self { supply: DeltaHalfInRelTotalPattern2::new(client.clone(), "sth_supply".to_string()), outputs: UnspentPattern::new(client.clone(), "sth_utxo_count".to_string()), - activity: CoindaysCoinyearsDormancySentPattern::new(client.clone(), "sth".to_string()), + activity: MetricsTree_Cohorts_Utxo_Sth_Activity::new(client.clone(), format!("{base_path}_activity")), realized: MetricsTree_Cohorts_Utxo_Sth_Realized::new(client.clone(), format!("{base_path}_realized")), - cost_basis: InvestedMaxMinPercentilesSupplyPattern::new(client.clone(), "sth".to_string()), - unrealized: GrossInvestedLossNetNuplProfitSentimentPattern2::new(client.clone(), "sth".to_string()), + cost_basis: MetricsTree_Cohorts_Utxo_Sth_CostBasis::new(client.clone(), format!("{base_path}_cost_basis")), + unrealized: MetricsTree_Cohorts_Utxo_Sth_Unrealized::new(client.clone(), format!("{base_path}_unrealized")), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Cohorts_Utxo_Sth_Activity { + pub sent: BaseCumulativeInSumPattern, + pub coindays_destroyed: BaseCumulativeSumPattern, + pub coinyears_destroyed: MetricPattern1, + pub dormancy: MetricPattern1, +} + +impl MetricsTree_Cohorts_Utxo_Sth_Activity { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + sent: BaseCumulativeInSumPattern::new(client.clone(), "sth_sent".to_string()), + coindays_destroyed: BaseCumulativeSumPattern::new(client.clone(), "sth_coindays_destroyed".to_string()), + coinyears_destroyed: MetricPattern1::new(client.clone(), "sth_coinyears_destroyed".to_string()), + dormancy: MetricPattern1::new(client.clone(), "sth_dormancy".to_string()), } } } @@ -6656,16 +6837,16 @@ impl MetricsTree_Cohorts_Utxo_Sth { /// Metrics tree node. pub struct MetricsTree_Cohorts_Utxo_Sth_Realized { pub cap: CentsDeltaRelUsdPattern, - pub profit: BaseCumulativeDistributionRelSumValuePattern, - pub loss: BaseCapitulationCumulativeNegativeRelSumValuePattern, - pub price: BpsCentsPercentilesRatioSatsSmaStdUsdPattern, + pub profit: MetricsTree_Cohorts_Utxo_Sth_Realized_Profit, + pub loss: MetricsTree_Cohorts_Utxo_Sth_Realized_Loss, + pub price: MetricsTree_Cohorts_Utxo_Sth_Realized_Price, pub mvrv: MetricPattern1, - pub sopr: AdjustedRatioValuePattern, + pub sopr: MetricsTree_Cohorts_Utxo_Sth_Realized_Sopr, pub net_pnl: BaseChangeCumulativeDeltaRelSumPattern, pub gross_pnl: BaseCumulativeSumPattern3, pub sell_side_risk_ratio: _1m1w1y24hPattern6, pub peak_regret: BaseCumulativeRelPattern, - pub investor: LowerPriceUpperPattern, + pub investor: MetricsTree_Cohorts_Utxo_Sth_Realized_Investor, pub profit_to_loss_ratio: _1m1w1y24hPattern, } @@ -6673,29 +6854,407 @@ impl MetricsTree_Cohorts_Utxo_Sth_Realized { pub fn new(client: Arc, base_path: String) -> Self { Self { cap: CentsDeltaRelUsdPattern::new(client.clone(), "sth_realized_cap".to_string()), - profit: BaseCumulativeDistributionRelSumValuePattern::new(client.clone(), "sth".to_string()), - loss: BaseCapitulationCumulativeNegativeRelSumValuePattern::new(client.clone(), "sth".to_string()), - price: BpsCentsPercentilesRatioSatsSmaStdUsdPattern::new(client.clone(), "sth_realized_price".to_string()), + profit: MetricsTree_Cohorts_Utxo_Sth_Realized_Profit::new(client.clone(), format!("{base_path}_profit")), + loss: MetricsTree_Cohorts_Utxo_Sth_Realized_Loss::new(client.clone(), format!("{base_path}_loss")), + price: MetricsTree_Cohorts_Utxo_Sth_Realized_Price::new(client.clone(), format!("{base_path}_price")), mvrv: MetricPattern1::new(client.clone(), "sth_mvrv".to_string()), - sopr: AdjustedRatioValuePattern::new(client.clone(), "sth".to_string()), + sopr: MetricsTree_Cohorts_Utxo_Sth_Realized_Sopr::new(client.clone(), format!("{base_path}_sopr")), net_pnl: BaseChangeCumulativeDeltaRelSumPattern::new(client.clone(), "sth_net".to_string()), gross_pnl: BaseCumulativeSumPattern3::new(client.clone(), "sth_realized_gross_pnl".to_string()), sell_side_risk_ratio: _1m1w1y24hPattern6::new(client.clone(), "sth_sell_side_risk_ratio".to_string()), peak_regret: BaseCumulativeRelPattern::new(client.clone(), "sth_realized_peak_regret".to_string()), - investor: LowerPriceUpperPattern::new(client.clone(), "sth".to_string()), + investor: MetricsTree_Cohorts_Utxo_Sth_Realized_Investor::new(client.clone(), format!("{base_path}_investor")), profit_to_loss_ratio: _1m1w1y24hPattern::new(client.clone(), "sth_realized_profit_to_loss_ratio".to_string()), } } } +/// Metrics tree node. +pub struct MetricsTree_Cohorts_Utxo_Sth_Realized_Profit { + pub base: CentsUsdPattern2, + pub cumulative: CentsUsdPattern2, + pub sum: _1m1w1y24hPattern4, + pub rel_to_rcap: BpsPercentRatioPattern4, + pub value_created: BaseCumulativeSumPattern, + pub value_destroyed: BaseCumulativeSumPattern, + pub distribution_flow: MetricPattern1, +} + +impl MetricsTree_Cohorts_Utxo_Sth_Realized_Profit { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + base: CentsUsdPattern2::new(client.clone(), "sth_realized_profit".to_string()), + cumulative: CentsUsdPattern2::new(client.clone(), "sth_realized_profit_cumulative".to_string()), + sum: _1m1w1y24hPattern4::new(client.clone(), "sth_realized_profit_sum".to_string()), + rel_to_rcap: BpsPercentRatioPattern4::new(client.clone(), "sth_realized_profit_rel_to_rcap".to_string()), + value_created: BaseCumulativeSumPattern::new(client.clone(), "sth_profit_value_created".to_string()), + value_destroyed: BaseCumulativeSumPattern::new(client.clone(), "sth_profit_value_destroyed".to_string()), + distribution_flow: MetricPattern1::new(client.clone(), "sth_distribution_flow".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Cohorts_Utxo_Sth_Realized_Loss { + pub base: CentsUsdPattern2, + pub cumulative: CentsUsdPattern2, + pub sum: _1m1w1y24hPattern4, + pub negative: MetricPattern1, + pub rel_to_rcap: BpsPercentRatioPattern4, + pub value_created: BaseCumulativeSumPattern, + pub value_destroyed: BaseCumulativeSumPattern, + pub capitulation_flow: MetricPattern1, +} + +impl MetricsTree_Cohorts_Utxo_Sth_Realized_Loss { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + base: CentsUsdPattern2::new(client.clone(), "sth_realized_loss".to_string()), + cumulative: CentsUsdPattern2::new(client.clone(), "sth_realized_loss_cumulative".to_string()), + sum: _1m1w1y24hPattern4::new(client.clone(), "sth_realized_loss_sum".to_string()), + negative: MetricPattern1::new(client.clone(), "sth_neg_realized_loss".to_string()), + rel_to_rcap: BpsPercentRatioPattern4::new(client.clone(), "sth_realized_loss_rel_to_rcap".to_string()), + value_created: BaseCumulativeSumPattern::new(client.clone(), "sth_loss_value_created".to_string()), + value_destroyed: BaseCumulativeSumPattern::new(client.clone(), "sth_loss_value_destroyed".to_string()), + capitulation_flow: MetricPattern1::new(client.clone(), "sth_capitulation_flow".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Cohorts_Utxo_Sth_Realized_Price { + pub usd: MetricPattern1, + pub cents: MetricPattern1, + pub sats: MetricPattern1, + pub bps: MetricPattern1, + pub ratio: MetricPattern1, + pub percentiles: Pct1Pct2Pct5Pct95Pct98Pct99Pattern, + pub sma: _1m1w1y2y4yAllPattern, + pub std_dev: MetricsTree_Cohorts_Utxo_Sth_Realized_Price_StdDev, +} + +impl MetricsTree_Cohorts_Utxo_Sth_Realized_Price { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + usd: MetricPattern1::new(client.clone(), "sth_realized_price".to_string()), + cents: MetricPattern1::new(client.clone(), "sth_realized_price_cents".to_string()), + sats: MetricPattern1::new(client.clone(), "sth_realized_price_sats".to_string()), + bps: MetricPattern1::new(client.clone(), "sth_realized_price_ratio_bps".to_string()), + ratio: MetricPattern1::new(client.clone(), "sth_realized_price_ratio".to_string()), + percentiles: Pct1Pct2Pct5Pct95Pct98Pct99Pattern::new(client.clone(), "sth_realized_price".to_string()), + sma: _1m1w1y2y4yAllPattern::new(client.clone(), "sth_realized_price_ratio_sma".to_string()), + std_dev: MetricsTree_Cohorts_Utxo_Sth_Realized_Price_StdDev::new(client.clone(), format!("{base_path}_std_dev")), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Cohorts_Utxo_Sth_Realized_Price_StdDev { + pub all: MetricsTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_All, + pub _4y: MetricsTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_4y, + pub _2y: MetricsTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_2y, + pub _1y: MetricsTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_1y, +} + +impl MetricsTree_Cohorts_Utxo_Sth_Realized_Price_StdDev { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + all: MetricsTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_All::new(client.clone(), format!("{base_path}_all")), + _4y: MetricsTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_4y::new(client.clone(), format!("{base_path}_4y")), + _2y: MetricsTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_2y::new(client.clone(), format!("{base_path}_2y")), + _1y: MetricsTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_1y::new(client.clone(), format!("{base_path}_1y")), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_All { + pub sd: MetricPattern1, + pub zscore: MetricPattern1, + pub _0sd: CentsSatsUsdPattern, + pub p0_5sd: PriceRatioPattern, + pub p1sd: PriceRatioPattern, + pub p1_5sd: PriceRatioPattern, + pub p2sd: PriceRatioPattern, + pub p2_5sd: PriceRatioPattern, + pub p3sd: PriceRatioPattern, + pub m0_5sd: PriceRatioPattern, + pub m1sd: PriceRatioPattern, + pub m1_5sd: PriceRatioPattern, + pub m2sd: PriceRatioPattern, + pub m2_5sd: PriceRatioPattern, + pub m3sd: PriceRatioPattern, +} + +impl MetricsTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_All { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + sd: MetricPattern1::new(client.clone(), "sth_realized_price_ratio_sd".to_string()), + zscore: MetricPattern1::new(client.clone(), "sth_realized_price_ratio_zscore".to_string()), + _0sd: CentsSatsUsdPattern::new(client.clone(), "sth_realized_price_0sd".to_string()), + p0_5sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "p0_5sd".to_string().to_string()), + p1sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "p1sd".to_string().to_string()), + p1_5sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "p1_5sd".to_string().to_string()), + p2sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "p2sd".to_string().to_string()), + p2_5sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "p2_5sd".to_string().to_string()), + p3sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "p3sd".to_string().to_string()), + m0_5sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "m0_5sd".to_string().to_string()), + m1sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "m1sd".to_string().to_string()), + m1_5sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "m1_5sd".to_string().to_string()), + m2sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "m2sd".to_string().to_string()), + m2_5sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "m2_5sd".to_string().to_string()), + m3sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "m3sd".to_string().to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_4y { + pub sd: MetricPattern1, + pub zscore: MetricPattern1, + pub _0sd: CentsSatsUsdPattern, + pub p0_5sd: PriceRatioPattern, + pub p1sd: PriceRatioPattern, + pub p1_5sd: PriceRatioPattern, + pub p2sd: PriceRatioPattern, + pub p2_5sd: PriceRatioPattern, + pub p3sd: PriceRatioPattern, + pub m0_5sd: PriceRatioPattern, + pub m1sd: PriceRatioPattern, + pub m1_5sd: PriceRatioPattern, + pub m2sd: PriceRatioPattern, + pub m2_5sd: PriceRatioPattern, + pub m3sd: PriceRatioPattern, +} + +impl MetricsTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_4y { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + sd: MetricPattern1::new(client.clone(), "sth_realized_price_ratio_sd_4y".to_string()), + zscore: MetricPattern1::new(client.clone(), "sth_realized_price_ratio_zscore_4y".to_string()), + _0sd: CentsSatsUsdPattern::new(client.clone(), "sth_realized_price_0sd_4y".to_string()), + p0_5sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "p0_5sd_4y".to_string().to_string()), + p1sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "p1sd_4y".to_string().to_string()), + p1_5sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "p1_5sd_4y".to_string().to_string()), + p2sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "p2sd_4y".to_string().to_string()), + p2_5sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "p2_5sd_4y".to_string().to_string()), + p3sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "p3sd_4y".to_string().to_string()), + m0_5sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "m0_5sd_4y".to_string().to_string()), + m1sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "m1sd_4y".to_string().to_string()), + m1_5sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "m1_5sd_4y".to_string().to_string()), + m2sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "m2sd_4y".to_string().to_string()), + m2_5sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "m2_5sd_4y".to_string().to_string()), + m3sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "m3sd_4y".to_string().to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_2y { + pub sd: MetricPattern1, + pub zscore: MetricPattern1, + pub _0sd: CentsSatsUsdPattern, + pub p0_5sd: PriceRatioPattern, + pub p1sd: PriceRatioPattern, + pub p1_5sd: PriceRatioPattern, + pub p2sd: PriceRatioPattern, + pub p2_5sd: PriceRatioPattern, + pub p3sd: PriceRatioPattern, + pub m0_5sd: PriceRatioPattern, + pub m1sd: PriceRatioPattern, + pub m1_5sd: PriceRatioPattern, + pub m2sd: PriceRatioPattern, + pub m2_5sd: PriceRatioPattern, + pub m3sd: PriceRatioPattern, +} + +impl MetricsTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_2y { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + sd: MetricPattern1::new(client.clone(), "sth_realized_price_ratio_sd_2y".to_string()), + zscore: MetricPattern1::new(client.clone(), "sth_realized_price_ratio_zscore_2y".to_string()), + _0sd: CentsSatsUsdPattern::new(client.clone(), "sth_realized_price_0sd_2y".to_string()), + p0_5sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "p0_5sd_2y".to_string().to_string()), + p1sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "p1sd_2y".to_string().to_string()), + p1_5sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "p1_5sd_2y".to_string().to_string()), + p2sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "p2sd_2y".to_string().to_string()), + p2_5sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "p2_5sd_2y".to_string().to_string()), + p3sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "p3sd_2y".to_string().to_string()), + m0_5sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "m0_5sd_2y".to_string().to_string()), + m1sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "m1sd_2y".to_string().to_string()), + m1_5sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "m1_5sd_2y".to_string().to_string()), + m2sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "m2sd_2y".to_string().to_string()), + m2_5sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "m2_5sd_2y".to_string().to_string()), + m3sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "m3sd_2y".to_string().to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_1y { + pub sd: MetricPattern1, + pub zscore: MetricPattern1, + pub _0sd: CentsSatsUsdPattern, + pub p0_5sd: PriceRatioPattern, + pub p1sd: PriceRatioPattern, + pub p1_5sd: PriceRatioPattern, + pub p2sd: PriceRatioPattern, + pub p2_5sd: PriceRatioPattern, + pub p3sd: PriceRatioPattern, + pub m0_5sd: PriceRatioPattern, + pub m1sd: PriceRatioPattern, + pub m1_5sd: PriceRatioPattern, + pub m2sd: PriceRatioPattern, + pub m2_5sd: PriceRatioPattern, + pub m3sd: PriceRatioPattern, +} + +impl MetricsTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_1y { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + sd: MetricPattern1::new(client.clone(), "sth_realized_price_ratio_sd_1y".to_string()), + zscore: MetricPattern1::new(client.clone(), "sth_realized_price_ratio_zscore_1y".to_string()), + _0sd: CentsSatsUsdPattern::new(client.clone(), "sth_realized_price_0sd_1y".to_string()), + p0_5sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "p0_5sd_1y".to_string().to_string()), + p1sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "p1sd_1y".to_string().to_string()), + p1_5sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "p1_5sd_1y".to_string().to_string()), + p2sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "p2sd_1y".to_string().to_string()), + p2_5sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "p2_5sd_1y".to_string().to_string()), + p3sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "p3sd_1y".to_string().to_string()), + m0_5sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "m0_5sd_1y".to_string().to_string()), + m1sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "m1sd_1y".to_string().to_string()), + m1_5sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "m1_5sd_1y".to_string().to_string()), + m2sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "m2sd_1y".to_string().to_string()), + m2_5sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "m2_5sd_1y".to_string().to_string()), + m3sd: PriceRatioPattern::new(client.clone(), "sth_realized_price".to_string(), "m3sd_1y".to_string().to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Cohorts_Utxo_Sth_Realized_Sopr { + pub value_created: BaseCumulativeSumPattern, + pub value_destroyed: BaseCumulativeSumPattern, + pub ratio: _1m1w1y24hPattern, + pub adjusted: MetricsTree_Cohorts_Utxo_Sth_Realized_Sopr_Adjusted, +} + +impl MetricsTree_Cohorts_Utxo_Sth_Realized_Sopr { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + value_created: BaseCumulativeSumPattern::new(client.clone(), "sth_value_created".to_string()), + value_destroyed: BaseCumulativeSumPattern::new(client.clone(), "sth_value_destroyed".to_string()), + ratio: _1m1w1y24hPattern::new(client.clone(), "sth_sopr".to_string()), + adjusted: MetricsTree_Cohorts_Utxo_Sth_Realized_Sopr_Adjusted::new(client.clone(), format!("{base_path}_adjusted")), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Cohorts_Utxo_Sth_Realized_Sopr_Adjusted { + pub ratio: _1m1w1y24hPattern, + pub value_created: BaseCumulativeSumPattern, + pub value_destroyed: BaseCumulativeSumPattern, +} + +impl MetricsTree_Cohorts_Utxo_Sth_Realized_Sopr_Adjusted { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + ratio: _1m1w1y24hPattern::new(client.clone(), "sth_asopr".to_string()), + value_created: BaseCumulativeSumPattern::new(client.clone(), "sth_adj_value_created".to_string()), + value_destroyed: BaseCumulativeSumPattern::new(client.clone(), "sth_adj_value_destroyed".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Cohorts_Utxo_Sth_Realized_Investor { + pub price: BpsCentsPercentilesRatioSatsUsdPattern, + pub lower_price_band: CentsSatsUsdPattern, + pub upper_price_band: CentsSatsUsdPattern, +} + +impl MetricsTree_Cohorts_Utxo_Sth_Realized_Investor { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + price: BpsCentsPercentilesRatioSatsUsdPattern::new(client.clone(), "sth_investor_price".to_string()), + lower_price_band: CentsSatsUsdPattern::new(client.clone(), "sth_lower_price_band".to_string()), + upper_price_band: CentsSatsUsdPattern::new(client.clone(), "sth_upper_price_band".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Cohorts_Utxo_Sth_CostBasis { + pub min: CentsSatsUsdPattern, + pub max: CentsSatsUsdPattern, + pub percentiles: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern, + pub invested_capital: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern, + pub supply_density: BpsPercentRatioPattern3, +} + +impl MetricsTree_Cohorts_Utxo_Sth_CostBasis { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + min: CentsSatsUsdPattern::new(client.clone(), "sth_cost_basis_min".to_string()), + max: CentsSatsUsdPattern::new(client.clone(), "sth_cost_basis_max".to_string()), + percentiles: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern::new(client.clone(), "sth_cost_basis".to_string()), + invested_capital: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern::new(client.clone(), "sth_invested_capital".to_string()), + supply_density: BpsPercentRatioPattern3::new(client.clone(), "sth_supply_density".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Cohorts_Utxo_Sth_Unrealized { + pub nupl: BpsRatioPattern, + pub profit: BaseCumulativeRelSumPattern2, + pub loss: BaseCumulativeNegativeRelSumPattern2, + pub net_pnl: CentsRelUsdPattern2, + pub gross_pnl: CentsUsdPattern2, + pub invested_capital: InPattern, + pub sentiment: MetricsTree_Cohorts_Utxo_Sth_Unrealized_Sentiment, +} + +impl MetricsTree_Cohorts_Utxo_Sth_Unrealized { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + nupl: BpsRatioPattern::new(client.clone(), "sth_nupl".to_string()), + profit: BaseCumulativeRelSumPattern2::new(client.clone(), "sth_unrealized_profit".to_string()), + loss: BaseCumulativeNegativeRelSumPattern2::new(client.clone(), "sth".to_string()), + net_pnl: CentsRelUsdPattern2::new(client.clone(), "sth_net_unrealized_pnl".to_string()), + gross_pnl: CentsUsdPattern2::new(client.clone(), "sth_unrealized_gross_pnl".to_string()), + invested_capital: InPattern::new(client.clone(), "sth_invested_capital_in".to_string()), + sentiment: MetricsTree_Cohorts_Utxo_Sth_Unrealized_Sentiment::new(client.clone(), format!("{base_path}_sentiment")), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Cohorts_Utxo_Sth_Unrealized_Sentiment { + pub pain_index: CentsUsdPattern2, + pub greed_index: CentsUsdPattern2, + pub net: CentsUsdPattern, +} + +impl MetricsTree_Cohorts_Utxo_Sth_Unrealized_Sentiment { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + pain_index: CentsUsdPattern2::new(client.clone(), "sth_pain_index".to_string()), + greed_index: CentsUsdPattern2::new(client.clone(), "sth_greed_index".to_string()), + net: CentsUsdPattern::new(client.clone(), "sth_net_sentiment".to_string()), + } + } +} + /// Metrics tree node. pub struct MetricsTree_Cohorts_Utxo_Lth { pub supply: DeltaHalfInRelTotalPattern2, pub outputs: UnspentPattern, - pub activity: CoindaysCoinyearsDormancySentPattern, + pub activity: MetricsTree_Cohorts_Utxo_Lth_Activity, pub realized: MetricsTree_Cohorts_Utxo_Lth_Realized, - pub cost_basis: InvestedMaxMinPercentilesSupplyPattern, - pub unrealized: GrossInvestedLossNetNuplProfitSentimentPattern2, + pub cost_basis: MetricsTree_Cohorts_Utxo_Lth_CostBasis, + pub unrealized: MetricsTree_Cohorts_Utxo_Lth_Unrealized, } impl MetricsTree_Cohorts_Utxo_Lth { @@ -6703,10 +7262,29 @@ impl MetricsTree_Cohorts_Utxo_Lth { Self { supply: DeltaHalfInRelTotalPattern2::new(client.clone(), "lth_supply".to_string()), outputs: UnspentPattern::new(client.clone(), "lth_utxo_count".to_string()), - activity: CoindaysCoinyearsDormancySentPattern::new(client.clone(), "lth".to_string()), + activity: MetricsTree_Cohorts_Utxo_Lth_Activity::new(client.clone(), format!("{base_path}_activity")), realized: MetricsTree_Cohorts_Utxo_Lth_Realized::new(client.clone(), format!("{base_path}_realized")), - cost_basis: InvestedMaxMinPercentilesSupplyPattern::new(client.clone(), "lth".to_string()), - unrealized: GrossInvestedLossNetNuplProfitSentimentPattern2::new(client.clone(), "lth".to_string()), + cost_basis: MetricsTree_Cohorts_Utxo_Lth_CostBasis::new(client.clone(), format!("{base_path}_cost_basis")), + unrealized: MetricsTree_Cohorts_Utxo_Lth_Unrealized::new(client.clone(), format!("{base_path}_unrealized")), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Cohorts_Utxo_Lth_Activity { + pub sent: BaseCumulativeInSumPattern, + pub coindays_destroyed: BaseCumulativeSumPattern, + pub coinyears_destroyed: MetricPattern1, + pub dormancy: MetricPattern1, +} + +impl MetricsTree_Cohorts_Utxo_Lth_Activity { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + sent: BaseCumulativeInSumPattern::new(client.clone(), "lth_sent".to_string()), + coindays_destroyed: BaseCumulativeSumPattern::new(client.clone(), "lth_coindays_destroyed".to_string()), + coinyears_destroyed: MetricPattern1::new(client.clone(), "lth_coinyears_destroyed".to_string()), + dormancy: MetricPattern1::new(client.clone(), "lth_dormancy".to_string()), } } } @@ -6714,16 +7292,16 @@ impl MetricsTree_Cohorts_Utxo_Lth { /// Metrics tree node. pub struct MetricsTree_Cohorts_Utxo_Lth_Realized { pub cap: CentsDeltaRelUsdPattern, - pub profit: BaseCumulativeDistributionRelSumValuePattern, - pub loss: BaseCapitulationCumulativeNegativeRelSumValuePattern, - pub price: BpsCentsPercentilesRatioSatsSmaStdUsdPattern, + pub profit: MetricsTree_Cohorts_Utxo_Lth_Realized_Profit, + pub loss: MetricsTree_Cohorts_Utxo_Lth_Realized_Loss, + pub price: MetricsTree_Cohorts_Utxo_Lth_Realized_Price, pub mvrv: MetricPattern1, pub sopr: MetricsTree_Cohorts_Utxo_Lth_Realized_Sopr, pub net_pnl: BaseChangeCumulativeDeltaRelSumPattern, pub gross_pnl: BaseCumulativeSumPattern3, pub sell_side_risk_ratio: _1m1w1y24hPattern6, pub peak_regret: BaseCumulativeRelPattern, - pub investor: LowerPriceUpperPattern, + pub investor: MetricsTree_Cohorts_Utxo_Lth_Realized_Investor, pub profit_to_loss_ratio: _1m1w1y24hPattern, } @@ -6731,21 +7309,283 @@ impl MetricsTree_Cohorts_Utxo_Lth_Realized { pub fn new(client: Arc, base_path: String) -> Self { Self { cap: CentsDeltaRelUsdPattern::new(client.clone(), "lth_realized_cap".to_string()), - profit: BaseCumulativeDistributionRelSumValuePattern::new(client.clone(), "lth".to_string()), - loss: BaseCapitulationCumulativeNegativeRelSumValuePattern::new(client.clone(), "lth".to_string()), - price: BpsCentsPercentilesRatioSatsSmaStdUsdPattern::new(client.clone(), "lth_realized_price".to_string()), + profit: MetricsTree_Cohorts_Utxo_Lth_Realized_Profit::new(client.clone(), format!("{base_path}_profit")), + loss: MetricsTree_Cohorts_Utxo_Lth_Realized_Loss::new(client.clone(), format!("{base_path}_loss")), + price: MetricsTree_Cohorts_Utxo_Lth_Realized_Price::new(client.clone(), format!("{base_path}_price")), mvrv: MetricPattern1::new(client.clone(), "lth_mvrv".to_string()), sopr: MetricsTree_Cohorts_Utxo_Lth_Realized_Sopr::new(client.clone(), format!("{base_path}_sopr")), net_pnl: BaseChangeCumulativeDeltaRelSumPattern::new(client.clone(), "lth_net".to_string()), gross_pnl: BaseCumulativeSumPattern3::new(client.clone(), "lth_realized_gross_pnl".to_string()), sell_side_risk_ratio: _1m1w1y24hPattern6::new(client.clone(), "lth_sell_side_risk_ratio".to_string()), peak_regret: BaseCumulativeRelPattern::new(client.clone(), "lth_realized_peak_regret".to_string()), - investor: LowerPriceUpperPattern::new(client.clone(), "lth".to_string()), + investor: MetricsTree_Cohorts_Utxo_Lth_Realized_Investor::new(client.clone(), format!("{base_path}_investor")), profit_to_loss_ratio: _1m1w1y24hPattern::new(client.clone(), "lth_realized_profit_to_loss_ratio".to_string()), } } } +/// Metrics tree node. +pub struct MetricsTree_Cohorts_Utxo_Lth_Realized_Profit { + pub base: CentsUsdPattern2, + pub cumulative: CentsUsdPattern2, + pub sum: _1m1w1y24hPattern4, + pub rel_to_rcap: BpsPercentRatioPattern4, + pub value_created: BaseCumulativeSumPattern, + pub value_destroyed: BaseCumulativeSumPattern, + pub distribution_flow: MetricPattern1, +} + +impl MetricsTree_Cohorts_Utxo_Lth_Realized_Profit { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + base: CentsUsdPattern2::new(client.clone(), "lth_realized_profit".to_string()), + cumulative: CentsUsdPattern2::new(client.clone(), "lth_realized_profit_cumulative".to_string()), + sum: _1m1w1y24hPattern4::new(client.clone(), "lth_realized_profit_sum".to_string()), + rel_to_rcap: BpsPercentRatioPattern4::new(client.clone(), "lth_realized_profit_rel_to_rcap".to_string()), + value_created: BaseCumulativeSumPattern::new(client.clone(), "lth_profit_value_created".to_string()), + value_destroyed: BaseCumulativeSumPattern::new(client.clone(), "lth_profit_value_destroyed".to_string()), + distribution_flow: MetricPattern1::new(client.clone(), "lth_distribution_flow".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Cohorts_Utxo_Lth_Realized_Loss { + pub base: CentsUsdPattern2, + pub cumulative: CentsUsdPattern2, + pub sum: _1m1w1y24hPattern4, + pub negative: MetricPattern1, + pub rel_to_rcap: BpsPercentRatioPattern4, + pub value_created: BaseCumulativeSumPattern, + pub value_destroyed: BaseCumulativeSumPattern, + pub capitulation_flow: MetricPattern1, +} + +impl MetricsTree_Cohorts_Utxo_Lth_Realized_Loss { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + base: CentsUsdPattern2::new(client.clone(), "lth_realized_loss".to_string()), + cumulative: CentsUsdPattern2::new(client.clone(), "lth_realized_loss_cumulative".to_string()), + sum: _1m1w1y24hPattern4::new(client.clone(), "lth_realized_loss_sum".to_string()), + negative: MetricPattern1::new(client.clone(), "lth_neg_realized_loss".to_string()), + rel_to_rcap: BpsPercentRatioPattern4::new(client.clone(), "lth_realized_loss_rel_to_rcap".to_string()), + value_created: BaseCumulativeSumPattern::new(client.clone(), "lth_loss_value_created".to_string()), + value_destroyed: BaseCumulativeSumPattern::new(client.clone(), "lth_loss_value_destroyed".to_string()), + capitulation_flow: MetricPattern1::new(client.clone(), "lth_capitulation_flow".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Cohorts_Utxo_Lth_Realized_Price { + pub usd: MetricPattern1, + pub cents: MetricPattern1, + pub sats: MetricPattern1, + pub bps: MetricPattern1, + pub ratio: MetricPattern1, + pub percentiles: Pct1Pct2Pct5Pct95Pct98Pct99Pattern, + pub sma: _1m1w1y2y4yAllPattern, + pub std_dev: MetricsTree_Cohorts_Utxo_Lth_Realized_Price_StdDev, +} + +impl MetricsTree_Cohorts_Utxo_Lth_Realized_Price { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + usd: MetricPattern1::new(client.clone(), "lth_realized_price".to_string()), + cents: MetricPattern1::new(client.clone(), "lth_realized_price_cents".to_string()), + sats: MetricPattern1::new(client.clone(), "lth_realized_price_sats".to_string()), + bps: MetricPattern1::new(client.clone(), "lth_realized_price_ratio_bps".to_string()), + ratio: MetricPattern1::new(client.clone(), "lth_realized_price_ratio".to_string()), + percentiles: Pct1Pct2Pct5Pct95Pct98Pct99Pattern::new(client.clone(), "lth_realized_price".to_string()), + sma: _1m1w1y2y4yAllPattern::new(client.clone(), "lth_realized_price_ratio_sma".to_string()), + std_dev: MetricsTree_Cohorts_Utxo_Lth_Realized_Price_StdDev::new(client.clone(), format!("{base_path}_std_dev")), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Cohorts_Utxo_Lth_Realized_Price_StdDev { + pub all: MetricsTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_All, + pub _4y: MetricsTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_4y, + pub _2y: MetricsTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_2y, + pub _1y: MetricsTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_1y, +} + +impl MetricsTree_Cohorts_Utxo_Lth_Realized_Price_StdDev { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + all: MetricsTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_All::new(client.clone(), format!("{base_path}_all")), + _4y: MetricsTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_4y::new(client.clone(), format!("{base_path}_4y")), + _2y: MetricsTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_2y::new(client.clone(), format!("{base_path}_2y")), + _1y: MetricsTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_1y::new(client.clone(), format!("{base_path}_1y")), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_All { + pub sd: MetricPattern1, + pub zscore: MetricPattern1, + pub _0sd: CentsSatsUsdPattern, + pub p0_5sd: PriceRatioPattern, + pub p1sd: PriceRatioPattern, + pub p1_5sd: PriceRatioPattern, + pub p2sd: PriceRatioPattern, + pub p2_5sd: PriceRatioPattern, + pub p3sd: PriceRatioPattern, + pub m0_5sd: PriceRatioPattern, + pub m1sd: PriceRatioPattern, + pub m1_5sd: PriceRatioPattern, + pub m2sd: PriceRatioPattern, + pub m2_5sd: PriceRatioPattern, + pub m3sd: PriceRatioPattern, +} + +impl MetricsTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_All { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + sd: MetricPattern1::new(client.clone(), "lth_realized_price_ratio_sd".to_string()), + zscore: MetricPattern1::new(client.clone(), "lth_realized_price_ratio_zscore".to_string()), + _0sd: CentsSatsUsdPattern::new(client.clone(), "lth_realized_price_0sd".to_string()), + p0_5sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "p0_5sd".to_string().to_string()), + p1sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "p1sd".to_string().to_string()), + p1_5sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "p1_5sd".to_string().to_string()), + p2sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "p2sd".to_string().to_string()), + p2_5sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "p2_5sd".to_string().to_string()), + p3sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "p3sd".to_string().to_string()), + m0_5sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "m0_5sd".to_string().to_string()), + m1sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "m1sd".to_string().to_string()), + m1_5sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "m1_5sd".to_string().to_string()), + m2sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "m2sd".to_string().to_string()), + m2_5sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "m2_5sd".to_string().to_string()), + m3sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "m3sd".to_string().to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_4y { + pub sd: MetricPattern1, + pub zscore: MetricPattern1, + pub _0sd: CentsSatsUsdPattern, + pub p0_5sd: PriceRatioPattern, + pub p1sd: PriceRatioPattern, + pub p1_5sd: PriceRatioPattern, + pub p2sd: PriceRatioPattern, + pub p2_5sd: PriceRatioPattern, + pub p3sd: PriceRatioPattern, + pub m0_5sd: PriceRatioPattern, + pub m1sd: PriceRatioPattern, + pub m1_5sd: PriceRatioPattern, + pub m2sd: PriceRatioPattern, + pub m2_5sd: PriceRatioPattern, + pub m3sd: PriceRatioPattern, +} + +impl MetricsTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_4y { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + sd: MetricPattern1::new(client.clone(), "lth_realized_price_ratio_sd_4y".to_string()), + zscore: MetricPattern1::new(client.clone(), "lth_realized_price_ratio_zscore_4y".to_string()), + _0sd: CentsSatsUsdPattern::new(client.clone(), "lth_realized_price_0sd_4y".to_string()), + p0_5sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "p0_5sd_4y".to_string().to_string()), + p1sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "p1sd_4y".to_string().to_string()), + p1_5sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "p1_5sd_4y".to_string().to_string()), + p2sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "p2sd_4y".to_string().to_string()), + p2_5sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "p2_5sd_4y".to_string().to_string()), + p3sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "p3sd_4y".to_string().to_string()), + m0_5sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "m0_5sd_4y".to_string().to_string()), + m1sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "m1sd_4y".to_string().to_string()), + m1_5sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "m1_5sd_4y".to_string().to_string()), + m2sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "m2sd_4y".to_string().to_string()), + m2_5sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "m2_5sd_4y".to_string().to_string()), + m3sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "m3sd_4y".to_string().to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_2y { + pub sd: MetricPattern1, + pub zscore: MetricPattern1, + pub _0sd: CentsSatsUsdPattern, + pub p0_5sd: PriceRatioPattern, + pub p1sd: PriceRatioPattern, + pub p1_5sd: PriceRatioPattern, + pub p2sd: PriceRatioPattern, + pub p2_5sd: PriceRatioPattern, + pub p3sd: PriceRatioPattern, + pub m0_5sd: PriceRatioPattern, + pub m1sd: PriceRatioPattern, + pub m1_5sd: PriceRatioPattern, + pub m2sd: PriceRatioPattern, + pub m2_5sd: PriceRatioPattern, + pub m3sd: PriceRatioPattern, +} + +impl MetricsTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_2y { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + sd: MetricPattern1::new(client.clone(), "lth_realized_price_ratio_sd_2y".to_string()), + zscore: MetricPattern1::new(client.clone(), "lth_realized_price_ratio_zscore_2y".to_string()), + _0sd: CentsSatsUsdPattern::new(client.clone(), "lth_realized_price_0sd_2y".to_string()), + p0_5sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "p0_5sd_2y".to_string().to_string()), + p1sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "p1sd_2y".to_string().to_string()), + p1_5sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "p1_5sd_2y".to_string().to_string()), + p2sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "p2sd_2y".to_string().to_string()), + p2_5sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "p2_5sd_2y".to_string().to_string()), + p3sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "p3sd_2y".to_string().to_string()), + m0_5sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "m0_5sd_2y".to_string().to_string()), + m1sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "m1sd_2y".to_string().to_string()), + m1_5sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "m1_5sd_2y".to_string().to_string()), + m2sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "m2sd_2y".to_string().to_string()), + m2_5sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "m2_5sd_2y".to_string().to_string()), + m3sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "m3sd_2y".to_string().to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_1y { + pub sd: MetricPattern1, + pub zscore: MetricPattern1, + pub _0sd: CentsSatsUsdPattern, + pub p0_5sd: PriceRatioPattern, + pub p1sd: PriceRatioPattern, + pub p1_5sd: PriceRatioPattern, + pub p2sd: PriceRatioPattern, + pub p2_5sd: PriceRatioPattern, + pub p3sd: PriceRatioPattern, + pub m0_5sd: PriceRatioPattern, + pub m1sd: PriceRatioPattern, + pub m1_5sd: PriceRatioPattern, + pub m2sd: PriceRatioPattern, + pub m2_5sd: PriceRatioPattern, + pub m3sd: PriceRatioPattern, +} + +impl MetricsTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_1y { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + sd: MetricPattern1::new(client.clone(), "lth_realized_price_ratio_sd_1y".to_string()), + zscore: MetricPattern1::new(client.clone(), "lth_realized_price_ratio_zscore_1y".to_string()), + _0sd: CentsSatsUsdPattern::new(client.clone(), "lth_realized_price_0sd_1y".to_string()), + p0_5sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "p0_5sd_1y".to_string().to_string()), + p1sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "p1sd_1y".to_string().to_string()), + p1_5sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "p1_5sd_1y".to_string().to_string()), + p2sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "p2sd_1y".to_string().to_string()), + p2_5sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "p2_5sd_1y".to_string().to_string()), + p3sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "p3sd_1y".to_string().to_string()), + m0_5sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "m0_5sd_1y".to_string().to_string()), + m1sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "m1sd_1y".to_string().to_string()), + m1_5sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "m1_5sd_1y".to_string().to_string()), + m2sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "m2sd_1y".to_string().to_string()), + m2_5sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "m2_5sd_1y".to_string().to_string()), + m3sd: PriceRatioPattern::new(client.clone(), "lth_realized_price".to_string(), "m3sd_1y".to_string().to_string()), + } + } +} + /// Metrics tree node. pub struct MetricsTree_Cohorts_Utxo_Lth_Realized_Sopr { pub value_created: BaseCumulativeSumPattern, @@ -6763,6 +7603,86 @@ impl MetricsTree_Cohorts_Utxo_Lth_Realized_Sopr { } } +/// Metrics tree node. +pub struct MetricsTree_Cohorts_Utxo_Lth_Realized_Investor { + pub price: BpsCentsPercentilesRatioSatsUsdPattern, + pub lower_price_band: CentsSatsUsdPattern, + pub upper_price_band: CentsSatsUsdPattern, +} + +impl MetricsTree_Cohorts_Utxo_Lth_Realized_Investor { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + price: BpsCentsPercentilesRatioSatsUsdPattern::new(client.clone(), "lth_investor_price".to_string()), + lower_price_band: CentsSatsUsdPattern::new(client.clone(), "lth_lower_price_band".to_string()), + upper_price_band: CentsSatsUsdPattern::new(client.clone(), "lth_upper_price_band".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Cohorts_Utxo_Lth_CostBasis { + pub min: CentsSatsUsdPattern, + pub max: CentsSatsUsdPattern, + pub percentiles: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern, + pub invested_capital: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern, + pub supply_density: BpsPercentRatioPattern3, +} + +impl MetricsTree_Cohorts_Utxo_Lth_CostBasis { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + min: CentsSatsUsdPattern::new(client.clone(), "lth_cost_basis_min".to_string()), + max: CentsSatsUsdPattern::new(client.clone(), "lth_cost_basis_max".to_string()), + percentiles: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern::new(client.clone(), "lth_cost_basis".to_string()), + invested_capital: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern::new(client.clone(), "lth_invested_capital".to_string()), + supply_density: BpsPercentRatioPattern3::new(client.clone(), "lth_supply_density".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Cohorts_Utxo_Lth_Unrealized { + pub nupl: BpsRatioPattern, + pub profit: BaseCumulativeRelSumPattern2, + pub loss: BaseCumulativeNegativeRelSumPattern2, + pub net_pnl: CentsRelUsdPattern2, + pub gross_pnl: CentsUsdPattern2, + pub invested_capital: InPattern, + pub sentiment: MetricsTree_Cohorts_Utxo_Lth_Unrealized_Sentiment, +} + +impl MetricsTree_Cohorts_Utxo_Lth_Unrealized { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + nupl: BpsRatioPattern::new(client.clone(), "lth_nupl".to_string()), + profit: BaseCumulativeRelSumPattern2::new(client.clone(), "lth_unrealized_profit".to_string()), + loss: BaseCumulativeNegativeRelSumPattern2::new(client.clone(), "lth".to_string()), + net_pnl: CentsRelUsdPattern2::new(client.clone(), "lth_net_unrealized_pnl".to_string()), + gross_pnl: CentsUsdPattern2::new(client.clone(), "lth_unrealized_gross_pnl".to_string()), + invested_capital: InPattern::new(client.clone(), "lth_invested_capital_in".to_string()), + sentiment: MetricsTree_Cohorts_Utxo_Lth_Unrealized_Sentiment::new(client.clone(), format!("{base_path}_sentiment")), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Cohorts_Utxo_Lth_Unrealized_Sentiment { + pub pain_index: CentsUsdPattern2, + pub greed_index: CentsUsdPattern2, + pub net: CentsUsdPattern, +} + +impl MetricsTree_Cohorts_Utxo_Lth_Unrealized_Sentiment { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + pain_index: CentsUsdPattern2::new(client.clone(), "lth_pain_index".to_string()), + greed_index: CentsUsdPattern2::new(client.clone(), "lth_greed_index".to_string()), + net: CentsUsdPattern::new(client.clone(), "lth_net_sentiment".to_string()), + } + } +} + /// Metrics tree node. pub struct MetricsTree_Cohorts_Utxo_AgeRange { pub under_1h: ActivityOutputsRealizedSupplyUnrealizedPattern, diff --git a/modules/brk-client/index.js b/modules/brk-client/index.js index 6ec219943..07fececbc 100644 --- a/modules/brk-client/index.js +++ b/modules/brk-client/index.js @@ -1672,33 +1672,6 @@ function createPct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65 * @property {MetricPattern1} zscore */ -/** - * Create a _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @param {string} disc - Discriminator suffix - * @returns {_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern} - */ -function create_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern(client, acc, disc) { - return { - _0sd: createCentsSatsUsdPattern(client, _m(_m(acc, '0sd'), disc)), - m05sd: createPriceRatioPattern(client, acc, _m('m0_5sd', disc)), - m15sd: createPriceRatioPattern(client, acc, _m('m1_5sd', disc)), - m1sd: createPriceRatioPattern(client, acc, _m('m1sd', disc)), - m25sd: createPriceRatioPattern(client, acc, _m('m2_5sd', disc)), - m2sd: createPriceRatioPattern(client, acc, _m('m2sd', disc)), - m3sd: createPriceRatioPattern(client, acc, _m('m3sd', disc)), - p05sd: createPriceRatioPattern(client, acc, _m('p0_5sd', disc)), - p15sd: createPriceRatioPattern(client, acc, _m('p1_5sd', disc)), - p1sd: createPriceRatioPattern(client, acc, _m('p1sd', disc)), - p25sd: createPriceRatioPattern(client, acc, _m('p2_5sd', disc)), - p2sd: createPriceRatioPattern(client, acc, _m('p2sd', disc)), - p3sd: createPriceRatioPattern(client, acc, _m('p3sd', disc)), - sd: createMetricPattern1(client, _m(_m(acc, 'ratio_sd'), disc)), - zscore: createMetricPattern1(client, _m(_m(acc, 'ratio_zscore'), disc)), - }; -} - /** * @typedef {Object} _10y1m1w1y2y3m3y4y5y6m6y8yPattern2 * @property {BpsPercentRatioPattern} _10y @@ -1793,29 +1766,6 @@ function create_10y1m1w1y2y3m3y4y5y6m6y8yPattern3(client, acc) { * @property {AdjustedRatioValuePattern} sopr */ -/** - * Create a CapGrossInvestorLossMvrvNetPeakPriceProfitSellSoprPattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {CapGrossInvestorLossMvrvNetPeakPriceProfitSellSoprPattern} - */ -function createCapGrossInvestorLossMvrvNetPeakPriceProfitSellSoprPattern(client, acc) { - return { - cap: createCentsDeltaRelUsdPattern(client, _m(acc, 'realized_cap')), - grossPnl: createBaseCumulativeSumPattern3(client, _m(acc, 'realized_gross_pnl')), - investor: createLowerPriceUpperPattern(client, acc), - loss: createBaseCapitulationCumulativeNegativeRelSumValuePattern(client, acc), - mvrv: createMetricPattern1(client, _m(acc, 'mvrv')), - netPnl: createBaseChangeCumulativeDeltaRelSumPattern(client, _m(acc, 'net')), - peakRegret: createBaseCumulativeRelPattern(client, _m(acc, 'realized_peak_regret')), - price: createBpsCentsPercentilesRatioSatsSmaStdUsdPattern(client, _m(acc, 'realized_price')), - profit: createBaseCumulativeDistributionRelSumValuePattern(client, acc), - profitToLossRatio: create_1m1w1y24hPattern(client, _m(acc, 'realized_profit_to_loss_ratio')), - sellSideRiskRatio: create_1m1w1y24hPattern6(client, _m(acc, 'sell_side_risk_ratio')), - sopr: createAdjustedRatioValuePattern(client, acc), - }; -} - /** * @typedef {Object} AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90RollingSumPattern * @property {MetricPattern18} average @@ -2035,25 +1985,6 @@ function createAverageMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, acc) { * @property {BaseCumulativeSumPattern} valueDestroyed */ -/** - * Create a BaseCapitulationCumulativeNegativeRelSumValuePattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {BaseCapitulationCumulativeNegativeRelSumValuePattern} - */ -function createBaseCapitulationCumulativeNegativeRelSumValuePattern(client, acc) { - return { - base: createCentsUsdPattern2(client, _m(acc, 'realized_loss')), - capitulationFlow: createMetricPattern1(client, _m(acc, 'capitulation_flow')), - cumulative: createCentsUsdPattern2(client, _m(acc, 'realized_loss_cumulative')), - negative: createMetricPattern1(client, _m(acc, 'neg_realized_loss')), - relToRcap: createBpsPercentRatioPattern4(client, _m(acc, 'realized_loss_rel_to_rcap')), - sum: create_1m1w1y24hPattern4(client, _m(acc, 'realized_loss_sum')), - valueCreated: createBaseCumulativeSumPattern(client, _m(acc, 'loss_value_created')), - valueDestroyed: createBaseCumulativeSumPattern(client, _m(acc, 'loss_value_destroyed')), - }; -} - /** * @typedef {Object} BpsCentsPercentilesRatioSatsSmaStdUsdPattern * @property {MetricPattern1} bps @@ -2066,25 +1997,6 @@ function createBaseCapitulationCumulativeNegativeRelSumValuePattern(client, acc) * @property {MetricPattern1} usd */ -/** - * Create a BpsCentsPercentilesRatioSatsSmaStdUsdPattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {BpsCentsPercentilesRatioSatsSmaStdUsdPattern} - */ -function createBpsCentsPercentilesRatioSatsSmaStdUsdPattern(client, acc) { - return { - bps: createMetricPattern1(client, _m(acc, 'ratio_bps')), - cents: createMetricPattern1(client, _m(acc, 'cents')), - percentiles: createPct1Pct2Pct5Pct95Pct98Pct99Pattern(client, acc), - ratio: createMetricPattern1(client, _m(acc, 'ratio')), - sats: createMetricPattern1(client, _m(acc, 'sats')), - sma: create_1m1w1y2y4yAllPattern(client, _m(acc, 'ratio_sma')), - stdDev: create_1y2y4yAllPattern(client, acc), - usd: createMetricPattern1(client, acc), - }; -} - /** * @template T * @typedef {Object} AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern2 @@ -2187,24 +2099,6 @@ function create_1m1w1y24hBpsPercentRatioPattern(client, acc) { * @property {BaseCumulativeSumPattern} valueDestroyed */ -/** - * Create a BaseCumulativeDistributionRelSumValuePattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {BaseCumulativeDistributionRelSumValuePattern} - */ -function createBaseCumulativeDistributionRelSumValuePattern(client, acc) { - return { - base: createCentsUsdPattern2(client, _m(acc, 'realized_profit')), - cumulative: createCentsUsdPattern2(client, _m(acc, 'realized_profit_cumulative')), - distributionFlow: createMetricPattern1(client, _m(acc, 'distribution_flow')), - relToRcap: createBpsPercentRatioPattern4(client, _m(acc, 'realized_profit_rel_to_rcap')), - sum: create_1m1w1y24hPattern4(client, _m(acc, 'realized_profit_sum')), - valueCreated: createBaseCumulativeSumPattern(client, _m(acc, 'profit_value_created')), - valueDestroyed: createBaseCumulativeSumPattern(client, _m(acc, 'profit_value_destroyed')), - }; -} - /** * @typedef {Object} BaseCumulativeNegativeRelSumPattern2 * @property {CentsUsdPattern2} base @@ -2254,7 +2148,7 @@ function createBaseCumulativeNegativeRelSumPattern2(client, acc) { function createCapLossMvrvNetPriceProfitSoprPattern(client, acc) { return { cap: createCentsDeltaUsdPattern(client, _m(acc, 'realized_cap')), - loss: createBaseCumulativeNegativeSumPattern(client, acc, ''), + loss: createBaseCumulativeNegativeSumPattern(client, acc, 'realized_loss'), mvrv: createMetricPattern1(client, _m(acc, 'mvrv')), netPnl: createBaseCumulativeDeltaSumPattern(client, _m(acc, 'net_realized_pnl')), price: createBpsCentsRatioSatsUsdPattern(client, _m(acc, 'realized_price')), @@ -2274,24 +2168,6 @@ function createCapLossMvrvNetPriceProfitSoprPattern(client, acc) { * @property {GreedNetPainPattern} sentiment */ -/** - * Create a GrossInvestedLossNetNuplProfitSentimentPattern2 pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {GrossInvestedLossNetNuplProfitSentimentPattern2} - */ -function createGrossInvestedLossNetNuplProfitSentimentPattern2(client, acc) { - return { - grossPnl: createCentsUsdPattern2(client, _m(acc, 'unrealized_gross_pnl')), - investedCapital: createInPattern(client, _m(acc, 'invested_capital_in')), - loss: createBaseCumulativeNegativeRelSumPattern2(client, acc), - netPnl: createCentsRelUsdPattern2(client, _m(acc, 'net_unrealized_pnl')), - nupl: createBpsRatioPattern(client, _m(acc, 'nupl')), - profit: createBaseCumulativeRelSumPattern2(client, _m(acc, 'unrealized_profit')), - sentiment: createGreedNetPainPattern(client, acc), - }; -} - /** * @typedef {Object} _1m1w1y2y4yAllPattern * @property {BpsRatioPattern2} _1m @@ -2744,22 +2620,6 @@ function createDeltaHalfInTotalPattern2(client, acc) { * @property {MetricPattern1} signal */ -/** - * Create a EmaHistogramLineSignalPattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {EmaHistogramLineSignalPattern} - */ -function createEmaHistogramLineSignalPattern(client, acc) { - return { - emaFast: createMetricPattern1(client, `${acc}_ema_fast`), - emaSlow: createMetricPattern1(client, `${acc}_ema_slow`), - histogram: createMetricPattern1(client, `${acc}_histogram`), - line: createMetricPattern1(client, `${acc}_line`), - signal: createMetricPattern1(client, `${acc}_signal`), - }; -} - /** * @typedef {Object} InvestedMaxMinPercentilesSupplyPattern * @property {Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern} investedCapital @@ -2769,22 +2629,6 @@ function createEmaHistogramLineSignalPattern(client, acc) { * @property {BpsPercentRatioPattern3} supplyDensity */ -/** - * Create a InvestedMaxMinPercentilesSupplyPattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {InvestedMaxMinPercentilesSupplyPattern} - */ -function createInvestedMaxMinPercentilesSupplyPattern(client, acc) { - return { - investedCapital: createPct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern(client, _m(acc, 'invested_capital')), - max: createCentsSatsUsdPattern(client, _m(acc, 'cost_basis_max')), - min: createCentsSatsUsdPattern(client, _m(acc, 'cost_basis_min')), - percentiles: createPct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern(client, _m(acc, 'cost_basis')), - supplyDensity: createBpsPercentRatioPattern3(client, _m(acc, 'supply_density')), - }; -} - /** * @typedef {Object} MvrvNuplRealizedSupplyPattern * @property {MetricPattern1} mvrv @@ -3008,21 +2852,6 @@ function create_1m1w1y24hPattern4(client, acc) { * @property {_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern} all */ -/** - * Create a _1y2y4yAllPattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {_1y2y4yAllPattern} - */ -function create_1y2y4yAllPattern(client, acc) { - return { - _1y: create_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern(client, acc, ''), - _2y: create_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern(client, acc, ''), - _4y: create_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern(client, acc, ''), - all: create_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern(client, acc, ''), - }; -} - /** * @typedef {Object} AdjustedRatioValuePattern * @property {RatioValuePattern2} adjusted @@ -3031,21 +2860,6 @@ function create_1y2y4yAllPattern(client, acc) { * @property {BaseCumulativeSumPattern} valueDestroyed */ -/** - * Create a AdjustedRatioValuePattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {AdjustedRatioValuePattern} - */ -function createAdjustedRatioValuePattern(client, acc) { - return { - adjusted: createRatioValuePattern2(client, acc), - ratio: create_1m1w1y24hPattern(client, _m(acc, 'sopr')), - valueCreated: createBaseCumulativeSumPattern(client, _m(acc, 'value_created')), - valueDestroyed: createBaseCumulativeSumPattern(client, _m(acc, 'value_destroyed')), - }; -} - /** * @typedef {Object} BaseCumulativeDeltaSumPattern * @property {CentsUsdPattern} base @@ -3193,21 +3007,6 @@ function createCentsRelUsdPattern2(client, acc) { * @property {BaseCumulativeInSumPattern} sent */ -/** - * Create a CoindaysCoinyearsDormancySentPattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {CoindaysCoinyearsDormancySentPattern} - */ -function createCoindaysCoinyearsDormancySentPattern(client, acc) { - return { - coindaysDestroyed: createBaseCumulativeSumPattern(client, _m(acc, 'coindays_destroyed')), - coinyearsDestroyed: createMetricPattern1(client, _m(acc, 'coinyears_destroyed')), - dormancy: createMetricPattern1(client, _m(acc, 'dormancy')), - sent: createBaseCumulativeInSumPattern(client, _m(acc, 'sent')), - }; -} - /** * @typedef {Object} LossNetNuplProfitPattern * @property {BaseCumulativeNegativeSumPattern} loss @@ -3224,7 +3023,7 @@ function createCoindaysCoinyearsDormancySentPattern(client, acc) { */ function createLossNetNuplProfitPattern(client, acc) { return { - loss: createBaseCumulativeNegativeSumPattern(client, acc, ''), + loss: createBaseCumulativeNegativeSumPattern(client, acc, 'unrealized_loss'), netPnl: createCentsUsdPattern(client, _m(acc, 'net_unrealized_pnl')), nupl: createBpsRatioPattern(client, _m(acc, 'nupl')), profit: createBaseCumulativeSumPattern3(client, _m(acc, 'unrealized_profit')), @@ -3604,20 +3403,6 @@ function createDeltaHalfTotalPattern(client, acc) { * @property {CentsUsdPattern2} painIndex */ -/** - * Create a GreedNetPainPattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {GreedNetPainPattern} - */ -function createGreedNetPainPattern(client, acc) { - return { - greedIndex: createCentsUsdPattern2(client, _m(acc, 'greed_index')), - net: createCentsUsdPattern(client, _m(acc, 'net_sentiment')), - painIndex: createCentsUsdPattern2(client, _m(acc, 'pain_index')), - }; -} - /** * @typedef {Object} LossNuplProfitPattern * @property {BaseCumulativeNegativeSumPattern} loss @@ -3633,7 +3418,7 @@ function createGreedNetPainPattern(client, acc) { */ function createLossNuplProfitPattern(client, acc) { return { - loss: createBaseCumulativeNegativeSumPattern(client, acc, ''), + loss: createBaseCumulativeNegativeSumPattern(client, acc, 'unrealized_loss'), nupl: createBpsRatioPattern(client, _m(acc, 'nupl')), profit: createBaseCumulativeSumPattern3(client, _m(acc, 'unrealized_profit')), }; @@ -3646,20 +3431,6 @@ function createLossNuplProfitPattern(client, acc) { * @property {CentsSatsUsdPattern} upperPriceBand */ -/** - * Create a LowerPriceUpperPattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {LowerPriceUpperPattern} - */ -function createLowerPriceUpperPattern(client, acc) { - return { - lowerPriceBand: createCentsSatsUsdPattern(client, _m(acc, 'lower_price_band')), - price: createBpsCentsPercentilesRatioSatsUsdPattern(client, _m(acc, 'investor_price')), - upperPriceBand: createCentsSatsUsdPattern(client, _m(acc, 'upper_price_band')), - }; -} - /** * @typedef {Object} RatioValuePattern2 * @property {_1m1w1y24hPattern} ratio @@ -3667,20 +3438,6 @@ function createLowerPriceUpperPattern(client, acc) { * @property {BaseCumulativeSumPattern} valueDestroyed */ -/** - * Create a RatioValuePattern2 pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {RatioValuePattern2} - */ -function createRatioValuePattern2(client, acc) { - return { - ratio: create_1m1w1y24hPattern(client, `${acc}_ratio`), - valueCreated: createBaseCumulativeSumPattern(client, `${acc}_value_created`), - valueDestroyed: createBaseCumulativeSumPattern(client, `${acc}_value_destroyed`), - }; -} - /** * @typedef {Object} RatioValuePattern * @property {_24hPattern} ratio @@ -4021,19 +3778,6 @@ function createRelPattern(client, acc) { * @property {MetricPattern1} sma */ -/** - * Create a SdSmaPattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {SdSmaPattern} - */ -function createSdSmaPattern(client, acc) { - return { - sd: createMetricPattern1(client, `${acc}_sd`), - sma: createMetricPattern1(client, `${acc}_sma`), - }; -} - /** * @typedef {Object} ValuePattern * @property {BaseCumulativeSumPattern} valueCreated @@ -5566,9 +5310,9 @@ function createUnspentPattern(client, acc) { * @typedef {Object} MetricsTree_Cohorts_Utxo_All * @property {MetricsTree_Cohorts_Utxo_All_Supply} supply * @property {UnspentPattern} outputs - * @property {CoindaysCoinyearsDormancySentPattern} activity - * @property {CapGrossInvestorLossMvrvNetPeakPriceProfitSellSoprPattern} realized - * @property {InvestedMaxMinPercentilesSupplyPattern} costBasis + * @property {MetricsTree_Cohorts_Utxo_All_Activity} activity + * @property {MetricsTree_Cohorts_Utxo_All_Realized} realized + * @property {MetricsTree_Cohorts_Utxo_All_CostBasis} costBasis * @property {MetricsTree_Cohorts_Utxo_All_Unrealized} unrealized */ @@ -5581,6 +5325,180 @@ function createUnspentPattern(client, acc) { * @property {BtcCentsRelSatsUsdPattern2} inLoss */ +/** + * @typedef {Object} MetricsTree_Cohorts_Utxo_All_Activity + * @property {BaseCumulativeInSumPattern} sent + * @property {BaseCumulativeSumPattern} coindaysDestroyed + * @property {MetricPattern1} coinyearsDestroyed + * @property {MetricPattern1} dormancy + */ + +/** + * @typedef {Object} MetricsTree_Cohorts_Utxo_All_Realized + * @property {CentsDeltaRelUsdPattern} cap + * @property {MetricsTree_Cohorts_Utxo_All_Realized_Profit} profit + * @property {MetricsTree_Cohorts_Utxo_All_Realized_Loss} loss + * @property {MetricsTree_Cohorts_Utxo_All_Realized_Price} price + * @property {MetricPattern1} mvrv + * @property {MetricsTree_Cohorts_Utxo_All_Realized_Sopr} sopr + * @property {BaseChangeCumulativeDeltaRelSumPattern} netPnl + * @property {BaseCumulativeSumPattern3} grossPnl + * @property {_1m1w1y24hPattern6} sellSideRiskRatio + * @property {BaseCumulativeRelPattern} peakRegret + * @property {MetricsTree_Cohorts_Utxo_All_Realized_Investor} investor + * @property {_1m1w1y24hPattern} profitToLossRatio + */ + +/** + * @typedef {Object} MetricsTree_Cohorts_Utxo_All_Realized_Profit + * @property {CentsUsdPattern2} base + * @property {CentsUsdPattern2} cumulative + * @property {_1m1w1y24hPattern4} sum + * @property {BpsPercentRatioPattern4} relToRcap + * @property {BaseCumulativeSumPattern} valueCreated + * @property {BaseCumulativeSumPattern} valueDestroyed + * @property {MetricPattern1} distributionFlow + */ + +/** + * @typedef {Object} MetricsTree_Cohorts_Utxo_All_Realized_Loss + * @property {CentsUsdPattern2} base + * @property {CentsUsdPattern2} cumulative + * @property {_1m1w1y24hPattern4} sum + * @property {MetricPattern1} negative + * @property {BpsPercentRatioPattern4} relToRcap + * @property {BaseCumulativeSumPattern} valueCreated + * @property {BaseCumulativeSumPattern} valueDestroyed + * @property {MetricPattern1} capitulationFlow + */ + +/** + * @typedef {Object} MetricsTree_Cohorts_Utxo_All_Realized_Price + * @property {MetricPattern1} usd + * @property {MetricPattern1} cents + * @property {MetricPattern1} sats + * @property {MetricPattern1} bps + * @property {MetricPattern1} ratio + * @property {Pct1Pct2Pct5Pct95Pct98Pct99Pattern} percentiles + * @property {_1m1w1y2y4yAllPattern} sma + * @property {MetricsTree_Cohorts_Utxo_All_Realized_Price_StdDev} stdDev + */ + +/** + * @typedef {Object} MetricsTree_Cohorts_Utxo_All_Realized_Price_StdDev + * @property {MetricsTree_Cohorts_Utxo_All_Realized_Price_StdDev_All} all + * @property {MetricsTree_Cohorts_Utxo_All_Realized_Price_StdDev_4y} _4y + * @property {MetricsTree_Cohorts_Utxo_All_Realized_Price_StdDev_2y} _2y + * @property {MetricsTree_Cohorts_Utxo_All_Realized_Price_StdDev_1y} _1y + */ + +/** + * @typedef {Object} MetricsTree_Cohorts_Utxo_All_Realized_Price_StdDev_All + * @property {MetricPattern1} sd + * @property {MetricPattern1} zscore + * @property {CentsSatsUsdPattern} _0sd + * @property {PriceRatioPattern} p05sd + * @property {PriceRatioPattern} p1sd + * @property {PriceRatioPattern} p15sd + * @property {PriceRatioPattern} p2sd + * @property {PriceRatioPattern} p25sd + * @property {PriceRatioPattern} p3sd + * @property {PriceRatioPattern} m05sd + * @property {PriceRatioPattern} m1sd + * @property {PriceRatioPattern} m15sd + * @property {PriceRatioPattern} m2sd + * @property {PriceRatioPattern} m25sd + * @property {PriceRatioPattern} m3sd + */ + +/** + * @typedef {Object} MetricsTree_Cohorts_Utxo_All_Realized_Price_StdDev_4y + * @property {MetricPattern1} sd + * @property {MetricPattern1} zscore + * @property {CentsSatsUsdPattern} _0sd + * @property {PriceRatioPattern} p05sd + * @property {PriceRatioPattern} p1sd + * @property {PriceRatioPattern} p15sd + * @property {PriceRatioPattern} p2sd + * @property {PriceRatioPattern} p25sd + * @property {PriceRatioPattern} p3sd + * @property {PriceRatioPattern} m05sd + * @property {PriceRatioPattern} m1sd + * @property {PriceRatioPattern} m15sd + * @property {PriceRatioPattern} m2sd + * @property {PriceRatioPattern} m25sd + * @property {PriceRatioPattern} m3sd + */ + +/** + * @typedef {Object} MetricsTree_Cohorts_Utxo_All_Realized_Price_StdDev_2y + * @property {MetricPattern1} sd + * @property {MetricPattern1} zscore + * @property {CentsSatsUsdPattern} _0sd + * @property {PriceRatioPattern} p05sd + * @property {PriceRatioPattern} p1sd + * @property {PriceRatioPattern} p15sd + * @property {PriceRatioPattern} p2sd + * @property {PriceRatioPattern} p25sd + * @property {PriceRatioPattern} p3sd + * @property {PriceRatioPattern} m05sd + * @property {PriceRatioPattern} m1sd + * @property {PriceRatioPattern} m15sd + * @property {PriceRatioPattern} m2sd + * @property {PriceRatioPattern} m25sd + * @property {PriceRatioPattern} m3sd + */ + +/** + * @typedef {Object} MetricsTree_Cohorts_Utxo_All_Realized_Price_StdDev_1y + * @property {MetricPattern1} sd + * @property {MetricPattern1} zscore + * @property {CentsSatsUsdPattern} _0sd + * @property {PriceRatioPattern} p05sd + * @property {PriceRatioPattern} p1sd + * @property {PriceRatioPattern} p15sd + * @property {PriceRatioPattern} p2sd + * @property {PriceRatioPattern} p25sd + * @property {PriceRatioPattern} p3sd + * @property {PriceRatioPattern} m05sd + * @property {PriceRatioPattern} m1sd + * @property {PriceRatioPattern} m15sd + * @property {PriceRatioPattern} m2sd + * @property {PriceRatioPattern} m25sd + * @property {PriceRatioPattern} m3sd + */ + +/** + * @typedef {Object} MetricsTree_Cohorts_Utxo_All_Realized_Sopr + * @property {BaseCumulativeSumPattern} valueCreated + * @property {BaseCumulativeSumPattern} valueDestroyed + * @property {_1m1w1y24hPattern} ratio + * @property {MetricsTree_Cohorts_Utxo_All_Realized_Sopr_Adjusted} adjusted + */ + +/** + * @typedef {Object} MetricsTree_Cohorts_Utxo_All_Realized_Sopr_Adjusted + * @property {_1m1w1y24hPattern} ratio + * @property {BaseCumulativeSumPattern} valueCreated + * @property {BaseCumulativeSumPattern} valueDestroyed + */ + +/** + * @typedef {Object} MetricsTree_Cohorts_Utxo_All_Realized_Investor + * @property {BpsCentsPercentilesRatioSatsUsdPattern} price + * @property {CentsSatsUsdPattern} lowerPriceBand + * @property {CentsSatsUsdPattern} upperPriceBand + */ + +/** + * @typedef {Object} MetricsTree_Cohorts_Utxo_All_CostBasis + * @property {CentsSatsUsdPattern} min + * @property {CentsSatsUsdPattern} max + * @property {Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern} percentiles + * @property {Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern} investedCapital + * @property {BpsPercentRatioPattern3} supplyDensity + */ + /** * @typedef {Object} MetricsTree_Cohorts_Utxo_All_Unrealized * @property {BpsRatioPattern} nupl @@ -5589,7 +5507,7 @@ function createUnspentPattern(client, acc) { * @property {MetricsTree_Cohorts_Utxo_All_Unrealized_NetPnl} netPnl * @property {CentsUsdPattern2} grossPnl * @property {InPattern} investedCapital - * @property {GreedNetPainPattern} sentiment + * @property {MetricsTree_Cohorts_Utxo_All_Unrealized_Sentiment} sentiment */ /** @@ -5618,42 +5536,368 @@ function createUnspentPattern(client, acc) { * @property {BpsPercentRatioPattern} relToOwnGross */ +/** + * @typedef {Object} MetricsTree_Cohorts_Utxo_All_Unrealized_Sentiment + * @property {CentsUsdPattern2} painIndex + * @property {CentsUsdPattern2} greedIndex + * @property {CentsUsdPattern} net + */ + /** * @typedef {Object} MetricsTree_Cohorts_Utxo_Sth * @property {DeltaHalfInRelTotalPattern2} supply * @property {UnspentPattern} outputs - * @property {CoindaysCoinyearsDormancySentPattern} activity - * @property {CapGrossInvestorLossMvrvNetPeakPriceProfitSellSoprPattern} realized - * @property {InvestedMaxMinPercentilesSupplyPattern} costBasis - * @property {GrossInvestedLossNetNuplProfitSentimentPattern2} unrealized + * @property {MetricsTree_Cohorts_Utxo_Sth_Activity} activity + * @property {MetricsTree_Cohorts_Utxo_Sth_Realized} realized + * @property {MetricsTree_Cohorts_Utxo_Sth_CostBasis} costBasis + * @property {MetricsTree_Cohorts_Utxo_Sth_Unrealized} unrealized + */ + +/** + * @typedef {Object} MetricsTree_Cohorts_Utxo_Sth_Activity + * @property {BaseCumulativeInSumPattern} sent + * @property {BaseCumulativeSumPattern} coindaysDestroyed + * @property {MetricPattern1} coinyearsDestroyed + * @property {MetricPattern1} dormancy + */ + +/** + * @typedef {Object} MetricsTree_Cohorts_Utxo_Sth_Realized + * @property {CentsDeltaRelUsdPattern} cap + * @property {MetricsTree_Cohorts_Utxo_Sth_Realized_Profit} profit + * @property {MetricsTree_Cohorts_Utxo_Sth_Realized_Loss} loss + * @property {MetricsTree_Cohorts_Utxo_Sth_Realized_Price} price + * @property {MetricPattern1} mvrv + * @property {MetricsTree_Cohorts_Utxo_Sth_Realized_Sopr} sopr + * @property {BaseChangeCumulativeDeltaRelSumPattern} netPnl + * @property {BaseCumulativeSumPattern3} grossPnl + * @property {_1m1w1y24hPattern6} sellSideRiskRatio + * @property {BaseCumulativeRelPattern} peakRegret + * @property {MetricsTree_Cohorts_Utxo_Sth_Realized_Investor} investor + * @property {_1m1w1y24hPattern} profitToLossRatio + */ + +/** + * @typedef {Object} MetricsTree_Cohorts_Utxo_Sth_Realized_Profit + * @property {CentsUsdPattern2} base + * @property {CentsUsdPattern2} cumulative + * @property {_1m1w1y24hPattern4} sum + * @property {BpsPercentRatioPattern4} relToRcap + * @property {BaseCumulativeSumPattern} valueCreated + * @property {BaseCumulativeSumPattern} valueDestroyed + * @property {MetricPattern1} distributionFlow + */ + +/** + * @typedef {Object} MetricsTree_Cohorts_Utxo_Sth_Realized_Loss + * @property {CentsUsdPattern2} base + * @property {CentsUsdPattern2} cumulative + * @property {_1m1w1y24hPattern4} sum + * @property {MetricPattern1} negative + * @property {BpsPercentRatioPattern4} relToRcap + * @property {BaseCumulativeSumPattern} valueCreated + * @property {BaseCumulativeSumPattern} valueDestroyed + * @property {MetricPattern1} capitulationFlow + */ + +/** + * @typedef {Object} MetricsTree_Cohorts_Utxo_Sth_Realized_Price + * @property {MetricPattern1} usd + * @property {MetricPattern1} cents + * @property {MetricPattern1} sats + * @property {MetricPattern1} bps + * @property {MetricPattern1} ratio + * @property {Pct1Pct2Pct5Pct95Pct98Pct99Pattern} percentiles + * @property {_1m1w1y2y4yAllPattern} sma + * @property {MetricsTree_Cohorts_Utxo_Sth_Realized_Price_StdDev} stdDev + */ + +/** + * @typedef {Object} MetricsTree_Cohorts_Utxo_Sth_Realized_Price_StdDev + * @property {MetricsTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_All} all + * @property {MetricsTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_4y} _4y + * @property {MetricsTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_2y} _2y + * @property {MetricsTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_1y} _1y + */ + +/** + * @typedef {Object} MetricsTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_All + * @property {MetricPattern1} sd + * @property {MetricPattern1} zscore + * @property {CentsSatsUsdPattern} _0sd + * @property {PriceRatioPattern} p05sd + * @property {PriceRatioPattern} p1sd + * @property {PriceRatioPattern} p15sd + * @property {PriceRatioPattern} p2sd + * @property {PriceRatioPattern} p25sd + * @property {PriceRatioPattern} p3sd + * @property {PriceRatioPattern} m05sd + * @property {PriceRatioPattern} m1sd + * @property {PriceRatioPattern} m15sd + * @property {PriceRatioPattern} m2sd + * @property {PriceRatioPattern} m25sd + * @property {PriceRatioPattern} m3sd + */ + +/** + * @typedef {Object} MetricsTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_4y + * @property {MetricPattern1} sd + * @property {MetricPattern1} zscore + * @property {CentsSatsUsdPattern} _0sd + * @property {PriceRatioPattern} p05sd + * @property {PriceRatioPattern} p1sd + * @property {PriceRatioPattern} p15sd + * @property {PriceRatioPattern} p2sd + * @property {PriceRatioPattern} p25sd + * @property {PriceRatioPattern} p3sd + * @property {PriceRatioPattern} m05sd + * @property {PriceRatioPattern} m1sd + * @property {PriceRatioPattern} m15sd + * @property {PriceRatioPattern} m2sd + * @property {PriceRatioPattern} m25sd + * @property {PriceRatioPattern} m3sd + */ + +/** + * @typedef {Object} MetricsTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_2y + * @property {MetricPattern1} sd + * @property {MetricPattern1} zscore + * @property {CentsSatsUsdPattern} _0sd + * @property {PriceRatioPattern} p05sd + * @property {PriceRatioPattern} p1sd + * @property {PriceRatioPattern} p15sd + * @property {PriceRatioPattern} p2sd + * @property {PriceRatioPattern} p25sd + * @property {PriceRatioPattern} p3sd + * @property {PriceRatioPattern} m05sd + * @property {PriceRatioPattern} m1sd + * @property {PriceRatioPattern} m15sd + * @property {PriceRatioPattern} m2sd + * @property {PriceRatioPattern} m25sd + * @property {PriceRatioPattern} m3sd + */ + +/** + * @typedef {Object} MetricsTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_1y + * @property {MetricPattern1} sd + * @property {MetricPattern1} zscore + * @property {CentsSatsUsdPattern} _0sd + * @property {PriceRatioPattern} p05sd + * @property {PriceRatioPattern} p1sd + * @property {PriceRatioPattern} p15sd + * @property {PriceRatioPattern} p2sd + * @property {PriceRatioPattern} p25sd + * @property {PriceRatioPattern} p3sd + * @property {PriceRatioPattern} m05sd + * @property {PriceRatioPattern} m1sd + * @property {PriceRatioPattern} m15sd + * @property {PriceRatioPattern} m2sd + * @property {PriceRatioPattern} m25sd + * @property {PriceRatioPattern} m3sd + */ + +/** + * @typedef {Object} MetricsTree_Cohorts_Utxo_Sth_Realized_Sopr + * @property {BaseCumulativeSumPattern} valueCreated + * @property {BaseCumulativeSumPattern} valueDestroyed + * @property {_1m1w1y24hPattern} ratio + * @property {MetricsTree_Cohorts_Utxo_Sth_Realized_Sopr_Adjusted} adjusted + */ + +/** + * @typedef {Object} MetricsTree_Cohorts_Utxo_Sth_Realized_Sopr_Adjusted + * @property {_1m1w1y24hPattern} ratio + * @property {BaseCumulativeSumPattern} valueCreated + * @property {BaseCumulativeSumPattern} valueDestroyed + */ + +/** + * @typedef {Object} MetricsTree_Cohorts_Utxo_Sth_Realized_Investor + * @property {BpsCentsPercentilesRatioSatsUsdPattern} price + * @property {CentsSatsUsdPattern} lowerPriceBand + * @property {CentsSatsUsdPattern} upperPriceBand + */ + +/** + * @typedef {Object} MetricsTree_Cohorts_Utxo_Sth_CostBasis + * @property {CentsSatsUsdPattern} min + * @property {CentsSatsUsdPattern} max + * @property {Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern} percentiles + * @property {Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern} investedCapital + * @property {BpsPercentRatioPattern3} supplyDensity + */ + +/** + * @typedef {Object} MetricsTree_Cohorts_Utxo_Sth_Unrealized + * @property {BpsRatioPattern} nupl + * @property {BaseCumulativeRelSumPattern2} profit + * @property {BaseCumulativeNegativeRelSumPattern2} loss + * @property {CentsRelUsdPattern2} netPnl + * @property {CentsUsdPattern2} grossPnl + * @property {InPattern} investedCapital + * @property {MetricsTree_Cohorts_Utxo_Sth_Unrealized_Sentiment} sentiment + */ + +/** + * @typedef {Object} MetricsTree_Cohorts_Utxo_Sth_Unrealized_Sentiment + * @property {CentsUsdPattern2} painIndex + * @property {CentsUsdPattern2} greedIndex + * @property {CentsUsdPattern} net */ /** * @typedef {Object} MetricsTree_Cohorts_Utxo_Lth * @property {DeltaHalfInRelTotalPattern2} supply * @property {UnspentPattern} outputs - * @property {CoindaysCoinyearsDormancySentPattern} activity + * @property {MetricsTree_Cohorts_Utxo_Lth_Activity} activity * @property {MetricsTree_Cohorts_Utxo_Lth_Realized} realized - * @property {InvestedMaxMinPercentilesSupplyPattern} costBasis - * @property {GrossInvestedLossNetNuplProfitSentimentPattern2} unrealized + * @property {MetricsTree_Cohorts_Utxo_Lth_CostBasis} costBasis + * @property {MetricsTree_Cohorts_Utxo_Lth_Unrealized} unrealized + */ + +/** + * @typedef {Object} MetricsTree_Cohorts_Utxo_Lth_Activity + * @property {BaseCumulativeInSumPattern} sent + * @property {BaseCumulativeSumPattern} coindaysDestroyed + * @property {MetricPattern1} coinyearsDestroyed + * @property {MetricPattern1} dormancy */ /** * @typedef {Object} MetricsTree_Cohorts_Utxo_Lth_Realized * @property {CentsDeltaRelUsdPattern} cap - * @property {BaseCumulativeDistributionRelSumValuePattern} profit - * @property {BaseCapitulationCumulativeNegativeRelSumValuePattern} loss - * @property {BpsCentsPercentilesRatioSatsSmaStdUsdPattern} price + * @property {MetricsTree_Cohorts_Utxo_Lth_Realized_Profit} profit + * @property {MetricsTree_Cohorts_Utxo_Lth_Realized_Loss} loss + * @property {MetricsTree_Cohorts_Utxo_Lth_Realized_Price} price * @property {MetricPattern1} mvrv * @property {MetricsTree_Cohorts_Utxo_Lth_Realized_Sopr} sopr * @property {BaseChangeCumulativeDeltaRelSumPattern} netPnl * @property {BaseCumulativeSumPattern3} grossPnl * @property {_1m1w1y24hPattern6} sellSideRiskRatio * @property {BaseCumulativeRelPattern} peakRegret - * @property {LowerPriceUpperPattern} investor + * @property {MetricsTree_Cohorts_Utxo_Lth_Realized_Investor} investor * @property {_1m1w1y24hPattern} profitToLossRatio */ +/** + * @typedef {Object} MetricsTree_Cohorts_Utxo_Lth_Realized_Profit + * @property {CentsUsdPattern2} base + * @property {CentsUsdPattern2} cumulative + * @property {_1m1w1y24hPattern4} sum + * @property {BpsPercentRatioPattern4} relToRcap + * @property {BaseCumulativeSumPattern} valueCreated + * @property {BaseCumulativeSumPattern} valueDestroyed + * @property {MetricPattern1} distributionFlow + */ + +/** + * @typedef {Object} MetricsTree_Cohorts_Utxo_Lth_Realized_Loss + * @property {CentsUsdPattern2} base + * @property {CentsUsdPattern2} cumulative + * @property {_1m1w1y24hPattern4} sum + * @property {MetricPattern1} negative + * @property {BpsPercentRatioPattern4} relToRcap + * @property {BaseCumulativeSumPattern} valueCreated + * @property {BaseCumulativeSumPattern} valueDestroyed + * @property {MetricPattern1} capitulationFlow + */ + +/** + * @typedef {Object} MetricsTree_Cohorts_Utxo_Lth_Realized_Price + * @property {MetricPattern1} usd + * @property {MetricPattern1} cents + * @property {MetricPattern1} sats + * @property {MetricPattern1} bps + * @property {MetricPattern1} ratio + * @property {Pct1Pct2Pct5Pct95Pct98Pct99Pattern} percentiles + * @property {_1m1w1y2y4yAllPattern} sma + * @property {MetricsTree_Cohorts_Utxo_Lth_Realized_Price_StdDev} stdDev + */ + +/** + * @typedef {Object} MetricsTree_Cohorts_Utxo_Lth_Realized_Price_StdDev + * @property {MetricsTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_All} all + * @property {MetricsTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_4y} _4y + * @property {MetricsTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_2y} _2y + * @property {MetricsTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_1y} _1y + */ + +/** + * @typedef {Object} MetricsTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_All + * @property {MetricPattern1} sd + * @property {MetricPattern1} zscore + * @property {CentsSatsUsdPattern} _0sd + * @property {PriceRatioPattern} p05sd + * @property {PriceRatioPattern} p1sd + * @property {PriceRatioPattern} p15sd + * @property {PriceRatioPattern} p2sd + * @property {PriceRatioPattern} p25sd + * @property {PriceRatioPattern} p3sd + * @property {PriceRatioPattern} m05sd + * @property {PriceRatioPattern} m1sd + * @property {PriceRatioPattern} m15sd + * @property {PriceRatioPattern} m2sd + * @property {PriceRatioPattern} m25sd + * @property {PriceRatioPattern} m3sd + */ + +/** + * @typedef {Object} MetricsTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_4y + * @property {MetricPattern1} sd + * @property {MetricPattern1} zscore + * @property {CentsSatsUsdPattern} _0sd + * @property {PriceRatioPattern} p05sd + * @property {PriceRatioPattern} p1sd + * @property {PriceRatioPattern} p15sd + * @property {PriceRatioPattern} p2sd + * @property {PriceRatioPattern} p25sd + * @property {PriceRatioPattern} p3sd + * @property {PriceRatioPattern} m05sd + * @property {PriceRatioPattern} m1sd + * @property {PriceRatioPattern} m15sd + * @property {PriceRatioPattern} m2sd + * @property {PriceRatioPattern} m25sd + * @property {PriceRatioPattern} m3sd + */ + +/** + * @typedef {Object} MetricsTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_2y + * @property {MetricPattern1} sd + * @property {MetricPattern1} zscore + * @property {CentsSatsUsdPattern} _0sd + * @property {PriceRatioPattern} p05sd + * @property {PriceRatioPattern} p1sd + * @property {PriceRatioPattern} p15sd + * @property {PriceRatioPattern} p2sd + * @property {PriceRatioPattern} p25sd + * @property {PriceRatioPattern} p3sd + * @property {PriceRatioPattern} m05sd + * @property {PriceRatioPattern} m1sd + * @property {PriceRatioPattern} m15sd + * @property {PriceRatioPattern} m2sd + * @property {PriceRatioPattern} m25sd + * @property {PriceRatioPattern} m3sd + */ + +/** + * @typedef {Object} MetricsTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_1y + * @property {MetricPattern1} sd + * @property {MetricPattern1} zscore + * @property {CentsSatsUsdPattern} _0sd + * @property {PriceRatioPattern} p05sd + * @property {PriceRatioPattern} p1sd + * @property {PriceRatioPattern} p15sd + * @property {PriceRatioPattern} p2sd + * @property {PriceRatioPattern} p25sd + * @property {PriceRatioPattern} p3sd + * @property {PriceRatioPattern} m05sd + * @property {PriceRatioPattern} m1sd + * @property {PriceRatioPattern} m15sd + * @property {PriceRatioPattern} m2sd + * @property {PriceRatioPattern} m25sd + * @property {PriceRatioPattern} m3sd + */ + /** * @typedef {Object} MetricsTree_Cohorts_Utxo_Lth_Realized_Sopr * @property {BaseCumulativeSumPattern} valueCreated @@ -5661,6 +5905,40 @@ function createUnspentPattern(client, acc) { * @property {_1m1w1y24hPattern} ratio */ +/** + * @typedef {Object} MetricsTree_Cohorts_Utxo_Lth_Realized_Investor + * @property {BpsCentsPercentilesRatioSatsUsdPattern} price + * @property {CentsSatsUsdPattern} lowerPriceBand + * @property {CentsSatsUsdPattern} upperPriceBand + */ + +/** + * @typedef {Object} MetricsTree_Cohorts_Utxo_Lth_CostBasis + * @property {CentsSatsUsdPattern} min + * @property {CentsSatsUsdPattern} max + * @property {Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern} percentiles + * @property {Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern} investedCapital + * @property {BpsPercentRatioPattern3} supplyDensity + */ + +/** + * @typedef {Object} MetricsTree_Cohorts_Utxo_Lth_Unrealized + * @property {BpsRatioPattern} nupl + * @property {BaseCumulativeRelSumPattern2} profit + * @property {BaseCumulativeNegativeRelSumPattern2} loss + * @property {CentsRelUsdPattern2} netPnl + * @property {CentsUsdPattern2} grossPnl + * @property {InPattern} investedCapital + * @property {MetricsTree_Cohorts_Utxo_Lth_Unrealized_Sentiment} sentiment + */ + +/** + * @typedef {Object} MetricsTree_Cohorts_Utxo_Lth_Unrealized_Sentiment + * @property {CentsUsdPattern2} painIndex + * @property {CentsUsdPattern2} greedIndex + * @property {CentsUsdPattern} net + */ + /** * @typedef {Object} MetricsTree_Cohorts_Utxo_AgeRange * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} under1h @@ -8196,9 +8474,141 @@ class BrkClient extends BrkClientBase { inLoss: createBtcCentsRelSatsUsdPattern2(this, 'supply_in_loss'), }, outputs: createUnspentPattern(this, 'utxo_count'), - activity: createCoindaysCoinyearsDormancySentPattern(this, ''), - realized: createCapGrossInvestorLossMvrvNetPeakPriceProfitSellSoprPattern(this, ''), - costBasis: createInvestedMaxMinPercentilesSupplyPattern(this, ''), + activity: { + sent: createBaseCumulativeInSumPattern(this, 'sent'), + coindaysDestroyed: createBaseCumulativeSumPattern(this, 'coindays_destroyed'), + coinyearsDestroyed: createMetricPattern1(this, 'coinyears_destroyed'), + dormancy: createMetricPattern1(this, 'dormancy'), + }, + realized: { + cap: createCentsDeltaRelUsdPattern(this, 'realized_cap'), + profit: { + base: createCentsUsdPattern2(this, 'realized_profit'), + cumulative: createCentsUsdPattern2(this, 'realized_profit_cumulative'), + sum: create_1m1w1y24hPattern4(this, 'realized_profit_sum'), + relToRcap: createBpsPercentRatioPattern4(this, 'realized_profit_rel_to_rcap'), + valueCreated: createBaseCumulativeSumPattern(this, 'profit_value_created'), + valueDestroyed: createBaseCumulativeSumPattern(this, 'profit_value_destroyed'), + distributionFlow: createMetricPattern1(this, 'distribution_flow'), + }, + loss: { + base: createCentsUsdPattern2(this, 'realized_loss'), + cumulative: createCentsUsdPattern2(this, 'realized_loss_cumulative'), + sum: create_1m1w1y24hPattern4(this, 'realized_loss_sum'), + negative: createMetricPattern1(this, 'neg_realized_loss'), + relToRcap: createBpsPercentRatioPattern4(this, 'realized_loss_rel_to_rcap'), + valueCreated: createBaseCumulativeSumPattern(this, 'loss_value_created'), + valueDestroyed: createBaseCumulativeSumPattern(this, 'loss_value_destroyed'), + capitulationFlow: createMetricPattern1(this, 'capitulation_flow'), + }, + price: { + usd: createMetricPattern1(this, 'realized_price'), + cents: createMetricPattern1(this, 'realized_price_cents'), + sats: createMetricPattern1(this, 'realized_price_sats'), + bps: createMetricPattern1(this, 'realized_price_ratio_bps'), + ratio: createMetricPattern1(this, 'realized_price_ratio'), + percentiles: createPct1Pct2Pct5Pct95Pct98Pct99Pattern(this, 'realized_price'), + sma: create_1m1w1y2y4yAllPattern(this, 'realized_price_ratio_sma'), + stdDev: { + all: { + sd: createMetricPattern1(this, 'realized_price_ratio_sd'), + zscore: createMetricPattern1(this, 'realized_price_ratio_zscore'), + _0sd: createCentsSatsUsdPattern(this, 'realized_price_0sd'), + p05sd: createPriceRatioPattern(this, 'realized_price', 'p0_5sd'), + p1sd: createPriceRatioPattern(this, 'realized_price', 'p1sd'), + p15sd: createPriceRatioPattern(this, 'realized_price', 'p1_5sd'), + p2sd: createPriceRatioPattern(this, 'realized_price', 'p2sd'), + p25sd: createPriceRatioPattern(this, 'realized_price', 'p2_5sd'), + p3sd: createPriceRatioPattern(this, 'realized_price', 'p3sd'), + m05sd: createPriceRatioPattern(this, 'realized_price', 'm0_5sd'), + m1sd: createPriceRatioPattern(this, 'realized_price', 'm1sd'), + m15sd: createPriceRatioPattern(this, 'realized_price', 'm1_5sd'), + m2sd: createPriceRatioPattern(this, 'realized_price', 'm2sd'), + m25sd: createPriceRatioPattern(this, 'realized_price', 'm2_5sd'), + m3sd: createPriceRatioPattern(this, 'realized_price', 'm3sd'), + }, + _4y: { + sd: createMetricPattern1(this, 'realized_price_ratio_sd_4y'), + zscore: createMetricPattern1(this, 'realized_price_ratio_zscore_4y'), + _0sd: createCentsSatsUsdPattern(this, 'realized_price_0sd_4y'), + p05sd: createPriceRatioPattern(this, 'realized_price', 'p0_5sd_4y'), + p1sd: createPriceRatioPattern(this, 'realized_price', 'p1sd_4y'), + p15sd: createPriceRatioPattern(this, 'realized_price', 'p1_5sd_4y'), + p2sd: createPriceRatioPattern(this, 'realized_price', 'p2sd_4y'), + p25sd: createPriceRatioPattern(this, 'realized_price', 'p2_5sd_4y'), + p3sd: createPriceRatioPattern(this, 'realized_price', 'p3sd_4y'), + m05sd: createPriceRatioPattern(this, 'realized_price', 'm0_5sd_4y'), + m1sd: createPriceRatioPattern(this, 'realized_price', 'm1sd_4y'), + m15sd: createPriceRatioPattern(this, 'realized_price', 'm1_5sd_4y'), + m2sd: createPriceRatioPattern(this, 'realized_price', 'm2sd_4y'), + m25sd: createPriceRatioPattern(this, 'realized_price', 'm2_5sd_4y'), + m3sd: createPriceRatioPattern(this, 'realized_price', 'm3sd_4y'), + }, + _2y: { + sd: createMetricPattern1(this, 'realized_price_ratio_sd_2y'), + zscore: createMetricPattern1(this, 'realized_price_ratio_zscore_2y'), + _0sd: createCentsSatsUsdPattern(this, 'realized_price_0sd_2y'), + p05sd: createPriceRatioPattern(this, 'realized_price', 'p0_5sd_2y'), + p1sd: createPriceRatioPattern(this, 'realized_price', 'p1sd_2y'), + p15sd: createPriceRatioPattern(this, 'realized_price', 'p1_5sd_2y'), + p2sd: createPriceRatioPattern(this, 'realized_price', 'p2sd_2y'), + p25sd: createPriceRatioPattern(this, 'realized_price', 'p2_5sd_2y'), + p3sd: createPriceRatioPattern(this, 'realized_price', 'p3sd_2y'), + m05sd: createPriceRatioPattern(this, 'realized_price', 'm0_5sd_2y'), + m1sd: createPriceRatioPattern(this, 'realized_price', 'm1sd_2y'), + m15sd: createPriceRatioPattern(this, 'realized_price', 'm1_5sd_2y'), + m2sd: createPriceRatioPattern(this, 'realized_price', 'm2sd_2y'), + m25sd: createPriceRatioPattern(this, 'realized_price', 'm2_5sd_2y'), + m3sd: createPriceRatioPattern(this, 'realized_price', 'm3sd_2y'), + }, + _1y: { + sd: createMetricPattern1(this, 'realized_price_ratio_sd_1y'), + zscore: createMetricPattern1(this, 'realized_price_ratio_zscore_1y'), + _0sd: createCentsSatsUsdPattern(this, 'realized_price_0sd_1y'), + p05sd: createPriceRatioPattern(this, 'realized_price', 'p0_5sd_1y'), + p1sd: createPriceRatioPattern(this, 'realized_price', 'p1sd_1y'), + p15sd: createPriceRatioPattern(this, 'realized_price', 'p1_5sd_1y'), + p2sd: createPriceRatioPattern(this, 'realized_price', 'p2sd_1y'), + p25sd: createPriceRatioPattern(this, 'realized_price', 'p2_5sd_1y'), + p3sd: createPriceRatioPattern(this, 'realized_price', 'p3sd_1y'), + m05sd: createPriceRatioPattern(this, 'realized_price', 'm0_5sd_1y'), + m1sd: createPriceRatioPattern(this, 'realized_price', 'm1sd_1y'), + m15sd: createPriceRatioPattern(this, 'realized_price', 'm1_5sd_1y'), + m2sd: createPriceRatioPattern(this, 'realized_price', 'm2sd_1y'), + m25sd: createPriceRatioPattern(this, 'realized_price', 'm2_5sd_1y'), + m3sd: createPriceRatioPattern(this, 'realized_price', 'm3sd_1y'), + }, + }, + }, + mvrv: createMetricPattern1(this, 'mvrv'), + sopr: { + valueCreated: createBaseCumulativeSumPattern(this, 'value_created'), + valueDestroyed: createBaseCumulativeSumPattern(this, 'value_destroyed'), + ratio: create_1m1w1y24hPattern(this, 'sopr'), + adjusted: { + ratio: create_1m1w1y24hPattern(this, 'asopr'), + valueCreated: createBaseCumulativeSumPattern(this, 'adj_value_created'), + valueDestroyed: createBaseCumulativeSumPattern(this, 'adj_value_destroyed'), + }, + }, + netPnl: createBaseChangeCumulativeDeltaRelSumPattern(this, 'net'), + grossPnl: createBaseCumulativeSumPattern3(this, 'realized_gross_pnl'), + sellSideRiskRatio: create_1m1w1y24hPattern6(this, 'sell_side_risk_ratio'), + peakRegret: createBaseCumulativeRelPattern(this, 'realized_peak_regret'), + investor: { + price: createBpsCentsPercentilesRatioSatsUsdPattern(this, 'investor_price'), + lowerPriceBand: createCentsSatsUsdPattern(this, 'lower_price_band'), + upperPriceBand: createCentsSatsUsdPattern(this, 'upper_price_band'), + }, + profitToLossRatio: create_1m1w1y24hPattern(this, 'realized_profit_to_loss_ratio'), + }, + costBasis: { + min: createCentsSatsUsdPattern(this, 'cost_basis_min'), + max: createCentsSatsUsdPattern(this, 'cost_basis_max'), + percentiles: createPct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern(this, 'cost_basis'), + investedCapital: createPct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern(this, 'invested_capital'), + supplyDensity: createBpsPercentRatioPattern3(this, 'supply_density'), + }, unrealized: { nupl: createBpsRatioPattern(this, 'nupl'), profit: { @@ -8223,26 +8633,274 @@ class BrkClient extends BrkClientBase { }, grossPnl: createCentsUsdPattern2(this, 'unrealized_gross_pnl'), investedCapital: createInPattern(this, 'invested_capital_in'), - sentiment: createGreedNetPainPattern(this, ''), + sentiment: { + painIndex: createCentsUsdPattern2(this, 'pain_index'), + greedIndex: createCentsUsdPattern2(this, 'greed_index'), + net: createCentsUsdPattern(this, 'net_sentiment'), + }, }, }, sth: { supply: createDeltaHalfInRelTotalPattern2(this, 'sth_supply'), outputs: createUnspentPattern(this, 'sth_utxo_count'), - activity: createCoindaysCoinyearsDormancySentPattern(this, 'sth'), - realized: createCapGrossInvestorLossMvrvNetPeakPriceProfitSellSoprPattern(this, 'sth'), - costBasis: createInvestedMaxMinPercentilesSupplyPattern(this, 'sth'), - unrealized: createGrossInvestedLossNetNuplProfitSentimentPattern2(this, 'sth'), + activity: { + sent: createBaseCumulativeInSumPattern(this, 'sth_sent'), + coindaysDestroyed: createBaseCumulativeSumPattern(this, 'sth_coindays_destroyed'), + coinyearsDestroyed: createMetricPattern1(this, 'sth_coinyears_destroyed'), + dormancy: createMetricPattern1(this, 'sth_dormancy'), + }, + realized: { + cap: createCentsDeltaRelUsdPattern(this, 'sth_realized_cap'), + profit: { + base: createCentsUsdPattern2(this, 'sth_realized_profit'), + cumulative: createCentsUsdPattern2(this, 'sth_realized_profit_cumulative'), + sum: create_1m1w1y24hPattern4(this, 'sth_realized_profit_sum'), + relToRcap: createBpsPercentRatioPattern4(this, 'sth_realized_profit_rel_to_rcap'), + valueCreated: createBaseCumulativeSumPattern(this, 'sth_profit_value_created'), + valueDestroyed: createBaseCumulativeSumPattern(this, 'sth_profit_value_destroyed'), + distributionFlow: createMetricPattern1(this, 'sth_distribution_flow'), + }, + loss: { + base: createCentsUsdPattern2(this, 'sth_realized_loss'), + cumulative: createCentsUsdPattern2(this, 'sth_realized_loss_cumulative'), + sum: create_1m1w1y24hPattern4(this, 'sth_realized_loss_sum'), + negative: createMetricPattern1(this, 'sth_neg_realized_loss'), + relToRcap: createBpsPercentRatioPattern4(this, 'sth_realized_loss_rel_to_rcap'), + valueCreated: createBaseCumulativeSumPattern(this, 'sth_loss_value_created'), + valueDestroyed: createBaseCumulativeSumPattern(this, 'sth_loss_value_destroyed'), + capitulationFlow: createMetricPattern1(this, 'sth_capitulation_flow'), + }, + price: { + usd: createMetricPattern1(this, 'sth_realized_price'), + cents: createMetricPattern1(this, 'sth_realized_price_cents'), + sats: createMetricPattern1(this, 'sth_realized_price_sats'), + bps: createMetricPattern1(this, 'sth_realized_price_ratio_bps'), + ratio: createMetricPattern1(this, 'sth_realized_price_ratio'), + percentiles: createPct1Pct2Pct5Pct95Pct98Pct99Pattern(this, 'sth_realized_price'), + sma: create_1m1w1y2y4yAllPattern(this, 'sth_realized_price_ratio_sma'), + stdDev: { + all: { + sd: createMetricPattern1(this, 'sth_realized_price_ratio_sd'), + zscore: createMetricPattern1(this, 'sth_realized_price_ratio_zscore'), + _0sd: createCentsSatsUsdPattern(this, 'sth_realized_price_0sd'), + p05sd: createPriceRatioPattern(this, 'sth_realized_price', 'p0_5sd'), + p1sd: createPriceRatioPattern(this, 'sth_realized_price', 'p1sd'), + p15sd: createPriceRatioPattern(this, 'sth_realized_price', 'p1_5sd'), + p2sd: createPriceRatioPattern(this, 'sth_realized_price', 'p2sd'), + p25sd: createPriceRatioPattern(this, 'sth_realized_price', 'p2_5sd'), + p3sd: createPriceRatioPattern(this, 'sth_realized_price', 'p3sd'), + m05sd: createPriceRatioPattern(this, 'sth_realized_price', 'm0_5sd'), + m1sd: createPriceRatioPattern(this, 'sth_realized_price', 'm1sd'), + m15sd: createPriceRatioPattern(this, 'sth_realized_price', 'm1_5sd'), + m2sd: createPriceRatioPattern(this, 'sth_realized_price', 'm2sd'), + m25sd: createPriceRatioPattern(this, 'sth_realized_price', 'm2_5sd'), + m3sd: createPriceRatioPattern(this, 'sth_realized_price', 'm3sd'), + }, + _4y: { + sd: createMetricPattern1(this, 'sth_realized_price_ratio_sd_4y'), + zscore: createMetricPattern1(this, 'sth_realized_price_ratio_zscore_4y'), + _0sd: createCentsSatsUsdPattern(this, 'sth_realized_price_0sd_4y'), + p05sd: createPriceRatioPattern(this, 'sth_realized_price', 'p0_5sd_4y'), + p1sd: createPriceRatioPattern(this, 'sth_realized_price', 'p1sd_4y'), + p15sd: createPriceRatioPattern(this, 'sth_realized_price', 'p1_5sd_4y'), + p2sd: createPriceRatioPattern(this, 'sth_realized_price', 'p2sd_4y'), + p25sd: createPriceRatioPattern(this, 'sth_realized_price', 'p2_5sd_4y'), + p3sd: createPriceRatioPattern(this, 'sth_realized_price', 'p3sd_4y'), + m05sd: createPriceRatioPattern(this, 'sth_realized_price', 'm0_5sd_4y'), + m1sd: createPriceRatioPattern(this, 'sth_realized_price', 'm1sd_4y'), + m15sd: createPriceRatioPattern(this, 'sth_realized_price', 'm1_5sd_4y'), + m2sd: createPriceRatioPattern(this, 'sth_realized_price', 'm2sd_4y'), + m25sd: createPriceRatioPattern(this, 'sth_realized_price', 'm2_5sd_4y'), + m3sd: createPriceRatioPattern(this, 'sth_realized_price', 'm3sd_4y'), + }, + _2y: { + sd: createMetricPattern1(this, 'sth_realized_price_ratio_sd_2y'), + zscore: createMetricPattern1(this, 'sth_realized_price_ratio_zscore_2y'), + _0sd: createCentsSatsUsdPattern(this, 'sth_realized_price_0sd_2y'), + p05sd: createPriceRatioPattern(this, 'sth_realized_price', 'p0_5sd_2y'), + p1sd: createPriceRatioPattern(this, 'sth_realized_price', 'p1sd_2y'), + p15sd: createPriceRatioPattern(this, 'sth_realized_price', 'p1_5sd_2y'), + p2sd: createPriceRatioPattern(this, 'sth_realized_price', 'p2sd_2y'), + p25sd: createPriceRatioPattern(this, 'sth_realized_price', 'p2_5sd_2y'), + p3sd: createPriceRatioPattern(this, 'sth_realized_price', 'p3sd_2y'), + m05sd: createPriceRatioPattern(this, 'sth_realized_price', 'm0_5sd_2y'), + m1sd: createPriceRatioPattern(this, 'sth_realized_price', 'm1sd_2y'), + m15sd: createPriceRatioPattern(this, 'sth_realized_price', 'm1_5sd_2y'), + m2sd: createPriceRatioPattern(this, 'sth_realized_price', 'm2sd_2y'), + m25sd: createPriceRatioPattern(this, 'sth_realized_price', 'm2_5sd_2y'), + m3sd: createPriceRatioPattern(this, 'sth_realized_price', 'm3sd_2y'), + }, + _1y: { + sd: createMetricPattern1(this, 'sth_realized_price_ratio_sd_1y'), + zscore: createMetricPattern1(this, 'sth_realized_price_ratio_zscore_1y'), + _0sd: createCentsSatsUsdPattern(this, 'sth_realized_price_0sd_1y'), + p05sd: createPriceRatioPattern(this, 'sth_realized_price', 'p0_5sd_1y'), + p1sd: createPriceRatioPattern(this, 'sth_realized_price', 'p1sd_1y'), + p15sd: createPriceRatioPattern(this, 'sth_realized_price', 'p1_5sd_1y'), + p2sd: createPriceRatioPattern(this, 'sth_realized_price', 'p2sd_1y'), + p25sd: createPriceRatioPattern(this, 'sth_realized_price', 'p2_5sd_1y'), + p3sd: createPriceRatioPattern(this, 'sth_realized_price', 'p3sd_1y'), + m05sd: createPriceRatioPattern(this, 'sth_realized_price', 'm0_5sd_1y'), + m1sd: createPriceRatioPattern(this, 'sth_realized_price', 'm1sd_1y'), + m15sd: createPriceRatioPattern(this, 'sth_realized_price', 'm1_5sd_1y'), + m2sd: createPriceRatioPattern(this, 'sth_realized_price', 'm2sd_1y'), + m25sd: createPriceRatioPattern(this, 'sth_realized_price', 'm2_5sd_1y'), + m3sd: createPriceRatioPattern(this, 'sth_realized_price', 'm3sd_1y'), + }, + }, + }, + mvrv: createMetricPattern1(this, 'sth_mvrv'), + sopr: { + valueCreated: createBaseCumulativeSumPattern(this, 'sth_value_created'), + valueDestroyed: createBaseCumulativeSumPattern(this, 'sth_value_destroyed'), + ratio: create_1m1w1y24hPattern(this, 'sth_sopr'), + adjusted: { + ratio: create_1m1w1y24hPattern(this, 'sth_asopr'), + valueCreated: createBaseCumulativeSumPattern(this, 'sth_adj_value_created'), + valueDestroyed: createBaseCumulativeSumPattern(this, 'sth_adj_value_destroyed'), + }, + }, + netPnl: createBaseChangeCumulativeDeltaRelSumPattern(this, 'sth_net'), + grossPnl: createBaseCumulativeSumPattern3(this, 'sth_realized_gross_pnl'), + sellSideRiskRatio: create_1m1w1y24hPattern6(this, 'sth_sell_side_risk_ratio'), + peakRegret: createBaseCumulativeRelPattern(this, 'sth_realized_peak_regret'), + investor: { + price: createBpsCentsPercentilesRatioSatsUsdPattern(this, 'sth_investor_price'), + lowerPriceBand: createCentsSatsUsdPattern(this, 'sth_lower_price_band'), + upperPriceBand: createCentsSatsUsdPattern(this, 'sth_upper_price_band'), + }, + profitToLossRatio: create_1m1w1y24hPattern(this, 'sth_realized_profit_to_loss_ratio'), + }, + costBasis: { + min: createCentsSatsUsdPattern(this, 'sth_cost_basis_min'), + max: createCentsSatsUsdPattern(this, 'sth_cost_basis_max'), + percentiles: createPct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern(this, 'sth_cost_basis'), + investedCapital: createPct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern(this, 'sth_invested_capital'), + supplyDensity: createBpsPercentRatioPattern3(this, 'sth_supply_density'), + }, + unrealized: { + nupl: createBpsRatioPattern(this, 'sth_nupl'), + profit: createBaseCumulativeRelSumPattern2(this, 'sth_unrealized_profit'), + loss: createBaseCumulativeNegativeRelSumPattern2(this, 'sth'), + netPnl: createCentsRelUsdPattern2(this, 'sth_net_unrealized_pnl'), + grossPnl: createCentsUsdPattern2(this, 'sth_unrealized_gross_pnl'), + investedCapital: createInPattern(this, 'sth_invested_capital_in'), + sentiment: { + painIndex: createCentsUsdPattern2(this, 'sth_pain_index'), + greedIndex: createCentsUsdPattern2(this, 'sth_greed_index'), + net: createCentsUsdPattern(this, 'sth_net_sentiment'), + }, + }, }, lth: { supply: createDeltaHalfInRelTotalPattern2(this, 'lth_supply'), outputs: createUnspentPattern(this, 'lth_utxo_count'), - activity: createCoindaysCoinyearsDormancySentPattern(this, 'lth'), + activity: { + sent: createBaseCumulativeInSumPattern(this, 'lth_sent'), + coindaysDestroyed: createBaseCumulativeSumPattern(this, 'lth_coindays_destroyed'), + coinyearsDestroyed: createMetricPattern1(this, 'lth_coinyears_destroyed'), + dormancy: createMetricPattern1(this, 'lth_dormancy'), + }, realized: { cap: createCentsDeltaRelUsdPattern(this, 'lth_realized_cap'), - profit: createBaseCumulativeDistributionRelSumValuePattern(this, 'lth'), - loss: createBaseCapitulationCumulativeNegativeRelSumValuePattern(this, 'lth'), - price: createBpsCentsPercentilesRatioSatsSmaStdUsdPattern(this, 'lth_realized_price'), + profit: { + base: createCentsUsdPattern2(this, 'lth_realized_profit'), + cumulative: createCentsUsdPattern2(this, 'lth_realized_profit_cumulative'), + sum: create_1m1w1y24hPattern4(this, 'lth_realized_profit_sum'), + relToRcap: createBpsPercentRatioPattern4(this, 'lth_realized_profit_rel_to_rcap'), + valueCreated: createBaseCumulativeSumPattern(this, 'lth_profit_value_created'), + valueDestroyed: createBaseCumulativeSumPattern(this, 'lth_profit_value_destroyed'), + distributionFlow: createMetricPattern1(this, 'lth_distribution_flow'), + }, + loss: { + base: createCentsUsdPattern2(this, 'lth_realized_loss'), + cumulative: createCentsUsdPattern2(this, 'lth_realized_loss_cumulative'), + sum: create_1m1w1y24hPattern4(this, 'lth_realized_loss_sum'), + negative: createMetricPattern1(this, 'lth_neg_realized_loss'), + relToRcap: createBpsPercentRatioPattern4(this, 'lth_realized_loss_rel_to_rcap'), + valueCreated: createBaseCumulativeSumPattern(this, 'lth_loss_value_created'), + valueDestroyed: createBaseCumulativeSumPattern(this, 'lth_loss_value_destroyed'), + capitulationFlow: createMetricPattern1(this, 'lth_capitulation_flow'), + }, + price: { + usd: createMetricPattern1(this, 'lth_realized_price'), + cents: createMetricPattern1(this, 'lth_realized_price_cents'), + sats: createMetricPattern1(this, 'lth_realized_price_sats'), + bps: createMetricPattern1(this, 'lth_realized_price_ratio_bps'), + ratio: createMetricPattern1(this, 'lth_realized_price_ratio'), + percentiles: createPct1Pct2Pct5Pct95Pct98Pct99Pattern(this, 'lth_realized_price'), + sma: create_1m1w1y2y4yAllPattern(this, 'lth_realized_price_ratio_sma'), + stdDev: { + all: { + sd: createMetricPattern1(this, 'lth_realized_price_ratio_sd'), + zscore: createMetricPattern1(this, 'lth_realized_price_ratio_zscore'), + _0sd: createCentsSatsUsdPattern(this, 'lth_realized_price_0sd'), + p05sd: createPriceRatioPattern(this, 'lth_realized_price', 'p0_5sd'), + p1sd: createPriceRatioPattern(this, 'lth_realized_price', 'p1sd'), + p15sd: createPriceRatioPattern(this, 'lth_realized_price', 'p1_5sd'), + p2sd: createPriceRatioPattern(this, 'lth_realized_price', 'p2sd'), + p25sd: createPriceRatioPattern(this, 'lth_realized_price', 'p2_5sd'), + p3sd: createPriceRatioPattern(this, 'lth_realized_price', 'p3sd'), + m05sd: createPriceRatioPattern(this, 'lth_realized_price', 'm0_5sd'), + m1sd: createPriceRatioPattern(this, 'lth_realized_price', 'm1sd'), + m15sd: createPriceRatioPattern(this, 'lth_realized_price', 'm1_5sd'), + m2sd: createPriceRatioPattern(this, 'lth_realized_price', 'm2sd'), + m25sd: createPriceRatioPattern(this, 'lth_realized_price', 'm2_5sd'), + m3sd: createPriceRatioPattern(this, 'lth_realized_price', 'm3sd'), + }, + _4y: { + sd: createMetricPattern1(this, 'lth_realized_price_ratio_sd_4y'), + zscore: createMetricPattern1(this, 'lth_realized_price_ratio_zscore_4y'), + _0sd: createCentsSatsUsdPattern(this, 'lth_realized_price_0sd_4y'), + p05sd: createPriceRatioPattern(this, 'lth_realized_price', 'p0_5sd_4y'), + p1sd: createPriceRatioPattern(this, 'lth_realized_price', 'p1sd_4y'), + p15sd: createPriceRatioPattern(this, 'lth_realized_price', 'p1_5sd_4y'), + p2sd: createPriceRatioPattern(this, 'lth_realized_price', 'p2sd_4y'), + p25sd: createPriceRatioPattern(this, 'lth_realized_price', 'p2_5sd_4y'), + p3sd: createPriceRatioPattern(this, 'lth_realized_price', 'p3sd_4y'), + m05sd: createPriceRatioPattern(this, 'lth_realized_price', 'm0_5sd_4y'), + m1sd: createPriceRatioPattern(this, 'lth_realized_price', 'm1sd_4y'), + m15sd: createPriceRatioPattern(this, 'lth_realized_price', 'm1_5sd_4y'), + m2sd: createPriceRatioPattern(this, 'lth_realized_price', 'm2sd_4y'), + m25sd: createPriceRatioPattern(this, 'lth_realized_price', 'm2_5sd_4y'), + m3sd: createPriceRatioPattern(this, 'lth_realized_price', 'm3sd_4y'), + }, + _2y: { + sd: createMetricPattern1(this, 'lth_realized_price_ratio_sd_2y'), + zscore: createMetricPattern1(this, 'lth_realized_price_ratio_zscore_2y'), + _0sd: createCentsSatsUsdPattern(this, 'lth_realized_price_0sd_2y'), + p05sd: createPriceRatioPattern(this, 'lth_realized_price', 'p0_5sd_2y'), + p1sd: createPriceRatioPattern(this, 'lth_realized_price', 'p1sd_2y'), + p15sd: createPriceRatioPattern(this, 'lth_realized_price', 'p1_5sd_2y'), + p2sd: createPriceRatioPattern(this, 'lth_realized_price', 'p2sd_2y'), + p25sd: createPriceRatioPattern(this, 'lth_realized_price', 'p2_5sd_2y'), + p3sd: createPriceRatioPattern(this, 'lth_realized_price', 'p3sd_2y'), + m05sd: createPriceRatioPattern(this, 'lth_realized_price', 'm0_5sd_2y'), + m1sd: createPriceRatioPattern(this, 'lth_realized_price', 'm1sd_2y'), + m15sd: createPriceRatioPattern(this, 'lth_realized_price', 'm1_5sd_2y'), + m2sd: createPriceRatioPattern(this, 'lth_realized_price', 'm2sd_2y'), + m25sd: createPriceRatioPattern(this, 'lth_realized_price', 'm2_5sd_2y'), + m3sd: createPriceRatioPattern(this, 'lth_realized_price', 'm3sd_2y'), + }, + _1y: { + sd: createMetricPattern1(this, 'lth_realized_price_ratio_sd_1y'), + zscore: createMetricPattern1(this, 'lth_realized_price_ratio_zscore_1y'), + _0sd: createCentsSatsUsdPattern(this, 'lth_realized_price_0sd_1y'), + p05sd: createPriceRatioPattern(this, 'lth_realized_price', 'p0_5sd_1y'), + p1sd: createPriceRatioPattern(this, 'lth_realized_price', 'p1sd_1y'), + p15sd: createPriceRatioPattern(this, 'lth_realized_price', 'p1_5sd_1y'), + p2sd: createPriceRatioPattern(this, 'lth_realized_price', 'p2sd_1y'), + p25sd: createPriceRatioPattern(this, 'lth_realized_price', 'p2_5sd_1y'), + p3sd: createPriceRatioPattern(this, 'lth_realized_price', 'p3sd_1y'), + m05sd: createPriceRatioPattern(this, 'lth_realized_price', 'm0_5sd_1y'), + m1sd: createPriceRatioPattern(this, 'lth_realized_price', 'm1sd_1y'), + m15sd: createPriceRatioPattern(this, 'lth_realized_price', 'm1_5sd_1y'), + m2sd: createPriceRatioPattern(this, 'lth_realized_price', 'm2sd_1y'), + m25sd: createPriceRatioPattern(this, 'lth_realized_price', 'm2_5sd_1y'), + m3sd: createPriceRatioPattern(this, 'lth_realized_price', 'm3sd_1y'), + }, + }, + }, mvrv: createMetricPattern1(this, 'lth_mvrv'), sopr: { valueCreated: createBaseCumulativeSumPattern(this, 'lth_value_created'), @@ -8253,11 +8911,33 @@ class BrkClient extends BrkClientBase { grossPnl: createBaseCumulativeSumPattern3(this, 'lth_realized_gross_pnl'), sellSideRiskRatio: create_1m1w1y24hPattern6(this, 'lth_sell_side_risk_ratio'), peakRegret: createBaseCumulativeRelPattern(this, 'lth_realized_peak_regret'), - investor: createLowerPriceUpperPattern(this, 'lth'), + investor: { + price: createBpsCentsPercentilesRatioSatsUsdPattern(this, 'lth_investor_price'), + lowerPriceBand: createCentsSatsUsdPattern(this, 'lth_lower_price_band'), + upperPriceBand: createCentsSatsUsdPattern(this, 'lth_upper_price_band'), + }, profitToLossRatio: create_1m1w1y24hPattern(this, 'lth_realized_profit_to_loss_ratio'), }, - costBasis: createInvestedMaxMinPercentilesSupplyPattern(this, 'lth'), - unrealized: createGrossInvestedLossNetNuplProfitSentimentPattern2(this, 'lth'), + costBasis: { + min: createCentsSatsUsdPattern(this, 'lth_cost_basis_min'), + max: createCentsSatsUsdPattern(this, 'lth_cost_basis_max'), + percentiles: createPct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern(this, 'lth_cost_basis'), + investedCapital: createPct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern(this, 'lth_invested_capital'), + supplyDensity: createBpsPercentRatioPattern3(this, 'lth_supply_density'), + }, + unrealized: { + nupl: createBpsRatioPattern(this, 'lth_nupl'), + profit: createBaseCumulativeRelSumPattern2(this, 'lth_unrealized_profit'), + loss: createBaseCumulativeNegativeRelSumPattern2(this, 'lth'), + netPnl: createCentsRelUsdPattern2(this, 'lth_net_unrealized_pnl'), + grossPnl: createCentsUsdPattern2(this, 'lth_unrealized_gross_pnl'), + investedCapital: createInPattern(this, 'lth_invested_capital_in'), + sentiment: { + painIndex: createCentsUsdPattern2(this, 'lth_pain_index'), + greedIndex: createCentsUsdPattern2(this, 'lth_greed_index'), + net: createCentsUsdPattern(this, 'lth_net_sentiment'), + }, + }, }, ageRange: { under1h: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_under_1h_old'), diff --git a/packages/brk_client/brk_client/__init__.py b/packages/brk_client/brk_client/__init__.py index fa83ba5fa..fe85b97de 100644 --- a/packages/brk_client/brk_client/__init__.py +++ b/packages/brk_client/brk_client/__init__.py @@ -2149,21 +2149,21 @@ class _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self._0sd: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, f'0sd{disc}')) - self.m0_5sd: PriceRatioPattern = PriceRatioPattern(client, acc, _m('m0_5sd', disc)) - self.m1_5sd: PriceRatioPattern = PriceRatioPattern(client, acc, _m('m1_5sd', disc)) - self.m1sd: PriceRatioPattern = PriceRatioPattern(client, acc, _m('m1sd', disc)) - self.m2_5sd: PriceRatioPattern = PriceRatioPattern(client, acc, _m('m2_5sd', disc)) - self.m2sd: PriceRatioPattern = PriceRatioPattern(client, acc, _m('m2sd', disc)) - self.m3sd: PriceRatioPattern = PriceRatioPattern(client, acc, _m('m3sd', disc)) - self.p0_5sd: PriceRatioPattern = PriceRatioPattern(client, acc, _m('p0_5sd', disc)) - self.p1_5sd: PriceRatioPattern = PriceRatioPattern(client, acc, _m('p1_5sd', disc)) - self.p1sd: PriceRatioPattern = PriceRatioPattern(client, acc, _m('p1sd', disc)) - self.p2_5sd: PriceRatioPattern = PriceRatioPattern(client, acc, _m('p2_5sd', disc)) - self.p2sd: PriceRatioPattern = PriceRatioPattern(client, acc, _m('p2sd', disc)) - self.p3sd: PriceRatioPattern = PriceRatioPattern(client, acc, _m('p3sd', disc)) - self.sd: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, f'ratio_sd{disc}')) - self.zscore: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, f'ratio_zscore{disc}')) + self._0sd: CentsSatsUsdPattern = CentsSatsUsdPattern(client, f'{acc}_0sd') + self.m0_5sd: PriceRatioPattern = PriceRatioPattern(client, acc, 'm0_5sd') + self.m1_5sd: PriceRatioPattern = PriceRatioPattern(client, acc, 'm1_5sd') + self.m1sd: PriceRatioPattern = PriceRatioPattern(client, acc, 'm1sd') + self.m2_5sd: PriceRatioPattern = PriceRatioPattern(client, acc, 'm2_5sd') + self.m2sd: PriceRatioPattern = PriceRatioPattern(client, acc, 'm2sd') + self.m3sd: PriceRatioPattern = PriceRatioPattern(client, acc, 'm3sd') + self.p0_5sd: PriceRatioPattern = PriceRatioPattern(client, acc, 'p0_5sd') + self.p1_5sd: PriceRatioPattern = PriceRatioPattern(client, acc, 'p1_5sd') + self.p1sd: PriceRatioPattern = PriceRatioPattern(client, acc, 'p1sd') + self.p2_5sd: PriceRatioPattern = PriceRatioPattern(client, acc, 'p2_5sd') + self.p2sd: PriceRatioPattern = PriceRatioPattern(client, acc, 'p2sd') + self.p3sd: PriceRatioPattern = PriceRatioPattern(client, acc, 'p3sd') + self.sd: MetricPattern1[StoredF32] = MetricPattern1(client, f'{acc}_sd') + self.zscore: MetricPattern1[StoredF32] = MetricPattern1(client, f'{acc}_zscore') class _10y1m1w1y2y3m3y4y5y6m6y8yPattern2: """Pattern struct for repeated tree structure.""" @@ -2318,14 +2318,14 @@ class BaseCapitulationCumulativeNegativeRelSumValuePattern: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.base: CentsUsdPattern2 = CentsUsdPattern2(client, _m(acc, 'realized_loss')) - self.capitulation_flow: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'capitulation_flow')) - self.cumulative: CentsUsdPattern2 = CentsUsdPattern2(client, _m(acc, 'realized_loss_cumulative')) - self.negative: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'neg_realized_loss')) - self.rel_to_rcap: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, _m(acc, 'realized_loss_rel_to_rcap')) - self.sum: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, _m(acc, 'realized_loss_sum')) - self.value_created: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, _m(acc, 'loss_value_created')) - self.value_destroyed: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, _m(acc, 'loss_value_destroyed')) + self.base: CentsUsdPattern2 = CentsUsdPattern2(client, f'{acc}_base') + self.capitulation_flow: MetricPattern1[Dollars] = MetricPattern1(client, f'{acc}_capitulation_flow') + self.cumulative: CentsUsdPattern2 = CentsUsdPattern2(client, f'{acc}_cumulative') + self.negative: MetricPattern1[Dollars] = MetricPattern1(client, f'{acc}_negative') + self.rel_to_rcap: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, f'{acc}_rel_to_rcap') + self.sum: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, f'{acc}_sum') + self.value_created: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, f'{acc}_value_created') + self.value_destroyed: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, f'{acc}_value_destroyed') class BpsCentsPercentilesRatioSatsSmaStdUsdPattern: """Pattern struct for repeated tree structure.""" @@ -2338,7 +2338,7 @@ class BpsCentsPercentilesRatioSatsSmaStdUsdPattern: self.ratio: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'ratio')) self.sats: MetricPattern1[SatsFract] = MetricPattern1(client, _m(acc, 'sats')) self.sma: _1m1w1y2y4yAllPattern = _1m1w1y2y4yAllPattern(client, _m(acc, 'ratio_sma')) - self.std_dev: _1y2y4yAllPattern = _1y2y4yAllPattern(client, acc) + self.std_dev: _1y2y4yAllPattern = _1y2y4yAllPattern(client, _m(acc, '0sd')) self.usd: MetricPattern1[Dollars] = MetricPattern1(client, acc) class AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern2(Generic[T]): @@ -2386,13 +2386,13 @@ class BaseCumulativeDistributionRelSumValuePattern: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.base: CentsUsdPattern2 = CentsUsdPattern2(client, _m(acc, 'realized_profit')) - self.cumulative: CentsUsdPattern2 = CentsUsdPattern2(client, _m(acc, 'realized_profit_cumulative')) - self.distribution_flow: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'distribution_flow')) - self.rel_to_rcap: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, _m(acc, 'realized_profit_rel_to_rcap')) - self.sum: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, _m(acc, 'realized_profit_sum')) - self.value_created: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, _m(acc, 'profit_value_created')) - self.value_destroyed: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, _m(acc, 'profit_value_destroyed')) + self.base: CentsUsdPattern2 = CentsUsdPattern2(client, f'{acc}_base') + self.cumulative: CentsUsdPattern2 = CentsUsdPattern2(client, f'{acc}_cumulative') + self.distribution_flow: MetricPattern1[Dollars] = MetricPattern1(client, f'{acc}_distribution_flow') + self.rel_to_rcap: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, f'{acc}_rel_to_rcap') + self.sum: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, f'{acc}_sum') + self.value_created: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, f'{acc}_value_created') + self.value_destroyed: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, f'{acc}_value_destroyed') class BaseCumulativeNegativeRelSumPattern2: """Pattern struct for repeated tree structure.""" @@ -2413,12 +2413,12 @@ class CapLossMvrvNetPriceProfitSoprPattern: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" self.cap: CentsDeltaUsdPattern = CentsDeltaUsdPattern(client, _m(acc, 'realized_cap')) - self.loss: BaseCumulativeNegativeSumPattern = BaseCumulativeNegativeSumPattern(client, acc, '') + self.loss: BaseCumulativeNegativeSumPattern = BaseCumulativeNegativeSumPattern(client, acc, 'realized_loss') self.mvrv: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'mvrv')) self.net_pnl: BaseCumulativeDeltaSumPattern = BaseCumulativeDeltaSumPattern(client, _m(acc, 'net_realized_pnl')) self.price: BpsCentsRatioSatsUsdPattern = BpsCentsRatioSatsUsdPattern(client, _m(acc, 'realized_price')) self.profit: BaseCumulativeSumPattern3 = BaseCumulativeSumPattern3(client, _m(acc, 'realized_profit')) - self.sopr: RatioValuePattern = RatioValuePattern(client, _m(acc, 'sopr_24h')) + self.sopr: RatioValuePattern = RatioValuePattern(client, acc) class GrossInvestedLossNetNuplProfitSentimentPattern2: """Pattern struct for repeated tree structure.""" @@ -2645,11 +2645,11 @@ class InvestedMaxMinPercentilesSupplyPattern: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.invested_capital: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern = Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern(client, _m(acc, 'invested_capital')) - self.max: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'cost_basis_max')) - self.min: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'cost_basis_min')) - self.percentiles: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern = Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern(client, _m(acc, 'cost_basis')) - self.supply_density: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, 'supply_density')) + self.invested_capital: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern = Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern(client, f'{acc}_invested_capital') + self.max: CentsSatsUsdPattern = CentsSatsUsdPattern(client, f'{acc}_max') + self.min: CentsSatsUsdPattern = CentsSatsUsdPattern(client, f'{acc}_min') + self.percentiles: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern = Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern(client, f'{acc}_percentiles') + self.supply_density: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, f'{acc}_supply_density') class MvrvNuplRealizedSupplyPattern: """Pattern struct for repeated tree structure.""" @@ -2658,9 +2658,9 @@ class MvrvNuplRealizedSupplyPattern: """Create pattern node with accumulated metric name.""" self.mvrv: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'mvrv')) self.nupl: BpsRatioPattern = BpsRatioPattern(client, _m(acc, 'nupl')) - self.realized_cap: AllSthPattern = AllSthPattern(client, _m(acc, 'realized_cap')) + self.realized_cap: AllSthPattern = AllSthPattern(client, acc) self.realized_price: BpsCentsRatioSatsUsdPattern = BpsCentsRatioSatsUsdPattern(client, _m(acc, 'realized_price')) - self.supply: AllSthPattern2 = AllSthPattern2(client, _m(acc, 'supply')) + self.supply: AllSthPattern2 = AllSthPattern2(client, acc) class PhsReboundThsPattern: """Pattern struct for repeated tree structure.""" @@ -2749,20 +2749,20 @@ class _1y2y4yAllPattern: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self._1y: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern = _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern(client, acc, '1y') - self._2y: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern = _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern(client, acc, '2y') - self._4y: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern = _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern(client, acc, '4y') - self.all: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern = _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern(client, acc, '') + self._1y: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern = _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern(client, f'{acc}_1y') + self._2y: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern = _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern(client, f'{acc}_2y') + self._4y: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern = _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern(client, f'{acc}_4y') + self.all: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern = _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern(client, f'{acc}_all') class AdjustedRatioValuePattern: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.adjusted: RatioValuePattern2 = RatioValuePattern2(client, acc) - self.ratio: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, _m(acc, 'sopr')) - self.value_created: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, _m(acc, 'value_created')) - self.value_destroyed: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, _m(acc, 'value_destroyed')) + self.adjusted: RatioValuePattern2 = RatioValuePattern2(client, f'{acc}_adjusted') + self.ratio: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, f'{acc}_ratio') + self.value_created: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, f'{acc}_value_created') + self.value_destroyed: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, f'{acc}_value_destroyed') class BaseCumulativeDeltaSumPattern: """Pattern struct for repeated tree structure.""" @@ -2829,17 +2829,17 @@ class CoindaysCoinyearsDormancySentPattern: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.coindays_destroyed: BaseCumulativeSumPattern[StoredF64] = BaseCumulativeSumPattern(client, _m(acc, 'coindays_destroyed')) - self.coinyears_destroyed: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'coinyears_destroyed')) - self.dormancy: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'dormancy')) - self.sent: BaseCumulativeInSumPattern = BaseCumulativeInSumPattern(client, _m(acc, 'sent')) + self.coindays_destroyed: BaseCumulativeSumPattern[StoredF64] = BaseCumulativeSumPattern(client, f'{acc}_coindays_destroyed') + self.coinyears_destroyed: MetricPattern1[StoredF64] = MetricPattern1(client, f'{acc}_coinyears_destroyed') + self.dormancy: MetricPattern1[StoredF32] = MetricPattern1(client, f'{acc}_dormancy') + self.sent: BaseCumulativeInSumPattern = BaseCumulativeInSumPattern(client, f'{acc}_sent') class LossNetNuplProfitPattern: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.loss: BaseCumulativeNegativeSumPattern = BaseCumulativeNegativeSumPattern(client, acc, '') + self.loss: BaseCumulativeNegativeSumPattern = BaseCumulativeNegativeSumPattern(client, acc, 'unrealized_loss') self.net_pnl: CentsUsdPattern = CentsUsdPattern(client, _m(acc, 'net_unrealized_pnl')) self.nupl: BpsRatioPattern = BpsRatioPattern(client, _m(acc, 'nupl')) self.profit: BaseCumulativeSumPattern3 = BaseCumulativeSumPattern3(client, _m(acc, 'unrealized_profit')) @@ -3005,16 +3005,16 @@ class GreedNetPainPattern: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.greed_index: CentsUsdPattern2 = CentsUsdPattern2(client, _m(acc, 'greed_index')) - self.net: CentsUsdPattern = CentsUsdPattern(client, _m(acc, 'net_sentiment')) - self.pain_index: CentsUsdPattern2 = CentsUsdPattern2(client, _m(acc, 'pain_index')) + self.greed_index: CentsUsdPattern2 = CentsUsdPattern2(client, f'{acc}_greed_index') + self.net: CentsUsdPattern = CentsUsdPattern(client, f'{acc}_net') + self.pain_index: CentsUsdPattern2 = CentsUsdPattern2(client, f'{acc}_pain_index') class LossNuplProfitPattern: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.loss: BaseCumulativeNegativeSumPattern = BaseCumulativeNegativeSumPattern(client, acc, '') + self.loss: BaseCumulativeNegativeSumPattern = BaseCumulativeNegativeSumPattern(client, acc, 'unrealized_loss') self.nupl: BpsRatioPattern = BpsRatioPattern(client, _m(acc, 'nupl')) self.profit: BaseCumulativeSumPattern3 = BaseCumulativeSumPattern3(client, _m(acc, 'unrealized_profit')) @@ -3023,9 +3023,9 @@ class LowerPriceUpperPattern: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.lower_price_band: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'lower_price_band')) - self.price: BpsCentsPercentilesRatioSatsUsdPattern = BpsCentsPercentilesRatioSatsUsdPattern(client, _m(acc, 'investor_price')) - self.upper_price_band: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'upper_price_band')) + self.lower_price_band: CentsSatsUsdPattern = CentsSatsUsdPattern(client, f'{acc}_lower_price_band') + self.price: BpsCentsPercentilesRatioSatsUsdPattern = BpsCentsPercentilesRatioSatsUsdPattern(client, f'{acc}_price') + self.upper_price_band: CentsSatsUsdPattern = CentsSatsUsdPattern(client, f'{acc}_upper_price_band') class RatioValuePattern2: """Pattern struct for repeated tree structure.""" @@ -3069,7 +3069,7 @@ class AbsoluteRatePattern: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" self.absolute: _1m1w1y24hPattern[StoredI64] = _1m1w1y24hPattern(client, acc) - self.rate: _1m1w1y24hPattern2 = _1m1w1y24hPattern2(client, _m(acc, 'rate')) + self.rate: _1m1w1y24hPattern2 = _1m1w1y24hPattern2(client, acc) class AbsoluteRatePattern2: """Pattern struct for repeated tree structure.""" @@ -3077,7 +3077,7 @@ class AbsoluteRatePattern2: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" self.absolute: _1m1w1y24hPattern3 = _1m1w1y24hPattern3(client, acc) - self.rate: _1m1w1y24hPattern2 = _1m1w1y24hPattern2(client, _m(acc, 'rate')) + self.rate: _1m1w1y24hPattern2 = _1m1w1y24hPattern2(client, acc) class AllSthPattern2: """Pattern struct for repeated tree structure.""" @@ -4775,23 +4775,194 @@ class MetricsTree_Cohorts_Utxo_All_Supply: self.in_profit: BtcCentsRelSatsUsdPattern2 = BtcCentsRelSatsUsdPattern2(client, 'supply_in_profit') self.in_loss: BtcCentsRelSatsUsdPattern2 = BtcCentsRelSatsUsdPattern2(client, 'supply_in_loss') +class MetricsTree_Cohorts_Utxo_All_Activity: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.sent: BaseCumulativeInSumPattern = BaseCumulativeInSumPattern(client, 'sent') + self.coindays_destroyed: BaseCumulativeSumPattern[StoredF64] = BaseCumulativeSumPattern(client, 'coindays_destroyed') + self.coinyears_destroyed: MetricPattern1[StoredF64] = MetricPattern1(client, 'coinyears_destroyed') + self.dormancy: MetricPattern1[StoredF32] = MetricPattern1(client, 'dormancy') + +class MetricsTree_Cohorts_Utxo_All_Realized_Profit: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.base: CentsUsdPattern2 = CentsUsdPattern2(client, 'realized_profit') + self.cumulative: CentsUsdPattern2 = CentsUsdPattern2(client, 'realized_profit_cumulative') + self.sum: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, 'realized_profit_sum') + self.rel_to_rcap: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'realized_profit_rel_to_rcap') + self.value_created: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, 'profit_value_created') + self.value_destroyed: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, 'profit_value_destroyed') + self.distribution_flow: MetricPattern1[Dollars] = MetricPattern1(client, 'distribution_flow') + +class MetricsTree_Cohorts_Utxo_All_Realized_Loss: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.base: CentsUsdPattern2 = CentsUsdPattern2(client, 'realized_loss') + self.cumulative: CentsUsdPattern2 = CentsUsdPattern2(client, 'realized_loss_cumulative') + self.sum: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, 'realized_loss_sum') + self.negative: MetricPattern1[Dollars] = MetricPattern1(client, 'neg_realized_loss') + self.rel_to_rcap: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'realized_loss_rel_to_rcap') + self.value_created: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, 'loss_value_created') + self.value_destroyed: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, 'loss_value_destroyed') + self.capitulation_flow: MetricPattern1[Dollars] = MetricPattern1(client, 'capitulation_flow') + +class MetricsTree_Cohorts_Utxo_All_Realized_Price_StdDev_All: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.sd: MetricPattern1[StoredF32] = MetricPattern1(client, 'realized_price_ratio_sd') + self.zscore: MetricPattern1[StoredF32] = MetricPattern1(client, 'realized_price_ratio_zscore') + self._0sd: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'realized_price_0sd') + self.p0_5sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + self.p1sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + self.p1_5sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + self.p2sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + self.p2_5sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + self.p3sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + self.m0_5sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + self.m1sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + self.m1_5sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + self.m2sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + self.m2_5sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + self.m3sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + +class MetricsTree_Cohorts_Utxo_All_Realized_Price_StdDev_4y: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.sd: MetricPattern1[StoredF32] = MetricPattern1(client, 'realized_price_ratio_sd_4y') + self.zscore: MetricPattern1[StoredF32] = MetricPattern1(client, 'realized_price_ratio_zscore_4y') + self._0sd: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'realized_price_0sd_4y') + self.p0_5sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + self.p1sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + self.p1_5sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + self.p2sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + self.p2_5sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + self.p3sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + self.m0_5sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + self.m1sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + self.m1_5sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + self.m2sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + self.m2_5sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + self.m3sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + +class MetricsTree_Cohorts_Utxo_All_Realized_Price_StdDev_2y: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.sd: MetricPattern1[StoredF32] = MetricPattern1(client, 'realized_price_ratio_sd_2y') + self.zscore: MetricPattern1[StoredF32] = MetricPattern1(client, 'realized_price_ratio_zscore_2y') + self._0sd: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'realized_price_0sd_2y') + self.p0_5sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + self.p1sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + self.p1_5sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + self.p2sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + self.p2_5sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + self.p3sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + self.m0_5sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + self.m1sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + self.m1_5sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + self.m2sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + self.m2_5sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + self.m3sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + +class MetricsTree_Cohorts_Utxo_All_Realized_Price_StdDev_1y: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.sd: MetricPattern1[StoredF32] = MetricPattern1(client, 'realized_price_ratio_sd_1y') + self.zscore: MetricPattern1[StoredF32] = MetricPattern1(client, 'realized_price_ratio_zscore_1y') + self._0sd: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'realized_price_0sd_1y') + self.p0_5sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + self.p1sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + self.p1_5sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + self.p2sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + self.p2_5sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + self.p3sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + self.m0_5sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + self.m1sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + self.m1_5sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + self.m2sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + self.m2_5sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + self.m3sd: PriceRatioPattern = PriceRatioPattern(client, 'realized_price') + +class MetricsTree_Cohorts_Utxo_All_Realized_Price_StdDev: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.all: MetricsTree_Cohorts_Utxo_All_Realized_Price_StdDev_All = MetricsTree_Cohorts_Utxo_All_Realized_Price_StdDev_All(client) + self._4y: MetricsTree_Cohorts_Utxo_All_Realized_Price_StdDev_4y = MetricsTree_Cohorts_Utxo_All_Realized_Price_StdDev_4y(client) + self._2y: MetricsTree_Cohorts_Utxo_All_Realized_Price_StdDev_2y = MetricsTree_Cohorts_Utxo_All_Realized_Price_StdDev_2y(client) + self._1y: MetricsTree_Cohorts_Utxo_All_Realized_Price_StdDev_1y = MetricsTree_Cohorts_Utxo_All_Realized_Price_StdDev_1y(client) + +class MetricsTree_Cohorts_Utxo_All_Realized_Price: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.usd: MetricPattern1[Dollars] = MetricPattern1(client, 'realized_price') + self.cents: MetricPattern1[Cents] = MetricPattern1(client, 'realized_price_cents') + self.sats: MetricPattern1[SatsFract] = MetricPattern1(client, 'realized_price_sats') + self.bps: MetricPattern1[BasisPoints32] = MetricPattern1(client, 'realized_price_ratio_bps') + self.ratio: MetricPattern1[StoredF32] = MetricPattern1(client, 'realized_price_ratio') + self.percentiles: Pct1Pct2Pct5Pct95Pct98Pct99Pattern = Pct1Pct2Pct5Pct95Pct98Pct99Pattern(client, 'realized_price') + self.sma: _1m1w1y2y4yAllPattern = _1m1w1y2y4yAllPattern(client, 'realized_price_ratio_sma') + self.std_dev: MetricsTree_Cohorts_Utxo_All_Realized_Price_StdDev = MetricsTree_Cohorts_Utxo_All_Realized_Price_StdDev(client) + +class MetricsTree_Cohorts_Utxo_All_Realized_Sopr_Adjusted: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.ratio: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, 'asopr') + self.value_created: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, 'adj_value_created') + self.value_destroyed: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, 'adj_value_destroyed') + +class MetricsTree_Cohorts_Utxo_All_Realized_Sopr: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.value_created: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, 'value_created') + self.value_destroyed: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, 'value_destroyed') + self.ratio: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, 'sopr') + self.adjusted: MetricsTree_Cohorts_Utxo_All_Realized_Sopr_Adjusted = MetricsTree_Cohorts_Utxo_All_Realized_Sopr_Adjusted(client) + +class MetricsTree_Cohorts_Utxo_All_Realized_Investor: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.price: BpsCentsPercentilesRatioSatsUsdPattern = BpsCentsPercentilesRatioSatsUsdPattern(client, 'investor_price') + self.lower_price_band: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'lower_price_band') + self.upper_price_band: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'upper_price_band') + class MetricsTree_Cohorts_Utxo_All_Realized: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): self.cap: CentsDeltaRelUsdPattern = CentsDeltaRelUsdPattern(client, 'realized_cap') - self.profit: BaseCumulativeDistributionRelSumValuePattern = BaseCumulativeDistributionRelSumValuePattern(client, '') - self.loss: BaseCapitulationCumulativeNegativeRelSumValuePattern = BaseCapitulationCumulativeNegativeRelSumValuePattern(client, '') - self.price: BpsCentsPercentilesRatioSatsSmaStdUsdPattern = BpsCentsPercentilesRatioSatsSmaStdUsdPattern(client, 'realized_price') + self.profit: MetricsTree_Cohorts_Utxo_All_Realized_Profit = MetricsTree_Cohorts_Utxo_All_Realized_Profit(client) + self.loss: MetricsTree_Cohorts_Utxo_All_Realized_Loss = MetricsTree_Cohorts_Utxo_All_Realized_Loss(client) + self.price: MetricsTree_Cohorts_Utxo_All_Realized_Price = MetricsTree_Cohorts_Utxo_All_Realized_Price(client) self.mvrv: MetricPattern1[StoredF32] = MetricPattern1(client, 'mvrv') - self.sopr: AdjustedRatioValuePattern = AdjustedRatioValuePattern(client, '') + self.sopr: MetricsTree_Cohorts_Utxo_All_Realized_Sopr = MetricsTree_Cohorts_Utxo_All_Realized_Sopr(client) self.net_pnl: BaseChangeCumulativeDeltaRelSumPattern = BaseChangeCumulativeDeltaRelSumPattern(client, 'net') self.gross_pnl: BaseCumulativeSumPattern3 = BaseCumulativeSumPattern3(client, 'realized_gross_pnl') self.sell_side_risk_ratio: _1m1w1y24hPattern6 = _1m1w1y24hPattern6(client, 'sell_side_risk_ratio') self.peak_regret: BaseCumulativeRelPattern = BaseCumulativeRelPattern(client, 'realized_peak_regret') - self.investor: LowerPriceUpperPattern = LowerPriceUpperPattern(client, '') + self.investor: MetricsTree_Cohorts_Utxo_All_Realized_Investor = MetricsTree_Cohorts_Utxo_All_Realized_Investor(client) self.profit_to_loss_ratio: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, 'realized_profit_to_loss_ratio') +class MetricsTree_Cohorts_Utxo_All_CostBasis: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.min: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'cost_basis_min') + self.max: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'cost_basis_max') + self.percentiles: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern = Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern(client, 'cost_basis') + self.invested_capital: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern = Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern(client, 'invested_capital') + self.supply_density: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'supply_density') + class MetricsTree_Cohorts_Utxo_All_Unrealized_Profit: """Metrics tree node.""" @@ -4821,6 +4992,14 @@ class MetricsTree_Cohorts_Utxo_All_Unrealized_NetPnl: self.cents: MetricPattern1[CentsSigned] = MetricPattern1(client, 'net_unrealized_pnl_cents') self.rel_to_own_gross: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'net_unrealized_pnl_rel_to_own_gross_pnl') +class MetricsTree_Cohorts_Utxo_All_Unrealized_Sentiment: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.pain_index: CentsUsdPattern2 = CentsUsdPattern2(client, 'pain_index') + self.greed_index: CentsUsdPattern2 = CentsUsdPattern2(client, 'greed_index') + self.net: CentsUsdPattern = CentsUsdPattern(client, 'net_sentiment') + class MetricsTree_Cohorts_Utxo_All_Unrealized: """Metrics tree node.""" @@ -4831,7 +5010,7 @@ class MetricsTree_Cohorts_Utxo_All_Unrealized: self.net_pnl: MetricsTree_Cohorts_Utxo_All_Unrealized_NetPnl = MetricsTree_Cohorts_Utxo_All_Unrealized_NetPnl(client) self.gross_pnl: CentsUsdPattern2 = CentsUsdPattern2(client, 'unrealized_gross_pnl') self.invested_capital: InPattern = InPattern(client, 'invested_capital_in') - self.sentiment: GreedNetPainPattern = GreedNetPainPattern(client, '') + self.sentiment: MetricsTree_Cohorts_Utxo_All_Unrealized_Sentiment = MetricsTree_Cohorts_Utxo_All_Unrealized_Sentiment(client) class MetricsTree_Cohorts_Utxo_All: """Metrics tree node.""" @@ -4839,38 +5018,365 @@ class MetricsTree_Cohorts_Utxo_All: def __init__(self, client: BrkClientBase, base_path: str = ''): self.supply: MetricsTree_Cohorts_Utxo_All_Supply = MetricsTree_Cohorts_Utxo_All_Supply(client) self.outputs: UnspentPattern = UnspentPattern(client, 'utxo_count') - self.activity: CoindaysCoinyearsDormancySentPattern = CoindaysCoinyearsDormancySentPattern(client, '') + self.activity: MetricsTree_Cohorts_Utxo_All_Activity = MetricsTree_Cohorts_Utxo_All_Activity(client) self.realized: MetricsTree_Cohorts_Utxo_All_Realized = MetricsTree_Cohorts_Utxo_All_Realized(client) - self.cost_basis: InvestedMaxMinPercentilesSupplyPattern = InvestedMaxMinPercentilesSupplyPattern(client, '') + self.cost_basis: MetricsTree_Cohorts_Utxo_All_CostBasis = MetricsTree_Cohorts_Utxo_All_CostBasis(client) self.unrealized: MetricsTree_Cohorts_Utxo_All_Unrealized = MetricsTree_Cohorts_Utxo_All_Unrealized(client) +class MetricsTree_Cohorts_Utxo_Sth_Activity: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.sent: BaseCumulativeInSumPattern = BaseCumulativeInSumPattern(client, 'sth_sent') + self.coindays_destroyed: BaseCumulativeSumPattern[StoredF64] = BaseCumulativeSumPattern(client, 'sth_coindays_destroyed') + self.coinyears_destroyed: MetricPattern1[StoredF64] = MetricPattern1(client, 'sth_coinyears_destroyed') + self.dormancy: MetricPattern1[StoredF32] = MetricPattern1(client, 'sth_dormancy') + +class MetricsTree_Cohorts_Utxo_Sth_Realized_Profit: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.base: CentsUsdPattern2 = CentsUsdPattern2(client, 'sth_realized_profit') + self.cumulative: CentsUsdPattern2 = CentsUsdPattern2(client, 'sth_realized_profit_cumulative') + self.sum: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, 'sth_realized_profit_sum') + self.rel_to_rcap: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'sth_realized_profit_rel_to_rcap') + self.value_created: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, 'sth_profit_value_created') + self.value_destroyed: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, 'sth_profit_value_destroyed') + self.distribution_flow: MetricPattern1[Dollars] = MetricPattern1(client, 'sth_distribution_flow') + +class MetricsTree_Cohorts_Utxo_Sth_Realized_Loss: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.base: CentsUsdPattern2 = CentsUsdPattern2(client, 'sth_realized_loss') + self.cumulative: CentsUsdPattern2 = CentsUsdPattern2(client, 'sth_realized_loss_cumulative') + self.sum: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, 'sth_realized_loss_sum') + self.negative: MetricPattern1[Dollars] = MetricPattern1(client, 'sth_neg_realized_loss') + self.rel_to_rcap: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'sth_realized_loss_rel_to_rcap') + self.value_created: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, 'sth_loss_value_created') + self.value_destroyed: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, 'sth_loss_value_destroyed') + self.capitulation_flow: MetricPattern1[Dollars] = MetricPattern1(client, 'sth_capitulation_flow') + +class MetricsTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_All: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.sd: MetricPattern1[StoredF32] = MetricPattern1(client, 'sth_realized_price_ratio_sd') + self.zscore: MetricPattern1[StoredF32] = MetricPattern1(client, 'sth_realized_price_ratio_zscore') + self._0sd: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'sth_realized_price_0sd') + self.p0_5sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + self.p1sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + self.p1_5sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + self.p2sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + self.p2_5sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + self.p3sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + self.m0_5sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + self.m1sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + self.m1_5sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + self.m2sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + self.m2_5sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + self.m3sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + +class MetricsTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_4y: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.sd: MetricPattern1[StoredF32] = MetricPattern1(client, 'sth_realized_price_ratio_sd_4y') + self.zscore: MetricPattern1[StoredF32] = MetricPattern1(client, 'sth_realized_price_ratio_zscore_4y') + self._0sd: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'sth_realized_price_0sd_4y') + self.p0_5sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + self.p1sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + self.p1_5sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + self.p2sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + self.p2_5sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + self.p3sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + self.m0_5sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + self.m1sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + self.m1_5sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + self.m2sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + self.m2_5sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + self.m3sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + +class MetricsTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_2y: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.sd: MetricPattern1[StoredF32] = MetricPattern1(client, 'sth_realized_price_ratio_sd_2y') + self.zscore: MetricPattern1[StoredF32] = MetricPattern1(client, 'sth_realized_price_ratio_zscore_2y') + self._0sd: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'sth_realized_price_0sd_2y') + self.p0_5sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + self.p1sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + self.p1_5sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + self.p2sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + self.p2_5sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + self.p3sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + self.m0_5sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + self.m1sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + self.m1_5sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + self.m2sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + self.m2_5sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + self.m3sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + +class MetricsTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_1y: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.sd: MetricPattern1[StoredF32] = MetricPattern1(client, 'sth_realized_price_ratio_sd_1y') + self.zscore: MetricPattern1[StoredF32] = MetricPattern1(client, 'sth_realized_price_ratio_zscore_1y') + self._0sd: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'sth_realized_price_0sd_1y') + self.p0_5sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + self.p1sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + self.p1_5sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + self.p2sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + self.p2_5sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + self.p3sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + self.m0_5sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + self.m1sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + self.m1_5sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + self.m2sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + self.m2_5sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + self.m3sd: PriceRatioPattern = PriceRatioPattern(client, 'sth_realized_price') + +class MetricsTree_Cohorts_Utxo_Sth_Realized_Price_StdDev: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.all: MetricsTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_All = MetricsTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_All(client) + self._4y: MetricsTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_4y = MetricsTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_4y(client) + self._2y: MetricsTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_2y = MetricsTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_2y(client) + self._1y: MetricsTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_1y = MetricsTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_1y(client) + +class MetricsTree_Cohorts_Utxo_Sth_Realized_Price: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.usd: MetricPattern1[Dollars] = MetricPattern1(client, 'sth_realized_price') + self.cents: MetricPattern1[Cents] = MetricPattern1(client, 'sth_realized_price_cents') + self.sats: MetricPattern1[SatsFract] = MetricPattern1(client, 'sth_realized_price_sats') + self.bps: MetricPattern1[BasisPoints32] = MetricPattern1(client, 'sth_realized_price_ratio_bps') + self.ratio: MetricPattern1[StoredF32] = MetricPattern1(client, 'sth_realized_price_ratio') + self.percentiles: Pct1Pct2Pct5Pct95Pct98Pct99Pattern = Pct1Pct2Pct5Pct95Pct98Pct99Pattern(client, 'sth_realized_price') + self.sma: _1m1w1y2y4yAllPattern = _1m1w1y2y4yAllPattern(client, 'sth_realized_price_ratio_sma') + self.std_dev: MetricsTree_Cohorts_Utxo_Sth_Realized_Price_StdDev = MetricsTree_Cohorts_Utxo_Sth_Realized_Price_StdDev(client) + +class MetricsTree_Cohorts_Utxo_Sth_Realized_Sopr_Adjusted: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.ratio: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, 'sth_asopr') + self.value_created: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, 'sth_adj_value_created') + self.value_destroyed: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, 'sth_adj_value_destroyed') + +class MetricsTree_Cohorts_Utxo_Sth_Realized_Sopr: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.value_created: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, 'sth_value_created') + self.value_destroyed: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, 'sth_value_destroyed') + self.ratio: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, 'sth_sopr') + self.adjusted: MetricsTree_Cohorts_Utxo_Sth_Realized_Sopr_Adjusted = MetricsTree_Cohorts_Utxo_Sth_Realized_Sopr_Adjusted(client) + +class MetricsTree_Cohorts_Utxo_Sth_Realized_Investor: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.price: BpsCentsPercentilesRatioSatsUsdPattern = BpsCentsPercentilesRatioSatsUsdPattern(client, 'sth_investor_price') + self.lower_price_band: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'sth_lower_price_band') + self.upper_price_band: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'sth_upper_price_band') + class MetricsTree_Cohorts_Utxo_Sth_Realized: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): self.cap: CentsDeltaRelUsdPattern = CentsDeltaRelUsdPattern(client, 'sth_realized_cap') - self.profit: BaseCumulativeDistributionRelSumValuePattern = BaseCumulativeDistributionRelSumValuePattern(client, 'sth') - self.loss: BaseCapitulationCumulativeNegativeRelSumValuePattern = BaseCapitulationCumulativeNegativeRelSumValuePattern(client, 'sth') - self.price: BpsCentsPercentilesRatioSatsSmaStdUsdPattern = BpsCentsPercentilesRatioSatsSmaStdUsdPattern(client, 'sth_realized_price') + self.profit: MetricsTree_Cohorts_Utxo_Sth_Realized_Profit = MetricsTree_Cohorts_Utxo_Sth_Realized_Profit(client) + self.loss: MetricsTree_Cohorts_Utxo_Sth_Realized_Loss = MetricsTree_Cohorts_Utxo_Sth_Realized_Loss(client) + self.price: MetricsTree_Cohorts_Utxo_Sth_Realized_Price = MetricsTree_Cohorts_Utxo_Sth_Realized_Price(client) self.mvrv: MetricPattern1[StoredF32] = MetricPattern1(client, 'sth_mvrv') - self.sopr: AdjustedRatioValuePattern = AdjustedRatioValuePattern(client, 'sth') + self.sopr: MetricsTree_Cohorts_Utxo_Sth_Realized_Sopr = MetricsTree_Cohorts_Utxo_Sth_Realized_Sopr(client) self.net_pnl: BaseChangeCumulativeDeltaRelSumPattern = BaseChangeCumulativeDeltaRelSumPattern(client, 'sth_net') self.gross_pnl: BaseCumulativeSumPattern3 = BaseCumulativeSumPattern3(client, 'sth_realized_gross_pnl') self.sell_side_risk_ratio: _1m1w1y24hPattern6 = _1m1w1y24hPattern6(client, 'sth_sell_side_risk_ratio') self.peak_regret: BaseCumulativeRelPattern = BaseCumulativeRelPattern(client, 'sth_realized_peak_regret') - self.investor: LowerPriceUpperPattern = LowerPriceUpperPattern(client, 'sth') + self.investor: MetricsTree_Cohorts_Utxo_Sth_Realized_Investor = MetricsTree_Cohorts_Utxo_Sth_Realized_Investor(client) self.profit_to_loss_ratio: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, 'sth_realized_profit_to_loss_ratio') +class MetricsTree_Cohorts_Utxo_Sth_CostBasis: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.min: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'sth_cost_basis_min') + self.max: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'sth_cost_basis_max') + self.percentiles: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern = Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern(client, 'sth_cost_basis') + self.invested_capital: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern = Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern(client, 'sth_invested_capital') + self.supply_density: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'sth_supply_density') + +class MetricsTree_Cohorts_Utxo_Sth_Unrealized_Sentiment: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.pain_index: CentsUsdPattern2 = CentsUsdPattern2(client, 'sth_pain_index') + self.greed_index: CentsUsdPattern2 = CentsUsdPattern2(client, 'sth_greed_index') + self.net: CentsUsdPattern = CentsUsdPattern(client, 'sth_net_sentiment') + +class MetricsTree_Cohorts_Utxo_Sth_Unrealized: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.nupl: BpsRatioPattern = BpsRatioPattern(client, 'sth_nupl') + self.profit: BaseCumulativeRelSumPattern2 = BaseCumulativeRelSumPattern2(client, 'sth_unrealized_profit') + self.loss: BaseCumulativeNegativeRelSumPattern2 = BaseCumulativeNegativeRelSumPattern2(client, 'sth') + self.net_pnl: CentsRelUsdPattern2 = CentsRelUsdPattern2(client, 'sth_net_unrealized_pnl') + self.gross_pnl: CentsUsdPattern2 = CentsUsdPattern2(client, 'sth_unrealized_gross_pnl') + self.invested_capital: InPattern = InPattern(client, 'sth_invested_capital_in') + self.sentiment: MetricsTree_Cohorts_Utxo_Sth_Unrealized_Sentiment = MetricsTree_Cohorts_Utxo_Sth_Unrealized_Sentiment(client) + class MetricsTree_Cohorts_Utxo_Sth: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): self.supply: DeltaHalfInRelTotalPattern2 = DeltaHalfInRelTotalPattern2(client, 'sth_supply') self.outputs: UnspentPattern = UnspentPattern(client, 'sth_utxo_count') - self.activity: CoindaysCoinyearsDormancySentPattern = CoindaysCoinyearsDormancySentPattern(client, 'sth') + self.activity: MetricsTree_Cohorts_Utxo_Sth_Activity = MetricsTree_Cohorts_Utxo_Sth_Activity(client) self.realized: MetricsTree_Cohorts_Utxo_Sth_Realized = MetricsTree_Cohorts_Utxo_Sth_Realized(client) - self.cost_basis: InvestedMaxMinPercentilesSupplyPattern = InvestedMaxMinPercentilesSupplyPattern(client, 'sth') - self.unrealized: GrossInvestedLossNetNuplProfitSentimentPattern2 = GrossInvestedLossNetNuplProfitSentimentPattern2(client, 'sth') + self.cost_basis: MetricsTree_Cohorts_Utxo_Sth_CostBasis = MetricsTree_Cohorts_Utxo_Sth_CostBasis(client) + self.unrealized: MetricsTree_Cohorts_Utxo_Sth_Unrealized = MetricsTree_Cohorts_Utxo_Sth_Unrealized(client) + +class MetricsTree_Cohorts_Utxo_Lth_Activity: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.sent: BaseCumulativeInSumPattern = BaseCumulativeInSumPattern(client, 'lth_sent') + self.coindays_destroyed: BaseCumulativeSumPattern[StoredF64] = BaseCumulativeSumPattern(client, 'lth_coindays_destroyed') + self.coinyears_destroyed: MetricPattern1[StoredF64] = MetricPattern1(client, 'lth_coinyears_destroyed') + self.dormancy: MetricPattern1[StoredF32] = MetricPattern1(client, 'lth_dormancy') + +class MetricsTree_Cohorts_Utxo_Lth_Realized_Profit: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.base: CentsUsdPattern2 = CentsUsdPattern2(client, 'lth_realized_profit') + self.cumulative: CentsUsdPattern2 = CentsUsdPattern2(client, 'lth_realized_profit_cumulative') + self.sum: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, 'lth_realized_profit_sum') + self.rel_to_rcap: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'lth_realized_profit_rel_to_rcap') + self.value_created: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, 'lth_profit_value_created') + self.value_destroyed: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, 'lth_profit_value_destroyed') + self.distribution_flow: MetricPattern1[Dollars] = MetricPattern1(client, 'lth_distribution_flow') + +class MetricsTree_Cohorts_Utxo_Lth_Realized_Loss: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.base: CentsUsdPattern2 = CentsUsdPattern2(client, 'lth_realized_loss') + self.cumulative: CentsUsdPattern2 = CentsUsdPattern2(client, 'lth_realized_loss_cumulative') + self.sum: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, 'lth_realized_loss_sum') + self.negative: MetricPattern1[Dollars] = MetricPattern1(client, 'lth_neg_realized_loss') + self.rel_to_rcap: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'lth_realized_loss_rel_to_rcap') + self.value_created: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, 'lth_loss_value_created') + self.value_destroyed: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, 'lth_loss_value_destroyed') + self.capitulation_flow: MetricPattern1[Dollars] = MetricPattern1(client, 'lth_capitulation_flow') + +class MetricsTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_All: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.sd: MetricPattern1[StoredF32] = MetricPattern1(client, 'lth_realized_price_ratio_sd') + self.zscore: MetricPattern1[StoredF32] = MetricPattern1(client, 'lth_realized_price_ratio_zscore') + self._0sd: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'lth_realized_price_0sd') + self.p0_5sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + self.p1sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + self.p1_5sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + self.p2sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + self.p2_5sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + self.p3sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + self.m0_5sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + self.m1sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + self.m1_5sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + self.m2sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + self.m2_5sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + self.m3sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + +class MetricsTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_4y: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.sd: MetricPattern1[StoredF32] = MetricPattern1(client, 'lth_realized_price_ratio_sd_4y') + self.zscore: MetricPattern1[StoredF32] = MetricPattern1(client, 'lth_realized_price_ratio_zscore_4y') + self._0sd: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'lth_realized_price_0sd_4y') + self.p0_5sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + self.p1sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + self.p1_5sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + self.p2sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + self.p2_5sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + self.p3sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + self.m0_5sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + self.m1sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + self.m1_5sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + self.m2sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + self.m2_5sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + self.m3sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + +class MetricsTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_2y: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.sd: MetricPattern1[StoredF32] = MetricPattern1(client, 'lth_realized_price_ratio_sd_2y') + self.zscore: MetricPattern1[StoredF32] = MetricPattern1(client, 'lth_realized_price_ratio_zscore_2y') + self._0sd: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'lth_realized_price_0sd_2y') + self.p0_5sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + self.p1sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + self.p1_5sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + self.p2sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + self.p2_5sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + self.p3sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + self.m0_5sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + self.m1sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + self.m1_5sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + self.m2sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + self.m2_5sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + self.m3sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + +class MetricsTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_1y: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.sd: MetricPattern1[StoredF32] = MetricPattern1(client, 'lth_realized_price_ratio_sd_1y') + self.zscore: MetricPattern1[StoredF32] = MetricPattern1(client, 'lth_realized_price_ratio_zscore_1y') + self._0sd: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'lth_realized_price_0sd_1y') + self.p0_5sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + self.p1sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + self.p1_5sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + self.p2sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + self.p2_5sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + self.p3sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + self.m0_5sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + self.m1sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + self.m1_5sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + self.m2sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + self.m2_5sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + self.m3sd: PriceRatioPattern = PriceRatioPattern(client, 'lth_realized_price') + +class MetricsTree_Cohorts_Utxo_Lth_Realized_Price_StdDev: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.all: MetricsTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_All = MetricsTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_All(client) + self._4y: MetricsTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_4y = MetricsTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_4y(client) + self._2y: MetricsTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_2y = MetricsTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_2y(client) + self._1y: MetricsTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_1y = MetricsTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_1y(client) + +class MetricsTree_Cohorts_Utxo_Lth_Realized_Price: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.usd: MetricPattern1[Dollars] = MetricPattern1(client, 'lth_realized_price') + self.cents: MetricPattern1[Cents] = MetricPattern1(client, 'lth_realized_price_cents') + self.sats: MetricPattern1[SatsFract] = MetricPattern1(client, 'lth_realized_price_sats') + self.bps: MetricPattern1[BasisPoints32] = MetricPattern1(client, 'lth_realized_price_ratio_bps') + self.ratio: MetricPattern1[StoredF32] = MetricPattern1(client, 'lth_realized_price_ratio') + self.percentiles: Pct1Pct2Pct5Pct95Pct98Pct99Pattern = Pct1Pct2Pct5Pct95Pct98Pct99Pattern(client, 'lth_realized_price') + self.sma: _1m1w1y2y4yAllPattern = _1m1w1y2y4yAllPattern(client, 'lth_realized_price_ratio_sma') + self.std_dev: MetricsTree_Cohorts_Utxo_Lth_Realized_Price_StdDev = MetricsTree_Cohorts_Utxo_Lth_Realized_Price_StdDev(client) class MetricsTree_Cohorts_Utxo_Lth_Realized_Sopr: """Metrics tree node.""" @@ -4880,33 +5386,71 @@ class MetricsTree_Cohorts_Utxo_Lth_Realized_Sopr: self.value_destroyed: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, 'lth_value_destroyed') self.ratio: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, 'lth_sopr') +class MetricsTree_Cohorts_Utxo_Lth_Realized_Investor: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.price: BpsCentsPercentilesRatioSatsUsdPattern = BpsCentsPercentilesRatioSatsUsdPattern(client, 'lth_investor_price') + self.lower_price_band: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'lth_lower_price_band') + self.upper_price_band: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'lth_upper_price_band') + class MetricsTree_Cohorts_Utxo_Lth_Realized: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): self.cap: CentsDeltaRelUsdPattern = CentsDeltaRelUsdPattern(client, 'lth_realized_cap') - self.profit: BaseCumulativeDistributionRelSumValuePattern = BaseCumulativeDistributionRelSumValuePattern(client, 'lth') - self.loss: BaseCapitulationCumulativeNegativeRelSumValuePattern = BaseCapitulationCumulativeNegativeRelSumValuePattern(client, 'lth') - self.price: BpsCentsPercentilesRatioSatsSmaStdUsdPattern = BpsCentsPercentilesRatioSatsSmaStdUsdPattern(client, 'lth_realized_price') + self.profit: MetricsTree_Cohorts_Utxo_Lth_Realized_Profit = MetricsTree_Cohorts_Utxo_Lth_Realized_Profit(client) + self.loss: MetricsTree_Cohorts_Utxo_Lth_Realized_Loss = MetricsTree_Cohorts_Utxo_Lth_Realized_Loss(client) + self.price: MetricsTree_Cohorts_Utxo_Lth_Realized_Price = MetricsTree_Cohorts_Utxo_Lth_Realized_Price(client) self.mvrv: MetricPattern1[StoredF32] = MetricPattern1(client, 'lth_mvrv') self.sopr: MetricsTree_Cohorts_Utxo_Lth_Realized_Sopr = MetricsTree_Cohorts_Utxo_Lth_Realized_Sopr(client) self.net_pnl: BaseChangeCumulativeDeltaRelSumPattern = BaseChangeCumulativeDeltaRelSumPattern(client, 'lth_net') self.gross_pnl: BaseCumulativeSumPattern3 = BaseCumulativeSumPattern3(client, 'lth_realized_gross_pnl') self.sell_side_risk_ratio: _1m1w1y24hPattern6 = _1m1w1y24hPattern6(client, 'lth_sell_side_risk_ratio') self.peak_regret: BaseCumulativeRelPattern = BaseCumulativeRelPattern(client, 'lth_realized_peak_regret') - self.investor: LowerPriceUpperPattern = LowerPriceUpperPattern(client, 'lth') + self.investor: MetricsTree_Cohorts_Utxo_Lth_Realized_Investor = MetricsTree_Cohorts_Utxo_Lth_Realized_Investor(client) self.profit_to_loss_ratio: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, 'lth_realized_profit_to_loss_ratio') +class MetricsTree_Cohorts_Utxo_Lth_CostBasis: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.min: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'lth_cost_basis_min') + self.max: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'lth_cost_basis_max') + self.percentiles: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern = Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern(client, 'lth_cost_basis') + self.invested_capital: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern = Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern(client, 'lth_invested_capital') + self.supply_density: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'lth_supply_density') + +class MetricsTree_Cohorts_Utxo_Lth_Unrealized_Sentiment: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.pain_index: CentsUsdPattern2 = CentsUsdPattern2(client, 'lth_pain_index') + self.greed_index: CentsUsdPattern2 = CentsUsdPattern2(client, 'lth_greed_index') + self.net: CentsUsdPattern = CentsUsdPattern(client, 'lth_net_sentiment') + +class MetricsTree_Cohorts_Utxo_Lth_Unrealized: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.nupl: BpsRatioPattern = BpsRatioPattern(client, 'lth_nupl') + self.profit: BaseCumulativeRelSumPattern2 = BaseCumulativeRelSumPattern2(client, 'lth_unrealized_profit') + self.loss: BaseCumulativeNegativeRelSumPattern2 = BaseCumulativeNegativeRelSumPattern2(client, 'lth') + self.net_pnl: CentsRelUsdPattern2 = CentsRelUsdPattern2(client, 'lth_net_unrealized_pnl') + self.gross_pnl: CentsUsdPattern2 = CentsUsdPattern2(client, 'lth_unrealized_gross_pnl') + self.invested_capital: InPattern = InPattern(client, 'lth_invested_capital_in') + self.sentiment: MetricsTree_Cohorts_Utxo_Lth_Unrealized_Sentiment = MetricsTree_Cohorts_Utxo_Lth_Unrealized_Sentiment(client) + class MetricsTree_Cohorts_Utxo_Lth: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): self.supply: DeltaHalfInRelTotalPattern2 = DeltaHalfInRelTotalPattern2(client, 'lth_supply') self.outputs: UnspentPattern = UnspentPattern(client, 'lth_utxo_count') - self.activity: CoindaysCoinyearsDormancySentPattern = CoindaysCoinyearsDormancySentPattern(client, 'lth') + self.activity: MetricsTree_Cohorts_Utxo_Lth_Activity = MetricsTree_Cohorts_Utxo_Lth_Activity(client) self.realized: MetricsTree_Cohorts_Utxo_Lth_Realized = MetricsTree_Cohorts_Utxo_Lth_Realized(client) - self.cost_basis: InvestedMaxMinPercentilesSupplyPattern = InvestedMaxMinPercentilesSupplyPattern(client, 'lth') - self.unrealized: GrossInvestedLossNetNuplProfitSentimentPattern2 = GrossInvestedLossNetNuplProfitSentimentPattern2(client, 'lth') + self.cost_basis: MetricsTree_Cohorts_Utxo_Lth_CostBasis = MetricsTree_Cohorts_Utxo_Lth_CostBasis(client) + self.unrealized: MetricsTree_Cohorts_Utxo_Lth_Unrealized = MetricsTree_Cohorts_Utxo_Lth_Unrealized(client) class MetricsTree_Cohorts_Utxo_AgeRange: """Metrics tree node."""