diff --git a/Cargo.lock b/Cargo.lock index f2136c3b0..0ed97a284 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1954,9 +1954,9 @@ dependencies = [ [[package]] name = "importmap" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d13d6361899f14d58146b6214c07e63cda8270c3ef3b8c30626f8e20e6766eb" +checksum = "a45c4c5e8b4d0a6aed90f3a14125bd3af3bca73d49d44e8f8b764311903b5213" dependencies = [ "rapidhash", "serde", @@ -2684,7 +2684,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ "rand_chacha 0.9.0", - "rand_core 0.9.3", + "rand_core 0.9.4", ] [[package]] @@ -2704,7 +2704,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" dependencies = [ "ppv-lite86", - "rand_core 0.9.3", + "rand_core 0.9.4", ] [[package]] @@ -2718,9 +2718,9 @@ dependencies = [ [[package]] name = "rand_core" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +checksum = "4f1b3bc831f92381018fd9c6350b917c7b21f1eed35a65a51900e0e55a3d7afa" dependencies = [ "getrandom 0.3.4", ] @@ -2745,9 +2745,9 @@ dependencies = [ [[package]] name = "rawdb" -version = "0.5.8" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1eb09ba02f9467845fde4a1fadb317721025f2b836f22a5a7d3567c9e100875" +checksum = "eb8999fc8f80521c13091f98e1a24bde2448b29c0637f008dc470ed84d58f703" dependencies = [ "libc", "log", @@ -3689,9 +3689,9 @@ checksum = "8f54a172d0620933a27a4360d3db3e2ae0dd6cceae9730751a036bbf182c4b23" [[package]] name = "vecdb" -version = "0.5.8" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b02690e7c013257b959b482fac78e90f73764efa8a57551e1e67a06ad7ab4" +checksum = "1a31985bee527adda1601eab9c72de0a567be83a08e80e646b79afb77ab14970" dependencies = [ "ctrlc", "log", @@ -3710,9 +3710,9 @@ dependencies = [ [[package]] name = "vecdb_derive" -version = "0.5.8" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21339c58345d1a422c2574b1114b3cd862900a9196421dc7acf43aca48c288bb" +checksum = "61716cbeb322dcc9838cea11b533cea278f9592b2ef2ce520595849833cfee1c" dependencies = [ "quote", "syn", diff --git a/Cargo.toml b/Cargo.toml index 7bce93776..8a3efc534 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -79,7 +79,7 @@ serde_json = { version = "1.0.149", features = ["float_roundtrip", "preserve_ord smallvec = "1.15.1" tokio = { version = "1.49.0", features = ["rt-multi-thread"] } tracing = { version = "0.1", default-features = false, features = ["std"] } -vecdb = { version = "0.5.8", features = ["derive", "serde_json", "pco", "schemars"] } +vecdb = { version = "0.5.9", features = ["derive", "serde_json", "pco", "schemars"] } # vecdb = { path = "../anydb/crates/vecdb", features = ["derive", "serde_json", "pco", "schemars"] } [workspace.metadata.release] diff --git a/crates/brk_bindgen/src/analysis/names.rs b/crates/brk_bindgen/src/analysis/names.rs index 3ce7817dd..046430f14 100644 --- a/crates/brk_bindgen/src/analysis/names.rs +++ b/crates/brk_bindgen/src/analysis/names.rs @@ -458,4 +458,33 @@ mod tests { Some(&FieldNamePosition::Append("_cumulative".to_string())) ); } + + #[test] + fn test_analyze_pattern_level_no_base_field() { + // When there's no base field (like block_weight which has no block_weight metric), + // only suffixed metrics like block_weight_average, block_weight_sum, etc. + // Base should still be "block_weight" + let children = vec![ + ("average".to_string(), "block_weight_average".to_string()), + ("sum".to_string(), "block_weight_sum".to_string()), + ( + "cumulative".to_string(), + "block_weight_cumulative".to_string(), + ), + ("max".to_string(), "block_weight_max".to_string()), + ("min".to_string(), "block_weight_min".to_string()), + ]; + let analysis = analyze_pattern_level(&children); + + assert!(matches!(analysis.common, CommonDenominator::Prefix(_))); + assert_eq!(analysis.base, "block_weight"); + assert_eq!( + analysis.field_positions.get("average"), + Some(&FieldNamePosition::Append("_average".to_string())) + ); + assert_eq!( + analysis.field_positions.get("sum"), + Some(&FieldNamePosition::Append("_sum".to_string())) + ); + } } diff --git a/crates/brk_bindgen/src/analysis/tree.rs b/crates/brk_bindgen/src/analysis/tree.rs index d27dd13f6..e1937ce95 100644 --- a/crates/brk_bindgen/src/analysis/tree.rs +++ b/crates/brk_bindgen/src/analysis/tree.rs @@ -7,7 +7,7 @@ use std::collections::{BTreeMap, BTreeSet, HashMap}; use brk_types::{Index, TreeNode, extract_json_type}; -use crate::{IndexSetPattern, PatternField, analysis::names::analyze_pattern_level, child_type_name}; +use crate::{IndexSetPattern, PatternField, analysis::names::{analyze_pattern_level, CommonDenominator}, child_type_name}; /// Get the first leaf name from a tree node. pub fn get_first_leaf_name(node: &TreeNode) -> Option { @@ -124,16 +124,81 @@ fn collect_indexes_from_tree( } } +/// Result of analyzing a pattern instance's base. +#[derive(Debug, Clone)] +pub struct PatternBaseResult { + /// The computed base name for the pattern. + pub base: String, + /// Whether an outlier child was excluded to find the pattern. + /// If true, pattern factory should not be used. + pub has_outlier: bool, +} + +impl PatternBaseResult { + /// Returns true if an inline type should be generated instead of using a pattern factory. + /// + /// This is the case when: + /// - The child fields don't match a parameterizable pattern, OR + /// - An outlier was detected during pattern analysis + pub fn should_inline(&self, is_parameterizable: bool) -> bool { + !is_parameterizable || self.has_outlier + } +} + /// Get the metric base for a pattern instance by analyzing direct children. /// /// Uses field names and first leaf names from direct children to determine /// the common base via `analyze_pattern_level`. -pub fn get_pattern_instance_base(node: &TreeNode) -> String { +/// +/// If the initial analysis fails to find a common pattern, it tries excluding +/// each child one at a time to detect outliers (e.g., a mismatched "base" field +/// from indexer/computed tree merging). +/// +/// Returns both the base and whether an outlier was detected. +pub fn get_pattern_instance_base(node: &TreeNode) -> PatternBaseResult { let child_names = get_direct_children_for_analysis(node); if child_names.is_empty() { - return String::new(); + return PatternBaseResult { + base: String::new(), + has_outlier: false, + }; + } + + let analysis = analyze_pattern_level(&child_names); + + // If we found a common pattern, use it + if !matches!(analysis.common, CommonDenominator::None) { + return PatternBaseResult { + base: analysis.base, + has_outlier: false, + }; + } + + // If no common pattern found, try excluding each child one at a time + // to detect if there's a single outlier breaking the pattern. + if child_names.len() > 2 { + for i in 0..child_names.len() { + let filtered: Vec<_> = child_names + .iter() + .enumerate() + .filter(|(j, _)| *j != i) + .map(|(_, v)| v.clone()) + .collect(); + + let filtered_analysis = analyze_pattern_level(&filtered); + if !matches!(filtered_analysis.common, CommonDenominator::None) { + return PatternBaseResult { + base: filtered_analysis.base, + has_outlier: true, + }; + } + } + } + + PatternBaseResult { + base: analysis.base, + has_outlier: false, } - analyze_pattern_level(&child_names).base } /// Get (field_name, shortest_leaf_name) pairs for direct children of a branch node. @@ -217,3 +282,93 @@ pub fn get_fields_with_child_info( }) .collect() } + +#[cfg(test)] +mod tests { + use super::*; + use brk_types::{MetricLeaf, MetricLeafWithSchema, TreeNode}; + use std::collections::BTreeMap; + + fn make_leaf(name: &str) -> TreeNode { + let leaf = MetricLeaf { + name: name.to_string(), + kind: "TestType".to_string(), + indexes: BTreeSet::new(), + }; + TreeNode::Leaf(MetricLeafWithSchema::new(leaf, serde_json::json!({}))) + } + + fn make_branch(children: Vec<(&str, TreeNode)>) -> TreeNode { + let map: BTreeMap = children + .into_iter() + .map(|(k, v)| (k.to_string(), v)) + .collect(); + TreeNode::Branch(map) + } + + #[test] + fn test_get_pattern_instance_base_with_base_field() { + // Simulates vbytes tree: has base field with block_vbytes leaf + let tree = make_branch(vec![ + ("base", make_branch(vec![("dateindex", make_leaf("block_vbytes"))])), + ("average", make_branch(vec![("dateindex", make_leaf("block_vbytes_average"))])), + ("sum", make_branch(vec![("dateindex", make_leaf("block_vbytes_sum"))])), + ]); + + let result = get_pattern_instance_base(&tree); + assert_eq!(result.base, "block_vbytes"); + assert!(!result.has_outlier); + } + + #[test] + fn test_get_pattern_instance_base_without_base_field() { + // Simulates weight tree: NO base field, only suffixed metrics + let tree = make_branch(vec![ + ("average", make_branch(vec![("dateindex", make_leaf("block_weight_average"))])), + ("sum", make_branch(vec![("dateindex", make_leaf("block_weight_sum"))])), + ("cumulative", make_branch(vec![("dateindex", make_leaf("block_weight_cumulative"))])), + ("max", make_branch(vec![("dateindex", make_leaf("block_weight_max"))])), + ("min", make_branch(vec![("dateindex", make_leaf("block_weight_min"))])), + ]); + + let result = get_pattern_instance_base(&tree); + assert_eq!(result.base, "block_weight"); + assert!(!result.has_outlier); + } + + #[test] + fn test_get_pattern_instance_base_with_duplicate_base_field() { + // What if there's a "base" field that points to the same leaf as "average"? + // This could happen if the tree generation creates a base field that shares leaves with average + let tree = make_branch(vec![ + ("base", make_branch(vec![("dateindex", make_leaf("block_weight_average"))])), + ("average", make_branch(vec![("dateindex", make_leaf("block_weight_average"))])), + ("sum", make_branch(vec![("dateindex", make_leaf("block_weight_sum"))])), + ]); + + let result = get_pattern_instance_base(&tree); + // Common prefix among all children is "block_weight_" + assert_eq!(result.base, "block_weight"); + assert!(!result.has_outlier); + } + + #[test] + fn test_get_pattern_instance_base_with_mismatched_base_name() { + // Simulates the actual bug: indexed tree's "base" field has name "weight" + // but computed tree's derived metrics use "block_weight_*" prefix. + // After tree merge, we get a base field with mismatched naming. + let tree = make_branch(vec![ + ("base", make_leaf("weight")), // Outlier - doesn't match pattern + ("average", make_leaf("block_weight_average")), + ("sum", make_leaf("block_weight_sum")), + ("cumulative", make_leaf("block_weight_cumulative")), + ("max", make_leaf("block_weight_max")), + ("min", make_leaf("block_weight_min")), + ]); + + let result = get_pattern_instance_base(&tree); + // Should detect "weight" as outlier and find common prefix from others + assert_eq!(result.base, "block_weight"); + assert!(result.has_outlier); // Pattern factory should NOT be used + } +} diff --git a/crates/brk_bindgen/src/generate/tree.rs b/crates/brk_bindgen/src/generate/tree.rs index d310e2e7a..e57d896a7 100644 --- a/crates/brk_bindgen/src/generate/tree.rs +++ b/crates/brk_bindgen/src/generate/tree.rs @@ -4,16 +4,35 @@ use std::collections::{HashMap, HashSet}; use brk_types::TreeNode; -use crate::{ClientMetadata, PatternField, get_fields_with_child_info}; +use crate::{ + ClientMetadata, PatternBaseResult, PatternField, child_type_name, get_fields_with_child_info, + get_pattern_instance_base, +}; + +/// Pre-computed context for a single child node. +pub struct ChildContext<'a> { + /// The child's field name in the tree. + pub name: &'a str, + /// The child node. + pub node: &'a TreeNode, + /// The field info for this child. + pub field: PatternField, + /// Child fields if this is a branch (for pattern lookup). + pub child_fields: Option>, + /// Pattern analysis result. + pub base_result: PatternBaseResult, + /// Whether this is a leaf node. + pub is_leaf: bool, + /// Whether to use an inline type instead of a pattern factory (only meaningful for branches). + pub should_inline: bool, + /// The type name to use for inline branches. + pub inline_type_name: String, +} /// Context for generating a tree node, returned by `prepare_tree_node`. pub struct TreeNodeContext<'a> { - /// The children of the branch node. - pub children: &'a std::collections::BTreeMap, - /// Fields with optional child field info for generic pattern lookup. - pub fields_with_child_info: Vec<(PatternField, Option>)>, - /// Just the fields (for pattern lookup). - pub fields: Vec, + /// Pre-computed context for each child. + pub children: Vec>, } /// Prepare a tree node for generation. @@ -26,20 +45,22 @@ pub fn prepare_tree_node<'a>( metadata: &ClientMetadata, generated: &mut HashSet, ) -> Option> { - let TreeNode::Branch(children) = node else { + let TreeNode::Branch(branch_children) = node else { return None; }; - let fields_with_child_info = get_fields_with_child_info(children, name, pattern_lookup); + let fields_with_child_info = get_fields_with_child_info(branch_children, name, pattern_lookup); let fields: Vec = fields_with_child_info .iter() .map(|(f, _)| f.clone()) .collect(); - // Skip if this matches a parameterizable pattern + // Skip if this matches a parameterizable pattern AND has no outlier + let base_result = get_pattern_instance_base(node); if let Some(pattern_name) = pattern_lookup.get(&fields) && pattern_name != name && metadata.is_parameterizable(pattern_name) + && !base_result.has_outlier { return None; } @@ -50,9 +71,38 @@ pub fn prepare_tree_node<'a>( } generated.insert(name.to_string()); - Some(TreeNodeContext { - children, - fields_with_child_info, - fields, - }) + // Build child contexts with pre-computed decisions + let children: Vec> = branch_children + .iter() + .zip(fields_with_child_info) + .map(|((child_name, child_node), (field, child_fields))| { + let is_leaf = matches!(child_node, TreeNode::Leaf(_)); + let base_result = get_pattern_instance_base(child_node); + let is_parameterizable = child_fields + .as_ref() + .is_some_and(|cf| metadata.is_parameterizable_fields(cf)); + // should_inline is only meaningful for branches + let should_inline = !is_leaf && base_result.should_inline(is_parameterizable); + + // Inline type name (only used when should_inline is true) + let inline_type_name = if should_inline { + child_type_name(name, child_name) + } else { + String::new() + }; + + ChildContext { + name: child_name, + node: child_node, + field, + child_fields, + base_result, + is_leaf, + should_inline, + inline_type_name, + } + }) + .collect(); + + Some(TreeNodeContext { children }) } diff --git a/crates/brk_bindgen/src/generators/javascript/client.rs b/crates/brk_bindgen/src/generators/javascript/client.rs index 2d201863e..84579c0d6 100644 --- a/crates/brk_bindgen/src/generators/javascript/client.rs +++ b/crates/brk_bindgen/src/generators/javascript/client.rs @@ -63,57 +63,65 @@ class BrkError extends Error {{ * @property {{number}} end - End index (exclusive) * @property {{T[]}} data - The metric data */ -/** @typedef {{MetricData}} AnyMetricData */ +/** @typedef {{MetricData}} AnyMetricData */ /** + * Thenable interface for await support. + * @template T + * @typedef {{(onfulfilled?: (value: MetricData) => MetricData, onrejected?: (reason: Error) => never) => Promise>}} Thenable + */ + +/** + * Metric endpoint builder. Callable (returns itself) so both .by.dateindex and .by.dateindex() work. * @template T * @typedef {{Object}} MetricEndpointBuilder - * @property {{(n: number) => RangeBuilder}} first - Fetch first n data points - * @property {{(n: number) => RangeBuilder}} last - Fetch last n data points - * @property {{(start: number, end: number) => RangeBuilder}} range - Set explicit range [start, end) - * @property {{(start: number) => FromBuilder}} from - Set start position, chain with take() or to() - * @property {{(end: number) => ToBuilder}} to - Set end position, chain with takeLast() or from() - * @property {{(onUpdate?: (value: MetricData) => void) => Promise>}} json - Execute and return JSON (all data) - * @property {{() => Promise}} csv - Execute and return CSV (all data) + * @property {{(index: number) => SingleItemBuilder}} get - Get single item at index + * @property {{(start?: number, end?: number) => RangeBuilder}} slice - Slice like Array.slice + * @property {{(n: number) => RangeBuilder}} first - Get first n items + * @property {{(n: number) => RangeBuilder}} last - Get last n items + * @property {{(n: number) => SkippedBuilder}} skip - Skip first n items, chain with take() + * @property {{(onUpdate?: (value: MetricData) => void) => Promise>}} fetch - Fetch all data + * @property {{() => Promise}} fetchCsv - Fetch all data as CSV + * @property {{Thenable}} then - Thenable (await endpoint) * @property {{string}} path - The endpoint path */ -/** @typedef {{MetricEndpointBuilder}} AnyMetricEndpointBuilder */ +/** @typedef {{MetricEndpointBuilder}} AnyMetricEndpointBuilder */ /** * @template T - * @typedef {{Object}} FromBuilder - * @property {{(n: number) => RangeBuilder}} take - Take n items from start position - * @property {{(end: number) => RangeBuilder}} to - Set end position - * @property {{(onUpdate?: (value: MetricData) => void) => Promise>}} json - Execute and return JSON - * @property {{() => Promise}} csv - Execute and return CSV + * @typedef {{Object}} SingleItemBuilder + * @property {{(onUpdate?: (value: MetricData) => void) => Promise>}} fetch - Fetch the item + * @property {{() => Promise}} fetchCsv - Fetch as CSV + * @property {{Thenable}} then - Thenable */ /** * @template T - * @typedef {{Object}} ToBuilder - * @property {{(n: number) => RangeBuilder}} takeLast - Take last n items before end position - * @property {{(start: number) => RangeBuilder}} from - Set start position - * @property {{(onUpdate?: (value: MetricData) => void) => Promise>}} json - Execute and return JSON - * @property {{() => Promise}} csv - Execute and return CSV + * @typedef {{Object}} SkippedBuilder + * @property {{(n: number) => RangeBuilder}} take - Take n items after skipped position + * @property {{(onUpdate?: (value: MetricData) => void) => Promise>}} fetch - Fetch from skipped position to end + * @property {{() => Promise}} fetchCsv - Fetch as CSV + * @property {{Thenable}} then - Thenable */ /** * @template T * @typedef {{Object}} RangeBuilder - * @property {{(onUpdate?: (value: MetricData) => void) => Promise>}} json - Execute and return JSON - * @property {{() => Promise}} csv - Execute and return CSV + * @property {{(onUpdate?: (value: MetricData) => void) => Promise>}} fetch - Fetch the range + * @property {{() => Promise}} fetchCsv - Fetch as CSV + * @property {{Thenable}} then - Thenable */ /** * @template T * @typedef {{Object}} MetricPattern * @property {{string}} name - The metric name - * @property {{Partial>>}} by - Index endpoints (lazy getters) + * @property {{Readonly>>>}} by - Index endpoints as lazy getters. Access via .by.dateindex or .by['dateindex'] * @property {{() => Index[]}} indexes - Get the list of available indexes * @property {{(index: Index) => MetricEndpointBuilder|undefined}} get - Get an endpoint for a specific index */ -/** @typedef {{MetricPattern}} AnyMetricPattern */ +/** @typedef {{MetricPattern}} AnyMetricPattern */ /** * Create a metric endpoint builder with typestate pattern. @@ -147,50 +155,46 @@ function _endpoint(client, name, index) {{ * @returns {{RangeBuilder}} */ const rangeBuilder = (start, end) => ({{ - json(/** @type {{((value: MetricData) => void) | undefined}} */ onUpdate) {{ - return client.getJson(buildPath(start, end), onUpdate); - }}, - csv() {{ return client.getText(buildPath(start, end, 'csv')); }}, + fetch(onUpdate) {{ return client.getJson(buildPath(start, end), onUpdate); }}, + fetchCsv() {{ return client.getText(buildPath(start, end, 'csv')); }}, + then(resolve, reject) {{ return this.fetch().then(resolve, reject); }}, + }}); + + /** + * @param {{number}} index + * @returns {{SingleItemBuilder}} + */ + const singleItemBuilder = (index) => ({{ + fetch(onUpdate) {{ return client.getJson(buildPath(index, index + 1), onUpdate); }}, + fetchCsv() {{ return client.getText(buildPath(index, index + 1, 'csv')); }}, + then(resolve, reject) {{ return this.fetch().then(resolve, reject); }}, }}); /** * @param {{number}} start - * @returns {{FromBuilder}} + * @returns {{SkippedBuilder}} */ - const fromBuilder = (start) => ({{ - take(/** @type {{number}} */ n) {{ return rangeBuilder(start, start + n); }}, - to(/** @type {{number}} */ end) {{ return rangeBuilder(start, end); }}, - json(/** @type {{((value: MetricData) => void) | undefined}} */ onUpdate) {{ - return client.getJson(buildPath(start, undefined), onUpdate); - }}, - csv() {{ return client.getText(buildPath(start, undefined, 'csv')); }}, + const skippedBuilder = (start) => ({{ + take(n) {{ return rangeBuilder(start, start + n); }}, + fetch(onUpdate) {{ return client.getJson(buildPath(start, undefined), onUpdate); }}, + fetchCsv() {{ return client.getText(buildPath(start, undefined, 'csv')); }}, + then(resolve, reject) {{ return this.fetch().then(resolve, reject); }}, }}); - /** - * @param {{number}} end - * @returns {{ToBuilder}} - */ - const toBuilder = (end) => ({{ - takeLast(/** @type {{number}} */ n) {{ return rangeBuilder(end - n, end); }}, - from(/** @type {{number}} */ start) {{ return rangeBuilder(start, end); }}, - json(/** @type {{((value: MetricData) => void) | undefined}} */ onUpdate) {{ - return client.getJson(buildPath(undefined, end), onUpdate); - }}, - csv() {{ return client.getText(buildPath(undefined, end, 'csv')); }}, - }}); - - return {{ - first(/** @type {{number}} */ n) {{ return rangeBuilder(undefined, n); }}, - last(/** @type {{number}} */ n) {{ return rangeBuilder(-n, undefined); }}, - range(/** @type {{number}} */ start, /** @type {{number}} */ end) {{ return rangeBuilder(start, end); }}, - from(/** @type {{number}} */ start) {{ return fromBuilder(start); }}, - to(/** @type {{number}} */ end) {{ return toBuilder(end); }}, - json(/** @type {{((value: MetricData) => void) | undefined}} */ onUpdate) {{ - return client.getJson(buildPath(), onUpdate); - }}, - csv() {{ return client.getText(buildPath(undefined, undefined, 'csv')); }}, + /** @type {{MetricEndpointBuilder}} */ + const endpoint = {{ + get(index) {{ return singleItemBuilder(index); }}, + slice(start, end) {{ return rangeBuilder(start, end); }}, + first(n) {{ return rangeBuilder(undefined, n); }}, + last(n) {{ return rangeBuilder(-n, undefined); }}, + skip(n) {{ return skippedBuilder(n); }}, + fetch(onUpdate) {{ return client.getJson(buildPath(), onUpdate); }}, + fetchCsv() {{ return client.getText(buildPath(undefined, undefined, 'csv')); }}, + then(resolve, reject) {{ return this.fetch().then(resolve, reject); }}, get path() {{ return p; }}, }}; + + return endpoint; }} /** @@ -235,7 +239,7 @@ class BrkClientBase {{ const cachedJson = cachedRes ? await cachedRes.json() : null; if (cachedJson) onUpdate?.(cachedJson); - if (!globalThis.navigator?.onLine) {{ + if (globalThis.navigator?.onLine === false) {{ if (cachedJson) return cachedJson; throw new BrkError('Offline and no cached data available'); }} @@ -305,7 +309,11 @@ pub fn generate_static_constants(output: &mut String) { fn instance_const_camel(output: &mut String, name: &str, value: &T) { let json_value: Value = serde_json::to_value(value).unwrap(); let camel_value = camel_case_top_level_keys(json_value); - write_static_const(output, name, &serde_json::to_string_pretty(&camel_value).unwrap()); + write_static_const( + output, + name, + &serde_json::to_string_pretty(&camel_value).unwrap(), + ); } instance_const_camel(output, "TERM_NAMES", &TERM_NAMES); @@ -336,13 +344,25 @@ fn camel_case_top_level_keys(value: Value) -> Value { fn indent_json_const(json: &str) -> String { json.lines() .enumerate() - .map(|(i, line)| if i == 0 { line.to_string() } else { format!(" {}", line) }) + .map(|(i, line)| { + if i == 0 { + line.to_string() + } else { + format!(" {}", line) + } + }) .collect::>() .join("\n") } fn write_static_const(output: &mut String, name: &str, json: &str) { - writeln!(output, " {} = /** @type {{const}} */ ({});\n", name, indent_json_const(json)).unwrap(); + writeln!( + output, + " {} = /** @type {{const}} */ ({});\n", + name, + indent_json_const(json) + ) + .unwrap(); } /// Generate index accessor factory functions. @@ -354,14 +374,30 @@ pub fn generate_index_accessors(output: &mut String, patterns: &[IndexSetPattern writeln!(output, "// Index accessor factory functions\n").unwrap(); for pattern in patterns { + // Use 'readonly' to indicate these are getters (lazy evaluation) let by_fields: Vec = pattern .indexes .iter() - .map(|idx| format!("{}: MetricEndpointBuilder", idx.serialize_long())) + .map(|idx| { + format!( + "readonly {}: MetricEndpointBuilder", + idx.serialize_long() + ) + }) .collect(); let by_type = format!("{{ {} }}", by_fields.join(", ")); writeln!(output, "/**").unwrap(); + writeln!( + output, + " * Metric pattern with index endpoints as lazy getters." + ) + .unwrap(); + writeln!( + output, + " * Access via property (.by.dateindex) or bracket notation (.by['dateindex'])." + ) + .unwrap(); writeln!(output, " * @template T").unwrap(); writeln!( output, @@ -385,7 +421,11 @@ pub fn generate_index_accessors(output: &mut String, patterns: &[IndexSetPattern for (i, index) in pattern.indexes.iter().enumerate() { let index_name = index.serialize_long(); - let comma = if i < pattern.indexes.len() - 1 { "," } else { "" }; + let comma = if i < pattern.indexes.len() - 1 { + "," + } else { + "" + }; writeln!( output, " get {}() {{ return _endpoint(client, name, '{}'); }}{}", @@ -438,8 +478,12 @@ pub fn generate_structural_patterns( } writeln!(output, " * @typedef {{Object}} {}", pattern.name).unwrap(); for field in &pattern.fields { - let js_type = - metadata.field_type_annotation(field, pattern.is_generic, None, GenericSyntax::JAVASCRIPT); + let js_type = metadata.field_type_annotation( + field, + pattern.is_generic, + None, + GenericSyntax::JAVASCRIPT, + ); writeln!( output, " * @property {{{}}} {}", @@ -469,8 +513,17 @@ pub fn generate_structural_patterns( writeln!(output, " * @returns {{{}}}", return_type).unwrap(); writeln!(output, " */").unwrap(); - let param_name = if is_parameterizable { "acc" } else { "basePath" }; - writeln!(output, "function create{}(client, {}) {{", pattern.name, param_name).unwrap(); + let param_name = if is_parameterizable { + "acc" + } else { + "basePath" + }; + writeln!( + output, + "function create{}(client, {}) {{", + pattern.name, param_name + ) + .unwrap(); writeln!(output, " return {{").unwrap(); let syntax = JavaScriptSyntax; diff --git a/crates/brk_bindgen/src/generators/javascript/tree.rs b/crates/brk_bindgen/src/generators/javascript/tree.rs index 9277423d6..72e5b6f34 100644 --- a/crates/brk_bindgen/src/generators/javascript/tree.rs +++ b/crates/brk_bindgen/src/generators/javascript/tree.rs @@ -6,7 +6,7 @@ use std::fmt::Write; use brk_types::TreeNode; use crate::{ - ClientMetadata, Endpoint, GenericSyntax, JavaScriptSyntax, PatternField, child_type_name, + ClientMetadata, Endpoint, GenericSyntax, JavaScriptSyntax, PatternField, generate_leaf_field, get_first_leaf_name, get_node_fields, get_pattern_instance_base, infer_accumulated_name, prepare_tree_node, to_camel_case, }; @@ -45,43 +45,41 @@ fn generate_tree_typedef( writeln!(output, "/**").unwrap(); writeln!(output, " * @typedef {{Object}} {}", name).unwrap(); - for ((field, child_fields), (child_name, _)) in - ctx.fields_with_child_info.iter().zip(ctx.children.iter()) - { - let js_type = metadata.resolve_tree_field_type( - field, - child_fields.as_deref(), - name, - child_name, - GenericSyntax::JAVASCRIPT, - ); + for child in &ctx.children { + let js_type = if child.should_inline { + child.inline_type_name.clone() + } else { + metadata.resolve_tree_field_type( + &child.field, + child.child_fields.as_deref(), + name, + child.name, + GenericSyntax::JAVASCRIPT, + ) + }; writeln!( output, " * @property {{{}}} {}", js_type, - to_camel_case(&field.name) + to_camel_case(&child.field.name) ) .unwrap(); } writeln!(output, " */\n").unwrap(); - for (child_name, child_node) in ctx.children { - if let TreeNode::Branch(grandchildren) = child_node { - let child_fields = get_node_fields(grandchildren, pattern_lookup); - // Generate typedef if no pattern match OR pattern is not parameterizable - if !metadata.is_parameterizable_fields(&child_fields) { - let child_type = child_type_name(name, child_name); - generate_tree_typedef( - output, - &child_type, - child_node, - pattern_lookup, - metadata, - generated, - ); - } + // Generate child typedefs + for child in &ctx.children { + if child.should_inline { + generate_tree_typedef( + output, + &child.inline_type_name, + child.node, + pattern_lookup, + metadata, + generated, + ); } } } @@ -182,12 +180,14 @@ fn generate_tree_initializer( .get(&child_fields) .filter(|name| metadata.is_parameterizable(name)); - if let Some(pattern_name) = pattern_name { - let arg = get_pattern_instance_base(child_node); + let base_result = get_pattern_instance_base(child_node); + + // Use pattern factory only if no outlier was detected + if let Some(pattern_name) = pattern_name.filter(|_| !base_result.has_outlier) { writeln!( output, "{}{}: create{}(this, '{}'),", - indent_str, field_name, pattern_name, arg + indent_str, field_name, pattern_name, base_result.base ) .unwrap(); } else { diff --git a/crates/brk_bindgen/src/generators/python/client.rs b/crates/brk_bindgen/src/generators/python/client.rs index 99218feff..bb9a042c6 100644 --- a/crates/brk_bindgen/src/generators/python/client.rs +++ b/crates/brk_bindgen/src/generators/python/client.rs @@ -195,143 +195,138 @@ class _EndpointConfig: class RangeBuilder(Generic[T]): - """Final builder with range fully specified. Can only call json() or csv().""" + """Builder with range specified.""" def __init__(self, config: _EndpointConfig): self._config = config - def json(self) -> MetricData[T]: - """Execute the query and return parsed JSON data.""" + def fetch(self) -> MetricData[T]: + """Fetch the range as parsed JSON.""" return self._config.get_json() - def csv(self) -> str: - """Execute the query and return CSV data as a string.""" + def fetch_csv(self) -> str: + """Fetch the range as CSV string.""" return self._config.get_csv() -class FromBuilder(Generic[T]): - """Builder after calling from(start). Can chain with take() or to().""" +class SingleItemBuilder(Generic[T]): + """Builder for single item access.""" + + def __init__(self, config: _EndpointConfig): + self._config = config + + def fetch(self) -> MetricData[T]: + """Fetch the single item.""" + return self._config.get_json() + + def fetch_csv(self) -> str: + """Fetch as CSV.""" + return self._config.get_csv() + + +class SkippedBuilder(Generic[T]): + """Builder after calling skip(n). Chain with take() to specify count.""" def __init__(self, config: _EndpointConfig): self._config = config def take(self, n: int) -> RangeBuilder[T]: - """Take n items from the start position.""" + """Take n items after the skipped position.""" start = self._config.start or 0 return RangeBuilder(_EndpointConfig( self._config.client, self._config.name, self._config.index, start, start + n )) - def to(self, end: int) -> RangeBuilder[T]: - """Set the end position.""" - return RangeBuilder(_EndpointConfig( - self._config.client, self._config.name, self._config.index, - self._config.start, end - )) - - def json(self) -> MetricData[T]: - """Execute the query and return parsed JSON data (from start to end of data).""" + def fetch(self) -> MetricData[T]: + """Fetch from skipped position to end.""" return self._config.get_json() - def csv(self) -> str: - """Execute the query and return CSV data as a string.""" - return self._config.get_csv() - - -class ToBuilder(Generic[T]): - """Builder after calling to(end). Can chain with take_last() or from().""" - - def __init__(self, config: _EndpointConfig): - self._config = config - - def take_last(self, n: int) -> RangeBuilder[T]: - """Take last n items before the end position.""" - end = self._config.end or 0 - return RangeBuilder(_EndpointConfig( - self._config.client, self._config.name, self._config.index, - end - n, end - )) - - def from_(self, start: int) -> RangeBuilder[T]: - """Set the start position.""" - return RangeBuilder(_EndpointConfig( - self._config.client, self._config.name, self._config.index, - start, self._config.end - )) - - def json(self) -> MetricData[T]: - """Execute the query and return parsed JSON data (from start of data to end).""" - return self._config.get_json() - - def csv(self) -> str: - """Execute the query and return CSV data as a string.""" + def fetch_csv(self) -> str: + """Fetch as CSV.""" return self._config.get_csv() class MetricEndpointBuilder(Generic[T]): - """Initial builder for metric endpoint queries. + """Builder for metric endpoint queries. - Use method chaining to specify the data range, then call json() or csv() to execute. + Use method chaining to specify the data range, then call fetch() or fetch_csv() to execute. Examples: - # Get all data - endpoint.json() + # Fetch all data + data = endpoint.fetch() - # Get last 10 points - endpoint.last(10).json() + # Single item access + data = endpoint[5].fetch() - # Get range [100, 200) - endpoint.range(100, 200).json() + # Slice syntax (Python-native) + data = endpoint[:10].fetch() # First 10 + data = endpoint[-5:].fetch() # Last 5 + data = endpoint[100:110].fetch() # Range - # Get 10 points starting from position 100 - endpoint.from_(100).take(10).json() + # Convenience methods (pandas-style) + data = endpoint.head().fetch() # First 10 (default) + data = endpoint.head(20).fetch() # First 20 + data = endpoint.tail(5).fetch() # Last 5 + + # Iterator-style chaining + data = endpoint.skip(100).take(10).fetch() """ def __init__(self, client: BrkClientBase, name: str, index: Index): self._config = _EndpointConfig(client, name, index) - def first(self, n: int) -> RangeBuilder[T]: - """Fetch the first n data points.""" + @overload + def __getitem__(self, key: int) -> SingleItemBuilder[T]: ... + @overload + def __getitem__(self, key: slice) -> RangeBuilder[T]: ... + + def __getitem__(self, key: Union[int, slice]) -> Union[SingleItemBuilder[T], RangeBuilder[T]]: + """Access single item or slice. + + Examples: + endpoint[5] # Single item at index 5 + endpoint[:10] # First 10 + endpoint[-5:] # Last 5 + endpoint[100:110] # Range 100-109 + """ + if isinstance(key, int): + return SingleItemBuilder(_EndpointConfig( + self._config.client, self._config.name, self._config.index, + key, key + 1 + )) + return RangeBuilder(_EndpointConfig( + self._config.client, self._config.name, self._config.index, + key.start, key.stop + )) + + def head(self, n: int = 10) -> RangeBuilder[T]: + """Get the first n items (pandas-style).""" return RangeBuilder(_EndpointConfig( self._config.client, self._config.name, self._config.index, None, n )) - def last(self, n: int) -> RangeBuilder[T]: - """Fetch the last n data points.""" + def tail(self, n: int = 10) -> RangeBuilder[T]: + """Get the last n items (pandas-style).""" return RangeBuilder(_EndpointConfig( self._config.client, self._config.name, self._config.index, -n, None )) - def range(self, start: int, end: int) -> RangeBuilder[T]: - """Set an explicit range [start, end).""" - return RangeBuilder(_EndpointConfig( + def skip(self, n: int) -> SkippedBuilder[T]: + """Skip the first n items. Chain with take() to get a range.""" + return SkippedBuilder(_EndpointConfig( self._config.client, self._config.name, self._config.index, - start, end + n, None )) - def from_(self, start: int) -> FromBuilder[T]: - """Set the start position. Chain with take() or to().""" - return FromBuilder(_EndpointConfig( - self._config.client, self._config.name, self._config.index, - start, None - )) - - def to(self, end: int) -> ToBuilder[T]: - """Set the end position. Chain with take_last() or from_().""" - return ToBuilder(_EndpointConfig( - self._config.client, self._config.name, self._config.index, - None, end - )) - - def json(self) -> MetricData[T]: - """Execute the query and return parsed JSON data (all data).""" + def fetch(self) -> MetricData[T]: + """Fetch all data as parsed JSON.""" return self._config.get_json() - def csv(self) -> str: - """Execute the query and return CSV data as a string (all data).""" + def fetch_csv(self) -> str: + """Fetch all data as CSV string.""" return self._config.get_csv() def path(self) -> str: diff --git a/crates/brk_bindgen/src/generators/python/mod.rs b/crates/brk_bindgen/src/generators/python/mod.rs index 2bd877ff6..d06fd1c72 100644 --- a/crates/brk_bindgen/src/generators/python/mod.rs +++ b/crates/brk_bindgen/src/generators/python/mod.rs @@ -26,7 +26,7 @@ pub fn generate_python_client( writeln!(output, "# Do not edit manually\n").unwrap(); writeln!( output, - "from typing import TypeVar, Generic, Any, Optional, List, Literal, TypedDict, Union, Protocol" + "from typing import TypeVar, Generic, Any, Optional, List, Literal, TypedDict, Union, Protocol, overload" ) .unwrap(); writeln!(output, "from http.client import HTTPSConnection, HTTPConnection").unwrap(); diff --git a/crates/brk_bindgen/src/generators/python/tree.rs b/crates/brk_bindgen/src/generators/python/tree.rs index b14a29542..4dd80ce83 100644 --- a/crates/brk_bindgen/src/generators/python/tree.rs +++ b/crates/brk_bindgen/src/generators/python/tree.rs @@ -6,8 +6,8 @@ use std::fmt::Write; use brk_types::TreeNode; use crate::{ - ClientMetadata, GenericSyntax, PatternField, PythonSyntax, child_type_name, generate_leaf_field, - get_node_fields, get_pattern_instance_base, prepare_tree_node, to_snake_case, + ClientMetadata, GenericSyntax, PatternField, PythonSyntax, generate_leaf_field, + prepare_tree_node, to_snake_case, }; /// Generate tree classes @@ -41,22 +41,16 @@ fn generate_tree_class( // Generate child classes FIRST (post-order traversal) // This ensures children are defined before parent references them - for (child_name, child_node) in ctx.children.iter() { - if let TreeNode::Branch(grandchildren) = child_node { - let child_fields = get_node_fields(grandchildren, pattern_lookup); - - // Generate inline class if no pattern match OR pattern is not parameterizable - if !metadata.is_parameterizable_fields(&child_fields) { - let child_class = child_type_name(name, child_name); - generate_tree_class( - output, - &child_class, - child_node, - pattern_lookup, - metadata, - generated, - ); - } + for child in &ctx.children { + if child.should_inline { + generate_tree_class( + output, + &child.inline_type_name, + child.node, + pattern_lookup, + metadata, + generated, + ); } } @@ -71,45 +65,36 @@ fn generate_tree_class( .unwrap(); let syntax = PythonSyntax; - for ((field, child_fields_opt), (child_name, child_node)) in - ctx.fields_with_child_info.iter().zip(ctx.children.iter()) - { - let py_type = metadata.resolve_tree_field_type( - field, - child_fields_opt.as_deref(), - name, - child_name, - GenericSyntax::PYTHON, - ); - let field_name_py = to_snake_case(&field.name); + for child in &ctx.children { + let field_name_py = to_snake_case(child.name); - if metadata.is_pattern_type(&field.rust_type) && metadata.is_parameterizable(&field.rust_type) - { - // Parameterizable pattern: use pattern class with metric base - let metric_base = get_pattern_instance_base(child_node); - writeln!( - output, - " self.{}: {} = {}(client, '{}')", - field_name_py, py_type, field.rust_type, metric_base - ) - .unwrap(); - } else if let TreeNode::Leaf(leaf) = child_node { - // Leaf node: use shared helper - generate_leaf_field(output, &syntax, "client", child_name, leaf, metadata, " "); - } else if field.is_branch() { - // Non-parameterizable pattern or regular branch: generate inline class - let inline_class = child_type_name(name, &field.name); + if child.is_leaf { + if let TreeNode::Leaf(leaf) = child.node { + generate_leaf_field(output, &syntax, "client", child.name, leaf, metadata, " "); + } + } else if child.should_inline { + // Inline class writeln!( output, " self.{}: {} = {}(client)", - field_name_py, inline_class, inline_class + field_name_py, child.inline_type_name, child.inline_type_name ) .unwrap(); } else { - panic!( - "Field '{}' has no matching index pattern. All metrics must be indexed.", - field.name + // Use pattern class with metric base + let py_type = metadata.resolve_tree_field_type( + &child.field, + child.child_fields.as_deref(), + name, + child.name, + GenericSyntax::PYTHON, ); + writeln!( + output, + " self.{}: {} = {}(client, '{}')", + field_name_py, py_type, child.field.rust_type, child.base_result.base + ) + .unwrap(); } } diff --git a/crates/brk_bindgen/src/generators/rust/client.rs b/crates/brk_bindgen/src/generators/rust/client.rs index c0a3948ff..4ba06486b 100644 --- a/crates/brk_bindgen/src/generators/rust/client.rs +++ b/crates/brk_bindgen/src/generators/rust/client.rs @@ -12,6 +12,7 @@ pub fn generate_imports(output: &mut String) { writeln!( output, r#"use std::sync::Arc; +use std::ops::{{Bound, RangeBounds}}; use serde::de::DeserializeOwned; pub use brk_cohort::*; pub use brk_types::*; @@ -193,21 +194,30 @@ impl EndpointConfig {{ /// Initial builder for metric endpoint queries. /// -/// Use method chaining to specify the data range, then call `json()` or `csv()` to execute. +/// Use method chaining to specify the data range, then call `fetch()` or `fetch_csv()` to execute. /// /// # Examples /// ```ignore -/// // Get all data -/// endpoint.json()?; +/// // Fetch all data +/// let data = endpoint.fetch()?; /// -/// // Get last 10 points -/// endpoint.last(10).json()?; +/// // Get single item at index 5 +/// let data = endpoint.get(5).fetch()?; +/// +/// // Get first 10 using range +/// let data = endpoint.range(..10).fetch()?; /// /// // Get range [100, 200) -/// endpoint.range(100, 200).json()?; +/// let data = endpoint.range(100..200).fetch()?; /// -/// // Get 10 points starting from position 100 -/// endpoint.from(100).take(10).json()?; +/// // Get first 10 (convenience) +/// let data = endpoint.take(10).fetch()?; +/// +/// // Get last 10 +/// let data = endpoint.last(10).fetch()?; +/// +/// // Iterator-style chaining +/// let data = endpoint.skip(100).take(10).fetch()?; /// ``` pub struct MetricEndpointBuilder {{ config: EndpointConfig, @@ -219,44 +229,59 @@ impl MetricEndpointBuilder {{ Self {{ config: EndpointConfig::new(client, name, index), _marker: std::marker::PhantomData }} }} - /// Fetch the first n data points. - pub fn first(mut self, n: u64) -> RangeBuilder {{ - self.config.end = Some(n as i64); + /// Select a specific index position. + pub fn get(mut self, index: usize) -> SingleItemBuilder {{ + self.config.start = Some(index as i64); + self.config.end = Some(index as i64 + 1); + SingleItemBuilder {{ config: self.config, _marker: std::marker::PhantomData }} + }} + + /// Select a range using Rust range syntax. + /// + /// # Examples + /// ```ignore + /// endpoint.range(..10) // first 10 + /// endpoint.range(100..110) // indices 100-109 + /// endpoint.range(100..) // from 100 to end + /// ``` + pub fn range>(mut self, range: R) -> RangeBuilder {{ + self.config.start = match range.start_bound() {{ + Bound::Included(&n) => Some(n as i64), + Bound::Excluded(&n) => Some(n as i64 + 1), + Bound::Unbounded => None, + }}; + self.config.end = match range.end_bound() {{ + Bound::Included(&n) => Some(n as i64 + 1), + Bound::Excluded(&n) => Some(n as i64), + Bound::Unbounded => None, + }}; RangeBuilder {{ config: self.config, _marker: std::marker::PhantomData }} }} - /// Fetch the last n data points. - pub fn last(mut self, n: u64) -> RangeBuilder {{ + /// Take the first n items. + pub fn take(self, n: usize) -> RangeBuilder {{ + self.range(..n) + }} + + /// Take the last n items. + pub fn last(mut self, n: usize) -> RangeBuilder {{ self.config.start = Some(-(n as i64)); RangeBuilder {{ config: self.config, _marker: std::marker::PhantomData }} }} - /// Set an explicit range [start, end). - pub fn range(mut self, start: i64, end: i64) -> RangeBuilder {{ - self.config.start = Some(start); - self.config.end = Some(end); - RangeBuilder {{ config: self.config, _marker: std::marker::PhantomData }} + /// Skip the first n items. Chain with `take(n)` to get a range. + pub fn skip(mut self, n: usize) -> SkippedBuilder {{ + self.config.start = Some(n as i64); + SkippedBuilder {{ config: self.config, _marker: std::marker::PhantomData }} }} - /// Set the start position. Chain with `take(n)` or `to(end)`. - pub fn from(mut self, start: i64) -> FromBuilder {{ - self.config.start = Some(start); - FromBuilder {{ config: self.config, _marker: std::marker::PhantomData }} - }} - - /// Set the end position. Chain with `takeLast(n)` or `from(start)`. - pub fn to(mut self, end: i64) -> ToBuilder {{ - self.config.end = Some(end); - ToBuilder {{ config: self.config, _marker: std::marker::PhantomData }} - }} - - /// Execute the query and return parsed JSON data (all data). - pub fn json(self) -> Result> {{ + /// Fetch all data as parsed JSON. + pub fn fetch(self) -> Result> {{ self.config.get_json(None) }} - /// Execute the query and return CSV data as a string (all data). - pub fn csv(self) -> Result {{ + /// Fetch all data as CSV string. + pub fn fetch_csv(self) -> Result {{ self.config.get_text(Some("csv")) }} @@ -266,82 +291,63 @@ impl MetricEndpointBuilder {{ }} }} -/// Builder after calling `from(start)`. Can chain with `take(n)` or `to(end)`. -pub struct FromBuilder {{ +/// Builder for single item access. +pub struct SingleItemBuilder {{ config: EndpointConfig, _marker: std::marker::PhantomData, }} -impl FromBuilder {{ - /// Take n items from the start position. - pub fn take(mut self, n: u64) -> RangeBuilder {{ +impl SingleItemBuilder {{ + /// Fetch the single item. + pub fn fetch(self) -> Result> {{ + self.config.get_json(None) + }} + + /// Fetch the single item as CSV. + pub fn fetch_csv(self) -> Result {{ + self.config.get_text(Some("csv")) + }} +}} + +/// Builder after calling `skip(n)`. Chain with `take(n)` to specify count. +pub struct SkippedBuilder {{ + config: EndpointConfig, + _marker: std::marker::PhantomData, +}} + +impl SkippedBuilder {{ + /// Take n items after the skipped position. + pub fn take(mut self, n: usize) -> RangeBuilder {{ let start = self.config.start.unwrap_or(0); self.config.end = Some(start + n as i64); RangeBuilder {{ config: self.config, _marker: std::marker::PhantomData }} }} - /// Set the end position. - pub fn to(mut self, end: i64) -> RangeBuilder {{ - self.config.end = Some(end); - RangeBuilder {{ config: self.config, _marker: std::marker::PhantomData }} - }} - - /// Execute the query and return parsed JSON data (from start to end of data). - pub fn json(self) -> Result> {{ + /// Fetch from the skipped position to the end. + pub fn fetch(self) -> Result> {{ self.config.get_json(None) }} - /// Execute the query and return CSV data as a string. - pub fn csv(self) -> Result {{ + /// Fetch from the skipped position to the end as CSV. + pub fn fetch_csv(self) -> Result {{ self.config.get_text(Some("csv")) }} }} -/// Builder after calling `to(end)`. Can chain with `takeLast(n)` or `from(start)`. -pub struct ToBuilder {{ - config: EndpointConfig, - _marker: std::marker::PhantomData, -}} - -impl ToBuilder {{ - /// Take last n items before the end position. - pub fn take_last(mut self, n: u64) -> RangeBuilder {{ - let end = self.config.end.unwrap_or(0); - self.config.start = Some(end - n as i64); - RangeBuilder {{ config: self.config, _marker: std::marker::PhantomData }} - }} - - /// Set the start position. - pub fn from(mut self, start: i64) -> RangeBuilder {{ - self.config.start = Some(start); - RangeBuilder {{ config: self.config, _marker: std::marker::PhantomData }} - }} - - /// Execute the query and return parsed JSON data (from start of data to end). - pub fn json(self) -> Result> {{ - self.config.get_json(None) - }} - - /// Execute the query and return CSV data as a string. - pub fn csv(self) -> Result {{ - self.config.get_text(Some("csv")) - }} -}} - -/// Final builder with range fully specified. Can only call `json()` or `csv()`. +/// Builder with range fully specified. pub struct RangeBuilder {{ config: EndpointConfig, _marker: std::marker::PhantomData, }} impl RangeBuilder {{ - /// Execute the query and return parsed JSON data. - pub fn json(self) -> Result> {{ + /// Fetch the range as parsed JSON. + pub fn fetch(self) -> Result> {{ self.config.get_json(None) }} - /// Execute the query and return CSV data as a string. - pub fn csv(self) -> Result {{ + /// Fetch the range as CSV string. + pub fn fetch_csv(self) -> Result {{ self.config.get_text(Some("csv")) }} }} diff --git a/crates/brk_bindgen/src/generators/rust/tree.rs b/crates/brk_bindgen/src/generators/rust/tree.rs index f82115fe8..d1fd3514c 100644 --- a/crates/brk_bindgen/src/generators/rust/tree.rs +++ b/crates/brk_bindgen/src/generators/rust/tree.rs @@ -6,9 +6,8 @@ use std::fmt::Write; use brk_types::TreeNode; use crate::{ - ClientMetadata, GenericSyntax, LanguageSyntax, PatternField, RustSyntax, child_type_name, - generate_leaf_field, generate_tree_node_field, get_node_fields, get_pattern_instance_base, - prepare_tree_node, to_snake_case, + ClientMetadata, GenericSyntax, LanguageSyntax, PatternField, RustSyntax, + generate_leaf_field, generate_tree_node_field, prepare_tree_node, to_snake_case, }; /// Generate tree structs. @@ -39,25 +38,29 @@ fn generate_tree_node( return; }; + // Generate struct definition writeln!(output, "/// Metrics tree node.").unwrap(); writeln!(output, "pub struct {} {{", name).unwrap(); - for ((field, child_fields), (child_name, _)) in - ctx.fields_with_child_info.iter().zip(ctx.children.iter()) - { - let field_name = to_snake_case(&field.name); - let type_annotation = metadata.resolve_tree_field_type( - field, - child_fields.as_deref(), - name, - child_name, - GenericSyntax::RUST, - ); + for child in &ctx.children { + let field_name = to_snake_case(child.name); + let type_annotation = if child.should_inline { + child.inline_type_name.clone() + } else { + metadata.resolve_tree_field_type( + &child.field, + child.child_fields.as_deref(), + name, + child.name, + GenericSyntax::RUST, + ) + }; writeln!(output, " pub {}: {},", field_name, type_annotation).unwrap(); } writeln!(output, "}}\n").unwrap(); + // Generate impl block writeln!(output, "impl {} {{", name).unwrap(); writeln!( output, @@ -67,53 +70,40 @@ fn generate_tree_node( writeln!(output, " Self {{").unwrap(); let syntax = RustSyntax; - for ((field_info, child_fields), (child_name, child_node)) in - ctx.fields_with_child_info.iter().zip(ctx.children.iter()) - { - let field_name = to_snake_case(&field_info.name); + for child in &ctx.children { + let field_name = to_snake_case(child.name); - // Check if this is a pattern type and if it's parameterizable - let is_parameterizable = child_fields - .as_ref() - .is_some_and(|cf| metadata.is_parameterizable_fields(cf)); - - if metadata.is_pattern_type(&field_info.rust_type) && is_parameterizable { - // Parameterizable pattern: use pattern constructor with metric base - let pattern_base = get_pattern_instance_base(child_node); - generate_tree_node_field( - output, - &syntax, - field_info, - metadata, - " ", - child_name, - Some(&pattern_base), - ); - } else if child_fields.is_some() { - // Non-parameterizable pattern or regular branch: use inline struct - let child_struct = child_type_name(name, child_name); - let path_expr = syntax.path_expr("base_path", &format!("_{}", child_name)); + if child.is_leaf { + if let TreeNode::Leaf(leaf) = child.node { + generate_leaf_field( + output, + &syntax, + "client.clone()", + child.name, + leaf, + metadata, + " ", + ); + } + } else if child.should_inline { + // Inline struct + let path_expr = syntax.path_expr("base_path", &format!("_{}", child.name)); writeln!( output, " {}: {}::new(client.clone(), {}),", - field_name, child_struct, path_expr + field_name, child.inline_type_name, path_expr ) .unwrap(); - } else if let TreeNode::Leaf(leaf) = child_node { - // Leaf field - use shared helper - generate_leaf_field( + } else { + // Use pattern constructor + generate_tree_node_field( output, &syntax, - "client.clone()", - child_name, - leaf, + &child.field, metadata, " ", - ); - } else { - panic!( - "Field '{}' is a leaf with no TreeNode::Leaf. This shouldn't happen.", - field_info.name + child.name, + Some(&child.base_result.base), ); } } @@ -122,21 +112,17 @@ fn generate_tree_node( writeln!(output, " }}").unwrap(); writeln!(output, "}}\n").unwrap(); - for (child_name, child_node) in ctx.children { - if let TreeNode::Branch(grandchildren) = child_node { - let child_fields = get_node_fields(grandchildren, pattern_lookup); - // Generate child struct if no pattern match OR pattern is not parameterizable - if !metadata.is_parameterizable_fields(&child_fields) { - let child_struct = child_type_name(name, child_name); - generate_tree_node( - output, - &child_struct, - child_node, - pattern_lookup, - metadata, - generated, - ); - } + // Generate child structs + for child in &ctx.children { + if child.should_inline { + generate_tree_node( + output, + &child.inline_type_name, + child.node, + pattern_lookup, + metadata, + generated, + ); } } } diff --git a/crates/brk_cli/Cargo.toml b/crates/brk_cli/Cargo.toml index c599de8b0..1df37b08b 100644 --- a/crates/brk_cli/Cargo.toml +++ b/crates/brk_cli/Cargo.toml @@ -23,7 +23,7 @@ brk_rpc = { workspace = true } brk_server = { workspace = true } clap = { version = "4.5.54", features = ["derive", "string"] } color-eyre = { workspace = true } -importmap = "0.1.2" +importmap = "0.1.3" # importmap = { path = "../../../importmap" } tracing = { workspace = true } minreq = { workspace = true } diff --git a/crates/brk_cli/src/main.rs b/crates/brk_cli/src/main.rs index 80ff38d26..0a501866f 100644 --- a/crates/brk_cli/src/main.rs +++ b/crates/brk_cli/src/main.rs @@ -17,6 +17,7 @@ use brk_mempool::Mempool; use brk_query::AsyncQuery; use brk_reader::Reader; use brk_server::{Server, VERSION}; +use importmap::ImportMap; use tracing::info; use vecdb::Exit; @@ -85,25 +86,28 @@ pub fn run() -> color_eyre::Result<()> { let data_path = config.brkdir(); let future = async move { - let bundle_path = if website.is_some() { - // Try to find local dev directories - check cwd and parent directories - let find_dev_dirs = || -> Option<(PathBuf, PathBuf)> { - let mut dir = std::env::current_dir().ok()?; - loop { - let websites = dir.join("websites"); - let modules = dir.join("modules"); - if websites.exists() && modules.exists() { - return Some((websites, modules)); - } - // Stop at workspace root (crates/ indicates we're there) - if dir.join("crates").exists() { - return None; - } - dir = dir.parent()?.to_path_buf(); + // Try to find local dev directories - check cwd and parent directories + let find_dev_dirs = || -> Option<(PathBuf, PathBuf)> { + let mut dir = std::env::current_dir().ok()?; + loop { + let websites = dir.join("websites"); + let modules = dir.join("modules"); + if websites.exists() && modules.exists() { + return Some((websites, modules)); } - }; + // Stop at workspace root (crates/ indicates we're there) + if dir.join("crates").exists() { + return None; + } + dir = dir.parent()?.to_path_buf(); + } + }; - let websites_path = if let Some((websites, _modules)) = find_dev_dirs() { + let dev_dirs = find_dev_dirs(); + let is_dev = dev_dirs.is_some(); + + let bundle_path = if website.is_some() { + let websites_path = if let Some((websites, _modules)) = dev_dirs { websites } else { let downloaded_brk_path = downloads_path.join(format!("brk-{VERSION}")); @@ -133,19 +137,28 @@ pub fn run() -> color_eyre::Result<()> { None }; - // Generate import map for cache busting + // Generate import map for cache busting (disabled in dev mode) if let Some(ref path) = bundle_path { - match importmap::ImportMap::scan(path, "") { - Ok(map) => { - let html_path = path.join("index.html"); - if let Ok(html) = fs::read_to_string(&html_path) - && let Some(updated) = map.update_html(&html) - { - let _ = fs::write(&html_path, updated); - info!("Updated importmap in index.html"); + let map = if is_dev { + ImportMap::empty() + } else { + match ImportMap::scan(path, "") { + Ok(map) => map, + Err(e) => { + tracing::error!("Failed to generate importmap: {e}"); + ImportMap::empty() } } - Err(e) => tracing::error!("Failed to generate importmap: {e}"), + }; + + let html_path = path.join("index.html"); + if let Ok(html) = fs::read_to_string(&html_path) + && let Some(updated) = map.update_html(&html) + { + let _ = fs::write(&html_path, updated); + if !is_dev { + info!("Updated importmap in index.html"); + } } } diff --git a/crates/brk_client/examples/basic.rs b/crates/brk_client/examples/basic.rs index 93cbdc3be..1f2091a04 100644 --- a/crates/brk_client/examples/basic.rs +++ b/crates/brk_client/examples/basic.rs @@ -14,6 +14,7 @@ fn main() -> brk_client::Result<()> { }); // Fetch price data using the typed metrics API + // Using new idiomatic API: last(3).fetch() let price_close = client .metrics() .price @@ -22,8 +23,8 @@ fn main() -> brk_client::Result<()> { .close .by .dateindex() - .from(-3) - .json()?; + .last(3) + .fetch()?; println!("Last 3 price close values: {:?}", price_close); // Fetch block data @@ -35,12 +36,11 @@ fn main() -> brk_client::Result<()> { .sum .by .dateindex() - .from(-3) - .json()?; + .last(3) + .fetch()?; println!("Last 3 block count values: {:?}", block_count); // Fetch supply data - // dbg!( client .metrics() @@ -58,8 +58,8 @@ fn main() -> brk_client::Result<()> { .bitcoin .by .dateindex() - .from(-3) - .csv()?; + .last(3) + .fetch_csv()?; println!("Last 3 circulating supply values: {:?}", circulating); // Using generic metric fetching diff --git a/crates/brk_client/src/lib.rs b/crates/brk_client/src/lib.rs index cec625bad..2edc37786 100644 --- a/crates/brk_client/src/lib.rs +++ b/crates/brk_client/src/lib.rs @@ -7,10 +7,12 @@ #![allow(clippy::useless_format)] #![allow(clippy::unnecessary_to_owned)] +use std::sync::Arc; +use std::ops::{Bound, RangeBounds}; +use serde::de::DeserializeOwned; pub use brk_cohort::*; pub use brk_types::*; -use serde::de::DeserializeOwned; -use std::sync::Arc; + /// Error type for BRK client operations. #[derive(Debug)] @@ -75,9 +77,7 @@ impl BrkClientBase { let response = minreq::get(&url) .with_timeout(self.timeout_secs) .send() - .map_err(|e| BrkError { - message: e.to_string(), - })?; + .map_err(|e| BrkError { message: e.to_string() })?; if response.status_code >= 400 { return Err(BrkError { @@ -90,9 +90,9 @@ impl BrkClientBase { /// Make a GET request and deserialize JSON response. pub fn get_json(&self, path: &str) -> Result { - self.get(path)?.json().map_err(|e| BrkError { - message: e.to_string(), - }) + self.get(path)? + .json() + .map_err(|e| BrkError { message: e.to_string() }) } /// Make a GET request and return raw text response. @@ -100,22 +100,17 @@ impl BrkClientBase { self.get(path)? .as_str() .map(|s| s.to_string()) - .map_err(|e| BrkError { - message: e.to_string(), - }) + .map_err(|e| BrkError { message: e.to_string() }) } } /// Build metric name with optional prefix. #[inline] fn _m(acc: &str, s: &str) -> String { - if acc.is_empty() { - s.to_string() - } else { - format!("{acc}_{s}") - } + if acc.is_empty() { s.to_string() } else { format!("{acc}_{s}") } } + /// Non-generic trait for metric patterns (usable in collections). pub trait AnyMetricPattern { /// Get the metric name. @@ -131,6 +126,7 @@ pub trait MetricPattern: AnyMetricPattern { fn get(&self, index: Index) -> Option>; } + /// Shared endpoint configuration. #[derive(Clone)] struct EndpointConfig { @@ -143,13 +139,7 @@ struct EndpointConfig { impl EndpointConfig { fn new(client: Arc, name: Arc, index: Index) -> Self { - Self { - client, - name, - index, - start: None, - end: None, - } + Self { client, name, index, start: None, end: None } } fn path(&self) -> String { @@ -158,21 +148,11 @@ impl EndpointConfig { fn build_path(&self, format: Option<&str>) -> String { let mut params = Vec::new(); - if let Some(s) = self.start { - params.push(format!("start={}", s)); - } - if let Some(e) = self.end { - params.push(format!("end={}", e)); - } - if let Some(fmt) = format { - params.push(format!("format={}", fmt)); - } + if let Some(s) = self.start { params.push(format!("start={}", s)); } + if let Some(e) = self.end { params.push(format!("end={}", e)); } + if let Some(fmt) = format { params.push(format!("format={}", fmt)); } let p = self.path(); - if params.is_empty() { - p - } else { - format!("{}?{}", p, params.join("&")) - } + if params.is_empty() { p } else { format!("{}?{}", p, params.join("&")) } } fn get_json(&self, format: Option<&str>) -> Result { @@ -186,21 +166,30 @@ impl EndpointConfig { /// Initial builder for metric endpoint queries. /// -/// Use method chaining to specify the data range, then call `json()` or `csv()` to execute. +/// Use method chaining to specify the data range, then call `fetch()` or `fetch_csv()` to execute. /// /// # Examples /// ```ignore -/// // Get all data -/// endpoint.json()?; +/// // Fetch all data +/// let data = endpoint.fetch()?; /// -/// // Get last 10 points -/// endpoint.last(10).json()?; +/// // Get single item at index 5 +/// let data = endpoint.get(5).fetch()?; +/// +/// // Get first 10 using range +/// let data = endpoint.range(..10).fetch()?; /// /// // Get range [100, 200) -/// endpoint.range(100, 200).json()?; +/// let data = endpoint.range(100..200).fetch()?; /// -/// // Get 10 points starting from position 100 -/// endpoint.from(100).take(10).json()?; +/// // Get first 10 (convenience) +/// let data = endpoint.take(10).fetch()?; +/// +/// // Get last 10 +/// let data = endpoint.last(10).fetch()?; +/// +/// // Iterator-style chaining +/// let data = endpoint.skip(100).take(10).fetch()?; /// ``` pub struct MetricEndpointBuilder { config: EndpointConfig, @@ -209,65 +198,62 @@ pub struct MetricEndpointBuilder { impl MetricEndpointBuilder { pub fn new(client: Arc, name: Arc, index: Index) -> Self { - Self { - config: EndpointConfig::new(client, name, index), - _marker: std::marker::PhantomData, - } + Self { config: EndpointConfig::new(client, name, index), _marker: std::marker::PhantomData } } - /// Fetch the first n data points. - pub fn first(mut self, n: u64) -> RangeBuilder { - self.config.end = Some(n as i64); - RangeBuilder { - config: self.config, - _marker: std::marker::PhantomData, - } + /// Select a specific index position. + pub fn get(mut self, index: usize) -> SingleItemBuilder { + self.config.start = Some(index as i64); + self.config.end = Some(index as i64 + 1); + SingleItemBuilder { config: self.config, _marker: std::marker::PhantomData } } - /// Fetch the last n data points. - pub fn last(mut self, n: u64) -> RangeBuilder { + /// Select a range using Rust range syntax. + /// + /// # Examples + /// ```ignore + /// endpoint.range(..10) // first 10 + /// endpoint.range(100..110) // indices 100-109 + /// endpoint.range(100..) // from 100 to end + /// ``` + pub fn range>(mut self, range: R) -> RangeBuilder { + self.config.start = match range.start_bound() { + Bound::Included(&n) => Some(n as i64), + Bound::Excluded(&n) => Some(n as i64 + 1), + Bound::Unbounded => None, + }; + self.config.end = match range.end_bound() { + Bound::Included(&n) => Some(n as i64 + 1), + Bound::Excluded(&n) => Some(n as i64), + Bound::Unbounded => None, + }; + RangeBuilder { config: self.config, _marker: std::marker::PhantomData } + } + + /// Take the first n items. + pub fn take(self, n: usize) -> RangeBuilder { + self.range(..n) + } + + /// Take the last n items. + pub fn last(mut self, n: usize) -> RangeBuilder { self.config.start = Some(-(n as i64)); - RangeBuilder { - config: self.config, - _marker: std::marker::PhantomData, - } + RangeBuilder { config: self.config, _marker: std::marker::PhantomData } } - /// Set an explicit range [start, end). - pub fn range(mut self, start: i64, end: i64) -> RangeBuilder { - self.config.start = Some(start); - self.config.end = Some(end); - RangeBuilder { - config: self.config, - _marker: std::marker::PhantomData, - } + /// Skip the first n items. Chain with `take(n)` to get a range. + pub fn skip(mut self, n: usize) -> SkippedBuilder { + self.config.start = Some(n as i64); + SkippedBuilder { config: self.config, _marker: std::marker::PhantomData } } - /// Set the start position. Chain with `take(n)` or `to(end)`. - pub fn from(mut self, start: i64) -> FromBuilder { - self.config.start = Some(start); - FromBuilder { - config: self.config, - _marker: std::marker::PhantomData, - } - } - - /// Set the end position. Chain with `takeLast(n)` or `from(start)`. - pub fn to(mut self, end: i64) -> ToBuilder { - self.config.end = Some(end); - ToBuilder { - config: self.config, - _marker: std::marker::PhantomData, - } - } - - /// Execute the query and return parsed JSON data (all data). - pub fn json(self) -> Result> { + /// Fetch all data as parsed JSON. + pub fn fetch(self) -> Result> { self.config.get_json(None) } - /// Execute the query and return CSV data as a string (all data). - pub fn csv(self) -> Result { + /// Fetch all data as CSV string. + pub fn fetch_csv(self) -> Result { self.config.get_text(Some("csv")) } @@ -277,98 +263,68 @@ impl MetricEndpointBuilder { } } -/// Builder after calling `from(start)`. Can chain with `take(n)` or `to(end)`. -pub struct FromBuilder { +/// Builder for single item access. +pub struct SingleItemBuilder { config: EndpointConfig, _marker: std::marker::PhantomData, } -impl FromBuilder { - /// Take n items from the start position. - pub fn take(mut self, n: u64) -> RangeBuilder { +impl SingleItemBuilder { + /// Fetch the single item. + pub fn fetch(self) -> Result> { + self.config.get_json(None) + } + + /// Fetch the single item as CSV. + pub fn fetch_csv(self) -> Result { + self.config.get_text(Some("csv")) + } +} + +/// Builder after calling `skip(n)`. Chain with `take(n)` to specify count. +pub struct SkippedBuilder { + config: EndpointConfig, + _marker: std::marker::PhantomData, +} + +impl SkippedBuilder { + /// Take n items after the skipped position. + pub fn take(mut self, n: usize) -> RangeBuilder { let start = self.config.start.unwrap_or(0); self.config.end = Some(start + n as i64); - RangeBuilder { - config: self.config, - _marker: std::marker::PhantomData, - } + RangeBuilder { config: self.config, _marker: std::marker::PhantomData } } - /// Set the end position. - pub fn to(mut self, end: i64) -> RangeBuilder { - self.config.end = Some(end); - RangeBuilder { - config: self.config, - _marker: std::marker::PhantomData, - } - } - - /// Execute the query and return parsed JSON data (from start to end of data). - pub fn json(self) -> Result> { + /// Fetch from the skipped position to the end. + pub fn fetch(self) -> Result> { self.config.get_json(None) } - /// Execute the query and return CSV data as a string. - pub fn csv(self) -> Result { + /// Fetch from the skipped position to the end as CSV. + pub fn fetch_csv(self) -> Result { self.config.get_text(Some("csv")) } } -/// Builder after calling `to(end)`. Can chain with `takeLast(n)` or `from(start)`. -pub struct ToBuilder { - config: EndpointConfig, - _marker: std::marker::PhantomData, -} - -impl ToBuilder { - /// Take last n items before the end position. - pub fn take_last(mut self, n: u64) -> RangeBuilder { - let end = self.config.end.unwrap_or(0); - self.config.start = Some(end - n as i64); - RangeBuilder { - config: self.config, - _marker: std::marker::PhantomData, - } - } - - /// Set the start position. - pub fn from(mut self, start: i64) -> RangeBuilder { - self.config.start = Some(start); - RangeBuilder { - config: self.config, - _marker: std::marker::PhantomData, - } - } - - /// Execute the query and return parsed JSON data (from start of data to end). - pub fn json(self) -> Result> { - self.config.get_json(None) - } - - /// Execute the query and return CSV data as a string. - pub fn csv(self) -> Result { - self.config.get_text(Some("csv")) - } -} - -/// Final builder with range fully specified. Can only call `json()` or `csv()`. +/// Builder with range fully specified. pub struct RangeBuilder { config: EndpointConfig, _marker: std::marker::PhantomData, } impl RangeBuilder { - /// Execute the query and return parsed JSON data. - pub fn json(self) -> Result> { + /// Fetch the range as parsed JSON. + pub fn fetch(self) -> Result> { self.config.get_json(None) } - /// Execute the query and return CSV data as a string. - pub fn csv(self) -> Result { + /// Fetch the range as CSV string. + pub fn fetch_csv(self) -> Result { self.config.get_text(Some("csv")) } } + // Index accessor structs /// Container for index endpoint methods. @@ -386,11 +342,7 @@ impl MetricPattern1By { MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::DecadeIndex) } pub fn difficultyepoch(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new( - self.client.clone(), - self.name.clone(), - Index::DifficultyEpoch, - ) + MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::DifficultyEpoch) } pub fn height(&self) -> MetricEndpointBuilder { MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::Height) @@ -429,7 +381,7 @@ impl MetricPattern1 { client, name, _marker: std::marker::PhantomData, - }, + } } } @@ -491,11 +443,7 @@ impl MetricPattern2By { MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::DecadeIndex) } pub fn difficultyepoch(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new( - self.client.clone(), - self.name.clone(), - Index::DifficultyEpoch, - ) + MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::DifficultyEpoch) } pub fn monthindex(&self) -> MetricEndpointBuilder { MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::MonthIndex) @@ -531,7 +479,7 @@ impl MetricPattern2 { client, name, _marker: std::marker::PhantomData, - }, + } } } @@ -627,7 +575,7 @@ impl MetricPattern3 { client, name, _marker: std::marker::PhantomData, - }, + } } } @@ -720,7 +668,7 @@ impl MetricPattern4 { client, name, _marker: std::marker::PhantomData, - }, + } } } @@ -796,7 +744,7 @@ impl MetricPattern5 { client, name, _marker: std::marker::PhantomData, - }, + } } } @@ -812,7 +760,10 @@ impl AnyMetricPattern for MetricPattern5 { } fn indexes(&self) -> &'static [Index] { - &[Index::DateIndex, Index::Height] + &[ + Index::DateIndex, + Index::Height, + ] } } @@ -856,7 +807,7 @@ impl MetricPattern6 { client, name, _marker: std::marker::PhantomData, - }, + } } } @@ -872,7 +823,9 @@ impl AnyMetricPattern for MetricPattern6 { } fn indexes(&self) -> &'static [Index] { - &[Index::DateIndex] + &[ + Index::DateIndex, + ] } } @@ -915,7 +868,7 @@ impl MetricPattern7 { client, name, _marker: std::marker::PhantomData, - }, + } } } @@ -931,7 +884,9 @@ impl AnyMetricPattern for MetricPattern7 { } fn indexes(&self) -> &'static [Index] { - &[Index::DecadeIndex] + &[ + Index::DecadeIndex, + ] } } @@ -953,11 +908,7 @@ pub struct MetricPattern8By { impl MetricPattern8By { pub fn difficultyepoch(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new( - self.client.clone(), - self.name.clone(), - Index::DifficultyEpoch, - ) + MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::DifficultyEpoch) } } @@ -978,7 +929,7 @@ impl MetricPattern8 { client, name, _marker: std::marker::PhantomData, - }, + } } } @@ -994,7 +945,9 @@ impl AnyMetricPattern for MetricPattern8 { } fn indexes(&self) -> &'static [Index] { - &[Index::DifficultyEpoch] + &[ + Index::DifficultyEpoch, + ] } } @@ -1016,11 +969,7 @@ pub struct MetricPattern9By { impl MetricPattern9By { pub fn emptyoutputindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new( - self.client.clone(), - self.name.clone(), - Index::EmptyOutputIndex, - ) + MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::EmptyOutputIndex) } } @@ -1041,7 +990,7 @@ impl MetricPattern9 { client, name, _marker: std::marker::PhantomData, - }, + } } } @@ -1057,7 +1006,9 @@ impl AnyMetricPattern for MetricPattern9 { } fn indexes(&self) -> &'static [Index] { - &[Index::EmptyOutputIndex] + &[ + Index::EmptyOutputIndex, + ] } } @@ -1100,7 +1051,7 @@ impl MetricPattern10 { client, name, _marker: std::marker::PhantomData, - }, + } } } @@ -1116,7 +1067,9 @@ impl AnyMetricPattern for MetricPattern10 { } fn indexes(&self) -> &'static [Index] { - &[Index::HalvingEpoch] + &[ + Index::HalvingEpoch, + ] } } @@ -1159,7 +1112,7 @@ impl MetricPattern11 { client, name, _marker: std::marker::PhantomData, - }, + } } } @@ -1175,7 +1128,9 @@ impl AnyMetricPattern for MetricPattern11 { } fn indexes(&self) -> &'static [Index] { - &[Index::Height] + &[ + Index::Height, + ] } } @@ -1218,7 +1173,7 @@ impl MetricPattern12 { client, name, _marker: std::marker::PhantomData, - }, + } } } @@ -1234,7 +1189,9 @@ impl AnyMetricPattern for MetricPattern12 { } fn indexes(&self) -> &'static [Index] { - &[Index::TxInIndex] + &[ + Index::TxInIndex, + ] } } @@ -1277,7 +1234,7 @@ impl MetricPattern13 { client, name, _marker: std::marker::PhantomData, - }, + } } } @@ -1293,7 +1250,9 @@ impl AnyMetricPattern for MetricPattern13 { } fn indexes(&self) -> &'static [Index] { - &[Index::MonthIndex] + &[ + Index::MonthIndex, + ] } } @@ -1336,7 +1295,7 @@ impl MetricPattern14 { client, name, _marker: std::marker::PhantomData, - }, + } } } @@ -1352,7 +1311,9 @@ impl AnyMetricPattern for MetricPattern14 { } fn indexes(&self) -> &'static [Index] { - &[Index::OpReturnIndex] + &[ + Index::OpReturnIndex, + ] } } @@ -1395,7 +1356,7 @@ impl MetricPattern15 { client, name, _marker: std::marker::PhantomData, - }, + } } } @@ -1411,7 +1372,9 @@ impl AnyMetricPattern for MetricPattern15 { } fn indexes(&self) -> &'static [Index] { - &[Index::TxOutIndex] + &[ + Index::TxOutIndex, + ] } } @@ -1433,11 +1396,7 @@ pub struct MetricPattern16By { impl MetricPattern16By { pub fn p2aaddressindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new( - self.client.clone(), - self.name.clone(), - Index::P2AAddressIndex, - ) + MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::P2AAddressIndex) } } @@ -1458,7 +1417,7 @@ impl MetricPattern16 { client, name, _marker: std::marker::PhantomData, - }, + } } } @@ -1474,7 +1433,9 @@ impl AnyMetricPattern for MetricPattern16 { } fn indexes(&self) -> &'static [Index] { - &[Index::P2AAddressIndex] + &[ + Index::P2AAddressIndex, + ] } } @@ -1496,11 +1457,7 @@ pub struct MetricPattern17By { impl MetricPattern17By { pub fn p2msoutputindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new( - self.client.clone(), - self.name.clone(), - Index::P2MSOutputIndex, - ) + MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::P2MSOutputIndex) } } @@ -1521,7 +1478,7 @@ impl MetricPattern17 { client, name, _marker: std::marker::PhantomData, - }, + } } } @@ -1537,7 +1494,9 @@ impl AnyMetricPattern for MetricPattern17 { } fn indexes(&self) -> &'static [Index] { - &[Index::P2MSOutputIndex] + &[ + Index::P2MSOutputIndex, + ] } } @@ -1559,11 +1518,7 @@ pub struct MetricPattern18By { impl MetricPattern18By { pub fn p2pk33addressindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new( - self.client.clone(), - self.name.clone(), - Index::P2PK33AddressIndex, - ) + MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::P2PK33AddressIndex) } } @@ -1584,7 +1539,7 @@ impl MetricPattern18 { client, name, _marker: std::marker::PhantomData, - }, + } } } @@ -1600,7 +1555,9 @@ impl AnyMetricPattern for MetricPattern18 { } fn indexes(&self) -> &'static [Index] { - &[Index::P2PK33AddressIndex] + &[ + Index::P2PK33AddressIndex, + ] } } @@ -1622,11 +1579,7 @@ pub struct MetricPattern19By { impl MetricPattern19By { pub fn p2pk65addressindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new( - self.client.clone(), - self.name.clone(), - Index::P2PK65AddressIndex, - ) + MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::P2PK65AddressIndex) } } @@ -1647,7 +1600,7 @@ impl MetricPattern19 { client, name, _marker: std::marker::PhantomData, - }, + } } } @@ -1663,7 +1616,9 @@ impl AnyMetricPattern for MetricPattern19 { } fn indexes(&self) -> &'static [Index] { - &[Index::P2PK65AddressIndex] + &[ + Index::P2PK65AddressIndex, + ] } } @@ -1685,11 +1640,7 @@ pub struct MetricPattern20By { impl MetricPattern20By { pub fn p2pkhaddressindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new( - self.client.clone(), - self.name.clone(), - Index::P2PKHAddressIndex, - ) + MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::P2PKHAddressIndex) } } @@ -1710,7 +1661,7 @@ impl MetricPattern20 { client, name, _marker: std::marker::PhantomData, - }, + } } } @@ -1726,7 +1677,9 @@ impl AnyMetricPattern for MetricPattern20 { } fn indexes(&self) -> &'static [Index] { - &[Index::P2PKHAddressIndex] + &[ + Index::P2PKHAddressIndex, + ] } } @@ -1748,11 +1701,7 @@ pub struct MetricPattern21By { impl MetricPattern21By { pub fn p2shaddressindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new( - self.client.clone(), - self.name.clone(), - Index::P2SHAddressIndex, - ) + MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::P2SHAddressIndex) } } @@ -1773,7 +1722,7 @@ impl MetricPattern21 { client, name, _marker: std::marker::PhantomData, - }, + } } } @@ -1789,7 +1738,9 @@ impl AnyMetricPattern for MetricPattern21 { } fn indexes(&self) -> &'static [Index] { - &[Index::P2SHAddressIndex] + &[ + Index::P2SHAddressIndex, + ] } } @@ -1811,11 +1762,7 @@ pub struct MetricPattern22By { impl MetricPattern22By { pub fn p2traddressindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new( - self.client.clone(), - self.name.clone(), - Index::P2TRAddressIndex, - ) + MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::P2TRAddressIndex) } } @@ -1836,7 +1783,7 @@ impl MetricPattern22 { client, name, _marker: std::marker::PhantomData, - }, + } } } @@ -1852,7 +1799,9 @@ impl AnyMetricPattern for MetricPattern22 { } fn indexes(&self) -> &'static [Index] { - &[Index::P2TRAddressIndex] + &[ + Index::P2TRAddressIndex, + ] } } @@ -1874,11 +1823,7 @@ pub struct MetricPattern23By { impl MetricPattern23By { pub fn p2wpkhaddressindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new( - self.client.clone(), - self.name.clone(), - Index::P2WPKHAddressIndex, - ) + MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::P2WPKHAddressIndex) } } @@ -1899,7 +1844,7 @@ impl MetricPattern23 { client, name, _marker: std::marker::PhantomData, - }, + } } } @@ -1915,7 +1860,9 @@ impl AnyMetricPattern for MetricPattern23 { } fn indexes(&self) -> &'static [Index] { - &[Index::P2WPKHAddressIndex] + &[ + Index::P2WPKHAddressIndex, + ] } } @@ -1937,11 +1884,7 @@ pub struct MetricPattern24By { impl MetricPattern24By { pub fn p2wshaddressindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new( - self.client.clone(), - self.name.clone(), - Index::P2WSHAddressIndex, - ) + MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::P2WSHAddressIndex) } } @@ -1962,7 +1905,7 @@ impl MetricPattern24 { client, name, _marker: std::marker::PhantomData, - }, + } } } @@ -1978,7 +1921,9 @@ impl AnyMetricPattern for MetricPattern24 { } fn indexes(&self) -> &'static [Index] { - &[Index::P2WSHAddressIndex] + &[ + Index::P2WSHAddressIndex, + ] } } @@ -2021,7 +1966,7 @@ impl MetricPattern25 { client, name, _marker: std::marker::PhantomData, - }, + } } } @@ -2037,7 +1982,9 @@ impl AnyMetricPattern for MetricPattern25 { } fn indexes(&self) -> &'static [Index] { - &[Index::QuarterIndex] + &[ + Index::QuarterIndex, + ] } } @@ -2080,7 +2027,7 @@ impl MetricPattern26 { client, name, _marker: std::marker::PhantomData, - }, + } } } @@ -2096,7 +2043,9 @@ impl AnyMetricPattern for MetricPattern26 { } fn indexes(&self) -> &'static [Index] { - &[Index::SemesterIndex] + &[ + Index::SemesterIndex, + ] } } @@ -2139,7 +2088,7 @@ impl MetricPattern27 { client, name, _marker: std::marker::PhantomData, - }, + } } } @@ -2155,7 +2104,9 @@ impl AnyMetricPattern for MetricPattern27 { } fn indexes(&self) -> &'static [Index] { - &[Index::TxIndex] + &[ + Index::TxIndex, + ] } } @@ -2177,11 +2128,7 @@ pub struct MetricPattern28By { impl MetricPattern28By { pub fn unknownoutputindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new( - self.client.clone(), - self.name.clone(), - Index::UnknownOutputIndex, - ) + MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::UnknownOutputIndex) } } @@ -2202,7 +2149,7 @@ impl MetricPattern28 { client, name, _marker: std::marker::PhantomData, - }, + } } } @@ -2218,7 +2165,9 @@ impl AnyMetricPattern for MetricPattern28 { } fn indexes(&self) -> &'static [Index] { - &[Index::UnknownOutputIndex] + &[ + Index::UnknownOutputIndex, + ] } } @@ -2261,7 +2210,7 @@ impl MetricPattern29 { client, name, _marker: std::marker::PhantomData, - }, + } } } @@ -2277,7 +2226,9 @@ impl AnyMetricPattern for MetricPattern29 { } fn indexes(&self) -> &'static [Index] { - &[Index::WeekIndex] + &[ + Index::WeekIndex, + ] } } @@ -2320,7 +2271,7 @@ impl MetricPattern30 { client, name, _marker: std::marker::PhantomData, - }, + } } } @@ -2336,7 +2287,9 @@ impl AnyMetricPattern for MetricPattern30 { } fn indexes(&self) -> &'static [Index] { - &[Index::YearIndex] + &[ + Index::YearIndex, + ] } } @@ -2358,11 +2311,7 @@ pub struct MetricPattern31By { impl MetricPattern31By { pub fn loadedaddressindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new( - self.client.clone(), - self.name.clone(), - Index::LoadedAddressIndex, - ) + MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::LoadedAddressIndex) } } @@ -2383,7 +2332,7 @@ impl MetricPattern31 { client, name, _marker: std::marker::PhantomData, - }, + } } } @@ -2399,7 +2348,9 @@ impl AnyMetricPattern for MetricPattern31 { } fn indexes(&self) -> &'static [Index] { - &[Index::LoadedAddressIndex] + &[ + Index::LoadedAddressIndex, + ] } } @@ -2421,11 +2372,7 @@ pub struct MetricPattern32By { impl MetricPattern32By { pub fn emptyaddressindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new( - self.client.clone(), - self.name.clone(), - Index::EmptyAddressIndex, - ) + MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::EmptyAddressIndex) } } @@ -2446,7 +2393,7 @@ impl MetricPattern32 { client, name, _marker: std::marker::PhantomData, - }, + } } } @@ -2462,7 +2409,9 @@ impl AnyMetricPattern for MetricPattern32 { } fn indexes(&self) -> &'static [Index] { - &[Index::EmptyAddressIndex] + &[ + Index::EmptyAddressIndex, + ] } } @@ -2518,88 +2467,31 @@ impl RealizedPattern3 { pub fn new(client: Arc, acc: String) -> Self { Self { adjusted_sopr: MetricPattern6::new(client.clone(), _m(&acc, "adjusted_sopr")), - adjusted_sopr_30d_ema: MetricPattern6::new( - client.clone(), - _m(&acc, "adjusted_sopr_30d_ema"), - ), - adjusted_sopr_7d_ema: MetricPattern6::new( - client.clone(), - _m(&acc, "adjusted_sopr_7d_ema"), - ), - adjusted_value_created: MetricPattern1::new( - client.clone(), - _m(&acc, "adjusted_value_created"), - ), - adjusted_value_destroyed: MetricPattern1::new( - client.clone(), - _m(&acc, "adjusted_value_destroyed"), - ), + adjusted_sopr_30d_ema: MetricPattern6::new(client.clone(), _m(&acc, "adjusted_sopr_30d_ema")), + adjusted_sopr_7d_ema: MetricPattern6::new(client.clone(), _m(&acc, "adjusted_sopr_7d_ema")), + adjusted_value_created: MetricPattern1::new(client.clone(), _m(&acc, "adjusted_value_created")), + adjusted_value_destroyed: MetricPattern1::new(client.clone(), _m(&acc, "adjusted_value_destroyed")), mvrv: MetricPattern4::new(client.clone(), _m(&acc, "mvrv")), neg_realized_loss: BitcoinPattern::new(client.clone(), _m(&acc, "neg_realized_loss")), net_realized_pnl: BlockCountPattern::new(client.clone(), _m(&acc, "net_realized_pnl")), - net_realized_pnl_cumulative_30d_delta: MetricPattern4::new( - client.clone(), - _m(&acc, "net_realized_pnl_cumulative_30d_delta"), - ), - net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: MetricPattern4::new( - client.clone(), - _m( - &acc, - "net_realized_pnl_cumulative_30d_delta_rel_to_market_cap", - ), - ), - net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: MetricPattern4::new( - client.clone(), - _m( - &acc, - "net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap", - ), - ), - net_realized_pnl_rel_to_realized_cap: BlockCountPattern::new( - client.clone(), - _m(&acc, "net_realized_pnl_rel_to_realized_cap"), - ), + net_realized_pnl_cumulative_30d_delta: MetricPattern4::new(client.clone(), _m(&acc, "net_realized_pnl_cumulative_30d_delta")), + net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: MetricPattern4::new(client.clone(), _m(&acc, "net_realized_pnl_cumulative_30d_delta_rel_to_market_cap")), + net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: MetricPattern4::new(client.clone(), _m(&acc, "net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap")), + net_realized_pnl_rel_to_realized_cap: BlockCountPattern::new(client.clone(), _m(&acc, "net_realized_pnl_rel_to_realized_cap")), realized_cap: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap")), - realized_cap_30d_delta: MetricPattern4::new( - client.clone(), - _m(&acc, "realized_cap_30d_delta"), - ), - realized_cap_rel_to_own_market_cap: MetricPattern1::new( - client.clone(), - _m(&acc, "realized_cap_rel_to_own_market_cap"), - ), + realized_cap_30d_delta: MetricPattern4::new(client.clone(), _m(&acc, "realized_cap_30d_delta")), + realized_cap_rel_to_own_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap_rel_to_own_market_cap")), realized_loss: BlockCountPattern::new(client.clone(), _m(&acc, "realized_loss")), - realized_loss_rel_to_realized_cap: BlockCountPattern::new( - client.clone(), - _m(&acc, "realized_loss_rel_to_realized_cap"), - ), + realized_loss_rel_to_realized_cap: BlockCountPattern::new(client.clone(), _m(&acc, "realized_loss_rel_to_realized_cap")), realized_price: MetricPattern1::new(client.clone(), _m(&acc, "realized_price")), - realized_price_extra: ActivePriceRatioPattern::new( - client.clone(), - _m(&acc, "realized_price_ratio"), - ), + realized_price_extra: ActivePriceRatioPattern::new(client.clone(), _m(&acc, "realized_price_ratio")), realized_profit: BlockCountPattern::new(client.clone(), _m(&acc, "realized_profit")), - realized_profit_rel_to_realized_cap: BlockCountPattern::new( - client.clone(), - _m(&acc, "realized_profit_rel_to_realized_cap"), - ), - realized_profit_to_loss_ratio: MetricPattern6::new( - client.clone(), - _m(&acc, "realized_profit_to_loss_ratio"), - ), + realized_profit_rel_to_realized_cap: BlockCountPattern::new(client.clone(), _m(&acc, "realized_profit_rel_to_realized_cap")), + realized_profit_to_loss_ratio: MetricPattern6::new(client.clone(), _m(&acc, "realized_profit_to_loss_ratio")), realized_value: MetricPattern1::new(client.clone(), _m(&acc, "realized_value")), - sell_side_risk_ratio: MetricPattern6::new( - client.clone(), - _m(&acc, "sell_side_risk_ratio"), - ), - sell_side_risk_ratio_30d_ema: MetricPattern6::new( - client.clone(), - _m(&acc, "sell_side_risk_ratio_30d_ema"), - ), - sell_side_risk_ratio_7d_ema: MetricPattern6::new( - client.clone(), - _m(&acc, "sell_side_risk_ratio_7d_ema"), - ), + sell_side_risk_ratio: MetricPattern6::new(client.clone(), _m(&acc, "sell_side_risk_ratio")), + sell_side_risk_ratio_30d_ema: MetricPattern6::new(client.clone(), _m(&acc, "sell_side_risk_ratio_30d_ema")), + sell_side_risk_ratio_7d_ema: MetricPattern6::new(client.clone(), _m(&acc, "sell_side_risk_ratio_7d_ema")), sopr: MetricPattern6::new(client.clone(), _m(&acc, "sopr")), sopr_30d_ema: MetricPattern6::new(client.clone(), _m(&acc, "sopr_30d_ema")), sopr_7d_ema: MetricPattern6::new(client.clone(), _m(&acc, "sopr_7d_ema")), @@ -2649,80 +2541,29 @@ impl RealizedPattern4 { pub fn new(client: Arc, acc: String) -> Self { Self { adjusted_sopr: MetricPattern6::new(client.clone(), _m(&acc, "adjusted_sopr")), - adjusted_sopr_30d_ema: MetricPattern6::new( - client.clone(), - _m(&acc, "adjusted_sopr_30d_ema"), - ), - adjusted_sopr_7d_ema: MetricPattern6::new( - client.clone(), - _m(&acc, "adjusted_sopr_7d_ema"), - ), - adjusted_value_created: MetricPattern1::new( - client.clone(), - _m(&acc, "adjusted_value_created"), - ), - adjusted_value_destroyed: MetricPattern1::new( - client.clone(), - _m(&acc, "adjusted_value_destroyed"), - ), + adjusted_sopr_30d_ema: MetricPattern6::new(client.clone(), _m(&acc, "adjusted_sopr_30d_ema")), + adjusted_sopr_7d_ema: MetricPattern6::new(client.clone(), _m(&acc, "adjusted_sopr_7d_ema")), + adjusted_value_created: MetricPattern1::new(client.clone(), _m(&acc, "adjusted_value_created")), + adjusted_value_destroyed: MetricPattern1::new(client.clone(), _m(&acc, "adjusted_value_destroyed")), mvrv: MetricPattern4::new(client.clone(), _m(&acc, "mvrv")), neg_realized_loss: BitcoinPattern::new(client.clone(), _m(&acc, "neg_realized_loss")), net_realized_pnl: BlockCountPattern::new(client.clone(), _m(&acc, "net_realized_pnl")), - net_realized_pnl_cumulative_30d_delta: MetricPattern4::new( - client.clone(), - _m(&acc, "net_realized_pnl_cumulative_30d_delta"), - ), - net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: MetricPattern4::new( - client.clone(), - _m( - &acc, - "net_realized_pnl_cumulative_30d_delta_rel_to_market_cap", - ), - ), - net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: MetricPattern4::new( - client.clone(), - _m( - &acc, - "net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap", - ), - ), - net_realized_pnl_rel_to_realized_cap: BlockCountPattern::new( - client.clone(), - _m(&acc, "net_realized_pnl_rel_to_realized_cap"), - ), + net_realized_pnl_cumulative_30d_delta: MetricPattern4::new(client.clone(), _m(&acc, "net_realized_pnl_cumulative_30d_delta")), + net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: MetricPattern4::new(client.clone(), _m(&acc, "net_realized_pnl_cumulative_30d_delta_rel_to_market_cap")), + net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: MetricPattern4::new(client.clone(), _m(&acc, "net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap")), + net_realized_pnl_rel_to_realized_cap: BlockCountPattern::new(client.clone(), _m(&acc, "net_realized_pnl_rel_to_realized_cap")), realized_cap: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap")), - realized_cap_30d_delta: MetricPattern4::new( - client.clone(), - _m(&acc, "realized_cap_30d_delta"), - ), + realized_cap_30d_delta: MetricPattern4::new(client.clone(), _m(&acc, "realized_cap_30d_delta")), realized_loss: BlockCountPattern::new(client.clone(), _m(&acc, "realized_loss")), - realized_loss_rel_to_realized_cap: BlockCountPattern::new( - client.clone(), - _m(&acc, "realized_loss_rel_to_realized_cap"), - ), + realized_loss_rel_to_realized_cap: BlockCountPattern::new(client.clone(), _m(&acc, "realized_loss_rel_to_realized_cap")), realized_price: MetricPattern1::new(client.clone(), _m(&acc, "realized_price")), - realized_price_extra: RealizedPriceExtraPattern::new( - client.clone(), - _m(&acc, "realized_price"), - ), + realized_price_extra: RealizedPriceExtraPattern::new(client.clone(), _m(&acc, "realized_price")), realized_profit: BlockCountPattern::new(client.clone(), _m(&acc, "realized_profit")), - realized_profit_rel_to_realized_cap: BlockCountPattern::new( - client.clone(), - _m(&acc, "realized_profit_rel_to_realized_cap"), - ), + realized_profit_rel_to_realized_cap: BlockCountPattern::new(client.clone(), _m(&acc, "realized_profit_rel_to_realized_cap")), realized_value: MetricPattern1::new(client.clone(), _m(&acc, "realized_value")), - sell_side_risk_ratio: MetricPattern6::new( - client.clone(), - _m(&acc, "sell_side_risk_ratio"), - ), - sell_side_risk_ratio_30d_ema: MetricPattern6::new( - client.clone(), - _m(&acc, "sell_side_risk_ratio_30d_ema"), - ), - sell_side_risk_ratio_7d_ema: MetricPattern6::new( - client.clone(), - _m(&acc, "sell_side_risk_ratio_7d_ema"), - ), + sell_side_risk_ratio: MetricPattern6::new(client.clone(), _m(&acc, "sell_side_risk_ratio")), + sell_side_risk_ratio_30d_ema: MetricPattern6::new(client.clone(), _m(&acc, "sell_side_risk_ratio_30d_ema")), + sell_side_risk_ratio_7d_ema: MetricPattern6::new(client.clone(), _m(&acc, "sell_side_risk_ratio_7d_ema")), sopr: MetricPattern6::new(client.clone(), _m(&acc, "sopr")), sopr_30d_ema: MetricPattern6::new(client.clone(), _m(&acc, "sopr_30d_ema")), sopr_7d_ema: MetricPattern6::new(client.clone(), _m(&acc, "sopr_7d_ema")), @@ -2839,69 +2680,24 @@ impl RealizedPattern2 { mvrv: MetricPattern4::new(client.clone(), _m(&acc, "mvrv")), neg_realized_loss: BitcoinPattern::new(client.clone(), _m(&acc, "neg_realized_loss")), net_realized_pnl: BlockCountPattern::new(client.clone(), _m(&acc, "net_realized_pnl")), - net_realized_pnl_cumulative_30d_delta: MetricPattern4::new( - client.clone(), - _m(&acc, "net_realized_pnl_cumulative_30d_delta"), - ), - net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: MetricPattern4::new( - client.clone(), - _m( - &acc, - "net_realized_pnl_cumulative_30d_delta_rel_to_market_cap", - ), - ), - net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: MetricPattern4::new( - client.clone(), - _m( - &acc, - "net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap", - ), - ), - net_realized_pnl_rel_to_realized_cap: BlockCountPattern::new( - client.clone(), - _m(&acc, "net_realized_pnl_rel_to_realized_cap"), - ), + net_realized_pnl_cumulative_30d_delta: MetricPattern4::new(client.clone(), _m(&acc, "net_realized_pnl_cumulative_30d_delta")), + net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: MetricPattern4::new(client.clone(), _m(&acc, "net_realized_pnl_cumulative_30d_delta_rel_to_market_cap")), + net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: MetricPattern4::new(client.clone(), _m(&acc, "net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap")), + net_realized_pnl_rel_to_realized_cap: BlockCountPattern::new(client.clone(), _m(&acc, "net_realized_pnl_rel_to_realized_cap")), realized_cap: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap")), - realized_cap_30d_delta: MetricPattern4::new( - client.clone(), - _m(&acc, "realized_cap_30d_delta"), - ), - realized_cap_rel_to_own_market_cap: MetricPattern1::new( - client.clone(), - _m(&acc, "realized_cap_rel_to_own_market_cap"), - ), + realized_cap_30d_delta: MetricPattern4::new(client.clone(), _m(&acc, "realized_cap_30d_delta")), + realized_cap_rel_to_own_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap_rel_to_own_market_cap")), realized_loss: BlockCountPattern::new(client.clone(), _m(&acc, "realized_loss")), - realized_loss_rel_to_realized_cap: BlockCountPattern::new( - client.clone(), - _m(&acc, "realized_loss_rel_to_realized_cap"), - ), + realized_loss_rel_to_realized_cap: BlockCountPattern::new(client.clone(), _m(&acc, "realized_loss_rel_to_realized_cap")), realized_price: MetricPattern1::new(client.clone(), _m(&acc, "realized_price")), - realized_price_extra: ActivePriceRatioPattern::new( - client.clone(), - _m(&acc, "realized_price_ratio"), - ), + realized_price_extra: ActivePriceRatioPattern::new(client.clone(), _m(&acc, "realized_price_ratio")), realized_profit: BlockCountPattern::new(client.clone(), _m(&acc, "realized_profit")), - realized_profit_rel_to_realized_cap: BlockCountPattern::new( - client.clone(), - _m(&acc, "realized_profit_rel_to_realized_cap"), - ), - realized_profit_to_loss_ratio: MetricPattern6::new( - client.clone(), - _m(&acc, "realized_profit_to_loss_ratio"), - ), + realized_profit_rel_to_realized_cap: BlockCountPattern::new(client.clone(), _m(&acc, "realized_profit_rel_to_realized_cap")), + realized_profit_to_loss_ratio: MetricPattern6::new(client.clone(), _m(&acc, "realized_profit_to_loss_ratio")), realized_value: MetricPattern1::new(client.clone(), _m(&acc, "realized_value")), - sell_side_risk_ratio: MetricPattern6::new( - client.clone(), - _m(&acc, "sell_side_risk_ratio"), - ), - sell_side_risk_ratio_30d_ema: MetricPattern6::new( - client.clone(), - _m(&acc, "sell_side_risk_ratio_30d_ema"), - ), - sell_side_risk_ratio_7d_ema: MetricPattern6::new( - client.clone(), - _m(&acc, "sell_side_risk_ratio_7d_ema"), - ), + sell_side_risk_ratio: MetricPattern6::new(client.clone(), _m(&acc, "sell_side_risk_ratio")), + sell_side_risk_ratio_30d_ema: MetricPattern6::new(client.clone(), _m(&acc, "sell_side_risk_ratio_30d_ema")), + sell_side_risk_ratio_7d_ema: MetricPattern6::new(client.clone(), _m(&acc, "sell_side_risk_ratio_7d_ema")), sopr: MetricPattern6::new(client.clone(), _m(&acc, "sopr")), sopr_30d_ema: MetricPattern6::new(client.clone(), _m(&acc, "sopr_30d_ema")), sopr_7d_ema: MetricPattern6::new(client.clone(), _m(&acc, "sopr_7d_ema")), @@ -2948,61 +2744,22 @@ impl RealizedPattern { mvrv: MetricPattern4::new(client.clone(), _m(&acc, "mvrv")), neg_realized_loss: BitcoinPattern::new(client.clone(), _m(&acc, "neg_realized_loss")), net_realized_pnl: BlockCountPattern::new(client.clone(), _m(&acc, "net_realized_pnl")), - net_realized_pnl_cumulative_30d_delta: MetricPattern4::new( - client.clone(), - _m(&acc, "net_realized_pnl_cumulative_30d_delta"), - ), - net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: MetricPattern4::new( - client.clone(), - _m( - &acc, - "net_realized_pnl_cumulative_30d_delta_rel_to_market_cap", - ), - ), - net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: MetricPattern4::new( - client.clone(), - _m( - &acc, - "net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap", - ), - ), - net_realized_pnl_rel_to_realized_cap: BlockCountPattern::new( - client.clone(), - _m(&acc, "net_realized_pnl_rel_to_realized_cap"), - ), + net_realized_pnl_cumulative_30d_delta: MetricPattern4::new(client.clone(), _m(&acc, "net_realized_pnl_cumulative_30d_delta")), + net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: MetricPattern4::new(client.clone(), _m(&acc, "net_realized_pnl_cumulative_30d_delta_rel_to_market_cap")), + net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: MetricPattern4::new(client.clone(), _m(&acc, "net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap")), + net_realized_pnl_rel_to_realized_cap: BlockCountPattern::new(client.clone(), _m(&acc, "net_realized_pnl_rel_to_realized_cap")), realized_cap: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap")), - realized_cap_30d_delta: MetricPattern4::new( - client.clone(), - _m(&acc, "realized_cap_30d_delta"), - ), + realized_cap_30d_delta: MetricPattern4::new(client.clone(), _m(&acc, "realized_cap_30d_delta")), realized_loss: BlockCountPattern::new(client.clone(), _m(&acc, "realized_loss")), - realized_loss_rel_to_realized_cap: BlockCountPattern::new( - client.clone(), - _m(&acc, "realized_loss_rel_to_realized_cap"), - ), + realized_loss_rel_to_realized_cap: BlockCountPattern::new(client.clone(), _m(&acc, "realized_loss_rel_to_realized_cap")), realized_price: MetricPattern1::new(client.clone(), _m(&acc, "realized_price")), - realized_price_extra: RealizedPriceExtraPattern::new( - client.clone(), - _m(&acc, "realized_price"), - ), + realized_price_extra: RealizedPriceExtraPattern::new(client.clone(), _m(&acc, "realized_price")), realized_profit: BlockCountPattern::new(client.clone(), _m(&acc, "realized_profit")), - realized_profit_rel_to_realized_cap: BlockCountPattern::new( - client.clone(), - _m(&acc, "realized_profit_rel_to_realized_cap"), - ), + realized_profit_rel_to_realized_cap: BlockCountPattern::new(client.clone(), _m(&acc, "realized_profit_rel_to_realized_cap")), realized_value: MetricPattern1::new(client.clone(), _m(&acc, "realized_value")), - sell_side_risk_ratio: MetricPattern6::new( - client.clone(), - _m(&acc, "sell_side_risk_ratio"), - ), - sell_side_risk_ratio_30d_ema: MetricPattern6::new( - client.clone(), - _m(&acc, "sell_side_risk_ratio_30d_ema"), - ), - sell_side_risk_ratio_7d_ema: MetricPattern6::new( - client.clone(), - _m(&acc, "sell_side_risk_ratio_7d_ema"), - ), + sell_side_risk_ratio: MetricPattern6::new(client.clone(), _m(&acc, "sell_side_risk_ratio")), + sell_side_risk_ratio_30d_ema: MetricPattern6::new(client.clone(), _m(&acc, "sell_side_risk_ratio_30d_ema")), + sell_side_risk_ratio_7d_ema: MetricPattern6::new(client.clone(), _m(&acc, "sell_side_risk_ratio_7d_ema")), sopr: MetricPattern6::new(client.clone(), _m(&acc, "sopr")), sopr_30d_ema: MetricPattern6::new(client.clone(), _m(&acc, "sopr_30d_ema")), sopr_7d_ema: MetricPattern6::new(client.clone(), _m(&acc, "sopr_7d_ema")), @@ -3065,56 +2822,6 @@ impl Price111dSmaPattern { } } -/// Pattern struct for repeated tree structure. -pub struct PercentilesPattern { - pub cost_basis_pct05: MetricPattern4, - pub cost_basis_pct10: MetricPattern4, - pub cost_basis_pct15: MetricPattern4, - pub cost_basis_pct20: MetricPattern4, - pub cost_basis_pct25: MetricPattern4, - pub cost_basis_pct30: MetricPattern4, - pub cost_basis_pct35: MetricPattern4, - pub cost_basis_pct40: MetricPattern4, - pub cost_basis_pct45: MetricPattern4, - pub cost_basis_pct50: MetricPattern4, - pub cost_basis_pct55: MetricPattern4, - pub cost_basis_pct60: MetricPattern4, - pub cost_basis_pct65: MetricPattern4, - pub cost_basis_pct70: MetricPattern4, - pub cost_basis_pct75: MetricPattern4, - pub cost_basis_pct80: MetricPattern4, - pub cost_basis_pct85: MetricPattern4, - pub cost_basis_pct90: MetricPattern4, - pub cost_basis_pct95: MetricPattern4, -} - -impl PercentilesPattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - cost_basis_pct05: MetricPattern4::new(client.clone(), _m(&acc, "pct05")), - cost_basis_pct10: MetricPattern4::new(client.clone(), _m(&acc, "pct10")), - cost_basis_pct15: MetricPattern4::new(client.clone(), _m(&acc, "pct15")), - cost_basis_pct20: MetricPattern4::new(client.clone(), _m(&acc, "pct20")), - cost_basis_pct25: MetricPattern4::new(client.clone(), _m(&acc, "pct25")), - cost_basis_pct30: MetricPattern4::new(client.clone(), _m(&acc, "pct30")), - cost_basis_pct35: MetricPattern4::new(client.clone(), _m(&acc, "pct35")), - cost_basis_pct40: MetricPattern4::new(client.clone(), _m(&acc, "pct40")), - cost_basis_pct45: MetricPattern4::new(client.clone(), _m(&acc, "pct45")), - cost_basis_pct50: MetricPattern4::new(client.clone(), _m(&acc, "pct50")), - cost_basis_pct55: MetricPattern4::new(client.clone(), _m(&acc, "pct55")), - cost_basis_pct60: MetricPattern4::new(client.clone(), _m(&acc, "pct60")), - cost_basis_pct65: MetricPattern4::new(client.clone(), _m(&acc, "pct65")), - cost_basis_pct70: MetricPattern4::new(client.clone(), _m(&acc, "pct70")), - cost_basis_pct75: MetricPattern4::new(client.clone(), _m(&acc, "pct75")), - cost_basis_pct80: MetricPattern4::new(client.clone(), _m(&acc, "pct80")), - cost_basis_pct85: MetricPattern4::new(client.clone(), _m(&acc, "pct85")), - cost_basis_pct90: MetricPattern4::new(client.clone(), _m(&acc, "pct90")), - cost_basis_pct95: MetricPattern4::new(client.clone(), _m(&acc, "pct95")), - } - } -} - /// Pattern struct for repeated tree structure. pub struct ActivePriceRatioPattern { pub ratio: MetricPattern4, @@ -3165,6 +2872,56 @@ impl ActivePriceRatioPattern { } } +/// Pattern struct for repeated tree structure. +pub struct PercentilesPattern { + pub cost_basis_pct05: MetricPattern4, + pub cost_basis_pct10: MetricPattern4, + pub cost_basis_pct15: MetricPattern4, + pub cost_basis_pct20: MetricPattern4, + pub cost_basis_pct25: MetricPattern4, + pub cost_basis_pct30: MetricPattern4, + pub cost_basis_pct35: MetricPattern4, + pub cost_basis_pct40: MetricPattern4, + pub cost_basis_pct45: MetricPattern4, + pub cost_basis_pct50: MetricPattern4, + pub cost_basis_pct55: MetricPattern4, + pub cost_basis_pct60: MetricPattern4, + pub cost_basis_pct65: MetricPattern4, + pub cost_basis_pct70: MetricPattern4, + pub cost_basis_pct75: MetricPattern4, + pub cost_basis_pct80: MetricPattern4, + pub cost_basis_pct85: MetricPattern4, + pub cost_basis_pct90: MetricPattern4, + pub cost_basis_pct95: MetricPattern4, +} + +impl PercentilesPattern { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + cost_basis_pct05: MetricPattern4::new(client.clone(), _m(&acc, "pct05")), + cost_basis_pct10: MetricPattern4::new(client.clone(), _m(&acc, "pct10")), + cost_basis_pct15: MetricPattern4::new(client.clone(), _m(&acc, "pct15")), + cost_basis_pct20: MetricPattern4::new(client.clone(), _m(&acc, "pct20")), + cost_basis_pct25: MetricPattern4::new(client.clone(), _m(&acc, "pct25")), + cost_basis_pct30: MetricPattern4::new(client.clone(), _m(&acc, "pct30")), + cost_basis_pct35: MetricPattern4::new(client.clone(), _m(&acc, "pct35")), + cost_basis_pct40: MetricPattern4::new(client.clone(), _m(&acc, "pct40")), + cost_basis_pct45: MetricPattern4::new(client.clone(), _m(&acc, "pct45")), + cost_basis_pct50: MetricPattern4::new(client.clone(), _m(&acc, "pct50")), + cost_basis_pct55: MetricPattern4::new(client.clone(), _m(&acc, "pct55")), + cost_basis_pct60: MetricPattern4::new(client.clone(), _m(&acc, "pct60")), + cost_basis_pct65: MetricPattern4::new(client.clone(), _m(&acc, "pct65")), + cost_basis_pct70: MetricPattern4::new(client.clone(), _m(&acc, "pct70")), + cost_basis_pct75: MetricPattern4::new(client.clone(), _m(&acc, "pct75")), + cost_basis_pct80: MetricPattern4::new(client.clone(), _m(&acc, "pct80")), + cost_basis_pct85: MetricPattern4::new(client.clone(), _m(&acc, "pct85")), + cost_basis_pct90: MetricPattern4::new(client.clone(), _m(&acc, "pct90")), + cost_basis_pct95: MetricPattern4::new(client.clone(), _m(&acc, "pct95")), + } + } +} + /// Pattern struct for repeated tree structure. pub struct RelativePattern5 { pub neg_unrealized_loss_rel_to_market_cap: MetricPattern1, @@ -3191,75 +2948,24 @@ impl RelativePattern5 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - neg_unrealized_loss_rel_to_market_cap: MetricPattern1::new( - client.clone(), - _m(&acc, "neg_unrealized_loss_rel_to_market_cap"), - ), - neg_unrealized_loss_rel_to_own_market_cap: MetricPattern1::new( - client.clone(), - _m(&acc, "neg_unrealized_loss_rel_to_own_market_cap"), - ), - neg_unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1::new( - client.clone(), - _m(&acc, "neg_unrealized_loss_rel_to_own_total_unrealized_pnl"), - ), - net_unrealized_pnl_rel_to_market_cap: MetricPattern1::new( - client.clone(), - _m(&acc, "net_unrealized_pnl_rel_to_market_cap"), - ), - net_unrealized_pnl_rel_to_own_market_cap: MetricPattern1::new( - client.clone(), - _m(&acc, "net_unrealized_pnl_rel_to_own_market_cap"), - ), - net_unrealized_pnl_rel_to_own_total_unrealized_pnl: MetricPattern1::new( - client.clone(), - _m(&acc, "net_unrealized_pnl_rel_to_own_total_unrealized_pnl"), - ), + neg_unrealized_loss_rel_to_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "neg_unrealized_loss_rel_to_market_cap")), + neg_unrealized_loss_rel_to_own_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "neg_unrealized_loss_rel_to_own_market_cap")), + neg_unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "neg_unrealized_loss_rel_to_own_total_unrealized_pnl")), + net_unrealized_pnl_rel_to_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "net_unrealized_pnl_rel_to_market_cap")), + net_unrealized_pnl_rel_to_own_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "net_unrealized_pnl_rel_to_own_market_cap")), + net_unrealized_pnl_rel_to_own_total_unrealized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "net_unrealized_pnl_rel_to_own_total_unrealized_pnl")), nupl: MetricPattern1::new(client.clone(), _m(&acc, "nupl")), - supply_in_loss_rel_to_circulating_supply: MetricPattern1::new( - client.clone(), - _m(&acc, "supply_in_loss_rel_to_circulating_supply"), - ), - supply_in_loss_rel_to_own_supply: MetricPattern1::new( - client.clone(), - _m(&acc, "supply_in_loss_rel_to_own_supply"), - ), - supply_in_profit_rel_to_circulating_supply: MetricPattern1::new( - client.clone(), - _m(&acc, "supply_in_profit_rel_to_circulating_supply"), - ), - supply_in_profit_rel_to_own_supply: MetricPattern1::new( - client.clone(), - _m(&acc, "supply_in_profit_rel_to_own_supply"), - ), - supply_rel_to_circulating_supply: MetricPattern4::new( - client.clone(), - _m(&acc, "supply_rel_to_circulating_supply"), - ), - unrealized_loss_rel_to_market_cap: MetricPattern1::new( - client.clone(), - _m(&acc, "unrealized_loss_rel_to_market_cap"), - ), - unrealized_loss_rel_to_own_market_cap: MetricPattern1::new( - client.clone(), - _m(&acc, "unrealized_loss_rel_to_own_market_cap"), - ), - unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1::new( - client.clone(), - _m(&acc, "unrealized_loss_rel_to_own_total_unrealized_pnl"), - ), - unrealized_profit_rel_to_market_cap: MetricPattern1::new( - client.clone(), - _m(&acc, "unrealized_profit_rel_to_market_cap"), - ), - unrealized_profit_rel_to_own_market_cap: MetricPattern1::new( - client.clone(), - _m(&acc, "unrealized_profit_rel_to_own_market_cap"), - ), - unrealized_profit_rel_to_own_total_unrealized_pnl: MetricPattern1::new( - client.clone(), - _m(&acc, "unrealized_profit_rel_to_own_total_unrealized_pnl"), - ), + supply_in_loss_rel_to_circulating_supply: MetricPattern1::new(client.clone(), _m(&acc, "supply_in_loss_rel_to_circulating_supply")), + supply_in_loss_rel_to_own_supply: MetricPattern1::new(client.clone(), _m(&acc, "supply_in_loss_rel_to_own_supply")), + supply_in_profit_rel_to_circulating_supply: MetricPattern1::new(client.clone(), _m(&acc, "supply_in_profit_rel_to_circulating_supply")), + supply_in_profit_rel_to_own_supply: MetricPattern1::new(client.clone(), _m(&acc, "supply_in_profit_rel_to_own_supply")), + supply_rel_to_circulating_supply: MetricPattern4::new(client.clone(), _m(&acc, "supply_rel_to_circulating_supply")), + unrealized_loss_rel_to_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_loss_rel_to_market_cap")), + unrealized_loss_rel_to_own_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_loss_rel_to_own_market_cap")), + unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_loss_rel_to_own_total_unrealized_pnl")), + unrealized_profit_rel_to_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_profit_rel_to_market_cap")), + unrealized_profit_rel_to_own_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_profit_rel_to_own_market_cap")), + unrealized_profit_rel_to_own_total_unrealized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_profit_rel_to_own_total_unrealized_pnl")), } } } @@ -3361,102 +3067,18 @@ impl PeriodLumpSumStackPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - _10y: _2015Pattern::new( - client.clone(), - if acc.is_empty() { - "10y".to_string() - } else { - format!("10y_{acc}") - }, - ), - _1m: _2015Pattern::new( - client.clone(), - if acc.is_empty() { - "1m".to_string() - } else { - format!("1m_{acc}") - }, - ), - _1w: _2015Pattern::new( - client.clone(), - if acc.is_empty() { - "1w".to_string() - } else { - format!("1w_{acc}") - }, - ), - _1y: _2015Pattern::new( - client.clone(), - if acc.is_empty() { - "1y".to_string() - } else { - format!("1y_{acc}") - }, - ), - _2y: _2015Pattern::new( - client.clone(), - if acc.is_empty() { - "2y".to_string() - } else { - format!("2y_{acc}") - }, - ), - _3m: _2015Pattern::new( - client.clone(), - if acc.is_empty() { - "3m".to_string() - } else { - format!("3m_{acc}") - }, - ), - _3y: _2015Pattern::new( - client.clone(), - if acc.is_empty() { - "3y".to_string() - } else { - format!("3y_{acc}") - }, - ), - _4y: _2015Pattern::new( - client.clone(), - if acc.is_empty() { - "4y".to_string() - } else { - format!("4y_{acc}") - }, - ), - _5y: _2015Pattern::new( - client.clone(), - if acc.is_empty() { - "5y".to_string() - } else { - format!("5y_{acc}") - }, - ), - _6m: _2015Pattern::new( - client.clone(), - if acc.is_empty() { - "6m".to_string() - } else { - format!("6m_{acc}") - }, - ), - _6y: _2015Pattern::new( - client.clone(), - if acc.is_empty() { - "6y".to_string() - } else { - format!("6y_{acc}") - }, - ), - _8y: _2015Pattern::new( - client.clone(), - if acc.is_empty() { - "8y".to_string() - } else { - format!("8y_{acc}") - }, - ), + _10y: _2015Pattern::new(client.clone(), if acc.is_empty() { "10y".to_string() } else { format!("10y_{acc}") }), + _1m: _2015Pattern::new(client.clone(), if acc.is_empty() { "1m".to_string() } else { format!("1m_{acc}") }), + _1w: _2015Pattern::new(client.clone(), if acc.is_empty() { "1w".to_string() } else { format!("1w_{acc}") }), + _1y: _2015Pattern::new(client.clone(), if acc.is_empty() { "1y".to_string() } else { format!("1y_{acc}") }), + _2y: _2015Pattern::new(client.clone(), if acc.is_empty() { "2y".to_string() } else { format!("2y_{acc}") }), + _3m: _2015Pattern::new(client.clone(), if acc.is_empty() { "3m".to_string() } else { format!("3m_{acc}") }), + _3y: _2015Pattern::new(client.clone(), if acc.is_empty() { "3y".to_string() } else { format!("3y_{acc}") }), + _4y: _2015Pattern::new(client.clone(), if acc.is_empty() { "4y".to_string() } else { format!("4y_{acc}") }), + _5y: _2015Pattern::new(client.clone(), if acc.is_empty() { "5y".to_string() } else { format!("5y_{acc}") }), + _6m: _2015Pattern::new(client.clone(), if acc.is_empty() { "6m".to_string() } else { format!("6m_{acc}") }), + _6y: _2015Pattern::new(client.clone(), if acc.is_empty() { "6y".to_string() } else { format!("6y_{acc}") }), + _8y: _2015Pattern::new(client.clone(), if acc.is_empty() { "8y".to_string() } else { format!("8y_{acc}") }), } } } @@ -3481,102 +3103,52 @@ impl PeriodAveragePricePattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - _10y: MetricPattern4::new( - client.clone(), - if acc.is_empty() { - "10y".to_string() - } else { - format!("10y_{acc}") - }, - ), - _1m: MetricPattern4::new( - client.clone(), - if acc.is_empty() { - "1m".to_string() - } else { - format!("1m_{acc}") - }, - ), - _1w: MetricPattern4::new( - client.clone(), - if acc.is_empty() { - "1w".to_string() - } else { - format!("1w_{acc}") - }, - ), - _1y: MetricPattern4::new( - client.clone(), - if acc.is_empty() { - "1y".to_string() - } else { - format!("1y_{acc}") - }, - ), - _2y: MetricPattern4::new( - client.clone(), - if acc.is_empty() { - "2y".to_string() - } else { - format!("2y_{acc}") - }, - ), - _3m: MetricPattern4::new( - client.clone(), - if acc.is_empty() { - "3m".to_string() - } else { - format!("3m_{acc}") - }, - ), - _3y: MetricPattern4::new( - client.clone(), - if acc.is_empty() { - "3y".to_string() - } else { - format!("3y_{acc}") - }, - ), - _4y: MetricPattern4::new( - client.clone(), - if acc.is_empty() { - "4y".to_string() - } else { - format!("4y_{acc}") - }, - ), - _5y: MetricPattern4::new( - client.clone(), - if acc.is_empty() { - "5y".to_string() - } else { - format!("5y_{acc}") - }, - ), - _6m: MetricPattern4::new( - client.clone(), - if acc.is_empty() { - "6m".to_string() - } else { - format!("6m_{acc}") - }, - ), - _6y: MetricPattern4::new( - client.clone(), - if acc.is_empty() { - "6y".to_string() - } else { - format!("6y_{acc}") - }, - ), - _8y: MetricPattern4::new( - client.clone(), - if acc.is_empty() { - "8y".to_string() - } else { - format!("8y_{acc}") - }, - ), + _10y: MetricPattern4::new(client.clone(), if acc.is_empty() { "10y".to_string() } else { format!("10y_{acc}") }), + _1m: MetricPattern4::new(client.clone(), if acc.is_empty() { "1m".to_string() } else { format!("1m_{acc}") }), + _1w: MetricPattern4::new(client.clone(), if acc.is_empty() { "1w".to_string() } else { format!("1w_{acc}") }), + _1y: MetricPattern4::new(client.clone(), if acc.is_empty() { "1y".to_string() } else { format!("1y_{acc}") }), + _2y: MetricPattern4::new(client.clone(), if acc.is_empty() { "2y".to_string() } else { format!("2y_{acc}") }), + _3m: MetricPattern4::new(client.clone(), if acc.is_empty() { "3m".to_string() } else { format!("3m_{acc}") }), + _3y: MetricPattern4::new(client.clone(), if acc.is_empty() { "3y".to_string() } else { format!("3y_{acc}") }), + _4y: MetricPattern4::new(client.clone(), if acc.is_empty() { "4y".to_string() } else { format!("4y_{acc}") }), + _5y: MetricPattern4::new(client.clone(), if acc.is_empty() { "5y".to_string() } else { format!("5y_{acc}") }), + _6m: MetricPattern4::new(client.clone(), if acc.is_empty() { "6m".to_string() } else { format!("6m_{acc}") }), + _6y: MetricPattern4::new(client.clone(), if acc.is_empty() { "6y".to_string() } else { format!("6y_{acc}") }), + _8y: MetricPattern4::new(client.clone(), if acc.is_empty() { "8y".to_string() } else { format!("8y_{acc}") }), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct FullnessPattern { + pub average: MetricPattern2, + pub base: MetricPattern11, + pub cumulative: MetricPattern2, + pub max: MetricPattern2, + pub median: MetricPattern6, + pub min: MetricPattern2, + pub pct10: MetricPattern6, + pub pct25: MetricPattern6, + pub pct75: MetricPattern6, + pub pct90: MetricPattern6, + pub sum: MetricPattern2, +} + +impl FullnessPattern { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + average: MetricPattern2::new(client.clone(), _m(&acc, "average")), + base: MetricPattern11::new(client.clone(), acc.clone()), + cumulative: MetricPattern2::new(client.clone(), _m(&acc, "cumulative")), + max: MetricPattern2::new(client.clone(), _m(&acc, "max")), + median: MetricPattern6::new(client.clone(), _m(&acc, "median")), + min: MetricPattern2::new(client.clone(), _m(&acc, "min")), + pct10: MetricPattern6::new(client.clone(), _m(&acc, "pct10")), + pct25: MetricPattern6::new(client.clone(), _m(&acc, "pct25")), + pct75: MetricPattern6::new(client.clone(), _m(&acc, "pct75")), + pct90: MetricPattern6::new(client.clone(), _m(&acc, "pct90")), + sum: MetricPattern2::new(client.clone(), _m(&acc, "sum")), } } } @@ -3648,40 +3220,6 @@ impl DollarsPattern { } } -/// Pattern struct for repeated tree structure. -pub struct FullnessPattern { - pub average: MetricPattern2, - pub base: MetricPattern11, - pub cumulative: MetricPattern2, - pub max: MetricPattern2, - pub median: MetricPattern6, - pub min: MetricPattern2, - pub pct10: MetricPattern6, - pub pct25: MetricPattern6, - pub pct75: MetricPattern6, - pub pct90: MetricPattern6, - pub sum: MetricPattern2, -} - -impl FullnessPattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - average: MetricPattern2::new(client.clone(), _m(&acc, "average")), - base: MetricPattern11::new(client.clone(), acc.clone()), - cumulative: MetricPattern2::new(client.clone(), _m(&acc, "cumulative")), - max: MetricPattern2::new(client.clone(), _m(&acc, "max")), - median: MetricPattern6::new(client.clone(), _m(&acc, "median")), - min: MetricPattern2::new(client.clone(), _m(&acc, "min")), - pct10: MetricPattern6::new(client.clone(), _m(&acc, "pct10")), - pct25: MetricPattern6::new(client.clone(), _m(&acc, "pct25")), - pct75: MetricPattern6::new(client.clone(), _m(&acc, "pct75")), - pct90: MetricPattern6::new(client.clone(), _m(&acc, "pct90")), - sum: MetricPattern2::new(client.clone(), _m(&acc, "sum")), - } - } -} - /// Pattern struct for repeated tree structure. pub struct RelativePattern { pub neg_unrealized_loss_rel_to_market_cap: MetricPattern1, @@ -3700,43 +3238,16 @@ impl RelativePattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - neg_unrealized_loss_rel_to_market_cap: MetricPattern1::new( - client.clone(), - _m(&acc, "neg_unrealized_loss_rel_to_market_cap"), - ), - net_unrealized_pnl_rel_to_market_cap: MetricPattern1::new( - client.clone(), - _m(&acc, "net_unrealized_pnl_rel_to_market_cap"), - ), + neg_unrealized_loss_rel_to_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "neg_unrealized_loss_rel_to_market_cap")), + net_unrealized_pnl_rel_to_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "net_unrealized_pnl_rel_to_market_cap")), nupl: MetricPattern1::new(client.clone(), _m(&acc, "nupl")), - supply_in_loss_rel_to_circulating_supply: MetricPattern1::new( - client.clone(), - _m(&acc, "supply_in_loss_rel_to_circulating_supply"), - ), - supply_in_loss_rel_to_own_supply: MetricPattern1::new( - client.clone(), - _m(&acc, "supply_in_loss_rel_to_own_supply"), - ), - supply_in_profit_rel_to_circulating_supply: MetricPattern1::new( - client.clone(), - _m(&acc, "supply_in_profit_rel_to_circulating_supply"), - ), - supply_in_profit_rel_to_own_supply: MetricPattern1::new( - client.clone(), - _m(&acc, "supply_in_profit_rel_to_own_supply"), - ), - supply_rel_to_circulating_supply: MetricPattern4::new( - client.clone(), - _m(&acc, "supply_rel_to_circulating_supply"), - ), - unrealized_loss_rel_to_market_cap: MetricPattern1::new( - client.clone(), - _m(&acc, "unrealized_loss_rel_to_market_cap"), - ), - unrealized_profit_rel_to_market_cap: MetricPattern1::new( - client.clone(), - _m(&acc, "unrealized_profit_rel_to_market_cap"), - ), + supply_in_loss_rel_to_circulating_supply: MetricPattern1::new(client.clone(), _m(&acc, "supply_in_loss_rel_to_circulating_supply")), + supply_in_loss_rel_to_own_supply: MetricPattern1::new(client.clone(), _m(&acc, "supply_in_loss_rel_to_own_supply")), + supply_in_profit_rel_to_circulating_supply: MetricPattern1::new(client.clone(), _m(&acc, "supply_in_profit_rel_to_circulating_supply")), + supply_in_profit_rel_to_own_supply: MetricPattern1::new(client.clone(), _m(&acc, "supply_in_profit_rel_to_own_supply")), + supply_rel_to_circulating_supply: MetricPattern4::new(client.clone(), _m(&acc, "supply_rel_to_circulating_supply")), + unrealized_loss_rel_to_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_loss_rel_to_market_cap")), + unrealized_profit_rel_to_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_profit_rel_to_market_cap")), } } } @@ -3759,46 +3270,16 @@ impl RelativePattern2 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - neg_unrealized_loss_rel_to_own_market_cap: MetricPattern1::new( - client.clone(), - _m(&acc, "neg_unrealized_loss_rel_to_own_market_cap"), - ), - neg_unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1::new( - client.clone(), - _m(&acc, "neg_unrealized_loss_rel_to_own_total_unrealized_pnl"), - ), - net_unrealized_pnl_rel_to_own_market_cap: MetricPattern1::new( - client.clone(), - _m(&acc, "net_unrealized_pnl_rel_to_own_market_cap"), - ), - net_unrealized_pnl_rel_to_own_total_unrealized_pnl: MetricPattern1::new( - client.clone(), - _m(&acc, "net_unrealized_pnl_rel_to_own_total_unrealized_pnl"), - ), - supply_in_loss_rel_to_own_supply: MetricPattern1::new( - client.clone(), - _m(&acc, "supply_in_loss_rel_to_own_supply"), - ), - supply_in_profit_rel_to_own_supply: MetricPattern1::new( - client.clone(), - _m(&acc, "supply_in_profit_rel_to_own_supply"), - ), - unrealized_loss_rel_to_own_market_cap: MetricPattern1::new( - client.clone(), - _m(&acc, "unrealized_loss_rel_to_own_market_cap"), - ), - unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1::new( - client.clone(), - _m(&acc, "unrealized_loss_rel_to_own_total_unrealized_pnl"), - ), - unrealized_profit_rel_to_own_market_cap: MetricPattern1::new( - client.clone(), - _m(&acc, "unrealized_profit_rel_to_own_market_cap"), - ), - unrealized_profit_rel_to_own_total_unrealized_pnl: MetricPattern1::new( - client.clone(), - _m(&acc, "unrealized_profit_rel_to_own_total_unrealized_pnl"), - ), + neg_unrealized_loss_rel_to_own_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "neg_unrealized_loss_rel_to_own_market_cap")), + neg_unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "neg_unrealized_loss_rel_to_own_total_unrealized_pnl")), + net_unrealized_pnl_rel_to_own_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "net_unrealized_pnl_rel_to_own_market_cap")), + net_unrealized_pnl_rel_to_own_total_unrealized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "net_unrealized_pnl_rel_to_own_total_unrealized_pnl")), + supply_in_loss_rel_to_own_supply: MetricPattern1::new(client.clone(), _m(&acc, "supply_in_loss_rel_to_own_supply")), + supply_in_profit_rel_to_own_supply: MetricPattern1::new(client.clone(), _m(&acc, "supply_in_profit_rel_to_own_supply")), + unrealized_loss_rel_to_own_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_loss_rel_to_own_market_cap")), + unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_loss_rel_to_own_total_unrealized_pnl")), + unrealized_profit_rel_to_own_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_profit_rel_to_own_market_cap")), + unrealized_profit_rel_to_own_total_unrealized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_profit_rel_to_own_total_unrealized_pnl")), } } } @@ -3922,6 +3403,32 @@ impl _0satsPattern { } } +/// Pattern struct for repeated tree structure. +pub struct _10yPattern { + pub activity: ActivityPattern2, + pub cost_basis: CostBasisPattern, + pub outputs: OutputsPattern, + pub realized: RealizedPattern4, + pub relative: RelativePattern, + pub supply: SupplyPattern2, + pub unrealized: UnrealizedPattern, +} + +impl _10yPattern { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + activity: ActivityPattern2::new(client.clone(), acc.clone()), + cost_basis: CostBasisPattern::new(client.clone(), acc.clone()), + outputs: OutputsPattern::new(client.clone(), acc.clone()), + realized: RealizedPattern4::new(client.clone(), acc.clone()), + relative: RelativePattern::new(client.clone(), acc.clone()), + supply: SupplyPattern2::new(client.clone(), _m(&acc, "supply")), + unrealized: UnrealizedPattern::new(client.clone(), acc.clone()), + } + } +} + /// Pattern struct for repeated tree structure. pub struct _10yTo12yPattern { pub activity: ActivityPattern2, @@ -3948,6 +3455,58 @@ impl _10yTo12yPattern { } } +/// Pattern struct for repeated tree structure. +pub struct PeriodCagrPattern { + pub _10y: MetricPattern4, + pub _2y: MetricPattern4, + pub _3y: MetricPattern4, + pub _4y: MetricPattern4, + pub _5y: MetricPattern4, + pub _6y: MetricPattern4, + pub _8y: MetricPattern4, +} + +impl PeriodCagrPattern { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + _10y: MetricPattern4::new(client.clone(), if acc.is_empty() { "10y".to_string() } else { format!("10y_{acc}") }), + _2y: MetricPattern4::new(client.clone(), if acc.is_empty() { "2y".to_string() } else { format!("2y_{acc}") }), + _3y: MetricPattern4::new(client.clone(), if acc.is_empty() { "3y".to_string() } else { format!("3y_{acc}") }), + _4y: MetricPattern4::new(client.clone(), if acc.is_empty() { "4y".to_string() } else { format!("4y_{acc}") }), + _5y: MetricPattern4::new(client.clone(), if acc.is_empty() { "5y".to_string() } else { format!("5y_{acc}") }), + _6y: MetricPattern4::new(client.clone(), if acc.is_empty() { "6y".to_string() } else { format!("6y_{acc}") }), + _8y: MetricPattern4::new(client.clone(), if acc.is_empty() { "8y".to_string() } else { format!("8y_{acc}") }), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct _100btcPattern { + pub activity: ActivityPattern2, + pub cost_basis: CostBasisPattern, + pub outputs: OutputsPattern, + pub realized: RealizedPattern, + pub relative: RelativePattern, + pub supply: SupplyPattern2, + pub unrealized: UnrealizedPattern, +} + +impl _100btcPattern { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + activity: ActivityPattern2::new(client.clone(), acc.clone()), + cost_basis: CostBasisPattern::new(client.clone(), acc.clone()), + outputs: OutputsPattern::new(client.clone(), acc.clone()), + realized: RealizedPattern::new(client.clone(), acc.clone()), + relative: RelativePattern::new(client.clone(), acc.clone()), + supply: SupplyPattern2::new(client.clone(), _m(&acc, "supply")), + unrealized: UnrealizedPattern::new(client.clone(), acc.clone()), + } + } +} + /// Pattern struct for repeated tree structure. pub struct _0satsPattern2 { pub activity: ActivityPattern2, @@ -3974,58 +3533,6 @@ impl _0satsPattern2 { } } -/// Pattern struct for repeated tree structure. -pub struct _100btcPattern { - pub activity: ActivityPattern2, - pub cost_basis: CostBasisPattern, - pub outputs: OutputsPattern, - pub realized: RealizedPattern, - pub relative: RelativePattern, - pub supply: SupplyPattern2, - pub unrealized: UnrealizedPattern, -} - -impl _100btcPattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - activity: ActivityPattern2::new(client.clone(), acc.clone()), - cost_basis: CostBasisPattern::new(client.clone(), acc.clone()), - outputs: OutputsPattern::new(client.clone(), acc.clone()), - realized: RealizedPattern::new(client.clone(), acc.clone()), - relative: RelativePattern::new(client.clone(), acc.clone()), - supply: SupplyPattern2::new(client.clone(), _m(&acc, "supply")), - unrealized: UnrealizedPattern::new(client.clone(), acc.clone()), - } - } -} - -/// Pattern struct for repeated tree structure. -pub struct _10yPattern { - pub activity: ActivityPattern2, - pub cost_basis: CostBasisPattern, - pub outputs: OutputsPattern, - pub realized: RealizedPattern4, - pub relative: RelativePattern, - pub supply: SupplyPattern2, - pub unrealized: UnrealizedPattern, -} - -impl _10yPattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - activity: ActivityPattern2::new(client.clone(), acc.clone()), - cost_basis: CostBasisPattern::new(client.clone(), acc.clone()), - outputs: OutputsPattern::new(client.clone(), acc.clone()), - realized: RealizedPattern4::new(client.clone(), acc.clone()), - relative: RelativePattern::new(client.clone(), acc.clone()), - supply: SupplyPattern2::new(client.clone(), _m(&acc, "supply")), - unrealized: UnrealizedPattern::new(client.clone(), acc.clone()), - } - } -} - /// Pattern struct for repeated tree structure. pub struct UnrealizedPattern { pub neg_unrealized_loss: MetricPattern1, @@ -4041,101 +3548,17 @@ impl UnrealizedPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - neg_unrealized_loss: MetricPattern1::new( - client.clone(), - _m(&acc, "neg_unrealized_loss"), - ), + neg_unrealized_loss: MetricPattern1::new(client.clone(), _m(&acc, "neg_unrealized_loss")), net_unrealized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "net_unrealized_pnl")), supply_in_loss: ActiveSupplyPattern::new(client.clone(), _m(&acc, "supply_in_loss")), - supply_in_profit: ActiveSupplyPattern::new( - client.clone(), - _m(&acc, "supply_in_profit"), - ), - total_unrealized_pnl: MetricPattern1::new( - client.clone(), - _m(&acc, "total_unrealized_pnl"), - ), + supply_in_profit: ActiveSupplyPattern::new(client.clone(), _m(&acc, "supply_in_profit")), + total_unrealized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "total_unrealized_pnl")), unrealized_loss: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_loss")), unrealized_profit: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_profit")), } } } -/// Pattern struct for repeated tree structure. -pub struct PeriodCagrPattern { - pub _10y: MetricPattern4, - pub _2y: MetricPattern4, - pub _3y: MetricPattern4, - pub _4y: MetricPattern4, - pub _5y: MetricPattern4, - pub _6y: MetricPattern4, - pub _8y: MetricPattern4, -} - -impl PeriodCagrPattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - _10y: MetricPattern4::new( - client.clone(), - if acc.is_empty() { - "10y".to_string() - } else { - format!("10y_{acc}") - }, - ), - _2y: MetricPattern4::new( - client.clone(), - if acc.is_empty() { - "2y".to_string() - } else { - format!("2y_{acc}") - }, - ), - _3y: MetricPattern4::new( - client.clone(), - if acc.is_empty() { - "3y".to_string() - } else { - format!("3y_{acc}") - }, - ), - _4y: MetricPattern4::new( - client.clone(), - if acc.is_empty() { - "4y".to_string() - } else { - format!("4y_{acc}") - }, - ), - _5y: MetricPattern4::new( - client.clone(), - if acc.is_empty() { - "5y".to_string() - } else { - format!("5y_{acc}") - }, - ), - _6y: MetricPattern4::new( - client.clone(), - if acc.is_empty() { - "6y".to_string() - } else { - format!("6y_{acc}") - }, - ), - _8y: MetricPattern4::new( - client.clone(), - if acc.is_empty() { - "8y".to_string() - } else { - format!("8y_{acc}") - }, - ), - } - } -} - /// Pattern struct for repeated tree structure. pub struct ActivityPattern2 { pub coinblocks_destroyed: BlockCountPattern, @@ -4149,18 +3572,9 @@ impl ActivityPattern2 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - coinblocks_destroyed: BlockCountPattern::new( - client.clone(), - _m(&acc, "coinblocks_destroyed"), - ), - coindays_destroyed: BlockCountPattern::new( - client.clone(), - _m(&acc, "coindays_destroyed"), - ), - satblocks_destroyed: MetricPattern11::new( - client.clone(), - _m(&acc, "satblocks_destroyed"), - ), + coinblocks_destroyed: BlockCountPattern::new(client.clone(), _m(&acc, "coinblocks_destroyed")), + coindays_destroyed: BlockCountPattern::new(client.clone(), _m(&acc, "coindays_destroyed")), + satblocks_destroyed: MetricPattern11::new(client.clone(), _m(&acc, "satblocks_destroyed")), satdays_destroyed: MetricPattern11::new(client.clone(), _m(&acc, "satdays_destroyed")), sent: UnclaimedRewardsPattern::new(client.clone(), _m(&acc, "sent")), } @@ -4188,75 +3602,19 @@ impl SplitPattern2 { } /// Pattern struct for repeated tree structure. -pub struct CoinbasePattern2 { - pub bitcoin: BlockCountPattern, - pub dollars: BlockCountPattern, - pub sats: BlockCountPattern, +pub struct ActiveSupplyPattern { + pub bitcoin: MetricPattern1, + pub dollars: MetricPattern1, + pub sats: MetricPattern1, } -impl CoinbasePattern2 { +impl ActiveSupplyPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - bitcoin: BlockCountPattern::new(client.clone(), _m(&acc, "btc")), - dollars: BlockCountPattern::new(client.clone(), _m(&acc, "usd")), - sats: BlockCountPattern::new(client.clone(), acc.clone()), - } - } -} - -/// Pattern struct for repeated tree structure. -pub struct UnclaimedRewardsPattern { - pub bitcoin: BitcoinPattern, - pub dollars: BlockCountPattern, - pub sats: BlockCountPattern, -} - -impl UnclaimedRewardsPattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - bitcoin: BitcoinPattern::new(client.clone(), _m(&acc, "btc")), - dollars: BlockCountPattern::new(client.clone(), _m(&acc, "usd")), - sats: BlockCountPattern::new(client.clone(), acc.clone()), - } - } -} - -/// Pattern struct for repeated tree structure. -pub struct SegwitAdoptionPattern { - pub base: MetricPattern11, - pub cumulative: MetricPattern2, - pub sum: MetricPattern2, -} - -impl SegwitAdoptionPattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - base: MetricPattern11::new(client.clone(), acc.clone()), - cumulative: MetricPattern2::new(client.clone(), _m(&acc, "cumulative")), - sum: MetricPattern2::new(client.clone(), _m(&acc, "sum")), - } - } -} - -/// Pattern struct for repeated tree structure. -pub struct CostBasisPattern2 { - pub max: MetricPattern1, - pub min: MetricPattern1, - pub percentiles: PercentilesPattern, -} - -impl CostBasisPattern2 { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - max: MetricPattern1::new(client.clone(), format!("{base_path}_max")), - min: MetricPattern1::new(client.clone(), format!("{base_path}_min")), - percentiles: PercentilesPattern::new( - client.clone(), - format!("{base_path}_percentiles"), - ), + bitcoin: MetricPattern1::new(client.clone(), _m(&acc, "btc")), + dollars: MetricPattern1::new(client.clone(), _m(&acc, "usd")), + sats: MetricPattern1::new(client.clone(), acc.clone()), } } } @@ -4280,19 +3638,54 @@ impl _2015Pattern { } /// Pattern struct for repeated tree structure. -pub struct ActiveSupplyPattern { - pub bitcoin: MetricPattern1, - pub dollars: MetricPattern1, - pub sats: MetricPattern1, +pub struct CostBasisPattern2 { + pub max: MetricPattern1, + pub min: MetricPattern1, + pub percentiles: PercentilesPattern, } -impl ActiveSupplyPattern { +impl CostBasisPattern2 { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + max: MetricPattern1::new(client.clone(), format!("{base_path}_max")), + min: MetricPattern1::new(client.clone(), format!("{base_path}_min")), + percentiles: PercentilesPattern::new(client.clone(), format!("{base_path}_percentiles")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct SegwitAdoptionPattern { + pub base: MetricPattern11, + pub cumulative: MetricPattern2, + pub sum: MetricPattern2, +} + +impl SegwitAdoptionPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - bitcoin: MetricPattern1::new(client.clone(), _m(&acc, "btc")), - dollars: MetricPattern1::new(client.clone(), _m(&acc, "usd")), - sats: MetricPattern1::new(client.clone(), acc.clone()), + base: MetricPattern11::new(client.clone(), acc.clone()), + cumulative: MetricPattern2::new(client.clone(), _m(&acc, "cumulative")), + sum: MetricPattern2::new(client.clone(), _m(&acc, "sum")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct CoinbasePattern2 { + pub bitcoin: BlockCountPattern, + pub dollars: BlockCountPattern, + pub sats: BlockCountPattern, +} + +impl CoinbasePattern2 { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + bitcoin: BlockCountPattern::new(client.clone(), _m(&acc, "btc")), + dollars: BlockCountPattern::new(client.clone(), _m(&acc, "usd")), + sats: BlockCountPattern::new(client.clone(), acc.clone()), } } } @@ -4315,6 +3708,24 @@ impl CoinbasePattern { } } +/// Pattern struct for repeated tree structure. +pub struct UnclaimedRewardsPattern { + pub bitcoin: BitcoinPattern, + pub dollars: BlockCountPattern, + pub sats: BlockCountPattern, +} + +impl UnclaimedRewardsPattern { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + bitcoin: BitcoinPattern::new(client.clone(), _m(&acc, "btc")), + dollars: BlockCountPattern::new(client.clone(), _m(&acc, "usd")), + sats: BlockCountPattern::new(client.clone(), acc.clone()), + } + } +} + /// Pattern struct for repeated tree structure. pub struct CostBasisPattern { pub max: MetricPattern1, @@ -4373,14 +3784,8 @@ impl RelativePattern4 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - supply_in_loss_rel_to_own_supply: MetricPattern1::new( - client.clone(), - _m(&acc, "loss_rel_to_own_supply"), - ), - supply_in_profit_rel_to_own_supply: MetricPattern1::new( - client.clone(), - _m(&acc, "profit_rel_to_own_supply"), - ), + supply_in_loss_rel_to_own_supply: MetricPattern1::new(client.clone(), _m(&acc, "loss_rel_to_own_supply")), + supply_in_profit_rel_to_own_supply: MetricPattern1::new(client.clone(), _m(&acc, "profit_rel_to_own_supply")), } } } @@ -4400,22 +3805,6 @@ impl SatsPattern { } } -/// Pattern struct for repeated tree structure. -pub struct BitcoinPattern { - pub cumulative: MetricPattern2, - pub sum: MetricPattern1, -} - -impl BitcoinPattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - cumulative: MetricPattern2::new(client.clone(), _m(&acc, "cumulative")), - sum: MetricPattern1::new(client.clone(), acc.clone()), - } - } -} - /// Pattern struct for repeated tree structure. pub struct BlockCountPattern { pub cumulative: MetricPattern1, @@ -4433,15 +3822,17 @@ impl BlockCountPattern { } /// Pattern struct for repeated tree structure. -pub struct RealizedPriceExtraPattern { - pub ratio: MetricPattern4, +pub struct BitcoinPattern { + pub cumulative: MetricPattern2, + pub sum: MetricPattern1, } -impl RealizedPriceExtraPattern { +impl BitcoinPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - ratio: MetricPattern4::new(client.clone(), _m(&acc, "ratio")), + cumulative: MetricPattern2::new(client.clone(), _m(&acc, "cumulative")), + sum: MetricPattern1::new(client.clone(), acc.clone()), } } } @@ -4460,6 +3851,20 @@ impl OutputsPattern { } } +/// Pattern struct for repeated tree structure. +pub struct RealizedPriceExtraPattern { + pub ratio: MetricPattern4, +} + +impl RealizedPriceExtraPattern { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + ratio: MetricPattern4::new(client.clone(), _m(&acc, "ratio")), + } + } +} + // Metrics tree /// Metrics tree node. @@ -4488,10 +3893,7 @@ impl MetricsTree { blocks: MetricsTree_Blocks::new(client.clone(), format!("{base_path}_blocks")), cointime: MetricsTree_Cointime::new(client.clone(), format!("{base_path}_cointime")), constants: MetricsTree_Constants::new(client.clone(), format!("{base_path}_constants")), - distribution: MetricsTree_Distribution::new( - client.clone(), - format!("{base_path}_distribution"), - ), + distribution: MetricsTree_Distribution::new(client.clone(), format!("{base_path}_distribution")), indexes: MetricsTree_Indexes::new(client.clone(), format!("{base_path}_indexes")), inputs: MetricsTree_Inputs::new(client.clone(), format!("{base_path}_inputs")), market: MetricsTree_Market::new(client.clone(), format!("{base_path}_market")), @@ -4501,10 +3903,7 @@ impl MetricsTree { price: MetricsTree_Price::new(client.clone(), format!("{base_path}_price")), scripts: MetricsTree_Scripts::new(client.clone(), format!("{base_path}_scripts")), supply: MetricsTree_Supply::new(client.clone(), format!("{base_path}_supply")), - transactions: MetricsTree_Transactions::new( - client.clone(), - format!("{base_path}_transactions"), - ), + transactions: MetricsTree_Transactions::new(client.clone(), format!("{base_path}_transactions")), } } } @@ -4532,38 +3931,14 @@ pub struct MetricsTree_Addresses { impl MetricsTree_Addresses { pub fn new(client: Arc, base_path: String) -> Self { Self { - first_p2aaddressindex: MetricPattern11::new( - client.clone(), - "first_p2aaddressindex".to_string(), - ), - first_p2pk33addressindex: MetricPattern11::new( - client.clone(), - "first_p2pk33addressindex".to_string(), - ), - first_p2pk65addressindex: MetricPattern11::new( - client.clone(), - "first_p2pk65addressindex".to_string(), - ), - first_p2pkhaddressindex: MetricPattern11::new( - client.clone(), - "first_p2pkhaddressindex".to_string(), - ), - first_p2shaddressindex: MetricPattern11::new( - client.clone(), - "first_p2shaddressindex".to_string(), - ), - first_p2traddressindex: MetricPattern11::new( - client.clone(), - "first_p2traddressindex".to_string(), - ), - first_p2wpkhaddressindex: MetricPattern11::new( - client.clone(), - "first_p2wpkhaddressindex".to_string(), - ), - first_p2wshaddressindex: MetricPattern11::new( - client.clone(), - "first_p2wshaddressindex".to_string(), - ), + first_p2aaddressindex: MetricPattern11::new(client.clone(), "first_p2aaddressindex".to_string()), + first_p2pk33addressindex: MetricPattern11::new(client.clone(), "first_p2pk33addressindex".to_string()), + first_p2pk65addressindex: MetricPattern11::new(client.clone(), "first_p2pk65addressindex".to_string()), + first_p2pkhaddressindex: MetricPattern11::new(client.clone(), "first_p2pkhaddressindex".to_string()), + first_p2shaddressindex: MetricPattern11::new(client.clone(), "first_p2shaddressindex".to_string()), + first_p2traddressindex: MetricPattern11::new(client.clone(), "first_p2traddressindex".to_string()), + first_p2wpkhaddressindex: MetricPattern11::new(client.clone(), "first_p2wpkhaddressindex".to_string()), + first_p2wshaddressindex: MetricPattern11::new(client.clone(), "first_p2wshaddressindex".to_string()), p2abytes: MetricPattern16::new(client.clone(), "p2abytes".to_string()), p2pk33bytes: MetricPattern18::new(client.clone(), "p2pk33bytes".to_string()), p2pk65bytes: MetricPattern19::new(client.clone(), "p2pk65bytes".to_string()), @@ -4590,7 +3965,7 @@ pub struct MetricsTree_Blocks { pub time: MetricsTree_Blocks_Time, pub total_size: MetricPattern11, pub vbytes: DollarsPattern, - pub weight: DollarsPattern, + pub weight: MetricsTree_Blocks_Weight, } impl MetricsTree_Blocks { @@ -4598,29 +3973,17 @@ impl MetricsTree_Blocks { Self { blockhash: MetricPattern11::new(client.clone(), "blockhash".to_string()), count: MetricsTree_Blocks_Count::new(client.clone(), format!("{base_path}_count")), - difficulty: MetricsTree_Blocks_Difficulty::new( - client.clone(), - format!("{base_path}_difficulty"), - ), + difficulty: MetricsTree_Blocks_Difficulty::new(client.clone(), format!("{base_path}_difficulty")), fullness: FullnessPattern::new(client.clone(), "block_fullness".to_string()), - halving: MetricsTree_Blocks_Halving::new( - client.clone(), - format!("{base_path}_halving"), - ), - interval: MetricsTree_Blocks_Interval::new( - client.clone(), - format!("{base_path}_interval"), - ), + halving: MetricsTree_Blocks_Halving::new(client.clone(), format!("{base_path}_halving")), + interval: MetricsTree_Blocks_Interval::new(client.clone(), format!("{base_path}_interval")), mining: MetricsTree_Blocks_Mining::new(client.clone(), format!("{base_path}_mining")), - rewards: MetricsTree_Blocks_Rewards::new( - client.clone(), - format!("{base_path}_rewards"), - ), + rewards: MetricsTree_Blocks_Rewards::new(client.clone(), format!("{base_path}_rewards")), size: MetricsTree_Blocks_Size::new(client.clone(), format!("{base_path}_size")), time: MetricsTree_Blocks_Time::new(client.clone(), format!("{base_path}_time")), total_size: MetricPattern11::new(client.clone(), "total_size".to_string()), vbytes: DollarsPattern::new(client.clone(), "block_vbytes".to_string()), - weight: DollarsPattern::new(client.clone(), "block_weight_average".to_string()), + weight: MetricsTree_Blocks_Weight::new(client.clone(), format!("{base_path}_weight")), } } } @@ -4651,10 +4014,7 @@ impl MetricsTree_Blocks_Count { _24h_block_count: MetricPattern1::new(client.clone(), "24h_block_count".to_string()), _24h_start: MetricPattern11::new(client.clone(), "24h_start".to_string()), block_count: BlockCountPattern::new(client.clone(), "block_count".to_string()), - block_count_target: MetricPattern4::new( - client.clone(), - "block_count_target".to_string(), - ), + block_count_target: MetricPattern4::new(client.clone(), "block_count_target".to_string()), } } } @@ -4674,14 +4034,8 @@ impl MetricsTree_Blocks_Difficulty { Self { adjustment: MetricPattern1::new(client.clone(), "difficulty_adjustment".to_string()), as_hash: MetricPattern1::new(client.clone(), "difficulty_as_hash".to_string()), - blocks_before_next_adjustment: MetricPattern1::new( - client.clone(), - "blocks_before_next_difficulty_adjustment".to_string(), - ), - days_before_next_adjustment: MetricPattern1::new( - client.clone(), - "days_before_next_difficulty_adjustment".to_string(), - ), + blocks_before_next_adjustment: MetricPattern1::new(client.clone(), "blocks_before_next_difficulty_adjustment".to_string()), + days_before_next_adjustment: MetricPattern1::new(client.clone(), "days_before_next_difficulty_adjustment".to_string()), epoch: MetricPattern4::new(client.clone(), "difficultyepoch".to_string()), raw: MetricPattern1::new(client.clone(), "difficulty".to_string()), } @@ -4698,14 +4052,8 @@ pub struct MetricsTree_Blocks_Halving { impl MetricsTree_Blocks_Halving { pub fn new(client: Arc, base_path: String) -> Self { Self { - blocks_before_next_halving: MetricPattern1::new( - client.clone(), - "blocks_before_next_halving".to_string(), - ), - days_before_next_halving: MetricPattern1::new( - client.clone(), - "days_before_next_halving".to_string(), - ), + blocks_before_next_halving: MetricPattern1::new(client.clone(), "blocks_before_next_halving".to_string()), + days_before_next_halving: MetricPattern1::new(client.clone(), "days_before_next_halving".to_string()), epoch: MetricPattern4::new(client.clone(), "halvingepoch".to_string()), } } @@ -4763,38 +4111,20 @@ impl MetricsTree_Blocks_Mining { pub fn new(client: Arc, base_path: String) -> Self { Self { hash_price_phs: MetricPattern1::new(client.clone(), "hash_price_phs".to_string()), - hash_price_phs_min: MetricPattern1::new( - client.clone(), - "hash_price_phs_min".to_string(), - ), - hash_price_rebound: MetricPattern1::new( - client.clone(), - "hash_price_rebound".to_string(), - ), + hash_price_phs_min: MetricPattern1::new(client.clone(), "hash_price_phs_min".to_string()), + hash_price_rebound: MetricPattern1::new(client.clone(), "hash_price_rebound".to_string()), hash_price_ths: MetricPattern1::new(client.clone(), "hash_price_ths".to_string()), - hash_price_ths_min: MetricPattern1::new( - client.clone(), - "hash_price_ths_min".to_string(), - ), + hash_price_ths_min: MetricPattern1::new(client.clone(), "hash_price_ths_min".to_string()), hash_rate: MetricPattern1::new(client.clone(), "hash_rate".to_string()), hash_rate_1m_sma: MetricPattern4::new(client.clone(), "hash_rate_1m_sma".to_string()), hash_rate_1w_sma: MetricPattern4::new(client.clone(), "hash_rate_1w_sma".to_string()), hash_rate_1y_sma: MetricPattern4::new(client.clone(), "hash_rate_1y_sma".to_string()), hash_rate_2m_sma: MetricPattern4::new(client.clone(), "hash_rate_2m_sma".to_string()), hash_value_phs: MetricPattern1::new(client.clone(), "hash_value_phs".to_string()), - hash_value_phs_min: MetricPattern1::new( - client.clone(), - "hash_value_phs_min".to_string(), - ), - hash_value_rebound: MetricPattern1::new( - client.clone(), - "hash_value_rebound".to_string(), - ), + hash_value_phs_min: MetricPattern1::new(client.clone(), "hash_value_phs_min".to_string()), + hash_value_rebound: MetricPattern1::new(client.clone(), "hash_value_rebound".to_string()), hash_value_ths: MetricPattern1::new(client.clone(), "hash_value_ths".to_string()), - hash_value_ths_min: MetricPattern1::new( - client.clone(), - "hash_value_ths_min".to_string(), - ), + hash_value_ths_min: MetricPattern1::new(client.clone(), "hash_value_ths_min".to_string()), } } } @@ -4813,22 +4143,13 @@ pub struct MetricsTree_Blocks_Rewards { impl MetricsTree_Blocks_Rewards { pub fn new(client: Arc, base_path: String) -> Self { Self { - _24h_coinbase_sum: MetricsTree_Blocks_Rewards_24hCoinbaseSum::new( - client.clone(), - format!("{base_path}__24h_coinbase_sum"), - ), + _24h_coinbase_sum: MetricsTree_Blocks_Rewards_24hCoinbaseSum::new(client.clone(), format!("{base_path}__24h_coinbase_sum")), coinbase: CoinbasePattern::new(client.clone(), "coinbase".to_string()), fee_dominance: MetricPattern6::new(client.clone(), "fee_dominance".to_string()), subsidy: CoinbasePattern::new(client.clone(), "subsidy".to_string()), subsidy_dominance: MetricPattern6::new(client.clone(), "subsidy_dominance".to_string()), - subsidy_usd_1y_sma: MetricPattern4::new( - client.clone(), - "subsidy_usd_1y_sma".to_string(), - ), - unclaimed_rewards: UnclaimedRewardsPattern::new( - client.clone(), - "unclaimed_rewards".to_string(), - ), + subsidy_usd_1y_sma: MetricPattern4::new(client.clone(), "subsidy_usd_1y_sma".to_string()), + unclaimed_rewards: UnclaimedRewardsPattern::new(client.clone(), "unclaimed_rewards".to_string()), } } } @@ -4900,6 +4221,39 @@ impl MetricsTree_Blocks_Time { } } +/// Metrics tree node. +pub struct MetricsTree_Blocks_Weight { + pub average: MetricPattern2, + pub base: MetricPattern11, + pub cumulative: MetricPattern1, + pub max: MetricPattern2, + pub median: MetricPattern6, + pub min: MetricPattern2, + pub pct10: MetricPattern6, + pub pct25: MetricPattern6, + pub pct75: MetricPattern6, + pub pct90: MetricPattern6, + pub sum: MetricPattern2, +} + +impl MetricsTree_Blocks_Weight { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + average: MetricPattern2::new(client.clone(), "block_weight_average".to_string()), + base: MetricPattern11::new(client.clone(), "weight".to_string()), + cumulative: MetricPattern1::new(client.clone(), "block_weight_cumulative".to_string()), + max: MetricPattern2::new(client.clone(), "block_weight_max".to_string()), + median: MetricPattern6::new(client.clone(), "block_weight_median".to_string()), + min: MetricPattern2::new(client.clone(), "block_weight_min".to_string()), + pct10: MetricPattern6::new(client.clone(), "block_weight_pct10".to_string()), + pct25: MetricPattern6::new(client.clone(), "block_weight_pct25".to_string()), + pct75: MetricPattern6::new(client.clone(), "block_weight_pct75".to_string()), + pct90: MetricPattern6::new(client.clone(), "block_weight_pct90".to_string()), + sum: MetricPattern2::new(client.clone(), "block_weight_sum".to_string()), + } + } +} + /// Metrics tree node. pub struct MetricsTree_Cointime { pub activity: MetricsTree_Cointime_Activity, @@ -4913,19 +4267,10 @@ pub struct MetricsTree_Cointime { impl MetricsTree_Cointime { pub fn new(client: Arc, base_path: String) -> Self { Self { - activity: MetricsTree_Cointime_Activity::new( - client.clone(), - format!("{base_path}_activity"), - ), - adjusted: MetricsTree_Cointime_Adjusted::new( - client.clone(), - format!("{base_path}_adjusted"), - ), + activity: MetricsTree_Cointime_Activity::new(client.clone(), format!("{base_path}_activity")), + adjusted: MetricsTree_Cointime_Adjusted::new(client.clone(), format!("{base_path}_adjusted")), cap: MetricsTree_Cointime_Cap::new(client.clone(), format!("{base_path}_cap")), - pricing: MetricsTree_Cointime_Pricing::new( - client.clone(), - format!("{base_path}_pricing"), - ), + pricing: MetricsTree_Cointime_Pricing::new(client.clone(), format!("{base_path}_pricing")), supply: MetricsTree_Cointime_Supply::new(client.clone(), format!("{base_path}_supply")), value: MetricsTree_Cointime_Value::new(client.clone(), format!("{base_path}_value")), } @@ -4944,18 +4289,9 @@ pub struct MetricsTree_Cointime_Activity { impl MetricsTree_Cointime_Activity { pub fn new(client: Arc, base_path: String) -> Self { Self { - activity_to_vaultedness_ratio: MetricPattern1::new( - client.clone(), - "activity_to_vaultedness_ratio".to_string(), - ), - coinblocks_created: BlockCountPattern::new( - client.clone(), - "coinblocks_created".to_string(), - ), - coinblocks_stored: BlockCountPattern::new( - client.clone(), - "coinblocks_stored".to_string(), - ), + activity_to_vaultedness_ratio: MetricPattern1::new(client.clone(), "activity_to_vaultedness_ratio".to_string()), + coinblocks_created: BlockCountPattern::new(client.clone(), "coinblocks_created".to_string()), + coinblocks_stored: BlockCountPattern::new(client.clone(), "coinblocks_stored".to_string()), liveliness: MetricPattern1::new(client.clone(), "liveliness".to_string()), vaultedness: MetricPattern1::new(client.clone(), "vaultedness".to_string()), } @@ -4972,18 +4308,9 @@ pub struct MetricsTree_Cointime_Adjusted { impl MetricsTree_Cointime_Adjusted { pub fn new(client: Arc, base_path: String) -> Self { Self { - cointime_adj_inflation_rate: MetricPattern4::new( - client.clone(), - "cointime_adj_inflation_rate".to_string(), - ), - cointime_adj_tx_btc_velocity: MetricPattern4::new( - client.clone(), - "cointime_adj_tx_btc_velocity".to_string(), - ), - cointime_adj_tx_usd_velocity: MetricPattern4::new( - client.clone(), - "cointime_adj_tx_usd_velocity".to_string(), - ), + cointime_adj_inflation_rate: MetricPattern4::new(client.clone(), "cointime_adj_inflation_rate".to_string()), + cointime_adj_tx_btc_velocity: MetricPattern4::new(client.clone(), "cointime_adj_tx_btc_velocity".to_string()), + cointime_adj_tx_usd_velocity: MetricPattern4::new(client.clone(), "cointime_adj_tx_usd_velocity".to_string()), } } } @@ -5025,25 +4352,13 @@ impl MetricsTree_Cointime_Pricing { pub fn new(client: Arc, base_path: String) -> Self { Self { active_price: MetricPattern1::new(client.clone(), "active_price".to_string()), - active_price_ratio: ActivePriceRatioPattern::new( - client.clone(), - "active_price_ratio".to_string(), - ), + active_price_ratio: ActivePriceRatioPattern::new(client.clone(), "active_price_ratio".to_string()), cointime_price: MetricPattern1::new(client.clone(), "cointime_price".to_string()), - cointime_price_ratio: ActivePriceRatioPattern::new( - client.clone(), - "cointime_price_ratio".to_string(), - ), + cointime_price_ratio: ActivePriceRatioPattern::new(client.clone(), "cointime_price_ratio".to_string()), true_market_mean: MetricPattern1::new(client.clone(), "true_market_mean".to_string()), - true_market_mean_ratio: ActivePriceRatioPattern::new( - client.clone(), - "true_market_mean_ratio".to_string(), - ), + true_market_mean_ratio: ActivePriceRatioPattern::new(client.clone(), "true_market_mean_ratio".to_string()), vaulted_price: MetricPattern1::new(client.clone(), "vaulted_price".to_string()), - vaulted_price_ratio: ActivePriceRatioPattern::new( - client.clone(), - "vaulted_price_ratio".to_string(), - ), + vaulted_price_ratio: ActivePriceRatioPattern::new(client.clone(), "vaulted_price_ratio".to_string()), } } } @@ -5073,18 +4388,9 @@ pub struct MetricsTree_Cointime_Value { impl MetricsTree_Cointime_Value { pub fn new(client: Arc, base_path: String) -> Self { Self { - cointime_value_created: BlockCountPattern::new( - client.clone(), - "cointime_value_created".to_string(), - ), - cointime_value_destroyed: BlockCountPattern::new( - client.clone(), - "cointime_value_destroyed".to_string(), - ), - cointime_value_stored: BlockCountPattern::new( - client.clone(), - "cointime_value_stored".to_string(), - ), + cointime_value_created: BlockCountPattern::new(client.clone(), "cointime_value_created".to_string()), + cointime_value_destroyed: BlockCountPattern::new(client.clone(), "cointime_value_destroyed".to_string()), + cointime_value_stored: BlockCountPattern::new(client.clone(), "cointime_value_stored".to_string()), } } } @@ -5152,39 +4458,15 @@ pub struct MetricsTree_Distribution { impl MetricsTree_Distribution { pub fn new(client: Arc, base_path: String) -> Self { Self { - addr_count: MetricsTree_Distribution_AddrCount::new( - client.clone(), - format!("{base_path}_addr_count"), - ), - address_cohorts: MetricsTree_Distribution_AddressCohorts::new( - client.clone(), - format!("{base_path}_address_cohorts"), - ), - addresses_data: MetricsTree_Distribution_AddressesData::new( - client.clone(), - format!("{base_path}_addresses_data"), - ), - any_address_indexes: MetricsTree_Distribution_AnyAddressIndexes::new( - client.clone(), - format!("{base_path}_any_address_indexes"), - ), + addr_count: MetricsTree_Distribution_AddrCount::new(client.clone(), format!("{base_path}_addr_count")), + address_cohorts: MetricsTree_Distribution_AddressCohorts::new(client.clone(), format!("{base_path}_address_cohorts")), + addresses_data: MetricsTree_Distribution_AddressesData::new(client.clone(), format!("{base_path}_addresses_data")), + any_address_indexes: MetricsTree_Distribution_AnyAddressIndexes::new(client.clone(), format!("{base_path}_any_address_indexes")), chain_state: MetricPattern11::new(client.clone(), "chain".to_string()), - empty_addr_count: MetricsTree_Distribution_EmptyAddrCount::new( - client.clone(), - format!("{base_path}_empty_addr_count"), - ), - emptyaddressindex: MetricPattern32::new( - client.clone(), - "emptyaddressindex".to_string(), - ), - loadedaddressindex: MetricPattern31::new( - client.clone(), - "loadedaddressindex".to_string(), - ), - utxo_cohorts: MetricsTree_Distribution_UtxoCohorts::new( - client.clone(), - format!("{base_path}_utxo_cohorts"), - ), + empty_addr_count: MetricsTree_Distribution_EmptyAddrCount::new(client.clone(), format!("{base_path}_empty_addr_count")), + emptyaddressindex: MetricPattern32::new(client.clone(), "emptyaddressindex".to_string()), + loadedaddressindex: MetricPattern31::new(client.clone(), "loadedaddressindex".to_string()), + utxo_cohorts: MetricsTree_Distribution_UtxoCohorts::new(client.clone(), format!("{base_path}_utxo_cohorts")), } } } @@ -5228,18 +4510,9 @@ pub struct MetricsTree_Distribution_AddressCohorts { impl MetricsTree_Distribution_AddressCohorts { pub fn new(client: Arc, base_path: String) -> Self { Self { - amount_range: MetricsTree_Distribution_AddressCohorts_AmountRange::new( - client.clone(), - format!("{base_path}_amount_range"), - ), - ge_amount: MetricsTree_Distribution_AddressCohorts_GeAmount::new( - client.clone(), - format!("{base_path}_ge_amount"), - ), - lt_amount: MetricsTree_Distribution_AddressCohorts_LtAmount::new( - client.clone(), - format!("{base_path}_lt_amount"), - ), + amount_range: MetricsTree_Distribution_AddressCohorts_AmountRange::new(client.clone(), format!("{base_path}_amount_range")), + ge_amount: MetricsTree_Distribution_AddressCohorts_GeAmount::new(client.clone(), format!("{base_path}_ge_amount")), + lt_amount: MetricsTree_Distribution_AddressCohorts_LtAmount::new(client.clone(), format!("{base_path}_lt_amount")), } } } @@ -5267,62 +4540,20 @@ impl MetricsTree_Distribution_AddressCohorts_AmountRange { pub fn new(client: Arc, base_path: String) -> Self { Self { _0sats: _0satsPattern::new(client.clone(), "addrs_with_0sats".to_string()), - _100btc_to_1k_btc: _0satsPattern::new( - client.clone(), - "addrs_above_100btc_under_1k_btc".to_string(), - ), - _100k_btc_or_more: _0satsPattern::new( - client.clone(), - "addrs_above_100k_btc".to_string(), - ), - _100k_sats_to_1m_sats: _0satsPattern::new( - client.clone(), - "addrs_above_100k_sats_under_1m_sats".to_string(), - ), - _100sats_to_1k_sats: _0satsPattern::new( - client.clone(), - "addrs_above_100sats_under_1k_sats".to_string(), - ), - _10btc_to_100btc: _0satsPattern::new( - client.clone(), - "addrs_above_10btc_under_100btc".to_string(), - ), - _10k_btc_to_100k_btc: _0satsPattern::new( - client.clone(), - "addrs_above_10k_btc_under_100k_btc".to_string(), - ), - _10k_sats_to_100k_sats: _0satsPattern::new( - client.clone(), - "addrs_above_10k_sats_under_100k_sats".to_string(), - ), - _10m_sats_to_1btc: _0satsPattern::new( - client.clone(), - "addrs_above_10m_sats_under_1btc".to_string(), - ), - _10sats_to_100sats: _0satsPattern::new( - client.clone(), - "addrs_above_10sats_under_100sats".to_string(), - ), - _1btc_to_10btc: _0satsPattern::new( - client.clone(), - "addrs_above_1btc_under_10btc".to_string(), - ), - _1k_btc_to_10k_btc: _0satsPattern::new( - client.clone(), - "addrs_above_1k_btc_under_10k_btc".to_string(), - ), - _1k_sats_to_10k_sats: _0satsPattern::new( - client.clone(), - "addrs_above_1k_sats_under_10k_sats".to_string(), - ), - _1m_sats_to_10m_sats: _0satsPattern::new( - client.clone(), - "addrs_above_1m_sats_under_10m_sats".to_string(), - ), - _1sat_to_10sats: _0satsPattern::new( - client.clone(), - "addrs_above_1sat_under_10sats".to_string(), - ), + _100btc_to_1k_btc: _0satsPattern::new(client.clone(), "addrs_above_100btc_under_1k_btc".to_string()), + _100k_btc_or_more: _0satsPattern::new(client.clone(), "addrs_above_100k_btc".to_string()), + _100k_sats_to_1m_sats: _0satsPattern::new(client.clone(), "addrs_above_100k_sats_under_1m_sats".to_string()), + _100sats_to_1k_sats: _0satsPattern::new(client.clone(), "addrs_above_100sats_under_1k_sats".to_string()), + _10btc_to_100btc: _0satsPattern::new(client.clone(), "addrs_above_10btc_under_100btc".to_string()), + _10k_btc_to_100k_btc: _0satsPattern::new(client.clone(), "addrs_above_10k_btc_under_100k_btc".to_string()), + _10k_sats_to_100k_sats: _0satsPattern::new(client.clone(), "addrs_above_10k_sats_under_100k_sats".to_string()), + _10m_sats_to_1btc: _0satsPattern::new(client.clone(), "addrs_above_10m_sats_under_1btc".to_string()), + _10sats_to_100sats: _0satsPattern::new(client.clone(), "addrs_above_10sats_under_100sats".to_string()), + _1btc_to_10btc: _0satsPattern::new(client.clone(), "addrs_above_1btc_under_10btc".to_string()), + _1k_btc_to_10k_btc: _0satsPattern::new(client.clone(), "addrs_above_1k_btc_under_10k_btc".to_string()), + _1k_sats_to_10k_sats: _0satsPattern::new(client.clone(), "addrs_above_1k_sats_under_10k_sats".to_string()), + _1m_sats_to_10m_sats: _0satsPattern::new(client.clone(), "addrs_above_1m_sats_under_10m_sats".to_string()), + _1sat_to_10sats: _0satsPattern::new(client.clone(), "addrs_above_1sat_under_10sats".to_string()), } } } @@ -5490,50 +4721,17 @@ pub struct MetricsTree_Distribution_UtxoCohorts { impl MetricsTree_Distribution_UtxoCohorts { pub fn new(client: Arc, base_path: String) -> Self { Self { - age_range: MetricsTree_Distribution_UtxoCohorts_AgeRange::new( - client.clone(), - format!("{base_path}_age_range"), - ), - all: MetricsTree_Distribution_UtxoCohorts_All::new( - client.clone(), - format!("{base_path}_all"), - ), - amount_range: MetricsTree_Distribution_UtxoCohorts_AmountRange::new( - client.clone(), - format!("{base_path}_amount_range"), - ), - epoch: MetricsTree_Distribution_UtxoCohorts_Epoch::new( - client.clone(), - format!("{base_path}_epoch"), - ), - ge_amount: MetricsTree_Distribution_UtxoCohorts_GeAmount::new( - client.clone(), - format!("{base_path}_ge_amount"), - ), - lt_amount: MetricsTree_Distribution_UtxoCohorts_LtAmount::new( - client.clone(), - format!("{base_path}_lt_amount"), - ), - max_age: MetricsTree_Distribution_UtxoCohorts_MaxAge::new( - client.clone(), - format!("{base_path}_max_age"), - ), - min_age: MetricsTree_Distribution_UtxoCohorts_MinAge::new( - client.clone(), - format!("{base_path}_min_age"), - ), - term: MetricsTree_Distribution_UtxoCohorts_Term::new( - client.clone(), - format!("{base_path}_term"), - ), - type_: MetricsTree_Distribution_UtxoCohorts_Type::new( - client.clone(), - format!("{base_path}_type_"), - ), - year: MetricsTree_Distribution_UtxoCohorts_Year::new( - client.clone(), - format!("{base_path}_year"), - ), + age_range: MetricsTree_Distribution_UtxoCohorts_AgeRange::new(client.clone(), format!("{base_path}_age_range")), + all: MetricsTree_Distribution_UtxoCohorts_All::new(client.clone(), format!("{base_path}_all")), + amount_range: MetricsTree_Distribution_UtxoCohorts_AmountRange::new(client.clone(), format!("{base_path}_amount_range")), + epoch: MetricsTree_Distribution_UtxoCohorts_Epoch::new(client.clone(), format!("{base_path}_epoch")), + ge_amount: MetricsTree_Distribution_UtxoCohorts_GeAmount::new(client.clone(), format!("{base_path}_ge_amount")), + lt_amount: MetricsTree_Distribution_UtxoCohorts_LtAmount::new(client.clone(), format!("{base_path}_lt_amount")), + max_age: MetricsTree_Distribution_UtxoCohorts_MaxAge::new(client.clone(), format!("{base_path}_max_age")), + min_age: MetricsTree_Distribution_UtxoCohorts_MinAge::new(client.clone(), format!("{base_path}_min_age")), + term: MetricsTree_Distribution_UtxoCohorts_Term::new(client.clone(), format!("{base_path}_term")), + type_: MetricsTree_Distribution_UtxoCohorts_Type::new(client.clone(), format!("{base_path}_type_")), + year: MetricsTree_Distribution_UtxoCohorts_Year::new(client.clone(), format!("{base_path}_year")), } } } @@ -5566,82 +4764,25 @@ pub struct MetricsTree_Distribution_UtxoCohorts_AgeRange { impl MetricsTree_Distribution_UtxoCohorts_AgeRange { pub fn new(client: Arc, base_path: String) -> Self { Self { - _10y_to_12y: _10yTo12yPattern::new( - client.clone(), - "utxos_at_least_10y_up_to_12y_old".to_string(), - ), - _12y_to_15y: _10yTo12yPattern::new( - client.clone(), - "utxos_at_least_12y_up_to_15y_old".to_string(), - ), - _1d_to_1w: _10yTo12yPattern::new( - client.clone(), - "utxos_at_least_1d_up_to_1w_old".to_string(), - ), - _1h_to_1d: _10yTo12yPattern::new( - client.clone(), - "utxos_at_least_1h_up_to_1d_old".to_string(), - ), - _1m_to_2m: _10yTo12yPattern::new( - client.clone(), - "utxos_at_least_1m_up_to_2m_old".to_string(), - ), - _1w_to_1m: _10yTo12yPattern::new( - client.clone(), - "utxos_at_least_1w_up_to_1m_old".to_string(), - ), - _1y_to_2y: _10yTo12yPattern::new( - client.clone(), - "utxos_at_least_1y_up_to_2y_old".to_string(), - ), - _2m_to_3m: _10yTo12yPattern::new( - client.clone(), - "utxos_at_least_2m_up_to_3m_old".to_string(), - ), - _2y_to_3y: _10yTo12yPattern::new( - client.clone(), - "utxos_at_least_2y_up_to_3y_old".to_string(), - ), - _3m_to_4m: _10yTo12yPattern::new( - client.clone(), - "utxos_at_least_3m_up_to_4m_old".to_string(), - ), - _3y_to_4y: _10yTo12yPattern::new( - client.clone(), - "utxos_at_least_3y_up_to_4y_old".to_string(), - ), - _4m_to_5m: _10yTo12yPattern::new( - client.clone(), - "utxos_at_least_4m_up_to_5m_old".to_string(), - ), - _4y_to_5y: _10yTo12yPattern::new( - client.clone(), - "utxos_at_least_4y_up_to_5y_old".to_string(), - ), - _5m_to_6m: _10yTo12yPattern::new( - client.clone(), - "utxos_at_least_5m_up_to_6m_old".to_string(), - ), - _5y_to_6y: _10yTo12yPattern::new( - client.clone(), - "utxos_at_least_5y_up_to_6y_old".to_string(), - ), - _6m_to_1y: _10yTo12yPattern::new( - client.clone(), - "utxos_at_least_6m_up_to_1y_old".to_string(), - ), - _6y_to_7y: _10yTo12yPattern::new( - client.clone(), - "utxos_at_least_6y_up_to_7y_old".to_string(), - ), - _7y_to_8y: _10yTo12yPattern::new( - client.clone(), - "utxos_at_least_7y_up_to_8y_old".to_string(), - ), - _8y_to_10y: _10yTo12yPattern::new( - client.clone(), - "utxos_at_least_8y_up_to_10y_old".to_string(), - ), + _10y_to_12y: _10yTo12yPattern::new(client.clone(), "utxos_at_least_10y_up_to_12y_old".to_string()), + _12y_to_15y: _10yTo12yPattern::new(client.clone(), "utxos_at_least_12y_up_to_15y_old".to_string()), + _1d_to_1w: _10yTo12yPattern::new(client.clone(), "utxos_at_least_1d_up_to_1w_old".to_string()), + _1h_to_1d: _10yTo12yPattern::new(client.clone(), "utxos_at_least_1h_up_to_1d_old".to_string()), + _1m_to_2m: _10yTo12yPattern::new(client.clone(), "utxos_at_least_1m_up_to_2m_old".to_string()), + _1w_to_1m: _10yTo12yPattern::new(client.clone(), "utxos_at_least_1w_up_to_1m_old".to_string()), + _1y_to_2y: _10yTo12yPattern::new(client.clone(), "utxos_at_least_1y_up_to_2y_old".to_string()), + _2m_to_3m: _10yTo12yPattern::new(client.clone(), "utxos_at_least_2m_up_to_3m_old".to_string()), + _2y_to_3y: _10yTo12yPattern::new(client.clone(), "utxos_at_least_2y_up_to_3y_old".to_string()), + _3m_to_4m: _10yTo12yPattern::new(client.clone(), "utxos_at_least_3m_up_to_4m_old".to_string()), + _3y_to_4y: _10yTo12yPattern::new(client.clone(), "utxos_at_least_3y_up_to_4y_old".to_string()), + _4m_to_5m: _10yTo12yPattern::new(client.clone(), "utxos_at_least_4m_up_to_5m_old".to_string()), + _4y_to_5y: _10yTo12yPattern::new(client.clone(), "utxos_at_least_4y_up_to_5y_old".to_string()), + _5m_to_6m: _10yTo12yPattern::new(client.clone(), "utxos_at_least_5m_up_to_6m_old".to_string()), + _5y_to_6y: _10yTo12yPattern::new(client.clone(), "utxos_at_least_5y_up_to_6y_old".to_string()), + _6m_to_1y: _10yTo12yPattern::new(client.clone(), "utxos_at_least_6m_up_to_1y_old".to_string()), + _6y_to_7y: _10yTo12yPattern::new(client.clone(), "utxos_at_least_6y_up_to_7y_old".to_string()), + _7y_to_8y: _10yTo12yPattern::new(client.clone(), "utxos_at_least_7y_up_to_8y_old".to_string()), + _8y_to_10y: _10yTo12yPattern::new(client.clone(), "utxos_at_least_8y_up_to_10y_old".to_string()), from_15y: _10yTo12yPattern::new(client.clone(), "utxos_at_least_15y_old".to_string()), up_to_1h: _10yTo12yPattern::new(client.clone(), "utxos_up_to_1h_old".to_string()), } @@ -5650,7 +4791,7 @@ impl MetricsTree_Distribution_UtxoCohorts_AgeRange { /// Metrics tree node. pub struct MetricsTree_Distribution_UtxoCohorts_All { - pub activity: ActivityPattern2, + pub activity: MetricsTree_Distribution_UtxoCohorts_All_Activity, pub cost_basis: MetricsTree_Distribution_UtxoCohorts_All_CostBasis, pub outputs: OutputsPattern, pub realized: RealizedPattern3, @@ -5662,23 +4803,38 @@ pub struct MetricsTree_Distribution_UtxoCohorts_All { impl MetricsTree_Distribution_UtxoCohorts_All { pub fn new(client: Arc, base_path: String) -> Self { Self { - activity: ActivityPattern2::new(client.clone(), "".to_string()), - cost_basis: MetricsTree_Distribution_UtxoCohorts_All_CostBasis::new( - client.clone(), - format!("{base_path}_cost_basis"), - ), + activity: MetricsTree_Distribution_UtxoCohorts_All_Activity::new(client.clone(), format!("{base_path}_activity")), + cost_basis: MetricsTree_Distribution_UtxoCohorts_All_CostBasis::new(client.clone(), format!("{base_path}_cost_basis")), outputs: OutputsPattern::new(client.clone(), "utxo_count".to_string()), realized: RealizedPattern3::new(client.clone(), "adjusted_sopr".to_string()), - relative: MetricsTree_Distribution_UtxoCohorts_All_Relative::new( - client.clone(), - format!("{base_path}_relative"), - ), + relative: MetricsTree_Distribution_UtxoCohorts_All_Relative::new(client.clone(), format!("{base_path}_relative")), supply: SupplyPattern2::new(client.clone(), "supply".to_string()), unrealized: UnrealizedPattern::new(client.clone(), "".to_string()), } } } +/// Metrics tree node. +pub struct MetricsTree_Distribution_UtxoCohorts_All_Activity { + pub coinblocks_destroyed: BlockCountPattern, + pub coindays_destroyed: BlockCountPattern, + pub satblocks_destroyed: MetricPattern11, + pub satdays_destroyed: MetricPattern11, + pub sent: UnclaimedRewardsPattern, +} + +impl MetricsTree_Distribution_UtxoCohorts_All_Activity { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + coinblocks_destroyed: BlockCountPattern::new(client.clone(), "coinblocks_destroyed".to_string()), + coindays_destroyed: BlockCountPattern::new(client.clone(), "coindays_destroyed".to_string()), + satblocks_destroyed: MetricPattern11::new(client.clone(), "satblocks_destroyed".to_string()), + satdays_destroyed: MetricPattern11::new(client.clone(), "satdays_destroyed".to_string()), + sent: UnclaimedRewardsPattern::new(client.clone(), "sent".to_string()), + } + } +} + /// Metrics tree node. pub struct MetricsTree_Distribution_UtxoCohorts_All_CostBasis { pub max: MetricPattern1, @@ -5709,30 +4865,12 @@ pub struct MetricsTree_Distribution_UtxoCohorts_All_Relative { impl MetricsTree_Distribution_UtxoCohorts_All_Relative { pub fn new(client: Arc, base_path: String) -> Self { Self { - neg_unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1::new( - client.clone(), - "neg_unrealized_loss_rel_to_own_total_unrealized_pnl".to_string(), - ), - net_unrealized_pnl_rel_to_own_total_unrealized_pnl: MetricPattern1::new( - client.clone(), - "net_unrealized_pnl_rel_to_own_total_unrealized_pnl".to_string(), - ), - supply_in_loss_rel_to_own_supply: MetricPattern1::new( - client.clone(), - "supply_in_loss_rel_to_own_supply".to_string(), - ), - supply_in_profit_rel_to_own_supply: MetricPattern1::new( - client.clone(), - "supply_in_profit_rel_to_own_supply".to_string(), - ), - unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1::new( - client.clone(), - "unrealized_loss_rel_to_own_total_unrealized_pnl".to_string(), - ), - unrealized_profit_rel_to_own_total_unrealized_pnl: MetricPattern1::new( - client.clone(), - "unrealized_profit_rel_to_own_total_unrealized_pnl".to_string(), - ), + neg_unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1::new(client.clone(), "neg_unrealized_loss_rel_to_own_total_unrealized_pnl".to_string()), + net_unrealized_pnl_rel_to_own_total_unrealized_pnl: MetricPattern1::new(client.clone(), "net_unrealized_pnl_rel_to_own_total_unrealized_pnl".to_string()), + supply_in_loss_rel_to_own_supply: MetricPattern1::new(client.clone(), "supply_in_loss_rel_to_own_supply".to_string()), + supply_in_profit_rel_to_own_supply: MetricPattern1::new(client.clone(), "supply_in_profit_rel_to_own_supply".to_string()), + unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1::new(client.clone(), "unrealized_loss_rel_to_own_total_unrealized_pnl".to_string()), + unrealized_profit_rel_to_own_total_unrealized_pnl: MetricPattern1::new(client.clone(), "unrealized_profit_rel_to_own_total_unrealized_pnl".to_string()), } } } @@ -5760,62 +4898,20 @@ impl MetricsTree_Distribution_UtxoCohorts_AmountRange { pub fn new(client: Arc, base_path: String) -> Self { Self { _0sats: _0satsPattern2::new(client.clone(), "utxos_with_0sats".to_string()), - _100btc_to_1k_btc: _0satsPattern2::new( - client.clone(), - "utxos_above_100btc_under_1k_btc".to_string(), - ), - _100k_btc_or_more: _0satsPattern2::new( - client.clone(), - "utxos_above_100k_btc".to_string(), - ), - _100k_sats_to_1m_sats: _0satsPattern2::new( - client.clone(), - "utxos_above_100k_sats_under_1m_sats".to_string(), - ), - _100sats_to_1k_sats: _0satsPattern2::new( - client.clone(), - "utxos_above_100sats_under_1k_sats".to_string(), - ), - _10btc_to_100btc: _0satsPattern2::new( - client.clone(), - "utxos_above_10btc_under_100btc".to_string(), - ), - _10k_btc_to_100k_btc: _0satsPattern2::new( - client.clone(), - "utxos_above_10k_btc_under_100k_btc".to_string(), - ), - _10k_sats_to_100k_sats: _0satsPattern2::new( - client.clone(), - "utxos_above_10k_sats_under_100k_sats".to_string(), - ), - _10m_sats_to_1btc: _0satsPattern2::new( - client.clone(), - "utxos_above_10m_sats_under_1btc".to_string(), - ), - _10sats_to_100sats: _0satsPattern2::new( - client.clone(), - "utxos_above_10sats_under_100sats".to_string(), - ), - _1btc_to_10btc: _0satsPattern2::new( - client.clone(), - "utxos_above_1btc_under_10btc".to_string(), - ), - _1k_btc_to_10k_btc: _0satsPattern2::new( - client.clone(), - "utxos_above_1k_btc_under_10k_btc".to_string(), - ), - _1k_sats_to_10k_sats: _0satsPattern2::new( - client.clone(), - "utxos_above_1k_sats_under_10k_sats".to_string(), - ), - _1m_sats_to_10m_sats: _0satsPattern2::new( - client.clone(), - "utxos_above_1m_sats_under_10m_sats".to_string(), - ), - _1sat_to_10sats: _0satsPattern2::new( - client.clone(), - "utxos_above_1sat_under_10sats".to_string(), - ), + _100btc_to_1k_btc: _0satsPattern2::new(client.clone(), "utxos_above_100btc_under_1k_btc".to_string()), + _100k_btc_or_more: _0satsPattern2::new(client.clone(), "utxos_above_100k_btc".to_string()), + _100k_sats_to_1m_sats: _0satsPattern2::new(client.clone(), "utxos_above_100k_sats_under_1m_sats".to_string()), + _100sats_to_1k_sats: _0satsPattern2::new(client.clone(), "utxos_above_100sats_under_1k_sats".to_string()), + _10btc_to_100btc: _0satsPattern2::new(client.clone(), "utxos_above_10btc_under_100btc".to_string()), + _10k_btc_to_100k_btc: _0satsPattern2::new(client.clone(), "utxos_above_10k_btc_under_100k_btc".to_string()), + _10k_sats_to_100k_sats: _0satsPattern2::new(client.clone(), "utxos_above_10k_sats_under_100k_sats".to_string()), + _10m_sats_to_1btc: _0satsPattern2::new(client.clone(), "utxos_above_10m_sats_under_1btc".to_string()), + _10sats_to_100sats: _0satsPattern2::new(client.clone(), "utxos_above_10sats_under_100sats".to_string()), + _1btc_to_10btc: _0satsPattern2::new(client.clone(), "utxos_above_1btc_under_10btc".to_string()), + _1k_btc_to_10k_btc: _0satsPattern2::new(client.clone(), "utxos_above_1k_btc_under_10k_btc".to_string()), + _1k_sats_to_10k_sats: _0satsPattern2::new(client.clone(), "utxos_above_1k_sats_under_10k_sats".to_string()), + _1m_sats_to_10m_sats: _0satsPattern2::new(client.clone(), "utxos_above_1m_sats_under_10m_sats".to_string()), + _1sat_to_10sats: _0satsPattern2::new(client.clone(), "utxos_above_1sat_under_10sats".to_string()), } } } @@ -6018,14 +5114,8 @@ pub struct MetricsTree_Distribution_UtxoCohorts_Term { impl MetricsTree_Distribution_UtxoCohorts_Term { pub fn new(client: Arc, base_path: String) -> Self { Self { - long: MetricsTree_Distribution_UtxoCohorts_Term_Long::new( - client.clone(), - format!("{base_path}_long"), - ), - short: MetricsTree_Distribution_UtxoCohorts_Term_Short::new( - client.clone(), - format!("{base_path}_short"), - ), + long: MetricsTree_Distribution_UtxoCohorts_Term_Long::new(client.clone(), format!("{base_path}_long")), + short: MetricsTree_Distribution_UtxoCohorts_Term_Short::new(client.clone(), format!("{base_path}_short")), } } } @@ -6045,10 +5135,7 @@ impl MetricsTree_Distribution_UtxoCohorts_Term_Long { pub fn new(client: Arc, base_path: String) -> Self { Self { activity: ActivityPattern2::new(client.clone(), "lth".to_string()), - cost_basis: MetricsTree_Distribution_UtxoCohorts_Term_Long_CostBasis::new( - client.clone(), - format!("{base_path}_cost_basis"), - ), + cost_basis: MetricsTree_Distribution_UtxoCohorts_Term_Long_CostBasis::new(client.clone(), format!("{base_path}_cost_basis")), outputs: OutputsPattern::new(client.clone(), "lth".to_string()), realized: RealizedPattern2::new(client.clone(), "lth".to_string()), relative: RelativePattern5::new(client.clone(), "lth".to_string()), @@ -6090,10 +5177,7 @@ impl MetricsTree_Distribution_UtxoCohorts_Term_Short { pub fn new(client: Arc, base_path: String) -> Self { Self { activity: ActivityPattern2::new(client.clone(), "sth".to_string()), - cost_basis: MetricsTree_Distribution_UtxoCohorts_Term_Short_CostBasis::new( - client.clone(), - format!("{base_path}_cost_basis"), - ), + cost_basis: MetricsTree_Distribution_UtxoCohorts_Term_Short_CostBasis::new(client.clone(), format!("{base_path}_cost_basis")), outputs: OutputsPattern::new(client.clone(), "sth".to_string()), realized: RealizedPattern3::new(client.clone(), "sth".to_string()), relative: RelativePattern5::new(client.clone(), "sth".to_string()), @@ -6221,59 +5305,20 @@ pub struct MetricsTree_Indexes { impl MetricsTree_Indexes { pub fn new(client: Arc, base_path: String) -> Self { Self { - address: MetricsTree_Indexes_Address::new( - client.clone(), - format!("{base_path}_address"), - ), - dateindex: MetricsTree_Indexes_Dateindex::new( - client.clone(), - format!("{base_path}_dateindex"), - ), - decadeindex: MetricsTree_Indexes_Decadeindex::new( - client.clone(), - format!("{base_path}_decadeindex"), - ), - difficultyepoch: MetricsTree_Indexes_Difficultyepoch::new( - client.clone(), - format!("{base_path}_difficultyepoch"), - ), - halvingepoch: MetricsTree_Indexes_Halvingepoch::new( - client.clone(), - format!("{base_path}_halvingepoch"), - ), + address: MetricsTree_Indexes_Address::new(client.clone(), format!("{base_path}_address")), + dateindex: MetricsTree_Indexes_Dateindex::new(client.clone(), format!("{base_path}_dateindex")), + decadeindex: MetricsTree_Indexes_Decadeindex::new(client.clone(), format!("{base_path}_decadeindex")), + difficultyepoch: MetricsTree_Indexes_Difficultyepoch::new(client.clone(), format!("{base_path}_difficultyepoch")), + halvingepoch: MetricsTree_Indexes_Halvingepoch::new(client.clone(), format!("{base_path}_halvingepoch")), height: MetricsTree_Indexes_Height::new(client.clone(), format!("{base_path}_height")), - monthindex: MetricsTree_Indexes_Monthindex::new( - client.clone(), - format!("{base_path}_monthindex"), - ), - quarterindex: MetricsTree_Indexes_Quarterindex::new( - client.clone(), - format!("{base_path}_quarterindex"), - ), - semesterindex: MetricsTree_Indexes_Semesterindex::new( - client.clone(), - format!("{base_path}_semesterindex"), - ), - txindex: MetricsTree_Indexes_Txindex::new( - client.clone(), - format!("{base_path}_txindex"), - ), - txinindex: MetricsTree_Indexes_Txinindex::new( - client.clone(), - format!("{base_path}_txinindex"), - ), - txoutindex: MetricsTree_Indexes_Txoutindex::new( - client.clone(), - format!("{base_path}_txoutindex"), - ), - weekindex: MetricsTree_Indexes_Weekindex::new( - client.clone(), - format!("{base_path}_weekindex"), - ), - yearindex: MetricsTree_Indexes_Yearindex::new( - client.clone(), - format!("{base_path}_yearindex"), - ), + monthindex: MetricsTree_Indexes_Monthindex::new(client.clone(), format!("{base_path}_monthindex")), + quarterindex: MetricsTree_Indexes_Quarterindex::new(client.clone(), format!("{base_path}_quarterindex")), + semesterindex: MetricsTree_Indexes_Semesterindex::new(client.clone(), format!("{base_path}_semesterindex")), + txindex: MetricsTree_Indexes_Txindex::new(client.clone(), format!("{base_path}_txindex")), + txinindex: MetricsTree_Indexes_Txinindex::new(client.clone(), format!("{base_path}_txinindex")), + txoutindex: MetricsTree_Indexes_Txoutindex::new(client.clone(), format!("{base_path}_txoutindex")), + weekindex: MetricsTree_Indexes_Weekindex::new(client.clone(), format!("{base_path}_weekindex")), + yearindex: MetricsTree_Indexes_Yearindex::new(client.clone(), format!("{base_path}_yearindex")), } } } @@ -6297,51 +5342,18 @@ pub struct MetricsTree_Indexes_Address { impl MetricsTree_Indexes_Address { pub fn new(client: Arc, base_path: String) -> Self { Self { - empty: MetricsTree_Indexes_Address_Empty::new( - client.clone(), - format!("{base_path}_empty"), - ), - opreturn: MetricsTree_Indexes_Address_Opreturn::new( - client.clone(), - format!("{base_path}_opreturn"), - ), + empty: MetricsTree_Indexes_Address_Empty::new(client.clone(), format!("{base_path}_empty")), + opreturn: MetricsTree_Indexes_Address_Opreturn::new(client.clone(), format!("{base_path}_opreturn")), p2a: MetricsTree_Indexes_Address_P2a::new(client.clone(), format!("{base_path}_p2a")), - p2ms: MetricsTree_Indexes_Address_P2ms::new( - client.clone(), - format!("{base_path}_p2ms"), - ), - p2pk33: MetricsTree_Indexes_Address_P2pk33::new( - client.clone(), - format!("{base_path}_p2pk33"), - ), - p2pk65: MetricsTree_Indexes_Address_P2pk65::new( - client.clone(), - format!("{base_path}_p2pk65"), - ), - p2pkh: MetricsTree_Indexes_Address_P2pkh::new( - client.clone(), - format!("{base_path}_p2pkh"), - ), - p2sh: MetricsTree_Indexes_Address_P2sh::new( - client.clone(), - format!("{base_path}_p2sh"), - ), - p2tr: MetricsTree_Indexes_Address_P2tr::new( - client.clone(), - format!("{base_path}_p2tr"), - ), - p2wpkh: MetricsTree_Indexes_Address_P2wpkh::new( - client.clone(), - format!("{base_path}_p2wpkh"), - ), - p2wsh: MetricsTree_Indexes_Address_P2wsh::new( - client.clone(), - format!("{base_path}_p2wsh"), - ), - unknown: MetricsTree_Indexes_Address_Unknown::new( - client.clone(), - format!("{base_path}_unknown"), - ), + p2ms: MetricsTree_Indexes_Address_P2ms::new(client.clone(), format!("{base_path}_p2ms")), + p2pk33: MetricsTree_Indexes_Address_P2pk33::new(client.clone(), format!("{base_path}_p2pk33")), + p2pk65: MetricsTree_Indexes_Address_P2pk65::new(client.clone(), format!("{base_path}_p2pk65")), + p2pkh: MetricsTree_Indexes_Address_P2pkh::new(client.clone(), format!("{base_path}_p2pkh")), + p2sh: MetricsTree_Indexes_Address_P2sh::new(client.clone(), format!("{base_path}_p2sh")), + p2tr: MetricsTree_Indexes_Address_P2tr::new(client.clone(), format!("{base_path}_p2tr")), + p2wpkh: MetricsTree_Indexes_Address_P2wpkh::new(client.clone(), format!("{base_path}_p2wpkh")), + p2wsh: MetricsTree_Indexes_Address_P2wsh::new(client.clone(), format!("{base_path}_p2wsh")), + unknown: MetricsTree_Indexes_Address_Unknown::new(client.clone(), format!("{base_path}_unknown")), } } } @@ -6535,15 +5547,9 @@ pub struct MetricsTree_Indexes_Decadeindex { impl MetricsTree_Indexes_Decadeindex { pub fn new(client: Arc, base_path: String) -> Self { Self { - first_yearindex: MetricPattern7::new( - client.clone(), - "decadeindex_first_yearindex".to_string(), - ), + first_yearindex: MetricPattern7::new(client.clone(), "decadeindex_first_yearindex".to_string()), identity: MetricPattern7::new(client.clone(), "decadeindex".to_string()), - yearindex_count: MetricPattern7::new( - client.clone(), - "decadeindex_yearindex_count".to_string(), - ), + yearindex_count: MetricPattern7::new(client.clone(), "decadeindex_yearindex_count".to_string()), } } } @@ -6558,14 +5564,8 @@ pub struct MetricsTree_Indexes_Difficultyepoch { impl MetricsTree_Indexes_Difficultyepoch { pub fn new(client: Arc, base_path: String) -> Self { Self { - first_height: MetricPattern8::new( - client.clone(), - "difficultyepoch_first_height".to_string(), - ), - height_count: MetricPattern8::new( - client.clone(), - "difficultyepoch_height_count".to_string(), - ), + first_height: MetricPattern8::new(client.clone(), "difficultyepoch_first_height".to_string()), + height_count: MetricPattern8::new(client.clone(), "difficultyepoch_height_count".to_string()), identity: MetricPattern8::new(client.clone(), "difficultyepoch".to_string()), } } @@ -6580,10 +5580,7 @@ pub struct MetricsTree_Indexes_Halvingepoch { impl MetricsTree_Indexes_Halvingepoch { pub fn new(client: Arc, base_path: String) -> Self { Self { - first_height: MetricPattern10::new( - client.clone(), - "halvingepoch_first_height".to_string(), - ), + first_height: MetricPattern10::new(client.clone(), "halvingepoch_first_height".to_string()), identity: MetricPattern10::new(client.clone(), "halvingepoch".to_string()), } } @@ -6602,10 +5599,7 @@ impl MetricsTree_Indexes_Height { pub fn new(client: Arc, base_path: String) -> Self { Self { dateindex: MetricPattern11::new(client.clone(), "height_dateindex".to_string()), - difficultyepoch: MetricPattern11::new( - client.clone(), - "height_difficultyepoch".to_string(), - ), + difficultyepoch: MetricPattern11::new(client.clone(), "height_difficultyepoch".to_string()), halvingepoch: MetricPattern11::new(client.clone(), "height_halvingepoch".to_string()), identity: MetricPattern11::new(client.clone(), "height".to_string()), txindex_count: MetricPattern11::new(client.clone(), "height_txindex_count".to_string()), @@ -6626,23 +5620,11 @@ pub struct MetricsTree_Indexes_Monthindex { impl MetricsTree_Indexes_Monthindex { pub fn new(client: Arc, base_path: String) -> Self { Self { - dateindex_count: MetricPattern13::new( - client.clone(), - "monthindex_dateindex_count".to_string(), - ), - first_dateindex: MetricPattern13::new( - client.clone(), - "monthindex_first_dateindex".to_string(), - ), + dateindex_count: MetricPattern13::new(client.clone(), "monthindex_dateindex_count".to_string()), + first_dateindex: MetricPattern13::new(client.clone(), "monthindex_first_dateindex".to_string()), identity: MetricPattern13::new(client.clone(), "monthindex".to_string()), - quarterindex: MetricPattern13::new( - client.clone(), - "monthindex_quarterindex".to_string(), - ), - semesterindex: MetricPattern13::new( - client.clone(), - "monthindex_semesterindex".to_string(), - ), + quarterindex: MetricPattern13::new(client.clone(), "monthindex_quarterindex".to_string()), + semesterindex: MetricPattern13::new(client.clone(), "monthindex_semesterindex".to_string()), yearindex: MetricPattern13::new(client.clone(), "monthindex_yearindex".to_string()), } } @@ -6658,15 +5640,9 @@ pub struct MetricsTree_Indexes_Quarterindex { impl MetricsTree_Indexes_Quarterindex { pub fn new(client: Arc, base_path: String) -> Self { Self { - first_monthindex: MetricPattern25::new( - client.clone(), - "quarterindex_first_monthindex".to_string(), - ), + first_monthindex: MetricPattern25::new(client.clone(), "quarterindex_first_monthindex".to_string()), identity: MetricPattern25::new(client.clone(), "quarterindex".to_string()), - monthindex_count: MetricPattern25::new( - client.clone(), - "quarterindex_monthindex_count".to_string(), - ), + monthindex_count: MetricPattern25::new(client.clone(), "quarterindex_monthindex_count".to_string()), } } } @@ -6681,15 +5657,9 @@ pub struct MetricsTree_Indexes_Semesterindex { impl MetricsTree_Indexes_Semesterindex { pub fn new(client: Arc, base_path: String) -> Self { Self { - first_monthindex: MetricPattern26::new( - client.clone(), - "semesterindex_first_monthindex".to_string(), - ), + first_monthindex: MetricPattern26::new(client.clone(), "semesterindex_first_monthindex".to_string()), identity: MetricPattern26::new(client.clone(), "semesterindex".to_string()), - monthindex_count: MetricPattern26::new( - client.clone(), - "semesterindex_monthindex_count".to_string(), - ), + monthindex_count: MetricPattern26::new(client.clone(), "semesterindex_monthindex_count".to_string()), } } } @@ -6747,14 +5717,8 @@ pub struct MetricsTree_Indexes_Weekindex { impl MetricsTree_Indexes_Weekindex { pub fn new(client: Arc, base_path: String) -> Self { Self { - dateindex_count: MetricPattern29::new( - client.clone(), - "weekindex_dateindex_count".to_string(), - ), - first_dateindex: MetricPattern29::new( - client.clone(), - "weekindex_first_dateindex".to_string(), - ), + dateindex_count: MetricPattern29::new(client.clone(), "weekindex_dateindex_count".to_string()), + first_dateindex: MetricPattern29::new(client.clone(), "weekindex_first_dateindex".to_string()), identity: MetricPattern29::new(client.clone(), "weekindex".to_string()), } } @@ -6772,15 +5736,9 @@ impl MetricsTree_Indexes_Yearindex { pub fn new(client: Arc, base_path: String) -> Self { Self { decadeindex: MetricPattern30::new(client.clone(), "yearindex_decadeindex".to_string()), - first_monthindex: MetricPattern30::new( - client.clone(), - "yearindex_first_monthindex".to_string(), - ), + first_monthindex: MetricPattern30::new(client.clone(), "yearindex_first_monthindex".to_string()), identity: MetricPattern30::new(client.clone(), "yearindex".to_string()), - monthindex_count: MetricPattern30::new( - client.clone(), - "yearindex_monthindex_count".to_string(), - ), + monthindex_count: MetricPattern30::new(client.clone(), "yearindex_monthindex_count".to_string()), } } } @@ -6844,27 +5802,12 @@ impl MetricsTree_Market { Self { ath: MetricsTree_Market_Ath::new(client.clone(), format!("{base_path}_ath")), dca: MetricsTree_Market_Dca::new(client.clone(), format!("{base_path}_dca")), - indicators: MetricsTree_Market_Indicators::new( - client.clone(), - format!("{base_path}_indicators"), - ), - lookback: MetricsTree_Market_Lookback::new( - client.clone(), - format!("{base_path}_lookback"), - ), - moving_average: MetricsTree_Market_MovingAverage::new( - client.clone(), - format!("{base_path}_moving_average"), - ), + indicators: MetricsTree_Market_Indicators::new(client.clone(), format!("{base_path}_indicators")), + lookback: MetricsTree_Market_Lookback::new(client.clone(), format!("{base_path}_lookback")), + moving_average: MetricsTree_Market_MovingAverage::new(client.clone(), format!("{base_path}_moving_average")), range: MetricsTree_Market_Range::new(client.clone(), format!("{base_path}_range")), - returns: MetricsTree_Market_Returns::new( - client.clone(), - format!("{base_path}_returns"), - ), - volatility: MetricsTree_Market_Volatility::new( - client.clone(), - format!("{base_path}_volatility"), - ), + returns: MetricsTree_Market_Returns::new(client.clone(), format!("{base_path}_returns")), + volatility: MetricsTree_Market_Volatility::new(client.clone(), format!("{base_path}_volatility")), } } } @@ -6882,24 +5825,12 @@ pub struct MetricsTree_Market_Ath { impl MetricsTree_Market_Ath { pub fn new(client: Arc, base_path: String) -> Self { Self { - days_since_price_ath: MetricPattern4::new( - client.clone(), - "days_since_price_ath".to_string(), - ), - max_days_between_price_aths: MetricPattern4::new( - client.clone(), - "max_days_between_price_aths".to_string(), - ), - max_years_between_price_aths: MetricPattern4::new( - client.clone(), - "max_years_between_price_aths".to_string(), - ), + days_since_price_ath: MetricPattern4::new(client.clone(), "days_since_price_ath".to_string()), + max_days_between_price_aths: MetricPattern4::new(client.clone(), "max_days_between_price_aths".to_string()), + max_years_between_price_aths: MetricPattern4::new(client.clone(), "max_years_between_price_aths".to_string()), price_ath: MetricPattern1::new(client.clone(), "price_ath".to_string()), price_drawdown: MetricPattern3::new(client.clone(), "price_drawdown".to_string()), - years_since_price_ath: MetricPattern4::new( - client.clone(), - "years_since_price_ath".to_string(), - ), + years_since_price_ath: MetricPattern4::new(client.clone(), "years_since_price_ath".to_string()), } } } @@ -6919,31 +5850,13 @@ pub struct MetricsTree_Market_Dca { impl MetricsTree_Market_Dca { pub fn new(client: Arc, base_path: String) -> Self { Self { - class_average_price: MetricsTree_Market_Dca_ClassAveragePrice::new( - client.clone(), - format!("{base_path}_class_average_price"), - ), - class_returns: MetricsTree_Market_Dca_ClassReturns::new( - client.clone(), - format!("{base_path}_class_returns"), - ), - class_stack: MetricsTree_Market_Dca_ClassStack::new( - client.clone(), - format!("{base_path}_class_stack"), - ), - period_average_price: PeriodAveragePricePattern::new( - client.clone(), - "dca_average_price".to_string(), - ), + class_average_price: MetricsTree_Market_Dca_ClassAveragePrice::new(client.clone(), format!("{base_path}_class_average_price")), + class_returns: MetricsTree_Market_Dca_ClassReturns::new(client.clone(), format!("{base_path}_class_returns")), + class_stack: MetricsTree_Market_Dca_ClassStack::new(client.clone(), format!("{base_path}_class_stack")), + period_average_price: PeriodAveragePricePattern::new(client.clone(), "dca_average_price".to_string()), period_cagr: PeriodCagrPattern::new(client.clone(), "dca_cagr".to_string()), - period_lump_sum_stack: PeriodLumpSumStackPattern::new( - client.clone(), - "lump_sum_stack".to_string(), - ), - period_returns: PeriodAveragePricePattern::new( - client.clone(), - "dca_returns".to_string(), - ), + period_lump_sum_stack: PeriodLumpSumStackPattern::new(client.clone(), "lump_sum_stack".to_string()), + period_returns: PeriodAveragePricePattern::new(client.clone(), "dca_returns".to_string()), period_stack: PeriodLumpSumStackPattern::new(client.clone(), "dca_stack".to_string()), } } @@ -7084,14 +5997,8 @@ impl MetricsTree_Market_Indicators { rsi_14d: MetricPattern6::new(client.clone(), "rsi_14d".to_string()), rsi_14d_max: MetricPattern6::new(client.clone(), "rsi_14d_max".to_string()), rsi_14d_min: MetricPattern6::new(client.clone(), "rsi_14d_min".to_string()), - rsi_average_gain_14d: MetricPattern6::new( - client.clone(), - "rsi_average_gain_14d".to_string(), - ), - rsi_average_loss_14d: MetricPattern6::new( - client.clone(), - "rsi_average_loss_14d".to_string(), - ), + rsi_average_gain_14d: MetricPattern6::new(client.clone(), "rsi_average_gain_14d".to_string()), + rsi_average_loss_14d: MetricPattern6::new(client.clone(), "rsi_average_loss_14d".to_string()), rsi_gains: MetricPattern6::new(client.clone(), "rsi_gains".to_string()), rsi_losses: MetricPattern6::new(client.clone(), "rsi_losses".to_string()), stoch_d: MetricPattern6::new(client.clone(), "stoch_d".to_string()), @@ -7111,10 +6018,7 @@ pub struct MetricsTree_Market_Lookback { impl MetricsTree_Market_Lookback { pub fn new(client: Arc, base_path: String) -> Self { Self { - price_ago: MetricsTree_Market_Lookback_PriceAgo::new( - client.clone(), - format!("{base_path}_price_ago"), - ), + price_ago: MetricsTree_Market_Lookback_PriceAgo::new(client.clone(), format!("{base_path}_price_ago")), } } } @@ -7212,14 +6116,8 @@ impl MetricsTree_Market_MovingAverage { price_1y_sma: Price111dSmaPattern::new(client.clone(), "price_1y_sma".to_string()), price_200d_ema: Price111dSmaPattern::new(client.clone(), "price_200d_ema".to_string()), price_200d_sma: Price111dSmaPattern::new(client.clone(), "price_200d_sma".to_string()), - price_200d_sma_x0_8: MetricPattern4::new( - client.clone(), - "price_200d_sma_x0_8".to_string(), - ), - price_200d_sma_x2_4: MetricPattern4::new( - client.clone(), - "price_200d_sma_x2_4".to_string(), - ), + price_200d_sma_x0_8: MetricPattern4::new(client.clone(), "price_200d_sma_x0_8".to_string()), + price_200d_sma_x2_4: MetricPattern4::new(client.clone(), "price_200d_sma_x2_4".to_string()), price_200w_ema: Price111dSmaPattern::new(client.clone(), "price_200w_ema".to_string()), price_200w_sma: Price111dSmaPattern::new(client.clone(), "price_200w_sma".to_string()), price_21d_ema: Price111dSmaPattern::new(client.clone(), "price_21d_ema".to_string()), @@ -7267,17 +6165,11 @@ impl MetricsTree_Market_Range { price_1w_min: MetricPattern4::new(client.clone(), "price_1w_min".to_string()), price_1y_max: MetricPattern4::new(client.clone(), "price_1y_max".to_string()), price_1y_min: MetricPattern4::new(client.clone(), "price_1y_min".to_string()), - price_2w_choppiness_index: MetricPattern4::new( - client.clone(), - "price_2w_choppiness_index".to_string(), - ), + price_2w_choppiness_index: MetricPattern4::new(client.clone(), "price_2w_choppiness_index".to_string()), price_2w_max: MetricPattern4::new(client.clone(), "price_2w_max".to_string()), price_2w_min: MetricPattern4::new(client.clone(), "price_2w_min".to_string()), price_true_range: MetricPattern6::new(client.clone(), "price_true_range".to_string()), - price_true_range_2w_sum: MetricPattern6::new( - client.clone(), - "price_true_range_2w_sum".to_string(), - ), + price_true_range_2w_sum: MetricPattern6::new(client.clone(), "price_true_range_2w_sum".to_string()), } } } @@ -7298,36 +6190,15 @@ pub struct MetricsTree_Market_Returns { impl MetricsTree_Market_Returns { pub fn new(client: Arc, base_path: String) -> Self { Self { - _1d_returns_1m_sd: _1dReturns1mSdPattern::new( - client.clone(), - "1d_returns_1m_sd".to_string(), - ), - _1d_returns_1w_sd: _1dReturns1mSdPattern::new( - client.clone(), - "1d_returns_1w_sd".to_string(), - ), - _1d_returns_1y_sd: _1dReturns1mSdPattern::new( - client.clone(), - "1d_returns_1y_sd".to_string(), - ), + _1d_returns_1m_sd: _1dReturns1mSdPattern::new(client.clone(), "1d_returns_1m_sd".to_string()), + _1d_returns_1w_sd: _1dReturns1mSdPattern::new(client.clone(), "1d_returns_1w_sd".to_string()), + _1d_returns_1y_sd: _1dReturns1mSdPattern::new(client.clone(), "1d_returns_1y_sd".to_string()), cagr: PeriodCagrPattern::new(client.clone(), "cagr".to_string()), - downside_1m_sd: _1dReturns1mSdPattern::new( - client.clone(), - "downside_1m_sd".to_string(), - ), - downside_1w_sd: _1dReturns1mSdPattern::new( - client.clone(), - "downside_1w_sd".to_string(), - ), - downside_1y_sd: _1dReturns1mSdPattern::new( - client.clone(), - "downside_1y_sd".to_string(), - ), + downside_1m_sd: _1dReturns1mSdPattern::new(client.clone(), "downside_1m_sd".to_string()), + downside_1w_sd: _1dReturns1mSdPattern::new(client.clone(), "downside_1w_sd".to_string()), + downside_1y_sd: _1dReturns1mSdPattern::new(client.clone(), "downside_1y_sd".to_string()), downside_returns: MetricPattern6::new(client.clone(), "downside_returns".to_string()), - price_returns: MetricsTree_Market_Returns_PriceReturns::new( - client.clone(), - format!("{base_path}_price_returns"), - ), + price_returns: MetricsTree_Market_Returns_PriceReturns::new(client.clone(), format!("{base_path}_price_returns")), } } } @@ -7385,18 +6256,9 @@ pub struct MetricsTree_Market_Volatility { impl MetricsTree_Market_Volatility { pub fn new(client: Arc, base_path: String) -> Self { Self { - price_1m_volatility: MetricPattern4::new( - client.clone(), - "price_1m_volatility".to_string(), - ), - price_1w_volatility: MetricPattern4::new( - client.clone(), - "price_1w_volatility".to_string(), - ), - price_1y_volatility: MetricPattern4::new( - client.clone(), - "price_1y_volatility".to_string(), - ), + price_1m_volatility: MetricPattern4::new(client.clone(), "price_1m_volatility".to_string()), + price_1w_volatility: MetricPattern4::new(client.clone(), "price_1w_volatility".to_string()), + price_1y_volatility: MetricPattern4::new(client.clone(), "price_1y_volatility".to_string()), sharpe_1m: MetricPattern6::new(client.clone(), "sharpe_1m".to_string()), sharpe_1w: MetricPattern6::new(client.clone(), "sharpe_1w".to_string()), sharpe_1y: MetricPattern6::new(client.clone(), "sharpe_1y".to_string()), @@ -7651,10 +6513,7 @@ impl MetricsTree_Pools_Vecs { binancepool: AaopoolPattern::new(client.clone(), "binancepool".to_string()), bitalo: AaopoolPattern::new(client.clone(), "bitalo".to_string()), bitclub: AaopoolPattern::new(client.clone(), "bitclub".to_string()), - bitcoinaffiliatenetwork: AaopoolPattern::new( - client.clone(), - "bitcoinaffiliatenetwork".to_string(), - ), + bitcoinaffiliatenetwork: AaopoolPattern::new(client.clone(), "bitcoinaffiliatenetwork".to_string()), bitcoincom: AaopoolPattern::new(client.clone(), "bitcoincom".to_string()), bitcoinindia: AaopoolPattern::new(client.clone(), "bitcoinindia".to_string()), bitcoinrussia: AaopoolPattern::new(client.clone(), "bitcoinrussia".to_string()), @@ -7700,19 +6559,13 @@ impl MetricsTree_Pools_Vecs { ekanembtc: AaopoolPattern::new(client.clone(), "ekanembtc".to_string()), eligius: AaopoolPattern::new(client.clone(), "eligius".to_string()), emcdpool: AaopoolPattern::new(client.clone(), "emcdpool".to_string()), - entrustcharitypool: AaopoolPattern::new( - client.clone(), - "entrustcharitypool".to_string(), - ), + entrustcharitypool: AaopoolPattern::new(client.clone(), "entrustcharitypool".to_string()), eobot: AaopoolPattern::new(client.clone(), "eobot".to_string()), exxbw: AaopoolPattern::new(client.clone(), "exxbw".to_string()), f2pool: AaopoolPattern::new(client.clone(), "f2pool".to_string()), fiftyeightcoin: AaopoolPattern::new(client.clone(), "fiftyeightcoin".to_string()), foundryusa: AaopoolPattern::new(client.clone(), "foundryusa".to_string()), - futurebitapollosolo: AaopoolPattern::new( - client.clone(), - "futurebitapollosolo".to_string(), - ), + futurebitapollosolo: AaopoolPattern::new(client.clone(), "futurebitapollosolo".to_string()), gbminers: AaopoolPattern::new(client.clone(), "gbminers".to_string()), ghashio: AaopoolPattern::new(client.clone(), "ghashio".to_string()), givemecoins: AaopoolPattern::new(client.clone(), "givemecoins".to_string()), @@ -7793,10 +6646,7 @@ impl MetricsTree_Pools_Vecs { tiger: AaopoolPattern::new(client.clone(), "tiger".to_string()), tigerpoolnet: AaopoolPattern::new(client.clone(), "tigerpoolnet".to_string()), titan: AaopoolPattern::new(client.clone(), "titan".to_string()), - transactioncoinmining: AaopoolPattern::new( - client.clone(), - "transactioncoinmining".to_string(), - ), + transactioncoinmining: AaopoolPattern::new(client.clone(), "transactioncoinmining".to_string()), trickysbtcpool: AaopoolPattern::new(client.clone(), "trickysbtcpool".to_string()), triplemining: AaopoolPattern::new(client.clone(), "triplemining".to_string()), twentyoneinc: AaopoolPattern::new(client.clone(), "twentyoneinc".to_string()), @@ -7929,22 +6779,10 @@ impl MetricsTree_Scripts { Self { count: MetricsTree_Scripts_Count::new(client.clone(), format!("{base_path}_count")), empty_to_txindex: MetricPattern9::new(client.clone(), "txindex".to_string()), - first_emptyoutputindex: MetricPattern11::new( - client.clone(), - "first_emptyoutputindex".to_string(), - ), - first_opreturnindex: MetricPattern11::new( - client.clone(), - "first_opreturnindex".to_string(), - ), - first_p2msoutputindex: MetricPattern11::new( - client.clone(), - "first_p2msoutputindex".to_string(), - ), - first_unknownoutputindex: MetricPattern11::new( - client.clone(), - "first_unknownoutputindex".to_string(), - ), + first_emptyoutputindex: MetricPattern11::new(client.clone(), "first_emptyoutputindex".to_string()), + first_opreturnindex: MetricPattern11::new(client.clone(), "first_opreturnindex".to_string()), + first_p2msoutputindex: MetricPattern11::new(client.clone(), "first_p2msoutputindex".to_string()), + first_unknownoutputindex: MetricPattern11::new(client.clone(), "first_unknownoutputindex".to_string()), opreturn_to_txindex: MetricPattern14::new(client.clone(), "txindex".to_string()), p2ms_to_txindex: MetricPattern17::new(client.clone(), "txindex".to_string()), unknown_to_txindex: MetricPattern28::new(client.clone(), "txindex".to_string()), @@ -7987,14 +6825,8 @@ impl MetricsTree_Scripts_Count { p2wpkh: DollarsPattern::new(client.clone(), "p2wpkh_count".to_string()), p2wsh: DollarsPattern::new(client.clone(), "p2wsh_count".to_string()), segwit: DollarsPattern::new(client.clone(), "segwit_count".to_string()), - segwit_adoption: SegwitAdoptionPattern::new( - client.clone(), - "segwit_adoption".to_string(), - ), - taproot_adoption: SegwitAdoptionPattern::new( - client.clone(), - "taproot_adoption".to_string(), - ), + segwit_adoption: SegwitAdoptionPattern::new(client.clone(), "segwit_adoption".to_string()), + taproot_adoption: SegwitAdoptionPattern::new(client.clone(), "taproot_adoption".to_string()), unknownoutput: DollarsPattern::new(client.clone(), "unknownoutput_count".to_string()), } } @@ -8026,16 +6858,10 @@ impl MetricsTree_Supply { pub fn new(client: Arc, base_path: String) -> Self { Self { burned: MetricsTree_Supply_Burned::new(client.clone(), format!("{base_path}_burned")), - circulating: MetricsTree_Supply_Circulating::new( - client.clone(), - format!("{base_path}_circulating"), - ), + circulating: MetricsTree_Supply_Circulating::new(client.clone(), format!("{base_path}_circulating")), inflation: MetricPattern4::new(client.clone(), "inflation_rate".to_string()), market_cap: MetricPattern1::new(client.clone(), "market_cap".to_string()), - velocity: MetricsTree_Supply_Velocity::new( - client.clone(), - format!("{base_path}_velocity"), - ), + velocity: MetricsTree_Supply_Velocity::new(client.clone(), format!("{base_path}_velocity")), } } } @@ -8050,10 +6876,7 @@ impl MetricsTree_Supply_Burned { pub fn new(client: Arc, base_path: String) -> Self { Self { opreturn: UnclaimedRewardsPattern::new(client.clone(), "opreturn_supply".to_string()), - unspendable: UnclaimedRewardsPattern::new( - client.clone(), - "unspendable_supply".to_string(), - ), + unspendable: UnclaimedRewardsPattern::new(client.clone(), "unspendable_supply".to_string()), } } } @@ -8113,32 +6936,20 @@ impl MetricsTree_Transactions { pub fn new(client: Arc, base_path: String) -> Self { Self { base_size: MetricPattern27::new(client.clone(), "base_size".to_string()), - count: MetricsTree_Transactions_Count::new( - client.clone(), - format!("{base_path}_count"), - ), + count: MetricsTree_Transactions_Count::new(client.clone(), format!("{base_path}_count")), fees: MetricsTree_Transactions_Fees::new(client.clone(), format!("{base_path}_fees")), first_txindex: MetricPattern11::new(client.clone(), "first_txindex".to_string()), first_txinindex: MetricPattern27::new(client.clone(), "first_txinindex".to_string()), first_txoutindex: MetricPattern27::new(client.clone(), "first_txoutindex".to_string()), height: MetricPattern27::new(client.clone(), "height".to_string()), - is_explicitly_rbf: MetricPattern27::new( - client.clone(), - "is_explicitly_rbf".to_string(), - ), + is_explicitly_rbf: MetricPattern27::new(client.clone(), "is_explicitly_rbf".to_string()), rawlocktime: MetricPattern27::new(client.clone(), "rawlocktime".to_string()), size: MetricsTree_Transactions_Size::new(client.clone(), format!("{base_path}_size")), total_size: MetricPattern27::new(client.clone(), "total_size".to_string()), txid: MetricPattern27::new(client.clone(), "txid".to_string()), txversion: MetricPattern27::new(client.clone(), "txversion".to_string()), - versions: MetricsTree_Transactions_Versions::new( - client.clone(), - format!("{base_path}_versions"), - ), - volume: MetricsTree_Transactions_Volume::new( - client.clone(), - format!("{base_path}_volume"), - ), + versions: MetricsTree_Transactions_Versions::new(client.clone(), format!("{base_path}_versions")), + volume: MetricsTree_Transactions_Volume::new(client.clone(), format!("{base_path}_volume")), } } } @@ -8189,10 +7000,7 @@ impl MetricsTree_Transactions_Fees_Fee { pub fn new(client: Arc, base_path: String) -> Self { Self { bitcoin: CountPattern2::new(client.clone(), "fee_btc".to_string()), - dollars: MetricsTree_Transactions_Fees_Fee_Dollars::new( - client.clone(), - format!("{base_path}_dollars"), - ), + dollars: MetricsTree_Transactions_Fees_Fee_Dollars::new(client.clone(), format!("{base_path}_dollars")), sats: CountPattern2::new(client.clone(), "fee".to_string()), txindex: MetricPattern27::new(client.clone(), "fee".to_string()), } @@ -8219,10 +7027,7 @@ impl MetricsTree_Transactions_Fees_Fee_Dollars { Self { average: MetricPattern1::new(client.clone(), "fee_usd_average".to_string()), cumulative: MetricPattern2::new(client.clone(), "fee_usd_cumulative".to_string()), - height_cumulative: MetricPattern11::new( - client.clone(), - "fee_usd_cumulative".to_string(), - ), + height_cumulative: MetricPattern11::new(client.clone(), "fee_usd_cumulative".to_string()), max: MetricPattern1::new(client.clone(), "fee_usd_max".to_string()), median: MetricPattern11::new(client.clone(), "fee_usd_median".to_string()), min: MetricPattern1::new(client.clone(), "fee_usd_min".to_string()), @@ -8237,15 +7042,73 @@ impl MetricsTree_Transactions_Fees_Fee_Dollars { /// Metrics tree node. pub struct MetricsTree_Transactions_Size { - pub vsize: FeeRatePattern, - pub weight: FeeRatePattern, + pub vsize: MetricsTree_Transactions_Size_Vsize, + pub weight: MetricsTree_Transactions_Size_Weight, } impl MetricsTree_Transactions_Size { pub fn new(client: Arc, base_path: String) -> Self { Self { - vsize: FeeRatePattern::new(client.clone(), "tx_vsize_average".to_string()), - weight: FeeRatePattern::new(client.clone(), "tx_weight_average".to_string()), + vsize: MetricsTree_Transactions_Size_Vsize::new(client.clone(), format!("{base_path}_vsize")), + weight: MetricsTree_Transactions_Size_Weight::new(client.clone(), format!("{base_path}_weight")), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Transactions_Size_Vsize { + pub average: MetricPattern1, + pub max: MetricPattern1, + pub median: MetricPattern11, + pub min: MetricPattern1, + pub pct10: MetricPattern11, + pub pct25: MetricPattern11, + pub pct75: MetricPattern11, + pub pct90: MetricPattern11, + pub txindex: MetricPattern27, +} + +impl MetricsTree_Transactions_Size_Vsize { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + average: MetricPattern1::new(client.clone(), "tx_vsize_average".to_string()), + max: MetricPattern1::new(client.clone(), "tx_vsize_max".to_string()), + median: MetricPattern11::new(client.clone(), "tx_vsize_median".to_string()), + min: MetricPattern1::new(client.clone(), "tx_vsize_min".to_string()), + pct10: MetricPattern11::new(client.clone(), "tx_vsize_pct10".to_string()), + pct25: MetricPattern11::new(client.clone(), "tx_vsize_pct25".to_string()), + pct75: MetricPattern11::new(client.clone(), "tx_vsize_pct75".to_string()), + pct90: MetricPattern11::new(client.clone(), "tx_vsize_pct90".to_string()), + txindex: MetricPattern27::new(client.clone(), "vsize".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Transactions_Size_Weight { + pub average: MetricPattern1, + pub max: MetricPattern1, + pub median: MetricPattern11, + pub min: MetricPattern1, + pub pct10: MetricPattern11, + pub pct25: MetricPattern11, + pub pct75: MetricPattern11, + pub pct90: MetricPattern11, + pub txindex: MetricPattern27, +} + +impl MetricsTree_Transactions_Size_Weight { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + average: MetricPattern1::new(client.clone(), "tx_weight_average".to_string()), + max: MetricPattern1::new(client.clone(), "tx_weight_max".to_string()), + median: MetricPattern11::new(client.clone(), "tx_weight_median".to_string()), + min: MetricPattern1::new(client.clone(), "tx_weight_min".to_string()), + pct10: MetricPattern11::new(client.clone(), "tx_weight_pct10".to_string()), + pct25: MetricPattern11::new(client.clone(), "tx_weight_pct25".to_string()), + pct75: MetricPattern11::new(client.clone(), "tx_weight_pct75".to_string()), + pct90: MetricPattern11::new(client.clone(), "tx_weight_pct90".to_string()), + txindex: MetricPattern27::new(client.clone(), "weight".to_string()), } } } @@ -8328,12 +7191,12 @@ impl BrkClient { /// .last(10) /// .json::()?; /// ``` - pub fn metric( - &self, - metric: impl Into, - index: Index, - ) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.base.clone(), Arc::from(metric.into().as_str()), index) + pub fn metric(&self, metric: impl Into, index: Index) -> MetricEndpointBuilder { + MetricEndpointBuilder::new( + self.base.clone(), + Arc::from(metric.into().as_str()), + index, + ) } /// Address information @@ -8354,24 +7217,11 @@ impl BrkClient { /// *[Mempool.space docs](https://mempool.space/docs/api/rest#get-address-transactions)* /// /// Endpoint: `GET /api/address/{address}/txs` - pub fn get_address_txs( - &self, - address: Address, - after_txid: Option<&str>, - limit: Option, - ) -> Result> { + pub fn get_address_txs(&self, address: Address, after_txid: Option<&str>, limit: Option) -> Result> { let mut query = Vec::new(); - if let Some(v) = after_txid { - query.push(format!("after_txid={}", v)); - } - if let Some(v) = limit { - query.push(format!("limit={}", v)); - } - let query_str = if query.is_empty() { - String::new() - } else { - format!("?{}", query.join("&")) - }; + if let Some(v) = after_txid { query.push(format!("after_txid={}", v)); } + if let Some(v) = limit { query.push(format!("limit={}", v)); } + let query_str = if query.is_empty() { String::new() } else { format!("?{}", query.join("&")) }; let path = format!("/api/address/{address}/txs{}", query_str); self.base.get_json(&path) } @@ -8383,24 +7233,11 @@ impl BrkClient { /// *[Mempool.space docs](https://mempool.space/docs/api/rest#get-address-transactions-chain)* /// /// Endpoint: `GET /api/address/{address}/txs/chain` - pub fn get_address_confirmed_txs( - &self, - address: Address, - after_txid: Option<&str>, - limit: Option, - ) -> Result> { + pub fn get_address_confirmed_txs(&self, address: Address, after_txid: Option<&str>, limit: Option) -> Result> { let mut query = Vec::new(); - if let Some(v) = after_txid { - query.push(format!("after_txid={}", v)); - } - if let Some(v) = limit { - query.push(format!("limit={}", v)); - } - let query_str = if query.is_empty() { - String::new() - } else { - format!("?{}", query.join("&")) - }; + if let Some(v) = after_txid { query.push(format!("after_txid={}", v)); } + if let Some(v) = limit { query.push(format!("limit={}", v)); } + let query_str = if query.is_empty() { String::new() } else { format!("?{}", query.join("&")) }; let path = format!("/api/address/{address}/txs/chain{}", query_str); self.base.get_json(&path) } @@ -8413,8 +7250,7 @@ impl BrkClient { /// /// Endpoint: `GET /api/address/{address}/txs/mempool` pub fn get_address_mempool_txs(&self, address: Address) -> Result> { - self.base - .get_json(&format!("/api/address/{address}/txs/mempool")) + self.base.get_json(&format!("/api/address/{address}/txs/mempool")) } /// Address UTXOs @@ -8480,8 +7316,7 @@ impl BrkClient { /// /// Endpoint: `GET /api/block/{hash}/txid/{index}` pub fn get_block_txid(&self, hash: BlockHash, index: TxIndex) -> Result { - self.base - .get_json(&format!("/api/block/{hash}/txid/{index}")) + self.base.get_json(&format!("/api/block/{hash}/txid/{index}")) } /// Block transaction IDs @@ -8503,8 +7338,7 @@ impl BrkClient { /// /// Endpoint: `GET /api/block/{hash}/txs/{start_index}` pub fn get_block_txs(&self, hash: BlockHash, start_index: TxIndex) -> Result> { - self.base - .get_json(&format!("/api/block/{hash}/txs/{start_index}")) + self.base.get_json(&format!("/api/block/{hash}/txs/{start_index}")) } /// Recent blocks @@ -8565,38 +7399,14 @@ impl BrkClient { /// Fetch data for a specific metric at the given index. Use query parameters to filter by date range and format (json/csv). /// /// Endpoint: `GET /api/metric/{metric}/{index}` - pub fn get_metric( - &self, - metric: Metric, - index: Index, - start: Option, - end: Option, - limit: Option<&str>, - format: Option, - ) -> Result> { + pub fn get_metric(&self, metric: Metric, index: Index, start: Option, end: Option, limit: Option<&str>, format: Option) -> Result> { let mut query = Vec::new(); - if let Some(v) = start { - query.push(format!("start={}", v)); - } - if let Some(v) = end { - query.push(format!("end={}", v)); - } - if let Some(v) = limit { - query.push(format!("limit={}", v)); - } - if let Some(v) = format { - query.push(format!("format={}", v)); - } - let query_str = if query.is_empty() { - String::new() - } else { - format!("?{}", query.join("&")) - }; - let path = format!( - "/api/metric/{metric}/{}{}", - index.serialize_long(), - query_str - ); + if let Some(v) = start { query.push(format!("start={}", v)); } + if let Some(v) = end { query.push(format!("end={}", v)); } + if let Some(v) = limit { query.push(format!("limit={}", v)); } + if let Some(v) = format { query.push(format!("format={}", v)); } + let query_str = if query.is_empty() { String::new() } else { format!("?{}", query.join("&")) }; + let path = format!("/api/metric/{metric}/{}{}", index.serialize_long(), query_str); if format == Some(Format::CSV) { self.base.get_text(&path).map(FormatResponse::Csv) } else { @@ -8618,35 +7428,15 @@ impl BrkClient { /// Fetch multiple metrics in a single request. Supports filtering by index and date range. Returns an array of MetricData objects. For a single metric, use `get_metric` instead. /// /// Endpoint: `GET /api/metrics/bulk` - pub fn get_metrics( - &self, - metrics: Metrics, - index: Index, - start: Option, - end: Option, - limit: Option<&str>, - format: Option, - ) -> Result>> { + pub fn get_metrics(&self, metrics: Metrics, index: Index, start: Option, end: Option, limit: Option<&str>, format: Option) -> Result>> { let mut query = Vec::new(); query.push(format!("metrics={}", metrics)); query.push(format!("index={}", index)); - if let Some(v) = start { - query.push(format!("start={}", v)); - } - if let Some(v) = end { - query.push(format!("end={}", v)); - } - if let Some(v) = limit { - query.push(format!("limit={}", v)); - } - if let Some(v) = format { - query.push(format!("format={}", v)); - } - let query_str = if query.is_empty() { - String::new() - } else { - format!("?{}", query.join("&")) - }; + if let Some(v) = start { query.push(format!("start={}", v)); } + if let Some(v) = end { query.push(format!("end={}", v)); } + if let Some(v) = limit { query.push(format!("limit={}", v)); } + if let Some(v) = format { query.push(format!("format={}", v)); } + let query_str = if query.is_empty() { String::new() } else { format!("?{}", query.join("&")) }; let path = format!("/api/metrics/bulk{}", query_str); if format == Some(Format::CSV) { self.base.get_text(&path).map(FormatResponse::Csv) @@ -8680,14 +7470,8 @@ impl BrkClient { /// Endpoint: `GET /api/metrics/list` pub fn list_metrics(&self, page: Option) -> Result { let mut query = Vec::new(); - if let Some(v) = page { - query.push(format!("page={}", v)); - } - let query_str = if query.is_empty() { - String::new() - } else { - format!("?{}", query.join("&")) - }; + if let Some(v) = page { query.push(format!("page={}", v)); } + let query_str = if query.is_empty() { String::new() } else { format!("?{}", query.join("&")) }; let path = format!("/api/metrics/list{}", query_str); self.base.get_json(&path) } @@ -8699,14 +7483,8 @@ impl BrkClient { /// Endpoint: `GET /api/metrics/search/{metric}` pub fn search_metrics(&self, metric: Metric, limit: Option) -> Result> { let mut query = Vec::new(); - if let Some(v) = limit { - query.push(format!("limit={}", v)); - } - let query_str = if query.is_empty() { - String::new() - } else { - format!("?{}", query.join("&")) - }; + if let Some(v) = limit { query.push(format!("limit={}", v)); } + let query_str = if query.is_empty() { String::new() } else { format!("?{}", query.join("&")) }; let path = format!("/api/metrics/search/{metric}{}", query_str); self.base.get_json(&path) } @@ -8759,8 +7537,7 @@ impl BrkClient { /// /// Endpoint: `GET /api/tx/{txid}/outspend/{vout}` pub fn get_tx_outspend(&self, txid: Txid, vout: Vout) -> Result { - self.base - .get_json(&format!("/api/tx/{txid}/outspend/{vout}")) + self.base.get_json(&format!("/api/tx/{txid}/outspend/{vout}")) } /// All output spend statuses @@ -8793,8 +7570,7 @@ impl BrkClient { /// /// Endpoint: `GET /api/v1/difficulty-adjustment` pub fn get_difficulty_adjustment(&self) -> Result { - self.base - .get_json(&format!("/api/v1/difficulty-adjustment")) + self.base.get_json(&format!("/api/v1/difficulty-adjustment")) } /// Projected mempool blocks @@ -8827,8 +7603,7 @@ impl BrkClient { /// /// Endpoint: `GET /api/v1/mining/blocks/fee-rates/{time_period}` pub fn get_block_fee_rates(&self, time_period: TimePeriod) -> Result { - self.base - .get_json(&format!("/api/v1/mining/blocks/fee-rates/{time_period}")) + self.base.get_json(&format!("/api/v1/mining/blocks/fee-rates/{time_period}")) } /// Block fees @@ -8839,8 +7614,7 @@ impl BrkClient { /// /// Endpoint: `GET /api/v1/mining/blocks/fees/{time_period}` pub fn get_block_fees(&self, time_period: TimePeriod) -> Result> { - self.base - .get_json(&format!("/api/v1/mining/blocks/fees/{time_period}")) + self.base.get_json(&format!("/api/v1/mining/blocks/fees/{time_period}")) } /// Block rewards @@ -8851,8 +7625,7 @@ impl BrkClient { /// /// Endpoint: `GET /api/v1/mining/blocks/rewards/{time_period}` pub fn get_block_rewards(&self, time_period: TimePeriod) -> Result> { - self.base - .get_json(&format!("/api/v1/mining/blocks/rewards/{time_period}")) + self.base.get_json(&format!("/api/v1/mining/blocks/rewards/{time_period}")) } /// Block sizes and weights @@ -8863,9 +7636,7 @@ impl BrkClient { /// /// Endpoint: `GET /api/v1/mining/blocks/sizes-weights/{time_period}` pub fn get_block_sizes_weights(&self, time_period: TimePeriod) -> Result { - self.base.get_json(&format!( - "/api/v1/mining/blocks/sizes-weights/{time_period}" - )) + self.base.get_json(&format!("/api/v1/mining/blocks/sizes-weights/{time_period}")) } /// Block by timestamp @@ -8876,8 +7647,7 @@ impl BrkClient { /// /// Endpoint: `GET /api/v1/mining/blocks/timestamp/{timestamp}` pub fn get_block_by_timestamp(&self, timestamp: Timestamp) -> Result { - self.base - .get_json(&format!("/api/v1/mining/blocks/timestamp/{timestamp}")) + self.base.get_json(&format!("/api/v1/mining/blocks/timestamp/{timestamp}")) } /// Difficulty adjustments (all time) @@ -8888,8 +7658,7 @@ impl BrkClient { /// /// Endpoint: `GET /api/v1/mining/difficulty-adjustments` pub fn get_difficulty_adjustments(&self) -> Result> { - self.base - .get_json(&format!("/api/v1/mining/difficulty-adjustments")) + self.base.get_json(&format!("/api/v1/mining/difficulty-adjustments")) } /// Difficulty adjustments @@ -8899,13 +7668,8 @@ impl BrkClient { /// *[Mempool.space docs](https://mempool.space/docs/api/rest#get-difficulty-adjustments)* /// /// Endpoint: `GET /api/v1/mining/difficulty-adjustments/{time_period}` - pub fn get_difficulty_adjustments_by_period( - &self, - time_period: TimePeriod, - ) -> Result> { - self.base.get_json(&format!( - "/api/v1/mining/difficulty-adjustments/{time_period}" - )) + pub fn get_difficulty_adjustments_by_period(&self, time_period: TimePeriod) -> Result> { + self.base.get_json(&format!("/api/v1/mining/difficulty-adjustments/{time_period}")) } /// Network hashrate (all time) @@ -8927,8 +7691,7 @@ impl BrkClient { /// /// Endpoint: `GET /api/v1/mining/hashrate/{time_period}` pub fn get_hashrate_by_period(&self, time_period: TimePeriod) -> Result { - self.base - .get_json(&format!("/api/v1/mining/hashrate/{time_period}")) + self.base.get_json(&format!("/api/v1/mining/hashrate/{time_period}")) } /// Mining pool details @@ -8961,8 +7724,7 @@ impl BrkClient { /// /// Endpoint: `GET /api/v1/mining/pools/{time_period}` pub fn get_pool_stats(&self, time_period: TimePeriod) -> Result { - self.base - .get_json(&format!("/api/v1/mining/pools/{time_period}")) + self.base.get_json(&format!("/api/v1/mining/pools/{time_period}")) } /// Mining reward statistics @@ -8973,8 +7735,7 @@ impl BrkClient { /// /// Endpoint: `GET /api/v1/mining/reward-stats/{block_count}` pub fn get_reward_stats(&self, block_count: i64) -> Result { - self.base - .get_json(&format!("/api/v1/mining/reward-stats/{block_count}")) + self.base.get_json(&format!("/api/v1/mining/reward-stats/{block_count}")) } /// Validate address @@ -8985,8 +7746,7 @@ impl BrkClient { /// /// Endpoint: `GET /api/v1/validate-address/{address}` pub fn validate_address(&self, address: &str) -> Result { - self.base - .get_json(&format!("/api/v1/validate-address/{address}")) + self.base.get_json(&format!("/api/v1/validate-address/{address}")) } /// Health check @@ -9006,4 +7766,5 @@ impl BrkClient { pub fn get_version(&self) -> Result { self.base.get_json(&format!("/version")) } + } diff --git a/crates/brk_computer/examples/computer_read.rs b/crates/brk_computer/examples/computer_read.rs index e2766882d..5e79eb676 100644 --- a/crates/brk_computer/examples/computer_read.rs +++ b/crates/brk_computer/examples/computer_read.rs @@ -1,10 +1,10 @@ -use std::{env, path::Path, thread}; +use std::{env, path::Path, thread, time::Instant}; use brk_computer::Computer; use brk_error::Result; use brk_fetcher::Fetcher; use brk_indexer::Indexer; -use vecdb::{AnyStoredVec, Exit}; +use vecdb::{AnySerializableVec, AnyVec, Exit}; pub fn main() -> Result<()> { // Can't increase main thread's stack size, thus we need to use another thread @@ -19,7 +19,6 @@ fn run() -> Result<()> { brk_logger::init(None)?; let outputs_dir = Path::new(&env::var("HOME").unwrap()).join(".brk"); - // let outputs_dir = Path::new("../../_outputs"); let indexer = Indexer::forced_import(&outputs_dir)?; @@ -30,7 +29,35 @@ fn run() -> Result<()> { let computer = Computer::forced_import(&outputs_dir, &indexer, Some(fetcher))?; - let _a = dbg!(computer.transactions.fees.fee.base.region().meta()); + // Test emptyaddressdata (underlying BytesVec) - direct access + let empty_data = &computer.distribution.addresses_data.empty; + println!("emptyaddressdata (BytesVec) len: {}", empty_data.len()); + + let start = Instant::now(); + let mut buf = Vec::new(); + empty_data.write_json(Some(empty_data.len() - 1), Some(empty_data.len()), &mut buf)?; + println!("emptyaddressdata last item JSON: {}", String::from_utf8_lossy(&buf)); + println!("Time for BytesVec write_json: {:?}", start.elapsed()); + + // Test emptyaddressindex (LazyVecFrom1 wrapper) - computed access + let empty_index = &computer.distribution.emptyaddressindex; + println!("\nemptyaddressindex (LazyVecFrom1) len: {}", empty_index.len()); + + let start = Instant::now(); + let mut buf = Vec::new(); + empty_index.write_json(Some(empty_index.len() - 1), Some(empty_index.len()), &mut buf)?; + println!("emptyaddressindex last item JSON: {}", String::from_utf8_lossy(&buf)); + println!("Time for LazyVecFrom1 write_json: {:?}", start.elapsed()); + + // Compare with loaded versions + let loaded_data = &computer.distribution.addresses_data.loaded; + println!("\nloadedaddressdata (BytesVec) len: {}", loaded_data.len()); + + let start = Instant::now(); + let mut buf = Vec::new(); + loaded_data.write_json(Some(loaded_data.len() - 1), Some(loaded_data.len()), &mut buf)?; + println!("loadedaddressdata last item JSON: {}", String::from_utf8_lossy(&buf)); + println!("Time for BytesVec write_json: {:?}", start.elapsed()); Ok(()) } diff --git a/crates/brk_error/src/lib.rs b/crates/brk_error/src/lib.rs index d685367b7..4244fd330 100644 --- a/crates/brk_error/src/lib.rs +++ b/crates/brk_error/src/lib.rs @@ -137,6 +137,18 @@ pub enum Error { impl Error { + /// Returns true if this error is due to a file lock (another process has the database open). + /// Lock errors are transient and should not trigger data deletion. + pub fn is_lock_error(&self) -> bool { + matches!(self, Error::VecDB(e) if e.is_lock_error()) + } + + /// Returns true if this error indicates data corruption or version incompatibility. + /// These errors may require resetting/deleting the data to recover. + pub fn is_data_error(&self) -> bool { + matches!(self, Error::VecDB(e) if e.is_data_error()) + } + /// Returns true if this network/fetch error indicates a permanent/blocking condition /// that won't be resolved by retrying (e.g., DNS failure, connection refused, blocked endpoint). /// Returns false for transient errors worth retrying (timeouts, rate limits, server errors). diff --git a/crates/brk_indexer/src/lib.rs b/crates/brk_indexer/src/lib.rs index a9e0d6b7c..15f63e330 100644 --- a/crates/brk_indexer/src/lib.rs +++ b/crates/brk_indexer/src/lib.rs @@ -47,27 +47,26 @@ impl Indexer { let indexed_path = outputs_dir.join("indexed"); let try_import = || -> Result { - let (vecs, stores) = thread::scope(|s| -> Result<_> { - let vecs = s.spawn(|| -> Result<_> { - let i = Instant::now(); - let vecs = Vecs::forced_import(&indexed_path, VERSION)?; - info!("Imported vecs in {:?}", i.elapsed()); - Ok(vecs) - }); + let i = Instant::now(); + let vecs = Vecs::forced_import(&indexed_path, VERSION)?; + info!("Imported vecs in {:?}", i.elapsed()); - let i = Instant::now(); - let stores = Stores::forced_import(&indexed_path, VERSION)?; - info!("Imported stores in {:?}", i.elapsed()); - - Ok((vecs.join().unwrap()?, stores)) - })?; + let i = Instant::now(); + let stores = Stores::forced_import(&indexed_path, VERSION)?; + info!("Imported stores in {:?}", i.elapsed()); Ok(Self { vecs, stores }) }; match try_import() { Ok(result) => Ok(result), - Err(err) if can_retry => { + Err(err) if err.is_lock_error() => { + // Lock errors are transient - another process has the database open. + // Don't delete data, just return the error. + Err(err) + } + Err(err) if can_retry && err.is_data_error() => { + // Data corruption or version mismatch - safe to delete and retry info!("{err:?}, deleting {indexed_path:?} and retrying"); fs::remove_dir_all(&indexed_path)?; Self::forced_import_inner(outputs_dir, false) diff --git a/modules/brk-client/index.js b/modules/brk-client/index.js index 2122f5d01..93ad7dfff 100644 --- a/modules/brk-client/index.js +++ b/modules/brk-client/index.js @@ -797,10 +797,9 @@ * @property {string|boolean} [cache] - Enable browser cache with default name (true), custom name (string), or disable (false). No effect in Node.js. Default: true */ -const _isBrowser = typeof window !== "undefined" && "caches" in window; -const _runIdle = (/** @type {VoidFunction} */ fn) => - (globalThis.requestIdleCallback ?? setTimeout)(fn); -const _defaultCacheName = "__BRK_CLIENT__"; +const _isBrowser = typeof window !== 'undefined' && 'caches' in window; +const _runIdle = (/** @type {VoidFunction} */ fn) => (globalThis.requestIdleCallback ?? setTimeout)(fn); +const _defaultCacheName = '__BRK_CLIENT__'; /** * @param {string|boolean|undefined} cache @@ -808,7 +807,7 @@ const _defaultCacheName = "__BRK_CLIENT__"; */ const _openCache = (cache) => { if (!_isBrowser || cache === false) return Promise.resolve(null); - const name = typeof cache === "string" ? cache : _defaultCacheName; + const name = typeof cache === 'string' ? cache : _defaultCacheName; return caches.open(name).catch(() => null); }; @@ -822,7 +821,7 @@ class BrkError extends Error { */ constructor(message, status) { super(message); - this.name = "BrkError"; + this.name = 'BrkError'; this.status = status; } } @@ -835,57 +834,65 @@ class BrkError extends Error { * @property {number} end - End index (exclusive) * @property {T[]} data - The metric data */ -/** @typedef {MetricData} AnyMetricData */ +/** @typedef {MetricData} AnyMetricData */ /** + * Thenable interface for await support. + * @template T + * @typedef {(onfulfilled?: (value: MetricData) => MetricData, onrejected?: (reason: Error) => never) => Promise>} Thenable + */ + +/** + * Metric endpoint builder. Callable (returns itself) so both .by.dateindex and .by.dateindex() work. * @template T * @typedef {Object} MetricEndpointBuilder - * @property {(n: number) => RangeBuilder} first - Fetch first n data points - * @property {(n: number) => RangeBuilder} last - Fetch last n data points - * @property {(start: number, end: number) => RangeBuilder} range - Set explicit range [start, end) - * @property {(start: number) => FromBuilder} from - Set start position, chain with take() or to() - * @property {(end: number) => ToBuilder} to - Set end position, chain with takeLast() or from() - * @property {(onUpdate?: (value: MetricData) => void) => Promise>} json - Execute and return JSON (all data) - * @property {() => Promise} csv - Execute and return CSV (all data) + * @property {(index: number) => SingleItemBuilder} get - Get single item at index + * @property {(start?: number, end?: number) => RangeBuilder} slice - Slice like Array.slice + * @property {(n: number) => RangeBuilder} first - Get first n items + * @property {(n: number) => RangeBuilder} last - Get last n items + * @property {(n: number) => SkippedBuilder} skip - Skip first n items, chain with take() + * @property {(onUpdate?: (value: MetricData) => void) => Promise>} fetch - Fetch all data + * @property {() => Promise} fetchCsv - Fetch all data as CSV + * @property {Thenable} then - Thenable (await endpoint) * @property {string} path - The endpoint path */ -/** @typedef {MetricEndpointBuilder} AnyMetricEndpointBuilder */ +/** @typedef {MetricEndpointBuilder} AnyMetricEndpointBuilder */ /** * @template T - * @typedef {Object} FromBuilder - * @property {(n: number) => RangeBuilder} take - Take n items from start position - * @property {(end: number) => RangeBuilder} to - Set end position - * @property {(onUpdate?: (value: MetricData) => void) => Promise>} json - Execute and return JSON - * @property {() => Promise} csv - Execute and return CSV + * @typedef {Object} SingleItemBuilder + * @property {(onUpdate?: (value: MetricData) => void) => Promise>} fetch - Fetch the item + * @property {() => Promise} fetchCsv - Fetch as CSV + * @property {Thenable} then - Thenable */ /** * @template T - * @typedef {Object} ToBuilder - * @property {(n: number) => RangeBuilder} takeLast - Take last n items before end position - * @property {(start: number) => RangeBuilder} from - Set start position - * @property {(onUpdate?: (value: MetricData) => void) => Promise>} json - Execute and return JSON - * @property {() => Promise} csv - Execute and return CSV + * @typedef {Object} SkippedBuilder + * @property {(n: number) => RangeBuilder} take - Take n items after skipped position + * @property {(onUpdate?: (value: MetricData) => void) => Promise>} fetch - Fetch from skipped position to end + * @property {() => Promise} fetchCsv - Fetch as CSV + * @property {Thenable} then - Thenable */ /** * @template T * @typedef {Object} RangeBuilder - * @property {(onUpdate?: (value: MetricData) => void) => Promise>} json - Execute and return JSON - * @property {() => Promise} csv - Execute and return CSV + * @property {(onUpdate?: (value: MetricData) => void) => Promise>} fetch - Fetch the range + * @property {() => Promise} fetchCsv - Fetch as CSV + * @property {Thenable} then - Thenable */ /** * @template T * @typedef {Object} MetricPattern * @property {string} name - The metric name - * @property {Partial>>} by - Index endpoints (lazy getters) + * @property {Readonly>>>} by - Index endpoints as lazy getters. Access via .by.dateindex or .by['dateindex'] * @property {() => Index[]} indexes - Get the list of available indexes * @property {(index: Index) => MetricEndpointBuilder|undefined} get - Get an endpoint for a specific index */ -/** @typedef {MetricPattern} AnyMetricPattern */ +/** @typedef {MetricPattern} AnyMetricPattern */ /** * Create a metric endpoint builder with typestate pattern. @@ -906,9 +913,9 @@ function _endpoint(client, name, index) { */ const buildPath = (start, end, format) => { const params = new URLSearchParams(); - if (start !== undefined) params.set("start", String(start)); - if (end !== undefined) params.set("end", String(end)); - if (format) params.set("format", format); + if (start !== undefined) params.set('start', String(start)); + if (end !== undefined) params.set('end', String(end)); + if (format) params.set('format', format); const query = params.toString(); return query ? `${p}?${query}` : p; }; @@ -919,78 +926,46 @@ function _endpoint(client, name, index) { * @returns {RangeBuilder} */ const rangeBuilder = (start, end) => ({ - json(/** @type {((value: MetricData) => void) | undefined} */ onUpdate) { - return client.getJson(buildPath(start, end), onUpdate); - }, - csv() { - return client.getText(buildPath(start, end, "csv")); - }, + fetch(onUpdate) { return client.getJson(buildPath(start, end), onUpdate); }, + fetchCsv() { return client.getText(buildPath(start, end, 'csv')); }, + then(resolve, reject) { return this.fetch().then(resolve, reject); }, + }); + + /** + * @param {number} index + * @returns {SingleItemBuilder} + */ + const singleItemBuilder = (index) => ({ + fetch(onUpdate) { return client.getJson(buildPath(index, index + 1), onUpdate); }, + fetchCsv() { return client.getText(buildPath(index, index + 1, 'csv')); }, + then(resolve, reject) { return this.fetch().then(resolve, reject); }, }); /** * @param {number} start - * @returns {FromBuilder} + * @returns {SkippedBuilder} */ - const fromBuilder = (start) => ({ - take(/** @type {number} */ n) { - return rangeBuilder(start, start + n); - }, - to(/** @type {number} */ end) { - return rangeBuilder(start, end); - }, - json(/** @type {((value: MetricData) => void) | undefined} */ onUpdate) { - return client.getJson(buildPath(start, undefined), onUpdate); - }, - csv() { - return client.getText(buildPath(start, undefined, "csv")); - }, + const skippedBuilder = (start) => ({ + take(n) { return rangeBuilder(start, start + n); }, + fetch(onUpdate) { return client.getJson(buildPath(start, undefined), onUpdate); }, + fetchCsv() { return client.getText(buildPath(start, undefined, 'csv')); }, + then(resolve, reject) { return this.fetch().then(resolve, reject); }, }); - /** - * @param {number} end - * @returns {ToBuilder} - */ - const toBuilder = (end) => ({ - takeLast(/** @type {number} */ n) { - return rangeBuilder(end - n, end); - }, - from(/** @type {number} */ start) { - return rangeBuilder(start, end); - }, - json(/** @type {((value: MetricData) => void) | undefined} */ onUpdate) { - return client.getJson(buildPath(undefined, end), onUpdate); - }, - csv() { - return client.getText(buildPath(undefined, end, "csv")); - }, - }); - - return { - first(/** @type {number} */ n) { - return rangeBuilder(undefined, n); - }, - last(/** @type {number} */ n) { - return rangeBuilder(-n, undefined); - }, - range(/** @type {number} */ start, /** @type {number} */ end) { - return rangeBuilder(start, end); - }, - from(/** @type {number} */ start) { - return fromBuilder(start); - }, - to(/** @type {number} */ end) { - return toBuilder(end); - }, - json(/** @type {((value: MetricData) => void) | undefined} */ onUpdate) { - return client.getJson(buildPath(), onUpdate); - }, - csv() { - return client.getText(buildPath(undefined, undefined, "csv")); - }, - get path() { - return p; - }, + /** @type {MetricEndpointBuilder} */ + const endpoint = { + get(index) { return singleItemBuilder(index); }, + slice(start, end) { return rangeBuilder(start, end); }, + first(n) { return rangeBuilder(undefined, n); }, + last(n) { return rangeBuilder(-n, undefined); }, + skip(n) { return skippedBuilder(n); }, + fetch(onUpdate) { return client.getJson(buildPath(), onUpdate); }, + fetchCsv() { return client.getText(buildPath(undefined, undefined, 'csv')); }, + then(resolve, reject) { return this.fetch().then(resolve, reject); }, + get path() { return p; }, }; + + return endpoint; } /** @@ -1001,7 +976,7 @@ class BrkClientBase { * @param {BrkClientOptions|string} options */ constructor(options) { - const isString = typeof options === "string"; + const isString = typeof options === 'string'; this.baseUrl = isString ? options : options.baseUrl; this.timeout = isString ? 5000 : (options.timeout ?? 5000); /** @type {Promise} */ @@ -1013,9 +988,7 @@ class BrkClientBase { * @returns {Promise} */ async get(path) { - const base = this.baseUrl.endsWith("/") - ? this.baseUrl.slice(0, -1) - : this.baseUrl; + const base = this.baseUrl.endsWith('/') ? this.baseUrl.slice(0, -1) : this.baseUrl; const url = `${base}${path}`; const res = await fetch(url, { signal: AbortSignal.timeout(this.timeout) }); if (!res.ok) throw new BrkError(`HTTP ${res.status}`, res.status); @@ -1030,24 +1003,21 @@ class BrkClientBase { * @returns {Promise} */ async getJson(path, onUpdate) { - const base = this.baseUrl.endsWith("/") - ? this.baseUrl.slice(0, -1) - : this.baseUrl; + const base = this.baseUrl.endsWith('/') ? this.baseUrl.slice(0, -1) : this.baseUrl; const url = `${base}${path}`; const cache = await this._cachePromise; const cachedRes = await cache?.match(url); const cachedJson = cachedRes ? await cachedRes.json() : null; if (cachedJson) onUpdate?.(cachedJson); - if (!globalThis.navigator?.onLine) { + if (globalThis.navigator?.onLine === false) { if (cachedJson) return cachedJson; - throw new BrkError("Offline and no cached data available"); + throw new BrkError('Offline and no cached data available'); } try { const res = await this.get(path); - if (cachedRes?.headers.get("ETag") === res.headers.get("ETag")) - return cachedJson; + if (cachedRes?.headers.get('ETag') === res.headers.get('ETag')) return cachedJson; const cloned = res.clone(); const json = await res.json(); @@ -1077,13 +1047,16 @@ class BrkClientBase { * @param {string} s - Metric suffix * @returns {string} */ -const _m = (acc, s) => (acc ? `${acc}_${s}` : s); +const _m = (acc, s) => acc ? `${acc}_${s}` : s; + // Index accessor factory functions /** + * Metric pattern with index endpoints as lazy getters. + * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). * @template T - * @typedef {{ name: string, by: { dateindex: MetricEndpointBuilder, decadeindex: MetricEndpointBuilder, difficultyepoch: MetricEndpointBuilder, height: MetricEndpointBuilder, monthindex: MetricEndpointBuilder, quarterindex: MetricEndpointBuilder, semesterindex: MetricEndpointBuilder, weekindex: MetricEndpointBuilder, yearindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern1 + * @typedef {{ name: string, by: { readonly dateindex: MetricEndpointBuilder, readonly decadeindex: MetricEndpointBuilder, readonly difficultyepoch: MetricEndpointBuilder, readonly height: MetricEndpointBuilder, readonly monthindex: MetricEndpointBuilder, readonly quarterindex: MetricEndpointBuilder, readonly semesterindex: MetricEndpointBuilder, readonly weekindex: MetricEndpointBuilder, readonly yearindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern1 */ /** @@ -1097,58 +1070,32 @@ function createMetricPattern1(client, name) { return { name, by: { - get dateindex() { - return _endpoint(client, name, "dateindex"); - }, - get decadeindex() { - return _endpoint(client, name, "decadeindex"); - }, - get difficultyepoch() { - return _endpoint(client, name, "difficultyepoch"); - }, - get height() { - return _endpoint(client, name, "height"); - }, - get monthindex() { - return _endpoint(client, name, "monthindex"); - }, - get quarterindex() { - return _endpoint(client, name, "quarterindex"); - }, - get semesterindex() { - return _endpoint(client, name, "semesterindex"); - }, - get weekindex() { - return _endpoint(client, name, "weekindex"); - }, - get yearindex() { - return _endpoint(client, name, "yearindex"); - }, + get dateindex() { return _endpoint(client, name, 'dateindex'); }, + get decadeindex() { return _endpoint(client, name, 'decadeindex'); }, + get difficultyepoch() { return _endpoint(client, name, 'difficultyepoch'); }, + get height() { return _endpoint(client, name, 'height'); }, + get monthindex() { return _endpoint(client, name, 'monthindex'); }, + get quarterindex() { return _endpoint(client, name, 'quarterindex'); }, + get semesterindex() { return _endpoint(client, name, 'semesterindex'); }, + get weekindex() { return _endpoint(client, name, 'weekindex'); }, + get yearindex() { return _endpoint(client, name, 'yearindex'); } }, indexes() { - return [ - "dateindex", - "decadeindex", - "difficultyepoch", - "height", - "monthindex", - "quarterindex", - "semesterindex", - "weekindex", - "yearindex", - ]; + return ['dateindex', 'decadeindex', 'difficultyepoch', 'height', 'monthindex', 'quarterindex', 'semesterindex', 'weekindex', 'yearindex']; }, get(index) { if (this.indexes().includes(index)) { return _endpoint(client, name, index); } - }, + } }; } /** + * Metric pattern with index endpoints as lazy getters. + * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). * @template T - * @typedef {{ name: string, by: { dateindex: MetricEndpointBuilder, decadeindex: MetricEndpointBuilder, difficultyepoch: MetricEndpointBuilder, monthindex: MetricEndpointBuilder, quarterindex: MetricEndpointBuilder, semesterindex: MetricEndpointBuilder, weekindex: MetricEndpointBuilder, yearindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern2 + * @typedef {{ name: string, by: { readonly dateindex: MetricEndpointBuilder, readonly decadeindex: MetricEndpointBuilder, readonly difficultyepoch: MetricEndpointBuilder, readonly monthindex: MetricEndpointBuilder, readonly quarterindex: MetricEndpointBuilder, readonly semesterindex: MetricEndpointBuilder, readonly weekindex: MetricEndpointBuilder, readonly yearindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern2 */ /** @@ -1162,54 +1109,31 @@ function createMetricPattern2(client, name) { return { name, by: { - get dateindex() { - return _endpoint(client, name, "dateindex"); - }, - get decadeindex() { - return _endpoint(client, name, "decadeindex"); - }, - get difficultyepoch() { - return _endpoint(client, name, "difficultyepoch"); - }, - get monthindex() { - return _endpoint(client, name, "monthindex"); - }, - get quarterindex() { - return _endpoint(client, name, "quarterindex"); - }, - get semesterindex() { - return _endpoint(client, name, "semesterindex"); - }, - get weekindex() { - return _endpoint(client, name, "weekindex"); - }, - get yearindex() { - return _endpoint(client, name, "yearindex"); - }, + get dateindex() { return _endpoint(client, name, 'dateindex'); }, + get decadeindex() { return _endpoint(client, name, 'decadeindex'); }, + get difficultyepoch() { return _endpoint(client, name, 'difficultyepoch'); }, + get monthindex() { return _endpoint(client, name, 'monthindex'); }, + get quarterindex() { return _endpoint(client, name, 'quarterindex'); }, + get semesterindex() { return _endpoint(client, name, 'semesterindex'); }, + get weekindex() { return _endpoint(client, name, 'weekindex'); }, + get yearindex() { return _endpoint(client, name, 'yearindex'); } }, indexes() { - return [ - "dateindex", - "decadeindex", - "difficultyepoch", - "monthindex", - "quarterindex", - "semesterindex", - "weekindex", - "yearindex", - ]; + return ['dateindex', 'decadeindex', 'difficultyepoch', 'monthindex', 'quarterindex', 'semesterindex', 'weekindex', 'yearindex']; }, get(index) { if (this.indexes().includes(index)) { return _endpoint(client, name, index); } - }, + } }; } /** + * Metric pattern with index endpoints as lazy getters. + * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). * @template T - * @typedef {{ name: string, by: { dateindex: MetricEndpointBuilder, decadeindex: MetricEndpointBuilder, height: MetricEndpointBuilder, monthindex: MetricEndpointBuilder, quarterindex: MetricEndpointBuilder, semesterindex: MetricEndpointBuilder, weekindex: MetricEndpointBuilder, yearindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern3 + * @typedef {{ name: string, by: { readonly dateindex: MetricEndpointBuilder, readonly decadeindex: MetricEndpointBuilder, readonly height: MetricEndpointBuilder, readonly monthindex: MetricEndpointBuilder, readonly quarterindex: MetricEndpointBuilder, readonly semesterindex: MetricEndpointBuilder, readonly weekindex: MetricEndpointBuilder, readonly yearindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern3 */ /** @@ -1223,54 +1147,31 @@ function createMetricPattern3(client, name) { return { name, by: { - get dateindex() { - return _endpoint(client, name, "dateindex"); - }, - get decadeindex() { - return _endpoint(client, name, "decadeindex"); - }, - get height() { - return _endpoint(client, name, "height"); - }, - get monthindex() { - return _endpoint(client, name, "monthindex"); - }, - get quarterindex() { - return _endpoint(client, name, "quarterindex"); - }, - get semesterindex() { - return _endpoint(client, name, "semesterindex"); - }, - get weekindex() { - return _endpoint(client, name, "weekindex"); - }, - get yearindex() { - return _endpoint(client, name, "yearindex"); - }, + get dateindex() { return _endpoint(client, name, 'dateindex'); }, + get decadeindex() { return _endpoint(client, name, 'decadeindex'); }, + get height() { return _endpoint(client, name, 'height'); }, + get monthindex() { return _endpoint(client, name, 'monthindex'); }, + get quarterindex() { return _endpoint(client, name, 'quarterindex'); }, + get semesterindex() { return _endpoint(client, name, 'semesterindex'); }, + get weekindex() { return _endpoint(client, name, 'weekindex'); }, + get yearindex() { return _endpoint(client, name, 'yearindex'); } }, indexes() { - return [ - "dateindex", - "decadeindex", - "height", - "monthindex", - "quarterindex", - "semesterindex", - "weekindex", - "yearindex", - ]; + return ['dateindex', 'decadeindex', 'height', 'monthindex', 'quarterindex', 'semesterindex', 'weekindex', 'yearindex']; }, get(index) { if (this.indexes().includes(index)) { return _endpoint(client, name, index); } - }, + } }; } /** + * Metric pattern with index endpoints as lazy getters. + * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). * @template T - * @typedef {{ name: string, by: { dateindex: MetricEndpointBuilder, decadeindex: MetricEndpointBuilder, monthindex: MetricEndpointBuilder, quarterindex: MetricEndpointBuilder, semesterindex: MetricEndpointBuilder, weekindex: MetricEndpointBuilder, yearindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern4 + * @typedef {{ name: string, by: { readonly dateindex: MetricEndpointBuilder, readonly decadeindex: MetricEndpointBuilder, readonly monthindex: MetricEndpointBuilder, readonly quarterindex: MetricEndpointBuilder, readonly semesterindex: MetricEndpointBuilder, readonly weekindex: MetricEndpointBuilder, readonly yearindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern4 */ /** @@ -1284,50 +1185,30 @@ function createMetricPattern4(client, name) { return { name, by: { - get dateindex() { - return _endpoint(client, name, "dateindex"); - }, - get decadeindex() { - return _endpoint(client, name, "decadeindex"); - }, - get monthindex() { - return _endpoint(client, name, "monthindex"); - }, - get quarterindex() { - return _endpoint(client, name, "quarterindex"); - }, - get semesterindex() { - return _endpoint(client, name, "semesterindex"); - }, - get weekindex() { - return _endpoint(client, name, "weekindex"); - }, - get yearindex() { - return _endpoint(client, name, "yearindex"); - }, + get dateindex() { return _endpoint(client, name, 'dateindex'); }, + get decadeindex() { return _endpoint(client, name, 'decadeindex'); }, + get monthindex() { return _endpoint(client, name, 'monthindex'); }, + get quarterindex() { return _endpoint(client, name, 'quarterindex'); }, + get semesterindex() { return _endpoint(client, name, 'semesterindex'); }, + get weekindex() { return _endpoint(client, name, 'weekindex'); }, + get yearindex() { return _endpoint(client, name, 'yearindex'); } }, indexes() { - return [ - "dateindex", - "decadeindex", - "monthindex", - "quarterindex", - "semesterindex", - "weekindex", - "yearindex", - ]; + return ['dateindex', 'decadeindex', 'monthindex', 'quarterindex', 'semesterindex', 'weekindex', 'yearindex']; }, get(index) { if (this.indexes().includes(index)) { return _endpoint(client, name, index); } - }, + } }; } /** + * Metric pattern with index endpoints as lazy getters. + * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). * @template T - * @typedef {{ name: string, by: { dateindex: MetricEndpointBuilder, height: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern5 + * @typedef {{ name: string, by: { readonly dateindex: MetricEndpointBuilder, readonly height: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern5 */ /** @@ -1341,27 +1222,25 @@ function createMetricPattern5(client, name) { return { name, by: { - get dateindex() { - return _endpoint(client, name, "dateindex"); - }, - get height() { - return _endpoint(client, name, "height"); - }, + get dateindex() { return _endpoint(client, name, 'dateindex'); }, + get height() { return _endpoint(client, name, 'height'); } }, indexes() { - return ["dateindex", "height"]; + return ['dateindex', 'height']; }, get(index) { if (this.indexes().includes(index)) { return _endpoint(client, name, index); } - }, + } }; } /** + * Metric pattern with index endpoints as lazy getters. + * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). * @template T - * @typedef {{ name: string, by: { dateindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern6 + * @typedef {{ name: string, by: { readonly dateindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern6 */ /** @@ -1375,24 +1254,24 @@ function createMetricPattern6(client, name) { return { name, by: { - get dateindex() { - return _endpoint(client, name, "dateindex"); - }, + get dateindex() { return _endpoint(client, name, 'dateindex'); } }, indexes() { - return ["dateindex"]; + return ['dateindex']; }, get(index) { if (this.indexes().includes(index)) { return _endpoint(client, name, index); } - }, + } }; } /** + * Metric pattern with index endpoints as lazy getters. + * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). * @template T - * @typedef {{ name: string, by: { decadeindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern7 + * @typedef {{ name: string, by: { readonly decadeindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern7 */ /** @@ -1406,24 +1285,24 @@ function createMetricPattern7(client, name) { return { name, by: { - get decadeindex() { - return _endpoint(client, name, "decadeindex"); - }, + get decadeindex() { return _endpoint(client, name, 'decadeindex'); } }, indexes() { - return ["decadeindex"]; + return ['decadeindex']; }, get(index) { if (this.indexes().includes(index)) { return _endpoint(client, name, index); } - }, + } }; } /** + * Metric pattern with index endpoints as lazy getters. + * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). * @template T - * @typedef {{ name: string, by: { difficultyepoch: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern8 + * @typedef {{ name: string, by: { readonly difficultyepoch: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern8 */ /** @@ -1437,24 +1316,24 @@ function createMetricPattern8(client, name) { return { name, by: { - get difficultyepoch() { - return _endpoint(client, name, "difficultyepoch"); - }, + get difficultyepoch() { return _endpoint(client, name, 'difficultyepoch'); } }, indexes() { - return ["difficultyepoch"]; + return ['difficultyepoch']; }, get(index) { if (this.indexes().includes(index)) { return _endpoint(client, name, index); } - }, + } }; } /** + * Metric pattern with index endpoints as lazy getters. + * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). * @template T - * @typedef {{ name: string, by: { emptyoutputindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern9 + * @typedef {{ name: string, by: { readonly emptyoutputindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern9 */ /** @@ -1468,24 +1347,24 @@ function createMetricPattern9(client, name) { return { name, by: { - get emptyoutputindex() { - return _endpoint(client, name, "emptyoutputindex"); - }, + get emptyoutputindex() { return _endpoint(client, name, 'emptyoutputindex'); } }, indexes() { - return ["emptyoutputindex"]; + return ['emptyoutputindex']; }, get(index) { if (this.indexes().includes(index)) { return _endpoint(client, name, index); } - }, + } }; } /** + * Metric pattern with index endpoints as lazy getters. + * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). * @template T - * @typedef {{ name: string, by: { halvingepoch: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern10 + * @typedef {{ name: string, by: { readonly halvingepoch: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern10 */ /** @@ -1499,24 +1378,24 @@ function createMetricPattern10(client, name) { return { name, by: { - get halvingepoch() { - return _endpoint(client, name, "halvingepoch"); - }, + get halvingepoch() { return _endpoint(client, name, 'halvingepoch'); } }, indexes() { - return ["halvingepoch"]; + return ['halvingepoch']; }, get(index) { if (this.indexes().includes(index)) { return _endpoint(client, name, index); } - }, + } }; } /** + * Metric pattern with index endpoints as lazy getters. + * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). * @template T - * @typedef {{ name: string, by: { height: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern11 + * @typedef {{ name: string, by: { readonly height: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern11 */ /** @@ -1530,24 +1409,24 @@ function createMetricPattern11(client, name) { return { name, by: { - get height() { - return _endpoint(client, name, "height"); - }, + get height() { return _endpoint(client, name, 'height'); } }, indexes() { - return ["height"]; + return ['height']; }, get(index) { if (this.indexes().includes(index)) { return _endpoint(client, name, index); } - }, + } }; } /** + * Metric pattern with index endpoints as lazy getters. + * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). * @template T - * @typedef {{ name: string, by: { txinindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern12 + * @typedef {{ name: string, by: { readonly txinindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern12 */ /** @@ -1561,24 +1440,24 @@ function createMetricPattern12(client, name) { return { name, by: { - get txinindex() { - return _endpoint(client, name, "txinindex"); - }, + get txinindex() { return _endpoint(client, name, 'txinindex'); } }, indexes() { - return ["txinindex"]; + return ['txinindex']; }, get(index) { if (this.indexes().includes(index)) { return _endpoint(client, name, index); } - }, + } }; } /** + * Metric pattern with index endpoints as lazy getters. + * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). * @template T - * @typedef {{ name: string, by: { monthindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern13 + * @typedef {{ name: string, by: { readonly monthindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern13 */ /** @@ -1592,24 +1471,24 @@ function createMetricPattern13(client, name) { return { name, by: { - get monthindex() { - return _endpoint(client, name, "monthindex"); - }, + get monthindex() { return _endpoint(client, name, 'monthindex'); } }, indexes() { - return ["monthindex"]; + return ['monthindex']; }, get(index) { if (this.indexes().includes(index)) { return _endpoint(client, name, index); } - }, + } }; } /** + * Metric pattern with index endpoints as lazy getters. + * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). * @template T - * @typedef {{ name: string, by: { opreturnindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern14 + * @typedef {{ name: string, by: { readonly opreturnindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern14 */ /** @@ -1623,24 +1502,24 @@ function createMetricPattern14(client, name) { return { name, by: { - get opreturnindex() { - return _endpoint(client, name, "opreturnindex"); - }, + get opreturnindex() { return _endpoint(client, name, 'opreturnindex'); } }, indexes() { - return ["opreturnindex"]; + return ['opreturnindex']; }, get(index) { if (this.indexes().includes(index)) { return _endpoint(client, name, index); } - }, + } }; } /** + * Metric pattern with index endpoints as lazy getters. + * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). * @template T - * @typedef {{ name: string, by: { txoutindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern15 + * @typedef {{ name: string, by: { readonly txoutindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern15 */ /** @@ -1654,24 +1533,24 @@ function createMetricPattern15(client, name) { return { name, by: { - get txoutindex() { - return _endpoint(client, name, "txoutindex"); - }, + get txoutindex() { return _endpoint(client, name, 'txoutindex'); } }, indexes() { - return ["txoutindex"]; + return ['txoutindex']; }, get(index) { if (this.indexes().includes(index)) { return _endpoint(client, name, index); } - }, + } }; } /** + * Metric pattern with index endpoints as lazy getters. + * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). * @template T - * @typedef {{ name: string, by: { p2aaddressindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern16 + * @typedef {{ name: string, by: { readonly p2aaddressindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern16 */ /** @@ -1685,24 +1564,24 @@ function createMetricPattern16(client, name) { return { name, by: { - get p2aaddressindex() { - return _endpoint(client, name, "p2aaddressindex"); - }, + get p2aaddressindex() { return _endpoint(client, name, 'p2aaddressindex'); } }, indexes() { - return ["p2aaddressindex"]; + return ['p2aaddressindex']; }, get(index) { if (this.indexes().includes(index)) { return _endpoint(client, name, index); } - }, + } }; } /** + * Metric pattern with index endpoints as lazy getters. + * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). * @template T - * @typedef {{ name: string, by: { p2msoutputindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern17 + * @typedef {{ name: string, by: { readonly p2msoutputindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern17 */ /** @@ -1716,24 +1595,24 @@ function createMetricPattern17(client, name) { return { name, by: { - get p2msoutputindex() { - return _endpoint(client, name, "p2msoutputindex"); - }, + get p2msoutputindex() { return _endpoint(client, name, 'p2msoutputindex'); } }, indexes() { - return ["p2msoutputindex"]; + return ['p2msoutputindex']; }, get(index) { if (this.indexes().includes(index)) { return _endpoint(client, name, index); } - }, + } }; } /** + * Metric pattern with index endpoints as lazy getters. + * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). * @template T - * @typedef {{ name: string, by: { p2pk33addressindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern18 + * @typedef {{ name: string, by: { readonly p2pk33addressindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern18 */ /** @@ -1747,24 +1626,24 @@ function createMetricPattern18(client, name) { return { name, by: { - get p2pk33addressindex() { - return _endpoint(client, name, "p2pk33addressindex"); - }, + get p2pk33addressindex() { return _endpoint(client, name, 'p2pk33addressindex'); } }, indexes() { - return ["p2pk33addressindex"]; + return ['p2pk33addressindex']; }, get(index) { if (this.indexes().includes(index)) { return _endpoint(client, name, index); } - }, + } }; } /** + * Metric pattern with index endpoints as lazy getters. + * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). * @template T - * @typedef {{ name: string, by: { p2pk65addressindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern19 + * @typedef {{ name: string, by: { readonly p2pk65addressindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern19 */ /** @@ -1778,24 +1657,24 @@ function createMetricPattern19(client, name) { return { name, by: { - get p2pk65addressindex() { - return _endpoint(client, name, "p2pk65addressindex"); - }, + get p2pk65addressindex() { return _endpoint(client, name, 'p2pk65addressindex'); } }, indexes() { - return ["p2pk65addressindex"]; + return ['p2pk65addressindex']; }, get(index) { if (this.indexes().includes(index)) { return _endpoint(client, name, index); } - }, + } }; } /** + * Metric pattern with index endpoints as lazy getters. + * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). * @template T - * @typedef {{ name: string, by: { p2pkhaddressindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern20 + * @typedef {{ name: string, by: { readonly p2pkhaddressindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern20 */ /** @@ -1809,24 +1688,24 @@ function createMetricPattern20(client, name) { return { name, by: { - get p2pkhaddressindex() { - return _endpoint(client, name, "p2pkhaddressindex"); - }, + get p2pkhaddressindex() { return _endpoint(client, name, 'p2pkhaddressindex'); } }, indexes() { - return ["p2pkhaddressindex"]; + return ['p2pkhaddressindex']; }, get(index) { if (this.indexes().includes(index)) { return _endpoint(client, name, index); } - }, + } }; } /** + * Metric pattern with index endpoints as lazy getters. + * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). * @template T - * @typedef {{ name: string, by: { p2shaddressindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern21 + * @typedef {{ name: string, by: { readonly p2shaddressindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern21 */ /** @@ -1840,24 +1719,24 @@ function createMetricPattern21(client, name) { return { name, by: { - get p2shaddressindex() { - return _endpoint(client, name, "p2shaddressindex"); - }, + get p2shaddressindex() { return _endpoint(client, name, 'p2shaddressindex'); } }, indexes() { - return ["p2shaddressindex"]; + return ['p2shaddressindex']; }, get(index) { if (this.indexes().includes(index)) { return _endpoint(client, name, index); } - }, + } }; } /** + * Metric pattern with index endpoints as lazy getters. + * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). * @template T - * @typedef {{ name: string, by: { p2traddressindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern22 + * @typedef {{ name: string, by: { readonly p2traddressindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern22 */ /** @@ -1871,24 +1750,24 @@ function createMetricPattern22(client, name) { return { name, by: { - get p2traddressindex() { - return _endpoint(client, name, "p2traddressindex"); - }, + get p2traddressindex() { return _endpoint(client, name, 'p2traddressindex'); } }, indexes() { - return ["p2traddressindex"]; + return ['p2traddressindex']; }, get(index) { if (this.indexes().includes(index)) { return _endpoint(client, name, index); } - }, + } }; } /** + * Metric pattern with index endpoints as lazy getters. + * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). * @template T - * @typedef {{ name: string, by: { p2wpkhaddressindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern23 + * @typedef {{ name: string, by: { readonly p2wpkhaddressindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern23 */ /** @@ -1902,24 +1781,24 @@ function createMetricPattern23(client, name) { return { name, by: { - get p2wpkhaddressindex() { - return _endpoint(client, name, "p2wpkhaddressindex"); - }, + get p2wpkhaddressindex() { return _endpoint(client, name, 'p2wpkhaddressindex'); } }, indexes() { - return ["p2wpkhaddressindex"]; + return ['p2wpkhaddressindex']; }, get(index) { if (this.indexes().includes(index)) { return _endpoint(client, name, index); } - }, + } }; } /** + * Metric pattern with index endpoints as lazy getters. + * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). * @template T - * @typedef {{ name: string, by: { p2wshaddressindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern24 + * @typedef {{ name: string, by: { readonly p2wshaddressindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern24 */ /** @@ -1933,24 +1812,24 @@ function createMetricPattern24(client, name) { return { name, by: { - get p2wshaddressindex() { - return _endpoint(client, name, "p2wshaddressindex"); - }, + get p2wshaddressindex() { return _endpoint(client, name, 'p2wshaddressindex'); } }, indexes() { - return ["p2wshaddressindex"]; + return ['p2wshaddressindex']; }, get(index) { if (this.indexes().includes(index)) { return _endpoint(client, name, index); } - }, + } }; } /** + * Metric pattern with index endpoints as lazy getters. + * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). * @template T - * @typedef {{ name: string, by: { quarterindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern25 + * @typedef {{ name: string, by: { readonly quarterindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern25 */ /** @@ -1964,24 +1843,24 @@ function createMetricPattern25(client, name) { return { name, by: { - get quarterindex() { - return _endpoint(client, name, "quarterindex"); - }, + get quarterindex() { return _endpoint(client, name, 'quarterindex'); } }, indexes() { - return ["quarterindex"]; + return ['quarterindex']; }, get(index) { if (this.indexes().includes(index)) { return _endpoint(client, name, index); } - }, + } }; } /** + * Metric pattern with index endpoints as lazy getters. + * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). * @template T - * @typedef {{ name: string, by: { semesterindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern26 + * @typedef {{ name: string, by: { readonly semesterindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern26 */ /** @@ -1995,24 +1874,24 @@ function createMetricPattern26(client, name) { return { name, by: { - get semesterindex() { - return _endpoint(client, name, "semesterindex"); - }, + get semesterindex() { return _endpoint(client, name, 'semesterindex'); } }, indexes() { - return ["semesterindex"]; + return ['semesterindex']; }, get(index) { if (this.indexes().includes(index)) { return _endpoint(client, name, index); } - }, + } }; } /** + * Metric pattern with index endpoints as lazy getters. + * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). * @template T - * @typedef {{ name: string, by: { txindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern27 + * @typedef {{ name: string, by: { readonly txindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern27 */ /** @@ -2026,24 +1905,24 @@ function createMetricPattern27(client, name) { return { name, by: { - get txindex() { - return _endpoint(client, name, "txindex"); - }, + get txindex() { return _endpoint(client, name, 'txindex'); } }, indexes() { - return ["txindex"]; + return ['txindex']; }, get(index) { if (this.indexes().includes(index)) { return _endpoint(client, name, index); } - }, + } }; } /** + * Metric pattern with index endpoints as lazy getters. + * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). * @template T - * @typedef {{ name: string, by: { unknownoutputindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern28 + * @typedef {{ name: string, by: { readonly unknownoutputindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern28 */ /** @@ -2057,24 +1936,24 @@ function createMetricPattern28(client, name) { return { name, by: { - get unknownoutputindex() { - return _endpoint(client, name, "unknownoutputindex"); - }, + get unknownoutputindex() { return _endpoint(client, name, 'unknownoutputindex'); } }, indexes() { - return ["unknownoutputindex"]; + return ['unknownoutputindex']; }, get(index) { if (this.indexes().includes(index)) { return _endpoint(client, name, index); } - }, + } }; } /** + * Metric pattern with index endpoints as lazy getters. + * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). * @template T - * @typedef {{ name: string, by: { weekindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern29 + * @typedef {{ name: string, by: { readonly weekindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern29 */ /** @@ -2088,24 +1967,24 @@ function createMetricPattern29(client, name) { return { name, by: { - get weekindex() { - return _endpoint(client, name, "weekindex"); - }, + get weekindex() { return _endpoint(client, name, 'weekindex'); } }, indexes() { - return ["weekindex"]; + return ['weekindex']; }, get(index) { if (this.indexes().includes(index)) { return _endpoint(client, name, index); } - }, + } }; } /** + * Metric pattern with index endpoints as lazy getters. + * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). * @template T - * @typedef {{ name: string, by: { yearindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern30 + * @typedef {{ name: string, by: { readonly yearindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern30 */ /** @@ -2119,24 +1998,24 @@ function createMetricPattern30(client, name) { return { name, by: { - get yearindex() { - return _endpoint(client, name, "yearindex"); - }, + get yearindex() { return _endpoint(client, name, 'yearindex'); } }, indexes() { - return ["yearindex"]; + return ['yearindex']; }, get(index) { if (this.indexes().includes(index)) { return _endpoint(client, name, index); } - }, + } }; } /** + * Metric pattern with index endpoints as lazy getters. + * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). * @template T - * @typedef {{ name: string, by: { loadedaddressindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern31 + * @typedef {{ name: string, by: { readonly loadedaddressindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern31 */ /** @@ -2150,24 +2029,24 @@ function createMetricPattern31(client, name) { return { name, by: { - get loadedaddressindex() { - return _endpoint(client, name, "loadedaddressindex"); - }, + get loadedaddressindex() { return _endpoint(client, name, 'loadedaddressindex'); } }, indexes() { - return ["loadedaddressindex"]; + return ['loadedaddressindex']; }, get(index) { if (this.indexes().includes(index)) { return _endpoint(client, name, index); } - }, + } }; } /** + * Metric pattern with index endpoints as lazy getters. + * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). * @template T - * @typedef {{ name: string, by: { emptyaddressindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern32 + * @typedef {{ name: string, by: { readonly emptyaddressindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern32 */ /** @@ -2181,18 +2060,16 @@ function createMetricPattern32(client, name) { return { name, by: { - get emptyaddressindex() { - return _endpoint(client, name, "emptyaddressindex"); - }, + get emptyaddressindex() { return _endpoint(client, name, 'emptyaddressindex'); } }, indexes() { - return ["emptyaddressindex"]; + return ['emptyaddressindex']; }, get(index) { if (this.indexes().includes(index)) { return _endpoint(client, name, index); } - }, + } }; } @@ -2242,95 +2119,38 @@ function createMetricPattern32(client, name) { */ function createRealizedPattern3(client, acc) { return { - adjustedSopr: createMetricPattern6(client, _m(acc, "adjusted_sopr")), - adjustedSopr30dEma: createMetricPattern6( - client, - _m(acc, "adjusted_sopr_30d_ema"), - ), - adjustedSopr7dEma: createMetricPattern6( - client, - _m(acc, "adjusted_sopr_7d_ema"), - ), - adjustedValueCreated: createMetricPattern1( - client, - _m(acc, "adjusted_value_created"), - ), - adjustedValueDestroyed: createMetricPattern1( - client, - _m(acc, "adjusted_value_destroyed"), - ), - mvrv: createMetricPattern4(client, _m(acc, "mvrv")), - negRealizedLoss: createBitcoinPattern(client, _m(acc, "neg_realized_loss")), - netRealizedPnl: createBlockCountPattern( - client, - _m(acc, "net_realized_pnl"), - ), - netRealizedPnlCumulative30dDelta: createMetricPattern4( - client, - _m(acc, "net_realized_pnl_cumulative_30d_delta"), - ), - netRealizedPnlCumulative30dDeltaRelToMarketCap: createMetricPattern4( - client, - _m(acc, "net_realized_pnl_cumulative_30d_delta_rel_to_market_cap"), - ), - netRealizedPnlCumulative30dDeltaRelToRealizedCap: createMetricPattern4( - client, - _m(acc, "net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap"), - ), - netRealizedPnlRelToRealizedCap: createBlockCountPattern( - client, - _m(acc, "net_realized_pnl_rel_to_realized_cap"), - ), - realizedCap: createMetricPattern1(client, _m(acc, "realized_cap")), - realizedCap30dDelta: createMetricPattern4( - client, - _m(acc, "realized_cap_30d_delta"), - ), - realizedCapRelToOwnMarketCap: createMetricPattern1( - client, - _m(acc, "realized_cap_rel_to_own_market_cap"), - ), - realizedLoss: createBlockCountPattern(client, _m(acc, "realized_loss")), - realizedLossRelToRealizedCap: createBlockCountPattern( - client, - _m(acc, "realized_loss_rel_to_realized_cap"), - ), - realizedPrice: createMetricPattern1(client, _m(acc, "realized_price")), - realizedPriceExtra: createActivePriceRatioPattern( - client, - _m(acc, "realized_price_ratio"), - ), - realizedProfit: createBlockCountPattern(client, _m(acc, "realized_profit")), - realizedProfitRelToRealizedCap: createBlockCountPattern( - client, - _m(acc, "realized_profit_rel_to_realized_cap"), - ), - realizedProfitToLossRatio: createMetricPattern6( - client, - _m(acc, "realized_profit_to_loss_ratio"), - ), - realizedValue: createMetricPattern1(client, _m(acc, "realized_value")), - sellSideRiskRatio: createMetricPattern6( - client, - _m(acc, "sell_side_risk_ratio"), - ), - sellSideRiskRatio30dEma: createMetricPattern6( - client, - _m(acc, "sell_side_risk_ratio_30d_ema"), - ), - sellSideRiskRatio7dEma: createMetricPattern6( - client, - _m(acc, "sell_side_risk_ratio_7d_ema"), - ), - sopr: createMetricPattern6(client, _m(acc, "sopr")), - sopr30dEma: createMetricPattern6(client, _m(acc, "sopr_30d_ema")), - sopr7dEma: createMetricPattern6(client, _m(acc, "sopr_7d_ema")), - totalRealizedPnl: createMetricPattern1( - client, - _m(acc, "total_realized_pnl"), - ), - valueCreated: createMetricPattern1(client, _m(acc, "value_created")), - valueDestroyed: createMetricPattern1(client, _m(acc, "value_destroyed")), + adjustedSopr: createMetricPattern6(client, _m(acc, 'adjusted_sopr')), + adjustedSopr30dEma: createMetricPattern6(client, _m(acc, 'adjusted_sopr_30d_ema')), + adjustedSopr7dEma: createMetricPattern6(client, _m(acc, 'adjusted_sopr_7d_ema')), + adjustedValueCreated: createMetricPattern1(client, _m(acc, 'adjusted_value_created')), + adjustedValueDestroyed: createMetricPattern1(client, _m(acc, 'adjusted_value_destroyed')), + mvrv: createMetricPattern4(client, _m(acc, 'mvrv')), + negRealizedLoss: createBitcoinPattern(client, _m(acc, 'neg_realized_loss')), + netRealizedPnl: createBlockCountPattern(client, _m(acc, 'net_realized_pnl')), + netRealizedPnlCumulative30dDelta: createMetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta')), + netRealizedPnlCumulative30dDeltaRelToMarketCap: createMetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_market_cap')), + netRealizedPnlCumulative30dDeltaRelToRealizedCap: createMetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap')), + netRealizedPnlRelToRealizedCap: createBlockCountPattern(client, _m(acc, 'net_realized_pnl_rel_to_realized_cap')), + realizedCap: createMetricPattern1(client, _m(acc, 'realized_cap')), + realizedCap30dDelta: createMetricPattern4(client, _m(acc, 'realized_cap_30d_delta')), + realizedCapRelToOwnMarketCap: createMetricPattern1(client, _m(acc, 'realized_cap_rel_to_own_market_cap')), + realizedLoss: createBlockCountPattern(client, _m(acc, 'realized_loss')), + realizedLossRelToRealizedCap: createBlockCountPattern(client, _m(acc, 'realized_loss_rel_to_realized_cap')), + realizedPrice: createMetricPattern1(client, _m(acc, 'realized_price')), + realizedPriceExtra: createActivePriceRatioPattern(client, _m(acc, 'realized_price_ratio')), + realizedProfit: createBlockCountPattern(client, _m(acc, 'realized_profit')), + realizedProfitRelToRealizedCap: createBlockCountPattern(client, _m(acc, 'realized_profit_rel_to_realized_cap')), + realizedProfitToLossRatio: createMetricPattern6(client, _m(acc, 'realized_profit_to_loss_ratio')), + realizedValue: createMetricPattern1(client, _m(acc, 'realized_value')), + sellSideRiskRatio: createMetricPattern6(client, _m(acc, 'sell_side_risk_ratio')), + sellSideRiskRatio30dEma: createMetricPattern6(client, _m(acc, 'sell_side_risk_ratio_30d_ema')), + sellSideRiskRatio7dEma: createMetricPattern6(client, _m(acc, 'sell_side_risk_ratio_7d_ema')), + sopr: createMetricPattern6(client, _m(acc, 'sopr')), + sopr30dEma: createMetricPattern6(client, _m(acc, 'sopr_30d_ema')), + sopr7dEma: createMetricPattern6(client, _m(acc, 'sopr_7d_ema')), + totalRealizedPnl: createMetricPattern1(client, _m(acc, 'total_realized_pnl')), + valueCreated: createMetricPattern1(client, _m(acc, 'value_created')), + valueDestroyed: createMetricPattern1(client, _m(acc, 'value_destroyed')), }; } @@ -2376,87 +2196,36 @@ function createRealizedPattern3(client, acc) { */ function createRealizedPattern4(client, acc) { return { - adjustedSopr: createMetricPattern6(client, _m(acc, "adjusted_sopr")), - adjustedSopr30dEma: createMetricPattern6( - client, - _m(acc, "adjusted_sopr_30d_ema"), - ), - adjustedSopr7dEma: createMetricPattern6( - client, - _m(acc, "adjusted_sopr_7d_ema"), - ), - adjustedValueCreated: createMetricPattern1( - client, - _m(acc, "adjusted_value_created"), - ), - adjustedValueDestroyed: createMetricPattern1( - client, - _m(acc, "adjusted_value_destroyed"), - ), - mvrv: createMetricPattern4(client, _m(acc, "mvrv")), - negRealizedLoss: createBitcoinPattern(client, _m(acc, "neg_realized_loss")), - netRealizedPnl: createBlockCountPattern( - client, - _m(acc, "net_realized_pnl"), - ), - netRealizedPnlCumulative30dDelta: createMetricPattern4( - client, - _m(acc, "net_realized_pnl_cumulative_30d_delta"), - ), - netRealizedPnlCumulative30dDeltaRelToMarketCap: createMetricPattern4( - client, - _m(acc, "net_realized_pnl_cumulative_30d_delta_rel_to_market_cap"), - ), - netRealizedPnlCumulative30dDeltaRelToRealizedCap: createMetricPattern4( - client, - _m(acc, "net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap"), - ), - netRealizedPnlRelToRealizedCap: createBlockCountPattern( - client, - _m(acc, "net_realized_pnl_rel_to_realized_cap"), - ), - realizedCap: createMetricPattern1(client, _m(acc, "realized_cap")), - realizedCap30dDelta: createMetricPattern4( - client, - _m(acc, "realized_cap_30d_delta"), - ), - realizedLoss: createBlockCountPattern(client, _m(acc, "realized_loss")), - realizedLossRelToRealizedCap: createBlockCountPattern( - client, - _m(acc, "realized_loss_rel_to_realized_cap"), - ), - realizedPrice: createMetricPattern1(client, _m(acc, "realized_price")), - realizedPriceExtra: createRealizedPriceExtraPattern( - client, - _m(acc, "realized_price"), - ), - realizedProfit: createBlockCountPattern(client, _m(acc, "realized_profit")), - realizedProfitRelToRealizedCap: createBlockCountPattern( - client, - _m(acc, "realized_profit_rel_to_realized_cap"), - ), - realizedValue: createMetricPattern1(client, _m(acc, "realized_value")), - sellSideRiskRatio: createMetricPattern6( - client, - _m(acc, "sell_side_risk_ratio"), - ), - sellSideRiskRatio30dEma: createMetricPattern6( - client, - _m(acc, "sell_side_risk_ratio_30d_ema"), - ), - sellSideRiskRatio7dEma: createMetricPattern6( - client, - _m(acc, "sell_side_risk_ratio_7d_ema"), - ), - sopr: createMetricPattern6(client, _m(acc, "sopr")), - sopr30dEma: createMetricPattern6(client, _m(acc, "sopr_30d_ema")), - sopr7dEma: createMetricPattern6(client, _m(acc, "sopr_7d_ema")), - totalRealizedPnl: createMetricPattern1( - client, - _m(acc, "total_realized_pnl"), - ), - valueCreated: createMetricPattern1(client, _m(acc, "value_created")), - valueDestroyed: createMetricPattern1(client, _m(acc, "value_destroyed")), + adjustedSopr: createMetricPattern6(client, _m(acc, 'adjusted_sopr')), + adjustedSopr30dEma: createMetricPattern6(client, _m(acc, 'adjusted_sopr_30d_ema')), + adjustedSopr7dEma: createMetricPattern6(client, _m(acc, 'adjusted_sopr_7d_ema')), + adjustedValueCreated: createMetricPattern1(client, _m(acc, 'adjusted_value_created')), + adjustedValueDestroyed: createMetricPattern1(client, _m(acc, 'adjusted_value_destroyed')), + mvrv: createMetricPattern4(client, _m(acc, 'mvrv')), + negRealizedLoss: createBitcoinPattern(client, _m(acc, 'neg_realized_loss')), + netRealizedPnl: createBlockCountPattern(client, _m(acc, 'net_realized_pnl')), + netRealizedPnlCumulative30dDelta: createMetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta')), + netRealizedPnlCumulative30dDeltaRelToMarketCap: createMetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_market_cap')), + netRealizedPnlCumulative30dDeltaRelToRealizedCap: createMetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap')), + netRealizedPnlRelToRealizedCap: createBlockCountPattern(client, _m(acc, 'net_realized_pnl_rel_to_realized_cap')), + realizedCap: createMetricPattern1(client, _m(acc, 'realized_cap')), + realizedCap30dDelta: createMetricPattern4(client, _m(acc, 'realized_cap_30d_delta')), + realizedLoss: createBlockCountPattern(client, _m(acc, 'realized_loss')), + realizedLossRelToRealizedCap: createBlockCountPattern(client, _m(acc, 'realized_loss_rel_to_realized_cap')), + realizedPrice: createMetricPattern1(client, _m(acc, 'realized_price')), + realizedPriceExtra: createRealizedPriceExtraPattern(client, _m(acc, 'realized_price')), + realizedProfit: createBlockCountPattern(client, _m(acc, 'realized_profit')), + realizedProfitRelToRealizedCap: createBlockCountPattern(client, _m(acc, 'realized_profit_rel_to_realized_cap')), + realizedValue: createMetricPattern1(client, _m(acc, 'realized_value')), + sellSideRiskRatio: createMetricPattern6(client, _m(acc, 'sell_side_risk_ratio')), + sellSideRiskRatio30dEma: createMetricPattern6(client, _m(acc, 'sell_side_risk_ratio_30d_ema')), + sellSideRiskRatio7dEma: createMetricPattern6(client, _m(acc, 'sell_side_risk_ratio_7d_ema')), + sopr: createMetricPattern6(client, _m(acc, 'sopr')), + sopr30dEma: createMetricPattern6(client, _m(acc, 'sopr_30d_ema')), + sopr7dEma: createMetricPattern6(client, _m(acc, 'sopr_7d_ema')), + totalRealizedPnl: createMetricPattern1(client, _m(acc, 'total_realized_pnl')), + valueCreated: createMetricPattern1(client, _m(acc, 'value_created')), + valueDestroyed: createMetricPattern1(client, _m(acc, 'value_destroyed')), }; } @@ -2500,34 +2269,34 @@ function createRealizedPattern4(client, acc) { */ function createRatio1ySdPattern(client, acc) { return { - _0sdUsd: createMetricPattern4(client, _m(acc, "0sd_usd")), - m05sd: createMetricPattern4(client, _m(acc, "m0_5sd")), - m05sdUsd: createMetricPattern4(client, _m(acc, "m0_5sd_usd")), - m15sd: createMetricPattern4(client, _m(acc, "m1_5sd")), - m15sdUsd: createMetricPattern4(client, _m(acc, "m1_5sd_usd")), - m1sd: createMetricPattern4(client, _m(acc, "m1sd")), - m1sdUsd: createMetricPattern4(client, _m(acc, "m1sd_usd")), - m25sd: createMetricPattern4(client, _m(acc, "m2_5sd")), - m25sdUsd: createMetricPattern4(client, _m(acc, "m2_5sd_usd")), - m2sd: createMetricPattern4(client, _m(acc, "m2sd")), - m2sdUsd: createMetricPattern4(client, _m(acc, "m2sd_usd")), - m3sd: createMetricPattern4(client, _m(acc, "m3sd")), - m3sdUsd: createMetricPattern4(client, _m(acc, "m3sd_usd")), - p05sd: createMetricPattern4(client, _m(acc, "p0_5sd")), - p05sdUsd: createMetricPattern4(client, _m(acc, "p0_5sd_usd")), - p15sd: createMetricPattern4(client, _m(acc, "p1_5sd")), - p15sdUsd: createMetricPattern4(client, _m(acc, "p1_5sd_usd")), - p1sd: createMetricPattern4(client, _m(acc, "p1sd")), - p1sdUsd: createMetricPattern4(client, _m(acc, "p1sd_usd")), - p25sd: createMetricPattern4(client, _m(acc, "p2_5sd")), - p25sdUsd: createMetricPattern4(client, _m(acc, "p2_5sd_usd")), - p2sd: createMetricPattern4(client, _m(acc, "p2sd")), - p2sdUsd: createMetricPattern4(client, _m(acc, "p2sd_usd")), - p3sd: createMetricPattern4(client, _m(acc, "p3sd")), - p3sdUsd: createMetricPattern4(client, _m(acc, "p3sd_usd")), - sd: createMetricPattern4(client, _m(acc, "sd")), - sma: createMetricPattern4(client, _m(acc, "sma")), - zscore: createMetricPattern4(client, _m(acc, "zscore")), + _0sdUsd: createMetricPattern4(client, _m(acc, '0sd_usd')), + m05sd: createMetricPattern4(client, _m(acc, 'm0_5sd')), + m05sdUsd: createMetricPattern4(client, _m(acc, 'm0_5sd_usd')), + m15sd: createMetricPattern4(client, _m(acc, 'm1_5sd')), + m15sdUsd: createMetricPattern4(client, _m(acc, 'm1_5sd_usd')), + m1sd: createMetricPattern4(client, _m(acc, 'm1sd')), + m1sdUsd: createMetricPattern4(client, _m(acc, 'm1sd_usd')), + m25sd: createMetricPattern4(client, _m(acc, 'm2_5sd')), + m25sdUsd: createMetricPattern4(client, _m(acc, 'm2_5sd_usd')), + m2sd: createMetricPattern4(client, _m(acc, 'm2sd')), + m2sdUsd: createMetricPattern4(client, _m(acc, 'm2sd_usd')), + m3sd: createMetricPattern4(client, _m(acc, 'm3sd')), + m3sdUsd: createMetricPattern4(client, _m(acc, 'm3sd_usd')), + p05sd: createMetricPattern4(client, _m(acc, 'p0_5sd')), + p05sdUsd: createMetricPattern4(client, _m(acc, 'p0_5sd_usd')), + p15sd: createMetricPattern4(client, _m(acc, 'p1_5sd')), + p15sdUsd: createMetricPattern4(client, _m(acc, 'p1_5sd_usd')), + p1sd: createMetricPattern4(client, _m(acc, 'p1sd')), + p1sdUsd: createMetricPattern4(client, _m(acc, 'p1sd_usd')), + p25sd: createMetricPattern4(client, _m(acc, 'p2_5sd')), + p25sdUsd: createMetricPattern4(client, _m(acc, 'p2_5sd_usd')), + p2sd: createMetricPattern4(client, _m(acc, 'p2sd')), + p2sdUsd: createMetricPattern4(client, _m(acc, 'p2sd_usd')), + p3sd: createMetricPattern4(client, _m(acc, 'p3sd')), + p3sdUsd: createMetricPattern4(client, _m(acc, 'p3sd_usd')), + sd: createMetricPattern4(client, _m(acc, 'sd')), + sma: createMetricPattern4(client, _m(acc, 'sma')), + zscore: createMetricPattern4(client, _m(acc, 'zscore')), }; } @@ -2570,78 +2339,33 @@ function createRatio1ySdPattern(client, acc) { */ function createRealizedPattern2(client, acc) { return { - mvrv: createMetricPattern4(client, _m(acc, "mvrv")), - negRealizedLoss: createBitcoinPattern(client, _m(acc, "neg_realized_loss")), - netRealizedPnl: createBlockCountPattern( - client, - _m(acc, "net_realized_pnl"), - ), - netRealizedPnlCumulative30dDelta: createMetricPattern4( - client, - _m(acc, "net_realized_pnl_cumulative_30d_delta"), - ), - netRealizedPnlCumulative30dDeltaRelToMarketCap: createMetricPattern4( - client, - _m(acc, "net_realized_pnl_cumulative_30d_delta_rel_to_market_cap"), - ), - netRealizedPnlCumulative30dDeltaRelToRealizedCap: createMetricPattern4( - client, - _m(acc, "net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap"), - ), - netRealizedPnlRelToRealizedCap: createBlockCountPattern( - client, - _m(acc, "net_realized_pnl_rel_to_realized_cap"), - ), - realizedCap: createMetricPattern1(client, _m(acc, "realized_cap")), - realizedCap30dDelta: createMetricPattern4( - client, - _m(acc, "realized_cap_30d_delta"), - ), - realizedCapRelToOwnMarketCap: createMetricPattern1( - client, - _m(acc, "realized_cap_rel_to_own_market_cap"), - ), - realizedLoss: createBlockCountPattern(client, _m(acc, "realized_loss")), - realizedLossRelToRealizedCap: createBlockCountPattern( - client, - _m(acc, "realized_loss_rel_to_realized_cap"), - ), - realizedPrice: createMetricPattern1(client, _m(acc, "realized_price")), - realizedPriceExtra: createActivePriceRatioPattern( - client, - _m(acc, "realized_price_ratio"), - ), - realizedProfit: createBlockCountPattern(client, _m(acc, "realized_profit")), - realizedProfitRelToRealizedCap: createBlockCountPattern( - client, - _m(acc, "realized_profit_rel_to_realized_cap"), - ), - realizedProfitToLossRatio: createMetricPattern6( - client, - _m(acc, "realized_profit_to_loss_ratio"), - ), - realizedValue: createMetricPattern1(client, _m(acc, "realized_value")), - sellSideRiskRatio: createMetricPattern6( - client, - _m(acc, "sell_side_risk_ratio"), - ), - sellSideRiskRatio30dEma: createMetricPattern6( - client, - _m(acc, "sell_side_risk_ratio_30d_ema"), - ), - sellSideRiskRatio7dEma: createMetricPattern6( - client, - _m(acc, "sell_side_risk_ratio_7d_ema"), - ), - sopr: createMetricPattern6(client, _m(acc, "sopr")), - sopr30dEma: createMetricPattern6(client, _m(acc, "sopr_30d_ema")), - sopr7dEma: createMetricPattern6(client, _m(acc, "sopr_7d_ema")), - totalRealizedPnl: createMetricPattern1( - client, - _m(acc, "total_realized_pnl"), - ), - valueCreated: createMetricPattern1(client, _m(acc, "value_created")), - valueDestroyed: createMetricPattern1(client, _m(acc, "value_destroyed")), + mvrv: createMetricPattern4(client, _m(acc, 'mvrv')), + negRealizedLoss: createBitcoinPattern(client, _m(acc, 'neg_realized_loss')), + netRealizedPnl: createBlockCountPattern(client, _m(acc, 'net_realized_pnl')), + netRealizedPnlCumulative30dDelta: createMetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta')), + netRealizedPnlCumulative30dDeltaRelToMarketCap: createMetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_market_cap')), + netRealizedPnlCumulative30dDeltaRelToRealizedCap: createMetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap')), + netRealizedPnlRelToRealizedCap: createBlockCountPattern(client, _m(acc, 'net_realized_pnl_rel_to_realized_cap')), + realizedCap: createMetricPattern1(client, _m(acc, 'realized_cap')), + realizedCap30dDelta: createMetricPattern4(client, _m(acc, 'realized_cap_30d_delta')), + realizedCapRelToOwnMarketCap: createMetricPattern1(client, _m(acc, 'realized_cap_rel_to_own_market_cap')), + realizedLoss: createBlockCountPattern(client, _m(acc, 'realized_loss')), + realizedLossRelToRealizedCap: createBlockCountPattern(client, _m(acc, 'realized_loss_rel_to_realized_cap')), + realizedPrice: createMetricPattern1(client, _m(acc, 'realized_price')), + realizedPriceExtra: createActivePriceRatioPattern(client, _m(acc, 'realized_price_ratio')), + realizedProfit: createBlockCountPattern(client, _m(acc, 'realized_profit')), + realizedProfitRelToRealizedCap: createBlockCountPattern(client, _m(acc, 'realized_profit_rel_to_realized_cap')), + realizedProfitToLossRatio: createMetricPattern6(client, _m(acc, 'realized_profit_to_loss_ratio')), + realizedValue: createMetricPattern1(client, _m(acc, 'realized_value')), + sellSideRiskRatio: createMetricPattern6(client, _m(acc, 'sell_side_risk_ratio')), + sellSideRiskRatio30dEma: createMetricPattern6(client, _m(acc, 'sell_side_risk_ratio_30d_ema')), + sellSideRiskRatio7dEma: createMetricPattern6(client, _m(acc, 'sell_side_risk_ratio_7d_ema')), + sopr: createMetricPattern6(client, _m(acc, 'sopr')), + sopr30dEma: createMetricPattern6(client, _m(acc, 'sopr_30d_ema')), + sopr7dEma: createMetricPattern6(client, _m(acc, 'sopr_7d_ema')), + totalRealizedPnl: createMetricPattern1(client, _m(acc, 'total_realized_pnl')), + valueCreated: createMetricPattern1(client, _m(acc, 'value_created')), + valueDestroyed: createMetricPattern1(client, _m(acc, 'value_destroyed')), }; } @@ -2682,70 +2406,31 @@ function createRealizedPattern2(client, acc) { */ function createRealizedPattern(client, acc) { return { - mvrv: createMetricPattern4(client, _m(acc, "mvrv")), - negRealizedLoss: createBitcoinPattern(client, _m(acc, "neg_realized_loss")), - netRealizedPnl: createBlockCountPattern( - client, - _m(acc, "net_realized_pnl"), - ), - netRealizedPnlCumulative30dDelta: createMetricPattern4( - client, - _m(acc, "net_realized_pnl_cumulative_30d_delta"), - ), - netRealizedPnlCumulative30dDeltaRelToMarketCap: createMetricPattern4( - client, - _m(acc, "net_realized_pnl_cumulative_30d_delta_rel_to_market_cap"), - ), - netRealizedPnlCumulative30dDeltaRelToRealizedCap: createMetricPattern4( - client, - _m(acc, "net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap"), - ), - netRealizedPnlRelToRealizedCap: createBlockCountPattern( - client, - _m(acc, "net_realized_pnl_rel_to_realized_cap"), - ), - realizedCap: createMetricPattern1(client, _m(acc, "realized_cap")), - realizedCap30dDelta: createMetricPattern4( - client, - _m(acc, "realized_cap_30d_delta"), - ), - realizedLoss: createBlockCountPattern(client, _m(acc, "realized_loss")), - realizedLossRelToRealizedCap: createBlockCountPattern( - client, - _m(acc, "realized_loss_rel_to_realized_cap"), - ), - realizedPrice: createMetricPattern1(client, _m(acc, "realized_price")), - realizedPriceExtra: createRealizedPriceExtraPattern( - client, - _m(acc, "realized_price"), - ), - realizedProfit: createBlockCountPattern(client, _m(acc, "realized_profit")), - realizedProfitRelToRealizedCap: createBlockCountPattern( - client, - _m(acc, "realized_profit_rel_to_realized_cap"), - ), - realizedValue: createMetricPattern1(client, _m(acc, "realized_value")), - sellSideRiskRatio: createMetricPattern6( - client, - _m(acc, "sell_side_risk_ratio"), - ), - sellSideRiskRatio30dEma: createMetricPattern6( - client, - _m(acc, "sell_side_risk_ratio_30d_ema"), - ), - sellSideRiskRatio7dEma: createMetricPattern6( - client, - _m(acc, "sell_side_risk_ratio_7d_ema"), - ), - sopr: createMetricPattern6(client, _m(acc, "sopr")), - sopr30dEma: createMetricPattern6(client, _m(acc, "sopr_30d_ema")), - sopr7dEma: createMetricPattern6(client, _m(acc, "sopr_7d_ema")), - totalRealizedPnl: createMetricPattern1( - client, - _m(acc, "total_realized_pnl"), - ), - valueCreated: createMetricPattern1(client, _m(acc, "value_created")), - valueDestroyed: createMetricPattern1(client, _m(acc, "value_destroyed")), + mvrv: createMetricPattern4(client, _m(acc, 'mvrv')), + negRealizedLoss: createBitcoinPattern(client, _m(acc, 'neg_realized_loss')), + netRealizedPnl: createBlockCountPattern(client, _m(acc, 'net_realized_pnl')), + netRealizedPnlCumulative30dDelta: createMetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta')), + netRealizedPnlCumulative30dDeltaRelToMarketCap: createMetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_market_cap')), + netRealizedPnlCumulative30dDeltaRelToRealizedCap: createMetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap')), + netRealizedPnlRelToRealizedCap: createBlockCountPattern(client, _m(acc, 'net_realized_pnl_rel_to_realized_cap')), + realizedCap: createMetricPattern1(client, _m(acc, 'realized_cap')), + realizedCap30dDelta: createMetricPattern4(client, _m(acc, 'realized_cap_30d_delta')), + realizedLoss: createBlockCountPattern(client, _m(acc, 'realized_loss')), + realizedLossRelToRealizedCap: createBlockCountPattern(client, _m(acc, 'realized_loss_rel_to_realized_cap')), + realizedPrice: createMetricPattern1(client, _m(acc, 'realized_price')), + realizedPriceExtra: createRealizedPriceExtraPattern(client, _m(acc, 'realized_price')), + realizedProfit: createBlockCountPattern(client, _m(acc, 'realized_profit')), + realizedProfitRelToRealizedCap: createBlockCountPattern(client, _m(acc, 'realized_profit_rel_to_realized_cap')), + realizedValue: createMetricPattern1(client, _m(acc, 'realized_value')), + sellSideRiskRatio: createMetricPattern6(client, _m(acc, 'sell_side_risk_ratio')), + sellSideRiskRatio30dEma: createMetricPattern6(client, _m(acc, 'sell_side_risk_ratio_30d_ema')), + sellSideRiskRatio7dEma: createMetricPattern6(client, _m(acc, 'sell_side_risk_ratio_7d_ema')), + sopr: createMetricPattern6(client, _m(acc, 'sopr')), + sopr30dEma: createMetricPattern6(client, _m(acc, 'sopr_30d_ema')), + sopr7dEma: createMetricPattern6(client, _m(acc, 'sopr_7d_ema')), + totalRealizedPnl: createMetricPattern1(client, _m(acc, 'total_realized_pnl')), + valueCreated: createMetricPattern1(client, _m(acc, 'value_created')), + valueDestroyed: createMetricPattern1(client, _m(acc, 'value_destroyed')), }; } @@ -2782,78 +2467,25 @@ function createRealizedPattern(client, acc) { function createPrice111dSmaPattern(client, acc) { return { price: createMetricPattern4(client, acc), - ratio: createMetricPattern4(client, _m(acc, "ratio")), - ratio1mSma: createMetricPattern4(client, _m(acc, "ratio_1m_sma")), - ratio1wSma: createMetricPattern4(client, _m(acc, "ratio_1w_sma")), - ratio1ySd: createRatio1ySdPattern(client, _m(acc, "ratio_1y")), - ratio2ySd: createRatio1ySdPattern(client, _m(acc, "ratio_2y")), - ratio4ySd: createRatio1ySdPattern(client, _m(acc, "ratio_4y")), - ratioPct1: createMetricPattern4(client, _m(acc, "ratio_pct1")), - ratioPct1Usd: createMetricPattern4(client, _m(acc, "ratio_pct1_usd")), - ratioPct2: createMetricPattern4(client, _m(acc, "ratio_pct2")), - ratioPct2Usd: createMetricPattern4(client, _m(acc, "ratio_pct2_usd")), - ratioPct5: createMetricPattern4(client, _m(acc, "ratio_pct5")), - ratioPct5Usd: createMetricPattern4(client, _m(acc, "ratio_pct5_usd")), - ratioPct95: createMetricPattern4(client, _m(acc, "ratio_pct95")), - ratioPct95Usd: createMetricPattern4(client, _m(acc, "ratio_pct95_usd")), - ratioPct98: createMetricPattern4(client, _m(acc, "ratio_pct98")), - ratioPct98Usd: createMetricPattern4(client, _m(acc, "ratio_pct98_usd")), - ratioPct99: createMetricPattern4(client, _m(acc, "ratio_pct99")), - ratioPct99Usd: createMetricPattern4(client, _m(acc, "ratio_pct99_usd")), - ratioSd: createRatio1ySdPattern(client, _m(acc, "ratio")), - }; -} - -/** - * @typedef {Object} PercentilesPattern - * @property {MetricPattern4} costBasisPct05 - * @property {MetricPattern4} costBasisPct10 - * @property {MetricPattern4} costBasisPct15 - * @property {MetricPattern4} costBasisPct20 - * @property {MetricPattern4} costBasisPct25 - * @property {MetricPattern4} costBasisPct30 - * @property {MetricPattern4} costBasisPct35 - * @property {MetricPattern4} costBasisPct40 - * @property {MetricPattern4} costBasisPct45 - * @property {MetricPattern4} costBasisPct50 - * @property {MetricPattern4} costBasisPct55 - * @property {MetricPattern4} costBasisPct60 - * @property {MetricPattern4} costBasisPct65 - * @property {MetricPattern4} costBasisPct70 - * @property {MetricPattern4} costBasisPct75 - * @property {MetricPattern4} costBasisPct80 - * @property {MetricPattern4} costBasisPct85 - * @property {MetricPattern4} costBasisPct90 - * @property {MetricPattern4} costBasisPct95 - */ - -/** - * Create a PercentilesPattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {PercentilesPattern} - */ -function createPercentilesPattern(client, acc) { - return { - costBasisPct05: createMetricPattern4(client, _m(acc, "pct05")), - costBasisPct10: createMetricPattern4(client, _m(acc, "pct10")), - costBasisPct15: createMetricPattern4(client, _m(acc, "pct15")), - costBasisPct20: createMetricPattern4(client, _m(acc, "pct20")), - costBasisPct25: createMetricPattern4(client, _m(acc, "pct25")), - costBasisPct30: createMetricPattern4(client, _m(acc, "pct30")), - costBasisPct35: createMetricPattern4(client, _m(acc, "pct35")), - costBasisPct40: createMetricPattern4(client, _m(acc, "pct40")), - costBasisPct45: createMetricPattern4(client, _m(acc, "pct45")), - costBasisPct50: createMetricPattern4(client, _m(acc, "pct50")), - costBasisPct55: createMetricPattern4(client, _m(acc, "pct55")), - costBasisPct60: createMetricPattern4(client, _m(acc, "pct60")), - costBasisPct65: createMetricPattern4(client, _m(acc, "pct65")), - costBasisPct70: createMetricPattern4(client, _m(acc, "pct70")), - costBasisPct75: createMetricPattern4(client, _m(acc, "pct75")), - costBasisPct80: createMetricPattern4(client, _m(acc, "pct80")), - costBasisPct85: createMetricPattern4(client, _m(acc, "pct85")), - costBasisPct90: createMetricPattern4(client, _m(acc, "pct90")), - costBasisPct95: createMetricPattern4(client, _m(acc, "pct95")), + ratio: createMetricPattern4(client, _m(acc, 'ratio')), + ratio1mSma: createMetricPattern4(client, _m(acc, 'ratio_1m_sma')), + ratio1wSma: createMetricPattern4(client, _m(acc, 'ratio_1w_sma')), + ratio1ySd: createRatio1ySdPattern(client, _m(acc, 'ratio_1y')), + ratio2ySd: createRatio1ySdPattern(client, _m(acc, 'ratio_2y')), + ratio4ySd: createRatio1ySdPattern(client, _m(acc, 'ratio_4y')), + ratioPct1: createMetricPattern4(client, _m(acc, 'ratio_pct1')), + ratioPct1Usd: createMetricPattern4(client, _m(acc, 'ratio_pct1_usd')), + ratioPct2: createMetricPattern4(client, _m(acc, 'ratio_pct2')), + ratioPct2Usd: createMetricPattern4(client, _m(acc, 'ratio_pct2_usd')), + ratioPct5: createMetricPattern4(client, _m(acc, 'ratio_pct5')), + ratioPct5Usd: createMetricPattern4(client, _m(acc, 'ratio_pct5_usd')), + ratioPct95: createMetricPattern4(client, _m(acc, 'ratio_pct95')), + ratioPct95Usd: createMetricPattern4(client, _m(acc, 'ratio_pct95_usd')), + ratioPct98: createMetricPattern4(client, _m(acc, 'ratio_pct98')), + ratioPct98Usd: createMetricPattern4(client, _m(acc, 'ratio_pct98_usd')), + ratioPct99: createMetricPattern4(client, _m(acc, 'ratio_pct99')), + ratioPct99Usd: createMetricPattern4(client, _m(acc, 'ratio_pct99_usd')), + ratioSd: createRatio1ySdPattern(client, _m(acc, 'ratio')), }; } @@ -2889,27 +2521,80 @@ function createPercentilesPattern(client, acc) { function createActivePriceRatioPattern(client, acc) { return { ratio: createMetricPattern4(client, acc), - ratio1mSma: createMetricPattern4(client, _m(acc, "1m_sma")), - ratio1wSma: createMetricPattern4(client, _m(acc, "1w_sma")), - ratio1ySd: createRatio1ySdPattern(client, _m(acc, "1y")), - ratio2ySd: createRatio1ySdPattern(client, _m(acc, "2y")), - ratio4ySd: createRatio1ySdPattern(client, _m(acc, "4y")), - ratioPct1: createMetricPattern4(client, _m(acc, "pct1")), - ratioPct1Usd: createMetricPattern4(client, _m(acc, "pct1_usd")), - ratioPct2: createMetricPattern4(client, _m(acc, "pct2")), - ratioPct2Usd: createMetricPattern4(client, _m(acc, "pct2_usd")), - ratioPct5: createMetricPattern4(client, _m(acc, "pct5")), - ratioPct5Usd: createMetricPattern4(client, _m(acc, "pct5_usd")), - ratioPct95: createMetricPattern4(client, _m(acc, "pct95")), - ratioPct95Usd: createMetricPattern4(client, _m(acc, "pct95_usd")), - ratioPct98: createMetricPattern4(client, _m(acc, "pct98")), - ratioPct98Usd: createMetricPattern4(client, _m(acc, "pct98_usd")), - ratioPct99: createMetricPattern4(client, _m(acc, "pct99")), - ratioPct99Usd: createMetricPattern4(client, _m(acc, "pct99_usd")), + ratio1mSma: createMetricPattern4(client, _m(acc, '1m_sma')), + ratio1wSma: createMetricPattern4(client, _m(acc, '1w_sma')), + ratio1ySd: createRatio1ySdPattern(client, _m(acc, '1y')), + ratio2ySd: createRatio1ySdPattern(client, _m(acc, '2y')), + ratio4ySd: createRatio1ySdPattern(client, _m(acc, '4y')), + ratioPct1: createMetricPattern4(client, _m(acc, 'pct1')), + ratioPct1Usd: createMetricPattern4(client, _m(acc, 'pct1_usd')), + ratioPct2: createMetricPattern4(client, _m(acc, 'pct2')), + ratioPct2Usd: createMetricPattern4(client, _m(acc, 'pct2_usd')), + ratioPct5: createMetricPattern4(client, _m(acc, 'pct5')), + ratioPct5Usd: createMetricPattern4(client, _m(acc, 'pct5_usd')), + ratioPct95: createMetricPattern4(client, _m(acc, 'pct95')), + ratioPct95Usd: createMetricPattern4(client, _m(acc, 'pct95_usd')), + ratioPct98: createMetricPattern4(client, _m(acc, 'pct98')), + ratioPct98Usd: createMetricPattern4(client, _m(acc, 'pct98_usd')), + ratioPct99: createMetricPattern4(client, _m(acc, 'pct99')), + ratioPct99Usd: createMetricPattern4(client, _m(acc, 'pct99_usd')), ratioSd: createRatio1ySdPattern(client, acc), }; } +/** + * @typedef {Object} PercentilesPattern + * @property {MetricPattern4} costBasisPct05 + * @property {MetricPattern4} costBasisPct10 + * @property {MetricPattern4} costBasisPct15 + * @property {MetricPattern4} costBasisPct20 + * @property {MetricPattern4} costBasisPct25 + * @property {MetricPattern4} costBasisPct30 + * @property {MetricPattern4} costBasisPct35 + * @property {MetricPattern4} costBasisPct40 + * @property {MetricPattern4} costBasisPct45 + * @property {MetricPattern4} costBasisPct50 + * @property {MetricPattern4} costBasisPct55 + * @property {MetricPattern4} costBasisPct60 + * @property {MetricPattern4} costBasisPct65 + * @property {MetricPattern4} costBasisPct70 + * @property {MetricPattern4} costBasisPct75 + * @property {MetricPattern4} costBasisPct80 + * @property {MetricPattern4} costBasisPct85 + * @property {MetricPattern4} costBasisPct90 + * @property {MetricPattern4} costBasisPct95 + */ + +/** + * Create a PercentilesPattern pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {PercentilesPattern} + */ +function createPercentilesPattern(client, acc) { + return { + costBasisPct05: createMetricPattern4(client, _m(acc, 'pct05')), + costBasisPct10: createMetricPattern4(client, _m(acc, 'pct10')), + costBasisPct15: createMetricPattern4(client, _m(acc, 'pct15')), + costBasisPct20: createMetricPattern4(client, _m(acc, 'pct20')), + costBasisPct25: createMetricPattern4(client, _m(acc, 'pct25')), + costBasisPct30: createMetricPattern4(client, _m(acc, 'pct30')), + costBasisPct35: createMetricPattern4(client, _m(acc, 'pct35')), + costBasisPct40: createMetricPattern4(client, _m(acc, 'pct40')), + costBasisPct45: createMetricPattern4(client, _m(acc, 'pct45')), + costBasisPct50: createMetricPattern4(client, _m(acc, 'pct50')), + costBasisPct55: createMetricPattern4(client, _m(acc, 'pct55')), + costBasisPct60: createMetricPattern4(client, _m(acc, 'pct60')), + costBasisPct65: createMetricPattern4(client, _m(acc, 'pct65')), + costBasisPct70: createMetricPattern4(client, _m(acc, 'pct70')), + costBasisPct75: createMetricPattern4(client, _m(acc, 'pct75')), + costBasisPct80: createMetricPattern4(client, _m(acc, 'pct80')), + costBasisPct85: createMetricPattern4(client, _m(acc, 'pct85')), + costBasisPct90: createMetricPattern4(client, _m(acc, 'pct90')), + costBasisPct95: createMetricPattern4(client, _m(acc, 'pct95')), + }; +} + /** * @typedef {Object} RelativePattern5 * @property {MetricPattern1} negUnrealizedLossRelToMarketCap @@ -2940,75 +2625,24 @@ function createActivePriceRatioPattern(client, acc) { */ function createRelativePattern5(client, acc) { return { - negUnrealizedLossRelToMarketCap: createMetricPattern1( - client, - _m(acc, "neg_unrealized_loss_rel_to_market_cap"), - ), - negUnrealizedLossRelToOwnMarketCap: createMetricPattern1( - client, - _m(acc, "neg_unrealized_loss_rel_to_own_market_cap"), - ), - negUnrealizedLossRelToOwnTotalUnrealizedPnl: createMetricPattern1( - client, - _m(acc, "neg_unrealized_loss_rel_to_own_total_unrealized_pnl"), - ), - netUnrealizedPnlRelToMarketCap: createMetricPattern1( - client, - _m(acc, "net_unrealized_pnl_rel_to_market_cap"), - ), - netUnrealizedPnlRelToOwnMarketCap: createMetricPattern1( - client, - _m(acc, "net_unrealized_pnl_rel_to_own_market_cap"), - ), - netUnrealizedPnlRelToOwnTotalUnrealizedPnl: createMetricPattern1( - client, - _m(acc, "net_unrealized_pnl_rel_to_own_total_unrealized_pnl"), - ), - nupl: createMetricPattern1(client, _m(acc, "nupl")), - supplyInLossRelToCirculatingSupply: createMetricPattern1( - client, - _m(acc, "supply_in_loss_rel_to_circulating_supply"), - ), - supplyInLossRelToOwnSupply: createMetricPattern1( - client, - _m(acc, "supply_in_loss_rel_to_own_supply"), - ), - supplyInProfitRelToCirculatingSupply: createMetricPattern1( - client, - _m(acc, "supply_in_profit_rel_to_circulating_supply"), - ), - supplyInProfitRelToOwnSupply: createMetricPattern1( - client, - _m(acc, "supply_in_profit_rel_to_own_supply"), - ), - supplyRelToCirculatingSupply: createMetricPattern4( - client, - _m(acc, "supply_rel_to_circulating_supply"), - ), - unrealizedLossRelToMarketCap: createMetricPattern1( - client, - _m(acc, "unrealized_loss_rel_to_market_cap"), - ), - unrealizedLossRelToOwnMarketCap: createMetricPattern1( - client, - _m(acc, "unrealized_loss_rel_to_own_market_cap"), - ), - unrealizedLossRelToOwnTotalUnrealizedPnl: createMetricPattern1( - client, - _m(acc, "unrealized_loss_rel_to_own_total_unrealized_pnl"), - ), - unrealizedProfitRelToMarketCap: createMetricPattern1( - client, - _m(acc, "unrealized_profit_rel_to_market_cap"), - ), - unrealizedProfitRelToOwnMarketCap: createMetricPattern1( - client, - _m(acc, "unrealized_profit_rel_to_own_market_cap"), - ), - unrealizedProfitRelToOwnTotalUnrealizedPnl: createMetricPattern1( - client, - _m(acc, "unrealized_profit_rel_to_own_total_unrealized_pnl"), - ), + negUnrealizedLossRelToMarketCap: createMetricPattern1(client, _m(acc, 'neg_unrealized_loss_rel_to_market_cap')), + negUnrealizedLossRelToOwnMarketCap: createMetricPattern1(client, _m(acc, 'neg_unrealized_loss_rel_to_own_market_cap')), + negUnrealizedLossRelToOwnTotalUnrealizedPnl: createMetricPattern1(client, _m(acc, 'neg_unrealized_loss_rel_to_own_total_unrealized_pnl')), + netUnrealizedPnlRelToMarketCap: createMetricPattern1(client, _m(acc, 'net_unrealized_pnl_rel_to_market_cap')), + netUnrealizedPnlRelToOwnMarketCap: createMetricPattern1(client, _m(acc, 'net_unrealized_pnl_rel_to_own_market_cap')), + netUnrealizedPnlRelToOwnTotalUnrealizedPnl: createMetricPattern1(client, _m(acc, 'net_unrealized_pnl_rel_to_own_total_unrealized_pnl')), + nupl: createMetricPattern1(client, _m(acc, 'nupl')), + supplyInLossRelToCirculatingSupply: createMetricPattern1(client, _m(acc, 'supply_in_loss_rel_to_circulating_supply')), + supplyInLossRelToOwnSupply: createMetricPattern1(client, _m(acc, 'supply_in_loss_rel_to_own_supply')), + supplyInProfitRelToCirculatingSupply: createMetricPattern1(client, _m(acc, 'supply_in_profit_rel_to_circulating_supply')), + supplyInProfitRelToOwnSupply: createMetricPattern1(client, _m(acc, 'supply_in_profit_rel_to_own_supply')), + supplyRelToCirculatingSupply: createMetricPattern4(client, _m(acc, 'supply_rel_to_circulating_supply')), + unrealizedLossRelToMarketCap: createMetricPattern1(client, _m(acc, 'unrealized_loss_rel_to_market_cap')), + unrealizedLossRelToOwnMarketCap: createMetricPattern1(client, _m(acc, 'unrealized_loss_rel_to_own_market_cap')), + unrealizedLossRelToOwnTotalUnrealizedPnl: createMetricPattern1(client, _m(acc, 'unrealized_loss_rel_to_own_total_unrealized_pnl')), + unrealizedProfitRelToMarketCap: createMetricPattern1(client, _m(acc, 'unrealized_profit_rel_to_market_cap')), + unrealizedProfitRelToOwnMarketCap: createMetricPattern1(client, _m(acc, 'unrealized_profit_rel_to_own_market_cap')), + unrealizedProfitRelToOwnTotalUnrealizedPnl: createMetricPattern1(client, _m(acc, 'unrealized_profit_rel_to_own_total_unrealized_pnl')), }; } @@ -3038,20 +2672,20 @@ function createRelativePattern5(client, acc) { */ function createAaopoolPattern(client, acc) { return { - _1mBlocksMined: createMetricPattern1(client, _m(acc, "1m_blocks_mined")), - _1mDominance: createMetricPattern1(client, _m(acc, "1m_dominance")), - _1wBlocksMined: createMetricPattern1(client, _m(acc, "1w_blocks_mined")), - _1wDominance: createMetricPattern1(client, _m(acc, "1w_dominance")), - _1yBlocksMined: createMetricPattern1(client, _m(acc, "1y_blocks_mined")), - _1yDominance: createMetricPattern1(client, _m(acc, "1y_dominance")), - _24hBlocksMined: createMetricPattern1(client, _m(acc, "24h_blocks_mined")), - _24hDominance: createMetricPattern1(client, _m(acc, "24h_dominance")), - blocksMined: createBlockCountPattern(client, _m(acc, "blocks_mined")), - coinbase: createCoinbasePattern2(client, _m(acc, "coinbase")), - daysSinceBlock: createMetricPattern4(client, _m(acc, "days_since_block")), - dominance: createMetricPattern1(client, _m(acc, "dominance")), - fee: createUnclaimedRewardsPattern(client, _m(acc, "fee")), - subsidy: createUnclaimedRewardsPattern(client, _m(acc, "subsidy")), + _1mBlocksMined: createMetricPattern1(client, _m(acc, '1m_blocks_mined')), + _1mDominance: createMetricPattern1(client, _m(acc, '1m_dominance')), + _1wBlocksMined: createMetricPattern1(client, _m(acc, '1w_blocks_mined')), + _1wDominance: createMetricPattern1(client, _m(acc, '1w_dominance')), + _1yBlocksMined: createMetricPattern1(client, _m(acc, '1y_blocks_mined')), + _1yDominance: createMetricPattern1(client, _m(acc, '1y_dominance')), + _24hBlocksMined: createMetricPattern1(client, _m(acc, '24h_blocks_mined')), + _24hDominance: createMetricPattern1(client, _m(acc, '24h_dominance')), + blocksMined: createBlockCountPattern(client, _m(acc, 'blocks_mined')), + coinbase: createCoinbasePattern2(client, _m(acc, 'coinbase')), + daysSinceBlock: createMetricPattern4(client, _m(acc, 'days_since_block')), + dominance: createMetricPattern1(client, _m(acc, 'dominance')), + fee: createUnclaimedRewardsPattern(client, _m(acc, 'fee')), + subsidy: createUnclaimedRewardsPattern(client, _m(acc, 'subsidy')), }; } @@ -3122,18 +2756,18 @@ function createPriceAgoPattern(client, basePath) { */ function createPeriodLumpSumStackPattern(client, acc) { return { - _10y: create_2015Pattern(client, acc ? `10y_${acc}` : "10y"), - _1m: create_2015Pattern(client, acc ? `1m_${acc}` : "1m"), - _1w: create_2015Pattern(client, acc ? `1w_${acc}` : "1w"), - _1y: create_2015Pattern(client, acc ? `1y_${acc}` : "1y"), - _2y: create_2015Pattern(client, acc ? `2y_${acc}` : "2y"), - _3m: create_2015Pattern(client, acc ? `3m_${acc}` : "3m"), - _3y: create_2015Pattern(client, acc ? `3y_${acc}` : "3y"), - _4y: create_2015Pattern(client, acc ? `4y_${acc}` : "4y"), - _5y: create_2015Pattern(client, acc ? `5y_${acc}` : "5y"), - _6m: create_2015Pattern(client, acc ? `6m_${acc}` : "6m"), - _6y: create_2015Pattern(client, acc ? `6y_${acc}` : "6y"), - _8y: create_2015Pattern(client, acc ? `8y_${acc}` : "8y"), + _10y: create_2015Pattern(client, (acc ? `10y_${acc}` : '10y')), + _1m: create_2015Pattern(client, (acc ? `1m_${acc}` : '1m')), + _1w: create_2015Pattern(client, (acc ? `1w_${acc}` : '1w')), + _1y: create_2015Pattern(client, (acc ? `1y_${acc}` : '1y')), + _2y: create_2015Pattern(client, (acc ? `2y_${acc}` : '2y')), + _3m: create_2015Pattern(client, (acc ? `3m_${acc}` : '3m')), + _3y: create_2015Pattern(client, (acc ? `3y_${acc}` : '3y')), + _4y: create_2015Pattern(client, (acc ? `4y_${acc}` : '4y')), + _5y: create_2015Pattern(client, (acc ? `5y_${acc}` : '5y')), + _6m: create_2015Pattern(client, (acc ? `6m_${acc}` : '6m')), + _6y: create_2015Pattern(client, (acc ? `6y_${acc}` : '6y')), + _8y: create_2015Pattern(client, (acc ? `8y_${acc}` : '8y')), }; } @@ -3163,18 +2797,57 @@ function createPeriodLumpSumStackPattern(client, acc) { */ function createPeriodAveragePricePattern(client, acc) { return { - _10y: createMetricPattern4(client, acc ? `10y_${acc}` : "10y"), - _1m: createMetricPattern4(client, acc ? `1m_${acc}` : "1m"), - _1w: createMetricPattern4(client, acc ? `1w_${acc}` : "1w"), - _1y: createMetricPattern4(client, acc ? `1y_${acc}` : "1y"), - _2y: createMetricPattern4(client, acc ? `2y_${acc}` : "2y"), - _3m: createMetricPattern4(client, acc ? `3m_${acc}` : "3m"), - _3y: createMetricPattern4(client, acc ? `3y_${acc}` : "3y"), - _4y: createMetricPattern4(client, acc ? `4y_${acc}` : "4y"), - _5y: createMetricPattern4(client, acc ? `5y_${acc}` : "5y"), - _6m: createMetricPattern4(client, acc ? `6m_${acc}` : "6m"), - _6y: createMetricPattern4(client, acc ? `6y_${acc}` : "6y"), - _8y: createMetricPattern4(client, acc ? `8y_${acc}` : "8y"), + _10y: createMetricPattern4(client, (acc ? `10y_${acc}` : '10y')), + _1m: createMetricPattern4(client, (acc ? `1m_${acc}` : '1m')), + _1w: createMetricPattern4(client, (acc ? `1w_${acc}` : '1w')), + _1y: createMetricPattern4(client, (acc ? `1y_${acc}` : '1y')), + _2y: createMetricPattern4(client, (acc ? `2y_${acc}` : '2y')), + _3m: createMetricPattern4(client, (acc ? `3m_${acc}` : '3m')), + _3y: createMetricPattern4(client, (acc ? `3y_${acc}` : '3y')), + _4y: createMetricPattern4(client, (acc ? `4y_${acc}` : '4y')), + _5y: createMetricPattern4(client, (acc ? `5y_${acc}` : '5y')), + _6m: createMetricPattern4(client, (acc ? `6m_${acc}` : '6m')), + _6y: createMetricPattern4(client, (acc ? `6y_${acc}` : '6y')), + _8y: createMetricPattern4(client, (acc ? `8y_${acc}` : '8y')), + }; +} + +/** + * @template T + * @typedef {Object} FullnessPattern + * @property {MetricPattern2} average + * @property {MetricPattern11} base + * @property {MetricPattern2} cumulative + * @property {MetricPattern2} max + * @property {MetricPattern6} median + * @property {MetricPattern2} min + * @property {MetricPattern6} pct10 + * @property {MetricPattern6} pct25 + * @property {MetricPattern6} pct75 + * @property {MetricPattern6} pct90 + * @property {MetricPattern2} sum + */ + +/** + * Create a FullnessPattern pattern node + * @template T + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {FullnessPattern} + */ +function createFullnessPattern(client, acc) { + return { + average: createMetricPattern2(client, _m(acc, 'average')), + base: createMetricPattern11(client, acc), + cumulative: createMetricPattern2(client, _m(acc, 'cumulative')), + max: createMetricPattern2(client, _m(acc, 'max')), + median: createMetricPattern6(client, _m(acc, 'median')), + min: createMetricPattern2(client, _m(acc, 'min')), + pct10: createMetricPattern6(client, _m(acc, 'pct10')), + pct25: createMetricPattern6(client, _m(acc, 'pct25')), + pct75: createMetricPattern6(client, _m(acc, 'pct75')), + pct90: createMetricPattern6(client, _m(acc, 'pct90')), + sum: createMetricPattern2(client, _m(acc, 'sum')), }; } @@ -3242,56 +2915,17 @@ function createClassAveragePricePattern(client, basePath) { */ function createDollarsPattern(client, acc) { return { - average: createMetricPattern2(client, _m(acc, "average")), + average: createMetricPattern2(client, _m(acc, 'average')), base: createMetricPattern11(client, acc), - cumulative: createMetricPattern1(client, _m(acc, "cumulative")), - max: createMetricPattern2(client, _m(acc, "max")), - median: createMetricPattern6(client, _m(acc, "median")), - min: createMetricPattern2(client, _m(acc, "min")), - pct10: createMetricPattern6(client, _m(acc, "pct10")), - pct25: createMetricPattern6(client, _m(acc, "pct25")), - pct75: createMetricPattern6(client, _m(acc, "pct75")), - pct90: createMetricPattern6(client, _m(acc, "pct90")), - sum: createMetricPattern2(client, _m(acc, "sum")), - }; -} - -/** - * @template T - * @typedef {Object} FullnessPattern - * @property {MetricPattern2} average - * @property {MetricPattern11} base - * @property {MetricPattern2} cumulative - * @property {MetricPattern2} max - * @property {MetricPattern6} median - * @property {MetricPattern2} min - * @property {MetricPattern6} pct10 - * @property {MetricPattern6} pct25 - * @property {MetricPattern6} pct75 - * @property {MetricPattern6} pct90 - * @property {MetricPattern2} sum - */ - -/** - * Create a FullnessPattern pattern node - * @template T - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {FullnessPattern} - */ -function createFullnessPattern(client, acc) { - return { - average: createMetricPattern2(client, _m(acc, "average")), - base: createMetricPattern11(client, acc), - cumulative: createMetricPattern2(client, _m(acc, "cumulative")), - max: createMetricPattern2(client, _m(acc, "max")), - median: createMetricPattern6(client, _m(acc, "median")), - min: createMetricPattern2(client, _m(acc, "min")), - pct10: createMetricPattern6(client, _m(acc, "pct10")), - pct25: createMetricPattern6(client, _m(acc, "pct25")), - pct75: createMetricPattern6(client, _m(acc, "pct75")), - pct90: createMetricPattern6(client, _m(acc, "pct90")), - sum: createMetricPattern2(client, _m(acc, "sum")), + cumulative: createMetricPattern1(client, _m(acc, 'cumulative')), + max: createMetricPattern2(client, _m(acc, 'max')), + median: createMetricPattern6(client, _m(acc, 'median')), + min: createMetricPattern2(client, _m(acc, 'min')), + pct10: createMetricPattern6(client, _m(acc, 'pct10')), + pct25: createMetricPattern6(client, _m(acc, 'pct25')), + pct75: createMetricPattern6(client, _m(acc, 'pct75')), + pct90: createMetricPattern6(client, _m(acc, 'pct90')), + sum: createMetricPattern2(client, _m(acc, 'sum')), }; } @@ -3317,43 +2951,16 @@ function createFullnessPattern(client, acc) { */ function createRelativePattern(client, acc) { return { - negUnrealizedLossRelToMarketCap: createMetricPattern1( - client, - _m(acc, "neg_unrealized_loss_rel_to_market_cap"), - ), - netUnrealizedPnlRelToMarketCap: createMetricPattern1( - client, - _m(acc, "net_unrealized_pnl_rel_to_market_cap"), - ), - nupl: createMetricPattern1(client, _m(acc, "nupl")), - supplyInLossRelToCirculatingSupply: createMetricPattern1( - client, - _m(acc, "supply_in_loss_rel_to_circulating_supply"), - ), - supplyInLossRelToOwnSupply: createMetricPattern1( - client, - _m(acc, "supply_in_loss_rel_to_own_supply"), - ), - supplyInProfitRelToCirculatingSupply: createMetricPattern1( - client, - _m(acc, "supply_in_profit_rel_to_circulating_supply"), - ), - supplyInProfitRelToOwnSupply: createMetricPattern1( - client, - _m(acc, "supply_in_profit_rel_to_own_supply"), - ), - supplyRelToCirculatingSupply: createMetricPattern4( - client, - _m(acc, "supply_rel_to_circulating_supply"), - ), - unrealizedLossRelToMarketCap: createMetricPattern1( - client, - _m(acc, "unrealized_loss_rel_to_market_cap"), - ), - unrealizedProfitRelToMarketCap: createMetricPattern1( - client, - _m(acc, "unrealized_profit_rel_to_market_cap"), - ), + negUnrealizedLossRelToMarketCap: createMetricPattern1(client, _m(acc, 'neg_unrealized_loss_rel_to_market_cap')), + netUnrealizedPnlRelToMarketCap: createMetricPattern1(client, _m(acc, 'net_unrealized_pnl_rel_to_market_cap')), + nupl: createMetricPattern1(client, _m(acc, 'nupl')), + supplyInLossRelToCirculatingSupply: createMetricPattern1(client, _m(acc, 'supply_in_loss_rel_to_circulating_supply')), + supplyInLossRelToOwnSupply: createMetricPattern1(client, _m(acc, 'supply_in_loss_rel_to_own_supply')), + supplyInProfitRelToCirculatingSupply: createMetricPattern1(client, _m(acc, 'supply_in_profit_rel_to_circulating_supply')), + supplyInProfitRelToOwnSupply: createMetricPattern1(client, _m(acc, 'supply_in_profit_rel_to_own_supply')), + supplyRelToCirculatingSupply: createMetricPattern4(client, _m(acc, 'supply_rel_to_circulating_supply')), + unrealizedLossRelToMarketCap: createMetricPattern1(client, _m(acc, 'unrealized_loss_rel_to_market_cap')), + unrealizedProfitRelToMarketCap: createMetricPattern1(client, _m(acc, 'unrealized_profit_rel_to_market_cap')), }; } @@ -3379,46 +2986,16 @@ function createRelativePattern(client, acc) { */ function createRelativePattern2(client, acc) { return { - negUnrealizedLossRelToOwnMarketCap: createMetricPattern1( - client, - _m(acc, "neg_unrealized_loss_rel_to_own_market_cap"), - ), - negUnrealizedLossRelToOwnTotalUnrealizedPnl: createMetricPattern1( - client, - _m(acc, "neg_unrealized_loss_rel_to_own_total_unrealized_pnl"), - ), - netUnrealizedPnlRelToOwnMarketCap: createMetricPattern1( - client, - _m(acc, "net_unrealized_pnl_rel_to_own_market_cap"), - ), - netUnrealizedPnlRelToOwnTotalUnrealizedPnl: createMetricPattern1( - client, - _m(acc, "net_unrealized_pnl_rel_to_own_total_unrealized_pnl"), - ), - supplyInLossRelToOwnSupply: createMetricPattern1( - client, - _m(acc, "supply_in_loss_rel_to_own_supply"), - ), - supplyInProfitRelToOwnSupply: createMetricPattern1( - client, - _m(acc, "supply_in_profit_rel_to_own_supply"), - ), - unrealizedLossRelToOwnMarketCap: createMetricPattern1( - client, - _m(acc, "unrealized_loss_rel_to_own_market_cap"), - ), - unrealizedLossRelToOwnTotalUnrealizedPnl: createMetricPattern1( - client, - _m(acc, "unrealized_loss_rel_to_own_total_unrealized_pnl"), - ), - unrealizedProfitRelToOwnMarketCap: createMetricPattern1( - client, - _m(acc, "unrealized_profit_rel_to_own_market_cap"), - ), - unrealizedProfitRelToOwnTotalUnrealizedPnl: createMetricPattern1( - client, - _m(acc, "unrealized_profit_rel_to_own_total_unrealized_pnl"), - ), + negUnrealizedLossRelToOwnMarketCap: createMetricPattern1(client, _m(acc, 'neg_unrealized_loss_rel_to_own_market_cap')), + negUnrealizedLossRelToOwnTotalUnrealizedPnl: createMetricPattern1(client, _m(acc, 'neg_unrealized_loss_rel_to_own_total_unrealized_pnl')), + netUnrealizedPnlRelToOwnMarketCap: createMetricPattern1(client, _m(acc, 'net_unrealized_pnl_rel_to_own_market_cap')), + netUnrealizedPnlRelToOwnTotalUnrealizedPnl: createMetricPattern1(client, _m(acc, 'net_unrealized_pnl_rel_to_own_total_unrealized_pnl')), + supplyInLossRelToOwnSupply: createMetricPattern1(client, _m(acc, 'supply_in_loss_rel_to_own_supply')), + supplyInProfitRelToOwnSupply: createMetricPattern1(client, _m(acc, 'supply_in_profit_rel_to_own_supply')), + unrealizedLossRelToOwnMarketCap: createMetricPattern1(client, _m(acc, 'unrealized_loss_rel_to_own_market_cap')), + unrealizedLossRelToOwnTotalUnrealizedPnl: createMetricPattern1(client, _m(acc, 'unrealized_loss_rel_to_own_total_unrealized_pnl')), + unrealizedProfitRelToOwnMarketCap: createMetricPattern1(client, _m(acc, 'unrealized_profit_rel_to_own_market_cap')), + unrealizedProfitRelToOwnTotalUnrealizedPnl: createMetricPattern1(client, _m(acc, 'unrealized_profit_rel_to_own_total_unrealized_pnl')), }; } @@ -3446,16 +3023,16 @@ function createRelativePattern2(client, acc) { */ function createCountPattern2(client, acc) { return { - average: createMetricPattern1(client, _m(acc, "average")), - cumulative: createMetricPattern1(client, _m(acc, "cumulative")), - max: createMetricPattern1(client, _m(acc, "max")), - median: createMetricPattern11(client, _m(acc, "median")), - min: createMetricPattern1(client, _m(acc, "min")), - pct10: createMetricPattern11(client, _m(acc, "pct10")), - pct25: createMetricPattern11(client, _m(acc, "pct25")), - pct75: createMetricPattern11(client, _m(acc, "pct75")), - pct90: createMetricPattern11(client, _m(acc, "pct90")), - sum: createMetricPattern1(client, _m(acc, "sum")), + average: createMetricPattern1(client, _m(acc, 'average')), + cumulative: createMetricPattern1(client, _m(acc, 'cumulative')), + max: createMetricPattern1(client, _m(acc, 'max')), + median: createMetricPattern11(client, _m(acc, 'median')), + min: createMetricPattern1(client, _m(acc, 'min')), + pct10: createMetricPattern11(client, _m(acc, 'pct10')), + pct25: createMetricPattern11(client, _m(acc, 'pct25')), + pct75: createMetricPattern11(client, _m(acc, 'pct75')), + pct90: createMetricPattern11(client, _m(acc, 'pct90')), + sum: createMetricPattern1(client, _m(acc, 'sum')), }; } @@ -3515,14 +3092,14 @@ function createAddrCountPattern(client, basePath) { */ function createFeeRatePattern(client, acc) { return { - average: createMetricPattern1(client, _m(acc, "average")), - max: createMetricPattern1(client, _m(acc, "max")), - median: createMetricPattern11(client, _m(acc, "median")), - min: createMetricPattern1(client, _m(acc, "min")), - pct10: createMetricPattern11(client, _m(acc, "pct10")), - pct25: createMetricPattern11(client, _m(acc, "pct25")), - pct75: createMetricPattern11(client, _m(acc, "pct75")), - pct90: createMetricPattern11(client, _m(acc, "pct90")), + average: createMetricPattern1(client, _m(acc, 'average')), + max: createMetricPattern1(client, _m(acc, 'max')), + median: createMetricPattern11(client, _m(acc, 'median')), + min: createMetricPattern1(client, _m(acc, 'min')), + pct10: createMetricPattern11(client, _m(acc, 'pct10')), + pct25: createMetricPattern11(client, _m(acc, 'pct25')), + pct75: createMetricPattern11(client, _m(acc, 'pct75')), + pct90: createMetricPattern11(client, _m(acc, 'pct90')), txindex: createMetricPattern27(client, acc), }; } @@ -3548,99 +3125,12 @@ function createFeeRatePattern(client, acc) { function create_0satsPattern(client, acc) { return { activity: createActivityPattern2(client, acc), - addrCount: createMetricPattern1(client, _m(acc, "addr_count")), + addrCount: createMetricPattern1(client, _m(acc, 'addr_count')), costBasis: createCostBasisPattern(client, acc), outputs: createOutputsPattern(client, acc), realized: createRealizedPattern(client, acc), relative: createRelativePattern(client, acc), - supply: createSupplyPattern2(client, _m(acc, "supply")), - unrealized: createUnrealizedPattern(client, acc), - }; -} - -/** - * @typedef {Object} _10yTo12yPattern - * @property {ActivityPattern2} activity - * @property {CostBasisPattern2} costBasis - * @property {OutputsPattern} outputs - * @property {RealizedPattern2} realized - * @property {RelativePattern2} relative - * @property {SupplyPattern2} supply - * @property {UnrealizedPattern} unrealized - */ - -/** - * Create a _10yTo12yPattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {_10yTo12yPattern} - */ -function create_10yTo12yPattern(client, acc) { - return { - activity: createActivityPattern2(client, acc), - costBasis: createCostBasisPattern2(client, acc), - outputs: createOutputsPattern(client, acc), - realized: createRealizedPattern2(client, acc), - relative: createRelativePattern2(client, acc), - supply: createSupplyPattern2(client, _m(acc, "supply")), - unrealized: createUnrealizedPattern(client, acc), - }; -} - -/** - * @typedef {Object} _0satsPattern2 - * @property {ActivityPattern2} activity - * @property {CostBasisPattern} costBasis - * @property {OutputsPattern} outputs - * @property {RealizedPattern} realized - * @property {RelativePattern4} relative - * @property {SupplyPattern2} supply - * @property {UnrealizedPattern} unrealized - */ - -/** - * Create a _0satsPattern2 pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {_0satsPattern2} - */ -function create_0satsPattern2(client, acc) { - return { - activity: createActivityPattern2(client, acc), - costBasis: createCostBasisPattern(client, acc), - outputs: createOutputsPattern(client, acc), - realized: createRealizedPattern(client, acc), - relative: createRelativePattern4(client, _m(acc, "supply_in")), - supply: createSupplyPattern2(client, _m(acc, "supply")), - unrealized: createUnrealizedPattern(client, acc), - }; -} - -/** - * @typedef {Object} _100btcPattern - * @property {ActivityPattern2} activity - * @property {CostBasisPattern} costBasis - * @property {OutputsPattern} outputs - * @property {RealizedPattern} realized - * @property {RelativePattern} relative - * @property {SupplyPattern2} supply - * @property {UnrealizedPattern} unrealized - */ - -/** - * Create a _100btcPattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {_100btcPattern} - */ -function create_100btcPattern(client, acc) { - return { - activity: createActivityPattern2(client, acc), - costBasis: createCostBasisPattern(client, acc), - outputs: createOutputsPattern(client, acc), - realized: createRealizedPattern(client, acc), - relative: createRelativePattern(client, acc), - supply: createSupplyPattern2(client, _m(acc, "supply")), + supply: createSupplyPattern2(client, _m(acc, 'supply')), unrealized: createUnrealizedPattern(client, acc), }; } @@ -3669,7 +3159,123 @@ function create_10yPattern(client, acc) { outputs: createOutputsPattern(client, acc), realized: createRealizedPattern4(client, acc), relative: createRelativePattern(client, acc), - supply: createSupplyPattern2(client, _m(acc, "supply")), + supply: createSupplyPattern2(client, _m(acc, 'supply')), + unrealized: createUnrealizedPattern(client, acc), + }; +} + +/** + * @typedef {Object} _10yTo12yPattern + * @property {ActivityPattern2} activity + * @property {CostBasisPattern2} costBasis + * @property {OutputsPattern} outputs + * @property {RealizedPattern2} realized + * @property {RelativePattern2} relative + * @property {SupplyPattern2} supply + * @property {UnrealizedPattern} unrealized + */ + +/** + * Create a _10yTo12yPattern pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {_10yTo12yPattern} + */ +function create_10yTo12yPattern(client, acc) { + return { + activity: createActivityPattern2(client, acc), + costBasis: createCostBasisPattern2(client, acc), + outputs: createOutputsPattern(client, acc), + realized: createRealizedPattern2(client, acc), + relative: createRelativePattern2(client, acc), + supply: createSupplyPattern2(client, _m(acc, 'supply')), + unrealized: createUnrealizedPattern(client, acc), + }; +} + +/** + * @typedef {Object} PeriodCagrPattern + * @property {MetricPattern4} _10y + * @property {MetricPattern4} _2y + * @property {MetricPattern4} _3y + * @property {MetricPattern4} _4y + * @property {MetricPattern4} _5y + * @property {MetricPattern4} _6y + * @property {MetricPattern4} _8y + */ + +/** + * Create a PeriodCagrPattern pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {PeriodCagrPattern} + */ +function createPeriodCagrPattern(client, acc) { + return { + _10y: createMetricPattern4(client, (acc ? `10y_${acc}` : '10y')), + _2y: createMetricPattern4(client, (acc ? `2y_${acc}` : '2y')), + _3y: createMetricPattern4(client, (acc ? `3y_${acc}` : '3y')), + _4y: createMetricPattern4(client, (acc ? `4y_${acc}` : '4y')), + _5y: createMetricPattern4(client, (acc ? `5y_${acc}` : '5y')), + _6y: createMetricPattern4(client, (acc ? `6y_${acc}` : '6y')), + _8y: createMetricPattern4(client, (acc ? `8y_${acc}` : '8y')), + }; +} + +/** + * @typedef {Object} _100btcPattern + * @property {ActivityPattern2} activity + * @property {CostBasisPattern} costBasis + * @property {OutputsPattern} outputs + * @property {RealizedPattern} realized + * @property {RelativePattern} relative + * @property {SupplyPattern2} supply + * @property {UnrealizedPattern} unrealized + */ + +/** + * Create a _100btcPattern pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {_100btcPattern} + */ +function create_100btcPattern(client, acc) { + return { + activity: createActivityPattern2(client, acc), + costBasis: createCostBasisPattern(client, acc), + outputs: createOutputsPattern(client, acc), + realized: createRealizedPattern(client, acc), + relative: createRelativePattern(client, acc), + supply: createSupplyPattern2(client, _m(acc, 'supply')), + unrealized: createUnrealizedPattern(client, acc), + }; +} + +/** + * @typedef {Object} _0satsPattern2 + * @property {ActivityPattern2} activity + * @property {CostBasisPattern} costBasis + * @property {OutputsPattern} outputs + * @property {RealizedPattern} realized + * @property {RelativePattern4} relative + * @property {SupplyPattern2} supply + * @property {UnrealizedPattern} unrealized + */ + +/** + * Create a _0satsPattern2 pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {_0satsPattern2} + */ +function create_0satsPattern2(client, acc) { + return { + activity: createActivityPattern2(client, acc), + costBasis: createCostBasisPattern(client, acc), + outputs: createOutputsPattern(client, acc), + realized: createRealizedPattern(client, acc), + relative: createRelativePattern4(client, _m(acc, 'supply_in')), + supply: createSupplyPattern2(client, _m(acc, 'supply')), unrealized: createUnrealizedPattern(client, acc), }; } @@ -3693,57 +3299,13 @@ function create_10yPattern(client, acc) { */ function createUnrealizedPattern(client, acc) { return { - negUnrealizedLoss: createMetricPattern1( - client, - _m(acc, "neg_unrealized_loss"), - ), - netUnrealizedPnl: createMetricPattern1( - client, - _m(acc, "net_unrealized_pnl"), - ), - supplyInLoss: createActiveSupplyPattern(client, _m(acc, "supply_in_loss")), - supplyInProfit: createActiveSupplyPattern( - client, - _m(acc, "supply_in_profit"), - ), - totalUnrealizedPnl: createMetricPattern1( - client, - _m(acc, "total_unrealized_pnl"), - ), - unrealizedLoss: createMetricPattern1(client, _m(acc, "unrealized_loss")), - unrealizedProfit: createMetricPattern1( - client, - _m(acc, "unrealized_profit"), - ), - }; -} - -/** - * @typedef {Object} PeriodCagrPattern - * @property {MetricPattern4} _10y - * @property {MetricPattern4} _2y - * @property {MetricPattern4} _3y - * @property {MetricPattern4} _4y - * @property {MetricPattern4} _5y - * @property {MetricPattern4} _6y - * @property {MetricPattern4} _8y - */ - -/** - * Create a PeriodCagrPattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {PeriodCagrPattern} - */ -function createPeriodCagrPattern(client, acc) { - return { - _10y: createMetricPattern4(client, acc ? `10y_${acc}` : "10y"), - _2y: createMetricPattern4(client, acc ? `2y_${acc}` : "2y"), - _3y: createMetricPattern4(client, acc ? `3y_${acc}` : "3y"), - _4y: createMetricPattern4(client, acc ? `4y_${acc}` : "4y"), - _5y: createMetricPattern4(client, acc ? `5y_${acc}` : "5y"), - _6y: createMetricPattern4(client, acc ? `6y_${acc}` : "6y"), - _8y: createMetricPattern4(client, acc ? `8y_${acc}` : "8y"), + negUnrealizedLoss: createMetricPattern1(client, _m(acc, 'neg_unrealized_loss')), + netUnrealizedPnl: createMetricPattern1(client, _m(acc, 'net_unrealized_pnl')), + supplyInLoss: createActiveSupplyPattern(client, _m(acc, 'supply_in_loss')), + supplyInProfit: createActiveSupplyPattern(client, _m(acc, 'supply_in_profit')), + totalUnrealizedPnl: createMetricPattern1(client, _m(acc, 'total_unrealized_pnl')), + unrealizedLoss: createMetricPattern1(client, _m(acc, 'unrealized_loss')), + unrealizedProfit: createMetricPattern1(client, _m(acc, 'unrealized_profit')), }; } @@ -3764,23 +3326,11 @@ function createPeriodCagrPattern(client, acc) { */ function createActivityPattern2(client, acc) { return { - coinblocksDestroyed: createBlockCountPattern( - client, - _m(acc, "coinblocks_destroyed"), - ), - coindaysDestroyed: createBlockCountPattern( - client, - _m(acc, "coindays_destroyed"), - ), - satblocksDestroyed: createMetricPattern11( - client, - _m(acc, "satblocks_destroyed"), - ), - satdaysDestroyed: createMetricPattern11( - client, - _m(acc, "satdays_destroyed"), - ), - sent: createUnclaimedRewardsPattern(client, _m(acc, "sent")), + coinblocksDestroyed: createBlockCountPattern(client, _m(acc, 'coinblocks_destroyed')), + coindaysDestroyed: createBlockCountPattern(client, _m(acc, 'coindays_destroyed')), + satblocksDestroyed: createMetricPattern11(client, _m(acc, 'satblocks_destroyed')), + satdaysDestroyed: createMetricPattern11(client, _m(acc, 'satdays_destroyed')), + sent: createUnclaimedRewardsPattern(client, _m(acc, 'sent')), }; } @@ -3802,73 +3352,52 @@ function createActivityPattern2(client, acc) { */ function createSplitPattern2(client, acc) { return { - close: createMetricPattern1(client, _m(acc, "close")), - high: createMetricPattern1(client, _m(acc, "high")), - low: createMetricPattern1(client, _m(acc, "low")), - open: createMetricPattern1(client, _m(acc, "open")), + close: createMetricPattern1(client, _m(acc, 'close')), + high: createMetricPattern1(client, _m(acc, 'high')), + low: createMetricPattern1(client, _m(acc, 'low')), + open: createMetricPattern1(client, _m(acc, 'open')), }; } /** - * @typedef {Object} CoinbasePattern2 - * @property {BlockCountPattern} bitcoin - * @property {BlockCountPattern} dollars - * @property {BlockCountPattern} sats + * @typedef {Object} ActiveSupplyPattern + * @property {MetricPattern1} bitcoin + * @property {MetricPattern1} dollars + * @property {MetricPattern1} sats */ /** - * Create a CoinbasePattern2 pattern node + * Create a ActiveSupplyPattern pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {CoinbasePattern2} + * @returns {ActiveSupplyPattern} */ -function createCoinbasePattern2(client, acc) { +function createActiveSupplyPattern(client, acc) { return { - bitcoin: createBlockCountPattern(client, _m(acc, "btc")), - dollars: createBlockCountPattern(client, _m(acc, "usd")), - sats: createBlockCountPattern(client, acc), + bitcoin: createMetricPattern1(client, _m(acc, 'btc')), + dollars: createMetricPattern1(client, _m(acc, 'usd')), + sats: createMetricPattern1(client, acc), }; } /** - * @typedef {Object} UnclaimedRewardsPattern - * @property {BitcoinPattern} bitcoin - * @property {BlockCountPattern} dollars - * @property {BlockCountPattern} sats + * @typedef {Object} _2015Pattern + * @property {MetricPattern4} bitcoin + * @property {MetricPattern4} dollars + * @property {MetricPattern4} sats */ /** - * Create a UnclaimedRewardsPattern pattern node + * Create a _2015Pattern pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {UnclaimedRewardsPattern} + * @returns {_2015Pattern} */ -function createUnclaimedRewardsPattern(client, acc) { +function create_2015Pattern(client, acc) { return { - bitcoin: createBitcoinPattern(client, _m(acc, "btc")), - dollars: createBlockCountPattern(client, _m(acc, "usd")), - sats: createBlockCountPattern(client, acc), - }; -} - -/** - * @typedef {Object} SegwitAdoptionPattern - * @property {MetricPattern11} base - * @property {MetricPattern2} cumulative - * @property {MetricPattern2} sum - */ - -/** - * Create a SegwitAdoptionPattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {SegwitAdoptionPattern} - */ -function createSegwitAdoptionPattern(client, acc) { - return { - base: createMetricPattern11(client, acc), - cumulative: createMetricPattern2(client, _m(acc, "cumulative")), - sum: createMetricPattern2(client, _m(acc, "sum")), + bitcoin: createMetricPattern4(client, _m(acc, 'btc')), + dollars: createMetricPattern4(client, _m(acc, 'usd')), + sats: createMetricPattern4(client, acc), }; } @@ -3894,44 +3423,44 @@ function createCostBasisPattern2(client, basePath) { } /** - * @typedef {Object} _2015Pattern - * @property {MetricPattern4} bitcoin - * @property {MetricPattern4} dollars - * @property {MetricPattern4} sats + * @typedef {Object} SegwitAdoptionPattern + * @property {MetricPattern11} base + * @property {MetricPattern2} cumulative + * @property {MetricPattern2} sum */ /** - * Create a _2015Pattern pattern node + * Create a SegwitAdoptionPattern pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {_2015Pattern} + * @returns {SegwitAdoptionPattern} */ -function create_2015Pattern(client, acc) { +function createSegwitAdoptionPattern(client, acc) { return { - bitcoin: createMetricPattern4(client, _m(acc, "btc")), - dollars: createMetricPattern4(client, _m(acc, "usd")), - sats: createMetricPattern4(client, acc), + base: createMetricPattern11(client, acc), + cumulative: createMetricPattern2(client, _m(acc, 'cumulative')), + sum: createMetricPattern2(client, _m(acc, 'sum')), }; } /** - * @typedef {Object} ActiveSupplyPattern - * @property {MetricPattern1} bitcoin - * @property {MetricPattern1} dollars - * @property {MetricPattern1} sats + * @typedef {Object} CoinbasePattern2 + * @property {BlockCountPattern} bitcoin + * @property {BlockCountPattern} dollars + * @property {BlockCountPattern} sats */ /** - * Create a ActiveSupplyPattern pattern node + * Create a CoinbasePattern2 pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {ActiveSupplyPattern} + * @returns {CoinbasePattern2} */ -function createActiveSupplyPattern(client, acc) { +function createCoinbasePattern2(client, acc) { return { - bitcoin: createMetricPattern1(client, _m(acc, "btc")), - dollars: createMetricPattern1(client, _m(acc, "usd")), - sats: createMetricPattern1(client, acc), + bitcoin: createBlockCountPattern(client, _m(acc, 'btc')), + dollars: createBlockCountPattern(client, _m(acc, 'usd')), + sats: createBlockCountPattern(client, acc), }; } @@ -3950,12 +3479,33 @@ function createActiveSupplyPattern(client, acc) { */ function createCoinbasePattern(client, acc) { return { - bitcoin: createFullnessPattern(client, _m(acc, "btc")), - dollars: createDollarsPattern(client, _m(acc, "usd")), + bitcoin: createFullnessPattern(client, _m(acc, 'btc')), + dollars: createDollarsPattern(client, _m(acc, 'usd')), sats: createDollarsPattern(client, acc), }; } +/** + * @typedef {Object} UnclaimedRewardsPattern + * @property {BitcoinPattern} bitcoin + * @property {BlockCountPattern} dollars + * @property {BlockCountPattern} sats + */ + +/** + * Create a UnclaimedRewardsPattern pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {UnclaimedRewardsPattern} + */ +function createUnclaimedRewardsPattern(client, acc) { + return { + bitcoin: createBitcoinPattern(client, _m(acc, 'btc')), + dollars: createBlockCountPattern(client, _m(acc, 'usd')), + sats: createBlockCountPattern(client, acc), + }; +} + /** * @typedef {Object} CostBasisPattern * @property {MetricPattern1} max @@ -3970,8 +3520,8 @@ function createCoinbasePattern(client, acc) { */ function createCostBasisPattern(client, acc) { return { - max: createMetricPattern1(client, _m(acc, "max_cost_basis")), - min: createMetricPattern1(client, _m(acc, "min_cost_basis")), + max: createMetricPattern1(client, _m(acc, 'max_cost_basis')), + min: createMetricPattern1(client, _m(acc, 'min_cost_basis')), }; } @@ -3989,8 +3539,8 @@ function createCostBasisPattern(client, acc) { */ function create_1dReturns1mSdPattern(client, acc) { return { - sd: createMetricPattern4(client, _m(acc, "sd")), - sma: createMetricPattern4(client, _m(acc, "sma")), + sd: createMetricPattern4(client, _m(acc, 'sd')), + sma: createMetricPattern4(client, _m(acc, 'sma')), }; } @@ -4008,7 +3558,7 @@ function create_1dReturns1mSdPattern(client, acc) { */ function createSupplyPattern2(client, acc) { return { - halved: createActiveSupplyPattern(client, _m(acc, "half")), + halved: createActiveSupplyPattern(client, _m(acc, 'half')), total: createActiveSupplyPattern(client, acc), }; } @@ -4027,14 +3577,8 @@ function createSupplyPattern2(client, acc) { */ function createRelativePattern4(client, acc) { return { - supplyInLossRelToOwnSupply: createMetricPattern1( - client, - _m(acc, "loss_rel_to_own_supply"), - ), - supplyInProfitRelToOwnSupply: createMetricPattern1( - client, - _m(acc, "profit_rel_to_own_supply"), - ), + supplyInLossRelToOwnSupply: createMetricPattern1(client, _m(acc, 'loss_rel_to_own_supply')), + supplyInProfitRelToOwnSupply: createMetricPattern1(client, _m(acc, 'profit_rel_to_own_supply')), }; } @@ -4059,27 +3603,6 @@ function createSatsPattern(client, basePath) { }; } -/** - * @template T - * @typedef {Object} BitcoinPattern - * @property {MetricPattern2} cumulative - * @property {MetricPattern1} sum - */ - -/** - * Create a BitcoinPattern pattern node - * @template T - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {BitcoinPattern} - */ -function createBitcoinPattern(client, acc) { - return { - cumulative: createMetricPattern2(client, _m(acc, "cumulative")), - sum: createMetricPattern1(client, acc), - }; -} - /** * @template T * @typedef {Object} BlockCountPattern @@ -4096,25 +3619,29 @@ function createBitcoinPattern(client, acc) { */ function createBlockCountPattern(client, acc) { return { - cumulative: createMetricPattern1(client, _m(acc, "cumulative")), + cumulative: createMetricPattern1(client, _m(acc, 'cumulative')), sum: createMetricPattern1(client, acc), }; } /** - * @typedef {Object} RealizedPriceExtraPattern - * @property {MetricPattern4} ratio + * @template T + * @typedef {Object} BitcoinPattern + * @property {MetricPattern2} cumulative + * @property {MetricPattern1} sum */ /** - * Create a RealizedPriceExtraPattern pattern node + * Create a BitcoinPattern pattern node + * @template T * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {RealizedPriceExtraPattern} + * @returns {BitcoinPattern} */ -function createRealizedPriceExtraPattern(client, acc) { +function createBitcoinPattern(client, acc) { return { - ratio: createMetricPattern4(client, _m(acc, "ratio")), + cumulative: createMetricPattern2(client, _m(acc, 'cumulative')), + sum: createMetricPattern1(client, acc), }; } @@ -4131,7 +3658,24 @@ function createRealizedPriceExtraPattern(client, acc) { */ function createOutputsPattern(client, acc) { return { - utxoCount: createMetricPattern1(client, _m(acc, "utxo_count")), + utxoCount: createMetricPattern1(client, _m(acc, 'utxo_count')), + }; +} + +/** + * @typedef {Object} RealizedPriceExtraPattern + * @property {MetricPattern4} ratio + */ + +/** + * Create a RealizedPriceExtraPattern pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {RealizedPriceExtraPattern} + */ +function createRealizedPriceExtraPattern(client, acc) { + return { + ratio: createMetricPattern4(client, _m(acc, 'ratio')), }; } @@ -4190,7 +3734,7 @@ function createOutputsPattern(client, acc) { * @property {MetricsTree_Blocks_Time} time * @property {MetricPattern11} totalSize * @property {DollarsPattern} vbytes - * @property {DollarsPattern} weight + * @property {MetricsTree_Blocks_Weight} weight */ /** @@ -4296,6 +3840,21 @@ function createOutputsPattern(client, acc) { * @property {MetricPattern11} timestampFixed */ +/** + * @typedef {Object} MetricsTree_Blocks_Weight + * @property {MetricPattern2} average + * @property {MetricPattern11} base + * @property {MetricPattern1} cumulative + * @property {MetricPattern2} max + * @property {MetricPattern6} median + * @property {MetricPattern2} min + * @property {MetricPattern6} pct10 + * @property {MetricPattern6} pct25 + * @property {MetricPattern6} pct75 + * @property {MetricPattern6} pct90 + * @property {MetricPattern2} sum + */ + /** * @typedef {Object} MetricsTree_Cointime * @property {MetricsTree_Cointime_Activity} activity @@ -4537,7 +4096,7 @@ function createOutputsPattern(client, acc) { /** * @typedef {Object} MetricsTree_Distribution_UtxoCohorts_All - * @property {ActivityPattern2} activity + * @property {MetricsTree_Distribution_UtxoCohorts_All_Activity} activity * @property {MetricsTree_Distribution_UtxoCohorts_All_CostBasis} costBasis * @property {OutputsPattern} outputs * @property {RealizedPattern3} realized @@ -4546,6 +4105,15 @@ function createOutputsPattern(client, acc) { * @property {UnrealizedPattern} unrealized */ +/** + * @typedef {Object} MetricsTree_Distribution_UtxoCohorts_All_Activity + * @property {BlockCountPattern} coinblocksDestroyed + * @property {BlockCountPattern} coindaysDestroyed + * @property {MetricPattern11} satblocksDestroyed + * @property {MetricPattern11} satdaysDestroyed + * @property {UnclaimedRewardsPattern} sent + */ + /** * @typedef {Object} MetricsTree_Distribution_UtxoCohorts_All_CostBasis * @property {MetricPattern1} max @@ -5529,8 +5097,34 @@ function createOutputsPattern(client, acc) { /** * @typedef {Object} MetricsTree_Transactions_Size - * @property {FeeRatePattern} vsize - * @property {FeeRatePattern} weight + * @property {MetricsTree_Transactions_Size_Vsize} vsize + * @property {MetricsTree_Transactions_Size_Weight} weight + */ + +/** + * @typedef {Object} MetricsTree_Transactions_Size_Vsize + * @property {MetricPattern1} average + * @property {MetricPattern1} max + * @property {MetricPattern11} median + * @property {MetricPattern1} min + * @property {MetricPattern11} pct10 + * @property {MetricPattern11} pct25 + * @property {MetricPattern11} pct75 + * @property {MetricPattern11} pct90 + * @property {MetricPattern27} txindex + */ + +/** + * @typedef {Object} MetricsTree_Transactions_Size_Weight + * @property {MetricPattern1} average + * @property {MetricPattern1} max + * @property {MetricPattern11} median + * @property {MetricPattern1} min + * @property {MetricPattern11} pct10 + * @property {MetricPattern11} pct25 + * @property {MetricPattern11} pct75 + * @property {MetricPattern11} pct90 + * @property {MetricPattern27} txindex */ /** @@ -5583,868 +5177,868 @@ class BrkClient extends BrkClientBase { "weekindex", "yearindex", "loadedaddressindex", - "emptyaddressindex", + "emptyaddressindex" ]); POOL_ID_TO_POOL_NAME = /** @type {const} */ ({ - unknown: "Unknown", - blockfills: "BlockFills", - ultimuspool: "ULTIMUSPOOL", - terrapool: "Terra Pool", - luxor: "Luxor", - onethash: "1THash", - btccom: "BTC.com", - bitfarms: "Bitfarms", - huobipool: "Huobi.pool", - wayicn: "WAYI.CN", - canoepool: "CanoePool", - btctop: "BTC.TOP", - bitcoincom: "Bitcoin.com", - pool175btc: "175btc", - gbminers: "GBMiners", - axbt: "A-XBT", - asicminer: "ASICMiner", - bitminter: "BitMinter", - bitcoinrussia: "BitcoinRussia", - btcserv: "BTCServ", - simplecoinus: "simplecoin.us", - btcguild: "BTC Guild", - eligius: "Eligius", - ozcoin: "OzCoin", - eclipsemc: "EclipseMC", - maxbtc: "MaxBTC", - triplemining: "TripleMining", - coinlab: "CoinLab", - pool50btc: "50BTC", - ghashio: "GHash.IO", - stminingcorp: "ST Mining Corp", - bitparking: "Bitparking", - mmpool: "mmpool", - polmine: "Polmine", - kncminer: "KnCMiner", - bitalo: "Bitalo", - f2pool: "F2Pool", - hhtt: "HHTT", - megabigpower: "MegaBigPower", - mtred: "Mt Red", - nmcbit: "NMCbit", - yourbtcnet: "Yourbtc.net", - givemecoins: "Give Me Coins", - braiinspool: "Braiins Pool", - antpool: "AntPool", - multicoinco: "MultiCoin.co", - bcpoolio: "bcpool.io", - cointerra: "Cointerra", - kanopool: "KanoPool", - solock: "Solo CK", - ckpool: "CKPool", - nicehash: "NiceHash", - bitclub: "BitClub", - bitcoinaffiliatenetwork: "Bitcoin Affiliate Network", - btcc: "BTCC", - bwpool: "BWPool", - exxbw: "EXX&BW", - bitsolo: "Bitsolo", - bitfury: "BitFury", - twentyoneinc: "21 Inc.", - digitalbtc: "digitalBTC", - eightbaochi: "8baochi", - mybtccoinpool: "myBTCcoin Pool", - tbdice: "TBDice", - hashpool: "HASHPOOL", - nexious: "Nexious", - bravomining: "Bravo Mining", - hotpool: "HotPool", - okexpool: "OKExPool", - bcmonster: "BCMonster", - onehash: "1Hash", - bixin: "Bixin", - tatmaspool: "TATMAS Pool", - viabtc: "ViaBTC", - connectbtc: "ConnectBTC", - batpool: "BATPOOL", - waterhole: "Waterhole", - dcexploration: "DCExploration", - dcex: "DCEX", - btpool: "BTPOOL", - fiftyeightcoin: "58COIN", - bitcoinindia: "Bitcoin India", - shawnp0wers: "shawnp0wers", - phashio: "PHash.IO", - rigpool: "RigPool", - haozhuzhu: "HAOZHUZHU", - sevenpool: "7pool", - miningkings: "MiningKings", - hashbx: "HashBX", - dpool: "DPOOL", - rawpool: "Rawpool", - haominer: "haominer", - helix: "Helix", - bitcoinukraine: "Bitcoin-Ukraine", - poolin: "Poolin", - secretsuperstar: "SecretSuperstar", - tigerpoolnet: "tigerpool.net", - sigmapoolcom: "Sigmapool.com", - okpooltop: "okpool.top", - hummerpool: "Hummerpool", - tangpool: "Tangpool", - bytepool: "BytePool", - spiderpool: "SpiderPool", - novablock: "NovaBlock", - miningcity: "MiningCity", - binancepool: "Binance Pool", - minerium: "Minerium", - lubiancom: "Lubian.com", - okkong: "OKKONG", - aaopool: "AAO Pool", - emcdpool: "EMCDPool", - foundryusa: "Foundry USA", - sbicrypto: "SBI Crypto", - arkpool: "ArkPool", - purebtccom: "PureBTC.COM", - marapool: "MARA Pool", - kucoinpool: "KuCoinPool", - entrustcharitypool: "Entrust Charity Pool", - okminer: "OKMINER", - titan: "Titan", - pegapool: "PEGA Pool", - btcnuggets: "BTC Nuggets", - cloudhashing: "CloudHashing", - digitalxmintsy: "digitalX Mintsy", - telco214: "Telco 214", - btcpoolparty: "BTC Pool Party", - multipool: "Multipool", - transactioncoinmining: "transactioncoinmining", - btcdig: "BTCDig", - trickysbtcpool: "Tricky's BTC Pool", - btcmp: "BTCMP", - eobot: "Eobot", - unomp: "UNOMP", - patels: "Patels", - gogreenlight: "GoGreenLight", - ekanembtc: "EkanemBTC", - canoe: "CANOE", - tiger: "tiger", - onem1x: "1M1X", - zulupool: "Zulupool", - secpool: "SECPOOL", - ocean: "OCEAN", - whitepool: "WhitePool", - wk057: "wk057", - futurebitapollosolo: "FutureBit Apollo Solo", - carbonnegative: "Carbon Negative", - portlandhodl: "Portland.HODL", - phoenix: "Phoenix", - neopool: "Neopool", - maxipool: "MaxiPool", - bitfufupool: "BitFuFuPool", - luckypool: "luckyPool", - miningdutch: "Mining-Dutch", - publicpool: "Public Pool", - miningsquared: "Mining Squared", - innopolistech: "Innopolis Tech", - btclab: "BTCLab", - parasite: "Parasite", + "unknown": "Unknown", + "blockfills": "BlockFills", + "ultimuspool": "ULTIMUSPOOL", + "terrapool": "Terra Pool", + "luxor": "Luxor", + "onethash": "1THash", + "btccom": "BTC.com", + "bitfarms": "Bitfarms", + "huobipool": "Huobi.pool", + "wayicn": "WAYI.CN", + "canoepool": "CanoePool", + "btctop": "BTC.TOP", + "bitcoincom": "Bitcoin.com", + "pool175btc": "175btc", + "gbminers": "GBMiners", + "axbt": "A-XBT", + "asicminer": "ASICMiner", + "bitminter": "BitMinter", + "bitcoinrussia": "BitcoinRussia", + "btcserv": "BTCServ", + "simplecoinus": "simplecoin.us", + "btcguild": "BTC Guild", + "eligius": "Eligius", + "ozcoin": "OzCoin", + "eclipsemc": "EclipseMC", + "maxbtc": "MaxBTC", + "triplemining": "TripleMining", + "coinlab": "CoinLab", + "pool50btc": "50BTC", + "ghashio": "GHash.IO", + "stminingcorp": "ST Mining Corp", + "bitparking": "Bitparking", + "mmpool": "mmpool", + "polmine": "Polmine", + "kncminer": "KnCMiner", + "bitalo": "Bitalo", + "f2pool": "F2Pool", + "hhtt": "HHTT", + "megabigpower": "MegaBigPower", + "mtred": "Mt Red", + "nmcbit": "NMCbit", + "yourbtcnet": "Yourbtc.net", + "givemecoins": "Give Me Coins", + "braiinspool": "Braiins Pool", + "antpool": "AntPool", + "multicoinco": "MultiCoin.co", + "bcpoolio": "bcpool.io", + "cointerra": "Cointerra", + "kanopool": "KanoPool", + "solock": "Solo CK", + "ckpool": "CKPool", + "nicehash": "NiceHash", + "bitclub": "BitClub", + "bitcoinaffiliatenetwork": "Bitcoin Affiliate Network", + "btcc": "BTCC", + "bwpool": "BWPool", + "exxbw": "EXX&BW", + "bitsolo": "Bitsolo", + "bitfury": "BitFury", + "twentyoneinc": "21 Inc.", + "digitalbtc": "digitalBTC", + "eightbaochi": "8baochi", + "mybtccoinpool": "myBTCcoin Pool", + "tbdice": "TBDice", + "hashpool": "HASHPOOL", + "nexious": "Nexious", + "bravomining": "Bravo Mining", + "hotpool": "HotPool", + "okexpool": "OKExPool", + "bcmonster": "BCMonster", + "onehash": "1Hash", + "bixin": "Bixin", + "tatmaspool": "TATMAS Pool", + "viabtc": "ViaBTC", + "connectbtc": "ConnectBTC", + "batpool": "BATPOOL", + "waterhole": "Waterhole", + "dcexploration": "DCExploration", + "dcex": "DCEX", + "btpool": "BTPOOL", + "fiftyeightcoin": "58COIN", + "bitcoinindia": "Bitcoin India", + "shawnp0wers": "shawnp0wers", + "phashio": "PHash.IO", + "rigpool": "RigPool", + "haozhuzhu": "HAOZHUZHU", + "sevenpool": "7pool", + "miningkings": "MiningKings", + "hashbx": "HashBX", + "dpool": "DPOOL", + "rawpool": "Rawpool", + "haominer": "haominer", + "helix": "Helix", + "bitcoinukraine": "Bitcoin-Ukraine", + "poolin": "Poolin", + "secretsuperstar": "SecretSuperstar", + "tigerpoolnet": "tigerpool.net", + "sigmapoolcom": "Sigmapool.com", + "okpooltop": "okpool.top", + "hummerpool": "Hummerpool", + "tangpool": "Tangpool", + "bytepool": "BytePool", + "spiderpool": "SpiderPool", + "novablock": "NovaBlock", + "miningcity": "MiningCity", + "binancepool": "Binance Pool", + "minerium": "Minerium", + "lubiancom": "Lubian.com", + "okkong": "OKKONG", + "aaopool": "AAO Pool", + "emcdpool": "EMCDPool", + "foundryusa": "Foundry USA", + "sbicrypto": "SBI Crypto", + "arkpool": "ArkPool", + "purebtccom": "PureBTC.COM", + "marapool": "MARA Pool", + "kucoinpool": "KuCoinPool", + "entrustcharitypool": "Entrust Charity Pool", + "okminer": "OKMINER", + "titan": "Titan", + "pegapool": "PEGA Pool", + "btcnuggets": "BTC Nuggets", + "cloudhashing": "CloudHashing", + "digitalxmintsy": "digitalX Mintsy", + "telco214": "Telco 214", + "btcpoolparty": "BTC Pool Party", + "multipool": "Multipool", + "transactioncoinmining": "transactioncoinmining", + "btcdig": "BTCDig", + "trickysbtcpool": "Tricky's BTC Pool", + "btcmp": "BTCMP", + "eobot": "Eobot", + "unomp": "UNOMP", + "patels": "Patels", + "gogreenlight": "GoGreenLight", + "ekanembtc": "EkanemBTC", + "canoe": "CANOE", + "tiger": "tiger", + "onem1x": "1M1X", + "zulupool": "Zulupool", + "secpool": "SECPOOL", + "ocean": "OCEAN", + "whitepool": "WhitePool", + "wk057": "wk057", + "futurebitapollosolo": "FutureBit Apollo Solo", + "carbonnegative": "Carbon Negative", + "portlandhodl": "Portland.HODL", + "phoenix": "Phoenix", + "neopool": "Neopool", + "maxipool": "MaxiPool", + "bitfufupool": "BitFuFuPool", + "luckypool": "luckyPool", + "miningdutch": "Mining-Dutch", + "publicpool": "Public Pool", + "miningsquared": "Mining Squared", + "innopolistech": "Innopolis Tech", + "btclab": "BTCLab", + "parasite": "Parasite" }); TERM_NAMES = /** @type {const} */ ({ - short: { - id: "sth", - short: "STH", - long: "Short Term Holders", - }, - long: { - id: "lth", - short: "LTH", - long: "Long Term Holders", + "short": { + "id": "sth", + "short": "STH", + "long": "Short Term Holders" }, + "long": { + "id": "lth", + "short": "LTH", + "long": "Long Term Holders" + } }); EPOCH_NAMES = /** @type {const} */ ({ - _0: { - id: "epoch_0", - short: "Epoch 0", - long: "Epoch 0", + "_0": { + "id": "epoch_0", + "short": "Epoch 0", + "long": "Epoch 0" }, - _1: { - id: "epoch_1", - short: "Epoch 1", - long: "Epoch 1", + "_1": { + "id": "epoch_1", + "short": "Epoch 1", + "long": "Epoch 1" }, - _2: { - id: "epoch_2", - short: "Epoch 2", - long: "Epoch 2", + "_2": { + "id": "epoch_2", + "short": "Epoch 2", + "long": "Epoch 2" }, - _3: { - id: "epoch_3", - short: "Epoch 3", - long: "Epoch 3", - }, - _4: { - id: "epoch_4", - short: "Epoch 4", - long: "Epoch 4", + "_3": { + "id": "epoch_3", + "short": "Epoch 3", + "long": "Epoch 3" }, + "_4": { + "id": "epoch_4", + "short": "Epoch 4", + "long": "Epoch 4" + } }); YEAR_NAMES = /** @type {const} */ ({ - _2009: { - id: "year_2009", - short: "2009", - long: "Year 2009", + "_2009": { + "id": "year_2009", + "short": "2009", + "long": "Year 2009" }, - _2010: { - id: "year_2010", - short: "2010", - long: "Year 2010", + "_2010": { + "id": "year_2010", + "short": "2010", + "long": "Year 2010" }, - _2011: { - id: "year_2011", - short: "2011", - long: "Year 2011", + "_2011": { + "id": "year_2011", + "short": "2011", + "long": "Year 2011" }, - _2012: { - id: "year_2012", - short: "2012", - long: "Year 2012", + "_2012": { + "id": "year_2012", + "short": "2012", + "long": "Year 2012" }, - _2013: { - id: "year_2013", - short: "2013", - long: "Year 2013", + "_2013": { + "id": "year_2013", + "short": "2013", + "long": "Year 2013" }, - _2014: { - id: "year_2014", - short: "2014", - long: "Year 2014", + "_2014": { + "id": "year_2014", + "short": "2014", + "long": "Year 2014" }, - _2015: { - id: "year_2015", - short: "2015", - long: "Year 2015", + "_2015": { + "id": "year_2015", + "short": "2015", + "long": "Year 2015" }, - _2016: { - id: "year_2016", - short: "2016", - long: "Year 2016", + "_2016": { + "id": "year_2016", + "short": "2016", + "long": "Year 2016" }, - _2017: { - id: "year_2017", - short: "2017", - long: "Year 2017", + "_2017": { + "id": "year_2017", + "short": "2017", + "long": "Year 2017" }, - _2018: { - id: "year_2018", - short: "2018", - long: "Year 2018", + "_2018": { + "id": "year_2018", + "short": "2018", + "long": "Year 2018" }, - _2019: { - id: "year_2019", - short: "2019", - long: "Year 2019", + "_2019": { + "id": "year_2019", + "short": "2019", + "long": "Year 2019" }, - _2020: { - id: "year_2020", - short: "2020", - long: "Year 2020", + "_2020": { + "id": "year_2020", + "short": "2020", + "long": "Year 2020" }, - _2021: { - id: "year_2021", - short: "2021", - long: "Year 2021", + "_2021": { + "id": "year_2021", + "short": "2021", + "long": "Year 2021" }, - _2022: { - id: "year_2022", - short: "2022", - long: "Year 2022", + "_2022": { + "id": "year_2022", + "short": "2022", + "long": "Year 2022" }, - _2023: { - id: "year_2023", - short: "2023", - long: "Year 2023", + "_2023": { + "id": "year_2023", + "short": "2023", + "long": "Year 2023" }, - _2024: { - id: "year_2024", - short: "2024", - long: "Year 2024", + "_2024": { + "id": "year_2024", + "short": "2024", + "long": "Year 2024" }, - _2025: { - id: "year_2025", - short: "2025", - long: "Year 2025", - }, - _2026: { - id: "year_2026", - short: "2026", - long: "Year 2026", + "_2025": { + "id": "year_2025", + "short": "2025", + "long": "Year 2025" }, + "_2026": { + "id": "year_2026", + "short": "2026", + "long": "Year 2026" + } }); SPENDABLE_TYPE_NAMES = /** @type {const} */ ({ - p2pk65: { - id: "p2pk65", - short: "P2PK65", - long: "Pay to Public Key (65 bytes)", + "p2pk65": { + "id": "p2pk65", + "short": "P2PK65", + "long": "Pay to Public Key (65 bytes)" }, - p2pk33: { - id: "p2pk33", - short: "P2PK33", - long: "Pay to Public Key (33 bytes)", + "p2pk33": { + "id": "p2pk33", + "short": "P2PK33", + "long": "Pay to Public Key (33 bytes)" }, - p2pkh: { - id: "p2pkh", - short: "P2PKH", - long: "Pay to Public Key Hash", + "p2pkh": { + "id": "p2pkh", + "short": "P2PKH", + "long": "Pay to Public Key Hash" }, - p2ms: { - id: "p2ms", - short: "P2MS", - long: "Pay to Multisig", + "p2ms": { + "id": "p2ms", + "short": "P2MS", + "long": "Pay to Multisig" }, - p2sh: { - id: "p2sh", - short: "P2SH", - long: "Pay to Script Hash", + "p2sh": { + "id": "p2sh", + "short": "P2SH", + "long": "Pay to Script Hash" }, - p2wpkh: { - id: "p2wpkh", - short: "P2WPKH", - long: "Pay to Witness Public Key Hash", + "p2wpkh": { + "id": "p2wpkh", + "short": "P2WPKH", + "long": "Pay to Witness Public Key Hash" }, - p2wsh: { - id: "p2wsh", - short: "P2WSH", - long: "Pay to Witness Script Hash", + "p2wsh": { + "id": "p2wsh", + "short": "P2WSH", + "long": "Pay to Witness Script Hash" }, - p2tr: { - id: "p2tr", - short: "P2TR", - long: "Pay to Taproot", + "p2tr": { + "id": "p2tr", + "short": "P2TR", + "long": "Pay to Taproot" }, - p2a: { - id: "p2a", - short: "P2A", - long: "Pay to Anchor", + "p2a": { + "id": "p2a", + "short": "P2A", + "long": "Pay to Anchor" }, - unknown: { - id: "unknown_outputs", - short: "Unknown", - long: "Unknown Output Type", - }, - empty: { - id: "empty_outputs", - short: "Empty", - long: "Empty Output", + "unknown": { + "id": "unknown_outputs", + "short": "Unknown", + "long": "Unknown Output Type" }, + "empty": { + "id": "empty_outputs", + "short": "Empty", + "long": "Empty Output" + } }); AGE_RANGE_NAMES = /** @type {const} */ ({ - upTo1h: { - id: "up_to_1h_old", - short: "<1h", - long: "Up to 1 Hour Old", + "upTo1h": { + "id": "up_to_1h_old", + "short": "<1h", + "long": "Up to 1 Hour Old" }, - _1hTo1d: { - id: "at_least_1h_up_to_1d_old", - short: "1h-1d", - long: "1 Hour to 1 Day Old", + "_1hTo1d": { + "id": "at_least_1h_up_to_1d_old", + "short": "1h-1d", + "long": "1 Hour to 1 Day Old" }, - _1dTo1w: { - id: "at_least_1d_up_to_1w_old", - short: "1d-1w", - long: "1 Day to 1 Week Old", + "_1dTo1w": { + "id": "at_least_1d_up_to_1w_old", + "short": "1d-1w", + "long": "1 Day to 1 Week Old" }, - _1wTo1m: { - id: "at_least_1w_up_to_1m_old", - short: "1w-1m", - long: "1 Week to 1 Month Old", + "_1wTo1m": { + "id": "at_least_1w_up_to_1m_old", + "short": "1w-1m", + "long": "1 Week to 1 Month Old" }, - _1mTo2m: { - id: "at_least_1m_up_to_2m_old", - short: "1m-2m", - long: "1 to 2 Months Old", + "_1mTo2m": { + "id": "at_least_1m_up_to_2m_old", + "short": "1m-2m", + "long": "1 to 2 Months Old" }, - _2mTo3m: { - id: "at_least_2m_up_to_3m_old", - short: "2m-3m", - long: "2 to 3 Months Old", + "_2mTo3m": { + "id": "at_least_2m_up_to_3m_old", + "short": "2m-3m", + "long": "2 to 3 Months Old" }, - _3mTo4m: { - id: "at_least_3m_up_to_4m_old", - short: "3m-4m", - long: "3 to 4 Months Old", + "_3mTo4m": { + "id": "at_least_3m_up_to_4m_old", + "short": "3m-4m", + "long": "3 to 4 Months Old" }, - _4mTo5m: { - id: "at_least_4m_up_to_5m_old", - short: "4m-5m", - long: "4 to 5 Months Old", + "_4mTo5m": { + "id": "at_least_4m_up_to_5m_old", + "short": "4m-5m", + "long": "4 to 5 Months Old" }, - _5mTo6m: { - id: "at_least_5m_up_to_6m_old", - short: "5m-6m", - long: "5 to 6 Months Old", + "_5mTo6m": { + "id": "at_least_5m_up_to_6m_old", + "short": "5m-6m", + "long": "5 to 6 Months Old" }, - _6mTo1y: { - id: "at_least_6m_up_to_1y_old", - short: "6m-1y", - long: "6 Months to 1 Year Old", + "_6mTo1y": { + "id": "at_least_6m_up_to_1y_old", + "short": "6m-1y", + "long": "6 Months to 1 Year Old" }, - _1yTo2y: { - id: "at_least_1y_up_to_2y_old", - short: "1y-2y", - long: "1 to 2 Years Old", + "_1yTo2y": { + "id": "at_least_1y_up_to_2y_old", + "short": "1y-2y", + "long": "1 to 2 Years Old" }, - _2yTo3y: { - id: "at_least_2y_up_to_3y_old", - short: "2y-3y", - long: "2 to 3 Years Old", + "_2yTo3y": { + "id": "at_least_2y_up_to_3y_old", + "short": "2y-3y", + "long": "2 to 3 Years Old" }, - _3yTo4y: { - id: "at_least_3y_up_to_4y_old", - short: "3y-4y", - long: "3 to 4 Years Old", + "_3yTo4y": { + "id": "at_least_3y_up_to_4y_old", + "short": "3y-4y", + "long": "3 to 4 Years Old" }, - _4yTo5y: { - id: "at_least_4y_up_to_5y_old", - short: "4y-5y", - long: "4 to 5 Years Old", + "_4yTo5y": { + "id": "at_least_4y_up_to_5y_old", + "short": "4y-5y", + "long": "4 to 5 Years Old" }, - _5yTo6y: { - id: "at_least_5y_up_to_6y_old", - short: "5y-6y", - long: "5 to 6 Years Old", + "_5yTo6y": { + "id": "at_least_5y_up_to_6y_old", + "short": "5y-6y", + "long": "5 to 6 Years Old" }, - _6yTo7y: { - id: "at_least_6y_up_to_7y_old", - short: "6y-7y", - long: "6 to 7 Years Old", + "_6yTo7y": { + "id": "at_least_6y_up_to_7y_old", + "short": "6y-7y", + "long": "6 to 7 Years Old" }, - _7yTo8y: { - id: "at_least_7y_up_to_8y_old", - short: "7y-8y", - long: "7 to 8 Years Old", + "_7yTo8y": { + "id": "at_least_7y_up_to_8y_old", + "short": "7y-8y", + "long": "7 to 8 Years Old" }, - _8yTo10y: { - id: "at_least_8y_up_to_10y_old", - short: "8y-10y", - long: "8 to 10 Years Old", + "_8yTo10y": { + "id": "at_least_8y_up_to_10y_old", + "short": "8y-10y", + "long": "8 to 10 Years Old" }, - _10yTo12y: { - id: "at_least_10y_up_to_12y_old", - short: "10y-12y", - long: "10 to 12 Years Old", + "_10yTo12y": { + "id": "at_least_10y_up_to_12y_old", + "short": "10y-12y", + "long": "10 to 12 Years Old" }, - _12yTo15y: { - id: "at_least_12y_up_to_15y_old", - short: "12y-15y", - long: "12 to 15 Years Old", - }, - from15y: { - id: "at_least_15y_old", - short: "15y+", - long: "15+ Years Old", + "_12yTo15y": { + "id": "at_least_12y_up_to_15y_old", + "short": "12y-15y", + "long": "12 to 15 Years Old" }, + "from15y": { + "id": "at_least_15y_old", + "short": "15y+", + "long": "15+ Years Old" + } }); MAX_AGE_NAMES = /** @type {const} */ ({ - _1w: { - id: "up_to_1w_old", - short: "<1w", - long: "Up to 1 Week Old", + "_1w": { + "id": "up_to_1w_old", + "short": "<1w", + "long": "Up to 1 Week Old" }, - _1m: { - id: "up_to_1m_old", - short: "<1m", - long: "Up to 1 Month Old", + "_1m": { + "id": "up_to_1m_old", + "short": "<1m", + "long": "Up to 1 Month Old" }, - _2m: { - id: "up_to_2m_old", - short: "<2m", - long: "Up to 2 Months Old", + "_2m": { + "id": "up_to_2m_old", + "short": "<2m", + "long": "Up to 2 Months Old" }, - _3m: { - id: "up_to_3m_old", - short: "<3m", - long: "Up to 3 Months Old", + "_3m": { + "id": "up_to_3m_old", + "short": "<3m", + "long": "Up to 3 Months Old" }, - _4m: { - id: "up_to_4m_old", - short: "<4m", - long: "Up to 4 Months Old", + "_4m": { + "id": "up_to_4m_old", + "short": "<4m", + "long": "Up to 4 Months Old" }, - _5m: { - id: "up_to_5m_old", - short: "<5m", - long: "Up to 5 Months Old", + "_5m": { + "id": "up_to_5m_old", + "short": "<5m", + "long": "Up to 5 Months Old" }, - _6m: { - id: "up_to_6m_old", - short: "<6m", - long: "Up to 6 Months Old", + "_6m": { + "id": "up_to_6m_old", + "short": "<6m", + "long": "Up to 6 Months Old" }, - _1y: { - id: "up_to_1y_old", - short: "<1y", - long: "Up to 1 Year Old", + "_1y": { + "id": "up_to_1y_old", + "short": "<1y", + "long": "Up to 1 Year Old" }, - _2y: { - id: "up_to_2y_old", - short: "<2y", - long: "Up to 2 Years Old", + "_2y": { + "id": "up_to_2y_old", + "short": "<2y", + "long": "Up to 2 Years Old" }, - _3y: { - id: "up_to_3y_old", - short: "<3y", - long: "Up to 3 Years Old", + "_3y": { + "id": "up_to_3y_old", + "short": "<3y", + "long": "Up to 3 Years Old" }, - _4y: { - id: "up_to_4y_old", - short: "<4y", - long: "Up to 4 Years Old", + "_4y": { + "id": "up_to_4y_old", + "short": "<4y", + "long": "Up to 4 Years Old" }, - _5y: { - id: "up_to_5y_old", - short: "<5y", - long: "Up to 5 Years Old", + "_5y": { + "id": "up_to_5y_old", + "short": "<5y", + "long": "Up to 5 Years Old" }, - _6y: { - id: "up_to_6y_old", - short: "<6y", - long: "Up to 6 Years Old", + "_6y": { + "id": "up_to_6y_old", + "short": "<6y", + "long": "Up to 6 Years Old" }, - _7y: { - id: "up_to_7y_old", - short: "<7y", - long: "Up to 7 Years Old", + "_7y": { + "id": "up_to_7y_old", + "short": "<7y", + "long": "Up to 7 Years Old" }, - _8y: { - id: "up_to_8y_old", - short: "<8y", - long: "Up to 8 Years Old", + "_8y": { + "id": "up_to_8y_old", + "short": "<8y", + "long": "Up to 8 Years Old" }, - _10y: { - id: "up_to_10y_old", - short: "<10y", - long: "Up to 10 Years Old", + "_10y": { + "id": "up_to_10y_old", + "short": "<10y", + "long": "Up to 10 Years Old" }, - _12y: { - id: "up_to_12y_old", - short: "<12y", - long: "Up to 12 Years Old", - }, - _15y: { - id: "up_to_15y_old", - short: "<15y", - long: "Up to 15 Years Old", + "_12y": { + "id": "up_to_12y_old", + "short": "<12y", + "long": "Up to 12 Years Old" }, + "_15y": { + "id": "up_to_15y_old", + "short": "<15y", + "long": "Up to 15 Years Old" + } }); MIN_AGE_NAMES = /** @type {const} */ ({ - _1d: { - id: "at_least_1d_old", - short: "1d+", - long: "At Least 1 Day Old", + "_1d": { + "id": "at_least_1d_old", + "short": "1d+", + "long": "At Least 1 Day Old" }, - _1w: { - id: "at_least_1w_old", - short: "1w+", - long: "At Least 1 Week Old", + "_1w": { + "id": "at_least_1w_old", + "short": "1w+", + "long": "At Least 1 Week Old" }, - _1m: { - id: "at_least_1m_old", - short: "1m+", - long: "At Least 1 Month Old", + "_1m": { + "id": "at_least_1m_old", + "short": "1m+", + "long": "At Least 1 Month Old" }, - _2m: { - id: "at_least_2m_old", - short: "2m+", - long: "At Least 2 Months Old", + "_2m": { + "id": "at_least_2m_old", + "short": "2m+", + "long": "At Least 2 Months Old" }, - _3m: { - id: "at_least_3m_old", - short: "3m+", - long: "At Least 3 Months Old", + "_3m": { + "id": "at_least_3m_old", + "short": "3m+", + "long": "At Least 3 Months Old" }, - _4m: { - id: "at_least_4m_old", - short: "4m+", - long: "At Least 4 Months Old", + "_4m": { + "id": "at_least_4m_old", + "short": "4m+", + "long": "At Least 4 Months Old" }, - _5m: { - id: "at_least_5m_old", - short: "5m+", - long: "At Least 5 Months Old", + "_5m": { + "id": "at_least_5m_old", + "short": "5m+", + "long": "At Least 5 Months Old" }, - _6m: { - id: "at_least_6m_old", - short: "6m+", - long: "At Least 6 Months Old", + "_6m": { + "id": "at_least_6m_old", + "short": "6m+", + "long": "At Least 6 Months Old" }, - _1y: { - id: "at_least_1y_old", - short: "1y+", - long: "At Least 1 Year Old", + "_1y": { + "id": "at_least_1y_old", + "short": "1y+", + "long": "At Least 1 Year Old" }, - _2y: { - id: "at_least_2y_old", - short: "2y+", - long: "At Least 2 Years Old", + "_2y": { + "id": "at_least_2y_old", + "short": "2y+", + "long": "At Least 2 Years Old" }, - _3y: { - id: "at_least_3y_old", - short: "3y+", - long: "At Least 3 Years Old", + "_3y": { + "id": "at_least_3y_old", + "short": "3y+", + "long": "At Least 3 Years Old" }, - _4y: { - id: "at_least_4y_old", - short: "4y+", - long: "At Least 4 Years Old", + "_4y": { + "id": "at_least_4y_old", + "short": "4y+", + "long": "At Least 4 Years Old" }, - _5y: { - id: "at_least_5y_old", - short: "5y+", - long: "At Least 5 Years Old", + "_5y": { + "id": "at_least_5y_old", + "short": "5y+", + "long": "At Least 5 Years Old" }, - _6y: { - id: "at_least_6y_old", - short: "6y+", - long: "At Least 6 Years Old", + "_6y": { + "id": "at_least_6y_old", + "short": "6y+", + "long": "At Least 6 Years Old" }, - _7y: { - id: "at_least_7y_old", - short: "7y+", - long: "At Least 7 Years Old", + "_7y": { + "id": "at_least_7y_old", + "short": "7y+", + "long": "At Least 7 Years Old" }, - _8y: { - id: "at_least_8y_old", - short: "8y+", - long: "At Least 8 Years Old", + "_8y": { + "id": "at_least_8y_old", + "short": "8y+", + "long": "At Least 8 Years Old" }, - _10y: { - id: "at_least_10y_old", - short: "10y+", - long: "At Least 10 Years Old", - }, - _12y: { - id: "at_least_12y_old", - short: "12y+", - long: "At Least 12 Years Old", + "_10y": { + "id": "at_least_10y_old", + "short": "10y+", + "long": "At Least 10 Years Old" }, + "_12y": { + "id": "at_least_12y_old", + "short": "12y+", + "long": "At Least 12 Years Old" + } }); AMOUNT_RANGE_NAMES = /** @type {const} */ ({ - _0sats: { - id: "with_0sats", - short: "0 sats", - long: "0 Sats", + "_0sats": { + "id": "with_0sats", + "short": "0 sats", + "long": "0 Sats" }, - _1satTo10sats: { - id: "above_1sat_under_10sats", - short: "1-10 sats", - long: "1 to 10 Sats", + "_1satTo10sats": { + "id": "above_1sat_under_10sats", + "short": "1-10 sats", + "long": "1 to 10 Sats" }, - _10satsTo100sats: { - id: "above_10sats_under_100sats", - short: "10-100 sats", - long: "10 to 100 Sats", + "_10satsTo100sats": { + "id": "above_10sats_under_100sats", + "short": "10-100 sats", + "long": "10 to 100 Sats" }, - _100satsTo1kSats: { - id: "above_100sats_under_1k_sats", - short: "100-1k sats", - long: "100 to 1K Sats", + "_100satsTo1kSats": { + "id": "above_100sats_under_1k_sats", + "short": "100-1k sats", + "long": "100 to 1K Sats" }, - _1kSatsTo10kSats: { - id: "above_1k_sats_under_10k_sats", - short: "1k-10k sats", - long: "1K to 10K Sats", + "_1kSatsTo10kSats": { + "id": "above_1k_sats_under_10k_sats", + "short": "1k-10k sats", + "long": "1K to 10K Sats" }, - _10kSatsTo100kSats: { - id: "above_10k_sats_under_100k_sats", - short: "10k-100k sats", - long: "10K to 100K Sats", + "_10kSatsTo100kSats": { + "id": "above_10k_sats_under_100k_sats", + "short": "10k-100k sats", + "long": "10K to 100K Sats" }, - _100kSatsTo1mSats: { - id: "above_100k_sats_under_1m_sats", - short: "100k-1M sats", - long: "100K to 1M Sats", + "_100kSatsTo1mSats": { + "id": "above_100k_sats_under_1m_sats", + "short": "100k-1M sats", + "long": "100K to 1M Sats" }, - _1mSatsTo10mSats: { - id: "above_1m_sats_under_10m_sats", - short: "1M-10M sats", - long: "1M to 10M Sats", + "_1mSatsTo10mSats": { + "id": "above_1m_sats_under_10m_sats", + "short": "1M-10M sats", + "long": "1M to 10M Sats" }, - _10mSatsTo1btc: { - id: "above_10m_sats_under_1btc", - short: "0.1-1 BTC", - long: "0.1 to 1 BTC", + "_10mSatsTo1btc": { + "id": "above_10m_sats_under_1btc", + "short": "0.1-1 BTC", + "long": "0.1 to 1 BTC" }, - _1btcTo10btc: { - id: "above_1btc_under_10btc", - short: "1-10 BTC", - long: "1 to 10 BTC", + "_1btcTo10btc": { + "id": "above_1btc_under_10btc", + "short": "1-10 BTC", + "long": "1 to 10 BTC" }, - _10btcTo100btc: { - id: "above_10btc_under_100btc", - short: "10-100 BTC", - long: "10 to 100 BTC", + "_10btcTo100btc": { + "id": "above_10btc_under_100btc", + "short": "10-100 BTC", + "long": "10 to 100 BTC" }, - _100btcTo1kBtc: { - id: "above_100btc_under_1k_btc", - short: "100-1k BTC", - long: "100 to 1K BTC", + "_100btcTo1kBtc": { + "id": "above_100btc_under_1k_btc", + "short": "100-1k BTC", + "long": "100 to 1K BTC" }, - _1kBtcTo10kBtc: { - id: "above_1k_btc_under_10k_btc", - short: "1k-10k BTC", - long: "1K to 10K BTC", + "_1kBtcTo10kBtc": { + "id": "above_1k_btc_under_10k_btc", + "short": "1k-10k BTC", + "long": "1K to 10K BTC" }, - _10kBtcTo100kBtc: { - id: "above_10k_btc_under_100k_btc", - short: "10k-100k BTC", - long: "10K to 100K BTC", - }, - _100kBtcOrMore: { - id: "above_100k_btc", - short: "100k+ BTC", - long: "100K+ BTC", + "_10kBtcTo100kBtc": { + "id": "above_10k_btc_under_100k_btc", + "short": "10k-100k BTC", + "long": "10K to 100K BTC" }, + "_100kBtcOrMore": { + "id": "above_100k_btc", + "short": "100k+ BTC", + "long": "100K+ BTC" + } }); GE_AMOUNT_NAMES = /** @type {const} */ ({ - _1sat: { - id: "above_1sat", - short: "1+ sats", - long: "Above 1 Sat", + "_1sat": { + "id": "above_1sat", + "short": "1+ sats", + "long": "Above 1 Sat" }, - _10sats: { - id: "above_10sats", - short: "10+ sats", - long: "Above 10 Sats", + "_10sats": { + "id": "above_10sats", + "short": "10+ sats", + "long": "Above 10 Sats" }, - _100sats: { - id: "above_100sats", - short: "100+ sats", - long: "Above 100 Sats", + "_100sats": { + "id": "above_100sats", + "short": "100+ sats", + "long": "Above 100 Sats" }, - _1kSats: { - id: "above_1k_sats", - short: "1k+ sats", - long: "Above 1K Sats", + "_1kSats": { + "id": "above_1k_sats", + "short": "1k+ sats", + "long": "Above 1K Sats" }, - _10kSats: { - id: "above_10k_sats", - short: "10k+ sats", - long: "Above 10K Sats", + "_10kSats": { + "id": "above_10k_sats", + "short": "10k+ sats", + "long": "Above 10K Sats" }, - _100kSats: { - id: "above_100k_sats", - short: "100k+ sats", - long: "Above 100K Sats", + "_100kSats": { + "id": "above_100k_sats", + "short": "100k+ sats", + "long": "Above 100K Sats" }, - _1mSats: { - id: "above_1m_sats", - short: "1M+ sats", - long: "Above 1M Sats", + "_1mSats": { + "id": "above_1m_sats", + "short": "1M+ sats", + "long": "Above 1M Sats" }, - _10mSats: { - id: "above_10m_sats", - short: "0.1+ BTC", - long: "Above 0.1 BTC", + "_10mSats": { + "id": "above_10m_sats", + "short": "0.1+ BTC", + "long": "Above 0.1 BTC" }, - _1btc: { - id: "above_1btc", - short: "1+ BTC", - long: "Above 1 BTC", + "_1btc": { + "id": "above_1btc", + "short": "1+ BTC", + "long": "Above 1 BTC" }, - _10btc: { - id: "above_10btc", - short: "10+ BTC", - long: "Above 10 BTC", + "_10btc": { + "id": "above_10btc", + "short": "10+ BTC", + "long": "Above 10 BTC" }, - _100btc: { - id: "above_100btc", - short: "100+ BTC", - long: "Above 100 BTC", + "_100btc": { + "id": "above_100btc", + "short": "100+ BTC", + "long": "Above 100 BTC" }, - _1kBtc: { - id: "above_1k_btc", - short: "1k+ BTC", - long: "Above 1K BTC", - }, - _10kBtc: { - id: "above_10k_btc", - short: "10k+ BTC", - long: "Above 10K BTC", + "_1kBtc": { + "id": "above_1k_btc", + "short": "1k+ BTC", + "long": "Above 1K BTC" }, + "_10kBtc": { + "id": "above_10k_btc", + "short": "10k+ BTC", + "long": "Above 10K BTC" + } }); LT_AMOUNT_NAMES = /** @type {const} */ ({ - _10sats: { - id: "under_10sats", - short: "<10 sats", - long: "Under 10 Sats", + "_10sats": { + "id": "under_10sats", + "short": "<10 sats", + "long": "Under 10 Sats" }, - _100sats: { - id: "under_100sats", - short: "<100 sats", - long: "Under 100 Sats", + "_100sats": { + "id": "under_100sats", + "short": "<100 sats", + "long": "Under 100 Sats" }, - _1kSats: { - id: "under_1k_sats", - short: "<1k sats", - long: "Under 1K Sats", + "_1kSats": { + "id": "under_1k_sats", + "short": "<1k sats", + "long": "Under 1K Sats" }, - _10kSats: { - id: "under_10k_sats", - short: "<10k sats", - long: "Under 10K Sats", + "_10kSats": { + "id": "under_10k_sats", + "short": "<10k sats", + "long": "Under 10K Sats" }, - _100kSats: { - id: "under_100k_sats", - short: "<100k sats", - long: "Under 100K Sats", + "_100kSats": { + "id": "under_100k_sats", + "short": "<100k sats", + "long": "Under 100K Sats" }, - _1mSats: { - id: "under_1m_sats", - short: "<1M sats", - long: "Under 1M Sats", + "_1mSats": { + "id": "under_1m_sats", + "short": "<1M sats", + "long": "Under 1M Sats" }, - _10mSats: { - id: "under_10m_sats", - short: "<0.1 BTC", - long: "Under 0.1 BTC", + "_10mSats": { + "id": "under_10m_sats", + "short": "<0.1 BTC", + "long": "Under 0.1 BTC" }, - _1btc: { - id: "under_1btc", - short: "<1 BTC", - long: "Under 1 BTC", + "_1btc": { + "id": "under_1btc", + "short": "<1 BTC", + "long": "Under 1 BTC" }, - _10btc: { - id: "under_10btc", - short: "<10 BTC", - long: "Under 10 BTC", + "_10btc": { + "id": "under_10btc", + "short": "<10 BTC", + "long": "Under 10 BTC" }, - _100btc: { - id: "under_100btc", - short: "<100 BTC", - long: "Under 100 BTC", + "_100btc": { + "id": "under_100btc", + "short": "<100 BTC", + "long": "Under 100 BTC" }, - _1kBtc: { - id: "under_1k_btc", - short: "<1k BTC", - long: "Under 1K BTC", + "_1kBtc": { + "id": "under_1k_btc", + "short": "<1k BTC", + "long": "Under 1K BTC" }, - _10kBtc: { - id: "under_10k_btc", - short: "<10k BTC", - long: "Under 10K BTC", - }, - _100kBtc: { - id: "under_100k_btc", - short: "<100k BTC", - long: "Under 100K BTC", + "_10kBtc": { + "id": "under_10k_btc", + "short": "<10k BTC", + "long": "Under 10K BTC" }, + "_100kBtc": { + "id": "under_100k_btc", + "short": "<100k BTC", + "long": "Under 100K BTC" + } }); /** @@ -6453,7 +6047,7 @@ class BrkClient extends BrkClientBase { constructor(options) { super(options); /** @type {MetricsTree} */ - this.metrics = this._buildTree(""); + this.metrics = this._buildTree(''); } /** @@ -6464,1390 +6058,1104 @@ class BrkClient extends BrkClientBase { _buildTree(basePath) { return { addresses: { - firstP2aaddressindex: createMetricPattern11( - this, - "first_p2aaddressindex", - ), - firstP2pk33addressindex: createMetricPattern11( - this, - "first_p2pk33addressindex", - ), - firstP2pk65addressindex: createMetricPattern11( - this, - "first_p2pk65addressindex", - ), - firstP2pkhaddressindex: createMetricPattern11( - this, - "first_p2pkhaddressindex", - ), - firstP2shaddressindex: createMetricPattern11( - this, - "first_p2shaddressindex", - ), - firstP2traddressindex: createMetricPattern11( - this, - "first_p2traddressindex", - ), - firstP2wpkhaddressindex: createMetricPattern11( - this, - "first_p2wpkhaddressindex", - ), - firstP2wshaddressindex: createMetricPattern11( - this, - "first_p2wshaddressindex", - ), - p2abytes: createMetricPattern16(this, "p2abytes"), - p2pk33bytes: createMetricPattern18(this, "p2pk33bytes"), - p2pk65bytes: createMetricPattern19(this, "p2pk65bytes"), - p2pkhbytes: createMetricPattern20(this, "p2pkhbytes"), - p2shbytes: createMetricPattern21(this, "p2shbytes"), - p2trbytes: createMetricPattern22(this, "p2trbytes"), - p2wpkhbytes: createMetricPattern23(this, "p2wpkhbytes"), - p2wshbytes: createMetricPattern24(this, "p2wshbytes"), + firstP2aaddressindex: createMetricPattern11(this, 'first_p2aaddressindex'), + firstP2pk33addressindex: createMetricPattern11(this, 'first_p2pk33addressindex'), + firstP2pk65addressindex: createMetricPattern11(this, 'first_p2pk65addressindex'), + firstP2pkhaddressindex: createMetricPattern11(this, 'first_p2pkhaddressindex'), + firstP2shaddressindex: createMetricPattern11(this, 'first_p2shaddressindex'), + firstP2traddressindex: createMetricPattern11(this, 'first_p2traddressindex'), + firstP2wpkhaddressindex: createMetricPattern11(this, 'first_p2wpkhaddressindex'), + firstP2wshaddressindex: createMetricPattern11(this, 'first_p2wshaddressindex'), + p2abytes: createMetricPattern16(this, 'p2abytes'), + p2pk33bytes: createMetricPattern18(this, 'p2pk33bytes'), + p2pk65bytes: createMetricPattern19(this, 'p2pk65bytes'), + p2pkhbytes: createMetricPattern20(this, 'p2pkhbytes'), + p2shbytes: createMetricPattern21(this, 'p2shbytes'), + p2trbytes: createMetricPattern22(this, 'p2trbytes'), + p2wpkhbytes: createMetricPattern23(this, 'p2wpkhbytes'), + p2wshbytes: createMetricPattern24(this, 'p2wshbytes'), }, blocks: { - blockhash: createMetricPattern11(this, "blockhash"), + blockhash: createMetricPattern11(this, 'blockhash'), count: { - _1mBlockCount: createMetricPattern1(this, "1m_block_count"), - _1mStart: createMetricPattern11(this, "1m_start"), - _1wBlockCount: createMetricPattern1(this, "1w_block_count"), - _1wStart: createMetricPattern11(this, "1w_start"), - _1yBlockCount: createMetricPattern1(this, "1y_block_count"), - _1yStart: createMetricPattern11(this, "1y_start"), - _24hBlockCount: createMetricPattern1(this, "24h_block_count"), - _24hStart: createMetricPattern11(this, "24h_start"), - blockCount: createBlockCountPattern(this, "block_count"), - blockCountTarget: createMetricPattern4(this, "block_count_target"), + _1mBlockCount: createMetricPattern1(this, '1m_block_count'), + _1mStart: createMetricPattern11(this, '1m_start'), + _1wBlockCount: createMetricPattern1(this, '1w_block_count'), + _1wStart: createMetricPattern11(this, '1w_start'), + _1yBlockCount: createMetricPattern1(this, '1y_block_count'), + _1yStart: createMetricPattern11(this, '1y_start'), + _24hBlockCount: createMetricPattern1(this, '24h_block_count'), + _24hStart: createMetricPattern11(this, '24h_start'), + blockCount: createBlockCountPattern(this, 'block_count'), + blockCountTarget: createMetricPattern4(this, 'block_count_target'), }, difficulty: { - adjustment: createMetricPattern1(this, "difficulty_adjustment"), - asHash: createMetricPattern1(this, "difficulty_as_hash"), - blocksBeforeNextAdjustment: createMetricPattern1( - this, - "blocks_before_next_difficulty_adjustment", - ), - daysBeforeNextAdjustment: createMetricPattern1( - this, - "days_before_next_difficulty_adjustment", - ), - epoch: createMetricPattern4(this, "difficultyepoch"), - raw: createMetricPattern1(this, "difficulty"), + adjustment: createMetricPattern1(this, 'difficulty_adjustment'), + asHash: createMetricPattern1(this, 'difficulty_as_hash'), + blocksBeforeNextAdjustment: createMetricPattern1(this, 'blocks_before_next_difficulty_adjustment'), + daysBeforeNextAdjustment: createMetricPattern1(this, 'days_before_next_difficulty_adjustment'), + epoch: createMetricPattern4(this, 'difficultyepoch'), + raw: createMetricPattern1(this, 'difficulty'), }, - fullness: createFullnessPattern(this, "block_fullness"), + fullness: createFullnessPattern(this, 'block_fullness'), halving: { - blocksBeforeNextHalving: createMetricPattern1( - this, - "blocks_before_next_halving", - ), - daysBeforeNextHalving: createMetricPattern1( - this, - "days_before_next_halving", - ), - epoch: createMetricPattern4(this, "halvingepoch"), + blocksBeforeNextHalving: createMetricPattern1(this, 'blocks_before_next_halving'), + daysBeforeNextHalving: createMetricPattern1(this, 'days_before_next_halving'), + epoch: createMetricPattern4(this, 'halvingepoch'), }, interval: { - average: createMetricPattern2(this, "block_interval_average"), - base: createMetricPattern11(this, "block_interval"), - max: createMetricPattern2(this, "block_interval_max"), - median: createMetricPattern6(this, "block_interval_median"), - min: createMetricPattern2(this, "block_interval_min"), - pct10: createMetricPattern6(this, "block_interval_pct10"), - pct25: createMetricPattern6(this, "block_interval_pct25"), - pct75: createMetricPattern6(this, "block_interval_pct75"), - pct90: createMetricPattern6(this, "block_interval_pct90"), + average: createMetricPattern2(this, 'block_interval_average'), + base: createMetricPattern11(this, 'block_interval'), + max: createMetricPattern2(this, 'block_interval_max'), + median: createMetricPattern6(this, 'block_interval_median'), + min: createMetricPattern2(this, 'block_interval_min'), + pct10: createMetricPattern6(this, 'block_interval_pct10'), + pct25: createMetricPattern6(this, 'block_interval_pct25'), + pct75: createMetricPattern6(this, 'block_interval_pct75'), + pct90: createMetricPattern6(this, 'block_interval_pct90'), }, mining: { - hashPricePhs: createMetricPattern1(this, "hash_price_phs"), - hashPricePhsMin: createMetricPattern1(this, "hash_price_phs_min"), - hashPriceRebound: createMetricPattern1(this, "hash_price_rebound"), - hashPriceThs: createMetricPattern1(this, "hash_price_ths"), - hashPriceThsMin: createMetricPattern1(this, "hash_price_ths_min"), - hashRate: createMetricPattern1(this, "hash_rate"), - hashRate1mSma: createMetricPattern4(this, "hash_rate_1m_sma"), - hashRate1wSma: createMetricPattern4(this, "hash_rate_1w_sma"), - hashRate1ySma: createMetricPattern4(this, "hash_rate_1y_sma"), - hashRate2mSma: createMetricPattern4(this, "hash_rate_2m_sma"), - hashValuePhs: createMetricPattern1(this, "hash_value_phs"), - hashValuePhsMin: createMetricPattern1(this, "hash_value_phs_min"), - hashValueRebound: createMetricPattern1(this, "hash_value_rebound"), - hashValueThs: createMetricPattern1(this, "hash_value_ths"), - hashValueThsMin: createMetricPattern1(this, "hash_value_ths_min"), + hashPricePhs: createMetricPattern1(this, 'hash_price_phs'), + hashPricePhsMin: createMetricPattern1(this, 'hash_price_phs_min'), + hashPriceRebound: createMetricPattern1(this, 'hash_price_rebound'), + hashPriceThs: createMetricPattern1(this, 'hash_price_ths'), + hashPriceThsMin: createMetricPattern1(this, 'hash_price_ths_min'), + hashRate: createMetricPattern1(this, 'hash_rate'), + hashRate1mSma: createMetricPattern4(this, 'hash_rate_1m_sma'), + hashRate1wSma: createMetricPattern4(this, 'hash_rate_1w_sma'), + hashRate1ySma: createMetricPattern4(this, 'hash_rate_1y_sma'), + hashRate2mSma: createMetricPattern4(this, 'hash_rate_2m_sma'), + hashValuePhs: createMetricPattern1(this, 'hash_value_phs'), + hashValuePhsMin: createMetricPattern1(this, 'hash_value_phs_min'), + hashValueRebound: createMetricPattern1(this, 'hash_value_rebound'), + hashValueThs: createMetricPattern1(this, 'hash_value_ths'), + hashValueThsMin: createMetricPattern1(this, 'hash_value_ths_min'), }, rewards: { _24hCoinbaseSum: { - bitcoin: createMetricPattern11(this, "24h_coinbase_sum_btc"), - dollars: createMetricPattern11(this, "24h_coinbase_sum_usd"), - sats: createMetricPattern11(this, "24h_coinbase_sum"), + bitcoin: createMetricPattern11(this, '24h_coinbase_sum_btc'), + dollars: createMetricPattern11(this, '24h_coinbase_sum_usd'), + sats: createMetricPattern11(this, '24h_coinbase_sum'), }, - coinbase: createCoinbasePattern(this, "coinbase"), - feeDominance: createMetricPattern6(this, "fee_dominance"), - subsidy: createCoinbasePattern(this, "subsidy"), - subsidyDominance: createMetricPattern6(this, "subsidy_dominance"), - subsidyUsd1ySma: createMetricPattern4(this, "subsidy_usd_1y_sma"), - unclaimedRewards: createUnclaimedRewardsPattern( - this, - "unclaimed_rewards", - ), + coinbase: createCoinbasePattern(this, 'coinbase'), + feeDominance: createMetricPattern6(this, 'fee_dominance'), + subsidy: createCoinbasePattern(this, 'subsidy'), + subsidyDominance: createMetricPattern6(this, 'subsidy_dominance'), + subsidyUsd1ySma: createMetricPattern4(this, 'subsidy_usd_1y_sma'), + unclaimedRewards: createUnclaimedRewardsPattern(this, 'unclaimed_rewards'), }, size: { - average: createMetricPattern2(this, "block_size_average"), - cumulative: createMetricPattern1(this, "block_size_cumulative"), - max: createMetricPattern2(this, "block_size_max"), - median: createMetricPattern6(this, "block_size_median"), - min: createMetricPattern2(this, "block_size_min"), - pct10: createMetricPattern6(this, "block_size_pct10"), - pct25: createMetricPattern6(this, "block_size_pct25"), - pct75: createMetricPattern6(this, "block_size_pct75"), - pct90: createMetricPattern6(this, "block_size_pct90"), - sum: createMetricPattern2(this, "block_size_sum"), + average: createMetricPattern2(this, 'block_size_average'), + cumulative: createMetricPattern1(this, 'block_size_cumulative'), + max: createMetricPattern2(this, 'block_size_max'), + median: createMetricPattern6(this, 'block_size_median'), + min: createMetricPattern2(this, 'block_size_min'), + pct10: createMetricPattern6(this, 'block_size_pct10'), + pct25: createMetricPattern6(this, 'block_size_pct25'), + pct75: createMetricPattern6(this, 'block_size_pct75'), + pct90: createMetricPattern6(this, 'block_size_pct90'), + sum: createMetricPattern2(this, 'block_size_sum'), }, time: { - date: createMetricPattern11(this, "date"), - dateFixed: createMetricPattern11(this, "date_fixed"), - timestamp: createMetricPattern1(this, "timestamp"), - timestampFixed: createMetricPattern11(this, "timestamp_fixed"), + date: createMetricPattern11(this, 'date'), + dateFixed: createMetricPattern11(this, 'date_fixed'), + timestamp: createMetricPattern1(this, 'timestamp'), + timestampFixed: createMetricPattern11(this, 'timestamp_fixed'), + }, + totalSize: createMetricPattern11(this, 'total_size'), + vbytes: createDollarsPattern(this, 'block_vbytes'), + weight: { + average: createMetricPattern2(this, 'block_weight_average'), + base: createMetricPattern11(this, 'weight'), + cumulative: createMetricPattern1(this, 'block_weight_cumulative'), + max: createMetricPattern2(this, 'block_weight_max'), + median: createMetricPattern6(this, 'block_weight_median'), + min: createMetricPattern2(this, 'block_weight_min'), + pct10: createMetricPattern6(this, 'block_weight_pct10'), + pct25: createMetricPattern6(this, 'block_weight_pct25'), + pct75: createMetricPattern6(this, 'block_weight_pct75'), + pct90: createMetricPattern6(this, 'block_weight_pct90'), + sum: createMetricPattern2(this, 'block_weight_sum'), }, - totalSize: createMetricPattern11(this, "total_size"), - vbytes: createDollarsPattern(this, "block_vbytes"), - weight: createDollarsPattern(this, "block_weight_average"), }, cointime: { activity: { - activityToVaultednessRatio: createMetricPattern1( - this, - "activity_to_vaultedness_ratio", - ), - coinblocksCreated: createBlockCountPattern( - this, - "coinblocks_created", - ), - coinblocksStored: createBlockCountPattern(this, "coinblocks_stored"), - liveliness: createMetricPattern1(this, "liveliness"), - vaultedness: createMetricPattern1(this, "vaultedness"), + activityToVaultednessRatio: createMetricPattern1(this, 'activity_to_vaultedness_ratio'), + coinblocksCreated: createBlockCountPattern(this, 'coinblocks_created'), + coinblocksStored: createBlockCountPattern(this, 'coinblocks_stored'), + liveliness: createMetricPattern1(this, 'liveliness'), + vaultedness: createMetricPattern1(this, 'vaultedness'), }, adjusted: { - cointimeAdjInflationRate: createMetricPattern4( - this, - "cointime_adj_inflation_rate", - ), - cointimeAdjTxBtcVelocity: createMetricPattern4( - this, - "cointime_adj_tx_btc_velocity", - ), - cointimeAdjTxUsdVelocity: createMetricPattern4( - this, - "cointime_adj_tx_usd_velocity", - ), + cointimeAdjInflationRate: createMetricPattern4(this, 'cointime_adj_inflation_rate'), + cointimeAdjTxBtcVelocity: createMetricPattern4(this, 'cointime_adj_tx_btc_velocity'), + cointimeAdjTxUsdVelocity: createMetricPattern4(this, 'cointime_adj_tx_usd_velocity'), }, cap: { - activeCap: createMetricPattern1(this, "active_cap"), - cointimeCap: createMetricPattern1(this, "cointime_cap"), - investorCap: createMetricPattern1(this, "investor_cap"), - thermoCap: createMetricPattern1(this, "thermo_cap"), - vaultedCap: createMetricPattern1(this, "vaulted_cap"), + activeCap: createMetricPattern1(this, 'active_cap'), + cointimeCap: createMetricPattern1(this, 'cointime_cap'), + investorCap: createMetricPattern1(this, 'investor_cap'), + thermoCap: createMetricPattern1(this, 'thermo_cap'), + vaultedCap: createMetricPattern1(this, 'vaulted_cap'), }, pricing: { - activePrice: createMetricPattern1(this, "active_price"), - activePriceRatio: createActivePriceRatioPattern( - this, - "active_price_ratio", - ), - cointimePrice: createMetricPattern1(this, "cointime_price"), - cointimePriceRatio: createActivePriceRatioPattern( - this, - "cointime_price_ratio", - ), - trueMarketMean: createMetricPattern1(this, "true_market_mean"), - trueMarketMeanRatio: createActivePriceRatioPattern( - this, - "true_market_mean_ratio", - ), - vaultedPrice: createMetricPattern1(this, "vaulted_price"), - vaultedPriceRatio: createActivePriceRatioPattern( - this, - "vaulted_price_ratio", - ), + activePrice: createMetricPattern1(this, 'active_price'), + activePriceRatio: createActivePriceRatioPattern(this, 'active_price_ratio'), + cointimePrice: createMetricPattern1(this, 'cointime_price'), + cointimePriceRatio: createActivePriceRatioPattern(this, 'cointime_price_ratio'), + trueMarketMean: createMetricPattern1(this, 'true_market_mean'), + trueMarketMeanRatio: createActivePriceRatioPattern(this, 'true_market_mean_ratio'), + vaultedPrice: createMetricPattern1(this, 'vaulted_price'), + vaultedPriceRatio: createActivePriceRatioPattern(this, 'vaulted_price_ratio'), }, supply: { - activeSupply: createActiveSupplyPattern(this, "active_supply"), - vaultedSupply: createActiveSupplyPattern(this, "vaulted_supply"), + activeSupply: createActiveSupplyPattern(this, 'active_supply'), + vaultedSupply: createActiveSupplyPattern(this, 'vaulted_supply'), }, value: { - cointimeValueCreated: createBlockCountPattern( - this, - "cointime_value_created", - ), - cointimeValueDestroyed: createBlockCountPattern( - this, - "cointime_value_destroyed", - ), - cointimeValueStored: createBlockCountPattern( - this, - "cointime_value_stored", - ), + cointimeValueCreated: createBlockCountPattern(this, 'cointime_value_created'), + cointimeValueDestroyed: createBlockCountPattern(this, 'cointime_value_destroyed'), + cointimeValueStored: createBlockCountPattern(this, 'cointime_value_stored'), }, }, constants: { - constant0: createMetricPattern1(this, "constant_0"), - constant1: createMetricPattern1(this, "constant_1"), - constant100: createMetricPattern1(this, "constant_100"), - constant2: createMetricPattern1(this, "constant_2"), - constant20: createMetricPattern1(this, "constant_20"), - constant3: createMetricPattern1(this, "constant_3"), - constant30: createMetricPattern1(this, "constant_30"), - constant382: createMetricPattern1(this, "constant_38_2"), - constant4: createMetricPattern1(this, "constant_4"), - constant50: createMetricPattern1(this, "constant_50"), - constant600: createMetricPattern1(this, "constant_600"), - constant618: createMetricPattern1(this, "constant_61_8"), - constant70: createMetricPattern1(this, "constant_70"), - constant80: createMetricPattern1(this, "constant_80"), - constantMinus1: createMetricPattern1(this, "constant_minus_1"), - constantMinus2: createMetricPattern1(this, "constant_minus_2"), - constantMinus3: createMetricPattern1(this, "constant_minus_3"), - constantMinus4: createMetricPattern1(this, "constant_minus_4"), + constant0: createMetricPattern1(this, 'constant_0'), + constant1: createMetricPattern1(this, 'constant_1'), + constant100: createMetricPattern1(this, 'constant_100'), + constant2: createMetricPattern1(this, 'constant_2'), + constant20: createMetricPattern1(this, 'constant_20'), + constant3: createMetricPattern1(this, 'constant_3'), + constant30: createMetricPattern1(this, 'constant_30'), + constant382: createMetricPattern1(this, 'constant_38_2'), + constant4: createMetricPattern1(this, 'constant_4'), + constant50: createMetricPattern1(this, 'constant_50'), + constant600: createMetricPattern1(this, 'constant_600'), + constant618: createMetricPattern1(this, 'constant_61_8'), + constant70: createMetricPattern1(this, 'constant_70'), + constant80: createMetricPattern1(this, 'constant_80'), + constantMinus1: createMetricPattern1(this, 'constant_minus_1'), + constantMinus2: createMetricPattern1(this, 'constant_minus_2'), + constantMinus3: createMetricPattern1(this, 'constant_minus_3'), + constantMinus4: createMetricPattern1(this, 'constant_minus_4'), }, distribution: { addrCount: { - all: createMetricPattern1(this, "addr_count"), - p2a: createMetricPattern1(this, "p2a_addr_count"), - p2pk33: createMetricPattern1(this, "p2pk33_addr_count"), - p2pk65: createMetricPattern1(this, "p2pk65_addr_count"), - p2pkh: createMetricPattern1(this, "p2pkh_addr_count"), - p2sh: createMetricPattern1(this, "p2sh_addr_count"), - p2tr: createMetricPattern1(this, "p2tr_addr_count"), - p2wpkh: createMetricPattern1(this, "p2wpkh_addr_count"), - p2wsh: createMetricPattern1(this, "p2wsh_addr_count"), + all: createMetricPattern1(this, 'addr_count'), + p2a: createMetricPattern1(this, 'p2a_addr_count'), + p2pk33: createMetricPattern1(this, 'p2pk33_addr_count'), + p2pk65: createMetricPattern1(this, 'p2pk65_addr_count'), + p2pkh: createMetricPattern1(this, 'p2pkh_addr_count'), + p2sh: createMetricPattern1(this, 'p2sh_addr_count'), + p2tr: createMetricPattern1(this, 'p2tr_addr_count'), + p2wpkh: createMetricPattern1(this, 'p2wpkh_addr_count'), + p2wsh: createMetricPattern1(this, 'p2wsh_addr_count'), }, addressCohorts: { amountRange: { - _0sats: create_0satsPattern(this, "addrs_with_0sats"), - _100btcTo1kBtc: create_0satsPattern( - this, - "addrs_above_100btc_under_1k_btc", - ), - _100kBtcOrMore: create_0satsPattern(this, "addrs_above_100k_btc"), - _100kSatsTo1mSats: create_0satsPattern( - this, - "addrs_above_100k_sats_under_1m_sats", - ), - _100satsTo1kSats: create_0satsPattern( - this, - "addrs_above_100sats_under_1k_sats", - ), - _10btcTo100btc: create_0satsPattern( - this, - "addrs_above_10btc_under_100btc", - ), - _10kBtcTo100kBtc: create_0satsPattern( - this, - "addrs_above_10k_btc_under_100k_btc", - ), - _10kSatsTo100kSats: create_0satsPattern( - this, - "addrs_above_10k_sats_under_100k_sats", - ), - _10mSatsTo1btc: create_0satsPattern( - this, - "addrs_above_10m_sats_under_1btc", - ), - _10satsTo100sats: create_0satsPattern( - this, - "addrs_above_10sats_under_100sats", - ), - _1btcTo10btc: create_0satsPattern( - this, - "addrs_above_1btc_under_10btc", - ), - _1kBtcTo10kBtc: create_0satsPattern( - this, - "addrs_above_1k_btc_under_10k_btc", - ), - _1kSatsTo10kSats: create_0satsPattern( - this, - "addrs_above_1k_sats_under_10k_sats", - ), - _1mSatsTo10mSats: create_0satsPattern( - this, - "addrs_above_1m_sats_under_10m_sats", - ), - _1satTo10sats: create_0satsPattern( - this, - "addrs_above_1sat_under_10sats", - ), + _0sats: create_0satsPattern(this, 'addrs_with_0sats'), + _100btcTo1kBtc: create_0satsPattern(this, 'addrs_above_100btc_under_1k_btc'), + _100kBtcOrMore: create_0satsPattern(this, 'addrs_above_100k_btc'), + _100kSatsTo1mSats: create_0satsPattern(this, 'addrs_above_100k_sats_under_1m_sats'), + _100satsTo1kSats: create_0satsPattern(this, 'addrs_above_100sats_under_1k_sats'), + _10btcTo100btc: create_0satsPattern(this, 'addrs_above_10btc_under_100btc'), + _10kBtcTo100kBtc: create_0satsPattern(this, 'addrs_above_10k_btc_under_100k_btc'), + _10kSatsTo100kSats: create_0satsPattern(this, 'addrs_above_10k_sats_under_100k_sats'), + _10mSatsTo1btc: create_0satsPattern(this, 'addrs_above_10m_sats_under_1btc'), + _10satsTo100sats: create_0satsPattern(this, 'addrs_above_10sats_under_100sats'), + _1btcTo10btc: create_0satsPattern(this, 'addrs_above_1btc_under_10btc'), + _1kBtcTo10kBtc: create_0satsPattern(this, 'addrs_above_1k_btc_under_10k_btc'), + _1kSatsTo10kSats: create_0satsPattern(this, 'addrs_above_1k_sats_under_10k_sats'), + _1mSatsTo10mSats: create_0satsPattern(this, 'addrs_above_1m_sats_under_10m_sats'), + _1satTo10sats: create_0satsPattern(this, 'addrs_above_1sat_under_10sats'), }, geAmount: { - _100btc: create_0satsPattern(this, "addrs_above_100btc"), - _100kSats: create_0satsPattern(this, "addrs_above_100k_sats"), - _100sats: create_0satsPattern(this, "addrs_above_100sats"), - _10btc: create_0satsPattern(this, "addrs_above_10btc"), - _10kBtc: create_0satsPattern(this, "addrs_above_10k_btc"), - _10kSats: create_0satsPattern(this, "addrs_above_10k_sats"), - _10mSats: create_0satsPattern(this, "addrs_above_10m_sats"), - _10sats: create_0satsPattern(this, "addrs_above_10sats"), - _1btc: create_0satsPattern(this, "addrs_above_1btc"), - _1kBtc: create_0satsPattern(this, "addrs_above_1k_btc"), - _1kSats: create_0satsPattern(this, "addrs_above_1k_sats"), - _1mSats: create_0satsPattern(this, "addrs_above_1m_sats"), - _1sat: create_0satsPattern(this, "addrs_above_1sat"), + _100btc: create_0satsPattern(this, 'addrs_above_100btc'), + _100kSats: create_0satsPattern(this, 'addrs_above_100k_sats'), + _100sats: create_0satsPattern(this, 'addrs_above_100sats'), + _10btc: create_0satsPattern(this, 'addrs_above_10btc'), + _10kBtc: create_0satsPattern(this, 'addrs_above_10k_btc'), + _10kSats: create_0satsPattern(this, 'addrs_above_10k_sats'), + _10mSats: create_0satsPattern(this, 'addrs_above_10m_sats'), + _10sats: create_0satsPattern(this, 'addrs_above_10sats'), + _1btc: create_0satsPattern(this, 'addrs_above_1btc'), + _1kBtc: create_0satsPattern(this, 'addrs_above_1k_btc'), + _1kSats: create_0satsPattern(this, 'addrs_above_1k_sats'), + _1mSats: create_0satsPattern(this, 'addrs_above_1m_sats'), + _1sat: create_0satsPattern(this, 'addrs_above_1sat'), }, ltAmount: { - _100btc: create_0satsPattern(this, "addrs_under_100btc"), - _100kBtc: create_0satsPattern(this, "addrs_under_100k_btc"), - _100kSats: create_0satsPattern(this, "addrs_under_100k_sats"), - _100sats: create_0satsPattern(this, "addrs_under_100sats"), - _10btc: create_0satsPattern(this, "addrs_under_10btc"), - _10kBtc: create_0satsPattern(this, "addrs_under_10k_btc"), - _10kSats: create_0satsPattern(this, "addrs_under_10k_sats"), - _10mSats: create_0satsPattern(this, "addrs_under_10m_sats"), - _10sats: create_0satsPattern(this, "addrs_under_10sats"), - _1btc: create_0satsPattern(this, "addrs_under_1btc"), - _1kBtc: create_0satsPattern(this, "addrs_under_1k_btc"), - _1kSats: create_0satsPattern(this, "addrs_under_1k_sats"), - _1mSats: create_0satsPattern(this, "addrs_under_1m_sats"), + _100btc: create_0satsPattern(this, 'addrs_under_100btc'), + _100kBtc: create_0satsPattern(this, 'addrs_under_100k_btc'), + _100kSats: create_0satsPattern(this, 'addrs_under_100k_sats'), + _100sats: create_0satsPattern(this, 'addrs_under_100sats'), + _10btc: create_0satsPattern(this, 'addrs_under_10btc'), + _10kBtc: create_0satsPattern(this, 'addrs_under_10k_btc'), + _10kSats: create_0satsPattern(this, 'addrs_under_10k_sats'), + _10mSats: create_0satsPattern(this, 'addrs_under_10m_sats'), + _10sats: create_0satsPattern(this, 'addrs_under_10sats'), + _1btc: create_0satsPattern(this, 'addrs_under_1btc'), + _1kBtc: create_0satsPattern(this, 'addrs_under_1k_btc'), + _1kSats: create_0satsPattern(this, 'addrs_under_1k_sats'), + _1mSats: create_0satsPattern(this, 'addrs_under_1m_sats'), }, }, addressesData: { - empty: createMetricPattern32(this, "emptyaddressdata"), - loaded: createMetricPattern31(this, "loadedaddressdata"), + empty: createMetricPattern32(this, 'emptyaddressdata'), + loaded: createMetricPattern31(this, 'loadedaddressdata'), }, anyAddressIndexes: { - p2a: createMetricPattern16(this, "anyaddressindex"), - p2pk33: createMetricPattern18(this, "anyaddressindex"), - p2pk65: createMetricPattern19(this, "anyaddressindex"), - p2pkh: createMetricPattern20(this, "anyaddressindex"), - p2sh: createMetricPattern21(this, "anyaddressindex"), - p2tr: createMetricPattern22(this, "anyaddressindex"), - p2wpkh: createMetricPattern23(this, "anyaddressindex"), - p2wsh: createMetricPattern24(this, "anyaddressindex"), + p2a: createMetricPattern16(this, 'anyaddressindex'), + p2pk33: createMetricPattern18(this, 'anyaddressindex'), + p2pk65: createMetricPattern19(this, 'anyaddressindex'), + p2pkh: createMetricPattern20(this, 'anyaddressindex'), + p2sh: createMetricPattern21(this, 'anyaddressindex'), + p2tr: createMetricPattern22(this, 'anyaddressindex'), + p2wpkh: createMetricPattern23(this, 'anyaddressindex'), + p2wsh: createMetricPattern24(this, 'anyaddressindex'), }, - chainState: createMetricPattern11(this, "chain"), + chainState: createMetricPattern11(this, 'chain'), emptyAddrCount: { - all: createMetricPattern1(this, "empty_addr_count"), - p2a: createMetricPattern1(this, "p2a_empty_addr_count"), - p2pk33: createMetricPattern1(this, "p2pk33_empty_addr_count"), - p2pk65: createMetricPattern1(this, "p2pk65_empty_addr_count"), - p2pkh: createMetricPattern1(this, "p2pkh_empty_addr_count"), - p2sh: createMetricPattern1(this, "p2sh_empty_addr_count"), - p2tr: createMetricPattern1(this, "p2tr_empty_addr_count"), - p2wpkh: createMetricPattern1(this, "p2wpkh_empty_addr_count"), - p2wsh: createMetricPattern1(this, "p2wsh_empty_addr_count"), + all: createMetricPattern1(this, 'empty_addr_count'), + p2a: createMetricPattern1(this, 'p2a_empty_addr_count'), + p2pk33: createMetricPattern1(this, 'p2pk33_empty_addr_count'), + p2pk65: createMetricPattern1(this, 'p2pk65_empty_addr_count'), + p2pkh: createMetricPattern1(this, 'p2pkh_empty_addr_count'), + p2sh: createMetricPattern1(this, 'p2sh_empty_addr_count'), + p2tr: createMetricPattern1(this, 'p2tr_empty_addr_count'), + p2wpkh: createMetricPattern1(this, 'p2wpkh_empty_addr_count'), + p2wsh: createMetricPattern1(this, 'p2wsh_empty_addr_count'), }, - emptyaddressindex: createMetricPattern32(this, "emptyaddressindex"), - loadedaddressindex: createMetricPattern31(this, "loadedaddressindex"), + emptyaddressindex: createMetricPattern32(this, 'emptyaddressindex'), + loadedaddressindex: createMetricPattern31(this, 'loadedaddressindex'), utxoCohorts: { ageRange: { - _10yTo12y: create_10yTo12yPattern( - this, - "utxos_at_least_10y_up_to_12y_old", - ), - _12yTo15y: create_10yTo12yPattern( - this, - "utxos_at_least_12y_up_to_15y_old", - ), - _1dTo1w: create_10yTo12yPattern( - this, - "utxos_at_least_1d_up_to_1w_old", - ), - _1hTo1d: create_10yTo12yPattern( - this, - "utxos_at_least_1h_up_to_1d_old", - ), - _1mTo2m: create_10yTo12yPattern( - this, - "utxos_at_least_1m_up_to_2m_old", - ), - _1wTo1m: create_10yTo12yPattern( - this, - "utxos_at_least_1w_up_to_1m_old", - ), - _1yTo2y: create_10yTo12yPattern( - this, - "utxos_at_least_1y_up_to_2y_old", - ), - _2mTo3m: create_10yTo12yPattern( - this, - "utxos_at_least_2m_up_to_3m_old", - ), - _2yTo3y: create_10yTo12yPattern( - this, - "utxos_at_least_2y_up_to_3y_old", - ), - _3mTo4m: create_10yTo12yPattern( - this, - "utxos_at_least_3m_up_to_4m_old", - ), - _3yTo4y: create_10yTo12yPattern( - this, - "utxos_at_least_3y_up_to_4y_old", - ), - _4mTo5m: create_10yTo12yPattern( - this, - "utxos_at_least_4m_up_to_5m_old", - ), - _4yTo5y: create_10yTo12yPattern( - this, - "utxos_at_least_4y_up_to_5y_old", - ), - _5mTo6m: create_10yTo12yPattern( - this, - "utxos_at_least_5m_up_to_6m_old", - ), - _5yTo6y: create_10yTo12yPattern( - this, - "utxos_at_least_5y_up_to_6y_old", - ), - _6mTo1y: create_10yTo12yPattern( - this, - "utxos_at_least_6m_up_to_1y_old", - ), - _6yTo7y: create_10yTo12yPattern( - this, - "utxos_at_least_6y_up_to_7y_old", - ), - _7yTo8y: create_10yTo12yPattern( - this, - "utxos_at_least_7y_up_to_8y_old", - ), - _8yTo10y: create_10yTo12yPattern( - this, - "utxos_at_least_8y_up_to_10y_old", - ), - from15y: create_10yTo12yPattern(this, "utxos_at_least_15y_old"), - upTo1h: create_10yTo12yPattern(this, "utxos_up_to_1h_old"), + _10yTo12y: create_10yTo12yPattern(this, 'utxos_at_least_10y_up_to_12y_old'), + _12yTo15y: create_10yTo12yPattern(this, 'utxos_at_least_12y_up_to_15y_old'), + _1dTo1w: create_10yTo12yPattern(this, 'utxos_at_least_1d_up_to_1w_old'), + _1hTo1d: create_10yTo12yPattern(this, 'utxos_at_least_1h_up_to_1d_old'), + _1mTo2m: create_10yTo12yPattern(this, 'utxos_at_least_1m_up_to_2m_old'), + _1wTo1m: create_10yTo12yPattern(this, 'utxos_at_least_1w_up_to_1m_old'), + _1yTo2y: create_10yTo12yPattern(this, 'utxos_at_least_1y_up_to_2y_old'), + _2mTo3m: create_10yTo12yPattern(this, 'utxos_at_least_2m_up_to_3m_old'), + _2yTo3y: create_10yTo12yPattern(this, 'utxos_at_least_2y_up_to_3y_old'), + _3mTo4m: create_10yTo12yPattern(this, 'utxos_at_least_3m_up_to_4m_old'), + _3yTo4y: create_10yTo12yPattern(this, 'utxos_at_least_3y_up_to_4y_old'), + _4mTo5m: create_10yTo12yPattern(this, 'utxos_at_least_4m_up_to_5m_old'), + _4yTo5y: create_10yTo12yPattern(this, 'utxos_at_least_4y_up_to_5y_old'), + _5mTo6m: create_10yTo12yPattern(this, 'utxos_at_least_5m_up_to_6m_old'), + _5yTo6y: create_10yTo12yPattern(this, 'utxos_at_least_5y_up_to_6y_old'), + _6mTo1y: create_10yTo12yPattern(this, 'utxos_at_least_6m_up_to_1y_old'), + _6yTo7y: create_10yTo12yPattern(this, 'utxos_at_least_6y_up_to_7y_old'), + _7yTo8y: create_10yTo12yPattern(this, 'utxos_at_least_7y_up_to_8y_old'), + _8yTo10y: create_10yTo12yPattern(this, 'utxos_at_least_8y_up_to_10y_old'), + from15y: create_10yTo12yPattern(this, 'utxos_at_least_15y_old'), + upTo1h: create_10yTo12yPattern(this, 'utxos_up_to_1h_old'), }, all: { - activity: createActivityPattern2(this, ""), + activity: { + coinblocksDestroyed: createBlockCountPattern(this, 'coinblocks_destroyed'), + coindaysDestroyed: createBlockCountPattern(this, 'coindays_destroyed'), + satblocksDestroyed: createMetricPattern11(this, 'satblocks_destroyed'), + satdaysDestroyed: createMetricPattern11(this, 'satdays_destroyed'), + sent: createUnclaimedRewardsPattern(this, 'sent'), + }, costBasis: { - max: createMetricPattern1(this, "max_cost_basis"), - min: createMetricPattern1(this, "min_cost_basis"), - percentiles: createPercentilesPattern(this, "cost_basis"), + max: createMetricPattern1(this, 'max_cost_basis'), + min: createMetricPattern1(this, 'min_cost_basis'), + percentiles: createPercentilesPattern(this, 'cost_basis'), }, - outputs: createOutputsPattern(this, "utxo_count"), - realized: createRealizedPattern3(this, "adjusted_sopr"), + outputs: createOutputsPattern(this, 'utxo_count'), + realized: createRealizedPattern3(this, 'adjusted_sopr'), relative: { - negUnrealizedLossRelToOwnTotalUnrealizedPnl: createMetricPattern1( - this, - "neg_unrealized_loss_rel_to_own_total_unrealized_pnl", - ), - netUnrealizedPnlRelToOwnTotalUnrealizedPnl: createMetricPattern1( - this, - "net_unrealized_pnl_rel_to_own_total_unrealized_pnl", - ), - supplyInLossRelToOwnSupply: createMetricPattern1( - this, - "supply_in_loss_rel_to_own_supply", - ), - supplyInProfitRelToOwnSupply: createMetricPattern1( - this, - "supply_in_profit_rel_to_own_supply", - ), - unrealizedLossRelToOwnTotalUnrealizedPnl: createMetricPattern1( - this, - "unrealized_loss_rel_to_own_total_unrealized_pnl", - ), - unrealizedProfitRelToOwnTotalUnrealizedPnl: createMetricPattern1( - this, - "unrealized_profit_rel_to_own_total_unrealized_pnl", - ), + negUnrealizedLossRelToOwnTotalUnrealizedPnl: createMetricPattern1(this, 'neg_unrealized_loss_rel_to_own_total_unrealized_pnl'), + netUnrealizedPnlRelToOwnTotalUnrealizedPnl: createMetricPattern1(this, 'net_unrealized_pnl_rel_to_own_total_unrealized_pnl'), + supplyInLossRelToOwnSupply: createMetricPattern1(this, 'supply_in_loss_rel_to_own_supply'), + supplyInProfitRelToOwnSupply: createMetricPattern1(this, 'supply_in_profit_rel_to_own_supply'), + unrealizedLossRelToOwnTotalUnrealizedPnl: createMetricPattern1(this, 'unrealized_loss_rel_to_own_total_unrealized_pnl'), + unrealizedProfitRelToOwnTotalUnrealizedPnl: createMetricPattern1(this, 'unrealized_profit_rel_to_own_total_unrealized_pnl'), }, - supply: createSupplyPattern2(this, "supply"), - unrealized: createUnrealizedPattern(this, ""), + supply: createSupplyPattern2(this, 'supply'), + unrealized: createUnrealizedPattern(this, ''), }, amountRange: { - _0sats: create_0satsPattern2(this, "utxos_with_0sats"), - _100btcTo1kBtc: create_0satsPattern2( - this, - "utxos_above_100btc_under_1k_btc", - ), - _100kBtcOrMore: create_0satsPattern2(this, "utxos_above_100k_btc"), - _100kSatsTo1mSats: create_0satsPattern2( - this, - "utxos_above_100k_sats_under_1m_sats", - ), - _100satsTo1kSats: create_0satsPattern2( - this, - "utxos_above_100sats_under_1k_sats", - ), - _10btcTo100btc: create_0satsPattern2( - this, - "utxos_above_10btc_under_100btc", - ), - _10kBtcTo100kBtc: create_0satsPattern2( - this, - "utxos_above_10k_btc_under_100k_btc", - ), - _10kSatsTo100kSats: create_0satsPattern2( - this, - "utxos_above_10k_sats_under_100k_sats", - ), - _10mSatsTo1btc: create_0satsPattern2( - this, - "utxos_above_10m_sats_under_1btc", - ), - _10satsTo100sats: create_0satsPattern2( - this, - "utxos_above_10sats_under_100sats", - ), - _1btcTo10btc: create_0satsPattern2( - this, - "utxos_above_1btc_under_10btc", - ), - _1kBtcTo10kBtc: create_0satsPattern2( - this, - "utxos_above_1k_btc_under_10k_btc", - ), - _1kSatsTo10kSats: create_0satsPattern2( - this, - "utxos_above_1k_sats_under_10k_sats", - ), - _1mSatsTo10mSats: create_0satsPattern2( - this, - "utxos_above_1m_sats_under_10m_sats", - ), - _1satTo10sats: create_0satsPattern2( - this, - "utxos_above_1sat_under_10sats", - ), + _0sats: create_0satsPattern2(this, 'utxos_with_0sats'), + _100btcTo1kBtc: create_0satsPattern2(this, 'utxos_above_100btc_under_1k_btc'), + _100kBtcOrMore: create_0satsPattern2(this, 'utxos_above_100k_btc'), + _100kSatsTo1mSats: create_0satsPattern2(this, 'utxos_above_100k_sats_under_1m_sats'), + _100satsTo1kSats: create_0satsPattern2(this, 'utxos_above_100sats_under_1k_sats'), + _10btcTo100btc: create_0satsPattern2(this, 'utxos_above_10btc_under_100btc'), + _10kBtcTo100kBtc: create_0satsPattern2(this, 'utxos_above_10k_btc_under_100k_btc'), + _10kSatsTo100kSats: create_0satsPattern2(this, 'utxos_above_10k_sats_under_100k_sats'), + _10mSatsTo1btc: create_0satsPattern2(this, 'utxos_above_10m_sats_under_1btc'), + _10satsTo100sats: create_0satsPattern2(this, 'utxos_above_10sats_under_100sats'), + _1btcTo10btc: create_0satsPattern2(this, 'utxos_above_1btc_under_10btc'), + _1kBtcTo10kBtc: create_0satsPattern2(this, 'utxos_above_1k_btc_under_10k_btc'), + _1kSatsTo10kSats: create_0satsPattern2(this, 'utxos_above_1k_sats_under_10k_sats'), + _1mSatsTo10mSats: create_0satsPattern2(this, 'utxos_above_1m_sats_under_10m_sats'), + _1satTo10sats: create_0satsPattern2(this, 'utxos_above_1sat_under_10sats'), }, epoch: { - _0: create_0satsPattern2(this, "epoch_0"), - _1: create_0satsPattern2(this, "epoch_1"), - _2: create_0satsPattern2(this, "epoch_2"), - _3: create_0satsPattern2(this, "epoch_3"), - _4: create_0satsPattern2(this, "epoch_4"), + _0: create_0satsPattern2(this, 'epoch_0'), + _1: create_0satsPattern2(this, 'epoch_1'), + _2: create_0satsPattern2(this, 'epoch_2'), + _3: create_0satsPattern2(this, 'epoch_3'), + _4: create_0satsPattern2(this, 'epoch_4'), }, geAmount: { - _100btc: create_100btcPattern(this, "utxos_above_100btc"), - _100kSats: create_100btcPattern(this, "utxos_above_100k_sats"), - _100sats: create_100btcPattern(this, "utxos_above_100sats"), - _10btc: create_100btcPattern(this, "utxos_above_10btc"), - _10kBtc: create_100btcPattern(this, "utxos_above_10k_btc"), - _10kSats: create_100btcPattern(this, "utxos_above_10k_sats"), - _10mSats: create_100btcPattern(this, "utxos_above_10m_sats"), - _10sats: create_100btcPattern(this, "utxos_above_10sats"), - _1btc: create_100btcPattern(this, "utxos_above_1btc"), - _1kBtc: create_100btcPattern(this, "utxos_above_1k_btc"), - _1kSats: create_100btcPattern(this, "utxos_above_1k_sats"), - _1mSats: create_100btcPattern(this, "utxos_above_1m_sats"), - _1sat: create_100btcPattern(this, "utxos_above_1sat"), + _100btc: create_100btcPattern(this, 'utxos_above_100btc'), + _100kSats: create_100btcPattern(this, 'utxos_above_100k_sats'), + _100sats: create_100btcPattern(this, 'utxos_above_100sats'), + _10btc: create_100btcPattern(this, 'utxos_above_10btc'), + _10kBtc: create_100btcPattern(this, 'utxos_above_10k_btc'), + _10kSats: create_100btcPattern(this, 'utxos_above_10k_sats'), + _10mSats: create_100btcPattern(this, 'utxos_above_10m_sats'), + _10sats: create_100btcPattern(this, 'utxos_above_10sats'), + _1btc: create_100btcPattern(this, 'utxos_above_1btc'), + _1kBtc: create_100btcPattern(this, 'utxos_above_1k_btc'), + _1kSats: create_100btcPattern(this, 'utxos_above_1k_sats'), + _1mSats: create_100btcPattern(this, 'utxos_above_1m_sats'), + _1sat: create_100btcPattern(this, 'utxos_above_1sat'), }, ltAmount: { - _100btc: create_100btcPattern(this, "utxos_under_100btc"), - _100kBtc: create_100btcPattern(this, "utxos_under_100k_btc"), - _100kSats: create_100btcPattern(this, "utxos_under_100k_sats"), - _100sats: create_100btcPattern(this, "utxos_under_100sats"), - _10btc: create_100btcPattern(this, "utxos_under_10btc"), - _10kBtc: create_100btcPattern(this, "utxos_under_10k_btc"), - _10kSats: create_100btcPattern(this, "utxos_under_10k_sats"), - _10mSats: create_100btcPattern(this, "utxos_under_10m_sats"), - _10sats: create_100btcPattern(this, "utxos_under_10sats"), - _1btc: create_100btcPattern(this, "utxos_under_1btc"), - _1kBtc: create_100btcPattern(this, "utxos_under_1k_btc"), - _1kSats: create_100btcPattern(this, "utxos_under_1k_sats"), - _1mSats: create_100btcPattern(this, "utxos_under_1m_sats"), + _100btc: create_100btcPattern(this, 'utxos_under_100btc'), + _100kBtc: create_100btcPattern(this, 'utxos_under_100k_btc'), + _100kSats: create_100btcPattern(this, 'utxos_under_100k_sats'), + _100sats: create_100btcPattern(this, 'utxos_under_100sats'), + _10btc: create_100btcPattern(this, 'utxos_under_10btc'), + _10kBtc: create_100btcPattern(this, 'utxos_under_10k_btc'), + _10kSats: create_100btcPattern(this, 'utxos_under_10k_sats'), + _10mSats: create_100btcPattern(this, 'utxos_under_10m_sats'), + _10sats: create_100btcPattern(this, 'utxos_under_10sats'), + _1btc: create_100btcPattern(this, 'utxos_under_1btc'), + _1kBtc: create_100btcPattern(this, 'utxos_under_1k_btc'), + _1kSats: create_100btcPattern(this, 'utxos_under_1k_sats'), + _1mSats: create_100btcPattern(this, 'utxos_under_1m_sats'), }, maxAge: { - _10y: create_10yPattern(this, "utxos_up_to_10y_old"), - _12y: create_10yPattern(this, "utxos_up_to_12y_old"), - _15y: create_10yPattern(this, "utxos_up_to_15y_old"), - _1m: create_10yPattern(this, "utxos_up_to_1m_old"), - _1w: create_10yPattern(this, "utxos_up_to_1w_old"), - _1y: create_10yPattern(this, "utxos_up_to_1y_old"), - _2m: create_10yPattern(this, "utxos_up_to_2m_old"), - _2y: create_10yPattern(this, "utxos_up_to_2y_old"), - _3m: create_10yPattern(this, "utxos_up_to_3m_old"), - _3y: create_10yPattern(this, "utxos_up_to_3y_old"), - _4m: create_10yPattern(this, "utxos_up_to_4m_old"), - _4y: create_10yPattern(this, "utxos_up_to_4y_old"), - _5m: create_10yPattern(this, "utxos_up_to_5m_old"), - _5y: create_10yPattern(this, "utxos_up_to_5y_old"), - _6m: create_10yPattern(this, "utxos_up_to_6m_old"), - _6y: create_10yPattern(this, "utxos_up_to_6y_old"), - _7y: create_10yPattern(this, "utxos_up_to_7y_old"), - _8y: create_10yPattern(this, "utxos_up_to_8y_old"), + _10y: create_10yPattern(this, 'utxos_up_to_10y_old'), + _12y: create_10yPattern(this, 'utxos_up_to_12y_old'), + _15y: create_10yPattern(this, 'utxos_up_to_15y_old'), + _1m: create_10yPattern(this, 'utxos_up_to_1m_old'), + _1w: create_10yPattern(this, 'utxos_up_to_1w_old'), + _1y: create_10yPattern(this, 'utxos_up_to_1y_old'), + _2m: create_10yPattern(this, 'utxos_up_to_2m_old'), + _2y: create_10yPattern(this, 'utxos_up_to_2y_old'), + _3m: create_10yPattern(this, 'utxos_up_to_3m_old'), + _3y: create_10yPattern(this, 'utxos_up_to_3y_old'), + _4m: create_10yPattern(this, 'utxos_up_to_4m_old'), + _4y: create_10yPattern(this, 'utxos_up_to_4y_old'), + _5m: create_10yPattern(this, 'utxos_up_to_5m_old'), + _5y: create_10yPattern(this, 'utxos_up_to_5y_old'), + _6m: create_10yPattern(this, 'utxos_up_to_6m_old'), + _6y: create_10yPattern(this, 'utxos_up_to_6y_old'), + _7y: create_10yPattern(this, 'utxos_up_to_7y_old'), + _8y: create_10yPattern(this, 'utxos_up_to_8y_old'), }, minAge: { - _10y: create_100btcPattern(this, "utxos_at_least_10y_old"), - _12y: create_100btcPattern(this, "utxos_at_least_12y_old"), - _1d: create_100btcPattern(this, "utxos_at_least_1d_old"), - _1m: create_100btcPattern(this, "utxos_at_least_1m_old"), - _1w: create_100btcPattern(this, "utxos_at_least_1w_old"), - _1y: create_100btcPattern(this, "utxos_at_least_1y_old"), - _2m: create_100btcPattern(this, "utxos_at_least_2m_old"), - _2y: create_100btcPattern(this, "utxos_at_least_2y_old"), - _3m: create_100btcPattern(this, "utxos_at_least_3m_old"), - _3y: create_100btcPattern(this, "utxos_at_least_3y_old"), - _4m: create_100btcPattern(this, "utxos_at_least_4m_old"), - _4y: create_100btcPattern(this, "utxos_at_least_4y_old"), - _5m: create_100btcPattern(this, "utxos_at_least_5m_old"), - _5y: create_100btcPattern(this, "utxos_at_least_5y_old"), - _6m: create_100btcPattern(this, "utxos_at_least_6m_old"), - _6y: create_100btcPattern(this, "utxos_at_least_6y_old"), - _7y: create_100btcPattern(this, "utxos_at_least_7y_old"), - _8y: create_100btcPattern(this, "utxos_at_least_8y_old"), + _10y: create_100btcPattern(this, 'utxos_at_least_10y_old'), + _12y: create_100btcPattern(this, 'utxos_at_least_12y_old'), + _1d: create_100btcPattern(this, 'utxos_at_least_1d_old'), + _1m: create_100btcPattern(this, 'utxos_at_least_1m_old'), + _1w: create_100btcPattern(this, 'utxos_at_least_1w_old'), + _1y: create_100btcPattern(this, 'utxos_at_least_1y_old'), + _2m: create_100btcPattern(this, 'utxos_at_least_2m_old'), + _2y: create_100btcPattern(this, 'utxos_at_least_2y_old'), + _3m: create_100btcPattern(this, 'utxos_at_least_3m_old'), + _3y: create_100btcPattern(this, 'utxos_at_least_3y_old'), + _4m: create_100btcPattern(this, 'utxos_at_least_4m_old'), + _4y: create_100btcPattern(this, 'utxos_at_least_4y_old'), + _5m: create_100btcPattern(this, 'utxos_at_least_5m_old'), + _5y: create_100btcPattern(this, 'utxos_at_least_5y_old'), + _6m: create_100btcPattern(this, 'utxos_at_least_6m_old'), + _6y: create_100btcPattern(this, 'utxos_at_least_6y_old'), + _7y: create_100btcPattern(this, 'utxos_at_least_7y_old'), + _8y: create_100btcPattern(this, 'utxos_at_least_8y_old'), }, term: { long: { - activity: createActivityPattern2(this, "lth"), + activity: createActivityPattern2(this, 'lth'), costBasis: { - max: createMetricPattern1(this, "lth_max_cost_basis"), - min: createMetricPattern1(this, "lth_min_cost_basis"), - percentiles: createPercentilesPattern(this, "lth_cost_basis"), + max: createMetricPattern1(this, 'lth_max_cost_basis'), + min: createMetricPattern1(this, 'lth_min_cost_basis'), + percentiles: createPercentilesPattern(this, 'lth_cost_basis'), }, - outputs: createOutputsPattern(this, "lth"), - realized: createRealizedPattern2(this, "lth"), - relative: createRelativePattern5(this, "lth"), - supply: createSupplyPattern2(this, "lth_supply"), - unrealized: createUnrealizedPattern(this, "lth"), + outputs: createOutputsPattern(this, 'lth'), + realized: createRealizedPattern2(this, 'lth'), + relative: createRelativePattern5(this, 'lth'), + supply: createSupplyPattern2(this, 'lth_supply'), + unrealized: createUnrealizedPattern(this, 'lth'), }, short: { - activity: createActivityPattern2(this, "sth"), + activity: createActivityPattern2(this, 'sth'), costBasis: { - max: createMetricPattern1(this, "sth_max_cost_basis"), - min: createMetricPattern1(this, "sth_min_cost_basis"), - percentiles: createPercentilesPattern(this, "sth_cost_basis"), + max: createMetricPattern1(this, 'sth_max_cost_basis'), + min: createMetricPattern1(this, 'sth_min_cost_basis'), + percentiles: createPercentilesPattern(this, 'sth_cost_basis'), }, - outputs: createOutputsPattern(this, "sth"), - realized: createRealizedPattern3(this, "sth"), - relative: createRelativePattern5(this, "sth"), - supply: createSupplyPattern2(this, "sth_supply"), - unrealized: createUnrealizedPattern(this, "sth"), + outputs: createOutputsPattern(this, 'sth'), + realized: createRealizedPattern3(this, 'sth'), + relative: createRelativePattern5(this, 'sth'), + supply: createSupplyPattern2(this, 'sth_supply'), + unrealized: createUnrealizedPattern(this, 'sth'), }, }, type: { - empty: create_0satsPattern2(this, "empty_outputs"), - p2a: create_0satsPattern2(this, "p2a"), - p2ms: create_0satsPattern2(this, "p2ms"), - p2pk33: create_0satsPattern2(this, "p2pk33"), - p2pk65: create_0satsPattern2(this, "p2pk65"), - p2pkh: create_0satsPattern2(this, "p2pkh"), - p2sh: create_0satsPattern2(this, "p2sh"), - p2tr: create_0satsPattern2(this, "p2tr"), - p2wpkh: create_0satsPattern2(this, "p2wpkh"), - p2wsh: create_0satsPattern2(this, "p2wsh"), - unknown: create_0satsPattern2(this, "unknown_outputs"), + empty: create_0satsPattern2(this, 'empty_outputs'), + p2a: create_0satsPattern2(this, 'p2a'), + p2ms: create_0satsPattern2(this, 'p2ms'), + p2pk33: create_0satsPattern2(this, 'p2pk33'), + p2pk65: create_0satsPattern2(this, 'p2pk65'), + p2pkh: create_0satsPattern2(this, 'p2pkh'), + p2sh: create_0satsPattern2(this, 'p2sh'), + p2tr: create_0satsPattern2(this, 'p2tr'), + p2wpkh: create_0satsPattern2(this, 'p2wpkh'), + p2wsh: create_0satsPattern2(this, 'p2wsh'), + unknown: create_0satsPattern2(this, 'unknown_outputs'), }, year: { - _2009: create_0satsPattern2(this, "year_2009"), - _2010: create_0satsPattern2(this, "year_2010"), - _2011: create_0satsPattern2(this, "year_2011"), - _2012: create_0satsPattern2(this, "year_2012"), - _2013: create_0satsPattern2(this, "year_2013"), - _2014: create_0satsPattern2(this, "year_2014"), - _2015: create_0satsPattern2(this, "year_2015"), - _2016: create_0satsPattern2(this, "year_2016"), - _2017: create_0satsPattern2(this, "year_2017"), - _2018: create_0satsPattern2(this, "year_2018"), - _2019: create_0satsPattern2(this, "year_2019"), - _2020: create_0satsPattern2(this, "year_2020"), - _2021: create_0satsPattern2(this, "year_2021"), - _2022: create_0satsPattern2(this, "year_2022"), - _2023: create_0satsPattern2(this, "year_2023"), - _2024: create_0satsPattern2(this, "year_2024"), - _2025: create_0satsPattern2(this, "year_2025"), - _2026: create_0satsPattern2(this, "year_2026"), + _2009: create_0satsPattern2(this, 'year_2009'), + _2010: create_0satsPattern2(this, 'year_2010'), + _2011: create_0satsPattern2(this, 'year_2011'), + _2012: create_0satsPattern2(this, 'year_2012'), + _2013: create_0satsPattern2(this, 'year_2013'), + _2014: create_0satsPattern2(this, 'year_2014'), + _2015: create_0satsPattern2(this, 'year_2015'), + _2016: create_0satsPattern2(this, 'year_2016'), + _2017: create_0satsPattern2(this, 'year_2017'), + _2018: create_0satsPattern2(this, 'year_2018'), + _2019: create_0satsPattern2(this, 'year_2019'), + _2020: create_0satsPattern2(this, 'year_2020'), + _2021: create_0satsPattern2(this, 'year_2021'), + _2022: create_0satsPattern2(this, 'year_2022'), + _2023: create_0satsPattern2(this, 'year_2023'), + _2024: create_0satsPattern2(this, 'year_2024'), + _2025: create_0satsPattern2(this, 'year_2025'), + _2026: create_0satsPattern2(this, 'year_2026'), }, }, }, indexes: { address: { empty: { - identity: createMetricPattern9(this, "emptyoutputindex"), + identity: createMetricPattern9(this, 'emptyoutputindex'), }, opreturn: { - identity: createMetricPattern14(this, "opreturnindex"), + identity: createMetricPattern14(this, 'opreturnindex'), }, p2a: { - identity: createMetricPattern16(this, "p2aaddressindex"), + identity: createMetricPattern16(this, 'p2aaddressindex'), }, p2ms: { - identity: createMetricPattern17(this, "p2msoutputindex"), + identity: createMetricPattern17(this, 'p2msoutputindex'), }, p2pk33: { - identity: createMetricPattern18(this, "p2pk33addressindex"), + identity: createMetricPattern18(this, 'p2pk33addressindex'), }, p2pk65: { - identity: createMetricPattern19(this, "p2pk65addressindex"), + identity: createMetricPattern19(this, 'p2pk65addressindex'), }, p2pkh: { - identity: createMetricPattern20(this, "p2pkhaddressindex"), + identity: createMetricPattern20(this, 'p2pkhaddressindex'), }, p2sh: { - identity: createMetricPattern21(this, "p2shaddressindex"), + identity: createMetricPattern21(this, 'p2shaddressindex'), }, p2tr: { - identity: createMetricPattern22(this, "p2traddressindex"), + identity: createMetricPattern22(this, 'p2traddressindex'), }, p2wpkh: { - identity: createMetricPattern23(this, "p2wpkhaddressindex"), + identity: createMetricPattern23(this, 'p2wpkhaddressindex'), }, p2wsh: { - identity: createMetricPattern24(this, "p2wshaddressindex"), + identity: createMetricPattern24(this, 'p2wshaddressindex'), }, unknown: { - identity: createMetricPattern28(this, "unknownoutputindex"), + identity: createMetricPattern28(this, 'unknownoutputindex'), }, }, dateindex: { - date: createMetricPattern6(this, "dateindex_date"), - firstHeight: createMetricPattern6(this, "dateindex_first_height"), - heightCount: createMetricPattern6(this, "dateindex_height_count"), - identity: createMetricPattern6(this, "dateindex"), - monthindex: createMetricPattern6(this, "dateindex_monthindex"), - weekindex: createMetricPattern6(this, "dateindex_weekindex"), + date: createMetricPattern6(this, 'dateindex_date'), + firstHeight: createMetricPattern6(this, 'dateindex_first_height'), + heightCount: createMetricPattern6(this, 'dateindex_height_count'), + identity: createMetricPattern6(this, 'dateindex'), + monthindex: createMetricPattern6(this, 'dateindex_monthindex'), + weekindex: createMetricPattern6(this, 'dateindex_weekindex'), }, decadeindex: { - firstYearindex: createMetricPattern7( - this, - "decadeindex_first_yearindex", - ), - identity: createMetricPattern7(this, "decadeindex"), - yearindexCount: createMetricPattern7( - this, - "decadeindex_yearindex_count", - ), + firstYearindex: createMetricPattern7(this, 'decadeindex_first_yearindex'), + identity: createMetricPattern7(this, 'decadeindex'), + yearindexCount: createMetricPattern7(this, 'decadeindex_yearindex_count'), }, difficultyepoch: { - firstHeight: createMetricPattern8( - this, - "difficultyepoch_first_height", - ), - heightCount: createMetricPattern8( - this, - "difficultyepoch_height_count", - ), - identity: createMetricPattern8(this, "difficultyepoch"), + firstHeight: createMetricPattern8(this, 'difficultyepoch_first_height'), + heightCount: createMetricPattern8(this, 'difficultyepoch_height_count'), + identity: createMetricPattern8(this, 'difficultyepoch'), }, halvingepoch: { - firstHeight: createMetricPattern10(this, "halvingepoch_first_height"), - identity: createMetricPattern10(this, "halvingepoch"), + firstHeight: createMetricPattern10(this, 'halvingepoch_first_height'), + identity: createMetricPattern10(this, 'halvingepoch'), }, height: { - dateindex: createMetricPattern11(this, "height_dateindex"), - difficultyepoch: createMetricPattern11( - this, - "height_difficultyepoch", - ), - halvingepoch: createMetricPattern11(this, "height_halvingepoch"), - identity: createMetricPattern11(this, "height"), - txindexCount: createMetricPattern11(this, "height_txindex_count"), + dateindex: createMetricPattern11(this, 'height_dateindex'), + difficultyepoch: createMetricPattern11(this, 'height_difficultyepoch'), + halvingepoch: createMetricPattern11(this, 'height_halvingepoch'), + identity: createMetricPattern11(this, 'height'), + txindexCount: createMetricPattern11(this, 'height_txindex_count'), }, monthindex: { - dateindexCount: createMetricPattern13( - this, - "monthindex_dateindex_count", - ), - firstDateindex: createMetricPattern13( - this, - "monthindex_first_dateindex", - ), - identity: createMetricPattern13(this, "monthindex"), - quarterindex: createMetricPattern13(this, "monthindex_quarterindex"), - semesterindex: createMetricPattern13( - this, - "monthindex_semesterindex", - ), - yearindex: createMetricPattern13(this, "monthindex_yearindex"), + dateindexCount: createMetricPattern13(this, 'monthindex_dateindex_count'), + firstDateindex: createMetricPattern13(this, 'monthindex_first_dateindex'), + identity: createMetricPattern13(this, 'monthindex'), + quarterindex: createMetricPattern13(this, 'monthindex_quarterindex'), + semesterindex: createMetricPattern13(this, 'monthindex_semesterindex'), + yearindex: createMetricPattern13(this, 'monthindex_yearindex'), }, quarterindex: { - firstMonthindex: createMetricPattern25( - this, - "quarterindex_first_monthindex", - ), - identity: createMetricPattern25(this, "quarterindex"), - monthindexCount: createMetricPattern25( - this, - "quarterindex_monthindex_count", - ), + firstMonthindex: createMetricPattern25(this, 'quarterindex_first_monthindex'), + identity: createMetricPattern25(this, 'quarterindex'), + monthindexCount: createMetricPattern25(this, 'quarterindex_monthindex_count'), }, semesterindex: { - firstMonthindex: createMetricPattern26( - this, - "semesterindex_first_monthindex", - ), - identity: createMetricPattern26(this, "semesterindex"), - monthindexCount: createMetricPattern26( - this, - "semesterindex_monthindex_count", - ), + firstMonthindex: createMetricPattern26(this, 'semesterindex_first_monthindex'), + identity: createMetricPattern26(this, 'semesterindex'), + monthindexCount: createMetricPattern26(this, 'semesterindex_monthindex_count'), }, txindex: { - identity: createMetricPattern27(this, "txindex"), - inputCount: createMetricPattern27(this, "txindex_input_count"), - outputCount: createMetricPattern27(this, "txindex_output_count"), + identity: createMetricPattern27(this, 'txindex'), + inputCount: createMetricPattern27(this, 'txindex_input_count'), + outputCount: createMetricPattern27(this, 'txindex_output_count'), }, txinindex: { - identity: createMetricPattern12(this, "txinindex"), + identity: createMetricPattern12(this, 'txinindex'), }, txoutindex: { - identity: createMetricPattern15(this, "txoutindex"), + identity: createMetricPattern15(this, 'txoutindex'), }, weekindex: { - dateindexCount: createMetricPattern29( - this, - "weekindex_dateindex_count", - ), - firstDateindex: createMetricPattern29( - this, - "weekindex_first_dateindex", - ), - identity: createMetricPattern29(this, "weekindex"), + dateindexCount: createMetricPattern29(this, 'weekindex_dateindex_count'), + firstDateindex: createMetricPattern29(this, 'weekindex_first_dateindex'), + identity: createMetricPattern29(this, 'weekindex'), }, yearindex: { - decadeindex: createMetricPattern30(this, "yearindex_decadeindex"), - firstMonthindex: createMetricPattern30( - this, - "yearindex_first_monthindex", - ), - identity: createMetricPattern30(this, "yearindex"), - monthindexCount: createMetricPattern30( - this, - "yearindex_monthindex_count", - ), + decadeindex: createMetricPattern30(this, 'yearindex_decadeindex'), + firstMonthindex: createMetricPattern30(this, 'yearindex_first_monthindex'), + identity: createMetricPattern30(this, 'yearindex'), + monthindexCount: createMetricPattern30(this, 'yearindex_monthindex_count'), }, }, inputs: { - count: createCountPattern2(this, "input_count"), - firstTxinindex: createMetricPattern11(this, "first_txinindex"), - outpoint: createMetricPattern12(this, "outpoint"), - outputtype: createMetricPattern12(this, "outputtype"), + count: createCountPattern2(this, 'input_count'), + firstTxinindex: createMetricPattern11(this, 'first_txinindex'), + outpoint: createMetricPattern12(this, 'outpoint'), + outputtype: createMetricPattern12(this, 'outputtype'), spent: { - txoutindex: createMetricPattern12(this, "txoutindex"), - value: createMetricPattern12(this, "value"), + txoutindex: createMetricPattern12(this, 'txoutindex'), + value: createMetricPattern12(this, 'value'), }, - txindex: createMetricPattern12(this, "txindex"), - typeindex: createMetricPattern12(this, "typeindex"), - witnessSize: createMetricPattern12(this, "witness_size"), + txindex: createMetricPattern12(this, 'txindex'), + typeindex: createMetricPattern12(this, 'typeindex'), + witnessSize: createMetricPattern12(this, 'witness_size'), }, market: { ath: { - daysSincePriceAth: createMetricPattern4(this, "days_since_price_ath"), - maxDaysBetweenPriceAths: createMetricPattern4( - this, - "max_days_between_price_aths", - ), - maxYearsBetweenPriceAths: createMetricPattern4( - this, - "max_years_between_price_aths", - ), - priceAth: createMetricPattern1(this, "price_ath"), - priceDrawdown: createMetricPattern3(this, "price_drawdown"), - yearsSincePriceAth: createMetricPattern4( - this, - "years_since_price_ath", - ), + daysSincePriceAth: createMetricPattern4(this, 'days_since_price_ath'), + maxDaysBetweenPriceAths: createMetricPattern4(this, 'max_days_between_price_aths'), + maxYearsBetweenPriceAths: createMetricPattern4(this, 'max_years_between_price_aths'), + priceAth: createMetricPattern1(this, 'price_ath'), + priceDrawdown: createMetricPattern3(this, 'price_drawdown'), + yearsSincePriceAth: createMetricPattern4(this, 'years_since_price_ath'), }, dca: { classAveragePrice: { - _2015: createMetricPattern4(this, "dca_class_2015_average_price"), - _2016: createMetricPattern4(this, "dca_class_2016_average_price"), - _2017: createMetricPattern4(this, "dca_class_2017_average_price"), - _2018: createMetricPattern4(this, "dca_class_2018_average_price"), - _2019: createMetricPattern4(this, "dca_class_2019_average_price"), - _2020: createMetricPattern4(this, "dca_class_2020_average_price"), - _2021: createMetricPattern4(this, "dca_class_2021_average_price"), - _2022: createMetricPattern4(this, "dca_class_2022_average_price"), - _2023: createMetricPattern4(this, "dca_class_2023_average_price"), - _2024: createMetricPattern4(this, "dca_class_2024_average_price"), - _2025: createMetricPattern4(this, "dca_class_2025_average_price"), + _2015: createMetricPattern4(this, 'dca_class_2015_average_price'), + _2016: createMetricPattern4(this, 'dca_class_2016_average_price'), + _2017: createMetricPattern4(this, 'dca_class_2017_average_price'), + _2018: createMetricPattern4(this, 'dca_class_2018_average_price'), + _2019: createMetricPattern4(this, 'dca_class_2019_average_price'), + _2020: createMetricPattern4(this, 'dca_class_2020_average_price'), + _2021: createMetricPattern4(this, 'dca_class_2021_average_price'), + _2022: createMetricPattern4(this, 'dca_class_2022_average_price'), + _2023: createMetricPattern4(this, 'dca_class_2023_average_price'), + _2024: createMetricPattern4(this, 'dca_class_2024_average_price'), + _2025: createMetricPattern4(this, 'dca_class_2025_average_price'), }, classReturns: { - _2015: createMetricPattern4(this, "dca_class_2015_returns"), - _2016: createMetricPattern4(this, "dca_class_2016_returns"), - _2017: createMetricPattern4(this, "dca_class_2017_returns"), - _2018: createMetricPattern4(this, "dca_class_2018_returns"), - _2019: createMetricPattern4(this, "dca_class_2019_returns"), - _2020: createMetricPattern4(this, "dca_class_2020_returns"), - _2021: createMetricPattern4(this, "dca_class_2021_returns"), - _2022: createMetricPattern4(this, "dca_class_2022_returns"), - _2023: createMetricPattern4(this, "dca_class_2023_returns"), - _2024: createMetricPattern4(this, "dca_class_2024_returns"), - _2025: createMetricPattern4(this, "dca_class_2025_returns"), + _2015: createMetricPattern4(this, 'dca_class_2015_returns'), + _2016: createMetricPattern4(this, 'dca_class_2016_returns'), + _2017: createMetricPattern4(this, 'dca_class_2017_returns'), + _2018: createMetricPattern4(this, 'dca_class_2018_returns'), + _2019: createMetricPattern4(this, 'dca_class_2019_returns'), + _2020: createMetricPattern4(this, 'dca_class_2020_returns'), + _2021: createMetricPattern4(this, 'dca_class_2021_returns'), + _2022: createMetricPattern4(this, 'dca_class_2022_returns'), + _2023: createMetricPattern4(this, 'dca_class_2023_returns'), + _2024: createMetricPattern4(this, 'dca_class_2024_returns'), + _2025: createMetricPattern4(this, 'dca_class_2025_returns'), }, classStack: { - _2015: create_2015Pattern(this, "dca_class_2015_stack"), - _2016: create_2015Pattern(this, "dca_class_2016_stack"), - _2017: create_2015Pattern(this, "dca_class_2017_stack"), - _2018: create_2015Pattern(this, "dca_class_2018_stack"), - _2019: create_2015Pattern(this, "dca_class_2019_stack"), - _2020: create_2015Pattern(this, "dca_class_2020_stack"), - _2021: create_2015Pattern(this, "dca_class_2021_stack"), - _2022: create_2015Pattern(this, "dca_class_2022_stack"), - _2023: create_2015Pattern(this, "dca_class_2023_stack"), - _2024: create_2015Pattern(this, "dca_class_2024_stack"), - _2025: create_2015Pattern(this, "dca_class_2025_stack"), + _2015: create_2015Pattern(this, 'dca_class_2015_stack'), + _2016: create_2015Pattern(this, 'dca_class_2016_stack'), + _2017: create_2015Pattern(this, 'dca_class_2017_stack'), + _2018: create_2015Pattern(this, 'dca_class_2018_stack'), + _2019: create_2015Pattern(this, 'dca_class_2019_stack'), + _2020: create_2015Pattern(this, 'dca_class_2020_stack'), + _2021: create_2015Pattern(this, 'dca_class_2021_stack'), + _2022: create_2015Pattern(this, 'dca_class_2022_stack'), + _2023: create_2015Pattern(this, 'dca_class_2023_stack'), + _2024: create_2015Pattern(this, 'dca_class_2024_stack'), + _2025: create_2015Pattern(this, 'dca_class_2025_stack'), }, - periodAveragePrice: createPeriodAveragePricePattern( - this, - "dca_average_price", - ), - periodCagr: createPeriodCagrPattern(this, "dca_cagr"), - periodLumpSumStack: createPeriodLumpSumStackPattern( - this, - "lump_sum_stack", - ), - periodReturns: createPeriodAveragePricePattern(this, "dca_returns"), - periodStack: createPeriodLumpSumStackPattern(this, "dca_stack"), + periodAveragePrice: createPeriodAveragePricePattern(this, 'dca_average_price'), + periodCagr: createPeriodCagrPattern(this, 'dca_cagr'), + periodLumpSumStack: createPeriodLumpSumStackPattern(this, 'lump_sum_stack'), + periodReturns: createPeriodAveragePricePattern(this, 'dca_returns'), + periodStack: createPeriodLumpSumStackPattern(this, 'dca_stack'), }, indicators: { - gini: createMetricPattern6(this, "gini"), - macdHistogram: createMetricPattern6(this, "macd_histogram"), - macdLine: createMetricPattern6(this, "macd_line"), - macdSignal: createMetricPattern6(this, "macd_signal"), - nvt: createMetricPattern4(this, "nvt"), - piCycle: createMetricPattern6(this, "pi_cycle"), - puellMultiple: createMetricPattern4(this, "puell_multiple"), - rsi14d: createMetricPattern6(this, "rsi_14d"), - rsi14dMax: createMetricPattern6(this, "rsi_14d_max"), - rsi14dMin: createMetricPattern6(this, "rsi_14d_min"), - rsiAverageGain14d: createMetricPattern6(this, "rsi_average_gain_14d"), - rsiAverageLoss14d: createMetricPattern6(this, "rsi_average_loss_14d"), - rsiGains: createMetricPattern6(this, "rsi_gains"), - rsiLosses: createMetricPattern6(this, "rsi_losses"), - stochD: createMetricPattern6(this, "stoch_d"), - stochK: createMetricPattern6(this, "stoch_k"), - stochRsi: createMetricPattern6(this, "stoch_rsi"), - stochRsiD: createMetricPattern6(this, "stoch_rsi_d"), - stochRsiK: createMetricPattern6(this, "stoch_rsi_k"), + gini: createMetricPattern6(this, 'gini'), + macdHistogram: createMetricPattern6(this, 'macd_histogram'), + macdLine: createMetricPattern6(this, 'macd_line'), + macdSignal: createMetricPattern6(this, 'macd_signal'), + nvt: createMetricPattern4(this, 'nvt'), + piCycle: createMetricPattern6(this, 'pi_cycle'), + puellMultiple: createMetricPattern4(this, 'puell_multiple'), + rsi14d: createMetricPattern6(this, 'rsi_14d'), + rsi14dMax: createMetricPattern6(this, 'rsi_14d_max'), + rsi14dMin: createMetricPattern6(this, 'rsi_14d_min'), + rsiAverageGain14d: createMetricPattern6(this, 'rsi_average_gain_14d'), + rsiAverageLoss14d: createMetricPattern6(this, 'rsi_average_loss_14d'), + rsiGains: createMetricPattern6(this, 'rsi_gains'), + rsiLosses: createMetricPattern6(this, 'rsi_losses'), + stochD: createMetricPattern6(this, 'stoch_d'), + stochK: createMetricPattern6(this, 'stoch_k'), + stochRsi: createMetricPattern6(this, 'stoch_rsi'), + stochRsiD: createMetricPattern6(this, 'stoch_rsi_d'), + stochRsiK: createMetricPattern6(this, 'stoch_rsi_k'), }, lookback: { priceAgo: { - _10y: createMetricPattern4(this, "price_10y_ago"), - _1d: createMetricPattern4(this, "price_1d_ago"), - _1m: createMetricPattern4(this, "price_1m_ago"), - _1w: createMetricPattern4(this, "price_1w_ago"), - _1y: createMetricPattern4(this, "price_1y_ago"), - _2y: createMetricPattern4(this, "price_2y_ago"), - _3m: createMetricPattern4(this, "price_3m_ago"), - _3y: createMetricPattern4(this, "price_3y_ago"), - _4y: createMetricPattern4(this, "price_4y_ago"), - _5y: createMetricPattern4(this, "price_5y_ago"), - _6m: createMetricPattern4(this, "price_6m_ago"), - _6y: createMetricPattern4(this, "price_6y_ago"), - _8y: createMetricPattern4(this, "price_8y_ago"), + _10y: createMetricPattern4(this, 'price_10y_ago'), + _1d: createMetricPattern4(this, 'price_1d_ago'), + _1m: createMetricPattern4(this, 'price_1m_ago'), + _1w: createMetricPattern4(this, 'price_1w_ago'), + _1y: createMetricPattern4(this, 'price_1y_ago'), + _2y: createMetricPattern4(this, 'price_2y_ago'), + _3m: createMetricPattern4(this, 'price_3m_ago'), + _3y: createMetricPattern4(this, 'price_3y_ago'), + _4y: createMetricPattern4(this, 'price_4y_ago'), + _5y: createMetricPattern4(this, 'price_5y_ago'), + _6m: createMetricPattern4(this, 'price_6m_ago'), + _6y: createMetricPattern4(this, 'price_6y_ago'), + _8y: createMetricPattern4(this, 'price_8y_ago'), }, }, movingAverage: { - price111dSma: createPrice111dSmaPattern(this, "price_111d_sma"), - price12dEma: createPrice111dSmaPattern(this, "price_12d_ema"), - price13dEma: createPrice111dSmaPattern(this, "price_13d_ema"), - price13dSma: createPrice111dSmaPattern(this, "price_13d_sma"), - price144dEma: createPrice111dSmaPattern(this, "price_144d_ema"), - price144dSma: createPrice111dSmaPattern(this, "price_144d_sma"), - price1mEma: createPrice111dSmaPattern(this, "price_1m_ema"), - price1mSma: createPrice111dSmaPattern(this, "price_1m_sma"), - price1wEma: createPrice111dSmaPattern(this, "price_1w_ema"), - price1wSma: createPrice111dSmaPattern(this, "price_1w_sma"), - price1yEma: createPrice111dSmaPattern(this, "price_1y_ema"), - price1ySma: createPrice111dSmaPattern(this, "price_1y_sma"), - price200dEma: createPrice111dSmaPattern(this, "price_200d_ema"), - price200dSma: createPrice111dSmaPattern(this, "price_200d_sma"), - price200dSmaX08: createMetricPattern4(this, "price_200d_sma_x0_8"), - price200dSmaX24: createMetricPattern4(this, "price_200d_sma_x2_4"), - price200wEma: createPrice111dSmaPattern(this, "price_200w_ema"), - price200wSma: createPrice111dSmaPattern(this, "price_200w_sma"), - price21dEma: createPrice111dSmaPattern(this, "price_21d_ema"), - price21dSma: createPrice111dSmaPattern(this, "price_21d_sma"), - price26dEma: createPrice111dSmaPattern(this, "price_26d_ema"), - price2yEma: createPrice111dSmaPattern(this, "price_2y_ema"), - price2ySma: createPrice111dSmaPattern(this, "price_2y_sma"), - price34dEma: createPrice111dSmaPattern(this, "price_34d_ema"), - price34dSma: createPrice111dSmaPattern(this, "price_34d_sma"), - price350dSma: createPrice111dSmaPattern(this, "price_350d_sma"), - price350dSmaX2: createMetricPattern4(this, "price_350d_sma_x2"), - price4yEma: createPrice111dSmaPattern(this, "price_4y_ema"), - price4ySma: createPrice111dSmaPattern(this, "price_4y_sma"), - price55dEma: createPrice111dSmaPattern(this, "price_55d_ema"), - price55dSma: createPrice111dSmaPattern(this, "price_55d_sma"), - price89dEma: createPrice111dSmaPattern(this, "price_89d_ema"), - price89dSma: createPrice111dSmaPattern(this, "price_89d_sma"), - price8dEma: createPrice111dSmaPattern(this, "price_8d_ema"), - price8dSma: createPrice111dSmaPattern(this, "price_8d_sma"), + price111dSma: createPrice111dSmaPattern(this, 'price_111d_sma'), + price12dEma: createPrice111dSmaPattern(this, 'price_12d_ema'), + price13dEma: createPrice111dSmaPattern(this, 'price_13d_ema'), + price13dSma: createPrice111dSmaPattern(this, 'price_13d_sma'), + price144dEma: createPrice111dSmaPattern(this, 'price_144d_ema'), + price144dSma: createPrice111dSmaPattern(this, 'price_144d_sma'), + price1mEma: createPrice111dSmaPattern(this, 'price_1m_ema'), + price1mSma: createPrice111dSmaPattern(this, 'price_1m_sma'), + price1wEma: createPrice111dSmaPattern(this, 'price_1w_ema'), + price1wSma: createPrice111dSmaPattern(this, 'price_1w_sma'), + price1yEma: createPrice111dSmaPattern(this, 'price_1y_ema'), + price1ySma: createPrice111dSmaPattern(this, 'price_1y_sma'), + price200dEma: createPrice111dSmaPattern(this, 'price_200d_ema'), + price200dSma: createPrice111dSmaPattern(this, 'price_200d_sma'), + price200dSmaX08: createMetricPattern4(this, 'price_200d_sma_x0_8'), + price200dSmaX24: createMetricPattern4(this, 'price_200d_sma_x2_4'), + price200wEma: createPrice111dSmaPattern(this, 'price_200w_ema'), + price200wSma: createPrice111dSmaPattern(this, 'price_200w_sma'), + price21dEma: createPrice111dSmaPattern(this, 'price_21d_ema'), + price21dSma: createPrice111dSmaPattern(this, 'price_21d_sma'), + price26dEma: createPrice111dSmaPattern(this, 'price_26d_ema'), + price2yEma: createPrice111dSmaPattern(this, 'price_2y_ema'), + price2ySma: createPrice111dSmaPattern(this, 'price_2y_sma'), + price34dEma: createPrice111dSmaPattern(this, 'price_34d_ema'), + price34dSma: createPrice111dSmaPattern(this, 'price_34d_sma'), + price350dSma: createPrice111dSmaPattern(this, 'price_350d_sma'), + price350dSmaX2: createMetricPattern4(this, 'price_350d_sma_x2'), + price4yEma: createPrice111dSmaPattern(this, 'price_4y_ema'), + price4ySma: createPrice111dSmaPattern(this, 'price_4y_sma'), + price55dEma: createPrice111dSmaPattern(this, 'price_55d_ema'), + price55dSma: createPrice111dSmaPattern(this, 'price_55d_sma'), + price89dEma: createPrice111dSmaPattern(this, 'price_89d_ema'), + price89dSma: createPrice111dSmaPattern(this, 'price_89d_sma'), + price8dEma: createPrice111dSmaPattern(this, 'price_8d_ema'), + price8dSma: createPrice111dSmaPattern(this, 'price_8d_sma'), }, range: { - price1mMax: createMetricPattern4(this, "price_1m_max"), - price1mMin: createMetricPattern4(this, "price_1m_min"), - price1wMax: createMetricPattern4(this, "price_1w_max"), - price1wMin: createMetricPattern4(this, "price_1w_min"), - price1yMax: createMetricPattern4(this, "price_1y_max"), - price1yMin: createMetricPattern4(this, "price_1y_min"), - price2wChoppinessIndex: createMetricPattern4( - this, - "price_2w_choppiness_index", - ), - price2wMax: createMetricPattern4(this, "price_2w_max"), - price2wMin: createMetricPattern4(this, "price_2w_min"), - priceTrueRange: createMetricPattern6(this, "price_true_range"), - priceTrueRange2wSum: createMetricPattern6( - this, - "price_true_range_2w_sum", - ), + price1mMax: createMetricPattern4(this, 'price_1m_max'), + price1mMin: createMetricPattern4(this, 'price_1m_min'), + price1wMax: createMetricPattern4(this, 'price_1w_max'), + price1wMin: createMetricPattern4(this, 'price_1w_min'), + price1yMax: createMetricPattern4(this, 'price_1y_max'), + price1yMin: createMetricPattern4(this, 'price_1y_min'), + price2wChoppinessIndex: createMetricPattern4(this, 'price_2w_choppiness_index'), + price2wMax: createMetricPattern4(this, 'price_2w_max'), + price2wMin: createMetricPattern4(this, 'price_2w_min'), + priceTrueRange: createMetricPattern6(this, 'price_true_range'), + priceTrueRange2wSum: createMetricPattern6(this, 'price_true_range_2w_sum'), }, returns: { - _1dReturns1mSd: create_1dReturns1mSdPattern(this, "1d_returns_1m_sd"), - _1dReturns1wSd: create_1dReturns1mSdPattern(this, "1d_returns_1w_sd"), - _1dReturns1ySd: create_1dReturns1mSdPattern(this, "1d_returns_1y_sd"), - cagr: createPeriodCagrPattern(this, "cagr"), - downside1mSd: create_1dReturns1mSdPattern(this, "downside_1m_sd"), - downside1wSd: create_1dReturns1mSdPattern(this, "downside_1w_sd"), - downside1ySd: create_1dReturns1mSdPattern(this, "downside_1y_sd"), - downsideReturns: createMetricPattern6(this, "downside_returns"), + _1dReturns1mSd: create_1dReturns1mSdPattern(this, '1d_returns_1m_sd'), + _1dReturns1wSd: create_1dReturns1mSdPattern(this, '1d_returns_1w_sd'), + _1dReturns1ySd: create_1dReturns1mSdPattern(this, '1d_returns_1y_sd'), + cagr: createPeriodCagrPattern(this, 'cagr'), + downside1mSd: create_1dReturns1mSdPattern(this, 'downside_1m_sd'), + downside1wSd: create_1dReturns1mSdPattern(this, 'downside_1w_sd'), + downside1ySd: create_1dReturns1mSdPattern(this, 'downside_1y_sd'), + downsideReturns: createMetricPattern6(this, 'downside_returns'), priceReturns: { - _10y: createMetricPattern4(this, "10y_price_returns"), - _1d: createMetricPattern4(this, "1d_price_returns"), - _1m: createMetricPattern4(this, "1m_price_returns"), - _1w: createMetricPattern4(this, "1w_price_returns"), - _1y: createMetricPattern4(this, "1y_price_returns"), - _2y: createMetricPattern4(this, "2y_price_returns"), - _3m: createMetricPattern4(this, "3m_price_returns"), - _3y: createMetricPattern4(this, "3y_price_returns"), - _4y: createMetricPattern4(this, "4y_price_returns"), - _5y: createMetricPattern4(this, "5y_price_returns"), - _6m: createMetricPattern4(this, "6m_price_returns"), - _6y: createMetricPattern4(this, "6y_price_returns"), - _8y: createMetricPattern4(this, "8y_price_returns"), + _10y: createMetricPattern4(this, '10y_price_returns'), + _1d: createMetricPattern4(this, '1d_price_returns'), + _1m: createMetricPattern4(this, '1m_price_returns'), + _1w: createMetricPattern4(this, '1w_price_returns'), + _1y: createMetricPattern4(this, '1y_price_returns'), + _2y: createMetricPattern4(this, '2y_price_returns'), + _3m: createMetricPattern4(this, '3m_price_returns'), + _3y: createMetricPattern4(this, '3y_price_returns'), + _4y: createMetricPattern4(this, '4y_price_returns'), + _5y: createMetricPattern4(this, '5y_price_returns'), + _6m: createMetricPattern4(this, '6m_price_returns'), + _6y: createMetricPattern4(this, '6y_price_returns'), + _8y: createMetricPattern4(this, '8y_price_returns'), }, }, volatility: { - price1mVolatility: createMetricPattern4(this, "price_1m_volatility"), - price1wVolatility: createMetricPattern4(this, "price_1w_volatility"), - price1yVolatility: createMetricPattern4(this, "price_1y_volatility"), - sharpe1m: createMetricPattern6(this, "sharpe_1m"), - sharpe1w: createMetricPattern6(this, "sharpe_1w"), - sharpe1y: createMetricPattern6(this, "sharpe_1y"), - sortino1m: createMetricPattern6(this, "sortino_1m"), - sortino1w: createMetricPattern6(this, "sortino_1w"), - sortino1y: createMetricPattern6(this, "sortino_1y"), + price1mVolatility: createMetricPattern4(this, 'price_1m_volatility'), + price1wVolatility: createMetricPattern4(this, 'price_1w_volatility'), + price1yVolatility: createMetricPattern4(this, 'price_1y_volatility'), + sharpe1m: createMetricPattern6(this, 'sharpe_1m'), + sharpe1w: createMetricPattern6(this, 'sharpe_1w'), + sharpe1y: createMetricPattern6(this, 'sharpe_1y'), + sortino1m: createMetricPattern6(this, 'sortino_1m'), + sortino1w: createMetricPattern6(this, 'sortino_1w'), + sortino1y: createMetricPattern6(this, 'sortino_1y'), }, }, outputs: { count: { - totalCount: createCountPattern2(this, "output_count"), - utxoCount: createMetricPattern1(this, "exact_utxo_count"), + totalCount: createCountPattern2(this, 'output_count'), + utxoCount: createMetricPattern1(this, 'exact_utxo_count'), }, - firstTxoutindex: createMetricPattern11(this, "first_txoutindex"), - outputtype: createMetricPattern15(this, "outputtype"), + firstTxoutindex: createMetricPattern11(this, 'first_txoutindex'), + outputtype: createMetricPattern15(this, 'outputtype'), spent: { - txinindex: createMetricPattern15(this, "txinindex"), + txinindex: createMetricPattern15(this, 'txinindex'), }, - txindex: createMetricPattern15(this, "txindex"), - typeindex: createMetricPattern15(this, "typeindex"), - value: createMetricPattern15(this, "value"), + txindex: createMetricPattern15(this, 'txindex'), + typeindex: createMetricPattern15(this, 'typeindex'), + value: createMetricPattern15(this, 'value'), }, pools: { - heightToPool: createMetricPattern11(this, "pool"), + heightToPool: createMetricPattern11(this, 'pool'), vecs: { - aaopool: createAaopoolPattern(this, "aaopool"), - antpool: createAaopoolPattern(this, "antpool"), - arkpool: createAaopoolPattern(this, "arkpool"), - asicminer: createAaopoolPattern(this, "asicminer"), - axbt: createAaopoolPattern(this, "axbt"), - batpool: createAaopoolPattern(this, "batpool"), - bcmonster: createAaopoolPattern(this, "bcmonster"), - bcpoolio: createAaopoolPattern(this, "bcpoolio"), - binancepool: createAaopoolPattern(this, "binancepool"), - bitalo: createAaopoolPattern(this, "bitalo"), - bitclub: createAaopoolPattern(this, "bitclub"), - bitcoinaffiliatenetwork: createAaopoolPattern( - this, - "bitcoinaffiliatenetwork", - ), - bitcoincom: createAaopoolPattern(this, "bitcoincom"), - bitcoinindia: createAaopoolPattern(this, "bitcoinindia"), - bitcoinrussia: createAaopoolPattern(this, "bitcoinrussia"), - bitcoinukraine: createAaopoolPattern(this, "bitcoinukraine"), - bitfarms: createAaopoolPattern(this, "bitfarms"), - bitfufupool: createAaopoolPattern(this, "bitfufupool"), - bitfury: createAaopoolPattern(this, "bitfury"), - bitminter: createAaopoolPattern(this, "bitminter"), - bitparking: createAaopoolPattern(this, "bitparking"), - bitsolo: createAaopoolPattern(this, "bitsolo"), - bixin: createAaopoolPattern(this, "bixin"), - blockfills: createAaopoolPattern(this, "blockfills"), - braiinspool: createAaopoolPattern(this, "braiinspool"), - bravomining: createAaopoolPattern(this, "bravomining"), - btcc: createAaopoolPattern(this, "btcc"), - btccom: createAaopoolPattern(this, "btccom"), - btcdig: createAaopoolPattern(this, "btcdig"), - btcguild: createAaopoolPattern(this, "btcguild"), - btclab: createAaopoolPattern(this, "btclab"), - btcmp: createAaopoolPattern(this, "btcmp"), - btcnuggets: createAaopoolPattern(this, "btcnuggets"), - btcpoolparty: createAaopoolPattern(this, "btcpoolparty"), - btcserv: createAaopoolPattern(this, "btcserv"), - btctop: createAaopoolPattern(this, "btctop"), - btpool: createAaopoolPattern(this, "btpool"), - bwpool: createAaopoolPattern(this, "bwpool"), - bytepool: createAaopoolPattern(this, "bytepool"), - canoe: createAaopoolPattern(this, "canoe"), - canoepool: createAaopoolPattern(this, "canoepool"), - carbonnegative: createAaopoolPattern(this, "carbonnegative"), - ckpool: createAaopoolPattern(this, "ckpool"), - cloudhashing: createAaopoolPattern(this, "cloudhashing"), - coinlab: createAaopoolPattern(this, "coinlab"), - cointerra: createAaopoolPattern(this, "cointerra"), - connectbtc: createAaopoolPattern(this, "connectbtc"), - dcex: createAaopoolPattern(this, "dcex"), - dcexploration: createAaopoolPattern(this, "dcexploration"), - digitalbtc: createAaopoolPattern(this, "digitalbtc"), - digitalxmintsy: createAaopoolPattern(this, "digitalxmintsy"), - dpool: createAaopoolPattern(this, "dpool"), - eclipsemc: createAaopoolPattern(this, "eclipsemc"), - eightbaochi: createAaopoolPattern(this, "eightbaochi"), - ekanembtc: createAaopoolPattern(this, "ekanembtc"), - eligius: createAaopoolPattern(this, "eligius"), - emcdpool: createAaopoolPattern(this, "emcdpool"), - entrustcharitypool: createAaopoolPattern(this, "entrustcharitypool"), - eobot: createAaopoolPattern(this, "eobot"), - exxbw: createAaopoolPattern(this, "exxbw"), - f2pool: createAaopoolPattern(this, "f2pool"), - fiftyeightcoin: createAaopoolPattern(this, "fiftyeightcoin"), - foundryusa: createAaopoolPattern(this, "foundryusa"), - futurebitapollosolo: createAaopoolPattern( - this, - "futurebitapollosolo", - ), - gbminers: createAaopoolPattern(this, "gbminers"), - ghashio: createAaopoolPattern(this, "ghashio"), - givemecoins: createAaopoolPattern(this, "givemecoins"), - gogreenlight: createAaopoolPattern(this, "gogreenlight"), - haominer: createAaopoolPattern(this, "haominer"), - haozhuzhu: createAaopoolPattern(this, "haozhuzhu"), - hashbx: createAaopoolPattern(this, "hashbx"), - hashpool: createAaopoolPattern(this, "hashpool"), - helix: createAaopoolPattern(this, "helix"), - hhtt: createAaopoolPattern(this, "hhtt"), - hotpool: createAaopoolPattern(this, "hotpool"), - hummerpool: createAaopoolPattern(this, "hummerpool"), - huobipool: createAaopoolPattern(this, "huobipool"), - innopolistech: createAaopoolPattern(this, "innopolistech"), - kanopool: createAaopoolPattern(this, "kanopool"), - kncminer: createAaopoolPattern(this, "kncminer"), - kucoinpool: createAaopoolPattern(this, "kucoinpool"), - lubiancom: createAaopoolPattern(this, "lubiancom"), - luckypool: createAaopoolPattern(this, "luckypool"), - luxor: createAaopoolPattern(this, "luxor"), - marapool: createAaopoolPattern(this, "marapool"), - maxbtc: createAaopoolPattern(this, "maxbtc"), - maxipool: createAaopoolPattern(this, "maxipool"), - megabigpower: createAaopoolPattern(this, "megabigpower"), - minerium: createAaopoolPattern(this, "minerium"), - miningcity: createAaopoolPattern(this, "miningcity"), - miningdutch: createAaopoolPattern(this, "miningdutch"), - miningkings: createAaopoolPattern(this, "miningkings"), - miningsquared: createAaopoolPattern(this, "miningsquared"), - mmpool: createAaopoolPattern(this, "mmpool"), - mtred: createAaopoolPattern(this, "mtred"), - multicoinco: createAaopoolPattern(this, "multicoinco"), - multipool: createAaopoolPattern(this, "multipool"), - mybtccoinpool: createAaopoolPattern(this, "mybtccoinpool"), - neopool: createAaopoolPattern(this, "neopool"), - nexious: createAaopoolPattern(this, "nexious"), - nicehash: createAaopoolPattern(this, "nicehash"), - nmcbit: createAaopoolPattern(this, "nmcbit"), - novablock: createAaopoolPattern(this, "novablock"), - ocean: createAaopoolPattern(this, "ocean"), - okexpool: createAaopoolPattern(this, "okexpool"), - okkong: createAaopoolPattern(this, "okkong"), - okminer: createAaopoolPattern(this, "okminer"), - okpooltop: createAaopoolPattern(this, "okpooltop"), - onehash: createAaopoolPattern(this, "onehash"), - onem1x: createAaopoolPattern(this, "onem1x"), - onethash: createAaopoolPattern(this, "onethash"), - ozcoin: createAaopoolPattern(this, "ozcoin"), - parasite: createAaopoolPattern(this, "parasite"), - patels: createAaopoolPattern(this, "patels"), - pegapool: createAaopoolPattern(this, "pegapool"), - phashio: createAaopoolPattern(this, "phashio"), - phoenix: createAaopoolPattern(this, "phoenix"), - polmine: createAaopoolPattern(this, "polmine"), - pool175btc: createAaopoolPattern(this, "pool175btc"), - pool50btc: createAaopoolPattern(this, "pool50btc"), - poolin: createAaopoolPattern(this, "poolin"), - portlandhodl: createAaopoolPattern(this, "portlandhodl"), - publicpool: createAaopoolPattern(this, "publicpool"), - purebtccom: createAaopoolPattern(this, "purebtccom"), - rawpool: createAaopoolPattern(this, "rawpool"), - rigpool: createAaopoolPattern(this, "rigpool"), - sbicrypto: createAaopoolPattern(this, "sbicrypto"), - secpool: createAaopoolPattern(this, "secpool"), - secretsuperstar: createAaopoolPattern(this, "secretsuperstar"), - sevenpool: createAaopoolPattern(this, "sevenpool"), - shawnp0wers: createAaopoolPattern(this, "shawnp0wers"), - sigmapoolcom: createAaopoolPattern(this, "sigmapoolcom"), - simplecoinus: createAaopoolPattern(this, "simplecoinus"), - solock: createAaopoolPattern(this, "solock"), - spiderpool: createAaopoolPattern(this, "spiderpool"), - stminingcorp: createAaopoolPattern(this, "stminingcorp"), - tangpool: createAaopoolPattern(this, "tangpool"), - tatmaspool: createAaopoolPattern(this, "tatmaspool"), - tbdice: createAaopoolPattern(this, "tbdice"), - telco214: createAaopoolPattern(this, "telco214"), - terrapool: createAaopoolPattern(this, "terrapool"), - tiger: createAaopoolPattern(this, "tiger"), - tigerpoolnet: createAaopoolPattern(this, "tigerpoolnet"), - titan: createAaopoolPattern(this, "titan"), - transactioncoinmining: createAaopoolPattern( - this, - "transactioncoinmining", - ), - trickysbtcpool: createAaopoolPattern(this, "trickysbtcpool"), - triplemining: createAaopoolPattern(this, "triplemining"), - twentyoneinc: createAaopoolPattern(this, "twentyoneinc"), - ultimuspool: createAaopoolPattern(this, "ultimuspool"), - unknown: createAaopoolPattern(this, "unknown"), - unomp: createAaopoolPattern(this, "unomp"), - viabtc: createAaopoolPattern(this, "viabtc"), - waterhole: createAaopoolPattern(this, "waterhole"), - wayicn: createAaopoolPattern(this, "wayicn"), - whitepool: createAaopoolPattern(this, "whitepool"), - wk057: createAaopoolPattern(this, "wk057"), - yourbtcnet: createAaopoolPattern(this, "yourbtcnet"), - zulupool: createAaopoolPattern(this, "zulupool"), + aaopool: createAaopoolPattern(this, 'aaopool'), + antpool: createAaopoolPattern(this, 'antpool'), + arkpool: createAaopoolPattern(this, 'arkpool'), + asicminer: createAaopoolPattern(this, 'asicminer'), + axbt: createAaopoolPattern(this, 'axbt'), + batpool: createAaopoolPattern(this, 'batpool'), + bcmonster: createAaopoolPattern(this, 'bcmonster'), + bcpoolio: createAaopoolPattern(this, 'bcpoolio'), + binancepool: createAaopoolPattern(this, 'binancepool'), + bitalo: createAaopoolPattern(this, 'bitalo'), + bitclub: createAaopoolPattern(this, 'bitclub'), + bitcoinaffiliatenetwork: createAaopoolPattern(this, 'bitcoinaffiliatenetwork'), + bitcoincom: createAaopoolPattern(this, 'bitcoincom'), + bitcoinindia: createAaopoolPattern(this, 'bitcoinindia'), + bitcoinrussia: createAaopoolPattern(this, 'bitcoinrussia'), + bitcoinukraine: createAaopoolPattern(this, 'bitcoinukraine'), + bitfarms: createAaopoolPattern(this, 'bitfarms'), + bitfufupool: createAaopoolPattern(this, 'bitfufupool'), + bitfury: createAaopoolPattern(this, 'bitfury'), + bitminter: createAaopoolPattern(this, 'bitminter'), + bitparking: createAaopoolPattern(this, 'bitparking'), + bitsolo: createAaopoolPattern(this, 'bitsolo'), + bixin: createAaopoolPattern(this, 'bixin'), + blockfills: createAaopoolPattern(this, 'blockfills'), + braiinspool: createAaopoolPattern(this, 'braiinspool'), + bravomining: createAaopoolPattern(this, 'bravomining'), + btcc: createAaopoolPattern(this, 'btcc'), + btccom: createAaopoolPattern(this, 'btccom'), + btcdig: createAaopoolPattern(this, 'btcdig'), + btcguild: createAaopoolPattern(this, 'btcguild'), + btclab: createAaopoolPattern(this, 'btclab'), + btcmp: createAaopoolPattern(this, 'btcmp'), + btcnuggets: createAaopoolPattern(this, 'btcnuggets'), + btcpoolparty: createAaopoolPattern(this, 'btcpoolparty'), + btcserv: createAaopoolPattern(this, 'btcserv'), + btctop: createAaopoolPattern(this, 'btctop'), + btpool: createAaopoolPattern(this, 'btpool'), + bwpool: createAaopoolPattern(this, 'bwpool'), + bytepool: createAaopoolPattern(this, 'bytepool'), + canoe: createAaopoolPattern(this, 'canoe'), + canoepool: createAaopoolPattern(this, 'canoepool'), + carbonnegative: createAaopoolPattern(this, 'carbonnegative'), + ckpool: createAaopoolPattern(this, 'ckpool'), + cloudhashing: createAaopoolPattern(this, 'cloudhashing'), + coinlab: createAaopoolPattern(this, 'coinlab'), + cointerra: createAaopoolPattern(this, 'cointerra'), + connectbtc: createAaopoolPattern(this, 'connectbtc'), + dcex: createAaopoolPattern(this, 'dcex'), + dcexploration: createAaopoolPattern(this, 'dcexploration'), + digitalbtc: createAaopoolPattern(this, 'digitalbtc'), + digitalxmintsy: createAaopoolPattern(this, 'digitalxmintsy'), + dpool: createAaopoolPattern(this, 'dpool'), + eclipsemc: createAaopoolPattern(this, 'eclipsemc'), + eightbaochi: createAaopoolPattern(this, 'eightbaochi'), + ekanembtc: createAaopoolPattern(this, 'ekanembtc'), + eligius: createAaopoolPattern(this, 'eligius'), + emcdpool: createAaopoolPattern(this, 'emcdpool'), + entrustcharitypool: createAaopoolPattern(this, 'entrustcharitypool'), + eobot: createAaopoolPattern(this, 'eobot'), + exxbw: createAaopoolPattern(this, 'exxbw'), + f2pool: createAaopoolPattern(this, 'f2pool'), + fiftyeightcoin: createAaopoolPattern(this, 'fiftyeightcoin'), + foundryusa: createAaopoolPattern(this, 'foundryusa'), + futurebitapollosolo: createAaopoolPattern(this, 'futurebitapollosolo'), + gbminers: createAaopoolPattern(this, 'gbminers'), + ghashio: createAaopoolPattern(this, 'ghashio'), + givemecoins: createAaopoolPattern(this, 'givemecoins'), + gogreenlight: createAaopoolPattern(this, 'gogreenlight'), + haominer: createAaopoolPattern(this, 'haominer'), + haozhuzhu: createAaopoolPattern(this, 'haozhuzhu'), + hashbx: createAaopoolPattern(this, 'hashbx'), + hashpool: createAaopoolPattern(this, 'hashpool'), + helix: createAaopoolPattern(this, 'helix'), + hhtt: createAaopoolPattern(this, 'hhtt'), + hotpool: createAaopoolPattern(this, 'hotpool'), + hummerpool: createAaopoolPattern(this, 'hummerpool'), + huobipool: createAaopoolPattern(this, 'huobipool'), + innopolistech: createAaopoolPattern(this, 'innopolistech'), + kanopool: createAaopoolPattern(this, 'kanopool'), + kncminer: createAaopoolPattern(this, 'kncminer'), + kucoinpool: createAaopoolPattern(this, 'kucoinpool'), + lubiancom: createAaopoolPattern(this, 'lubiancom'), + luckypool: createAaopoolPattern(this, 'luckypool'), + luxor: createAaopoolPattern(this, 'luxor'), + marapool: createAaopoolPattern(this, 'marapool'), + maxbtc: createAaopoolPattern(this, 'maxbtc'), + maxipool: createAaopoolPattern(this, 'maxipool'), + megabigpower: createAaopoolPattern(this, 'megabigpower'), + minerium: createAaopoolPattern(this, 'minerium'), + miningcity: createAaopoolPattern(this, 'miningcity'), + miningdutch: createAaopoolPattern(this, 'miningdutch'), + miningkings: createAaopoolPattern(this, 'miningkings'), + miningsquared: createAaopoolPattern(this, 'miningsquared'), + mmpool: createAaopoolPattern(this, 'mmpool'), + mtred: createAaopoolPattern(this, 'mtred'), + multicoinco: createAaopoolPattern(this, 'multicoinco'), + multipool: createAaopoolPattern(this, 'multipool'), + mybtccoinpool: createAaopoolPattern(this, 'mybtccoinpool'), + neopool: createAaopoolPattern(this, 'neopool'), + nexious: createAaopoolPattern(this, 'nexious'), + nicehash: createAaopoolPattern(this, 'nicehash'), + nmcbit: createAaopoolPattern(this, 'nmcbit'), + novablock: createAaopoolPattern(this, 'novablock'), + ocean: createAaopoolPattern(this, 'ocean'), + okexpool: createAaopoolPattern(this, 'okexpool'), + okkong: createAaopoolPattern(this, 'okkong'), + okminer: createAaopoolPattern(this, 'okminer'), + okpooltop: createAaopoolPattern(this, 'okpooltop'), + onehash: createAaopoolPattern(this, 'onehash'), + onem1x: createAaopoolPattern(this, 'onem1x'), + onethash: createAaopoolPattern(this, 'onethash'), + ozcoin: createAaopoolPattern(this, 'ozcoin'), + parasite: createAaopoolPattern(this, 'parasite'), + patels: createAaopoolPattern(this, 'patels'), + pegapool: createAaopoolPattern(this, 'pegapool'), + phashio: createAaopoolPattern(this, 'phashio'), + phoenix: createAaopoolPattern(this, 'phoenix'), + polmine: createAaopoolPattern(this, 'polmine'), + pool175btc: createAaopoolPattern(this, 'pool175btc'), + pool50btc: createAaopoolPattern(this, 'pool50btc'), + poolin: createAaopoolPattern(this, 'poolin'), + portlandhodl: createAaopoolPattern(this, 'portlandhodl'), + publicpool: createAaopoolPattern(this, 'publicpool'), + purebtccom: createAaopoolPattern(this, 'purebtccom'), + rawpool: createAaopoolPattern(this, 'rawpool'), + rigpool: createAaopoolPattern(this, 'rigpool'), + sbicrypto: createAaopoolPattern(this, 'sbicrypto'), + secpool: createAaopoolPattern(this, 'secpool'), + secretsuperstar: createAaopoolPattern(this, 'secretsuperstar'), + sevenpool: createAaopoolPattern(this, 'sevenpool'), + shawnp0wers: createAaopoolPattern(this, 'shawnp0wers'), + sigmapoolcom: createAaopoolPattern(this, 'sigmapoolcom'), + simplecoinus: createAaopoolPattern(this, 'simplecoinus'), + solock: createAaopoolPattern(this, 'solock'), + spiderpool: createAaopoolPattern(this, 'spiderpool'), + stminingcorp: createAaopoolPattern(this, 'stminingcorp'), + tangpool: createAaopoolPattern(this, 'tangpool'), + tatmaspool: createAaopoolPattern(this, 'tatmaspool'), + tbdice: createAaopoolPattern(this, 'tbdice'), + telco214: createAaopoolPattern(this, 'telco214'), + terrapool: createAaopoolPattern(this, 'terrapool'), + tiger: createAaopoolPattern(this, 'tiger'), + tigerpoolnet: createAaopoolPattern(this, 'tigerpoolnet'), + titan: createAaopoolPattern(this, 'titan'), + transactioncoinmining: createAaopoolPattern(this, 'transactioncoinmining'), + trickysbtcpool: createAaopoolPattern(this, 'trickysbtcpool'), + triplemining: createAaopoolPattern(this, 'triplemining'), + twentyoneinc: createAaopoolPattern(this, 'twentyoneinc'), + ultimuspool: createAaopoolPattern(this, 'ultimuspool'), + unknown: createAaopoolPattern(this, 'unknown'), + unomp: createAaopoolPattern(this, 'unomp'), + viabtc: createAaopoolPattern(this, 'viabtc'), + waterhole: createAaopoolPattern(this, 'waterhole'), + wayicn: createAaopoolPattern(this, 'wayicn'), + whitepool: createAaopoolPattern(this, 'whitepool'), + wk057: createAaopoolPattern(this, 'wk057'), + yourbtcnet: createAaopoolPattern(this, 'yourbtcnet'), + zulupool: createAaopoolPattern(this, 'zulupool'), }, }, positions: { - blockPosition: createMetricPattern11(this, "position"), - txPosition: createMetricPattern27(this, "position"), + blockPosition: createMetricPattern11(this, 'position'), + txPosition: createMetricPattern27(this, 'position'), }, price: { cents: { - ohlc: createMetricPattern5(this, "ohlc_cents"), + ohlc: createMetricPattern5(this, 'ohlc_cents'), split: { - close: createMetricPattern5(this, "price_close_cents"), - high: createMetricPattern5(this, "price_high_cents"), - low: createMetricPattern5(this, "price_low_cents"), - open: createMetricPattern5(this, "price_open_cents"), + close: createMetricPattern5(this, 'price_close_cents'), + high: createMetricPattern5(this, 'price_high_cents'), + low: createMetricPattern5(this, 'price_low_cents'), + open: createMetricPattern5(this, 'price_open_cents'), }, }, sats: { - ohlc: createMetricPattern1(this, "price_ohlc_sats"), - split: createSplitPattern2(this, "price_sats"), + ohlc: createMetricPattern1(this, 'price_ohlc_sats'), + split: createSplitPattern2(this, 'price_sats'), }, usd: { - ohlc: createMetricPattern1(this, "price_ohlc"), - split: createSplitPattern2(this, "price"), + ohlc: createMetricPattern1(this, 'price_ohlc'), + split: createSplitPattern2(this, 'price'), }, }, scripts: { count: { - emptyoutput: createDollarsPattern(this, "emptyoutput_count"), - opreturn: createDollarsPattern(this, "opreturn_count"), - p2a: createDollarsPattern(this, "p2a_count"), - p2ms: createDollarsPattern(this, "p2ms_count"), - p2pk33: createDollarsPattern(this, "p2pk33_count"), - p2pk65: createDollarsPattern(this, "p2pk65_count"), - p2pkh: createDollarsPattern(this, "p2pkh_count"), - p2sh: createDollarsPattern(this, "p2sh_count"), - p2tr: createDollarsPattern(this, "p2tr_count"), - p2wpkh: createDollarsPattern(this, "p2wpkh_count"), - p2wsh: createDollarsPattern(this, "p2wsh_count"), - segwit: createDollarsPattern(this, "segwit_count"), - segwitAdoption: createSegwitAdoptionPattern(this, "segwit_adoption"), - taprootAdoption: createSegwitAdoptionPattern( - this, - "taproot_adoption", - ), - unknownoutput: createDollarsPattern(this, "unknownoutput_count"), + emptyoutput: createDollarsPattern(this, 'emptyoutput_count'), + opreturn: createDollarsPattern(this, 'opreturn_count'), + p2a: createDollarsPattern(this, 'p2a_count'), + p2ms: createDollarsPattern(this, 'p2ms_count'), + p2pk33: createDollarsPattern(this, 'p2pk33_count'), + p2pk65: createDollarsPattern(this, 'p2pk65_count'), + p2pkh: createDollarsPattern(this, 'p2pkh_count'), + p2sh: createDollarsPattern(this, 'p2sh_count'), + p2tr: createDollarsPattern(this, 'p2tr_count'), + p2wpkh: createDollarsPattern(this, 'p2wpkh_count'), + p2wsh: createDollarsPattern(this, 'p2wsh_count'), + segwit: createDollarsPattern(this, 'segwit_count'), + segwitAdoption: createSegwitAdoptionPattern(this, 'segwit_adoption'), + taprootAdoption: createSegwitAdoptionPattern(this, 'taproot_adoption'), + unknownoutput: createDollarsPattern(this, 'unknownoutput_count'), }, - emptyToTxindex: createMetricPattern9(this, "txindex"), - firstEmptyoutputindex: createMetricPattern11( - this, - "first_emptyoutputindex", - ), - firstOpreturnindex: createMetricPattern11(this, "first_opreturnindex"), - firstP2msoutputindex: createMetricPattern11( - this, - "first_p2msoutputindex", - ), - firstUnknownoutputindex: createMetricPattern11( - this, - "first_unknownoutputindex", - ), - opreturnToTxindex: createMetricPattern14(this, "txindex"), - p2msToTxindex: createMetricPattern17(this, "txindex"), - unknownToTxindex: createMetricPattern28(this, "txindex"), + emptyToTxindex: createMetricPattern9(this, 'txindex'), + firstEmptyoutputindex: createMetricPattern11(this, 'first_emptyoutputindex'), + firstOpreturnindex: createMetricPattern11(this, 'first_opreturnindex'), + firstP2msoutputindex: createMetricPattern11(this, 'first_p2msoutputindex'), + firstUnknownoutputindex: createMetricPattern11(this, 'first_unknownoutputindex'), + opreturnToTxindex: createMetricPattern14(this, 'txindex'), + p2msToTxindex: createMetricPattern17(this, 'txindex'), + unknownToTxindex: createMetricPattern28(this, 'txindex'), value: { - opreturn: createCoinbasePattern(this, "opreturn_value"), + opreturn: createCoinbasePattern(this, 'opreturn_value'), }, }, supply: { burned: { - opreturn: createUnclaimedRewardsPattern(this, "opreturn_supply"), - unspendable: createUnclaimedRewardsPattern( - this, - "unspendable_supply", - ), + opreturn: createUnclaimedRewardsPattern(this, 'opreturn_supply'), + unspendable: createUnclaimedRewardsPattern(this, 'unspendable_supply'), }, circulating: { - bitcoin: createMetricPattern3(this, "circulating_supply_btc"), - dollars: createMetricPattern3(this, "circulating_supply_usd"), - sats: createMetricPattern3(this, "circulating_supply"), + bitcoin: createMetricPattern3(this, 'circulating_supply_btc'), + dollars: createMetricPattern3(this, 'circulating_supply_usd'), + sats: createMetricPattern3(this, 'circulating_supply'), }, - inflation: createMetricPattern4(this, "inflation_rate"), - marketCap: createMetricPattern1(this, "market_cap"), + inflation: createMetricPattern4(this, 'inflation_rate'), + marketCap: createMetricPattern1(this, 'market_cap'), velocity: { - btc: createMetricPattern4(this, "btc_velocity"), - usd: createMetricPattern4(this, "usd_velocity"), + btc: createMetricPattern4(this, 'btc_velocity'), + usd: createMetricPattern4(this, 'usd_velocity'), }, }, transactions: { - baseSize: createMetricPattern27(this, "base_size"), + baseSize: createMetricPattern27(this, 'base_size'), count: { - isCoinbase: createMetricPattern27(this, "is_coinbase"), - txCount: createDollarsPattern(this, "tx_count"), + isCoinbase: createMetricPattern27(this, 'is_coinbase'), + txCount: createDollarsPattern(this, 'tx_count'), }, fees: { fee: { - bitcoin: createCountPattern2(this, "fee_btc"), + bitcoin: createCountPattern2(this, 'fee_btc'), dollars: { - average: createMetricPattern1(this, "fee_usd_average"), - cumulative: createMetricPattern2(this, "fee_usd_cumulative"), - heightCumulative: createMetricPattern11( - this, - "fee_usd_cumulative", - ), - max: createMetricPattern1(this, "fee_usd_max"), - median: createMetricPattern11(this, "fee_usd_median"), - min: createMetricPattern1(this, "fee_usd_min"), - pct10: createMetricPattern11(this, "fee_usd_pct10"), - pct25: createMetricPattern11(this, "fee_usd_pct25"), - pct75: createMetricPattern11(this, "fee_usd_pct75"), - pct90: createMetricPattern11(this, "fee_usd_pct90"), - sum: createMetricPattern1(this, "fee_usd_sum"), + average: createMetricPattern1(this, 'fee_usd_average'), + cumulative: createMetricPattern2(this, 'fee_usd_cumulative'), + heightCumulative: createMetricPattern11(this, 'fee_usd_cumulative'), + max: createMetricPattern1(this, 'fee_usd_max'), + median: createMetricPattern11(this, 'fee_usd_median'), + min: createMetricPattern1(this, 'fee_usd_min'), + pct10: createMetricPattern11(this, 'fee_usd_pct10'), + pct25: createMetricPattern11(this, 'fee_usd_pct25'), + pct75: createMetricPattern11(this, 'fee_usd_pct75'), + pct90: createMetricPattern11(this, 'fee_usd_pct90'), + sum: createMetricPattern1(this, 'fee_usd_sum'), }, - sats: createCountPattern2(this, "fee"), - txindex: createMetricPattern27(this, "fee"), + sats: createCountPattern2(this, 'fee'), + txindex: createMetricPattern27(this, 'fee'), }, - feeRate: createFeeRatePattern(this, "fee_rate"), - inputValue: createMetricPattern27(this, "input_value"), - outputValue: createMetricPattern27(this, "output_value"), + feeRate: createFeeRatePattern(this, 'fee_rate'), + inputValue: createMetricPattern27(this, 'input_value'), + outputValue: createMetricPattern27(this, 'output_value'), }, - firstTxindex: createMetricPattern11(this, "first_txindex"), - firstTxinindex: createMetricPattern27(this, "first_txinindex"), - firstTxoutindex: createMetricPattern27(this, "first_txoutindex"), - height: createMetricPattern27(this, "height"), - isExplicitlyRbf: createMetricPattern27(this, "is_explicitly_rbf"), - rawlocktime: createMetricPattern27(this, "rawlocktime"), + firstTxindex: createMetricPattern11(this, 'first_txindex'), + firstTxinindex: createMetricPattern27(this, 'first_txinindex'), + firstTxoutindex: createMetricPattern27(this, 'first_txoutindex'), + height: createMetricPattern27(this, 'height'), + isExplicitlyRbf: createMetricPattern27(this, 'is_explicitly_rbf'), + rawlocktime: createMetricPattern27(this, 'rawlocktime'), size: { - vsize: createFeeRatePattern(this, "tx_vsize_average"), - weight: createFeeRatePattern(this, "tx_weight_average"), + vsize: { + average: createMetricPattern1(this, 'tx_vsize_average'), + max: createMetricPattern1(this, 'tx_vsize_max'), + median: createMetricPattern11(this, 'tx_vsize_median'), + min: createMetricPattern1(this, 'tx_vsize_min'), + pct10: createMetricPattern11(this, 'tx_vsize_pct10'), + pct25: createMetricPattern11(this, 'tx_vsize_pct25'), + pct75: createMetricPattern11(this, 'tx_vsize_pct75'), + pct90: createMetricPattern11(this, 'tx_vsize_pct90'), + txindex: createMetricPattern27(this, 'vsize'), + }, + weight: { + average: createMetricPattern1(this, 'tx_weight_average'), + max: createMetricPattern1(this, 'tx_weight_max'), + median: createMetricPattern11(this, 'tx_weight_median'), + min: createMetricPattern1(this, 'tx_weight_min'), + pct10: createMetricPattern11(this, 'tx_weight_pct10'), + pct25: createMetricPattern11(this, 'tx_weight_pct25'), + pct75: createMetricPattern11(this, 'tx_weight_pct75'), + pct90: createMetricPattern11(this, 'tx_weight_pct90'), + txindex: createMetricPattern27(this, 'weight'), + }, }, - totalSize: createMetricPattern27(this, "total_size"), - txid: createMetricPattern27(this, "txid"), - txversion: createMetricPattern27(this, "txversion"), + totalSize: createMetricPattern27(this, 'total_size'), + txid: createMetricPattern27(this, 'txid'), + txversion: createMetricPattern27(this, 'txversion'), versions: { - v1: createBlockCountPattern(this, "tx_v1"), - v2: createBlockCountPattern(this, "tx_v2"), - v3: createBlockCountPattern(this, "tx_v3"), + v1: createBlockCountPattern(this, 'tx_v1'), + v2: createBlockCountPattern(this, 'tx_v2'), + v3: createBlockCountPattern(this, 'tx_v3'), }, volume: { - annualizedVolume: create_2015Pattern(this, "annualized_volume"), - inputsPerSec: createMetricPattern4(this, "inputs_per_sec"), - outputsPerSec: createMetricPattern4(this, "outputs_per_sec"), - sentSum: createActiveSupplyPattern(this, "sent_sum"), - txPerSec: createMetricPattern4(this, "tx_per_sec"), + annualizedVolume: create_2015Pattern(this, 'annualized_volume'), + inputsPerSec: createMetricPattern4(this, 'inputs_per_sec'), + outputsPerSec: createMetricPattern4(this, 'outputs_per_sec'), + sentSum: createActiveSupplyPattern(this, 'sent_sum'), + txPerSec: createMetricPattern4(this, 'tx_per_sec'), }, }, }; @@ -7899,10 +7207,10 @@ class BrkClient extends BrkClientBase { */ async getAddressTxs(address, after_txid, limit) { const params = new URLSearchParams(); - if (after_txid !== undefined) params.set("after_txid", String(after_txid)); - if (limit !== undefined) params.set("limit", String(limit)); + if (after_txid !== undefined) params.set('after_txid', String(after_txid)); + if (limit !== undefined) params.set('limit', String(limit)); const query = params.toString(); - const path = `/api/address/${address}/txs${query ? "?" + query : ""}`; + const path = `/api/address/${address}/txs${query ? '?' + query : ''}`; return this.getJson(path); } @@ -7922,10 +7230,10 @@ class BrkClient extends BrkClientBase { */ async getAddressConfirmedTxs(address, after_txid, limit) { const params = new URLSearchParams(); - if (after_txid !== undefined) params.set("after_txid", String(after_txid)); - if (limit !== undefined) params.set("limit", String(limit)); + if (after_txid !== undefined) params.set('after_txid', String(after_txid)); + if (limit !== undefined) params.set('limit', String(limit)); const query = params.toString(); - const path = `/api/address/${address}/txs/chain${query ? "?" + query : ""}`; + const path = `/api/address/${address}/txs/chain${query ? '?' + query : ''}`; return this.getJson(path); } @@ -8164,13 +7472,13 @@ class BrkClient extends BrkClientBase { */ async getMetric(metric, index, start, end, limit, format) { const params = new URLSearchParams(); - if (start !== undefined) params.set("start", String(start)); - if (end !== undefined) params.set("end", String(end)); - if (limit !== undefined) params.set("limit", String(limit)); - if (format !== undefined) params.set("format", String(format)); + if (start !== undefined) params.set('start', String(start)); + if (end !== undefined) params.set('end', String(end)); + if (limit !== undefined) params.set('limit', String(limit)); + if (format !== undefined) params.set('format', String(format)); const query = params.toString(); - const path = `/api/metric/${metric}/${index}${query ? "?" + query : ""}`; - if (format === "csv") { + const path = `/api/metric/${metric}/${index}${query ? '?' + query : ''}`; + if (format === 'csv') { return this.getText(path); } return this.getJson(path); @@ -8205,15 +7513,15 @@ class BrkClient extends BrkClientBase { */ async getMetrics(metrics, index, start, end, limit, format) { const params = new URLSearchParams(); - params.set("metrics", String(metrics)); - params.set("index", String(index)); - if (start !== undefined) params.set("start", String(start)); - if (end !== undefined) params.set("end", String(end)); - if (limit !== undefined) params.set("limit", String(limit)); - if (format !== undefined) params.set("format", String(format)); + params.set('metrics', String(metrics)); + params.set('index', String(index)); + if (start !== undefined) params.set('start', String(start)); + if (end !== undefined) params.set('end', String(end)); + if (limit !== undefined) params.set('limit', String(limit)); + if (format !== undefined) params.set('format', String(format)); const query = params.toString(); - const path = `/api/metrics/bulk${query ? "?" + query : ""}`; - if (format === "csv") { + const path = `/api/metrics/bulk${query ? '?' + query : ''}`; + if (format === 'csv') { return this.getText(path); } return this.getJson(path); @@ -8255,9 +7563,9 @@ class BrkClient extends BrkClientBase { */ async listMetrics(page) { const params = new URLSearchParams(); - if (page !== undefined) params.set("page", String(page)); + if (page !== undefined) params.set('page', String(page)); const query = params.toString(); - const path = `/api/metrics/list${query ? "?" + query : ""}`; + const path = `/api/metrics/list${query ? '?' + query : ''}`; return this.getJson(path); } @@ -8274,9 +7582,9 @@ class BrkClient extends BrkClientBase { */ async searchMetrics(metric, limit) { const params = new URLSearchParams(); - if (limit !== undefined) params.set("limit", String(limit)); + if (limit !== undefined) params.set('limit', String(limit)); const query = params.toString(); - const path = `/api/metrics/search/${metric}${query ? "?" + query : ""}`; + const path = `/api/metrics/search/${metric}${query ? '?' + query : ''}`; return this.getJson(path); } @@ -8668,6 +7976,7 @@ class BrkClient extends BrkClientBase { async getVersion() { return this.getJson(`/version`); } + } export { BrkClient, BrkError }; diff --git a/modules/brk-client/package.json b/modules/brk-client/package.json index c32bf48fe..3e30d64ed 100644 --- a/modules/brk-client/package.json +++ b/modules/brk-client/package.json @@ -2,6 +2,10 @@ "bugs": { "url": "https://github.com/bitcoinresearchkit/brk/issues" }, + "scripts": { + "test": "node tests/basic.js", + "test:tree": "node tests/tree.js" + }, "description": "BRK JavaScript client", "engines": { "node": ">=18" diff --git a/modules/brk-client/tests/basic.js b/modules/brk-client/tests/basic.js index 970b4e963..8299b15c9 100644 --- a/modules/brk-client/tests/basic.js +++ b/modules/brk-client/tests/basic.js @@ -1,5 +1,74 @@ import { BrkClient } from "../index.js"; -let client = new BrkClient("http://localhost:3110"); +const client = new BrkClient("http://localhost:3110"); -let blocks = await client.getBlocks(); +console.log("Testing idiomatic API...\n"); + +// Test getter access (property) +console.log("1. Getter access (.by.dateindex):"); +const all = await client.metrics.price.usd.split.close.by.dateindex; +console.log(` Total: ${all.total}, Got: ${all.data.length} items\n`); + +// Test dynamic access (bracket notation) +console.log("2. Dynamic access (.by['dateindex']):"); +const allDynamic = await client.metrics.price.usd.split.close.by["dateindex"]; +console.log( + ` Total: ${allDynamic.total}, Got: ${allDynamic.data.length} items\n`, +); + +// Test fetch all (explicit .fetch()) +console.log("3. Explicit .fetch():"); +const allExplicit = + await client.metrics.price.usd.split.close.by.dateindex.fetch(); +console.log( + ` Total: ${allExplicit.total}, Got: ${allExplicit.data.length} items\n`, +); + +// Test first(n) +console.log("4. First 5 items (.first(5)):"); +const first5 = await client.metrics.price.usd.split.close.by.dateindex.first(5); +console.log( + ` Total: ${first5.total}, Start: ${first5.start}, End: ${first5.end}, Got: ${first5.data.length} items\n`, +); + +// Test last(n) +console.log("5. Last 5 items (.last(5)):"); +const last5 = await client.metrics.price.usd.split.close.by.dateindex.last(5); +console.log( + ` Total: ${last5.total}, Start: ${last5.start}, End: ${last5.end}, Got: ${last5.data.length} items\n`, +); + +// Test slice(start, end) +console.log("6. Slice 10-20 (.slice(10, 20)):"); +const sliced = await client.metrics.price.usd.split.close.by.dateindex.slice( + 10, + 20, +); +console.log( + ` Total: ${sliced.total}, Start: ${sliced.start}, End: ${sliced.end}, Got: ${sliced.data.length} items\n`, +); + +// Test get(index) - single item +console.log("7. Single item (.get(100)):"); +const single = await client.metrics.price.usd.split.close.by.dateindex.get(100); +console.log( + ` Total: ${single.total}, Start: ${single.start}, End: ${single.end}, Got: ${single.data.length} item(s)\n`, +); + +// Test skip(n).take(m) chaining +console.log("8. Skip and take (.skip(100).take(10)):"); +const skipTake = await client.metrics.price.usd.split.close.by.dateindex + .skip(100) + .take(10); +console.log( + ` Total: ${skipTake.total}, Start: ${skipTake.start}, End: ${skipTake.end}, Got: ${skipTake.data.length} items\n`, +); + +// Test fetchCsv +console.log("9. Fetch as CSV (.last(3).fetchCsv()):"); +const csv = await client.metrics.price.usd.split.close.by.dateindex + .last(3) + .fetchCsv(); +console.log(` CSV preview: ${csv.substring(0, 100)}...\n`); + +console.log("All tests passed!"); diff --git a/modules/brk-client/tests/tree.js b/modules/brk-client/tests/tree.js index 988d4c81c..927ec3bf3 100644 --- a/modules/brk-client/tests/tree.js +++ b/modules/brk-client/tests/tree.js @@ -6,9 +6,9 @@ import { BrkClient } from "../index.js"; /** * Recursively collect all metric patterns from the tree. - * @param {object} obj + * @param {Record} obj * @param {string} path - * @returns {Array<{path: string, metric: object, indexes: string[]}>} + * @returns {Array<{path: string, metric: Record, indexes: string[]}>} */ function getAllMetrics(obj, path = "") { const metrics = []; @@ -21,10 +21,10 @@ function getAllMetrics(obj, path = "") { const currentPath = path ? `${path}.${key}` : key; - // Check if this is a metric pattern (has 'by' property with index methods) + // Check if this is a metric pattern (has 'by' property with index getters) if (attr.by && typeof attr.by === "object") { const indexes = Object.keys(attr.by).filter( - (k) => !k.startsWith("_") && typeof attr.by[k] === "function", + (k) => !k.startsWith("_") && typeof attr.by[k] === "object", ); if (indexes.length > 0) { metrics.push({ path: currentPath, metric: attr, indexes }); @@ -41,54 +41,38 @@ function getAllMetrics(obj, path = "") { } async function testAllEndpoints() { - const client = new BrkClient("http://localhost:3110"); + const client = new BrkClient({ baseUrl: "http://localhost:3110", timeout: 15000 }); - const metrics = getAllMetrics(client.tree); + const metrics = getAllMetrics(client.metrics); console.log(`\nFound ${metrics.length} metrics`); let success = 0; - let failed = 0; - const errors = []; for (const { path, metric, indexes } of metrics) { for (const idxName of indexes) { try { - const endpoint = metric.by[idxName](); - const res = await endpoint.range(-3); + const endpoint = metric.by[idxName]; + const res = await endpoint.last(1); const count = res.data.length; - if (count !== 3) { - failed++; - const errorMsg = `FAIL: ${path}.by.${idxName}() -> expected 3, got ${count}`; - errors.push(errorMsg); - console.log(errorMsg); - } else { - success++; - console.log(`OK: ${path}.by.${idxName}() -> ${count} items`); + if (count !== 1) { + console.log( + `FAIL: ${path}.by.${idxName} -> expected 1, got ${count}`, + ); + return; } + success++; + console.log(`OK: ${path}.by.${idxName} -> ${count} items`); } catch (e) { - failed++; - const errorMsg = `FAIL: ${path}.by.${idxName}() -> ${e.message}`; - errors.push(errorMsg); - console.log(errorMsg); + console.log( + `FAIL: ${path}.by.${idxName} -> ${e instanceof Error ? e.message : e}`, + ); + return; } } } console.log(`\n=== Results ===`); console.log(`Success: ${success}`); - console.log(`Failed: ${failed}`); - - if (errors.length > 0) { - console.log(`\nErrors:`); - errors.slice(0, 10).forEach((err) => console.log(` ${err}`)); - if (errors.length > 10) { - console.log(` ... and ${errors.length - 10} more`); - } - } - - if (failed > 0) { - process.exit(1); - } } testAllEndpoints(); diff --git a/packages/brk_client/brk_client/__init__.py b/packages/brk_client/brk_client/__init__.py index 228d2c69c..6e63962f6 100644 --- a/packages/brk_client/brk_client/__init__.py +++ b/packages/brk_client/brk_client/__init__.py @@ -1,22 +1,12 @@ # Auto-generated BRK Python client # Do not edit manually -import json -from http.client import HTTPConnection, HTTPSConnection -from typing import ( - Any, - Generic, - List, - Literal, - Optional, - Protocol, - TypedDict, - TypeVar, - Union, -) +from typing import TypeVar, Generic, Any, Optional, List, Literal, TypedDict, Union, Protocol, overload +from http.client import HTTPSConnection, HTTPConnection from urllib.parse import urlparse +import json -T = TypeVar("T") +T = TypeVar('T') # Type definitions @@ -81,20 +71,7 @@ Open = Cents OpReturnIndex = TypeIndex OutPoint = int # Type (P2PKH, P2WPKH, P2SH, P2TR, etc.) -OutputType = Literal[ - "p2pk65", - "p2pk33", - "p2pkh", - "p2ms", - "p2sh", - "opreturn", - "p2wpkh", - "p2wsh", - "p2tr", - "p2a", - "empty", - "unknown", -] +OutputType = Literal["p2pk65", "p2pk33", "p2pkh", "p2ms", "p2sh", "opreturn", "p2wpkh", "p2wsh", "p2tr", "p2a", "empty", "unknown"] P2AAddressIndex = TypeIndex U8x2 = List[int] P2ABytes = U8x2 @@ -117,166 +94,7 @@ P2WPKHAddressIndex = TypeIndex P2WPKHBytes = U8x20 P2WSHAddressIndex = TypeIndex P2WSHBytes = U8x32 -PoolSlug = Literal[ - "unknown", - "blockfills", - "ultimuspool", - "terrapool", - "luxor", - "onethash", - "btccom", - "bitfarms", - "huobipool", - "wayicn", - "canoepool", - "btctop", - "bitcoincom", - "pool175btc", - "gbminers", - "axbt", - "asicminer", - "bitminter", - "bitcoinrussia", - "btcserv", - "simplecoinus", - "btcguild", - "eligius", - "ozcoin", - "eclipsemc", - "maxbtc", - "triplemining", - "coinlab", - "pool50btc", - "ghashio", - "stminingcorp", - "bitparking", - "mmpool", - "polmine", - "kncminer", - "bitalo", - "f2pool", - "hhtt", - "megabigpower", - "mtred", - "nmcbit", - "yourbtcnet", - "givemecoins", - "braiinspool", - "antpool", - "multicoinco", - "bcpoolio", - "cointerra", - "kanopool", - "solock", - "ckpool", - "nicehash", - "bitclub", - "bitcoinaffiliatenetwork", - "btcc", - "bwpool", - "exxbw", - "bitsolo", - "bitfury", - "twentyoneinc", - "digitalbtc", - "eightbaochi", - "mybtccoinpool", - "tbdice", - "hashpool", - "nexious", - "bravomining", - "hotpool", - "okexpool", - "bcmonster", - "onehash", - "bixin", - "tatmaspool", - "viabtc", - "connectbtc", - "batpool", - "waterhole", - "dcexploration", - "dcex", - "btpool", - "fiftyeightcoin", - "bitcoinindia", - "shawnp0wers", - "phashio", - "rigpool", - "haozhuzhu", - "sevenpool", - "miningkings", - "hashbx", - "dpool", - "rawpool", - "haominer", - "helix", - "bitcoinukraine", - "poolin", - "secretsuperstar", - "tigerpoolnet", - "sigmapoolcom", - "okpooltop", - "hummerpool", - "tangpool", - "bytepool", - "spiderpool", - "novablock", - "miningcity", - "binancepool", - "minerium", - "lubiancom", - "okkong", - "aaopool", - "emcdpool", - "foundryusa", - "sbicrypto", - "arkpool", - "purebtccom", - "marapool", - "kucoinpool", - "entrustcharitypool", - "okminer", - "titan", - "pegapool", - "btcnuggets", - "cloudhashing", - "digitalxmintsy", - "telco214", - "btcpoolparty", - "multipool", - "transactioncoinmining", - "btcdig", - "trickysbtcpool", - "btcmp", - "eobot", - "unomp", - "patels", - "gogreenlight", - "ekanembtc", - "canoe", - "tiger", - "onem1x", - "zulupool", - "secpool", - "ocean", - "whitepool", - "wk057", - "futurebitapollosolo", - "carbonnegative", - "portlandhodl", - "phoenix", - "neopool", - "maxipool", - "bitfufupool", - "luckypool", - "miningdutch", - "publicpool", - "miningsquared", - "innopolistech", - "btclab", - "parasite", -] +PoolSlug = Literal["unknown", "blockfills", "ultimuspool", "terrapool", "luxor", "onethash", "btccom", "bitfarms", "huobipool", "wayicn", "canoepool", "btctop", "bitcoincom", "pool175btc", "gbminers", "axbt", "asicminer", "bitminter", "bitcoinrussia", "btcserv", "simplecoinus", "btcguild", "eligius", "ozcoin", "eclipsemc", "maxbtc", "triplemining", "coinlab", "pool50btc", "ghashio", "stminingcorp", "bitparking", "mmpool", "polmine", "kncminer", "bitalo", "f2pool", "hhtt", "megabigpower", "mtred", "nmcbit", "yourbtcnet", "givemecoins", "braiinspool", "antpool", "multicoinco", "bcpoolio", "cointerra", "kanopool", "solock", "ckpool", "nicehash", "bitclub", "bitcoinaffiliatenetwork", "btcc", "bwpool", "exxbw", "bitsolo", "bitfury", "twentyoneinc", "digitalbtc", "eightbaochi", "mybtccoinpool", "tbdice", "hashpool", "nexious", "bravomining", "hotpool", "okexpool", "bcmonster", "onehash", "bixin", "tatmaspool", "viabtc", "connectbtc", "batpool", "waterhole", "dcexploration", "dcex", "btpool", "fiftyeightcoin", "bitcoinindia", "shawnp0wers", "phashio", "rigpool", "haozhuzhu", "sevenpool", "miningkings", "hashbx", "dpool", "rawpool", "haominer", "helix", "bitcoinukraine", "poolin", "secretsuperstar", "tigerpoolnet", "sigmapoolcom", "okpooltop", "hummerpool", "tangpool", "bytepool", "spiderpool", "novablock", "miningcity", "binancepool", "minerium", "lubiancom", "okkong", "aaopool", "emcdpool", "foundryusa", "sbicrypto", "arkpool", "purebtccom", "marapool", "kucoinpool", "entrustcharitypool", "okminer", "titan", "pegapool", "btcnuggets", "cloudhashing", "digitalxmintsy", "telco214", "btcpoolparty", "multipool", "transactioncoinmining", "btcdig", "trickysbtcpool", "btcmp", "eobot", "unomp", "patels", "gogreenlight", "ekanembtc", "canoe", "tiger", "onem1x", "zulupool", "secpool", "ocean", "whitepool", "wk057", "futurebitapollosolo", "carbonnegative", "portlandhodl", "phoenix", "neopool", "maxipool", "bitfufupool", "luckypool", "miningdutch", "publicpool", "miningsquared", "innopolistech", "btclab", "parasite"] QuarterIndex = int # Transaction locktime RawLockTime = int @@ -294,7 +112,7 @@ StoredU32 = int # Fixed-size 64-bit unsigned integer optimized for on-disk storage StoredU64 = int # Time period for mining statistics. -# +# # Used to specify the lookback window for pool statistics, hashrate calculations, # and other time-based mining metrics. TimePeriod = Literal["24h", "3d", "1w", "1m", "3m", "6m", "1y", "2y", "3y"] @@ -311,43 +129,13 @@ WeekIndex = int YearIndex = int # Aggregation dimension for querying metrics. Includes time-based (date, week, month, year), # block-based (height, txindex), and address/output type indexes. -Index = Literal[ - "dateindex", - "decadeindex", - "difficultyepoch", - "emptyoutputindex", - "halvingepoch", - "height", - "txinindex", - "monthindex", - "opreturnindex", - "txoutindex", - "p2aaddressindex", - "p2msoutputindex", - "p2pk33addressindex", - "p2pk65addressindex", - "p2pkhaddressindex", - "p2shaddressindex", - "p2traddressindex", - "p2wpkhaddressindex", - "p2wshaddressindex", - "quarterindex", - "semesterindex", - "txindex", - "unknownoutputindex", - "weekindex", - "yearindex", - "loadedaddressindex", - "emptyaddressindex", -] +Index = Literal["dateindex", "decadeindex", "difficultyepoch", "emptyoutputindex", "halvingepoch", "height", "txinindex", "monthindex", "opreturnindex", "txoutindex", "p2aaddressindex", "p2msoutputindex", "p2pk33addressindex", "p2pk65addressindex", "p2pkhaddressindex", "p2shaddressindex", "p2traddressindex", "p2wpkhaddressindex", "p2wshaddressindex", "quarterindex", "semesterindex", "txindex", "unknownoutputindex", "weekindex", "yearindex", "loadedaddressindex", "emptyaddressindex"] # Hierarchical tree node for organizing metrics into categories TreeNode = Union[dict[str, "TreeNode"], "MetricLeafWithSchema"] - - class AddressChainStats(TypedDict): """ Address statistics on the blockchain (confirmed transactions only) - + Based on mempool.space's format with type_index extension. Attributes: @@ -358,7 +146,6 @@ class AddressChainStats(TypedDict): tx_count: Total number of confirmed transactions involving this address type_index: Index of this address within its type on the blockchain """ - funded_txo_count: int funded_txo_sum: Sats spent_txo_count: int @@ -366,11 +153,10 @@ class AddressChainStats(TypedDict): tx_count: int type_index: TypeIndex - class AddressMempoolStats(TypedDict): """ Address statistics in the mempool (unconfirmed transactions only) - + Based on mempool.space's format. Attributes: @@ -380,18 +166,15 @@ class AddressMempoolStats(TypedDict): spent_txo_sum: Total amount in satoshis being spent in unconfirmed transactions tx_count: Number of unconfirmed transactions involving this address """ - funded_txo_count: int funded_txo_sum: Sats spent_txo_count: int spent_txo_sum: Sats tx_count: int - class AddressParam(TypedDict): address: Address - class AddressStats(TypedDict): """ Address information compatible with mempool.space API format @@ -401,23 +184,19 @@ class AddressStats(TypedDict): chain_stats: Statistics for confirmed transactions on the blockchain mempool_stats: Statistics for unconfirmed transactions in the mempool """ - address: Address chain_stats: AddressChainStats mempool_stats: Union[AddressMempoolStats, None] - class AddressTxidsParam(TypedDict): """ Attributes: after_txid: Txid to paginate from (return transactions before this one) limit: Maximum number of results to return. Defaults to 25 if not specified. """ - after_txid: Union[Txid, None] limit: int - class AddressValidation(TypedDict): """ Address validation result @@ -431,7 +210,6 @@ class AddressValidation(TypedDict): witness_version: Witness version (0 for P2WPKH/P2WSH, 1 for P2TR) witness_program: Witness program in hex """ - isvalid: bool address: Optional[str] scriptPubKey: Optional[str] @@ -440,52 +218,42 @@ class AddressValidation(TypedDict): witness_version: Optional[int] witness_program: Optional[str] - class BlockCountParam(TypedDict): """ Attributes: block_count: Number of recent blocks to include """ - block_count: int - class BlockFeesEntry(TypedDict): """ A single block fees data point. """ - avgHeight: Height timestamp: Timestamp avgFees: Sats - class BlockHashParam(TypedDict): hash: BlockHash - class BlockHashStartIndex(TypedDict): """ Attributes: hash: Bitcoin block hash start_index: Starting transaction index within the block (0-based) """ - hash: BlockHash start_index: TxIndex - class BlockHashTxIndex(TypedDict): """ Attributes: hash: Bitcoin block hash index: Transaction index within the block (0-based) """ - hash: BlockHash index: TxIndex - class BlockInfo(TypedDict): """ Block information returned by the API @@ -499,7 +267,6 @@ class BlockInfo(TypedDict): timestamp: Block timestamp (Unix time) difficulty: Block difficulty as a floating point number """ - id: BlockHash height: Height tx_count: int @@ -508,46 +275,37 @@ class BlockInfo(TypedDict): timestamp: Timestamp difficulty: float - class BlockRewardsEntry(TypedDict): """ A single block rewards data point. """ - avgHeight: int timestamp: int avgRewards: int - class BlockSizeEntry(TypedDict): """ A single block size data point. """ - avgHeight: int timestamp: int avgSize: int - class BlockWeightEntry(TypedDict): """ A single block weight data point. """ - avgHeight: int timestamp: int avgWeight: int - class BlockSizesWeights(TypedDict): """ Combined block sizes and weights response. """ - sizes: List[BlockSizeEntry] weights: List[BlockWeightEntry] - class BlockStatus(TypedDict): """ Block status indicating whether block is in the best chain @@ -557,12 +315,10 @@ class BlockStatus(TypedDict): height: Block height (only if in best chain) next_best: Hash of the next block in the best chain (only if in best chain and not tip) """ - in_best_chain: bool height: Union[Height, None] next_best: Union[BlockHash, None] - class BlockTimestamp(TypedDict): """ Block information returned for timestamp queries @@ -572,12 +328,10 @@ class BlockTimestamp(TypedDict): hash: Block hash timestamp: Block timestamp in ISO 8601 format """ - height: Height hash: BlockHash timestamp: str - class DataRangeFormat(TypedDict): """ Data range with output format for API query parameters @@ -588,13 +342,11 @@ class DataRangeFormat(TypedDict): limit: Maximum number of values to return (ignored if `end` is set) format: Format of the output """ - start: Optional[int] end: Optional[int] limit: Union[Limit, None] format: Format - class DifficultyAdjustment(TypedDict): """ Difficulty adjustment information. @@ -611,7 +363,6 @@ class DifficultyAdjustment(TypedDict): adjustedTimeAvg: Time-adjusted average (accounting for timestamp manipulation) timeOffset: Time offset from expected schedule (seconds) """ - progressPercent: float difficultyChange: float estimatedRetargetDate: int @@ -623,19 +374,16 @@ class DifficultyAdjustment(TypedDict): adjustedTimeAvg: int timeOffset: int - class DifficultyAdjustmentEntry(TypedDict): """ A single difficulty adjustment entry. Serializes as array: [timestamp, height, difficulty, change_percent] """ - timestamp: Timestamp height: Height difficulty: float change_percent: float - class DifficultyEntry(TypedDict): """ A single difficulty data point. @@ -645,12 +393,10 @@ class DifficultyEntry(TypedDict): difficulty: Difficulty value. height: Block height of the adjustment. """ - timestamp: Timestamp difficulty: float height: Height - class DiskUsage(TypedDict): """ Disk usage of the indexed data @@ -662,14 +408,12 @@ class DiskUsage(TypedDict): bitcoin_bytes: Bitcoin blocks directory size in bytes ratio: brk as percentage of Bitcoin data """ - brk: str brk_bytes: int bitcoin: str bitcoin_bytes: int ratio: float - class EmptyAddressData(TypedDict): """ Data of an empty address @@ -679,12 +423,10 @@ class EmptyAddressData(TypedDict): funded_txo_count: Total funded/spent transaction output count (equal since address is empty) transfered: Total satoshis transferred """ - tx_count: int funded_txo_count: int transfered: Sats - class HashrateEntry(TypedDict): """ A single hashrate data point. @@ -693,11 +435,9 @@ class HashrateEntry(TypedDict): timestamp: Unix timestamp. avgHashrate: Average hashrate (H/s). """ - timestamp: Timestamp avgHashrate: int - class HashrateSummary(TypedDict): """ Summary of network hashrate and difficulty data. @@ -708,13 +448,11 @@ class HashrateSummary(TypedDict): currentHashrate: Current network hashrate (H/s). currentDifficulty: Current network difficulty. """ - hashrates: List[HashrateEntry] difficulty: List[DifficultyEntry] currentHashrate: int currentDifficulty: float - class Health(TypedDict): """ Server health status @@ -723,18 +461,15 @@ class Health(TypedDict): started_at: Server start time (ISO 8601) uptime_seconds: Uptime in seconds """ - status: str service: str timestamp: str started_at: str uptime_seconds: int - class HeightParam(TypedDict): height: Height - class IndexInfo(TypedDict): """ Information about an available index and its query aliases @@ -743,15 +478,12 @@ class IndexInfo(TypedDict): index: The canonical index name aliases: All Accepted query aliases """ - index: Index aliases: List[str] - class LimitParam(TypedDict): limit: Limit - class LoadedAddressData(TypedDict): """ Data for a loaded (non-empty) address with current balance @@ -764,7 +496,6 @@ class LoadedAddressData(TypedDict): sent: Satoshis sent by this address realized_cap: The realized capitalization of this address """ - tx_count: int funded_txo_count: int spent_txo_count: int @@ -772,7 +503,6 @@ class LoadedAddressData(TypedDict): sent: Sats realized_cap: Dollars - class MempoolBlock(TypedDict): """ Block info in a mempool.space like format for fee estimation. @@ -785,7 +515,6 @@ class MempoolBlock(TypedDict): medianFee: Median fee rate in sat/vB feeRange: Fee rate range: [min, 10%, 25%, 50%, 75%, 90%, max] """ - blockSize: int blockVSize: float nTx: int @@ -793,7 +522,6 @@ class MempoolBlock(TypedDict): medianFee: FeeRate feeRange: List[FeeRate] - class MempoolInfo(TypedDict): """ Mempool statistics @@ -803,12 +531,10 @@ class MempoolInfo(TypedDict): vsize: Total virtual size of all transactions in the mempool (vbytes) total_fee: Total fees of all transactions in the mempool (satoshis) """ - count: int vsize: VSize total_fee: Sats - class MetricCount(TypedDict): """ Metric count statistics - distinct metrics and total metric-index combinations @@ -819,17 +545,14 @@ class MetricCount(TypedDict): lazy_endpoints: Number of lazy (computed on-the-fly) metric-index combinations stored_endpoints: Number of eager (stored on disk) metric-index combinations """ - distinct_metrics: int total_endpoints: int lazy_endpoints: int stored_endpoints: int - class MetricParam(TypedDict): metric: Metric - class MetricSelection(TypedDict): """ Selection of metrics to query @@ -842,7 +565,6 @@ class MetricSelection(TypedDict): limit: Maximum number of values to return (ignored if `end` is set) format: Format of the output """ - metrics: Metrics index: Index start: Optional[int] @@ -850,7 +572,6 @@ class MetricSelection(TypedDict): limit: Union[Limit, None] format: Format - class MetricSelectionLegacy(TypedDict): """ Legacy metric selection parameters (deprecated) @@ -861,7 +582,6 @@ class MetricSelectionLegacy(TypedDict): limit: Maximum number of values to return (ignored if `end` is set) format: Format of the output """ - index: Index ids: Metrics start: Optional[int] @@ -869,51 +589,42 @@ class MetricSelectionLegacy(TypedDict): limit: Union[Limit, None] format: Format - class MetricWithIndex(TypedDict): """ Attributes: metric: Metric name index: Aggregation index """ - metric: Metric index: Index - class OHLCCents(TypedDict): """ OHLC (Open, High, Low, Close) data in cents """ - open: Open high: High low: Low close: Close - class OHLCDollars(TypedDict): """ OHLC (Open, High, Low, Close) data in dollars """ - open: Open high: High low: Low close: Close - class OHLCSats(TypedDict): """ OHLC (Open, High, Low, Close) data in satoshis """ - open: Open high: High low: Low close: Close - class PaginatedMetrics(TypedDict): """ A paginated list of available metric names (1000 per page) @@ -923,12 +634,10 @@ class PaginatedMetrics(TypedDict): max_page: Maximum valid page index (0-indexed) metrics: List of metric names (max 1000 per page) """ - current_page: int max_page: int metrics: List[str] - class Pagination(TypedDict): """ Pagination parameters for paginated API endpoints @@ -936,10 +645,8 @@ class Pagination(TypedDict): Attributes: page: Pagination index """ - page: Optional[int] - class PoolBlockCounts(TypedDict): """ Block counts for different time periods @@ -949,12 +656,10 @@ class PoolBlockCounts(TypedDict): _24h: Blocks mined in last 24 hours _1w: Blocks mined in last week """ - all: int _24h: int _1w: int - class PoolBlockShares(TypedDict): """ Pool's share of total blocks for different time periods @@ -964,12 +669,10 @@ class PoolBlockShares(TypedDict): _24h: Share of blocks in last 24 hours _1w: Share of blocks in last week """ - all: float _24h: float _1w: float - class PoolDetailInfo(TypedDict): """ Pool information for detail view @@ -982,7 +685,6 @@ class PoolDetailInfo(TypedDict): regexes: Coinbase tag patterns (regexes) slug: URL-friendly pool identifier """ - id: int name: str link: str @@ -990,7 +692,6 @@ class PoolDetailInfo(TypedDict): regexes: List[str] slug: PoolSlug - class PoolDetail(TypedDict): """ Detailed pool information with statistics across time periods @@ -1002,14 +703,12 @@ class PoolDetail(TypedDict): estimatedHashrate: Estimated hashrate based on blocks mined reportedHashrate: Self-reported hashrate (if available) """ - pool: PoolDetailInfo blockCount: PoolBlockCounts blockShare: PoolBlockShares estimatedHashrate: int reportedHashrate: Optional[int] - class PoolInfo(TypedDict): """ Basic pool information for listing all pools @@ -1019,16 +718,13 @@ class PoolInfo(TypedDict): slug: URL-friendly pool identifier unique_id: Unique numeric pool identifier """ - name: str slug: PoolSlug unique_id: int - class PoolSlugParam(TypedDict): slug: PoolSlug - class PoolStats(TypedDict): """ Mining pool with block statistics for a time period @@ -1043,7 +739,6 @@ class PoolStats(TypedDict): slug: URL-friendly pool identifier share: Pool's share of total blocks (0.0 - 1.0) """ - poolId: int name: str link: str @@ -1053,7 +748,6 @@ class PoolStats(TypedDict): slug: PoolSlug share: float - class PoolsSummary(TypedDict): """ Mining pools response for a time period @@ -1063,12 +757,10 @@ class PoolsSummary(TypedDict): blockCount: Total blocks in the time period lastEstimatedHashrate: Estimated network hashrate (hashes per second) """ - pools: List[PoolStats] blockCount: int lastEstimatedHashrate: int - class RecommendedFees(TypedDict): """ Recommended fee rates in sat/vB @@ -1080,14 +772,12 @@ class RecommendedFees(TypedDict): economyFee: Fee rate for economical confirmation minimumFee: Minimum relay fee rate """ - fastestFee: FeeRate halfHourFee: FeeRate hourFee: FeeRate economyFee: FeeRate minimumFee: FeeRate - class RewardStats(TypedDict): """ Block reward statistics over a range of blocks @@ -1096,14 +786,12 @@ class RewardStats(TypedDict): startBlock: First block in the range endBlock: Last block in the range """ - startBlock: Height endBlock: Height totalReward: Sats totalFee: Sats totalTx: int - class SupplyState(TypedDict): """ Current supply state tracking UTXO count and total value @@ -1112,11 +800,9 @@ class SupplyState(TypedDict): utxo_count: Number of unspent transaction outputs value: Total value in satoshis """ - utxo_count: int value: Sats - class SyncStatus(TypedDict): """ Sync status of the indexer @@ -1128,22 +814,18 @@ class SyncStatus(TypedDict): last_indexed_at: Human-readable timestamp of the last indexed block (ISO 8601) last_indexed_at_unix: Unix timestamp of the last indexed block """ - indexed_height: Height tip_height: Height blocks_behind: Height last_indexed_at: str last_indexed_at_unix: Timestamp - class TimePeriodParam(TypedDict): time_period: TimePeriod - class TimestampParam(TypedDict): timestamp: Timestamp - class TxOut(TypedDict): """ Transaction output @@ -1152,11 +834,9 @@ class TxOut(TypedDict): scriptpubkey: Script pubkey (locking script) value: Value of the output in satoshis """ - scriptpubkey: str value: Sats - class TxIn(TypedDict): """ Transaction input @@ -1170,7 +850,6 @@ class TxIn(TypedDict): sequence: Input sequence number inner_redeemscript_asm: Inner redeemscript in assembly format (for P2SH-wrapped SegWit) """ - txid: Txid vout: Vout prevout: Union[TxOut, None] @@ -1180,7 +859,6 @@ class TxIn(TypedDict): sequence: int inner_redeemscript_asm: Optional[str] - class TxStatus(TypedDict): """ Transaction confirmation status @@ -1191,13 +869,11 @@ class TxStatus(TypedDict): block_hash: Block hash (only present if confirmed) block_time: Block timestamp (only present if confirmed) """ - confirmed: bool block_height: Union[Height, None] block_hash: Union[BlockHash, None] block_time: Union[Timestamp, None] - class Transaction(TypedDict): """ Transaction information compatible with mempool.space API format @@ -1210,7 +886,6 @@ class Transaction(TypedDict): vin: Transaction inputs vout: Transaction outputs """ - index: Union[TxIndex, None] txid: Txid version: TxVersion @@ -1223,7 +898,6 @@ class Transaction(TypedDict): vout: List[TxOut] status: TxStatus - class TxOutspend(TypedDict): """ Status of an output indicating whether it has been spent @@ -1234,17 +908,14 @@ class TxOutspend(TypedDict): vin: Input index in the spending transaction (only present if spent) status: Status of the spending transaction (only present if spent) """ - spent: bool txid: Union[Txid, None] vin: Union[Vin, None] status: Union[TxStatus, None] - class TxidParam(TypedDict): txid: Txid - class TxidVout(TypedDict): """ Transaction output reference (txid + output index) @@ -1253,31 +924,25 @@ class TxidVout(TypedDict): txid: Transaction ID vout: Output index """ - txid: Txid vout: Vout - class Utxo(TypedDict): """ Unspent transaction output """ - txid: Txid vout: Vout status: TxStatus value: Sats - class ValidateAddressParam(TypedDict): """ Attributes: address: Bitcoin address to validate (can be any string) """ - address: str - class MetricLeafWithSchema(TypedDict): """ MetricLeaf with JSON Schema for client generation @@ -1288,7 +953,6 @@ class MetricLeafWithSchema(TypedDict): indexes: Available indexes for this metric type: JSON Schema type (e.g., "integer", "number", "string", "boolean", "array", "object") """ - name: str kind: str indexes: List[Index] @@ -1309,7 +973,7 @@ class BrkClientBase: def __init__(self, base_url: str, timeout: float = 30.0): parsed = urlparse(base_url) self._host = parsed.netloc - self._secure = parsed.scheme == "https" + self._secure = parsed.scheme == 'https' self._timeout = timeout self._conn: Optional[Union[HTTPSConnection, HTTPConnection]] = None @@ -1364,7 +1028,6 @@ def _m(acc: str, s: str) -> str: class MetricData(TypedDict, Generic[T]): """Metric data with range information.""" - total: int start: int end: int @@ -1377,21 +1040,14 @@ AnyMetricData = MetricData[Any] class _EndpointConfig: """Shared endpoint configuration.""" - client: BrkClientBase name: str index: Index start: Optional[int] end: Optional[int] - def __init__( - self, - client: BrkClientBase, - name: str, - index: Index, - start: Optional[int] = None, - end: Optional[int] = None, - ): + def __init__(self, client: BrkClientBase, name: str, index: Index, + start: Optional[int] = None, end: Optional[int] = None): self.client = client self.name = name self.index = index @@ -1417,168 +1073,142 @@ class _EndpointConfig: return self.client.get_json(self._build_path()) def get_csv(self) -> str: - return self.client.get_text(self._build_path(format="csv")) + return self.client.get_text(self._build_path(format='csv')) class RangeBuilder(Generic[T]): - """Final builder with range fully specified. Can only call json() or csv().""" + """Builder with range specified.""" def __init__(self, config: _EndpointConfig): self._config = config - def json(self) -> MetricData[T]: - """Execute the query and return parsed JSON data.""" + def fetch(self) -> MetricData[T]: + """Fetch the range as parsed JSON.""" return self._config.get_json() - def csv(self) -> str: - """Execute the query and return CSV data as a string.""" + def fetch_csv(self) -> str: + """Fetch the range as CSV string.""" return self._config.get_csv() -class FromBuilder(Generic[T]): - """Builder after calling from(start). Can chain with take() or to().""" +class SingleItemBuilder(Generic[T]): + """Builder for single item access.""" + + def __init__(self, config: _EndpointConfig): + self._config = config + + def fetch(self) -> MetricData[T]: + """Fetch the single item.""" + return self._config.get_json() + + def fetch_csv(self) -> str: + """Fetch as CSV.""" + return self._config.get_csv() + + +class SkippedBuilder(Generic[T]): + """Builder after calling skip(n). Chain with take() to specify count.""" def __init__(self, config: _EndpointConfig): self._config = config def take(self, n: int) -> RangeBuilder[T]: - """Take n items from the start position.""" + """Take n items after the skipped position.""" start = self._config.start or 0 - return RangeBuilder( - _EndpointConfig( - self._config.client, - self._config.name, - self._config.index, - start, - start + n, - ) - ) + return RangeBuilder(_EndpointConfig( + self._config.client, self._config.name, self._config.index, + start, start + n + )) - def to(self, end: int) -> RangeBuilder[T]: - """Set the end position.""" - return RangeBuilder( - _EndpointConfig( - self._config.client, - self._config.name, - self._config.index, - self._config.start, - end, - ) - ) - - def json(self) -> MetricData[T]: - """Execute the query and return parsed JSON data (from start to end of data).""" + def fetch(self) -> MetricData[T]: + """Fetch from skipped position to end.""" return self._config.get_json() - def csv(self) -> str: - """Execute the query and return CSV data as a string.""" - return self._config.get_csv() - - -class ToBuilder(Generic[T]): - """Builder after calling to(end). Can chain with take_last() or from().""" - - def __init__(self, config: _EndpointConfig): - self._config = config - - def take_last(self, n: int) -> RangeBuilder[T]: - """Take last n items before the end position.""" - end = self._config.end or 0 - return RangeBuilder( - _EndpointConfig( - self._config.client, self._config.name, self._config.index, end - n, end - ) - ) - - def from_(self, start: int) -> RangeBuilder[T]: - """Set the start position.""" - return RangeBuilder( - _EndpointConfig( - self._config.client, - self._config.name, - self._config.index, - start, - self._config.end, - ) - ) - - def json(self) -> MetricData[T]: - """Execute the query and return parsed JSON data (from start of data to end).""" - return self._config.get_json() - - def csv(self) -> str: - """Execute the query and return CSV data as a string.""" + def fetch_csv(self) -> str: + """Fetch as CSV.""" return self._config.get_csv() class MetricEndpointBuilder(Generic[T]): - """Initial builder for metric endpoint queries. + """Builder for metric endpoint queries. - Use method chaining to specify the data range, then call json() or csv() to execute. + Use method chaining to specify the data range, then call fetch() or fetch_csv() to execute. Examples: - # Get all data - endpoint.json() + # Fetch all data + data = endpoint.fetch() - # Get last 10 points - endpoint.last(10).json() + # Single item access + data = endpoint[5].fetch() - # Get range [100, 200) - endpoint.range(100, 200).json() + # Slice syntax (Python-native) + data = endpoint[:10].fetch() # First 10 + data = endpoint[-5:].fetch() # Last 5 + data = endpoint[100:110].fetch() # Range - # Get 10 points starting from position 100 - endpoint.from_(100).take(10).json() + # Convenience methods (pandas-style) + data = endpoint.head().fetch() # First 10 (default) + data = endpoint.head(20).fetch() # First 20 + data = endpoint.tail(5).fetch() # Last 5 + + # Iterator-style chaining + data = endpoint.skip(100).take(10).fetch() """ def __init__(self, client: BrkClientBase, name: str, index: Index): self._config = _EndpointConfig(client, name, index) - def first(self, n: int) -> RangeBuilder[T]: - """Fetch the first n data points.""" - return RangeBuilder( - _EndpointConfig( - self._config.client, self._config.name, self._config.index, None, n - ) - ) + @overload + def __getitem__(self, key: int) -> SingleItemBuilder[T]: ... + @overload + def __getitem__(self, key: slice) -> RangeBuilder[T]: ... - def last(self, n: int) -> RangeBuilder[T]: - """Fetch the last n data points.""" - return RangeBuilder( - _EndpointConfig( - self._config.client, self._config.name, self._config.index, -n, None - ) - ) + def __getitem__(self, key: Union[int, slice]) -> Union[SingleItemBuilder[T], RangeBuilder[T]]: + """Access single item or slice. - def range(self, start: int, end: int) -> RangeBuilder[T]: - """Set an explicit range [start, end).""" - return RangeBuilder( - _EndpointConfig( - self._config.client, self._config.name, self._config.index, start, end - ) - ) + Examples: + endpoint[5] # Single item at index 5 + endpoint[:10] # First 10 + endpoint[-5:] # Last 5 + endpoint[100:110] # Range 100-109 + """ + if isinstance(key, int): + return SingleItemBuilder(_EndpointConfig( + self._config.client, self._config.name, self._config.index, + key, key + 1 + )) + return RangeBuilder(_EndpointConfig( + self._config.client, self._config.name, self._config.index, + key.start, key.stop + )) - def from_(self, start: int) -> FromBuilder[T]: - """Set the start position. Chain with take() or to().""" - return FromBuilder( - _EndpointConfig( - self._config.client, self._config.name, self._config.index, start, None - ) - ) + def head(self, n: int = 10) -> RangeBuilder[T]: + """Get the first n items (pandas-style).""" + return RangeBuilder(_EndpointConfig( + self._config.client, self._config.name, self._config.index, + None, n + )) - def to(self, end: int) -> ToBuilder[T]: - """Set the end position. Chain with take_last() or from_().""" - return ToBuilder( - _EndpointConfig( - self._config.client, self._config.name, self._config.index, None, end - ) - ) + def tail(self, n: int = 10) -> RangeBuilder[T]: + """Get the last n items (pandas-style).""" + return RangeBuilder(_EndpointConfig( + self._config.client, self._config.name, self._config.index, + -n, None + )) - def json(self) -> MetricData[T]: - """Execute the query and return parsed JSON data (all data).""" + def skip(self, n: int) -> SkippedBuilder[T]: + """Skip the first n items. Chain with take() to get a range.""" + return SkippedBuilder(_EndpointConfig( + self._config.client, self._config.name, self._config.index, + n, None + )) + + def fetch(self) -> MetricData[T]: + """Fetch all data as parsed JSON.""" return self._config.get_json() - def csv(self) -> str: - """Execute the query and return CSV data as a string (all data).""" + def fetch_csv(self) -> str: + """Fetch all data as CSV string.""" return self._config.get_csv() def path(self) -> str: @@ -1609,45 +1239,43 @@ class MetricPattern(Protocol[T]): # Index accessor classes - class _MetricPattern1By(Generic[T]): """Index endpoint methods container.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name def dateindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "dateindex") + return MetricEndpointBuilder(self._client, self._name, 'dateindex') def decadeindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "decadeindex") + return MetricEndpointBuilder(self._client, self._name, 'decadeindex') def difficultyepoch(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "difficultyepoch") + return MetricEndpointBuilder(self._client, self._name, 'difficultyepoch') def height(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "height") + return MetricEndpointBuilder(self._client, self._name, 'height') def monthindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "monthindex") + return MetricEndpointBuilder(self._client, self._name, 'monthindex') def quarterindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "quarterindex") + return MetricEndpointBuilder(self._client, self._name, 'quarterindex') def semesterindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "semesterindex") + return MetricEndpointBuilder(self._client, self._name, 'semesterindex') def weekindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "weekindex") + return MetricEndpointBuilder(self._client, self._name, 'weekindex') def yearindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "yearindex") - + return MetricEndpointBuilder(self._client, self._name, 'yearindex') class MetricPattern1(Generic[T]): """Index accessor for metrics with 9 indexes.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name @@ -1660,76 +1288,55 @@ class MetricPattern1(Generic[T]): def indexes(self) -> List[str]: """Get the list of available indexes.""" - return [ - "dateindex", - "decadeindex", - "difficultyepoch", - "height", - "monthindex", - "quarterindex", - "semesterindex", - "weekindex", - "yearindex", - ] + return ['dateindex', 'decadeindex', 'difficultyepoch', 'height', 'monthindex', 'quarterindex', 'semesterindex', 'weekindex', 'yearindex'] def get(self, index: Index) -> Optional[MetricEndpointBuilder[T]]: """Get an endpoint builder for a specific index, if supported.""" - if index == "dateindex": - return self.by.dateindex() - elif index == "decadeindex": - return self.by.decadeindex() - elif index == "difficultyepoch": - return self.by.difficultyepoch() - elif index == "height": - return self.by.height() - elif index == "monthindex": - return self.by.monthindex() - elif index == "quarterindex": - return self.by.quarterindex() - elif index == "semesterindex": - return self.by.semesterindex() - elif index == "weekindex": - return self.by.weekindex() - elif index == "yearindex": - return self.by.yearindex() + if index == 'dateindex': return self.by.dateindex() + elif index == 'decadeindex': return self.by.decadeindex() + elif index == 'difficultyepoch': return self.by.difficultyepoch() + elif index == 'height': return self.by.height() + elif index == 'monthindex': return self.by.monthindex() + elif index == 'quarterindex': return self.by.quarterindex() + elif index == 'semesterindex': return self.by.semesterindex() + elif index == 'weekindex': return self.by.weekindex() + elif index == 'yearindex': return self.by.yearindex() return None - class _MetricPattern2By(Generic[T]): """Index endpoint methods container.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name def dateindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "dateindex") + return MetricEndpointBuilder(self._client, self._name, 'dateindex') def decadeindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "decadeindex") + return MetricEndpointBuilder(self._client, self._name, 'decadeindex') def difficultyepoch(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "difficultyepoch") + return MetricEndpointBuilder(self._client, self._name, 'difficultyepoch') def monthindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "monthindex") + return MetricEndpointBuilder(self._client, self._name, 'monthindex') def quarterindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "quarterindex") + return MetricEndpointBuilder(self._client, self._name, 'quarterindex') def semesterindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "semesterindex") + return MetricEndpointBuilder(self._client, self._name, 'semesterindex') def weekindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "weekindex") + return MetricEndpointBuilder(self._client, self._name, 'weekindex') def yearindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "yearindex") - + return MetricEndpointBuilder(self._client, self._name, 'yearindex') class MetricPattern2(Generic[T]): """Index accessor for metrics with 8 indexes.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name @@ -1742,73 +1349,54 @@ class MetricPattern2(Generic[T]): def indexes(self) -> List[str]: """Get the list of available indexes.""" - return [ - "dateindex", - "decadeindex", - "difficultyepoch", - "monthindex", - "quarterindex", - "semesterindex", - "weekindex", - "yearindex", - ] + return ['dateindex', 'decadeindex', 'difficultyepoch', 'monthindex', 'quarterindex', 'semesterindex', 'weekindex', 'yearindex'] def get(self, index: Index) -> Optional[MetricEndpointBuilder[T]]: """Get an endpoint builder for a specific index, if supported.""" - if index == "dateindex": - return self.by.dateindex() - elif index == "decadeindex": - return self.by.decadeindex() - elif index == "difficultyepoch": - return self.by.difficultyepoch() - elif index == "monthindex": - return self.by.monthindex() - elif index == "quarterindex": - return self.by.quarterindex() - elif index == "semesterindex": - return self.by.semesterindex() - elif index == "weekindex": - return self.by.weekindex() - elif index == "yearindex": - return self.by.yearindex() + if index == 'dateindex': return self.by.dateindex() + elif index == 'decadeindex': return self.by.decadeindex() + elif index == 'difficultyepoch': return self.by.difficultyepoch() + elif index == 'monthindex': return self.by.monthindex() + elif index == 'quarterindex': return self.by.quarterindex() + elif index == 'semesterindex': return self.by.semesterindex() + elif index == 'weekindex': return self.by.weekindex() + elif index == 'yearindex': return self.by.yearindex() return None - class _MetricPattern3By(Generic[T]): """Index endpoint methods container.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name def dateindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "dateindex") + return MetricEndpointBuilder(self._client, self._name, 'dateindex') def decadeindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "decadeindex") + return MetricEndpointBuilder(self._client, self._name, 'decadeindex') def height(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "height") + return MetricEndpointBuilder(self._client, self._name, 'height') def monthindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "monthindex") + return MetricEndpointBuilder(self._client, self._name, 'monthindex') def quarterindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "quarterindex") + return MetricEndpointBuilder(self._client, self._name, 'quarterindex') def semesterindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "semesterindex") + return MetricEndpointBuilder(self._client, self._name, 'semesterindex') def weekindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "weekindex") + return MetricEndpointBuilder(self._client, self._name, 'weekindex') def yearindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "yearindex") - + return MetricEndpointBuilder(self._client, self._name, 'yearindex') class MetricPattern3(Generic[T]): """Index accessor for metrics with 8 indexes.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name @@ -1821,70 +1409,51 @@ class MetricPattern3(Generic[T]): def indexes(self) -> List[str]: """Get the list of available indexes.""" - return [ - "dateindex", - "decadeindex", - "height", - "monthindex", - "quarterindex", - "semesterindex", - "weekindex", - "yearindex", - ] + return ['dateindex', 'decadeindex', 'height', 'monthindex', 'quarterindex', 'semesterindex', 'weekindex', 'yearindex'] def get(self, index: Index) -> Optional[MetricEndpointBuilder[T]]: """Get an endpoint builder for a specific index, if supported.""" - if index == "dateindex": - return self.by.dateindex() - elif index == "decadeindex": - return self.by.decadeindex() - elif index == "height": - return self.by.height() - elif index == "monthindex": - return self.by.monthindex() - elif index == "quarterindex": - return self.by.quarterindex() - elif index == "semesterindex": - return self.by.semesterindex() - elif index == "weekindex": - return self.by.weekindex() - elif index == "yearindex": - return self.by.yearindex() + if index == 'dateindex': return self.by.dateindex() + elif index == 'decadeindex': return self.by.decadeindex() + elif index == 'height': return self.by.height() + elif index == 'monthindex': return self.by.monthindex() + elif index == 'quarterindex': return self.by.quarterindex() + elif index == 'semesterindex': return self.by.semesterindex() + elif index == 'weekindex': return self.by.weekindex() + elif index == 'yearindex': return self.by.yearindex() return None - class _MetricPattern4By(Generic[T]): """Index endpoint methods container.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name def dateindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "dateindex") + return MetricEndpointBuilder(self._client, self._name, 'dateindex') def decadeindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "decadeindex") + return MetricEndpointBuilder(self._client, self._name, 'decadeindex') def monthindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "monthindex") + return MetricEndpointBuilder(self._client, self._name, 'monthindex') def quarterindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "quarterindex") + return MetricEndpointBuilder(self._client, self._name, 'quarterindex') def semesterindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "semesterindex") + return MetricEndpointBuilder(self._client, self._name, 'semesterindex') def weekindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "weekindex") + return MetricEndpointBuilder(self._client, self._name, 'weekindex') def yearindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "yearindex") - + return MetricEndpointBuilder(self._client, self._name, 'yearindex') class MetricPattern4(Generic[T]): """Index accessor for metrics with 7 indexes.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name @@ -1897,52 +1466,35 @@ class MetricPattern4(Generic[T]): def indexes(self) -> List[str]: """Get the list of available indexes.""" - return [ - "dateindex", - "decadeindex", - "monthindex", - "quarterindex", - "semesterindex", - "weekindex", - "yearindex", - ] + return ['dateindex', 'decadeindex', 'monthindex', 'quarterindex', 'semesterindex', 'weekindex', 'yearindex'] def get(self, index: Index) -> Optional[MetricEndpointBuilder[T]]: """Get an endpoint builder for a specific index, if supported.""" - if index == "dateindex": - return self.by.dateindex() - elif index == "decadeindex": - return self.by.decadeindex() - elif index == "monthindex": - return self.by.monthindex() - elif index == "quarterindex": - return self.by.quarterindex() - elif index == "semesterindex": - return self.by.semesterindex() - elif index == "weekindex": - return self.by.weekindex() - elif index == "yearindex": - return self.by.yearindex() + if index == 'dateindex': return self.by.dateindex() + elif index == 'decadeindex': return self.by.decadeindex() + elif index == 'monthindex': return self.by.monthindex() + elif index == 'quarterindex': return self.by.quarterindex() + elif index == 'semesterindex': return self.by.semesterindex() + elif index == 'weekindex': return self.by.weekindex() + elif index == 'yearindex': return self.by.yearindex() return None - class _MetricPattern5By(Generic[T]): """Index endpoint methods container.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name def dateindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "dateindex") + return MetricEndpointBuilder(self._client, self._name, 'dateindex') def height(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "height") - + return MetricEndpointBuilder(self._client, self._name, 'height') class MetricPattern5(Generic[T]): """Index accessor for metrics with 2 indexes.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name @@ -1955,31 +1507,27 @@ class MetricPattern5(Generic[T]): def indexes(self) -> List[str]: """Get the list of available indexes.""" - return ["dateindex", "height"] + return ['dateindex', 'height'] def get(self, index: Index) -> Optional[MetricEndpointBuilder[T]]: """Get an endpoint builder for a specific index, if supported.""" - if index == "dateindex": - return self.by.dateindex() - elif index == "height": - return self.by.height() + if index == 'dateindex': return self.by.dateindex() + elif index == 'height': return self.by.height() return None - class _MetricPattern6By(Generic[T]): """Index endpoint methods container.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name def dateindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "dateindex") - + return MetricEndpointBuilder(self._client, self._name, 'dateindex') class MetricPattern6(Generic[T]): """Index accessor for metrics with 1 indexes.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name @@ -1992,29 +1540,26 @@ class MetricPattern6(Generic[T]): def indexes(self) -> List[str]: """Get the list of available indexes.""" - return ["dateindex"] + return ['dateindex'] def get(self, index: Index) -> Optional[MetricEndpointBuilder[T]]: """Get an endpoint builder for a specific index, if supported.""" - if index == "dateindex": - return self.by.dateindex() + if index == 'dateindex': return self.by.dateindex() return None - class _MetricPattern7By(Generic[T]): """Index endpoint methods container.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name def decadeindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "decadeindex") - + return MetricEndpointBuilder(self._client, self._name, 'decadeindex') class MetricPattern7(Generic[T]): """Index accessor for metrics with 1 indexes.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name @@ -2027,29 +1572,26 @@ class MetricPattern7(Generic[T]): def indexes(self) -> List[str]: """Get the list of available indexes.""" - return ["decadeindex"] + return ['decadeindex'] def get(self, index: Index) -> Optional[MetricEndpointBuilder[T]]: """Get an endpoint builder for a specific index, if supported.""" - if index == "decadeindex": - return self.by.decadeindex() + if index == 'decadeindex': return self.by.decadeindex() return None - class _MetricPattern8By(Generic[T]): """Index endpoint methods container.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name def difficultyepoch(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "difficultyepoch") - + return MetricEndpointBuilder(self._client, self._name, 'difficultyepoch') class MetricPattern8(Generic[T]): """Index accessor for metrics with 1 indexes.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name @@ -2062,29 +1604,26 @@ class MetricPattern8(Generic[T]): def indexes(self) -> List[str]: """Get the list of available indexes.""" - return ["difficultyepoch"] + return ['difficultyepoch'] def get(self, index: Index) -> Optional[MetricEndpointBuilder[T]]: """Get an endpoint builder for a specific index, if supported.""" - if index == "difficultyepoch": - return self.by.difficultyepoch() + if index == 'difficultyepoch': return self.by.difficultyepoch() return None - class _MetricPattern9By(Generic[T]): """Index endpoint methods container.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name def emptyoutputindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "emptyoutputindex") - + return MetricEndpointBuilder(self._client, self._name, 'emptyoutputindex') class MetricPattern9(Generic[T]): """Index accessor for metrics with 1 indexes.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name @@ -2097,29 +1636,26 @@ class MetricPattern9(Generic[T]): def indexes(self) -> List[str]: """Get the list of available indexes.""" - return ["emptyoutputindex"] + return ['emptyoutputindex'] def get(self, index: Index) -> Optional[MetricEndpointBuilder[T]]: """Get an endpoint builder for a specific index, if supported.""" - if index == "emptyoutputindex": - return self.by.emptyoutputindex() + if index == 'emptyoutputindex': return self.by.emptyoutputindex() return None - class _MetricPattern10By(Generic[T]): """Index endpoint methods container.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name def halvingepoch(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "halvingepoch") - + return MetricEndpointBuilder(self._client, self._name, 'halvingepoch') class MetricPattern10(Generic[T]): """Index accessor for metrics with 1 indexes.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name @@ -2132,29 +1668,26 @@ class MetricPattern10(Generic[T]): def indexes(self) -> List[str]: """Get the list of available indexes.""" - return ["halvingepoch"] + return ['halvingepoch'] def get(self, index: Index) -> Optional[MetricEndpointBuilder[T]]: """Get an endpoint builder for a specific index, if supported.""" - if index == "halvingepoch": - return self.by.halvingepoch() + if index == 'halvingepoch': return self.by.halvingepoch() return None - class _MetricPattern11By(Generic[T]): """Index endpoint methods container.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name def height(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "height") - + return MetricEndpointBuilder(self._client, self._name, 'height') class MetricPattern11(Generic[T]): """Index accessor for metrics with 1 indexes.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name @@ -2167,29 +1700,26 @@ class MetricPattern11(Generic[T]): def indexes(self) -> List[str]: """Get the list of available indexes.""" - return ["height"] + return ['height'] def get(self, index: Index) -> Optional[MetricEndpointBuilder[T]]: """Get an endpoint builder for a specific index, if supported.""" - if index == "height": - return self.by.height() + if index == 'height': return self.by.height() return None - class _MetricPattern12By(Generic[T]): """Index endpoint methods container.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name def txinindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "txinindex") - + return MetricEndpointBuilder(self._client, self._name, 'txinindex') class MetricPattern12(Generic[T]): """Index accessor for metrics with 1 indexes.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name @@ -2202,29 +1732,26 @@ class MetricPattern12(Generic[T]): def indexes(self) -> List[str]: """Get the list of available indexes.""" - return ["txinindex"] + return ['txinindex'] def get(self, index: Index) -> Optional[MetricEndpointBuilder[T]]: """Get an endpoint builder for a specific index, if supported.""" - if index == "txinindex": - return self.by.txinindex() + if index == 'txinindex': return self.by.txinindex() return None - class _MetricPattern13By(Generic[T]): """Index endpoint methods container.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name def monthindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "monthindex") - + return MetricEndpointBuilder(self._client, self._name, 'monthindex') class MetricPattern13(Generic[T]): """Index accessor for metrics with 1 indexes.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name @@ -2237,29 +1764,26 @@ class MetricPattern13(Generic[T]): def indexes(self) -> List[str]: """Get the list of available indexes.""" - return ["monthindex"] + return ['monthindex'] def get(self, index: Index) -> Optional[MetricEndpointBuilder[T]]: """Get an endpoint builder for a specific index, if supported.""" - if index == "monthindex": - return self.by.monthindex() + if index == 'monthindex': return self.by.monthindex() return None - class _MetricPattern14By(Generic[T]): """Index endpoint methods container.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name def opreturnindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "opreturnindex") - + return MetricEndpointBuilder(self._client, self._name, 'opreturnindex') class MetricPattern14(Generic[T]): """Index accessor for metrics with 1 indexes.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name @@ -2272,29 +1796,26 @@ class MetricPattern14(Generic[T]): def indexes(self) -> List[str]: """Get the list of available indexes.""" - return ["opreturnindex"] + return ['opreturnindex'] def get(self, index: Index) -> Optional[MetricEndpointBuilder[T]]: """Get an endpoint builder for a specific index, if supported.""" - if index == "opreturnindex": - return self.by.opreturnindex() + if index == 'opreturnindex': return self.by.opreturnindex() return None - class _MetricPattern15By(Generic[T]): """Index endpoint methods container.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name def txoutindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "txoutindex") - + return MetricEndpointBuilder(self._client, self._name, 'txoutindex') class MetricPattern15(Generic[T]): """Index accessor for metrics with 1 indexes.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name @@ -2307,29 +1828,26 @@ class MetricPattern15(Generic[T]): def indexes(self) -> List[str]: """Get the list of available indexes.""" - return ["txoutindex"] + return ['txoutindex'] def get(self, index: Index) -> Optional[MetricEndpointBuilder[T]]: """Get an endpoint builder for a specific index, if supported.""" - if index == "txoutindex": - return self.by.txoutindex() + if index == 'txoutindex': return self.by.txoutindex() return None - class _MetricPattern16By(Generic[T]): """Index endpoint methods container.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name def p2aaddressindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "p2aaddressindex") - + return MetricEndpointBuilder(self._client, self._name, 'p2aaddressindex') class MetricPattern16(Generic[T]): """Index accessor for metrics with 1 indexes.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name @@ -2342,29 +1860,26 @@ class MetricPattern16(Generic[T]): def indexes(self) -> List[str]: """Get the list of available indexes.""" - return ["p2aaddressindex"] + return ['p2aaddressindex'] def get(self, index: Index) -> Optional[MetricEndpointBuilder[T]]: """Get an endpoint builder for a specific index, if supported.""" - if index == "p2aaddressindex": - return self.by.p2aaddressindex() + if index == 'p2aaddressindex': return self.by.p2aaddressindex() return None - class _MetricPattern17By(Generic[T]): """Index endpoint methods container.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name def p2msoutputindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "p2msoutputindex") - + return MetricEndpointBuilder(self._client, self._name, 'p2msoutputindex') class MetricPattern17(Generic[T]): """Index accessor for metrics with 1 indexes.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name @@ -2377,29 +1892,26 @@ class MetricPattern17(Generic[T]): def indexes(self) -> List[str]: """Get the list of available indexes.""" - return ["p2msoutputindex"] + return ['p2msoutputindex'] def get(self, index: Index) -> Optional[MetricEndpointBuilder[T]]: """Get an endpoint builder for a specific index, if supported.""" - if index == "p2msoutputindex": - return self.by.p2msoutputindex() + if index == 'p2msoutputindex': return self.by.p2msoutputindex() return None - class _MetricPattern18By(Generic[T]): """Index endpoint methods container.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name def p2pk33addressindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "p2pk33addressindex") - + return MetricEndpointBuilder(self._client, self._name, 'p2pk33addressindex') class MetricPattern18(Generic[T]): """Index accessor for metrics with 1 indexes.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name @@ -2412,29 +1924,26 @@ class MetricPattern18(Generic[T]): def indexes(self) -> List[str]: """Get the list of available indexes.""" - return ["p2pk33addressindex"] + return ['p2pk33addressindex'] def get(self, index: Index) -> Optional[MetricEndpointBuilder[T]]: """Get an endpoint builder for a specific index, if supported.""" - if index == "p2pk33addressindex": - return self.by.p2pk33addressindex() + if index == 'p2pk33addressindex': return self.by.p2pk33addressindex() return None - class _MetricPattern19By(Generic[T]): """Index endpoint methods container.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name def p2pk65addressindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "p2pk65addressindex") - + return MetricEndpointBuilder(self._client, self._name, 'p2pk65addressindex') class MetricPattern19(Generic[T]): """Index accessor for metrics with 1 indexes.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name @@ -2447,29 +1956,26 @@ class MetricPattern19(Generic[T]): def indexes(self) -> List[str]: """Get the list of available indexes.""" - return ["p2pk65addressindex"] + return ['p2pk65addressindex'] def get(self, index: Index) -> Optional[MetricEndpointBuilder[T]]: """Get an endpoint builder for a specific index, if supported.""" - if index == "p2pk65addressindex": - return self.by.p2pk65addressindex() + if index == 'p2pk65addressindex': return self.by.p2pk65addressindex() return None - class _MetricPattern20By(Generic[T]): """Index endpoint methods container.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name def p2pkhaddressindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "p2pkhaddressindex") - + return MetricEndpointBuilder(self._client, self._name, 'p2pkhaddressindex') class MetricPattern20(Generic[T]): """Index accessor for metrics with 1 indexes.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name @@ -2482,29 +1988,26 @@ class MetricPattern20(Generic[T]): def indexes(self) -> List[str]: """Get the list of available indexes.""" - return ["p2pkhaddressindex"] + return ['p2pkhaddressindex'] def get(self, index: Index) -> Optional[MetricEndpointBuilder[T]]: """Get an endpoint builder for a specific index, if supported.""" - if index == "p2pkhaddressindex": - return self.by.p2pkhaddressindex() + if index == 'p2pkhaddressindex': return self.by.p2pkhaddressindex() return None - class _MetricPattern21By(Generic[T]): """Index endpoint methods container.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name def p2shaddressindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "p2shaddressindex") - + return MetricEndpointBuilder(self._client, self._name, 'p2shaddressindex') class MetricPattern21(Generic[T]): """Index accessor for metrics with 1 indexes.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name @@ -2517,29 +2020,26 @@ class MetricPattern21(Generic[T]): def indexes(self) -> List[str]: """Get the list of available indexes.""" - return ["p2shaddressindex"] + return ['p2shaddressindex'] def get(self, index: Index) -> Optional[MetricEndpointBuilder[T]]: """Get an endpoint builder for a specific index, if supported.""" - if index == "p2shaddressindex": - return self.by.p2shaddressindex() + if index == 'p2shaddressindex': return self.by.p2shaddressindex() return None - class _MetricPattern22By(Generic[T]): """Index endpoint methods container.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name def p2traddressindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "p2traddressindex") - + return MetricEndpointBuilder(self._client, self._name, 'p2traddressindex') class MetricPattern22(Generic[T]): """Index accessor for metrics with 1 indexes.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name @@ -2552,29 +2052,26 @@ class MetricPattern22(Generic[T]): def indexes(self) -> List[str]: """Get the list of available indexes.""" - return ["p2traddressindex"] + return ['p2traddressindex'] def get(self, index: Index) -> Optional[MetricEndpointBuilder[T]]: """Get an endpoint builder for a specific index, if supported.""" - if index == "p2traddressindex": - return self.by.p2traddressindex() + if index == 'p2traddressindex': return self.by.p2traddressindex() return None - class _MetricPattern23By(Generic[T]): """Index endpoint methods container.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name def p2wpkhaddressindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "p2wpkhaddressindex") - + return MetricEndpointBuilder(self._client, self._name, 'p2wpkhaddressindex') class MetricPattern23(Generic[T]): """Index accessor for metrics with 1 indexes.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name @@ -2587,29 +2084,26 @@ class MetricPattern23(Generic[T]): def indexes(self) -> List[str]: """Get the list of available indexes.""" - return ["p2wpkhaddressindex"] + return ['p2wpkhaddressindex'] def get(self, index: Index) -> Optional[MetricEndpointBuilder[T]]: """Get an endpoint builder for a specific index, if supported.""" - if index == "p2wpkhaddressindex": - return self.by.p2wpkhaddressindex() + if index == 'p2wpkhaddressindex': return self.by.p2wpkhaddressindex() return None - class _MetricPattern24By(Generic[T]): """Index endpoint methods container.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name def p2wshaddressindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "p2wshaddressindex") - + return MetricEndpointBuilder(self._client, self._name, 'p2wshaddressindex') class MetricPattern24(Generic[T]): """Index accessor for metrics with 1 indexes.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name @@ -2622,29 +2116,26 @@ class MetricPattern24(Generic[T]): def indexes(self) -> List[str]: """Get the list of available indexes.""" - return ["p2wshaddressindex"] + return ['p2wshaddressindex'] def get(self, index: Index) -> Optional[MetricEndpointBuilder[T]]: """Get an endpoint builder for a specific index, if supported.""" - if index == "p2wshaddressindex": - return self.by.p2wshaddressindex() + if index == 'p2wshaddressindex': return self.by.p2wshaddressindex() return None - class _MetricPattern25By(Generic[T]): """Index endpoint methods container.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name def quarterindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "quarterindex") - + return MetricEndpointBuilder(self._client, self._name, 'quarterindex') class MetricPattern25(Generic[T]): """Index accessor for metrics with 1 indexes.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name @@ -2657,29 +2148,26 @@ class MetricPattern25(Generic[T]): def indexes(self) -> List[str]: """Get the list of available indexes.""" - return ["quarterindex"] + return ['quarterindex'] def get(self, index: Index) -> Optional[MetricEndpointBuilder[T]]: """Get an endpoint builder for a specific index, if supported.""" - if index == "quarterindex": - return self.by.quarterindex() + if index == 'quarterindex': return self.by.quarterindex() return None - class _MetricPattern26By(Generic[T]): """Index endpoint methods container.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name def semesterindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "semesterindex") - + return MetricEndpointBuilder(self._client, self._name, 'semesterindex') class MetricPattern26(Generic[T]): """Index accessor for metrics with 1 indexes.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name @@ -2692,29 +2180,26 @@ class MetricPattern26(Generic[T]): def indexes(self) -> List[str]: """Get the list of available indexes.""" - return ["semesterindex"] + return ['semesterindex'] def get(self, index: Index) -> Optional[MetricEndpointBuilder[T]]: """Get an endpoint builder for a specific index, if supported.""" - if index == "semesterindex": - return self.by.semesterindex() + if index == 'semesterindex': return self.by.semesterindex() return None - class _MetricPattern27By(Generic[T]): """Index endpoint methods container.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name def txindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "txindex") - + return MetricEndpointBuilder(self._client, self._name, 'txindex') class MetricPattern27(Generic[T]): """Index accessor for metrics with 1 indexes.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name @@ -2727,29 +2212,26 @@ class MetricPattern27(Generic[T]): def indexes(self) -> List[str]: """Get the list of available indexes.""" - return ["txindex"] + return ['txindex'] def get(self, index: Index) -> Optional[MetricEndpointBuilder[T]]: """Get an endpoint builder for a specific index, if supported.""" - if index == "txindex": - return self.by.txindex() + if index == 'txindex': return self.by.txindex() return None - class _MetricPattern28By(Generic[T]): """Index endpoint methods container.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name def unknownoutputindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "unknownoutputindex") - + return MetricEndpointBuilder(self._client, self._name, 'unknownoutputindex') class MetricPattern28(Generic[T]): """Index accessor for metrics with 1 indexes.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name @@ -2762,29 +2244,26 @@ class MetricPattern28(Generic[T]): def indexes(self) -> List[str]: """Get the list of available indexes.""" - return ["unknownoutputindex"] + return ['unknownoutputindex'] def get(self, index: Index) -> Optional[MetricEndpointBuilder[T]]: """Get an endpoint builder for a specific index, if supported.""" - if index == "unknownoutputindex": - return self.by.unknownoutputindex() + if index == 'unknownoutputindex': return self.by.unknownoutputindex() return None - class _MetricPattern29By(Generic[T]): """Index endpoint methods container.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name def weekindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "weekindex") - + return MetricEndpointBuilder(self._client, self._name, 'weekindex') class MetricPattern29(Generic[T]): """Index accessor for metrics with 1 indexes.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name @@ -2797,29 +2276,26 @@ class MetricPattern29(Generic[T]): def indexes(self) -> List[str]: """Get the list of available indexes.""" - return ["weekindex"] + return ['weekindex'] def get(self, index: Index) -> Optional[MetricEndpointBuilder[T]]: """Get an endpoint builder for a specific index, if supported.""" - if index == "weekindex": - return self.by.weekindex() + if index == 'weekindex': return self.by.weekindex() return None - class _MetricPattern30By(Generic[T]): """Index endpoint methods container.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name def yearindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "yearindex") - + return MetricEndpointBuilder(self._client, self._name, 'yearindex') class MetricPattern30(Generic[T]): """Index accessor for metrics with 1 indexes.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name @@ -2832,29 +2308,26 @@ class MetricPattern30(Generic[T]): def indexes(self) -> List[str]: """Get the list of available indexes.""" - return ["yearindex"] + return ['yearindex'] def get(self, index: Index) -> Optional[MetricEndpointBuilder[T]]: """Get an endpoint builder for a specific index, if supported.""" - if index == "yearindex": - return self.by.yearindex() + if index == 'yearindex': return self.by.yearindex() return None - class _MetricPattern31By(Generic[T]): """Index endpoint methods container.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name def loadedaddressindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "loadedaddressindex") - + return MetricEndpointBuilder(self._client, self._name, 'loadedaddressindex') class MetricPattern31(Generic[T]): """Index accessor for metrics with 1 indexes.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name @@ -2867,29 +2340,26 @@ class MetricPattern31(Generic[T]): def indexes(self) -> List[str]: """Get the list of available indexes.""" - return ["loadedaddressindex"] + return ['loadedaddressindex'] def get(self, index: Index) -> Optional[MetricEndpointBuilder[T]]: """Get an endpoint builder for a specific index, if supported.""" - if index == "loadedaddressindex": - return self.by.loadedaddressindex() + if index == 'loadedaddressindex': return self.by.loadedaddressindex() return None - class _MetricPattern32By(Generic[T]): """Index endpoint methods container.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name def emptyaddressindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "emptyaddressindex") - + return MetricEndpointBuilder(self._client, self._name, 'emptyaddressindex') class MetricPattern32(Generic[T]): """Index accessor for metrics with 1 indexes.""" - + def __init__(self, client: BrkClientBase, name: str): self._client = client self._name = name @@ -2902,1104 +2372,505 @@ class MetricPattern32(Generic[T]): def indexes(self) -> List[str]: """Get the list of available indexes.""" - return ["emptyaddressindex"] + return ['emptyaddressindex'] def get(self, index: Index) -> Optional[MetricEndpointBuilder[T]]: """Get an endpoint builder for a specific index, if supported.""" - if index == "emptyaddressindex": - return self.by.emptyaddressindex() + if index == 'emptyaddressindex': return self.by.emptyaddressindex() return None - # Reusable structural pattern classes - class RealizedPattern3: """Pattern struct for repeated tree structure.""" - + def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.adjusted_sopr: MetricPattern6[StoredF64] = MetricPattern6( - client, _m(acc, "adjusted_sopr") - ) - self.adjusted_sopr_30d_ema: MetricPattern6[StoredF64] = MetricPattern6( - client, _m(acc, "adjusted_sopr_30d_ema") - ) - self.adjusted_sopr_7d_ema: MetricPattern6[StoredF64] = MetricPattern6( - client, _m(acc, "adjusted_sopr_7d_ema") - ) - self.adjusted_value_created: MetricPattern1[Dollars] = MetricPattern1( - client, _m(acc, "adjusted_value_created") - ) - self.adjusted_value_destroyed: MetricPattern1[Dollars] = MetricPattern1( - client, _m(acc, "adjusted_value_destroyed") - ) - self.mvrv: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, "mvrv")) - self.neg_realized_loss: BitcoinPattern[Dollars] = BitcoinPattern( - client, _m(acc, "neg_realized_loss") - ) - self.net_realized_pnl: BlockCountPattern[Dollars] = BlockCountPattern( - client, _m(acc, "net_realized_pnl") - ) - self.net_realized_pnl_cumulative_30d_delta: MetricPattern4[Dollars] = ( - MetricPattern4(client, _m(acc, "net_realized_pnl_cumulative_30d_delta")) - ) - self.net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: MetricPattern4[ - StoredF32 - ] = MetricPattern4( - client, _m(acc, "net_realized_pnl_cumulative_30d_delta_rel_to_market_cap") - ) - self.net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: MetricPattern4[ - StoredF32 - ] = MetricPattern4( - client, _m(acc, "net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap") - ) - self.net_realized_pnl_rel_to_realized_cap: BlockCountPattern[StoredF32] = ( - BlockCountPattern(client, _m(acc, "net_realized_pnl_rel_to_realized_cap")) - ) - self.realized_cap: MetricPattern1[Dollars] = MetricPattern1( - client, _m(acc, "realized_cap") - ) - self.realized_cap_30d_delta: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "realized_cap_30d_delta") - ) - self.realized_cap_rel_to_own_market_cap: MetricPattern1[StoredF32] = ( - MetricPattern1(client, _m(acc, "realized_cap_rel_to_own_market_cap")) - ) - self.realized_loss: BlockCountPattern[Dollars] = BlockCountPattern( - client, _m(acc, "realized_loss") - ) - self.realized_loss_rel_to_realized_cap: BlockCountPattern[StoredF32] = ( - BlockCountPattern(client, _m(acc, "realized_loss_rel_to_realized_cap")) - ) - self.realized_price: MetricPattern1[Dollars] = MetricPattern1( - client, _m(acc, "realized_price") - ) - self.realized_price_extra: ActivePriceRatioPattern = ActivePriceRatioPattern( - client, _m(acc, "realized_price_ratio") - ) - self.realized_profit: BlockCountPattern[Dollars] = BlockCountPattern( - client, _m(acc, "realized_profit") - ) - self.realized_profit_rel_to_realized_cap: BlockCountPattern[StoredF32] = ( - BlockCountPattern(client, _m(acc, "realized_profit_rel_to_realized_cap")) - ) - self.realized_profit_to_loss_ratio: MetricPattern6[StoredF64] = MetricPattern6( - client, _m(acc, "realized_profit_to_loss_ratio") - ) - self.realized_value: MetricPattern1[Dollars] = MetricPattern1( - client, _m(acc, "realized_value") - ) - self.sell_side_risk_ratio: MetricPattern6[StoredF32] = MetricPattern6( - client, _m(acc, "sell_side_risk_ratio") - ) - self.sell_side_risk_ratio_30d_ema: MetricPattern6[StoredF32] = MetricPattern6( - client, _m(acc, "sell_side_risk_ratio_30d_ema") - ) - self.sell_side_risk_ratio_7d_ema: MetricPattern6[StoredF32] = MetricPattern6( - client, _m(acc, "sell_side_risk_ratio_7d_ema") - ) - self.sopr: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, "sopr")) - self.sopr_30d_ema: MetricPattern6[StoredF64] = MetricPattern6( - client, _m(acc, "sopr_30d_ema") - ) - self.sopr_7d_ema: MetricPattern6[StoredF64] = MetricPattern6( - client, _m(acc, "sopr_7d_ema") - ) - self.total_realized_pnl: MetricPattern1[Dollars] = MetricPattern1( - client, _m(acc, "total_realized_pnl") - ) - self.value_created: MetricPattern1[Dollars] = MetricPattern1( - client, _m(acc, "value_created") - ) - self.value_destroyed: MetricPattern1[Dollars] = MetricPattern1( - client, _m(acc, "value_destroyed") - ) - + self.adjusted_sopr: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, 'adjusted_sopr')) + self.adjusted_sopr_30d_ema: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, 'adjusted_sopr_30d_ema')) + self.adjusted_sopr_7d_ema: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, 'adjusted_sopr_7d_ema')) + self.adjusted_value_created: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'adjusted_value_created')) + self.adjusted_value_destroyed: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'adjusted_value_destroyed')) + self.mvrv: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'mvrv')) + self.neg_realized_loss: BitcoinPattern[Dollars] = BitcoinPattern(client, _m(acc, 'neg_realized_loss')) + self.net_realized_pnl: BlockCountPattern[Dollars] = BlockCountPattern(client, _m(acc, 'net_realized_pnl')) + self.net_realized_pnl_cumulative_30d_delta: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta')) + self.net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_market_cap')) + self.net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap')) + self.net_realized_pnl_rel_to_realized_cap: BlockCountPattern[StoredF32] = BlockCountPattern(client, _m(acc, 'net_realized_pnl_rel_to_realized_cap')) + self.realized_cap: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_cap')) + self.realized_cap_30d_delta: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'realized_cap_30d_delta')) + self.realized_cap_rel_to_own_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'realized_cap_rel_to_own_market_cap')) + self.realized_loss: BlockCountPattern[Dollars] = BlockCountPattern(client, _m(acc, 'realized_loss')) + self.realized_loss_rel_to_realized_cap: BlockCountPattern[StoredF32] = BlockCountPattern(client, _m(acc, 'realized_loss_rel_to_realized_cap')) + self.realized_price: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_price')) + self.realized_price_extra: ActivePriceRatioPattern = ActivePriceRatioPattern(client, _m(acc, 'realized_price_ratio')) + self.realized_profit: BlockCountPattern[Dollars] = BlockCountPattern(client, _m(acc, 'realized_profit')) + self.realized_profit_rel_to_realized_cap: BlockCountPattern[StoredF32] = BlockCountPattern(client, _m(acc, 'realized_profit_rel_to_realized_cap')) + self.realized_profit_to_loss_ratio: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, 'realized_profit_to_loss_ratio')) + self.realized_value: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_value')) + self.sell_side_risk_ratio: MetricPattern6[StoredF32] = MetricPattern6(client, _m(acc, 'sell_side_risk_ratio')) + self.sell_side_risk_ratio_30d_ema: MetricPattern6[StoredF32] = MetricPattern6(client, _m(acc, 'sell_side_risk_ratio_30d_ema')) + self.sell_side_risk_ratio_7d_ema: MetricPattern6[StoredF32] = MetricPattern6(client, _m(acc, 'sell_side_risk_ratio_7d_ema')) + self.sopr: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, 'sopr')) + self.sopr_30d_ema: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, 'sopr_30d_ema')) + self.sopr_7d_ema: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, 'sopr_7d_ema')) + self.total_realized_pnl: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'total_realized_pnl')) + self.value_created: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_created')) + self.value_destroyed: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_destroyed')) class RealizedPattern4: """Pattern struct for repeated tree structure.""" - + def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.adjusted_sopr: MetricPattern6[StoredF64] = MetricPattern6( - client, _m(acc, "adjusted_sopr") - ) - self.adjusted_sopr_30d_ema: MetricPattern6[StoredF64] = MetricPattern6( - client, _m(acc, "adjusted_sopr_30d_ema") - ) - self.adjusted_sopr_7d_ema: MetricPattern6[StoredF64] = MetricPattern6( - client, _m(acc, "adjusted_sopr_7d_ema") - ) - self.adjusted_value_created: MetricPattern1[Dollars] = MetricPattern1( - client, _m(acc, "adjusted_value_created") - ) - self.adjusted_value_destroyed: MetricPattern1[Dollars] = MetricPattern1( - client, _m(acc, "adjusted_value_destroyed") - ) - self.mvrv: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, "mvrv")) - self.neg_realized_loss: BitcoinPattern[Dollars] = BitcoinPattern( - client, _m(acc, "neg_realized_loss") - ) - self.net_realized_pnl: BlockCountPattern[Dollars] = BlockCountPattern( - client, _m(acc, "net_realized_pnl") - ) - self.net_realized_pnl_cumulative_30d_delta: MetricPattern4[Dollars] = ( - MetricPattern4(client, _m(acc, "net_realized_pnl_cumulative_30d_delta")) - ) - self.net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: MetricPattern4[ - StoredF32 - ] = MetricPattern4( - client, _m(acc, "net_realized_pnl_cumulative_30d_delta_rel_to_market_cap") - ) - self.net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: MetricPattern4[ - StoredF32 - ] = MetricPattern4( - client, _m(acc, "net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap") - ) - self.net_realized_pnl_rel_to_realized_cap: BlockCountPattern[StoredF32] = ( - BlockCountPattern(client, _m(acc, "net_realized_pnl_rel_to_realized_cap")) - ) - self.realized_cap: MetricPattern1[Dollars] = MetricPattern1( - client, _m(acc, "realized_cap") - ) - self.realized_cap_30d_delta: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "realized_cap_30d_delta") - ) - self.realized_loss: BlockCountPattern[Dollars] = BlockCountPattern( - client, _m(acc, "realized_loss") - ) - self.realized_loss_rel_to_realized_cap: BlockCountPattern[StoredF32] = ( - BlockCountPattern(client, _m(acc, "realized_loss_rel_to_realized_cap")) - ) - self.realized_price: MetricPattern1[Dollars] = MetricPattern1( - client, _m(acc, "realized_price") - ) - self.realized_price_extra: RealizedPriceExtraPattern = ( - RealizedPriceExtraPattern(client, _m(acc, "realized_price")) - ) - self.realized_profit: BlockCountPattern[Dollars] = BlockCountPattern( - client, _m(acc, "realized_profit") - ) - self.realized_profit_rel_to_realized_cap: BlockCountPattern[StoredF32] = ( - BlockCountPattern(client, _m(acc, "realized_profit_rel_to_realized_cap")) - ) - self.realized_value: MetricPattern1[Dollars] = MetricPattern1( - client, _m(acc, "realized_value") - ) - self.sell_side_risk_ratio: MetricPattern6[StoredF32] = MetricPattern6( - client, _m(acc, "sell_side_risk_ratio") - ) - self.sell_side_risk_ratio_30d_ema: MetricPattern6[StoredF32] = MetricPattern6( - client, _m(acc, "sell_side_risk_ratio_30d_ema") - ) - self.sell_side_risk_ratio_7d_ema: MetricPattern6[StoredF32] = MetricPattern6( - client, _m(acc, "sell_side_risk_ratio_7d_ema") - ) - self.sopr: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, "sopr")) - self.sopr_30d_ema: MetricPattern6[StoredF64] = MetricPattern6( - client, _m(acc, "sopr_30d_ema") - ) - self.sopr_7d_ema: MetricPattern6[StoredF64] = MetricPattern6( - client, _m(acc, "sopr_7d_ema") - ) - self.total_realized_pnl: MetricPattern1[Dollars] = MetricPattern1( - client, _m(acc, "total_realized_pnl") - ) - self.value_created: MetricPattern1[Dollars] = MetricPattern1( - client, _m(acc, "value_created") - ) - self.value_destroyed: MetricPattern1[Dollars] = MetricPattern1( - client, _m(acc, "value_destroyed") - ) - + self.adjusted_sopr: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, 'adjusted_sopr')) + self.adjusted_sopr_30d_ema: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, 'adjusted_sopr_30d_ema')) + self.adjusted_sopr_7d_ema: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, 'adjusted_sopr_7d_ema')) + self.adjusted_value_created: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'adjusted_value_created')) + self.adjusted_value_destroyed: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'adjusted_value_destroyed')) + self.mvrv: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'mvrv')) + self.neg_realized_loss: BitcoinPattern[Dollars] = BitcoinPattern(client, _m(acc, 'neg_realized_loss')) + self.net_realized_pnl: BlockCountPattern[Dollars] = BlockCountPattern(client, _m(acc, 'net_realized_pnl')) + self.net_realized_pnl_cumulative_30d_delta: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta')) + self.net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_market_cap')) + self.net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap')) + self.net_realized_pnl_rel_to_realized_cap: BlockCountPattern[StoredF32] = BlockCountPattern(client, _m(acc, 'net_realized_pnl_rel_to_realized_cap')) + self.realized_cap: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_cap')) + self.realized_cap_30d_delta: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'realized_cap_30d_delta')) + self.realized_loss: BlockCountPattern[Dollars] = BlockCountPattern(client, _m(acc, 'realized_loss')) + self.realized_loss_rel_to_realized_cap: BlockCountPattern[StoredF32] = BlockCountPattern(client, _m(acc, 'realized_loss_rel_to_realized_cap')) + self.realized_price: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_price')) + self.realized_price_extra: RealizedPriceExtraPattern = RealizedPriceExtraPattern(client, _m(acc, 'realized_price')) + self.realized_profit: BlockCountPattern[Dollars] = BlockCountPattern(client, _m(acc, 'realized_profit')) + self.realized_profit_rel_to_realized_cap: BlockCountPattern[StoredF32] = BlockCountPattern(client, _m(acc, 'realized_profit_rel_to_realized_cap')) + self.realized_value: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_value')) + self.sell_side_risk_ratio: MetricPattern6[StoredF32] = MetricPattern6(client, _m(acc, 'sell_side_risk_ratio')) + self.sell_side_risk_ratio_30d_ema: MetricPattern6[StoredF32] = MetricPattern6(client, _m(acc, 'sell_side_risk_ratio_30d_ema')) + self.sell_side_risk_ratio_7d_ema: MetricPattern6[StoredF32] = MetricPattern6(client, _m(acc, 'sell_side_risk_ratio_7d_ema')) + self.sopr: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, 'sopr')) + self.sopr_30d_ema: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, 'sopr_30d_ema')) + self.sopr_7d_ema: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, 'sopr_7d_ema')) + self.total_realized_pnl: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'total_realized_pnl')) + self.value_created: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_created')) + self.value_destroyed: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_destroyed')) class Ratio1ySdPattern: """Pattern struct for repeated tree structure.""" - + def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self._0sd_usd: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "0sd_usd") - ) - self.m0_5sd: MetricPattern4[StoredF32] = MetricPattern4( - client, _m(acc, "m0_5sd") - ) - self.m0_5sd_usd: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "m0_5sd_usd") - ) - self.m1_5sd: MetricPattern4[StoredF32] = MetricPattern4( - client, _m(acc, "m1_5sd") - ) - self.m1_5sd_usd: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "m1_5sd_usd") - ) - self.m1sd: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, "m1sd")) - self.m1sd_usd: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "m1sd_usd") - ) - self.m2_5sd: MetricPattern4[StoredF32] = MetricPattern4( - client, _m(acc, "m2_5sd") - ) - self.m2_5sd_usd: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "m2_5sd_usd") - ) - self.m2sd: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, "m2sd")) - self.m2sd_usd: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "m2sd_usd") - ) - self.m3sd: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, "m3sd")) - self.m3sd_usd: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "m3sd_usd") - ) - self.p0_5sd: MetricPattern4[StoredF32] = MetricPattern4( - client, _m(acc, "p0_5sd") - ) - self.p0_5sd_usd: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "p0_5sd_usd") - ) - self.p1_5sd: MetricPattern4[StoredF32] = MetricPattern4( - client, _m(acc, "p1_5sd") - ) - self.p1_5sd_usd: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "p1_5sd_usd") - ) - self.p1sd: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, "p1sd")) - self.p1sd_usd: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "p1sd_usd") - ) - self.p2_5sd: MetricPattern4[StoredF32] = MetricPattern4( - client, _m(acc, "p2_5sd") - ) - self.p2_5sd_usd: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "p2_5sd_usd") - ) - self.p2sd: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, "p2sd")) - self.p2sd_usd: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "p2sd_usd") - ) - self.p3sd: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, "p3sd")) - self.p3sd_usd: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "p3sd_usd") - ) - self.sd: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, "sd")) - self.sma: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, "sma")) - self.zscore: MetricPattern4[StoredF32] = MetricPattern4( - client, _m(acc, "zscore") - ) - + self._0sd_usd: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, '0sd_usd')) + self.m0_5sd: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'm0_5sd')) + self.m0_5sd_usd: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'm0_5sd_usd')) + self.m1_5sd: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'm1_5sd')) + self.m1_5sd_usd: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'm1_5sd_usd')) + self.m1sd: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'm1sd')) + self.m1sd_usd: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'm1sd_usd')) + self.m2_5sd: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'm2_5sd')) + self.m2_5sd_usd: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'm2_5sd_usd')) + self.m2sd: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'm2sd')) + self.m2sd_usd: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'm2sd_usd')) + self.m3sd: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'm3sd')) + self.m3sd_usd: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'm3sd_usd')) + self.p0_5sd: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'p0_5sd')) + self.p0_5sd_usd: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'p0_5sd_usd')) + self.p1_5sd: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'p1_5sd')) + self.p1_5sd_usd: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'p1_5sd_usd')) + self.p1sd: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'p1sd')) + self.p1sd_usd: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'p1sd_usd')) + self.p2_5sd: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'p2_5sd')) + self.p2_5sd_usd: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'p2_5sd_usd')) + self.p2sd: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'p2sd')) + self.p2sd_usd: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'p2sd_usd')) + self.p3sd: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'p3sd')) + self.p3sd_usd: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'p3sd_usd')) + self.sd: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'sd')) + self.sma: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'sma')) + self.zscore: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'zscore')) class RealizedPattern2: """Pattern struct for repeated tree structure.""" - + def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.mvrv: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, "mvrv")) - self.neg_realized_loss: BitcoinPattern[Dollars] = BitcoinPattern( - client, _m(acc, "neg_realized_loss") - ) - self.net_realized_pnl: BlockCountPattern[Dollars] = BlockCountPattern( - client, _m(acc, "net_realized_pnl") - ) - self.net_realized_pnl_cumulative_30d_delta: MetricPattern4[Dollars] = ( - MetricPattern4(client, _m(acc, "net_realized_pnl_cumulative_30d_delta")) - ) - self.net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: MetricPattern4[ - StoredF32 - ] = MetricPattern4( - client, _m(acc, "net_realized_pnl_cumulative_30d_delta_rel_to_market_cap") - ) - self.net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: MetricPattern4[ - StoredF32 - ] = MetricPattern4( - client, _m(acc, "net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap") - ) - self.net_realized_pnl_rel_to_realized_cap: BlockCountPattern[StoredF32] = ( - BlockCountPattern(client, _m(acc, "net_realized_pnl_rel_to_realized_cap")) - ) - self.realized_cap: MetricPattern1[Dollars] = MetricPattern1( - client, _m(acc, "realized_cap") - ) - self.realized_cap_30d_delta: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "realized_cap_30d_delta") - ) - self.realized_cap_rel_to_own_market_cap: MetricPattern1[StoredF32] = ( - MetricPattern1(client, _m(acc, "realized_cap_rel_to_own_market_cap")) - ) - self.realized_loss: BlockCountPattern[Dollars] = BlockCountPattern( - client, _m(acc, "realized_loss") - ) - self.realized_loss_rel_to_realized_cap: BlockCountPattern[StoredF32] = ( - BlockCountPattern(client, _m(acc, "realized_loss_rel_to_realized_cap")) - ) - self.realized_price: MetricPattern1[Dollars] = MetricPattern1( - client, _m(acc, "realized_price") - ) - self.realized_price_extra: ActivePriceRatioPattern = ActivePriceRatioPattern( - client, _m(acc, "realized_price_ratio") - ) - self.realized_profit: BlockCountPattern[Dollars] = BlockCountPattern( - client, _m(acc, "realized_profit") - ) - self.realized_profit_rel_to_realized_cap: BlockCountPattern[StoredF32] = ( - BlockCountPattern(client, _m(acc, "realized_profit_rel_to_realized_cap")) - ) - self.realized_profit_to_loss_ratio: MetricPattern6[StoredF64] = MetricPattern6( - client, _m(acc, "realized_profit_to_loss_ratio") - ) - self.realized_value: MetricPattern1[Dollars] = MetricPattern1( - client, _m(acc, "realized_value") - ) - self.sell_side_risk_ratio: MetricPattern6[StoredF32] = MetricPattern6( - client, _m(acc, "sell_side_risk_ratio") - ) - self.sell_side_risk_ratio_30d_ema: MetricPattern6[StoredF32] = MetricPattern6( - client, _m(acc, "sell_side_risk_ratio_30d_ema") - ) - self.sell_side_risk_ratio_7d_ema: MetricPattern6[StoredF32] = MetricPattern6( - client, _m(acc, "sell_side_risk_ratio_7d_ema") - ) - self.sopr: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, "sopr")) - self.sopr_30d_ema: MetricPattern6[StoredF64] = MetricPattern6( - client, _m(acc, "sopr_30d_ema") - ) - self.sopr_7d_ema: MetricPattern6[StoredF64] = MetricPattern6( - client, _m(acc, "sopr_7d_ema") - ) - self.total_realized_pnl: MetricPattern1[Dollars] = MetricPattern1( - client, _m(acc, "total_realized_pnl") - ) - self.value_created: MetricPattern1[Dollars] = MetricPattern1( - client, _m(acc, "value_created") - ) - self.value_destroyed: MetricPattern1[Dollars] = MetricPattern1( - client, _m(acc, "value_destroyed") - ) - + self.mvrv: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'mvrv')) + self.neg_realized_loss: BitcoinPattern[Dollars] = BitcoinPattern(client, _m(acc, 'neg_realized_loss')) + self.net_realized_pnl: BlockCountPattern[Dollars] = BlockCountPattern(client, _m(acc, 'net_realized_pnl')) + self.net_realized_pnl_cumulative_30d_delta: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta')) + self.net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_market_cap')) + self.net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap')) + self.net_realized_pnl_rel_to_realized_cap: BlockCountPattern[StoredF32] = BlockCountPattern(client, _m(acc, 'net_realized_pnl_rel_to_realized_cap')) + self.realized_cap: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_cap')) + self.realized_cap_30d_delta: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'realized_cap_30d_delta')) + self.realized_cap_rel_to_own_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'realized_cap_rel_to_own_market_cap')) + self.realized_loss: BlockCountPattern[Dollars] = BlockCountPattern(client, _m(acc, 'realized_loss')) + self.realized_loss_rel_to_realized_cap: BlockCountPattern[StoredF32] = BlockCountPattern(client, _m(acc, 'realized_loss_rel_to_realized_cap')) + self.realized_price: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_price')) + self.realized_price_extra: ActivePriceRatioPattern = ActivePriceRatioPattern(client, _m(acc, 'realized_price_ratio')) + self.realized_profit: BlockCountPattern[Dollars] = BlockCountPattern(client, _m(acc, 'realized_profit')) + self.realized_profit_rel_to_realized_cap: BlockCountPattern[StoredF32] = BlockCountPattern(client, _m(acc, 'realized_profit_rel_to_realized_cap')) + self.realized_profit_to_loss_ratio: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, 'realized_profit_to_loss_ratio')) + self.realized_value: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_value')) + self.sell_side_risk_ratio: MetricPattern6[StoredF32] = MetricPattern6(client, _m(acc, 'sell_side_risk_ratio')) + self.sell_side_risk_ratio_30d_ema: MetricPattern6[StoredF32] = MetricPattern6(client, _m(acc, 'sell_side_risk_ratio_30d_ema')) + self.sell_side_risk_ratio_7d_ema: MetricPattern6[StoredF32] = MetricPattern6(client, _m(acc, 'sell_side_risk_ratio_7d_ema')) + self.sopr: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, 'sopr')) + self.sopr_30d_ema: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, 'sopr_30d_ema')) + self.sopr_7d_ema: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, 'sopr_7d_ema')) + self.total_realized_pnl: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'total_realized_pnl')) + self.value_created: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_created')) + self.value_destroyed: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_destroyed')) class RealizedPattern: """Pattern struct for repeated tree structure.""" - + def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.mvrv: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, "mvrv")) - self.neg_realized_loss: BitcoinPattern[Dollars] = BitcoinPattern( - client, _m(acc, "neg_realized_loss") - ) - self.net_realized_pnl: BlockCountPattern[Dollars] = BlockCountPattern( - client, _m(acc, "net_realized_pnl") - ) - self.net_realized_pnl_cumulative_30d_delta: MetricPattern4[Dollars] = ( - MetricPattern4(client, _m(acc, "net_realized_pnl_cumulative_30d_delta")) - ) - self.net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: MetricPattern4[ - StoredF32 - ] = MetricPattern4( - client, _m(acc, "net_realized_pnl_cumulative_30d_delta_rel_to_market_cap") - ) - self.net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: MetricPattern4[ - StoredF32 - ] = MetricPattern4( - client, _m(acc, "net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap") - ) - self.net_realized_pnl_rel_to_realized_cap: BlockCountPattern[StoredF32] = ( - BlockCountPattern(client, _m(acc, "net_realized_pnl_rel_to_realized_cap")) - ) - self.realized_cap: MetricPattern1[Dollars] = MetricPattern1( - client, _m(acc, "realized_cap") - ) - self.realized_cap_30d_delta: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "realized_cap_30d_delta") - ) - self.realized_loss: BlockCountPattern[Dollars] = BlockCountPattern( - client, _m(acc, "realized_loss") - ) - self.realized_loss_rel_to_realized_cap: BlockCountPattern[StoredF32] = ( - BlockCountPattern(client, _m(acc, "realized_loss_rel_to_realized_cap")) - ) - self.realized_price: MetricPattern1[Dollars] = MetricPattern1( - client, _m(acc, "realized_price") - ) - self.realized_price_extra: RealizedPriceExtraPattern = ( - RealizedPriceExtraPattern(client, _m(acc, "realized_price")) - ) - self.realized_profit: BlockCountPattern[Dollars] = BlockCountPattern( - client, _m(acc, "realized_profit") - ) - self.realized_profit_rel_to_realized_cap: BlockCountPattern[StoredF32] = ( - BlockCountPattern(client, _m(acc, "realized_profit_rel_to_realized_cap")) - ) - self.realized_value: MetricPattern1[Dollars] = MetricPattern1( - client, _m(acc, "realized_value") - ) - self.sell_side_risk_ratio: MetricPattern6[StoredF32] = MetricPattern6( - client, _m(acc, "sell_side_risk_ratio") - ) - self.sell_side_risk_ratio_30d_ema: MetricPattern6[StoredF32] = MetricPattern6( - client, _m(acc, "sell_side_risk_ratio_30d_ema") - ) - self.sell_side_risk_ratio_7d_ema: MetricPattern6[StoredF32] = MetricPattern6( - client, _m(acc, "sell_side_risk_ratio_7d_ema") - ) - self.sopr: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, "sopr")) - self.sopr_30d_ema: MetricPattern6[StoredF64] = MetricPattern6( - client, _m(acc, "sopr_30d_ema") - ) - self.sopr_7d_ema: MetricPattern6[StoredF64] = MetricPattern6( - client, _m(acc, "sopr_7d_ema") - ) - self.total_realized_pnl: MetricPattern1[Dollars] = MetricPattern1( - client, _m(acc, "total_realized_pnl") - ) - self.value_created: MetricPattern1[Dollars] = MetricPattern1( - client, _m(acc, "value_created") - ) - self.value_destroyed: MetricPattern1[Dollars] = MetricPattern1( - client, _m(acc, "value_destroyed") - ) - + self.mvrv: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'mvrv')) + self.neg_realized_loss: BitcoinPattern[Dollars] = BitcoinPattern(client, _m(acc, 'neg_realized_loss')) + self.net_realized_pnl: BlockCountPattern[Dollars] = BlockCountPattern(client, _m(acc, 'net_realized_pnl')) + self.net_realized_pnl_cumulative_30d_delta: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta')) + self.net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_market_cap')) + self.net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap')) + self.net_realized_pnl_rel_to_realized_cap: BlockCountPattern[StoredF32] = BlockCountPattern(client, _m(acc, 'net_realized_pnl_rel_to_realized_cap')) + self.realized_cap: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_cap')) + self.realized_cap_30d_delta: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'realized_cap_30d_delta')) + self.realized_loss: BlockCountPattern[Dollars] = BlockCountPattern(client, _m(acc, 'realized_loss')) + self.realized_loss_rel_to_realized_cap: BlockCountPattern[StoredF32] = BlockCountPattern(client, _m(acc, 'realized_loss_rel_to_realized_cap')) + self.realized_price: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_price')) + self.realized_price_extra: RealizedPriceExtraPattern = RealizedPriceExtraPattern(client, _m(acc, 'realized_price')) + self.realized_profit: BlockCountPattern[Dollars] = BlockCountPattern(client, _m(acc, 'realized_profit')) + self.realized_profit_rel_to_realized_cap: BlockCountPattern[StoredF32] = BlockCountPattern(client, _m(acc, 'realized_profit_rel_to_realized_cap')) + self.realized_value: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_value')) + self.sell_side_risk_ratio: MetricPattern6[StoredF32] = MetricPattern6(client, _m(acc, 'sell_side_risk_ratio')) + self.sell_side_risk_ratio_30d_ema: MetricPattern6[StoredF32] = MetricPattern6(client, _m(acc, 'sell_side_risk_ratio_30d_ema')) + self.sell_side_risk_ratio_7d_ema: MetricPattern6[StoredF32] = MetricPattern6(client, _m(acc, 'sell_side_risk_ratio_7d_ema')) + self.sopr: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, 'sopr')) + self.sopr_30d_ema: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, 'sopr_30d_ema')) + self.sopr_7d_ema: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, 'sopr_7d_ema')) + self.total_realized_pnl: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'total_realized_pnl')) + self.value_created: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_created')) + self.value_destroyed: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_destroyed')) class Price111dSmaPattern: """Pattern struct for repeated tree structure.""" - + def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" self.price: MetricPattern4[Dollars] = MetricPattern4(client, acc) - self.ratio: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, "ratio")) - self.ratio_1m_sma: MetricPattern4[StoredF32] = MetricPattern4( - client, _m(acc, "ratio_1m_sma") - ) - self.ratio_1w_sma: MetricPattern4[StoredF32] = MetricPattern4( - client, _m(acc, "ratio_1w_sma") - ) - self.ratio_1y_sd: Ratio1ySdPattern = Ratio1ySdPattern( - client, _m(acc, "ratio_1y") - ) - self.ratio_2y_sd: Ratio1ySdPattern = Ratio1ySdPattern( - client, _m(acc, "ratio_2y") - ) - self.ratio_4y_sd: Ratio1ySdPattern = Ratio1ySdPattern( - client, _m(acc, "ratio_4y") - ) - self.ratio_pct1: MetricPattern4[StoredF32] = MetricPattern4( - client, _m(acc, "ratio_pct1") - ) - self.ratio_pct1_usd: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "ratio_pct1_usd") - ) - self.ratio_pct2: MetricPattern4[StoredF32] = MetricPattern4( - client, _m(acc, "ratio_pct2") - ) - self.ratio_pct2_usd: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "ratio_pct2_usd") - ) - self.ratio_pct5: MetricPattern4[StoredF32] = MetricPattern4( - client, _m(acc, "ratio_pct5") - ) - self.ratio_pct5_usd: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "ratio_pct5_usd") - ) - self.ratio_pct95: MetricPattern4[StoredF32] = MetricPattern4( - client, _m(acc, "ratio_pct95") - ) - self.ratio_pct95_usd: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "ratio_pct95_usd") - ) - self.ratio_pct98: MetricPattern4[StoredF32] = MetricPattern4( - client, _m(acc, "ratio_pct98") - ) - self.ratio_pct98_usd: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "ratio_pct98_usd") - ) - self.ratio_pct99: MetricPattern4[StoredF32] = MetricPattern4( - client, _m(acc, "ratio_pct99") - ) - self.ratio_pct99_usd: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "ratio_pct99_usd") - ) - self.ratio_sd: Ratio1ySdPattern = Ratio1ySdPattern(client, _m(acc, "ratio")) - - -class PercentilesPattern: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.cost_basis_pct05: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "pct05") - ) - self.cost_basis_pct10: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "pct10") - ) - self.cost_basis_pct15: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "pct15") - ) - self.cost_basis_pct20: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "pct20") - ) - self.cost_basis_pct25: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "pct25") - ) - self.cost_basis_pct30: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "pct30") - ) - self.cost_basis_pct35: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "pct35") - ) - self.cost_basis_pct40: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "pct40") - ) - self.cost_basis_pct45: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "pct45") - ) - self.cost_basis_pct50: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "pct50") - ) - self.cost_basis_pct55: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "pct55") - ) - self.cost_basis_pct60: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "pct60") - ) - self.cost_basis_pct65: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "pct65") - ) - self.cost_basis_pct70: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "pct70") - ) - self.cost_basis_pct75: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "pct75") - ) - self.cost_basis_pct80: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "pct80") - ) - self.cost_basis_pct85: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "pct85") - ) - self.cost_basis_pct90: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "pct90") - ) - self.cost_basis_pct95: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "pct95") - ) - + self.ratio: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'ratio')) + self.ratio_1m_sma: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'ratio_1m_sma')) + self.ratio_1w_sma: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'ratio_1w_sma')) + self.ratio_1y_sd: Ratio1ySdPattern = Ratio1ySdPattern(client, _m(acc, 'ratio_1y')) + self.ratio_2y_sd: Ratio1ySdPattern = Ratio1ySdPattern(client, _m(acc, 'ratio_2y')) + self.ratio_4y_sd: Ratio1ySdPattern = Ratio1ySdPattern(client, _m(acc, 'ratio_4y')) + self.ratio_pct1: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'ratio_pct1')) + self.ratio_pct1_usd: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'ratio_pct1_usd')) + self.ratio_pct2: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'ratio_pct2')) + self.ratio_pct2_usd: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'ratio_pct2_usd')) + self.ratio_pct5: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'ratio_pct5')) + self.ratio_pct5_usd: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'ratio_pct5_usd')) + self.ratio_pct95: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'ratio_pct95')) + self.ratio_pct95_usd: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'ratio_pct95_usd')) + self.ratio_pct98: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'ratio_pct98')) + self.ratio_pct98_usd: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'ratio_pct98_usd')) + self.ratio_pct99: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'ratio_pct99')) + self.ratio_pct99_usd: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'ratio_pct99_usd')) + self.ratio_sd: Ratio1ySdPattern = Ratio1ySdPattern(client, _m(acc, 'ratio')) class ActivePriceRatioPattern: """Pattern struct for repeated tree structure.""" - + def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" self.ratio: MetricPattern4[StoredF32] = MetricPattern4(client, acc) - self.ratio_1m_sma: MetricPattern4[StoredF32] = MetricPattern4( - client, _m(acc, "1m_sma") - ) - self.ratio_1w_sma: MetricPattern4[StoredF32] = MetricPattern4( - client, _m(acc, "1w_sma") - ) - self.ratio_1y_sd: Ratio1ySdPattern = Ratio1ySdPattern(client, _m(acc, "1y")) - self.ratio_2y_sd: Ratio1ySdPattern = Ratio1ySdPattern(client, _m(acc, "2y")) - self.ratio_4y_sd: Ratio1ySdPattern = Ratio1ySdPattern(client, _m(acc, "4y")) - self.ratio_pct1: MetricPattern4[StoredF32] = MetricPattern4( - client, _m(acc, "pct1") - ) - self.ratio_pct1_usd: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "pct1_usd") - ) - self.ratio_pct2: MetricPattern4[StoredF32] = MetricPattern4( - client, _m(acc, "pct2") - ) - self.ratio_pct2_usd: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "pct2_usd") - ) - self.ratio_pct5: MetricPattern4[StoredF32] = MetricPattern4( - client, _m(acc, "pct5") - ) - self.ratio_pct5_usd: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "pct5_usd") - ) - self.ratio_pct95: MetricPattern4[StoredF32] = MetricPattern4( - client, _m(acc, "pct95") - ) - self.ratio_pct95_usd: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "pct95_usd") - ) - self.ratio_pct98: MetricPattern4[StoredF32] = MetricPattern4( - client, _m(acc, "pct98") - ) - self.ratio_pct98_usd: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "pct98_usd") - ) - self.ratio_pct99: MetricPattern4[StoredF32] = MetricPattern4( - client, _m(acc, "pct99") - ) - self.ratio_pct99_usd: MetricPattern4[Dollars] = MetricPattern4( - client, _m(acc, "pct99_usd") - ) + self.ratio_1m_sma: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, '1m_sma')) + self.ratio_1w_sma: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, '1w_sma')) + self.ratio_1y_sd: Ratio1ySdPattern = Ratio1ySdPattern(client, _m(acc, '1y')) + self.ratio_2y_sd: Ratio1ySdPattern = Ratio1ySdPattern(client, _m(acc, '2y')) + self.ratio_4y_sd: Ratio1ySdPattern = Ratio1ySdPattern(client, _m(acc, '4y')) + self.ratio_pct1: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'pct1')) + self.ratio_pct1_usd: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'pct1_usd')) + self.ratio_pct2: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'pct2')) + self.ratio_pct2_usd: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'pct2_usd')) + self.ratio_pct5: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'pct5')) + self.ratio_pct5_usd: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'pct5_usd')) + self.ratio_pct95: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'pct95')) + self.ratio_pct95_usd: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'pct95_usd')) + self.ratio_pct98: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'pct98')) + self.ratio_pct98_usd: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'pct98_usd')) + self.ratio_pct99: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'pct99')) + self.ratio_pct99_usd: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'pct99_usd')) self.ratio_sd: Ratio1ySdPattern = Ratio1ySdPattern(client, acc) +class PercentilesPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.cost_basis_pct05: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'pct05')) + self.cost_basis_pct10: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'pct10')) + self.cost_basis_pct15: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'pct15')) + self.cost_basis_pct20: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'pct20')) + self.cost_basis_pct25: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'pct25')) + self.cost_basis_pct30: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'pct30')) + self.cost_basis_pct35: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'pct35')) + self.cost_basis_pct40: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'pct40')) + self.cost_basis_pct45: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'pct45')) + self.cost_basis_pct50: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'pct50')) + self.cost_basis_pct55: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'pct55')) + self.cost_basis_pct60: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'pct60')) + self.cost_basis_pct65: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'pct65')) + self.cost_basis_pct70: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'pct70')) + self.cost_basis_pct75: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'pct75')) + self.cost_basis_pct80: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'pct80')) + self.cost_basis_pct85: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'pct85')) + self.cost_basis_pct90: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'pct90')) + self.cost_basis_pct95: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'pct95')) class RelativePattern5: """Pattern struct for repeated tree structure.""" - + def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.neg_unrealized_loss_rel_to_market_cap: MetricPattern1[StoredF32] = ( - MetricPattern1(client, _m(acc, "neg_unrealized_loss_rel_to_market_cap")) - ) - self.neg_unrealized_loss_rel_to_own_market_cap: MetricPattern1[StoredF32] = ( - MetricPattern1(client, _m(acc, "neg_unrealized_loss_rel_to_own_market_cap")) - ) - self.neg_unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1[ - StoredF32 - ] = MetricPattern1( - client, _m(acc, "neg_unrealized_loss_rel_to_own_total_unrealized_pnl") - ) - self.net_unrealized_pnl_rel_to_market_cap: MetricPattern1[StoredF32] = ( - MetricPattern1(client, _m(acc, "net_unrealized_pnl_rel_to_market_cap")) - ) - self.net_unrealized_pnl_rel_to_own_market_cap: MetricPattern1[StoredF32] = ( - MetricPattern1(client, _m(acc, "net_unrealized_pnl_rel_to_own_market_cap")) - ) - self.net_unrealized_pnl_rel_to_own_total_unrealized_pnl: MetricPattern1[ - StoredF32 - ] = MetricPattern1( - client, _m(acc, "net_unrealized_pnl_rel_to_own_total_unrealized_pnl") - ) - self.nupl: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, "nupl")) - self.supply_in_loss_rel_to_circulating_supply: MetricPattern1[StoredF64] = ( - MetricPattern1(client, _m(acc, "supply_in_loss_rel_to_circulating_supply")) - ) - self.supply_in_loss_rel_to_own_supply: MetricPattern1[StoredF64] = ( - MetricPattern1(client, _m(acc, "supply_in_loss_rel_to_own_supply")) - ) - self.supply_in_profit_rel_to_circulating_supply: MetricPattern1[StoredF64] = ( - MetricPattern1( - client, _m(acc, "supply_in_profit_rel_to_circulating_supply") - ) - ) - self.supply_in_profit_rel_to_own_supply: MetricPattern1[StoredF64] = ( - MetricPattern1(client, _m(acc, "supply_in_profit_rel_to_own_supply")) - ) - self.supply_rel_to_circulating_supply: MetricPattern4[StoredF64] = ( - MetricPattern4(client, _m(acc, "supply_rel_to_circulating_supply")) - ) - self.unrealized_loss_rel_to_market_cap: MetricPattern1[StoredF32] = ( - MetricPattern1(client, _m(acc, "unrealized_loss_rel_to_market_cap")) - ) - self.unrealized_loss_rel_to_own_market_cap: MetricPattern1[StoredF32] = ( - MetricPattern1(client, _m(acc, "unrealized_loss_rel_to_own_market_cap")) - ) - self.unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1[ - StoredF32 - ] = MetricPattern1( - client, _m(acc, "unrealized_loss_rel_to_own_total_unrealized_pnl") - ) - self.unrealized_profit_rel_to_market_cap: MetricPattern1[StoredF32] = ( - MetricPattern1(client, _m(acc, "unrealized_profit_rel_to_market_cap")) - ) - self.unrealized_profit_rel_to_own_market_cap: MetricPattern1[StoredF32] = ( - MetricPattern1(client, _m(acc, "unrealized_profit_rel_to_own_market_cap")) - ) - self.unrealized_profit_rel_to_own_total_unrealized_pnl: MetricPattern1[ - StoredF32 - ] = MetricPattern1( - client, _m(acc, "unrealized_profit_rel_to_own_total_unrealized_pnl") - ) - + self.neg_unrealized_loss_rel_to_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'neg_unrealized_loss_rel_to_market_cap')) + self.neg_unrealized_loss_rel_to_own_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'neg_unrealized_loss_rel_to_own_market_cap')) + self.neg_unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'neg_unrealized_loss_rel_to_own_total_unrealized_pnl')) + self.net_unrealized_pnl_rel_to_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'net_unrealized_pnl_rel_to_market_cap')) + self.net_unrealized_pnl_rel_to_own_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'net_unrealized_pnl_rel_to_own_market_cap')) + self.net_unrealized_pnl_rel_to_own_total_unrealized_pnl: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'net_unrealized_pnl_rel_to_own_total_unrealized_pnl')) + self.nupl: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'nupl')) + self.supply_in_loss_rel_to_circulating_supply: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'supply_in_loss_rel_to_circulating_supply')) + self.supply_in_loss_rel_to_own_supply: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'supply_in_loss_rel_to_own_supply')) + self.supply_in_profit_rel_to_circulating_supply: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'supply_in_profit_rel_to_circulating_supply')) + self.supply_in_profit_rel_to_own_supply: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'supply_in_profit_rel_to_own_supply')) + self.supply_rel_to_circulating_supply: MetricPattern4[StoredF64] = MetricPattern4(client, _m(acc, 'supply_rel_to_circulating_supply')) + self.unrealized_loss_rel_to_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'unrealized_loss_rel_to_market_cap')) + self.unrealized_loss_rel_to_own_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'unrealized_loss_rel_to_own_market_cap')) + self.unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'unrealized_loss_rel_to_own_total_unrealized_pnl')) + self.unrealized_profit_rel_to_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'unrealized_profit_rel_to_market_cap')) + self.unrealized_profit_rel_to_own_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'unrealized_profit_rel_to_own_market_cap')) + self.unrealized_profit_rel_to_own_total_unrealized_pnl: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'unrealized_profit_rel_to_own_total_unrealized_pnl')) class AaopoolPattern: """Pattern struct for repeated tree structure.""" - + def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self._1m_blocks_mined: MetricPattern1[StoredU32] = MetricPattern1( - client, _m(acc, "1m_blocks_mined") - ) - self._1m_dominance: MetricPattern1[StoredF32] = MetricPattern1( - client, _m(acc, "1m_dominance") - ) - self._1w_blocks_mined: MetricPattern1[StoredU32] = MetricPattern1( - client, _m(acc, "1w_blocks_mined") - ) - self._1w_dominance: MetricPattern1[StoredF32] = MetricPattern1( - client, _m(acc, "1w_dominance") - ) - self._1y_blocks_mined: MetricPattern1[StoredU32] = MetricPattern1( - client, _m(acc, "1y_blocks_mined") - ) - self._1y_dominance: MetricPattern1[StoredF32] = MetricPattern1( - client, _m(acc, "1y_dominance") - ) - self._24h_blocks_mined: MetricPattern1[StoredU32] = MetricPattern1( - client, _m(acc, "24h_blocks_mined") - ) - self._24h_dominance: MetricPattern1[StoredF32] = MetricPattern1( - client, _m(acc, "24h_dominance") - ) - self.blocks_mined: BlockCountPattern[StoredU32] = BlockCountPattern( - client, _m(acc, "blocks_mined") - ) - self.coinbase: CoinbasePattern2 = CoinbasePattern2(client, _m(acc, "coinbase")) - self.days_since_block: MetricPattern4[StoredU16] = MetricPattern4( - client, _m(acc, "days_since_block") - ) - self.dominance: MetricPattern1[StoredF32] = MetricPattern1( - client, _m(acc, "dominance") - ) - self.fee: UnclaimedRewardsPattern = UnclaimedRewardsPattern( - client, _m(acc, "fee") - ) - self.subsidy: UnclaimedRewardsPattern = UnclaimedRewardsPattern( - client, _m(acc, "subsidy") - ) - + self._1m_blocks_mined: MetricPattern1[StoredU32] = MetricPattern1(client, _m(acc, '1m_blocks_mined')) + self._1m_dominance: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, '1m_dominance')) + self._1w_blocks_mined: MetricPattern1[StoredU32] = MetricPattern1(client, _m(acc, '1w_blocks_mined')) + self._1w_dominance: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, '1w_dominance')) + self._1y_blocks_mined: MetricPattern1[StoredU32] = MetricPattern1(client, _m(acc, '1y_blocks_mined')) + self._1y_dominance: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, '1y_dominance')) + self._24h_blocks_mined: MetricPattern1[StoredU32] = MetricPattern1(client, _m(acc, '24h_blocks_mined')) + self._24h_dominance: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, '24h_dominance')) + self.blocks_mined: BlockCountPattern[StoredU32] = BlockCountPattern(client, _m(acc, 'blocks_mined')) + self.coinbase: CoinbasePattern2 = CoinbasePattern2(client, _m(acc, 'coinbase')) + self.days_since_block: MetricPattern4[StoredU16] = MetricPattern4(client, _m(acc, 'days_since_block')) + self.dominance: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'dominance')) + self.fee: UnclaimedRewardsPattern = UnclaimedRewardsPattern(client, _m(acc, 'fee')) + self.subsidy: UnclaimedRewardsPattern = UnclaimedRewardsPattern(client, _m(acc, 'subsidy')) class PriceAgoPattern(Generic[T]): """Pattern struct for repeated tree structure.""" - + def __init__(self, client: BrkClientBase, base_path: str): - self._10y: MetricPattern4[T] = MetricPattern4(client, f"{base_path}_10y") - self._1d: MetricPattern4[T] = MetricPattern4(client, f"{base_path}_1d") - self._1m: MetricPattern4[T] = MetricPattern4(client, f"{base_path}_1m") - self._1w: MetricPattern4[T] = MetricPattern4(client, f"{base_path}_1w") - self._1y: MetricPattern4[T] = MetricPattern4(client, f"{base_path}_1y") - self._2y: MetricPattern4[T] = MetricPattern4(client, f"{base_path}_2y") - self._3m: MetricPattern4[T] = MetricPattern4(client, f"{base_path}_3m") - self._3y: MetricPattern4[T] = MetricPattern4(client, f"{base_path}_3y") - self._4y: MetricPattern4[T] = MetricPattern4(client, f"{base_path}_4y") - self._5y: MetricPattern4[T] = MetricPattern4(client, f"{base_path}_5y") - self._6m: MetricPattern4[T] = MetricPattern4(client, f"{base_path}_6m") - self._6y: MetricPattern4[T] = MetricPattern4(client, f"{base_path}_6y") - self._8y: MetricPattern4[T] = MetricPattern4(client, f"{base_path}_8y") - + self._10y: MetricPattern4[T] = MetricPattern4(client, f'{base_path}_10y') + self._1d: MetricPattern4[T] = MetricPattern4(client, f'{base_path}_1d') + self._1m: MetricPattern4[T] = MetricPattern4(client, f'{base_path}_1m') + self._1w: MetricPattern4[T] = MetricPattern4(client, f'{base_path}_1w') + self._1y: MetricPattern4[T] = MetricPattern4(client, f'{base_path}_1y') + self._2y: MetricPattern4[T] = MetricPattern4(client, f'{base_path}_2y') + self._3m: MetricPattern4[T] = MetricPattern4(client, f'{base_path}_3m') + self._3y: MetricPattern4[T] = MetricPattern4(client, f'{base_path}_3y') + self._4y: MetricPattern4[T] = MetricPattern4(client, f'{base_path}_4y') + self._5y: MetricPattern4[T] = MetricPattern4(client, f'{base_path}_5y') + self._6m: MetricPattern4[T] = MetricPattern4(client, f'{base_path}_6m') + self._6y: MetricPattern4[T] = MetricPattern4(client, f'{base_path}_6y') + self._8y: MetricPattern4[T] = MetricPattern4(client, f'{base_path}_8y') class PeriodLumpSumStackPattern: """Pattern struct for repeated tree structure.""" - + def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self._10y: _2015Pattern = _2015Pattern(client, (f"10y_{acc}" if acc else "10y")) - self._1m: _2015Pattern = _2015Pattern(client, (f"1m_{acc}" if acc else "1m")) - self._1w: _2015Pattern = _2015Pattern(client, (f"1w_{acc}" if acc else "1w")) - self._1y: _2015Pattern = _2015Pattern(client, (f"1y_{acc}" if acc else "1y")) - self._2y: _2015Pattern = _2015Pattern(client, (f"2y_{acc}" if acc else "2y")) - self._3m: _2015Pattern = _2015Pattern(client, (f"3m_{acc}" if acc else "3m")) - self._3y: _2015Pattern = _2015Pattern(client, (f"3y_{acc}" if acc else "3y")) - self._4y: _2015Pattern = _2015Pattern(client, (f"4y_{acc}" if acc else "4y")) - self._5y: _2015Pattern = _2015Pattern(client, (f"5y_{acc}" if acc else "5y")) - self._6m: _2015Pattern = _2015Pattern(client, (f"6m_{acc}" if acc else "6m")) - self._6y: _2015Pattern = _2015Pattern(client, (f"6y_{acc}" if acc else "6y")) - self._8y: _2015Pattern = _2015Pattern(client, (f"8y_{acc}" if acc else "8y")) - + self._10y: _2015Pattern = _2015Pattern(client, (f'10y_{acc}' if acc else '10y')) + self._1m: _2015Pattern = _2015Pattern(client, (f'1m_{acc}' if acc else '1m')) + self._1w: _2015Pattern = _2015Pattern(client, (f'1w_{acc}' if acc else '1w')) + self._1y: _2015Pattern = _2015Pattern(client, (f'1y_{acc}' if acc else '1y')) + self._2y: _2015Pattern = _2015Pattern(client, (f'2y_{acc}' if acc else '2y')) + self._3m: _2015Pattern = _2015Pattern(client, (f'3m_{acc}' if acc else '3m')) + self._3y: _2015Pattern = _2015Pattern(client, (f'3y_{acc}' if acc else '3y')) + self._4y: _2015Pattern = _2015Pattern(client, (f'4y_{acc}' if acc else '4y')) + self._5y: _2015Pattern = _2015Pattern(client, (f'5y_{acc}' if acc else '5y')) + self._6m: _2015Pattern = _2015Pattern(client, (f'6m_{acc}' if acc else '6m')) + self._6y: _2015Pattern = _2015Pattern(client, (f'6y_{acc}' if acc else '6y')) + self._8y: _2015Pattern = _2015Pattern(client, (f'8y_{acc}' if acc else '8y')) class PeriodAveragePricePattern(Generic[T]): """Pattern struct for repeated tree structure.""" - + def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self._10y: MetricPattern4[T] = MetricPattern4( - client, (f"10y_{acc}" if acc else "10y") - ) - self._1m: MetricPattern4[T] = MetricPattern4( - client, (f"1m_{acc}" if acc else "1m") - ) - self._1w: MetricPattern4[T] = MetricPattern4( - client, (f"1w_{acc}" if acc else "1w") - ) - self._1y: MetricPattern4[T] = MetricPattern4( - client, (f"1y_{acc}" if acc else "1y") - ) - self._2y: MetricPattern4[T] = MetricPattern4( - client, (f"2y_{acc}" if acc else "2y") - ) - self._3m: MetricPattern4[T] = MetricPattern4( - client, (f"3m_{acc}" if acc else "3m") - ) - self._3y: MetricPattern4[T] = MetricPattern4( - client, (f"3y_{acc}" if acc else "3y") - ) - self._4y: MetricPattern4[T] = MetricPattern4( - client, (f"4y_{acc}" if acc else "4y") - ) - self._5y: MetricPattern4[T] = MetricPattern4( - client, (f"5y_{acc}" if acc else "5y") - ) - self._6m: MetricPattern4[T] = MetricPattern4( - client, (f"6m_{acc}" if acc else "6m") - ) - self._6y: MetricPattern4[T] = MetricPattern4( - client, (f"6y_{acc}" if acc else "6y") - ) - self._8y: MetricPattern4[T] = MetricPattern4( - client, (f"8y_{acc}" if acc else "8y") - ) - - -class ClassAveragePricePattern(Generic[T]): - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, base_path: str): - self._2015: MetricPattern4[T] = MetricPattern4(client, f"{base_path}_2015") - self._2016: MetricPattern4[T] = MetricPattern4(client, f"{base_path}_2016") - self._2017: MetricPattern4[T] = MetricPattern4(client, f"{base_path}_2017") - self._2018: MetricPattern4[T] = MetricPattern4(client, f"{base_path}_2018") - self._2019: MetricPattern4[T] = MetricPattern4(client, f"{base_path}_2019") - self._2020: MetricPattern4[T] = MetricPattern4(client, f"{base_path}_2020") - self._2021: MetricPattern4[T] = MetricPattern4(client, f"{base_path}_2021") - self._2022: MetricPattern4[T] = MetricPattern4(client, f"{base_path}_2022") - self._2023: MetricPattern4[T] = MetricPattern4(client, f"{base_path}_2023") - self._2024: MetricPattern4[T] = MetricPattern4(client, f"{base_path}_2024") - self._2025: MetricPattern4[T] = MetricPattern4(client, f"{base_path}_2025") - - -class DollarsPattern(Generic[T]): - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.average: MetricPattern2[T] = MetricPattern2(client, _m(acc, "average")) - self.base: MetricPattern11[T] = MetricPattern11(client, acc) - self.cumulative: MetricPattern1[T] = MetricPattern1( - client, _m(acc, "cumulative") - ) - self.max: MetricPattern2[T] = MetricPattern2(client, _m(acc, "max")) - self.median: MetricPattern6[T] = MetricPattern6(client, _m(acc, "median")) - self.min: MetricPattern2[T] = MetricPattern2(client, _m(acc, "min")) - self.pct10: MetricPattern6[T] = MetricPattern6(client, _m(acc, "pct10")) - self.pct25: MetricPattern6[T] = MetricPattern6(client, _m(acc, "pct25")) - self.pct75: MetricPattern6[T] = MetricPattern6(client, _m(acc, "pct75")) - self.pct90: MetricPattern6[T] = MetricPattern6(client, _m(acc, "pct90")) - self.sum: MetricPattern2[T] = MetricPattern2(client, _m(acc, "sum")) - + self._10y: MetricPattern4[T] = MetricPattern4(client, (f'10y_{acc}' if acc else '10y')) + self._1m: MetricPattern4[T] = MetricPattern4(client, (f'1m_{acc}' if acc else '1m')) + self._1w: MetricPattern4[T] = MetricPattern4(client, (f'1w_{acc}' if acc else '1w')) + self._1y: MetricPattern4[T] = MetricPattern4(client, (f'1y_{acc}' if acc else '1y')) + self._2y: MetricPattern4[T] = MetricPattern4(client, (f'2y_{acc}' if acc else '2y')) + self._3m: MetricPattern4[T] = MetricPattern4(client, (f'3m_{acc}' if acc else '3m')) + self._3y: MetricPattern4[T] = MetricPattern4(client, (f'3y_{acc}' if acc else '3y')) + self._4y: MetricPattern4[T] = MetricPattern4(client, (f'4y_{acc}' if acc else '4y')) + self._5y: MetricPattern4[T] = MetricPattern4(client, (f'5y_{acc}' if acc else '5y')) + self._6m: MetricPattern4[T] = MetricPattern4(client, (f'6m_{acc}' if acc else '6m')) + self._6y: MetricPattern4[T] = MetricPattern4(client, (f'6y_{acc}' if acc else '6y')) + self._8y: MetricPattern4[T] = MetricPattern4(client, (f'8y_{acc}' if acc else '8y')) class FullnessPattern(Generic[T]): """Pattern struct for repeated tree structure.""" - + def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.average: MetricPattern2[T] = MetricPattern2(client, _m(acc, "average")) + self.average: MetricPattern2[T] = MetricPattern2(client, _m(acc, 'average')) self.base: MetricPattern11[T] = MetricPattern11(client, acc) - self.cumulative: MetricPattern2[T] = MetricPattern2( - client, _m(acc, "cumulative") - ) - self.max: MetricPattern2[T] = MetricPattern2(client, _m(acc, "max")) - self.median: MetricPattern6[T] = MetricPattern6(client, _m(acc, "median")) - self.min: MetricPattern2[T] = MetricPattern2(client, _m(acc, "min")) - self.pct10: MetricPattern6[T] = MetricPattern6(client, _m(acc, "pct10")) - self.pct25: MetricPattern6[T] = MetricPattern6(client, _m(acc, "pct25")) - self.pct75: MetricPattern6[T] = MetricPattern6(client, _m(acc, "pct75")) - self.pct90: MetricPattern6[T] = MetricPattern6(client, _m(acc, "pct90")) - self.sum: MetricPattern2[T] = MetricPattern2(client, _m(acc, "sum")) + self.cumulative: MetricPattern2[T] = MetricPattern2(client, _m(acc, 'cumulative')) + self.max: MetricPattern2[T] = MetricPattern2(client, _m(acc, 'max')) + self.median: MetricPattern6[T] = MetricPattern6(client, _m(acc, 'median')) + self.min: MetricPattern2[T] = MetricPattern2(client, _m(acc, 'min')) + self.pct10: MetricPattern6[T] = MetricPattern6(client, _m(acc, 'pct10')) + self.pct25: MetricPattern6[T] = MetricPattern6(client, _m(acc, 'pct25')) + self.pct75: MetricPattern6[T] = MetricPattern6(client, _m(acc, 'pct75')) + self.pct90: MetricPattern6[T] = MetricPattern6(client, _m(acc, 'pct90')) + self.sum: MetricPattern2[T] = MetricPattern2(client, _m(acc, 'sum')) +class ClassAveragePricePattern(Generic[T]): + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self._2015: MetricPattern4[T] = MetricPattern4(client, f'{base_path}_2015') + self._2016: MetricPattern4[T] = MetricPattern4(client, f'{base_path}_2016') + self._2017: MetricPattern4[T] = MetricPattern4(client, f'{base_path}_2017') + self._2018: MetricPattern4[T] = MetricPattern4(client, f'{base_path}_2018') + self._2019: MetricPattern4[T] = MetricPattern4(client, f'{base_path}_2019') + self._2020: MetricPattern4[T] = MetricPattern4(client, f'{base_path}_2020') + self._2021: MetricPattern4[T] = MetricPattern4(client, f'{base_path}_2021') + self._2022: MetricPattern4[T] = MetricPattern4(client, f'{base_path}_2022') + self._2023: MetricPattern4[T] = MetricPattern4(client, f'{base_path}_2023') + self._2024: MetricPattern4[T] = MetricPattern4(client, f'{base_path}_2024') + self._2025: MetricPattern4[T] = MetricPattern4(client, f'{base_path}_2025') + +class DollarsPattern(Generic[T]): + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.average: MetricPattern2[T] = MetricPattern2(client, _m(acc, 'average')) + self.base: MetricPattern11[T] = MetricPattern11(client, acc) + self.cumulative: MetricPattern1[T] = MetricPattern1(client, _m(acc, 'cumulative')) + self.max: MetricPattern2[T] = MetricPattern2(client, _m(acc, 'max')) + self.median: MetricPattern6[T] = MetricPattern6(client, _m(acc, 'median')) + self.min: MetricPattern2[T] = MetricPattern2(client, _m(acc, 'min')) + self.pct10: MetricPattern6[T] = MetricPattern6(client, _m(acc, 'pct10')) + self.pct25: MetricPattern6[T] = MetricPattern6(client, _m(acc, 'pct25')) + self.pct75: MetricPattern6[T] = MetricPattern6(client, _m(acc, 'pct75')) + self.pct90: MetricPattern6[T] = MetricPattern6(client, _m(acc, 'pct90')) + self.sum: MetricPattern2[T] = MetricPattern2(client, _m(acc, 'sum')) class RelativePattern: """Pattern struct for repeated tree structure.""" - + def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.neg_unrealized_loss_rel_to_market_cap: MetricPattern1[StoredF32] = ( - MetricPattern1(client, _m(acc, "neg_unrealized_loss_rel_to_market_cap")) - ) - self.net_unrealized_pnl_rel_to_market_cap: MetricPattern1[StoredF32] = ( - MetricPattern1(client, _m(acc, "net_unrealized_pnl_rel_to_market_cap")) - ) - self.nupl: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, "nupl")) - self.supply_in_loss_rel_to_circulating_supply: MetricPattern1[StoredF64] = ( - MetricPattern1(client, _m(acc, "supply_in_loss_rel_to_circulating_supply")) - ) - self.supply_in_loss_rel_to_own_supply: MetricPattern1[StoredF64] = ( - MetricPattern1(client, _m(acc, "supply_in_loss_rel_to_own_supply")) - ) - self.supply_in_profit_rel_to_circulating_supply: MetricPattern1[StoredF64] = ( - MetricPattern1( - client, _m(acc, "supply_in_profit_rel_to_circulating_supply") - ) - ) - self.supply_in_profit_rel_to_own_supply: MetricPattern1[StoredF64] = ( - MetricPattern1(client, _m(acc, "supply_in_profit_rel_to_own_supply")) - ) - self.supply_rel_to_circulating_supply: MetricPattern4[StoredF64] = ( - MetricPattern4(client, _m(acc, "supply_rel_to_circulating_supply")) - ) - self.unrealized_loss_rel_to_market_cap: MetricPattern1[StoredF32] = ( - MetricPattern1(client, _m(acc, "unrealized_loss_rel_to_market_cap")) - ) - self.unrealized_profit_rel_to_market_cap: MetricPattern1[StoredF32] = ( - MetricPattern1(client, _m(acc, "unrealized_profit_rel_to_market_cap")) - ) - + self.neg_unrealized_loss_rel_to_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'neg_unrealized_loss_rel_to_market_cap')) + self.net_unrealized_pnl_rel_to_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'net_unrealized_pnl_rel_to_market_cap')) + self.nupl: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'nupl')) + self.supply_in_loss_rel_to_circulating_supply: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'supply_in_loss_rel_to_circulating_supply')) + self.supply_in_loss_rel_to_own_supply: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'supply_in_loss_rel_to_own_supply')) + self.supply_in_profit_rel_to_circulating_supply: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'supply_in_profit_rel_to_circulating_supply')) + self.supply_in_profit_rel_to_own_supply: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'supply_in_profit_rel_to_own_supply')) + self.supply_rel_to_circulating_supply: MetricPattern4[StoredF64] = MetricPattern4(client, _m(acc, 'supply_rel_to_circulating_supply')) + self.unrealized_loss_rel_to_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'unrealized_loss_rel_to_market_cap')) + self.unrealized_profit_rel_to_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'unrealized_profit_rel_to_market_cap')) class RelativePattern2: """Pattern struct for repeated tree structure.""" - + def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.neg_unrealized_loss_rel_to_own_market_cap: MetricPattern1[StoredF32] = ( - MetricPattern1(client, _m(acc, "neg_unrealized_loss_rel_to_own_market_cap")) - ) - self.neg_unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1[ - StoredF32 - ] = MetricPattern1( - client, _m(acc, "neg_unrealized_loss_rel_to_own_total_unrealized_pnl") - ) - self.net_unrealized_pnl_rel_to_own_market_cap: MetricPattern1[StoredF32] = ( - MetricPattern1(client, _m(acc, "net_unrealized_pnl_rel_to_own_market_cap")) - ) - self.net_unrealized_pnl_rel_to_own_total_unrealized_pnl: MetricPattern1[ - StoredF32 - ] = MetricPattern1( - client, _m(acc, "net_unrealized_pnl_rel_to_own_total_unrealized_pnl") - ) - self.supply_in_loss_rel_to_own_supply: MetricPattern1[StoredF64] = ( - MetricPattern1(client, _m(acc, "supply_in_loss_rel_to_own_supply")) - ) - self.supply_in_profit_rel_to_own_supply: MetricPattern1[StoredF64] = ( - MetricPattern1(client, _m(acc, "supply_in_profit_rel_to_own_supply")) - ) - self.unrealized_loss_rel_to_own_market_cap: MetricPattern1[StoredF32] = ( - MetricPattern1(client, _m(acc, "unrealized_loss_rel_to_own_market_cap")) - ) - self.unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1[ - StoredF32 - ] = MetricPattern1( - client, _m(acc, "unrealized_loss_rel_to_own_total_unrealized_pnl") - ) - self.unrealized_profit_rel_to_own_market_cap: MetricPattern1[StoredF32] = ( - MetricPattern1(client, _m(acc, "unrealized_profit_rel_to_own_market_cap")) - ) - self.unrealized_profit_rel_to_own_total_unrealized_pnl: MetricPattern1[ - StoredF32 - ] = MetricPattern1( - client, _m(acc, "unrealized_profit_rel_to_own_total_unrealized_pnl") - ) - + self.neg_unrealized_loss_rel_to_own_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'neg_unrealized_loss_rel_to_own_market_cap')) + self.neg_unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'neg_unrealized_loss_rel_to_own_total_unrealized_pnl')) + self.net_unrealized_pnl_rel_to_own_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'net_unrealized_pnl_rel_to_own_market_cap')) + self.net_unrealized_pnl_rel_to_own_total_unrealized_pnl: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'net_unrealized_pnl_rel_to_own_total_unrealized_pnl')) + self.supply_in_loss_rel_to_own_supply: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'supply_in_loss_rel_to_own_supply')) + self.supply_in_profit_rel_to_own_supply: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'supply_in_profit_rel_to_own_supply')) + self.unrealized_loss_rel_to_own_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'unrealized_loss_rel_to_own_market_cap')) + self.unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'unrealized_loss_rel_to_own_total_unrealized_pnl')) + self.unrealized_profit_rel_to_own_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'unrealized_profit_rel_to_own_market_cap')) + self.unrealized_profit_rel_to_own_total_unrealized_pnl: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'unrealized_profit_rel_to_own_total_unrealized_pnl')) class CountPattern2(Generic[T]): """Pattern struct for repeated tree structure.""" - + def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.average: MetricPattern1[T] = MetricPattern1(client, _m(acc, "average")) - self.cumulative: MetricPattern1[T] = MetricPattern1( - client, _m(acc, "cumulative") - ) - self.max: MetricPattern1[T] = MetricPattern1(client, _m(acc, "max")) - self.median: MetricPattern11[T] = MetricPattern11(client, _m(acc, "median")) - self.min: MetricPattern1[T] = MetricPattern1(client, _m(acc, "min")) - self.pct10: MetricPattern11[T] = MetricPattern11(client, _m(acc, "pct10")) - self.pct25: MetricPattern11[T] = MetricPattern11(client, _m(acc, "pct25")) - self.pct75: MetricPattern11[T] = MetricPattern11(client, _m(acc, "pct75")) - self.pct90: MetricPattern11[T] = MetricPattern11(client, _m(acc, "pct90")) - self.sum: MetricPattern1[T] = MetricPattern1(client, _m(acc, "sum")) - + self.average: MetricPattern1[T] = MetricPattern1(client, _m(acc, 'average')) + self.cumulative: MetricPattern1[T] = MetricPattern1(client, _m(acc, 'cumulative')) + self.max: MetricPattern1[T] = MetricPattern1(client, _m(acc, 'max')) + self.median: MetricPattern11[T] = MetricPattern11(client, _m(acc, 'median')) + self.min: MetricPattern1[T] = MetricPattern1(client, _m(acc, 'min')) + self.pct10: MetricPattern11[T] = MetricPattern11(client, _m(acc, 'pct10')) + self.pct25: MetricPattern11[T] = MetricPattern11(client, _m(acc, 'pct25')) + self.pct75: MetricPattern11[T] = MetricPattern11(client, _m(acc, 'pct75')) + self.pct90: MetricPattern11[T] = MetricPattern11(client, _m(acc, 'pct90')) + self.sum: MetricPattern1[T] = MetricPattern1(client, _m(acc, 'sum')) class AddrCountPattern: """Pattern struct for repeated tree structure.""" - + def __init__(self, client: BrkClientBase, base_path: str): - self.all: MetricPattern1[StoredU64] = MetricPattern1(client, f"{base_path}_all") - self.p2a: MetricPattern1[StoredU64] = MetricPattern1(client, f"{base_path}_p2a") - self.p2pk33: MetricPattern1[StoredU64] = MetricPattern1( - client, f"{base_path}_p2pk33" - ) - self.p2pk65: MetricPattern1[StoredU64] = MetricPattern1( - client, f"{base_path}_p2pk65" - ) - self.p2pkh: MetricPattern1[StoredU64] = MetricPattern1( - client, f"{base_path}_p2pkh" - ) - self.p2sh: MetricPattern1[StoredU64] = MetricPattern1( - client, f"{base_path}_p2sh" - ) - self.p2tr: MetricPattern1[StoredU64] = MetricPattern1( - client, f"{base_path}_p2tr" - ) - self.p2wpkh: MetricPattern1[StoredU64] = MetricPattern1( - client, f"{base_path}_p2wpkh" - ) - self.p2wsh: MetricPattern1[StoredU64] = MetricPattern1( - client, f"{base_path}_p2wsh" - ) - + self.all: MetricPattern1[StoredU64] = MetricPattern1(client, f'{base_path}_all') + self.p2a: MetricPattern1[StoredU64] = MetricPattern1(client, f'{base_path}_p2a') + self.p2pk33: MetricPattern1[StoredU64] = MetricPattern1(client, f'{base_path}_p2pk33') + self.p2pk65: MetricPattern1[StoredU64] = MetricPattern1(client, f'{base_path}_p2pk65') + self.p2pkh: MetricPattern1[StoredU64] = MetricPattern1(client, f'{base_path}_p2pkh') + self.p2sh: MetricPattern1[StoredU64] = MetricPattern1(client, f'{base_path}_p2sh') + self.p2tr: MetricPattern1[StoredU64] = MetricPattern1(client, f'{base_path}_p2tr') + self.p2wpkh: MetricPattern1[StoredU64] = MetricPattern1(client, f'{base_path}_p2wpkh') + self.p2wsh: MetricPattern1[StoredU64] = MetricPattern1(client, f'{base_path}_p2wsh') class FeeRatePattern(Generic[T]): """Pattern struct for repeated tree structure.""" - + def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.average: MetricPattern1[T] = MetricPattern1(client, _m(acc, "average")) - self.max: MetricPattern1[T] = MetricPattern1(client, _m(acc, "max")) - self.median: MetricPattern11[T] = MetricPattern11(client, _m(acc, "median")) - self.min: MetricPattern1[T] = MetricPattern1(client, _m(acc, "min")) - self.pct10: MetricPattern11[T] = MetricPattern11(client, _m(acc, "pct10")) - self.pct25: MetricPattern11[T] = MetricPattern11(client, _m(acc, "pct25")) - self.pct75: MetricPattern11[T] = MetricPattern11(client, _m(acc, "pct75")) - self.pct90: MetricPattern11[T] = MetricPattern11(client, _m(acc, "pct90")) + self.average: MetricPattern1[T] = MetricPattern1(client, _m(acc, 'average')) + self.max: MetricPattern1[T] = MetricPattern1(client, _m(acc, 'max')) + self.median: MetricPattern11[T] = MetricPattern11(client, _m(acc, 'median')) + self.min: MetricPattern1[T] = MetricPattern1(client, _m(acc, 'min')) + self.pct10: MetricPattern11[T] = MetricPattern11(client, _m(acc, 'pct10')) + self.pct25: MetricPattern11[T] = MetricPattern11(client, _m(acc, 'pct25')) + self.pct75: MetricPattern11[T] = MetricPattern11(client, _m(acc, 'pct75')) + self.pct90: MetricPattern11[T] = MetricPattern11(client, _m(acc, 'pct90')) self.txindex: MetricPattern27[T] = MetricPattern27(client, acc) - class _0satsPattern: """Pattern struct for repeated tree structure.""" - + def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" self.activity: ActivityPattern2 = ActivityPattern2(client, acc) - self.addr_count: MetricPattern1[StoredU64] = MetricPattern1( - client, _m(acc, "addr_count") - ) + self.addr_count: MetricPattern1[StoredU64] = MetricPattern1(client, _m(acc, 'addr_count')) self.cost_basis: CostBasisPattern = CostBasisPattern(client, acc) self.outputs: OutputsPattern = OutputsPattern(client, acc) self.realized: RealizedPattern = RealizedPattern(client, acc) self.relative: RelativePattern = RelativePattern(client, acc) - self.supply: SupplyPattern2 = SupplyPattern2(client, _m(acc, "supply")) + self.supply: SupplyPattern2 = SupplyPattern2(client, _m(acc, 'supply')) self.unrealized: UnrealizedPattern = UnrealizedPattern(client, acc) - -class _10yTo12yPattern: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.activity: ActivityPattern2 = ActivityPattern2(client, acc) - self.cost_basis: CostBasisPattern2 = CostBasisPattern2(client, acc) - self.outputs: OutputsPattern = OutputsPattern(client, acc) - self.realized: RealizedPattern2 = RealizedPattern2(client, acc) - self.relative: RelativePattern2 = RelativePattern2(client, acc) - self.supply: SupplyPattern2 = SupplyPattern2(client, _m(acc, "supply")) - self.unrealized: UnrealizedPattern = UnrealizedPattern(client, acc) - - -class _0satsPattern2: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.activity: ActivityPattern2 = ActivityPattern2(client, acc) - self.cost_basis: CostBasisPattern = CostBasisPattern(client, acc) - self.outputs: OutputsPattern = OutputsPattern(client, acc) - self.realized: RealizedPattern = RealizedPattern(client, acc) - self.relative: RelativePattern4 = RelativePattern4(client, _m(acc, "supply_in")) - self.supply: SupplyPattern2 = SupplyPattern2(client, _m(acc, "supply")) - self.unrealized: UnrealizedPattern = UnrealizedPattern(client, acc) - - -class _100btcPattern: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.activity: ActivityPattern2 = ActivityPattern2(client, acc) - self.cost_basis: CostBasisPattern = CostBasisPattern(client, acc) - self.outputs: OutputsPattern = OutputsPattern(client, acc) - self.realized: RealizedPattern = RealizedPattern(client, acc) - self.relative: RelativePattern = RelativePattern(client, acc) - self.supply: SupplyPattern2 = SupplyPattern2(client, _m(acc, "supply")) - self.unrealized: UnrealizedPattern = UnrealizedPattern(client, acc) - - class _10yPattern: """Pattern struct for repeated tree structure.""" - + def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" self.activity: ActivityPattern2 = ActivityPattern2(client, acc) @@ -4007,2836 +2878,1794 @@ class _10yPattern: self.outputs: OutputsPattern = OutputsPattern(client, acc) self.realized: RealizedPattern4 = RealizedPattern4(client, acc) self.relative: RelativePattern = RelativePattern(client, acc) - self.supply: SupplyPattern2 = SupplyPattern2(client, _m(acc, "supply")) + self.supply: SupplyPattern2 = SupplyPattern2(client, _m(acc, 'supply')) self.unrealized: UnrealizedPattern = UnrealizedPattern(client, acc) - -class UnrealizedPattern: +class _10yTo12yPattern: """Pattern struct for repeated tree structure.""" - + def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.neg_unrealized_loss: MetricPattern1[Dollars] = MetricPattern1( - client, _m(acc, "neg_unrealized_loss") - ) - self.net_unrealized_pnl: MetricPattern1[Dollars] = MetricPattern1( - client, _m(acc, "net_unrealized_pnl") - ) - self.supply_in_loss: ActiveSupplyPattern = ActiveSupplyPattern( - client, _m(acc, "supply_in_loss") - ) - self.supply_in_profit: ActiveSupplyPattern = ActiveSupplyPattern( - client, _m(acc, "supply_in_profit") - ) - self.total_unrealized_pnl: MetricPattern1[Dollars] = MetricPattern1( - client, _m(acc, "total_unrealized_pnl") - ) - self.unrealized_loss: MetricPattern1[Dollars] = MetricPattern1( - client, _m(acc, "unrealized_loss") - ) - self.unrealized_profit: MetricPattern1[Dollars] = MetricPattern1( - client, _m(acc, "unrealized_profit") - ) - + self.activity: ActivityPattern2 = ActivityPattern2(client, acc) + self.cost_basis: CostBasisPattern2 = CostBasisPattern2(client, acc) + self.outputs: OutputsPattern = OutputsPattern(client, acc) + self.realized: RealizedPattern2 = RealizedPattern2(client, acc) + self.relative: RelativePattern2 = RelativePattern2(client, acc) + self.supply: SupplyPattern2 = SupplyPattern2(client, _m(acc, 'supply')) + self.unrealized: UnrealizedPattern = UnrealizedPattern(client, acc) class PeriodCagrPattern: """Pattern struct for repeated tree structure.""" - + def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self._10y: MetricPattern4[StoredF32] = MetricPattern4( - client, (f"10y_{acc}" if acc else "10y") - ) - self._2y: MetricPattern4[StoredF32] = MetricPattern4( - client, (f"2y_{acc}" if acc else "2y") - ) - self._3y: MetricPattern4[StoredF32] = MetricPattern4( - client, (f"3y_{acc}" if acc else "3y") - ) - self._4y: MetricPattern4[StoredF32] = MetricPattern4( - client, (f"4y_{acc}" if acc else "4y") - ) - self._5y: MetricPattern4[StoredF32] = MetricPattern4( - client, (f"5y_{acc}" if acc else "5y") - ) - self._6y: MetricPattern4[StoredF32] = MetricPattern4( - client, (f"6y_{acc}" if acc else "6y") - ) - self._8y: MetricPattern4[StoredF32] = MetricPattern4( - client, (f"8y_{acc}" if acc else "8y") - ) + self._10y: MetricPattern4[StoredF32] = MetricPattern4(client, (f'10y_{acc}' if acc else '10y')) + self._2y: MetricPattern4[StoredF32] = MetricPattern4(client, (f'2y_{acc}' if acc else '2y')) + self._3y: MetricPattern4[StoredF32] = MetricPattern4(client, (f'3y_{acc}' if acc else '3y')) + self._4y: MetricPattern4[StoredF32] = MetricPattern4(client, (f'4y_{acc}' if acc else '4y')) + self._5y: MetricPattern4[StoredF32] = MetricPattern4(client, (f'5y_{acc}' if acc else '5y')) + self._6y: MetricPattern4[StoredF32] = MetricPattern4(client, (f'6y_{acc}' if acc else '6y')) + self._8y: MetricPattern4[StoredF32] = MetricPattern4(client, (f'8y_{acc}' if acc else '8y')) +class _100btcPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.activity: ActivityPattern2 = ActivityPattern2(client, acc) + self.cost_basis: CostBasisPattern = CostBasisPattern(client, acc) + self.outputs: OutputsPattern = OutputsPattern(client, acc) + self.realized: RealizedPattern = RealizedPattern(client, acc) + self.relative: RelativePattern = RelativePattern(client, acc) + self.supply: SupplyPattern2 = SupplyPattern2(client, _m(acc, 'supply')) + self.unrealized: UnrealizedPattern = UnrealizedPattern(client, acc) + +class _0satsPattern2: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.activity: ActivityPattern2 = ActivityPattern2(client, acc) + self.cost_basis: CostBasisPattern = CostBasisPattern(client, acc) + self.outputs: OutputsPattern = OutputsPattern(client, acc) + self.realized: RealizedPattern = RealizedPattern(client, acc) + self.relative: RelativePattern4 = RelativePattern4(client, _m(acc, 'supply_in')) + self.supply: SupplyPattern2 = SupplyPattern2(client, _m(acc, 'supply')) + self.unrealized: UnrealizedPattern = UnrealizedPattern(client, acc) + +class UnrealizedPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.neg_unrealized_loss: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'neg_unrealized_loss')) + self.net_unrealized_pnl: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'net_unrealized_pnl')) + self.supply_in_loss: ActiveSupplyPattern = ActiveSupplyPattern(client, _m(acc, 'supply_in_loss')) + self.supply_in_profit: ActiveSupplyPattern = ActiveSupplyPattern(client, _m(acc, 'supply_in_profit')) + self.total_unrealized_pnl: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'total_unrealized_pnl')) + self.unrealized_loss: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'unrealized_loss')) + self.unrealized_profit: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'unrealized_profit')) class ActivityPattern2: """Pattern struct for repeated tree structure.""" - + def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.coinblocks_destroyed: BlockCountPattern[StoredF64] = BlockCountPattern( - client, _m(acc, "coinblocks_destroyed") - ) - self.coindays_destroyed: BlockCountPattern[StoredF64] = BlockCountPattern( - client, _m(acc, "coindays_destroyed") - ) - self.satblocks_destroyed: MetricPattern11[Sats] = MetricPattern11( - client, _m(acc, "satblocks_destroyed") - ) - self.satdays_destroyed: MetricPattern11[Sats] = MetricPattern11( - client, _m(acc, "satdays_destroyed") - ) - self.sent: UnclaimedRewardsPattern = UnclaimedRewardsPattern( - client, _m(acc, "sent") - ) - + self.coinblocks_destroyed: BlockCountPattern[StoredF64] = BlockCountPattern(client, _m(acc, 'coinblocks_destroyed')) + self.coindays_destroyed: BlockCountPattern[StoredF64] = BlockCountPattern(client, _m(acc, 'coindays_destroyed')) + self.satblocks_destroyed: MetricPattern11[Sats] = MetricPattern11(client, _m(acc, 'satblocks_destroyed')) + self.satdays_destroyed: MetricPattern11[Sats] = MetricPattern11(client, _m(acc, 'satdays_destroyed')) + self.sent: UnclaimedRewardsPattern = UnclaimedRewardsPattern(client, _m(acc, 'sent')) class SplitPattern2(Generic[T]): """Pattern struct for repeated tree structure.""" - + def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.close: MetricPattern1[T] = MetricPattern1(client, _m(acc, "close")) - self.high: MetricPattern1[T] = MetricPattern1(client, _m(acc, "high")) - self.low: MetricPattern1[T] = MetricPattern1(client, _m(acc, "low")) - self.open: MetricPattern1[T] = MetricPattern1(client, _m(acc, "open")) - - -class CoinbasePattern2: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.bitcoin: BlockCountPattern[Bitcoin] = BlockCountPattern( - client, _m(acc, "btc") - ) - self.dollars: BlockCountPattern[Dollars] = BlockCountPattern( - client, _m(acc, "usd") - ) - self.sats: BlockCountPattern[Sats] = BlockCountPattern(client, acc) - - -class UnclaimedRewardsPattern: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.bitcoin: BitcoinPattern[Bitcoin] = BitcoinPattern(client, _m(acc, "btc")) - self.dollars: BlockCountPattern[Dollars] = BlockCountPattern( - client, _m(acc, "usd") - ) - self.sats: BlockCountPattern[Sats] = BlockCountPattern(client, acc) - - -class SegwitAdoptionPattern: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.base: MetricPattern11[StoredF32] = MetricPattern11(client, acc) - self.cumulative: MetricPattern2[StoredF32] = MetricPattern2( - client, _m(acc, "cumulative") - ) - self.sum: MetricPattern2[StoredF32] = MetricPattern2(client, _m(acc, "sum")) - - -class CostBasisPattern2: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, base_path: str): - self.max: MetricPattern1[Dollars] = MetricPattern1(client, f"{base_path}_max") - self.min: MetricPattern1[Dollars] = MetricPattern1(client, f"{base_path}_min") - self.percentiles: PercentilesPattern = PercentilesPattern( - client, f"{base_path}_percentiles" - ) - - -class _2015Pattern: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.bitcoin: MetricPattern4[Bitcoin] = MetricPattern4(client, _m(acc, "btc")) - self.dollars: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, "usd")) - self.sats: MetricPattern4[Sats] = MetricPattern4(client, acc) - + self.close: MetricPattern1[T] = MetricPattern1(client, _m(acc, 'close')) + self.high: MetricPattern1[T] = MetricPattern1(client, _m(acc, 'high')) + self.low: MetricPattern1[T] = MetricPattern1(client, _m(acc, 'low')) + self.open: MetricPattern1[T] = MetricPattern1(client, _m(acc, 'open')) class ActiveSupplyPattern: """Pattern struct for repeated tree structure.""" - + def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.bitcoin: MetricPattern1[Bitcoin] = MetricPattern1(client, _m(acc, "btc")) - self.dollars: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, "usd")) + self.bitcoin: MetricPattern1[Bitcoin] = MetricPattern1(client, _m(acc, 'btc')) + self.dollars: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'usd')) self.sats: MetricPattern1[Sats] = MetricPattern1(client, acc) +class _2015Pattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.bitcoin: MetricPattern4[Bitcoin] = MetricPattern4(client, _m(acc, 'btc')) + self.dollars: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'usd')) + self.sats: MetricPattern4[Sats] = MetricPattern4(client, acc) + +class CostBasisPattern2: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.max: MetricPattern1[Dollars] = MetricPattern1(client, f'{base_path}_max') + self.min: MetricPattern1[Dollars] = MetricPattern1(client, f'{base_path}_min') + self.percentiles: PercentilesPattern = PercentilesPattern(client, f'{base_path}_percentiles') + +class SegwitAdoptionPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.base: MetricPattern11[StoredF32] = MetricPattern11(client, acc) + self.cumulative: MetricPattern2[StoredF32] = MetricPattern2(client, _m(acc, 'cumulative')) + self.sum: MetricPattern2[StoredF32] = MetricPattern2(client, _m(acc, 'sum')) + +class CoinbasePattern2: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.bitcoin: BlockCountPattern[Bitcoin] = BlockCountPattern(client, _m(acc, 'btc')) + self.dollars: BlockCountPattern[Dollars] = BlockCountPattern(client, _m(acc, 'usd')) + self.sats: BlockCountPattern[Sats] = BlockCountPattern(client, acc) class CoinbasePattern: """Pattern struct for repeated tree structure.""" - + def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.bitcoin: FullnessPattern[Bitcoin] = FullnessPattern(client, _m(acc, "btc")) - self.dollars: DollarsPattern[Dollars] = DollarsPattern(client, _m(acc, "usd")) + self.bitcoin: FullnessPattern[Bitcoin] = FullnessPattern(client, _m(acc, 'btc')) + self.dollars: DollarsPattern[Dollars] = DollarsPattern(client, _m(acc, 'usd')) self.sats: DollarsPattern[Sats] = DollarsPattern(client, acc) +class UnclaimedRewardsPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.bitcoin: BitcoinPattern[Bitcoin] = BitcoinPattern(client, _m(acc, 'btc')) + self.dollars: BlockCountPattern[Dollars] = BlockCountPattern(client, _m(acc, 'usd')) + self.sats: BlockCountPattern[Sats] = BlockCountPattern(client, acc) class CostBasisPattern: """Pattern struct for repeated tree structure.""" - + def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.max: MetricPattern1[Dollars] = MetricPattern1( - client, _m(acc, "max_cost_basis") - ) - self.min: MetricPattern1[Dollars] = MetricPattern1( - client, _m(acc, "min_cost_basis") - ) - + self.max: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'max_cost_basis')) + self.min: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'min_cost_basis')) class _1dReturns1mSdPattern: """Pattern struct for repeated tree structure.""" - + def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.sd: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, "sd")) - self.sma: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, "sma")) - + self.sd: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'sd')) + self.sma: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'sma')) class SupplyPattern2: """Pattern struct for repeated tree structure.""" - + def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.halved: ActiveSupplyPattern = ActiveSupplyPattern(client, _m(acc, "half")) + self.halved: ActiveSupplyPattern = ActiveSupplyPattern(client, _m(acc, 'half')) self.total: ActiveSupplyPattern = ActiveSupplyPattern(client, acc) - class RelativePattern4: """Pattern struct for repeated tree structure.""" - + def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.supply_in_loss_rel_to_own_supply: MetricPattern1[StoredF64] = ( - MetricPattern1(client, _m(acc, "loss_rel_to_own_supply")) - ) - self.supply_in_profit_rel_to_own_supply: MetricPattern1[StoredF64] = ( - MetricPattern1(client, _m(acc, "profit_rel_to_own_supply")) - ) - + self.supply_in_loss_rel_to_own_supply: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'loss_rel_to_own_supply')) + self.supply_in_profit_rel_to_own_supply: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'profit_rel_to_own_supply')) class SatsPattern(Generic[T]): """Pattern struct for repeated tree structure.""" - + def __init__(self, client: BrkClientBase, base_path: str): - self.ohlc: MetricPattern1[T] = MetricPattern1(client, f"{base_path}_ohlc") - self.split: SplitPattern2[Any] = SplitPattern2(client, f"{base_path}_split") - - -class BitcoinPattern(Generic[T]): - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.cumulative: MetricPattern2[T] = MetricPattern2( - client, _m(acc, "cumulative") - ) - self.sum: MetricPattern1[T] = MetricPattern1(client, acc) - + self.ohlc: MetricPattern1[T] = MetricPattern1(client, f'{base_path}_ohlc') + self.split: SplitPattern2[Any] = SplitPattern2(client, f'{base_path}_split') class BlockCountPattern(Generic[T]): """Pattern struct for repeated tree structure.""" - + def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.cumulative: MetricPattern1[T] = MetricPattern1( - client, _m(acc, "cumulative") - ) + self.cumulative: MetricPattern1[T] = MetricPattern1(client, _m(acc, 'cumulative')) self.sum: MetricPattern1[T] = MetricPattern1(client, acc) - -class RealizedPriceExtraPattern: +class BitcoinPattern(Generic[T]): """Pattern struct for repeated tree structure.""" - + def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.ratio: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, "ratio")) - + self.cumulative: MetricPattern2[T] = MetricPattern2(client, _m(acc, 'cumulative')) + self.sum: MetricPattern1[T] = MetricPattern1(client, acc) class OutputsPattern: """Pattern struct for repeated tree structure.""" - + def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.utxo_count: MetricPattern1[StoredU64] = MetricPattern1( - client, _m(acc, "utxo_count") - ) + self.utxo_count: MetricPattern1[StoredU64] = MetricPattern1(client, _m(acc, 'utxo_count')) +class RealizedPriceExtraPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.ratio: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'ratio')) # Metrics tree classes - class MetricsTree_Addresses: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.first_p2aaddressindex: MetricPattern11[P2AAddressIndex] = MetricPattern11( - client, "first_p2aaddressindex" - ) - self.first_p2pk33addressindex: MetricPattern11[P2PK33AddressIndex] = ( - MetricPattern11(client, "first_p2pk33addressindex") - ) - self.first_p2pk65addressindex: MetricPattern11[P2PK65AddressIndex] = ( - MetricPattern11(client, "first_p2pk65addressindex") - ) - self.first_p2pkhaddressindex: MetricPattern11[P2PKHAddressIndex] = ( - MetricPattern11(client, "first_p2pkhaddressindex") - ) - self.first_p2shaddressindex: MetricPattern11[P2SHAddressIndex] = ( - MetricPattern11(client, "first_p2shaddressindex") - ) - self.first_p2traddressindex: MetricPattern11[P2TRAddressIndex] = ( - MetricPattern11(client, "first_p2traddressindex") - ) - self.first_p2wpkhaddressindex: MetricPattern11[P2WPKHAddressIndex] = ( - MetricPattern11(client, "first_p2wpkhaddressindex") - ) - self.first_p2wshaddressindex: MetricPattern11[P2WSHAddressIndex] = ( - MetricPattern11(client, "first_p2wshaddressindex") - ) - self.p2abytes: MetricPattern16[P2ABytes] = MetricPattern16(client, "p2abytes") - self.p2pk33bytes: MetricPattern18[P2PK33Bytes] = MetricPattern18( - client, "p2pk33bytes" - ) - self.p2pk65bytes: MetricPattern19[P2PK65Bytes] = MetricPattern19( - client, "p2pk65bytes" - ) - self.p2pkhbytes: MetricPattern20[P2PKHBytes] = MetricPattern20( - client, "p2pkhbytes" - ) - self.p2shbytes: MetricPattern21[P2SHBytes] = MetricPattern21( - client, "p2shbytes" - ) - self.p2trbytes: MetricPattern22[P2TRBytes] = MetricPattern22( - client, "p2trbytes" - ) - self.p2wpkhbytes: MetricPattern23[P2WPKHBytes] = MetricPattern23( - client, "p2wpkhbytes" - ) - self.p2wshbytes: MetricPattern24[P2WSHBytes] = MetricPattern24( - client, "p2wshbytes" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.first_p2aaddressindex: MetricPattern11[P2AAddressIndex] = MetricPattern11(client, 'first_p2aaddressindex') + self.first_p2pk33addressindex: MetricPattern11[P2PK33AddressIndex] = MetricPattern11(client, 'first_p2pk33addressindex') + self.first_p2pk65addressindex: MetricPattern11[P2PK65AddressIndex] = MetricPattern11(client, 'first_p2pk65addressindex') + self.first_p2pkhaddressindex: MetricPattern11[P2PKHAddressIndex] = MetricPattern11(client, 'first_p2pkhaddressindex') + self.first_p2shaddressindex: MetricPattern11[P2SHAddressIndex] = MetricPattern11(client, 'first_p2shaddressindex') + self.first_p2traddressindex: MetricPattern11[P2TRAddressIndex] = MetricPattern11(client, 'first_p2traddressindex') + self.first_p2wpkhaddressindex: MetricPattern11[P2WPKHAddressIndex] = MetricPattern11(client, 'first_p2wpkhaddressindex') + self.first_p2wshaddressindex: MetricPattern11[P2WSHAddressIndex] = MetricPattern11(client, 'first_p2wshaddressindex') + self.p2abytes: MetricPattern16[P2ABytes] = MetricPattern16(client, 'p2abytes') + self.p2pk33bytes: MetricPattern18[P2PK33Bytes] = MetricPattern18(client, 'p2pk33bytes') + self.p2pk65bytes: MetricPattern19[P2PK65Bytes] = MetricPattern19(client, 'p2pk65bytes') + self.p2pkhbytes: MetricPattern20[P2PKHBytes] = MetricPattern20(client, 'p2pkhbytes') + self.p2shbytes: MetricPattern21[P2SHBytes] = MetricPattern21(client, 'p2shbytes') + self.p2trbytes: MetricPattern22[P2TRBytes] = MetricPattern22(client, 'p2trbytes') + self.p2wpkhbytes: MetricPattern23[P2WPKHBytes] = MetricPattern23(client, 'p2wpkhbytes') + self.p2wshbytes: MetricPattern24[P2WSHBytes] = MetricPattern24(client, 'p2wshbytes') class MetricsTree_Blocks_Count: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self._1m_block_count: MetricPattern1[StoredU32] = MetricPattern1( - client, "1m_block_count" - ) - self._1m_start: MetricPattern11[Height] = MetricPattern11(client, "1m_start") - self._1w_block_count: MetricPattern1[StoredU32] = MetricPattern1( - client, "1w_block_count" - ) - self._1w_start: MetricPattern11[Height] = MetricPattern11(client, "1w_start") - self._1y_block_count: MetricPattern1[StoredU32] = MetricPattern1( - client, "1y_block_count" - ) - self._1y_start: MetricPattern11[Height] = MetricPattern11(client, "1y_start") - self._24h_block_count: MetricPattern1[StoredU32] = MetricPattern1( - client, "24h_block_count" - ) - self._24h_start: MetricPattern11[Height] = MetricPattern11(client, "24h_start") - self.block_count: BlockCountPattern[StoredU32] = BlockCountPattern( - client, "block_count" - ) - self.block_count_target: MetricPattern4[StoredU64] = MetricPattern4( - client, "block_count_target" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._1m_block_count: MetricPattern1[StoredU32] = MetricPattern1(client, '1m_block_count') + self._1m_start: MetricPattern11[Height] = MetricPattern11(client, '1m_start') + self._1w_block_count: MetricPattern1[StoredU32] = MetricPattern1(client, '1w_block_count') + self._1w_start: MetricPattern11[Height] = MetricPattern11(client, '1w_start') + self._1y_block_count: MetricPattern1[StoredU32] = MetricPattern1(client, '1y_block_count') + self._1y_start: MetricPattern11[Height] = MetricPattern11(client, '1y_start') + self._24h_block_count: MetricPattern1[StoredU32] = MetricPattern1(client, '24h_block_count') + self._24h_start: MetricPattern11[Height] = MetricPattern11(client, '24h_start') + self.block_count: BlockCountPattern[StoredU32] = BlockCountPattern(client, 'block_count') + self.block_count_target: MetricPattern4[StoredU64] = MetricPattern4(client, 'block_count_target') class MetricsTree_Blocks_Difficulty: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.adjustment: MetricPattern1[StoredF32] = MetricPattern1( - client, "difficulty_adjustment" - ) - self.as_hash: MetricPattern1[StoredF32] = MetricPattern1( - client, "difficulty_as_hash" - ) - self.blocks_before_next_adjustment: MetricPattern1[StoredU32] = MetricPattern1( - client, "blocks_before_next_difficulty_adjustment" - ) - self.days_before_next_adjustment: MetricPattern1[StoredF32] = MetricPattern1( - client, "days_before_next_difficulty_adjustment" - ) - self.epoch: MetricPattern4[DifficultyEpoch] = MetricPattern4( - client, "difficultyepoch" - ) - self.raw: MetricPattern1[StoredF64] = MetricPattern1(client, "difficulty") - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.adjustment: MetricPattern1[StoredF32] = MetricPattern1(client, 'difficulty_adjustment') + self.as_hash: MetricPattern1[StoredF32] = MetricPattern1(client, 'difficulty_as_hash') + self.blocks_before_next_adjustment: MetricPattern1[StoredU32] = MetricPattern1(client, 'blocks_before_next_difficulty_adjustment') + self.days_before_next_adjustment: MetricPattern1[StoredF32] = MetricPattern1(client, 'days_before_next_difficulty_adjustment') + self.epoch: MetricPattern4[DifficultyEpoch] = MetricPattern4(client, 'difficultyepoch') + self.raw: MetricPattern1[StoredF64] = MetricPattern1(client, 'difficulty') class MetricsTree_Blocks_Halving: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.blocks_before_next_halving: MetricPattern1[StoredU32] = MetricPattern1( - client, "blocks_before_next_halving" - ) - self.days_before_next_halving: MetricPattern1[StoredF32] = MetricPattern1( - client, "days_before_next_halving" - ) - self.epoch: MetricPattern4[HalvingEpoch] = MetricPattern4( - client, "halvingepoch" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.blocks_before_next_halving: MetricPattern1[StoredU32] = MetricPattern1(client, 'blocks_before_next_halving') + self.days_before_next_halving: MetricPattern1[StoredF32] = MetricPattern1(client, 'days_before_next_halving') + self.epoch: MetricPattern4[HalvingEpoch] = MetricPattern4(client, 'halvingepoch') class MetricsTree_Blocks_Interval: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.average: MetricPattern2[Timestamp] = MetricPattern2( - client, "block_interval_average" - ) - self.base: MetricPattern11[Timestamp] = MetricPattern11( - client, "block_interval" - ) - self.max: MetricPattern2[Timestamp] = MetricPattern2( - client, "block_interval_max" - ) - self.median: MetricPattern6[Timestamp] = MetricPattern6( - client, "block_interval_median" - ) - self.min: MetricPattern2[Timestamp] = MetricPattern2( - client, "block_interval_min" - ) - self.pct10: MetricPattern6[Timestamp] = MetricPattern6( - client, "block_interval_pct10" - ) - self.pct25: MetricPattern6[Timestamp] = MetricPattern6( - client, "block_interval_pct25" - ) - self.pct75: MetricPattern6[Timestamp] = MetricPattern6( - client, "block_interval_pct75" - ) - self.pct90: MetricPattern6[Timestamp] = MetricPattern6( - client, "block_interval_pct90" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.average: MetricPattern2[Timestamp] = MetricPattern2(client, 'block_interval_average') + self.base: MetricPattern11[Timestamp] = MetricPattern11(client, 'block_interval') + self.max: MetricPattern2[Timestamp] = MetricPattern2(client, 'block_interval_max') + self.median: MetricPattern6[Timestamp] = MetricPattern6(client, 'block_interval_median') + self.min: MetricPattern2[Timestamp] = MetricPattern2(client, 'block_interval_min') + self.pct10: MetricPattern6[Timestamp] = MetricPattern6(client, 'block_interval_pct10') + self.pct25: MetricPattern6[Timestamp] = MetricPattern6(client, 'block_interval_pct25') + self.pct75: MetricPattern6[Timestamp] = MetricPattern6(client, 'block_interval_pct75') + self.pct90: MetricPattern6[Timestamp] = MetricPattern6(client, 'block_interval_pct90') class MetricsTree_Blocks_Mining: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.hash_price_phs: MetricPattern1[StoredF32] = MetricPattern1( - client, "hash_price_phs" - ) - self.hash_price_phs_min: MetricPattern1[StoredF32] = MetricPattern1( - client, "hash_price_phs_min" - ) - self.hash_price_rebound: MetricPattern1[StoredF32] = MetricPattern1( - client, "hash_price_rebound" - ) - self.hash_price_ths: MetricPattern1[StoredF32] = MetricPattern1( - client, "hash_price_ths" - ) - self.hash_price_ths_min: MetricPattern1[StoredF32] = MetricPattern1( - client, "hash_price_ths_min" - ) - self.hash_rate: MetricPattern1[StoredF64] = MetricPattern1(client, "hash_rate") - self.hash_rate_1m_sma: MetricPattern4[StoredF32] = MetricPattern4( - client, "hash_rate_1m_sma" - ) - self.hash_rate_1w_sma: MetricPattern4[StoredF64] = MetricPattern4( - client, "hash_rate_1w_sma" - ) - self.hash_rate_1y_sma: MetricPattern4[StoredF32] = MetricPattern4( - client, "hash_rate_1y_sma" - ) - self.hash_rate_2m_sma: MetricPattern4[StoredF32] = MetricPattern4( - client, "hash_rate_2m_sma" - ) - self.hash_value_phs: MetricPattern1[StoredF32] = MetricPattern1( - client, "hash_value_phs" - ) - self.hash_value_phs_min: MetricPattern1[StoredF32] = MetricPattern1( - client, "hash_value_phs_min" - ) - self.hash_value_rebound: MetricPattern1[StoredF32] = MetricPattern1( - client, "hash_value_rebound" - ) - self.hash_value_ths: MetricPattern1[StoredF32] = MetricPattern1( - client, "hash_value_ths" - ) - self.hash_value_ths_min: MetricPattern1[StoredF32] = MetricPattern1( - client, "hash_value_ths_min" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.hash_price_phs: MetricPattern1[StoredF32] = MetricPattern1(client, 'hash_price_phs') + self.hash_price_phs_min: MetricPattern1[StoredF32] = MetricPattern1(client, 'hash_price_phs_min') + self.hash_price_rebound: MetricPattern1[StoredF32] = MetricPattern1(client, 'hash_price_rebound') + self.hash_price_ths: MetricPattern1[StoredF32] = MetricPattern1(client, 'hash_price_ths') + self.hash_price_ths_min: MetricPattern1[StoredF32] = MetricPattern1(client, 'hash_price_ths_min') + self.hash_rate: MetricPattern1[StoredF64] = MetricPattern1(client, 'hash_rate') + self.hash_rate_1m_sma: MetricPattern4[StoredF32] = MetricPattern4(client, 'hash_rate_1m_sma') + self.hash_rate_1w_sma: MetricPattern4[StoredF64] = MetricPattern4(client, 'hash_rate_1w_sma') + self.hash_rate_1y_sma: MetricPattern4[StoredF32] = MetricPattern4(client, 'hash_rate_1y_sma') + self.hash_rate_2m_sma: MetricPattern4[StoredF32] = MetricPattern4(client, 'hash_rate_2m_sma') + self.hash_value_phs: MetricPattern1[StoredF32] = MetricPattern1(client, 'hash_value_phs') + self.hash_value_phs_min: MetricPattern1[StoredF32] = MetricPattern1(client, 'hash_value_phs_min') + self.hash_value_rebound: MetricPattern1[StoredF32] = MetricPattern1(client, 'hash_value_rebound') + self.hash_value_ths: MetricPattern1[StoredF32] = MetricPattern1(client, 'hash_value_ths') + self.hash_value_ths_min: MetricPattern1[StoredF32] = MetricPattern1(client, 'hash_value_ths_min') class MetricsTree_Blocks_Rewards_24hCoinbaseSum: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.bitcoin: MetricPattern11[Bitcoin] = MetricPattern11( - client, "24h_coinbase_sum_btc" - ) - self.dollars: MetricPattern11[Dollars] = MetricPattern11( - client, "24h_coinbase_sum_usd" - ) - self.sats: MetricPattern11[Sats] = MetricPattern11(client, "24h_coinbase_sum") - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.bitcoin: MetricPattern11[Bitcoin] = MetricPattern11(client, '24h_coinbase_sum_btc') + self.dollars: MetricPattern11[Dollars] = MetricPattern11(client, '24h_coinbase_sum_usd') + self.sats: MetricPattern11[Sats] = MetricPattern11(client, '24h_coinbase_sum') class MetricsTree_Blocks_Rewards: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self._24h_coinbase_sum: MetricsTree_Blocks_Rewards_24hCoinbaseSum = ( - MetricsTree_Blocks_Rewards_24hCoinbaseSum(client) - ) - self.coinbase: CoinbasePattern = CoinbasePattern(client, "coinbase") - self.fee_dominance: MetricPattern6[StoredF32] = MetricPattern6( - client, "fee_dominance" - ) - self.subsidy: CoinbasePattern = CoinbasePattern(client, "subsidy") - self.subsidy_dominance: MetricPattern6[StoredF32] = MetricPattern6( - client, "subsidy_dominance" - ) - self.subsidy_usd_1y_sma: MetricPattern4[Dollars] = MetricPattern4( - client, "subsidy_usd_1y_sma" - ) - self.unclaimed_rewards: UnclaimedRewardsPattern = UnclaimedRewardsPattern( - client, "unclaimed_rewards" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._24h_coinbase_sum: MetricsTree_Blocks_Rewards_24hCoinbaseSum = MetricsTree_Blocks_Rewards_24hCoinbaseSum(client) + self.coinbase: CoinbasePattern = CoinbasePattern(client, 'coinbase') + self.fee_dominance: MetricPattern6[StoredF32] = MetricPattern6(client, 'fee_dominance') + self.subsidy: CoinbasePattern = CoinbasePattern(client, 'subsidy') + self.subsidy_dominance: MetricPattern6[StoredF32] = MetricPattern6(client, 'subsidy_dominance') + self.subsidy_usd_1y_sma: MetricPattern4[Dollars] = MetricPattern4(client, 'subsidy_usd_1y_sma') + self.unclaimed_rewards: UnclaimedRewardsPattern = UnclaimedRewardsPattern(client, 'unclaimed_rewards') class MetricsTree_Blocks_Size: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.average: MetricPattern2[StoredU64] = MetricPattern2( - client, "block_size_average" - ) - self.cumulative: MetricPattern1[StoredU64] = MetricPattern1( - client, "block_size_cumulative" - ) - self.max: MetricPattern2[StoredU64] = MetricPattern2(client, "block_size_max") - self.median: MetricPattern6[StoredU64] = MetricPattern6( - client, "block_size_median" - ) - self.min: MetricPattern2[StoredU64] = MetricPattern2(client, "block_size_min") - self.pct10: MetricPattern6[StoredU64] = MetricPattern6( - client, "block_size_pct10" - ) - self.pct25: MetricPattern6[StoredU64] = MetricPattern6( - client, "block_size_pct25" - ) - self.pct75: MetricPattern6[StoredU64] = MetricPattern6( - client, "block_size_pct75" - ) - self.pct90: MetricPattern6[StoredU64] = MetricPattern6( - client, "block_size_pct90" - ) - self.sum: MetricPattern2[StoredU64] = MetricPattern2(client, "block_size_sum") - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.average: MetricPattern2[StoredU64] = MetricPattern2(client, 'block_size_average') + self.cumulative: MetricPattern1[StoredU64] = MetricPattern1(client, 'block_size_cumulative') + self.max: MetricPattern2[StoredU64] = MetricPattern2(client, 'block_size_max') + self.median: MetricPattern6[StoredU64] = MetricPattern6(client, 'block_size_median') + self.min: MetricPattern2[StoredU64] = MetricPattern2(client, 'block_size_min') + self.pct10: MetricPattern6[StoredU64] = MetricPattern6(client, 'block_size_pct10') + self.pct25: MetricPattern6[StoredU64] = MetricPattern6(client, 'block_size_pct25') + self.pct75: MetricPattern6[StoredU64] = MetricPattern6(client, 'block_size_pct75') + self.pct90: MetricPattern6[StoredU64] = MetricPattern6(client, 'block_size_pct90') + self.sum: MetricPattern2[StoredU64] = MetricPattern2(client, 'block_size_sum') class MetricsTree_Blocks_Time: """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.date: MetricPattern11[Date] = MetricPattern11(client, 'date') + self.date_fixed: MetricPattern11[Date] = MetricPattern11(client, 'date_fixed') + self.timestamp: MetricPattern1[Timestamp] = MetricPattern1(client, 'timestamp') + self.timestamp_fixed: MetricPattern11[Timestamp] = MetricPattern11(client, 'timestamp_fixed') - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.date: MetricPattern11[Date] = MetricPattern11(client, "date") - self.date_fixed: MetricPattern11[Date] = MetricPattern11(client, "date_fixed") - self.timestamp: MetricPattern1[Timestamp] = MetricPattern1(client, "timestamp") - self.timestamp_fixed: MetricPattern11[Timestamp] = MetricPattern11( - client, "timestamp_fixed" - ) - +class MetricsTree_Blocks_Weight: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.average: MetricPattern2[Weight] = MetricPattern2(client, 'block_weight_average') + self.base: MetricPattern11[Weight] = MetricPattern11(client, 'weight') + self.cumulative: MetricPattern1[Weight] = MetricPattern1(client, 'block_weight_cumulative') + self.max: MetricPattern2[Weight] = MetricPattern2(client, 'block_weight_max') + self.median: MetricPattern6[Weight] = MetricPattern6(client, 'block_weight_median') + self.min: MetricPattern2[Weight] = MetricPattern2(client, 'block_weight_min') + self.pct10: MetricPattern6[Weight] = MetricPattern6(client, 'block_weight_pct10') + self.pct25: MetricPattern6[Weight] = MetricPattern6(client, 'block_weight_pct25') + self.pct75: MetricPattern6[Weight] = MetricPattern6(client, 'block_weight_pct75') + self.pct90: MetricPattern6[Weight] = MetricPattern6(client, 'block_weight_pct90') + self.sum: MetricPattern2[Weight] = MetricPattern2(client, 'block_weight_sum') class MetricsTree_Blocks: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.blockhash: MetricPattern11[BlockHash] = MetricPattern11( - client, "blockhash" - ) + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.blockhash: MetricPattern11[BlockHash] = MetricPattern11(client, 'blockhash') self.count: MetricsTree_Blocks_Count = MetricsTree_Blocks_Count(client) - self.difficulty: MetricsTree_Blocks_Difficulty = MetricsTree_Blocks_Difficulty( - client - ) - self.fullness: FullnessPattern[StoredF32] = FullnessPattern( - client, "block_fullness" - ) + self.difficulty: MetricsTree_Blocks_Difficulty = MetricsTree_Blocks_Difficulty(client) + self.fullness: FullnessPattern[StoredF32] = FullnessPattern(client, 'block_fullness') self.halving: MetricsTree_Blocks_Halving = MetricsTree_Blocks_Halving(client) self.interval: MetricsTree_Blocks_Interval = MetricsTree_Blocks_Interval(client) self.mining: MetricsTree_Blocks_Mining = MetricsTree_Blocks_Mining(client) self.rewards: MetricsTree_Blocks_Rewards = MetricsTree_Blocks_Rewards(client) self.size: MetricsTree_Blocks_Size = MetricsTree_Blocks_Size(client) self.time: MetricsTree_Blocks_Time = MetricsTree_Blocks_Time(client) - self.total_size: MetricPattern11[StoredU64] = MetricPattern11( - client, "total_size" - ) - self.vbytes: DollarsPattern[StoredU64] = DollarsPattern(client, "block_vbytes") - self.weight: DollarsPattern[Weight] = DollarsPattern( - client, "block_weight_average" - ) - + self.total_size: MetricPattern11[StoredU64] = MetricPattern11(client, 'total_size') + self.vbytes: DollarsPattern[StoredU64] = DollarsPattern(client, 'block_vbytes') + self.weight: MetricsTree_Blocks_Weight = MetricsTree_Blocks_Weight(client) class MetricsTree_Cointime_Activity: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.activity_to_vaultedness_ratio: MetricPattern1[StoredF64] = MetricPattern1( - client, "activity_to_vaultedness_ratio" - ) - self.coinblocks_created: BlockCountPattern[StoredF64] = BlockCountPattern( - client, "coinblocks_created" - ) - self.coinblocks_stored: BlockCountPattern[StoredF64] = BlockCountPattern( - client, "coinblocks_stored" - ) - self.liveliness: MetricPattern1[StoredF64] = MetricPattern1( - client, "liveliness" - ) - self.vaultedness: MetricPattern1[StoredF64] = MetricPattern1( - client, "vaultedness" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.activity_to_vaultedness_ratio: MetricPattern1[StoredF64] = MetricPattern1(client, 'activity_to_vaultedness_ratio') + self.coinblocks_created: BlockCountPattern[StoredF64] = BlockCountPattern(client, 'coinblocks_created') + self.coinblocks_stored: BlockCountPattern[StoredF64] = BlockCountPattern(client, 'coinblocks_stored') + self.liveliness: MetricPattern1[StoredF64] = MetricPattern1(client, 'liveliness') + self.vaultedness: MetricPattern1[StoredF64] = MetricPattern1(client, 'vaultedness') class MetricsTree_Cointime_Adjusted: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.cointime_adj_inflation_rate: MetricPattern4[StoredF32] = MetricPattern4( - client, "cointime_adj_inflation_rate" - ) - self.cointime_adj_tx_btc_velocity: MetricPattern4[StoredF64] = MetricPattern4( - client, "cointime_adj_tx_btc_velocity" - ) - self.cointime_adj_tx_usd_velocity: MetricPattern4[StoredF64] = MetricPattern4( - client, "cointime_adj_tx_usd_velocity" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.cointime_adj_inflation_rate: MetricPattern4[StoredF32] = MetricPattern4(client, 'cointime_adj_inflation_rate') + self.cointime_adj_tx_btc_velocity: MetricPattern4[StoredF64] = MetricPattern4(client, 'cointime_adj_tx_btc_velocity') + self.cointime_adj_tx_usd_velocity: MetricPattern4[StoredF64] = MetricPattern4(client, 'cointime_adj_tx_usd_velocity') class MetricsTree_Cointime_Cap: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.active_cap: MetricPattern1[Dollars] = MetricPattern1(client, "active_cap") - self.cointime_cap: MetricPattern1[Dollars] = MetricPattern1( - client, "cointime_cap" - ) - self.investor_cap: MetricPattern1[Dollars] = MetricPattern1( - client, "investor_cap" - ) - self.thermo_cap: MetricPattern1[Dollars] = MetricPattern1(client, "thermo_cap") - self.vaulted_cap: MetricPattern1[Dollars] = MetricPattern1( - client, "vaulted_cap" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.active_cap: MetricPattern1[Dollars] = MetricPattern1(client, 'active_cap') + self.cointime_cap: MetricPattern1[Dollars] = MetricPattern1(client, 'cointime_cap') + self.investor_cap: MetricPattern1[Dollars] = MetricPattern1(client, 'investor_cap') + self.thermo_cap: MetricPattern1[Dollars] = MetricPattern1(client, 'thermo_cap') + self.vaulted_cap: MetricPattern1[Dollars] = MetricPattern1(client, 'vaulted_cap') class MetricsTree_Cointime_Pricing: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.active_price: MetricPattern1[Dollars] = MetricPattern1( - client, "active_price" - ) - self.active_price_ratio: ActivePriceRatioPattern = ActivePriceRatioPattern( - client, "active_price_ratio" - ) - self.cointime_price: MetricPattern1[Dollars] = MetricPattern1( - client, "cointime_price" - ) - self.cointime_price_ratio: ActivePriceRatioPattern = ActivePriceRatioPattern( - client, "cointime_price_ratio" - ) - self.true_market_mean: MetricPattern1[Dollars] = MetricPattern1( - client, "true_market_mean" - ) - self.true_market_mean_ratio: ActivePriceRatioPattern = ActivePriceRatioPattern( - client, "true_market_mean_ratio" - ) - self.vaulted_price: MetricPattern1[Dollars] = MetricPattern1( - client, "vaulted_price" - ) - self.vaulted_price_ratio: ActivePriceRatioPattern = ActivePriceRatioPattern( - client, "vaulted_price_ratio" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.active_price: MetricPattern1[Dollars] = MetricPattern1(client, 'active_price') + self.active_price_ratio: ActivePriceRatioPattern = ActivePriceRatioPattern(client, 'active_price_ratio') + self.cointime_price: MetricPattern1[Dollars] = MetricPattern1(client, 'cointime_price') + self.cointime_price_ratio: ActivePriceRatioPattern = ActivePriceRatioPattern(client, 'cointime_price_ratio') + self.true_market_mean: MetricPattern1[Dollars] = MetricPattern1(client, 'true_market_mean') + self.true_market_mean_ratio: ActivePriceRatioPattern = ActivePriceRatioPattern(client, 'true_market_mean_ratio') + self.vaulted_price: MetricPattern1[Dollars] = MetricPattern1(client, 'vaulted_price') + self.vaulted_price_ratio: ActivePriceRatioPattern = ActivePriceRatioPattern(client, 'vaulted_price_ratio') class MetricsTree_Cointime_Supply: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.active_supply: ActiveSupplyPattern = ActiveSupplyPattern( - client, "active_supply" - ) - self.vaulted_supply: ActiveSupplyPattern = ActiveSupplyPattern( - client, "vaulted_supply" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.active_supply: ActiveSupplyPattern = ActiveSupplyPattern(client, 'active_supply') + self.vaulted_supply: ActiveSupplyPattern = ActiveSupplyPattern(client, 'vaulted_supply') class MetricsTree_Cointime_Value: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.cointime_value_created: BlockCountPattern[StoredF64] = BlockCountPattern( - client, "cointime_value_created" - ) - self.cointime_value_destroyed: BlockCountPattern[StoredF64] = BlockCountPattern( - client, "cointime_value_destroyed" - ) - self.cointime_value_stored: BlockCountPattern[StoredF64] = BlockCountPattern( - client, "cointime_value_stored" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.cointime_value_created: BlockCountPattern[StoredF64] = BlockCountPattern(client, 'cointime_value_created') + self.cointime_value_destroyed: BlockCountPattern[StoredF64] = BlockCountPattern(client, 'cointime_value_destroyed') + self.cointime_value_stored: BlockCountPattern[StoredF64] = BlockCountPattern(client, 'cointime_value_stored') class MetricsTree_Cointime: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.activity: MetricsTree_Cointime_Activity = MetricsTree_Cointime_Activity( - client - ) - self.adjusted: MetricsTree_Cointime_Adjusted = MetricsTree_Cointime_Adjusted( - client - ) + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.activity: MetricsTree_Cointime_Activity = MetricsTree_Cointime_Activity(client) + self.adjusted: MetricsTree_Cointime_Adjusted = MetricsTree_Cointime_Adjusted(client) self.cap: MetricsTree_Cointime_Cap = MetricsTree_Cointime_Cap(client) - self.pricing: MetricsTree_Cointime_Pricing = MetricsTree_Cointime_Pricing( - client - ) + self.pricing: MetricsTree_Cointime_Pricing = MetricsTree_Cointime_Pricing(client) self.supply: MetricsTree_Cointime_Supply = MetricsTree_Cointime_Supply(client) self.value: MetricsTree_Cointime_Value = MetricsTree_Cointime_Value(client) - class MetricsTree_Constants: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.constant_0: MetricPattern1[StoredU16] = MetricPattern1( - client, "constant_0" - ) - self.constant_1: MetricPattern1[StoredU16] = MetricPattern1( - client, "constant_1" - ) - self.constant_100: MetricPattern1[StoredU16] = MetricPattern1( - client, "constant_100" - ) - self.constant_2: MetricPattern1[StoredU16] = MetricPattern1( - client, "constant_2" - ) - self.constant_20: MetricPattern1[StoredU16] = MetricPattern1( - client, "constant_20" - ) - self.constant_3: MetricPattern1[StoredU16] = MetricPattern1( - client, "constant_3" - ) - self.constant_30: MetricPattern1[StoredU16] = MetricPattern1( - client, "constant_30" - ) - self.constant_38_2: MetricPattern1[StoredF32] = MetricPattern1( - client, "constant_38_2" - ) - self.constant_4: MetricPattern1[StoredU16] = MetricPattern1( - client, "constant_4" - ) - self.constant_50: MetricPattern1[StoredU16] = MetricPattern1( - client, "constant_50" - ) - self.constant_600: MetricPattern1[StoredU16] = MetricPattern1( - client, "constant_600" - ) - self.constant_61_8: MetricPattern1[StoredF32] = MetricPattern1( - client, "constant_61_8" - ) - self.constant_70: MetricPattern1[StoredU16] = MetricPattern1( - client, "constant_70" - ) - self.constant_80: MetricPattern1[StoredU16] = MetricPattern1( - client, "constant_80" - ) - self.constant_minus_1: MetricPattern1[StoredI16] = MetricPattern1( - client, "constant_minus_1" - ) - self.constant_minus_2: MetricPattern1[StoredI16] = MetricPattern1( - client, "constant_minus_2" - ) - self.constant_minus_3: MetricPattern1[StoredI16] = MetricPattern1( - client, "constant_minus_3" - ) - self.constant_minus_4: MetricPattern1[StoredI16] = MetricPattern1( - client, "constant_minus_4" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.constant_0: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_0') + self.constant_1: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_1') + self.constant_100: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_100') + self.constant_2: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_2') + self.constant_20: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_20') + self.constant_3: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_3') + self.constant_30: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_30') + self.constant_38_2: MetricPattern1[StoredF32] = MetricPattern1(client, 'constant_38_2') + self.constant_4: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_4') + self.constant_50: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_50') + self.constant_600: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_600') + self.constant_61_8: MetricPattern1[StoredF32] = MetricPattern1(client, 'constant_61_8') + self.constant_70: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_70') + self.constant_80: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_80') + self.constant_minus_1: MetricPattern1[StoredI16] = MetricPattern1(client, 'constant_minus_1') + self.constant_minus_2: MetricPattern1[StoredI16] = MetricPattern1(client, 'constant_minus_2') + self.constant_minus_3: MetricPattern1[StoredI16] = MetricPattern1(client, 'constant_minus_3') + self.constant_minus_4: MetricPattern1[StoredI16] = MetricPattern1(client, 'constant_minus_4') class MetricsTree_Distribution_AddrCount: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.all: MetricPattern1[StoredU64] = MetricPattern1(client, "addr_count") - self.p2a: MetricPattern1[StoredU64] = MetricPattern1(client, "p2a_addr_count") - self.p2pk33: MetricPattern1[StoredU64] = MetricPattern1( - client, "p2pk33_addr_count" - ) - self.p2pk65: MetricPattern1[StoredU64] = MetricPattern1( - client, "p2pk65_addr_count" - ) - self.p2pkh: MetricPattern1[StoredU64] = MetricPattern1( - client, "p2pkh_addr_count" - ) - self.p2sh: MetricPattern1[StoredU64] = MetricPattern1(client, "p2sh_addr_count") - self.p2tr: MetricPattern1[StoredU64] = MetricPattern1(client, "p2tr_addr_count") - self.p2wpkh: MetricPattern1[StoredU64] = MetricPattern1( - client, "p2wpkh_addr_count" - ) - self.p2wsh: MetricPattern1[StoredU64] = MetricPattern1( - client, "p2wsh_addr_count" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.all: MetricPattern1[StoredU64] = MetricPattern1(client, 'addr_count') + self.p2a: MetricPattern1[StoredU64] = MetricPattern1(client, 'p2a_addr_count') + self.p2pk33: MetricPattern1[StoredU64] = MetricPattern1(client, 'p2pk33_addr_count') + self.p2pk65: MetricPattern1[StoredU64] = MetricPattern1(client, 'p2pk65_addr_count') + self.p2pkh: MetricPattern1[StoredU64] = MetricPattern1(client, 'p2pkh_addr_count') + self.p2sh: MetricPattern1[StoredU64] = MetricPattern1(client, 'p2sh_addr_count') + self.p2tr: MetricPattern1[StoredU64] = MetricPattern1(client, 'p2tr_addr_count') + self.p2wpkh: MetricPattern1[StoredU64] = MetricPattern1(client, 'p2wpkh_addr_count') + self.p2wsh: MetricPattern1[StoredU64] = MetricPattern1(client, 'p2wsh_addr_count') class MetricsTree_Distribution_AddressCohorts_AmountRange: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self._0sats: _0satsPattern = _0satsPattern(client, "addrs_with_0sats") - self._100btc_to_1k_btc: _0satsPattern = _0satsPattern( - client, "addrs_above_100btc_under_1k_btc" - ) - self._100k_btc_or_more: _0satsPattern = _0satsPattern( - client, "addrs_above_100k_btc" - ) - self._100k_sats_to_1m_sats: _0satsPattern = _0satsPattern( - client, "addrs_above_100k_sats_under_1m_sats" - ) - self._100sats_to_1k_sats: _0satsPattern = _0satsPattern( - client, "addrs_above_100sats_under_1k_sats" - ) - self._10btc_to_100btc: _0satsPattern = _0satsPattern( - client, "addrs_above_10btc_under_100btc" - ) - self._10k_btc_to_100k_btc: _0satsPattern = _0satsPattern( - client, "addrs_above_10k_btc_under_100k_btc" - ) - self._10k_sats_to_100k_sats: _0satsPattern = _0satsPattern( - client, "addrs_above_10k_sats_under_100k_sats" - ) - self._10m_sats_to_1btc: _0satsPattern = _0satsPattern( - client, "addrs_above_10m_sats_under_1btc" - ) - self._10sats_to_100sats: _0satsPattern = _0satsPattern( - client, "addrs_above_10sats_under_100sats" - ) - self._1btc_to_10btc: _0satsPattern = _0satsPattern( - client, "addrs_above_1btc_under_10btc" - ) - self._1k_btc_to_10k_btc: _0satsPattern = _0satsPattern( - client, "addrs_above_1k_btc_under_10k_btc" - ) - self._1k_sats_to_10k_sats: _0satsPattern = _0satsPattern( - client, "addrs_above_1k_sats_under_10k_sats" - ) - self._1m_sats_to_10m_sats: _0satsPattern = _0satsPattern( - client, "addrs_above_1m_sats_under_10m_sats" - ) - self._1sat_to_10sats: _0satsPattern = _0satsPattern( - client, "addrs_above_1sat_under_10sats" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._0sats: _0satsPattern = _0satsPattern(client, 'addrs_with_0sats') + self._100btc_to_1k_btc: _0satsPattern = _0satsPattern(client, 'addrs_above_100btc_under_1k_btc') + self._100k_btc_or_more: _0satsPattern = _0satsPattern(client, 'addrs_above_100k_btc') + self._100k_sats_to_1m_sats: _0satsPattern = _0satsPattern(client, 'addrs_above_100k_sats_under_1m_sats') + self._100sats_to_1k_sats: _0satsPattern = _0satsPattern(client, 'addrs_above_100sats_under_1k_sats') + self._10btc_to_100btc: _0satsPattern = _0satsPattern(client, 'addrs_above_10btc_under_100btc') + self._10k_btc_to_100k_btc: _0satsPattern = _0satsPattern(client, 'addrs_above_10k_btc_under_100k_btc') + self._10k_sats_to_100k_sats: _0satsPattern = _0satsPattern(client, 'addrs_above_10k_sats_under_100k_sats') + self._10m_sats_to_1btc: _0satsPattern = _0satsPattern(client, 'addrs_above_10m_sats_under_1btc') + self._10sats_to_100sats: _0satsPattern = _0satsPattern(client, 'addrs_above_10sats_under_100sats') + self._1btc_to_10btc: _0satsPattern = _0satsPattern(client, 'addrs_above_1btc_under_10btc') + self._1k_btc_to_10k_btc: _0satsPattern = _0satsPattern(client, 'addrs_above_1k_btc_under_10k_btc') + self._1k_sats_to_10k_sats: _0satsPattern = _0satsPattern(client, 'addrs_above_1k_sats_under_10k_sats') + self._1m_sats_to_10m_sats: _0satsPattern = _0satsPattern(client, 'addrs_above_1m_sats_under_10m_sats') + self._1sat_to_10sats: _0satsPattern = _0satsPattern(client, 'addrs_above_1sat_under_10sats') class MetricsTree_Distribution_AddressCohorts_GeAmount: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self._100btc: _0satsPattern = _0satsPattern(client, "addrs_above_100btc") - self._100k_sats: _0satsPattern = _0satsPattern(client, "addrs_above_100k_sats") - self._100sats: _0satsPattern = _0satsPattern(client, "addrs_above_100sats") - self._10btc: _0satsPattern = _0satsPattern(client, "addrs_above_10btc") - self._10k_btc: _0satsPattern = _0satsPattern(client, "addrs_above_10k_btc") - self._10k_sats: _0satsPattern = _0satsPattern(client, "addrs_above_10k_sats") - self._10m_sats: _0satsPattern = _0satsPattern(client, "addrs_above_10m_sats") - self._10sats: _0satsPattern = _0satsPattern(client, "addrs_above_10sats") - self._1btc: _0satsPattern = _0satsPattern(client, "addrs_above_1btc") - self._1k_btc: _0satsPattern = _0satsPattern(client, "addrs_above_1k_btc") - self._1k_sats: _0satsPattern = _0satsPattern(client, "addrs_above_1k_sats") - self._1m_sats: _0satsPattern = _0satsPattern(client, "addrs_above_1m_sats") - self._1sat: _0satsPattern = _0satsPattern(client, "addrs_above_1sat") - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._100btc: _0satsPattern = _0satsPattern(client, 'addrs_above_100btc') + self._100k_sats: _0satsPattern = _0satsPattern(client, 'addrs_above_100k_sats') + self._100sats: _0satsPattern = _0satsPattern(client, 'addrs_above_100sats') + self._10btc: _0satsPattern = _0satsPattern(client, 'addrs_above_10btc') + self._10k_btc: _0satsPattern = _0satsPattern(client, 'addrs_above_10k_btc') + self._10k_sats: _0satsPattern = _0satsPattern(client, 'addrs_above_10k_sats') + self._10m_sats: _0satsPattern = _0satsPattern(client, 'addrs_above_10m_sats') + self._10sats: _0satsPattern = _0satsPattern(client, 'addrs_above_10sats') + self._1btc: _0satsPattern = _0satsPattern(client, 'addrs_above_1btc') + self._1k_btc: _0satsPattern = _0satsPattern(client, 'addrs_above_1k_btc') + self._1k_sats: _0satsPattern = _0satsPattern(client, 'addrs_above_1k_sats') + self._1m_sats: _0satsPattern = _0satsPattern(client, 'addrs_above_1m_sats') + self._1sat: _0satsPattern = _0satsPattern(client, 'addrs_above_1sat') class MetricsTree_Distribution_AddressCohorts_LtAmount: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self._100btc: _0satsPattern = _0satsPattern(client, "addrs_under_100btc") - self._100k_btc: _0satsPattern = _0satsPattern(client, "addrs_under_100k_btc") - self._100k_sats: _0satsPattern = _0satsPattern(client, "addrs_under_100k_sats") - self._100sats: _0satsPattern = _0satsPattern(client, "addrs_under_100sats") - self._10btc: _0satsPattern = _0satsPattern(client, "addrs_under_10btc") - self._10k_btc: _0satsPattern = _0satsPattern(client, "addrs_under_10k_btc") - self._10k_sats: _0satsPattern = _0satsPattern(client, "addrs_under_10k_sats") - self._10m_sats: _0satsPattern = _0satsPattern(client, "addrs_under_10m_sats") - self._10sats: _0satsPattern = _0satsPattern(client, "addrs_under_10sats") - self._1btc: _0satsPattern = _0satsPattern(client, "addrs_under_1btc") - self._1k_btc: _0satsPattern = _0satsPattern(client, "addrs_under_1k_btc") - self._1k_sats: _0satsPattern = _0satsPattern(client, "addrs_under_1k_sats") - self._1m_sats: _0satsPattern = _0satsPattern(client, "addrs_under_1m_sats") - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._100btc: _0satsPattern = _0satsPattern(client, 'addrs_under_100btc') + self._100k_btc: _0satsPattern = _0satsPattern(client, 'addrs_under_100k_btc') + self._100k_sats: _0satsPattern = _0satsPattern(client, 'addrs_under_100k_sats') + self._100sats: _0satsPattern = _0satsPattern(client, 'addrs_under_100sats') + self._10btc: _0satsPattern = _0satsPattern(client, 'addrs_under_10btc') + self._10k_btc: _0satsPattern = _0satsPattern(client, 'addrs_under_10k_btc') + self._10k_sats: _0satsPattern = _0satsPattern(client, 'addrs_under_10k_sats') + self._10m_sats: _0satsPattern = _0satsPattern(client, 'addrs_under_10m_sats') + self._10sats: _0satsPattern = _0satsPattern(client, 'addrs_under_10sats') + self._1btc: _0satsPattern = _0satsPattern(client, 'addrs_under_1btc') + self._1k_btc: _0satsPattern = _0satsPattern(client, 'addrs_under_1k_btc') + self._1k_sats: _0satsPattern = _0satsPattern(client, 'addrs_under_1k_sats') + self._1m_sats: _0satsPattern = _0satsPattern(client, 'addrs_under_1m_sats') class MetricsTree_Distribution_AddressCohorts: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.amount_range: MetricsTree_Distribution_AddressCohorts_AmountRange = ( - MetricsTree_Distribution_AddressCohorts_AmountRange(client) - ) - self.ge_amount: MetricsTree_Distribution_AddressCohorts_GeAmount = ( - MetricsTree_Distribution_AddressCohorts_GeAmount(client) - ) - self.lt_amount: MetricsTree_Distribution_AddressCohorts_LtAmount = ( - MetricsTree_Distribution_AddressCohorts_LtAmount(client) - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.amount_range: MetricsTree_Distribution_AddressCohorts_AmountRange = MetricsTree_Distribution_AddressCohorts_AmountRange(client) + self.ge_amount: MetricsTree_Distribution_AddressCohorts_GeAmount = MetricsTree_Distribution_AddressCohorts_GeAmount(client) + self.lt_amount: MetricsTree_Distribution_AddressCohorts_LtAmount = MetricsTree_Distribution_AddressCohorts_LtAmount(client) class MetricsTree_Distribution_AddressesData: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.empty: MetricPattern32[EmptyAddressData] = MetricPattern32( - client, "emptyaddressdata" - ) - self.loaded: MetricPattern31[LoadedAddressData] = MetricPattern31( - client, "loadedaddressdata" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.empty: MetricPattern32[EmptyAddressData] = MetricPattern32(client, 'emptyaddressdata') + self.loaded: MetricPattern31[LoadedAddressData] = MetricPattern31(client, 'loadedaddressdata') class MetricsTree_Distribution_AnyAddressIndexes: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.p2a: MetricPattern16[AnyAddressIndex] = MetricPattern16( - client, "anyaddressindex" - ) - self.p2pk33: MetricPattern18[AnyAddressIndex] = MetricPattern18( - client, "anyaddressindex" - ) - self.p2pk65: MetricPattern19[AnyAddressIndex] = MetricPattern19( - client, "anyaddressindex" - ) - self.p2pkh: MetricPattern20[AnyAddressIndex] = MetricPattern20( - client, "anyaddressindex" - ) - self.p2sh: MetricPattern21[AnyAddressIndex] = MetricPattern21( - client, "anyaddressindex" - ) - self.p2tr: MetricPattern22[AnyAddressIndex] = MetricPattern22( - client, "anyaddressindex" - ) - self.p2wpkh: MetricPattern23[AnyAddressIndex] = MetricPattern23( - client, "anyaddressindex" - ) - self.p2wsh: MetricPattern24[AnyAddressIndex] = MetricPattern24( - client, "anyaddressindex" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.p2a: MetricPattern16[AnyAddressIndex] = MetricPattern16(client, 'anyaddressindex') + self.p2pk33: MetricPattern18[AnyAddressIndex] = MetricPattern18(client, 'anyaddressindex') + self.p2pk65: MetricPattern19[AnyAddressIndex] = MetricPattern19(client, 'anyaddressindex') + self.p2pkh: MetricPattern20[AnyAddressIndex] = MetricPattern20(client, 'anyaddressindex') + self.p2sh: MetricPattern21[AnyAddressIndex] = MetricPattern21(client, 'anyaddressindex') + self.p2tr: MetricPattern22[AnyAddressIndex] = MetricPattern22(client, 'anyaddressindex') + self.p2wpkh: MetricPattern23[AnyAddressIndex] = MetricPattern23(client, 'anyaddressindex') + self.p2wsh: MetricPattern24[AnyAddressIndex] = MetricPattern24(client, 'anyaddressindex') class MetricsTree_Distribution_EmptyAddrCount: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.all: MetricPattern1[StoredU64] = MetricPattern1(client, "empty_addr_count") - self.p2a: MetricPattern1[StoredU64] = MetricPattern1( - client, "p2a_empty_addr_count" - ) - self.p2pk33: MetricPattern1[StoredU64] = MetricPattern1( - client, "p2pk33_empty_addr_count" - ) - self.p2pk65: MetricPattern1[StoredU64] = MetricPattern1( - client, "p2pk65_empty_addr_count" - ) - self.p2pkh: MetricPattern1[StoredU64] = MetricPattern1( - client, "p2pkh_empty_addr_count" - ) - self.p2sh: MetricPattern1[StoredU64] = MetricPattern1( - client, "p2sh_empty_addr_count" - ) - self.p2tr: MetricPattern1[StoredU64] = MetricPattern1( - client, "p2tr_empty_addr_count" - ) - self.p2wpkh: MetricPattern1[StoredU64] = MetricPattern1( - client, "p2wpkh_empty_addr_count" - ) - self.p2wsh: MetricPattern1[StoredU64] = MetricPattern1( - client, "p2wsh_empty_addr_count" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.all: MetricPattern1[StoredU64] = MetricPattern1(client, 'empty_addr_count') + self.p2a: MetricPattern1[StoredU64] = MetricPattern1(client, 'p2a_empty_addr_count') + self.p2pk33: MetricPattern1[StoredU64] = MetricPattern1(client, 'p2pk33_empty_addr_count') + self.p2pk65: MetricPattern1[StoredU64] = MetricPattern1(client, 'p2pk65_empty_addr_count') + self.p2pkh: MetricPattern1[StoredU64] = MetricPattern1(client, 'p2pkh_empty_addr_count') + self.p2sh: MetricPattern1[StoredU64] = MetricPattern1(client, 'p2sh_empty_addr_count') + self.p2tr: MetricPattern1[StoredU64] = MetricPattern1(client, 'p2tr_empty_addr_count') + self.p2wpkh: MetricPattern1[StoredU64] = MetricPattern1(client, 'p2wpkh_empty_addr_count') + self.p2wsh: MetricPattern1[StoredU64] = MetricPattern1(client, 'p2wsh_empty_addr_count') class MetricsTree_Distribution_UtxoCohorts_AgeRange: """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._10y_to_12y: _10yTo12yPattern = _10yTo12yPattern(client, 'utxos_at_least_10y_up_to_12y_old') + self._12y_to_15y: _10yTo12yPattern = _10yTo12yPattern(client, 'utxos_at_least_12y_up_to_15y_old') + self._1d_to_1w: _10yTo12yPattern = _10yTo12yPattern(client, 'utxos_at_least_1d_up_to_1w_old') + self._1h_to_1d: _10yTo12yPattern = _10yTo12yPattern(client, 'utxos_at_least_1h_up_to_1d_old') + self._1m_to_2m: _10yTo12yPattern = _10yTo12yPattern(client, 'utxos_at_least_1m_up_to_2m_old') + self._1w_to_1m: _10yTo12yPattern = _10yTo12yPattern(client, 'utxos_at_least_1w_up_to_1m_old') + self._1y_to_2y: _10yTo12yPattern = _10yTo12yPattern(client, 'utxos_at_least_1y_up_to_2y_old') + self._2m_to_3m: _10yTo12yPattern = _10yTo12yPattern(client, 'utxos_at_least_2m_up_to_3m_old') + self._2y_to_3y: _10yTo12yPattern = _10yTo12yPattern(client, 'utxos_at_least_2y_up_to_3y_old') + self._3m_to_4m: _10yTo12yPattern = _10yTo12yPattern(client, 'utxos_at_least_3m_up_to_4m_old') + self._3y_to_4y: _10yTo12yPattern = _10yTo12yPattern(client, 'utxos_at_least_3y_up_to_4y_old') + self._4m_to_5m: _10yTo12yPattern = _10yTo12yPattern(client, 'utxos_at_least_4m_up_to_5m_old') + self._4y_to_5y: _10yTo12yPattern = _10yTo12yPattern(client, 'utxos_at_least_4y_up_to_5y_old') + self._5m_to_6m: _10yTo12yPattern = _10yTo12yPattern(client, 'utxos_at_least_5m_up_to_6m_old') + self._5y_to_6y: _10yTo12yPattern = _10yTo12yPattern(client, 'utxos_at_least_5y_up_to_6y_old') + self._6m_to_1y: _10yTo12yPattern = _10yTo12yPattern(client, 'utxos_at_least_6m_up_to_1y_old') + self._6y_to_7y: _10yTo12yPattern = _10yTo12yPattern(client, 'utxos_at_least_6y_up_to_7y_old') + self._7y_to_8y: _10yTo12yPattern = _10yTo12yPattern(client, 'utxos_at_least_7y_up_to_8y_old') + self._8y_to_10y: _10yTo12yPattern = _10yTo12yPattern(client, 'utxos_at_least_8y_up_to_10y_old') + self.from_15y: _10yTo12yPattern = _10yTo12yPattern(client, 'utxos_at_least_15y_old') + self.up_to_1h: _10yTo12yPattern = _10yTo12yPattern(client, 'utxos_up_to_1h_old') - def __init__(self, client: BrkClientBase, base_path: str = ""): - self._10y_to_12y: _10yTo12yPattern = _10yTo12yPattern( - client, "utxos_at_least_10y_up_to_12y_old" - ) - self._12y_to_15y: _10yTo12yPattern = _10yTo12yPattern( - client, "utxos_at_least_12y_up_to_15y_old" - ) - self._1d_to_1w: _10yTo12yPattern = _10yTo12yPattern( - client, "utxos_at_least_1d_up_to_1w_old" - ) - self._1h_to_1d: _10yTo12yPattern = _10yTo12yPattern( - client, "utxos_at_least_1h_up_to_1d_old" - ) - self._1m_to_2m: _10yTo12yPattern = _10yTo12yPattern( - client, "utxos_at_least_1m_up_to_2m_old" - ) - self._1w_to_1m: _10yTo12yPattern = _10yTo12yPattern( - client, "utxos_at_least_1w_up_to_1m_old" - ) - self._1y_to_2y: _10yTo12yPattern = _10yTo12yPattern( - client, "utxos_at_least_1y_up_to_2y_old" - ) - self._2m_to_3m: _10yTo12yPattern = _10yTo12yPattern( - client, "utxos_at_least_2m_up_to_3m_old" - ) - self._2y_to_3y: _10yTo12yPattern = _10yTo12yPattern( - client, "utxos_at_least_2y_up_to_3y_old" - ) - self._3m_to_4m: _10yTo12yPattern = _10yTo12yPattern( - client, "utxos_at_least_3m_up_to_4m_old" - ) - self._3y_to_4y: _10yTo12yPattern = _10yTo12yPattern( - client, "utxos_at_least_3y_up_to_4y_old" - ) - self._4m_to_5m: _10yTo12yPattern = _10yTo12yPattern( - client, "utxos_at_least_4m_up_to_5m_old" - ) - self._4y_to_5y: _10yTo12yPattern = _10yTo12yPattern( - client, "utxos_at_least_4y_up_to_5y_old" - ) - self._5m_to_6m: _10yTo12yPattern = _10yTo12yPattern( - client, "utxos_at_least_5m_up_to_6m_old" - ) - self._5y_to_6y: _10yTo12yPattern = _10yTo12yPattern( - client, "utxos_at_least_5y_up_to_6y_old" - ) - self._6m_to_1y: _10yTo12yPattern = _10yTo12yPattern( - client, "utxos_at_least_6m_up_to_1y_old" - ) - self._6y_to_7y: _10yTo12yPattern = _10yTo12yPattern( - client, "utxos_at_least_6y_up_to_7y_old" - ) - self._7y_to_8y: _10yTo12yPattern = _10yTo12yPattern( - client, "utxos_at_least_7y_up_to_8y_old" - ) - self._8y_to_10y: _10yTo12yPattern = _10yTo12yPattern( - client, "utxos_at_least_8y_up_to_10y_old" - ) - self.from_15y: _10yTo12yPattern = _10yTo12yPattern( - client, "utxos_at_least_15y_old" - ) - self.up_to_1h: _10yTo12yPattern = _10yTo12yPattern(client, "utxos_up_to_1h_old") - +class MetricsTree_Distribution_UtxoCohorts_All_Activity: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.coinblocks_destroyed: BlockCountPattern[StoredF64] = BlockCountPattern(client, 'coinblocks_destroyed') + self.coindays_destroyed: BlockCountPattern[StoredF64] = BlockCountPattern(client, 'coindays_destroyed') + self.satblocks_destroyed: MetricPattern11[Sats] = MetricPattern11(client, 'satblocks_destroyed') + self.satdays_destroyed: MetricPattern11[Sats] = MetricPattern11(client, 'satdays_destroyed') + self.sent: UnclaimedRewardsPattern = UnclaimedRewardsPattern(client, 'sent') class MetricsTree_Distribution_UtxoCohorts_All_CostBasis: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.max: MetricPattern1[Dollars] = MetricPattern1(client, "max_cost_basis") - self.min: MetricPattern1[Dollars] = MetricPattern1(client, "min_cost_basis") - self.percentiles: PercentilesPattern = PercentilesPattern(client, "cost_basis") - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.max: MetricPattern1[Dollars] = MetricPattern1(client, 'max_cost_basis') + self.min: MetricPattern1[Dollars] = MetricPattern1(client, 'min_cost_basis') + self.percentiles: PercentilesPattern = PercentilesPattern(client, 'cost_basis') class MetricsTree_Distribution_UtxoCohorts_All_Relative: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.neg_unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1[ - StoredF32 - ] = MetricPattern1( - client, "neg_unrealized_loss_rel_to_own_total_unrealized_pnl" - ) - self.net_unrealized_pnl_rel_to_own_total_unrealized_pnl: MetricPattern1[ - StoredF32 - ] = MetricPattern1(client, "net_unrealized_pnl_rel_to_own_total_unrealized_pnl") - self.supply_in_loss_rel_to_own_supply: MetricPattern1[StoredF64] = ( - MetricPattern1(client, "supply_in_loss_rel_to_own_supply") - ) - self.supply_in_profit_rel_to_own_supply: MetricPattern1[StoredF64] = ( - MetricPattern1(client, "supply_in_profit_rel_to_own_supply") - ) - self.unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1[ - StoredF32 - ] = MetricPattern1(client, "unrealized_loss_rel_to_own_total_unrealized_pnl") - self.unrealized_profit_rel_to_own_total_unrealized_pnl: MetricPattern1[ - StoredF32 - ] = MetricPattern1(client, "unrealized_profit_rel_to_own_total_unrealized_pnl") - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.neg_unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1[StoredF32] = MetricPattern1(client, 'neg_unrealized_loss_rel_to_own_total_unrealized_pnl') + self.net_unrealized_pnl_rel_to_own_total_unrealized_pnl: MetricPattern1[StoredF32] = MetricPattern1(client, 'net_unrealized_pnl_rel_to_own_total_unrealized_pnl') + self.supply_in_loss_rel_to_own_supply: MetricPattern1[StoredF64] = MetricPattern1(client, 'supply_in_loss_rel_to_own_supply') + self.supply_in_profit_rel_to_own_supply: MetricPattern1[StoredF64] = MetricPattern1(client, 'supply_in_profit_rel_to_own_supply') + self.unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1[StoredF32] = MetricPattern1(client, 'unrealized_loss_rel_to_own_total_unrealized_pnl') + self.unrealized_profit_rel_to_own_total_unrealized_pnl: MetricPattern1[StoredF32] = MetricPattern1(client, 'unrealized_profit_rel_to_own_total_unrealized_pnl') class MetricsTree_Distribution_UtxoCohorts_All: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.activity: ActivityPattern2 = ActivityPattern2(client, "") - self.cost_basis: MetricsTree_Distribution_UtxoCohorts_All_CostBasis = ( - MetricsTree_Distribution_UtxoCohorts_All_CostBasis(client) - ) - self.outputs: OutputsPattern = OutputsPattern(client, "utxo_count") - self.realized: RealizedPattern3 = RealizedPattern3(client, "adjusted_sopr") - self.relative: MetricsTree_Distribution_UtxoCohorts_All_Relative = ( - MetricsTree_Distribution_UtxoCohorts_All_Relative(client) - ) - self.supply: SupplyPattern2 = SupplyPattern2(client, "supply") - self.unrealized: UnrealizedPattern = UnrealizedPattern(client, "") - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.activity: MetricsTree_Distribution_UtxoCohorts_All_Activity = MetricsTree_Distribution_UtxoCohorts_All_Activity(client) + self.cost_basis: MetricsTree_Distribution_UtxoCohorts_All_CostBasis = MetricsTree_Distribution_UtxoCohorts_All_CostBasis(client) + self.outputs: OutputsPattern = OutputsPattern(client, 'utxo_count') + self.realized: RealizedPattern3 = RealizedPattern3(client, 'adjusted_sopr') + self.relative: MetricsTree_Distribution_UtxoCohorts_All_Relative = MetricsTree_Distribution_UtxoCohorts_All_Relative(client) + self.supply: SupplyPattern2 = SupplyPattern2(client, 'supply') + self.unrealized: UnrealizedPattern = UnrealizedPattern(client, '') class MetricsTree_Distribution_UtxoCohorts_AmountRange: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self._0sats: _0satsPattern2 = _0satsPattern2(client, "utxos_with_0sats") - self._100btc_to_1k_btc: _0satsPattern2 = _0satsPattern2( - client, "utxos_above_100btc_under_1k_btc" - ) - self._100k_btc_or_more: _0satsPattern2 = _0satsPattern2( - client, "utxos_above_100k_btc" - ) - self._100k_sats_to_1m_sats: _0satsPattern2 = _0satsPattern2( - client, "utxos_above_100k_sats_under_1m_sats" - ) - self._100sats_to_1k_sats: _0satsPattern2 = _0satsPattern2( - client, "utxos_above_100sats_under_1k_sats" - ) - self._10btc_to_100btc: _0satsPattern2 = _0satsPattern2( - client, "utxos_above_10btc_under_100btc" - ) - self._10k_btc_to_100k_btc: _0satsPattern2 = _0satsPattern2( - client, "utxos_above_10k_btc_under_100k_btc" - ) - self._10k_sats_to_100k_sats: _0satsPattern2 = _0satsPattern2( - client, "utxos_above_10k_sats_under_100k_sats" - ) - self._10m_sats_to_1btc: _0satsPattern2 = _0satsPattern2( - client, "utxos_above_10m_sats_under_1btc" - ) - self._10sats_to_100sats: _0satsPattern2 = _0satsPattern2( - client, "utxos_above_10sats_under_100sats" - ) - self._1btc_to_10btc: _0satsPattern2 = _0satsPattern2( - client, "utxos_above_1btc_under_10btc" - ) - self._1k_btc_to_10k_btc: _0satsPattern2 = _0satsPattern2( - client, "utxos_above_1k_btc_under_10k_btc" - ) - self._1k_sats_to_10k_sats: _0satsPattern2 = _0satsPattern2( - client, "utxos_above_1k_sats_under_10k_sats" - ) - self._1m_sats_to_10m_sats: _0satsPattern2 = _0satsPattern2( - client, "utxos_above_1m_sats_under_10m_sats" - ) - self._1sat_to_10sats: _0satsPattern2 = _0satsPattern2( - client, "utxos_above_1sat_under_10sats" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._0sats: _0satsPattern2 = _0satsPattern2(client, 'utxos_with_0sats') + self._100btc_to_1k_btc: _0satsPattern2 = _0satsPattern2(client, 'utxos_above_100btc_under_1k_btc') + self._100k_btc_or_more: _0satsPattern2 = _0satsPattern2(client, 'utxos_above_100k_btc') + self._100k_sats_to_1m_sats: _0satsPattern2 = _0satsPattern2(client, 'utxos_above_100k_sats_under_1m_sats') + self._100sats_to_1k_sats: _0satsPattern2 = _0satsPattern2(client, 'utxos_above_100sats_under_1k_sats') + self._10btc_to_100btc: _0satsPattern2 = _0satsPattern2(client, 'utxos_above_10btc_under_100btc') + self._10k_btc_to_100k_btc: _0satsPattern2 = _0satsPattern2(client, 'utxos_above_10k_btc_under_100k_btc') + self._10k_sats_to_100k_sats: _0satsPattern2 = _0satsPattern2(client, 'utxos_above_10k_sats_under_100k_sats') + self._10m_sats_to_1btc: _0satsPattern2 = _0satsPattern2(client, 'utxos_above_10m_sats_under_1btc') + self._10sats_to_100sats: _0satsPattern2 = _0satsPattern2(client, 'utxos_above_10sats_under_100sats') + self._1btc_to_10btc: _0satsPattern2 = _0satsPattern2(client, 'utxos_above_1btc_under_10btc') + self._1k_btc_to_10k_btc: _0satsPattern2 = _0satsPattern2(client, 'utxos_above_1k_btc_under_10k_btc') + self._1k_sats_to_10k_sats: _0satsPattern2 = _0satsPattern2(client, 'utxos_above_1k_sats_under_10k_sats') + self._1m_sats_to_10m_sats: _0satsPattern2 = _0satsPattern2(client, 'utxos_above_1m_sats_under_10m_sats') + self._1sat_to_10sats: _0satsPattern2 = _0satsPattern2(client, 'utxos_above_1sat_under_10sats') class MetricsTree_Distribution_UtxoCohorts_Epoch: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self._0: _0satsPattern2 = _0satsPattern2(client, "epoch_0") - self._1: _0satsPattern2 = _0satsPattern2(client, "epoch_1") - self._2: _0satsPattern2 = _0satsPattern2(client, "epoch_2") - self._3: _0satsPattern2 = _0satsPattern2(client, "epoch_3") - self._4: _0satsPattern2 = _0satsPattern2(client, "epoch_4") - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._0: _0satsPattern2 = _0satsPattern2(client, 'epoch_0') + self._1: _0satsPattern2 = _0satsPattern2(client, 'epoch_1') + self._2: _0satsPattern2 = _0satsPattern2(client, 'epoch_2') + self._3: _0satsPattern2 = _0satsPattern2(client, 'epoch_3') + self._4: _0satsPattern2 = _0satsPattern2(client, 'epoch_4') class MetricsTree_Distribution_UtxoCohorts_GeAmount: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self._100btc: _100btcPattern = _100btcPattern(client, "utxos_above_100btc") - self._100k_sats: _100btcPattern = _100btcPattern( - client, "utxos_above_100k_sats" - ) - self._100sats: _100btcPattern = _100btcPattern(client, "utxos_above_100sats") - self._10btc: _100btcPattern = _100btcPattern(client, "utxos_above_10btc") - self._10k_btc: _100btcPattern = _100btcPattern(client, "utxos_above_10k_btc") - self._10k_sats: _100btcPattern = _100btcPattern(client, "utxos_above_10k_sats") - self._10m_sats: _100btcPattern = _100btcPattern(client, "utxos_above_10m_sats") - self._10sats: _100btcPattern = _100btcPattern(client, "utxos_above_10sats") - self._1btc: _100btcPattern = _100btcPattern(client, "utxos_above_1btc") - self._1k_btc: _100btcPattern = _100btcPattern(client, "utxos_above_1k_btc") - self._1k_sats: _100btcPattern = _100btcPattern(client, "utxos_above_1k_sats") - self._1m_sats: _100btcPattern = _100btcPattern(client, "utxos_above_1m_sats") - self._1sat: _100btcPattern = _100btcPattern(client, "utxos_above_1sat") - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._100btc: _100btcPattern = _100btcPattern(client, 'utxos_above_100btc') + self._100k_sats: _100btcPattern = _100btcPattern(client, 'utxos_above_100k_sats') + self._100sats: _100btcPattern = _100btcPattern(client, 'utxos_above_100sats') + self._10btc: _100btcPattern = _100btcPattern(client, 'utxos_above_10btc') + self._10k_btc: _100btcPattern = _100btcPattern(client, 'utxos_above_10k_btc') + self._10k_sats: _100btcPattern = _100btcPattern(client, 'utxos_above_10k_sats') + self._10m_sats: _100btcPattern = _100btcPattern(client, 'utxos_above_10m_sats') + self._10sats: _100btcPattern = _100btcPattern(client, 'utxos_above_10sats') + self._1btc: _100btcPattern = _100btcPattern(client, 'utxos_above_1btc') + self._1k_btc: _100btcPattern = _100btcPattern(client, 'utxos_above_1k_btc') + self._1k_sats: _100btcPattern = _100btcPattern(client, 'utxos_above_1k_sats') + self._1m_sats: _100btcPattern = _100btcPattern(client, 'utxos_above_1m_sats') + self._1sat: _100btcPattern = _100btcPattern(client, 'utxos_above_1sat') class MetricsTree_Distribution_UtxoCohorts_LtAmount: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self._100btc: _100btcPattern = _100btcPattern(client, "utxos_under_100btc") - self._100k_btc: _100btcPattern = _100btcPattern(client, "utxos_under_100k_btc") - self._100k_sats: _100btcPattern = _100btcPattern( - client, "utxos_under_100k_sats" - ) - self._100sats: _100btcPattern = _100btcPattern(client, "utxos_under_100sats") - self._10btc: _100btcPattern = _100btcPattern(client, "utxos_under_10btc") - self._10k_btc: _100btcPattern = _100btcPattern(client, "utxos_under_10k_btc") - self._10k_sats: _100btcPattern = _100btcPattern(client, "utxos_under_10k_sats") - self._10m_sats: _100btcPattern = _100btcPattern(client, "utxos_under_10m_sats") - self._10sats: _100btcPattern = _100btcPattern(client, "utxos_under_10sats") - self._1btc: _100btcPattern = _100btcPattern(client, "utxos_under_1btc") - self._1k_btc: _100btcPattern = _100btcPattern(client, "utxos_under_1k_btc") - self._1k_sats: _100btcPattern = _100btcPattern(client, "utxos_under_1k_sats") - self._1m_sats: _100btcPattern = _100btcPattern(client, "utxos_under_1m_sats") - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._100btc: _100btcPattern = _100btcPattern(client, 'utxos_under_100btc') + self._100k_btc: _100btcPattern = _100btcPattern(client, 'utxos_under_100k_btc') + self._100k_sats: _100btcPattern = _100btcPattern(client, 'utxos_under_100k_sats') + self._100sats: _100btcPattern = _100btcPattern(client, 'utxos_under_100sats') + self._10btc: _100btcPattern = _100btcPattern(client, 'utxos_under_10btc') + self._10k_btc: _100btcPattern = _100btcPattern(client, 'utxos_under_10k_btc') + self._10k_sats: _100btcPattern = _100btcPattern(client, 'utxos_under_10k_sats') + self._10m_sats: _100btcPattern = _100btcPattern(client, 'utxos_under_10m_sats') + self._10sats: _100btcPattern = _100btcPattern(client, 'utxos_under_10sats') + self._1btc: _100btcPattern = _100btcPattern(client, 'utxos_under_1btc') + self._1k_btc: _100btcPattern = _100btcPattern(client, 'utxos_under_1k_btc') + self._1k_sats: _100btcPattern = _100btcPattern(client, 'utxos_under_1k_sats') + self._1m_sats: _100btcPattern = _100btcPattern(client, 'utxos_under_1m_sats') class MetricsTree_Distribution_UtxoCohorts_MaxAge: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self._10y: _10yPattern = _10yPattern(client, "utxos_up_to_10y_old") - self._12y: _10yPattern = _10yPattern(client, "utxos_up_to_12y_old") - self._15y: _10yPattern = _10yPattern(client, "utxos_up_to_15y_old") - self._1m: _10yPattern = _10yPattern(client, "utxos_up_to_1m_old") - self._1w: _10yPattern = _10yPattern(client, "utxos_up_to_1w_old") - self._1y: _10yPattern = _10yPattern(client, "utxos_up_to_1y_old") - self._2m: _10yPattern = _10yPattern(client, "utxos_up_to_2m_old") - self._2y: _10yPattern = _10yPattern(client, "utxos_up_to_2y_old") - self._3m: _10yPattern = _10yPattern(client, "utxos_up_to_3m_old") - self._3y: _10yPattern = _10yPattern(client, "utxos_up_to_3y_old") - self._4m: _10yPattern = _10yPattern(client, "utxos_up_to_4m_old") - self._4y: _10yPattern = _10yPattern(client, "utxos_up_to_4y_old") - self._5m: _10yPattern = _10yPattern(client, "utxos_up_to_5m_old") - self._5y: _10yPattern = _10yPattern(client, "utxos_up_to_5y_old") - self._6m: _10yPattern = _10yPattern(client, "utxos_up_to_6m_old") - self._6y: _10yPattern = _10yPattern(client, "utxos_up_to_6y_old") - self._7y: _10yPattern = _10yPattern(client, "utxos_up_to_7y_old") - self._8y: _10yPattern = _10yPattern(client, "utxos_up_to_8y_old") - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._10y: _10yPattern = _10yPattern(client, 'utxos_up_to_10y_old') + self._12y: _10yPattern = _10yPattern(client, 'utxos_up_to_12y_old') + self._15y: _10yPattern = _10yPattern(client, 'utxos_up_to_15y_old') + self._1m: _10yPattern = _10yPattern(client, 'utxos_up_to_1m_old') + self._1w: _10yPattern = _10yPattern(client, 'utxos_up_to_1w_old') + self._1y: _10yPattern = _10yPattern(client, 'utxos_up_to_1y_old') + self._2m: _10yPattern = _10yPattern(client, 'utxos_up_to_2m_old') + self._2y: _10yPattern = _10yPattern(client, 'utxos_up_to_2y_old') + self._3m: _10yPattern = _10yPattern(client, 'utxos_up_to_3m_old') + self._3y: _10yPattern = _10yPattern(client, 'utxos_up_to_3y_old') + self._4m: _10yPattern = _10yPattern(client, 'utxos_up_to_4m_old') + self._4y: _10yPattern = _10yPattern(client, 'utxos_up_to_4y_old') + self._5m: _10yPattern = _10yPattern(client, 'utxos_up_to_5m_old') + self._5y: _10yPattern = _10yPattern(client, 'utxos_up_to_5y_old') + self._6m: _10yPattern = _10yPattern(client, 'utxos_up_to_6m_old') + self._6y: _10yPattern = _10yPattern(client, 'utxos_up_to_6y_old') + self._7y: _10yPattern = _10yPattern(client, 'utxos_up_to_7y_old') + self._8y: _10yPattern = _10yPattern(client, 'utxos_up_to_8y_old') class MetricsTree_Distribution_UtxoCohorts_MinAge: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self._10y: _100btcPattern = _100btcPattern(client, "utxos_at_least_10y_old") - self._12y: _100btcPattern = _100btcPattern(client, "utxos_at_least_12y_old") - self._1d: _100btcPattern = _100btcPattern(client, "utxos_at_least_1d_old") - self._1m: _100btcPattern = _100btcPattern(client, "utxos_at_least_1m_old") - self._1w: _100btcPattern = _100btcPattern(client, "utxos_at_least_1w_old") - self._1y: _100btcPattern = _100btcPattern(client, "utxos_at_least_1y_old") - self._2m: _100btcPattern = _100btcPattern(client, "utxos_at_least_2m_old") - self._2y: _100btcPattern = _100btcPattern(client, "utxos_at_least_2y_old") - self._3m: _100btcPattern = _100btcPattern(client, "utxos_at_least_3m_old") - self._3y: _100btcPattern = _100btcPattern(client, "utxos_at_least_3y_old") - self._4m: _100btcPattern = _100btcPattern(client, "utxos_at_least_4m_old") - self._4y: _100btcPattern = _100btcPattern(client, "utxos_at_least_4y_old") - self._5m: _100btcPattern = _100btcPattern(client, "utxos_at_least_5m_old") - self._5y: _100btcPattern = _100btcPattern(client, "utxos_at_least_5y_old") - self._6m: _100btcPattern = _100btcPattern(client, "utxos_at_least_6m_old") - self._6y: _100btcPattern = _100btcPattern(client, "utxos_at_least_6y_old") - self._7y: _100btcPattern = _100btcPattern(client, "utxos_at_least_7y_old") - self._8y: _100btcPattern = _100btcPattern(client, "utxos_at_least_8y_old") - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._10y: _100btcPattern = _100btcPattern(client, 'utxos_at_least_10y_old') + self._12y: _100btcPattern = _100btcPattern(client, 'utxos_at_least_12y_old') + self._1d: _100btcPattern = _100btcPattern(client, 'utxos_at_least_1d_old') + self._1m: _100btcPattern = _100btcPattern(client, 'utxos_at_least_1m_old') + self._1w: _100btcPattern = _100btcPattern(client, 'utxos_at_least_1w_old') + self._1y: _100btcPattern = _100btcPattern(client, 'utxos_at_least_1y_old') + self._2m: _100btcPattern = _100btcPattern(client, 'utxos_at_least_2m_old') + self._2y: _100btcPattern = _100btcPattern(client, 'utxos_at_least_2y_old') + self._3m: _100btcPattern = _100btcPattern(client, 'utxos_at_least_3m_old') + self._3y: _100btcPattern = _100btcPattern(client, 'utxos_at_least_3y_old') + self._4m: _100btcPattern = _100btcPattern(client, 'utxos_at_least_4m_old') + self._4y: _100btcPattern = _100btcPattern(client, 'utxos_at_least_4y_old') + self._5m: _100btcPattern = _100btcPattern(client, 'utxos_at_least_5m_old') + self._5y: _100btcPattern = _100btcPattern(client, 'utxos_at_least_5y_old') + self._6m: _100btcPattern = _100btcPattern(client, 'utxos_at_least_6m_old') + self._6y: _100btcPattern = _100btcPattern(client, 'utxos_at_least_6y_old') + self._7y: _100btcPattern = _100btcPattern(client, 'utxos_at_least_7y_old') + self._8y: _100btcPattern = _100btcPattern(client, 'utxos_at_least_8y_old') class MetricsTree_Distribution_UtxoCohorts_Term_Long_CostBasis: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.max: MetricPattern1[Dollars] = MetricPattern1(client, "lth_max_cost_basis") - self.min: MetricPattern1[Dollars] = MetricPattern1(client, "lth_min_cost_basis") - self.percentiles: PercentilesPattern = PercentilesPattern( - client, "lth_cost_basis" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.max: MetricPattern1[Dollars] = MetricPattern1(client, 'lth_max_cost_basis') + self.min: MetricPattern1[Dollars] = MetricPattern1(client, 'lth_min_cost_basis') + self.percentiles: PercentilesPattern = PercentilesPattern(client, 'lth_cost_basis') class MetricsTree_Distribution_UtxoCohorts_Term_Long: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.activity: ActivityPattern2 = ActivityPattern2(client, "lth") - self.cost_basis: MetricsTree_Distribution_UtxoCohorts_Term_Long_CostBasis = ( - MetricsTree_Distribution_UtxoCohorts_Term_Long_CostBasis(client) - ) - self.outputs: OutputsPattern = OutputsPattern(client, "lth") - self.realized: RealizedPattern2 = RealizedPattern2(client, "lth") - self.relative: RelativePattern5 = RelativePattern5(client, "lth") - self.supply: SupplyPattern2 = SupplyPattern2(client, "lth_supply") - self.unrealized: UnrealizedPattern = UnrealizedPattern(client, "lth") - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.activity: ActivityPattern2 = ActivityPattern2(client, 'lth') + self.cost_basis: MetricsTree_Distribution_UtxoCohorts_Term_Long_CostBasis = MetricsTree_Distribution_UtxoCohorts_Term_Long_CostBasis(client) + self.outputs: OutputsPattern = OutputsPattern(client, 'lth') + self.realized: RealizedPattern2 = RealizedPattern2(client, 'lth') + self.relative: RelativePattern5 = RelativePattern5(client, 'lth') + self.supply: SupplyPattern2 = SupplyPattern2(client, 'lth_supply') + self.unrealized: UnrealizedPattern = UnrealizedPattern(client, 'lth') class MetricsTree_Distribution_UtxoCohorts_Term_Short_CostBasis: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.max: MetricPattern1[Dollars] = MetricPattern1(client, "sth_max_cost_basis") - self.min: MetricPattern1[Dollars] = MetricPattern1(client, "sth_min_cost_basis") - self.percentiles: PercentilesPattern = PercentilesPattern( - client, "sth_cost_basis" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.max: MetricPattern1[Dollars] = MetricPattern1(client, 'sth_max_cost_basis') + self.min: MetricPattern1[Dollars] = MetricPattern1(client, 'sth_min_cost_basis') + self.percentiles: PercentilesPattern = PercentilesPattern(client, 'sth_cost_basis') class MetricsTree_Distribution_UtxoCohorts_Term_Short: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.activity: ActivityPattern2 = ActivityPattern2(client, "sth") - self.cost_basis: MetricsTree_Distribution_UtxoCohorts_Term_Short_CostBasis = ( - MetricsTree_Distribution_UtxoCohorts_Term_Short_CostBasis(client) - ) - self.outputs: OutputsPattern = OutputsPattern(client, "sth") - self.realized: RealizedPattern3 = RealizedPattern3(client, "sth") - self.relative: RelativePattern5 = RelativePattern5(client, "sth") - self.supply: SupplyPattern2 = SupplyPattern2(client, "sth_supply") - self.unrealized: UnrealizedPattern = UnrealizedPattern(client, "sth") - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.activity: ActivityPattern2 = ActivityPattern2(client, 'sth') + self.cost_basis: MetricsTree_Distribution_UtxoCohorts_Term_Short_CostBasis = MetricsTree_Distribution_UtxoCohorts_Term_Short_CostBasis(client) + self.outputs: OutputsPattern = OutputsPattern(client, 'sth') + self.realized: RealizedPattern3 = RealizedPattern3(client, 'sth') + self.relative: RelativePattern5 = RelativePattern5(client, 'sth') + self.supply: SupplyPattern2 = SupplyPattern2(client, 'sth_supply') + self.unrealized: UnrealizedPattern = UnrealizedPattern(client, 'sth') class MetricsTree_Distribution_UtxoCohorts_Term: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.long: MetricsTree_Distribution_UtxoCohorts_Term_Long = ( - MetricsTree_Distribution_UtxoCohorts_Term_Long(client) - ) - self.short: MetricsTree_Distribution_UtxoCohorts_Term_Short = ( - MetricsTree_Distribution_UtxoCohorts_Term_Short(client) - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.long: MetricsTree_Distribution_UtxoCohorts_Term_Long = MetricsTree_Distribution_UtxoCohorts_Term_Long(client) + self.short: MetricsTree_Distribution_UtxoCohorts_Term_Short = MetricsTree_Distribution_UtxoCohorts_Term_Short(client) class MetricsTree_Distribution_UtxoCohorts_Type: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.empty: _0satsPattern2 = _0satsPattern2(client, "empty_outputs") - self.p2a: _0satsPattern2 = _0satsPattern2(client, "p2a") - self.p2ms: _0satsPattern2 = _0satsPattern2(client, "p2ms") - self.p2pk33: _0satsPattern2 = _0satsPattern2(client, "p2pk33") - self.p2pk65: _0satsPattern2 = _0satsPattern2(client, "p2pk65") - self.p2pkh: _0satsPattern2 = _0satsPattern2(client, "p2pkh") - self.p2sh: _0satsPattern2 = _0satsPattern2(client, "p2sh") - self.p2tr: _0satsPattern2 = _0satsPattern2(client, "p2tr") - self.p2wpkh: _0satsPattern2 = _0satsPattern2(client, "p2wpkh") - self.p2wsh: _0satsPattern2 = _0satsPattern2(client, "p2wsh") - self.unknown: _0satsPattern2 = _0satsPattern2(client, "unknown_outputs") - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.empty: _0satsPattern2 = _0satsPattern2(client, 'empty_outputs') + self.p2a: _0satsPattern2 = _0satsPattern2(client, 'p2a') + self.p2ms: _0satsPattern2 = _0satsPattern2(client, 'p2ms') + self.p2pk33: _0satsPattern2 = _0satsPattern2(client, 'p2pk33') + self.p2pk65: _0satsPattern2 = _0satsPattern2(client, 'p2pk65') + self.p2pkh: _0satsPattern2 = _0satsPattern2(client, 'p2pkh') + self.p2sh: _0satsPattern2 = _0satsPattern2(client, 'p2sh') + self.p2tr: _0satsPattern2 = _0satsPattern2(client, 'p2tr') + self.p2wpkh: _0satsPattern2 = _0satsPattern2(client, 'p2wpkh') + self.p2wsh: _0satsPattern2 = _0satsPattern2(client, 'p2wsh') + self.unknown: _0satsPattern2 = _0satsPattern2(client, 'unknown_outputs') class MetricsTree_Distribution_UtxoCohorts_Year: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self._2009: _0satsPattern2 = _0satsPattern2(client, "year_2009") - self._2010: _0satsPattern2 = _0satsPattern2(client, "year_2010") - self._2011: _0satsPattern2 = _0satsPattern2(client, "year_2011") - self._2012: _0satsPattern2 = _0satsPattern2(client, "year_2012") - self._2013: _0satsPattern2 = _0satsPattern2(client, "year_2013") - self._2014: _0satsPattern2 = _0satsPattern2(client, "year_2014") - self._2015: _0satsPattern2 = _0satsPattern2(client, "year_2015") - self._2016: _0satsPattern2 = _0satsPattern2(client, "year_2016") - self._2017: _0satsPattern2 = _0satsPattern2(client, "year_2017") - self._2018: _0satsPattern2 = _0satsPattern2(client, "year_2018") - self._2019: _0satsPattern2 = _0satsPattern2(client, "year_2019") - self._2020: _0satsPattern2 = _0satsPattern2(client, "year_2020") - self._2021: _0satsPattern2 = _0satsPattern2(client, "year_2021") - self._2022: _0satsPattern2 = _0satsPattern2(client, "year_2022") - self._2023: _0satsPattern2 = _0satsPattern2(client, "year_2023") - self._2024: _0satsPattern2 = _0satsPattern2(client, "year_2024") - self._2025: _0satsPattern2 = _0satsPattern2(client, "year_2025") - self._2026: _0satsPattern2 = _0satsPattern2(client, "year_2026") - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._2009: _0satsPattern2 = _0satsPattern2(client, 'year_2009') + self._2010: _0satsPattern2 = _0satsPattern2(client, 'year_2010') + self._2011: _0satsPattern2 = _0satsPattern2(client, 'year_2011') + self._2012: _0satsPattern2 = _0satsPattern2(client, 'year_2012') + self._2013: _0satsPattern2 = _0satsPattern2(client, 'year_2013') + self._2014: _0satsPattern2 = _0satsPattern2(client, 'year_2014') + self._2015: _0satsPattern2 = _0satsPattern2(client, 'year_2015') + self._2016: _0satsPattern2 = _0satsPattern2(client, 'year_2016') + self._2017: _0satsPattern2 = _0satsPattern2(client, 'year_2017') + self._2018: _0satsPattern2 = _0satsPattern2(client, 'year_2018') + self._2019: _0satsPattern2 = _0satsPattern2(client, 'year_2019') + self._2020: _0satsPattern2 = _0satsPattern2(client, 'year_2020') + self._2021: _0satsPattern2 = _0satsPattern2(client, 'year_2021') + self._2022: _0satsPattern2 = _0satsPattern2(client, 'year_2022') + self._2023: _0satsPattern2 = _0satsPattern2(client, 'year_2023') + self._2024: _0satsPattern2 = _0satsPattern2(client, 'year_2024') + self._2025: _0satsPattern2 = _0satsPattern2(client, 'year_2025') + self._2026: _0satsPattern2 = _0satsPattern2(client, 'year_2026') class MetricsTree_Distribution_UtxoCohorts: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.age_range: MetricsTree_Distribution_UtxoCohorts_AgeRange = ( - MetricsTree_Distribution_UtxoCohorts_AgeRange(client) - ) - self.all: MetricsTree_Distribution_UtxoCohorts_All = ( - MetricsTree_Distribution_UtxoCohorts_All(client) - ) - self.amount_range: MetricsTree_Distribution_UtxoCohorts_AmountRange = ( - MetricsTree_Distribution_UtxoCohorts_AmountRange(client) - ) - self.epoch: MetricsTree_Distribution_UtxoCohorts_Epoch = ( - MetricsTree_Distribution_UtxoCohorts_Epoch(client) - ) - self.ge_amount: MetricsTree_Distribution_UtxoCohorts_GeAmount = ( - MetricsTree_Distribution_UtxoCohorts_GeAmount(client) - ) - self.lt_amount: MetricsTree_Distribution_UtxoCohorts_LtAmount = ( - MetricsTree_Distribution_UtxoCohorts_LtAmount(client) - ) - self.max_age: MetricsTree_Distribution_UtxoCohorts_MaxAge = ( - MetricsTree_Distribution_UtxoCohorts_MaxAge(client) - ) - self.min_age: MetricsTree_Distribution_UtxoCohorts_MinAge = ( - MetricsTree_Distribution_UtxoCohorts_MinAge(client) - ) - self.term: MetricsTree_Distribution_UtxoCohorts_Term = ( - MetricsTree_Distribution_UtxoCohorts_Term(client) - ) - self.type_: MetricsTree_Distribution_UtxoCohorts_Type = ( - MetricsTree_Distribution_UtxoCohorts_Type(client) - ) - self.year: MetricsTree_Distribution_UtxoCohorts_Year = ( - MetricsTree_Distribution_UtxoCohorts_Year(client) - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.age_range: MetricsTree_Distribution_UtxoCohorts_AgeRange = MetricsTree_Distribution_UtxoCohorts_AgeRange(client) + self.all: MetricsTree_Distribution_UtxoCohorts_All = MetricsTree_Distribution_UtxoCohorts_All(client) + self.amount_range: MetricsTree_Distribution_UtxoCohorts_AmountRange = MetricsTree_Distribution_UtxoCohorts_AmountRange(client) + self.epoch: MetricsTree_Distribution_UtxoCohorts_Epoch = MetricsTree_Distribution_UtxoCohorts_Epoch(client) + self.ge_amount: MetricsTree_Distribution_UtxoCohorts_GeAmount = MetricsTree_Distribution_UtxoCohorts_GeAmount(client) + self.lt_amount: MetricsTree_Distribution_UtxoCohorts_LtAmount = MetricsTree_Distribution_UtxoCohorts_LtAmount(client) + self.max_age: MetricsTree_Distribution_UtxoCohorts_MaxAge = MetricsTree_Distribution_UtxoCohorts_MaxAge(client) + self.min_age: MetricsTree_Distribution_UtxoCohorts_MinAge = MetricsTree_Distribution_UtxoCohorts_MinAge(client) + self.term: MetricsTree_Distribution_UtxoCohorts_Term = MetricsTree_Distribution_UtxoCohorts_Term(client) + self.type_: MetricsTree_Distribution_UtxoCohorts_Type = MetricsTree_Distribution_UtxoCohorts_Type(client) + self.year: MetricsTree_Distribution_UtxoCohorts_Year = MetricsTree_Distribution_UtxoCohorts_Year(client) class MetricsTree_Distribution: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.addr_count: MetricsTree_Distribution_AddrCount = ( - MetricsTree_Distribution_AddrCount(client) - ) - self.address_cohorts: MetricsTree_Distribution_AddressCohorts = ( - MetricsTree_Distribution_AddressCohorts(client) - ) - self.addresses_data: MetricsTree_Distribution_AddressesData = ( - MetricsTree_Distribution_AddressesData(client) - ) - self.any_address_indexes: MetricsTree_Distribution_AnyAddressIndexes = ( - MetricsTree_Distribution_AnyAddressIndexes(client) - ) - self.chain_state: MetricPattern11[SupplyState] = MetricPattern11( - client, "chain" - ) - self.empty_addr_count: MetricsTree_Distribution_EmptyAddrCount = ( - MetricsTree_Distribution_EmptyAddrCount(client) - ) - self.emptyaddressindex: MetricPattern32[EmptyAddressIndex] = MetricPattern32( - client, "emptyaddressindex" - ) - self.loadedaddressindex: MetricPattern31[LoadedAddressIndex] = MetricPattern31( - client, "loadedaddressindex" - ) - self.utxo_cohorts: MetricsTree_Distribution_UtxoCohorts = ( - MetricsTree_Distribution_UtxoCohorts(client) - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.addr_count: MetricsTree_Distribution_AddrCount = MetricsTree_Distribution_AddrCount(client) + self.address_cohorts: MetricsTree_Distribution_AddressCohorts = MetricsTree_Distribution_AddressCohorts(client) + self.addresses_data: MetricsTree_Distribution_AddressesData = MetricsTree_Distribution_AddressesData(client) + self.any_address_indexes: MetricsTree_Distribution_AnyAddressIndexes = MetricsTree_Distribution_AnyAddressIndexes(client) + self.chain_state: MetricPattern11[SupplyState] = MetricPattern11(client, 'chain') + self.empty_addr_count: MetricsTree_Distribution_EmptyAddrCount = MetricsTree_Distribution_EmptyAddrCount(client) + self.emptyaddressindex: MetricPattern32[EmptyAddressIndex] = MetricPattern32(client, 'emptyaddressindex') + self.loadedaddressindex: MetricPattern31[LoadedAddressIndex] = MetricPattern31(client, 'loadedaddressindex') + self.utxo_cohorts: MetricsTree_Distribution_UtxoCohorts = MetricsTree_Distribution_UtxoCohorts(client) class MetricsTree_Indexes_Address_Empty: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.identity: MetricPattern9[EmptyOutputIndex] = MetricPattern9( - client, "emptyoutputindex" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.identity: MetricPattern9[EmptyOutputIndex] = MetricPattern9(client, 'emptyoutputindex') class MetricsTree_Indexes_Address_Opreturn: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.identity: MetricPattern14[OpReturnIndex] = MetricPattern14( - client, "opreturnindex" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.identity: MetricPattern14[OpReturnIndex] = MetricPattern14(client, 'opreturnindex') class MetricsTree_Indexes_Address_P2a: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.identity: MetricPattern16[P2AAddressIndex] = MetricPattern16( - client, "p2aaddressindex" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.identity: MetricPattern16[P2AAddressIndex] = MetricPattern16(client, 'p2aaddressindex') class MetricsTree_Indexes_Address_P2ms: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.identity: MetricPattern17[P2MSOutputIndex] = MetricPattern17( - client, "p2msoutputindex" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.identity: MetricPattern17[P2MSOutputIndex] = MetricPattern17(client, 'p2msoutputindex') class MetricsTree_Indexes_Address_P2pk33: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.identity: MetricPattern18[P2PK33AddressIndex] = MetricPattern18( - client, "p2pk33addressindex" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.identity: MetricPattern18[P2PK33AddressIndex] = MetricPattern18(client, 'p2pk33addressindex') class MetricsTree_Indexes_Address_P2pk65: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.identity: MetricPattern19[P2PK65AddressIndex] = MetricPattern19( - client, "p2pk65addressindex" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.identity: MetricPattern19[P2PK65AddressIndex] = MetricPattern19(client, 'p2pk65addressindex') class MetricsTree_Indexes_Address_P2pkh: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.identity: MetricPattern20[P2PKHAddressIndex] = MetricPattern20( - client, "p2pkhaddressindex" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.identity: MetricPattern20[P2PKHAddressIndex] = MetricPattern20(client, 'p2pkhaddressindex') class MetricsTree_Indexes_Address_P2sh: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.identity: MetricPattern21[P2SHAddressIndex] = MetricPattern21( - client, "p2shaddressindex" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.identity: MetricPattern21[P2SHAddressIndex] = MetricPattern21(client, 'p2shaddressindex') class MetricsTree_Indexes_Address_P2tr: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.identity: MetricPattern22[P2TRAddressIndex] = MetricPattern22( - client, "p2traddressindex" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.identity: MetricPattern22[P2TRAddressIndex] = MetricPattern22(client, 'p2traddressindex') class MetricsTree_Indexes_Address_P2wpkh: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.identity: MetricPattern23[P2WPKHAddressIndex] = MetricPattern23( - client, "p2wpkhaddressindex" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.identity: MetricPattern23[P2WPKHAddressIndex] = MetricPattern23(client, 'p2wpkhaddressindex') class MetricsTree_Indexes_Address_P2wsh: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.identity: MetricPattern24[P2WSHAddressIndex] = MetricPattern24( - client, "p2wshaddressindex" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.identity: MetricPattern24[P2WSHAddressIndex] = MetricPattern24(client, 'p2wshaddressindex') class MetricsTree_Indexes_Address_Unknown: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.identity: MetricPattern28[UnknownOutputIndex] = MetricPattern28( - client, "unknownoutputindex" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.identity: MetricPattern28[UnknownOutputIndex] = MetricPattern28(client, 'unknownoutputindex') class MetricsTree_Indexes_Address: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.empty: MetricsTree_Indexes_Address_Empty = ( - MetricsTree_Indexes_Address_Empty(client) - ) - self.opreturn: MetricsTree_Indexes_Address_Opreturn = ( - MetricsTree_Indexes_Address_Opreturn(client) - ) - self.p2a: MetricsTree_Indexes_Address_P2a = MetricsTree_Indexes_Address_P2a( - client - ) - self.p2ms: MetricsTree_Indexes_Address_P2ms = MetricsTree_Indexes_Address_P2ms( - client - ) - self.p2pk33: MetricsTree_Indexes_Address_P2pk33 = ( - MetricsTree_Indexes_Address_P2pk33(client) - ) - self.p2pk65: MetricsTree_Indexes_Address_P2pk65 = ( - MetricsTree_Indexes_Address_P2pk65(client) - ) - self.p2pkh: MetricsTree_Indexes_Address_P2pkh = ( - MetricsTree_Indexes_Address_P2pkh(client) - ) - self.p2sh: MetricsTree_Indexes_Address_P2sh = MetricsTree_Indexes_Address_P2sh( - client - ) - self.p2tr: MetricsTree_Indexes_Address_P2tr = MetricsTree_Indexes_Address_P2tr( - client - ) - self.p2wpkh: MetricsTree_Indexes_Address_P2wpkh = ( - MetricsTree_Indexes_Address_P2wpkh(client) - ) - self.p2wsh: MetricsTree_Indexes_Address_P2wsh = ( - MetricsTree_Indexes_Address_P2wsh(client) - ) - self.unknown: MetricsTree_Indexes_Address_Unknown = ( - MetricsTree_Indexes_Address_Unknown(client) - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.empty: MetricsTree_Indexes_Address_Empty = MetricsTree_Indexes_Address_Empty(client) + self.opreturn: MetricsTree_Indexes_Address_Opreturn = MetricsTree_Indexes_Address_Opreturn(client) + self.p2a: MetricsTree_Indexes_Address_P2a = MetricsTree_Indexes_Address_P2a(client) + self.p2ms: MetricsTree_Indexes_Address_P2ms = MetricsTree_Indexes_Address_P2ms(client) + self.p2pk33: MetricsTree_Indexes_Address_P2pk33 = MetricsTree_Indexes_Address_P2pk33(client) + self.p2pk65: MetricsTree_Indexes_Address_P2pk65 = MetricsTree_Indexes_Address_P2pk65(client) + self.p2pkh: MetricsTree_Indexes_Address_P2pkh = MetricsTree_Indexes_Address_P2pkh(client) + self.p2sh: MetricsTree_Indexes_Address_P2sh = MetricsTree_Indexes_Address_P2sh(client) + self.p2tr: MetricsTree_Indexes_Address_P2tr = MetricsTree_Indexes_Address_P2tr(client) + self.p2wpkh: MetricsTree_Indexes_Address_P2wpkh = MetricsTree_Indexes_Address_P2wpkh(client) + self.p2wsh: MetricsTree_Indexes_Address_P2wsh = MetricsTree_Indexes_Address_P2wsh(client) + self.unknown: MetricsTree_Indexes_Address_Unknown = MetricsTree_Indexes_Address_Unknown(client) class MetricsTree_Indexes_Dateindex: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.date: MetricPattern6[Date] = MetricPattern6(client, "dateindex_date") - self.first_height: MetricPattern6[Height] = MetricPattern6( - client, "dateindex_first_height" - ) - self.height_count: MetricPattern6[StoredU64] = MetricPattern6( - client, "dateindex_height_count" - ) - self.identity: MetricPattern6[DateIndex] = MetricPattern6(client, "dateindex") - self.monthindex: MetricPattern6[MonthIndex] = MetricPattern6( - client, "dateindex_monthindex" - ) - self.weekindex: MetricPattern6[WeekIndex] = MetricPattern6( - client, "dateindex_weekindex" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.date: MetricPattern6[Date] = MetricPattern6(client, 'dateindex_date') + self.first_height: MetricPattern6[Height] = MetricPattern6(client, 'dateindex_first_height') + self.height_count: MetricPattern6[StoredU64] = MetricPattern6(client, 'dateindex_height_count') + self.identity: MetricPattern6[DateIndex] = MetricPattern6(client, 'dateindex') + self.monthindex: MetricPattern6[MonthIndex] = MetricPattern6(client, 'dateindex_monthindex') + self.weekindex: MetricPattern6[WeekIndex] = MetricPattern6(client, 'dateindex_weekindex') class MetricsTree_Indexes_Decadeindex: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.first_yearindex: MetricPattern7[YearIndex] = MetricPattern7( - client, "decadeindex_first_yearindex" - ) - self.identity: MetricPattern7[DecadeIndex] = MetricPattern7( - client, "decadeindex" - ) - self.yearindex_count: MetricPattern7[StoredU64] = MetricPattern7( - client, "decadeindex_yearindex_count" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.first_yearindex: MetricPattern7[YearIndex] = MetricPattern7(client, 'decadeindex_first_yearindex') + self.identity: MetricPattern7[DecadeIndex] = MetricPattern7(client, 'decadeindex') + self.yearindex_count: MetricPattern7[StoredU64] = MetricPattern7(client, 'decadeindex_yearindex_count') class MetricsTree_Indexes_Difficultyepoch: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.first_height: MetricPattern8[Height] = MetricPattern8( - client, "difficultyepoch_first_height" - ) - self.height_count: MetricPattern8[StoredU64] = MetricPattern8( - client, "difficultyepoch_height_count" - ) - self.identity: MetricPattern8[DifficultyEpoch] = MetricPattern8( - client, "difficultyepoch" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.first_height: MetricPattern8[Height] = MetricPattern8(client, 'difficultyepoch_first_height') + self.height_count: MetricPattern8[StoredU64] = MetricPattern8(client, 'difficultyepoch_height_count') + self.identity: MetricPattern8[DifficultyEpoch] = MetricPattern8(client, 'difficultyepoch') class MetricsTree_Indexes_Halvingepoch: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.first_height: MetricPattern10[Height] = MetricPattern10( - client, "halvingepoch_first_height" - ) - self.identity: MetricPattern10[HalvingEpoch] = MetricPattern10( - client, "halvingepoch" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.first_height: MetricPattern10[Height] = MetricPattern10(client, 'halvingepoch_first_height') + self.identity: MetricPattern10[HalvingEpoch] = MetricPattern10(client, 'halvingepoch') class MetricsTree_Indexes_Height: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.dateindex: MetricPattern11[DateIndex] = MetricPattern11( - client, "height_dateindex" - ) - self.difficultyepoch: MetricPattern11[DifficultyEpoch] = MetricPattern11( - client, "height_difficultyepoch" - ) - self.halvingepoch: MetricPattern11[HalvingEpoch] = MetricPattern11( - client, "height_halvingepoch" - ) - self.identity: MetricPattern11[Height] = MetricPattern11(client, "height") - self.txindex_count: MetricPattern11[StoredU64] = MetricPattern11( - client, "height_txindex_count" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.dateindex: MetricPattern11[DateIndex] = MetricPattern11(client, 'height_dateindex') + self.difficultyepoch: MetricPattern11[DifficultyEpoch] = MetricPattern11(client, 'height_difficultyepoch') + self.halvingepoch: MetricPattern11[HalvingEpoch] = MetricPattern11(client, 'height_halvingepoch') + self.identity: MetricPattern11[Height] = MetricPattern11(client, 'height') + self.txindex_count: MetricPattern11[StoredU64] = MetricPattern11(client, 'height_txindex_count') class MetricsTree_Indexes_Monthindex: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.dateindex_count: MetricPattern13[StoredU64] = MetricPattern13( - client, "monthindex_dateindex_count" - ) - self.first_dateindex: MetricPattern13[DateIndex] = MetricPattern13( - client, "monthindex_first_dateindex" - ) - self.identity: MetricPattern13[MonthIndex] = MetricPattern13( - client, "monthindex" - ) - self.quarterindex: MetricPattern13[QuarterIndex] = MetricPattern13( - client, "monthindex_quarterindex" - ) - self.semesterindex: MetricPattern13[SemesterIndex] = MetricPattern13( - client, "monthindex_semesterindex" - ) - self.yearindex: MetricPattern13[YearIndex] = MetricPattern13( - client, "monthindex_yearindex" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.dateindex_count: MetricPattern13[StoredU64] = MetricPattern13(client, 'monthindex_dateindex_count') + self.first_dateindex: MetricPattern13[DateIndex] = MetricPattern13(client, 'monthindex_first_dateindex') + self.identity: MetricPattern13[MonthIndex] = MetricPattern13(client, 'monthindex') + self.quarterindex: MetricPattern13[QuarterIndex] = MetricPattern13(client, 'monthindex_quarterindex') + self.semesterindex: MetricPattern13[SemesterIndex] = MetricPattern13(client, 'monthindex_semesterindex') + self.yearindex: MetricPattern13[YearIndex] = MetricPattern13(client, 'monthindex_yearindex') class MetricsTree_Indexes_Quarterindex: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.first_monthindex: MetricPattern25[MonthIndex] = MetricPattern25( - client, "quarterindex_first_monthindex" - ) - self.identity: MetricPattern25[QuarterIndex] = MetricPattern25( - client, "quarterindex" - ) - self.monthindex_count: MetricPattern25[StoredU64] = MetricPattern25( - client, "quarterindex_monthindex_count" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.first_monthindex: MetricPattern25[MonthIndex] = MetricPattern25(client, 'quarterindex_first_monthindex') + self.identity: MetricPattern25[QuarterIndex] = MetricPattern25(client, 'quarterindex') + self.monthindex_count: MetricPattern25[StoredU64] = MetricPattern25(client, 'quarterindex_monthindex_count') class MetricsTree_Indexes_Semesterindex: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.first_monthindex: MetricPattern26[MonthIndex] = MetricPattern26( - client, "semesterindex_first_monthindex" - ) - self.identity: MetricPattern26[SemesterIndex] = MetricPattern26( - client, "semesterindex" - ) - self.monthindex_count: MetricPattern26[StoredU64] = MetricPattern26( - client, "semesterindex_monthindex_count" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.first_monthindex: MetricPattern26[MonthIndex] = MetricPattern26(client, 'semesterindex_first_monthindex') + self.identity: MetricPattern26[SemesterIndex] = MetricPattern26(client, 'semesterindex') + self.monthindex_count: MetricPattern26[StoredU64] = MetricPattern26(client, 'semesterindex_monthindex_count') class MetricsTree_Indexes_Txindex: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.identity: MetricPattern27[TxIndex] = MetricPattern27(client, "txindex") - self.input_count: MetricPattern27[StoredU64] = MetricPattern27( - client, "txindex_input_count" - ) - self.output_count: MetricPattern27[StoredU64] = MetricPattern27( - client, "txindex_output_count" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.identity: MetricPattern27[TxIndex] = MetricPattern27(client, 'txindex') + self.input_count: MetricPattern27[StoredU64] = MetricPattern27(client, 'txindex_input_count') + self.output_count: MetricPattern27[StoredU64] = MetricPattern27(client, 'txindex_output_count') class MetricsTree_Indexes_Txinindex: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.identity: MetricPattern12[TxInIndex] = MetricPattern12(client, "txinindex") - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.identity: MetricPattern12[TxInIndex] = MetricPattern12(client, 'txinindex') class MetricsTree_Indexes_Txoutindex: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.identity: MetricPattern15[TxOutIndex] = MetricPattern15( - client, "txoutindex" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.identity: MetricPattern15[TxOutIndex] = MetricPattern15(client, 'txoutindex') class MetricsTree_Indexes_Weekindex: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.dateindex_count: MetricPattern29[StoredU64] = MetricPattern29( - client, "weekindex_dateindex_count" - ) - self.first_dateindex: MetricPattern29[DateIndex] = MetricPattern29( - client, "weekindex_first_dateindex" - ) - self.identity: MetricPattern29[WeekIndex] = MetricPattern29(client, "weekindex") - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.dateindex_count: MetricPattern29[StoredU64] = MetricPattern29(client, 'weekindex_dateindex_count') + self.first_dateindex: MetricPattern29[DateIndex] = MetricPattern29(client, 'weekindex_first_dateindex') + self.identity: MetricPattern29[WeekIndex] = MetricPattern29(client, 'weekindex') class MetricsTree_Indexes_Yearindex: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.decadeindex: MetricPattern30[DecadeIndex] = MetricPattern30( - client, "yearindex_decadeindex" - ) - self.first_monthindex: MetricPattern30[MonthIndex] = MetricPattern30( - client, "yearindex_first_monthindex" - ) - self.identity: MetricPattern30[YearIndex] = MetricPattern30(client, "yearindex") - self.monthindex_count: MetricPattern30[StoredU64] = MetricPattern30( - client, "yearindex_monthindex_count" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.decadeindex: MetricPattern30[DecadeIndex] = MetricPattern30(client, 'yearindex_decadeindex') + self.first_monthindex: MetricPattern30[MonthIndex] = MetricPattern30(client, 'yearindex_first_monthindex') + self.identity: MetricPattern30[YearIndex] = MetricPattern30(client, 'yearindex') + self.monthindex_count: MetricPattern30[StoredU64] = MetricPattern30(client, 'yearindex_monthindex_count') class MetricsTree_Indexes: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): + + def __init__(self, client: BrkClientBase, base_path: str = ''): self.address: MetricsTree_Indexes_Address = MetricsTree_Indexes_Address(client) - self.dateindex: MetricsTree_Indexes_Dateindex = MetricsTree_Indexes_Dateindex( - client - ) - self.decadeindex: MetricsTree_Indexes_Decadeindex = ( - MetricsTree_Indexes_Decadeindex(client) - ) - self.difficultyepoch: MetricsTree_Indexes_Difficultyepoch = ( - MetricsTree_Indexes_Difficultyepoch(client) - ) - self.halvingepoch: MetricsTree_Indexes_Halvingepoch = ( - MetricsTree_Indexes_Halvingepoch(client) - ) + self.dateindex: MetricsTree_Indexes_Dateindex = MetricsTree_Indexes_Dateindex(client) + self.decadeindex: MetricsTree_Indexes_Decadeindex = MetricsTree_Indexes_Decadeindex(client) + self.difficultyepoch: MetricsTree_Indexes_Difficultyepoch = MetricsTree_Indexes_Difficultyepoch(client) + self.halvingepoch: MetricsTree_Indexes_Halvingepoch = MetricsTree_Indexes_Halvingepoch(client) self.height: MetricsTree_Indexes_Height = MetricsTree_Indexes_Height(client) - self.monthindex: MetricsTree_Indexes_Monthindex = ( - MetricsTree_Indexes_Monthindex(client) - ) - self.quarterindex: MetricsTree_Indexes_Quarterindex = ( - MetricsTree_Indexes_Quarterindex(client) - ) - self.semesterindex: MetricsTree_Indexes_Semesterindex = ( - MetricsTree_Indexes_Semesterindex(client) - ) + self.monthindex: MetricsTree_Indexes_Monthindex = MetricsTree_Indexes_Monthindex(client) + self.quarterindex: MetricsTree_Indexes_Quarterindex = MetricsTree_Indexes_Quarterindex(client) + self.semesterindex: MetricsTree_Indexes_Semesterindex = MetricsTree_Indexes_Semesterindex(client) self.txindex: MetricsTree_Indexes_Txindex = MetricsTree_Indexes_Txindex(client) - self.txinindex: MetricsTree_Indexes_Txinindex = MetricsTree_Indexes_Txinindex( - client - ) - self.txoutindex: MetricsTree_Indexes_Txoutindex = ( - MetricsTree_Indexes_Txoutindex(client) - ) - self.weekindex: MetricsTree_Indexes_Weekindex = MetricsTree_Indexes_Weekindex( - client - ) - self.yearindex: MetricsTree_Indexes_Yearindex = MetricsTree_Indexes_Yearindex( - client - ) - + self.txinindex: MetricsTree_Indexes_Txinindex = MetricsTree_Indexes_Txinindex(client) + self.txoutindex: MetricsTree_Indexes_Txoutindex = MetricsTree_Indexes_Txoutindex(client) + self.weekindex: MetricsTree_Indexes_Weekindex = MetricsTree_Indexes_Weekindex(client) + self.yearindex: MetricsTree_Indexes_Yearindex = MetricsTree_Indexes_Yearindex(client) class MetricsTree_Inputs_Spent: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.txoutindex: MetricPattern12[TxOutIndex] = MetricPattern12( - client, "txoutindex" - ) - self.value: MetricPattern12[Sats] = MetricPattern12(client, "value") - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.txoutindex: MetricPattern12[TxOutIndex] = MetricPattern12(client, 'txoutindex') + self.value: MetricPattern12[Sats] = MetricPattern12(client, 'value') class MetricsTree_Inputs: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.count: CountPattern2[StoredU64] = CountPattern2(client, "input_count") - self.first_txinindex: MetricPattern11[TxInIndex] = MetricPattern11( - client, "first_txinindex" - ) - self.outpoint: MetricPattern12[OutPoint] = MetricPattern12(client, "outpoint") - self.outputtype: MetricPattern12[OutputType] = MetricPattern12( - client, "outputtype" - ) + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.count: CountPattern2[StoredU64] = CountPattern2(client, 'input_count') + self.first_txinindex: MetricPattern11[TxInIndex] = MetricPattern11(client, 'first_txinindex') + self.outpoint: MetricPattern12[OutPoint] = MetricPattern12(client, 'outpoint') + self.outputtype: MetricPattern12[OutputType] = MetricPattern12(client, 'outputtype') self.spent: MetricsTree_Inputs_Spent = MetricsTree_Inputs_Spent(client) - self.txindex: MetricPattern12[TxIndex] = MetricPattern12(client, "txindex") - self.typeindex: MetricPattern12[TypeIndex] = MetricPattern12( - client, "typeindex" - ) - self.witness_size: MetricPattern12[StoredU32] = MetricPattern12( - client, "witness_size" - ) - + self.txindex: MetricPattern12[TxIndex] = MetricPattern12(client, 'txindex') + self.typeindex: MetricPattern12[TypeIndex] = MetricPattern12(client, 'typeindex') + self.witness_size: MetricPattern12[StoredU32] = MetricPattern12(client, 'witness_size') class MetricsTree_Market_Ath: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.days_since_price_ath: MetricPattern4[StoredU16] = MetricPattern4( - client, "days_since_price_ath" - ) - self.max_days_between_price_aths: MetricPattern4[StoredU16] = MetricPattern4( - client, "max_days_between_price_aths" - ) - self.max_years_between_price_aths: MetricPattern4[StoredF32] = MetricPattern4( - client, "max_years_between_price_aths" - ) - self.price_ath: MetricPattern1[Dollars] = MetricPattern1(client, "price_ath") - self.price_drawdown: MetricPattern3[StoredF32] = MetricPattern3( - client, "price_drawdown" - ) - self.years_since_price_ath: MetricPattern4[StoredF32] = MetricPattern4( - client, "years_since_price_ath" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.days_since_price_ath: MetricPattern4[StoredU16] = MetricPattern4(client, 'days_since_price_ath') + self.max_days_between_price_aths: MetricPattern4[StoredU16] = MetricPattern4(client, 'max_days_between_price_aths') + self.max_years_between_price_aths: MetricPattern4[StoredF32] = MetricPattern4(client, 'max_years_between_price_aths') + self.price_ath: MetricPattern1[Dollars] = MetricPattern1(client, 'price_ath') + self.price_drawdown: MetricPattern3[StoredF32] = MetricPattern3(client, 'price_drawdown') + self.years_since_price_ath: MetricPattern4[StoredF32] = MetricPattern4(client, 'years_since_price_ath') class MetricsTree_Market_Dca_ClassAveragePrice: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self._2015: MetricPattern4[Dollars] = MetricPattern4( - client, "dca_class_2015_average_price" - ) - self._2016: MetricPattern4[Dollars] = MetricPattern4( - client, "dca_class_2016_average_price" - ) - self._2017: MetricPattern4[Dollars] = MetricPattern4( - client, "dca_class_2017_average_price" - ) - self._2018: MetricPattern4[Dollars] = MetricPattern4( - client, "dca_class_2018_average_price" - ) - self._2019: MetricPattern4[Dollars] = MetricPattern4( - client, "dca_class_2019_average_price" - ) - self._2020: MetricPattern4[Dollars] = MetricPattern4( - client, "dca_class_2020_average_price" - ) - self._2021: MetricPattern4[Dollars] = MetricPattern4( - client, "dca_class_2021_average_price" - ) - self._2022: MetricPattern4[Dollars] = MetricPattern4( - client, "dca_class_2022_average_price" - ) - self._2023: MetricPattern4[Dollars] = MetricPattern4( - client, "dca_class_2023_average_price" - ) - self._2024: MetricPattern4[Dollars] = MetricPattern4( - client, "dca_class_2024_average_price" - ) - self._2025: MetricPattern4[Dollars] = MetricPattern4( - client, "dca_class_2025_average_price" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._2015: MetricPattern4[Dollars] = MetricPattern4(client, 'dca_class_2015_average_price') + self._2016: MetricPattern4[Dollars] = MetricPattern4(client, 'dca_class_2016_average_price') + self._2017: MetricPattern4[Dollars] = MetricPattern4(client, 'dca_class_2017_average_price') + self._2018: MetricPattern4[Dollars] = MetricPattern4(client, 'dca_class_2018_average_price') + self._2019: MetricPattern4[Dollars] = MetricPattern4(client, 'dca_class_2019_average_price') + self._2020: MetricPattern4[Dollars] = MetricPattern4(client, 'dca_class_2020_average_price') + self._2021: MetricPattern4[Dollars] = MetricPattern4(client, 'dca_class_2021_average_price') + self._2022: MetricPattern4[Dollars] = MetricPattern4(client, 'dca_class_2022_average_price') + self._2023: MetricPattern4[Dollars] = MetricPattern4(client, 'dca_class_2023_average_price') + self._2024: MetricPattern4[Dollars] = MetricPattern4(client, 'dca_class_2024_average_price') + self._2025: MetricPattern4[Dollars] = MetricPattern4(client, 'dca_class_2025_average_price') class MetricsTree_Market_Dca_ClassReturns: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self._2015: MetricPattern4[StoredF32] = MetricPattern4( - client, "dca_class_2015_returns" - ) - self._2016: MetricPattern4[StoredF32] = MetricPattern4( - client, "dca_class_2016_returns" - ) - self._2017: MetricPattern4[StoredF32] = MetricPattern4( - client, "dca_class_2017_returns" - ) - self._2018: MetricPattern4[StoredF32] = MetricPattern4( - client, "dca_class_2018_returns" - ) - self._2019: MetricPattern4[StoredF32] = MetricPattern4( - client, "dca_class_2019_returns" - ) - self._2020: MetricPattern4[StoredF32] = MetricPattern4( - client, "dca_class_2020_returns" - ) - self._2021: MetricPattern4[StoredF32] = MetricPattern4( - client, "dca_class_2021_returns" - ) - self._2022: MetricPattern4[StoredF32] = MetricPattern4( - client, "dca_class_2022_returns" - ) - self._2023: MetricPattern4[StoredF32] = MetricPattern4( - client, "dca_class_2023_returns" - ) - self._2024: MetricPattern4[StoredF32] = MetricPattern4( - client, "dca_class_2024_returns" - ) - self._2025: MetricPattern4[StoredF32] = MetricPattern4( - client, "dca_class_2025_returns" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._2015: MetricPattern4[StoredF32] = MetricPattern4(client, 'dca_class_2015_returns') + self._2016: MetricPattern4[StoredF32] = MetricPattern4(client, 'dca_class_2016_returns') + self._2017: MetricPattern4[StoredF32] = MetricPattern4(client, 'dca_class_2017_returns') + self._2018: MetricPattern4[StoredF32] = MetricPattern4(client, 'dca_class_2018_returns') + self._2019: MetricPattern4[StoredF32] = MetricPattern4(client, 'dca_class_2019_returns') + self._2020: MetricPattern4[StoredF32] = MetricPattern4(client, 'dca_class_2020_returns') + self._2021: MetricPattern4[StoredF32] = MetricPattern4(client, 'dca_class_2021_returns') + self._2022: MetricPattern4[StoredF32] = MetricPattern4(client, 'dca_class_2022_returns') + self._2023: MetricPattern4[StoredF32] = MetricPattern4(client, 'dca_class_2023_returns') + self._2024: MetricPattern4[StoredF32] = MetricPattern4(client, 'dca_class_2024_returns') + self._2025: MetricPattern4[StoredF32] = MetricPattern4(client, 'dca_class_2025_returns') class MetricsTree_Market_Dca_ClassStack: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self._2015: _2015Pattern = _2015Pattern(client, "dca_class_2015_stack") - self._2016: _2015Pattern = _2015Pattern(client, "dca_class_2016_stack") - self._2017: _2015Pattern = _2015Pattern(client, "dca_class_2017_stack") - self._2018: _2015Pattern = _2015Pattern(client, "dca_class_2018_stack") - self._2019: _2015Pattern = _2015Pattern(client, "dca_class_2019_stack") - self._2020: _2015Pattern = _2015Pattern(client, "dca_class_2020_stack") - self._2021: _2015Pattern = _2015Pattern(client, "dca_class_2021_stack") - self._2022: _2015Pattern = _2015Pattern(client, "dca_class_2022_stack") - self._2023: _2015Pattern = _2015Pattern(client, "dca_class_2023_stack") - self._2024: _2015Pattern = _2015Pattern(client, "dca_class_2024_stack") - self._2025: _2015Pattern = _2015Pattern(client, "dca_class_2025_stack") - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._2015: _2015Pattern = _2015Pattern(client, 'dca_class_2015_stack') + self._2016: _2015Pattern = _2015Pattern(client, 'dca_class_2016_stack') + self._2017: _2015Pattern = _2015Pattern(client, 'dca_class_2017_stack') + self._2018: _2015Pattern = _2015Pattern(client, 'dca_class_2018_stack') + self._2019: _2015Pattern = _2015Pattern(client, 'dca_class_2019_stack') + self._2020: _2015Pattern = _2015Pattern(client, 'dca_class_2020_stack') + self._2021: _2015Pattern = _2015Pattern(client, 'dca_class_2021_stack') + self._2022: _2015Pattern = _2015Pattern(client, 'dca_class_2022_stack') + self._2023: _2015Pattern = _2015Pattern(client, 'dca_class_2023_stack') + self._2024: _2015Pattern = _2015Pattern(client, 'dca_class_2024_stack') + self._2025: _2015Pattern = _2015Pattern(client, 'dca_class_2025_stack') class MetricsTree_Market_Dca: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.class_average_price: MetricsTree_Market_Dca_ClassAveragePrice = ( - MetricsTree_Market_Dca_ClassAveragePrice(client) - ) - self.class_returns: MetricsTree_Market_Dca_ClassReturns = ( - MetricsTree_Market_Dca_ClassReturns(client) - ) - self.class_stack: MetricsTree_Market_Dca_ClassStack = ( - MetricsTree_Market_Dca_ClassStack(client) - ) - self.period_average_price: PeriodAveragePricePattern[Dollars] = ( - PeriodAveragePricePattern(client, "dca_average_price") - ) - self.period_cagr: PeriodCagrPattern = PeriodCagrPattern(client, "dca_cagr") - self.period_lump_sum_stack: PeriodLumpSumStackPattern = ( - PeriodLumpSumStackPattern(client, "lump_sum_stack") - ) - self.period_returns: PeriodAveragePricePattern[StoredF32] = ( - PeriodAveragePricePattern(client, "dca_returns") - ) - self.period_stack: PeriodLumpSumStackPattern = PeriodLumpSumStackPattern( - client, "dca_stack" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.class_average_price: MetricsTree_Market_Dca_ClassAveragePrice = MetricsTree_Market_Dca_ClassAveragePrice(client) + self.class_returns: MetricsTree_Market_Dca_ClassReturns = MetricsTree_Market_Dca_ClassReturns(client) + self.class_stack: MetricsTree_Market_Dca_ClassStack = MetricsTree_Market_Dca_ClassStack(client) + self.period_average_price: PeriodAveragePricePattern[Dollars] = PeriodAveragePricePattern(client, 'dca_average_price') + self.period_cagr: PeriodCagrPattern = PeriodCagrPattern(client, 'dca_cagr') + self.period_lump_sum_stack: PeriodLumpSumStackPattern = PeriodLumpSumStackPattern(client, 'lump_sum_stack') + self.period_returns: PeriodAveragePricePattern[StoredF32] = PeriodAveragePricePattern(client, 'dca_returns') + self.period_stack: PeriodLumpSumStackPattern = PeriodLumpSumStackPattern(client, 'dca_stack') class MetricsTree_Market_Indicators: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.gini: MetricPattern6[StoredF32] = MetricPattern6(client, "gini") - self.macd_histogram: MetricPattern6[StoredF32] = MetricPattern6( - client, "macd_histogram" - ) - self.macd_line: MetricPattern6[StoredF32] = MetricPattern6(client, "macd_line") - self.macd_signal: MetricPattern6[StoredF32] = MetricPattern6( - client, "macd_signal" - ) - self.nvt: MetricPattern4[StoredF32] = MetricPattern4(client, "nvt") - self.pi_cycle: MetricPattern6[StoredF32] = MetricPattern6(client, "pi_cycle") - self.puell_multiple: MetricPattern4[StoredF32] = MetricPattern4( - client, "puell_multiple" - ) - self.rsi_14d: MetricPattern6[StoredF32] = MetricPattern6(client, "rsi_14d") - self.rsi_14d_max: MetricPattern6[StoredF32] = MetricPattern6( - client, "rsi_14d_max" - ) - self.rsi_14d_min: MetricPattern6[StoredF32] = MetricPattern6( - client, "rsi_14d_min" - ) - self.rsi_average_gain_14d: MetricPattern6[StoredF32] = MetricPattern6( - client, "rsi_average_gain_14d" - ) - self.rsi_average_loss_14d: MetricPattern6[StoredF32] = MetricPattern6( - client, "rsi_average_loss_14d" - ) - self.rsi_gains: MetricPattern6[StoredF32] = MetricPattern6(client, "rsi_gains") - self.rsi_losses: MetricPattern6[StoredF32] = MetricPattern6( - client, "rsi_losses" - ) - self.stoch_d: MetricPattern6[StoredF32] = MetricPattern6(client, "stoch_d") - self.stoch_k: MetricPattern6[StoredF32] = MetricPattern6(client, "stoch_k") - self.stoch_rsi: MetricPattern6[StoredF32] = MetricPattern6(client, "stoch_rsi") - self.stoch_rsi_d: MetricPattern6[StoredF32] = MetricPattern6( - client, "stoch_rsi_d" - ) - self.stoch_rsi_k: MetricPattern6[StoredF32] = MetricPattern6( - client, "stoch_rsi_k" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.gini: MetricPattern6[StoredF32] = MetricPattern6(client, 'gini') + self.macd_histogram: MetricPattern6[StoredF32] = MetricPattern6(client, 'macd_histogram') + self.macd_line: MetricPattern6[StoredF32] = MetricPattern6(client, 'macd_line') + self.macd_signal: MetricPattern6[StoredF32] = MetricPattern6(client, 'macd_signal') + self.nvt: MetricPattern4[StoredF32] = MetricPattern4(client, 'nvt') + self.pi_cycle: MetricPattern6[StoredF32] = MetricPattern6(client, 'pi_cycle') + self.puell_multiple: MetricPattern4[StoredF32] = MetricPattern4(client, 'puell_multiple') + self.rsi_14d: MetricPattern6[StoredF32] = MetricPattern6(client, 'rsi_14d') + self.rsi_14d_max: MetricPattern6[StoredF32] = MetricPattern6(client, 'rsi_14d_max') + self.rsi_14d_min: MetricPattern6[StoredF32] = MetricPattern6(client, 'rsi_14d_min') + self.rsi_average_gain_14d: MetricPattern6[StoredF32] = MetricPattern6(client, 'rsi_average_gain_14d') + self.rsi_average_loss_14d: MetricPattern6[StoredF32] = MetricPattern6(client, 'rsi_average_loss_14d') + self.rsi_gains: MetricPattern6[StoredF32] = MetricPattern6(client, 'rsi_gains') + self.rsi_losses: MetricPattern6[StoredF32] = MetricPattern6(client, 'rsi_losses') + self.stoch_d: MetricPattern6[StoredF32] = MetricPattern6(client, 'stoch_d') + self.stoch_k: MetricPattern6[StoredF32] = MetricPattern6(client, 'stoch_k') + self.stoch_rsi: MetricPattern6[StoredF32] = MetricPattern6(client, 'stoch_rsi') + self.stoch_rsi_d: MetricPattern6[StoredF32] = MetricPattern6(client, 'stoch_rsi_d') + self.stoch_rsi_k: MetricPattern6[StoredF32] = MetricPattern6(client, 'stoch_rsi_k') class MetricsTree_Market_Lookback_PriceAgo: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self._10y: MetricPattern4[Dollars] = MetricPattern4(client, "price_10y_ago") - self._1d: MetricPattern4[Dollars] = MetricPattern4(client, "price_1d_ago") - self._1m: MetricPattern4[Dollars] = MetricPattern4(client, "price_1m_ago") - self._1w: MetricPattern4[Dollars] = MetricPattern4(client, "price_1w_ago") - self._1y: MetricPattern4[Dollars] = MetricPattern4(client, "price_1y_ago") - self._2y: MetricPattern4[Dollars] = MetricPattern4(client, "price_2y_ago") - self._3m: MetricPattern4[Dollars] = MetricPattern4(client, "price_3m_ago") - self._3y: MetricPattern4[Dollars] = MetricPattern4(client, "price_3y_ago") - self._4y: MetricPattern4[Dollars] = MetricPattern4(client, "price_4y_ago") - self._5y: MetricPattern4[Dollars] = MetricPattern4(client, "price_5y_ago") - self._6m: MetricPattern4[Dollars] = MetricPattern4(client, "price_6m_ago") - self._6y: MetricPattern4[Dollars] = MetricPattern4(client, "price_6y_ago") - self._8y: MetricPattern4[Dollars] = MetricPattern4(client, "price_8y_ago") - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._10y: MetricPattern4[Dollars] = MetricPattern4(client, 'price_10y_ago') + self._1d: MetricPattern4[Dollars] = MetricPattern4(client, 'price_1d_ago') + self._1m: MetricPattern4[Dollars] = MetricPattern4(client, 'price_1m_ago') + self._1w: MetricPattern4[Dollars] = MetricPattern4(client, 'price_1w_ago') + self._1y: MetricPattern4[Dollars] = MetricPattern4(client, 'price_1y_ago') + self._2y: MetricPattern4[Dollars] = MetricPattern4(client, 'price_2y_ago') + self._3m: MetricPattern4[Dollars] = MetricPattern4(client, 'price_3m_ago') + self._3y: MetricPattern4[Dollars] = MetricPattern4(client, 'price_3y_ago') + self._4y: MetricPattern4[Dollars] = MetricPattern4(client, 'price_4y_ago') + self._5y: MetricPattern4[Dollars] = MetricPattern4(client, 'price_5y_ago') + self._6m: MetricPattern4[Dollars] = MetricPattern4(client, 'price_6m_ago') + self._6y: MetricPattern4[Dollars] = MetricPattern4(client, 'price_6y_ago') + self._8y: MetricPattern4[Dollars] = MetricPattern4(client, 'price_8y_ago') class MetricsTree_Market_Lookback: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.price_ago: MetricsTree_Market_Lookback_PriceAgo = ( - MetricsTree_Market_Lookback_PriceAgo(client) - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.price_ago: MetricsTree_Market_Lookback_PriceAgo = MetricsTree_Market_Lookback_PriceAgo(client) class MetricsTree_Market_MovingAverage: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.price_111d_sma: Price111dSmaPattern = Price111dSmaPattern( - client, "price_111d_sma" - ) - self.price_12d_ema: Price111dSmaPattern = Price111dSmaPattern( - client, "price_12d_ema" - ) - self.price_13d_ema: Price111dSmaPattern = Price111dSmaPattern( - client, "price_13d_ema" - ) - self.price_13d_sma: Price111dSmaPattern = Price111dSmaPattern( - client, "price_13d_sma" - ) - self.price_144d_ema: Price111dSmaPattern = Price111dSmaPattern( - client, "price_144d_ema" - ) - self.price_144d_sma: Price111dSmaPattern = Price111dSmaPattern( - client, "price_144d_sma" - ) - self.price_1m_ema: Price111dSmaPattern = Price111dSmaPattern( - client, "price_1m_ema" - ) - self.price_1m_sma: Price111dSmaPattern = Price111dSmaPattern( - client, "price_1m_sma" - ) - self.price_1w_ema: Price111dSmaPattern = Price111dSmaPattern( - client, "price_1w_ema" - ) - self.price_1w_sma: Price111dSmaPattern = Price111dSmaPattern( - client, "price_1w_sma" - ) - self.price_1y_ema: Price111dSmaPattern = Price111dSmaPattern( - client, "price_1y_ema" - ) - self.price_1y_sma: Price111dSmaPattern = Price111dSmaPattern( - client, "price_1y_sma" - ) - self.price_200d_ema: Price111dSmaPattern = Price111dSmaPattern( - client, "price_200d_ema" - ) - self.price_200d_sma: Price111dSmaPattern = Price111dSmaPattern( - client, "price_200d_sma" - ) - self.price_200d_sma_x0_8: MetricPattern4[Dollars] = MetricPattern4( - client, "price_200d_sma_x0_8" - ) - self.price_200d_sma_x2_4: MetricPattern4[Dollars] = MetricPattern4( - client, "price_200d_sma_x2_4" - ) - self.price_200w_ema: Price111dSmaPattern = Price111dSmaPattern( - client, "price_200w_ema" - ) - self.price_200w_sma: Price111dSmaPattern = Price111dSmaPattern( - client, "price_200w_sma" - ) - self.price_21d_ema: Price111dSmaPattern = Price111dSmaPattern( - client, "price_21d_ema" - ) - self.price_21d_sma: Price111dSmaPattern = Price111dSmaPattern( - client, "price_21d_sma" - ) - self.price_26d_ema: Price111dSmaPattern = Price111dSmaPattern( - client, "price_26d_ema" - ) - self.price_2y_ema: Price111dSmaPattern = Price111dSmaPattern( - client, "price_2y_ema" - ) - self.price_2y_sma: Price111dSmaPattern = Price111dSmaPattern( - client, "price_2y_sma" - ) - self.price_34d_ema: Price111dSmaPattern = Price111dSmaPattern( - client, "price_34d_ema" - ) - self.price_34d_sma: Price111dSmaPattern = Price111dSmaPattern( - client, "price_34d_sma" - ) - self.price_350d_sma: Price111dSmaPattern = Price111dSmaPattern( - client, "price_350d_sma" - ) - self.price_350d_sma_x2: MetricPattern4[Dollars] = MetricPattern4( - client, "price_350d_sma_x2" - ) - self.price_4y_ema: Price111dSmaPattern = Price111dSmaPattern( - client, "price_4y_ema" - ) - self.price_4y_sma: Price111dSmaPattern = Price111dSmaPattern( - client, "price_4y_sma" - ) - self.price_55d_ema: Price111dSmaPattern = Price111dSmaPattern( - client, "price_55d_ema" - ) - self.price_55d_sma: Price111dSmaPattern = Price111dSmaPattern( - client, "price_55d_sma" - ) - self.price_89d_ema: Price111dSmaPattern = Price111dSmaPattern( - client, "price_89d_ema" - ) - self.price_89d_sma: Price111dSmaPattern = Price111dSmaPattern( - client, "price_89d_sma" - ) - self.price_8d_ema: Price111dSmaPattern = Price111dSmaPattern( - client, "price_8d_ema" - ) - self.price_8d_sma: Price111dSmaPattern = Price111dSmaPattern( - client, "price_8d_sma" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.price_111d_sma: Price111dSmaPattern = Price111dSmaPattern(client, 'price_111d_sma') + self.price_12d_ema: Price111dSmaPattern = Price111dSmaPattern(client, 'price_12d_ema') + self.price_13d_ema: Price111dSmaPattern = Price111dSmaPattern(client, 'price_13d_ema') + self.price_13d_sma: Price111dSmaPattern = Price111dSmaPattern(client, 'price_13d_sma') + self.price_144d_ema: Price111dSmaPattern = Price111dSmaPattern(client, 'price_144d_ema') + self.price_144d_sma: Price111dSmaPattern = Price111dSmaPattern(client, 'price_144d_sma') + self.price_1m_ema: Price111dSmaPattern = Price111dSmaPattern(client, 'price_1m_ema') + self.price_1m_sma: Price111dSmaPattern = Price111dSmaPattern(client, 'price_1m_sma') + self.price_1w_ema: Price111dSmaPattern = Price111dSmaPattern(client, 'price_1w_ema') + self.price_1w_sma: Price111dSmaPattern = Price111dSmaPattern(client, 'price_1w_sma') + self.price_1y_ema: Price111dSmaPattern = Price111dSmaPattern(client, 'price_1y_ema') + self.price_1y_sma: Price111dSmaPattern = Price111dSmaPattern(client, 'price_1y_sma') + self.price_200d_ema: Price111dSmaPattern = Price111dSmaPattern(client, 'price_200d_ema') + self.price_200d_sma: Price111dSmaPattern = Price111dSmaPattern(client, 'price_200d_sma') + self.price_200d_sma_x0_8: MetricPattern4[Dollars] = MetricPattern4(client, 'price_200d_sma_x0_8') + self.price_200d_sma_x2_4: MetricPattern4[Dollars] = MetricPattern4(client, 'price_200d_sma_x2_4') + self.price_200w_ema: Price111dSmaPattern = Price111dSmaPattern(client, 'price_200w_ema') + self.price_200w_sma: Price111dSmaPattern = Price111dSmaPattern(client, 'price_200w_sma') + self.price_21d_ema: Price111dSmaPattern = Price111dSmaPattern(client, 'price_21d_ema') + self.price_21d_sma: Price111dSmaPattern = Price111dSmaPattern(client, 'price_21d_sma') + self.price_26d_ema: Price111dSmaPattern = Price111dSmaPattern(client, 'price_26d_ema') + self.price_2y_ema: Price111dSmaPattern = Price111dSmaPattern(client, 'price_2y_ema') + self.price_2y_sma: Price111dSmaPattern = Price111dSmaPattern(client, 'price_2y_sma') + self.price_34d_ema: Price111dSmaPattern = Price111dSmaPattern(client, 'price_34d_ema') + self.price_34d_sma: Price111dSmaPattern = Price111dSmaPattern(client, 'price_34d_sma') + self.price_350d_sma: Price111dSmaPattern = Price111dSmaPattern(client, 'price_350d_sma') + self.price_350d_sma_x2: MetricPattern4[Dollars] = MetricPattern4(client, 'price_350d_sma_x2') + self.price_4y_ema: Price111dSmaPattern = Price111dSmaPattern(client, 'price_4y_ema') + self.price_4y_sma: Price111dSmaPattern = Price111dSmaPattern(client, 'price_4y_sma') + self.price_55d_ema: Price111dSmaPattern = Price111dSmaPattern(client, 'price_55d_ema') + self.price_55d_sma: Price111dSmaPattern = Price111dSmaPattern(client, 'price_55d_sma') + self.price_89d_ema: Price111dSmaPattern = Price111dSmaPattern(client, 'price_89d_ema') + self.price_89d_sma: Price111dSmaPattern = Price111dSmaPattern(client, 'price_89d_sma') + self.price_8d_ema: Price111dSmaPattern = Price111dSmaPattern(client, 'price_8d_ema') + self.price_8d_sma: Price111dSmaPattern = Price111dSmaPattern(client, 'price_8d_sma') class MetricsTree_Market_Range: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.price_1m_max: MetricPattern4[Dollars] = MetricPattern4( - client, "price_1m_max" - ) - self.price_1m_min: MetricPattern4[Dollars] = MetricPattern4( - client, "price_1m_min" - ) - self.price_1w_max: MetricPattern4[Dollars] = MetricPattern4( - client, "price_1w_max" - ) - self.price_1w_min: MetricPattern4[Dollars] = MetricPattern4( - client, "price_1w_min" - ) - self.price_1y_max: MetricPattern4[Dollars] = MetricPattern4( - client, "price_1y_max" - ) - self.price_1y_min: MetricPattern4[Dollars] = MetricPattern4( - client, "price_1y_min" - ) - self.price_2w_choppiness_index: MetricPattern4[StoredF32] = MetricPattern4( - client, "price_2w_choppiness_index" - ) - self.price_2w_max: MetricPattern4[Dollars] = MetricPattern4( - client, "price_2w_max" - ) - self.price_2w_min: MetricPattern4[Dollars] = MetricPattern4( - client, "price_2w_min" - ) - self.price_true_range: MetricPattern6[StoredF32] = MetricPattern6( - client, "price_true_range" - ) - self.price_true_range_2w_sum: MetricPattern6[StoredF32] = MetricPattern6( - client, "price_true_range_2w_sum" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.price_1m_max: MetricPattern4[Dollars] = MetricPattern4(client, 'price_1m_max') + self.price_1m_min: MetricPattern4[Dollars] = MetricPattern4(client, 'price_1m_min') + self.price_1w_max: MetricPattern4[Dollars] = MetricPattern4(client, 'price_1w_max') + self.price_1w_min: MetricPattern4[Dollars] = MetricPattern4(client, 'price_1w_min') + self.price_1y_max: MetricPattern4[Dollars] = MetricPattern4(client, 'price_1y_max') + self.price_1y_min: MetricPattern4[Dollars] = MetricPattern4(client, 'price_1y_min') + self.price_2w_choppiness_index: MetricPattern4[StoredF32] = MetricPattern4(client, 'price_2w_choppiness_index') + self.price_2w_max: MetricPattern4[Dollars] = MetricPattern4(client, 'price_2w_max') + self.price_2w_min: MetricPattern4[Dollars] = MetricPattern4(client, 'price_2w_min') + self.price_true_range: MetricPattern6[StoredF32] = MetricPattern6(client, 'price_true_range') + self.price_true_range_2w_sum: MetricPattern6[StoredF32] = MetricPattern6(client, 'price_true_range_2w_sum') class MetricsTree_Market_Returns_PriceReturns: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self._10y: MetricPattern4[StoredF32] = MetricPattern4( - client, "10y_price_returns" - ) - self._1d: MetricPattern4[StoredF32] = MetricPattern4(client, "1d_price_returns") - self._1m: MetricPattern4[StoredF32] = MetricPattern4(client, "1m_price_returns") - self._1w: MetricPattern4[StoredF32] = MetricPattern4(client, "1w_price_returns") - self._1y: MetricPattern4[StoredF32] = MetricPattern4(client, "1y_price_returns") - self._2y: MetricPattern4[StoredF32] = MetricPattern4(client, "2y_price_returns") - self._3m: MetricPattern4[StoredF32] = MetricPattern4(client, "3m_price_returns") - self._3y: MetricPattern4[StoredF32] = MetricPattern4(client, "3y_price_returns") - self._4y: MetricPattern4[StoredF32] = MetricPattern4(client, "4y_price_returns") - self._5y: MetricPattern4[StoredF32] = MetricPattern4(client, "5y_price_returns") - self._6m: MetricPattern4[StoredF32] = MetricPattern4(client, "6m_price_returns") - self._6y: MetricPattern4[StoredF32] = MetricPattern4(client, "6y_price_returns") - self._8y: MetricPattern4[StoredF32] = MetricPattern4(client, "8y_price_returns") - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._10y: MetricPattern4[StoredF32] = MetricPattern4(client, '10y_price_returns') + self._1d: MetricPattern4[StoredF32] = MetricPattern4(client, '1d_price_returns') + self._1m: MetricPattern4[StoredF32] = MetricPattern4(client, '1m_price_returns') + self._1w: MetricPattern4[StoredF32] = MetricPattern4(client, '1w_price_returns') + self._1y: MetricPattern4[StoredF32] = MetricPattern4(client, '1y_price_returns') + self._2y: MetricPattern4[StoredF32] = MetricPattern4(client, '2y_price_returns') + self._3m: MetricPattern4[StoredF32] = MetricPattern4(client, '3m_price_returns') + self._3y: MetricPattern4[StoredF32] = MetricPattern4(client, '3y_price_returns') + self._4y: MetricPattern4[StoredF32] = MetricPattern4(client, '4y_price_returns') + self._5y: MetricPattern4[StoredF32] = MetricPattern4(client, '5y_price_returns') + self._6m: MetricPattern4[StoredF32] = MetricPattern4(client, '6m_price_returns') + self._6y: MetricPattern4[StoredF32] = MetricPattern4(client, '6y_price_returns') + self._8y: MetricPattern4[StoredF32] = MetricPattern4(client, '8y_price_returns') class MetricsTree_Market_Returns: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self._1d_returns_1m_sd: _1dReturns1mSdPattern = _1dReturns1mSdPattern( - client, "1d_returns_1m_sd" - ) - self._1d_returns_1w_sd: _1dReturns1mSdPattern = _1dReturns1mSdPattern( - client, "1d_returns_1w_sd" - ) - self._1d_returns_1y_sd: _1dReturns1mSdPattern = _1dReturns1mSdPattern( - client, "1d_returns_1y_sd" - ) - self.cagr: PeriodCagrPattern = PeriodCagrPattern(client, "cagr") - self.downside_1m_sd: _1dReturns1mSdPattern = _1dReturns1mSdPattern( - client, "downside_1m_sd" - ) - self.downside_1w_sd: _1dReturns1mSdPattern = _1dReturns1mSdPattern( - client, "downside_1w_sd" - ) - self.downside_1y_sd: _1dReturns1mSdPattern = _1dReturns1mSdPattern( - client, "downside_1y_sd" - ) - self.downside_returns: MetricPattern6[StoredF32] = MetricPattern6( - client, "downside_returns" - ) - self.price_returns: MetricsTree_Market_Returns_PriceReturns = ( - MetricsTree_Market_Returns_PriceReturns(client) - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._1d_returns_1m_sd: _1dReturns1mSdPattern = _1dReturns1mSdPattern(client, '1d_returns_1m_sd') + self._1d_returns_1w_sd: _1dReturns1mSdPattern = _1dReturns1mSdPattern(client, '1d_returns_1w_sd') + self._1d_returns_1y_sd: _1dReturns1mSdPattern = _1dReturns1mSdPattern(client, '1d_returns_1y_sd') + self.cagr: PeriodCagrPattern = PeriodCagrPattern(client, 'cagr') + self.downside_1m_sd: _1dReturns1mSdPattern = _1dReturns1mSdPattern(client, 'downside_1m_sd') + self.downside_1w_sd: _1dReturns1mSdPattern = _1dReturns1mSdPattern(client, 'downside_1w_sd') + self.downside_1y_sd: _1dReturns1mSdPattern = _1dReturns1mSdPattern(client, 'downside_1y_sd') + self.downside_returns: MetricPattern6[StoredF32] = MetricPattern6(client, 'downside_returns') + self.price_returns: MetricsTree_Market_Returns_PriceReturns = MetricsTree_Market_Returns_PriceReturns(client) class MetricsTree_Market_Volatility: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.price_1m_volatility: MetricPattern4[StoredF32] = MetricPattern4( - client, "price_1m_volatility" - ) - self.price_1w_volatility: MetricPattern4[StoredF32] = MetricPattern4( - client, "price_1w_volatility" - ) - self.price_1y_volatility: MetricPattern4[StoredF32] = MetricPattern4( - client, "price_1y_volatility" - ) - self.sharpe_1m: MetricPattern6[StoredF32] = MetricPattern6(client, "sharpe_1m") - self.sharpe_1w: MetricPattern6[StoredF32] = MetricPattern6(client, "sharpe_1w") - self.sharpe_1y: MetricPattern6[StoredF32] = MetricPattern6(client, "sharpe_1y") - self.sortino_1m: MetricPattern6[StoredF32] = MetricPattern6( - client, "sortino_1m" - ) - self.sortino_1w: MetricPattern6[StoredF32] = MetricPattern6( - client, "sortino_1w" - ) - self.sortino_1y: MetricPattern6[StoredF32] = MetricPattern6( - client, "sortino_1y" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.price_1m_volatility: MetricPattern4[StoredF32] = MetricPattern4(client, 'price_1m_volatility') + self.price_1w_volatility: MetricPattern4[StoredF32] = MetricPattern4(client, 'price_1w_volatility') + self.price_1y_volatility: MetricPattern4[StoredF32] = MetricPattern4(client, 'price_1y_volatility') + self.sharpe_1m: MetricPattern6[StoredF32] = MetricPattern6(client, 'sharpe_1m') + self.sharpe_1w: MetricPattern6[StoredF32] = MetricPattern6(client, 'sharpe_1w') + self.sharpe_1y: MetricPattern6[StoredF32] = MetricPattern6(client, 'sharpe_1y') + self.sortino_1m: MetricPattern6[StoredF32] = MetricPattern6(client, 'sortino_1m') + self.sortino_1w: MetricPattern6[StoredF32] = MetricPattern6(client, 'sortino_1w') + self.sortino_1y: MetricPattern6[StoredF32] = MetricPattern6(client, 'sortino_1y') class MetricsTree_Market: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): + + def __init__(self, client: BrkClientBase, base_path: str = ''): self.ath: MetricsTree_Market_Ath = MetricsTree_Market_Ath(client) self.dca: MetricsTree_Market_Dca = MetricsTree_Market_Dca(client) - self.indicators: MetricsTree_Market_Indicators = MetricsTree_Market_Indicators( - client - ) + self.indicators: MetricsTree_Market_Indicators = MetricsTree_Market_Indicators(client) self.lookback: MetricsTree_Market_Lookback = MetricsTree_Market_Lookback(client) - self.moving_average: MetricsTree_Market_MovingAverage = ( - MetricsTree_Market_MovingAverage(client) - ) + self.moving_average: MetricsTree_Market_MovingAverage = MetricsTree_Market_MovingAverage(client) self.range: MetricsTree_Market_Range = MetricsTree_Market_Range(client) self.returns: MetricsTree_Market_Returns = MetricsTree_Market_Returns(client) - self.volatility: MetricsTree_Market_Volatility = MetricsTree_Market_Volatility( - client - ) - + self.volatility: MetricsTree_Market_Volatility = MetricsTree_Market_Volatility(client) class MetricsTree_Outputs_Count: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.total_count: CountPattern2[StoredU64] = CountPattern2( - client, "output_count" - ) - self.utxo_count: MetricPattern1[StoredU64] = MetricPattern1( - client, "exact_utxo_count" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.total_count: CountPattern2[StoredU64] = CountPattern2(client, 'output_count') + self.utxo_count: MetricPattern1[StoredU64] = MetricPattern1(client, 'exact_utxo_count') class MetricsTree_Outputs_Spent: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.txinindex: MetricPattern15[TxInIndex] = MetricPattern15( - client, "txinindex" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.txinindex: MetricPattern15[TxInIndex] = MetricPattern15(client, 'txinindex') class MetricsTree_Outputs: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): + + def __init__(self, client: BrkClientBase, base_path: str = ''): self.count: MetricsTree_Outputs_Count = MetricsTree_Outputs_Count(client) - self.first_txoutindex: MetricPattern11[TxOutIndex] = MetricPattern11( - client, "first_txoutindex" - ) - self.outputtype: MetricPattern15[OutputType] = MetricPattern15( - client, "outputtype" - ) + self.first_txoutindex: MetricPattern11[TxOutIndex] = MetricPattern11(client, 'first_txoutindex') + self.outputtype: MetricPattern15[OutputType] = MetricPattern15(client, 'outputtype') self.spent: MetricsTree_Outputs_Spent = MetricsTree_Outputs_Spent(client) - self.txindex: MetricPattern15[TxIndex] = MetricPattern15(client, "txindex") - self.typeindex: MetricPattern15[TypeIndex] = MetricPattern15( - client, "typeindex" - ) - self.value: MetricPattern15[Sats] = MetricPattern15(client, "value") - + self.txindex: MetricPattern15[TxIndex] = MetricPattern15(client, 'txindex') + self.typeindex: MetricPattern15[TypeIndex] = MetricPattern15(client, 'typeindex') + self.value: MetricPattern15[Sats] = MetricPattern15(client, 'value') class MetricsTree_Pools_Vecs: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.aaopool: AaopoolPattern = AaopoolPattern(client, "aaopool") - self.antpool: AaopoolPattern = AaopoolPattern(client, "antpool") - self.arkpool: AaopoolPattern = AaopoolPattern(client, "arkpool") - self.asicminer: AaopoolPattern = AaopoolPattern(client, "asicminer") - self.axbt: AaopoolPattern = AaopoolPattern(client, "axbt") - self.batpool: AaopoolPattern = AaopoolPattern(client, "batpool") - self.bcmonster: AaopoolPattern = AaopoolPattern(client, "bcmonster") - self.bcpoolio: AaopoolPattern = AaopoolPattern(client, "bcpoolio") - self.binancepool: AaopoolPattern = AaopoolPattern(client, "binancepool") - self.bitalo: AaopoolPattern = AaopoolPattern(client, "bitalo") - self.bitclub: AaopoolPattern = AaopoolPattern(client, "bitclub") - self.bitcoinaffiliatenetwork: AaopoolPattern = AaopoolPattern( - client, "bitcoinaffiliatenetwork" - ) - self.bitcoincom: AaopoolPattern = AaopoolPattern(client, "bitcoincom") - self.bitcoinindia: AaopoolPattern = AaopoolPattern(client, "bitcoinindia") - self.bitcoinrussia: AaopoolPattern = AaopoolPattern(client, "bitcoinrussia") - self.bitcoinukraine: AaopoolPattern = AaopoolPattern(client, "bitcoinukraine") - self.bitfarms: AaopoolPattern = AaopoolPattern(client, "bitfarms") - self.bitfufupool: AaopoolPattern = AaopoolPattern(client, "bitfufupool") - self.bitfury: AaopoolPattern = AaopoolPattern(client, "bitfury") - self.bitminter: AaopoolPattern = AaopoolPattern(client, "bitminter") - self.bitparking: AaopoolPattern = AaopoolPattern(client, "bitparking") - self.bitsolo: AaopoolPattern = AaopoolPattern(client, "bitsolo") - self.bixin: AaopoolPattern = AaopoolPattern(client, "bixin") - self.blockfills: AaopoolPattern = AaopoolPattern(client, "blockfills") - self.braiinspool: AaopoolPattern = AaopoolPattern(client, "braiinspool") - self.bravomining: AaopoolPattern = AaopoolPattern(client, "bravomining") - self.btcc: AaopoolPattern = AaopoolPattern(client, "btcc") - self.btccom: AaopoolPattern = AaopoolPattern(client, "btccom") - self.btcdig: AaopoolPattern = AaopoolPattern(client, "btcdig") - self.btcguild: AaopoolPattern = AaopoolPattern(client, "btcguild") - self.btclab: AaopoolPattern = AaopoolPattern(client, "btclab") - self.btcmp: AaopoolPattern = AaopoolPattern(client, "btcmp") - self.btcnuggets: AaopoolPattern = AaopoolPattern(client, "btcnuggets") - self.btcpoolparty: AaopoolPattern = AaopoolPattern(client, "btcpoolparty") - self.btcserv: AaopoolPattern = AaopoolPattern(client, "btcserv") - self.btctop: AaopoolPattern = AaopoolPattern(client, "btctop") - self.btpool: AaopoolPattern = AaopoolPattern(client, "btpool") - self.bwpool: AaopoolPattern = AaopoolPattern(client, "bwpool") - self.bytepool: AaopoolPattern = AaopoolPattern(client, "bytepool") - self.canoe: AaopoolPattern = AaopoolPattern(client, "canoe") - self.canoepool: AaopoolPattern = AaopoolPattern(client, "canoepool") - self.carbonnegative: AaopoolPattern = AaopoolPattern(client, "carbonnegative") - self.ckpool: AaopoolPattern = AaopoolPattern(client, "ckpool") - self.cloudhashing: AaopoolPattern = AaopoolPattern(client, "cloudhashing") - self.coinlab: AaopoolPattern = AaopoolPattern(client, "coinlab") - self.cointerra: AaopoolPattern = AaopoolPattern(client, "cointerra") - self.connectbtc: AaopoolPattern = AaopoolPattern(client, "connectbtc") - self.dcex: AaopoolPattern = AaopoolPattern(client, "dcex") - self.dcexploration: AaopoolPattern = AaopoolPattern(client, "dcexploration") - self.digitalbtc: AaopoolPattern = AaopoolPattern(client, "digitalbtc") - self.digitalxmintsy: AaopoolPattern = AaopoolPattern(client, "digitalxmintsy") - self.dpool: AaopoolPattern = AaopoolPattern(client, "dpool") - self.eclipsemc: AaopoolPattern = AaopoolPattern(client, "eclipsemc") - self.eightbaochi: AaopoolPattern = AaopoolPattern(client, "eightbaochi") - self.ekanembtc: AaopoolPattern = AaopoolPattern(client, "ekanembtc") - self.eligius: AaopoolPattern = AaopoolPattern(client, "eligius") - self.emcdpool: AaopoolPattern = AaopoolPattern(client, "emcdpool") - self.entrustcharitypool: AaopoolPattern = AaopoolPattern( - client, "entrustcharitypool" - ) - self.eobot: AaopoolPattern = AaopoolPattern(client, "eobot") - self.exxbw: AaopoolPattern = AaopoolPattern(client, "exxbw") - self.f2pool: AaopoolPattern = AaopoolPattern(client, "f2pool") - self.fiftyeightcoin: AaopoolPattern = AaopoolPattern(client, "fiftyeightcoin") - self.foundryusa: AaopoolPattern = AaopoolPattern(client, "foundryusa") - self.futurebitapollosolo: AaopoolPattern = AaopoolPattern( - client, "futurebitapollosolo" - ) - self.gbminers: AaopoolPattern = AaopoolPattern(client, "gbminers") - self.ghashio: AaopoolPattern = AaopoolPattern(client, "ghashio") - self.givemecoins: AaopoolPattern = AaopoolPattern(client, "givemecoins") - self.gogreenlight: AaopoolPattern = AaopoolPattern(client, "gogreenlight") - self.haominer: AaopoolPattern = AaopoolPattern(client, "haominer") - self.haozhuzhu: AaopoolPattern = AaopoolPattern(client, "haozhuzhu") - self.hashbx: AaopoolPattern = AaopoolPattern(client, "hashbx") - self.hashpool: AaopoolPattern = AaopoolPattern(client, "hashpool") - self.helix: AaopoolPattern = AaopoolPattern(client, "helix") - self.hhtt: AaopoolPattern = AaopoolPattern(client, "hhtt") - self.hotpool: AaopoolPattern = AaopoolPattern(client, "hotpool") - self.hummerpool: AaopoolPattern = AaopoolPattern(client, "hummerpool") - self.huobipool: AaopoolPattern = AaopoolPattern(client, "huobipool") - self.innopolistech: AaopoolPattern = AaopoolPattern(client, "innopolistech") - self.kanopool: AaopoolPattern = AaopoolPattern(client, "kanopool") - self.kncminer: AaopoolPattern = AaopoolPattern(client, "kncminer") - self.kucoinpool: AaopoolPattern = AaopoolPattern(client, "kucoinpool") - self.lubiancom: AaopoolPattern = AaopoolPattern(client, "lubiancom") - self.luckypool: AaopoolPattern = AaopoolPattern(client, "luckypool") - self.luxor: AaopoolPattern = AaopoolPattern(client, "luxor") - self.marapool: AaopoolPattern = AaopoolPattern(client, "marapool") - self.maxbtc: AaopoolPattern = AaopoolPattern(client, "maxbtc") - self.maxipool: AaopoolPattern = AaopoolPattern(client, "maxipool") - self.megabigpower: AaopoolPattern = AaopoolPattern(client, "megabigpower") - self.minerium: AaopoolPattern = AaopoolPattern(client, "minerium") - self.miningcity: AaopoolPattern = AaopoolPattern(client, "miningcity") - self.miningdutch: AaopoolPattern = AaopoolPattern(client, "miningdutch") - self.miningkings: AaopoolPattern = AaopoolPattern(client, "miningkings") - self.miningsquared: AaopoolPattern = AaopoolPattern(client, "miningsquared") - self.mmpool: AaopoolPattern = AaopoolPattern(client, "mmpool") - self.mtred: AaopoolPattern = AaopoolPattern(client, "mtred") - self.multicoinco: AaopoolPattern = AaopoolPattern(client, "multicoinco") - self.multipool: AaopoolPattern = AaopoolPattern(client, "multipool") - self.mybtccoinpool: AaopoolPattern = AaopoolPattern(client, "mybtccoinpool") - self.neopool: AaopoolPattern = AaopoolPattern(client, "neopool") - self.nexious: AaopoolPattern = AaopoolPattern(client, "nexious") - self.nicehash: AaopoolPattern = AaopoolPattern(client, "nicehash") - self.nmcbit: AaopoolPattern = AaopoolPattern(client, "nmcbit") - self.novablock: AaopoolPattern = AaopoolPattern(client, "novablock") - self.ocean: AaopoolPattern = AaopoolPattern(client, "ocean") - self.okexpool: AaopoolPattern = AaopoolPattern(client, "okexpool") - self.okkong: AaopoolPattern = AaopoolPattern(client, "okkong") - self.okminer: AaopoolPattern = AaopoolPattern(client, "okminer") - self.okpooltop: AaopoolPattern = AaopoolPattern(client, "okpooltop") - self.onehash: AaopoolPattern = AaopoolPattern(client, "onehash") - self.onem1x: AaopoolPattern = AaopoolPattern(client, "onem1x") - self.onethash: AaopoolPattern = AaopoolPattern(client, "onethash") - self.ozcoin: AaopoolPattern = AaopoolPattern(client, "ozcoin") - self.parasite: AaopoolPattern = AaopoolPattern(client, "parasite") - self.patels: AaopoolPattern = AaopoolPattern(client, "patels") - self.pegapool: AaopoolPattern = AaopoolPattern(client, "pegapool") - self.phashio: AaopoolPattern = AaopoolPattern(client, "phashio") - self.phoenix: AaopoolPattern = AaopoolPattern(client, "phoenix") - self.polmine: AaopoolPattern = AaopoolPattern(client, "polmine") - self.pool175btc: AaopoolPattern = AaopoolPattern(client, "pool175btc") - self.pool50btc: AaopoolPattern = AaopoolPattern(client, "pool50btc") - self.poolin: AaopoolPattern = AaopoolPattern(client, "poolin") - self.portlandhodl: AaopoolPattern = AaopoolPattern(client, "portlandhodl") - self.publicpool: AaopoolPattern = AaopoolPattern(client, "publicpool") - self.purebtccom: AaopoolPattern = AaopoolPattern(client, "purebtccom") - self.rawpool: AaopoolPattern = AaopoolPattern(client, "rawpool") - self.rigpool: AaopoolPattern = AaopoolPattern(client, "rigpool") - self.sbicrypto: AaopoolPattern = AaopoolPattern(client, "sbicrypto") - self.secpool: AaopoolPattern = AaopoolPattern(client, "secpool") - self.secretsuperstar: AaopoolPattern = AaopoolPattern(client, "secretsuperstar") - self.sevenpool: AaopoolPattern = AaopoolPattern(client, "sevenpool") - self.shawnp0wers: AaopoolPattern = AaopoolPattern(client, "shawnp0wers") - self.sigmapoolcom: AaopoolPattern = AaopoolPattern(client, "sigmapoolcom") - self.simplecoinus: AaopoolPattern = AaopoolPattern(client, "simplecoinus") - self.solock: AaopoolPattern = AaopoolPattern(client, "solock") - self.spiderpool: AaopoolPattern = AaopoolPattern(client, "spiderpool") - self.stminingcorp: AaopoolPattern = AaopoolPattern(client, "stminingcorp") - self.tangpool: AaopoolPattern = AaopoolPattern(client, "tangpool") - self.tatmaspool: AaopoolPattern = AaopoolPattern(client, "tatmaspool") - self.tbdice: AaopoolPattern = AaopoolPattern(client, "tbdice") - self.telco214: AaopoolPattern = AaopoolPattern(client, "telco214") - self.terrapool: AaopoolPattern = AaopoolPattern(client, "terrapool") - self.tiger: AaopoolPattern = AaopoolPattern(client, "tiger") - self.tigerpoolnet: AaopoolPattern = AaopoolPattern(client, "tigerpoolnet") - self.titan: AaopoolPattern = AaopoolPattern(client, "titan") - self.transactioncoinmining: AaopoolPattern = AaopoolPattern( - client, "transactioncoinmining" - ) - self.trickysbtcpool: AaopoolPattern = AaopoolPattern(client, "trickysbtcpool") - self.triplemining: AaopoolPattern = AaopoolPattern(client, "triplemining") - self.twentyoneinc: AaopoolPattern = AaopoolPattern(client, "twentyoneinc") - self.ultimuspool: AaopoolPattern = AaopoolPattern(client, "ultimuspool") - self.unknown: AaopoolPattern = AaopoolPattern(client, "unknown") - self.unomp: AaopoolPattern = AaopoolPattern(client, "unomp") - self.viabtc: AaopoolPattern = AaopoolPattern(client, "viabtc") - self.waterhole: AaopoolPattern = AaopoolPattern(client, "waterhole") - self.wayicn: AaopoolPattern = AaopoolPattern(client, "wayicn") - self.whitepool: AaopoolPattern = AaopoolPattern(client, "whitepool") - self.wk057: AaopoolPattern = AaopoolPattern(client, "wk057") - self.yourbtcnet: AaopoolPattern = AaopoolPattern(client, "yourbtcnet") - self.zulupool: AaopoolPattern = AaopoolPattern(client, "zulupool") - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.aaopool: AaopoolPattern = AaopoolPattern(client, 'aaopool') + self.antpool: AaopoolPattern = AaopoolPattern(client, 'antpool') + self.arkpool: AaopoolPattern = AaopoolPattern(client, 'arkpool') + self.asicminer: AaopoolPattern = AaopoolPattern(client, 'asicminer') + self.axbt: AaopoolPattern = AaopoolPattern(client, 'axbt') + self.batpool: AaopoolPattern = AaopoolPattern(client, 'batpool') + self.bcmonster: AaopoolPattern = AaopoolPattern(client, 'bcmonster') + self.bcpoolio: AaopoolPattern = AaopoolPattern(client, 'bcpoolio') + self.binancepool: AaopoolPattern = AaopoolPattern(client, 'binancepool') + self.bitalo: AaopoolPattern = AaopoolPattern(client, 'bitalo') + self.bitclub: AaopoolPattern = AaopoolPattern(client, 'bitclub') + self.bitcoinaffiliatenetwork: AaopoolPattern = AaopoolPattern(client, 'bitcoinaffiliatenetwork') + self.bitcoincom: AaopoolPattern = AaopoolPattern(client, 'bitcoincom') + self.bitcoinindia: AaopoolPattern = AaopoolPattern(client, 'bitcoinindia') + self.bitcoinrussia: AaopoolPattern = AaopoolPattern(client, 'bitcoinrussia') + self.bitcoinukraine: AaopoolPattern = AaopoolPattern(client, 'bitcoinukraine') + self.bitfarms: AaopoolPattern = AaopoolPattern(client, 'bitfarms') + self.bitfufupool: AaopoolPattern = AaopoolPattern(client, 'bitfufupool') + self.bitfury: AaopoolPattern = AaopoolPattern(client, 'bitfury') + self.bitminter: AaopoolPattern = AaopoolPattern(client, 'bitminter') + self.bitparking: AaopoolPattern = AaopoolPattern(client, 'bitparking') + self.bitsolo: AaopoolPattern = AaopoolPattern(client, 'bitsolo') + self.bixin: AaopoolPattern = AaopoolPattern(client, 'bixin') + self.blockfills: AaopoolPattern = AaopoolPattern(client, 'blockfills') + self.braiinspool: AaopoolPattern = AaopoolPattern(client, 'braiinspool') + self.bravomining: AaopoolPattern = AaopoolPattern(client, 'bravomining') + self.btcc: AaopoolPattern = AaopoolPattern(client, 'btcc') + self.btccom: AaopoolPattern = AaopoolPattern(client, 'btccom') + self.btcdig: AaopoolPattern = AaopoolPattern(client, 'btcdig') + self.btcguild: AaopoolPattern = AaopoolPattern(client, 'btcguild') + self.btclab: AaopoolPattern = AaopoolPattern(client, 'btclab') + self.btcmp: AaopoolPattern = AaopoolPattern(client, 'btcmp') + self.btcnuggets: AaopoolPattern = AaopoolPattern(client, 'btcnuggets') + self.btcpoolparty: AaopoolPattern = AaopoolPattern(client, 'btcpoolparty') + self.btcserv: AaopoolPattern = AaopoolPattern(client, 'btcserv') + self.btctop: AaopoolPattern = AaopoolPattern(client, 'btctop') + self.btpool: AaopoolPattern = AaopoolPattern(client, 'btpool') + self.bwpool: AaopoolPattern = AaopoolPattern(client, 'bwpool') + self.bytepool: AaopoolPattern = AaopoolPattern(client, 'bytepool') + self.canoe: AaopoolPattern = AaopoolPattern(client, 'canoe') + self.canoepool: AaopoolPattern = AaopoolPattern(client, 'canoepool') + self.carbonnegative: AaopoolPattern = AaopoolPattern(client, 'carbonnegative') + self.ckpool: AaopoolPattern = AaopoolPattern(client, 'ckpool') + self.cloudhashing: AaopoolPattern = AaopoolPattern(client, 'cloudhashing') + self.coinlab: AaopoolPattern = AaopoolPattern(client, 'coinlab') + self.cointerra: AaopoolPattern = AaopoolPattern(client, 'cointerra') + self.connectbtc: AaopoolPattern = AaopoolPattern(client, 'connectbtc') + self.dcex: AaopoolPattern = AaopoolPattern(client, 'dcex') + self.dcexploration: AaopoolPattern = AaopoolPattern(client, 'dcexploration') + self.digitalbtc: AaopoolPattern = AaopoolPattern(client, 'digitalbtc') + self.digitalxmintsy: AaopoolPattern = AaopoolPattern(client, 'digitalxmintsy') + self.dpool: AaopoolPattern = AaopoolPattern(client, 'dpool') + self.eclipsemc: AaopoolPattern = AaopoolPattern(client, 'eclipsemc') + self.eightbaochi: AaopoolPattern = AaopoolPattern(client, 'eightbaochi') + self.ekanembtc: AaopoolPattern = AaopoolPattern(client, 'ekanembtc') + self.eligius: AaopoolPattern = AaopoolPattern(client, 'eligius') + self.emcdpool: AaopoolPattern = AaopoolPattern(client, 'emcdpool') + self.entrustcharitypool: AaopoolPattern = AaopoolPattern(client, 'entrustcharitypool') + self.eobot: AaopoolPattern = AaopoolPattern(client, 'eobot') + self.exxbw: AaopoolPattern = AaopoolPattern(client, 'exxbw') + self.f2pool: AaopoolPattern = AaopoolPattern(client, 'f2pool') + self.fiftyeightcoin: AaopoolPattern = AaopoolPattern(client, 'fiftyeightcoin') + self.foundryusa: AaopoolPattern = AaopoolPattern(client, 'foundryusa') + self.futurebitapollosolo: AaopoolPattern = AaopoolPattern(client, 'futurebitapollosolo') + self.gbminers: AaopoolPattern = AaopoolPattern(client, 'gbminers') + self.ghashio: AaopoolPattern = AaopoolPattern(client, 'ghashio') + self.givemecoins: AaopoolPattern = AaopoolPattern(client, 'givemecoins') + self.gogreenlight: AaopoolPattern = AaopoolPattern(client, 'gogreenlight') + self.haominer: AaopoolPattern = AaopoolPattern(client, 'haominer') + self.haozhuzhu: AaopoolPattern = AaopoolPattern(client, 'haozhuzhu') + self.hashbx: AaopoolPattern = AaopoolPattern(client, 'hashbx') + self.hashpool: AaopoolPattern = AaopoolPattern(client, 'hashpool') + self.helix: AaopoolPattern = AaopoolPattern(client, 'helix') + self.hhtt: AaopoolPattern = AaopoolPattern(client, 'hhtt') + self.hotpool: AaopoolPattern = AaopoolPattern(client, 'hotpool') + self.hummerpool: AaopoolPattern = AaopoolPattern(client, 'hummerpool') + self.huobipool: AaopoolPattern = AaopoolPattern(client, 'huobipool') + self.innopolistech: AaopoolPattern = AaopoolPattern(client, 'innopolistech') + self.kanopool: AaopoolPattern = AaopoolPattern(client, 'kanopool') + self.kncminer: AaopoolPattern = AaopoolPattern(client, 'kncminer') + self.kucoinpool: AaopoolPattern = AaopoolPattern(client, 'kucoinpool') + self.lubiancom: AaopoolPattern = AaopoolPattern(client, 'lubiancom') + self.luckypool: AaopoolPattern = AaopoolPattern(client, 'luckypool') + self.luxor: AaopoolPattern = AaopoolPattern(client, 'luxor') + self.marapool: AaopoolPattern = AaopoolPattern(client, 'marapool') + self.maxbtc: AaopoolPattern = AaopoolPattern(client, 'maxbtc') + self.maxipool: AaopoolPattern = AaopoolPattern(client, 'maxipool') + self.megabigpower: AaopoolPattern = AaopoolPattern(client, 'megabigpower') + self.minerium: AaopoolPattern = AaopoolPattern(client, 'minerium') + self.miningcity: AaopoolPattern = AaopoolPattern(client, 'miningcity') + self.miningdutch: AaopoolPattern = AaopoolPattern(client, 'miningdutch') + self.miningkings: AaopoolPattern = AaopoolPattern(client, 'miningkings') + self.miningsquared: AaopoolPattern = AaopoolPattern(client, 'miningsquared') + self.mmpool: AaopoolPattern = AaopoolPattern(client, 'mmpool') + self.mtred: AaopoolPattern = AaopoolPattern(client, 'mtred') + self.multicoinco: AaopoolPattern = AaopoolPattern(client, 'multicoinco') + self.multipool: AaopoolPattern = AaopoolPattern(client, 'multipool') + self.mybtccoinpool: AaopoolPattern = AaopoolPattern(client, 'mybtccoinpool') + self.neopool: AaopoolPattern = AaopoolPattern(client, 'neopool') + self.nexious: AaopoolPattern = AaopoolPattern(client, 'nexious') + self.nicehash: AaopoolPattern = AaopoolPattern(client, 'nicehash') + self.nmcbit: AaopoolPattern = AaopoolPattern(client, 'nmcbit') + self.novablock: AaopoolPattern = AaopoolPattern(client, 'novablock') + self.ocean: AaopoolPattern = AaopoolPattern(client, 'ocean') + self.okexpool: AaopoolPattern = AaopoolPattern(client, 'okexpool') + self.okkong: AaopoolPattern = AaopoolPattern(client, 'okkong') + self.okminer: AaopoolPattern = AaopoolPattern(client, 'okminer') + self.okpooltop: AaopoolPattern = AaopoolPattern(client, 'okpooltop') + self.onehash: AaopoolPattern = AaopoolPattern(client, 'onehash') + self.onem1x: AaopoolPattern = AaopoolPattern(client, 'onem1x') + self.onethash: AaopoolPattern = AaopoolPattern(client, 'onethash') + self.ozcoin: AaopoolPattern = AaopoolPattern(client, 'ozcoin') + self.parasite: AaopoolPattern = AaopoolPattern(client, 'parasite') + self.patels: AaopoolPattern = AaopoolPattern(client, 'patels') + self.pegapool: AaopoolPattern = AaopoolPattern(client, 'pegapool') + self.phashio: AaopoolPattern = AaopoolPattern(client, 'phashio') + self.phoenix: AaopoolPattern = AaopoolPattern(client, 'phoenix') + self.polmine: AaopoolPattern = AaopoolPattern(client, 'polmine') + self.pool175btc: AaopoolPattern = AaopoolPattern(client, 'pool175btc') + self.pool50btc: AaopoolPattern = AaopoolPattern(client, 'pool50btc') + self.poolin: AaopoolPattern = AaopoolPattern(client, 'poolin') + self.portlandhodl: AaopoolPattern = AaopoolPattern(client, 'portlandhodl') + self.publicpool: AaopoolPattern = AaopoolPattern(client, 'publicpool') + self.purebtccom: AaopoolPattern = AaopoolPattern(client, 'purebtccom') + self.rawpool: AaopoolPattern = AaopoolPattern(client, 'rawpool') + self.rigpool: AaopoolPattern = AaopoolPattern(client, 'rigpool') + self.sbicrypto: AaopoolPattern = AaopoolPattern(client, 'sbicrypto') + self.secpool: AaopoolPattern = AaopoolPattern(client, 'secpool') + self.secretsuperstar: AaopoolPattern = AaopoolPattern(client, 'secretsuperstar') + self.sevenpool: AaopoolPattern = AaopoolPattern(client, 'sevenpool') + self.shawnp0wers: AaopoolPattern = AaopoolPattern(client, 'shawnp0wers') + self.sigmapoolcom: AaopoolPattern = AaopoolPattern(client, 'sigmapoolcom') + self.simplecoinus: AaopoolPattern = AaopoolPattern(client, 'simplecoinus') + self.solock: AaopoolPattern = AaopoolPattern(client, 'solock') + self.spiderpool: AaopoolPattern = AaopoolPattern(client, 'spiderpool') + self.stminingcorp: AaopoolPattern = AaopoolPattern(client, 'stminingcorp') + self.tangpool: AaopoolPattern = AaopoolPattern(client, 'tangpool') + self.tatmaspool: AaopoolPattern = AaopoolPattern(client, 'tatmaspool') + self.tbdice: AaopoolPattern = AaopoolPattern(client, 'tbdice') + self.telco214: AaopoolPattern = AaopoolPattern(client, 'telco214') + self.terrapool: AaopoolPattern = AaopoolPattern(client, 'terrapool') + self.tiger: AaopoolPattern = AaopoolPattern(client, 'tiger') + self.tigerpoolnet: AaopoolPattern = AaopoolPattern(client, 'tigerpoolnet') + self.titan: AaopoolPattern = AaopoolPattern(client, 'titan') + self.transactioncoinmining: AaopoolPattern = AaopoolPattern(client, 'transactioncoinmining') + self.trickysbtcpool: AaopoolPattern = AaopoolPattern(client, 'trickysbtcpool') + self.triplemining: AaopoolPattern = AaopoolPattern(client, 'triplemining') + self.twentyoneinc: AaopoolPattern = AaopoolPattern(client, 'twentyoneinc') + self.ultimuspool: AaopoolPattern = AaopoolPattern(client, 'ultimuspool') + self.unknown: AaopoolPattern = AaopoolPattern(client, 'unknown') + self.unomp: AaopoolPattern = AaopoolPattern(client, 'unomp') + self.viabtc: AaopoolPattern = AaopoolPattern(client, 'viabtc') + self.waterhole: AaopoolPattern = AaopoolPattern(client, 'waterhole') + self.wayicn: AaopoolPattern = AaopoolPattern(client, 'wayicn') + self.whitepool: AaopoolPattern = AaopoolPattern(client, 'whitepool') + self.wk057: AaopoolPattern = AaopoolPattern(client, 'wk057') + self.yourbtcnet: AaopoolPattern = AaopoolPattern(client, 'yourbtcnet') + self.zulupool: AaopoolPattern = AaopoolPattern(client, 'zulupool') class MetricsTree_Pools: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.height_to_pool: MetricPattern11[PoolSlug] = MetricPattern11(client, "pool") + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.height_to_pool: MetricPattern11[PoolSlug] = MetricPattern11(client, 'pool') self.vecs: MetricsTree_Pools_Vecs = MetricsTree_Pools_Vecs(client) - class MetricsTree_Positions: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.block_position: MetricPattern11[BlkPosition] = MetricPattern11( - client, "position" - ) - self.tx_position: MetricPattern27[BlkPosition] = MetricPattern27( - client, "position" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.block_position: MetricPattern11[BlkPosition] = MetricPattern11(client, 'position') + self.tx_position: MetricPattern27[BlkPosition] = MetricPattern27(client, 'position') class MetricsTree_Price_Cents_Split: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.close: MetricPattern5[Cents] = MetricPattern5(client, "price_close_cents") - self.high: MetricPattern5[Cents] = MetricPattern5(client, "price_high_cents") - self.low: MetricPattern5[Cents] = MetricPattern5(client, "price_low_cents") - self.open: MetricPattern5[Cents] = MetricPattern5(client, "price_open_cents") - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.close: MetricPattern5[Cents] = MetricPattern5(client, 'price_close_cents') + self.high: MetricPattern5[Cents] = MetricPattern5(client, 'price_high_cents') + self.low: MetricPattern5[Cents] = MetricPattern5(client, 'price_low_cents') + self.open: MetricPattern5[Cents] = MetricPattern5(client, 'price_open_cents') class MetricsTree_Price_Cents: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.ohlc: MetricPattern5[OHLCCents] = MetricPattern5(client, "ohlc_cents") - self.split: MetricsTree_Price_Cents_Split = MetricsTree_Price_Cents_Split( - client - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.ohlc: MetricPattern5[OHLCCents] = MetricPattern5(client, 'ohlc_cents') + self.split: MetricsTree_Price_Cents_Split = MetricsTree_Price_Cents_Split(client) class MetricsTree_Price_Sats: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.ohlc: MetricPattern1[OHLCSats] = MetricPattern1(client, "price_ohlc_sats") - self.split: SplitPattern2[Sats] = SplitPattern2(client, "price_sats") - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.ohlc: MetricPattern1[OHLCSats] = MetricPattern1(client, 'price_ohlc_sats') + self.split: SplitPattern2[Sats] = SplitPattern2(client, 'price_sats') class MetricsTree_Price_Usd: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.ohlc: MetricPattern1[OHLCDollars] = MetricPattern1(client, "price_ohlc") - self.split: SplitPattern2[Dollars] = SplitPattern2(client, "price") - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.ohlc: MetricPattern1[OHLCDollars] = MetricPattern1(client, 'price_ohlc') + self.split: SplitPattern2[Dollars] = SplitPattern2(client, 'price') class MetricsTree_Price: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): + + def __init__(self, client: BrkClientBase, base_path: str = ''): self.cents: MetricsTree_Price_Cents = MetricsTree_Price_Cents(client) self.sats: MetricsTree_Price_Sats = MetricsTree_Price_Sats(client) self.usd: MetricsTree_Price_Usd = MetricsTree_Price_Usd(client) - class MetricsTree_Scripts_Count: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.emptyoutput: DollarsPattern[StoredU64] = DollarsPattern( - client, "emptyoutput_count" - ) - self.opreturn: DollarsPattern[StoredU64] = DollarsPattern( - client, "opreturn_count" - ) - self.p2a: DollarsPattern[StoredU64] = DollarsPattern(client, "p2a_count") - self.p2ms: DollarsPattern[StoredU64] = DollarsPattern(client, "p2ms_count") - self.p2pk33: DollarsPattern[StoredU64] = DollarsPattern(client, "p2pk33_count") - self.p2pk65: DollarsPattern[StoredU64] = DollarsPattern(client, "p2pk65_count") - self.p2pkh: DollarsPattern[StoredU64] = DollarsPattern(client, "p2pkh_count") - self.p2sh: DollarsPattern[StoredU64] = DollarsPattern(client, "p2sh_count") - self.p2tr: DollarsPattern[StoredU64] = DollarsPattern(client, "p2tr_count") - self.p2wpkh: DollarsPattern[StoredU64] = DollarsPattern(client, "p2wpkh_count") - self.p2wsh: DollarsPattern[StoredU64] = DollarsPattern(client, "p2wsh_count") - self.segwit: DollarsPattern[StoredU64] = DollarsPattern(client, "segwit_count") - self.segwit_adoption: SegwitAdoptionPattern = SegwitAdoptionPattern( - client, "segwit_adoption" - ) - self.taproot_adoption: SegwitAdoptionPattern = SegwitAdoptionPattern( - client, "taproot_adoption" - ) - self.unknownoutput: DollarsPattern[StoredU64] = DollarsPattern( - client, "unknownoutput_count" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.emptyoutput: DollarsPattern[StoredU64] = DollarsPattern(client, 'emptyoutput_count') + self.opreturn: DollarsPattern[StoredU64] = DollarsPattern(client, 'opreturn_count') + self.p2a: DollarsPattern[StoredU64] = DollarsPattern(client, 'p2a_count') + self.p2ms: DollarsPattern[StoredU64] = DollarsPattern(client, 'p2ms_count') + self.p2pk33: DollarsPattern[StoredU64] = DollarsPattern(client, 'p2pk33_count') + self.p2pk65: DollarsPattern[StoredU64] = DollarsPattern(client, 'p2pk65_count') + self.p2pkh: DollarsPattern[StoredU64] = DollarsPattern(client, 'p2pkh_count') + self.p2sh: DollarsPattern[StoredU64] = DollarsPattern(client, 'p2sh_count') + self.p2tr: DollarsPattern[StoredU64] = DollarsPattern(client, 'p2tr_count') + self.p2wpkh: DollarsPattern[StoredU64] = DollarsPattern(client, 'p2wpkh_count') + self.p2wsh: DollarsPattern[StoredU64] = DollarsPattern(client, 'p2wsh_count') + self.segwit: DollarsPattern[StoredU64] = DollarsPattern(client, 'segwit_count') + self.segwit_adoption: SegwitAdoptionPattern = SegwitAdoptionPattern(client, 'segwit_adoption') + self.taproot_adoption: SegwitAdoptionPattern = SegwitAdoptionPattern(client, 'taproot_adoption') + self.unknownoutput: DollarsPattern[StoredU64] = DollarsPattern(client, 'unknownoutput_count') class MetricsTree_Scripts_Value: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.opreturn: CoinbasePattern = CoinbasePattern(client, "opreturn_value") - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.opreturn: CoinbasePattern = CoinbasePattern(client, 'opreturn_value') class MetricsTree_Scripts: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): + + def __init__(self, client: BrkClientBase, base_path: str = ''): self.count: MetricsTree_Scripts_Count = MetricsTree_Scripts_Count(client) - self.empty_to_txindex: MetricPattern9[TxIndex] = MetricPattern9( - client, "txindex" - ) - self.first_emptyoutputindex: MetricPattern11[EmptyOutputIndex] = ( - MetricPattern11(client, "first_emptyoutputindex") - ) - self.first_opreturnindex: MetricPattern11[OpReturnIndex] = MetricPattern11( - client, "first_opreturnindex" - ) - self.first_p2msoutputindex: MetricPattern11[P2MSOutputIndex] = MetricPattern11( - client, "first_p2msoutputindex" - ) - self.first_unknownoutputindex: MetricPattern11[UnknownOutputIndex] = ( - MetricPattern11(client, "first_unknownoutputindex") - ) - self.opreturn_to_txindex: MetricPattern14[TxIndex] = MetricPattern14( - client, "txindex" - ) - self.p2ms_to_txindex: MetricPattern17[TxIndex] = MetricPattern17( - client, "txindex" - ) - self.unknown_to_txindex: MetricPattern28[TxIndex] = MetricPattern28( - client, "txindex" - ) + self.empty_to_txindex: MetricPattern9[TxIndex] = MetricPattern9(client, 'txindex') + self.first_emptyoutputindex: MetricPattern11[EmptyOutputIndex] = MetricPattern11(client, 'first_emptyoutputindex') + self.first_opreturnindex: MetricPattern11[OpReturnIndex] = MetricPattern11(client, 'first_opreturnindex') + self.first_p2msoutputindex: MetricPattern11[P2MSOutputIndex] = MetricPattern11(client, 'first_p2msoutputindex') + self.first_unknownoutputindex: MetricPattern11[UnknownOutputIndex] = MetricPattern11(client, 'first_unknownoutputindex') + self.opreturn_to_txindex: MetricPattern14[TxIndex] = MetricPattern14(client, 'txindex') + self.p2ms_to_txindex: MetricPattern17[TxIndex] = MetricPattern17(client, 'txindex') + self.unknown_to_txindex: MetricPattern28[TxIndex] = MetricPattern28(client, 'txindex') self.value: MetricsTree_Scripts_Value = MetricsTree_Scripts_Value(client) - class MetricsTree_Supply_Burned: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.opreturn: UnclaimedRewardsPattern = UnclaimedRewardsPattern( - client, "opreturn_supply" - ) - self.unspendable: UnclaimedRewardsPattern = UnclaimedRewardsPattern( - client, "unspendable_supply" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.opreturn: UnclaimedRewardsPattern = UnclaimedRewardsPattern(client, 'opreturn_supply') + self.unspendable: UnclaimedRewardsPattern = UnclaimedRewardsPattern(client, 'unspendable_supply') class MetricsTree_Supply_Circulating: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.bitcoin: MetricPattern3[Bitcoin] = MetricPattern3( - client, "circulating_supply_btc" - ) - self.dollars: MetricPattern3[Dollars] = MetricPattern3( - client, "circulating_supply_usd" - ) - self.sats: MetricPattern3[Sats] = MetricPattern3(client, "circulating_supply") - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.bitcoin: MetricPattern3[Bitcoin] = MetricPattern3(client, 'circulating_supply_btc') + self.dollars: MetricPattern3[Dollars] = MetricPattern3(client, 'circulating_supply_usd') + self.sats: MetricPattern3[Sats] = MetricPattern3(client, 'circulating_supply') class MetricsTree_Supply_Velocity: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.btc: MetricPattern4[StoredF64] = MetricPattern4(client, "btc_velocity") - self.usd: MetricPattern4[StoredF64] = MetricPattern4(client, "usd_velocity") - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.btc: MetricPattern4[StoredF64] = MetricPattern4(client, 'btc_velocity') + self.usd: MetricPattern4[StoredF64] = MetricPattern4(client, 'usd_velocity') class MetricsTree_Supply: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): + + def __init__(self, client: BrkClientBase, base_path: str = ''): self.burned: MetricsTree_Supply_Burned = MetricsTree_Supply_Burned(client) - self.circulating: MetricsTree_Supply_Circulating = ( - MetricsTree_Supply_Circulating(client) - ) - self.inflation: MetricPattern4[StoredF32] = MetricPattern4( - client, "inflation_rate" - ) - self.market_cap: MetricPattern1[Dollars] = MetricPattern1(client, "market_cap") + self.circulating: MetricsTree_Supply_Circulating = MetricsTree_Supply_Circulating(client) + self.inflation: MetricPattern4[StoredF32] = MetricPattern4(client, 'inflation_rate') + self.market_cap: MetricPattern1[Dollars] = MetricPattern1(client, 'market_cap') self.velocity: MetricsTree_Supply_Velocity = MetricsTree_Supply_Velocity(client) - class MetricsTree_Transactions_Count: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.is_coinbase: MetricPattern27[StoredBool] = MetricPattern27( - client, "is_coinbase" - ) - self.tx_count: DollarsPattern[StoredU64] = DollarsPattern(client, "tx_count") - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.is_coinbase: MetricPattern27[StoredBool] = MetricPattern27(client, 'is_coinbase') + self.tx_count: DollarsPattern[StoredU64] = DollarsPattern(client, 'tx_count') class MetricsTree_Transactions_Fees_Fee_Dollars: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.average: MetricPattern1[Dollars] = MetricPattern1( - client, "fee_usd_average" - ) - self.cumulative: MetricPattern2[Dollars] = MetricPattern2( - client, "fee_usd_cumulative" - ) - self.height_cumulative: MetricPattern11[Dollars] = MetricPattern11( - client, "fee_usd_cumulative" - ) - self.max: MetricPattern1[Dollars] = MetricPattern1(client, "fee_usd_max") - self.median: MetricPattern11[Dollars] = MetricPattern11( - client, "fee_usd_median" - ) - self.min: MetricPattern1[Dollars] = MetricPattern1(client, "fee_usd_min") - self.pct10: MetricPattern11[Dollars] = MetricPattern11(client, "fee_usd_pct10") - self.pct25: MetricPattern11[Dollars] = MetricPattern11(client, "fee_usd_pct25") - self.pct75: MetricPattern11[Dollars] = MetricPattern11(client, "fee_usd_pct75") - self.pct90: MetricPattern11[Dollars] = MetricPattern11(client, "fee_usd_pct90") - self.sum: MetricPattern1[Dollars] = MetricPattern1(client, "fee_usd_sum") - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.average: MetricPattern1[Dollars] = MetricPattern1(client, 'fee_usd_average') + self.cumulative: MetricPattern2[Dollars] = MetricPattern2(client, 'fee_usd_cumulative') + self.height_cumulative: MetricPattern11[Dollars] = MetricPattern11(client, 'fee_usd_cumulative') + self.max: MetricPattern1[Dollars] = MetricPattern1(client, 'fee_usd_max') + self.median: MetricPattern11[Dollars] = MetricPattern11(client, 'fee_usd_median') + self.min: MetricPattern1[Dollars] = MetricPattern1(client, 'fee_usd_min') + self.pct10: MetricPattern11[Dollars] = MetricPattern11(client, 'fee_usd_pct10') + self.pct25: MetricPattern11[Dollars] = MetricPattern11(client, 'fee_usd_pct25') + self.pct75: MetricPattern11[Dollars] = MetricPattern11(client, 'fee_usd_pct75') + self.pct90: MetricPattern11[Dollars] = MetricPattern11(client, 'fee_usd_pct90') + self.sum: MetricPattern1[Dollars] = MetricPattern1(client, 'fee_usd_sum') class MetricsTree_Transactions_Fees_Fee: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.bitcoin: CountPattern2[Bitcoin] = CountPattern2(client, "fee_btc") - self.dollars: MetricsTree_Transactions_Fees_Fee_Dollars = ( - MetricsTree_Transactions_Fees_Fee_Dollars(client) - ) - self.sats: CountPattern2[Sats] = CountPattern2(client, "fee") - self.txindex: MetricPattern27[Sats] = MetricPattern27(client, "fee") - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.bitcoin: CountPattern2[Bitcoin] = CountPattern2(client, 'fee_btc') + self.dollars: MetricsTree_Transactions_Fees_Fee_Dollars = MetricsTree_Transactions_Fees_Fee_Dollars(client) + self.sats: CountPattern2[Sats] = CountPattern2(client, 'fee') + self.txindex: MetricPattern27[Sats] = MetricPattern27(client, 'fee') class MetricsTree_Transactions_Fees: """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.fee: MetricsTree_Transactions_Fees_Fee = MetricsTree_Transactions_Fees_Fee(client) + self.fee_rate: FeeRatePattern[FeeRate] = FeeRatePattern(client, 'fee_rate') + self.input_value: MetricPattern27[Sats] = MetricPattern27(client, 'input_value') + self.output_value: MetricPattern27[Sats] = MetricPattern27(client, 'output_value') - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.fee: MetricsTree_Transactions_Fees_Fee = MetricsTree_Transactions_Fees_Fee( - client - ) - self.fee_rate: FeeRatePattern[FeeRate] = FeeRatePattern(client, "fee_rate") - self.input_value: MetricPattern27[Sats] = MetricPattern27(client, "input_value") - self.output_value: MetricPattern27[Sats] = MetricPattern27( - client, "output_value" - ) +class MetricsTree_Transactions_Size_Vsize: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.average: MetricPattern1[VSize] = MetricPattern1(client, 'tx_vsize_average') + self.max: MetricPattern1[VSize] = MetricPattern1(client, 'tx_vsize_max') + self.median: MetricPattern11[VSize] = MetricPattern11(client, 'tx_vsize_median') + self.min: MetricPattern1[VSize] = MetricPattern1(client, 'tx_vsize_min') + self.pct10: MetricPattern11[VSize] = MetricPattern11(client, 'tx_vsize_pct10') + self.pct25: MetricPattern11[VSize] = MetricPattern11(client, 'tx_vsize_pct25') + self.pct75: MetricPattern11[VSize] = MetricPattern11(client, 'tx_vsize_pct75') + self.pct90: MetricPattern11[VSize] = MetricPattern11(client, 'tx_vsize_pct90') + self.txindex: MetricPattern27[VSize] = MetricPattern27(client, 'vsize') +class MetricsTree_Transactions_Size_Weight: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.average: MetricPattern1[Weight] = MetricPattern1(client, 'tx_weight_average') + self.max: MetricPattern1[Weight] = MetricPattern1(client, 'tx_weight_max') + self.median: MetricPattern11[Weight] = MetricPattern11(client, 'tx_weight_median') + self.min: MetricPattern1[Weight] = MetricPattern1(client, 'tx_weight_min') + self.pct10: MetricPattern11[Weight] = MetricPattern11(client, 'tx_weight_pct10') + self.pct25: MetricPattern11[Weight] = MetricPattern11(client, 'tx_weight_pct25') + self.pct75: MetricPattern11[Weight] = MetricPattern11(client, 'tx_weight_pct75') + self.pct90: MetricPattern11[Weight] = MetricPattern11(client, 'tx_weight_pct90') + self.txindex: MetricPattern27[Weight] = MetricPattern27(client, 'weight') class MetricsTree_Transactions_Size: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.vsize: FeeRatePattern[VSize] = FeeRatePattern(client, "tx_vsize_average") - self.weight: FeeRatePattern[Weight] = FeeRatePattern( - client, "tx_weight_average" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.vsize: MetricsTree_Transactions_Size_Vsize = MetricsTree_Transactions_Size_Vsize(client) + self.weight: MetricsTree_Transactions_Size_Weight = MetricsTree_Transactions_Size_Weight(client) class MetricsTree_Transactions_Versions: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.v1: BlockCountPattern[StoredU64] = BlockCountPattern(client, "tx_v1") - self.v2: BlockCountPattern[StoredU64] = BlockCountPattern(client, "tx_v2") - self.v3: BlockCountPattern[StoredU64] = BlockCountPattern(client, "tx_v3") - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.v1: BlockCountPattern[StoredU64] = BlockCountPattern(client, 'tx_v1') + self.v2: BlockCountPattern[StoredU64] = BlockCountPattern(client, 'tx_v2') + self.v3: BlockCountPattern[StoredU64] = BlockCountPattern(client, 'tx_v3') class MetricsTree_Transactions_Volume: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.annualized_volume: _2015Pattern = _2015Pattern(client, "annualized_volume") - self.inputs_per_sec: MetricPattern4[StoredF32] = MetricPattern4( - client, "inputs_per_sec" - ) - self.outputs_per_sec: MetricPattern4[StoredF32] = MetricPattern4( - client, "outputs_per_sec" - ) - self.sent_sum: ActiveSupplyPattern = ActiveSupplyPattern(client, "sent_sum") - self.tx_per_sec: MetricPattern4[StoredF32] = MetricPattern4( - client, "tx_per_sec" - ) - + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.annualized_volume: _2015Pattern = _2015Pattern(client, 'annualized_volume') + self.inputs_per_sec: MetricPattern4[StoredF32] = MetricPattern4(client, 'inputs_per_sec') + self.outputs_per_sec: MetricPattern4[StoredF32] = MetricPattern4(client, 'outputs_per_sec') + self.sent_sum: ActiveSupplyPattern = ActiveSupplyPattern(client, 'sent_sum') + self.tx_per_sec: MetricPattern4[StoredF32] = MetricPattern4(client, 'tx_per_sec') class MetricsTree_Transactions: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): - self.base_size: MetricPattern27[StoredU32] = MetricPattern27( - client, "base_size" - ) - self.count: MetricsTree_Transactions_Count = MetricsTree_Transactions_Count( - client - ) + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.base_size: MetricPattern27[StoredU32] = MetricPattern27(client, 'base_size') + self.count: MetricsTree_Transactions_Count = MetricsTree_Transactions_Count(client) self.fees: MetricsTree_Transactions_Fees = MetricsTree_Transactions_Fees(client) - self.first_txindex: MetricPattern11[TxIndex] = MetricPattern11( - client, "first_txindex" - ) - self.first_txinindex: MetricPattern27[TxInIndex] = MetricPattern27( - client, "first_txinindex" - ) - self.first_txoutindex: MetricPattern27[TxOutIndex] = MetricPattern27( - client, "first_txoutindex" - ) - self.height: MetricPattern27[Height] = MetricPattern27(client, "height") - self.is_explicitly_rbf: MetricPattern27[StoredBool] = MetricPattern27( - client, "is_explicitly_rbf" - ) - self.rawlocktime: MetricPattern27[RawLockTime] = MetricPattern27( - client, "rawlocktime" - ) + self.first_txindex: MetricPattern11[TxIndex] = MetricPattern11(client, 'first_txindex') + self.first_txinindex: MetricPattern27[TxInIndex] = MetricPattern27(client, 'first_txinindex') + self.first_txoutindex: MetricPattern27[TxOutIndex] = MetricPattern27(client, 'first_txoutindex') + self.height: MetricPattern27[Height] = MetricPattern27(client, 'height') + self.is_explicitly_rbf: MetricPattern27[StoredBool] = MetricPattern27(client, 'is_explicitly_rbf') + self.rawlocktime: MetricPattern27[RawLockTime] = MetricPattern27(client, 'rawlocktime') self.size: MetricsTree_Transactions_Size = MetricsTree_Transactions_Size(client) - self.total_size: MetricPattern27[StoredU32] = MetricPattern27( - client, "total_size" - ) - self.txid: MetricPattern27[Txid] = MetricPattern27(client, "txid") - self.txversion: MetricPattern27[TxVersion] = MetricPattern27( - client, "txversion" - ) - self.versions: MetricsTree_Transactions_Versions = ( - MetricsTree_Transactions_Versions(client) - ) - self.volume: MetricsTree_Transactions_Volume = MetricsTree_Transactions_Volume( - client - ) - + self.total_size: MetricPattern27[StoredU32] = MetricPattern27(client, 'total_size') + self.txid: MetricPattern27[Txid] = MetricPattern27(client, 'txid') + self.txversion: MetricPattern27[TxVersion] = MetricPattern27(client, 'txversion') + self.versions: MetricsTree_Transactions_Versions = MetricsTree_Transactions_Versions(client) + self.volume: MetricsTree_Transactions_Volume = MetricsTree_Transactions_Volume(client) class MetricsTree: """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ""): + + def __init__(self, client: BrkClientBase, base_path: str = ''): self.addresses: MetricsTree_Addresses = MetricsTree_Addresses(client) self.blocks: MetricsTree_Blocks = MetricsTree_Blocks(client) self.cointime: MetricsTree_Cointime = MetricsTree_Cointime(client) @@ -6853,644 +4682,903 @@ class MetricsTree: self.supply: MetricsTree_Supply = MetricsTree_Supply(client) self.transactions: MetricsTree_Transactions = MetricsTree_Transactions(client) - class BrkClient(BrkClientBase): """Main BRK client with metrics tree and API methods.""" VERSION = "v0.1.0-alpha.2" INDEXES = [ - "dateindex", - "decadeindex", - "difficultyepoch", - "emptyoutputindex", - "halvingepoch", - "height", - "txinindex", - "monthindex", - "opreturnindex", - "txoutindex", - "p2aaddressindex", - "p2msoutputindex", - "p2pk33addressindex", - "p2pk65addressindex", - "p2pkhaddressindex", - "p2shaddressindex", - "p2traddressindex", - "p2wpkhaddressindex", - "p2wshaddressindex", - "quarterindex", - "semesterindex", - "txindex", - "unknownoutputindex", - "weekindex", - "yearindex", - "loadedaddressindex", - "emptyaddressindex", + "dateindex", + "decadeindex", + "difficultyepoch", + "emptyoutputindex", + "halvingepoch", + "height", + "txinindex", + "monthindex", + "opreturnindex", + "txoutindex", + "p2aaddressindex", + "p2msoutputindex", + "p2pk33addressindex", + "p2pk65addressindex", + "p2pkhaddressindex", + "p2shaddressindex", + "p2traddressindex", + "p2wpkhaddressindex", + "p2wshaddressindex", + "quarterindex", + "semesterindex", + "txindex", + "unknownoutputindex", + "weekindex", + "yearindex", + "loadedaddressindex", + "emptyaddressindex" ] POOL_ID_TO_POOL_NAME = { - "aaopool": "AAO Pool", - "antpool": "AntPool", - "arkpool": "ArkPool", - "asicminer": "ASICMiner", - "axbt": "A-XBT", - "batpool": "BATPOOL", - "bcmonster": "BCMonster", - "bcpoolio": "bcpool.io", - "binancepool": "Binance Pool", - "bitalo": "Bitalo", - "bitclub": "BitClub", - "bitcoinaffiliatenetwork": "Bitcoin Affiliate Network", - "bitcoincom": "Bitcoin.com", - "bitcoinindia": "Bitcoin India", - "bitcoinrussia": "BitcoinRussia", - "bitcoinukraine": "Bitcoin-Ukraine", - "bitfarms": "Bitfarms", - "bitfufupool": "BitFuFuPool", - "bitfury": "BitFury", - "bitminter": "BitMinter", - "bitparking": "Bitparking", - "bitsolo": "Bitsolo", - "bixin": "Bixin", - "blockfills": "BlockFills", - "braiinspool": "Braiins Pool", - "bravomining": "Bravo Mining", - "btcc": "BTCC", - "btccom": "BTC.com", - "btcdig": "BTCDig", - "btcguild": "BTC Guild", - "btclab": "BTCLab", - "btcmp": "BTCMP", - "btcnuggets": "BTC Nuggets", - "btcpoolparty": "BTC Pool Party", - "btcserv": "BTCServ", - "btctop": "BTC.TOP", - "btpool": "BTPOOL", - "bwpool": "BWPool", - "bytepool": "BytePool", - "canoe": "CANOE", - "canoepool": "CanoePool", - "carbonnegative": "Carbon Negative", - "ckpool": "CKPool", - "cloudhashing": "CloudHashing", - "coinlab": "CoinLab", - "cointerra": "Cointerra", - "connectbtc": "ConnectBTC", - "dcex": "DCEX", - "dcexploration": "DCExploration", - "digitalbtc": "digitalBTC", - "digitalxmintsy": "digitalX Mintsy", - "dpool": "DPOOL", - "eclipsemc": "EclipseMC", - "eightbaochi": "8baochi", - "ekanembtc": "EkanemBTC", - "eligius": "Eligius", - "emcdpool": "EMCDPool", - "entrustcharitypool": "Entrust Charity Pool", - "eobot": "Eobot", - "exxbw": "EXX&BW", - "f2pool": "F2Pool", - "fiftyeightcoin": "58COIN", - "foundryusa": "Foundry USA", - "futurebitapollosolo": "FutureBit Apollo Solo", - "gbminers": "GBMiners", - "ghashio": "GHash.IO", - "givemecoins": "Give Me Coins", - "gogreenlight": "GoGreenLight", - "haominer": "haominer", - "haozhuzhu": "HAOZHUZHU", - "hashbx": "HashBX", - "hashpool": "HASHPOOL", - "helix": "Helix", - "hhtt": "HHTT", - "hotpool": "HotPool", - "hummerpool": "Hummerpool", - "huobipool": "Huobi.pool", - "innopolistech": "Innopolis Tech", - "kanopool": "KanoPool", - "kncminer": "KnCMiner", - "kucoinpool": "KuCoinPool", - "lubiancom": "Lubian.com", - "luckypool": "luckyPool", - "luxor": "Luxor", - "marapool": "MARA Pool", - "maxbtc": "MaxBTC", - "maxipool": "MaxiPool", - "megabigpower": "MegaBigPower", - "minerium": "Minerium", - "miningcity": "MiningCity", - "miningdutch": "Mining-Dutch", - "miningkings": "MiningKings", - "miningsquared": "Mining Squared", - "mmpool": "mmpool", - "mtred": "Mt Red", - "multicoinco": "MultiCoin.co", - "multipool": "Multipool", - "mybtccoinpool": "myBTCcoin Pool", - "neopool": "Neopool", - "nexious": "Nexious", - "nicehash": "NiceHash", - "nmcbit": "NMCbit", - "novablock": "NovaBlock", - "ocean": "OCEAN", - "okexpool": "OKExPool", - "okkong": "OKKONG", - "okminer": "OKMINER", - "okpooltop": "okpool.top", - "onehash": "1Hash", - "onem1x": "1M1X", - "onethash": "1THash", - "ozcoin": "OzCoin", - "parasite": "Parasite", - "patels": "Patels", - "pegapool": "PEGA Pool", - "phashio": "PHash.IO", - "phoenix": "Phoenix", - "polmine": "Polmine", - "pool175btc": "175btc", - "pool50btc": "50BTC", - "poolin": "Poolin", - "portlandhodl": "Portland.HODL", - "publicpool": "Public Pool", - "purebtccom": "PureBTC.COM", - "rawpool": "Rawpool", - "rigpool": "RigPool", - "sbicrypto": "SBI Crypto", - "secpool": "SECPOOL", - "secretsuperstar": "SecretSuperstar", - "sevenpool": "7pool", - "shawnp0wers": "shawnp0wers", - "sigmapoolcom": "Sigmapool.com", - "simplecoinus": "simplecoin.us", - "solock": "Solo CK", - "spiderpool": "SpiderPool", - "stminingcorp": "ST Mining Corp", - "tangpool": "Tangpool", - "tatmaspool": "TATMAS Pool", - "tbdice": "TBDice", - "telco214": "Telco 214", - "terrapool": "Terra Pool", - "tiger": "tiger", - "tigerpoolnet": "tigerpool.net", - "titan": "Titan", - "transactioncoinmining": "transactioncoinmining", - "trickysbtcpool": "Tricky's BTC Pool", - "triplemining": "TripleMining", - "twentyoneinc": "21 Inc.", - "ultimuspool": "ULTIMUSPOOL", - "unknown": "Unknown", - "unomp": "UNOMP", - "viabtc": "ViaBTC", - "waterhole": "Waterhole", - "wayicn": "WAYI.CN", - "whitepool": "WhitePool", - "wk057": "wk057", - "yourbtcnet": "Yourbtc.net", - "zulupool": "Zulupool", + "aaopool": "AAO Pool", + "antpool": "AntPool", + "arkpool": "ArkPool", + "asicminer": "ASICMiner", + "axbt": "A-XBT", + "batpool": "BATPOOL", + "bcmonster": "BCMonster", + "bcpoolio": "bcpool.io", + "binancepool": "Binance Pool", + "bitalo": "Bitalo", + "bitclub": "BitClub", + "bitcoinaffiliatenetwork": "Bitcoin Affiliate Network", + "bitcoincom": "Bitcoin.com", + "bitcoinindia": "Bitcoin India", + "bitcoinrussia": "BitcoinRussia", + "bitcoinukraine": "Bitcoin-Ukraine", + "bitfarms": "Bitfarms", + "bitfufupool": "BitFuFuPool", + "bitfury": "BitFury", + "bitminter": "BitMinter", + "bitparking": "Bitparking", + "bitsolo": "Bitsolo", + "bixin": "Bixin", + "blockfills": "BlockFills", + "braiinspool": "Braiins Pool", + "bravomining": "Bravo Mining", + "btcc": "BTCC", + "btccom": "BTC.com", + "btcdig": "BTCDig", + "btcguild": "BTC Guild", + "btclab": "BTCLab", + "btcmp": "BTCMP", + "btcnuggets": "BTC Nuggets", + "btcpoolparty": "BTC Pool Party", + "btcserv": "BTCServ", + "btctop": "BTC.TOP", + "btpool": "BTPOOL", + "bwpool": "BWPool", + "bytepool": "BytePool", + "canoe": "CANOE", + "canoepool": "CanoePool", + "carbonnegative": "Carbon Negative", + "ckpool": "CKPool", + "cloudhashing": "CloudHashing", + "coinlab": "CoinLab", + "cointerra": "Cointerra", + "connectbtc": "ConnectBTC", + "dcex": "DCEX", + "dcexploration": "DCExploration", + "digitalbtc": "digitalBTC", + "digitalxmintsy": "digitalX Mintsy", + "dpool": "DPOOL", + "eclipsemc": "EclipseMC", + "eightbaochi": "8baochi", + "ekanembtc": "EkanemBTC", + "eligius": "Eligius", + "emcdpool": "EMCDPool", + "entrustcharitypool": "Entrust Charity Pool", + "eobot": "Eobot", + "exxbw": "EXX&BW", + "f2pool": "F2Pool", + "fiftyeightcoin": "58COIN", + "foundryusa": "Foundry USA", + "futurebitapollosolo": "FutureBit Apollo Solo", + "gbminers": "GBMiners", + "ghashio": "GHash.IO", + "givemecoins": "Give Me Coins", + "gogreenlight": "GoGreenLight", + "haominer": "haominer", + "haozhuzhu": "HAOZHUZHU", + "hashbx": "HashBX", + "hashpool": "HASHPOOL", + "helix": "Helix", + "hhtt": "HHTT", + "hotpool": "HotPool", + "hummerpool": "Hummerpool", + "huobipool": "Huobi.pool", + "innopolistech": "Innopolis Tech", + "kanopool": "KanoPool", + "kncminer": "KnCMiner", + "kucoinpool": "KuCoinPool", + "lubiancom": "Lubian.com", + "luckypool": "luckyPool", + "luxor": "Luxor", + "marapool": "MARA Pool", + "maxbtc": "MaxBTC", + "maxipool": "MaxiPool", + "megabigpower": "MegaBigPower", + "minerium": "Minerium", + "miningcity": "MiningCity", + "miningdutch": "Mining-Dutch", + "miningkings": "MiningKings", + "miningsquared": "Mining Squared", + "mmpool": "mmpool", + "mtred": "Mt Red", + "multicoinco": "MultiCoin.co", + "multipool": "Multipool", + "mybtccoinpool": "myBTCcoin Pool", + "neopool": "Neopool", + "nexious": "Nexious", + "nicehash": "NiceHash", + "nmcbit": "NMCbit", + "novablock": "NovaBlock", + "ocean": "OCEAN", + "okexpool": "OKExPool", + "okkong": "OKKONG", + "okminer": "OKMINER", + "okpooltop": "okpool.top", + "onehash": "1Hash", + "onem1x": "1M1X", + "onethash": "1THash", + "ozcoin": "OzCoin", + "parasite": "Parasite", + "patels": "Patels", + "pegapool": "PEGA Pool", + "phashio": "PHash.IO", + "phoenix": "Phoenix", + "polmine": "Polmine", + "pool175btc": "175btc", + "pool50btc": "50BTC", + "poolin": "Poolin", + "portlandhodl": "Portland.HODL", + "publicpool": "Public Pool", + "purebtccom": "PureBTC.COM", + "rawpool": "Rawpool", + "rigpool": "RigPool", + "sbicrypto": "SBI Crypto", + "secpool": "SECPOOL", + "secretsuperstar": "SecretSuperstar", + "sevenpool": "7pool", + "shawnp0wers": "shawnp0wers", + "sigmapoolcom": "Sigmapool.com", + "simplecoinus": "simplecoin.us", + "solock": "Solo CK", + "spiderpool": "SpiderPool", + "stminingcorp": "ST Mining Corp", + "tangpool": "Tangpool", + "tatmaspool": "TATMAS Pool", + "tbdice": "TBDice", + "telco214": "Telco 214", + "terrapool": "Terra Pool", + "tiger": "tiger", + "tigerpoolnet": "tigerpool.net", + "titan": "Titan", + "transactioncoinmining": "transactioncoinmining", + "trickysbtcpool": "Tricky's BTC Pool", + "triplemining": "TripleMining", + "twentyoneinc": "21 Inc.", + "ultimuspool": "ULTIMUSPOOL", + "unknown": "Unknown", + "unomp": "UNOMP", + "viabtc": "ViaBTC", + "waterhole": "Waterhole", + "wayicn": "WAYI.CN", + "whitepool": "WhitePool", + "wk057": "wk057", + "yourbtcnet": "Yourbtc.net", + "zulupool": "Zulupool" } TERM_NAMES = { - "short": {"id": "sth", "short": "STH", "long": "Short Term Holders"}, - "long": {"id": "lth", "short": "LTH", "long": "Long Term Holders"}, + "short": { + "id": "sth", + "short": "STH", + "long": "Short Term Holders" + }, + "long": { + "id": "lth", + "short": "LTH", + "long": "Long Term Holders" + } } EPOCH_NAMES = { - "_0": {"id": "epoch_0", "short": "Epoch 0", "long": "Epoch 0"}, - "_1": {"id": "epoch_1", "short": "Epoch 1", "long": "Epoch 1"}, - "_2": {"id": "epoch_2", "short": "Epoch 2", "long": "Epoch 2"}, - "_3": {"id": "epoch_3", "short": "Epoch 3", "long": "Epoch 3"}, - "_4": {"id": "epoch_4", "short": "Epoch 4", "long": "Epoch 4"}, + "_0": { + "id": "epoch_0", + "short": "Epoch 0", + "long": "Epoch 0" + }, + "_1": { + "id": "epoch_1", + "short": "Epoch 1", + "long": "Epoch 1" + }, + "_2": { + "id": "epoch_2", + "short": "Epoch 2", + "long": "Epoch 2" + }, + "_3": { + "id": "epoch_3", + "short": "Epoch 3", + "long": "Epoch 3" + }, + "_4": { + "id": "epoch_4", + "short": "Epoch 4", + "long": "Epoch 4" + } } YEAR_NAMES = { - "_2009": {"id": "year_2009", "short": "2009", "long": "Year 2009"}, - "_2010": {"id": "year_2010", "short": "2010", "long": "Year 2010"}, - "_2011": {"id": "year_2011", "short": "2011", "long": "Year 2011"}, - "_2012": {"id": "year_2012", "short": "2012", "long": "Year 2012"}, - "_2013": {"id": "year_2013", "short": "2013", "long": "Year 2013"}, - "_2014": {"id": "year_2014", "short": "2014", "long": "Year 2014"}, - "_2015": {"id": "year_2015", "short": "2015", "long": "Year 2015"}, - "_2016": {"id": "year_2016", "short": "2016", "long": "Year 2016"}, - "_2017": {"id": "year_2017", "short": "2017", "long": "Year 2017"}, - "_2018": {"id": "year_2018", "short": "2018", "long": "Year 2018"}, - "_2019": {"id": "year_2019", "short": "2019", "long": "Year 2019"}, - "_2020": {"id": "year_2020", "short": "2020", "long": "Year 2020"}, - "_2021": {"id": "year_2021", "short": "2021", "long": "Year 2021"}, - "_2022": {"id": "year_2022", "short": "2022", "long": "Year 2022"}, - "_2023": {"id": "year_2023", "short": "2023", "long": "Year 2023"}, - "_2024": {"id": "year_2024", "short": "2024", "long": "Year 2024"}, - "_2025": {"id": "year_2025", "short": "2025", "long": "Year 2025"}, - "_2026": {"id": "year_2026", "short": "2026", "long": "Year 2026"}, + "_2009": { + "id": "year_2009", + "short": "2009", + "long": "Year 2009" + }, + "_2010": { + "id": "year_2010", + "short": "2010", + "long": "Year 2010" + }, + "_2011": { + "id": "year_2011", + "short": "2011", + "long": "Year 2011" + }, + "_2012": { + "id": "year_2012", + "short": "2012", + "long": "Year 2012" + }, + "_2013": { + "id": "year_2013", + "short": "2013", + "long": "Year 2013" + }, + "_2014": { + "id": "year_2014", + "short": "2014", + "long": "Year 2014" + }, + "_2015": { + "id": "year_2015", + "short": "2015", + "long": "Year 2015" + }, + "_2016": { + "id": "year_2016", + "short": "2016", + "long": "Year 2016" + }, + "_2017": { + "id": "year_2017", + "short": "2017", + "long": "Year 2017" + }, + "_2018": { + "id": "year_2018", + "short": "2018", + "long": "Year 2018" + }, + "_2019": { + "id": "year_2019", + "short": "2019", + "long": "Year 2019" + }, + "_2020": { + "id": "year_2020", + "short": "2020", + "long": "Year 2020" + }, + "_2021": { + "id": "year_2021", + "short": "2021", + "long": "Year 2021" + }, + "_2022": { + "id": "year_2022", + "short": "2022", + "long": "Year 2022" + }, + "_2023": { + "id": "year_2023", + "short": "2023", + "long": "Year 2023" + }, + "_2024": { + "id": "year_2024", + "short": "2024", + "long": "Year 2024" + }, + "_2025": { + "id": "year_2025", + "short": "2025", + "long": "Year 2025" + }, + "_2026": { + "id": "year_2026", + "short": "2026", + "long": "Year 2026" + } } SPENDABLE_TYPE_NAMES = { - "p2pk65": { - "id": "p2pk65", - "short": "P2PK65", - "long": "Pay to Public Key (65 bytes)", - }, - "p2pk33": { - "id": "p2pk33", - "short": "P2PK33", - "long": "Pay to Public Key (33 bytes)", - }, - "p2pkh": {"id": "p2pkh", "short": "P2PKH", "long": "Pay to Public Key Hash"}, - "p2ms": {"id": "p2ms", "short": "P2MS", "long": "Pay to Multisig"}, - "p2sh": {"id": "p2sh", "short": "P2SH", "long": "Pay to Script Hash"}, - "p2wpkh": { - "id": "p2wpkh", - "short": "P2WPKH", - "long": "Pay to Witness Public Key Hash", - }, - "p2wsh": { - "id": "p2wsh", - "short": "P2WSH", - "long": "Pay to Witness Script Hash", - }, - "p2tr": {"id": "p2tr", "short": "P2TR", "long": "Pay to Taproot"}, - "p2a": {"id": "p2a", "short": "P2A", "long": "Pay to Anchor"}, - "unknown": { - "id": "unknown_outputs", - "short": "Unknown", - "long": "Unknown Output Type", - }, - "empty": {"id": "empty_outputs", "short": "Empty", "long": "Empty Output"}, + "p2pk65": { + "id": "p2pk65", + "short": "P2PK65", + "long": "Pay to Public Key (65 bytes)" + }, + "p2pk33": { + "id": "p2pk33", + "short": "P2PK33", + "long": "Pay to Public Key (33 bytes)" + }, + "p2pkh": { + "id": "p2pkh", + "short": "P2PKH", + "long": "Pay to Public Key Hash" + }, + "p2ms": { + "id": "p2ms", + "short": "P2MS", + "long": "Pay to Multisig" + }, + "p2sh": { + "id": "p2sh", + "short": "P2SH", + "long": "Pay to Script Hash" + }, + "p2wpkh": { + "id": "p2wpkh", + "short": "P2WPKH", + "long": "Pay to Witness Public Key Hash" + }, + "p2wsh": { + "id": "p2wsh", + "short": "P2WSH", + "long": "Pay to Witness Script Hash" + }, + "p2tr": { + "id": "p2tr", + "short": "P2TR", + "long": "Pay to Taproot" + }, + "p2a": { + "id": "p2a", + "short": "P2A", + "long": "Pay to Anchor" + }, + "unknown": { + "id": "unknown_outputs", + "short": "Unknown", + "long": "Unknown Output Type" + }, + "empty": { + "id": "empty_outputs", + "short": "Empty", + "long": "Empty Output" + } } AGE_RANGE_NAMES = { - "up_to_1h": {"id": "up_to_1h_old", "short": "<1h", "long": "Up to 1 Hour Old"}, - "_1h_to_1d": { - "id": "at_least_1h_up_to_1d_old", - "short": "1h-1d", - "long": "1 Hour to 1 Day Old", - }, - "_1d_to_1w": { - "id": "at_least_1d_up_to_1w_old", - "short": "1d-1w", - "long": "1 Day to 1 Week Old", - }, - "_1w_to_1m": { - "id": "at_least_1w_up_to_1m_old", - "short": "1w-1m", - "long": "1 Week to 1 Month Old", - }, - "_1m_to_2m": { - "id": "at_least_1m_up_to_2m_old", - "short": "1m-2m", - "long": "1 to 2 Months Old", - }, - "_2m_to_3m": { - "id": "at_least_2m_up_to_3m_old", - "short": "2m-3m", - "long": "2 to 3 Months Old", - }, - "_3m_to_4m": { - "id": "at_least_3m_up_to_4m_old", - "short": "3m-4m", - "long": "3 to 4 Months Old", - }, - "_4m_to_5m": { - "id": "at_least_4m_up_to_5m_old", - "short": "4m-5m", - "long": "4 to 5 Months Old", - }, - "_5m_to_6m": { - "id": "at_least_5m_up_to_6m_old", - "short": "5m-6m", - "long": "5 to 6 Months Old", - }, - "_6m_to_1y": { - "id": "at_least_6m_up_to_1y_old", - "short": "6m-1y", - "long": "6 Months to 1 Year Old", - }, - "_1y_to_2y": { - "id": "at_least_1y_up_to_2y_old", - "short": "1y-2y", - "long": "1 to 2 Years Old", - }, - "_2y_to_3y": { - "id": "at_least_2y_up_to_3y_old", - "short": "2y-3y", - "long": "2 to 3 Years Old", - }, - "_3y_to_4y": { - "id": "at_least_3y_up_to_4y_old", - "short": "3y-4y", - "long": "3 to 4 Years Old", - }, - "_4y_to_5y": { - "id": "at_least_4y_up_to_5y_old", - "short": "4y-5y", - "long": "4 to 5 Years Old", - }, - "_5y_to_6y": { - "id": "at_least_5y_up_to_6y_old", - "short": "5y-6y", - "long": "5 to 6 Years Old", - }, - "_6y_to_7y": { - "id": "at_least_6y_up_to_7y_old", - "short": "6y-7y", - "long": "6 to 7 Years Old", - }, - "_7y_to_8y": { - "id": "at_least_7y_up_to_8y_old", - "short": "7y-8y", - "long": "7 to 8 Years Old", - }, - "_8y_to_10y": { - "id": "at_least_8y_up_to_10y_old", - "short": "8y-10y", - "long": "8 to 10 Years Old", - }, - "_10y_to_12y": { - "id": "at_least_10y_up_to_12y_old", - "short": "10y-12y", - "long": "10 to 12 Years Old", - }, - "_12y_to_15y": { - "id": "at_least_12y_up_to_15y_old", - "short": "12y-15y", - "long": "12 to 15 Years Old", - }, - "from_15y": { - "id": "at_least_15y_old", - "short": "15y+", - "long": "15+ Years Old", - }, + "up_to_1h": { + "id": "up_to_1h_old", + "short": "<1h", + "long": "Up to 1 Hour Old" + }, + "_1h_to_1d": { + "id": "at_least_1h_up_to_1d_old", + "short": "1h-1d", + "long": "1 Hour to 1 Day Old" + }, + "_1d_to_1w": { + "id": "at_least_1d_up_to_1w_old", + "short": "1d-1w", + "long": "1 Day to 1 Week Old" + }, + "_1w_to_1m": { + "id": "at_least_1w_up_to_1m_old", + "short": "1w-1m", + "long": "1 Week to 1 Month Old" + }, + "_1m_to_2m": { + "id": "at_least_1m_up_to_2m_old", + "short": "1m-2m", + "long": "1 to 2 Months Old" + }, + "_2m_to_3m": { + "id": "at_least_2m_up_to_3m_old", + "short": "2m-3m", + "long": "2 to 3 Months Old" + }, + "_3m_to_4m": { + "id": "at_least_3m_up_to_4m_old", + "short": "3m-4m", + "long": "3 to 4 Months Old" + }, + "_4m_to_5m": { + "id": "at_least_4m_up_to_5m_old", + "short": "4m-5m", + "long": "4 to 5 Months Old" + }, + "_5m_to_6m": { + "id": "at_least_5m_up_to_6m_old", + "short": "5m-6m", + "long": "5 to 6 Months Old" + }, + "_6m_to_1y": { + "id": "at_least_6m_up_to_1y_old", + "short": "6m-1y", + "long": "6 Months to 1 Year Old" + }, + "_1y_to_2y": { + "id": "at_least_1y_up_to_2y_old", + "short": "1y-2y", + "long": "1 to 2 Years Old" + }, + "_2y_to_3y": { + "id": "at_least_2y_up_to_3y_old", + "short": "2y-3y", + "long": "2 to 3 Years Old" + }, + "_3y_to_4y": { + "id": "at_least_3y_up_to_4y_old", + "short": "3y-4y", + "long": "3 to 4 Years Old" + }, + "_4y_to_5y": { + "id": "at_least_4y_up_to_5y_old", + "short": "4y-5y", + "long": "4 to 5 Years Old" + }, + "_5y_to_6y": { + "id": "at_least_5y_up_to_6y_old", + "short": "5y-6y", + "long": "5 to 6 Years Old" + }, + "_6y_to_7y": { + "id": "at_least_6y_up_to_7y_old", + "short": "6y-7y", + "long": "6 to 7 Years Old" + }, + "_7y_to_8y": { + "id": "at_least_7y_up_to_8y_old", + "short": "7y-8y", + "long": "7 to 8 Years Old" + }, + "_8y_to_10y": { + "id": "at_least_8y_up_to_10y_old", + "short": "8y-10y", + "long": "8 to 10 Years Old" + }, + "_10y_to_12y": { + "id": "at_least_10y_up_to_12y_old", + "short": "10y-12y", + "long": "10 to 12 Years Old" + }, + "_12y_to_15y": { + "id": "at_least_12y_up_to_15y_old", + "short": "12y-15y", + "long": "12 to 15 Years Old" + }, + "from_15y": { + "id": "at_least_15y_old", + "short": "15y+", + "long": "15+ Years Old" + } } MAX_AGE_NAMES = { - "_1w": {"id": "up_to_1w_old", "short": "<1w", "long": "Up to 1 Week Old"}, - "_1m": {"id": "up_to_1m_old", "short": "<1m", "long": "Up to 1 Month Old"}, - "_2m": {"id": "up_to_2m_old", "short": "<2m", "long": "Up to 2 Months Old"}, - "_3m": {"id": "up_to_3m_old", "short": "<3m", "long": "Up to 3 Months Old"}, - "_4m": {"id": "up_to_4m_old", "short": "<4m", "long": "Up to 4 Months Old"}, - "_5m": {"id": "up_to_5m_old", "short": "<5m", "long": "Up to 5 Months Old"}, - "_6m": {"id": "up_to_6m_old", "short": "<6m", "long": "Up to 6 Months Old"}, - "_1y": {"id": "up_to_1y_old", "short": "<1y", "long": "Up to 1 Year Old"}, - "_2y": {"id": "up_to_2y_old", "short": "<2y", "long": "Up to 2 Years Old"}, - "_3y": {"id": "up_to_3y_old", "short": "<3y", "long": "Up to 3 Years Old"}, - "_4y": {"id": "up_to_4y_old", "short": "<4y", "long": "Up to 4 Years Old"}, - "_5y": {"id": "up_to_5y_old", "short": "<5y", "long": "Up to 5 Years Old"}, - "_6y": {"id": "up_to_6y_old", "short": "<6y", "long": "Up to 6 Years Old"}, - "_7y": {"id": "up_to_7y_old", "short": "<7y", "long": "Up to 7 Years Old"}, - "_8y": {"id": "up_to_8y_old", "short": "<8y", "long": "Up to 8 Years Old"}, - "_10y": {"id": "up_to_10y_old", "short": "<10y", "long": "Up to 10 Years Old"}, - "_12y": {"id": "up_to_12y_old", "short": "<12y", "long": "Up to 12 Years Old"}, - "_15y": {"id": "up_to_15y_old", "short": "<15y", "long": "Up to 15 Years Old"}, + "_1w": { + "id": "up_to_1w_old", + "short": "<1w", + "long": "Up to 1 Week Old" + }, + "_1m": { + "id": "up_to_1m_old", + "short": "<1m", + "long": "Up to 1 Month Old" + }, + "_2m": { + "id": "up_to_2m_old", + "short": "<2m", + "long": "Up to 2 Months Old" + }, + "_3m": { + "id": "up_to_3m_old", + "short": "<3m", + "long": "Up to 3 Months Old" + }, + "_4m": { + "id": "up_to_4m_old", + "short": "<4m", + "long": "Up to 4 Months Old" + }, + "_5m": { + "id": "up_to_5m_old", + "short": "<5m", + "long": "Up to 5 Months Old" + }, + "_6m": { + "id": "up_to_6m_old", + "short": "<6m", + "long": "Up to 6 Months Old" + }, + "_1y": { + "id": "up_to_1y_old", + "short": "<1y", + "long": "Up to 1 Year Old" + }, + "_2y": { + "id": "up_to_2y_old", + "short": "<2y", + "long": "Up to 2 Years Old" + }, + "_3y": { + "id": "up_to_3y_old", + "short": "<3y", + "long": "Up to 3 Years Old" + }, + "_4y": { + "id": "up_to_4y_old", + "short": "<4y", + "long": "Up to 4 Years Old" + }, + "_5y": { + "id": "up_to_5y_old", + "short": "<5y", + "long": "Up to 5 Years Old" + }, + "_6y": { + "id": "up_to_6y_old", + "short": "<6y", + "long": "Up to 6 Years Old" + }, + "_7y": { + "id": "up_to_7y_old", + "short": "<7y", + "long": "Up to 7 Years Old" + }, + "_8y": { + "id": "up_to_8y_old", + "short": "<8y", + "long": "Up to 8 Years Old" + }, + "_10y": { + "id": "up_to_10y_old", + "short": "<10y", + "long": "Up to 10 Years Old" + }, + "_12y": { + "id": "up_to_12y_old", + "short": "<12y", + "long": "Up to 12 Years Old" + }, + "_15y": { + "id": "up_to_15y_old", + "short": "<15y", + "long": "Up to 15 Years Old" + } } MIN_AGE_NAMES = { - "_1d": {"id": "at_least_1d_old", "short": "1d+", "long": "At Least 1 Day Old"}, - "_1w": {"id": "at_least_1w_old", "short": "1w+", "long": "At Least 1 Week Old"}, - "_1m": { - "id": "at_least_1m_old", - "short": "1m+", - "long": "At Least 1 Month Old", - }, - "_2m": { - "id": "at_least_2m_old", - "short": "2m+", - "long": "At Least 2 Months Old", - }, - "_3m": { - "id": "at_least_3m_old", - "short": "3m+", - "long": "At Least 3 Months Old", - }, - "_4m": { - "id": "at_least_4m_old", - "short": "4m+", - "long": "At Least 4 Months Old", - }, - "_5m": { - "id": "at_least_5m_old", - "short": "5m+", - "long": "At Least 5 Months Old", - }, - "_6m": { - "id": "at_least_6m_old", - "short": "6m+", - "long": "At Least 6 Months Old", - }, - "_1y": {"id": "at_least_1y_old", "short": "1y+", "long": "At Least 1 Year Old"}, - "_2y": { - "id": "at_least_2y_old", - "short": "2y+", - "long": "At Least 2 Years Old", - }, - "_3y": { - "id": "at_least_3y_old", - "short": "3y+", - "long": "At Least 3 Years Old", - }, - "_4y": { - "id": "at_least_4y_old", - "short": "4y+", - "long": "At Least 4 Years Old", - }, - "_5y": { - "id": "at_least_5y_old", - "short": "5y+", - "long": "At Least 5 Years Old", - }, - "_6y": { - "id": "at_least_6y_old", - "short": "6y+", - "long": "At Least 6 Years Old", - }, - "_7y": { - "id": "at_least_7y_old", - "short": "7y+", - "long": "At Least 7 Years Old", - }, - "_8y": { - "id": "at_least_8y_old", - "short": "8y+", - "long": "At Least 8 Years Old", - }, - "_10y": { - "id": "at_least_10y_old", - "short": "10y+", - "long": "At Least 10 Years Old", - }, - "_12y": { - "id": "at_least_12y_old", - "short": "12y+", - "long": "At Least 12 Years Old", - }, + "_1d": { + "id": "at_least_1d_old", + "short": "1d+", + "long": "At Least 1 Day Old" + }, + "_1w": { + "id": "at_least_1w_old", + "short": "1w+", + "long": "At Least 1 Week Old" + }, + "_1m": { + "id": "at_least_1m_old", + "short": "1m+", + "long": "At Least 1 Month Old" + }, + "_2m": { + "id": "at_least_2m_old", + "short": "2m+", + "long": "At Least 2 Months Old" + }, + "_3m": { + "id": "at_least_3m_old", + "short": "3m+", + "long": "At Least 3 Months Old" + }, + "_4m": { + "id": "at_least_4m_old", + "short": "4m+", + "long": "At Least 4 Months Old" + }, + "_5m": { + "id": "at_least_5m_old", + "short": "5m+", + "long": "At Least 5 Months Old" + }, + "_6m": { + "id": "at_least_6m_old", + "short": "6m+", + "long": "At Least 6 Months Old" + }, + "_1y": { + "id": "at_least_1y_old", + "short": "1y+", + "long": "At Least 1 Year Old" + }, + "_2y": { + "id": "at_least_2y_old", + "short": "2y+", + "long": "At Least 2 Years Old" + }, + "_3y": { + "id": "at_least_3y_old", + "short": "3y+", + "long": "At Least 3 Years Old" + }, + "_4y": { + "id": "at_least_4y_old", + "short": "4y+", + "long": "At Least 4 Years Old" + }, + "_5y": { + "id": "at_least_5y_old", + "short": "5y+", + "long": "At Least 5 Years Old" + }, + "_6y": { + "id": "at_least_6y_old", + "short": "6y+", + "long": "At Least 6 Years Old" + }, + "_7y": { + "id": "at_least_7y_old", + "short": "7y+", + "long": "At Least 7 Years Old" + }, + "_8y": { + "id": "at_least_8y_old", + "short": "8y+", + "long": "At Least 8 Years Old" + }, + "_10y": { + "id": "at_least_10y_old", + "short": "10y+", + "long": "At Least 10 Years Old" + }, + "_12y": { + "id": "at_least_12y_old", + "short": "12y+", + "long": "At Least 12 Years Old" + } } AMOUNT_RANGE_NAMES = { - "_0sats": {"id": "with_0sats", "short": "0 sats", "long": "0 Sats"}, - "_1sat_to_10sats": { - "id": "above_1sat_under_10sats", - "short": "1-10 sats", - "long": "1 to 10 Sats", - }, - "_10sats_to_100sats": { - "id": "above_10sats_under_100sats", - "short": "10-100 sats", - "long": "10 to 100 Sats", - }, - "_100sats_to_1k_sats": { - "id": "above_100sats_under_1k_sats", - "short": "100-1k sats", - "long": "100 to 1K Sats", - }, - "_1k_sats_to_10k_sats": { - "id": "above_1k_sats_under_10k_sats", - "short": "1k-10k sats", - "long": "1K to 10K Sats", - }, - "_10k_sats_to_100k_sats": { - "id": "above_10k_sats_under_100k_sats", - "short": "10k-100k sats", - "long": "10K to 100K Sats", - }, - "_100k_sats_to_1m_sats": { - "id": "above_100k_sats_under_1m_sats", - "short": "100k-1M sats", - "long": "100K to 1M Sats", - }, - "_1m_sats_to_10m_sats": { - "id": "above_1m_sats_under_10m_sats", - "short": "1M-10M sats", - "long": "1M to 10M Sats", - }, - "_10m_sats_to_1btc": { - "id": "above_10m_sats_under_1btc", - "short": "0.1-1 BTC", - "long": "0.1 to 1 BTC", - }, - "_1btc_to_10btc": { - "id": "above_1btc_under_10btc", - "short": "1-10 BTC", - "long": "1 to 10 BTC", - }, - "_10btc_to_100btc": { - "id": "above_10btc_under_100btc", - "short": "10-100 BTC", - "long": "10 to 100 BTC", - }, - "_100btc_to_1k_btc": { - "id": "above_100btc_under_1k_btc", - "short": "100-1k BTC", - "long": "100 to 1K BTC", - }, - "_1k_btc_to_10k_btc": { - "id": "above_1k_btc_under_10k_btc", - "short": "1k-10k BTC", - "long": "1K to 10K BTC", - }, - "_10k_btc_to_100k_btc": { - "id": "above_10k_btc_under_100k_btc", - "short": "10k-100k BTC", - "long": "10K to 100K BTC", - }, - "_100k_btc_or_more": { - "id": "above_100k_btc", - "short": "100k+ BTC", - "long": "100K+ BTC", - }, + "_0sats": { + "id": "with_0sats", + "short": "0 sats", + "long": "0 Sats" + }, + "_1sat_to_10sats": { + "id": "above_1sat_under_10sats", + "short": "1-10 sats", + "long": "1 to 10 Sats" + }, + "_10sats_to_100sats": { + "id": "above_10sats_under_100sats", + "short": "10-100 sats", + "long": "10 to 100 Sats" + }, + "_100sats_to_1k_sats": { + "id": "above_100sats_under_1k_sats", + "short": "100-1k sats", + "long": "100 to 1K Sats" + }, + "_1k_sats_to_10k_sats": { + "id": "above_1k_sats_under_10k_sats", + "short": "1k-10k sats", + "long": "1K to 10K Sats" + }, + "_10k_sats_to_100k_sats": { + "id": "above_10k_sats_under_100k_sats", + "short": "10k-100k sats", + "long": "10K to 100K Sats" + }, + "_100k_sats_to_1m_sats": { + "id": "above_100k_sats_under_1m_sats", + "short": "100k-1M sats", + "long": "100K to 1M Sats" + }, + "_1m_sats_to_10m_sats": { + "id": "above_1m_sats_under_10m_sats", + "short": "1M-10M sats", + "long": "1M to 10M Sats" + }, + "_10m_sats_to_1btc": { + "id": "above_10m_sats_under_1btc", + "short": "0.1-1 BTC", + "long": "0.1 to 1 BTC" + }, + "_1btc_to_10btc": { + "id": "above_1btc_under_10btc", + "short": "1-10 BTC", + "long": "1 to 10 BTC" + }, + "_10btc_to_100btc": { + "id": "above_10btc_under_100btc", + "short": "10-100 BTC", + "long": "10 to 100 BTC" + }, + "_100btc_to_1k_btc": { + "id": "above_100btc_under_1k_btc", + "short": "100-1k BTC", + "long": "100 to 1K BTC" + }, + "_1k_btc_to_10k_btc": { + "id": "above_1k_btc_under_10k_btc", + "short": "1k-10k BTC", + "long": "1K to 10K BTC" + }, + "_10k_btc_to_100k_btc": { + "id": "above_10k_btc_under_100k_btc", + "short": "10k-100k BTC", + "long": "10K to 100K BTC" + }, + "_100k_btc_or_more": { + "id": "above_100k_btc", + "short": "100k+ BTC", + "long": "100K+ BTC" + } } GE_AMOUNT_NAMES = { - "_1sat": {"id": "above_1sat", "short": "1+ sats", "long": "Above 1 Sat"}, - "_10sats": {"id": "above_10sats", "short": "10+ sats", "long": "Above 10 Sats"}, - "_100sats": { - "id": "above_100sats", - "short": "100+ sats", - "long": "Above 100 Sats", - }, - "_1k_sats": { - "id": "above_1k_sats", - "short": "1k+ sats", - "long": "Above 1K Sats", - }, - "_10k_sats": { - "id": "above_10k_sats", - "short": "10k+ sats", - "long": "Above 10K Sats", - }, - "_100k_sats": { - "id": "above_100k_sats", - "short": "100k+ sats", - "long": "Above 100K Sats", - }, - "_1m_sats": { - "id": "above_1m_sats", - "short": "1M+ sats", - "long": "Above 1M Sats", - }, - "_10m_sats": { - "id": "above_10m_sats", - "short": "0.1+ BTC", - "long": "Above 0.1 BTC", - }, - "_1btc": {"id": "above_1btc", "short": "1+ BTC", "long": "Above 1 BTC"}, - "_10btc": {"id": "above_10btc", "short": "10+ BTC", "long": "Above 10 BTC"}, - "_100btc": {"id": "above_100btc", "short": "100+ BTC", "long": "Above 100 BTC"}, - "_1k_btc": {"id": "above_1k_btc", "short": "1k+ BTC", "long": "Above 1K BTC"}, - "_10k_btc": { - "id": "above_10k_btc", - "short": "10k+ BTC", - "long": "Above 10K BTC", - }, + "_1sat": { + "id": "above_1sat", + "short": "1+ sats", + "long": "Above 1 Sat" + }, + "_10sats": { + "id": "above_10sats", + "short": "10+ sats", + "long": "Above 10 Sats" + }, + "_100sats": { + "id": "above_100sats", + "short": "100+ sats", + "long": "Above 100 Sats" + }, + "_1k_sats": { + "id": "above_1k_sats", + "short": "1k+ sats", + "long": "Above 1K Sats" + }, + "_10k_sats": { + "id": "above_10k_sats", + "short": "10k+ sats", + "long": "Above 10K Sats" + }, + "_100k_sats": { + "id": "above_100k_sats", + "short": "100k+ sats", + "long": "Above 100K Sats" + }, + "_1m_sats": { + "id": "above_1m_sats", + "short": "1M+ sats", + "long": "Above 1M Sats" + }, + "_10m_sats": { + "id": "above_10m_sats", + "short": "0.1+ BTC", + "long": "Above 0.1 BTC" + }, + "_1btc": { + "id": "above_1btc", + "short": "1+ BTC", + "long": "Above 1 BTC" + }, + "_10btc": { + "id": "above_10btc", + "short": "10+ BTC", + "long": "Above 10 BTC" + }, + "_100btc": { + "id": "above_100btc", + "short": "100+ BTC", + "long": "Above 100 BTC" + }, + "_1k_btc": { + "id": "above_1k_btc", + "short": "1k+ BTC", + "long": "Above 1K BTC" + }, + "_10k_btc": { + "id": "above_10k_btc", + "short": "10k+ BTC", + "long": "Above 10K BTC" + } } LT_AMOUNT_NAMES = { - "_10sats": {"id": "under_10sats", "short": "<10 sats", "long": "Under 10 Sats"}, - "_100sats": { - "id": "under_100sats", - "short": "<100 sats", - "long": "Under 100 Sats", - }, - "_1k_sats": { - "id": "under_1k_sats", - "short": "<1k sats", - "long": "Under 1K Sats", - }, - "_10k_sats": { - "id": "under_10k_sats", - "short": "<10k sats", - "long": "Under 10K Sats", - }, - "_100k_sats": { - "id": "under_100k_sats", - "short": "<100k sats", - "long": "Under 100K Sats", - }, - "_1m_sats": { - "id": "under_1m_sats", - "short": "<1M sats", - "long": "Under 1M Sats", - }, - "_10m_sats": { - "id": "under_10m_sats", - "short": "<0.1 BTC", - "long": "Under 0.1 BTC", - }, - "_1btc": {"id": "under_1btc", "short": "<1 BTC", "long": "Under 1 BTC"}, - "_10btc": {"id": "under_10btc", "short": "<10 BTC", "long": "Under 10 BTC"}, - "_100btc": {"id": "under_100btc", "short": "<100 BTC", "long": "Under 100 BTC"}, - "_1k_btc": {"id": "under_1k_btc", "short": "<1k BTC", "long": "Under 1K BTC"}, - "_10k_btc": { - "id": "under_10k_btc", - "short": "<10k BTC", - "long": "Under 10K BTC", - }, - "_100k_btc": { - "id": "under_100k_btc", - "short": "<100k BTC", - "long": "Under 100K BTC", - }, + "_10sats": { + "id": "under_10sats", + "short": "<10 sats", + "long": "Under 10 Sats" + }, + "_100sats": { + "id": "under_100sats", + "short": "<100 sats", + "long": "Under 100 Sats" + }, + "_1k_sats": { + "id": "under_1k_sats", + "short": "<1k sats", + "long": "Under 1K Sats" + }, + "_10k_sats": { + "id": "under_10k_sats", + "short": "<10k sats", + "long": "Under 10K Sats" + }, + "_100k_sats": { + "id": "under_100k_sats", + "short": "<100k sats", + "long": "Under 100K Sats" + }, + "_1m_sats": { + "id": "under_1m_sats", + "short": "<1M sats", + "long": "Under 1M Sats" + }, + "_10m_sats": { + "id": "under_10m_sats", + "short": "<0.1 BTC", + "long": "Under 0.1 BTC" + }, + "_1btc": { + "id": "under_1btc", + "short": "<1 BTC", + "long": "Under 1 BTC" + }, + "_10btc": { + "id": "under_10btc", + "short": "<10 BTC", + "long": "Under 10 BTC" + }, + "_100btc": { + "id": "under_100btc", + "short": "<100 BTC", + "long": "Under 100 BTC" + }, + "_1k_btc": { + "id": "under_1k_btc", + "short": "<1k BTC", + "long": "Under 1K BTC" + }, + "_10k_btc": { + "id": "under_10k_btc", + "short": "<10k BTC", + "long": "Under 10K BTC" + }, + "_100k_btc": { + "id": "under_100k_btc", + "short": "<100k BTC", + "long": "Under 100K BTC" + } } - def __init__(self, base_url: str = "http://localhost:3000", timeout: float = 30.0): + def __init__(self, base_url: str = 'http://localhost:3000', timeout: float = 30.0): super().__init__(base_url, timeout) self.metrics = MetricsTree(self) @@ -7510,14 +5598,9 @@ class BrkClient(BrkClientBase): *[Mempool.space docs](https://mempool.space/docs/api/rest#get-address)* Endpoint: `GET /api/address/{address}`""" - return self.get_json(f"/api/address/{address}") + return self.get_json(f'/api/address/{address}') - def get_address_txs( - self, - address: Address, - after_txid: Optional[str] = None, - limit: Optional[float] = None, - ) -> List[Txid]: + def get_address_txs(self, address: Address, after_txid: Optional[str] = None, limit: Optional[float] = None) -> List[Txid]: """Address transaction IDs. Get transaction IDs for an address, newest first. Use after_txid for pagination. @@ -7526,20 +5609,13 @@ class BrkClient(BrkClientBase): Endpoint: `GET /api/address/{address}/txs`""" params = [] - if after_txid is not None: - params.append(f"after_txid={after_txid}") - if limit is not None: - params.append(f"limit={limit}") - query = "&".join(params) - path = f"/api/address/{address}/txs{'?' + query if query else ''}" + if after_txid is not None: params.append(f'after_txid={after_txid}') + if limit is not None: params.append(f'limit={limit}') + query = '&'.join(params) + path = f'/api/address/{address}/txs{"?" + query if query else ""}' return self.get_json(path) - def get_address_confirmed_txs( - self, - address: Address, - after_txid: Optional[str] = None, - limit: Optional[float] = None, - ) -> List[Txid]: + def get_address_confirmed_txs(self, address: Address, after_txid: Optional[str] = None, limit: Optional[float] = None) -> List[Txid]: """Address confirmed transactions. Get confirmed transaction IDs for an address, 25 per page. Use ?after_txid= for pagination. @@ -7548,12 +5624,10 @@ class BrkClient(BrkClientBase): Endpoint: `GET /api/address/{address}/txs/chain`""" params = [] - if after_txid is not None: - params.append(f"after_txid={after_txid}") - if limit is not None: - params.append(f"limit={limit}") - query = "&".join(params) - path = f"/api/address/{address}/txs/chain{'?' + query if query else ''}" + if after_txid is not None: params.append(f'after_txid={after_txid}') + if limit is not None: params.append(f'limit={limit}') + query = '&'.join(params) + path = f'/api/address/{address}/txs/chain{"?" + query if query else ""}' return self.get_json(path) def get_address_mempool_txs(self, address: Address) -> List[Txid]: @@ -7564,7 +5638,7 @@ class BrkClient(BrkClientBase): *[Mempool.space docs](https://mempool.space/docs/api/rest#get-address-transactions-mempool)* Endpoint: `GET /api/address/{address}/txs/mempool`""" - return self.get_json(f"/api/address/{address}/txs/mempool") + return self.get_json(f'/api/address/{address}/txs/mempool') def get_address_utxos(self, address: Address) -> List[Utxo]: """Address UTXOs. @@ -7574,7 +5648,7 @@ class BrkClient(BrkClientBase): *[Mempool.space docs](https://mempool.space/docs/api/rest#get-address-utxo)* Endpoint: `GET /api/address/{address}/utxo`""" - return self.get_json(f"/api/address/{address}/utxo") + return self.get_json(f'/api/address/{address}/utxo') def get_block_by_height(self, height: Height) -> BlockInfo: """Block by height. @@ -7584,7 +5658,7 @@ class BrkClient(BrkClientBase): *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-height)* Endpoint: `GET /api/block-height/{height}`""" - return self.get_json(f"/api/block-height/{height}") + return self.get_json(f'/api/block-height/{height}') def get_block(self, hash: BlockHash) -> BlockInfo: """Block information. @@ -7594,7 +5668,7 @@ class BrkClient(BrkClientBase): *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block)* Endpoint: `GET /api/block/{hash}`""" - return self.get_json(f"/api/block/{hash}") + return self.get_json(f'/api/block/{hash}') def get_block_raw(self, hash: BlockHash) -> List[float]: """Raw block. @@ -7604,7 +5678,7 @@ class BrkClient(BrkClientBase): *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-raw)* Endpoint: `GET /api/block/{hash}/raw`""" - return self.get_json(f"/api/block/{hash}/raw") + return self.get_json(f'/api/block/{hash}/raw') def get_block_status(self, hash: BlockHash) -> BlockStatus: """Block status. @@ -7614,7 +5688,7 @@ class BrkClient(BrkClientBase): *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-status)* Endpoint: `GET /api/block/{hash}/status`""" - return self.get_json(f"/api/block/{hash}/status") + return self.get_json(f'/api/block/{hash}/status') def get_block_txid(self, hash: BlockHash, index: TxIndex) -> Txid: """Transaction ID at index. @@ -7624,7 +5698,7 @@ class BrkClient(BrkClientBase): *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-transaction-id)* Endpoint: `GET /api/block/{hash}/txid/{index}`""" - return self.get_json(f"/api/block/{hash}/txid/{index}") + return self.get_json(f'/api/block/{hash}/txid/{index}') def get_block_txids(self, hash: BlockHash) -> List[Txid]: """Block transaction IDs. @@ -7634,7 +5708,7 @@ class BrkClient(BrkClientBase): *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-transaction-ids)* Endpoint: `GET /api/block/{hash}/txids`""" - return self.get_json(f"/api/block/{hash}/txids") + return self.get_json(f'/api/block/{hash}/txids') def get_block_txs(self, hash: BlockHash, start_index: TxIndex) -> List[Transaction]: """Block transactions (paginated). @@ -7644,7 +5718,7 @@ class BrkClient(BrkClientBase): *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-transactions)* Endpoint: `GET /api/block/{hash}/txs/{start_index}`""" - return self.get_json(f"/api/block/{hash}/txs/{start_index}") + return self.get_json(f'/api/block/{hash}/txs/{start_index}') def get_blocks(self) -> List[BlockInfo]: """Recent blocks. @@ -7654,7 +5728,7 @@ class BrkClient(BrkClientBase): *[Mempool.space docs](https://mempool.space/docs/api/rest#get-blocks)* Endpoint: `GET /api/blocks`""" - return self.get_json("/api/blocks") + return self.get_json('/api/blocks') def get_blocks_from_height(self, height: Height) -> List[BlockInfo]: """Blocks from height. @@ -7664,7 +5738,7 @@ class BrkClient(BrkClientBase): *[Mempool.space docs](https://mempool.space/docs/api/rest#get-blocks)* Endpoint: `GET /api/blocks/{height}`""" - return self.get_json(f"/api/blocks/{height}") + return self.get_json(f'/api/blocks/{height}') def get_mempool(self) -> MempoolInfo: """Mempool statistics. @@ -7674,7 +5748,7 @@ class BrkClient(BrkClientBase): *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mempool)* Endpoint: `GET /api/mempool/info`""" - return self.get_json("/api/mempool/info") + return self.get_json('/api/mempool/info') def get_mempool_txids(self) -> List[Txid]: """Mempool transaction IDs. @@ -7684,7 +5758,7 @@ class BrkClient(BrkClientBase): *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mempool-transaction-ids)* Endpoint: `GET /api/mempool/txids`""" - return self.get_json("/api/mempool/txids") + return self.get_json('/api/mempool/txids') def get_metric_info(self, metric: Metric) -> List[Index]: """Get supported indexes for a metric. @@ -7692,34 +5766,22 @@ class BrkClient(BrkClientBase): Returns the list of indexes supported by the specified metric. For example, `realized_price` might be available on dateindex, weekindex, and monthindex. Endpoint: `GET /api/metric/{metric}`""" - return self.get_json(f"/api/metric/{metric}") + return self.get_json(f'/api/metric/{metric}') - def get_metric( - self, - metric: Metric, - index: Index, - start: Optional[float] = None, - end: Optional[float] = None, - limit: Optional[str] = None, - format: Optional[Format] = None, - ) -> Union[AnyMetricData, str]: + def get_metric(self, metric: Metric, index: Index, start: Optional[float] = None, end: Optional[float] = None, limit: Optional[str] = None, format: Optional[Format] = None) -> Union[AnyMetricData, str]: """Get metric data. Fetch data for a specific metric at the given index. Use query parameters to filter by date range and format (json/csv). Endpoint: `GET /api/metric/{metric}/{index}`""" params = [] - if start is not None: - params.append(f"start={start}") - if end is not None: - params.append(f"end={end}") - if limit is not None: - params.append(f"limit={limit}") - if format is not None: - params.append(f"format={format}") - query = "&".join(params) - path = f"/api/metric/{metric}/{index}{'?' + query if query else ''}" - if format == "csv": + if start is not None: params.append(f'start={start}') + if end is not None: params.append(f'end={end}') + if limit is not None: params.append(f'limit={limit}') + if format is not None: params.append(f'format={format}') + query = '&'.join(params) + path = f'/api/metric/{metric}/{index}{"?" + query if query else ""}' + if format == 'csv': return self.get_text(path) return self.get_json(path) @@ -7729,36 +5791,24 @@ class BrkClient(BrkClientBase): Returns the complete hierarchical catalog of available metrics organized as a tree structure. Metrics are grouped by categories and subcategories. Endpoint: `GET /api/metrics`""" - return self.get_json("/api/metrics") + return self.get_json('/api/metrics') - def get_metrics( - self, - metrics: Metrics, - index: Index, - start: Optional[float] = None, - end: Optional[float] = None, - limit: Optional[str] = None, - format: Optional[Format] = None, - ) -> Union[List[AnyMetricData], str]: + def get_metrics(self, metrics: Metrics, index: Index, start: Optional[float] = None, end: Optional[float] = None, limit: Optional[str] = None, format: Optional[Format] = None) -> Union[List[AnyMetricData], str]: """Bulk metric data. Fetch multiple metrics in a single request. Supports filtering by index and date range. Returns an array of MetricData objects. For a single metric, use `get_metric` instead. Endpoint: `GET /api/metrics/bulk`""" params = [] - params.append(f"metrics={metrics}") - params.append(f"index={index}") - if start is not None: - params.append(f"start={start}") - if end is not None: - params.append(f"end={end}") - if limit is not None: - params.append(f"limit={limit}") - if format is not None: - params.append(f"format={format}") - query = "&".join(params) - path = f"/api/metrics/bulk{'?' + query if query else ''}" - if format == "csv": + params.append(f'metrics={metrics}') + params.append(f'index={index}') + if start is not None: params.append(f'start={start}') + if end is not None: params.append(f'end={end}') + if limit is not None: params.append(f'limit={limit}') + if format is not None: params.append(f'format={format}') + query = '&'.join(params) + path = f'/api/metrics/bulk{"?" + query if query else ""}' + if format == 'csv': return self.get_text(path) return self.get_json(path) @@ -7768,7 +5818,7 @@ class BrkClient(BrkClientBase): Returns the number of metrics available per index type. Endpoint: `GET /api/metrics/count`""" - return self.get_json("/api/metrics/count") + return self.get_json('/api/metrics/count') def get_indexes(self) -> List[IndexInfo]: """List available indexes. @@ -7776,7 +5826,7 @@ class BrkClient(BrkClientBase): Returns all available indexes with their accepted query aliases. Use any alias when querying metrics. Endpoint: `GET /api/metrics/indexes`""" - return self.get_json("/api/metrics/indexes") + return self.get_json('/api/metrics/indexes') def list_metrics(self, page: Optional[float] = None) -> PaginatedMetrics: """Metrics list. @@ -7785,25 +5835,21 @@ class BrkClient(BrkClientBase): Endpoint: `GET /api/metrics/list`""" params = [] - if page is not None: - params.append(f"page={page}") - query = "&".join(params) - path = f"/api/metrics/list{'?' + query if query else ''}" + if page is not None: params.append(f'page={page}') + query = '&'.join(params) + path = f'/api/metrics/list{"?" + query if query else ""}' return self.get_json(path) - def search_metrics( - self, metric: Metric, limit: Optional[Limit] = None - ) -> List[Metric]: + def search_metrics(self, metric: Metric, limit: Optional[Limit] = None) -> List[Metric]: """Search metrics. Fuzzy search for metrics by name. Supports partial matches and typos. Endpoint: `GET /api/metrics/search/{metric}`""" params = [] - if limit is not None: - params.append(f"limit={limit}") - query = "&".join(params) - path = f"/api/metrics/search/{metric}{'?' + query if query else ''}" + if limit is not None: params.append(f'limit={limit}') + query = '&'.join(params) + path = f'/api/metrics/search/{metric}{"?" + query if query else ""}' return self.get_json(path) def get_disk_usage(self) -> DiskUsage: @@ -7812,7 +5858,7 @@ class BrkClient(BrkClientBase): Returns the disk space used by BRK and Bitcoin data. Endpoint: `GET /api/server/disk`""" - return self.get_json("/api/server/disk") + return self.get_json('/api/server/disk') def get_sync_status(self) -> SyncStatus: """Sync status. @@ -7820,7 +5866,7 @@ class BrkClient(BrkClientBase): Returns the sync status of the indexer, including indexed height, tip height, blocks behind, and last indexed timestamp. Endpoint: `GET /api/server/sync`""" - return self.get_json("/api/server/sync") + return self.get_json('/api/server/sync') def get_tx(self, txid: Txid) -> Transaction: """Transaction information. @@ -7830,7 +5876,7 @@ class BrkClient(BrkClientBase): *[Mempool.space docs](https://mempool.space/docs/api/rest#get-transaction)* Endpoint: `GET /api/tx/{txid}`""" - return self.get_json(f"/api/tx/{txid}") + return self.get_json(f'/api/tx/{txid}') def get_tx_hex(self, txid: Txid) -> Hex: """Transaction hex. @@ -7840,7 +5886,7 @@ class BrkClient(BrkClientBase): *[Mempool.space docs](https://mempool.space/docs/api/rest#get-transaction-hex)* Endpoint: `GET /api/tx/{txid}/hex`""" - return self.get_json(f"/api/tx/{txid}/hex") + return self.get_json(f'/api/tx/{txid}/hex') def get_tx_outspend(self, txid: Txid, vout: Vout) -> TxOutspend: """Output spend status. @@ -7850,7 +5896,7 @@ class BrkClient(BrkClientBase): *[Mempool.space docs](https://mempool.space/docs/api/rest#get-transaction-outspend)* Endpoint: `GET /api/tx/{txid}/outspend/{vout}`""" - return self.get_json(f"/api/tx/{txid}/outspend/{vout}") + return self.get_json(f'/api/tx/{txid}/outspend/{vout}') def get_tx_outspends(self, txid: Txid) -> List[TxOutspend]: """All output spend statuses. @@ -7860,7 +5906,7 @@ class BrkClient(BrkClientBase): *[Mempool.space docs](https://mempool.space/docs/api/rest#get-transaction-outspends)* Endpoint: `GET /api/tx/{txid}/outspends`""" - return self.get_json(f"/api/tx/{txid}/outspends") + return self.get_json(f'/api/tx/{txid}/outspends') def get_tx_status(self, txid: Txid) -> TxStatus: """Transaction status. @@ -7870,7 +5916,7 @@ class BrkClient(BrkClientBase): *[Mempool.space docs](https://mempool.space/docs/api/rest#get-transaction-status)* Endpoint: `GET /api/tx/{txid}/status`""" - return self.get_json(f"/api/tx/{txid}/status") + return self.get_json(f'/api/tx/{txid}/status') def get_difficulty_adjustment(self) -> DifficultyAdjustment: """Difficulty adjustment. @@ -7880,7 +5926,7 @@ class BrkClient(BrkClientBase): *[Mempool.space docs](https://mempool.space/docs/api/rest#get-difficulty-adjustment)* Endpoint: `GET /api/v1/difficulty-adjustment`""" - return self.get_json("/api/v1/difficulty-adjustment") + return self.get_json('/api/v1/difficulty-adjustment') def get_mempool_blocks(self) -> List[MempoolBlock]: """Projected mempool blocks. @@ -7890,7 +5936,7 @@ class BrkClient(BrkClientBase): *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mempool-blocks-fees)* Endpoint: `GET /api/v1/fees/mempool-blocks`""" - return self.get_json("/api/v1/fees/mempool-blocks") + return self.get_json('/api/v1/fees/mempool-blocks') def get_recommended_fees(self) -> RecommendedFees: """Recommended fees. @@ -7900,7 +5946,7 @@ class BrkClient(BrkClientBase): *[Mempool.space docs](https://mempool.space/docs/api/rest#get-recommended-fees)* Endpoint: `GET /api/v1/fees/recommended`""" - return self.get_json("/api/v1/fees/recommended") + return self.get_json('/api/v1/fees/recommended') def get_block_fee_rates(self, time_period: TimePeriod) -> Any: """Block fee rates (WIP). @@ -7910,7 +5956,7 @@ class BrkClient(BrkClientBase): *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-feerates)* Endpoint: `GET /api/v1/mining/blocks/fee-rates/{time_period}`""" - return self.get_json(f"/api/v1/mining/blocks/fee-rates/{time_period}") + return self.get_json(f'/api/v1/mining/blocks/fee-rates/{time_period}') def get_block_fees(self, time_period: TimePeriod) -> List[BlockFeesEntry]: """Block fees. @@ -7920,7 +5966,7 @@ class BrkClient(BrkClientBase): *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-fees)* Endpoint: `GET /api/v1/mining/blocks/fees/{time_period}`""" - return self.get_json(f"/api/v1/mining/blocks/fees/{time_period}") + return self.get_json(f'/api/v1/mining/blocks/fees/{time_period}') def get_block_rewards(self, time_period: TimePeriod) -> List[BlockRewardsEntry]: """Block rewards. @@ -7930,7 +5976,7 @@ class BrkClient(BrkClientBase): *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-rewards)* Endpoint: `GET /api/v1/mining/blocks/rewards/{time_period}`""" - return self.get_json(f"/api/v1/mining/blocks/rewards/{time_period}") + return self.get_json(f'/api/v1/mining/blocks/rewards/{time_period}') def get_block_sizes_weights(self, time_period: TimePeriod) -> BlockSizesWeights: """Block sizes and weights. @@ -7940,7 +5986,7 @@ class BrkClient(BrkClientBase): *[Mempool.space docs](https://mempool.space/docs/api/rest#get-sizes-weights)* Endpoint: `GET /api/v1/mining/blocks/sizes-weights/{time_period}`""" - return self.get_json(f"/api/v1/mining/blocks/sizes-weights/{time_period}") + return self.get_json(f'/api/v1/mining/blocks/sizes-weights/{time_period}') def get_block_by_timestamp(self, timestamp: Timestamp) -> BlockTimestamp: """Block by timestamp. @@ -7950,7 +5996,7 @@ class BrkClient(BrkClientBase): *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-timestamp)* Endpoint: `GET /api/v1/mining/blocks/timestamp/{timestamp}`""" - return self.get_json(f"/api/v1/mining/blocks/timestamp/{timestamp}") + return self.get_json(f'/api/v1/mining/blocks/timestamp/{timestamp}') def get_difficulty_adjustments(self) -> List[DifficultyAdjustmentEntry]: """Difficulty adjustments (all time). @@ -7960,11 +6006,9 @@ class BrkClient(BrkClientBase): *[Mempool.space docs](https://mempool.space/docs/api/rest#get-difficulty-adjustments)* Endpoint: `GET /api/v1/mining/difficulty-adjustments`""" - return self.get_json("/api/v1/mining/difficulty-adjustments") + return self.get_json('/api/v1/mining/difficulty-adjustments') - def get_difficulty_adjustments_by_period( - self, time_period: TimePeriod - ) -> List[DifficultyAdjustmentEntry]: + def get_difficulty_adjustments_by_period(self, time_period: TimePeriod) -> List[DifficultyAdjustmentEntry]: """Difficulty adjustments. Get historical difficulty adjustments for a time period. Valid periods: 24h, 3d, 1w, 1m, 3m, 6m, 1y, 2y, 3y. @@ -7972,7 +6016,7 @@ class BrkClient(BrkClientBase): *[Mempool.space docs](https://mempool.space/docs/api/rest#get-difficulty-adjustments)* Endpoint: `GET /api/v1/mining/difficulty-adjustments/{time_period}`""" - return self.get_json(f"/api/v1/mining/difficulty-adjustments/{time_period}") + return self.get_json(f'/api/v1/mining/difficulty-adjustments/{time_period}') def get_hashrate(self) -> HashrateSummary: """Network hashrate (all time). @@ -7982,7 +6026,7 @@ class BrkClient(BrkClientBase): *[Mempool.space docs](https://mempool.space/docs/api/rest#get-hashrate)* Endpoint: `GET /api/v1/mining/hashrate`""" - return self.get_json("/api/v1/mining/hashrate") + return self.get_json('/api/v1/mining/hashrate') def get_hashrate_by_period(self, time_period: TimePeriod) -> HashrateSummary: """Network hashrate. @@ -7992,7 +6036,7 @@ class BrkClient(BrkClientBase): *[Mempool.space docs](https://mempool.space/docs/api/rest#get-hashrate)* Endpoint: `GET /api/v1/mining/hashrate/{time_period}`""" - return self.get_json(f"/api/v1/mining/hashrate/{time_period}") + return self.get_json(f'/api/v1/mining/hashrate/{time_period}') def get_pool(self, slug: PoolSlug) -> PoolDetail: """Mining pool details. @@ -8002,7 +6046,7 @@ class BrkClient(BrkClientBase): *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mining-pool)* Endpoint: `GET /api/v1/mining/pool/{slug}`""" - return self.get_json(f"/api/v1/mining/pool/{slug}") + return self.get_json(f'/api/v1/mining/pool/{slug}') def get_pools(self) -> List[PoolInfo]: """List all mining pools. @@ -8012,7 +6056,7 @@ class BrkClient(BrkClientBase): *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mining-pools)* Endpoint: `GET /api/v1/mining/pools`""" - return self.get_json("/api/v1/mining/pools") + return self.get_json('/api/v1/mining/pools') def get_pool_stats(self, time_period: TimePeriod) -> PoolsSummary: """Mining pool statistics. @@ -8022,7 +6066,7 @@ class BrkClient(BrkClientBase): *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mining-pools)* Endpoint: `GET /api/v1/mining/pools/{time_period}`""" - return self.get_json(f"/api/v1/mining/pools/{time_period}") + return self.get_json(f'/api/v1/mining/pools/{time_period}') def get_reward_stats(self, block_count: float) -> RewardStats: """Mining reward statistics. @@ -8032,7 +6076,7 @@ class BrkClient(BrkClientBase): *[Mempool.space docs](https://mempool.space/docs/api/rest#get-reward-stats)* Endpoint: `GET /api/v1/mining/reward-stats/{block_count}`""" - return self.get_json(f"/api/v1/mining/reward-stats/{block_count}") + return self.get_json(f'/api/v1/mining/reward-stats/{block_count}') def validate_address(self, address: str) -> AddressValidation: """Validate address. @@ -8042,7 +6086,7 @@ class BrkClient(BrkClientBase): *[Mempool.space docs](https://mempool.space/docs/api/rest#get-address-validate)* Endpoint: `GET /api/v1/validate-address/{address}`""" - return self.get_json(f"/api/v1/validate-address/{address}") + return self.get_json(f'/api/v1/validate-address/{address}') def get_health(self) -> Health: """Health check. @@ -8050,7 +6094,7 @@ class BrkClient(BrkClientBase): Returns the health status of the API server, including uptime information. Endpoint: `GET /health`""" - return self.get_json("/health") + return self.get_json('/health') def get_version(self) -> str: """API version. @@ -8058,4 +6102,5 @@ class BrkClient(BrkClientBase): Returns the current version of the API server Endpoint: `GET /version`""" - return self.get_json("/version") + return self.get_json('/version') + diff --git a/packages/brk_client/tests/basic.py b/packages/brk_client/tests/basic.py index 8b3c02b64..4a38aae1c 100644 --- a/packages/brk_client/tests/basic.py +++ b/packages/brk_client/tests/basic.py @@ -36,29 +36,30 @@ def test_fetch_csv_metric(): def test_fetch_typed_metric(): client = BrkClient("http://localhost:3110") - a = client.metrics.constants.constant_0.by.dateindex().from_(-10).json() + # Using new idiomatic API: tail(10).fetch() or [-10:].fetch() + a = client.metrics.constants.constant_0.by.dateindex().tail(10).fetch() print(a) - b = client.metrics.outputs.count.utxo_count.by.height().from_(-10).json() + b = client.metrics.outputs.count.utxo_count.by.height().tail(10).fetch() print(b) - c = client.metrics.price.usd.split.close.by.dateindex().from_(-10).json() + c = client.metrics.price.usd.split.close.by.dateindex().tail(10).fetch() print(c) d = ( client.metrics.market.dca.period_lump_sum_stack._10y.dollars.by.dateindex() - .from_(-10) - .json() + .tail(10) + .fetch() ) print(d) e = ( client.metrics.market.dca.class_average_price._2017.by.dateindex() - .from_(-10) - .json() + .tail(10) + .fetch() ) print(e) f = ( client.metrics.distribution.address_cohorts.amount_range._10k_sats_to_100k_sats.activity.sent.dollars.cumulative.by.dateindex() - .from_(-10) - .json() + .tail(10) + .fetch() ) print(f) - g = client.metrics.price.usd.ohlc.by.dateindex().from_(-10).json() + g = client.metrics.price.usd.ohlc.by.dateindex().tail(10).fetch() print(g) diff --git a/packages/brk_client/tests/tree.py b/packages/brk_client/tests/tree.py index 1f01fcf49..36db039cb 100644 --- a/packages/brk_client/tests/tree.py +++ b/packages/brk_client/tests/tree.py @@ -41,7 +41,7 @@ def test_all_endpoints(): """Test fetching last 3 values from all metric endpoints.""" client = BrkClient("http://localhost:3110") - metrics = get_all_metrics(client.tree) + metrics = get_all_metrics(client.metrics) print(f"\nFound {len(metrics)} metrics") success = 0 @@ -53,7 +53,8 @@ def test_all_endpoints(): try: by = metric.by endpoint = getattr(by, idx_name)() - res = endpoint.range(-3) + # Use the new idiomatic API: tail(3).fetch() or [-3:].fetch() + res = endpoint.tail(3).fetch() count = len(res["data"]) if count != 3: failed += 1 diff --git a/websites/bitview/index.html b/websites/bitview/index.html index 3c8008a21..d37375d0e 100644 --- a/websites/bitview/index.html +++ b/websites/bitview/index.html @@ -1515,148 +1515,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/websites/bitview/scripts/chart/index.js b/websites/bitview/scripts/chart/index.js index a224fa588..2b0b91312 100644 --- a/websites/bitview/scripts/chart/index.js +++ b/websites/bitview/scripts/chart/index.js @@ -19,6 +19,7 @@ import { throttle } from "../utils/timing.js"; import { serdeBool } from "../utils/serde.js"; import { stringToId } from "../utils/format.js"; import { style } from "../utils/elements.js"; +import { resources } from "../resources.js"; /** * @typedef {Object} Valued @@ -70,20 +71,18 @@ const lineWidth = /** @type {any} */ (1.5); * @param {HTMLElement} args.parent * @param {Signals} args.signals * @param {Colors} args.colors - * @param {Resources} args.resources * @param {BrkClient} args.brk * @param {Accessor} args.index * @param {((unknownTimeScaleCallback: VoidFunction) => void)} [args.timeScaleSetCallback] * @param {true} [args.fitContent] * @param {{unit: Unit; blueprints: AnySeriesBlueprint[]}[]} [args.config] */ -function createChartElement({ +export function createChartElement({ parent, signals, colors, id: chartId, index, - resources, brk, timeScaleSetCallback, fitContent, @@ -1076,5 +1075,3 @@ function numberToUSFormat(value, digits, options) { * @typedef {typeof createChartElement} CreateChartElement * @typedef {ReturnType} Chart */ - -export default { createChartElement }; diff --git a/websites/bitview/scripts/entry.js b/websites/bitview/scripts/entry.js index 3372934bb..d771a784e 100644 --- a/websites/bitview/scripts/entry.js +++ b/websites/bitview/scripts/entry.js @@ -6,7 +6,7 @@ * @import { Signal, Signals, Accessor } from "./signals.js"; * * @import * as Brk from "./modules/brk-client/index.js" - * @import { BrkClient} from "./modules/brk-client/index.js" + * @import { BrkClient, Index, Metric, MetricData } from "./modules/brk-client/index.js" * * @import { Resources, MetricResource } from './resources.js' * @@ -28,23 +28,91 @@ // import uFuzzy = require("./modules/leeoniya-ufuzzy/1.0.19/dist/uFuzzy.d.ts"); /** - * @typedef {typeof import("./lazy")["default"]} Modules * @typedef {[number, number, number, number]} OHLCTuple + * + * Brk type aliases + * @typedef {Brk.MetricsTree_Distribution_UtxoCohorts} UtxoCohortTree + * @typedef {Brk.MetricsTree_Distribution_AddressCohorts} AddressCohortTree + * @typedef {Brk.MetricsTree_Distribution_UtxoCohorts_All} AllUtxoPattern + * @typedef {Brk.MetricsTree_Distribution_UtxoCohorts_Term_Short} ShortTermPattern + * @typedef {Brk.MetricsTree_Distribution_UtxoCohorts_Term_Long} LongTermPattern + * @typedef {Brk._10yPattern} MaxAgePattern + * @typedef {Brk._10yTo12yPattern} AgeRangePattern + * @typedef {Brk._0satsPattern2} UtxoAmountPattern + * @typedef {Brk._0satsPattern} AddressAmountPattern + * @typedef {Brk._100btcPattern} BasicUtxoPattern + * @typedef {Brk._0satsPattern2} EpochPattern + * @typedef {Brk.Ratio1ySdPattern} Ratio1ySdPattern + * @typedef {Brk.Dollars} Dollars + * @typedef {Brk.Price111dSmaPattern} EmaRatioPattern + * @typedef {Brk.CoinbasePattern} CoinbasePattern + * @typedef {Brk.ActivePriceRatioPattern} ActivePriceRatioPattern + * @typedef {Brk.UnclaimedRewardsPattern} ValuePattern + * @typedef {Brk.AnyMetricPattern} AnyMetricPattern + * @typedef {Brk.AnyMetricEndpointBuilder} AnyMetricEndpoint + * @typedef {Brk.AnyMetricData} AnyMetricData + * @typedef {Brk.AddrCountPattern} AddrCountPattern + * @typedef {Brk.MetricsTree_Blocks_Interval} IntervalPattern + * @typedef {Brk.MetricsTree_Supply_Circulating} SupplyPattern + * @typedef {Brk.RelativePattern} GlobalRelativePattern + * @typedef {Brk.RelativePattern2} OwnRelativePattern + * @typedef {Brk.RelativePattern5} FullRelativePattern + * @typedef {Brk.MetricsTree_Distribution_UtxoCohorts_All_Relative} AllRelativePattern + */ + +/** + * @template T + * @typedef {Brk.BlockCountPattern} BlockCountPattern + */ +/** + * @template T + * @typedef {Brk.FullnessPattern} FullnessPattern + */ +/** + * @template T + * @typedef {Brk.FeeRatePattern} FeeRatePattern + */ +/** + * @template T + * @typedef {Brk.MetricEndpointBuilder} MetricEndpoint + */ +/** + * @template T + * @typedef {Brk.DollarsPattern} SizePattern + */ +/** + * @template T + * @typedef {Brk.CountPattern2} CountStatsPattern + */ +/** + * @typedef {Brk.MetricsTree_Blocks_Size} BlockSizePattern + */ +/** + * Stats pattern union - accepts both CountStatsPattern and BlockSizePattern + * @typedef {CountStatsPattern | BlockSizePattern} AnyStatsPattern + */ + +/** * * @typedef {InstanceType["INDEXES"]} Indexes * @typedef {Indexes[number]} IndexName * @typedef {InstanceType["POOL_ID_TO_POOL_NAME"]} PoolIdToPoolName * @typedef {keyof PoolIdToPoolName} PoolId * + * Tree branch types + * @typedef {Brk.MetricsTree_Market} Market + * @typedef {Brk.MetricsTree_Market_MovingAverage} MarketMovingAverage + * @typedef {Brk.MetricsTree_Market_Dca} MarketDca + * * Pattern unions by cohort type * @typedef {AllUtxoPattern | AgeRangePattern | UtxoAmountPattern} UtxoCohortPattern * @typedef {AddressAmountPattern} AddressCohortPattern * @typedef {UtxoCohortPattern | AddressCohortPattern} CohortPattern * * Relative pattern capability types - * @typedef {RelativePattern | RelativePattern5} RelativeWithMarketCap - * @typedef {RelativePattern2 | RelativePattern5} RelativeWithOwnMarketCap - * @typedef {RelativePattern2 | RelativePattern5 | AllRelativePattern} RelativeWithOwnPnl + * @typedef {GlobalRelativePattern | FullRelativePattern} RelativeWithMarketCap + * @typedef {OwnRelativePattern | FullRelativePattern} RelativeWithOwnMarketCap + * @typedef {OwnRelativePattern | FullRelativePattern | AllRelativePattern} RelativeWithOwnPnl * * Capability-based pattern groupings (patterns that have specific properties) * @typedef {AllUtxoPattern | AgeRangePattern | UtxoAmountPattern} PatternWithRealizedPrice diff --git a/websites/bitview/scripts/lazy.js b/websites/bitview/scripts/lazy.js deleted file mode 100644 index d971e1fcc..000000000 --- a/websites/bitview/scripts/lazy.js +++ /dev/null @@ -1,53 +0,0 @@ -const imports = { - async signals() { - return import("./signals.js").then((d) => d.default); - }, - async leanQr() { - return import("./modules/lean-qr/2.6.1/index.mjs").then((d) => d); - }, - async ufuzzy() { - return import("./modules/leeoniya-ufuzzy/1.0.19/dist/uFuzzy.mjs").then( - ({ default: d }) => d, - ); - }, - async brkClient() { - return import("./modules/brk-client/index.js").then((d) => d); - }, - async resources() { - return import("./resources.js").then((d) => d); - }, - - async chart() { - return window.document.fonts.ready.then(() => - import("./chart/index.js").then((d) => d.default), - ); - }, - async options() { - return import("./options/full.js").then((d) => d); - }, -}; - -/** - * @template {keyof typeof imports} K - * @param {K} key - */ -function lazyImport(key) { - /** @type {any | null} */ - let packagePromise = null; - - return function () { - if (!packagePromise) { - packagePromise = imports[key](); - } - return /** @type {ReturnType} */ (packagePromise); - }; -} - -export default /** @type {{ [K in keyof typeof imports]: () => ReturnType }} */ ( - Object.fromEntries( - Object.keys(imports).map((key) => [ - key, - lazyImport(/** @type {keyof typeof imports} */ (key)), - ]), - ) -); diff --git a/websites/bitview/scripts/main.js b/websites/bitview/scripts/main.js index f985e4a9a..1b6030e7d 100644 --- a/websites/bitview/scripts/main.js +++ b/websites/bitview/scripts/main.js @@ -1,8 +1,16 @@ import { createColors } from "./utils/colors.js"; -import { createWebSockets } from "./utils/ws.js"; +import { webSockets } from "./utils/ws.js"; import * as formatters from "./utils/format.js"; -import modules from "./lazy.js"; import { onFirstIntersection, getElementById, isHidden } from "./utils/dom.js"; +import signals from "./signals.js"; +import { BrkClient } from "./modules/brk-client/index.js"; +import { initOptions } from "./options/full.js"; +import ufuzzy from "./modules/leeoniya-ufuzzy/1.0.19/dist/uFuzzy.mjs"; +import * as leanQr from "./modules/lean-qr/2.6.1/index.mjs"; +import { init as initExplorer } from "./panes/explorer.js"; +import { init as initChart } from "./panes/chart/index.js"; +import { init as initTable } from "./panes/table.js"; +import { init as initSimulation } from "./panes/simulation.js"; import { next } from "./utils/timing.js"; import { replaceHistory } from "./utils/url.js"; import { removeStored, writeToStorage } from "./utils/storage.js"; @@ -106,600 +114,536 @@ function initFrameSelectors() { } initFrameSelectors(); -Promise.all([ - modules.signals(), - modules.brkClient(), - modules.resources(), - modules.options(), -]).then(([signals, { BrkClient }, { createResources }, { initOptions }]) => - signals.createRoot(() => { - const brk = new BrkClient("/"); - const resources = createResources(signals); - const owner = signals.getOwner(); +signals.createRoot(() => { + const brk = new BrkClient("/"); + const owner = signals.getOwner(); - console.log(`VERSION = ${brk.VERSION}`); + console.log(`VERSION = ${brk.VERSION}`); - function initDark() { - const preferredColorSchemeMatchMedia = window.matchMedia( - "(prefers-color-scheme: dark)", - ); - const dark = signals.createSignal(preferredColorSchemeMatchMedia.matches); - preferredColorSchemeMatchMedia.addEventListener( - "change", - ({ matches }) => { - dark.set(matches); - }, - ); - return dark; - } - const dark = initDark(); - - const qrcode = signals.createSignal(/** @type {string | null} */ (null)); - - // function createLastHeightResource() { - // const lastHeight = signals.createSignal(0); - // function fetchLastHeight() { - // utils.api.fetchLast( - // (h) => { - // lastHeight.set(h); - // }, - // /** @satisfies {Height} */ (5), - // "height", - // ); - // } - // fetchLastHeight(); - // setInterval(fetchLastHeight, 10_000); - // return lastHeight; - // } - // const lastHeight = createLastHeightResource(); - - const webSockets = createWebSockets(signals); - - const colors = createColors(dark); - - const options = initOptions({ - colors, - signals, - brk, - qrcode, + function initDark() { + const preferredColorSchemeMatchMedia = window.matchMedia( + "(prefers-color-scheme: dark)", + ); + const dark = signals.createSignal(preferredColorSchemeMatchMedia.matches); + preferredColorSchemeMatchMedia.addEventListener("change", ({ matches }) => { + dark.set(matches); }); + return dark; + } + const dark = initDark(); - window.addEventListener("popstate", (_event) => { - const path = window.document.location.pathname - .split("/") - .filter((v) => v); - let folder = options.tree; + const qrcode = signals.createSignal(/** @type {string | null} */ (null)); - while (path.length) { - const id = path.shift(); - const res = folder.find((v) => id === formatters.stringToId(v.name)); - if (!res) throw "Option not found"; - if (path.length >= 1) { - if (!("tree" in res)) { - throw "Unreachable"; - } - folder = res.tree; - } else { - if ("tree" in res) { - throw "Unreachable"; - } - options.selected.set(res); + signals.createEffect(webSockets.kraken1dCandle.latest, (latest) => { + if (latest) { + console.log("close:", latest.close); + window.document.title = `${latest.close.toLocaleString("en-us")} | ${window.location.host}`; + } + }); + + // function createLastHeightResource() { + // const lastHeight = signals.createSignal(0); + // function fetchLastHeight() { + // utils.api.fetchLast( + // (h) => { + // lastHeight.set(h); + // }, + // /** @satisfies {Height} */ (5), + // "height", + // ); + // } + // fetchLastHeight(); + // setInterval(fetchLastHeight, 10_000); + // return lastHeight; + // } + // const lastHeight = createLastHeightResource(); + + const colors = createColors(dark); + + const options = initOptions({ + colors, + signals, + brk, + qrcode, + }); + + window.addEventListener("popstate", (_event) => { + const path = window.document.location.pathname.split("/").filter((v) => v); + let folder = options.tree; + + while (path.length) { + const id = path.shift(); + const res = folder.find((v) => id === formatters.stringToId(v.name)); + if (!res) throw "Option not found"; + if (path.length >= 1) { + if (!("tree" in res)) { + throw "Unreachable"; } + folder = res.tree; + } else { + if ("tree" in res) { + throw "Unreachable"; + } + options.selected.set(res); } - }); - - function initSelected() { - let firstRun = true; - function initSelectedFrame() { - if (!firstRun) throw Error("Unreachable"); - firstRun = false; - - const owner = signals.getOwner(); - - const chartOption = signals.createSignal( - /** @type {ChartOption | null} */ (null), - ); - const simOption = signals.createSignal( - /** @type {SimulationOption | null} */ (null), - ); - - let previousElement = /** @type {HTMLElement | undefined} */ ( - undefined - ); - let firstTimeLoadingChart = true; - let firstTimeLoadingTable = true; - let firstTimeLoadingSimulation = true; - let firstTimeLoadingExplorer = true; - - signals.createEffect(options.selected, (option) => { - /** @type {HTMLElement} */ - let element; - - switch (option.kind) { - case "explorer": { - element = explorerElement; - - if (firstTimeLoadingExplorer) { - const chartPkg = modules.chart(); - import("./panes/explorer.js").then(({ init }) => - chartPkg.then(({ createChartElement }) => - signals.runWithOwner(owner, () => - init({ - colors, - createChartElement, - option: /** @type {Accessor} */ ( - chartOption - ), - signals, - webSockets, - resources, - brk, - }), - ), - ), - ); - } - firstTimeLoadingExplorer = false; - - break; - } - case "chart": { - element = chartElement; - - chartOption.set(option); - - if (firstTimeLoadingChart) { - const chartPkg = modules.chart(); - import("./panes/chart/index.js").then( - ({ init: initChartsElement }) => - chartPkg.then(({ createChartElement }) => - signals.runWithOwner(owner, () => - initChartsElement({ - colors, - createChartElement, - option: /** @type {Accessor} */ ( - chartOption - ), - signals, - webSockets, - resources, - brk, - }), - ), - ), - ); - } - firstTimeLoadingChart = false; - - break; - } - case "table": { - element = tableElement; - - if (firstTimeLoadingTable) { - import("./panes/table.js").then(({ init }) => - signals.runWithOwner(owner, () => - init({ - signals, - resources, - option, - brk, - }), - ), - ); - } - firstTimeLoadingTable = false; - - break; - } - case "simulation": { - element = simulationElement; - - simOption.set(option); - - if (firstTimeLoadingSimulation) { - const chart = modules.chart(); - import("./panes/simulation.js").then(({ init }) => - chart.then(({ createChartElement }) => - signals.runWithOwner(owner, () => - init({ - colors, - createChartElement, - signals, - resources, - }), - ), - ), - ); - } - firstTimeLoadingSimulation = false; - - break; - } - case "url": { - return; - } - } - - if (element !== previousElement) { - if (previousElement) previousElement.hidden = true; - element.hidden = false; - } - - if (!previousElement) { - replaceHistory({ pathname: option.path }); - } - - previousElement = element; - }); - } - - function createMobileSwitchEffect() { - let firstRun = true; - signals.createEffect(options.selected, () => { - if (!firstRun && !isHidden(asideLabelElement)) { - asideLabelElement.click(); - } - firstRun = false; - }); - } - createMobileSwitchEffect(); - - onFirstIntersection(asideElement, () => - signals.runWithOwner(owner, initSelectedFrame), - ); } - initSelected(); + }); - onFirstIntersection(navElement, async () => { - options.parent.set(navElement); + function initSelected() { + let firstRun = true; + function initSelectedFrame() { + if (!firstRun) throw Error("Unreachable"); + firstRun = false; - const option = options.selected(); - if (!option) throw "Selected should be set by now"; - const path = [...option.path]; + const owner = signals.getOwner(); - /** @type {HTMLUListElement | null} */ - let ul = /** @type {any} */ (null); - async function getFirstChild() { - try { - ul = /** @type {HTMLUListElement} */ (navElement.firstElementChild); - await next(); - if (!ul) { - await getFirstChild(); + const chartOption = signals.createSignal( + /** @type {ChartOption | null} */ (null), + ); + const simOption = signals.createSignal( + /** @type {SimulationOption | null} */ (null), + ); + + let previousElement = /** @type {HTMLElement | undefined} */ (undefined); + let firstTimeLoadingChart = true; + let firstTimeLoadingTable = true; + let firstTimeLoadingSimulation = true; + let firstTimeLoadingExplorer = true; + + signals.createEffect(options.selected, (option) => { + /** @type {HTMLElement} */ + let element; + + switch (option.kind) { + case "explorer": { + element = explorerElement; + + if (firstTimeLoadingExplorer) { + signals.runWithOwner(owner, () => initExplorer()); + } + firstTimeLoadingExplorer = false; + + break; } - } catch (_) { - await next(); + case "chart": { + element = chartElement; + + chartOption.set(option); + + if (firstTimeLoadingChart) { + signals.runWithOwner(owner, () => + initChart({ + colors, + option: /** @type {Accessor} */ (chartOption), + brk, + }), + ); + } + firstTimeLoadingChart = false; + + break; + } + case "table": { + element = tableElement; + + if (firstTimeLoadingTable) { + signals.runWithOwner(owner, () => initTable()); + } + firstTimeLoadingTable = false; + + break; + } + case "simulation": { + element = simulationElement; + + simOption.set(option); + + if (firstTimeLoadingSimulation) { + signals.runWithOwner(owner, () => + initSimulation({ + colors, + }), + ); + } + firstTimeLoadingSimulation = false; + + break; + } + case "url": { + return; + } + } + + if (element !== previousElement) { + if (previousElement) previousElement.hidden = true; + element.hidden = false; + } + + if (!previousElement) { + replaceHistory({ pathname: option.path }); + } + + previousElement = element; + }); + } + + function createMobileSwitchEffect() { + let firstRun = true; + signals.createEffect(options.selected, () => { + if (!firstRun && !isHidden(asideLabelElement)) { + asideLabelElement.click(); + } + firstRun = false; + }); + } + createMobileSwitchEffect(); + + onFirstIntersection(asideElement, () => + signals.runWithOwner(owner, initSelectedFrame), + ); + } + initSelected(); + + onFirstIntersection(navElement, async () => { + options.parent.set(navElement); + + const option = options.selected(); + if (!option) throw "Selected should be set by now"; + const path = [...option.path]; + + /** @type {HTMLUListElement | null} */ + let ul = /** @type {any} */ (null); + async function getFirstChild() { + try { + ul = /** @type {HTMLUListElement} */ (navElement.firstElementChild); + await next(); + if (!ul) { await getFirstChild(); } + } catch (_) { + await next(); + await getFirstChild(); } - await getFirstChild(); - if (!ul) throw Error("Unreachable"); + } + await getFirstChild(); + if (!ul) throw Error("Unreachable"); - while (path.length > 1) { - const name = path.shift(); - if (!name) throw "Unreachable"; - /** @type {HTMLDetailsElement[]} */ - let detailsList = []; - while (!detailsList.length) { - detailsList = Array.from( - ul.querySelectorAll(":scope > li > details"), - ); - if (!detailsList.length) { - await next(); - } - } - const details = detailsList.find((s) => s.dataset.name == name); - if (!details) return; - details.open = true; - ul = null; - while (!ul) { - const uls = /** @type {HTMLUListElement[]} */ ( - Array.from(details.querySelectorAll(":scope > ul")) - ); - if (!uls.length) { - await next(); - } else if (uls.length > 1) { - throw "Shouldn't be possible"; - } else { - ul = /** @type {HTMLUListElement} */ (uls.pop()); - } - } - } - /** @type {HTMLAnchorElement[]} */ - let anchors = []; - while (!anchors.length) { - anchors = Array.from(ul.querySelectorAll(":scope > li > a")); - if (!anchors.length) { + while (path.length > 1) { + const name = path.shift(); + if (!name) throw "Unreachable"; + /** @type {HTMLDetailsElement[]} */ + let detailsList = []; + while (!detailsList.length) { + detailsList = Array.from(ul.querySelectorAll(":scope > li > details")); + if (!detailsList.length) { await next(); } } - anchors - .find( - (a) => a.getAttribute("href") == window.document.location.pathname, - ) - ?.scrollIntoView({ - behavior: "instant", - block: "center", + const details = detailsList.find((s) => s.dataset.name == name); + if (!details) return; + details.open = true; + ul = null; + while (!ul) { + const uls = /** @type {HTMLUListElement[]} */ ( + Array.from(details.querySelectorAll(":scope > ul")) + ); + if (!uls.length) { + await next(); + } else if (uls.length > 1) { + throw "Shouldn't be possible"; + } else { + ul = /** @type {HTMLUListElement} */ (uls.pop()); + } + } + } + /** @type {HTMLAnchorElement[]} */ + let anchors = []; + while (!anchors.length) { + anchors = Array.from(ul.querySelectorAll(":scope > li > a")); + if (!anchors.length) { + await next(); + } + } + anchors + .find((a) => a.getAttribute("href") == window.document.location.pathname) + ?.scrollIntoView({ + behavior: "instant", + block: "center", + }); + }); + + onFirstIntersection(searchElement, () => { + console.log("search: init"); + + const haystack = options.list.map((option) => option.title); + + const RESULTS_PER_PAGE = 100; + + /** + * @param {uFuzzy.SearchResult} searchResult + * @param {number} pageIndex + */ + function computeResultPage(searchResult, pageIndex) { + /** @type {{ option: Option, title: string }[]} */ + let list = []; + + let [indexes, _info, order] = searchResult || [null, null, null]; + + const minIndex = pageIndex * RESULTS_PER_PAGE; + + if (indexes?.length) { + const maxIndex = Math.min( + (order || indexes).length - 1, + minIndex + RESULTS_PER_PAGE - 1, + ); + + list = Array(maxIndex - minIndex + 1); + + for (let i = minIndex; i <= maxIndex; i++) { + let index = indexes[i]; + + const title = haystack[index]; + + list[i % 100] = { + option: options.list[index], + title, + }; + } + } + + return list; + } + + /** @type {uFuzzy.Options} */ + const config = { + intraIns: Infinity, + intraChars: `[a-z\d' ]`, + }; + + const fuzzyMultiInsert = /** @type {uFuzzy} */ ( + ufuzzy({ + intraIns: 1, + }) + ); + const fuzzyMultiInsertFuzzier = /** @type {uFuzzy} */ (ufuzzy(config)); + const fuzzySingleError = /** @type {uFuzzy} */ ( + ufuzzy({ + intraMode: 1, + ...config, + }) + ); + const fuzzySingleErrorFuzzier = /** @type {uFuzzy} */ ( + ufuzzy({ + intraMode: 1, + ...config, + }) + ); + + /** @type {VoidFunction | undefined} */ + let dispose; + + function inputEvent() { + signals.createRoot((_dispose) => { + const needle = /** @type {string} */ (searchInput.value); + + dispose?.(); + + dispose = _dispose; + + searchResultsElement.scrollTo({ + top: 0, }); - }); - onFirstIntersection(searchElement, () => { - console.log("search: init"); + if (!needle) { + searchResultsElement.innerHTML = ""; + return; + } - const haystack = options.list.map((option) => option.title); + const outOfOrder = 5; + const infoThresh = 5_000; - const RESULTS_PER_PAGE = 100; + let result = fuzzyMultiInsert?.search( + haystack, + needle, + undefined, + infoThresh, + ); - modules.ufuzzy().then((ufuzzy) => { - /** - * @param {uFuzzy.SearchResult} searchResult - * @param {number} pageIndex - */ - function computeResultPage(searchResult, pageIndex) { - /** @type {{ option: Option, title: string }[]} */ - let list = []; + if (!result?.[0]?.length || !result?.[1]) { + result = fuzzyMultiInsert?.search( + haystack, + needle, + outOfOrder, + infoThresh, + ); + } - let [indexes, _info, order] = searchResult || [null, null, null]; + if (!result?.[0]?.length || !result?.[1]) { + result = fuzzySingleError?.search( + haystack, + needle, + outOfOrder, + infoThresh, + ); + } - const minIndex = pageIndex * RESULTS_PER_PAGE; + if (!result?.[0]?.length || !result?.[1]) { + result = fuzzySingleErrorFuzzier?.search( + haystack, + needle, + outOfOrder, + infoThresh, + ); + } - if (indexes?.length) { - const maxIndex = Math.min( - (order || indexes).length - 1, - minIndex + RESULTS_PER_PAGE - 1, - ); + if (!result?.[0]?.length || !result?.[1]) { + result = fuzzyMultiInsertFuzzier?.search( + haystack, + needle, + undefined, + infoThresh, + ); + } - list = Array(maxIndex - minIndex + 1); + if (!result?.[0]?.length || !result?.[1]) { + result = fuzzyMultiInsertFuzzier?.search( + haystack, + needle, + outOfOrder, + infoThresh, + ); + } - for (let i = minIndex; i <= maxIndex; i++) { - let index = indexes[i]; + searchResultsElement.innerHTML = ""; - const title = haystack[index]; + const list = computeResultPage(result, 0); - list[i % 100] = { - option: options.list[index], - title, - }; - } + list.forEach(({ option, title }) => { + const li = window.document.createElement("li"); + searchResultsElement.appendChild(li); + + const element = options.createOptionElement({ + option, + name: title, + qrcode, + }); + + if (element) { + li.append(element); } - - return list; - } - - /** @type {uFuzzy.Options} */ - const config = { - intraIns: Infinity, - intraChars: `[a-z\d' ]`, - }; - - const fuzzyMultiInsert = /** @type {uFuzzy} */ ( - ufuzzy({ - intraIns: 1, - }) - ); - const fuzzyMultiInsertFuzzier = /** @type {uFuzzy} */ (ufuzzy(config)); - const fuzzySingleError = /** @type {uFuzzy} */ ( - ufuzzy({ - intraMode: 1, - ...config, - }) - ); - const fuzzySingleErrorFuzzier = /** @type {uFuzzy} */ ( - ufuzzy({ - intraMode: 1, - ...config, - }) - ); - - /** @type {VoidFunction | undefined} */ - let dispose; - - function inputEvent() { - signals.createRoot((_dispose) => { - const needle = /** @type {string} */ (searchInput.value); - - dispose?.(); - - dispose = _dispose; - - searchResultsElement.scrollTo({ - top: 0, - }); - - if (!needle) { - searchResultsElement.innerHTML = ""; - return; - } - - const outOfOrder = 5; - const infoThresh = 5_000; - - let result = fuzzyMultiInsert?.search( - haystack, - needle, - undefined, - infoThresh, - ); - - if (!result?.[0]?.length || !result?.[1]) { - result = fuzzyMultiInsert?.search( - haystack, - needle, - outOfOrder, - infoThresh, - ); - } - - if (!result?.[0]?.length || !result?.[1]) { - result = fuzzySingleError?.search( - haystack, - needle, - outOfOrder, - infoThresh, - ); - } - - if (!result?.[0]?.length || !result?.[1]) { - result = fuzzySingleErrorFuzzier?.search( - haystack, - needle, - outOfOrder, - infoThresh, - ); - } - - if (!result?.[0]?.length || !result?.[1]) { - result = fuzzyMultiInsertFuzzier?.search( - haystack, - needle, - undefined, - infoThresh, - ); - } - - if (!result?.[0]?.length || !result?.[1]) { - result = fuzzyMultiInsertFuzzier?.search( - haystack, - needle, - outOfOrder, - infoThresh, - ); - } - - searchResultsElement.innerHTML = ""; - - const list = computeResultPage(result, 0); - - list.forEach(({ option, title }) => { - const li = window.document.createElement("li"); - searchResultsElement.appendChild(li); - - const element = options.createOptionElement({ - option, - name: title, - qrcode, - }); - - if (element) { - li.append(element); - } - }); - }); - } - - if (searchInput.value) { - inputEvent(); - } - - searchInput.addEventListener("input", inputEvent); + }); }); + } + + if (searchInput.value) { + inputEvent(); + } + + searchInput.addEventListener("input", inputEvent); + }); + + function initShare() { + const shareDiv = getElementById("share-div"); + const shareContentDiv = getElementById("share-content-div"); + + shareDiv.addEventListener("click", () => { + qrcode.set(null); }); - function initShare() { - const shareDiv = getElementById("share-div"); - const shareContentDiv = getElementById("share-content-div"); + shareContentDiv.addEventListener("click", (event) => { + event.stopPropagation(); + event.preventDefault(); + }); - shareDiv.addEventListener("click", () => { - qrcode.set(null); - }); - - shareContentDiv.addEventListener("click", (event) => { - event.stopPropagation(); - event.preventDefault(); - }); - - modules.leanQr().then(({ generate }) => - signals.runWithOwner(owner, () => { - const imgQrcode = /** @type {HTMLImageElement} */ ( - getElementById("share-img") - ); - - const anchor = /** @type {HTMLAnchorElement} */ ( - getElementById("share-anchor") - ); - - signals.createEffect(qrcode, (qrcode) => { - if (!qrcode) { - shareDiv.hidden = true; - return; - } - - const href = qrcode; - anchor.href = href; - anchor.innerText = - (href.startsWith("http") - ? href.split("//").at(-1) - : href.split(":").at(-1)) || ""; - - imgQrcode.src = - generate(/** @type {any} */ (href))?.toDataURL({ - // @ts-ignore - padX: 0, - padY: 0, - }) || ""; - - shareDiv.hidden = false; - }); - }), + signals.runWithOwner(owner, () => { + const imgQrcode = /** @type {HTMLImageElement} */ ( + getElementById("share-img") ); - } - initShare(); - function initDesktopResizeBar() { - const resizeBar = getElementById("resize-bar"); - let resize = false; - let startingWidth = 0; - let startingClientX = 0; + const anchor = /** @type {HTMLAnchorElement} */ ( + getElementById("share-anchor") + ); - const barWidthLocalStorageKey = "bar-width"; - - /** - * @param {number | null} width - */ - function setBarWidth(width) { - // TODO: Check if should be a signal ?? - try { - if (typeof width === "number") { - mainElement.style.width = `${width}px`; - writeToStorage(barWidthLocalStorageKey, String(width)); - } else { - mainElement.style.width = style.getPropertyValue( - "--default-main-width", - ); - removeStored(barWidthLocalStorageKey); - } - } catch (_) {} - } - - /** - * @param {MouseEvent} event - */ - function mouseMoveEvent(event) { - if (resize) { - setBarWidth(startingWidth + (event.clientX - startingClientX)); + signals.createEffect(qrcode, (qrcode) => { + if (!qrcode) { + shareDiv.hidden = true; + return; } - } - resizeBar.addEventListener("mousedown", (event) => { - startingClientX = event.clientX; - startingWidth = mainElement.clientWidth; - resize = true; - window.document.documentElement.dataset.resize = ""; - window.addEventListener("mousemove", mouseMoveEvent); + const href = qrcode; + anchor.href = href; + anchor.innerText = + (href.startsWith("http") + ? href.split("//").at(-1) + : href.split(":").at(-1)) || ""; + + imgQrcode.src = + leanQr.generate(/** @type {any} */ (href))?.toDataURL({ + // @ts-ignore + padX: 0, + padY: 0, + }) || ""; + + shareDiv.hidden = false; }); + }); + } + initShare(); - resizeBar.addEventListener("dblclick", () => { - setBarWidth(null); - }); + function initDesktopResizeBar() { + const resizeBar = getElementById("resize-bar"); + let resize = false; + let startingWidth = 0; + let startingClientX = 0; - const setResizeFalse = () => { - resize = false; - delete window.document.documentElement.dataset.resize; - window.removeEventListener("mousemove", mouseMoveEvent); - }; - window.addEventListener("mouseup", setResizeFalse); - window.addEventListener("mouseleave", setResizeFalse); + const barWidthLocalStorageKey = "bar-width"; + + /** + * @param {number | null} width + */ + function setBarWidth(width) { + // TODO: Check if should be a signal ?? + try { + if (typeof width === "number") { + mainElement.style.width = `${width}px`; + writeToStorage(barWidthLocalStorageKey, String(width)); + } else { + mainElement.style.width = style.getPropertyValue( + "--default-main-width", + ); + removeStored(barWidthLocalStorageKey); + } + } catch (_) {} } - initDesktopResizeBar(); - }), -); + + /** + * @param {MouseEvent} event + */ + function mouseMoveEvent(event) { + if (resize) { + setBarWidth(startingWidth + (event.clientX - startingClientX)); + } + } + + resizeBar.addEventListener("mousedown", (event) => { + startingClientX = event.clientX; + startingWidth = mainElement.clientWidth; + resize = true; + window.document.documentElement.dataset.resize = ""; + window.addEventListener("mousemove", mouseMoveEvent); + }); + + resizeBar.addEventListener("dblclick", () => { + setBarWidth(null); + }); + + const setResizeFalse = () => { + resize = false; + delete window.document.documentElement.dataset.resize; + window.removeEventListener("mousemove", mouseMoveEvent); + }; + window.addEventListener("mouseup", setResizeFalse); + window.addEventListener("mouseleave", setResizeFalse); + } + initDesktopResizeBar(); +}); diff --git a/websites/bitview/scripts/options/series.js b/websites/bitview/scripts/options/series.js index 08ea53ed6..1075ec992 100644 --- a/websites/bitview/scripts/options/series.js +++ b/websites/bitview/scripts/options/series.js @@ -178,7 +178,7 @@ export function fromBitcoin(colors, pattern, title, color) { /** * Create series from a SizePattern ({ sum, cumulative, average, min, max, percentiles }) * @param {Colors} colors - * @param {SizePattern} pattern + * @param {AnyStatsPattern} pattern * @param {string} title * @param {Color} [color] * @returns {AnyFetchedSeriesBlueprint[]} @@ -241,7 +241,7 @@ export function fromBlockSize(colors, pattern, title, color) { /** * Create series from a SizePattern ({ average, sum, cumulative, min, max, percentiles }) * @param {Colors} colors - * @param {SizePattern} pattern + * @param {AnyStatsPattern} pattern * @param {string} title * @param {Unit} unit * @returns {AnyFetchedSeriesBlueprint[]} diff --git a/websites/bitview/scripts/options/types.js b/websites/bitview/scripts/options/types.js index 91247cb43..7b1cf48f8 100644 --- a/websites/bitview/scripts/options/types.js +++ b/websites/bitview/scripts/options/types.js @@ -238,8 +238,8 @@ * @property {HistogramSeriesFn} histogram * @property {(pattern: BlockCountPattern, title: string, color?: Color) => AnyFetchedSeriesBlueprint[]} fromBlockCount * @property {(pattern: FullnessPattern, title: string, color?: Color) => AnyFetchedSeriesBlueprint[]} fromBitcoin - * @property {(pattern: SizePattern, title: string, color?: Color) => AnyFetchedSeriesBlueprint[]} fromBlockSize - * @property {(pattern: SizePattern, title: string, unit: Unit) => AnyFetchedSeriesBlueprint[]} fromSizePattern + * @property {(pattern: AnyStatsPattern, title: string, color?: Color) => AnyFetchedSeriesBlueprint[]} fromBlockSize + * @property {(pattern: AnyStatsPattern, title: string, unit: Unit) => AnyFetchedSeriesBlueprint[]} fromSizePattern * @property {(pattern: FullnessPattern, title: string, unit: Unit) => AnyFetchedSeriesBlueprint[]} fromFullnessPattern * @property {(pattern: FeeRatePattern, title: string, unit: Unit) => AnyFetchedSeriesBlueprint[]} fromFeeRatePattern * @property {(pattern: CoinbasePattern, title: string) => AnyFetchedSeriesBlueprint[]} fromCoinbasePattern diff --git a/websites/bitview/scripts/panes/chart/index.js b/websites/bitview/scripts/panes/chart/index.js index 315838fca..8c775d3b0 100644 --- a/websites/bitview/scripts/panes/chart/index.js +++ b/websites/bitview/scripts/panes/chart/index.js @@ -8,6 +8,9 @@ import { ios, canShare } from "../../utils/env.js"; import { serdeChartableIndex, serdeOptNumber } from "../../utils/serde.js"; import { throttle } from "../../utils/timing.js"; import { Unit } from "../../utils/units.js"; +import signals from "../../signals.js"; +import { createChartElement } from "../../chart/index.js"; +import { webSockets } from "../../utils/ws.js"; const keyPrefix = "chart"; const ONE_BTC_IN_SATS = 100_000_000; @@ -22,20 +25,12 @@ const CANDLE = "candle"; /** * @param {Object} args * @param {Colors} args.colors - * @param {CreateChartElement} args.createChartElement * @param {Accessor} args.option - * @param {Signals} args.signals - * @param {WebSockets} args.webSockets - * @param {Resources} args.resources * @param {BrkClient} args.brk */ export function init({ colors, - createChartElement, option, - signals, - webSockets, - resources, brk, }) { chartElement.append(createShadow("left")); @@ -44,10 +39,7 @@ export function init({ const { headerElement, headingElement } = createHeader(); chartElement.append(headerElement); - const { index, fieldset } = createIndexSelector({ - option, - signals, - }); + const { index, fieldset } = createIndexSelector(option); const TIMERANGE_LS_KEY = signals.createMemo( () => `chart-timerange-${index()}`, @@ -77,7 +69,6 @@ export function init({ signals, colors, id: "charts", - resources, brk, index, timeScaleSetCallback: (unknownTimeScaleCallback) => { @@ -525,11 +516,9 @@ export function init({ } /** - * @param {Object} args - * @param {Accessor} args.option - * @param {Signals} args.signals + * @param {Accessor} option */ -function createIndexSelector({ option, signals }) { +function createIndexSelector(option) { const choices_ = /** @satisfies {ChartableIndexName[]} */ ([ "timestamp", "date", diff --git a/websites/bitview/scripts/panes/explorer.js b/websites/bitview/scripts/panes/explorer.js index f21a5b2e9..d6b91f7a5 100644 --- a/websites/bitview/scripts/panes/explorer.js +++ b/websites/bitview/scripts/panes/explorer.js @@ -1,25 +1,7 @@ import { randomFromArray } from "../utils/array.js"; import { explorerElement } from "../utils/elements.js"; -/** - * @param {Object} args - * @param {Colors} args.colors - * @param {CreateChartElement} args.createChartElement - * @param {Accessor} args.option - * @param {Signals} args.signals - * @param {WebSockets} args.webSockets - * @param {Resources} args.resources - * @param {BrkClient} args.brk - */ -export function init({ - colors: _colors, - createChartElement: _createChartElement, - option: _option, - signals: _signals, - webSockets: _webSockets, - resources: _resources, - brk: _brk, -}) { +export function init() { const chain = window.document.createElement("div"); chain.id = "chain"; explorerElement.append(chain); diff --git a/websites/bitview/scripts/panes/simulation.js b/websites/bitview/scripts/panes/simulation.js index d00c15b6e..1a7389bde 100644 --- a/websites/bitview/scripts/panes/simulation.js +++ b/websites/bitview/scripts/panes/simulation.js @@ -18,15 +18,15 @@ import { numberToUSNumber, } from "../utils/format.js"; import { serdeDate, serdeOptDate, serdeOptNumber } from "../utils/serde.js"; +import signals from "../signals.js"; +import { createChartElement } from "../chart/index.js"; +import { resources } from "../resources.js"; /** * @param {Object} args * @param {Colors} args.colors - * @param {CreateChartElement} args.createChartElement - * @param {Signals} args.signals - * @param {Resources} args.resources */ -export function init({ colors, createChartElement, signals, resources }) { +export function init({ colors }) { /** * @typedef {Object} Frequency * @property {string} name diff --git a/websites/bitview/scripts/panes/table.js b/websites/bitview/scripts/panes/table.js index a5d3a7828..042f0d10e 100644 --- a/websites/bitview/scripts/panes/table.js +++ b/websites/bitview/scripts/panes/table.js @@ -6,14 +6,7 @@ import { tableElement } from "../utils/elements.js"; import { serdeMetrics, serdeString } from "../utils/serde.js"; import { resetParams } from "../utils/url.js"; -/** - * @param {Object} args - * @param {Signals} args.signals - * @param {Option} args.option - * @param {Resources} args.resources - * @param {BrkClient} args.brk - */ -export function init({ signals, option, resources, brk }) { +export function init() { tableElement.innerHTML = "wip, will hopefuly be back soon, sorry !"; // const parent = tableElement; diff --git a/websites/bitview/scripts/resources.js b/websites/bitview/scripts/resources.js index eae8099fb..84f218b3e 100644 --- a/websites/bitview/scripts/resources.js +++ b/websites/bitview/scripts/resources.js @@ -25,105 +25,106 @@ /** @typedef {MetricResource} AnyMetricResource */ /** - * @typedef {ReturnType} Resources + * @typedef {{ createResource: typeof createResource, useMetricEndpoint: typeof useMetricEndpoint }} Resources */ +import signals from "./signals.js"; + /** - * @param {Signals} signals + * Create a generic reactive resource wrapper for any async fetcher + * @template T + * @template {any[]} Args + * @param {(...args: Args) => Promise} fetcher + * @returns {Resource} */ -export function createResources(signals) { +function createResource(fetcher) { const owner = signals.getOwner(); + return signals.runWithOwner(owner, () => { + const data = signals.createSignal(/** @type {T | null} */ (null)); + const loading = signals.createSignal(false); + const error = signals.createSignal(/** @type {Error | null} */ (null)); - /** - * Create a generic reactive resource wrapper for any async fetcher - * @template T - * @template {any[]} Args - * @param {(...args: Args) => Promise} fetcher - * @returns {Resource} - */ - function createResource(fetcher) { - return signals.runWithOwner(owner, () => { - const data = signals.createSignal(/** @type {T | null} */ (null)); - const loading = signals.createSignal(false); - const error = signals.createSignal(/** @type {Error | null} */ (null)); - - return { - data, - loading, - error, - /** - * @param {Args} args - */ - async fetch(...args) { - loading.set(true); - error.set(null); - try { - const result = await fetcher(...args); - data.set(() => result); - return result; - } catch (e) { - error.set(e instanceof Error ? e : new Error(String(e))); - return null; - } finally { - loading.set(false); - } - }, - }; - }); - } - - /** - * Create a reactive resource wrapper for a MetricEndpoint with multi-range support - * @template T - * @param {MetricEndpoint} endpoint - * @returns {MetricResource} - */ - function useMetricEndpoint(endpoint) { - return signals.runWithOwner(owner, () => { - /** @type {Map>} */ - const ranges = new Map(); - + return { + data, + loading, + error, /** - * Get or create range state - * @param {number} [from=-10000] - * @param {number} [to] - * @returns {RangeState} + * @param {Args} args */ - function range(from = -10000, to) { - const key = `${from}-${to ?? ""}`; - const existing = ranges.get(key); - if (existing) return existing; - - /** @type {RangeState} */ - const state = { - response: signals.createSignal(/** @type {MetricData | null} */ (null)), - loading: signals.createSignal(false), - }; - ranges.set(key, state); - return state; - } - - return { - path: endpoint.path, - range, - /** - * Fetch data for a range - * @param {number} [from=-10000] - * @param {number} [to] - */ - async fetch(from = -10000, to) { - const r = range(from, to); - r.loading.set(true); - try { - const result = await endpoint.range(from, to, r.response.set); - return result; - } finally { - r.loading.set(false); - } - }, - }; - }); - } - - return { createResource, useMetricEndpoint }; + async fetch(...args) { + loading.set(true); + error.set(null); + try { + const result = await fetcher(...args); + data.set(() => result); + return result; + } catch (e) { + error.set(e instanceof Error ? e : new Error(String(e))); + return null; + } finally { + loading.set(false); + } + }, + }; + }); } + +/** + * Create a reactive resource wrapper for a MetricEndpoint with multi-range support + * @template T + * @param {MetricEndpoint} endpoint + * @returns {MetricResource} + */ +function useMetricEndpoint(endpoint) { + const owner = signals.getOwner(); + return signals.runWithOwner(owner, () => { + /** @type {Map>} */ + const ranges = new Map(); + + /** + * Get or create range state + * @param {number} [from=-10000] + * @param {number} [to] + * @returns {RangeState} + */ + function range(from = -10000, to) { + const key = `${from}-${to ?? ""}`; + const existing = ranges.get(key); + if (existing) return existing; + + /** @type {RangeState} */ + const state = { + response: signals.createSignal( + /** @type {MetricData | null} */ (null), + ), + loading: signals.createSignal(false), + }; + ranges.set(key, state); + return state; + } + + return { + path: endpoint.path, + range, + /** + * Fetch data for a range + * @param {number} [start=-10000] + * @param {number} [end] + */ + async fetch(start = -10000, end) { + const r = range(start, end); + r.loading.set(true); + try { + const result = await endpoint + .slice(start, end) + .fetch(r.response.set); + return result; + } finally { + r.loading.set(false); + } + }, + }; + }); +} + +export const resources = { createResource, useMetricEndpoint }; diff --git a/websites/bitview/scripts/utils/ws.js b/websites/bitview/scripts/utils/ws.js index 9aa895bde..062e4023b 100644 --- a/websites/bitview/scripts/utils/ws.js +++ b/websites/bitview/scripts/utils/ws.js @@ -1,128 +1,114 @@ +import signals from "../signals.js"; + /** - * @param {Signals} signals + * @template T + * @param {(callback: (value: T) => void) => WebSocket} creator */ -export function createWebSockets(signals) { - /** - * @template T - * @param {(callback: (value: T) => void) => WebSocket} creator - */ - function createWebsocket(creator) { - let ws = /** @type {WebSocket | null} */ (null); +function createWebsocket(creator) { + let ws = /** @type {WebSocket | null} */ (null); - const live = signals.createSignal(false); - const latest = signals.createSignal(/** @type {T | null} */ (null)); + const live = signals.createSignal(false); + const latest = signals.createSignal(/** @type {T | null} */ (null)); - function reinitWebSocket() { - if (!ws || ws.readyState === ws.CLOSED) { - console.log("ws: reinit"); - resource.open(); - } + function reinitWebSocket() { + if (!ws || ws.readyState === ws.CLOSED) { + console.log("ws: reinit"); + resource.open(); } + } - function reinitWebSocketIfDocumentNotHidden() { - !window.document.hidden && reinitWebSocket(); - } + function reinitWebSocketIfDocumentNotHidden() { + !window.document.hidden && reinitWebSocket(); + } - const resource = { - live, - latest, - open() { - ws = creator((value) => latest.set(() => value)); + const resource = { + live, + latest, + open() { + ws = creator((value) => latest.set(() => value)); - ws.addEventListener("open", () => { - console.log("ws: open"); - live.set(true); - }); + ws.addEventListener("open", () => { + console.log("ws: open"); + live.set(true); + }); - ws.addEventListener("close", () => { - console.log("ws: close"); - live.set(false); - }); - - window.document.addEventListener( - "visibilitychange", - reinitWebSocketIfDocumentNotHidden, - ); - - window.document.addEventListener("online", reinitWebSocket); - }, - close() { - ws?.close(); - window.document.removeEventListener( - "visibilitychange", - reinitWebSocketIfDocumentNotHidden, - ); - window.document.removeEventListener("online", reinitWebSocket); + ws.addEventListener("close", () => { + console.log("ws: close"); live.set(false); - ws = null; - }, - }; + }); - return resource; - } - - /** - * @param {(candle: CandlestickData) => void} callback - */ - function krakenCandleWebSocketCreator(callback) { - const ws = new WebSocket("wss://ws.kraken.com/v2"); - - ws.addEventListener("open", () => { - ws.send( - JSON.stringify({ - method: "subscribe", - params: { - channel: "ohlc", - symbol: ["BTC/USD"], - interval: 1440, - }, - }), + window.document.addEventListener( + "visibilitychange", + reinitWebSocketIfDocumentNotHidden, ); - }); - ws.addEventListener("message", (message) => { - const result = JSON.parse(message.data); + window.document.addEventListener("online", reinitWebSocket); + }, + close() { + ws?.close(); + window.document.removeEventListener( + "visibilitychange", + reinitWebSocketIfDocumentNotHidden, + ); + window.document.removeEventListener("online", reinitWebSocket); + live.set(false); + ws = null; + }, + }; - if (result.channel !== "ohlc") return; + return resource; +} - const { interval_begin, open, high, low, close } = result.data.at(-1); +/** + * @param {(candle: CandlestickData) => void} callback + */ +function krakenCandleWebSocketCreator(callback) { + const ws = new WebSocket("wss://ws.kraken.com/v2"); - /** @type {CandlestickData} */ - const candle = { - // index: -1, - time: new Date(interval_begin).valueOf() / 1000, - open: Number(open), - high: Number(high), - low: Number(low), - close: Number(close), - }; - - candle && callback({ ...candle }); - }); - - return ws; - } - - /** @type {ReturnType>} */ - const kraken1dCandle = createWebsocket((callback) => - krakenCandleWebSocketCreator(callback), - ); - - kraken1dCandle.open(); - - signals.createEffect(kraken1dCandle.latest, (latest) => { - if (latest) { - const close = latest.close; - console.log("close:", close); - - window.document.title = `${latest.close.toLocaleString("en-us")} | ${ - window.location.host - }`; - } + ws.addEventListener("open", () => { + ws.send( + JSON.stringify({ + method: "subscribe", + params: { + channel: "ohlc", + symbol: ["BTC/USD"], + interval: 1440, + }, + }), + ); }); - return { - kraken1dCandle, - }; + ws.addEventListener("message", (message) => { + const result = JSON.parse(message.data); + + if (result.channel !== "ohlc") return; + + const { interval_begin, open, high, low, close } = result.data.at(-1); + + /** @type {CandlestickData} */ + const candle = { + // index: -1, + time: new Date(interval_begin).valueOf() / 1000, + open: Number(open), + high: Number(high), + low: Number(low), + close: Number(close), + }; + + candle && callback({ ...candle }); + }); + + return ws; } -/** @typedef {ReturnType} WebSockets */ + +/** @type {ReturnType>} */ +const kraken1dCandle = createWebsocket((callback) => + krakenCandleWebSocketCreator(callback), +); + +kraken1dCandle.open(); + +export const webSockets = { + kraken1dCandle, +}; +/** @typedef {typeof webSockets} WebSockets */