diff --git a/crates/brk_bindgen/src/generators/javascript/client.rs b/crates/brk_bindgen/src/generators/javascript/client.rs index 64de8210b..d69e3bac6 100644 --- a/crates/brk_bindgen/src/generators/javascript/client.rs +++ b/crates/brk_bindgen/src/generators/javascript/client.rs @@ -379,10 +379,55 @@ pub fn generate_index_accessors(output: &mut String, patterns: &[IndexSetPattern return; } - writeln!(output, "// Index accessor factory functions\n").unwrap(); + writeln!(output, "// Index group constants and factory\n").unwrap(); - for pattern in patterns { - // Use 'readonly' to indicate these are getters (lazy evaluation) + // Generate index array constants (e.g., _i1 = ["dateindex", "height"]) + for (i, pattern) in patterns.iter().enumerate() { + write!(output, "const _i{} = [", i + 1).unwrap(); + for (j, index) in pattern.indexes.iter().enumerate() { + if j > 0 { + write!(output, ", ").unwrap(); + } + write!(output, "\"{}\"", index.serialize_long()).unwrap(); + } + writeln!(output, "];").unwrap(); + } + writeln!(output).unwrap(); + + // Generate ONE generic metric pattern factory + writeln!( + output, + r#"/** + * Generic metric pattern factory. + * @template T + * @param {{BrkClientBase}} client + * @param {{string}} name - The metric vec name + * @param {{readonly string[]}} indexes - The supported indexes + * @returns {{MetricPattern}} + */ +function _mp(client, name, indexes) {{ + const by = {{}}; + for (const idx of indexes) {{ + Object.defineProperty(by, idx, {{ + get() {{ return _endpoint(client, name, idx); }}, + enumerable: true, + configurable: true + }}); + }} + return {{ + name, + by, + indexes() {{ return indexes; }}, + get(index) {{ return indexes.includes(index) ? _endpoint(client, name, index) : undefined; }} + }}; +}} +"# + ) + .unwrap(); + + // Generate typedefs and thin wrapper functions + for (i, pattern) in patterns.iter().enumerate() { + // Generate typedef for type safety let by_fields: Vec = pattern .indexes .iter() @@ -395,74 +440,29 @@ pub fn generate_index_accessors(output: &mut String, patterns: &[IndexSetPattern .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, - " * @typedef {{{{ name: string, by: {}, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }}}} {}", + "/** @template T @typedef {{{{ name: string, by: {}, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }}}} {} */", by_type, pattern.name ) .unwrap(); - writeln!(output, " */\n").unwrap(); - writeln!(output, "/**").unwrap(); - writeln!(output, " * Create a {} accessor", pattern.name).unwrap(); - writeln!(output, " * @template T").unwrap(); - writeln!(output, " * @param {{BrkClientBase}} client").unwrap(); - writeln!(output, " * @param {{string}} name - The metric vec name").unwrap(); - writeln!(output, " * @returns {{{}}}", pattern.name).unwrap(); - writeln!(output, " */").unwrap(); - writeln!(output, "function create{}(client, name) {{", pattern.name).unwrap(); - writeln!(output, " return {{").unwrap(); - writeln!(output, " name,").unwrap(); - writeln!(output, " by: {{").unwrap(); - - for (i, index) in pattern.indexes.iter().enumerate() { - let index_name = index.serialize_long(); - let comma = if i < pattern.indexes.len() - 1 { - "," - } else { - "" - }; - writeln!( - output, - " get {}() {{ return _endpoint(client, name, '{}'); }}{}", - index_name, index_name, comma - ) - .unwrap(); - } - - writeln!(output, " }},").unwrap(); - writeln!(output, " indexes() {{").unwrap(); - - write!(output, " return [").unwrap(); - for (i, index) in pattern.indexes.iter().enumerate() { - if i > 0 { - write!(output, ", ").unwrap(); - } - write!(output, "'{}'", index.serialize_long()).unwrap(); - } - writeln!(output, "];").unwrap(); - - writeln!(output, " }},").unwrap(); - writeln!(output, " get(index) {{").unwrap(); - writeln!(output, " if (this.indexes().includes(index)) {{").unwrap(); - writeln!(output, " return _endpoint(client, name, index);").unwrap(); - writeln!(output, " }}").unwrap(); - writeln!(output, " }}").unwrap(); - writeln!(output, " }};").unwrap(); - writeln!(output, "}}\n").unwrap(); + // Generate thin wrapper that calls the generic factory + writeln!( + output, + "/** @template T @param {{BrkClientBase}} client @param {{string}} name @returns {{{}}} */", + pattern.name + ) + .unwrap(); + writeln!( + output, + "function create{}(client, name) {{ return _mp(client, name, _i{}); }}", + pattern.name, + i + 1 + ) + .unwrap(); } + writeln!(output).unwrap(); } /// Generate structural pattern factory functions. diff --git a/crates/brk_bindgen/src/generators/python/client.rs b/crates/brk_bindgen/src/generators/python/client.rs index 2732484a7..88b08c023 100644 --- a/crates/brk_bindgen/src/generators/python/client.rs +++ b/crates/brk_bindgen/src/generators/python/client.rs @@ -372,91 +372,75 @@ pub fn generate_index_accessors(output: &mut String, patterns: &[IndexSetPattern return; } + // Generate static index tuples + writeln!(output, "# Static index tuples").unwrap(); + for (i, pattern) in patterns.iter().enumerate() { + write!(output, "_i{} = (", i + 1).unwrap(); + for (j, index) in pattern.indexes.iter().enumerate() { + if j > 0 { + write!(output, ", ").unwrap(); + } + write!(output, "'{}'", index.serialize_long()).unwrap(); + } + // Single-element tuple needs trailing comma + if pattern.indexes.len() == 1 { + write!(output, ",").unwrap(); + } + writeln!(output, ")").unwrap(); + } + writeln!(output).unwrap(); + + // Generate helper function + writeln!( + output, + r#"def _ep(c: BrkClientBase, n: str, i: Index) -> MetricEndpointBuilder: + return MetricEndpointBuilder(c, n, i) +"# + ) + .unwrap(); + writeln!(output, "# Index accessor classes\n").unwrap(); - for pattern in patterns { + for (i, pattern) in patterns.iter().enumerate() { let by_class_name = format!("_{}By", pattern.name); + let idx_var = format!("_i{}", i + 1); - // Generate the By class with lazy endpoint methods + // Generate the By class with compact methods writeln!(output, "class {}(Generic[T]):", by_class_name).unwrap(); - writeln!(output, " \"\"\"Index endpoint methods container.\"\"\"").unwrap(); - writeln!(output, " ").unwrap(); writeln!( output, - " def __init__(self, client: BrkClientBase, name: str):" + " def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n" ) .unwrap(); - writeln!(output, " self._client = client").unwrap(); - writeln!(output, " self._name = name").unwrap(); - writeln!(output).unwrap(); - - // Generate methods for each index for index in &pattern.indexes { let method_name = index_to_field_name(index); let index_name = index.serialize_long(); - writeln!(output, " def {}(self) -> MetricEndpointBuilder[T]:", method_name).unwrap(); writeln!( output, - " return MetricEndpointBuilder(self._client, self._name, '{}')", - index_name + " def {}(self) -> MetricEndpointBuilder[T]: return _ep(self._c, self._n, '{}')", + method_name, index_name ) .unwrap(); - writeln!(output).unwrap(); } + writeln!(output).unwrap(); // Generate the main accessor class writeln!(output, "class {}(Generic[T]):", pattern.name).unwrap(); writeln!( output, - " \"\"\"Index accessor for metrics with {} indexes.\"\"\"", - pattern.indexes.len() + " def __init__(self, c: BrkClientBase, n: str): self._n, self.by = n, {}(c, n)", + by_class_name ) .unwrap(); - writeln!(output, " ").unwrap(); - writeln!( - output, - " def __init__(self, client: BrkClientBase, name: str):" - ) - .unwrap(); - writeln!(output, " self._client = client").unwrap(); - writeln!(output, " self._name = name").unwrap(); - writeln!( - output, - " self.by: {}[T] = {}(client, name)", - by_class_name, by_class_name - ) - .unwrap(); - writeln!(output).unwrap(); writeln!(output, " @property").unwrap(); - writeln!(output, " def name(self) -> str:").unwrap(); - writeln!(output, " \"\"\"Get the metric name.\"\"\"").unwrap(); - writeln!(output, " return self._name").unwrap(); - writeln!(output).unwrap(); - writeln!(output, " def indexes(self) -> List[str]:").unwrap(); - writeln!(output, " \"\"\"Get the list of available indexes.\"\"\"").unwrap(); - write!(output, " return [").unwrap(); - for (i, index) in pattern.indexes.iter().enumerate() { - if i > 0 { - write!(output, ", ").unwrap(); - } - write!(output, "'{}'", index.serialize_long()).unwrap(); - } - writeln!(output, "]").unwrap(); - writeln!(output).unwrap(); - - // Generate get(index) method - writeln!(output, " def get(self, index: Index) -> Optional[MetricEndpointBuilder[T]]:").unwrap(); - writeln!(output, " \"\"\"Get an endpoint builder for a specific index, if supported.\"\"\"").unwrap(); - for (i, index) in pattern.indexes.iter().enumerate() { - let method_name = index_to_field_name(index); - let index_name = index.serialize_long(); - if i == 0 { - writeln!(output, " if index == '{}': return self.by.{}()", index_name, method_name).unwrap(); - } else { - writeln!(output, " elif index == '{}': return self.by.{}()", index_name, method_name).unwrap(); - } - } - writeln!(output, " return None").unwrap(); + writeln!(output, " def name(self) -> str: return self._n").unwrap(); + writeln!(output, " def indexes(self) -> List[str]: return list({})", idx_var).unwrap(); + writeln!( + output, + " def get(self, index: Index) -> Optional[MetricEndpointBuilder[T]]: return _ep(self.by._c, self._n, index) if index in {} else None", + idx_var + ) + .unwrap(); writeln!(output).unwrap(); } } diff --git a/crates/brk_bindgen/src/generators/rust/client.rs b/crates/brk_bindgen/src/generators/rust/client.rs index 0495d0f5c..b91a3805d 100644 --- a/crates/brk_bindgen/src/generators/rust/client.rs +++ b/crates/brk_bindgen/src/generators/rust/client.rs @@ -375,122 +375,84 @@ pub fn generate_index_accessors(output: &mut String, patterns: &[IndexSetPattern return; } + // Generate static index arrays + writeln!(output, "// Static index arrays").unwrap(); + for (i, pattern) in patterns.iter().enumerate() { + write!(output, "const _I{}: &[Index] = &[", i + 1).unwrap(); + for (j, index) in pattern.indexes.iter().enumerate() { + if j > 0 { + write!(output, ", ").unwrap(); + } + write!(output, "Index::{}", index).unwrap(); + } + writeln!(output, "];").unwrap(); + } + writeln!(output).unwrap(); + + // Generate helper function + writeln!( + output, + r#"#[inline] +fn _ep(c: &Arc, n: &Arc, i: Index) -> MetricEndpointBuilder {{ + MetricEndpointBuilder::new(c.clone(), n.clone(), i) +}} +"# + ) + .unwrap(); + + // Generate index accessor structs writeln!(output, "// Index accessor structs\n").unwrap(); - for pattern in patterns { + for (i, pattern) in patterns.iter().enumerate() { let by_name = format!("{}By", pattern.name); + let idx_const = format!("_I{}", i + 1); - // Generate the "By" struct with lazy endpoint methods - writeln!(output, "/// Container for index endpoint methods.").unwrap(); - writeln!(output, "pub struct {} {{", by_name).unwrap(); - writeln!(output, " client: Arc,").unwrap(); - writeln!(output, " name: Arc,").unwrap(); - writeln!(output, " _marker: std::marker::PhantomData,").unwrap(); - writeln!(output, "}}\n").unwrap(); - - // Generate impl with methods for each index + // Generate the "By" struct + writeln!(output, "pub struct {} {{ client: Arc, name: Arc, _marker: std::marker::PhantomData }}", by_name).unwrap(); writeln!(output, "impl {} {{", by_name).unwrap(); for index in &pattern.indexes { let method_name = index_to_field_name(index); writeln!( output, - " pub fn {}(&self) -> MetricEndpointBuilder {{", - method_name + " pub fn {}(&self) -> MetricEndpointBuilder {{ _ep(&self.client, &self.name, Index::{}) }}", + method_name, index ) .unwrap(); - writeln!( - output, - " MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::{})", - index - ) - .unwrap(); - writeln!(output, " }}").unwrap(); } writeln!(output, "}}\n").unwrap(); // Generate the main accessor struct writeln!( output, - "/// Index accessor for metrics with {} indexes.", - pattern.indexes.len() + "pub struct {} {{ name: Arc, pub by: {} }}", + pattern.name, by_name ) .unwrap(); - writeln!(output, "pub struct {} {{", pattern.name).unwrap(); - writeln!(output, " name: Arc,").unwrap(); - writeln!(output, " pub by: {},", by_name).unwrap(); - writeln!(output, "}}\n").unwrap(); - - // Generate impl block with constructor writeln!(output, "impl {} {{", pattern.name).unwrap(); writeln!( output, - " pub fn new(client: Arc, name: String) -> Self {{" - ) - .unwrap(); - writeln!(output, " let name: Arc = name.into();").unwrap(); - writeln!(output, " Self {{").unwrap(); - writeln!(output, " name: name.clone(),").unwrap(); - writeln!( - output, - " by: {} {{ client, name, _marker: std::marker::PhantomData }}", + " pub fn new(client: Arc, name: String) -> Self {{ let name: Arc = name.into(); Self {{ name: name.clone(), by: {} {{ client, name, _marker: std::marker::PhantomData }} }} }}", by_name ) .unwrap(); - writeln!(output, " }}").unwrap(); - writeln!(output, " }}").unwrap(); - writeln!(output).unwrap(); - writeln!(output, " /// Get the metric name.").unwrap(); - writeln!(output, " pub fn name(&self) -> &str {{").unwrap(); - writeln!(output, " &self.name").unwrap(); - writeln!(output, " }}").unwrap(); + writeln!(output, " pub fn name(&self) -> &str {{ &self.name }}").unwrap(); writeln!(output, "}}\n").unwrap(); // Implement AnyMetricPattern trait writeln!( output, - "impl AnyMetricPattern for {} {{", - pattern.name + "impl AnyMetricPattern for {} {{ fn name(&self) -> &str {{ &self.name }} fn indexes(&self) -> &'static [Index] {{ {} }} }}", + pattern.name, idx_const ) .unwrap(); - writeln!(output, " fn name(&self) -> &str {{").unwrap(); - writeln!(output, " &self.name").unwrap(); - writeln!(output, " }}").unwrap(); - writeln!(output).unwrap(); - writeln!(output, " fn indexes(&self) -> &'static [Index] {{").unwrap(); - writeln!(output, " &[").unwrap(); - for index in &pattern.indexes { - writeln!(output, " Index::{},", index).unwrap(); - } - writeln!(output, " ]").unwrap(); - writeln!(output, " }}").unwrap(); - writeln!(output, "}}\n").unwrap(); // Implement MetricPattern trait writeln!( output, - "impl MetricPattern for {} {{", - pattern.name + "impl MetricPattern for {} {{ fn get(&self, index: Index) -> Option> {{ {}.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) }} }}\n", + pattern.name, idx_const ) .unwrap(); - writeln!( - output, - " fn get(&self, index: Index) -> Option> {{" - ) - .unwrap(); - writeln!(output, " match index {{").unwrap(); - for index in &pattern.indexes { - let method_name = index_to_field_name(index); - writeln!( - output, - " Index::{} => Some(self.by.{}()),", - index, method_name - ) - .unwrap(); - } - writeln!(output, " _ => None,").unwrap(); - writeln!(output, " }}").unwrap(); - writeln!(output, " }}").unwrap(); - writeln!(output, "}}\n").unwrap(); } } diff --git a/crates/brk_client/src/lib.rs b/crates/brk_client/src/lib.rs index efb4da287..f981a6903 100644 --- a/crates/brk_client/src/lib.rs +++ b/crates/brk_client/src/lib.rs @@ -337,1912 +337,523 @@ impl RangeBuilder { } +// Static index arrays +const _I1: &[Index] = &[Index::DateIndex, Index::DecadeIndex, Index::DifficultyEpoch, Index::Height, Index::MonthIndex, Index::QuarterIndex, Index::SemesterIndex, Index::WeekIndex, Index::YearIndex]; +const _I2: &[Index] = &[Index::DateIndex, Index::DecadeIndex, Index::DifficultyEpoch, Index::MonthIndex, Index::QuarterIndex, Index::SemesterIndex, Index::WeekIndex, Index::YearIndex]; +const _I3: &[Index] = &[Index::DateIndex, Index::DecadeIndex, Index::Height, Index::MonthIndex, Index::QuarterIndex, Index::SemesterIndex, Index::WeekIndex, Index::YearIndex]; +const _I4: &[Index] = &[Index::DateIndex, Index::DecadeIndex, Index::MonthIndex, Index::QuarterIndex, Index::SemesterIndex, Index::WeekIndex, Index::YearIndex]; +const _I5: &[Index] = &[Index::DateIndex, Index::Height]; +const _I6: &[Index] = &[Index::DateIndex]; +const _I7: &[Index] = &[Index::DecadeIndex]; +const _I8: &[Index] = &[Index::DifficultyEpoch]; +const _I9: &[Index] = &[Index::EmptyOutputIndex]; +const _I10: &[Index] = &[Index::HalvingEpoch]; +const _I11: &[Index] = &[Index::Height]; +const _I12: &[Index] = &[Index::TxInIndex]; +const _I13: &[Index] = &[Index::MonthIndex]; +const _I14: &[Index] = &[Index::OpReturnIndex]; +const _I15: &[Index] = &[Index::TxOutIndex]; +const _I16: &[Index] = &[Index::P2AAddressIndex]; +const _I17: &[Index] = &[Index::P2MSOutputIndex]; +const _I18: &[Index] = &[Index::P2PK33AddressIndex]; +const _I19: &[Index] = &[Index::P2PK65AddressIndex]; +const _I20: &[Index] = &[Index::P2PKHAddressIndex]; +const _I21: &[Index] = &[Index::P2SHAddressIndex]; +const _I22: &[Index] = &[Index::P2TRAddressIndex]; +const _I23: &[Index] = &[Index::P2WPKHAddressIndex]; +const _I24: &[Index] = &[Index::P2WSHAddressIndex]; +const _I25: &[Index] = &[Index::QuarterIndex]; +const _I26: &[Index] = &[Index::SemesterIndex]; +const _I27: &[Index] = &[Index::TxIndex]; +const _I28: &[Index] = &[Index::UnknownOutputIndex]; +const _I29: &[Index] = &[Index::WeekIndex]; +const _I30: &[Index] = &[Index::YearIndex]; +const _I31: &[Index] = &[Index::LoadedAddressIndex]; +const _I32: &[Index] = &[Index::EmptyAddressIndex]; + +#[inline] +fn _ep(c: &Arc, n: &Arc, i: Index) -> MetricEndpointBuilder { + MetricEndpointBuilder::new(c.clone(), n.clone(), i) +} + // Index accessor structs -/// Container for index endpoint methods. -pub struct MetricPattern1By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} - +pub struct MetricPattern1By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern1By { - pub fn dateindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::DateIndex) - } - pub fn decadeindex(&self) -> MetricEndpointBuilder { - 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) - } - pub fn height(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::Height) - } - pub fn monthindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::MonthIndex) - } - pub fn quarterindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::QuarterIndex) - } - pub fn semesterindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::SemesterIndex) - } - pub fn weekindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::WeekIndex) - } - pub fn yearindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::YearIndex) - } -} - -/// Index accessor for metrics with 9 indexes. -pub struct MetricPattern1 { - name: Arc, - pub by: MetricPattern1By, + pub fn dateindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::DateIndex) } + pub fn decadeindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::DecadeIndex) } + pub fn difficultyepoch(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::DifficultyEpoch) } + pub fn height(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::Height) } + pub fn monthindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::MonthIndex) } + pub fn quarterindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::QuarterIndex) } + pub fn semesterindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::SemesterIndex) } + pub fn weekindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::WeekIndex) } + pub fn yearindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::YearIndex) } } +pub struct MetricPattern1 { name: Arc, pub by: MetricPattern1By } impl MetricPattern1 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern1By { client, name, _marker: std::marker::PhantomData } - } - } - - /// Get the metric name. - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern1By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern1 { - fn name(&self) -> &str { - &self.name - } - - fn indexes(&self) -> &'static [Index] { - &[ - Index::DateIndex, - Index::DecadeIndex, - Index::DifficultyEpoch, - Index::Height, - Index::MonthIndex, - Index::QuarterIndex, - Index::SemesterIndex, - Index::WeekIndex, - Index::YearIndex, - ] - } -} - -impl MetricPattern for MetricPattern1 { - fn get(&self, index: Index) -> Option> { - match index { - Index::DateIndex => Some(self.by.dateindex()), - Index::DecadeIndex => Some(self.by.decadeindex()), - Index::DifficultyEpoch => Some(self.by.difficultyepoch()), - Index::Height => Some(self.by.height()), - Index::MonthIndex => Some(self.by.monthindex()), - Index::QuarterIndex => Some(self.by.quarterindex()), - Index::SemesterIndex => Some(self.by.semesterindex()), - Index::WeekIndex => Some(self.by.weekindex()), - Index::YearIndex => Some(self.by.yearindex()), - _ => None, - } - } -} - -/// Container for index endpoint methods. -pub struct MetricPattern2By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +impl AnyMetricPattern for MetricPattern1 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I1 } } +impl MetricPattern for MetricPattern1 { fn get(&self, index: Index) -> Option> { _I1.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +pub struct MetricPattern2By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern2By { - pub fn dateindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::DateIndex) - } - pub fn decadeindex(&self) -> MetricEndpointBuilder { - 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) - } - pub fn monthindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::MonthIndex) - } - pub fn quarterindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::QuarterIndex) - } - pub fn semesterindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::SemesterIndex) - } - pub fn weekindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::WeekIndex) - } - pub fn yearindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::YearIndex) - } -} - -/// Index accessor for metrics with 8 indexes. -pub struct MetricPattern2 { - name: Arc, - pub by: MetricPattern2By, + pub fn dateindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::DateIndex) } + pub fn decadeindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::DecadeIndex) } + pub fn difficultyepoch(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::DifficultyEpoch) } + pub fn monthindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::MonthIndex) } + pub fn quarterindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::QuarterIndex) } + pub fn semesterindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::SemesterIndex) } + pub fn weekindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::WeekIndex) } + pub fn yearindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::YearIndex) } } +pub struct MetricPattern2 { name: Arc, pub by: MetricPattern2By } impl MetricPattern2 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern2By { client, name, _marker: std::marker::PhantomData } - } - } - - /// Get the metric name. - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern2By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern2 { - fn name(&self) -> &str { - &self.name - } - - fn indexes(&self) -> &'static [Index] { - &[ - Index::DateIndex, - Index::DecadeIndex, - Index::DifficultyEpoch, - Index::MonthIndex, - Index::QuarterIndex, - Index::SemesterIndex, - Index::WeekIndex, - Index::YearIndex, - ] - } -} - -impl MetricPattern for MetricPattern2 { - fn get(&self, index: Index) -> Option> { - match index { - Index::DateIndex => Some(self.by.dateindex()), - Index::DecadeIndex => Some(self.by.decadeindex()), - Index::DifficultyEpoch => Some(self.by.difficultyepoch()), - Index::MonthIndex => Some(self.by.monthindex()), - Index::QuarterIndex => Some(self.by.quarterindex()), - Index::SemesterIndex => Some(self.by.semesterindex()), - Index::WeekIndex => Some(self.by.weekindex()), - Index::YearIndex => Some(self.by.yearindex()), - _ => None, - } - } -} - -/// Container for index endpoint methods. -pub struct MetricPattern3By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +impl AnyMetricPattern for MetricPattern2 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I2 } } +impl MetricPattern for MetricPattern2 { fn get(&self, index: Index) -> Option> { _I2.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +pub struct MetricPattern3By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern3By { - pub fn dateindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::DateIndex) - } - pub fn decadeindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::DecadeIndex) - } - pub fn height(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::Height) - } - pub fn monthindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::MonthIndex) - } - pub fn quarterindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::QuarterIndex) - } - pub fn semesterindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::SemesterIndex) - } - pub fn weekindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::WeekIndex) - } - pub fn yearindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::YearIndex) - } -} - -/// Index accessor for metrics with 8 indexes. -pub struct MetricPattern3 { - name: Arc, - pub by: MetricPattern3By, + pub fn dateindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::DateIndex) } + pub fn decadeindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::DecadeIndex) } + pub fn height(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::Height) } + pub fn monthindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::MonthIndex) } + pub fn quarterindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::QuarterIndex) } + pub fn semesterindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::SemesterIndex) } + pub fn weekindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::WeekIndex) } + pub fn yearindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::YearIndex) } } +pub struct MetricPattern3 { name: Arc, pub by: MetricPattern3By } impl MetricPattern3 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern3By { client, name, _marker: std::marker::PhantomData } - } - } - - /// Get the metric name. - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern3By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern3 { - fn name(&self) -> &str { - &self.name - } - - fn indexes(&self) -> &'static [Index] { - &[ - Index::DateIndex, - Index::DecadeIndex, - Index::Height, - Index::MonthIndex, - Index::QuarterIndex, - Index::SemesterIndex, - Index::WeekIndex, - Index::YearIndex, - ] - } -} - -impl MetricPattern for MetricPattern3 { - fn get(&self, index: Index) -> Option> { - match index { - Index::DateIndex => Some(self.by.dateindex()), - Index::DecadeIndex => Some(self.by.decadeindex()), - Index::Height => Some(self.by.height()), - Index::MonthIndex => Some(self.by.monthindex()), - Index::QuarterIndex => Some(self.by.quarterindex()), - Index::SemesterIndex => Some(self.by.semesterindex()), - Index::WeekIndex => Some(self.by.weekindex()), - Index::YearIndex => Some(self.by.yearindex()), - _ => None, - } - } -} - -/// Container for index endpoint methods. -pub struct MetricPattern4By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +impl AnyMetricPattern for MetricPattern3 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I3 } } +impl MetricPattern for MetricPattern3 { fn get(&self, index: Index) -> Option> { _I3.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +pub struct MetricPattern4By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern4By { - pub fn dateindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::DateIndex) - } - pub fn decadeindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::DecadeIndex) - } - pub fn monthindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::MonthIndex) - } - pub fn quarterindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::QuarterIndex) - } - pub fn semesterindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::SemesterIndex) - } - pub fn weekindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::WeekIndex) - } - pub fn yearindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::YearIndex) - } -} - -/// Index accessor for metrics with 7 indexes. -pub struct MetricPattern4 { - name: Arc, - pub by: MetricPattern4By, + pub fn dateindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::DateIndex) } + pub fn decadeindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::DecadeIndex) } + pub fn monthindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::MonthIndex) } + pub fn quarterindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::QuarterIndex) } + pub fn semesterindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::SemesterIndex) } + pub fn weekindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::WeekIndex) } + pub fn yearindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::YearIndex) } } +pub struct MetricPattern4 { name: Arc, pub by: MetricPattern4By } impl MetricPattern4 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern4By { client, name, _marker: std::marker::PhantomData } - } - } - - /// Get the metric name. - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern4By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern4 { - fn name(&self) -> &str { - &self.name - } - - fn indexes(&self) -> &'static [Index] { - &[ - Index::DateIndex, - Index::DecadeIndex, - Index::MonthIndex, - Index::QuarterIndex, - Index::SemesterIndex, - Index::WeekIndex, - Index::YearIndex, - ] - } -} - -impl MetricPattern for MetricPattern4 { - fn get(&self, index: Index) -> Option> { - match index { - Index::DateIndex => Some(self.by.dateindex()), - Index::DecadeIndex => Some(self.by.decadeindex()), - Index::MonthIndex => Some(self.by.monthindex()), - Index::QuarterIndex => Some(self.by.quarterindex()), - Index::SemesterIndex => Some(self.by.semesterindex()), - Index::WeekIndex => Some(self.by.weekindex()), - Index::YearIndex => Some(self.by.yearindex()), - _ => None, - } - } -} - -/// Container for index endpoint methods. -pub struct MetricPattern5By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +impl AnyMetricPattern for MetricPattern4 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I4 } } +impl MetricPattern for MetricPattern4 { fn get(&self, index: Index) -> Option> { _I4.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +pub struct MetricPattern5By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern5By { - pub fn dateindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::DateIndex) - } - pub fn height(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::Height) - } -} - -/// Index accessor for metrics with 2 indexes. -pub struct MetricPattern5 { - name: Arc, - pub by: MetricPattern5By, + pub fn dateindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::DateIndex) } + pub fn height(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::Height) } } +pub struct MetricPattern5 { name: Arc, pub by: MetricPattern5By } impl MetricPattern5 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern5By { client, name, _marker: std::marker::PhantomData } - } - } - - /// Get the metric name. - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern5By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern5 { - fn name(&self) -> &str { - &self.name - } - - fn indexes(&self) -> &'static [Index] { - &[ - Index::DateIndex, - Index::Height, - ] - } -} - -impl MetricPattern for MetricPattern5 { - fn get(&self, index: Index) -> Option> { - match index { - Index::DateIndex => Some(self.by.dateindex()), - Index::Height => Some(self.by.height()), - _ => None, - } - } -} - -/// Container for index endpoint methods. -pub struct MetricPattern6By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +impl AnyMetricPattern for MetricPattern5 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I5 } } +impl MetricPattern for MetricPattern5 { fn get(&self, index: Index) -> Option> { _I5.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +pub struct MetricPattern6By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern6By { - pub fn dateindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::DateIndex) - } -} - -/// Index accessor for metrics with 1 indexes. -pub struct MetricPattern6 { - name: Arc, - pub by: MetricPattern6By, + pub fn dateindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::DateIndex) } } +pub struct MetricPattern6 { name: Arc, pub by: MetricPattern6By } impl MetricPattern6 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern6By { client, name, _marker: std::marker::PhantomData } - } - } - - /// Get the metric name. - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern6By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern6 { - fn name(&self) -> &str { - &self.name - } - - fn indexes(&self) -> &'static [Index] { - &[ - Index::DateIndex, - ] - } -} - -impl MetricPattern for MetricPattern6 { - fn get(&self, index: Index) -> Option> { - match index { - Index::DateIndex => Some(self.by.dateindex()), - _ => None, - } - } -} - -/// Container for index endpoint methods. -pub struct MetricPattern7By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +impl AnyMetricPattern for MetricPattern6 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I6 } } +impl MetricPattern for MetricPattern6 { fn get(&self, index: Index) -> Option> { _I6.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +pub struct MetricPattern7By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern7By { - pub fn decadeindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::DecadeIndex) - } -} - -/// Index accessor for metrics with 1 indexes. -pub struct MetricPattern7 { - name: Arc, - pub by: MetricPattern7By, + pub fn decadeindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::DecadeIndex) } } +pub struct MetricPattern7 { name: Arc, pub by: MetricPattern7By } impl MetricPattern7 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern7By { client, name, _marker: std::marker::PhantomData } - } - } - - /// Get the metric name. - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern7By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern7 { - fn name(&self) -> &str { - &self.name - } - - fn indexes(&self) -> &'static [Index] { - &[ - Index::DecadeIndex, - ] - } -} - -impl MetricPattern for MetricPattern7 { - fn get(&self, index: Index) -> Option> { - match index { - Index::DecadeIndex => Some(self.by.decadeindex()), - _ => None, - } - } -} - -/// Container for index endpoint methods. -pub struct MetricPattern8By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +impl AnyMetricPattern for MetricPattern7 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I7 } } +impl MetricPattern for MetricPattern7 { fn get(&self, index: Index) -> Option> { _I7.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +pub struct MetricPattern8By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern8By { - pub fn difficultyepoch(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::DifficultyEpoch) - } -} - -/// Index accessor for metrics with 1 indexes. -pub struct MetricPattern8 { - name: Arc, - pub by: MetricPattern8By, + pub fn difficultyepoch(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::DifficultyEpoch) } } +pub struct MetricPattern8 { name: Arc, pub by: MetricPattern8By } impl MetricPattern8 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern8By { client, name, _marker: std::marker::PhantomData } - } - } - - /// Get the metric name. - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern8By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern8 { - fn name(&self) -> &str { - &self.name - } - - fn indexes(&self) -> &'static [Index] { - &[ - Index::DifficultyEpoch, - ] - } -} - -impl MetricPattern for MetricPattern8 { - fn get(&self, index: Index) -> Option> { - match index { - Index::DifficultyEpoch => Some(self.by.difficultyepoch()), - _ => None, - } - } -} - -/// Container for index endpoint methods. -pub struct MetricPattern9By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +impl AnyMetricPattern for MetricPattern8 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I8 } } +impl MetricPattern for MetricPattern8 { fn get(&self, index: Index) -> Option> { _I8.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +pub struct MetricPattern9By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern9By { - pub fn emptyoutputindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::EmptyOutputIndex) - } -} - -/// Index accessor for metrics with 1 indexes. -pub struct MetricPattern9 { - name: Arc, - pub by: MetricPattern9By, + pub fn emptyoutputindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::EmptyOutputIndex) } } +pub struct MetricPattern9 { name: Arc, pub by: MetricPattern9By } impl MetricPattern9 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern9By { client, name, _marker: std::marker::PhantomData } - } - } - - /// Get the metric name. - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern9By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern9 { - fn name(&self) -> &str { - &self.name - } - - fn indexes(&self) -> &'static [Index] { - &[ - Index::EmptyOutputIndex, - ] - } -} - -impl MetricPattern for MetricPattern9 { - fn get(&self, index: Index) -> Option> { - match index { - Index::EmptyOutputIndex => Some(self.by.emptyoutputindex()), - _ => None, - } - } -} - -/// Container for index endpoint methods. -pub struct MetricPattern10By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +impl AnyMetricPattern for MetricPattern9 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I9 } } +impl MetricPattern for MetricPattern9 { fn get(&self, index: Index) -> Option> { _I9.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +pub struct MetricPattern10By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern10By { - pub fn halvingepoch(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::HalvingEpoch) - } -} - -/// Index accessor for metrics with 1 indexes. -pub struct MetricPattern10 { - name: Arc, - pub by: MetricPattern10By, + pub fn halvingepoch(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::HalvingEpoch) } } +pub struct MetricPattern10 { name: Arc, pub by: MetricPattern10By } impl MetricPattern10 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern10By { client, name, _marker: std::marker::PhantomData } - } - } - - /// Get the metric name. - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern10By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern10 { - fn name(&self) -> &str { - &self.name - } - - fn indexes(&self) -> &'static [Index] { - &[ - Index::HalvingEpoch, - ] - } -} - -impl MetricPattern for MetricPattern10 { - fn get(&self, index: Index) -> Option> { - match index { - Index::HalvingEpoch => Some(self.by.halvingepoch()), - _ => None, - } - } -} - -/// Container for index endpoint methods. -pub struct MetricPattern11By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +impl AnyMetricPattern for MetricPattern10 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I10 } } +impl MetricPattern for MetricPattern10 { fn get(&self, index: Index) -> Option> { _I10.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +pub struct MetricPattern11By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern11By { - pub fn height(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::Height) - } -} - -/// Index accessor for metrics with 1 indexes. -pub struct MetricPattern11 { - name: Arc, - pub by: MetricPattern11By, + pub fn height(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::Height) } } +pub struct MetricPattern11 { name: Arc, pub by: MetricPattern11By } impl MetricPattern11 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern11By { client, name, _marker: std::marker::PhantomData } - } - } - - /// Get the metric name. - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern11By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern11 { - fn name(&self) -> &str { - &self.name - } - - fn indexes(&self) -> &'static [Index] { - &[ - Index::Height, - ] - } -} - -impl MetricPattern for MetricPattern11 { - fn get(&self, index: Index) -> Option> { - match index { - Index::Height => Some(self.by.height()), - _ => None, - } - } -} - -/// Container for index endpoint methods. -pub struct MetricPattern12By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +impl AnyMetricPattern for MetricPattern11 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I11 } } +impl MetricPattern for MetricPattern11 { fn get(&self, index: Index) -> Option> { _I11.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +pub struct MetricPattern12By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern12By { - pub fn txinindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::TxInIndex) - } -} - -/// Index accessor for metrics with 1 indexes. -pub struct MetricPattern12 { - name: Arc, - pub by: MetricPattern12By, + pub fn txinindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::TxInIndex) } } +pub struct MetricPattern12 { name: Arc, pub by: MetricPattern12By } impl MetricPattern12 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern12By { client, name, _marker: std::marker::PhantomData } - } - } - - /// Get the metric name. - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern12By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern12 { - fn name(&self) -> &str { - &self.name - } - - fn indexes(&self) -> &'static [Index] { - &[ - Index::TxInIndex, - ] - } -} - -impl MetricPattern for MetricPattern12 { - fn get(&self, index: Index) -> Option> { - match index { - Index::TxInIndex => Some(self.by.txinindex()), - _ => None, - } - } -} - -/// Container for index endpoint methods. -pub struct MetricPattern13By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +impl AnyMetricPattern for MetricPattern12 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I12 } } +impl MetricPattern for MetricPattern12 { fn get(&self, index: Index) -> Option> { _I12.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +pub struct MetricPattern13By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern13By { - pub fn monthindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::MonthIndex) - } -} - -/// Index accessor for metrics with 1 indexes. -pub struct MetricPattern13 { - name: Arc, - pub by: MetricPattern13By, + pub fn monthindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::MonthIndex) } } +pub struct MetricPattern13 { name: Arc, pub by: MetricPattern13By } impl MetricPattern13 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern13By { client, name, _marker: std::marker::PhantomData } - } - } - - /// Get the metric name. - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern13By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern13 { - fn name(&self) -> &str { - &self.name - } - - fn indexes(&self) -> &'static [Index] { - &[ - Index::MonthIndex, - ] - } -} - -impl MetricPattern for MetricPattern13 { - fn get(&self, index: Index) -> Option> { - match index { - Index::MonthIndex => Some(self.by.monthindex()), - _ => None, - } - } -} - -/// Container for index endpoint methods. -pub struct MetricPattern14By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +impl AnyMetricPattern for MetricPattern13 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I13 } } +impl MetricPattern for MetricPattern13 { fn get(&self, index: Index) -> Option> { _I13.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +pub struct MetricPattern14By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern14By { - pub fn opreturnindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::OpReturnIndex) - } -} - -/// Index accessor for metrics with 1 indexes. -pub struct MetricPattern14 { - name: Arc, - pub by: MetricPattern14By, + pub fn opreturnindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::OpReturnIndex) } } +pub struct MetricPattern14 { name: Arc, pub by: MetricPattern14By } impl MetricPattern14 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern14By { client, name, _marker: std::marker::PhantomData } - } - } - - /// Get the metric name. - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern14By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern14 { - fn name(&self) -> &str { - &self.name - } - - fn indexes(&self) -> &'static [Index] { - &[ - Index::OpReturnIndex, - ] - } -} - -impl MetricPattern for MetricPattern14 { - fn get(&self, index: Index) -> Option> { - match index { - Index::OpReturnIndex => Some(self.by.opreturnindex()), - _ => None, - } - } -} - -/// Container for index endpoint methods. -pub struct MetricPattern15By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +impl AnyMetricPattern for MetricPattern14 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I14 } } +impl MetricPattern for MetricPattern14 { fn get(&self, index: Index) -> Option> { _I14.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +pub struct MetricPattern15By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern15By { - pub fn txoutindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::TxOutIndex) - } -} - -/// Index accessor for metrics with 1 indexes. -pub struct MetricPattern15 { - name: Arc, - pub by: MetricPattern15By, + pub fn txoutindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::TxOutIndex) } } +pub struct MetricPattern15 { name: Arc, pub by: MetricPattern15By } impl MetricPattern15 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern15By { client, name, _marker: std::marker::PhantomData } - } - } - - /// Get the metric name. - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern15By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern15 { - fn name(&self) -> &str { - &self.name - } - - fn indexes(&self) -> &'static [Index] { - &[ - Index::TxOutIndex, - ] - } -} - -impl MetricPattern for MetricPattern15 { - fn get(&self, index: Index) -> Option> { - match index { - Index::TxOutIndex => Some(self.by.txoutindex()), - _ => None, - } - } -} - -/// Container for index endpoint methods. -pub struct MetricPattern16By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +impl AnyMetricPattern for MetricPattern15 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I15 } } +impl MetricPattern for MetricPattern15 { fn get(&self, index: Index) -> Option> { _I15.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +pub struct MetricPattern16By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern16By { - pub fn p2aaddressindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::P2AAddressIndex) - } -} - -/// Index accessor for metrics with 1 indexes. -pub struct MetricPattern16 { - name: Arc, - pub by: MetricPattern16By, + pub fn p2aaddressindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::P2AAddressIndex) } } +pub struct MetricPattern16 { name: Arc, pub by: MetricPattern16By } impl MetricPattern16 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern16By { client, name, _marker: std::marker::PhantomData } - } - } - - /// Get the metric name. - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern16By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern16 { - fn name(&self) -> &str { - &self.name - } - - fn indexes(&self) -> &'static [Index] { - &[ - Index::P2AAddressIndex, - ] - } -} - -impl MetricPattern for MetricPattern16 { - fn get(&self, index: Index) -> Option> { - match index { - Index::P2AAddressIndex => Some(self.by.p2aaddressindex()), - _ => None, - } - } -} - -/// Container for index endpoint methods. -pub struct MetricPattern17By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +impl AnyMetricPattern for MetricPattern16 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I16 } } +impl MetricPattern for MetricPattern16 { fn get(&self, index: Index) -> Option> { _I16.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +pub struct MetricPattern17By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern17By { - pub fn p2msoutputindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::P2MSOutputIndex) - } -} - -/// Index accessor for metrics with 1 indexes. -pub struct MetricPattern17 { - name: Arc, - pub by: MetricPattern17By, + pub fn p2msoutputindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::P2MSOutputIndex) } } +pub struct MetricPattern17 { name: Arc, pub by: MetricPattern17By } impl MetricPattern17 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern17By { client, name, _marker: std::marker::PhantomData } - } - } - - /// Get the metric name. - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern17By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern17 { - fn name(&self) -> &str { - &self.name - } - - fn indexes(&self) -> &'static [Index] { - &[ - Index::P2MSOutputIndex, - ] - } -} - -impl MetricPattern for MetricPattern17 { - fn get(&self, index: Index) -> Option> { - match index { - Index::P2MSOutputIndex => Some(self.by.p2msoutputindex()), - _ => None, - } - } -} - -/// Container for index endpoint methods. -pub struct MetricPattern18By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +impl AnyMetricPattern for MetricPattern17 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I17 } } +impl MetricPattern for MetricPattern17 { fn get(&self, index: Index) -> Option> { _I17.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +pub struct MetricPattern18By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern18By { - pub fn p2pk33addressindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::P2PK33AddressIndex) - } -} - -/// Index accessor for metrics with 1 indexes. -pub struct MetricPattern18 { - name: Arc, - pub by: MetricPattern18By, + pub fn p2pk33addressindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::P2PK33AddressIndex) } } +pub struct MetricPattern18 { name: Arc, pub by: MetricPattern18By } impl MetricPattern18 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern18By { client, name, _marker: std::marker::PhantomData } - } - } - - /// Get the metric name. - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern18By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern18 { - fn name(&self) -> &str { - &self.name - } - - fn indexes(&self) -> &'static [Index] { - &[ - Index::P2PK33AddressIndex, - ] - } -} - -impl MetricPattern for MetricPattern18 { - fn get(&self, index: Index) -> Option> { - match index { - Index::P2PK33AddressIndex => Some(self.by.p2pk33addressindex()), - _ => None, - } - } -} - -/// Container for index endpoint methods. -pub struct MetricPattern19By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +impl AnyMetricPattern for MetricPattern18 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I18 } } +impl MetricPattern for MetricPattern18 { fn get(&self, index: Index) -> Option> { _I18.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +pub struct MetricPattern19By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern19By { - pub fn p2pk65addressindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::P2PK65AddressIndex) - } -} - -/// Index accessor for metrics with 1 indexes. -pub struct MetricPattern19 { - name: Arc, - pub by: MetricPattern19By, + pub fn p2pk65addressindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::P2PK65AddressIndex) } } +pub struct MetricPattern19 { name: Arc, pub by: MetricPattern19By } impl MetricPattern19 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern19By { client, name, _marker: std::marker::PhantomData } - } - } - - /// Get the metric name. - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern19By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern19 { - fn name(&self) -> &str { - &self.name - } - - fn indexes(&self) -> &'static [Index] { - &[ - Index::P2PK65AddressIndex, - ] - } -} - -impl MetricPattern for MetricPattern19 { - fn get(&self, index: Index) -> Option> { - match index { - Index::P2PK65AddressIndex => Some(self.by.p2pk65addressindex()), - _ => None, - } - } -} - -/// Container for index endpoint methods. -pub struct MetricPattern20By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +impl AnyMetricPattern for MetricPattern19 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I19 } } +impl MetricPattern for MetricPattern19 { fn get(&self, index: Index) -> Option> { _I19.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +pub struct MetricPattern20By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern20By { - pub fn p2pkhaddressindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::P2PKHAddressIndex) - } -} - -/// Index accessor for metrics with 1 indexes. -pub struct MetricPattern20 { - name: Arc, - pub by: MetricPattern20By, + pub fn p2pkhaddressindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::P2PKHAddressIndex) } } +pub struct MetricPattern20 { name: Arc, pub by: MetricPattern20By } impl MetricPattern20 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern20By { client, name, _marker: std::marker::PhantomData } - } - } - - /// Get the metric name. - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern20By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern20 { - fn name(&self) -> &str { - &self.name - } - - fn indexes(&self) -> &'static [Index] { - &[ - Index::P2PKHAddressIndex, - ] - } -} - -impl MetricPattern for MetricPattern20 { - fn get(&self, index: Index) -> Option> { - match index { - Index::P2PKHAddressIndex => Some(self.by.p2pkhaddressindex()), - _ => None, - } - } -} - -/// Container for index endpoint methods. -pub struct MetricPattern21By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +impl AnyMetricPattern for MetricPattern20 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I20 } } +impl MetricPattern for MetricPattern20 { fn get(&self, index: Index) -> Option> { _I20.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +pub struct MetricPattern21By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern21By { - pub fn p2shaddressindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::P2SHAddressIndex) - } -} - -/// Index accessor for metrics with 1 indexes. -pub struct MetricPattern21 { - name: Arc, - pub by: MetricPattern21By, + pub fn p2shaddressindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::P2SHAddressIndex) } } +pub struct MetricPattern21 { name: Arc, pub by: MetricPattern21By } impl MetricPattern21 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern21By { client, name, _marker: std::marker::PhantomData } - } - } - - /// Get the metric name. - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern21By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern21 { - fn name(&self) -> &str { - &self.name - } - - fn indexes(&self) -> &'static [Index] { - &[ - Index::P2SHAddressIndex, - ] - } -} - -impl MetricPattern for MetricPattern21 { - fn get(&self, index: Index) -> Option> { - match index { - Index::P2SHAddressIndex => Some(self.by.p2shaddressindex()), - _ => None, - } - } -} - -/// Container for index endpoint methods. -pub struct MetricPattern22By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +impl AnyMetricPattern for MetricPattern21 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I21 } } +impl MetricPattern for MetricPattern21 { fn get(&self, index: Index) -> Option> { _I21.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +pub struct MetricPattern22By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern22By { - pub fn p2traddressindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::P2TRAddressIndex) - } -} - -/// Index accessor for metrics with 1 indexes. -pub struct MetricPattern22 { - name: Arc, - pub by: MetricPattern22By, + pub fn p2traddressindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::P2TRAddressIndex) } } +pub struct MetricPattern22 { name: Arc, pub by: MetricPattern22By } impl MetricPattern22 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern22By { client, name, _marker: std::marker::PhantomData } - } - } - - /// Get the metric name. - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern22By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern22 { - fn name(&self) -> &str { - &self.name - } - - fn indexes(&self) -> &'static [Index] { - &[ - Index::P2TRAddressIndex, - ] - } -} - -impl MetricPattern for MetricPattern22 { - fn get(&self, index: Index) -> Option> { - match index { - Index::P2TRAddressIndex => Some(self.by.p2traddressindex()), - _ => None, - } - } -} - -/// Container for index endpoint methods. -pub struct MetricPattern23By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +impl AnyMetricPattern for MetricPattern22 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I22 } } +impl MetricPattern for MetricPattern22 { fn get(&self, index: Index) -> Option> { _I22.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +pub struct MetricPattern23By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern23By { - pub fn p2wpkhaddressindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::P2WPKHAddressIndex) - } -} - -/// Index accessor for metrics with 1 indexes. -pub struct MetricPattern23 { - name: Arc, - pub by: MetricPattern23By, + pub fn p2wpkhaddressindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::P2WPKHAddressIndex) } } +pub struct MetricPattern23 { name: Arc, pub by: MetricPattern23By } impl MetricPattern23 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern23By { client, name, _marker: std::marker::PhantomData } - } - } - - /// Get the metric name. - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern23By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern23 { - fn name(&self) -> &str { - &self.name - } - - fn indexes(&self) -> &'static [Index] { - &[ - Index::P2WPKHAddressIndex, - ] - } -} - -impl MetricPattern for MetricPattern23 { - fn get(&self, index: Index) -> Option> { - match index { - Index::P2WPKHAddressIndex => Some(self.by.p2wpkhaddressindex()), - _ => None, - } - } -} - -/// Container for index endpoint methods. -pub struct MetricPattern24By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +impl AnyMetricPattern for MetricPattern23 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I23 } } +impl MetricPattern for MetricPattern23 { fn get(&self, index: Index) -> Option> { _I23.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +pub struct MetricPattern24By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern24By { - pub fn p2wshaddressindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::P2WSHAddressIndex) - } -} - -/// Index accessor for metrics with 1 indexes. -pub struct MetricPattern24 { - name: Arc, - pub by: MetricPattern24By, + pub fn p2wshaddressindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::P2WSHAddressIndex) } } +pub struct MetricPattern24 { name: Arc, pub by: MetricPattern24By } impl MetricPattern24 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern24By { client, name, _marker: std::marker::PhantomData } - } - } - - /// Get the metric name. - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern24By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern24 { - fn name(&self) -> &str { - &self.name - } - - fn indexes(&self) -> &'static [Index] { - &[ - Index::P2WSHAddressIndex, - ] - } -} - -impl MetricPattern for MetricPattern24 { - fn get(&self, index: Index) -> Option> { - match index { - Index::P2WSHAddressIndex => Some(self.by.p2wshaddressindex()), - _ => None, - } - } -} - -/// Container for index endpoint methods. -pub struct MetricPattern25By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +impl AnyMetricPattern for MetricPattern24 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I24 } } +impl MetricPattern for MetricPattern24 { fn get(&self, index: Index) -> Option> { _I24.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +pub struct MetricPattern25By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern25By { - pub fn quarterindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::QuarterIndex) - } -} - -/// Index accessor for metrics with 1 indexes. -pub struct MetricPattern25 { - name: Arc, - pub by: MetricPattern25By, + pub fn quarterindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::QuarterIndex) } } +pub struct MetricPattern25 { name: Arc, pub by: MetricPattern25By } impl MetricPattern25 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern25By { client, name, _marker: std::marker::PhantomData } - } - } - - /// Get the metric name. - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern25By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern25 { - fn name(&self) -> &str { - &self.name - } - - fn indexes(&self) -> &'static [Index] { - &[ - Index::QuarterIndex, - ] - } -} - -impl MetricPattern for MetricPattern25 { - fn get(&self, index: Index) -> Option> { - match index { - Index::QuarterIndex => Some(self.by.quarterindex()), - _ => None, - } - } -} - -/// Container for index endpoint methods. -pub struct MetricPattern26By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +impl AnyMetricPattern for MetricPattern25 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I25 } } +impl MetricPattern for MetricPattern25 { fn get(&self, index: Index) -> Option> { _I25.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +pub struct MetricPattern26By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern26By { - pub fn semesterindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::SemesterIndex) - } -} - -/// Index accessor for metrics with 1 indexes. -pub struct MetricPattern26 { - name: Arc, - pub by: MetricPattern26By, + pub fn semesterindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::SemesterIndex) } } +pub struct MetricPattern26 { name: Arc, pub by: MetricPattern26By } impl MetricPattern26 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern26By { client, name, _marker: std::marker::PhantomData } - } - } - - /// Get the metric name. - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern26By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern26 { - fn name(&self) -> &str { - &self.name - } - - fn indexes(&self) -> &'static [Index] { - &[ - Index::SemesterIndex, - ] - } -} - -impl MetricPattern for MetricPattern26 { - fn get(&self, index: Index) -> Option> { - match index { - Index::SemesterIndex => Some(self.by.semesterindex()), - _ => None, - } - } -} - -/// Container for index endpoint methods. -pub struct MetricPattern27By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +impl AnyMetricPattern for MetricPattern26 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I26 } } +impl MetricPattern for MetricPattern26 { fn get(&self, index: Index) -> Option> { _I26.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +pub struct MetricPattern27By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern27By { - pub fn txindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::TxIndex) - } -} - -/// Index accessor for metrics with 1 indexes. -pub struct MetricPattern27 { - name: Arc, - pub by: MetricPattern27By, + pub fn txindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::TxIndex) } } +pub struct MetricPattern27 { name: Arc, pub by: MetricPattern27By } impl MetricPattern27 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern27By { client, name, _marker: std::marker::PhantomData } - } - } - - /// Get the metric name. - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern27By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern27 { - fn name(&self) -> &str { - &self.name - } - - fn indexes(&self) -> &'static [Index] { - &[ - Index::TxIndex, - ] - } -} - -impl MetricPattern for MetricPattern27 { - fn get(&self, index: Index) -> Option> { - match index { - Index::TxIndex => Some(self.by.txindex()), - _ => None, - } - } -} - -/// Container for index endpoint methods. -pub struct MetricPattern28By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +impl AnyMetricPattern for MetricPattern27 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I27 } } +impl MetricPattern for MetricPattern27 { fn get(&self, index: Index) -> Option> { _I27.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +pub struct MetricPattern28By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern28By { - pub fn unknownoutputindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::UnknownOutputIndex) - } -} - -/// Index accessor for metrics with 1 indexes. -pub struct MetricPattern28 { - name: Arc, - pub by: MetricPattern28By, + pub fn unknownoutputindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::UnknownOutputIndex) } } +pub struct MetricPattern28 { name: Arc, pub by: MetricPattern28By } impl MetricPattern28 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern28By { client, name, _marker: std::marker::PhantomData } - } - } - - /// Get the metric name. - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern28By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern28 { - fn name(&self) -> &str { - &self.name - } - - fn indexes(&self) -> &'static [Index] { - &[ - Index::UnknownOutputIndex, - ] - } -} - -impl MetricPattern for MetricPattern28 { - fn get(&self, index: Index) -> Option> { - match index { - Index::UnknownOutputIndex => Some(self.by.unknownoutputindex()), - _ => None, - } - } -} - -/// Container for index endpoint methods. -pub struct MetricPattern29By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +impl AnyMetricPattern for MetricPattern28 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I28 } } +impl MetricPattern for MetricPattern28 { fn get(&self, index: Index) -> Option> { _I28.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +pub struct MetricPattern29By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern29By { - pub fn weekindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::WeekIndex) - } -} - -/// Index accessor for metrics with 1 indexes. -pub struct MetricPattern29 { - name: Arc, - pub by: MetricPattern29By, + pub fn weekindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::WeekIndex) } } +pub struct MetricPattern29 { name: Arc, pub by: MetricPattern29By } impl MetricPattern29 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern29By { client, name, _marker: std::marker::PhantomData } - } - } - - /// Get the metric name. - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern29By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern29 { - fn name(&self) -> &str { - &self.name - } - - fn indexes(&self) -> &'static [Index] { - &[ - Index::WeekIndex, - ] - } -} - -impl MetricPattern for MetricPattern29 { - fn get(&self, index: Index) -> Option> { - match index { - Index::WeekIndex => Some(self.by.weekindex()), - _ => None, - } - } -} - -/// Container for index endpoint methods. -pub struct MetricPattern30By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +impl AnyMetricPattern for MetricPattern29 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I29 } } +impl MetricPattern for MetricPattern29 { fn get(&self, index: Index) -> Option> { _I29.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +pub struct MetricPattern30By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern30By { - pub fn yearindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::YearIndex) - } -} - -/// Index accessor for metrics with 1 indexes. -pub struct MetricPattern30 { - name: Arc, - pub by: MetricPattern30By, + pub fn yearindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::YearIndex) } } +pub struct MetricPattern30 { name: Arc, pub by: MetricPattern30By } impl MetricPattern30 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern30By { client, name, _marker: std::marker::PhantomData } - } - } - - /// Get the metric name. - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern30By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern30 { - fn name(&self) -> &str { - &self.name - } - - fn indexes(&self) -> &'static [Index] { - &[ - Index::YearIndex, - ] - } -} - -impl MetricPattern for MetricPattern30 { - fn get(&self, index: Index) -> Option> { - match index { - Index::YearIndex => Some(self.by.yearindex()), - _ => None, - } - } -} - -/// Container for index endpoint methods. -pub struct MetricPattern31By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +impl AnyMetricPattern for MetricPattern30 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I30 } } +impl MetricPattern for MetricPattern30 { fn get(&self, index: Index) -> Option> { _I30.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +pub struct MetricPattern31By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern31By { - pub fn loadedaddressindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::LoadedAddressIndex) - } -} - -/// Index accessor for metrics with 1 indexes. -pub struct MetricPattern31 { - name: Arc, - pub by: MetricPattern31By, + pub fn loadedaddressindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::LoadedAddressIndex) } } +pub struct MetricPattern31 { name: Arc, pub by: MetricPattern31By } impl MetricPattern31 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern31By { client, name, _marker: std::marker::PhantomData } - } - } - - /// Get the metric name. - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern31By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern31 { - fn name(&self) -> &str { - &self.name - } - - fn indexes(&self) -> &'static [Index] { - &[ - Index::LoadedAddressIndex, - ] - } -} - -impl MetricPattern for MetricPattern31 { - fn get(&self, index: Index) -> Option> { - match index { - Index::LoadedAddressIndex => Some(self.by.loadedaddressindex()), - _ => None, - } - } -} - -/// Container for index endpoint methods. -pub struct MetricPattern32By { - client: Arc, - name: Arc, - _marker: std::marker::PhantomData, -} +impl AnyMetricPattern for MetricPattern31 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I31 } } +impl MetricPattern for MetricPattern31 { fn get(&self, index: Index) -> Option> { _I31.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +pub struct MetricPattern32By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern32By { - pub fn emptyaddressindex(&self) -> MetricEndpointBuilder { - MetricEndpointBuilder::new(self.client.clone(), self.name.clone(), Index::EmptyAddressIndex) - } -} - -/// Index accessor for metrics with 1 indexes. -pub struct MetricPattern32 { - name: Arc, - pub by: MetricPattern32By, + pub fn emptyaddressindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::EmptyAddressIndex) } } +pub struct MetricPattern32 { name: Arc, pub by: MetricPattern32By } impl MetricPattern32 { - pub fn new(client: Arc, name: String) -> Self { - let name: Arc = name.into(); - Self { - name: name.clone(), - by: MetricPattern32By { client, name, _marker: std::marker::PhantomData } - } - } - - /// Get the metric name. - pub fn name(&self) -> &str { - &self.name - } + pub fn new(client: Arc, name: String) -> Self { let name: Arc = name.into(); Self { name: name.clone(), by: MetricPattern32By { client, name, _marker: std::marker::PhantomData } } } + pub fn name(&self) -> &str { &self.name } } -impl AnyMetricPattern for MetricPattern32 { - fn name(&self) -> &str { - &self.name - } - - fn indexes(&self) -> &'static [Index] { - &[ - Index::EmptyAddressIndex, - ] - } -} - -impl MetricPattern for MetricPattern32 { - fn get(&self, index: Index) -> Option> { - match index { - Index::EmptyAddressIndex => Some(self.by.emptyaddressindex()), - _ => None, - } - } -} +impl AnyMetricPattern for MetricPattern32 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I32 } } +impl MetricPattern for MetricPattern32 { fn get(&self, index: Index) -> Option> { _I32.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } // Reusable pattern structs @@ -2642,56 +1253,6 @@ impl Price111dSmaPattern { } } -/// Pattern struct for repeated tree structure. -pub struct PercentilesPattern { - pub pct05: MetricPattern4, - pub pct10: MetricPattern4, - pub pct15: MetricPattern4, - pub pct20: MetricPattern4, - pub pct25: MetricPattern4, - pub pct30: MetricPattern4, - pub pct35: MetricPattern4, - pub pct40: MetricPattern4, - pub pct45: MetricPattern4, - pub pct50: MetricPattern4, - pub pct55: MetricPattern4, - pub pct60: MetricPattern4, - pub pct65: MetricPattern4, - pub pct70: MetricPattern4, - pub pct75: MetricPattern4, - pub pct80: MetricPattern4, - pub pct85: MetricPattern4, - pub pct90: MetricPattern4, - pub pct95: MetricPattern4, -} - -impl PercentilesPattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - pct05: MetricPattern4::new(client.clone(), _m(&acc, "pct05")), - pct10: MetricPattern4::new(client.clone(), _m(&acc, "pct10")), - pct15: MetricPattern4::new(client.clone(), _m(&acc, "pct15")), - pct20: MetricPattern4::new(client.clone(), _m(&acc, "pct20")), - pct25: MetricPattern4::new(client.clone(), _m(&acc, "pct25")), - pct30: MetricPattern4::new(client.clone(), _m(&acc, "pct30")), - pct35: MetricPattern4::new(client.clone(), _m(&acc, "pct35")), - pct40: MetricPattern4::new(client.clone(), _m(&acc, "pct40")), - pct45: MetricPattern4::new(client.clone(), _m(&acc, "pct45")), - pct50: MetricPattern4::new(client.clone(), _m(&acc, "pct50")), - pct55: MetricPattern4::new(client.clone(), _m(&acc, "pct55")), - pct60: MetricPattern4::new(client.clone(), _m(&acc, "pct60")), - pct65: MetricPattern4::new(client.clone(), _m(&acc, "pct65")), - pct70: MetricPattern4::new(client.clone(), _m(&acc, "pct70")), - pct75: MetricPattern4::new(client.clone(), _m(&acc, "pct75")), - pct80: MetricPattern4::new(client.clone(), _m(&acc, "pct80")), - pct85: MetricPattern4::new(client.clone(), _m(&acc, "pct85")), - pct90: MetricPattern4::new(client.clone(), _m(&acc, "pct90")), - pct95: MetricPattern4::new(client.clone(), _m(&acc, "pct95")), - } - } -} - /// Pattern struct for repeated tree structure. pub struct ActivePriceRatioPattern { pub ratio: MetricPattern4, @@ -2742,6 +1303,56 @@ impl ActivePriceRatioPattern { } } +/// Pattern struct for repeated tree structure. +pub struct PercentilesPattern { + pub pct05: MetricPattern4, + pub pct10: MetricPattern4, + pub pct15: MetricPattern4, + pub pct20: MetricPattern4, + pub pct25: MetricPattern4, + pub pct30: MetricPattern4, + pub pct35: MetricPattern4, + pub pct40: MetricPattern4, + pub pct45: MetricPattern4, + pub pct50: MetricPattern4, + pub pct55: MetricPattern4, + pub pct60: MetricPattern4, + pub pct65: MetricPattern4, + pub pct70: MetricPattern4, + pub pct75: MetricPattern4, + pub pct80: MetricPattern4, + pub pct85: MetricPattern4, + pub pct90: MetricPattern4, + pub pct95: MetricPattern4, +} + +impl PercentilesPattern { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + pct05: MetricPattern4::new(client.clone(), _m(&acc, "pct05")), + pct10: MetricPattern4::new(client.clone(), _m(&acc, "pct10")), + pct15: MetricPattern4::new(client.clone(), _m(&acc, "pct15")), + pct20: MetricPattern4::new(client.clone(), _m(&acc, "pct20")), + pct25: MetricPattern4::new(client.clone(), _m(&acc, "pct25")), + pct30: MetricPattern4::new(client.clone(), _m(&acc, "pct30")), + pct35: MetricPattern4::new(client.clone(), _m(&acc, "pct35")), + pct40: MetricPattern4::new(client.clone(), _m(&acc, "pct40")), + pct45: MetricPattern4::new(client.clone(), _m(&acc, "pct45")), + pct50: MetricPattern4::new(client.clone(), _m(&acc, "pct50")), + pct55: MetricPattern4::new(client.clone(), _m(&acc, "pct55")), + pct60: MetricPattern4::new(client.clone(), _m(&acc, "pct60")), + pct65: MetricPattern4::new(client.clone(), _m(&acc, "pct65")), + pct70: MetricPattern4::new(client.clone(), _m(&acc, "pct70")), + pct75: MetricPattern4::new(client.clone(), _m(&acc, "pct75")), + pct80: MetricPattern4::new(client.clone(), _m(&acc, "pct80")), + pct85: MetricPattern4::new(client.clone(), _m(&acc, "pct85")), + pct90: MetricPattern4::new(client.clone(), _m(&acc, "pct90")), + 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, @@ -3027,49 +1638,17 @@ impl ClassAveragePricePattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - _2015: MetricPattern4::new(client.clone(), _m(&acc, "2015_returns")), - _2016: MetricPattern4::new(client.clone(), _m(&acc, "2016_returns")), - _2017: MetricPattern4::new(client.clone(), _m(&acc, "2017_returns")), - _2018: MetricPattern4::new(client.clone(), _m(&acc, "2018_returns")), - _2019: MetricPattern4::new(client.clone(), _m(&acc, "2019_returns")), - _2020: MetricPattern4::new(client.clone(), _m(&acc, "2020_returns")), - _2021: MetricPattern4::new(client.clone(), _m(&acc, "2021_returns")), - _2022: MetricPattern4::new(client.clone(), _m(&acc, "2022_returns")), - _2023: MetricPattern4::new(client.clone(), _m(&acc, "2023_returns")), - _2024: MetricPattern4::new(client.clone(), _m(&acc, "2024_returns")), - _2025: MetricPattern4::new(client.clone(), _m(&acc, "2025_returns")), - } - } -} - -/// Pattern struct for repeated tree structure. -pub struct RelativePattern { - pub neg_unrealized_loss_rel_to_market_cap: MetricPattern1, - pub net_unrealized_pnl_rel_to_market_cap: MetricPattern1, - pub nupl: MetricPattern1, - pub supply_in_loss_rel_to_circulating_supply: MetricPattern1, - pub supply_in_loss_rel_to_own_supply: MetricPattern1, - pub supply_in_profit_rel_to_circulating_supply: MetricPattern1, - pub supply_in_profit_rel_to_own_supply: MetricPattern1, - pub supply_rel_to_circulating_supply: MetricPattern4, - pub unrealized_loss_rel_to_market_cap: MetricPattern1, - pub unrealized_profit_rel_to_market_cap: MetricPattern1, -} - -impl RelativePattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - neg_unrealized_loss_rel_to_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "neg_unrealized_loss_rel_to_market_cap")), - net_unrealized_pnl_rel_to_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "net_unrealized_pnl_rel_to_market_cap")), - nupl: MetricPattern1::new(client.clone(), _m(&acc, "nupl")), - supply_in_loss_rel_to_circulating_supply: MetricPattern1::new(client.clone(), _m(&acc, "supply_in_loss_rel_to_circulating_supply")), - supply_in_loss_rel_to_own_supply: MetricPattern1::new(client.clone(), _m(&acc, "supply_in_loss_rel_to_own_supply")), - supply_in_profit_rel_to_circulating_supply: MetricPattern1::new(client.clone(), _m(&acc, "supply_in_profit_rel_to_circulating_supply")), - supply_in_profit_rel_to_own_supply: MetricPattern1::new(client.clone(), _m(&acc, "supply_in_profit_rel_to_own_supply")), - supply_rel_to_circulating_supply: MetricPattern4::new(client.clone(), _m(&acc, "supply_rel_to_circulating_supply")), - unrealized_loss_rel_to_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_loss_rel_to_market_cap")), - unrealized_profit_rel_to_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_profit_rel_to_market_cap")), + _2015: MetricPattern4::new(client.clone(), _m(&acc, "2015_average_price")), + _2016: MetricPattern4::new(client.clone(), _m(&acc, "2016_average_price")), + _2017: MetricPattern4::new(client.clone(), _m(&acc, "2017_average_price")), + _2018: MetricPattern4::new(client.clone(), _m(&acc, "2018_average_price")), + _2019: MetricPattern4::new(client.clone(), _m(&acc, "2019_average_price")), + _2020: MetricPattern4::new(client.clone(), _m(&acc, "2020_average_price")), + _2021: MetricPattern4::new(client.clone(), _m(&acc, "2021_average_price")), + _2022: MetricPattern4::new(client.clone(), _m(&acc, "2022_average_price")), + _2023: MetricPattern4::new(client.clone(), _m(&acc, "2023_average_price")), + _2024: MetricPattern4::new(client.clone(), _m(&acc, "2024_average_price")), + _2025: MetricPattern4::new(client.clone(), _m(&acc, "2025_average_price")), } } } @@ -3106,6 +1685,38 @@ impl RelativePattern2 { } } +/// Pattern struct for repeated tree structure. +pub struct RelativePattern { + pub neg_unrealized_loss_rel_to_market_cap: MetricPattern1, + pub net_unrealized_pnl_rel_to_market_cap: MetricPattern1, + pub nupl: MetricPattern1, + pub supply_in_loss_rel_to_circulating_supply: MetricPattern1, + pub supply_in_loss_rel_to_own_supply: MetricPattern1, + pub supply_in_profit_rel_to_circulating_supply: MetricPattern1, + pub supply_in_profit_rel_to_own_supply: MetricPattern1, + pub supply_rel_to_circulating_supply: MetricPattern4, + pub unrealized_loss_rel_to_market_cap: MetricPattern1, + pub unrealized_profit_rel_to_market_cap: MetricPattern1, +} + +impl RelativePattern { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + neg_unrealized_loss_rel_to_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "neg_unrealized_loss_rel_to_market_cap")), + net_unrealized_pnl_rel_to_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "net_unrealized_pnl_rel_to_market_cap")), + nupl: MetricPattern1::new(client.clone(), _m(&acc, "nupl")), + supply_in_loss_rel_to_circulating_supply: MetricPattern1::new(client.clone(), _m(&acc, "supply_in_loss_rel_to_circulating_supply")), + supply_in_loss_rel_to_own_supply: MetricPattern1::new(client.clone(), _m(&acc, "supply_in_loss_rel_to_own_supply")), + supply_in_profit_rel_to_circulating_supply: MetricPattern1::new(client.clone(), _m(&acc, "supply_in_profit_rel_to_circulating_supply")), + supply_in_profit_rel_to_own_supply: MetricPattern1::new(client.clone(), _m(&acc, "supply_in_profit_rel_to_own_supply")), + supply_rel_to_circulating_supply: MetricPattern4::new(client.clone(), _m(&acc, "supply_rel_to_circulating_supply")), + unrealized_loss_rel_to_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_loss_rel_to_market_cap")), + unrealized_profit_rel_to_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_profit_rel_to_market_cap")), + } + } +} + /// Pattern struct for repeated tree structure. pub struct CountPattern2 { pub average: MetricPattern1, @@ -3256,32 +1867,6 @@ impl _0satsPattern { } } -/// 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(), _m(&acc, "utxo_count")), - realized: RealizedPattern::new(client.clone(), acc.clone()), - relative: RelativePattern::new(client.clone(), acc.clone()), - supply: SupplyPattern2::new(client.clone(), _m(&acc, "supply")), - unrealized: UnrealizedPattern::new(client.clone(), acc.clone()), - } - } -} - /// Pattern struct for repeated tree structure. pub struct UnrealizedPattern { pub neg_unrealized_loss: MetricPattern1, @@ -3308,58 +1893,6 @@ impl UnrealizedPattern { } } -/// 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(), _m(&acc, "utxo_count")), - realized: RealizedPattern4::new(client.clone(), acc.clone()), - relative: RelativePattern::new(client.clone(), acc.clone()), - supply: SupplyPattern2::new(client.clone(), _m(&acc, "supply")), - unrealized: UnrealizedPattern::new(client.clone(), acc.clone()), - } - } -} - -/// Pattern struct for repeated tree structure. -pub struct _0satsPattern2 { - pub activity: ActivityPattern2, - pub cost_basis: CostBasisPattern, - pub outputs: OutputsPattern, - pub realized: RealizedPattern, - pub relative: RelativePattern4, - pub supply: SupplyPattern2, - pub unrealized: UnrealizedPattern, -} - -impl _0satsPattern2 { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - activity: ActivityPattern2::new(client.clone(), acc.clone()), - cost_basis: CostBasisPattern::new(client.clone(), acc.clone()), - outputs: OutputsPattern::new(client.clone(), _m(&acc, "utxo_count")), - realized: RealizedPattern::new(client.clone(), acc.clone()), - relative: RelativePattern4::new(client.clone(), _m(&acc, "supply_in")), - supply: SupplyPattern2::new(client.clone(), _m(&acc, "supply")), - unrealized: UnrealizedPattern::new(client.clone(), acc.clone()), - } - } -} - /// Pattern struct for repeated tree structure. pub struct _10yTo12yPattern { pub activity: ActivityPattern2, @@ -3386,6 +1919,58 @@ impl _10yTo12yPattern { } } +/// 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(), _m(&acc, "utxo_count")), + realized: RealizedPattern4::new(client.clone(), acc.clone()), + relative: RelativePattern::new(client.clone(), acc.clone()), + supply: SupplyPattern2::new(client.clone(), _m(&acc, "supply")), + unrealized: UnrealizedPattern::new(client.clone(), acc.clone()), + } + } +} + +/// 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(), _m(&acc, "utxo_count")), + realized: RealizedPattern::new(client.clone(), acc.clone()), + relative: RelativePattern::new(client.clone(), acc.clone()), + supply: SupplyPattern2::new(client.clone(), _m(&acc, "supply")), + unrealized: UnrealizedPattern::new(client.clone(), acc.clone()), + } + } +} + /// Pattern struct for repeated tree structure. pub struct PeriodCagrPattern { pub _10y: MetricPattern4, @@ -3412,6 +1997,32 @@ impl PeriodCagrPattern { } } +/// Pattern struct for repeated tree structure. +pub struct _0satsPattern2 { + pub activity: ActivityPattern2, + pub cost_basis: CostBasisPattern, + pub outputs: OutputsPattern, + pub realized: RealizedPattern, + pub relative: RelativePattern4, + pub supply: SupplyPattern2, + pub unrealized: UnrealizedPattern, +} + +impl _0satsPattern2 { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + activity: ActivityPattern2::new(client.clone(), acc.clone()), + cost_basis: CostBasisPattern::new(client.clone(), acc.clone()), + outputs: OutputsPattern::new(client.clone(), _m(&acc, "utxo_count")), + realized: RealizedPattern::new(client.clone(), acc.clone()), + relative: RelativePattern4::new(client.clone(), _m(&acc, "supply_in")), + supply: SupplyPattern2::new(client.clone(), _m(&acc, "supply")), + unrealized: UnrealizedPattern::new(client.clone(), acc.clone()), + } + } +} + /// Pattern struct for repeated tree structure. pub struct ActivityPattern2 { pub coinblocks_destroyed: BlockCountPattern, @@ -3454,78 +2065,6 @@ impl SplitPattern2 { } } -/// Pattern struct for repeated tree structure. -pub struct CostBasisPattern2 { - pub max: MetricPattern1, - pub min: MetricPattern1, - pub percentiles: PercentilesPattern, -} - -impl CostBasisPattern2 { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - max: MetricPattern1::new(client.clone(), _m(&acc, "max_cost_basis")), - min: MetricPattern1::new(client.clone(), _m(&acc, "min_cost_basis")), - percentiles: PercentilesPattern::new(client.clone(), _m(&acc, "cost_basis")), - } - } -} - -/// Pattern struct for repeated tree structure. -pub struct CoinbasePattern { - pub bitcoin: BitcoinPattern, - pub dollars: DollarsPattern, - pub sats: DollarsPattern, -} - -impl CoinbasePattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - bitcoin: BitcoinPattern::new(client.clone(), _m(&acc, "btc")), - dollars: DollarsPattern::new(client.clone(), _m(&acc, "usd")), - sats: DollarsPattern::new(client.clone(), acc.clone()), - } - } -} - -/// Pattern struct for repeated tree structure. -pub struct _2015Pattern { - pub bitcoin: MetricPattern4, - pub dollars: MetricPattern4, - pub sats: MetricPattern4, -} - -impl _2015Pattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - bitcoin: MetricPattern4::new(client.clone(), _m(&acc, "btc")), - dollars: MetricPattern4::new(client.clone(), _m(&acc, "usd")), - sats: MetricPattern4::new(client.clone(), acc.clone()), - } - } -} - -/// Pattern struct for repeated tree structure. -pub struct ActiveSupplyPattern { - pub bitcoin: MetricPattern1, - pub dollars: MetricPattern1, - pub sats: MetricPattern1, -} - -impl ActiveSupplyPattern { - /// 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()), - } - } -} - /// Pattern struct for repeated tree structure. pub struct SegwitAdoptionPattern { pub base: MetricPattern11, @@ -3544,24 +2083,6 @@ impl SegwitAdoptionPattern { } } -/// Pattern struct for repeated tree structure. -pub struct CoinbasePattern2 { - pub bitcoin: BlockCountPattern, - pub dollars: BlockCountPattern, - pub sats: BlockCountPattern, -} - -impl CoinbasePattern2 { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - bitcoin: BlockCountPattern::new(client.clone(), _m(&acc, "btc")), - dollars: BlockCountPattern::new(client.clone(), _m(&acc, "usd")), - sats: BlockCountPattern::new(client.clone(), acc.clone()), - } - } -} - /// Pattern struct for repeated tree structure. pub struct UnclaimedRewardsPattern { pub bitcoin: BitcoinPattern2, @@ -3581,33 +2102,91 @@ impl UnclaimedRewardsPattern { } /// Pattern struct for repeated tree structure. -pub struct _1dReturns1mSdPattern { - pub sd: MetricPattern4, - pub sma: MetricPattern4, +pub struct _2015Pattern { + pub bitcoin: MetricPattern4, + pub dollars: MetricPattern4, + pub sats: MetricPattern4, } -impl _1dReturns1mSdPattern { +impl _2015Pattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - sd: MetricPattern4::new(client.clone(), _m(&acc, "sd")), - sma: MetricPattern4::new(client.clone(), _m(&acc, "sma")), + bitcoin: MetricPattern4::new(client.clone(), _m(&acc, "btc")), + dollars: MetricPattern4::new(client.clone(), _m(&acc, "usd")), + sats: MetricPattern4::new(client.clone(), acc.clone()), } } } /// Pattern struct for repeated tree structure. -pub struct SupplyPattern2 { - pub halved: ActiveSupplyPattern, - pub total: ActiveSupplyPattern, +pub struct CostBasisPattern2 { + pub max: MetricPattern1, + pub min: MetricPattern1, + pub percentiles: PercentilesPattern, } -impl SupplyPattern2 { +impl CostBasisPattern2 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - halved: ActiveSupplyPattern::new(client.clone(), _m(&acc, "halved")), - total: ActiveSupplyPattern::new(client.clone(), acc.clone()), + max: MetricPattern1::new(client.clone(), _m(&acc, "max_cost_basis")), + min: MetricPattern1::new(client.clone(), _m(&acc, "min_cost_basis")), + percentiles: PercentilesPattern::new(client.clone(), _m(&acc, "cost_basis")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct CoinbasePattern2 { + pub bitcoin: BlockCountPattern, + pub dollars: BlockCountPattern, + pub sats: BlockCountPattern, +} + +impl CoinbasePattern2 { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + bitcoin: BlockCountPattern::new(client.clone(), _m(&acc, "btc")), + dollars: BlockCountPattern::new(client.clone(), _m(&acc, "usd")), + sats: BlockCountPattern::new(client.clone(), acc.clone()), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct ActiveSupplyPattern { + pub bitcoin: MetricPattern1, + pub dollars: MetricPattern1, + pub sats: MetricPattern1, +} + +impl ActiveSupplyPattern { + /// 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()), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct CoinbasePattern { + pub bitcoin: BitcoinPattern, + pub dollars: DollarsPattern, + pub sats: DollarsPattern, +} + +impl CoinbasePattern { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + bitcoin: BitcoinPattern::new(client.clone(), _m(&acc, "btc")), + dollars: DollarsPattern::new(client.clone(), _m(&acc, "usd")), + sats: DollarsPattern::new(client.clone(), acc.clone()), } } } @@ -3628,6 +2207,22 @@ impl RelativePattern4 { } } +/// Pattern struct for repeated tree structure. +pub struct _1dReturns1mSdPattern { + pub sd: MetricPattern4, + pub sma: MetricPattern4, +} + +impl _1dReturns1mSdPattern { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + sd: MetricPattern4::new(client.clone(), _m(&acc, "sd")), + sma: MetricPattern4::new(client.clone(), _m(&acc, "sma")), + } + } +} + /// Pattern struct for repeated tree structure. pub struct CostBasisPattern { pub max: MetricPattern1, @@ -3644,6 +2239,38 @@ impl CostBasisPattern { } } +/// Pattern struct for repeated tree structure. +pub struct SupplyPattern2 { + pub halved: ActiveSupplyPattern, + pub total: ActiveSupplyPattern, +} + +impl SupplyPattern2 { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + halved: ActiveSupplyPattern::new(client.clone(), _m(&acc, "halved")), + total: ActiveSupplyPattern::new(client.clone(), acc.clone()), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct SatsPattern { + pub ohlc: MetricPattern1, + pub split: SplitPattern2, +} + +impl SatsPattern { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + ohlc: MetricPattern1::new(client.clone(), _m(&acc, "ohlc")), + split: SplitPattern2::new(client.clone(), acc.clone()), + } + } +} + /// Pattern struct for repeated tree structure. pub struct BitcoinPattern2 { pub cumulative: MetricPattern2, @@ -3676,22 +2303,6 @@ impl BlockCountPattern { } } -/// Pattern struct for repeated tree structure. -pub struct SatsPattern { - pub ohlc: MetricPattern1, - pub split: SplitPattern2, -} - -impl SatsPattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - ohlc: MetricPattern1::new(client.clone(), _m(&acc, "ohlc_sats")), - split: SplitPattern2::new(client.clone(), _m(&acc, "sats")), - } - } -} - /// Pattern struct for repeated tree structure. pub struct RealizedPriceExtraPattern { pub ratio: MetricPattern4, @@ -10689,8 +9300,8 @@ impl MetricsTree_Market_Ath { /// Metrics tree node. pub struct MetricsTree_Market_Dca { - pub class_average_price: MetricsTree_Market_Dca_ClassAveragePrice, - pub class_returns: ClassAveragePricePattern, + pub class_average_price: ClassAveragePricePattern, + pub class_returns: MetricsTree_Market_Dca_ClassReturns, pub class_stack: MetricsTree_Market_Dca_ClassStack, pub period_average_price: PeriodAveragePricePattern, pub period_cagr: PeriodCagrPattern, @@ -10702,8 +9313,8 @@ 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: ClassAveragePricePattern::new(client.clone(), "dca_class".to_string()), + class_average_price: ClassAveragePricePattern::new(client.clone(), "dca_class".to_string()), + 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()), @@ -10715,34 +9326,34 @@ impl MetricsTree_Market_Dca { } /// Metrics tree node. -pub struct MetricsTree_Market_Dca_ClassAveragePrice { - pub _2015: MetricPattern4, - pub _2016: MetricPattern4, - pub _2017: MetricPattern4, - pub _2018: MetricPattern4, - pub _2019: MetricPattern4, - pub _2020: MetricPattern4, - pub _2021: MetricPattern4, - pub _2022: MetricPattern4, - pub _2023: MetricPattern4, - pub _2024: MetricPattern4, - pub _2025: MetricPattern4, +pub struct MetricsTree_Market_Dca_ClassReturns { + pub _2015: MetricPattern4, + pub _2016: MetricPattern4, + pub _2017: MetricPattern4, + pub _2018: MetricPattern4, + pub _2019: MetricPattern4, + pub _2020: MetricPattern4, + pub _2021: MetricPattern4, + pub _2022: MetricPattern4, + pub _2023: MetricPattern4, + pub _2024: MetricPattern4, + pub _2025: MetricPattern4, } -impl MetricsTree_Market_Dca_ClassAveragePrice { +impl MetricsTree_Market_Dca_ClassReturns { pub fn new(client: Arc, base_path: String) -> Self { Self { - _2015: MetricPattern4::new(client.clone(), "dca_class_2015_average_price".to_string()), - _2016: MetricPattern4::new(client.clone(), "dca_class_2016_average_price".to_string()), - _2017: MetricPattern4::new(client.clone(), "dca_class_2017_average_price".to_string()), - _2018: MetricPattern4::new(client.clone(), "dca_class_2018_average_price".to_string()), - _2019: MetricPattern4::new(client.clone(), "dca_class_2019_average_price".to_string()), - _2020: MetricPattern4::new(client.clone(), "dca_class_2020_average_price".to_string()), - _2021: MetricPattern4::new(client.clone(), "dca_class_2021_average_price".to_string()), - _2022: MetricPattern4::new(client.clone(), "dca_class_2022_average_price".to_string()), - _2023: MetricPattern4::new(client.clone(), "dca_class_2023_average_price".to_string()), - _2024: MetricPattern4::new(client.clone(), "dca_class_2024_average_price".to_string()), - _2025: MetricPattern4::new(client.clone(), "dca_class_2025_average_price".to_string()), + _2015: MetricPattern4::new(client.clone(), "dca_class_2015_returns".to_string()), + _2016: MetricPattern4::new(client.clone(), "dca_class_2016_returns".to_string()), + _2017: MetricPattern4::new(client.clone(), "dca_class_2017_returns".to_string()), + _2018: MetricPattern4::new(client.clone(), "dca_class_2018_returns".to_string()), + _2019: MetricPattern4::new(client.clone(), "dca_class_2019_returns".to_string()), + _2020: MetricPattern4::new(client.clone(), "dca_class_2020_returns".to_string()), + _2021: MetricPattern4::new(client.clone(), "dca_class_2021_returns".to_string()), + _2022: MetricPattern4::new(client.clone(), "dca_class_2022_returns".to_string()), + _2023: MetricPattern4::new(client.clone(), "dca_class_2023_returns".to_string()), + _2024: MetricPattern4::new(client.clone(), "dca_class_2024_returns".to_string()), + _2025: MetricPattern4::new(client.clone(), "dca_class_2025_returns".to_string()), } } } diff --git a/modules/brk-client/index.js b/modules/brk-client/index.js index d9e28b4ed..12bc63919 100644 --- a/modules/brk-client/index.js +++ b/modules/brk-client/index.js @@ -1101,1185 +1101,269 @@ const _m = (acc, s) => (s ? (acc ? `${acc}_${s}` : s) : acc); */ const _p = (prefix, acc) => (acc ? `${prefix}_${acc}` : prefix); -// Index accessor factory functions +// Index group constants and factory + +const _i1 = [ + "dateindex", + "decadeindex", + "difficultyepoch", + "height", + "monthindex", + "quarterindex", + "semesterindex", + "weekindex", + "yearindex", +]; +const _i2 = [ + "dateindex", + "decadeindex", + "difficultyepoch", + "monthindex", + "quarterindex", + "semesterindex", + "weekindex", + "yearindex", +]; +const _i3 = [ + "dateindex", + "decadeindex", + "height", + "monthindex", + "quarterindex", + "semesterindex", + "weekindex", + "yearindex", +]; +const _i4 = [ + "dateindex", + "decadeindex", + "monthindex", + "quarterindex", + "semesterindex", + "weekindex", + "yearindex", +]; +const _i5 = ["dateindex", "height"]; +const _i6 = ["dateindex"]; +const _i7 = ["decadeindex"]; +const _i8 = ["difficultyepoch"]; +const _i9 = ["emptyoutputindex"]; +const _i10 = ["halvingepoch"]; +const _i11 = ["height"]; +const _i12 = ["txinindex"]; +const _i13 = ["monthindex"]; +const _i14 = ["opreturnindex"]; +const _i15 = ["txoutindex"]; +const _i16 = ["p2aaddressindex"]; +const _i17 = ["p2msoutputindex"]; +const _i18 = ["p2pk33addressindex"]; +const _i19 = ["p2pk65addressindex"]; +const _i20 = ["p2pkhaddressindex"]; +const _i21 = ["p2shaddressindex"]; +const _i22 = ["p2traddressindex"]; +const _i23 = ["p2wpkhaddressindex"]; +const _i24 = ["p2wshaddressindex"]; +const _i25 = ["quarterindex"]; +const _i26 = ["semesterindex"]; +const _i27 = ["txindex"]; +const _i28 = ["unknownoutputindex"]; +const _i29 = ["weekindex"]; +const _i30 = ["yearindex"]; +const _i31 = ["loadedaddressindex"]; +const _i32 = ["emptyaddressindex"]; /** - * Metric pattern with index endpoints as lazy getters. - * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). - * @template T - * @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 - */ - -/** - * Create a MetricPattern1 accessor + * Generic metric pattern factory. * @template T * @param {BrkClientBase} client * @param {string} name - The metric vec name - * @returns {MetricPattern1} + * @param {readonly string[]} indexes - The supported indexes + * @returns {MetricPattern} */ +function _mp(client, name, indexes) { + const by = {}; + for (const idx of indexes) { + Object.defineProperty(by, idx, { + get() { + return _endpoint(client, name, idx); + }, + enumerable: true, + configurable: true, + }); + } + return { + name, + by, + indexes() { + return indexes; + }, + get(index) { + return indexes.includes(index) + ? _endpoint(client, name, index) + : undefined; + }, + }; +} + +/** @template T @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 */ +/** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern1} */ 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"); - }, - }, - indexes() { - return [ - "dateindex", - "decadeindex", - "difficultyepoch", - "height", - "monthindex", - "quarterindex", - "semesterindex", - "weekindex", - "yearindex", - ]; - }, - get(index) { - if (this.indexes().includes(index)) { - return _endpoint(client, name, index); - } - }, - }; + return _mp(client, name, _i1); } - -/** - * Metric pattern with index endpoints as lazy getters. - * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). - * @template T - * @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 - */ - -/** - * Create a MetricPattern2 accessor - * @template T - * @param {BrkClientBase} client - * @param {string} name - The metric vec name - * @returns {MetricPattern2} - */ +/** @template T @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 */ +/** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern2} */ 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"); - }, - }, - indexes() { - return [ - "dateindex", - "decadeindex", - "difficultyepoch", - "monthindex", - "quarterindex", - "semesterindex", - "weekindex", - "yearindex", - ]; - }, - get(index) { - if (this.indexes().includes(index)) { - return _endpoint(client, name, index); - } - }, - }; + return _mp(client, name, _i2); } - -/** - * Metric pattern with index endpoints as lazy getters. - * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). - * @template T - * @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 - */ - -/** - * Create a MetricPattern3 accessor - * @template T - * @param {BrkClientBase} client - * @param {string} name - The metric vec name - * @returns {MetricPattern3} - */ +/** @template T @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 */ +/** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern3} */ 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"); - }, - }, - indexes() { - return [ - "dateindex", - "decadeindex", - "height", - "monthindex", - "quarterindex", - "semesterindex", - "weekindex", - "yearindex", - ]; - }, - get(index) { - if (this.indexes().includes(index)) { - return _endpoint(client, name, index); - } - }, - }; + return _mp(client, name, _i3); } - -/** - * Metric pattern with index endpoints as lazy getters. - * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). - * @template T - * @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 - */ - -/** - * Create a MetricPattern4 accessor - * @template T - * @param {BrkClientBase} client - * @param {string} name - The metric vec name - * @returns {MetricPattern4} - */ +/** @template T @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 */ +/** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern4} */ 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"); - }, - }, - indexes() { - return [ - "dateindex", - "decadeindex", - "monthindex", - "quarterindex", - "semesterindex", - "weekindex", - "yearindex", - ]; - }, - get(index) { - if (this.indexes().includes(index)) { - return _endpoint(client, name, index); - } - }, - }; + return _mp(client, name, _i4); } - -/** - * Metric pattern with index endpoints as lazy getters. - * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). - * @template T - * @typedef {{ name: string, by: { readonly dateindex: MetricEndpointBuilder, readonly height: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern5 - */ - -/** - * Create a MetricPattern5 accessor - * @template T - * @param {BrkClientBase} client - * @param {string} name - The metric vec name - * @returns {MetricPattern5} - */ +/** @template T @typedef {{ name: string, by: { readonly dateindex: MetricEndpointBuilder, readonly height: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern5 */ +/** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern5} */ function createMetricPattern5(client, name) { - return { - name, - by: { - get dateindex() { - return _endpoint(client, name, "dateindex"); - }, - get height() { - return _endpoint(client, name, "height"); - }, - }, - indexes() { - return ["dateindex", "height"]; - }, - get(index) { - if (this.indexes().includes(index)) { - return _endpoint(client, name, index); - } - }, - }; + return _mp(client, name, _i5); } - -/** - * Metric pattern with index endpoints as lazy getters. - * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). - * @template T - * @typedef {{ name: string, by: { readonly dateindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern6 - */ - -/** - * Create a MetricPattern6 accessor - * @template T - * @param {BrkClientBase} client - * @param {string} name - The metric vec name - * @returns {MetricPattern6} - */ +/** @template T @typedef {{ name: string, by: { readonly dateindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern6 */ +/** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern6} */ function createMetricPattern6(client, name) { - return { - name, - by: { - get dateindex() { - return _endpoint(client, name, "dateindex"); - }, - }, - indexes() { - return ["dateindex"]; - }, - get(index) { - if (this.indexes().includes(index)) { - return _endpoint(client, name, index); - } - }, - }; + return _mp(client, name, _i6); } - -/** - * Metric pattern with index endpoints as lazy getters. - * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). - * @template T - * @typedef {{ name: string, by: { readonly decadeindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern7 - */ - -/** - * Create a MetricPattern7 accessor - * @template T - * @param {BrkClientBase} client - * @param {string} name - The metric vec name - * @returns {MetricPattern7} - */ +/** @template T @typedef {{ name: string, by: { readonly decadeindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern7 */ +/** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern7} */ function createMetricPattern7(client, name) { - return { - name, - by: { - get decadeindex() { - return _endpoint(client, name, "decadeindex"); - }, - }, - indexes() { - return ["decadeindex"]; - }, - get(index) { - if (this.indexes().includes(index)) { - return _endpoint(client, name, index); - } - }, - }; + return _mp(client, name, _i7); } - -/** - * Metric pattern with index endpoints as lazy getters. - * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). - * @template T - * @typedef {{ name: string, by: { readonly difficultyepoch: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern8 - */ - -/** - * Create a MetricPattern8 accessor - * @template T - * @param {BrkClientBase} client - * @param {string} name - The metric vec name - * @returns {MetricPattern8} - */ +/** @template T @typedef {{ name: string, by: { readonly difficultyepoch: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern8 */ +/** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern8} */ function createMetricPattern8(client, name) { - return { - name, - by: { - get difficultyepoch() { - return _endpoint(client, name, "difficultyepoch"); - }, - }, - indexes() { - return ["difficultyepoch"]; - }, - get(index) { - if (this.indexes().includes(index)) { - return _endpoint(client, name, index); - } - }, - }; + return _mp(client, name, _i8); } - -/** - * Metric pattern with index endpoints as lazy getters. - * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). - * @template T - * @typedef {{ name: string, by: { readonly emptyoutputindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern9 - */ - -/** - * Create a MetricPattern9 accessor - * @template T - * @param {BrkClientBase} client - * @param {string} name - The metric vec name - * @returns {MetricPattern9} - */ +/** @template T @typedef {{ name: string, by: { readonly emptyoutputindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern9 */ +/** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern9} */ function createMetricPattern9(client, name) { - return { - name, - by: { - get emptyoutputindex() { - return _endpoint(client, name, "emptyoutputindex"); - }, - }, - indexes() { - return ["emptyoutputindex"]; - }, - get(index) { - if (this.indexes().includes(index)) { - return _endpoint(client, name, index); - } - }, - }; + return _mp(client, name, _i9); } - -/** - * Metric pattern with index endpoints as lazy getters. - * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). - * @template T - * @typedef {{ name: string, by: { readonly halvingepoch: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern10 - */ - -/** - * Create a MetricPattern10 accessor - * @template T - * @param {BrkClientBase} client - * @param {string} name - The metric vec name - * @returns {MetricPattern10} - */ +/** @template T @typedef {{ name: string, by: { readonly halvingepoch: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern10 */ +/** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern10} */ function createMetricPattern10(client, name) { - return { - name, - by: { - get halvingepoch() { - return _endpoint(client, name, "halvingepoch"); - }, - }, - indexes() { - return ["halvingepoch"]; - }, - get(index) { - if (this.indexes().includes(index)) { - return _endpoint(client, name, index); - } - }, - }; + return _mp(client, name, _i10); } - -/** - * Metric pattern with index endpoints as lazy getters. - * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). - * @template T - * @typedef {{ name: string, by: { readonly height: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern11 - */ - -/** - * Create a MetricPattern11 accessor - * @template T - * @param {BrkClientBase} client - * @param {string} name - The metric vec name - * @returns {MetricPattern11} - */ +/** @template T @typedef {{ name: string, by: { readonly height: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern11 */ +/** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern11} */ function createMetricPattern11(client, name) { - return { - name, - by: { - get height() { - return _endpoint(client, name, "height"); - }, - }, - indexes() { - return ["height"]; - }, - get(index) { - if (this.indexes().includes(index)) { - return _endpoint(client, name, index); - } - }, - }; + return _mp(client, name, _i11); } - -/** - * Metric pattern with index endpoints as lazy getters. - * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). - * @template T - * @typedef {{ name: string, by: { readonly txinindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern12 - */ - -/** - * Create a MetricPattern12 accessor - * @template T - * @param {BrkClientBase} client - * @param {string} name - The metric vec name - * @returns {MetricPattern12} - */ +/** @template T @typedef {{ name: string, by: { readonly txinindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern12 */ +/** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern12} */ function createMetricPattern12(client, name) { - return { - name, - by: { - get txinindex() { - return _endpoint(client, name, "txinindex"); - }, - }, - indexes() { - return ["txinindex"]; - }, - get(index) { - if (this.indexes().includes(index)) { - return _endpoint(client, name, index); - } - }, - }; + return _mp(client, name, _i12); } - -/** - * Metric pattern with index endpoints as lazy getters. - * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). - * @template T - * @typedef {{ name: string, by: { readonly monthindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern13 - */ - -/** - * Create a MetricPattern13 accessor - * @template T - * @param {BrkClientBase} client - * @param {string} name - The metric vec name - * @returns {MetricPattern13} - */ +/** @template T @typedef {{ name: string, by: { readonly monthindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern13 */ +/** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern13} */ function createMetricPattern13(client, name) { - return { - name, - by: { - get monthindex() { - return _endpoint(client, name, "monthindex"); - }, - }, - indexes() { - return ["monthindex"]; - }, - get(index) { - if (this.indexes().includes(index)) { - return _endpoint(client, name, index); - } - }, - }; + return _mp(client, name, _i13); } - -/** - * Metric pattern with index endpoints as lazy getters. - * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). - * @template T - * @typedef {{ name: string, by: { readonly opreturnindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern14 - */ - -/** - * Create a MetricPattern14 accessor - * @template T - * @param {BrkClientBase} client - * @param {string} name - The metric vec name - * @returns {MetricPattern14} - */ +/** @template T @typedef {{ name: string, by: { readonly opreturnindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern14 */ +/** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern14} */ function createMetricPattern14(client, name) { - return { - name, - by: { - get opreturnindex() { - return _endpoint(client, name, "opreturnindex"); - }, - }, - indexes() { - return ["opreturnindex"]; - }, - get(index) { - if (this.indexes().includes(index)) { - return _endpoint(client, name, index); - } - }, - }; + return _mp(client, name, _i14); } - -/** - * Metric pattern with index endpoints as lazy getters. - * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). - * @template T - * @typedef {{ name: string, by: { readonly txoutindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern15 - */ - -/** - * Create a MetricPattern15 accessor - * @template T - * @param {BrkClientBase} client - * @param {string} name - The metric vec name - * @returns {MetricPattern15} - */ +/** @template T @typedef {{ name: string, by: { readonly txoutindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern15 */ +/** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern15} */ function createMetricPattern15(client, name) { - return { - name, - by: { - get txoutindex() { - return _endpoint(client, name, "txoutindex"); - }, - }, - indexes() { - return ["txoutindex"]; - }, - get(index) { - if (this.indexes().includes(index)) { - return _endpoint(client, name, index); - } - }, - }; + return _mp(client, name, _i15); } - -/** - * Metric pattern with index endpoints as lazy getters. - * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). - * @template T - * @typedef {{ name: string, by: { readonly p2aaddressindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern16 - */ - -/** - * Create a MetricPattern16 accessor - * @template T - * @param {BrkClientBase} client - * @param {string} name - The metric vec name - * @returns {MetricPattern16} - */ +/** @template T @typedef {{ name: string, by: { readonly p2aaddressindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern16 */ +/** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern16} */ function createMetricPattern16(client, name) { - return { - name, - by: { - get p2aaddressindex() { - return _endpoint(client, name, "p2aaddressindex"); - }, - }, - indexes() { - return ["p2aaddressindex"]; - }, - get(index) { - if (this.indexes().includes(index)) { - return _endpoint(client, name, index); - } - }, - }; + return _mp(client, name, _i16); } - -/** - * Metric pattern with index endpoints as lazy getters. - * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). - * @template T - * @typedef {{ name: string, by: { readonly p2msoutputindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern17 - */ - -/** - * Create a MetricPattern17 accessor - * @template T - * @param {BrkClientBase} client - * @param {string} name - The metric vec name - * @returns {MetricPattern17} - */ +/** @template T @typedef {{ name: string, by: { readonly p2msoutputindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern17 */ +/** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern17} */ function createMetricPattern17(client, name) { - return { - name, - by: { - get p2msoutputindex() { - return _endpoint(client, name, "p2msoutputindex"); - }, - }, - indexes() { - return ["p2msoutputindex"]; - }, - get(index) { - if (this.indexes().includes(index)) { - return _endpoint(client, name, index); - } - }, - }; + return _mp(client, name, _i17); } - -/** - * Metric pattern with index endpoints as lazy getters. - * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). - * @template T - * @typedef {{ name: string, by: { readonly p2pk33addressindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern18 - */ - -/** - * Create a MetricPattern18 accessor - * @template T - * @param {BrkClientBase} client - * @param {string} name - The metric vec name - * @returns {MetricPattern18} - */ +/** @template T @typedef {{ name: string, by: { readonly p2pk33addressindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern18 */ +/** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern18} */ function createMetricPattern18(client, name) { - return { - name, - by: { - get p2pk33addressindex() { - return _endpoint(client, name, "p2pk33addressindex"); - }, - }, - indexes() { - return ["p2pk33addressindex"]; - }, - get(index) { - if (this.indexes().includes(index)) { - return _endpoint(client, name, index); - } - }, - }; + return _mp(client, name, _i18); } - -/** - * Metric pattern with index endpoints as lazy getters. - * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). - * @template T - * @typedef {{ name: string, by: { readonly p2pk65addressindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern19 - */ - -/** - * Create a MetricPattern19 accessor - * @template T - * @param {BrkClientBase} client - * @param {string} name - The metric vec name - * @returns {MetricPattern19} - */ +/** @template T @typedef {{ name: string, by: { readonly p2pk65addressindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern19 */ +/** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern19} */ function createMetricPattern19(client, name) { - return { - name, - by: { - get p2pk65addressindex() { - return _endpoint(client, name, "p2pk65addressindex"); - }, - }, - indexes() { - return ["p2pk65addressindex"]; - }, - get(index) { - if (this.indexes().includes(index)) { - return _endpoint(client, name, index); - } - }, - }; + return _mp(client, name, _i19); } - -/** - * Metric pattern with index endpoints as lazy getters. - * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). - * @template T - * @typedef {{ name: string, by: { readonly p2pkhaddressindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern20 - */ - -/** - * Create a MetricPattern20 accessor - * @template T - * @param {BrkClientBase} client - * @param {string} name - The metric vec name - * @returns {MetricPattern20} - */ +/** @template T @typedef {{ name: string, by: { readonly p2pkhaddressindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern20 */ +/** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern20} */ function createMetricPattern20(client, name) { - return { - name, - by: { - get p2pkhaddressindex() { - return _endpoint(client, name, "p2pkhaddressindex"); - }, - }, - indexes() { - return ["p2pkhaddressindex"]; - }, - get(index) { - if (this.indexes().includes(index)) { - return _endpoint(client, name, index); - } - }, - }; + return _mp(client, name, _i20); } - -/** - * Metric pattern with index endpoints as lazy getters. - * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). - * @template T - * @typedef {{ name: string, by: { readonly p2shaddressindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern21 - */ - -/** - * Create a MetricPattern21 accessor - * @template T - * @param {BrkClientBase} client - * @param {string} name - The metric vec name - * @returns {MetricPattern21} - */ +/** @template T @typedef {{ name: string, by: { readonly p2shaddressindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern21 */ +/** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern21} */ function createMetricPattern21(client, name) { - return { - name, - by: { - get p2shaddressindex() { - return _endpoint(client, name, "p2shaddressindex"); - }, - }, - indexes() { - return ["p2shaddressindex"]; - }, - get(index) { - if (this.indexes().includes(index)) { - return _endpoint(client, name, index); - } - }, - }; + return _mp(client, name, _i21); } - -/** - * Metric pattern with index endpoints as lazy getters. - * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). - * @template T - * @typedef {{ name: string, by: { readonly p2traddressindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern22 - */ - -/** - * Create a MetricPattern22 accessor - * @template T - * @param {BrkClientBase} client - * @param {string} name - The metric vec name - * @returns {MetricPattern22} - */ +/** @template T @typedef {{ name: string, by: { readonly p2traddressindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern22 */ +/** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern22} */ function createMetricPattern22(client, name) { - return { - name, - by: { - get p2traddressindex() { - return _endpoint(client, name, "p2traddressindex"); - }, - }, - indexes() { - return ["p2traddressindex"]; - }, - get(index) { - if (this.indexes().includes(index)) { - return _endpoint(client, name, index); - } - }, - }; + return _mp(client, name, _i22); } - -/** - * Metric pattern with index endpoints as lazy getters. - * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). - * @template T - * @typedef {{ name: string, by: { readonly p2wpkhaddressindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern23 - */ - -/** - * Create a MetricPattern23 accessor - * @template T - * @param {BrkClientBase} client - * @param {string} name - The metric vec name - * @returns {MetricPattern23} - */ +/** @template T @typedef {{ name: string, by: { readonly p2wpkhaddressindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern23 */ +/** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern23} */ function createMetricPattern23(client, name) { - return { - name, - by: { - get p2wpkhaddressindex() { - return _endpoint(client, name, "p2wpkhaddressindex"); - }, - }, - indexes() { - return ["p2wpkhaddressindex"]; - }, - get(index) { - if (this.indexes().includes(index)) { - return _endpoint(client, name, index); - } - }, - }; + return _mp(client, name, _i23); } - -/** - * Metric pattern with index endpoints as lazy getters. - * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). - * @template T - * @typedef {{ name: string, by: { readonly p2wshaddressindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern24 - */ - -/** - * Create a MetricPattern24 accessor - * @template T - * @param {BrkClientBase} client - * @param {string} name - The metric vec name - * @returns {MetricPattern24} - */ +/** @template T @typedef {{ name: string, by: { readonly p2wshaddressindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern24 */ +/** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern24} */ function createMetricPattern24(client, name) { - return { - name, - by: { - get p2wshaddressindex() { - return _endpoint(client, name, "p2wshaddressindex"); - }, - }, - indexes() { - return ["p2wshaddressindex"]; - }, - get(index) { - if (this.indexes().includes(index)) { - return _endpoint(client, name, index); - } - }, - }; + return _mp(client, name, _i24); } - -/** - * Metric pattern with index endpoints as lazy getters. - * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). - * @template T - * @typedef {{ name: string, by: { readonly quarterindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern25 - */ - -/** - * Create a MetricPattern25 accessor - * @template T - * @param {BrkClientBase} client - * @param {string} name - The metric vec name - * @returns {MetricPattern25} - */ +/** @template T @typedef {{ name: string, by: { readonly quarterindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern25 */ +/** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern25} */ function createMetricPattern25(client, name) { - return { - name, - by: { - get quarterindex() { - return _endpoint(client, name, "quarterindex"); - }, - }, - indexes() { - return ["quarterindex"]; - }, - get(index) { - if (this.indexes().includes(index)) { - return _endpoint(client, name, index); - } - }, - }; + return _mp(client, name, _i25); } - -/** - * Metric pattern with index endpoints as lazy getters. - * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). - * @template T - * @typedef {{ name: string, by: { readonly semesterindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern26 - */ - -/** - * Create a MetricPattern26 accessor - * @template T - * @param {BrkClientBase} client - * @param {string} name - The metric vec name - * @returns {MetricPattern26} - */ +/** @template T @typedef {{ name: string, by: { readonly semesterindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern26 */ +/** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern26} */ function createMetricPattern26(client, name) { - return { - name, - by: { - get semesterindex() { - return _endpoint(client, name, "semesterindex"); - }, - }, - indexes() { - return ["semesterindex"]; - }, - get(index) { - if (this.indexes().includes(index)) { - return _endpoint(client, name, index); - } - }, - }; + return _mp(client, name, _i26); } - -/** - * Metric pattern with index endpoints as lazy getters. - * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). - * @template T - * @typedef {{ name: string, by: { readonly txindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern27 - */ - -/** - * Create a MetricPattern27 accessor - * @template T - * @param {BrkClientBase} client - * @param {string} name - The metric vec name - * @returns {MetricPattern27} - */ +/** @template T @typedef {{ name: string, by: { readonly txindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern27 */ +/** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern27} */ function createMetricPattern27(client, name) { - return { - name, - by: { - get txindex() { - return _endpoint(client, name, "txindex"); - }, - }, - indexes() { - return ["txindex"]; - }, - get(index) { - if (this.indexes().includes(index)) { - return _endpoint(client, name, index); - } - }, - }; + return _mp(client, name, _i27); } - -/** - * Metric pattern with index endpoints as lazy getters. - * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). - * @template T - * @typedef {{ name: string, by: { readonly unknownoutputindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern28 - */ - -/** - * Create a MetricPattern28 accessor - * @template T - * @param {BrkClientBase} client - * @param {string} name - The metric vec name - * @returns {MetricPattern28} - */ +/** @template T @typedef {{ name: string, by: { readonly unknownoutputindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern28 */ +/** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern28} */ function createMetricPattern28(client, name) { - return { - name, - by: { - get unknownoutputindex() { - return _endpoint(client, name, "unknownoutputindex"); - }, - }, - indexes() { - return ["unknownoutputindex"]; - }, - get(index) { - if (this.indexes().includes(index)) { - return _endpoint(client, name, index); - } - }, - }; + return _mp(client, name, _i28); } - -/** - * Metric pattern with index endpoints as lazy getters. - * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). - * @template T - * @typedef {{ name: string, by: { readonly weekindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern29 - */ - -/** - * Create a MetricPattern29 accessor - * @template T - * @param {BrkClientBase} client - * @param {string} name - The metric vec name - * @returns {MetricPattern29} - */ +/** @template T @typedef {{ name: string, by: { readonly weekindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern29 */ +/** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern29} */ function createMetricPattern29(client, name) { - return { - name, - by: { - get weekindex() { - return _endpoint(client, name, "weekindex"); - }, - }, - indexes() { - return ["weekindex"]; - }, - get(index) { - if (this.indexes().includes(index)) { - return _endpoint(client, name, index); - } - }, - }; + return _mp(client, name, _i29); } - -/** - * Metric pattern with index endpoints as lazy getters. - * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). - * @template T - * @typedef {{ name: string, by: { readonly yearindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern30 - */ - -/** - * Create a MetricPattern30 accessor - * @template T - * @param {BrkClientBase} client - * @param {string} name - The metric vec name - * @returns {MetricPattern30} - */ +/** @template T @typedef {{ name: string, by: { readonly yearindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern30 */ +/** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern30} */ function createMetricPattern30(client, name) { - return { - name, - by: { - get yearindex() { - return _endpoint(client, name, "yearindex"); - }, - }, - indexes() { - return ["yearindex"]; - }, - get(index) { - if (this.indexes().includes(index)) { - return _endpoint(client, name, index); - } - }, - }; + return _mp(client, name, _i30); } - -/** - * Metric pattern with index endpoints as lazy getters. - * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). - * @template T - * @typedef {{ name: string, by: { readonly loadedaddressindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern31 - */ - -/** - * Create a MetricPattern31 accessor - * @template T - * @param {BrkClientBase} client - * @param {string} name - The metric vec name - * @returns {MetricPattern31} - */ +/** @template T @typedef {{ name: string, by: { readonly loadedaddressindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern31 */ +/** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern31} */ function createMetricPattern31(client, name) { - return { - name, - by: { - get loadedaddressindex() { - return _endpoint(client, name, "loadedaddressindex"); - }, - }, - indexes() { - return ["loadedaddressindex"]; - }, - get(index) { - if (this.indexes().includes(index)) { - return _endpoint(client, name, index); - } - }, - }; + return _mp(client, name, _i31); } - -/** - * Metric pattern with index endpoints as lazy getters. - * Access via property (.by.dateindex) or bracket notation (.by['dateindex']). - * @template T - * @typedef {{ name: string, by: { readonly emptyaddressindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern32 - */ - -/** - * Create a MetricPattern32 accessor - * @template T - * @param {BrkClientBase} client - * @param {string} name - The metric vec name - * @returns {MetricPattern32} - */ +/** @template T @typedef {{ name: string, by: { readonly emptyaddressindex: MetricEndpointBuilder }, indexes: () => Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern32 */ +/** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern32} */ function createMetricPattern32(client, name) { - return { - name, - by: { - get emptyaddressindex() { - return _endpoint(client, name, "emptyaddressindex"); - }, - }, - indexes() { - return ["emptyaddressindex"]; - }, - get(index) { - if (this.indexes().includes(index)) { - return _endpoint(client, name, index); - } - }, - }; + return _mp(client, name, _i32); } // Reusable structural pattern factories @@ -2902,59 +1986,6 @@ function createPrice111dSmaPattern(client, acc) { }; } -/** - * @typedef {Object} PercentilesPattern - * @property {MetricPattern4} pct05 - * @property {MetricPattern4} pct10 - * @property {MetricPattern4} pct15 - * @property {MetricPattern4} pct20 - * @property {MetricPattern4} pct25 - * @property {MetricPattern4} pct30 - * @property {MetricPattern4} pct35 - * @property {MetricPattern4} pct40 - * @property {MetricPattern4} pct45 - * @property {MetricPattern4} pct50 - * @property {MetricPattern4} pct55 - * @property {MetricPattern4} pct60 - * @property {MetricPattern4} pct65 - * @property {MetricPattern4} pct70 - * @property {MetricPattern4} pct75 - * @property {MetricPattern4} pct80 - * @property {MetricPattern4} pct85 - * @property {MetricPattern4} pct90 - * @property {MetricPattern4} pct95 - */ - -/** - * Create a PercentilesPattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {PercentilesPattern} - */ -function createPercentilesPattern(client, acc) { - return { - pct05: createMetricPattern4(client, _m(acc, "pct05")), - pct10: createMetricPattern4(client, _m(acc, "pct10")), - pct15: createMetricPattern4(client, _m(acc, "pct15")), - pct20: createMetricPattern4(client, _m(acc, "pct20")), - pct25: createMetricPattern4(client, _m(acc, "pct25")), - pct30: createMetricPattern4(client, _m(acc, "pct30")), - pct35: createMetricPattern4(client, _m(acc, "pct35")), - pct40: createMetricPattern4(client, _m(acc, "pct40")), - pct45: createMetricPattern4(client, _m(acc, "pct45")), - pct50: createMetricPattern4(client, _m(acc, "pct50")), - pct55: createMetricPattern4(client, _m(acc, "pct55")), - pct60: createMetricPattern4(client, _m(acc, "pct60")), - pct65: createMetricPattern4(client, _m(acc, "pct65")), - pct70: createMetricPattern4(client, _m(acc, "pct70")), - pct75: createMetricPattern4(client, _m(acc, "pct75")), - pct80: createMetricPattern4(client, _m(acc, "pct80")), - pct85: createMetricPattern4(client, _m(acc, "pct85")), - pct90: createMetricPattern4(client, _m(acc, "pct90")), - pct95: createMetricPattern4(client, _m(acc, "pct95")), - }; -} - /** * @typedef {Object} ActivePriceRatioPattern * @property {MetricPattern4} ratio @@ -3008,6 +2039,59 @@ function createActivePriceRatioPattern(client, acc) { }; } +/** + * @typedef {Object} PercentilesPattern + * @property {MetricPattern4} pct05 + * @property {MetricPattern4} pct10 + * @property {MetricPattern4} pct15 + * @property {MetricPattern4} pct20 + * @property {MetricPattern4} pct25 + * @property {MetricPattern4} pct30 + * @property {MetricPattern4} pct35 + * @property {MetricPattern4} pct40 + * @property {MetricPattern4} pct45 + * @property {MetricPattern4} pct50 + * @property {MetricPattern4} pct55 + * @property {MetricPattern4} pct60 + * @property {MetricPattern4} pct65 + * @property {MetricPattern4} pct70 + * @property {MetricPattern4} pct75 + * @property {MetricPattern4} pct80 + * @property {MetricPattern4} pct85 + * @property {MetricPattern4} pct90 + * @property {MetricPattern4} pct95 + */ + +/** + * Create a PercentilesPattern pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {PercentilesPattern} + */ +function createPercentilesPattern(client, acc) { + return { + pct05: createMetricPattern4(client, _m(acc, "pct05")), + pct10: createMetricPattern4(client, _m(acc, "pct10")), + pct15: createMetricPattern4(client, _m(acc, "pct15")), + pct20: createMetricPattern4(client, _m(acc, "pct20")), + pct25: createMetricPattern4(client, _m(acc, "pct25")), + pct30: createMetricPattern4(client, _m(acc, "pct30")), + pct35: createMetricPattern4(client, _m(acc, "pct35")), + pct40: createMetricPattern4(client, _m(acc, "pct40")), + pct45: createMetricPattern4(client, _m(acc, "pct45")), + pct50: createMetricPattern4(client, _m(acc, "pct50")), + pct55: createMetricPattern4(client, _m(acc, "pct55")), + pct60: createMetricPattern4(client, _m(acc, "pct60")), + pct65: createMetricPattern4(client, _m(acc, "pct65")), + pct70: createMetricPattern4(client, _m(acc, "pct70")), + pct75: createMetricPattern4(client, _m(acc, "pct75")), + pct80: createMetricPattern4(client, _m(acc, "pct80")), + pct85: createMetricPattern4(client, _m(acc, "pct85")), + pct90: createMetricPattern4(client, _m(acc, "pct90")), + pct95: createMetricPattern4(client, _m(acc, "pct95")), + }; +} + /** * @typedef {Object} RelativePattern5 * @property {MetricPattern1} negUnrealizedLossRelToMarketCap @@ -3377,79 +2461,17 @@ function createDollarsPattern(client, acc) { */ function createClassAveragePricePattern(client, acc) { return { - _2015: createMetricPattern4(client, _m(acc, "2015_returns")), - _2016: createMetricPattern4(client, _m(acc, "2016_returns")), - _2017: createMetricPattern4(client, _m(acc, "2017_returns")), - _2018: createMetricPattern4(client, _m(acc, "2018_returns")), - _2019: createMetricPattern4(client, _m(acc, "2019_returns")), - _2020: createMetricPattern4(client, _m(acc, "2020_returns")), - _2021: createMetricPattern4(client, _m(acc, "2021_returns")), - _2022: createMetricPattern4(client, _m(acc, "2022_returns")), - _2023: createMetricPattern4(client, _m(acc, "2023_returns")), - _2024: createMetricPattern4(client, _m(acc, "2024_returns")), - _2025: createMetricPattern4(client, _m(acc, "2025_returns")), - }; -} - -/** - * @typedef {Object} RelativePattern - * @property {MetricPattern1} negUnrealizedLossRelToMarketCap - * @property {MetricPattern1} netUnrealizedPnlRelToMarketCap - * @property {MetricPattern1} nupl - * @property {MetricPattern1} supplyInLossRelToCirculatingSupply - * @property {MetricPattern1} supplyInLossRelToOwnSupply - * @property {MetricPattern1} supplyInProfitRelToCirculatingSupply - * @property {MetricPattern1} supplyInProfitRelToOwnSupply - * @property {MetricPattern4} supplyRelToCirculatingSupply - * @property {MetricPattern1} unrealizedLossRelToMarketCap - * @property {MetricPattern1} unrealizedProfitRelToMarketCap - */ - -/** - * Create a RelativePattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {RelativePattern} - */ -function createRelativePattern(client, acc) { - return { - negUnrealizedLossRelToMarketCap: createMetricPattern1( - client, - _m(acc, "neg_unrealized_loss_rel_to_market_cap"), - ), - netUnrealizedPnlRelToMarketCap: createMetricPattern1( - client, - _m(acc, "net_unrealized_pnl_rel_to_market_cap"), - ), - nupl: createMetricPattern1(client, _m(acc, "nupl")), - supplyInLossRelToCirculatingSupply: createMetricPattern1( - client, - _m(acc, "supply_in_loss_rel_to_circulating_supply"), - ), - supplyInLossRelToOwnSupply: createMetricPattern1( - client, - _m(acc, "supply_in_loss_rel_to_own_supply"), - ), - supplyInProfitRelToCirculatingSupply: createMetricPattern1( - client, - _m(acc, "supply_in_profit_rel_to_circulating_supply"), - ), - supplyInProfitRelToOwnSupply: createMetricPattern1( - client, - _m(acc, "supply_in_profit_rel_to_own_supply"), - ), - supplyRelToCirculatingSupply: createMetricPattern4( - client, - _m(acc, "supply_rel_to_circulating_supply"), - ), - unrealizedLossRelToMarketCap: createMetricPattern1( - client, - _m(acc, "unrealized_loss_rel_to_market_cap"), - ), - unrealizedProfitRelToMarketCap: createMetricPattern1( - client, - _m(acc, "unrealized_profit_rel_to_market_cap"), - ), + _2015: createMetricPattern4(client, _m(acc, "2015_average_price")), + _2016: createMetricPattern4(client, _m(acc, "2016_average_price")), + _2017: createMetricPattern4(client, _m(acc, "2017_average_price")), + _2018: createMetricPattern4(client, _m(acc, "2018_average_price")), + _2019: createMetricPattern4(client, _m(acc, "2019_average_price")), + _2020: createMetricPattern4(client, _m(acc, "2020_average_price")), + _2021: createMetricPattern4(client, _m(acc, "2021_average_price")), + _2022: createMetricPattern4(client, _m(acc, "2022_average_price")), + _2023: createMetricPattern4(client, _m(acc, "2023_average_price")), + _2024: createMetricPattern4(client, _m(acc, "2024_average_price")), + _2025: createMetricPattern4(client, _m(acc, "2025_average_price")), }; } @@ -3518,6 +2540,68 @@ function createRelativePattern2(client, acc) { }; } +/** + * @typedef {Object} RelativePattern + * @property {MetricPattern1} negUnrealizedLossRelToMarketCap + * @property {MetricPattern1} netUnrealizedPnlRelToMarketCap + * @property {MetricPattern1} nupl + * @property {MetricPattern1} supplyInLossRelToCirculatingSupply + * @property {MetricPattern1} supplyInLossRelToOwnSupply + * @property {MetricPattern1} supplyInProfitRelToCirculatingSupply + * @property {MetricPattern1} supplyInProfitRelToOwnSupply + * @property {MetricPattern4} supplyRelToCirculatingSupply + * @property {MetricPattern1} unrealizedLossRelToMarketCap + * @property {MetricPattern1} unrealizedProfitRelToMarketCap + */ + +/** + * Create a RelativePattern pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {RelativePattern} + */ +function createRelativePattern(client, acc) { + return { + negUnrealizedLossRelToMarketCap: createMetricPattern1( + client, + _m(acc, "neg_unrealized_loss_rel_to_market_cap"), + ), + netUnrealizedPnlRelToMarketCap: createMetricPattern1( + client, + _m(acc, "net_unrealized_pnl_rel_to_market_cap"), + ), + nupl: createMetricPattern1(client, _m(acc, "nupl")), + supplyInLossRelToCirculatingSupply: createMetricPattern1( + client, + _m(acc, "supply_in_loss_rel_to_circulating_supply"), + ), + supplyInLossRelToOwnSupply: createMetricPattern1( + client, + _m(acc, "supply_in_loss_rel_to_own_supply"), + ), + supplyInProfitRelToCirculatingSupply: createMetricPattern1( + client, + _m(acc, "supply_in_profit_rel_to_circulating_supply"), + ), + supplyInProfitRelToOwnSupply: createMetricPattern1( + client, + _m(acc, "supply_in_profit_rel_to_own_supply"), + ), + supplyRelToCirculatingSupply: createMetricPattern4( + client, + _m(acc, "supply_rel_to_circulating_supply"), + ), + unrealizedLossRelToMarketCap: createMetricPattern1( + client, + _m(acc, "unrealized_loss_rel_to_market_cap"), + ), + unrealizedProfitRelToMarketCap: createMetricPattern1( + client, + _m(acc, "unrealized_profit_rel_to_market_cap"), + ), + }; +} + /** * @template T * @typedef {Object} CountPattern2 @@ -3689,35 +2773,6 @@ function create_0satsPattern(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, _m(acc, "utxo_count")), - realized: createRealizedPattern(client, acc), - relative: createRelativePattern(client, acc), - supply: createSupplyPattern2(client, _m(acc, "supply")), - unrealized: createUnrealizedPattern(client, acc), - }; -} - /** * @typedef {Object} UnrealizedPattern * @property {MetricPattern1} negUnrealizedLoss @@ -3762,6 +2817,35 @@ function 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, _m(acc, "utxo_count")), + realized: createRealizedPattern2(client, acc), + relative: createRelativePattern2(client, acc), + supply: createSupplyPattern2(client, _m(acc, "supply")), + unrealized: createUnrealizedPattern(client, acc), + }; +} + /** * @typedef {Object} _10yPattern * @property {ActivityPattern2} activity @@ -3792,58 +2876,29 @@ function create_10yPattern(client, acc) { } /** - * @typedef {Object} _0satsPattern2 + * @typedef {Object} _100btcPattern * @property {ActivityPattern2} activity * @property {CostBasisPattern} costBasis * @property {OutputsPattern} outputs * @property {RealizedPattern} realized - * @property {RelativePattern4} relative + * @property {RelativePattern} relative * @property {SupplyPattern2} supply * @property {UnrealizedPattern} unrealized */ /** - * Create a _0satsPattern2 pattern node + * Create a _100btcPattern pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {_0satsPattern2} + * @returns {_100btcPattern} */ -function create_0satsPattern2(client, acc) { +function create_100btcPattern(client, acc) { return { activity: createActivityPattern2(client, acc), costBasis: createCostBasisPattern(client, acc), outputs: createOutputsPattern(client, _m(acc, "utxo_count")), realized: createRealizedPattern(client, acc), - relative: createRelativePattern4(client, _m(acc, "supply_in")), - supply: createSupplyPattern2(client, _m(acc, "supply")), - unrealized: createUnrealizedPattern(client, acc), - }; -} - -/** - * @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, _m(acc, "utxo_count")), - realized: createRealizedPattern2(client, acc), - relative: createRelativePattern2(client, acc), + relative: createRelativePattern(client, acc), supply: createSupplyPattern2(client, _m(acc, "supply")), unrealized: createUnrealizedPattern(client, acc), }; @@ -3878,6 +2933,35 @@ function createPeriodCagrPattern(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, _m(acc, "utxo_count")), + realized: createRealizedPattern(client, acc), + relative: createRelativePattern4(client, _m(acc, "supply_in")), + supply: createSupplyPattern2(client, _m(acc, "supply")), + unrealized: createUnrealizedPattern(client, acc), + }; +} + /** * @typedef {Object} ActivityPattern2 * @property {BlockCountPattern} coinblocksDestroyed @@ -3940,90 +3024,6 @@ function createSplitPattern2(client, acc) { }; } -/** - * @typedef {Object} CostBasisPattern2 - * @property {MetricPattern1} max - * @property {MetricPattern1} min - * @property {PercentilesPattern} percentiles - */ - -/** - * Create a CostBasisPattern2 pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {CostBasisPattern2} - */ -function createCostBasisPattern2(client, acc) { - return { - max: createMetricPattern1(client, _m(acc, "max_cost_basis")), - min: createMetricPattern1(client, _m(acc, "min_cost_basis")), - percentiles: createPercentilesPattern(client, _m(acc, "cost_basis")), - }; -} - -/** - * @typedef {Object} CoinbasePattern - * @property {BitcoinPattern} bitcoin - * @property {DollarsPattern} dollars - * @property {DollarsPattern} sats - */ - -/** - * Create a CoinbasePattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {CoinbasePattern} - */ -function createCoinbasePattern(client, acc) { - return { - bitcoin: createBitcoinPattern(client, _m(acc, "btc")), - dollars: createDollarsPattern(client, _m(acc, "usd")), - sats: createDollarsPattern(client, acc), - }; -} - -/** - * @typedef {Object} _2015Pattern - * @property {MetricPattern4} bitcoin - * @property {MetricPattern4} dollars - * @property {MetricPattern4} sats - */ - -/** - * Create a _2015Pattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {_2015Pattern} - */ -function create_2015Pattern(client, acc) { - return { - bitcoin: createMetricPattern4(client, _m(acc, "btc")), - dollars: createMetricPattern4(client, _m(acc, "usd")), - sats: createMetricPattern4(client, acc), - }; -} - -/** - * @typedef {Object} ActiveSupplyPattern - * @property {MetricPattern1} bitcoin - * @property {MetricPattern1} dollars - * @property {MetricPattern1} sats - */ - -/** - * Create a ActiveSupplyPattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {ActiveSupplyPattern} - */ -function createActiveSupplyPattern(client, acc) { - return { - bitcoin: createMetricPattern1(client, _m(acc, "btc")), - dollars: createMetricPattern1(client, _m(acc, "usd")), - sats: createMetricPattern1(client, acc), - }; -} - /** * @typedef {Object} SegwitAdoptionPattern * @property {MetricPattern11} base @@ -4045,27 +3045,6 @@ function createSegwitAdoptionPattern(client, acc) { }; } -/** - * @typedef {Object} CoinbasePattern2 - * @property {BlockCountPattern} bitcoin - * @property {BlockCountPattern} dollars - * @property {BlockCountPattern} sats - */ - -/** - * Create a CoinbasePattern2 pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {CoinbasePattern2} - */ -function createCoinbasePattern2(client, acc) { - return { - bitcoin: createBlockCountPattern(client, _m(acc, "btc")), - dollars: createBlockCountPattern(client, _m(acc, "usd")), - sats: createBlockCountPattern(client, acc), - }; -} - /** * @typedef {Object} UnclaimedRewardsPattern * @property {BitcoinPattern2} bitcoin @@ -4088,40 +3067,107 @@ function createUnclaimedRewardsPattern(client, acc) { } /** - * @typedef {Object} _1dReturns1mSdPattern - * @property {MetricPattern4} sd - * @property {MetricPattern4} sma + * @typedef {Object} _2015Pattern + * @property {MetricPattern4} bitcoin + * @property {MetricPattern4} dollars + * @property {MetricPattern4} sats */ /** - * Create a _1dReturns1mSdPattern pattern node + * Create a _2015Pattern pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {_1dReturns1mSdPattern} + * @returns {_2015Pattern} */ -function create_1dReturns1mSdPattern(client, acc) { +function create_2015Pattern(client, acc) { return { - sd: createMetricPattern4(client, _m(acc, "sd")), - sma: createMetricPattern4(client, _m(acc, "sma")), + bitcoin: createMetricPattern4(client, _m(acc, "btc")), + dollars: createMetricPattern4(client, _m(acc, "usd")), + sats: createMetricPattern4(client, acc), }; } /** - * @typedef {Object} SupplyPattern2 - * @property {ActiveSupplyPattern} halved - * @property {ActiveSupplyPattern} total + * @typedef {Object} CostBasisPattern2 + * @property {MetricPattern1} max + * @property {MetricPattern1} min + * @property {PercentilesPattern} percentiles */ /** - * Create a SupplyPattern2 pattern node + * Create a CostBasisPattern2 pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {SupplyPattern2} + * @returns {CostBasisPattern2} */ -function createSupplyPattern2(client, acc) { +function createCostBasisPattern2(client, acc) { return { - halved: createActiveSupplyPattern(client, _m(acc, "halved")), - total: createActiveSupplyPattern(client, acc), + max: createMetricPattern1(client, _m(acc, "max_cost_basis")), + min: createMetricPattern1(client, _m(acc, "min_cost_basis")), + percentiles: createPercentilesPattern(client, _m(acc, "cost_basis")), + }; +} + +/** + * @typedef {Object} CoinbasePattern2 + * @property {BlockCountPattern} bitcoin + * @property {BlockCountPattern} dollars + * @property {BlockCountPattern} sats + */ + +/** + * Create a CoinbasePattern2 pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {CoinbasePattern2} + */ +function createCoinbasePattern2(client, acc) { + return { + bitcoin: createBlockCountPattern(client, _m(acc, "btc")), + dollars: createBlockCountPattern(client, _m(acc, "usd")), + sats: createBlockCountPattern(client, acc), + }; +} + +/** + * @typedef {Object} ActiveSupplyPattern + * @property {MetricPattern1} bitcoin + * @property {MetricPattern1} dollars + * @property {MetricPattern1} sats + */ + +/** + * Create a ActiveSupplyPattern pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {ActiveSupplyPattern} + */ +function createActiveSupplyPattern(client, acc) { + return { + bitcoin: createMetricPattern1(client, _m(acc, "btc")), + dollars: createMetricPattern1(client, _m(acc, "usd")), + sats: createMetricPattern1(client, acc), + }; +} + +/** + * @typedef {Object} CoinbasePattern + * @property {BitcoinPattern} bitcoin + * @property {DollarsPattern} dollars + * @property {DollarsPattern} sats + */ + +/** + * Create a CoinbasePattern pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {CoinbasePattern} + */ +function createCoinbasePattern(client, acc) { + return { + bitcoin: createBitcoinPattern(client, _m(acc, "btc")), + dollars: createDollarsPattern(client, _m(acc, "usd")), + sats: createDollarsPattern(client, acc), }; } @@ -4150,6 +3196,25 @@ function createRelativePattern4(client, acc) { }; } +/** + * @typedef {Object} _1dReturns1mSdPattern + * @property {MetricPattern4} sd + * @property {MetricPattern4} sma + */ + +/** + * Create a _1dReturns1mSdPattern pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {_1dReturns1mSdPattern} + */ +function create_1dReturns1mSdPattern(client, acc) { + return { + sd: createMetricPattern4(client, _m(acc, "sd")), + sma: createMetricPattern4(client, _m(acc, "sma")), + }; +} + /** * @typedef {Object} CostBasisPattern * @property {MetricPattern1} max @@ -4169,6 +3234,46 @@ function createCostBasisPattern(client, acc) { }; } +/** + * @typedef {Object} SupplyPattern2 + * @property {ActiveSupplyPattern} halved + * @property {ActiveSupplyPattern} total + */ + +/** + * Create a SupplyPattern2 pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {SupplyPattern2} + */ +function createSupplyPattern2(client, acc) { + return { + halved: createActiveSupplyPattern(client, _m(acc, "halved")), + total: createActiveSupplyPattern(client, acc), + }; +} + +/** + * @template T + * @typedef {Object} SatsPattern + * @property {MetricPattern1} ohlc + * @property {SplitPattern2} split + */ + +/** + * Create a SatsPattern pattern node + * @template T + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {SatsPattern} + */ +function createSatsPattern(client, acc) { + return { + ohlc: createMetricPattern1(client, _m(acc, "ohlc")), + split: createSplitPattern2(client, acc), + }; +} + /** * @template T * @typedef {Object} BitcoinPattern2 @@ -4211,27 +3316,6 @@ function createBlockCountPattern(client, acc) { }; } -/** - * @template T - * @typedef {Object} SatsPattern - * @property {MetricPattern1} ohlc - * @property {SplitPattern2} split - */ - -/** - * Create a SatsPattern pattern node - * @template T - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {SatsPattern} - */ -function createSatsPattern(client, acc) { - return { - ohlc: createMetricPattern1(client, _m(acc, "ohlc_sats")), - split: createSplitPattern2(client, _m(acc, "sats")), - }; -} - /** * @typedef {Object} RealizedPriceExtraPattern * @property {MetricPattern4} ratio @@ -7337,8 +6421,8 @@ function createOutputsPattern(client, acc) { /** * @typedef {Object} MetricsTree_Market_Dca - * @property {MetricsTree_Market_Dca_ClassAveragePrice} classAveragePrice - * @property {ClassAveragePricePattern} classReturns + * @property {ClassAveragePricePattern} classAveragePrice + * @property {MetricsTree_Market_Dca_ClassReturns} classReturns * @property {MetricsTree_Market_Dca_ClassStack} classStack * @property {PeriodAveragePricePattern} periodAveragePrice * @property {PeriodCagrPattern} periodCagr @@ -7348,18 +6432,18 @@ function createOutputsPattern(client, acc) { */ /** - * @typedef {Object} MetricsTree_Market_Dca_ClassAveragePrice - * @property {MetricPattern4} _2015 - * @property {MetricPattern4} _2016 - * @property {MetricPattern4} _2017 - * @property {MetricPattern4} _2018 - * @property {MetricPattern4} _2019 - * @property {MetricPattern4} _2020 - * @property {MetricPattern4} _2021 - * @property {MetricPattern4} _2022 - * @property {MetricPattern4} _2023 - * @property {MetricPattern4} _2024 - * @property {MetricPattern4} _2025 + * @typedef {Object} MetricsTree_Market_Dca_ClassReturns + * @property {MetricPattern4} _2015 + * @property {MetricPattern4} _2016 + * @property {MetricPattern4} _2017 + * @property {MetricPattern4} _2018 + * @property {MetricPattern4} _2019 + * @property {MetricPattern4} _2020 + * @property {MetricPattern4} _2021 + * @property {MetricPattern4} _2022 + * @property {MetricPattern4} _2023 + * @property {MetricPattern4} _2024 + * @property {MetricPattern4} _2025 */ /** @@ -13758,20 +12842,20 @@ class BrkClient extends BrkClientBase { ), }, 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"), + classAveragePrice: createClassAveragePricePattern(this, "dca_class"), + 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"), }, - classReturns: createClassAveragePricePattern(this, "dca_class"), classStack: { _2015: create_2015Pattern(this, "dca_class_2015_stack"), _2016: create_2015Pattern(this, "dca_class_2016_stack"), diff --git a/packages/brk_client/brk_client/__init__.py b/packages/brk_client/brk_client/__init__.py index f00671390..4c3f544c5 100644 --- a/packages/brk_client/brk_client/__init__.py +++ b/packages/brk_client/brk_client/__init__.py @@ -1610,1308 +1610,905 @@ class MetricPattern(Protocol[T]): ... +# Static index tuples +_i1 = ( + "dateindex", + "decadeindex", + "difficultyepoch", + "height", + "monthindex", + "quarterindex", + "semesterindex", + "weekindex", + "yearindex", +) +_i2 = ( + "dateindex", + "decadeindex", + "difficultyepoch", + "monthindex", + "quarterindex", + "semesterindex", + "weekindex", + "yearindex", +) +_i3 = ( + "dateindex", + "decadeindex", + "height", + "monthindex", + "quarterindex", + "semesterindex", + "weekindex", + "yearindex", +) +_i4 = ( + "dateindex", + "decadeindex", + "monthindex", + "quarterindex", + "semesterindex", + "weekindex", + "yearindex", +) +_i5 = ("dateindex", "height") +_i6 = ("dateindex",) +_i7 = ("decadeindex",) +_i8 = ("difficultyepoch",) +_i9 = ("emptyoutputindex",) +_i10 = ("halvingepoch",) +_i11 = ("height",) +_i12 = ("txinindex",) +_i13 = ("monthindex",) +_i14 = ("opreturnindex",) +_i15 = ("txoutindex",) +_i16 = ("p2aaddressindex",) +_i17 = ("p2msoutputindex",) +_i18 = ("p2pk33addressindex",) +_i19 = ("p2pk65addressindex",) +_i20 = ("p2pkhaddressindex",) +_i21 = ("p2shaddressindex",) +_i22 = ("p2traddressindex",) +_i23 = ("p2wpkhaddressindex",) +_i24 = ("p2wshaddressindex",) +_i25 = ("quarterindex",) +_i26 = ("semesterindex",) +_i27 = ("txindex",) +_i28 = ("unknownoutputindex",) +_i29 = ("weekindex",) +_i30 = ("yearindex",) +_i31 = ("loadedaddressindex",) +_i32 = ("emptyaddressindex",) + + +def _ep(c: BrkClientBase, n: str, i: Index) -> MetricEndpointBuilder: + return MetricEndpointBuilder(c, n, i) + + # 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 __init__(self, c: BrkClientBase, n: str): + self._c, self._n = c, n def dateindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "dateindex") + return _ep(self._c, self._n, "dateindex") def decadeindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "decadeindex") + return _ep(self._c, self._n, "decadeindex") def difficultyepoch(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "difficultyepoch") + return _ep(self._c, self._n, "difficultyepoch") def height(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "height") + return _ep(self._c, self._n, "height") def monthindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "monthindex") + return _ep(self._c, self._n, "monthindex") def quarterindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "quarterindex") + return _ep(self._c, self._n, "quarterindex") def semesterindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "semesterindex") + return _ep(self._c, self._n, "semesterindex") def weekindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "weekindex") + return _ep(self._c, self._n, "weekindex") def yearindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "yearindex") + return _ep(self._c, self._n, "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 - self.by: _MetricPattern1By[T] = _MetricPattern1By(client, name) + def __init__(self, c: BrkClientBase, n: str): + self._n, self.by = n, _MetricPattern1By(c, n) @property def name(self) -> str: - """Get the metric name.""" - return self._name + return self._n def indexes(self) -> List[str]: - """Get the list of available indexes.""" - return [ - "dateindex", - "decadeindex", - "difficultyepoch", - "height", - "monthindex", - "quarterindex", - "semesterindex", - "weekindex", - "yearindex", - ] + return list(_i1) 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() - return None + return _ep(self.by._c, self._n, index) if index in _i1 else None class _MetricPattern2By(Generic[T]): - """Index endpoint methods container.""" - - def __init__(self, client: BrkClientBase, name: str): - self._client = client - self._name = name + def __init__(self, c: BrkClientBase, n: str): + self._c, self._n = c, n def dateindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "dateindex") + return _ep(self._c, self._n, "dateindex") def decadeindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "decadeindex") + return _ep(self._c, self._n, "decadeindex") def difficultyepoch(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "difficultyepoch") + return _ep(self._c, self._n, "difficultyepoch") def monthindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "monthindex") + return _ep(self._c, self._n, "monthindex") def quarterindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "quarterindex") + return _ep(self._c, self._n, "quarterindex") def semesterindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "semesterindex") + return _ep(self._c, self._n, "semesterindex") def weekindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "weekindex") + return _ep(self._c, self._n, "weekindex") def yearindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "yearindex") + return _ep(self._c, self._n, "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 - self.by: _MetricPattern2By[T] = _MetricPattern2By(client, name) + def __init__(self, c: BrkClientBase, n: str): + self._n, self.by = n, _MetricPattern2By(c, n) @property def name(self) -> str: - """Get the metric name.""" - return self._name + return self._n def indexes(self) -> List[str]: - """Get the list of available indexes.""" - return [ - "dateindex", - "decadeindex", - "difficultyepoch", - "monthindex", - "quarterindex", - "semesterindex", - "weekindex", - "yearindex", - ] + return list(_i2) 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() - return None + return _ep(self.by._c, self._n, index) if index in _i2 else None class _MetricPattern3By(Generic[T]): - """Index endpoint methods container.""" - - def __init__(self, client: BrkClientBase, name: str): - self._client = client - self._name = name + def __init__(self, c: BrkClientBase, n: str): + self._c, self._n = c, n def dateindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "dateindex") + return _ep(self._c, self._n, "dateindex") def decadeindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "decadeindex") + return _ep(self._c, self._n, "decadeindex") def height(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "height") + return _ep(self._c, self._n, "height") def monthindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "monthindex") + return _ep(self._c, self._n, "monthindex") def quarterindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "quarterindex") + return _ep(self._c, self._n, "quarterindex") def semesterindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "semesterindex") + return _ep(self._c, self._n, "semesterindex") def weekindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "weekindex") + return _ep(self._c, self._n, "weekindex") def yearindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "yearindex") + return _ep(self._c, self._n, "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 - self.by: _MetricPattern3By[T] = _MetricPattern3By(client, name) + def __init__(self, c: BrkClientBase, n: str): + self._n, self.by = n, _MetricPattern3By(c, n) @property def name(self) -> str: - """Get the metric name.""" - return self._name + return self._n def indexes(self) -> List[str]: - """Get the list of available indexes.""" - return [ - "dateindex", - "decadeindex", - "height", - "monthindex", - "quarterindex", - "semesterindex", - "weekindex", - "yearindex", - ] + return list(_i3) 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() - return None + return _ep(self.by._c, self._n, index) if index in _i3 else None class _MetricPattern4By(Generic[T]): - """Index endpoint methods container.""" - - def __init__(self, client: BrkClientBase, name: str): - self._client = client - self._name = name + def __init__(self, c: BrkClientBase, n: str): + self._c, self._n = c, n def dateindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "dateindex") + return _ep(self._c, self._n, "dateindex") def decadeindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "decadeindex") + return _ep(self._c, self._n, "decadeindex") def monthindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "monthindex") + return _ep(self._c, self._n, "monthindex") def quarterindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "quarterindex") + return _ep(self._c, self._n, "quarterindex") def semesterindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "semesterindex") + return _ep(self._c, self._n, "semesterindex") def weekindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "weekindex") + return _ep(self._c, self._n, "weekindex") def yearindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "yearindex") + return _ep(self._c, self._n, "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 - self.by: _MetricPattern4By[T] = _MetricPattern4By(client, name) + def __init__(self, c: BrkClientBase, n: str): + self._n, self.by = n, _MetricPattern4By(c, n) @property def name(self) -> str: - """Get the metric name.""" - return self._name + return self._n def indexes(self) -> List[str]: - """Get the list of available indexes.""" - return [ - "dateindex", - "decadeindex", - "monthindex", - "quarterindex", - "semesterindex", - "weekindex", - "yearindex", - ] + return list(_i4) 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() - return None + return _ep(self.by._c, self._n, index) if index in _i4 else None class _MetricPattern5By(Generic[T]): - """Index endpoint methods container.""" - - def __init__(self, client: BrkClientBase, name: str): - self._client = client - self._name = name + def __init__(self, c: BrkClientBase, n: str): + self._c, self._n = c, n def dateindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "dateindex") + return _ep(self._c, self._n, "dateindex") def height(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "height") + return _ep(self._c, self._n, "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 - self.by: _MetricPattern5By[T] = _MetricPattern5By(client, name) + def __init__(self, c: BrkClientBase, n: str): + self._n, self.by = n, _MetricPattern5By(c, n) @property def name(self) -> str: - """Get the metric name.""" - return self._name + return self._n def indexes(self) -> List[str]: - """Get the list of available indexes.""" - return ["dateindex", "height"] + return list(_i5) 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() - return None + return _ep(self.by._c, self._n, index) if index in _i5 else None class _MetricPattern6By(Generic[T]): - """Index endpoint methods container.""" - - def __init__(self, client: BrkClientBase, name: str): - self._client = client - self._name = name + def __init__(self, c: BrkClientBase, n: str): + self._c, self._n = c, n def dateindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "dateindex") + return _ep(self._c, self._n, "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 - self.by: _MetricPattern6By[T] = _MetricPattern6By(client, name) + def __init__(self, c: BrkClientBase, n: str): + self._n, self.by = n, _MetricPattern6By(c, n) @property def name(self) -> str: - """Get the metric name.""" - return self._name + return self._n def indexes(self) -> List[str]: - """Get the list of available indexes.""" - return ["dateindex"] + return list(_i6) 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() - return None + return _ep(self.by._c, self._n, index) if index in _i6 else None class _MetricPattern7By(Generic[T]): - """Index endpoint methods container.""" - - def __init__(self, client: BrkClientBase, name: str): - self._client = client - self._name = name + def __init__(self, c: BrkClientBase, n: str): + self._c, self._n = c, n def decadeindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "decadeindex") + return _ep(self._c, self._n, "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 - self.by: _MetricPattern7By[T] = _MetricPattern7By(client, name) + def __init__(self, c: BrkClientBase, n: str): + self._n, self.by = n, _MetricPattern7By(c, n) @property def name(self) -> str: - """Get the metric name.""" - return self._name + return self._n def indexes(self) -> List[str]: - """Get the list of available indexes.""" - return ["decadeindex"] + return list(_i7) 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() - return None + return _ep(self.by._c, self._n, index) if index in _i7 else None class _MetricPattern8By(Generic[T]): - """Index endpoint methods container.""" - - def __init__(self, client: BrkClientBase, name: str): - self._client = client - self._name = name + def __init__(self, c: BrkClientBase, n: str): + self._c, self._n = c, n def difficultyepoch(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "difficultyepoch") + return _ep(self._c, self._n, "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 - self.by: _MetricPattern8By[T] = _MetricPattern8By(client, name) + def __init__(self, c: BrkClientBase, n: str): + self._n, self.by = n, _MetricPattern8By(c, n) @property def name(self) -> str: - """Get the metric name.""" - return self._name + return self._n def indexes(self) -> List[str]: - """Get the list of available indexes.""" - return ["difficultyepoch"] + return list(_i8) 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() - return None + return _ep(self.by._c, self._n, index) if index in _i8 else None class _MetricPattern9By(Generic[T]): - """Index endpoint methods container.""" - - def __init__(self, client: BrkClientBase, name: str): - self._client = client - self._name = name + def __init__(self, c: BrkClientBase, n: str): + self._c, self._n = c, n def emptyoutputindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "emptyoutputindex") + return _ep(self._c, self._n, "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 - self.by: _MetricPattern9By[T] = _MetricPattern9By(client, name) + def __init__(self, c: BrkClientBase, n: str): + self._n, self.by = n, _MetricPattern9By(c, n) @property def name(self) -> str: - """Get the metric name.""" - return self._name + return self._n def indexes(self) -> List[str]: - """Get the list of available indexes.""" - return ["emptyoutputindex"] + return list(_i9) 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() - return None + return _ep(self.by._c, self._n, index) if index in _i9 else None class _MetricPattern10By(Generic[T]): - """Index endpoint methods container.""" - - def __init__(self, client: BrkClientBase, name: str): - self._client = client - self._name = name + def __init__(self, c: BrkClientBase, n: str): + self._c, self._n = c, n def halvingepoch(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "halvingepoch") + return _ep(self._c, self._n, "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 - self.by: _MetricPattern10By[T] = _MetricPattern10By(client, name) + def __init__(self, c: BrkClientBase, n: str): + self._n, self.by = n, _MetricPattern10By(c, n) @property def name(self) -> str: - """Get the metric name.""" - return self._name + return self._n def indexes(self) -> List[str]: - """Get the list of available indexes.""" - return ["halvingepoch"] + return list(_i10) 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() - return None + return _ep(self.by._c, self._n, index) if index in _i10 else None class _MetricPattern11By(Generic[T]): - """Index endpoint methods container.""" - - def __init__(self, client: BrkClientBase, name: str): - self._client = client - self._name = name + def __init__(self, c: BrkClientBase, n: str): + self._c, self._n = c, n def height(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "height") + return _ep(self._c, self._n, "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 - self.by: _MetricPattern11By[T] = _MetricPattern11By(client, name) + def __init__(self, c: BrkClientBase, n: str): + self._n, self.by = n, _MetricPattern11By(c, n) @property def name(self) -> str: - """Get the metric name.""" - return self._name + return self._n def indexes(self) -> List[str]: - """Get the list of available indexes.""" - return ["height"] + return list(_i11) 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() - return None + return _ep(self.by._c, self._n, index) if index in _i11 else None class _MetricPattern12By(Generic[T]): - """Index endpoint methods container.""" - - def __init__(self, client: BrkClientBase, name: str): - self._client = client - self._name = name + def __init__(self, c: BrkClientBase, n: str): + self._c, self._n = c, n def txinindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "txinindex") + return _ep(self._c, self._n, "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 - self.by: _MetricPattern12By[T] = _MetricPattern12By(client, name) + def __init__(self, c: BrkClientBase, n: str): + self._n, self.by = n, _MetricPattern12By(c, n) @property def name(self) -> str: - """Get the metric name.""" - return self._name + return self._n def indexes(self) -> List[str]: - """Get the list of available indexes.""" - return ["txinindex"] + return list(_i12) 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() - return None + return _ep(self.by._c, self._n, index) if index in _i12 else None class _MetricPattern13By(Generic[T]): - """Index endpoint methods container.""" - - def __init__(self, client: BrkClientBase, name: str): - self._client = client - self._name = name + def __init__(self, c: BrkClientBase, n: str): + self._c, self._n = c, n def monthindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "monthindex") + return _ep(self._c, self._n, "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 - self.by: _MetricPattern13By[T] = _MetricPattern13By(client, name) + def __init__(self, c: BrkClientBase, n: str): + self._n, self.by = n, _MetricPattern13By(c, n) @property def name(self) -> str: - """Get the metric name.""" - return self._name + return self._n def indexes(self) -> List[str]: - """Get the list of available indexes.""" - return ["monthindex"] + return list(_i13) 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() - return None + return _ep(self.by._c, self._n, index) if index in _i13 else None class _MetricPattern14By(Generic[T]): - """Index endpoint methods container.""" - - def __init__(self, client: BrkClientBase, name: str): - self._client = client - self._name = name + def __init__(self, c: BrkClientBase, n: str): + self._c, self._n = c, n def opreturnindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "opreturnindex") + return _ep(self._c, self._n, "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 - self.by: _MetricPattern14By[T] = _MetricPattern14By(client, name) + def __init__(self, c: BrkClientBase, n: str): + self._n, self.by = n, _MetricPattern14By(c, n) @property def name(self) -> str: - """Get the metric name.""" - return self._name + return self._n def indexes(self) -> List[str]: - """Get the list of available indexes.""" - return ["opreturnindex"] + return list(_i14) 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() - return None + return _ep(self.by._c, self._n, index) if index in _i14 else None class _MetricPattern15By(Generic[T]): - """Index endpoint methods container.""" - - def __init__(self, client: BrkClientBase, name: str): - self._client = client - self._name = name + def __init__(self, c: BrkClientBase, n: str): + self._c, self._n = c, n def txoutindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "txoutindex") + return _ep(self._c, self._n, "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 - self.by: _MetricPattern15By[T] = _MetricPattern15By(client, name) + def __init__(self, c: BrkClientBase, n: str): + self._n, self.by = n, _MetricPattern15By(c, n) @property def name(self) -> str: - """Get the metric name.""" - return self._name + return self._n def indexes(self) -> List[str]: - """Get the list of available indexes.""" - return ["txoutindex"] + return list(_i15) 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() - return None + return _ep(self.by._c, self._n, index) if index in _i15 else None class _MetricPattern16By(Generic[T]): - """Index endpoint methods container.""" - - def __init__(self, client: BrkClientBase, name: str): - self._client = client - self._name = name + def __init__(self, c: BrkClientBase, n: str): + self._c, self._n = c, n def p2aaddressindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "p2aaddressindex") + return _ep(self._c, self._n, "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 - self.by: _MetricPattern16By[T] = _MetricPattern16By(client, name) + def __init__(self, c: BrkClientBase, n: str): + self._n, self.by = n, _MetricPattern16By(c, n) @property def name(self) -> str: - """Get the metric name.""" - return self._name + return self._n def indexes(self) -> List[str]: - """Get the list of available indexes.""" - return ["p2aaddressindex"] + return list(_i16) 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() - return None + return _ep(self.by._c, self._n, index) if index in _i16 else None class _MetricPattern17By(Generic[T]): - """Index endpoint methods container.""" - - def __init__(self, client: BrkClientBase, name: str): - self._client = client - self._name = name + def __init__(self, c: BrkClientBase, n: str): + self._c, self._n = c, n def p2msoutputindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "p2msoutputindex") + return _ep(self._c, self._n, "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 - self.by: _MetricPattern17By[T] = _MetricPattern17By(client, name) + def __init__(self, c: BrkClientBase, n: str): + self._n, self.by = n, _MetricPattern17By(c, n) @property def name(self) -> str: - """Get the metric name.""" - return self._name + return self._n def indexes(self) -> List[str]: - """Get the list of available indexes.""" - return ["p2msoutputindex"] + return list(_i17) 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() - return None + return _ep(self.by._c, self._n, index) if index in _i17 else None class _MetricPattern18By(Generic[T]): - """Index endpoint methods container.""" - - def __init__(self, client: BrkClientBase, name: str): - self._client = client - self._name = name + def __init__(self, c: BrkClientBase, n: str): + self._c, self._n = c, n def p2pk33addressindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "p2pk33addressindex") + return _ep(self._c, self._n, "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 - self.by: _MetricPattern18By[T] = _MetricPattern18By(client, name) + def __init__(self, c: BrkClientBase, n: str): + self._n, self.by = n, _MetricPattern18By(c, n) @property def name(self) -> str: - """Get the metric name.""" - return self._name + return self._n def indexes(self) -> List[str]: - """Get the list of available indexes.""" - return ["p2pk33addressindex"] + return list(_i18) 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() - return None + return _ep(self.by._c, self._n, index) if index in _i18 else None class _MetricPattern19By(Generic[T]): - """Index endpoint methods container.""" - - def __init__(self, client: BrkClientBase, name: str): - self._client = client - self._name = name + def __init__(self, c: BrkClientBase, n: str): + self._c, self._n = c, n def p2pk65addressindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "p2pk65addressindex") + return _ep(self._c, self._n, "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 - self.by: _MetricPattern19By[T] = _MetricPattern19By(client, name) + def __init__(self, c: BrkClientBase, n: str): + self._n, self.by = n, _MetricPattern19By(c, n) @property def name(self) -> str: - """Get the metric name.""" - return self._name + return self._n def indexes(self) -> List[str]: - """Get the list of available indexes.""" - return ["p2pk65addressindex"] + return list(_i19) 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() - return None + return _ep(self.by._c, self._n, index) if index in _i19 else None class _MetricPattern20By(Generic[T]): - """Index endpoint methods container.""" - - def __init__(self, client: BrkClientBase, name: str): - self._client = client - self._name = name + def __init__(self, c: BrkClientBase, n: str): + self._c, self._n = c, n def p2pkhaddressindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "p2pkhaddressindex") + return _ep(self._c, self._n, "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 - self.by: _MetricPattern20By[T] = _MetricPattern20By(client, name) + def __init__(self, c: BrkClientBase, n: str): + self._n, self.by = n, _MetricPattern20By(c, n) @property def name(self) -> str: - """Get the metric name.""" - return self._name + return self._n def indexes(self) -> List[str]: - """Get the list of available indexes.""" - return ["p2pkhaddressindex"] + return list(_i20) 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() - return None + return _ep(self.by._c, self._n, index) if index in _i20 else None class _MetricPattern21By(Generic[T]): - """Index endpoint methods container.""" - - def __init__(self, client: BrkClientBase, name: str): - self._client = client - self._name = name + def __init__(self, c: BrkClientBase, n: str): + self._c, self._n = c, n def p2shaddressindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "p2shaddressindex") + return _ep(self._c, self._n, "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 - self.by: _MetricPattern21By[T] = _MetricPattern21By(client, name) + def __init__(self, c: BrkClientBase, n: str): + self._n, self.by = n, _MetricPattern21By(c, n) @property def name(self) -> str: - """Get the metric name.""" - return self._name + return self._n def indexes(self) -> List[str]: - """Get the list of available indexes.""" - return ["p2shaddressindex"] + return list(_i21) 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() - return None + return _ep(self.by._c, self._n, index) if index in _i21 else None class _MetricPattern22By(Generic[T]): - """Index endpoint methods container.""" - - def __init__(self, client: BrkClientBase, name: str): - self._client = client - self._name = name + def __init__(self, c: BrkClientBase, n: str): + self._c, self._n = c, n def p2traddressindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "p2traddressindex") + return _ep(self._c, self._n, "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 - self.by: _MetricPattern22By[T] = _MetricPattern22By(client, name) + def __init__(self, c: BrkClientBase, n: str): + self._n, self.by = n, _MetricPattern22By(c, n) @property def name(self) -> str: - """Get the metric name.""" - return self._name + return self._n def indexes(self) -> List[str]: - """Get the list of available indexes.""" - return ["p2traddressindex"] + return list(_i22) 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() - return None + return _ep(self.by._c, self._n, index) if index in _i22 else None class _MetricPattern23By(Generic[T]): - """Index endpoint methods container.""" - - def __init__(self, client: BrkClientBase, name: str): - self._client = client - self._name = name + def __init__(self, c: BrkClientBase, n: str): + self._c, self._n = c, n def p2wpkhaddressindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "p2wpkhaddressindex") + return _ep(self._c, self._n, "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 - self.by: _MetricPattern23By[T] = _MetricPattern23By(client, name) + def __init__(self, c: BrkClientBase, n: str): + self._n, self.by = n, _MetricPattern23By(c, n) @property def name(self) -> str: - """Get the metric name.""" - return self._name + return self._n def indexes(self) -> List[str]: - """Get the list of available indexes.""" - return ["p2wpkhaddressindex"] + return list(_i23) 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() - return None + return _ep(self.by._c, self._n, index) if index in _i23 else None class _MetricPattern24By(Generic[T]): - """Index endpoint methods container.""" - - def __init__(self, client: BrkClientBase, name: str): - self._client = client - self._name = name + def __init__(self, c: BrkClientBase, n: str): + self._c, self._n = c, n def p2wshaddressindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "p2wshaddressindex") + return _ep(self._c, self._n, "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 - self.by: _MetricPattern24By[T] = _MetricPattern24By(client, name) + def __init__(self, c: BrkClientBase, n: str): + self._n, self.by = n, _MetricPattern24By(c, n) @property def name(self) -> str: - """Get the metric name.""" - return self._name + return self._n def indexes(self) -> List[str]: - """Get the list of available indexes.""" - return ["p2wshaddressindex"] + return list(_i24) 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() - return None + return _ep(self.by._c, self._n, index) if index in _i24 else None class _MetricPattern25By(Generic[T]): - """Index endpoint methods container.""" - - def __init__(self, client: BrkClientBase, name: str): - self._client = client - self._name = name + def __init__(self, c: BrkClientBase, n: str): + self._c, self._n = c, n def quarterindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "quarterindex") + return _ep(self._c, self._n, "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 - self.by: _MetricPattern25By[T] = _MetricPattern25By(client, name) + def __init__(self, c: BrkClientBase, n: str): + self._n, self.by = n, _MetricPattern25By(c, n) @property def name(self) -> str: - """Get the metric name.""" - return self._name + return self._n def indexes(self) -> List[str]: - """Get the list of available indexes.""" - return ["quarterindex"] + return list(_i25) 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() - return None + return _ep(self.by._c, self._n, index) if index in _i25 else None class _MetricPattern26By(Generic[T]): - """Index endpoint methods container.""" - - def __init__(self, client: BrkClientBase, name: str): - self._client = client - self._name = name + def __init__(self, c: BrkClientBase, n: str): + self._c, self._n = c, n def semesterindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "semesterindex") + return _ep(self._c, self._n, "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 - self.by: _MetricPattern26By[T] = _MetricPattern26By(client, name) + def __init__(self, c: BrkClientBase, n: str): + self._n, self.by = n, _MetricPattern26By(c, n) @property def name(self) -> str: - """Get the metric name.""" - return self._name + return self._n def indexes(self) -> List[str]: - """Get the list of available indexes.""" - return ["semesterindex"] + return list(_i26) 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() - return None + return _ep(self.by._c, self._n, index) if index in _i26 else None class _MetricPattern27By(Generic[T]): - """Index endpoint methods container.""" - - def __init__(self, client: BrkClientBase, name: str): - self._client = client - self._name = name + def __init__(self, c: BrkClientBase, n: str): + self._c, self._n = c, n def txindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "txindex") + return _ep(self._c, self._n, "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 - self.by: _MetricPattern27By[T] = _MetricPattern27By(client, name) + def __init__(self, c: BrkClientBase, n: str): + self._n, self.by = n, _MetricPattern27By(c, n) @property def name(self) -> str: - """Get the metric name.""" - return self._name + return self._n def indexes(self) -> List[str]: - """Get the list of available indexes.""" - return ["txindex"] + return list(_i27) 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() - return None + return _ep(self.by._c, self._n, index) if index in _i27 else None class _MetricPattern28By(Generic[T]): - """Index endpoint methods container.""" - - def __init__(self, client: BrkClientBase, name: str): - self._client = client - self._name = name + def __init__(self, c: BrkClientBase, n: str): + self._c, self._n = c, n def unknownoutputindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "unknownoutputindex") + return _ep(self._c, self._n, "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 - self.by: _MetricPattern28By[T] = _MetricPattern28By(client, name) + def __init__(self, c: BrkClientBase, n: str): + self._n, self.by = n, _MetricPattern28By(c, n) @property def name(self) -> str: - """Get the metric name.""" - return self._name + return self._n def indexes(self) -> List[str]: - """Get the list of available indexes.""" - return ["unknownoutputindex"] + return list(_i28) 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() - return None + return _ep(self.by._c, self._n, index) if index in _i28 else None class _MetricPattern29By(Generic[T]): - """Index endpoint methods container.""" - - def __init__(self, client: BrkClientBase, name: str): - self._client = client - self._name = name + def __init__(self, c: BrkClientBase, n: str): + self._c, self._n = c, n def weekindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "weekindex") + return _ep(self._c, self._n, "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 - self.by: _MetricPattern29By[T] = _MetricPattern29By(client, name) + def __init__(self, c: BrkClientBase, n: str): + self._n, self.by = n, _MetricPattern29By(c, n) @property def name(self) -> str: - """Get the metric name.""" - return self._name + return self._n def indexes(self) -> List[str]: - """Get the list of available indexes.""" - return ["weekindex"] + return list(_i29) 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() - return None + return _ep(self.by._c, self._n, index) if index in _i29 else None class _MetricPattern30By(Generic[T]): - """Index endpoint methods container.""" - - def __init__(self, client: BrkClientBase, name: str): - self._client = client - self._name = name + def __init__(self, c: BrkClientBase, n: str): + self._c, self._n = c, n def yearindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "yearindex") + return _ep(self._c, self._n, "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 - self.by: _MetricPattern30By[T] = _MetricPattern30By(client, name) + def __init__(self, c: BrkClientBase, n: str): + self._n, self.by = n, _MetricPattern30By(c, n) @property def name(self) -> str: - """Get the metric name.""" - return self._name + return self._n def indexes(self) -> List[str]: - """Get the list of available indexes.""" - return ["yearindex"] + return list(_i30) 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() - return None + return _ep(self.by._c, self._n, index) if index in _i30 else None class _MetricPattern31By(Generic[T]): - """Index endpoint methods container.""" - - def __init__(self, client: BrkClientBase, name: str): - self._client = client - self._name = name + def __init__(self, c: BrkClientBase, n: str): + self._c, self._n = c, n def loadedaddressindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "loadedaddressindex") + return _ep(self._c, self._n, "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 - self.by: _MetricPattern31By[T] = _MetricPattern31By(client, name) + def __init__(self, c: BrkClientBase, n: str): + self._n, self.by = n, _MetricPattern31By(c, n) @property def name(self) -> str: - """Get the metric name.""" - return self._name + return self._n def indexes(self) -> List[str]: - """Get the list of available indexes.""" - return ["loadedaddressindex"] + return list(_i31) 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() - return None + return _ep(self.by._c, self._n, index) if index in _i31 else None class _MetricPattern32By(Generic[T]): - """Index endpoint methods container.""" - - def __init__(self, client: BrkClientBase, name: str): - self._client = client - self._name = name + def __init__(self, c: BrkClientBase, n: str): + self._c, self._n = c, n def emptyaddressindex(self) -> MetricEndpointBuilder[T]: - return MetricEndpointBuilder(self._client, self._name, "emptyaddressindex") + return _ep(self._c, self._n, "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 - self.by: _MetricPattern32By[T] = _MetricPattern32By(client, name) + def __init__(self, c: BrkClientBase, n: str): + self._n, self.by = n, _MetricPattern32By(c, n) @property def name(self) -> str: - """Get the metric name.""" - return self._name + return self._n def indexes(self) -> List[str]: - """Get the list of available indexes.""" - return ["emptyaddressindex"] + return list(_i32) 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() - return None + return _ep(self.by._c, self._n, index) if index in _i32 else None # Reusable structural pattern classes @@ -3423,32 +3020,6 @@ class Price111dSmaPattern: self.ratio_sd: Ratio1ySdPattern = Ratio1ySdPattern(client, _m(acc, "ratio")) -class PercentilesPattern: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.pct05: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, "pct05")) - self.pct10: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, "pct10")) - self.pct15: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, "pct15")) - self.pct20: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, "pct20")) - self.pct25: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, "pct25")) - self.pct30: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, "pct30")) - self.pct35: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, "pct35")) - self.pct40: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, "pct40")) - self.pct45: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, "pct45")) - self.pct50: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, "pct50")) - self.pct55: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, "pct55")) - self.pct60: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, "pct60")) - self.pct65: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, "pct65")) - self.pct70: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, "pct70")) - self.pct75: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, "pct75")) - self.pct80: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, "pct80")) - self.pct85: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, "pct85")) - self.pct90: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, "pct90")) - self.pct95: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, "pct95")) - - class ActivePriceRatioPattern: """Pattern struct for repeated tree structure.""" @@ -3503,6 +3074,32 @@ class ActivePriceRatioPattern: 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.pct05: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, "pct05")) + self.pct10: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, "pct10")) + self.pct15: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, "pct15")) + self.pct20: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, "pct20")) + self.pct25: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, "pct25")) + self.pct30: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, "pct30")) + self.pct35: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, "pct35")) + self.pct40: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, "pct40")) + self.pct45: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, "pct45")) + self.pct50: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, "pct50")) + self.pct55: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, "pct55")) + self.pct60: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, "pct60")) + self.pct65: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, "pct65")) + self.pct70: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, "pct70")) + self.pct75: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, "pct75")) + self.pct80: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, "pct80")) + self.pct85: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, "pct85")) + self.pct90: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, "pct90")) + self.pct95: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, "pct95")) + + class RelativePattern5: """Pattern struct for repeated tree structure.""" @@ -3724,53 +3321,38 @@ class ClassAveragePricePattern(Generic[T]): def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self._2015: MetricPattern4[T] = MetricPattern4(client, _m(acc, "2015_returns")) - self._2016: MetricPattern4[T] = MetricPattern4(client, _m(acc, "2016_returns")) - self._2017: MetricPattern4[T] = MetricPattern4(client, _m(acc, "2017_returns")) - self._2018: MetricPattern4[T] = MetricPattern4(client, _m(acc, "2018_returns")) - self._2019: MetricPattern4[T] = MetricPattern4(client, _m(acc, "2019_returns")) - self._2020: MetricPattern4[T] = MetricPattern4(client, _m(acc, "2020_returns")) - self._2021: MetricPattern4[T] = MetricPattern4(client, _m(acc, "2021_returns")) - self._2022: MetricPattern4[T] = MetricPattern4(client, _m(acc, "2022_returns")) - self._2023: MetricPattern4[T] = MetricPattern4(client, _m(acc, "2023_returns")) - self._2024: MetricPattern4[T] = MetricPattern4(client, _m(acc, "2024_returns")) - self._2025: MetricPattern4[T] = MetricPattern4(client, _m(acc, "2025_returns")) - - -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._2015: MetricPattern4[T] = MetricPattern4( + client, _m(acc, "2015_average_price") ) - self.net_unrealized_pnl_rel_to_market_cap: MetricPattern1[StoredF32] = ( - MetricPattern1(client, _m(acc, "net_unrealized_pnl_rel_to_market_cap")) + self._2016: MetricPattern4[T] = MetricPattern4( + client, _m(acc, "2016_average_price") ) - 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._2017: MetricPattern4[T] = MetricPattern4( + client, _m(acc, "2017_average_price") ) - self.supply_in_loss_rel_to_own_supply: MetricPattern1[StoredF64] = ( - MetricPattern1(client, _m(acc, "supply_in_loss_rel_to_own_supply")) + self._2018: MetricPattern4[T] = MetricPattern4( + client, _m(acc, "2018_average_price") ) - self.supply_in_profit_rel_to_circulating_supply: MetricPattern1[StoredF64] = ( - MetricPattern1( - client, _m(acc, "supply_in_profit_rel_to_circulating_supply") - ) + self._2019: MetricPattern4[T] = MetricPattern4( + client, _m(acc, "2019_average_price") ) - self.supply_in_profit_rel_to_own_supply: MetricPattern1[StoredF64] = ( - MetricPattern1(client, _m(acc, "supply_in_profit_rel_to_own_supply")) + self._2020: MetricPattern4[T] = MetricPattern4( + client, _m(acc, "2020_average_price") ) - self.supply_rel_to_circulating_supply: MetricPattern4[StoredF64] = ( - MetricPattern4(client, _m(acc, "supply_rel_to_circulating_supply")) + self._2021: MetricPattern4[T] = MetricPattern4( + client, _m(acc, "2021_average_price") ) - self.unrealized_loss_rel_to_market_cap: MetricPattern1[StoredF32] = ( - MetricPattern1(client, _m(acc, "unrealized_loss_rel_to_market_cap")) + self._2022: MetricPattern4[T] = MetricPattern4( + client, _m(acc, "2022_average_price") ) - self.unrealized_profit_rel_to_market_cap: MetricPattern1[StoredF32] = ( - MetricPattern1(client, _m(acc, "unrealized_profit_rel_to_market_cap")) + self._2023: MetricPattern4[T] = MetricPattern4( + client, _m(acc, "2023_average_price") + ) + self._2024: MetricPattern4[T] = MetricPattern4( + client, _m(acc, "2024_average_price") + ) + self._2025: MetricPattern4[T] = MetricPattern4( + client, _m(acc, "2025_average_price") ) @@ -3819,6 +3401,43 @@ class RelativePattern2: ) +class RelativePattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.neg_unrealized_loss_rel_to_market_cap: MetricPattern1[StoredF32] = ( + MetricPattern1(client, _m(acc, "neg_unrealized_loss_rel_to_market_cap")) + ) + self.net_unrealized_pnl_rel_to_market_cap: MetricPattern1[StoredF32] = ( + MetricPattern1(client, _m(acc, "net_unrealized_pnl_rel_to_market_cap")) + ) + self.nupl: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, "nupl")) + self.supply_in_loss_rel_to_circulating_supply: MetricPattern1[StoredF64] = ( + MetricPattern1(client, _m(acc, "supply_in_loss_rel_to_circulating_supply")) + ) + self.supply_in_loss_rel_to_own_supply: MetricPattern1[StoredF64] = ( + MetricPattern1(client, _m(acc, "supply_in_loss_rel_to_own_supply")) + ) + self.supply_in_profit_rel_to_circulating_supply: MetricPattern1[StoredF64] = ( + MetricPattern1( + client, _m(acc, "supply_in_profit_rel_to_circulating_supply") + ) + ) + self.supply_in_profit_rel_to_own_supply: MetricPattern1[StoredF64] = ( + MetricPattern1(client, _m(acc, "supply_in_profit_rel_to_own_supply")) + ) + self.supply_rel_to_circulating_supply: MetricPattern4[StoredF64] = ( + MetricPattern4(client, _m(acc, "supply_rel_to_circulating_supply")) + ) + self.unrealized_loss_rel_to_market_cap: MetricPattern1[StoredF32] = ( + MetricPattern1(client, _m(acc, "unrealized_loss_rel_to_market_cap")) + ) + self.unrealized_profit_rel_to_market_cap: MetricPattern1[StoredF32] = ( + MetricPattern1(client, _m(acc, "unrealized_profit_rel_to_market_cap")) + ) + + class CountPattern2(Generic[T]): """Pattern struct for repeated tree structure.""" @@ -3909,20 +3528,6 @@ class _0satsPattern: 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, _m(acc, "utxo_count")) - self.realized: RealizedPattern = RealizedPattern(client, acc) - self.relative: RelativePattern = RelativePattern(client, acc) - self.supply: SupplyPattern2 = SupplyPattern2(client, _m(acc, "supply")) - self.unrealized: UnrealizedPattern = UnrealizedPattern(client, acc) - - class UnrealizedPattern: """Pattern struct for repeated tree structure.""" @@ -3951,6 +3556,20 @@ 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.activity: ActivityPattern2 = ActivityPattern2(client, acc) + self.cost_basis: CostBasisPattern2 = CostBasisPattern2(client, acc) + self.outputs: OutputsPattern = OutputsPattern(client, _m(acc, "utxo_count")) + self.realized: RealizedPattern2 = RealizedPattern2(client, acc) + self.relative: RelativePattern2 = RelativePattern2(client, acc) + self.supply: SupplyPattern2 = SupplyPattern2(client, _m(acc, "supply")) + self.unrealized: UnrealizedPattern = UnrealizedPattern(client, acc) + + class _10yPattern: """Pattern struct for repeated tree structure.""" @@ -3965,7 +3584,7 @@ class _10yPattern: self.unrealized: UnrealizedPattern = UnrealizedPattern(client, acc) -class _0satsPattern2: +class _100btcPattern: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -3974,21 +3593,7 @@ class _0satsPattern2: self.cost_basis: CostBasisPattern = CostBasisPattern(client, acc) self.outputs: OutputsPattern = OutputsPattern(client, _m(acc, "utxo_count")) self.realized: RealizedPattern = RealizedPattern(client, acc) - self.relative: RelativePattern4 = RelativePattern4(client, _m(acc, "supply_in")) - self.supply: SupplyPattern2 = SupplyPattern2(client, _m(acc, "supply")) - self.unrealized: UnrealizedPattern = UnrealizedPattern(client, acc) - - -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, _m(acc, "utxo_count")) - self.realized: RealizedPattern2 = RealizedPattern2(client, acc) - self.relative: RelativePattern2 = RelativePattern2(client, acc) + self.relative: RelativePattern = RelativePattern(client, acc) self.supply: SupplyPattern2 = SupplyPattern2(client, _m(acc, "supply")) self.unrealized: UnrealizedPattern = UnrealizedPattern(client, acc) @@ -4007,6 +3612,20 @@ class PeriodCagrPattern: self._8y: MetricPattern4[StoredF32] = MetricPattern4(client, _p("8y", 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, _m(acc, "utxo_count")) + self.realized: RealizedPattern = RealizedPattern(client, acc) + self.relative: RelativePattern4 = RelativePattern4(client, _m(acc, "supply_in")) + self.supply: SupplyPattern2 = SupplyPattern2(client, _m(acc, "supply")) + self.unrealized: UnrealizedPattern = UnrealizedPattern(client, acc) + + class ActivityPattern2: """Pattern struct for repeated tree structure.""" @@ -4040,6 +3659,40 @@ class SplitPattern2(Generic[T]): self.open: MetricPattern1[T] = MetricPattern1(client, _m(acc, "open")) +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 UnclaimedRewardsPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.bitcoin: BitcoinPattern2[Bitcoin] = BitcoinPattern2(client, _m(acc, "btc")) + self.dollars: BlockCountPattern[Dollars] = BlockCountPattern( + client, _m(acc, "usd") + ) + self.sats: BlockCountPattern[Sats] = BlockCountPattern(client, acc) + + +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.""" @@ -4056,48 +3709,6 @@ class CostBasisPattern2: ) -class CoinbasePattern: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.bitcoin: BitcoinPattern = BitcoinPattern(client, _m(acc, "btc")) - self.dollars: DollarsPattern[Dollars] = DollarsPattern(client, _m(acc, "usd")) - self.sats: DollarsPattern[Sats] = DollarsPattern(client, acc) - - -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 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.sats: MetricPattern1[Sats] = MetricPattern1(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 CoinbasePattern2: """Pattern struct for repeated tree structure.""" @@ -4112,36 +3723,24 @@ class CoinbasePattern2: self.sats: BlockCountPattern[Sats] = BlockCountPattern(client, acc) -class UnclaimedRewardsPattern: +class ActiveSupplyPattern: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.bitcoin: BitcoinPattern2[Bitcoin] = BitcoinPattern2(client, _m(acc, "btc")) - self.dollars: BlockCountPattern[Dollars] = BlockCountPattern( - client, _m(acc, "usd") - ) - self.sats: BlockCountPattern[Sats] = BlockCountPattern(client, acc) + self.bitcoin: MetricPattern1[Bitcoin] = MetricPattern1(client, _m(acc, "btc")) + self.dollars: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, "usd")) + self.sats: MetricPattern1[Sats] = MetricPattern1(client, acc) -class _1dReturns1mSdPattern: +class CoinbasePattern: """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")) - - -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, "halved") - ) - self.total: ActiveSupplyPattern = ActiveSupplyPattern(client, acc) + self.bitcoin: BitcoinPattern = BitcoinPattern(client, _m(acc, "btc")) + self.dollars: DollarsPattern[Dollars] = DollarsPattern(client, _m(acc, "usd")) + self.sats: DollarsPattern[Sats] = DollarsPattern(client, acc) class RelativePattern4: @@ -4157,6 +3756,15 @@ class RelativePattern4: ) +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")) + + class CostBasisPattern: """Pattern struct for repeated tree structure.""" @@ -4170,6 +3778,26 @@ class CostBasisPattern: ) +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, "halved") + ) + self.total: ActiveSupplyPattern = ActiveSupplyPattern(client, acc) + + +class SatsPattern(Generic[T]): + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.ohlc: MetricPattern1[T] = MetricPattern1(client, _m(acc, "ohlc")) + self.split: SplitPattern2[T] = SplitPattern2(client, acc) + + class BitcoinPattern2(Generic[T]): """Pattern struct for repeated tree structure.""" @@ -4192,15 +3820,6 @@ class BlockCountPattern(Generic[T]): self.sum: MetricPattern1[T] = MetricPattern1(client, acc) -class SatsPattern(Generic[T]): - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.ohlc: MetricPattern1[T] = MetricPattern1(client, _m(acc, "ohlc_sats")) - self.split: SplitPattern2[T] = SplitPattern2(client, _m(acc, "sats")) - - class RealizedPriceExtraPattern: """Pattern struct for repeated tree structure.""" @@ -10706,42 +10325,42 @@ class MetricsTree_Market_Ath: ) -class MetricsTree_Market_Dca_ClassAveragePrice: +class MetricsTree_Market_Dca_ClassReturns: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ""): - self._2015: MetricPattern4[Dollars] = MetricPattern4( - client, "dca_class_2015_average_price" + self._2015: MetricPattern4[StoredF32] = MetricPattern4( + client, "dca_class_2015_returns" ) - self._2016: MetricPattern4[Dollars] = MetricPattern4( - client, "dca_class_2016_average_price" + self._2016: MetricPattern4[StoredF32] = MetricPattern4( + client, "dca_class_2016_returns" ) - self._2017: MetricPattern4[Dollars] = MetricPattern4( - client, "dca_class_2017_average_price" + self._2017: MetricPattern4[StoredF32] = MetricPattern4( + client, "dca_class_2017_returns" ) - self._2018: MetricPattern4[Dollars] = MetricPattern4( - client, "dca_class_2018_average_price" + self._2018: MetricPattern4[StoredF32] = MetricPattern4( + client, "dca_class_2018_returns" ) - self._2019: MetricPattern4[Dollars] = MetricPattern4( - client, "dca_class_2019_average_price" + self._2019: MetricPattern4[StoredF32] = MetricPattern4( + client, "dca_class_2019_returns" ) - self._2020: MetricPattern4[Dollars] = MetricPattern4( - client, "dca_class_2020_average_price" + self._2020: MetricPattern4[StoredF32] = MetricPattern4( + client, "dca_class_2020_returns" ) - self._2021: MetricPattern4[Dollars] = MetricPattern4( - client, "dca_class_2021_average_price" + self._2021: MetricPattern4[StoredF32] = MetricPattern4( + client, "dca_class_2021_returns" ) - self._2022: MetricPattern4[Dollars] = MetricPattern4( - client, "dca_class_2022_average_price" + self._2022: MetricPattern4[StoredF32] = MetricPattern4( + client, "dca_class_2022_returns" ) - self._2023: MetricPattern4[Dollars] = MetricPattern4( - client, "dca_class_2023_average_price" + self._2023: MetricPattern4[StoredF32] = MetricPattern4( + client, "dca_class_2023_returns" ) - self._2024: MetricPattern4[Dollars] = MetricPattern4( - client, "dca_class_2024_average_price" + self._2024: MetricPattern4[StoredF32] = MetricPattern4( + client, "dca_class_2024_returns" ) - self._2025: MetricPattern4[Dollars] = MetricPattern4( - client, "dca_class_2025_average_price" + self._2025: MetricPattern4[StoredF32] = MetricPattern4( + client, "dca_class_2025_returns" ) @@ -10766,12 +10385,12 @@ 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: ClassAveragePricePattern[StoredF32] = ( + self.class_average_price: ClassAveragePricePattern[Dollars] = ( ClassAveragePricePattern(client, "dca_class") ) + self.class_returns: MetricsTree_Market_Dca_ClassReturns = ( + MetricsTree_Market_Dca_ClassReturns(client) + ) self.class_stack: MetricsTree_Market_Dca_ClassStack = ( MetricsTree_Market_Dca_ClassStack(client) )