diff --git a/.gitignore b/.gitignore index f881a9cbd..2529d6b02 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ bridge/ # Ignored _* +!__*.py /*.md # Logs diff --git a/crates/brk_client/.gitignore b/crates/brk_client/.gitignore deleted file mode 100644 index 515873a54..000000000 --- a/crates/brk_client/.gitignore +++ /dev/null @@ -1 +0,0 @@ -lib.rs diff --git a/crates/brk_client/src/lib.rs b/crates/brk_client/src/lib.rs new file mode 100644 index 000000000..2b1d47af4 --- /dev/null +++ b/crates/brk_client/src/lib.rs @@ -0,0 +1,4143 @@ +// Auto-generated BRK Rust client +// Do not edit manually + +#![allow(non_camel_case_types)] +#![allow(dead_code)] + +use std::sync::Arc; +use serde::de::DeserializeOwned; +use brk_types::*; + + +/// Error type for BRK client operations. +#[derive(Debug)] +pub struct BrkError { + pub message: String, +} + +impl std::fmt::Display for BrkError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.message) + } +} + +impl std::error::Error for BrkError {} + +/// Result type for BRK client operations. +pub type Result = std::result::Result; + +/// Options for configuring the BRK client. +#[derive(Debug, Clone)] +pub struct BrkClientOptions { + pub base_url: String, + pub timeout_secs: u64, +} + +impl Default for BrkClientOptions { + fn default() -> Self { + Self { + base_url: "http://localhost:3000".to_string(), + timeout_secs: 30, + } + } +} + +/// Base HTTP client for making requests. +#[derive(Debug, Clone)] +pub struct BrkClientBase { + base_url: String, + timeout_secs: u64, +} + +impl BrkClientBase { + /// Create a new client with the given base URL. + pub fn new(base_url: impl Into) -> Self { + Self { + base_url: base_url.into(), + timeout_secs: 30, + } + } + + /// Create a new client with options. + pub fn with_options(options: BrkClientOptions) -> Self { + Self { + base_url: options.base_url, + timeout_secs: options.timeout_secs, + } + } + + /// Make a GET request. + pub fn get(&self, path: &str) -> Result { + let url = format!("{}{}", self.base_url, path); + let response = minreq::get(&url) + .with_timeout(self.timeout_secs) + .send() + .map_err(|e| BrkError { message: e.to_string() })?; + + if response.status_code >= 400 { + return Err(BrkError { + message: format!("HTTP {}", response.status_code), + }); + } + + response + .json() + .map_err(|e| BrkError { message: e.to_string() }) + } +} + + +/// A metric node that can fetch data for different indexes. +pub struct MetricNode { + client: Arc, + path: String, + _marker: std::marker::PhantomData, +} + +impl MetricNode { + pub fn new(client: Arc, path: String) -> Self { + Self { + client, + path, + _marker: std::marker::PhantomData, + } + } + + /// Fetch all data points for this metric. + pub fn get(&self) -> Result> { + self.client.get(&self.path) + } + + /// Fetch data points within a range. + pub fn get_range(&self, from: &str, to: &str) -> Result> { + let path = format!("{}?from={}&to={}", self.path, from, to); + self.client.get(&path) + } +} + + +// Index accessor structs + +/// Index accessor for metrics with 9 indexes. +pub struct Indexes3 { + pub by_dateindex: MetricNode, + pub by_decadeindex: MetricNode, + pub by_difficultyepoch: MetricNode, + pub by_height: MetricNode, + pub by_monthindex: MetricNode, + pub by_quarterindex: MetricNode, + pub by_semesterindex: MetricNode, + pub by_weekindex: MetricNode, + pub by_yearindex: MetricNode, +} + +impl Indexes3 { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + by_dateindex: MetricNode::new(client.clone(), format!("{base_path}/dateindex")), + by_decadeindex: MetricNode::new(client.clone(), format!("{base_path}/decadeindex")), + by_difficultyepoch: MetricNode::new(client.clone(), format!("{base_path}/difficultyepoch")), + by_height: MetricNode::new(client.clone(), format!("{base_path}/height")), + by_monthindex: MetricNode::new(client.clone(), format!("{base_path}/monthindex")), + by_quarterindex: MetricNode::new(client.clone(), format!("{base_path}/quarterindex")), + by_semesterindex: MetricNode::new(client.clone(), format!("{base_path}/semesterindex")), + by_weekindex: MetricNode::new(client.clone(), format!("{base_path}/weekindex")), + by_yearindex: MetricNode::new(client.clone(), format!("{base_path}/yearindex")), + } + } +} + +/// Index accessor for metrics with 8 indexes. +pub struct Indexes4 { + pub by_dateindex: MetricNode, + pub by_decadeindex: MetricNode, + pub by_difficultyepoch: MetricNode, + pub by_monthindex: MetricNode, + pub by_quarterindex: MetricNode, + pub by_semesterindex: MetricNode, + pub by_weekindex: MetricNode, + pub by_yearindex: MetricNode, +} + +impl Indexes4 { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + by_dateindex: MetricNode::new(client.clone(), format!("{base_path}/dateindex")), + by_decadeindex: MetricNode::new(client.clone(), format!("{base_path}/decadeindex")), + by_difficultyepoch: MetricNode::new(client.clone(), format!("{base_path}/difficultyepoch")), + by_monthindex: MetricNode::new(client.clone(), format!("{base_path}/monthindex")), + by_quarterindex: MetricNode::new(client.clone(), format!("{base_path}/quarterindex")), + by_semesterindex: MetricNode::new(client.clone(), format!("{base_path}/semesterindex")), + by_weekindex: MetricNode::new(client.clone(), format!("{base_path}/weekindex")), + by_yearindex: MetricNode::new(client.clone(), format!("{base_path}/yearindex")), + } + } +} + +/// Index accessor for metrics with 8 indexes. +pub struct Indexes26 { + pub by_dateindex: MetricNode, + pub by_decadeindex: MetricNode, + pub by_height: MetricNode, + pub by_monthindex: MetricNode, + pub by_quarterindex: MetricNode, + pub by_semesterindex: MetricNode, + pub by_weekindex: MetricNode, + pub by_yearindex: MetricNode, +} + +impl Indexes26 { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + by_dateindex: MetricNode::new(client.clone(), format!("{base_path}/dateindex")), + by_decadeindex: MetricNode::new(client.clone(), format!("{base_path}/decadeindex")), + by_height: MetricNode::new(client.clone(), format!("{base_path}/height")), + by_monthindex: MetricNode::new(client.clone(), format!("{base_path}/monthindex")), + by_quarterindex: MetricNode::new(client.clone(), format!("{base_path}/quarterindex")), + by_semesterindex: MetricNode::new(client.clone(), format!("{base_path}/semesterindex")), + by_weekindex: MetricNode::new(client.clone(), format!("{base_path}/weekindex")), + by_yearindex: MetricNode::new(client.clone(), format!("{base_path}/yearindex")), + } + } +} + +/// Index accessor for metrics with 7 indexes. +pub struct Indexes { + pub by_dateindex: MetricNode, + pub by_decadeindex: MetricNode, + pub by_monthindex: MetricNode, + pub by_quarterindex: MetricNode, + pub by_semesterindex: MetricNode, + pub by_weekindex: MetricNode, + pub by_yearindex: MetricNode, +} + +impl Indexes { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + by_dateindex: MetricNode::new(client.clone(), format!("{base_path}/dateindex")), + by_decadeindex: MetricNode::new(client.clone(), format!("{base_path}/decadeindex")), + by_monthindex: MetricNode::new(client.clone(), format!("{base_path}/monthindex")), + by_quarterindex: MetricNode::new(client.clone(), format!("{base_path}/quarterindex")), + by_semesterindex: MetricNode::new(client.clone(), format!("{base_path}/semesterindex")), + by_weekindex: MetricNode::new(client.clone(), format!("{base_path}/weekindex")), + by_yearindex: MetricNode::new(client.clone(), format!("{base_path}/yearindex")), + } + } +} + +/// Index accessor for metrics with 7 indexes. +pub struct Indexes27 { + pub by_decadeindex: MetricNode, + pub by_height: MetricNode, + pub by_monthindex: MetricNode, + pub by_quarterindex: MetricNode, + pub by_semesterindex: MetricNode, + pub by_weekindex: MetricNode, + pub by_yearindex: MetricNode, +} + +impl Indexes27 { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + by_decadeindex: MetricNode::new(client.clone(), format!("{base_path}/decadeindex")), + by_height: MetricNode::new(client.clone(), format!("{base_path}/height")), + by_monthindex: MetricNode::new(client.clone(), format!("{base_path}/monthindex")), + by_quarterindex: MetricNode::new(client.clone(), format!("{base_path}/quarterindex")), + by_semesterindex: MetricNode::new(client.clone(), format!("{base_path}/semesterindex")), + by_weekindex: MetricNode::new(client.clone(), format!("{base_path}/weekindex")), + by_yearindex: MetricNode::new(client.clone(), format!("{base_path}/yearindex")), + } + } +} + +/// Index accessor for metrics with 6 indexes. +pub struct Indexes28 { + pub by_decadeindex: MetricNode, + pub by_monthindex: MetricNode, + pub by_quarterindex: MetricNode, + pub by_semesterindex: MetricNode, + pub by_weekindex: MetricNode, + pub by_yearindex: MetricNode, +} + +impl Indexes28 { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + by_decadeindex: MetricNode::new(client.clone(), format!("{base_path}/decadeindex")), + by_monthindex: MetricNode::new(client.clone(), format!("{base_path}/monthindex")), + by_quarterindex: MetricNode::new(client.clone(), format!("{base_path}/quarterindex")), + by_semesterindex: MetricNode::new(client.clone(), format!("{base_path}/semesterindex")), + by_weekindex: MetricNode::new(client.clone(), format!("{base_path}/weekindex")), + by_yearindex: MetricNode::new(client.clone(), format!("{base_path}/yearindex")), + } + } +} + +/// Index accessor for metrics with 3 indexes. +pub struct Indexes15 { + pub by_quarterindex: MetricNode, + pub by_semesterindex: MetricNode, + pub by_yearindex: MetricNode, +} + +impl Indexes15 { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + by_quarterindex: MetricNode::new(client.clone(), format!("{base_path}/quarterindex")), + by_semesterindex: MetricNode::new(client.clone(), format!("{base_path}/semesterindex")), + by_yearindex: MetricNode::new(client.clone(), format!("{base_path}/yearindex")), + } + } +} + +/// Index accessor for metrics with 2 indexes. +pub struct Indexes13 { + pub by_dateindex: MetricNode, + pub by_height: MetricNode, +} + +impl Indexes13 { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + by_dateindex: MetricNode::new(client.clone(), format!("{base_path}/dateindex")), + by_height: MetricNode::new(client.clone(), format!("{base_path}/height")), + } + } +} + +/// Index accessor for metrics with 2 indexes. +pub struct Indexes14 { + pub by_monthindex: MetricNode, + pub by_weekindex: MetricNode, +} + +impl Indexes14 { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + by_monthindex: MetricNode::new(client.clone(), format!("{base_path}/monthindex")), + by_weekindex: MetricNode::new(client.clone(), format!("{base_path}/weekindex")), + } + } +} + +/// Index accessor for metrics with 1 indexes. +pub struct Indexes2 { + pub by_height: MetricNode, +} + +impl Indexes2 { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + by_height: MetricNode::new(client.clone(), format!("{base_path}/height")), + } + } +} + +/// Index accessor for metrics with 1 indexes. +pub struct Indexes5 { + pub by_dateindex: MetricNode, +} + +impl Indexes5 { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + by_dateindex: MetricNode::new(client.clone(), format!("{base_path}/dateindex")), + } + } +} + +/// Index accessor for metrics with 1 indexes. +pub struct Indexes6 { + pub by_txindex: MetricNode, +} + +impl Indexes6 { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + by_txindex: MetricNode::new(client.clone(), format!("{base_path}/txindex")), + } + } +} + +/// Index accessor for metrics with 1 indexes. +pub struct Indexes7 { + pub by_decadeindex: MetricNode, +} + +impl Indexes7 { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + by_decadeindex: MetricNode::new(client.clone(), format!("{base_path}/decadeindex")), + } + } +} + +/// Index accessor for metrics with 1 indexes. +pub struct Indexes8 { + pub by_monthindex: MetricNode, +} + +impl Indexes8 { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + by_monthindex: MetricNode::new(client.clone(), format!("{base_path}/monthindex")), + } + } +} + +/// Index accessor for metrics with 1 indexes. +pub struct Indexes9 { + pub by_quarterindex: MetricNode, +} + +impl Indexes9 { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + by_quarterindex: MetricNode::new(client.clone(), format!("{base_path}/quarterindex")), + } + } +} + +/// Index accessor for metrics with 1 indexes. +pub struct Indexes10 { + pub by_semesterindex: MetricNode, +} + +impl Indexes10 { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + by_semesterindex: MetricNode::new(client.clone(), format!("{base_path}/semesterindex")), + } + } +} + +/// Index accessor for metrics with 1 indexes. +pub struct Indexes11 { + pub by_weekindex: MetricNode, +} + +impl Indexes11 { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + by_weekindex: MetricNode::new(client.clone(), format!("{base_path}/weekindex")), + } + } +} + +/// Index accessor for metrics with 1 indexes. +pub struct Indexes12 { + pub by_yearindex: MetricNode, +} + +impl Indexes12 { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + by_yearindex: MetricNode::new(client.clone(), format!("{base_path}/yearindex")), + } + } +} + +/// Index accessor for metrics with 1 indexes. +pub struct Indexes16 { + pub by_p2aaddressindex: MetricNode, +} + +impl Indexes16 { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + by_p2aaddressindex: MetricNode::new(client.clone(), format!("{base_path}/p2aaddressindex")), + } + } +} + +/// Index accessor for metrics with 1 indexes. +pub struct Indexes17 { + pub by_p2pk33addressindex: MetricNode, +} + +impl Indexes17 { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + by_p2pk33addressindex: MetricNode::new(client.clone(), format!("{base_path}/p2pk33addressindex")), + } + } +} + +/// Index accessor for metrics with 1 indexes. +pub struct Indexes18 { + pub by_p2pk65addressindex: MetricNode, +} + +impl Indexes18 { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + by_p2pk65addressindex: MetricNode::new(client.clone(), format!("{base_path}/p2pk65addressindex")), + } + } +} + +/// Index accessor for metrics with 1 indexes. +pub struct Indexes19 { + pub by_p2pkhaddressindex: MetricNode, +} + +impl Indexes19 { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + by_p2pkhaddressindex: MetricNode::new(client.clone(), format!("{base_path}/p2pkhaddressindex")), + } + } +} + +/// Index accessor for metrics with 1 indexes. +pub struct Indexes20 { + pub by_p2shaddressindex: MetricNode, +} + +impl Indexes20 { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + by_p2shaddressindex: MetricNode::new(client.clone(), format!("{base_path}/p2shaddressindex")), + } + } +} + +/// Index accessor for metrics with 1 indexes. +pub struct Indexes21 { + pub by_p2traddressindex: MetricNode, +} + +impl Indexes21 { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + by_p2traddressindex: MetricNode::new(client.clone(), format!("{base_path}/p2traddressindex")), + } + } +} + +/// Index accessor for metrics with 1 indexes. +pub struct Indexes22 { + pub by_p2wpkhaddressindex: MetricNode, +} + +impl Indexes22 { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + by_p2wpkhaddressindex: MetricNode::new(client.clone(), format!("{base_path}/p2wpkhaddressindex")), + } + } +} + +/// Index accessor for metrics with 1 indexes. +pub struct Indexes23 { + pub by_p2wshaddressindex: MetricNode, +} + +impl Indexes23 { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + by_p2wshaddressindex: MetricNode::new(client.clone(), format!("{base_path}/p2wshaddressindex")), + } + } +} + +/// Index accessor for metrics with 1 indexes. +pub struct Indexes24 { + pub by_txinindex: MetricNode, +} + +impl Indexes24 { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + by_txinindex: MetricNode::new(client.clone(), format!("{base_path}/txinindex")), + } + } +} + +/// Index accessor for metrics with 1 indexes. +pub struct Indexes25 { + pub by_txoutindex: MetricNode, +} + +impl Indexes25 { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + by_txoutindex: MetricNode::new(client.clone(), format!("{base_path}/txoutindex")), + } + } +} + +/// Index accessor for metrics with 1 indexes. +pub struct Indexes29 { + pub by_emptyaddressindex: MetricNode, +} + +impl Indexes29 { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + by_emptyaddressindex: MetricNode::new(client.clone(), format!("{base_path}/emptyaddressindex")), + } + } +} + +/// Index accessor for metrics with 1 indexes. +pub struct Indexes30 { + pub by_loadedaddressindex: MetricNode, +} + +impl Indexes30 { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + by_loadedaddressindex: MetricNode::new(client.clone(), format!("{base_path}/loadedaddressindex")), + } + } +} + +// Reusable pattern structs + +/// Pattern struct for repeated tree structure. +pub struct RealizedPattern3 { + pub adjusted_sopr: Indexes5, + pub adjusted_sopr_30d_ema: Indexes5, + pub adjusted_sopr_7d_ema: Indexes5, + pub adjusted_value_created: Indexes3, + pub adjusted_value_destroyed: Indexes3, + pub neg_realized_loss: BlockCountPattern, + pub net_realized_pnl: BlockCountPattern, + pub net_realized_pnl_cumulative_30d_delta: Indexes, + pub net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: Indexes, + pub net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: Indexes, + pub net_realized_pnl_rel_to_realized_cap: Indexes2, + pub realized_cap: Indexes3, + pub realized_cap_30d_delta: Indexes, + pub realized_cap_rel_to_own_market_cap: Indexes3, + pub realized_loss: BlockCountPattern, + pub realized_loss_rel_to_realized_cap: Indexes2, + pub realized_price: Indexes3, + pub realized_price_extra: ActivePriceRatioPattern, + pub realized_profit: BlockCountPattern, + pub realized_profit_rel_to_realized_cap: Indexes2, + pub realized_profit_to_loss_ratio: Indexes5, + pub realized_value: Indexes3, + pub sell_side_risk_ratio: Indexes5, + pub sell_side_risk_ratio_30d_ema: Indexes5, + pub sell_side_risk_ratio_7d_ema: Indexes5, + pub sopr: Indexes5, + pub sopr_30d_ema: Indexes5, + pub sopr_7d_ema: Indexes5, + pub total_realized_pnl: BitcoinPattern2, + pub value_created: Indexes3, + pub value_destroyed: Indexes3, +} + +impl RealizedPattern3 { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + adjusted_sopr: Indexes5::new(client.clone(), &format!("{base_path}/adjusted_sopr")), + adjusted_sopr_30d_ema: Indexes5::new(client.clone(), &format!("{base_path}/adjusted_sopr_30d_ema")), + adjusted_sopr_7d_ema: Indexes5::new(client.clone(), &format!("{base_path}/adjusted_sopr_7d_ema")), + adjusted_value_created: Indexes3::new(client.clone(), &format!("{base_path}/adjusted_value_created")), + adjusted_value_destroyed: Indexes3::new(client.clone(), &format!("{base_path}/adjusted_value_destroyed")), + neg_realized_loss: BlockCountPattern::new(client.clone(), &format!("{base_path}/neg_realized_loss")), + net_realized_pnl: BlockCountPattern::new(client.clone(), &format!("{base_path}/net_realized_pnl")), + net_realized_pnl_cumulative_30d_delta: Indexes::new(client.clone(), &format!("{base_path}/net_realized_pnl_cumulative_30d_delta")), + net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: Indexes::new(client.clone(), &format!("{base_path}/net_realized_pnl_cumulative_30d_delta_rel_to_market_cap")), + net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: Indexes::new(client.clone(), &format!("{base_path}/net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap")), + net_realized_pnl_rel_to_realized_cap: Indexes2::new(client.clone(), &format!("{base_path}/net_realized_pnl_rel_to_realized_cap")), + realized_cap: Indexes3::new(client.clone(), &format!("{base_path}/realized_cap")), + realized_cap_30d_delta: Indexes::new(client.clone(), &format!("{base_path}/realized_cap_30d_delta")), + realized_cap_rel_to_own_market_cap: Indexes3::new(client.clone(), &format!("{base_path}/realized_cap_rel_to_own_market_cap")), + realized_loss: BlockCountPattern::new(client.clone(), &format!("{base_path}/realized_loss")), + realized_loss_rel_to_realized_cap: Indexes2::new(client.clone(), &format!("{base_path}/realized_loss_rel_to_realized_cap")), + realized_price: Indexes3::new(client.clone(), &format!("{base_path}/realized_price")), + realized_price_extra: ActivePriceRatioPattern::new(client.clone(), &format!("{base_path}/realized_price_extra")), + realized_profit: BlockCountPattern::new(client.clone(), &format!("{base_path}/realized_profit")), + realized_profit_rel_to_realized_cap: Indexes2::new(client.clone(), &format!("{base_path}/realized_profit_rel_to_realized_cap")), + realized_profit_to_loss_ratio: Indexes5::new(client.clone(), &format!("{base_path}/realized_profit_to_loss_ratio")), + realized_value: Indexes3::new(client.clone(), &format!("{base_path}/realized_value")), + sell_side_risk_ratio: Indexes5::new(client.clone(), &format!("{base_path}/sell_side_risk_ratio")), + sell_side_risk_ratio_30d_ema: Indexes5::new(client.clone(), &format!("{base_path}/sell_side_risk_ratio_30d_ema")), + sell_side_risk_ratio_7d_ema: Indexes5::new(client.clone(), &format!("{base_path}/sell_side_risk_ratio_7d_ema")), + sopr: Indexes5::new(client.clone(), &format!("{base_path}/sopr")), + sopr_30d_ema: Indexes5::new(client.clone(), &format!("{base_path}/sopr_30d_ema")), + sopr_7d_ema: Indexes5::new(client.clone(), &format!("{base_path}/sopr_7d_ema")), + total_realized_pnl: BitcoinPattern2::new(client.clone(), &format!("{base_path}/total_realized_pnl")), + value_created: Indexes3::new(client.clone(), &format!("{base_path}/value_created")), + value_destroyed: Indexes3::new(client.clone(), &format!("{base_path}/value_destroyed")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct Ratio1ySdPattern2 { + pub _0sd_usd: Indexes, + pub m0_5sd: Indexes, + pub m0_5sd_usd: Indexes, + pub m1_5sd: Indexes, + pub m1_5sd_usd: Indexes, + pub m1sd: Indexes, + pub m1sd_usd: Indexes, + pub m2_5sd: Indexes, + pub m2_5sd_usd: Indexes, + pub m2sd: Indexes, + pub m2sd_usd: Indexes, + pub m3sd: Indexes, + pub m3sd_usd: Indexes, + pub p0_5sd: Indexes, + pub p0_5sd_usd: Indexes, + pub p1_5sd: Indexes, + pub p1_5sd_usd: Indexes, + pub p1sd: Indexes, + pub p1sd_usd: Indexes, + pub p2_5sd: Indexes, + pub p2_5sd_usd: Indexes, + pub p2sd: Indexes, + pub p2sd_usd: Indexes, + pub p3sd: Indexes, + pub p3sd_usd: Indexes, + pub sd: Indexes, + pub sma: Indexes, + pub zscore: Indexes, +} + +impl Ratio1ySdPattern2 { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + _0sd_usd: Indexes::new(client.clone(), &format!("{base_path}/_0sd_usd")), + m0_5sd: Indexes::new(client.clone(), &format!("{base_path}/m0_5sd")), + m0_5sd_usd: Indexes::new(client.clone(), &format!("{base_path}/m0_5sd_usd")), + m1_5sd: Indexes::new(client.clone(), &format!("{base_path}/m1_5sd")), + m1_5sd_usd: Indexes::new(client.clone(), &format!("{base_path}/m1_5sd_usd")), + m1sd: Indexes::new(client.clone(), &format!("{base_path}/m1sd")), + m1sd_usd: Indexes::new(client.clone(), &format!("{base_path}/m1sd_usd")), + m2_5sd: Indexes::new(client.clone(), &format!("{base_path}/m2_5sd")), + m2_5sd_usd: Indexes::new(client.clone(), &format!("{base_path}/m2_5sd_usd")), + m2sd: Indexes::new(client.clone(), &format!("{base_path}/m2sd")), + m2sd_usd: Indexes::new(client.clone(), &format!("{base_path}/m2sd_usd")), + m3sd: Indexes::new(client.clone(), &format!("{base_path}/m3sd")), + m3sd_usd: Indexes::new(client.clone(), &format!("{base_path}/m3sd_usd")), + p0_5sd: Indexes::new(client.clone(), &format!("{base_path}/p0_5sd")), + p0_5sd_usd: Indexes::new(client.clone(), &format!("{base_path}/p0_5sd_usd")), + p1_5sd: Indexes::new(client.clone(), &format!("{base_path}/p1_5sd")), + p1_5sd_usd: Indexes::new(client.clone(), &format!("{base_path}/p1_5sd_usd")), + p1sd: Indexes::new(client.clone(), &format!("{base_path}/p1sd")), + p1sd_usd: Indexes::new(client.clone(), &format!("{base_path}/p1sd_usd")), + p2_5sd: Indexes::new(client.clone(), &format!("{base_path}/p2_5sd")), + p2_5sd_usd: Indexes::new(client.clone(), &format!("{base_path}/p2_5sd_usd")), + p2sd: Indexes::new(client.clone(), &format!("{base_path}/p2sd")), + p2sd_usd: Indexes::new(client.clone(), &format!("{base_path}/p2sd_usd")), + p3sd: Indexes::new(client.clone(), &format!("{base_path}/p3sd")), + p3sd_usd: Indexes::new(client.clone(), &format!("{base_path}/p3sd_usd")), + sd: Indexes::new(client.clone(), &format!("{base_path}/sd")), + sma: Indexes::new(client.clone(), &format!("{base_path}/sma")), + zscore: Indexes::new(client.clone(), &format!("{base_path}/zscore")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct RealizedPattern2 { + pub neg_realized_loss: BlockCountPattern, + pub net_realized_pnl: BlockCountPattern, + pub net_realized_pnl_cumulative_30d_delta: Indexes, + pub net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: Indexes, + pub net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: Indexes, + pub net_realized_pnl_rel_to_realized_cap: Indexes2, + pub realized_cap: Indexes3, + pub realized_cap_30d_delta: Indexes, + pub realized_cap_rel_to_own_market_cap: Indexes3, + pub realized_loss: BlockCountPattern, + pub realized_loss_rel_to_realized_cap: Indexes2, + pub realized_price: Indexes3, + pub realized_price_extra: ActivePriceRatioPattern, + pub realized_profit: BlockCountPattern, + pub realized_profit_rel_to_realized_cap: Indexes2, + pub realized_profit_to_loss_ratio: Indexes5, + pub realized_value: Indexes3, + pub sell_side_risk_ratio: Indexes5, + pub sell_side_risk_ratio_30d_ema: Indexes5, + pub sell_side_risk_ratio_7d_ema: Indexes5, + pub sopr: Indexes5, + pub sopr_30d_ema: Indexes5, + pub sopr_7d_ema: Indexes5, + pub total_realized_pnl: BitcoinPattern2, + pub value_created: Indexes3, + pub value_destroyed: Indexes3, +} + +impl RealizedPattern2 { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + neg_realized_loss: BlockCountPattern::new(client.clone(), &format!("{base_path}/neg_realized_loss")), + net_realized_pnl: BlockCountPattern::new(client.clone(), &format!("{base_path}/net_realized_pnl")), + net_realized_pnl_cumulative_30d_delta: Indexes::new(client.clone(), &format!("{base_path}/net_realized_pnl_cumulative_30d_delta")), + net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: Indexes::new(client.clone(), &format!("{base_path}/net_realized_pnl_cumulative_30d_delta_rel_to_market_cap")), + net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: Indexes::new(client.clone(), &format!("{base_path}/net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap")), + net_realized_pnl_rel_to_realized_cap: Indexes2::new(client.clone(), &format!("{base_path}/net_realized_pnl_rel_to_realized_cap")), + realized_cap: Indexes3::new(client.clone(), &format!("{base_path}/realized_cap")), + realized_cap_30d_delta: Indexes::new(client.clone(), &format!("{base_path}/realized_cap_30d_delta")), + realized_cap_rel_to_own_market_cap: Indexes3::new(client.clone(), &format!("{base_path}/realized_cap_rel_to_own_market_cap")), + realized_loss: BlockCountPattern::new(client.clone(), &format!("{base_path}/realized_loss")), + realized_loss_rel_to_realized_cap: Indexes2::new(client.clone(), &format!("{base_path}/realized_loss_rel_to_realized_cap")), + realized_price: Indexes3::new(client.clone(), &format!("{base_path}/realized_price")), + realized_price_extra: ActivePriceRatioPattern::new(client.clone(), &format!("{base_path}/realized_price_extra")), + realized_profit: BlockCountPattern::new(client.clone(), &format!("{base_path}/realized_profit")), + realized_profit_rel_to_realized_cap: Indexes2::new(client.clone(), &format!("{base_path}/realized_profit_rel_to_realized_cap")), + realized_profit_to_loss_ratio: Indexes5::new(client.clone(), &format!("{base_path}/realized_profit_to_loss_ratio")), + realized_value: Indexes3::new(client.clone(), &format!("{base_path}/realized_value")), + sell_side_risk_ratio: Indexes5::new(client.clone(), &format!("{base_path}/sell_side_risk_ratio")), + sell_side_risk_ratio_30d_ema: Indexes5::new(client.clone(), &format!("{base_path}/sell_side_risk_ratio_30d_ema")), + sell_side_risk_ratio_7d_ema: Indexes5::new(client.clone(), &format!("{base_path}/sell_side_risk_ratio_7d_ema")), + sopr: Indexes5::new(client.clone(), &format!("{base_path}/sopr")), + sopr_30d_ema: Indexes5::new(client.clone(), &format!("{base_path}/sopr_30d_ema")), + sopr_7d_ema: Indexes5::new(client.clone(), &format!("{base_path}/sopr_7d_ema")), + total_realized_pnl: BitcoinPattern2::new(client.clone(), &format!("{base_path}/total_realized_pnl")), + value_created: Indexes3::new(client.clone(), &format!("{base_path}/value_created")), + value_destroyed: Indexes3::new(client.clone(), &format!("{base_path}/value_destroyed")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct RealizedPattern { + pub neg_realized_loss: BlockCountPattern, + pub net_realized_pnl: BlockCountPattern, + pub net_realized_pnl_cumulative_30d_delta: Indexes, + pub net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: Indexes, + pub net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: Indexes, + pub net_realized_pnl_rel_to_realized_cap: Indexes2, + pub realized_cap: Indexes3, + pub realized_cap_30d_delta: Indexes, + pub realized_loss: BlockCountPattern, + pub realized_loss_rel_to_realized_cap: Indexes2, + pub realized_price: Indexes3, + pub realized_price_extra: RealizedPriceExtraPattern, + pub realized_profit: BlockCountPattern, + pub realized_profit_rel_to_realized_cap: Indexes2, + pub realized_value: Indexes3, + pub sell_side_risk_ratio: Indexes5, + pub sell_side_risk_ratio_30d_ema: Indexes5, + pub sell_side_risk_ratio_7d_ema: Indexes5, + pub sopr: Indexes5, + pub sopr_30d_ema: Indexes5, + pub sopr_7d_ema: Indexes5, + pub total_realized_pnl: BitcoinPattern2, + pub value_created: Indexes3, + pub value_destroyed: Indexes3, +} + +impl RealizedPattern { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + neg_realized_loss: BlockCountPattern::new(client.clone(), &format!("{base_path}/neg_realized_loss")), + net_realized_pnl: BlockCountPattern::new(client.clone(), &format!("{base_path}/net_realized_pnl")), + net_realized_pnl_cumulative_30d_delta: Indexes::new(client.clone(), &format!("{base_path}/net_realized_pnl_cumulative_30d_delta")), + net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: Indexes::new(client.clone(), &format!("{base_path}/net_realized_pnl_cumulative_30d_delta_rel_to_market_cap")), + net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: Indexes::new(client.clone(), &format!("{base_path}/net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap")), + net_realized_pnl_rel_to_realized_cap: Indexes2::new(client.clone(), &format!("{base_path}/net_realized_pnl_rel_to_realized_cap")), + realized_cap: Indexes3::new(client.clone(), &format!("{base_path}/realized_cap")), + realized_cap_30d_delta: Indexes::new(client.clone(), &format!("{base_path}/realized_cap_30d_delta")), + realized_loss: BlockCountPattern::new(client.clone(), &format!("{base_path}/realized_loss")), + realized_loss_rel_to_realized_cap: Indexes2::new(client.clone(), &format!("{base_path}/realized_loss_rel_to_realized_cap")), + realized_price: Indexes3::new(client.clone(), &format!("{base_path}/realized_price")), + realized_price_extra: RealizedPriceExtraPattern::new(client.clone(), &format!("{base_path}/realized_price_extra")), + realized_profit: BlockCountPattern::new(client.clone(), &format!("{base_path}/realized_profit")), + realized_profit_rel_to_realized_cap: Indexes2::new(client.clone(), &format!("{base_path}/realized_profit_rel_to_realized_cap")), + realized_value: Indexes3::new(client.clone(), &format!("{base_path}/realized_value")), + sell_side_risk_ratio: Indexes5::new(client.clone(), &format!("{base_path}/sell_side_risk_ratio")), + sell_side_risk_ratio_30d_ema: Indexes5::new(client.clone(), &format!("{base_path}/sell_side_risk_ratio_30d_ema")), + sell_side_risk_ratio_7d_ema: Indexes5::new(client.clone(), &format!("{base_path}/sell_side_risk_ratio_7d_ema")), + sopr: Indexes5::new(client.clone(), &format!("{base_path}/sopr")), + sopr_30d_ema: Indexes5::new(client.clone(), &format!("{base_path}/sopr_30d_ema")), + sopr_7d_ema: Indexes5::new(client.clone(), &format!("{base_path}/sopr_7d_ema")), + total_realized_pnl: BitcoinPattern2::new(client.clone(), &format!("{base_path}/total_realized_pnl")), + value_created: Indexes3::new(client.clone(), &format!("{base_path}/value_created")), + value_destroyed: Indexes3::new(client.clone(), &format!("{base_path}/value_destroyed")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct Price13dEmaPattern { + pub price: Indexes, + pub ratio: Indexes, + pub ratio_1m_sma: Indexes, + pub ratio_1w_sma: Indexes, + pub ratio_1y_sd: Ratio1ySdPattern2, + pub ratio_2y_sd: Ratio1ySdPattern2, + pub ratio_4y_sd: Ratio1ySdPattern2, + pub ratio_pct1: Indexes, + pub ratio_pct1_usd: Indexes, + pub ratio_pct2: Indexes, + pub ratio_pct2_usd: Indexes, + pub ratio_pct5: Indexes, + pub ratio_pct5_usd: Indexes, + pub ratio_pct95: Indexes, + pub ratio_pct95_usd: Indexes, + pub ratio_pct98: Indexes, + pub ratio_pct98_usd: Indexes, + pub ratio_pct99: Indexes, + pub ratio_pct99_usd: Indexes, + pub ratio_sd: Ratio1ySdPattern2, +} + +impl Price13dEmaPattern { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: &str) -> Self { + Self { + price: Indexes::new(client.clone(), &format!("/{acc}")), + ratio: Indexes::new(client.clone(), &format!("/{acc}_ratio")), + ratio_1m_sma: Indexes::new(client.clone(), &format!("/{acc}_ratio_1m_sma")), + ratio_1w_sma: Indexes::new(client.clone(), &format!("/{acc}_ratio_1w_sma")), + ratio_1y_sd: Ratio1ySdPattern2::new(client.clone(), &format!("{acc}_ratio_1y_sd")), + ratio_2y_sd: Ratio1ySdPattern2::new(client.clone(), &format!("{acc}_ratio_2y_sd")), + ratio_4y_sd: Ratio1ySdPattern2::new(client.clone(), &format!("{acc}_ratio_4y_sd")), + ratio_pct1: Indexes::new(client.clone(), &format!("/{acc}_ratio_pct1")), + ratio_pct1_usd: Indexes::new(client.clone(), &format!("/{acc}_ratio_pct1_usd")), + ratio_pct2: Indexes::new(client.clone(), &format!("/{acc}_ratio_pct2")), + ratio_pct2_usd: Indexes::new(client.clone(), &format!("/{acc}_ratio_pct2_usd")), + ratio_pct5: Indexes::new(client.clone(), &format!("/{acc}_ratio_pct5")), + ratio_pct5_usd: Indexes::new(client.clone(), &format!("/{acc}_ratio_pct5_usd")), + ratio_pct95: Indexes::new(client.clone(), &format!("/{acc}_ratio_pct95")), + ratio_pct95_usd: Indexes::new(client.clone(), &format!("/{acc}_ratio_pct95_usd")), + ratio_pct98: Indexes::new(client.clone(), &format!("/{acc}_ratio_pct98")), + ratio_pct98_usd: Indexes::new(client.clone(), &format!("/{acc}_ratio_pct98_usd")), + ratio_pct99: Indexes::new(client.clone(), &format!("/{acc}_ratio_pct99")), + ratio_pct99_usd: Indexes::new(client.clone(), &format!("/{acc}_ratio_pct99_usd")), + ratio_sd: Ratio1ySdPattern2::new(client.clone(), &format!("{acc}_ratio_sd")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct PricePercentilesPattern { + pub pct05: Indexes, + pub pct10: Indexes, + pub pct15: Indexes, + pub pct20: Indexes, + pub pct25: Indexes, + pub pct30: Indexes, + pub pct35: Indexes, + pub pct40: Indexes, + pub pct45: Indexes, + pub pct50: Indexes, + pub pct55: Indexes, + pub pct60: Indexes, + pub pct65: Indexes, + pub pct70: Indexes, + pub pct75: Indexes, + pub pct80: Indexes, + pub pct85: Indexes, + pub pct90: Indexes, + pub pct95: Indexes, +} + +impl PricePercentilesPattern { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + pct05: Indexes::new(client.clone(), &format!("{base_path}/pct05")), + pct10: Indexes::new(client.clone(), &format!("{base_path}/pct10")), + pct15: Indexes::new(client.clone(), &format!("{base_path}/pct15")), + pct20: Indexes::new(client.clone(), &format!("{base_path}/pct20")), + pct25: Indexes::new(client.clone(), &format!("{base_path}/pct25")), + pct30: Indexes::new(client.clone(), &format!("{base_path}/pct30")), + pct35: Indexes::new(client.clone(), &format!("{base_path}/pct35")), + pct40: Indexes::new(client.clone(), &format!("{base_path}/pct40")), + pct45: Indexes::new(client.clone(), &format!("{base_path}/pct45")), + pct50: Indexes::new(client.clone(), &format!("{base_path}/pct50")), + pct55: Indexes::new(client.clone(), &format!("{base_path}/pct55")), + pct60: Indexes::new(client.clone(), &format!("{base_path}/pct60")), + pct65: Indexes::new(client.clone(), &format!("{base_path}/pct65")), + pct70: Indexes::new(client.clone(), &format!("{base_path}/pct70")), + pct75: Indexes::new(client.clone(), &format!("{base_path}/pct75")), + pct80: Indexes::new(client.clone(), &format!("{base_path}/pct80")), + pct85: Indexes::new(client.clone(), &format!("{base_path}/pct85")), + pct90: Indexes::new(client.clone(), &format!("{base_path}/pct90")), + pct95: Indexes::new(client.clone(), &format!("{base_path}/pct95")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct RelativePattern2 { + pub neg_unrealized_loss_rel_to_market_cap: Indexes27, + pub neg_unrealized_loss_rel_to_own_market_cap: Indexes27, + pub neg_unrealized_loss_rel_to_own_total_unrealized_pnl: Indexes27, + pub net_unrealized_pnl_rel_to_market_cap: Indexes26, + pub net_unrealized_pnl_rel_to_own_market_cap: Indexes26, + pub net_unrealized_pnl_rel_to_own_total_unrealized_pnl: Indexes26, + pub supply_in_loss_rel_to_circulating_supply: Indexes27, + pub supply_in_loss_rel_to_own_supply: Indexes27, + pub supply_in_profit_rel_to_circulating_supply: Indexes27, + pub supply_in_profit_rel_to_own_supply: Indexes27, + pub supply_rel_to_circulating_supply: Indexes, + pub unrealized_loss_rel_to_market_cap: Indexes27, + pub unrealized_loss_rel_to_own_market_cap: Indexes27, + pub unrealized_loss_rel_to_own_total_unrealized_pnl: Indexes27, + pub unrealized_profit_rel_to_market_cap: Indexes27, + pub unrealized_profit_rel_to_own_market_cap: Indexes27, + pub unrealized_profit_rel_to_own_total_unrealized_pnl: Indexes27, +} + +impl RelativePattern2 { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + neg_unrealized_loss_rel_to_market_cap: Indexes27::new(client.clone(), &format!("{base_path}/neg_unrealized_loss_rel_to_market_cap")), + neg_unrealized_loss_rel_to_own_market_cap: Indexes27::new(client.clone(), &format!("{base_path}/neg_unrealized_loss_rel_to_own_market_cap")), + neg_unrealized_loss_rel_to_own_total_unrealized_pnl: Indexes27::new(client.clone(), &format!("{base_path}/neg_unrealized_loss_rel_to_own_total_unrealized_pnl")), + net_unrealized_pnl_rel_to_market_cap: Indexes26::new(client.clone(), &format!("{base_path}/net_unrealized_pnl_rel_to_market_cap")), + net_unrealized_pnl_rel_to_own_market_cap: Indexes26::new(client.clone(), &format!("{base_path}/net_unrealized_pnl_rel_to_own_market_cap")), + net_unrealized_pnl_rel_to_own_total_unrealized_pnl: Indexes26::new(client.clone(), &format!("{base_path}/net_unrealized_pnl_rel_to_own_total_unrealized_pnl")), + supply_in_loss_rel_to_circulating_supply: Indexes27::new(client.clone(), &format!("{base_path}/supply_in_loss_rel_to_circulating_supply")), + supply_in_loss_rel_to_own_supply: Indexes27::new(client.clone(), &format!("{base_path}/supply_in_loss_rel_to_own_supply")), + supply_in_profit_rel_to_circulating_supply: Indexes27::new(client.clone(), &format!("{base_path}/supply_in_profit_rel_to_circulating_supply")), + supply_in_profit_rel_to_own_supply: Indexes27::new(client.clone(), &format!("{base_path}/supply_in_profit_rel_to_own_supply")), + supply_rel_to_circulating_supply: Indexes::new(client.clone(), &format!("{base_path}/supply_rel_to_circulating_supply")), + unrealized_loss_rel_to_market_cap: Indexes27::new(client.clone(), &format!("{base_path}/unrealized_loss_rel_to_market_cap")), + unrealized_loss_rel_to_own_market_cap: Indexes27::new(client.clone(), &format!("{base_path}/unrealized_loss_rel_to_own_market_cap")), + unrealized_loss_rel_to_own_total_unrealized_pnl: Indexes27::new(client.clone(), &format!("{base_path}/unrealized_loss_rel_to_own_total_unrealized_pnl")), + unrealized_profit_rel_to_market_cap: Indexes27::new(client.clone(), &format!("{base_path}/unrealized_profit_rel_to_market_cap")), + unrealized_profit_rel_to_own_market_cap: Indexes27::new(client.clone(), &format!("{base_path}/unrealized_profit_rel_to_own_market_cap")), + unrealized_profit_rel_to_own_total_unrealized_pnl: Indexes27::new(client.clone(), &format!("{base_path}/unrealized_profit_rel_to_own_total_unrealized_pnl")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct Ratio1ySdPattern { + pub m0_5sd: Indexes, + pub m1_5sd: Indexes, + pub m1sd: Indexes, + pub m2_5sd: Indexes, + pub m2sd: Indexes, + pub m3sd: Indexes, + pub p0_5sd: Indexes, + pub p1_5sd: Indexes, + pub p1sd: Indexes, + pub p2_5sd: Indexes, + pub p2sd: Indexes, + pub p3sd: Indexes, + pub sd: Indexes, + pub sma: Indexes, + pub zscore: Indexes, +} + +impl Ratio1ySdPattern { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + m0_5sd: Indexes::new(client.clone(), &format!("{base_path}/m0_5sd")), + m1_5sd: Indexes::new(client.clone(), &format!("{base_path}/m1_5sd")), + m1sd: Indexes::new(client.clone(), &format!("{base_path}/m1sd")), + m2_5sd: Indexes::new(client.clone(), &format!("{base_path}/m2_5sd")), + m2sd: Indexes::new(client.clone(), &format!("{base_path}/m2sd")), + m3sd: Indexes::new(client.clone(), &format!("{base_path}/m3sd")), + p0_5sd: Indexes::new(client.clone(), &format!("{base_path}/p0_5sd")), + p1_5sd: Indexes::new(client.clone(), &format!("{base_path}/p1_5sd")), + p1sd: Indexes::new(client.clone(), &format!("{base_path}/p1sd")), + p2_5sd: Indexes::new(client.clone(), &format!("{base_path}/p2_5sd")), + p2sd: Indexes::new(client.clone(), &format!("{base_path}/p2sd")), + p3sd: Indexes::new(client.clone(), &format!("{base_path}/p3sd")), + sd: Indexes::new(client.clone(), &format!("{base_path}/sd")), + sma: Indexes::new(client.clone(), &format!("{base_path}/sma")), + zscore: Indexes::new(client.clone(), &format!("{base_path}/zscore")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct ActivePriceRatioPattern { + pub ratio: Indexes, + pub ratio_1m_sma: Indexes, + pub ratio_1w_sma: Indexes, + pub ratio_1y_sd: Ratio1ySdPattern, + pub ratio_2y_sd: Ratio1ySdPattern, + pub ratio_4y_sd: Ratio1ySdPattern, + pub ratio_pct1: Indexes, + pub ratio_pct2: Indexes, + pub ratio_pct5: Indexes, + pub ratio_pct95: Indexes, + pub ratio_pct98: Indexes, + pub ratio_pct99: Indexes, + pub ratio_sd: Ratio1ySdPattern, +} + +impl ActivePriceRatioPattern { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + ratio: Indexes::new(client.clone(), &format!("{base_path}/ratio")), + ratio_1m_sma: Indexes::new(client.clone(), &format!("{base_path}/ratio_1m_sma")), + ratio_1w_sma: Indexes::new(client.clone(), &format!("{base_path}/ratio_1w_sma")), + ratio_1y_sd: Ratio1ySdPattern::new(client.clone(), &format!("{base_path}/ratio_1y_sd")), + ratio_2y_sd: Ratio1ySdPattern::new(client.clone(), &format!("{base_path}/ratio_2y_sd")), + ratio_4y_sd: Ratio1ySdPattern::new(client.clone(), &format!("{base_path}/ratio_4y_sd")), + ratio_pct1: Indexes::new(client.clone(), &format!("{base_path}/ratio_pct1")), + ratio_pct2: Indexes::new(client.clone(), &format!("{base_path}/ratio_pct2")), + ratio_pct5: Indexes::new(client.clone(), &format!("{base_path}/ratio_pct5")), + ratio_pct95: Indexes::new(client.clone(), &format!("{base_path}/ratio_pct95")), + ratio_pct98: Indexes::new(client.clone(), &format!("{base_path}/ratio_pct98")), + ratio_pct99: Indexes::new(client.clone(), &format!("{base_path}/ratio_pct99")), + ratio_sd: Ratio1ySdPattern::new(client.clone(), &format!("{base_path}/ratio_sd")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct AXbtPattern { + pub _1d_dominance: BlockCountPattern, + pub _1m_blocks_mined: Indexes, + pub _1m_dominance: Indexes, + pub _1w_blocks_mined: Indexes, + pub _1w_dominance: Indexes, + pub _1y_blocks_mined: Indexes, + pub _1y_dominance: Indexes, + pub blocks_mined: BlockCountPattern, + pub coinbase: UnclaimedRewardsPattern, + pub days_since_block: Indexes, + pub dominance: BlockCountPattern, + pub fee: UnclaimedRewardsPattern, + pub subsidy: UnclaimedRewardsPattern, +} + +impl AXbtPattern { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + _1d_dominance: BlockCountPattern::new(client.clone(), &format!("{base_path}/1d_dominance")), + _1m_blocks_mined: Indexes::new(client.clone(), &format!("{base_path}/1m_blocks_mined")), + _1m_dominance: Indexes::new(client.clone(), &format!("{base_path}/1m_dominance")), + _1w_blocks_mined: Indexes::new(client.clone(), &format!("{base_path}/1w_blocks_mined")), + _1w_dominance: Indexes::new(client.clone(), &format!("{base_path}/1w_dominance")), + _1y_blocks_mined: Indexes::new(client.clone(), &format!("{base_path}/1y_blocks_mined")), + _1y_dominance: Indexes::new(client.clone(), &format!("{base_path}/1y_dominance")), + blocks_mined: BlockCountPattern::new(client.clone(), &format!("{base_path}/blocks_mined")), + coinbase: UnclaimedRewardsPattern::new(client.clone(), &format!("{base_path}/coinbase")), + days_since_block: Indexes::new(client.clone(), &format!("{base_path}/days_since_block")), + dominance: BlockCountPattern::new(client.clone(), &format!("{base_path}/dominance")), + fee: UnclaimedRewardsPattern::new(client.clone(), &format!("{base_path}/fee")), + subsidy: UnclaimedRewardsPattern::new(client.clone(), &format!("{base_path}/subsidy")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct BitcoinPattern { + pub average: Indexes4, + pub base: Indexes2, + pub cumulative: Indexes3, + pub max: Indexes4, + pub median: Indexes5, + pub min: Indexes4, + pub pct10: Indexes5, + pub pct25: Indexes5, + pub pct75: Indexes5, + pub pct90: Indexes5, + pub sum: Indexes4, +} + +impl BitcoinPattern { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + average: Indexes4::new(client.clone(), &format!("{base_path}/average")), + base: Indexes2::new(client.clone(), &format!("{base_path}/base")), + cumulative: Indexes3::new(client.clone(), &format!("{base_path}/cumulative")), + max: Indexes4::new(client.clone(), &format!("{base_path}/max")), + median: Indexes5::new(client.clone(), &format!("{base_path}/median")), + min: Indexes4::new(client.clone(), &format!("{base_path}/min")), + pct10: Indexes5::new(client.clone(), &format!("{base_path}/pct10")), + pct25: Indexes5::new(client.clone(), &format!("{base_path}/pct25")), + pct75: Indexes5::new(client.clone(), &format!("{base_path}/pct75")), + pct90: Indexes5::new(client.clone(), &format!("{base_path}/pct90")), + sum: Indexes4::new(client.clone(), &format!("{base_path}/sum")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct BlockSizePattern { + pub average: Indexes4, + pub cumulative: Indexes3, + pub max: Indexes4, + pub median: Indexes5, + pub min: Indexes4, + pub pct10: Indexes5, + pub pct25: Indexes5, + pub pct75: Indexes5, + pub pct90: Indexes5, + pub sum: Indexes4, +} + +impl BlockSizePattern { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + average: Indexes4::new(client.clone(), &format!("{base_path}/average")), + cumulative: Indexes3::new(client.clone(), &format!("{base_path}/cumulative")), + max: Indexes4::new(client.clone(), &format!("{base_path}/max")), + median: Indexes5::new(client.clone(), &format!("{base_path}/median")), + min: Indexes4::new(client.clone(), &format!("{base_path}/min")), + pct10: Indexes5::new(client.clone(), &format!("{base_path}/pct10")), + pct25: Indexes5::new(client.clone(), &format!("{base_path}/pct25")), + pct75: Indexes5::new(client.clone(), &format!("{base_path}/pct75")), + pct90: Indexes5::new(client.clone(), &format!("{base_path}/pct90")), + sum: Indexes4::new(client.clone(), &format!("{base_path}/sum")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct UnrealizedPattern { + pub neg_unrealized_loss: Indexes26, + pub net_unrealized_pnl: Indexes26, + pub supply_in_loss: SupplyPattern, + pub supply_in_loss_value: SupplyValuePattern, + pub supply_in_profit: SupplyPattern, + pub supply_in_profit_value: SupplyValuePattern, + pub total_unrealized_pnl: Indexes26, + pub unrealized_loss: Indexes26, + pub unrealized_profit: Indexes26, +} + +impl UnrealizedPattern { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + neg_unrealized_loss: Indexes26::new(client.clone(), &format!("{base_path}/neg_unrealized_loss")), + net_unrealized_pnl: Indexes26::new(client.clone(), &format!("{base_path}/net_unrealized_pnl")), + supply_in_loss: SupplyPattern::new(client.clone(), &format!("{base_path}/supply_in_loss")), + supply_in_loss_value: SupplyValuePattern::new(client.clone(), &format!("{base_path}/supply_in_loss_value")), + supply_in_profit: SupplyPattern::new(client.clone(), &format!("{base_path}/supply_in_profit")), + supply_in_profit_value: SupplyValuePattern::new(client.clone(), &format!("{base_path}/supply_in_profit_value")), + total_unrealized_pnl: Indexes26::new(client.clone(), &format!("{base_path}/total_unrealized_pnl")), + unrealized_loss: Indexes26::new(client.clone(), &format!("{base_path}/unrealized_loss")), + unrealized_profit: Indexes26::new(client.clone(), &format!("{base_path}/unrealized_profit")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct RelativePattern { + pub neg_unrealized_loss_rel_to_market_cap: Indexes27, + pub net_unrealized_pnl_rel_to_market_cap: Indexes26, + pub supply_in_loss_rel_to_circulating_supply: Indexes27, + pub supply_in_loss_rel_to_own_supply: Indexes27, + pub supply_in_profit_rel_to_circulating_supply: Indexes27, + pub supply_in_profit_rel_to_own_supply: Indexes27, + pub supply_rel_to_circulating_supply: Indexes, + pub unrealized_loss_rel_to_market_cap: Indexes27, + pub unrealized_profit_rel_to_market_cap: Indexes27, +} + +impl RelativePattern { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + neg_unrealized_loss_rel_to_market_cap: Indexes27::new(client.clone(), &format!("{base_path}/neg_unrealized_loss_rel_to_market_cap")), + net_unrealized_pnl_rel_to_market_cap: Indexes26::new(client.clone(), &format!("{base_path}/net_unrealized_pnl_rel_to_market_cap")), + supply_in_loss_rel_to_circulating_supply: Indexes27::new(client.clone(), &format!("{base_path}/supply_in_loss_rel_to_circulating_supply")), + supply_in_loss_rel_to_own_supply: Indexes27::new(client.clone(), &format!("{base_path}/supply_in_loss_rel_to_own_supply")), + supply_in_profit_rel_to_circulating_supply: Indexes27::new(client.clone(), &format!("{base_path}/supply_in_profit_rel_to_circulating_supply")), + supply_in_profit_rel_to_own_supply: Indexes27::new(client.clone(), &format!("{base_path}/supply_in_profit_rel_to_own_supply")), + supply_rel_to_circulating_supply: Indexes::new(client.clone(), &format!("{base_path}/supply_rel_to_circulating_supply")), + unrealized_loss_rel_to_market_cap: Indexes27::new(client.clone(), &format!("{base_path}/unrealized_loss_rel_to_market_cap")), + unrealized_profit_rel_to_market_cap: Indexes27::new(client.clone(), &format!("{base_path}/unrealized_profit_rel_to_market_cap")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct AddresstypeToHeightToAddrCountPattern { + pub p2a: Indexes16, + pub p2pk33: Indexes17, + pub p2pk65: Indexes18, + pub p2pkh: Indexes19, + pub p2sh: Indexes20, + pub p2tr: Indexes21, + pub p2wpkh: Indexes22, + pub p2wsh: Indexes23, +} + +impl AddresstypeToHeightToAddrCountPattern { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + p2a: Indexes16::new(client.clone(), &format!("{base_path}/p2a")), + p2pk33: Indexes17::new(client.clone(), &format!("{base_path}/p2pk33")), + p2pk65: Indexes18::new(client.clone(), &format!("{base_path}/p2pk65")), + p2pkh: Indexes19::new(client.clone(), &format!("{base_path}/p2pkh")), + p2sh: Indexes20::new(client.clone(), &format!("{base_path}/p2sh")), + p2tr: Indexes21::new(client.clone(), &format!("{base_path}/p2tr")), + p2wpkh: Indexes22::new(client.clone(), &format!("{base_path}/p2wpkh")), + p2wsh: Indexes23::new(client.clone(), &format!("{base_path}/p2wsh")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct BlockIntervalPattern { + pub average: Indexes3, + pub max: Indexes3, + pub median: Indexes2, + pub min: Indexes3, + pub pct10: Indexes2, + pub pct25: Indexes2, + pub pct75: Indexes2, + pub pct90: Indexes2, +} + +impl BlockIntervalPattern { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: &str) -> Self { + Self { + average: Indexes3::new(client.clone(), &format!("/{acc}_avg")), + max: Indexes3::new(client.clone(), &format!("/{acc}_max")), + median: Indexes2::new(client.clone(), &format!("/{acc}_median")), + min: Indexes3::new(client.clone(), &format!("/{acc}_min")), + pct10: Indexes2::new(client.clone(), &format!("/{acc}_pct10")), + pct25: Indexes2::new(client.clone(), &format!("/{acc}_pct25")), + pct75: Indexes2::new(client.clone(), &format!("/{acc}_pct75")), + pct90: Indexes2::new(client.clone(), &format!("/{acc}_pct90")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct Constant0Pattern { + pub dateindex: Indexes5, + pub decadeindex: Indexes7, + pub height: Indexes2, + pub monthindex: Indexes8, + pub quarterindex: Indexes9, + pub semesterindex: Indexes10, + pub weekindex: Indexes11, + pub yearindex: Indexes12, +} + +impl Constant0Pattern { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: &str) -> Self { + Self { + dateindex: Indexes5::new(client.clone(), &format!("/{acc}")), + decadeindex: Indexes7::new(client.clone(), &format!("/{acc}")), + height: Indexes2::new(client.clone(), &format!("/{acc}")), + monthindex: Indexes8::new(client.clone(), &format!("/{acc}")), + quarterindex: Indexes9::new(client.clone(), &format!("/{acc}")), + semesterindex: Indexes10::new(client.clone(), &format!("/{acc}")), + weekindex: Indexes11::new(client.clone(), &format!("/{acc}")), + yearindex: Indexes12::new(client.clone(), &format!("/{acc}")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct _0satsPattern { + pub activity: ActivityPattern, + pub addr_count: Indexes3, + pub price_paid: PricePaidPattern, + pub realized: RealizedPattern, + pub relative: RelativePattern, + pub supply: SupplyPattern2, + pub unrealized: UnrealizedPattern, +} + +impl _0satsPattern { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + activity: ActivityPattern::new(client.clone(), &format!("{base_path}/activity")), + addr_count: Indexes3::new(client.clone(), &format!("{base_path}/addr_count")), + price_paid: PricePaidPattern::new(client.clone(), &format!("{base_path}/price_paid")), + realized: RealizedPattern::new(client.clone(), &format!("{base_path}/realized")), + relative: RelativePattern::new(client.clone(), &format!("{base_path}/relative")), + supply: SupplyPattern2::new(client.clone(), &format!("{base_path}/supply")), + unrealized: UnrealizedPattern::new(client.clone(), &format!("{base_path}/unrealized")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct UpTo1dPattern { + pub activity: ActivityPattern, + pub price_paid: PricePaidPattern2, + pub realized: RealizedPattern3, + pub relative: RelativePattern2, + pub supply: SupplyPattern2, + pub unrealized: UnrealizedPattern, +} + +impl UpTo1dPattern { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + activity: ActivityPattern::new(client.clone(), &format!("{base_path}/activity")), + price_paid: PricePaidPattern2::new(client.clone(), &format!("{base_path}/price_paid")), + realized: RealizedPattern3::new(client.clone(), &format!("{base_path}/realized")), + relative: RelativePattern2::new(client.clone(), &format!("{base_path}/relative")), + supply: SupplyPattern2::new(client.clone(), &format!("{base_path}/supply")), + unrealized: UnrealizedPattern::new(client.clone(), &format!("{base_path}/unrealized")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct _0satsPattern2 { + pub activity: ActivityPattern, + pub price_paid: PricePaidPattern, + pub realized: RealizedPattern, + pub relative: RelativePattern, + pub supply: SupplyPattern2, + pub unrealized: UnrealizedPattern, +} + +impl _0satsPattern2 { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + activity: ActivityPattern::new(client.clone(), &format!("{base_path}/activity")), + price_paid: PricePaidPattern::new(client.clone(), &format!("{base_path}/price_paid")), + realized: RealizedPattern::new(client.clone(), &format!("{base_path}/realized")), + relative: RelativePattern::new(client.clone(), &format!("{base_path}/relative")), + supply: SupplyPattern2::new(client.clone(), &format!("{base_path}/supply")), + unrealized: UnrealizedPattern::new(client.clone(), &format!("{base_path}/unrealized")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct _10yTo12yPattern { + pub activity: ActivityPattern, + pub price_paid: PricePaidPattern2, + pub realized: RealizedPattern2, + pub relative: RelativePattern2, + pub supply: SupplyPattern2, + pub unrealized: UnrealizedPattern, +} + +impl _10yTo12yPattern { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + activity: ActivityPattern::new(client.clone(), &format!("{base_path}/activity")), + price_paid: PricePaidPattern2::new(client.clone(), &format!("{base_path}/price_paid")), + realized: RealizedPattern2::new(client.clone(), &format!("{base_path}/realized")), + relative: RelativePattern2::new(client.clone(), &format!("{base_path}/relative")), + supply: SupplyPattern2::new(client.clone(), &format!("{base_path}/supply")), + unrealized: UnrealizedPattern::new(client.clone(), &format!("{base_path}/unrealized")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct SupplyPattern2 { + pub supply: SupplyPattern, + pub supply_half: ActiveSupplyPattern, + pub supply_half_value: ActiveSupplyPattern, + pub supply_value: SupplyValuePattern, + pub utxo_count: Indexes3, +} + +impl SupplyPattern2 { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + supply: SupplyPattern::new(client.clone(), &format!("{base_path}/supply")), + supply_half: ActiveSupplyPattern::new(client.clone(), &format!("{base_path}/supply_half")), + supply_half_value: ActiveSupplyPattern::new(client.clone(), &format!("{base_path}/supply_half_value")), + supply_value: SupplyValuePattern::new(client.clone(), &format!("{base_path}/supply_value")), + utxo_count: Indexes3::new(client.clone(), &format!("{base_path}/utxo_count")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct ActivityPattern { + pub coinblocks_destroyed: BlockCountPattern, + pub coindays_destroyed: BlockCountPattern, + pub satblocks_destroyed: Indexes2, + pub satdays_destroyed: Indexes2, + pub sent: SentPattern, +} + +impl ActivityPattern { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + coinblocks_destroyed: BlockCountPattern::new(client.clone(), &format!("{base_path}/coinblocks_destroyed")), + coindays_destroyed: BlockCountPattern::new(client.clone(), &format!("{base_path}/coindays_destroyed")), + satblocks_destroyed: Indexes2::new(client.clone(), &format!("{base_path}/satblocks_destroyed")), + satdays_destroyed: Indexes2::new(client.clone(), &format!("{base_path}/satdays_destroyed")), + sent: SentPattern::new(client.clone(), &format!("{base_path}/sent")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct SentPattern { + pub base: Indexes2, + pub bitcoin: BlockCountPattern, + pub dollars: BlockCountPattern, + pub sats: SatsPattern, +} + +impl SentPattern { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + base: Indexes2::new(client.clone(), &format!("{base_path}/base")), + bitcoin: BlockCountPattern::new(client.clone(), &format!("{base_path}/bitcoin")), + dollars: BlockCountPattern::new(client.clone(), &format!("{base_path}/dollars")), + sats: SatsPattern::new(client.clone(), &format!("{base_path}/sats")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct SupplyPattern { + pub base: Indexes2, + pub bitcoin: Indexes, + pub dollars: Indexes, + pub sats: Indexes, +} + +impl SupplyPattern { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + base: Indexes2::new(client.clone(), &format!("{base_path}/base")), + bitcoin: Indexes::new(client.clone(), &format!("{base_path}/bitcoin")), + dollars: Indexes::new(client.clone(), &format!("{base_path}/dollars")), + sats: Indexes::new(client.clone(), &format!("{base_path}/sats")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct CoinbasePattern { + pub bitcoin: BitcoinPattern, + pub dollars: BitcoinPattern, + pub sats: BitcoinPattern, +} + +impl CoinbasePattern { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + bitcoin: BitcoinPattern::new(client.clone(), &format!("{base_path}/bitcoin")), + dollars: BitcoinPattern::new(client.clone(), &format!("{base_path}/dollars")), + sats: BitcoinPattern::new(client.clone(), &format!("{base_path}/sats")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct ActiveSupplyPattern { + pub bitcoin: Indexes3, + pub dollars: Indexes3, + pub sats: Indexes3, +} + +impl ActiveSupplyPattern { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + bitcoin: Indexes3::new(client.clone(), &format!("{base_path}/bitcoin")), + dollars: Indexes3::new(client.clone(), &format!("{base_path}/dollars")), + sats: Indexes3::new(client.clone(), &format!("{base_path}/sats")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct UnclaimedRewardsPattern { + pub bitcoin: BlockCountPattern, + pub dollars: BlockCountPattern, + pub sats: BlockCountPattern, +} + +impl UnclaimedRewardsPattern { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + bitcoin: BlockCountPattern::new(client.clone(), &format!("{base_path}/bitcoin")), + dollars: BlockCountPattern::new(client.clone(), &format!("{base_path}/dollars")), + sats: BlockCountPattern::new(client.clone(), &format!("{base_path}/sats")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct PricePaidPattern2 { + pub max_price_paid: Indexes3, + pub min_price_paid: Indexes3, + pub price_percentiles: PricePercentilesPattern, +} + +impl PricePaidPattern2 { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + max_price_paid: Indexes3::new(client.clone(), &format!("{base_path}/max_price_paid")), + min_price_paid: Indexes3::new(client.clone(), &format!("{base_path}/min_price_paid")), + price_percentiles: PricePercentilesPattern::new(client.clone(), &format!("{base_path}/price_percentiles")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct BlockCountPattern { + pub base: Indexes2, + pub cumulative: Indexes3, + pub sum: Indexes4, +} + +impl BlockCountPattern { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + base: Indexes2::new(client.clone(), &format!("{base_path}/base")), + cumulative: Indexes3::new(client.clone(), &format!("{base_path}/cumulative")), + sum: Indexes4::new(client.clone(), &format!("{base_path}/sum")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct SupplyValuePattern { + pub bitcoin: Indexes2, + pub dollars: Indexes2, +} + +impl SupplyValuePattern { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + bitcoin: Indexes2::new(client.clone(), &format!("{base_path}/bitcoin")), + dollars: Indexes2::new(client.clone(), &format!("{base_path}/dollars")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct PricePaidPattern { + pub max_price_paid: Indexes3, + pub min_price_paid: Indexes3, +} + +impl PricePaidPattern { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + max_price_paid: Indexes3::new(client.clone(), &format!("{base_path}/max_price_paid")), + min_price_paid: Indexes3::new(client.clone(), &format!("{base_path}/min_price_paid")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct SatsPattern { + pub cumulative: Indexes3, + pub sum: Indexes4, +} + +impl SatsPattern { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + cumulative: Indexes3::new(client.clone(), &format!("{base_path}/cumulative")), + sum: Indexes4::new(client.clone(), &format!("{base_path}/sum")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct _1dReturns1mSdPattern { + pub sd: Indexes, + pub sma: Indexes, +} + +impl _1dReturns1mSdPattern { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: &str) -> Self { + Self { + sd: Indexes::new(client.clone(), &format!("/{acc}_sd")), + sma: Indexes::new(client.clone(), &format!("/{acc}_sma")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct BitcoinPattern2 { + pub base: Indexes2, + pub sum: Indexes4, +} + +impl BitcoinPattern2 { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + base: Indexes2::new(client.clone(), &format!("{base_path}/base")), + sum: Indexes4::new(client.clone(), &format!("{base_path}/sum")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct RealizedPriceExtraPattern { + pub ratio: Indexes, +} + +impl RealizedPriceExtraPattern { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + ratio: Indexes::new(client.clone(), &format!("{base_path}/ratio")), + } + } +} + +// Catalog tree + +/// Catalog tree node. +pub struct CatalogTree { + pub computed: CatalogTree_Computed, + pub indexed: CatalogTree_Indexed, +} + +impl CatalogTree { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + computed: CatalogTree_Computed::new(client.clone(), &format!("{base_path}/computed")), + indexed: CatalogTree_Indexed::new(client.clone(), &format!("{base_path}/indexed")), + } + } +} + +/// Catalog tree node. +pub struct CatalogTree_Computed { + pub blks: CatalogTree_Computed_Blks, + pub chain: CatalogTree_Computed_Chain, + pub cointime: CatalogTree_Computed_Cointime, + pub constants: CatalogTree_Computed_Constants, + pub fetched: CatalogTree_Computed_Fetched, + pub indexes: CatalogTree_Computed_Indexes, + pub market: CatalogTree_Computed_Market, + pub pools: CatalogTree_Computed_Pools, + pub price: CatalogTree_Computed_Price, + pub stateful: CatalogTree_Computed_Stateful, + pub txins: CatalogTree_Computed_Txins, + pub txouts: CatalogTree_Computed_Txouts, +} + +impl CatalogTree_Computed { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + blks: CatalogTree_Computed_Blks::new(client.clone(), &format!("{base_path}/blks")), + chain: CatalogTree_Computed_Chain::new(client.clone(), &format!("{base_path}/chain")), + cointime: CatalogTree_Computed_Cointime::new(client.clone(), &format!("{base_path}/cointime")), + constants: CatalogTree_Computed_Constants::new(client.clone(), &format!("{base_path}/constants")), + fetched: CatalogTree_Computed_Fetched::new(client.clone(), &format!("{base_path}/fetched")), + indexes: CatalogTree_Computed_Indexes::new(client.clone(), &format!("{base_path}/indexes")), + market: CatalogTree_Computed_Market::new(client.clone(), &format!("{base_path}/market")), + pools: CatalogTree_Computed_Pools::new(client.clone(), &format!("{base_path}/pools")), + price: CatalogTree_Computed_Price::new(client.clone(), &format!("{base_path}/price")), + stateful: CatalogTree_Computed_Stateful::new(client.clone(), &format!("{base_path}/stateful")), + txins: CatalogTree_Computed_Txins::new(client.clone(), &format!("{base_path}/txins")), + txouts: CatalogTree_Computed_Txouts::new(client.clone(), &format!("{base_path}/txouts")), + } + } +} + +/// Catalog tree node. +pub struct CatalogTree_Computed_Blks { + pub position: MetricNode, +} + +impl CatalogTree_Computed_Blks { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + position: MetricNode::new(client.clone(), format!("{base_path}/position")), + } + } +} + +/// Catalog tree node. +pub struct CatalogTree_Computed_Chain { + pub _1m_block_count: Indexes, + pub _1w_block_count: Indexes, + pub _1y_block_count: Indexes, + pub _24h_block_count: Indexes2, + pub _24h_coinbase_sum: Indexes2, + pub _24h_coinbase_usd_sum: Indexes2, + pub annualized_volume: Indexes, + pub annualized_volume_btc: Indexes, + pub annualized_volume_usd: Indexes, + pub block_count: BlockCountPattern, + pub block_count_target: Indexes, + pub block_interval: BlockIntervalPattern, + pub block_size: BlockSizePattern, + pub block_vbytes: BlockSizePattern, + pub block_weight: BlockSizePattern, + pub blocks_before_next_difficulty_adjustment: Indexes3, + pub blocks_before_next_halving: Indexes3, + pub coinbase: CoinbasePattern, + pub days_before_next_difficulty_adjustment: Indexes3, + pub days_before_next_halving: Indexes3, + pub difficulty: Indexes4, + pub difficulty_adjustment: Indexes3, + pub difficulty_as_hash: Indexes3, + pub difficultyepoch: Indexes, + pub emptyoutput_count: BitcoinPattern, + pub exact_utxo_count: Indexes3, + pub fee: CatalogTree_Computed_Chain_Fee, + pub fee_dominance: Indexes5, + pub fee_rate: CatalogTree_Computed_Chain_FeeRate, + pub halvingepoch: Indexes, + pub hash_price_phs: Indexes3, + pub hash_price_phs_min: Indexes3, + pub hash_price_rebound: Indexes3, + pub hash_price_ths: Indexes3, + pub hash_price_ths_min: Indexes3, + pub hash_rate: Indexes3, + pub hash_rate_1m_sma: Indexes, + pub hash_rate_1w_sma: Indexes, + pub hash_rate_1y_sma: Indexes, + pub hash_rate_2m_sma: Indexes, + pub hash_value_phs: Indexes3, + pub hash_value_phs_min: Indexes3, + pub hash_value_rebound: Indexes3, + pub hash_value_ths: Indexes3, + pub hash_value_ths_min: Indexes3, + pub inflation_rate: Indexes, + pub input_count: BlockSizePattern, + pub input_value: Indexes6, + pub inputs_per_sec: Indexes, + pub interval: Indexes2, + pub is_coinbase: Indexes6, + pub opreturn_count: BitcoinPattern, + pub output_count: BlockSizePattern, + pub output_value: Indexes6, + pub outputs_per_sec: Indexes, + pub p2a_count: BitcoinPattern, + pub p2ms_count: BitcoinPattern, + pub p2pk33_count: BitcoinPattern, + pub p2pk65_count: BitcoinPattern, + pub p2pkh_count: BitcoinPattern, + pub p2sh_count: BitcoinPattern, + pub p2tr_count: BitcoinPattern, + pub p2wpkh_count: BitcoinPattern, + pub p2wsh_count: BitcoinPattern, + pub puell_multiple: Indexes, + pub sent_sum: CatalogTree_Computed_Chain_SentSum, + pub subsidy: CoinbasePattern, + pub subsidy_dominance: Indexes5, + pub subsidy_usd_1y_sma: Indexes, + pub timestamp: MetricNode, + pub tx_btc_velocity: Indexes, + pub tx_count: BitcoinPattern, + pub tx_per_sec: Indexes, + pub tx_usd_velocity: Indexes, + pub tx_v1: BlockCountPattern, + pub tx_v2: BlockCountPattern, + pub tx_v3: BlockCountPattern, + pub tx_vsize: BlockIntervalPattern, + pub tx_weight: BlockIntervalPattern, + pub unclaimed_rewards: UnclaimedRewardsPattern, + pub unknownoutput_count: BitcoinPattern, + pub vbytes: Indexes2, + pub vsize: Indexes6, + pub weight: Indexes6, +} + +impl CatalogTree_Computed_Chain { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + _1m_block_count: Indexes::new(client.clone(), &format!("{base_path}/1m_block_count")), + _1w_block_count: Indexes::new(client.clone(), &format!("{base_path}/1w_block_count")), + _1y_block_count: Indexes::new(client.clone(), &format!("{base_path}/1y_block_count")), + _24h_block_count: Indexes2::new(client.clone(), &format!("{base_path}/24h_block_count")), + _24h_coinbase_sum: Indexes2::new(client.clone(), &format!("{base_path}/24h_coinbase_sum")), + _24h_coinbase_usd_sum: Indexes2::new(client.clone(), &format!("{base_path}/24h_coinbase_usd_sum")), + annualized_volume: Indexes::new(client.clone(), &format!("{base_path}/annualized_volume")), + annualized_volume_btc: Indexes::new(client.clone(), &format!("{base_path}/annualized_volume_btc")), + annualized_volume_usd: Indexes::new(client.clone(), &format!("{base_path}/annualized_volume_usd")), + block_count: BlockCountPattern::new(client.clone(), &format!("{base_path}/block_count")), + block_count_target: Indexes::new(client.clone(), &format!("{base_path}/block_count_target")), + block_interval: BlockIntervalPattern::new(client.clone(), "block_interval"), + block_size: BlockSizePattern::new(client.clone(), &format!("{base_path}/block_size")), + block_vbytes: BlockSizePattern::new(client.clone(), &format!("{base_path}/block_vbytes")), + block_weight: BlockSizePattern::new(client.clone(), &format!("{base_path}/block_weight")), + blocks_before_next_difficulty_adjustment: Indexes3::new(client.clone(), &format!("{base_path}/blocks_before_next_difficulty_adjustment")), + blocks_before_next_halving: Indexes3::new(client.clone(), &format!("{base_path}/blocks_before_next_halving")), + coinbase: CoinbasePattern::new(client.clone(), &format!("{base_path}/coinbase")), + days_before_next_difficulty_adjustment: Indexes3::new(client.clone(), &format!("{base_path}/days_before_next_difficulty_adjustment")), + days_before_next_halving: Indexes3::new(client.clone(), &format!("{base_path}/days_before_next_halving")), + difficulty: Indexes4::new(client.clone(), &format!("{base_path}/difficulty")), + difficulty_adjustment: Indexes3::new(client.clone(), &format!("{base_path}/difficulty_adjustment")), + difficulty_as_hash: Indexes3::new(client.clone(), &format!("{base_path}/difficulty_as_hash")), + difficultyepoch: Indexes::new(client.clone(), &format!("{base_path}/difficultyepoch")), + emptyoutput_count: BitcoinPattern::new(client.clone(), &format!("{base_path}/emptyoutput_count")), + exact_utxo_count: Indexes3::new(client.clone(), &format!("{base_path}/exact_utxo_count")), + fee: CatalogTree_Computed_Chain_Fee::new(client.clone(), &format!("{base_path}/fee")), + fee_dominance: Indexes5::new(client.clone(), &format!("{base_path}/fee_dominance")), + fee_rate: CatalogTree_Computed_Chain_FeeRate::new(client.clone(), &format!("{base_path}/fee_rate")), + halvingepoch: Indexes::new(client.clone(), &format!("{base_path}/halvingepoch")), + hash_price_phs: Indexes3::new(client.clone(), &format!("{base_path}/hash_price_phs")), + hash_price_phs_min: Indexes3::new(client.clone(), &format!("{base_path}/hash_price_phs_min")), + hash_price_rebound: Indexes3::new(client.clone(), &format!("{base_path}/hash_price_rebound")), + hash_price_ths: Indexes3::new(client.clone(), &format!("{base_path}/hash_price_ths")), + hash_price_ths_min: Indexes3::new(client.clone(), &format!("{base_path}/hash_price_ths_min")), + hash_rate: Indexes3::new(client.clone(), &format!("{base_path}/hash_rate")), + hash_rate_1m_sma: Indexes::new(client.clone(), &format!("{base_path}/hash_rate_1m_sma")), + hash_rate_1w_sma: Indexes::new(client.clone(), &format!("{base_path}/hash_rate_1w_sma")), + hash_rate_1y_sma: Indexes::new(client.clone(), &format!("{base_path}/hash_rate_1y_sma")), + hash_rate_2m_sma: Indexes::new(client.clone(), &format!("{base_path}/hash_rate_2m_sma")), + hash_value_phs: Indexes3::new(client.clone(), &format!("{base_path}/hash_value_phs")), + hash_value_phs_min: Indexes3::new(client.clone(), &format!("{base_path}/hash_value_phs_min")), + hash_value_rebound: Indexes3::new(client.clone(), &format!("{base_path}/hash_value_rebound")), + hash_value_ths: Indexes3::new(client.clone(), &format!("{base_path}/hash_value_ths")), + hash_value_ths_min: Indexes3::new(client.clone(), &format!("{base_path}/hash_value_ths_min")), + inflation_rate: Indexes::new(client.clone(), &format!("{base_path}/inflation_rate")), + input_count: BlockSizePattern::new(client.clone(), &format!("{base_path}/input_count")), + input_value: Indexes6::new(client.clone(), &format!("{base_path}/input_value")), + inputs_per_sec: Indexes::new(client.clone(), &format!("{base_path}/inputs_per_sec")), + interval: Indexes2::new(client.clone(), &format!("{base_path}/interval")), + is_coinbase: Indexes6::new(client.clone(), &format!("{base_path}/is_coinbase")), + opreturn_count: BitcoinPattern::new(client.clone(), &format!("{base_path}/opreturn_count")), + output_count: BlockSizePattern::new(client.clone(), &format!("{base_path}/output_count")), + output_value: Indexes6::new(client.clone(), &format!("{base_path}/output_value")), + outputs_per_sec: Indexes::new(client.clone(), &format!("{base_path}/outputs_per_sec")), + p2a_count: BitcoinPattern::new(client.clone(), &format!("{base_path}/p2a_count")), + p2ms_count: BitcoinPattern::new(client.clone(), &format!("{base_path}/p2ms_count")), + p2pk33_count: BitcoinPattern::new(client.clone(), &format!("{base_path}/p2pk33_count")), + p2pk65_count: BitcoinPattern::new(client.clone(), &format!("{base_path}/p2pk65_count")), + p2pkh_count: BitcoinPattern::new(client.clone(), &format!("{base_path}/p2pkh_count")), + p2sh_count: BitcoinPattern::new(client.clone(), &format!("{base_path}/p2sh_count")), + p2tr_count: BitcoinPattern::new(client.clone(), &format!("{base_path}/p2tr_count")), + p2wpkh_count: BitcoinPattern::new(client.clone(), &format!("{base_path}/p2wpkh_count")), + p2wsh_count: BitcoinPattern::new(client.clone(), &format!("{base_path}/p2wsh_count")), + puell_multiple: Indexes::new(client.clone(), &format!("{base_path}/puell_multiple")), + sent_sum: CatalogTree_Computed_Chain_SentSum::new(client.clone(), &format!("{base_path}/sent_sum")), + subsidy: CoinbasePattern::new(client.clone(), &format!("{base_path}/subsidy")), + subsidy_dominance: Indexes5::new(client.clone(), &format!("{base_path}/subsidy_dominance")), + subsidy_usd_1y_sma: Indexes::new(client.clone(), &format!("{base_path}/subsidy_usd_1y_sma")), + timestamp: MetricNode::new(client.clone(), format!("{base_path}/timestamp")), + tx_btc_velocity: Indexes::new(client.clone(), &format!("{base_path}/tx_btc_velocity")), + tx_count: BitcoinPattern::new(client.clone(), &format!("{base_path}/tx_count")), + tx_per_sec: Indexes::new(client.clone(), &format!("{base_path}/tx_per_sec")), + tx_usd_velocity: Indexes::new(client.clone(), &format!("{base_path}/tx_usd_velocity")), + tx_v1: BlockCountPattern::new(client.clone(), &format!("{base_path}/tx_v1")), + tx_v2: BlockCountPattern::new(client.clone(), &format!("{base_path}/tx_v2")), + tx_v3: BlockCountPattern::new(client.clone(), &format!("{base_path}/tx_v3")), + tx_vsize: BlockIntervalPattern::new(client.clone(), "tx_vsize"), + tx_weight: BlockIntervalPattern::new(client.clone(), "tx_weight"), + unclaimed_rewards: UnclaimedRewardsPattern::new(client.clone(), &format!("{base_path}/unclaimed_rewards")), + unknownoutput_count: BitcoinPattern::new(client.clone(), &format!("{base_path}/unknownoutput_count")), + vbytes: Indexes2::new(client.clone(), &format!("{base_path}/vbytes")), + vsize: Indexes6::new(client.clone(), &format!("{base_path}/vsize")), + weight: Indexes6::new(client.clone(), &format!("{base_path}/weight")), + } + } +} + +/// Catalog tree node. +pub struct CatalogTree_Computed_Chain_Fee { + pub base: Indexes6, + pub bitcoin: BlockSizePattern, + pub bitcoin_txindex: Indexes6, + pub dollars: BlockSizePattern, + pub dollars_txindex: Indexes6, + pub sats: BlockSizePattern, +} + +impl CatalogTree_Computed_Chain_Fee { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + base: Indexes6::new(client.clone(), &format!("{base_path}/base")), + bitcoin: BlockSizePattern::new(client.clone(), &format!("{base_path}/bitcoin")), + bitcoin_txindex: Indexes6::new(client.clone(), &format!("{base_path}/bitcoin_txindex")), + dollars: BlockSizePattern::new(client.clone(), &format!("{base_path}/dollars")), + dollars_txindex: Indexes6::new(client.clone(), &format!("{base_path}/dollars_txindex")), + sats: BlockSizePattern::new(client.clone(), &format!("{base_path}/sats")), + } + } +} + +/// Catalog tree node. +pub struct CatalogTree_Computed_Chain_FeeRate { + pub average: Indexes3, + pub base: Indexes6, + pub max: Indexes3, + pub median: Indexes2, + pub min: Indexes3, + pub pct10: Indexes2, + pub pct25: Indexes2, + pub pct75: Indexes2, + pub pct90: Indexes2, +} + +impl CatalogTree_Computed_Chain_FeeRate { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + average: Indexes3::new(client.clone(), &format!("{base_path}/average")), + base: Indexes6::new(client.clone(), &format!("{base_path}/base")), + max: Indexes3::new(client.clone(), &format!("{base_path}/max")), + median: Indexes2::new(client.clone(), &format!("{base_path}/median")), + min: Indexes3::new(client.clone(), &format!("{base_path}/min")), + pct10: Indexes2::new(client.clone(), &format!("{base_path}/pct10")), + pct25: Indexes2::new(client.clone(), &format!("{base_path}/pct25")), + pct75: Indexes2::new(client.clone(), &format!("{base_path}/pct75")), + pct90: Indexes2::new(client.clone(), &format!("{base_path}/pct90")), + } + } +} + +/// Catalog tree node. +pub struct CatalogTree_Computed_Chain_SentSum { + pub bitcoin: BitcoinPattern2, + pub dollars: Indexes3, + pub sats: Indexes3, +} + +impl CatalogTree_Computed_Chain_SentSum { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + bitcoin: BitcoinPattern2::new(client.clone(), &format!("{base_path}/bitcoin")), + dollars: Indexes3::new(client.clone(), &format!("{base_path}/dollars")), + sats: Indexes3::new(client.clone(), &format!("{base_path}/sats")), + } + } +} + +/// Catalog tree node. +pub struct CatalogTree_Computed_Cointime { + pub active_cap: Indexes3, + pub active_price: Indexes3, + pub active_price_ratio: ActivePriceRatioPattern, + pub active_supply: ActiveSupplyPattern, + pub activity_to_vaultedness_ratio: Indexes3, + pub coinblocks_created: BlockCountPattern, + pub coinblocks_stored: BlockCountPattern, + pub cointime_adj_inflation_rate: Indexes, + pub cointime_adj_tx_btc_velocity: Indexes, + pub cointime_adj_tx_usd_velocity: Indexes, + pub cointime_cap: Indexes3, + pub cointime_price: Indexes3, + pub cointime_price_ratio: ActivePriceRatioPattern, + pub cointime_value_created: BlockCountPattern, + pub cointime_value_destroyed: BlockCountPattern, + pub cointime_value_stored: BlockCountPattern, + pub investor_cap: Indexes3, + pub liveliness: Indexes3, + pub thermo_cap: Indexes3, + pub true_market_mean: Indexes3, + pub true_market_mean_ratio: ActivePriceRatioPattern, + pub vaulted_cap: Indexes3, + pub vaulted_price: Indexes3, + pub vaulted_price_ratio: ActivePriceRatioPattern, + pub vaulted_supply: ActiveSupplyPattern, + pub vaultedness: Indexes3, +} + +impl CatalogTree_Computed_Cointime { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + active_cap: Indexes3::new(client.clone(), &format!("{base_path}/active_cap")), + active_price: Indexes3::new(client.clone(), &format!("{base_path}/active_price")), + active_price_ratio: ActivePriceRatioPattern::new(client.clone(), &format!("{base_path}/active_price_ratio")), + active_supply: ActiveSupplyPattern::new(client.clone(), &format!("{base_path}/active_supply")), + activity_to_vaultedness_ratio: Indexes3::new(client.clone(), &format!("{base_path}/activity_to_vaultedness_ratio")), + coinblocks_created: BlockCountPattern::new(client.clone(), &format!("{base_path}/coinblocks_created")), + coinblocks_stored: BlockCountPattern::new(client.clone(), &format!("{base_path}/coinblocks_stored")), + cointime_adj_inflation_rate: Indexes::new(client.clone(), &format!("{base_path}/cointime_adj_inflation_rate")), + cointime_adj_tx_btc_velocity: Indexes::new(client.clone(), &format!("{base_path}/cointime_adj_tx_btc_velocity")), + cointime_adj_tx_usd_velocity: Indexes::new(client.clone(), &format!("{base_path}/cointime_adj_tx_usd_velocity")), + cointime_cap: Indexes3::new(client.clone(), &format!("{base_path}/cointime_cap")), + cointime_price: Indexes3::new(client.clone(), &format!("{base_path}/cointime_price")), + cointime_price_ratio: ActivePriceRatioPattern::new(client.clone(), &format!("{base_path}/cointime_price_ratio")), + cointime_value_created: BlockCountPattern::new(client.clone(), &format!("{base_path}/cointime_value_created")), + cointime_value_destroyed: BlockCountPattern::new(client.clone(), &format!("{base_path}/cointime_value_destroyed")), + cointime_value_stored: BlockCountPattern::new(client.clone(), &format!("{base_path}/cointime_value_stored")), + investor_cap: Indexes3::new(client.clone(), &format!("{base_path}/investor_cap")), + liveliness: Indexes3::new(client.clone(), &format!("{base_path}/liveliness")), + thermo_cap: Indexes3::new(client.clone(), &format!("{base_path}/thermo_cap")), + true_market_mean: Indexes3::new(client.clone(), &format!("{base_path}/true_market_mean")), + true_market_mean_ratio: ActivePriceRatioPattern::new(client.clone(), &format!("{base_path}/true_market_mean_ratio")), + vaulted_cap: Indexes3::new(client.clone(), &format!("{base_path}/vaulted_cap")), + vaulted_price: Indexes3::new(client.clone(), &format!("{base_path}/vaulted_price")), + vaulted_price_ratio: ActivePriceRatioPattern::new(client.clone(), &format!("{base_path}/vaulted_price_ratio")), + vaulted_supply: ActiveSupplyPattern::new(client.clone(), &format!("{base_path}/vaulted_supply")), + vaultedness: Indexes3::new(client.clone(), &format!("{base_path}/vaultedness")), + } + } +} + +/// Catalog tree node. +pub struct CatalogTree_Computed_Constants { + pub constant_0: Constant0Pattern, + pub constant_1: Constant0Pattern, + pub constant_100: Constant0Pattern, + pub constant_2: Constant0Pattern, + pub constant_3: Constant0Pattern, + pub constant_38_2: Constant0Pattern, + pub constant_4: Constant0Pattern, + pub constant_50: Constant0Pattern, + pub constant_600: Constant0Pattern, + pub constant_61_8: Constant0Pattern, + pub constant_minus_1: Constant0Pattern, + pub constant_minus_2: Constant0Pattern, + pub constant_minus_3: Constant0Pattern, + pub constant_minus_4: Constant0Pattern, +} + +impl CatalogTree_Computed_Constants { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + constant_0: Constant0Pattern::new(client.clone(), "constant_0"), + constant_1: Constant0Pattern::new(client.clone(), "constant_1"), + constant_100: Constant0Pattern::new(client.clone(), "constant_100"), + constant_2: Constant0Pattern::new(client.clone(), "constant_2"), + constant_3: Constant0Pattern::new(client.clone(), "constant_3"), + constant_38_2: Constant0Pattern::new(client.clone(), "constant_38_2"), + constant_4: Constant0Pattern::new(client.clone(), "constant_4"), + constant_50: Constant0Pattern::new(client.clone(), "constant_50"), + constant_600: Constant0Pattern::new(client.clone(), "constant_600"), + constant_61_8: Constant0Pattern::new(client.clone(), "constant_61_8"), + constant_minus_1: Constant0Pattern::new(client.clone(), "constant_minus_1"), + constant_minus_2: Constant0Pattern::new(client.clone(), "constant_minus_2"), + constant_minus_3: Constant0Pattern::new(client.clone(), "constant_minus_3"), + constant_minus_4: Constant0Pattern::new(client.clone(), "constant_minus_4"), + } + } +} + +/// Catalog tree node. +pub struct CatalogTree_Computed_Fetched { + pub price_ohlc_in_cents: Indexes13, +} + +impl CatalogTree_Computed_Fetched { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + price_ohlc_in_cents: Indexes13::new(client.clone(), &format!("{base_path}/price_ohlc_in_cents")), + } + } +} + +/// Catalog tree node. +pub struct CatalogTree_Computed_Indexes { + pub date: Indexes13, + pub date_fixed: Indexes2, + pub dateindex: Indexes13, + pub dateindex_count: Indexes14, + pub decadeindex: MetricNode, + pub difficultyepoch: MetricNode, + pub emptyoutputindex: MetricNode, + pub first_dateindex: Indexes14, + pub first_height: MetricNode, + pub first_monthindex: Indexes15, + pub first_yearindex: Indexes7, + pub halvingepoch: MetricNode, + pub height: Indexes2, + pub height_count: MetricNode, + pub input_count: Indexes6, + pub monthindex: MetricNode, + pub monthindex_count: Indexes15, + pub opreturnindex: MetricNode, + pub output_count: Indexes6, + pub p2aaddressindex: Indexes16, + pub p2msoutputindex: MetricNode, + pub p2pk33addressindex: Indexes17, + pub p2pk65addressindex: Indexes18, + pub p2pkhaddressindex: Indexes19, + pub p2shaddressindex: Indexes20, + pub p2traddressindex: Indexes21, + pub p2wpkhaddressindex: Indexes22, + pub p2wshaddressindex: Indexes23, + pub quarterindex: MetricNode, + pub semesterindex: MetricNode, + pub timestamp_fixed: Indexes2, + pub txindex: Indexes6, + pub txindex_count: Indexes2, + pub txinindex: Indexes24, + pub txoutindex: Indexes25, + pub unknownoutputindex: MetricNode, + pub weekindex: MetricNode, + pub yearindex: MetricNode, + pub yearindex_count: Indexes7, +} + +impl CatalogTree_Computed_Indexes { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + date: Indexes13::new(client.clone(), &format!("{base_path}/date")), + date_fixed: Indexes2::new(client.clone(), &format!("{base_path}/date_fixed")), + dateindex: Indexes13::new(client.clone(), &format!("{base_path}/dateindex")), + dateindex_count: Indexes14::new(client.clone(), &format!("{base_path}/dateindex_count")), + decadeindex: MetricNode::new(client.clone(), format!("{base_path}/decadeindex")), + difficultyepoch: MetricNode::new(client.clone(), format!("{base_path}/difficultyepoch")), + emptyoutputindex: MetricNode::new(client.clone(), format!("{base_path}/emptyoutputindex")), + first_dateindex: Indexes14::new(client.clone(), &format!("{base_path}/first_dateindex")), + first_height: MetricNode::new(client.clone(), format!("{base_path}/first_height")), + first_monthindex: Indexes15::new(client.clone(), &format!("{base_path}/first_monthindex")), + first_yearindex: Indexes7::new(client.clone(), &format!("{base_path}/first_yearindex")), + halvingepoch: MetricNode::new(client.clone(), format!("{base_path}/halvingepoch")), + height: Indexes2::new(client.clone(), &format!("{base_path}/height")), + height_count: MetricNode::new(client.clone(), format!("{base_path}/height_count")), + input_count: Indexes6::new(client.clone(), &format!("{base_path}/input_count")), + monthindex: MetricNode::new(client.clone(), format!("{base_path}/monthindex")), + monthindex_count: Indexes15::new(client.clone(), &format!("{base_path}/monthindex_count")), + opreturnindex: MetricNode::new(client.clone(), format!("{base_path}/opreturnindex")), + output_count: Indexes6::new(client.clone(), &format!("{base_path}/output_count")), + p2aaddressindex: Indexes16::new(client.clone(), &format!("{base_path}/p2aaddressindex")), + p2msoutputindex: MetricNode::new(client.clone(), format!("{base_path}/p2msoutputindex")), + p2pk33addressindex: Indexes17::new(client.clone(), &format!("{base_path}/p2pk33addressindex")), + p2pk65addressindex: Indexes18::new(client.clone(), &format!("{base_path}/p2pk65addressindex")), + p2pkhaddressindex: Indexes19::new(client.clone(), &format!("{base_path}/p2pkhaddressindex")), + p2shaddressindex: Indexes20::new(client.clone(), &format!("{base_path}/p2shaddressindex")), + p2traddressindex: Indexes21::new(client.clone(), &format!("{base_path}/p2traddressindex")), + p2wpkhaddressindex: Indexes22::new(client.clone(), &format!("{base_path}/p2wpkhaddressindex")), + p2wshaddressindex: Indexes23::new(client.clone(), &format!("{base_path}/p2wshaddressindex")), + quarterindex: MetricNode::new(client.clone(), format!("{base_path}/quarterindex")), + semesterindex: MetricNode::new(client.clone(), format!("{base_path}/semesterindex")), + timestamp_fixed: Indexes2::new(client.clone(), &format!("{base_path}/timestamp_fixed")), + txindex: Indexes6::new(client.clone(), &format!("{base_path}/txindex")), + txindex_count: Indexes2::new(client.clone(), &format!("{base_path}/txindex_count")), + txinindex: Indexes24::new(client.clone(), &format!("{base_path}/txinindex")), + txoutindex: Indexes25::new(client.clone(), &format!("{base_path}/txoutindex")), + unknownoutputindex: MetricNode::new(client.clone(), format!("{base_path}/unknownoutputindex")), + weekindex: MetricNode::new(client.clone(), format!("{base_path}/weekindex")), + yearindex: MetricNode::new(client.clone(), format!("{base_path}/yearindex")), + yearindex_count: Indexes7::new(client.clone(), &format!("{base_path}/yearindex_count")), + } + } +} + +/// Catalog tree node. +pub struct CatalogTree_Computed_Market { + pub _1d_returns_1m_sd: _1dReturns1mSdPattern, + pub _1d_returns_1w_sd: _1dReturns1mSdPattern, + pub _1d_returns_1y_sd: _1dReturns1mSdPattern, + pub _10y_cagr: Indexes, + pub _10y_dca_avg_price: Indexes, + pub _10y_dca_cagr: Indexes, + pub _10y_dca_returns: Indexes, + pub _10y_dca_stack: Indexes, + pub _10y_price_returns: Indexes, + pub _1d_price_returns: Indexes, + pub _1m_dca_avg_price: Indexes, + pub _1m_dca_returns: Indexes, + pub _1m_dca_stack: Indexes, + pub _1m_price_returns: Indexes, + pub _1w_dca_avg_price: Indexes, + pub _1w_dca_returns: Indexes, + pub _1w_dca_stack: Indexes, + pub _1w_price_returns: Indexes, + pub _1y_dca_avg_price: Indexes, + pub _1y_dca_returns: Indexes, + pub _1y_dca_stack: Indexes, + pub _1y_price_returns: Indexes, + pub _2y_cagr: Indexes, + pub _2y_dca_avg_price: Indexes, + pub _2y_dca_cagr: Indexes, + pub _2y_dca_returns: Indexes, + pub _2y_dca_stack: Indexes, + pub _2y_price_returns: Indexes, + pub _3m_dca_avg_price: Indexes, + pub _3m_dca_returns: Indexes, + pub _3m_dca_stack: Indexes, + pub _3m_price_returns: Indexes, + pub _3y_cagr: Indexes, + pub _3y_dca_avg_price: Indexes, + pub _3y_dca_cagr: Indexes, + pub _3y_dca_returns: Indexes, + pub _3y_dca_stack: Indexes, + pub _3y_price_returns: Indexes, + pub _4y_cagr: Indexes, + pub _4y_dca_avg_price: Indexes, + pub _4y_dca_cagr: Indexes, + pub _4y_dca_returns: Indexes, + pub _4y_dca_stack: Indexes, + pub _4y_price_returns: Indexes, + pub _5y_cagr: Indexes, + pub _5y_dca_avg_price: Indexes, + pub _5y_dca_cagr: Indexes, + pub _5y_dca_returns: Indexes, + pub _5y_dca_stack: Indexes, + pub _5y_price_returns: Indexes, + pub _6m_dca_avg_price: Indexes, + pub _6m_dca_returns: Indexes, + pub _6m_dca_stack: Indexes, + pub _6m_price_returns: Indexes, + pub _6y_cagr: Indexes, + pub _6y_dca_avg_price: Indexes, + pub _6y_dca_cagr: Indexes, + pub _6y_dca_returns: Indexes, + pub _6y_dca_stack: Indexes, + pub _6y_price_returns: Indexes, + pub _8y_cagr: Indexes, + pub _8y_dca_avg_price: Indexes, + pub _8y_dca_cagr: Indexes, + pub _8y_dca_returns: Indexes, + pub _8y_dca_stack: Indexes, + pub _8y_price_returns: Indexes, + pub days_since_price_ath: Indexes, + pub dca_class_2015_avg_price: Indexes, + pub dca_class_2015_returns: Indexes, + pub dca_class_2015_stack: Indexes, + pub dca_class_2016_avg_price: Indexes, + pub dca_class_2016_returns: Indexes, + pub dca_class_2016_stack: Indexes, + pub dca_class_2017_avg_price: Indexes, + pub dca_class_2017_returns: Indexes, + pub dca_class_2017_stack: Indexes, + pub dca_class_2018_avg_price: Indexes, + pub dca_class_2018_returns: Indexes, + pub dca_class_2018_stack: Indexes, + pub dca_class_2019_avg_price: Indexes, + pub dca_class_2019_returns: Indexes, + pub dca_class_2019_stack: Indexes, + pub dca_class_2020_avg_price: Indexes, + pub dca_class_2020_returns: Indexes, + pub dca_class_2020_stack: Indexes, + pub dca_class_2021_avg_price: Indexes, + pub dca_class_2021_returns: Indexes, + pub dca_class_2021_stack: Indexes, + pub dca_class_2022_avg_price: Indexes, + pub dca_class_2022_returns: Indexes, + pub dca_class_2022_stack: Indexes, + pub dca_class_2023_avg_price: Indexes, + pub dca_class_2023_returns: Indexes, + pub dca_class_2023_stack: Indexes, + pub dca_class_2024_avg_price: Indexes, + pub dca_class_2024_returns: Indexes, + pub dca_class_2024_stack: Indexes, + pub dca_class_2025_avg_price: Indexes, + pub dca_class_2025_returns: Indexes, + pub dca_class_2025_stack: Indexes, + pub max_days_between_price_aths: Indexes, + pub max_years_between_price_aths: Indexes, + pub price_10y_ago: Indexes, + pub price_13d_ema: Price13dEmaPattern, + pub price_13d_sma: Price13dEmaPattern, + pub price_144d_ema: Price13dEmaPattern, + pub price_144d_sma: Price13dEmaPattern, + pub price_1d_ago: Indexes, + pub price_1m_ago: Indexes, + pub price_1m_ema: Price13dEmaPattern, + pub price_1m_max: Indexes, + pub price_1m_min: Indexes, + pub price_1m_sma: Price13dEmaPattern, + pub price_1m_volatility: Indexes, + pub price_1w_ago: Indexes, + pub price_1w_ema: Price13dEmaPattern, + pub price_1w_max: Indexes, + pub price_1w_min: Indexes, + pub price_1w_sma: Price13dEmaPattern, + pub price_1w_volatility: Indexes, + pub price_1y_ago: Indexes, + pub price_1y_ema: Price13dEmaPattern, + pub price_1y_max: Indexes, + pub price_1y_min: Indexes, + pub price_1y_sma: Price13dEmaPattern, + pub price_1y_volatility: Indexes, + pub price_200d_ema: Price13dEmaPattern, + pub price_200d_sma: Price13dEmaPattern, + pub price_200d_sma_x0_8: Indexes, + pub price_200d_sma_x2_4: Indexes, + pub price_200w_ema: Price13dEmaPattern, + pub price_200w_sma: Price13dEmaPattern, + pub price_21d_ema: Price13dEmaPattern, + pub price_21d_sma: Price13dEmaPattern, + pub price_2w_choppiness_index: Indexes, + pub price_2w_max: Indexes, + pub price_2w_min: Indexes, + pub price_2y_ago: Indexes, + pub price_2y_ema: Price13dEmaPattern, + pub price_2y_sma: Price13dEmaPattern, + pub price_34d_ema: Price13dEmaPattern, + pub price_34d_sma: Price13dEmaPattern, + pub price_3m_ago: Indexes, + pub price_3y_ago: Indexes, + pub price_4y_ago: Indexes, + pub price_4y_ema: Price13dEmaPattern, + pub price_4y_sma: Price13dEmaPattern, + pub price_55d_ema: Price13dEmaPattern, + pub price_55d_sma: Price13dEmaPattern, + pub price_5y_ago: Indexes, + pub price_6m_ago: Indexes, + pub price_6y_ago: Indexes, + pub price_89d_ema: Price13dEmaPattern, + pub price_89d_sma: Price13dEmaPattern, + pub price_8d_ema: Price13dEmaPattern, + pub price_8d_sma: Price13dEmaPattern, + pub price_8y_ago: Indexes, + pub price_ath: Indexes26, + pub price_drawdown: Indexes26, + pub price_true_range: Indexes5, + pub price_true_range_2w_sum: Indexes5, +} + +impl CatalogTree_Computed_Market { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + _1d_returns_1m_sd: _1dReturns1mSdPattern::new(client.clone(), "1d_returns_1m_sd"), + _1d_returns_1w_sd: _1dReturns1mSdPattern::new(client.clone(), "1d_returns_1w_sd"), + _1d_returns_1y_sd: _1dReturns1mSdPattern::new(client.clone(), "1d_returns_1y_sd"), + _10y_cagr: Indexes::new(client.clone(), &format!("{base_path}/_10y_cagr")), + _10y_dca_avg_price: Indexes::new(client.clone(), &format!("{base_path}/_10y_dca_avg_price")), + _10y_dca_cagr: Indexes::new(client.clone(), &format!("{base_path}/_10y_dca_cagr")), + _10y_dca_returns: Indexes::new(client.clone(), &format!("{base_path}/_10y_dca_returns")), + _10y_dca_stack: Indexes::new(client.clone(), &format!("{base_path}/_10y_dca_stack")), + _10y_price_returns: Indexes::new(client.clone(), &format!("{base_path}/_10y_price_returns")), + _1d_price_returns: Indexes::new(client.clone(), &format!("{base_path}/_1d_price_returns")), + _1m_dca_avg_price: Indexes::new(client.clone(), &format!("{base_path}/_1m_dca_avg_price")), + _1m_dca_returns: Indexes::new(client.clone(), &format!("{base_path}/_1m_dca_returns")), + _1m_dca_stack: Indexes::new(client.clone(), &format!("{base_path}/_1m_dca_stack")), + _1m_price_returns: Indexes::new(client.clone(), &format!("{base_path}/_1m_price_returns")), + _1w_dca_avg_price: Indexes::new(client.clone(), &format!("{base_path}/_1w_dca_avg_price")), + _1w_dca_returns: Indexes::new(client.clone(), &format!("{base_path}/_1w_dca_returns")), + _1w_dca_stack: Indexes::new(client.clone(), &format!("{base_path}/_1w_dca_stack")), + _1w_price_returns: Indexes::new(client.clone(), &format!("{base_path}/_1w_price_returns")), + _1y_dca_avg_price: Indexes::new(client.clone(), &format!("{base_path}/_1y_dca_avg_price")), + _1y_dca_returns: Indexes::new(client.clone(), &format!("{base_path}/_1y_dca_returns")), + _1y_dca_stack: Indexes::new(client.clone(), &format!("{base_path}/_1y_dca_stack")), + _1y_price_returns: Indexes::new(client.clone(), &format!("{base_path}/_1y_price_returns")), + _2y_cagr: Indexes::new(client.clone(), &format!("{base_path}/_2y_cagr")), + _2y_dca_avg_price: Indexes::new(client.clone(), &format!("{base_path}/_2y_dca_avg_price")), + _2y_dca_cagr: Indexes::new(client.clone(), &format!("{base_path}/_2y_dca_cagr")), + _2y_dca_returns: Indexes::new(client.clone(), &format!("{base_path}/_2y_dca_returns")), + _2y_dca_stack: Indexes::new(client.clone(), &format!("{base_path}/_2y_dca_stack")), + _2y_price_returns: Indexes::new(client.clone(), &format!("{base_path}/_2y_price_returns")), + _3m_dca_avg_price: Indexes::new(client.clone(), &format!("{base_path}/_3m_dca_avg_price")), + _3m_dca_returns: Indexes::new(client.clone(), &format!("{base_path}/_3m_dca_returns")), + _3m_dca_stack: Indexes::new(client.clone(), &format!("{base_path}/_3m_dca_stack")), + _3m_price_returns: Indexes::new(client.clone(), &format!("{base_path}/_3m_price_returns")), + _3y_cagr: Indexes::new(client.clone(), &format!("{base_path}/_3y_cagr")), + _3y_dca_avg_price: Indexes::new(client.clone(), &format!("{base_path}/_3y_dca_avg_price")), + _3y_dca_cagr: Indexes::new(client.clone(), &format!("{base_path}/_3y_dca_cagr")), + _3y_dca_returns: Indexes::new(client.clone(), &format!("{base_path}/_3y_dca_returns")), + _3y_dca_stack: Indexes::new(client.clone(), &format!("{base_path}/_3y_dca_stack")), + _3y_price_returns: Indexes::new(client.clone(), &format!("{base_path}/_3y_price_returns")), + _4y_cagr: Indexes::new(client.clone(), &format!("{base_path}/_4y_cagr")), + _4y_dca_avg_price: Indexes::new(client.clone(), &format!("{base_path}/_4y_dca_avg_price")), + _4y_dca_cagr: Indexes::new(client.clone(), &format!("{base_path}/_4y_dca_cagr")), + _4y_dca_returns: Indexes::new(client.clone(), &format!("{base_path}/_4y_dca_returns")), + _4y_dca_stack: Indexes::new(client.clone(), &format!("{base_path}/_4y_dca_stack")), + _4y_price_returns: Indexes::new(client.clone(), &format!("{base_path}/_4y_price_returns")), + _5y_cagr: Indexes::new(client.clone(), &format!("{base_path}/_5y_cagr")), + _5y_dca_avg_price: Indexes::new(client.clone(), &format!("{base_path}/_5y_dca_avg_price")), + _5y_dca_cagr: Indexes::new(client.clone(), &format!("{base_path}/_5y_dca_cagr")), + _5y_dca_returns: Indexes::new(client.clone(), &format!("{base_path}/_5y_dca_returns")), + _5y_dca_stack: Indexes::new(client.clone(), &format!("{base_path}/_5y_dca_stack")), + _5y_price_returns: Indexes::new(client.clone(), &format!("{base_path}/_5y_price_returns")), + _6m_dca_avg_price: Indexes::new(client.clone(), &format!("{base_path}/_6m_dca_avg_price")), + _6m_dca_returns: Indexes::new(client.clone(), &format!("{base_path}/_6m_dca_returns")), + _6m_dca_stack: Indexes::new(client.clone(), &format!("{base_path}/_6m_dca_stack")), + _6m_price_returns: Indexes::new(client.clone(), &format!("{base_path}/_6m_price_returns")), + _6y_cagr: Indexes::new(client.clone(), &format!("{base_path}/_6y_cagr")), + _6y_dca_avg_price: Indexes::new(client.clone(), &format!("{base_path}/_6y_dca_avg_price")), + _6y_dca_cagr: Indexes::new(client.clone(), &format!("{base_path}/_6y_dca_cagr")), + _6y_dca_returns: Indexes::new(client.clone(), &format!("{base_path}/_6y_dca_returns")), + _6y_dca_stack: Indexes::new(client.clone(), &format!("{base_path}/_6y_dca_stack")), + _6y_price_returns: Indexes::new(client.clone(), &format!("{base_path}/_6y_price_returns")), + _8y_cagr: Indexes::new(client.clone(), &format!("{base_path}/_8y_cagr")), + _8y_dca_avg_price: Indexes::new(client.clone(), &format!("{base_path}/_8y_dca_avg_price")), + _8y_dca_cagr: Indexes::new(client.clone(), &format!("{base_path}/_8y_dca_cagr")), + _8y_dca_returns: Indexes::new(client.clone(), &format!("{base_path}/_8y_dca_returns")), + _8y_dca_stack: Indexes::new(client.clone(), &format!("{base_path}/_8y_dca_stack")), + _8y_price_returns: Indexes::new(client.clone(), &format!("{base_path}/_8y_price_returns")), + days_since_price_ath: Indexes::new(client.clone(), &format!("{base_path}/days_since_price_ath")), + dca_class_2015_avg_price: Indexes::new(client.clone(), &format!("{base_path}/dca_class_2015_avg_price")), + dca_class_2015_returns: Indexes::new(client.clone(), &format!("{base_path}/dca_class_2015_returns")), + dca_class_2015_stack: Indexes::new(client.clone(), &format!("{base_path}/dca_class_2015_stack")), + dca_class_2016_avg_price: Indexes::new(client.clone(), &format!("{base_path}/dca_class_2016_avg_price")), + dca_class_2016_returns: Indexes::new(client.clone(), &format!("{base_path}/dca_class_2016_returns")), + dca_class_2016_stack: Indexes::new(client.clone(), &format!("{base_path}/dca_class_2016_stack")), + dca_class_2017_avg_price: Indexes::new(client.clone(), &format!("{base_path}/dca_class_2017_avg_price")), + dca_class_2017_returns: Indexes::new(client.clone(), &format!("{base_path}/dca_class_2017_returns")), + dca_class_2017_stack: Indexes::new(client.clone(), &format!("{base_path}/dca_class_2017_stack")), + dca_class_2018_avg_price: Indexes::new(client.clone(), &format!("{base_path}/dca_class_2018_avg_price")), + dca_class_2018_returns: Indexes::new(client.clone(), &format!("{base_path}/dca_class_2018_returns")), + dca_class_2018_stack: Indexes::new(client.clone(), &format!("{base_path}/dca_class_2018_stack")), + dca_class_2019_avg_price: Indexes::new(client.clone(), &format!("{base_path}/dca_class_2019_avg_price")), + dca_class_2019_returns: Indexes::new(client.clone(), &format!("{base_path}/dca_class_2019_returns")), + dca_class_2019_stack: Indexes::new(client.clone(), &format!("{base_path}/dca_class_2019_stack")), + dca_class_2020_avg_price: Indexes::new(client.clone(), &format!("{base_path}/dca_class_2020_avg_price")), + dca_class_2020_returns: Indexes::new(client.clone(), &format!("{base_path}/dca_class_2020_returns")), + dca_class_2020_stack: Indexes::new(client.clone(), &format!("{base_path}/dca_class_2020_stack")), + dca_class_2021_avg_price: Indexes::new(client.clone(), &format!("{base_path}/dca_class_2021_avg_price")), + dca_class_2021_returns: Indexes::new(client.clone(), &format!("{base_path}/dca_class_2021_returns")), + dca_class_2021_stack: Indexes::new(client.clone(), &format!("{base_path}/dca_class_2021_stack")), + dca_class_2022_avg_price: Indexes::new(client.clone(), &format!("{base_path}/dca_class_2022_avg_price")), + dca_class_2022_returns: Indexes::new(client.clone(), &format!("{base_path}/dca_class_2022_returns")), + dca_class_2022_stack: Indexes::new(client.clone(), &format!("{base_path}/dca_class_2022_stack")), + dca_class_2023_avg_price: Indexes::new(client.clone(), &format!("{base_path}/dca_class_2023_avg_price")), + dca_class_2023_returns: Indexes::new(client.clone(), &format!("{base_path}/dca_class_2023_returns")), + dca_class_2023_stack: Indexes::new(client.clone(), &format!("{base_path}/dca_class_2023_stack")), + dca_class_2024_avg_price: Indexes::new(client.clone(), &format!("{base_path}/dca_class_2024_avg_price")), + dca_class_2024_returns: Indexes::new(client.clone(), &format!("{base_path}/dca_class_2024_returns")), + dca_class_2024_stack: Indexes::new(client.clone(), &format!("{base_path}/dca_class_2024_stack")), + dca_class_2025_avg_price: Indexes::new(client.clone(), &format!("{base_path}/dca_class_2025_avg_price")), + dca_class_2025_returns: Indexes::new(client.clone(), &format!("{base_path}/dca_class_2025_returns")), + dca_class_2025_stack: Indexes::new(client.clone(), &format!("{base_path}/dca_class_2025_stack")), + max_days_between_price_aths: Indexes::new(client.clone(), &format!("{base_path}/max_days_between_price_aths")), + max_years_between_price_aths: Indexes::new(client.clone(), &format!("{base_path}/max_years_between_price_aths")), + price_10y_ago: Indexes::new(client.clone(), &format!("{base_path}/price_10y_ago")), + price_13d_ema: Price13dEmaPattern::new(client.clone(), "price_13d_ema"), + price_13d_sma: Price13dEmaPattern::new(client.clone(), "price_13d_sma"), + price_144d_ema: Price13dEmaPattern::new(client.clone(), "price_144d_ema"), + price_144d_sma: Price13dEmaPattern::new(client.clone(), "price_144d_sma"), + price_1d_ago: Indexes::new(client.clone(), &format!("{base_path}/price_1d_ago")), + price_1m_ago: Indexes::new(client.clone(), &format!("{base_path}/price_1m_ago")), + price_1m_ema: Price13dEmaPattern::new(client.clone(), "price_1m_ema"), + price_1m_max: Indexes::new(client.clone(), &format!("{base_path}/price_1m_max")), + price_1m_min: Indexes::new(client.clone(), &format!("{base_path}/price_1m_min")), + price_1m_sma: Price13dEmaPattern::new(client.clone(), "price_1m_sma"), + price_1m_volatility: Indexes::new(client.clone(), &format!("{base_path}/price_1m_volatility")), + price_1w_ago: Indexes::new(client.clone(), &format!("{base_path}/price_1w_ago")), + price_1w_ema: Price13dEmaPattern::new(client.clone(), "price_1w_ema"), + price_1w_max: Indexes::new(client.clone(), &format!("{base_path}/price_1w_max")), + price_1w_min: Indexes::new(client.clone(), &format!("{base_path}/price_1w_min")), + price_1w_sma: Price13dEmaPattern::new(client.clone(), "price_1w_sma"), + price_1w_volatility: Indexes::new(client.clone(), &format!("{base_path}/price_1w_volatility")), + price_1y_ago: Indexes::new(client.clone(), &format!("{base_path}/price_1y_ago")), + price_1y_ema: Price13dEmaPattern::new(client.clone(), "price_1y_ema"), + price_1y_max: Indexes::new(client.clone(), &format!("{base_path}/price_1y_max")), + price_1y_min: Indexes::new(client.clone(), &format!("{base_path}/price_1y_min")), + price_1y_sma: Price13dEmaPattern::new(client.clone(), "price_1y_sma"), + price_1y_volatility: Indexes::new(client.clone(), &format!("{base_path}/price_1y_volatility")), + price_200d_ema: Price13dEmaPattern::new(client.clone(), "price_200d_ema"), + price_200d_sma: Price13dEmaPattern::new(client.clone(), "price_200d_sma"), + price_200d_sma_x0_8: Indexes::new(client.clone(), &format!("{base_path}/price_200d_sma_x0_8")), + price_200d_sma_x2_4: Indexes::new(client.clone(), &format!("{base_path}/price_200d_sma_x2_4")), + price_200w_ema: Price13dEmaPattern::new(client.clone(), "price_200w_ema"), + price_200w_sma: Price13dEmaPattern::new(client.clone(), "price_200w_sma"), + price_21d_ema: Price13dEmaPattern::new(client.clone(), "price_21d_ema"), + price_21d_sma: Price13dEmaPattern::new(client.clone(), "price_21d_sma"), + price_2w_choppiness_index: Indexes::new(client.clone(), &format!("{base_path}/price_2w_choppiness_index")), + price_2w_max: Indexes::new(client.clone(), &format!("{base_path}/price_2w_max")), + price_2w_min: Indexes::new(client.clone(), &format!("{base_path}/price_2w_min")), + price_2y_ago: Indexes::new(client.clone(), &format!("{base_path}/price_2y_ago")), + price_2y_ema: Price13dEmaPattern::new(client.clone(), "price_2y_ema"), + price_2y_sma: Price13dEmaPattern::new(client.clone(), "price_2y_sma"), + price_34d_ema: Price13dEmaPattern::new(client.clone(), "price_34d_ema"), + price_34d_sma: Price13dEmaPattern::new(client.clone(), "price_34d_sma"), + price_3m_ago: Indexes::new(client.clone(), &format!("{base_path}/price_3m_ago")), + price_3y_ago: Indexes::new(client.clone(), &format!("{base_path}/price_3y_ago")), + price_4y_ago: Indexes::new(client.clone(), &format!("{base_path}/price_4y_ago")), + price_4y_ema: Price13dEmaPattern::new(client.clone(), "price_4y_ema"), + price_4y_sma: Price13dEmaPattern::new(client.clone(), "price_4y_sma"), + price_55d_ema: Price13dEmaPattern::new(client.clone(), "price_55d_ema"), + price_55d_sma: Price13dEmaPattern::new(client.clone(), "price_55d_sma"), + price_5y_ago: Indexes::new(client.clone(), &format!("{base_path}/price_5y_ago")), + price_6m_ago: Indexes::new(client.clone(), &format!("{base_path}/price_6m_ago")), + price_6y_ago: Indexes::new(client.clone(), &format!("{base_path}/price_6y_ago")), + price_89d_ema: Price13dEmaPattern::new(client.clone(), "price_89d_ema"), + price_89d_sma: Price13dEmaPattern::new(client.clone(), "price_89d_sma"), + price_8d_ema: Price13dEmaPattern::new(client.clone(), "price_8d_ema"), + price_8d_sma: Price13dEmaPattern::new(client.clone(), "price_8d_sma"), + price_8y_ago: Indexes::new(client.clone(), &format!("{base_path}/price_8y_ago")), + price_ath: Indexes26::new(client.clone(), &format!("{base_path}/price_ath")), + price_drawdown: Indexes26::new(client.clone(), &format!("{base_path}/price_drawdown")), + price_true_range: Indexes5::new(client.clone(), &format!("{base_path}/price_true_range")), + price_true_range_2w_sum: Indexes5::new(client.clone(), &format!("{base_path}/price_true_range_2w_sum")), + } + } +} + +/// Catalog tree node. +pub struct CatalogTree_Computed_Pools { + pub pool: Indexes2, + pub vecs: CatalogTree_Computed_Pools_Vecs, +} + +impl CatalogTree_Computed_Pools { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + pool: Indexes2::new(client.clone(), &format!("{base_path}/pool")), + vecs: CatalogTree_Computed_Pools_Vecs::new(client.clone(), &format!("{base_path}/vecs")), + } + } +} + +/// Catalog tree node. +pub struct CatalogTree_Computed_Pools_Vecs { + pub AXbt: AXbtPattern, + pub AaoPool: AXbtPattern, + pub AntPool: AXbtPattern, + pub ArkPool: AXbtPattern, + pub AsicMiner: AXbtPattern, + pub BatPool: AXbtPattern, + pub BcMonster: AXbtPattern, + pub BcpoolIo: AXbtPattern, + pub BinancePool: AXbtPattern, + pub BitClub: AXbtPattern, + pub BitFuFuPool: AXbtPattern, + pub BitFury: AXbtPattern, + pub BitMinter: AXbtPattern, + pub Bitalo: AXbtPattern, + pub BitcoinAffiliateNetwork: AXbtPattern, + pub BitcoinCom: AXbtPattern, + pub BitcoinIndia: AXbtPattern, + pub BitcoinRussia: AXbtPattern, + pub BitcoinUkraine: AXbtPattern, + pub Bitfarms: AXbtPattern, + pub Bitparking: AXbtPattern, + pub Bitsolo: AXbtPattern, + pub Bixin: AXbtPattern, + pub BlockFills: AXbtPattern, + pub BraiinsPool: AXbtPattern, + pub BravoMining: AXbtPattern, + pub BtPool: AXbtPattern, + pub BtcCom: AXbtPattern, + pub BtcDig: AXbtPattern, + pub BtcGuild: AXbtPattern, + pub BtcLab: AXbtPattern, + pub BtcMp: AXbtPattern, + pub BtcNuggets: AXbtPattern, + pub BtcPoolParty: AXbtPattern, + pub BtcServ: AXbtPattern, + pub BtcTop: AXbtPattern, + pub Btcc: AXbtPattern, + pub BwPool: AXbtPattern, + pub BytePool: AXbtPattern, + pub Canoe: AXbtPattern, + pub CanoePool: AXbtPattern, + pub CarbonNegative: AXbtPattern, + pub CkPool: AXbtPattern, + pub CloudHashing: AXbtPattern, + pub CoinLab: AXbtPattern, + pub Cointerra: AXbtPattern, + pub ConnectBtc: AXbtPattern, + pub DPool: AXbtPattern, + pub DcExploration: AXbtPattern, + pub Dcex: AXbtPattern, + pub DigitalBtc: AXbtPattern, + pub DigitalXMintsy: AXbtPattern, + pub EclipseMc: AXbtPattern, + pub EightBaochi: AXbtPattern, + pub EkanemBtc: AXbtPattern, + pub Eligius: AXbtPattern, + pub EmcdPool: AXbtPattern, + pub EntrustCharityPool: AXbtPattern, + pub Eobot: AXbtPattern, + pub ExxBw: AXbtPattern, + pub F2Pool: AXbtPattern, + pub FiftyEightCoin: AXbtPattern, + pub FoundryUsa: AXbtPattern, + pub FutureBitApolloSolo: AXbtPattern, + pub GbMiners: AXbtPattern, + pub GhashIo: AXbtPattern, + pub GiveMeCoins: AXbtPattern, + pub GoGreenLight: AXbtPattern, + pub HaoZhuZhu: AXbtPattern, + pub Haominer: AXbtPattern, + pub HashBx: AXbtPattern, + pub HashPool: AXbtPattern, + pub Helix: AXbtPattern, + pub Hhtt: AXbtPattern, + pub HotPool: AXbtPattern, + pub Hummerpool: AXbtPattern, + pub HuobiPool: AXbtPattern, + pub InnopolisTech: AXbtPattern, + pub KanoPool: AXbtPattern, + pub KncMiner: AXbtPattern, + pub KuCoinPool: AXbtPattern, + pub LubianCom: AXbtPattern, + pub LuckyPool: AXbtPattern, + pub Luxor: AXbtPattern, + pub MaraPool: AXbtPattern, + pub MaxBtc: AXbtPattern, + pub MaxiPool: AXbtPattern, + pub MegaBigPower: AXbtPattern, + pub Minerium: AXbtPattern, + pub MiningCity: AXbtPattern, + pub MiningDutch: AXbtPattern, + pub MiningKings: AXbtPattern, + pub MiningSquared: AXbtPattern, + pub Mmpool: AXbtPattern, + pub MtRed: AXbtPattern, + pub MultiCoinCo: AXbtPattern, + pub Multipool: AXbtPattern, + pub MyBtcCoinPool: AXbtPattern, + pub Neopool: AXbtPattern, + pub Nexious: AXbtPattern, + pub NiceHash: AXbtPattern, + pub NmcBit: AXbtPattern, + pub NovaBlock: AXbtPattern, + pub Ocean: AXbtPattern, + pub OkExPool: AXbtPattern, + pub OkMiner: AXbtPattern, + pub Okkong: AXbtPattern, + pub OkpoolTop: AXbtPattern, + pub OneHash: AXbtPattern, + pub OneM1x: AXbtPattern, + pub OneThash: AXbtPattern, + pub OzCoin: AXbtPattern, + pub PHashIo: AXbtPattern, + pub Parasite: AXbtPattern, + pub Patels: AXbtPattern, + pub PegaPool: AXbtPattern, + pub Phoenix: AXbtPattern, + pub Polmine: AXbtPattern, + pub Pool175btc: AXbtPattern, + pub Pool50btc: AXbtPattern, + pub Poolin: AXbtPattern, + pub PortlandHodl: AXbtPattern, + pub PublicPool: AXbtPattern, + pub PureBtcCom: AXbtPattern, + pub Rawpool: AXbtPattern, + pub RigPool: AXbtPattern, + pub SbiCrypto: AXbtPattern, + pub SecPool: AXbtPattern, + pub SecretSuperstar: AXbtPattern, + pub SevenPool: AXbtPattern, + pub ShawnP0wers: AXbtPattern, + pub SigmapoolCom: AXbtPattern, + pub SimplecoinUs: AXbtPattern, + pub SoloCk: AXbtPattern, + pub SpiderPool: AXbtPattern, + pub StMiningCorp: AXbtPattern, + pub Tangpool: AXbtPattern, + pub TatmasPool: AXbtPattern, + pub TbDice: AXbtPattern, + pub Telco214: AXbtPattern, + pub TerraPool: AXbtPattern, + pub Tiger: AXbtPattern, + pub TigerpoolNet: AXbtPattern, + pub Titan: AXbtPattern, + pub TransactionCoinMining: AXbtPattern, + pub TrickysBtcPool: AXbtPattern, + pub TripleMining: AXbtPattern, + pub TwentyOneInc: AXbtPattern, + pub UltimusPool: AXbtPattern, + pub Unknown: AXbtPattern, + pub Unomp: AXbtPattern, + pub ViaBtc: AXbtPattern, + pub Waterhole: AXbtPattern, + pub WayiCn: AXbtPattern, + pub WhitePool: AXbtPattern, + pub Wk057: AXbtPattern, + pub YourbtcNet: AXbtPattern, + pub Zulupool: AXbtPattern, +} + +impl CatalogTree_Computed_Pools_Vecs { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + AXbt: AXbtPattern::new(client.clone(), &format!("{base_path}/AXbt")), + AaoPool: AXbtPattern::new(client.clone(), &format!("{base_path}/AaoPool")), + AntPool: AXbtPattern::new(client.clone(), &format!("{base_path}/AntPool")), + ArkPool: AXbtPattern::new(client.clone(), &format!("{base_path}/ArkPool")), + AsicMiner: AXbtPattern::new(client.clone(), &format!("{base_path}/AsicMiner")), + BatPool: AXbtPattern::new(client.clone(), &format!("{base_path}/BatPool")), + BcMonster: AXbtPattern::new(client.clone(), &format!("{base_path}/BcMonster")), + BcpoolIo: AXbtPattern::new(client.clone(), &format!("{base_path}/BcpoolIo")), + BinancePool: AXbtPattern::new(client.clone(), &format!("{base_path}/BinancePool")), + BitClub: AXbtPattern::new(client.clone(), &format!("{base_path}/BitClub")), + BitFuFuPool: AXbtPattern::new(client.clone(), &format!("{base_path}/BitFuFuPool")), + BitFury: AXbtPattern::new(client.clone(), &format!("{base_path}/BitFury")), + BitMinter: AXbtPattern::new(client.clone(), &format!("{base_path}/BitMinter")), + Bitalo: AXbtPattern::new(client.clone(), &format!("{base_path}/Bitalo")), + BitcoinAffiliateNetwork: AXbtPattern::new(client.clone(), &format!("{base_path}/BitcoinAffiliateNetwork")), + BitcoinCom: AXbtPattern::new(client.clone(), &format!("{base_path}/BitcoinCom")), + BitcoinIndia: AXbtPattern::new(client.clone(), &format!("{base_path}/BitcoinIndia")), + BitcoinRussia: AXbtPattern::new(client.clone(), &format!("{base_path}/BitcoinRussia")), + BitcoinUkraine: AXbtPattern::new(client.clone(), &format!("{base_path}/BitcoinUkraine")), + Bitfarms: AXbtPattern::new(client.clone(), &format!("{base_path}/Bitfarms")), + Bitparking: AXbtPattern::new(client.clone(), &format!("{base_path}/Bitparking")), + Bitsolo: AXbtPattern::new(client.clone(), &format!("{base_path}/Bitsolo")), + Bixin: AXbtPattern::new(client.clone(), &format!("{base_path}/Bixin")), + BlockFills: AXbtPattern::new(client.clone(), &format!("{base_path}/BlockFills")), + BraiinsPool: AXbtPattern::new(client.clone(), &format!("{base_path}/BraiinsPool")), + BravoMining: AXbtPattern::new(client.clone(), &format!("{base_path}/BravoMining")), + BtPool: AXbtPattern::new(client.clone(), &format!("{base_path}/BtPool")), + BtcCom: AXbtPattern::new(client.clone(), &format!("{base_path}/BtcCom")), + BtcDig: AXbtPattern::new(client.clone(), &format!("{base_path}/BtcDig")), + BtcGuild: AXbtPattern::new(client.clone(), &format!("{base_path}/BtcGuild")), + BtcLab: AXbtPattern::new(client.clone(), &format!("{base_path}/BtcLab")), + BtcMp: AXbtPattern::new(client.clone(), &format!("{base_path}/BtcMp")), + BtcNuggets: AXbtPattern::new(client.clone(), &format!("{base_path}/BtcNuggets")), + BtcPoolParty: AXbtPattern::new(client.clone(), &format!("{base_path}/BtcPoolParty")), + BtcServ: AXbtPattern::new(client.clone(), &format!("{base_path}/BtcServ")), + BtcTop: AXbtPattern::new(client.clone(), &format!("{base_path}/BtcTop")), + Btcc: AXbtPattern::new(client.clone(), &format!("{base_path}/Btcc")), + BwPool: AXbtPattern::new(client.clone(), &format!("{base_path}/BwPool")), + BytePool: AXbtPattern::new(client.clone(), &format!("{base_path}/BytePool")), + Canoe: AXbtPattern::new(client.clone(), &format!("{base_path}/Canoe")), + CanoePool: AXbtPattern::new(client.clone(), &format!("{base_path}/CanoePool")), + CarbonNegative: AXbtPattern::new(client.clone(), &format!("{base_path}/CarbonNegative")), + CkPool: AXbtPattern::new(client.clone(), &format!("{base_path}/CkPool")), + CloudHashing: AXbtPattern::new(client.clone(), &format!("{base_path}/CloudHashing")), + CoinLab: AXbtPattern::new(client.clone(), &format!("{base_path}/CoinLab")), + Cointerra: AXbtPattern::new(client.clone(), &format!("{base_path}/Cointerra")), + ConnectBtc: AXbtPattern::new(client.clone(), &format!("{base_path}/ConnectBtc")), + DPool: AXbtPattern::new(client.clone(), &format!("{base_path}/DPool")), + DcExploration: AXbtPattern::new(client.clone(), &format!("{base_path}/DcExploration")), + Dcex: AXbtPattern::new(client.clone(), &format!("{base_path}/Dcex")), + DigitalBtc: AXbtPattern::new(client.clone(), &format!("{base_path}/DigitalBtc")), + DigitalXMintsy: AXbtPattern::new(client.clone(), &format!("{base_path}/DigitalXMintsy")), + EclipseMc: AXbtPattern::new(client.clone(), &format!("{base_path}/EclipseMc")), + EightBaochi: AXbtPattern::new(client.clone(), &format!("{base_path}/EightBaochi")), + EkanemBtc: AXbtPattern::new(client.clone(), &format!("{base_path}/EkanemBtc")), + Eligius: AXbtPattern::new(client.clone(), &format!("{base_path}/Eligius")), + EmcdPool: AXbtPattern::new(client.clone(), &format!("{base_path}/EmcdPool")), + EntrustCharityPool: AXbtPattern::new(client.clone(), &format!("{base_path}/EntrustCharityPool")), + Eobot: AXbtPattern::new(client.clone(), &format!("{base_path}/Eobot")), + ExxBw: AXbtPattern::new(client.clone(), &format!("{base_path}/ExxBw")), + F2Pool: AXbtPattern::new(client.clone(), &format!("{base_path}/F2Pool")), + FiftyEightCoin: AXbtPattern::new(client.clone(), &format!("{base_path}/FiftyEightCoin")), + FoundryUsa: AXbtPattern::new(client.clone(), &format!("{base_path}/FoundryUsa")), + FutureBitApolloSolo: AXbtPattern::new(client.clone(), &format!("{base_path}/FutureBitApolloSolo")), + GbMiners: AXbtPattern::new(client.clone(), &format!("{base_path}/GbMiners")), + GhashIo: AXbtPattern::new(client.clone(), &format!("{base_path}/GhashIo")), + GiveMeCoins: AXbtPattern::new(client.clone(), &format!("{base_path}/GiveMeCoins")), + GoGreenLight: AXbtPattern::new(client.clone(), &format!("{base_path}/GoGreenLight")), + HaoZhuZhu: AXbtPattern::new(client.clone(), &format!("{base_path}/HaoZhuZhu")), + Haominer: AXbtPattern::new(client.clone(), &format!("{base_path}/Haominer")), + HashBx: AXbtPattern::new(client.clone(), &format!("{base_path}/HashBx")), + HashPool: AXbtPattern::new(client.clone(), &format!("{base_path}/HashPool")), + Helix: AXbtPattern::new(client.clone(), &format!("{base_path}/Helix")), + Hhtt: AXbtPattern::new(client.clone(), &format!("{base_path}/Hhtt")), + HotPool: AXbtPattern::new(client.clone(), &format!("{base_path}/HotPool")), + Hummerpool: AXbtPattern::new(client.clone(), &format!("{base_path}/Hummerpool")), + HuobiPool: AXbtPattern::new(client.clone(), &format!("{base_path}/HuobiPool")), + InnopolisTech: AXbtPattern::new(client.clone(), &format!("{base_path}/InnopolisTech")), + KanoPool: AXbtPattern::new(client.clone(), &format!("{base_path}/KanoPool")), + KncMiner: AXbtPattern::new(client.clone(), &format!("{base_path}/KncMiner")), + KuCoinPool: AXbtPattern::new(client.clone(), &format!("{base_path}/KuCoinPool")), + LubianCom: AXbtPattern::new(client.clone(), &format!("{base_path}/LubianCom")), + LuckyPool: AXbtPattern::new(client.clone(), &format!("{base_path}/LuckyPool")), + Luxor: AXbtPattern::new(client.clone(), &format!("{base_path}/Luxor")), + MaraPool: AXbtPattern::new(client.clone(), &format!("{base_path}/MaraPool")), + MaxBtc: AXbtPattern::new(client.clone(), &format!("{base_path}/MaxBtc")), + MaxiPool: AXbtPattern::new(client.clone(), &format!("{base_path}/MaxiPool")), + MegaBigPower: AXbtPattern::new(client.clone(), &format!("{base_path}/MegaBigPower")), + Minerium: AXbtPattern::new(client.clone(), &format!("{base_path}/Minerium")), + MiningCity: AXbtPattern::new(client.clone(), &format!("{base_path}/MiningCity")), + MiningDutch: AXbtPattern::new(client.clone(), &format!("{base_path}/MiningDutch")), + MiningKings: AXbtPattern::new(client.clone(), &format!("{base_path}/MiningKings")), + MiningSquared: AXbtPattern::new(client.clone(), &format!("{base_path}/MiningSquared")), + Mmpool: AXbtPattern::new(client.clone(), &format!("{base_path}/Mmpool")), + MtRed: AXbtPattern::new(client.clone(), &format!("{base_path}/MtRed")), + MultiCoinCo: AXbtPattern::new(client.clone(), &format!("{base_path}/MultiCoinCo")), + Multipool: AXbtPattern::new(client.clone(), &format!("{base_path}/Multipool")), + MyBtcCoinPool: AXbtPattern::new(client.clone(), &format!("{base_path}/MyBtcCoinPool")), + Neopool: AXbtPattern::new(client.clone(), &format!("{base_path}/Neopool")), + Nexious: AXbtPattern::new(client.clone(), &format!("{base_path}/Nexious")), + NiceHash: AXbtPattern::new(client.clone(), &format!("{base_path}/NiceHash")), + NmcBit: AXbtPattern::new(client.clone(), &format!("{base_path}/NmcBit")), + NovaBlock: AXbtPattern::new(client.clone(), &format!("{base_path}/NovaBlock")), + Ocean: AXbtPattern::new(client.clone(), &format!("{base_path}/Ocean")), + OkExPool: AXbtPattern::new(client.clone(), &format!("{base_path}/OkExPool")), + OkMiner: AXbtPattern::new(client.clone(), &format!("{base_path}/OkMiner")), + Okkong: AXbtPattern::new(client.clone(), &format!("{base_path}/Okkong")), + OkpoolTop: AXbtPattern::new(client.clone(), &format!("{base_path}/OkpoolTop")), + OneHash: AXbtPattern::new(client.clone(), &format!("{base_path}/OneHash")), + OneM1x: AXbtPattern::new(client.clone(), &format!("{base_path}/OneM1x")), + OneThash: AXbtPattern::new(client.clone(), &format!("{base_path}/OneThash")), + OzCoin: AXbtPattern::new(client.clone(), &format!("{base_path}/OzCoin")), + PHashIo: AXbtPattern::new(client.clone(), &format!("{base_path}/PHashIo")), + Parasite: AXbtPattern::new(client.clone(), &format!("{base_path}/Parasite")), + Patels: AXbtPattern::new(client.clone(), &format!("{base_path}/Patels")), + PegaPool: AXbtPattern::new(client.clone(), &format!("{base_path}/PegaPool")), + Phoenix: AXbtPattern::new(client.clone(), &format!("{base_path}/Phoenix")), + Polmine: AXbtPattern::new(client.clone(), &format!("{base_path}/Polmine")), + Pool175btc: AXbtPattern::new(client.clone(), &format!("{base_path}/Pool175btc")), + Pool50btc: AXbtPattern::new(client.clone(), &format!("{base_path}/Pool50btc")), + Poolin: AXbtPattern::new(client.clone(), &format!("{base_path}/Poolin")), + PortlandHodl: AXbtPattern::new(client.clone(), &format!("{base_path}/PortlandHodl")), + PublicPool: AXbtPattern::new(client.clone(), &format!("{base_path}/PublicPool")), + PureBtcCom: AXbtPattern::new(client.clone(), &format!("{base_path}/PureBtcCom")), + Rawpool: AXbtPattern::new(client.clone(), &format!("{base_path}/Rawpool")), + RigPool: AXbtPattern::new(client.clone(), &format!("{base_path}/RigPool")), + SbiCrypto: AXbtPattern::new(client.clone(), &format!("{base_path}/SbiCrypto")), + SecPool: AXbtPattern::new(client.clone(), &format!("{base_path}/SecPool")), + SecretSuperstar: AXbtPattern::new(client.clone(), &format!("{base_path}/SecretSuperstar")), + SevenPool: AXbtPattern::new(client.clone(), &format!("{base_path}/SevenPool")), + ShawnP0wers: AXbtPattern::new(client.clone(), &format!("{base_path}/ShawnP0wers")), + SigmapoolCom: AXbtPattern::new(client.clone(), &format!("{base_path}/SigmapoolCom")), + SimplecoinUs: AXbtPattern::new(client.clone(), &format!("{base_path}/SimplecoinUs")), + SoloCk: AXbtPattern::new(client.clone(), &format!("{base_path}/SoloCk")), + SpiderPool: AXbtPattern::new(client.clone(), &format!("{base_path}/SpiderPool")), + StMiningCorp: AXbtPattern::new(client.clone(), &format!("{base_path}/StMiningCorp")), + Tangpool: AXbtPattern::new(client.clone(), &format!("{base_path}/Tangpool")), + TatmasPool: AXbtPattern::new(client.clone(), &format!("{base_path}/TatmasPool")), + TbDice: AXbtPattern::new(client.clone(), &format!("{base_path}/TbDice")), + Telco214: AXbtPattern::new(client.clone(), &format!("{base_path}/Telco214")), + TerraPool: AXbtPattern::new(client.clone(), &format!("{base_path}/TerraPool")), + Tiger: AXbtPattern::new(client.clone(), &format!("{base_path}/Tiger")), + TigerpoolNet: AXbtPattern::new(client.clone(), &format!("{base_path}/TigerpoolNet")), + Titan: AXbtPattern::new(client.clone(), &format!("{base_path}/Titan")), + TransactionCoinMining: AXbtPattern::new(client.clone(), &format!("{base_path}/TransactionCoinMining")), + TrickysBtcPool: AXbtPattern::new(client.clone(), &format!("{base_path}/TrickysBtcPool")), + TripleMining: AXbtPattern::new(client.clone(), &format!("{base_path}/TripleMining")), + TwentyOneInc: AXbtPattern::new(client.clone(), &format!("{base_path}/TwentyOneInc")), + UltimusPool: AXbtPattern::new(client.clone(), &format!("{base_path}/UltimusPool")), + Unknown: AXbtPattern::new(client.clone(), &format!("{base_path}/Unknown")), + Unomp: AXbtPattern::new(client.clone(), &format!("{base_path}/Unomp")), + ViaBtc: AXbtPattern::new(client.clone(), &format!("{base_path}/ViaBtc")), + Waterhole: AXbtPattern::new(client.clone(), &format!("{base_path}/Waterhole")), + WayiCn: AXbtPattern::new(client.clone(), &format!("{base_path}/WayiCn")), + WhitePool: AXbtPattern::new(client.clone(), &format!("{base_path}/WhitePool")), + Wk057: AXbtPattern::new(client.clone(), &format!("{base_path}/Wk057")), + YourbtcNet: AXbtPattern::new(client.clone(), &format!("{base_path}/YourbtcNet")), + Zulupool: AXbtPattern::new(client.clone(), &format!("{base_path}/Zulupool")), + } + } +} + +/// Catalog tree node. +pub struct CatalogTree_Computed_Price { + pub price_close: Indexes3, + pub price_close_in_cents: Indexes13, + pub price_close_in_sats: Indexes3, + pub price_high: Indexes3, + pub price_high_in_cents: Indexes13, + pub price_high_in_sats: Indexes3, + pub price_low: Indexes3, + pub price_low_in_cents: Indexes13, + pub price_low_in_sats: Indexes3, + pub price_ohlc: Indexes3, + pub price_ohlc_in_sats: Indexes3, + pub price_open: Indexes3, + pub price_open_in_cents: Indexes13, + pub price_open_in_sats: Indexes3, +} + +impl CatalogTree_Computed_Price { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + price_close: Indexes3::new(client.clone(), &format!("{base_path}/price_close")), + price_close_in_cents: Indexes13::new(client.clone(), &format!("{base_path}/price_close_in_cents")), + price_close_in_sats: Indexes3::new(client.clone(), &format!("{base_path}/price_close_in_sats")), + price_high: Indexes3::new(client.clone(), &format!("{base_path}/price_high")), + price_high_in_cents: Indexes13::new(client.clone(), &format!("{base_path}/price_high_in_cents")), + price_high_in_sats: Indexes3::new(client.clone(), &format!("{base_path}/price_high_in_sats")), + price_low: Indexes3::new(client.clone(), &format!("{base_path}/price_low")), + price_low_in_cents: Indexes13::new(client.clone(), &format!("{base_path}/price_low_in_cents")), + price_low_in_sats: Indexes3::new(client.clone(), &format!("{base_path}/price_low_in_sats")), + price_ohlc: Indexes3::new(client.clone(), &format!("{base_path}/price_ohlc")), + price_ohlc_in_sats: Indexes3::new(client.clone(), &format!("{base_path}/price_ohlc_in_sats")), + price_open: Indexes3::new(client.clone(), &format!("{base_path}/price_open")), + price_open_in_cents: Indexes13::new(client.clone(), &format!("{base_path}/price_open_in_cents")), + price_open_in_sats: Indexes3::new(client.clone(), &format!("{base_path}/price_open_in_sats")), + } + } +} + +/// Catalog tree node. +pub struct CatalogTree_Computed_Stateful { + pub addr_count: Indexes3, + pub address_cohorts: CatalogTree_Computed_Stateful_AddressCohorts, + pub addresses_data: CatalogTree_Computed_Stateful_AddressesData, + pub addresstype_to_height_to_addr_count: AddresstypeToHeightToAddrCountPattern, + pub addresstype_to_height_to_empty_addr_count: AddresstypeToHeightToAddrCountPattern, + pub addresstype_to_indexes_to_addr_count: AddresstypeToHeightToAddrCountPattern, + pub addresstype_to_indexes_to_empty_addr_count: AddresstypeToHeightToAddrCountPattern, + pub any_address_indexes: AddresstypeToHeightToAddrCountPattern, + pub chain_state: Indexes2, + pub empty_addr_count: Indexes3, + pub emptyaddressindex: Indexes29, + pub loadedaddressindex: Indexes30, + pub market_cap: Indexes26, + pub opreturn_supply: SupplyPattern, + pub unspendable_supply: SupplyPattern, + pub utxo_cohorts: CatalogTree_Computed_Stateful_UtxoCohorts, +} + +impl CatalogTree_Computed_Stateful { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + addr_count: Indexes3::new(client.clone(), &format!("{base_path}/addr_count")), + address_cohorts: CatalogTree_Computed_Stateful_AddressCohorts::new(client.clone(), &format!("{base_path}/address_cohorts")), + addresses_data: CatalogTree_Computed_Stateful_AddressesData::new(client.clone(), &format!("{base_path}/addresses_data")), + addresstype_to_height_to_addr_count: AddresstypeToHeightToAddrCountPattern::new(client.clone(), &format!("{base_path}/addresstype_to_height_to_addr_count")), + addresstype_to_height_to_empty_addr_count: AddresstypeToHeightToAddrCountPattern::new(client.clone(), &format!("{base_path}/addresstype_to_height_to_empty_addr_count")), + addresstype_to_indexes_to_addr_count: AddresstypeToHeightToAddrCountPattern::new(client.clone(), &format!("{base_path}/addresstype_to_indexes_to_addr_count")), + addresstype_to_indexes_to_empty_addr_count: AddresstypeToHeightToAddrCountPattern::new(client.clone(), &format!("{base_path}/addresstype_to_indexes_to_empty_addr_count")), + any_address_indexes: AddresstypeToHeightToAddrCountPattern::new(client.clone(), &format!("{base_path}/any_address_indexes")), + chain_state: Indexes2::new(client.clone(), &format!("{base_path}/chain_state")), + empty_addr_count: Indexes3::new(client.clone(), &format!("{base_path}/empty_addr_count")), + emptyaddressindex: Indexes29::new(client.clone(), &format!("{base_path}/emptyaddressindex")), + loadedaddressindex: Indexes30::new(client.clone(), &format!("{base_path}/loadedaddressindex")), + market_cap: Indexes26::new(client.clone(), &format!("{base_path}/market_cap")), + opreturn_supply: SupplyPattern::new(client.clone(), &format!("{base_path}/opreturn_supply")), + unspendable_supply: SupplyPattern::new(client.clone(), &format!("{base_path}/unspendable_supply")), + utxo_cohorts: CatalogTree_Computed_Stateful_UtxoCohorts::new(client.clone(), &format!("{base_path}/utxo_cohorts")), + } + } +} + +/// Catalog tree node. +pub struct CatalogTree_Computed_Stateful_AddressCohorts { + pub amount_range: CatalogTree_Computed_Stateful_AddressCohorts_AmountRange, + pub ge_amount: CatalogTree_Computed_Stateful_AddressCohorts_GeAmount, + pub lt_amount: CatalogTree_Computed_Stateful_AddressCohorts_LtAmount, +} + +impl CatalogTree_Computed_Stateful_AddressCohorts { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + amount_range: CatalogTree_Computed_Stateful_AddressCohorts_AmountRange::new(client.clone(), &format!("{base_path}/amount_range")), + ge_amount: CatalogTree_Computed_Stateful_AddressCohorts_GeAmount::new(client.clone(), &format!("{base_path}/ge_amount")), + lt_amount: CatalogTree_Computed_Stateful_AddressCohorts_LtAmount::new(client.clone(), &format!("{base_path}/lt_amount")), + } + } +} + +/// Catalog tree node. +pub struct CatalogTree_Computed_Stateful_AddressCohorts_AmountRange { + pub _0sats: _0satsPattern, + pub _100btc_to_1k_btc: _0satsPattern, + pub _100k_btc_or_more: _0satsPattern, + pub _100k_sats_to_1m_sats: _0satsPattern, + pub _100sats_to_1k_sats: _0satsPattern, + pub _10btc_to_100btc: _0satsPattern, + pub _10k_btc_to_100k_btc: _0satsPattern, + pub _10k_sats_to_100k_sats: _0satsPattern, + pub _10m_sats_to_1btc: _0satsPattern, + pub _10sats_to_100sats: _0satsPattern, + pub _1btc_to_10btc: _0satsPattern, + pub _1k_btc_to_10k_btc: _0satsPattern, + pub _1k_sats_to_10k_sats: _0satsPattern, + pub _1m_sats_to_10m_sats: _0satsPattern, + pub _1sat_to_10sats: _0satsPattern, +} + +impl CatalogTree_Computed_Stateful_AddressCohorts_AmountRange { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + _0sats: _0satsPattern::new(client.clone(), &format!("{base_path}/_0sats")), + _100btc_to_1k_btc: _0satsPattern::new(client.clone(), &format!("{base_path}/_100btc_to_1k_btc")), + _100k_btc_or_more: _0satsPattern::new(client.clone(), &format!("{base_path}/_100k_btc_or_more")), + _100k_sats_to_1m_sats: _0satsPattern::new(client.clone(), &format!("{base_path}/_100k_sats_to_1m_sats")), + _100sats_to_1k_sats: _0satsPattern::new(client.clone(), &format!("{base_path}/_100sats_to_1k_sats")), + _10btc_to_100btc: _0satsPattern::new(client.clone(), &format!("{base_path}/_10btc_to_100btc")), + _10k_btc_to_100k_btc: _0satsPattern::new(client.clone(), &format!("{base_path}/_10k_btc_to_100k_btc")), + _10k_sats_to_100k_sats: _0satsPattern::new(client.clone(), &format!("{base_path}/_10k_sats_to_100k_sats")), + _10m_sats_to_1btc: _0satsPattern::new(client.clone(), &format!("{base_path}/_10m_sats_to_1btc")), + _10sats_to_100sats: _0satsPattern::new(client.clone(), &format!("{base_path}/_10sats_to_100sats")), + _1btc_to_10btc: _0satsPattern::new(client.clone(), &format!("{base_path}/_1btc_to_10btc")), + _1k_btc_to_10k_btc: _0satsPattern::new(client.clone(), &format!("{base_path}/_1k_btc_to_10k_btc")), + _1k_sats_to_10k_sats: _0satsPattern::new(client.clone(), &format!("{base_path}/_1k_sats_to_10k_sats")), + _1m_sats_to_10m_sats: _0satsPattern::new(client.clone(), &format!("{base_path}/_1m_sats_to_10m_sats")), + _1sat_to_10sats: _0satsPattern::new(client.clone(), &format!("{base_path}/_1sat_to_10sats")), + } + } +} + +/// Catalog tree node. +pub struct CatalogTree_Computed_Stateful_AddressCohorts_GeAmount { + pub _100btc: _0satsPattern, + pub _100k_sats: _0satsPattern, + pub _100sats: _0satsPattern, + pub _10btc: _0satsPattern, + pub _10k_btc: _0satsPattern, + pub _10k_sats: _0satsPattern, + pub _10m_sats: _0satsPattern, + pub _10sats: _0satsPattern, + pub _1btc: _0satsPattern, + pub _1k_btc: _0satsPattern, + pub _1k_sats: _0satsPattern, + pub _1m_sats: _0satsPattern, + pub _1sat: _0satsPattern, +} + +impl CatalogTree_Computed_Stateful_AddressCohorts_GeAmount { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + _100btc: _0satsPattern::new(client.clone(), &format!("{base_path}/_100btc")), + _100k_sats: _0satsPattern::new(client.clone(), &format!("{base_path}/_100k_sats")), + _100sats: _0satsPattern::new(client.clone(), &format!("{base_path}/_100sats")), + _10btc: _0satsPattern::new(client.clone(), &format!("{base_path}/_10btc")), + _10k_btc: _0satsPattern::new(client.clone(), &format!("{base_path}/_10k_btc")), + _10k_sats: _0satsPattern::new(client.clone(), &format!("{base_path}/_10k_sats")), + _10m_sats: _0satsPattern::new(client.clone(), &format!("{base_path}/_10m_sats")), + _10sats: _0satsPattern::new(client.clone(), &format!("{base_path}/_10sats")), + _1btc: _0satsPattern::new(client.clone(), &format!("{base_path}/_1btc")), + _1k_btc: _0satsPattern::new(client.clone(), &format!("{base_path}/_1k_btc")), + _1k_sats: _0satsPattern::new(client.clone(), &format!("{base_path}/_1k_sats")), + _1m_sats: _0satsPattern::new(client.clone(), &format!("{base_path}/_1m_sats")), + _1sat: _0satsPattern::new(client.clone(), &format!("{base_path}/_1sat")), + } + } +} + +/// Catalog tree node. +pub struct CatalogTree_Computed_Stateful_AddressCohorts_LtAmount { + pub _100btc: _0satsPattern, + pub _100k_btc: _0satsPattern, + pub _100k_sats: _0satsPattern, + pub _100sats: _0satsPattern, + pub _10btc: _0satsPattern, + pub _10k_btc: _0satsPattern, + pub _10k_sats: _0satsPattern, + pub _10m_sats: _0satsPattern, + pub _10sats: _0satsPattern, + pub _1btc: _0satsPattern, + pub _1k_btc: _0satsPattern, + pub _1k_sats: _0satsPattern, + pub _1m_sats: _0satsPattern, +} + +impl CatalogTree_Computed_Stateful_AddressCohorts_LtAmount { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + _100btc: _0satsPattern::new(client.clone(), &format!("{base_path}/_100btc")), + _100k_btc: _0satsPattern::new(client.clone(), &format!("{base_path}/_100k_btc")), + _100k_sats: _0satsPattern::new(client.clone(), &format!("{base_path}/_100k_sats")), + _100sats: _0satsPattern::new(client.clone(), &format!("{base_path}/_100sats")), + _10btc: _0satsPattern::new(client.clone(), &format!("{base_path}/_10btc")), + _10k_btc: _0satsPattern::new(client.clone(), &format!("{base_path}/_10k_btc")), + _10k_sats: _0satsPattern::new(client.clone(), &format!("{base_path}/_10k_sats")), + _10m_sats: _0satsPattern::new(client.clone(), &format!("{base_path}/_10m_sats")), + _10sats: _0satsPattern::new(client.clone(), &format!("{base_path}/_10sats")), + _1btc: _0satsPattern::new(client.clone(), &format!("{base_path}/_1btc")), + _1k_btc: _0satsPattern::new(client.clone(), &format!("{base_path}/_1k_btc")), + _1k_sats: _0satsPattern::new(client.clone(), &format!("{base_path}/_1k_sats")), + _1m_sats: _0satsPattern::new(client.clone(), &format!("{base_path}/_1m_sats")), + } + } +} + +/// Catalog tree node. +pub struct CatalogTree_Computed_Stateful_AddressesData { + pub empty: Indexes29, + pub loaded: Indexes30, +} + +impl CatalogTree_Computed_Stateful_AddressesData { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + empty: Indexes29::new(client.clone(), &format!("{base_path}/empty")), + loaded: Indexes30::new(client.clone(), &format!("{base_path}/loaded")), + } + } +} + +/// Catalog tree node. +pub struct CatalogTree_Computed_Stateful_UtxoCohorts { + pub age_range: CatalogTree_Computed_Stateful_UtxoCohorts_AgeRange, + pub all: CatalogTree_Computed_Stateful_UtxoCohorts_All, + pub amount_range: CatalogTree_Computed_Stateful_UtxoCohorts_AmountRange, + pub epoch: CatalogTree_Computed_Stateful_UtxoCohorts_Epoch, + pub ge_amount: CatalogTree_Computed_Stateful_UtxoCohorts_GeAmount, + pub lt_amount: CatalogTree_Computed_Stateful_UtxoCohorts_LtAmount, + pub max_age: CatalogTree_Computed_Stateful_UtxoCohorts_MaxAge, + pub min_age: CatalogTree_Computed_Stateful_UtxoCohorts_MinAge, + pub term: CatalogTree_Computed_Stateful_UtxoCohorts_Term, + pub type_: CatalogTree_Computed_Stateful_UtxoCohorts_Type, + pub year: CatalogTree_Computed_Stateful_UtxoCohorts_Year, +} + +impl CatalogTree_Computed_Stateful_UtxoCohorts { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + age_range: CatalogTree_Computed_Stateful_UtxoCohorts_AgeRange::new(client.clone(), &format!("{base_path}/age_range")), + all: CatalogTree_Computed_Stateful_UtxoCohorts_All::new(client.clone(), &format!("{base_path}/all")), + amount_range: CatalogTree_Computed_Stateful_UtxoCohorts_AmountRange::new(client.clone(), &format!("{base_path}/amount_range")), + epoch: CatalogTree_Computed_Stateful_UtxoCohorts_Epoch::new(client.clone(), &format!("{base_path}/epoch")), + ge_amount: CatalogTree_Computed_Stateful_UtxoCohorts_GeAmount::new(client.clone(), &format!("{base_path}/ge_amount")), + lt_amount: CatalogTree_Computed_Stateful_UtxoCohorts_LtAmount::new(client.clone(), &format!("{base_path}/lt_amount")), + max_age: CatalogTree_Computed_Stateful_UtxoCohorts_MaxAge::new(client.clone(), &format!("{base_path}/max_age")), + min_age: CatalogTree_Computed_Stateful_UtxoCohorts_MinAge::new(client.clone(), &format!("{base_path}/min_age")), + term: CatalogTree_Computed_Stateful_UtxoCohorts_Term::new(client.clone(), &format!("{base_path}/term")), + type_: CatalogTree_Computed_Stateful_UtxoCohorts_Type::new(client.clone(), &format!("{base_path}/type_")), + year: CatalogTree_Computed_Stateful_UtxoCohorts_Year::new(client.clone(), &format!("{base_path}/year")), + } + } +} + +/// Catalog tree node. +pub struct CatalogTree_Computed_Stateful_UtxoCohorts_AgeRange { + pub _10y_to_12y: _10yTo12yPattern, + pub _12y_to_15y: _10yTo12yPattern, + pub _1d_to_1w: _10yTo12yPattern, + pub _1m_to_2m: _10yTo12yPattern, + pub _1w_to_1m: _10yTo12yPattern, + pub _1y_to_2y: _10yTo12yPattern, + pub _2m_to_3m: _10yTo12yPattern, + pub _2y_to_3y: _10yTo12yPattern, + pub _3m_to_4m: _10yTo12yPattern, + pub _3y_to_4y: _10yTo12yPattern, + pub _4m_to_5m: _10yTo12yPattern, + pub _4y_to_5y: _10yTo12yPattern, + pub _5m_to_6m: _10yTo12yPattern, + pub _5y_to_6y: _10yTo12yPattern, + pub _6m_to_1y: _10yTo12yPattern, + pub _6y_to_7y: _10yTo12yPattern, + pub _7y_to_8y: _10yTo12yPattern, + pub _8y_to_10y: _10yTo12yPattern, + pub from_15y: _10yTo12yPattern, + pub up_to_1d: UpTo1dPattern, +} + +impl CatalogTree_Computed_Stateful_UtxoCohorts_AgeRange { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + _10y_to_12y: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_10y_to_12y")), + _12y_to_15y: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_12y_to_15y")), + _1d_to_1w: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_1d_to_1w")), + _1m_to_2m: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_1m_to_2m")), + _1w_to_1m: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_1w_to_1m")), + _1y_to_2y: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_1y_to_2y")), + _2m_to_3m: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_2m_to_3m")), + _2y_to_3y: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_2y_to_3y")), + _3m_to_4m: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_3m_to_4m")), + _3y_to_4y: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_3y_to_4y")), + _4m_to_5m: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_4m_to_5m")), + _4y_to_5y: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_4y_to_5y")), + _5m_to_6m: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_5m_to_6m")), + _5y_to_6y: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_5y_to_6y")), + _6m_to_1y: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_6m_to_1y")), + _6y_to_7y: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_6y_to_7y")), + _7y_to_8y: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_7y_to_8y")), + _8y_to_10y: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_8y_to_10y")), + from_15y: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/from_15y")), + up_to_1d: UpTo1dPattern::new(client.clone(), &format!("{base_path}/up_to_1d")), + } + } +} + +/// Catalog tree node. +pub struct CatalogTree_Computed_Stateful_UtxoCohorts_All { + pub activity: ActivityPattern, + pub price_paid: PricePaidPattern2, + pub realized: RealizedPattern3, + pub relative: CatalogTree_Computed_Stateful_UtxoCohorts_All_Relative, + pub supply: SupplyPattern2, + pub unrealized: UnrealizedPattern, +} + +impl CatalogTree_Computed_Stateful_UtxoCohorts_All { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + activity: ActivityPattern::new(client.clone(), &format!("{base_path}/activity")), + price_paid: PricePaidPattern2::new(client.clone(), &format!("{base_path}/price_paid")), + realized: RealizedPattern3::new(client.clone(), &format!("{base_path}/realized")), + relative: CatalogTree_Computed_Stateful_UtxoCohorts_All_Relative::new(client.clone(), &format!("{base_path}/relative")), + supply: SupplyPattern2::new(client.clone(), &format!("{base_path}/supply")), + unrealized: UnrealizedPattern::new(client.clone(), &format!("{base_path}/unrealized")), + } + } +} + +/// Catalog tree node. +pub struct CatalogTree_Computed_Stateful_UtxoCohorts_All_Relative { + pub neg_unrealized_loss_rel_to_own_total_unrealized_pnl: Indexes27, + pub net_unrealized_pnl_rel_to_own_total_unrealized_pnl: Indexes26, + pub supply_in_loss_rel_to_own_supply: Indexes27, + pub supply_in_profit_rel_to_own_supply: Indexes27, + pub unrealized_loss_rel_to_own_total_unrealized_pnl: Indexes27, + pub unrealized_profit_rel_to_own_total_unrealized_pnl: Indexes27, +} + +impl CatalogTree_Computed_Stateful_UtxoCohorts_All_Relative { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + neg_unrealized_loss_rel_to_own_total_unrealized_pnl: Indexes27::new(client.clone(), &format!("{base_path}/neg_unrealized_loss_rel_to_own_total_unrealized_pnl")), + net_unrealized_pnl_rel_to_own_total_unrealized_pnl: Indexes26::new(client.clone(), &format!("{base_path}/net_unrealized_pnl_rel_to_own_total_unrealized_pnl")), + supply_in_loss_rel_to_own_supply: Indexes27::new(client.clone(), &format!("{base_path}/supply_in_loss_rel_to_own_supply")), + supply_in_profit_rel_to_own_supply: Indexes27::new(client.clone(), &format!("{base_path}/supply_in_profit_rel_to_own_supply")), + unrealized_loss_rel_to_own_total_unrealized_pnl: Indexes27::new(client.clone(), &format!("{base_path}/unrealized_loss_rel_to_own_total_unrealized_pnl")), + unrealized_profit_rel_to_own_total_unrealized_pnl: Indexes27::new(client.clone(), &format!("{base_path}/unrealized_profit_rel_to_own_total_unrealized_pnl")), + } + } +} + +/// Catalog tree node. +pub struct CatalogTree_Computed_Stateful_UtxoCohorts_AmountRange { + pub _0sats: _0satsPattern2, + pub _100btc_to_1k_btc: _0satsPattern2, + pub _100k_btc_or_more: _0satsPattern2, + pub _100k_sats_to_1m_sats: _0satsPattern2, + pub _100sats_to_1k_sats: _0satsPattern2, + pub _10btc_to_100btc: _0satsPattern2, + pub _10k_btc_to_100k_btc: _0satsPattern2, + pub _10k_sats_to_100k_sats: _0satsPattern2, + pub _10m_sats_to_1btc: _0satsPattern2, + pub _10sats_to_100sats: _0satsPattern2, + pub _1btc_to_10btc: _0satsPattern2, + pub _1k_btc_to_10k_btc: _0satsPattern2, + pub _1k_sats_to_10k_sats: _0satsPattern2, + pub _1m_sats_to_10m_sats: _0satsPattern2, + pub _1sat_to_10sats: _0satsPattern2, +} + +impl CatalogTree_Computed_Stateful_UtxoCohorts_AmountRange { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + _0sats: _0satsPattern2::new(client.clone(), &format!("{base_path}/_0sats")), + _100btc_to_1k_btc: _0satsPattern2::new(client.clone(), &format!("{base_path}/_100btc_to_1k_btc")), + _100k_btc_or_more: _0satsPattern2::new(client.clone(), &format!("{base_path}/_100k_btc_or_more")), + _100k_sats_to_1m_sats: _0satsPattern2::new(client.clone(), &format!("{base_path}/_100k_sats_to_1m_sats")), + _100sats_to_1k_sats: _0satsPattern2::new(client.clone(), &format!("{base_path}/_100sats_to_1k_sats")), + _10btc_to_100btc: _0satsPattern2::new(client.clone(), &format!("{base_path}/_10btc_to_100btc")), + _10k_btc_to_100k_btc: _0satsPattern2::new(client.clone(), &format!("{base_path}/_10k_btc_to_100k_btc")), + _10k_sats_to_100k_sats: _0satsPattern2::new(client.clone(), &format!("{base_path}/_10k_sats_to_100k_sats")), + _10m_sats_to_1btc: _0satsPattern2::new(client.clone(), &format!("{base_path}/_10m_sats_to_1btc")), + _10sats_to_100sats: _0satsPattern2::new(client.clone(), &format!("{base_path}/_10sats_to_100sats")), + _1btc_to_10btc: _0satsPattern2::new(client.clone(), &format!("{base_path}/_1btc_to_10btc")), + _1k_btc_to_10k_btc: _0satsPattern2::new(client.clone(), &format!("{base_path}/_1k_btc_to_10k_btc")), + _1k_sats_to_10k_sats: _0satsPattern2::new(client.clone(), &format!("{base_path}/_1k_sats_to_10k_sats")), + _1m_sats_to_10m_sats: _0satsPattern2::new(client.clone(), &format!("{base_path}/_1m_sats_to_10m_sats")), + _1sat_to_10sats: _0satsPattern2::new(client.clone(), &format!("{base_path}/_1sat_to_10sats")), + } + } +} + +/// Catalog tree node. +pub struct CatalogTree_Computed_Stateful_UtxoCohorts_Epoch { + pub _0: _10yTo12yPattern, + pub _1: _10yTo12yPattern, + pub _2: _10yTo12yPattern, + pub _3: _10yTo12yPattern, + pub _4: _10yTo12yPattern, +} + +impl CatalogTree_Computed_Stateful_UtxoCohorts_Epoch { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + _0: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_0")), + _1: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_1")), + _2: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_2")), + _3: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_3")), + _4: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_4")), + } + } +} + +/// Catalog tree node. +pub struct CatalogTree_Computed_Stateful_UtxoCohorts_GeAmount { + pub _100btc: _0satsPattern2, + pub _100k_sats: _0satsPattern2, + pub _100sats: _0satsPattern2, + pub _10btc: _0satsPattern2, + pub _10k_btc: _0satsPattern2, + pub _10k_sats: _0satsPattern2, + pub _10m_sats: _0satsPattern2, + pub _10sats: _0satsPattern2, + pub _1btc: _0satsPattern2, + pub _1k_btc: _0satsPattern2, + pub _1k_sats: _0satsPattern2, + pub _1m_sats: _0satsPattern2, + pub _1sat: _0satsPattern2, +} + +impl CatalogTree_Computed_Stateful_UtxoCohorts_GeAmount { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + _100btc: _0satsPattern2::new(client.clone(), &format!("{base_path}/_100btc")), + _100k_sats: _0satsPattern2::new(client.clone(), &format!("{base_path}/_100k_sats")), + _100sats: _0satsPattern2::new(client.clone(), &format!("{base_path}/_100sats")), + _10btc: _0satsPattern2::new(client.clone(), &format!("{base_path}/_10btc")), + _10k_btc: _0satsPattern2::new(client.clone(), &format!("{base_path}/_10k_btc")), + _10k_sats: _0satsPattern2::new(client.clone(), &format!("{base_path}/_10k_sats")), + _10m_sats: _0satsPattern2::new(client.clone(), &format!("{base_path}/_10m_sats")), + _10sats: _0satsPattern2::new(client.clone(), &format!("{base_path}/_10sats")), + _1btc: _0satsPattern2::new(client.clone(), &format!("{base_path}/_1btc")), + _1k_btc: _0satsPattern2::new(client.clone(), &format!("{base_path}/_1k_btc")), + _1k_sats: _0satsPattern2::new(client.clone(), &format!("{base_path}/_1k_sats")), + _1m_sats: _0satsPattern2::new(client.clone(), &format!("{base_path}/_1m_sats")), + _1sat: _0satsPattern2::new(client.clone(), &format!("{base_path}/_1sat")), + } + } +} + +/// Catalog tree node. +pub struct CatalogTree_Computed_Stateful_UtxoCohorts_LtAmount { + pub _100btc: _0satsPattern2, + pub _100k_btc: _0satsPattern2, + pub _100k_sats: _0satsPattern2, + pub _100sats: _0satsPattern2, + pub _10btc: _0satsPattern2, + pub _10k_btc: _0satsPattern2, + pub _10k_sats: _0satsPattern2, + pub _10m_sats: _0satsPattern2, + pub _10sats: _0satsPattern2, + pub _1btc: _0satsPattern2, + pub _1k_btc: _0satsPattern2, + pub _1k_sats: _0satsPattern2, + pub _1m_sats: _0satsPattern2, +} + +impl CatalogTree_Computed_Stateful_UtxoCohorts_LtAmount { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + _100btc: _0satsPattern2::new(client.clone(), &format!("{base_path}/_100btc")), + _100k_btc: _0satsPattern2::new(client.clone(), &format!("{base_path}/_100k_btc")), + _100k_sats: _0satsPattern2::new(client.clone(), &format!("{base_path}/_100k_sats")), + _100sats: _0satsPattern2::new(client.clone(), &format!("{base_path}/_100sats")), + _10btc: _0satsPattern2::new(client.clone(), &format!("{base_path}/_10btc")), + _10k_btc: _0satsPattern2::new(client.clone(), &format!("{base_path}/_10k_btc")), + _10k_sats: _0satsPattern2::new(client.clone(), &format!("{base_path}/_10k_sats")), + _10m_sats: _0satsPattern2::new(client.clone(), &format!("{base_path}/_10m_sats")), + _10sats: _0satsPattern2::new(client.clone(), &format!("{base_path}/_10sats")), + _1btc: _0satsPattern2::new(client.clone(), &format!("{base_path}/_1btc")), + _1k_btc: _0satsPattern2::new(client.clone(), &format!("{base_path}/_1k_btc")), + _1k_sats: _0satsPattern2::new(client.clone(), &format!("{base_path}/_1k_sats")), + _1m_sats: _0satsPattern2::new(client.clone(), &format!("{base_path}/_1m_sats")), + } + } +} + +/// Catalog tree node. +pub struct CatalogTree_Computed_Stateful_UtxoCohorts_MaxAge { + pub _10y: UpTo1dPattern, + pub _12y: UpTo1dPattern, + pub _15y: UpTo1dPattern, + pub _1m: UpTo1dPattern, + pub _1w: UpTo1dPattern, + pub _1y: UpTo1dPattern, + pub _2m: UpTo1dPattern, + pub _2y: UpTo1dPattern, + pub _3m: UpTo1dPattern, + pub _3y: UpTo1dPattern, + pub _4m: UpTo1dPattern, + pub _4y: UpTo1dPattern, + pub _5m: UpTo1dPattern, + pub _5y: UpTo1dPattern, + pub _6m: UpTo1dPattern, + pub _6y: UpTo1dPattern, + pub _7y: UpTo1dPattern, + pub _8y: UpTo1dPattern, +} + +impl CatalogTree_Computed_Stateful_UtxoCohorts_MaxAge { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + _10y: UpTo1dPattern::new(client.clone(), &format!("{base_path}/_10y")), + _12y: UpTo1dPattern::new(client.clone(), &format!("{base_path}/_12y")), + _15y: UpTo1dPattern::new(client.clone(), &format!("{base_path}/_15y")), + _1m: UpTo1dPattern::new(client.clone(), &format!("{base_path}/_1m")), + _1w: UpTo1dPattern::new(client.clone(), &format!("{base_path}/_1w")), + _1y: UpTo1dPattern::new(client.clone(), &format!("{base_path}/_1y")), + _2m: UpTo1dPattern::new(client.clone(), &format!("{base_path}/_2m")), + _2y: UpTo1dPattern::new(client.clone(), &format!("{base_path}/_2y")), + _3m: UpTo1dPattern::new(client.clone(), &format!("{base_path}/_3m")), + _3y: UpTo1dPattern::new(client.clone(), &format!("{base_path}/_3y")), + _4m: UpTo1dPattern::new(client.clone(), &format!("{base_path}/_4m")), + _4y: UpTo1dPattern::new(client.clone(), &format!("{base_path}/_4y")), + _5m: UpTo1dPattern::new(client.clone(), &format!("{base_path}/_5m")), + _5y: UpTo1dPattern::new(client.clone(), &format!("{base_path}/_5y")), + _6m: UpTo1dPattern::new(client.clone(), &format!("{base_path}/_6m")), + _6y: UpTo1dPattern::new(client.clone(), &format!("{base_path}/_6y")), + _7y: UpTo1dPattern::new(client.clone(), &format!("{base_path}/_7y")), + _8y: UpTo1dPattern::new(client.clone(), &format!("{base_path}/_8y")), + } + } +} + +/// Catalog tree node. +pub struct CatalogTree_Computed_Stateful_UtxoCohorts_MinAge { + pub _10y: _10yTo12yPattern, + pub _12y: _10yTo12yPattern, + pub _1d: _10yTo12yPattern, + pub _1m: _10yTo12yPattern, + pub _1w: _10yTo12yPattern, + pub _1y: _10yTo12yPattern, + pub _2m: _10yTo12yPattern, + pub _2y: _10yTo12yPattern, + pub _3m: _10yTo12yPattern, + pub _3y: _10yTo12yPattern, + pub _4m: _10yTo12yPattern, + pub _4y: _10yTo12yPattern, + pub _5m: _10yTo12yPattern, + pub _5y: _10yTo12yPattern, + pub _6m: _10yTo12yPattern, + pub _6y: _10yTo12yPattern, + pub _7y: _10yTo12yPattern, + pub _8y: _10yTo12yPattern, +} + +impl CatalogTree_Computed_Stateful_UtxoCohorts_MinAge { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + _10y: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_10y")), + _12y: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_12y")), + _1d: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_1d")), + _1m: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_1m")), + _1w: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_1w")), + _1y: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_1y")), + _2m: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_2m")), + _2y: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_2y")), + _3m: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_3m")), + _3y: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_3y")), + _4m: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_4m")), + _4y: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_4y")), + _5m: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_5m")), + _5y: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_5y")), + _6m: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_6m")), + _6y: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_6y")), + _7y: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_7y")), + _8y: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_8y")), + } + } +} + +/// Catalog tree node. +pub struct CatalogTree_Computed_Stateful_UtxoCohorts_Term { + pub long: UpTo1dPattern, + pub short: UpTo1dPattern, +} + +impl CatalogTree_Computed_Stateful_UtxoCohorts_Term { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + long: UpTo1dPattern::new(client.clone(), &format!("{base_path}/long")), + short: UpTo1dPattern::new(client.clone(), &format!("{base_path}/short")), + } + } +} + +/// Catalog tree node. +pub struct CatalogTree_Computed_Stateful_UtxoCohorts_Type { + pub empty: _0satsPattern2, + pub p2a: _0satsPattern2, + pub p2ms: _0satsPattern2, + pub p2pk33: _0satsPattern2, + pub p2pk65: _0satsPattern2, + pub p2pkh: _0satsPattern2, + pub p2sh: _0satsPattern2, + pub p2tr: _0satsPattern2, + pub p2wpkh: _0satsPattern2, + pub p2wsh: _0satsPattern2, + pub unknown: _0satsPattern2, +} + +impl CatalogTree_Computed_Stateful_UtxoCohorts_Type { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + empty: _0satsPattern2::new(client.clone(), &format!("{base_path}/empty")), + p2a: _0satsPattern2::new(client.clone(), &format!("{base_path}/p2a")), + p2ms: _0satsPattern2::new(client.clone(), &format!("{base_path}/p2ms")), + p2pk33: _0satsPattern2::new(client.clone(), &format!("{base_path}/p2pk33")), + p2pk65: _0satsPattern2::new(client.clone(), &format!("{base_path}/p2pk65")), + p2pkh: _0satsPattern2::new(client.clone(), &format!("{base_path}/p2pkh")), + p2sh: _0satsPattern2::new(client.clone(), &format!("{base_path}/p2sh")), + p2tr: _0satsPattern2::new(client.clone(), &format!("{base_path}/p2tr")), + p2wpkh: _0satsPattern2::new(client.clone(), &format!("{base_path}/p2wpkh")), + p2wsh: _0satsPattern2::new(client.clone(), &format!("{base_path}/p2wsh")), + unknown: _0satsPattern2::new(client.clone(), &format!("{base_path}/unknown")), + } + } +} + +/// Catalog tree node. +pub struct CatalogTree_Computed_Stateful_UtxoCohorts_Year { + pub _2009: _10yTo12yPattern, + pub _2010: _10yTo12yPattern, + pub _2011: _10yTo12yPattern, + pub _2012: _10yTo12yPattern, + pub _2013: _10yTo12yPattern, + pub _2014: _10yTo12yPattern, + pub _2015: _10yTo12yPattern, + pub _2016: _10yTo12yPattern, + pub _2017: _10yTo12yPattern, + pub _2018: _10yTo12yPattern, + pub _2019: _10yTo12yPattern, + pub _2020: _10yTo12yPattern, + pub _2021: _10yTo12yPattern, + pub _2022: _10yTo12yPattern, + pub _2023: _10yTo12yPattern, + pub _2024: _10yTo12yPattern, + pub _2025: _10yTo12yPattern, + pub _2026: _10yTo12yPattern, +} + +impl CatalogTree_Computed_Stateful_UtxoCohorts_Year { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + _2009: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_2009")), + _2010: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_2010")), + _2011: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_2011")), + _2012: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_2012")), + _2013: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_2013")), + _2014: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_2014")), + _2015: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_2015")), + _2016: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_2016")), + _2017: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_2017")), + _2018: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_2018")), + _2019: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_2019")), + _2020: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_2020")), + _2021: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_2021")), + _2022: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_2022")), + _2023: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_2023")), + _2024: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_2024")), + _2025: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_2025")), + _2026: _10yTo12yPattern::new(client.clone(), &format!("{base_path}/_2026")), + } + } +} + +/// Catalog tree node. +pub struct CatalogTree_Computed_Txins { + pub txoutindex: Indexes24, + pub value: Indexes24, +} + +impl CatalogTree_Computed_Txins { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + txoutindex: Indexes24::new(client.clone(), &format!("{base_path}/txoutindex")), + value: Indexes24::new(client.clone(), &format!("{base_path}/value")), + } + } +} + +/// Catalog tree node. +pub struct CatalogTree_Computed_Txouts { + pub txinindex: Indexes25, +} + +impl CatalogTree_Computed_Txouts { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + txinindex: Indexes25::new(client.clone(), &format!("{base_path}/txinindex")), + } + } +} + +/// Catalog tree node. +pub struct CatalogTree_Indexed { + pub address: CatalogTree_Indexed_Address, + pub block: CatalogTree_Indexed_Block, + pub output: CatalogTree_Indexed_Output, + pub tx: CatalogTree_Indexed_Tx, + pub txin: CatalogTree_Indexed_Txin, + pub txout: CatalogTree_Indexed_Txout, +} + +impl CatalogTree_Indexed { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + address: CatalogTree_Indexed_Address::new(client.clone(), &format!("{base_path}/address")), + block: CatalogTree_Indexed_Block::new(client.clone(), &format!("{base_path}/block")), + output: CatalogTree_Indexed_Output::new(client.clone(), &format!("{base_path}/output")), + tx: CatalogTree_Indexed_Tx::new(client.clone(), &format!("{base_path}/tx")), + txin: CatalogTree_Indexed_Txin::new(client.clone(), &format!("{base_path}/txin")), + txout: CatalogTree_Indexed_Txout::new(client.clone(), &format!("{base_path}/txout")), + } + } +} + +/// Catalog tree node. +pub struct CatalogTree_Indexed_Address { + pub first_p2aaddressindex: Indexes2, + pub first_p2pk33addressindex: Indexes2, + pub first_p2pk65addressindex: Indexes2, + pub first_p2pkhaddressindex: Indexes2, + pub first_p2shaddressindex: Indexes2, + pub first_p2traddressindex: Indexes2, + pub first_p2wpkhaddressindex: Indexes2, + pub first_p2wshaddressindex: Indexes2, + pub p2abytes: Indexes16, + pub p2pk33bytes: Indexes17, + pub p2pk65bytes: Indexes18, + pub p2pkhbytes: Indexes19, + pub p2shbytes: Indexes20, + pub p2trbytes: Indexes21, + pub p2wpkhbytes: Indexes22, + pub p2wshbytes: Indexes23, +} + +impl CatalogTree_Indexed_Address { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + first_p2aaddressindex: Indexes2::new(client.clone(), &format!("{base_path}/first_p2aaddressindex")), + first_p2pk33addressindex: Indexes2::new(client.clone(), &format!("{base_path}/first_p2pk33addressindex")), + first_p2pk65addressindex: Indexes2::new(client.clone(), &format!("{base_path}/first_p2pk65addressindex")), + first_p2pkhaddressindex: Indexes2::new(client.clone(), &format!("{base_path}/first_p2pkhaddressindex")), + first_p2shaddressindex: Indexes2::new(client.clone(), &format!("{base_path}/first_p2shaddressindex")), + first_p2traddressindex: Indexes2::new(client.clone(), &format!("{base_path}/first_p2traddressindex")), + first_p2wpkhaddressindex: Indexes2::new(client.clone(), &format!("{base_path}/first_p2wpkhaddressindex")), + first_p2wshaddressindex: Indexes2::new(client.clone(), &format!("{base_path}/first_p2wshaddressindex")), + p2abytes: Indexes16::new(client.clone(), &format!("{base_path}/p2abytes")), + p2pk33bytes: Indexes17::new(client.clone(), &format!("{base_path}/p2pk33bytes")), + p2pk65bytes: Indexes18::new(client.clone(), &format!("{base_path}/p2pk65bytes")), + p2pkhbytes: Indexes19::new(client.clone(), &format!("{base_path}/p2pkhbytes")), + p2shbytes: Indexes20::new(client.clone(), &format!("{base_path}/p2shbytes")), + p2trbytes: Indexes21::new(client.clone(), &format!("{base_path}/p2trbytes")), + p2wpkhbytes: Indexes22::new(client.clone(), &format!("{base_path}/p2wpkhbytes")), + p2wshbytes: Indexes23::new(client.clone(), &format!("{base_path}/p2wshbytes")), + } + } +} + +/// Catalog tree node. +pub struct CatalogTree_Indexed_Block { + pub blockhash: Indexes2, + pub difficulty: Indexes2, + pub timestamp: Indexes2, + pub total_size: Indexes2, + pub weight: Indexes2, +} + +impl CatalogTree_Indexed_Block { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + blockhash: Indexes2::new(client.clone(), &format!("{base_path}/blockhash")), + difficulty: Indexes2::new(client.clone(), &format!("{base_path}/difficulty")), + timestamp: Indexes2::new(client.clone(), &format!("{base_path}/timestamp")), + total_size: Indexes2::new(client.clone(), &format!("{base_path}/total_size")), + weight: Indexes2::new(client.clone(), &format!("{base_path}/weight")), + } + } +} + +/// Catalog tree node. +pub struct CatalogTree_Indexed_Output { + pub first_emptyoutputindex: Indexes2, + pub first_opreturnindex: Indexes2, + pub first_p2msoutputindex: Indexes2, + pub first_unknownoutputindex: Indexes2, + pub txindex: MetricNode, +} + +impl CatalogTree_Indexed_Output { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + first_emptyoutputindex: Indexes2::new(client.clone(), &format!("{base_path}/first_emptyoutputindex")), + first_opreturnindex: Indexes2::new(client.clone(), &format!("{base_path}/first_opreturnindex")), + first_p2msoutputindex: Indexes2::new(client.clone(), &format!("{base_path}/first_p2msoutputindex")), + first_unknownoutputindex: Indexes2::new(client.clone(), &format!("{base_path}/first_unknownoutputindex")), + txindex: MetricNode::new(client.clone(), format!("{base_path}/txindex")), + } + } +} + +/// Catalog tree node. +pub struct CatalogTree_Indexed_Tx { + pub base_size: Indexes6, + pub first_txindex: Indexes2, + pub first_txinindex: Indexes6, + pub first_txoutindex: Indexes6, + pub height: Indexes6, + pub is_explicitly_rbf: Indexes6, + pub rawlocktime: Indexes6, + pub total_size: Indexes6, + pub txid: Indexes6, + pub txversion: Indexes6, +} + +impl CatalogTree_Indexed_Tx { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + base_size: Indexes6::new(client.clone(), &format!("{base_path}/base_size")), + first_txindex: Indexes2::new(client.clone(), &format!("{base_path}/first_txindex")), + first_txinindex: Indexes6::new(client.clone(), &format!("{base_path}/first_txinindex")), + first_txoutindex: Indexes6::new(client.clone(), &format!("{base_path}/first_txoutindex")), + height: Indexes6::new(client.clone(), &format!("{base_path}/height")), + is_explicitly_rbf: Indexes6::new(client.clone(), &format!("{base_path}/is_explicitly_rbf")), + rawlocktime: Indexes6::new(client.clone(), &format!("{base_path}/rawlocktime")), + total_size: Indexes6::new(client.clone(), &format!("{base_path}/total_size")), + txid: Indexes6::new(client.clone(), &format!("{base_path}/txid")), + txversion: Indexes6::new(client.clone(), &format!("{base_path}/txversion")), + } + } +} + +/// Catalog tree node. +pub struct CatalogTree_Indexed_Txin { + pub first_txinindex: Indexes2, + pub outpoint: Indexes24, + pub outputtype: Indexes24, + pub txindex: Indexes24, + pub typeindex: Indexes24, +} + +impl CatalogTree_Indexed_Txin { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + first_txinindex: Indexes2::new(client.clone(), &format!("{base_path}/first_txinindex")), + outpoint: Indexes24::new(client.clone(), &format!("{base_path}/outpoint")), + outputtype: Indexes24::new(client.clone(), &format!("{base_path}/outputtype")), + txindex: Indexes24::new(client.clone(), &format!("{base_path}/txindex")), + typeindex: Indexes24::new(client.clone(), &format!("{base_path}/typeindex")), + } + } +} + +/// Catalog tree node. +pub struct CatalogTree_Indexed_Txout { + pub first_txoutindex: Indexes2, + pub outputtype: Indexes25, + pub txindex: Indexes25, + pub typeindex: Indexes25, + pub value: Indexes25, +} + +impl CatalogTree_Indexed_Txout { + pub fn new(client: Arc, base_path: &str) -> Self { + Self { + first_txoutindex: Indexes2::new(client.clone(), &format!("{base_path}/first_txoutindex")), + outputtype: Indexes25::new(client.clone(), &format!("{base_path}/outputtype")), + txindex: Indexes25::new(client.clone(), &format!("{base_path}/txindex")), + typeindex: Indexes25::new(client.clone(), &format!("{base_path}/typeindex")), + value: Indexes25::new(client.clone(), &format!("{base_path}/value")), + } + } +} + +/// Main BRK client with catalog tree and API methods. +pub struct BrkClient { + base: Arc, + tree: CatalogTree, +} + +impl BrkClient { + /// Create a new client with the given base URL. + pub fn new(base_url: impl Into) -> Self { + let base = Arc::new(BrkClientBase::new(base_url)); + let tree = CatalogTree::new(base.clone(), ""); + Self { base, tree } + } + + /// Create a new client with options. + pub fn with_options(options: BrkClientOptions) -> Self { + let base = Arc::new(BrkClientBase::with_options(options)); + let tree = CatalogTree::new(base.clone(), ""); + Self { base, tree } + } + + /// Get the catalog tree for navigating metrics. + pub fn tree(&self) -> &CatalogTree { + &self.tree + } + + /// Address information + /// + /// Retrieve comprehensive information about a Bitcoin address including balance, transaction history, UTXOs, and estimated investment metrics. Supports all standard Bitcoin address types (P2PKH, P2SH, P2WPKH, P2WSH, P2TR, etc.). + pub fn get_api_address_by_address(&self, address: &str) -> Result { + self.base.get(&format!("/api/address/{address}")) + } + + /// Address transaction IDs + /// + /// Get transaction IDs for an address, newest first. Use after_txid for pagination. + pub fn get_api_address_by_address_txs(&self, address: &str, after_txid: Option<&str>, limit: Option<&str>) -> Result> { + let mut query = Vec::new(); + if let Some(v) = after_txid { query.push(format!("after_txid={}", v)); } + if let Some(v) = limit { query.push(format!("limit={}", v)); } + let query_str = if query.is_empty() { String::new() } else { format!("?{}", query.join("&")) }; + self.base.get(&format!("/api/address/{address}/txs{}", query_str)) + } + + /// Address confirmed transactions + /// + /// Get confirmed transaction IDs for an address, 25 per page. Use ?after_txid= for pagination. + pub fn get_api_address_by_address_txs_chain(&self, address: &str, after_txid: Option<&str>, limit: Option<&str>) -> Result> { + let mut query = Vec::new(); + if let Some(v) = after_txid { query.push(format!("after_txid={}", v)); } + if let Some(v) = limit { query.push(format!("limit={}", v)); } + let query_str = if query.is_empty() { String::new() } else { format!("?{}", query.join("&")) }; + self.base.get(&format!("/api/address/{address}/txs/chain{}", query_str)) + } + + /// Address mempool transactions + /// + /// Get unconfirmed transaction IDs for an address from the mempool (up to 50). + pub fn get_api_address_by_address_txs_mempool(&self, address: &str) -> Result> { + self.base.get(&format!("/api/address/{address}/txs/mempool")) + } + + /// Address UTXOs + /// + /// Get unspent transaction outputs for an address. + pub fn get_api_address_by_address_utxo(&self, address: &str) -> Result> { + self.base.get(&format!("/api/address/{address}/utxo")) + } + + /// Block by height + /// + /// Retrieve block information by block height. Returns block metadata including hash, timestamp, difficulty, size, weight, and transaction count. + pub fn get_api_block_height_by_height(&self, height: &str) -> Result { + self.base.get(&format!("/api/block-height/{height}")) + } + + /// Block information + /// + /// Retrieve block information by block hash. Returns block metadata including height, timestamp, difficulty, size, weight, and transaction count. + pub fn get_api_block_by_hash(&self, hash: &str) -> Result { + self.base.get(&format!("/api/block/{hash}")) + } + + /// Raw block + /// + /// Returns the raw block data in binary format. + pub fn get_api_block_by_hash_raw(&self, hash: &str) -> Result> { + self.base.get(&format!("/api/block/{hash}/raw")) + } + + /// Block status + /// + /// Retrieve the status of a block. Returns whether the block is in the best chain and, if so, its height and the hash of the next block. + pub fn get_api_block_by_hash_status(&self, hash: &str) -> Result { + self.base.get(&format!("/api/block/{hash}/status")) + } + + /// Transaction ID at index + /// + /// Retrieve a single transaction ID at a specific index within a block. Returns plain text txid. + pub fn get_api_block_by_hash_txid_by_index(&self, hash: &str, index: &str) -> Result { + self.base.get(&format!("/api/block/{hash}/txid/{index}")) + } + + /// Block transaction IDs + /// + /// Retrieve all transaction IDs in a block by block hash. + pub fn get_api_block_by_hash_txids(&self, hash: &str) -> Result> { + self.base.get(&format!("/api/block/{hash}/txids")) + } + + /// Block transactions (paginated) + /// + /// Retrieve transactions in a block by block hash, starting from the specified index. Returns up to 25 transactions at a time. + pub fn get_api_block_by_hash_txs_by_start_index(&self, hash: &str, start_index: &str) -> Result> { + self.base.get(&format!("/api/block/{hash}/txs/{start_index}")) + } + + /// Recent blocks + /// + /// Retrieve the last 10 blocks. Returns block metadata for each block. + pub fn get_api_blocks(&self) -> Result> { + self.base.get(&format!("/api/blocks")) + } + + /// Blocks from height + /// + /// Retrieve up to 10 blocks going backwards from the given height. For example, height=100 returns blocks 100, 99, 98, ..., 91. Height=0 returns only block 0. + pub fn get_api_blocks_by_height(&self, height: &str) -> Result> { + self.base.get(&format!("/api/blocks/{height}")) + } + + /// Mempool statistics + /// + /// Get current mempool statistics including transaction count, total vsize, and total fees. + pub fn get_api_mempool_info(&self) -> Result { + self.base.get(&format!("/api/mempool/info")) + } + + /// Mempool transaction IDs + /// + /// Get all transaction IDs currently in the mempool. + pub fn get_api_mempool_txids(&self) -> Result> { + self.base.get(&format!("/api/mempool/txids")) + } + + /// Get supported indexes for a metric + /// + /// Returns the list of indexes are supported by the specified metric. For example, `realized_price` might be available on dateindex, weekindex, and monthindex. + pub fn get_api_metric_by_metric(&self, metric: &str) -> Result> { + self.base.get(&format!("/api/metric/{metric}")) + } + + /// Get metric data + /// + /// Fetch data for a specific metric at the given index. Use query parameters to filter by date range and format (json/csv). + pub fn get_api_metric_by_metric_by_index(&self, metric: &str, index: &str, from: Option<&str>, to: Option<&str>, count: Option<&str>, format: Option<&str>) -> Result { + let mut query = Vec::new(); + if let Some(v) = from { query.push(format!("from={}", v)); } + if let Some(v) = to { query.push(format!("to={}", v)); } + if let Some(v) = count { query.push(format!("count={}", v)); } + if let Some(v) = format { query.push(format!("format={}", v)); } + let query_str = if query.is_empty() { String::new() } else { format!("?{}", query.join("&")) }; + self.base.get(&format!("/api/metric/{metric}/{index}{}", query_str)) + } + + /// Bulk metric data + /// + /// Fetch multiple metrics in a single request. Supports filtering by index and date range. Returns an array of MetricData objects. + pub fn get_api_metrics_bulk(&self, metrics: &str, index: &str, from: Option<&str>, to: Option<&str>, count: Option<&str>, format: Option<&str>) -> Result> { + let mut query = Vec::new(); + query.push(format!("metrics={}", metrics)); + query.push(format!("index={}", index)); + if let Some(v) = from { query.push(format!("from={}", v)); } + if let Some(v) = to { query.push(format!("to={}", v)); } + if let Some(v) = count { query.push(format!("count={}", v)); } + if let Some(v) = format { query.push(format!("format={}", v)); } + let query_str = if query.is_empty() { String::new() } else { format!("?{}", query.join("&")) }; + self.base.get(&format!("/api/metrics/bulk{}", query_str)) + } + + /// Metrics catalog + /// + /// Returns the complete hierarchical catalog of available metrics organized as a tree structure. Metrics are grouped by categories and subcategories. Best viewed in an interactive JSON viewer (e.g., Firefox's built-in JSON viewer) for easy navigation of the nested structure. + pub fn get_api_metrics_catalog(&self) -> Result { + self.base.get(&format!("/api/metrics/catalog")) + } + + /// Metric count + /// + /// Current metric count + pub fn get_api_metrics_count(&self) -> Result> { + self.base.get(&format!("/api/metrics/count")) + } + + /// List available indexes + /// + /// Returns all available indexes with their accepted query aliases. Use any alias when querying metrics. + pub fn get_api_metrics_indexes(&self) -> Result> { + self.base.get(&format!("/api/metrics/indexes")) + } + + /// Metrics list + /// + /// Paginated list of available metrics + pub fn get_api_metrics_list(&self, page: Option<&str>) -> Result { + let mut query = Vec::new(); + if let Some(v) = page { query.push(format!("page={}", v)); } + let query_str = if query.is_empty() { String::new() } else { format!("?{}", query.join("&")) }; + self.base.get(&format!("/api/metrics/list{}", query_str)) + } + + /// Search metrics + /// + /// Fuzzy search for metrics by name. Supports partial matches and typos. + pub fn get_api_metrics_search_by_metric(&self, metric: &str, limit: Option<&str>) -> Result> { + let mut query = Vec::new(); + if let Some(v) = limit { query.push(format!("limit={}", v)); } + let query_str = if query.is_empty() { String::new() } else { format!("?{}", query.join("&")) }; + self.base.get(&format!("/api/metrics/search/{metric}{}", query_str)) + } + + /// Transaction information + /// + /// Retrieve complete transaction data by transaction ID (txid). Returns the full transaction details including inputs, outputs, and metadata. The transaction data is read directly from the blockchain data files. + pub fn get_api_tx_by_txid(&self, txid: &str) -> Result { + self.base.get(&format!("/api/tx/{txid}")) + } + + /// Transaction hex + /// + /// Retrieve the raw transaction as a hex-encoded string. Returns the serialized transaction in hexadecimal format. + pub fn get_api_tx_by_txid_hex(&self, txid: &str) -> Result { + self.base.get(&format!("/api/tx/{txid}/hex")) + } + + /// Output spend status + /// + /// Get the spending status of a transaction output. Returns whether the output has been spent and, if so, the spending transaction details. + pub fn get_api_tx_by_txid_outspend_by_vout(&self, txid: &str, vout: &str) -> Result { + self.base.get(&format!("/api/tx/{txid}/outspend/{vout}")) + } + + /// All output spend statuses + /// + /// Get the spending status of all outputs in a transaction. Returns an array with the spend status for each output. + pub fn get_api_tx_by_txid_outspends(&self, txid: &str) -> Result> { + self.base.get(&format!("/api/tx/{txid}/outspends")) + } + + /// Transaction status + /// + /// Retrieve the confirmation status of a transaction. Returns whether the transaction is confirmed and, if so, the block height, hash, and timestamp. + pub fn get_api_tx_by_txid_status(&self, txid: &str) -> Result { + self.base.get(&format!("/api/tx/{txid}/status")) + } + + /// Difficulty adjustment + /// + /// Get current difficulty adjustment information including progress through the current epoch, estimated retarget date, and difficulty change prediction. + pub fn get_api_v1_difficulty_adjustment(&self) -> Result { + self.base.get(&format!("/api/v1/difficulty-adjustment")) + } + + /// Projected mempool blocks + /// + /// Get projected blocks from the mempool for fee estimation. Each block contains statistics about transactions that would be included if a block were mined now. + pub fn get_api_v1_fees_mempool_blocks(&self) -> Result> { + self.base.get(&format!("/api/v1/fees/mempool-blocks")) + } + + /// Recommended fees + /// + /// Get recommended fee rates for different confirmation targets based on current mempool state. + pub fn get_api_v1_fees_recommended(&self) -> Result { + self.base.get(&format!("/api/v1/fees/recommended")) + } + + /// Block fees + /// + /// Get average block fees for a time period. Valid periods: 24h, 3d, 1w, 1m, 3m, 6m, 1y, 2y, 3y + pub fn get_api_v1_mining_blocks_fees_by_time_period(&self, time_period: &str) -> Result> { + self.base.get(&format!("/api/v1/mining/blocks/fees/{time_period}")) + } + + /// Block rewards + /// + /// Get average block rewards (coinbase = subsidy + fees) for a time period. Valid periods: 24h, 3d, 1w, 1m, 3m, 6m, 1y, 2y, 3y + pub fn get_api_v1_mining_blocks_rewards_by_time_period(&self, time_period: &str) -> Result> { + self.base.get(&format!("/api/v1/mining/blocks/rewards/{time_period}")) + } + + /// Block sizes and weights + /// + /// Get average block sizes and weights for a time period. Valid periods: 24h, 3d, 1w, 1m, 3m, 6m, 1y, 2y, 3y + pub fn get_api_v1_mining_blocks_sizes_weights_by_time_period(&self, time_period: &str) -> Result { + self.base.get(&format!("/api/v1/mining/blocks/sizes-weights/{time_period}")) + } + + /// Block by timestamp + /// + /// Find the block closest to a given UNIX timestamp. + pub fn get_api_v1_mining_blocks_timestamp_by_timestamp(&self, timestamp: &str) -> Result { + self.base.get(&format!("/api/v1/mining/blocks/timestamp/{timestamp}")) + } + + /// Difficulty adjustments (all time) + /// + /// Get historical difficulty adjustments. Returns array of [timestamp, height, difficulty, change_percent]. + pub fn get_api_v1_mining_difficulty_adjustments(&self) -> Result> { + self.base.get(&format!("/api/v1/mining/difficulty-adjustments")) + } + + /// Difficulty adjustments + /// + /// Get historical difficulty adjustments for a time period. Valid periods: 24h, 3d, 1w, 1m, 3m, 6m, 1y, 2y, 3y. Returns array of [timestamp, height, difficulty, change_percent]. + pub fn get_api_v1_mining_difficulty_adjustments_by_time_period(&self, time_period: &str) -> Result> { + self.base.get(&format!("/api/v1/mining/difficulty-adjustments/{time_period}")) + } + + /// Network hashrate (all time) + /// + /// Get network hashrate and difficulty data for all time. + pub fn get_api_v1_mining_hashrate(&self) -> Result { + self.base.get(&format!("/api/v1/mining/hashrate")) + } + + /// Network hashrate + /// + /// Get network hashrate and difficulty data for a time period. Valid periods: 24h, 3d, 1w, 1m, 3m, 6m, 1y, 2y, 3y + pub fn get_api_v1_mining_hashrate_by_time_period(&self, time_period: &str) -> Result { + self.base.get(&format!("/api/v1/mining/hashrate/{time_period}")) + } + + /// Mining pool details + /// + /// Get detailed information about a specific mining pool including block counts and shares for different time periods. + pub fn get_api_v1_mining_pool_by_slug(&self, slug: &str) -> Result { + self.base.get(&format!("/api/v1/mining/pool/{slug}")) + } + + /// List all mining pools + /// + /// Get list of all known mining pools with their identifiers. + pub fn get_api_v1_mining_pools(&self) -> Result> { + self.base.get(&format!("/api/v1/mining/pools")) + } + + /// Mining pool statistics + /// + /// Get mining pool statistics for a time period. Valid periods: 24h, 3d, 1w, 1m, 3m, 6m, 1y, 2y, 3y + pub fn get_api_v1_mining_pools_by_time_period(&self, time_period: &str) -> Result { + self.base.get(&format!("/api/v1/mining/pools/{time_period}")) + } + + /// Mining reward statistics + /// + /// Get mining reward statistics for the last N blocks including total rewards, fees, and transaction count. + pub fn get_api_v1_mining_reward_stats_by_block_count(&self, block_count: &str) -> Result { + self.base.get(&format!("/api/v1/mining/reward-stats/{block_count}")) + } + + /// Validate address + /// + /// Validate a Bitcoin address and get information about its type and scriptPubKey. + pub fn get_api_v1_validate_address_by_address(&self, address: &str) -> Result { + self.base.get(&format!("/api/v1/validate-address/{address}")) + } + + /// Health check + /// + /// Returns the health status of the API server + pub fn get_health(&self) -> Result { + self.base.get(&format!("/health")) + } + + /// API version + /// + /// Returns the current version of the API server + pub fn get_version(&self) -> Result { + self.base.get(&format!("/version")) + } + +} diff --git a/crates/brk_computer/examples/full_bench.rs b/crates/brk_computer/examples/full_bench.rs index 249fd6cf2..2b90055af 100644 --- a/crates/brk_computer/examples/full_bench.rs +++ b/crates/brk_computer/examples/full_bench.rs @@ -40,23 +40,6 @@ fn run() -> Result<()> { brk_logger::init(Some(&outputs_dir.join("log")))?; - let client = Client::new( - Client::default_url(), - Auth::CookieFile(bitcoin_dir.join(".cookie")), - )?; - - let reader = Reader::new(bitcoin_dir.join("blocks"), &client); - - let blocks = Blocks::new(&client, &reader); - - let mut indexer = Indexer::forced_import(&outputs_dir)?; - - let fetcher = Fetcher::import(true, None)?; - - info!("Ping: {:?}", fetcher.brk.ping()?); - - let mut computer = Computer::forced_import(&outputs_dir, &indexer, Some(fetcher))?; - let mut bencher = Bencher::from_cargo_env("brk", &outputs_dir)?; bencher.start()?; @@ -68,6 +51,33 @@ fn run() -> Result<()> { debug!("Bench stopped."); }); + let client = Client::new( + Client::default_url(), + Auth::CookieFile(bitcoin_dir.join(".cookie")), + )?; + + let reader = Reader::new(bitcoin_dir.join("blocks"), &client); + + let blocks = Blocks::new(&client, &reader); + + let fetcher = Fetcher::import(true, None)?; + + info!("Ping: {:?}", fetcher.brk.ping()?); + + let mut indexer = Indexer::forced_import(&outputs_dir)?; + + // Pre-run indexer if too far behind, then drop and reimport to reduce memory + let chain_height = client.get_last_height()?; + let indexed_height = indexer.vecs.starting_height(); + if chain_height.saturating_sub(*indexed_height) > 1000 { + indexer.index(&blocks, &client, &exit)?; + drop(indexer); + Mimalloc::collect(); + indexer = Indexer::forced_import(&outputs_dir)?; + } + + let mut computer = Computer::forced_import(&outputs_dir, &indexer, Some(fetcher))?; + loop { let i = Instant::now(); let starting_indexes = indexer.index(&blocks, &client, &exit)?; diff --git a/crates/brk_computer/src/stateful/compute/mod.rs b/crates/brk_computer/src/stateful/compute/mod.rs index a2bba0faa..5c7f39a2c 100644 --- a/crates/brk_computer/src/stateful/compute/mod.rs +++ b/crates/brk_computer/src/stateful/compute/mod.rs @@ -14,7 +14,7 @@ pub use readers::{ pub use recover::{StartMode, determine_start_mode, recover_state, reset_state}; /// Flush checkpoint interval (every N blocks). -pub const FLUSH_INTERVAL: usize = 10_000; +pub const FLUSH_INTERVAL: usize = 20_000; // BIP30 duplicate coinbase heights (special case handling) pub const BIP30_DUPLICATE_HEIGHT_1: u32 = 91_842; diff --git a/crates/brk_computer/src/txins.rs b/crates/brk_computer/src/txins.rs index de3627baf..7f0f3a796 100644 --- a/crates/brk_computer/src/txins.rs +++ b/crates/brk_computer/src/txins.rs @@ -12,7 +12,7 @@ use vecdb::{ use super::Indexes; -const BATCH_SIZE: usize = 2 * 1024 * 1024 * 1024 / size_of::(); +const BATCH_SIZE: usize = 3 * 1024 * 1024 * 1024 / size_of::(); pub const DB_NAME: &str = "txins"; #[derive(Clone, Traversable)] diff --git a/crates/brk_computer/src/txouts.rs b/crates/brk_computer/src/txouts.rs index e7e9455db..5f7becbf8 100644 --- a/crates/brk_computer/src/txouts.rs +++ b/crates/brk_computer/src/txouts.rs @@ -101,7 +101,7 @@ impl Vecs { starting_indexes.height ); - const HEIGHT_BATCH: u32 = 10_000; + const HEIGHT_BATCH: u32 = 20_000; let mut pairs: Vec<(TxOutIndex, TxInIndex)> = Vec::new(); let mut batch_start_height = min_height; diff --git a/modules/brk-client/.gitignore b/modules/brk-client/.gitignore index 435c24fa8..86d4c2dd3 100644 --- a/modules/brk-client/.gitignore +++ b/modules/brk-client/.gitignore @@ -1,2 +1 @@ generated -index.js diff --git a/modules/brk-client/index.js b/modules/brk-client/index.js new file mode 100644 index 000000000..93d74d011 --- /dev/null +++ b/modules/brk-client/index.js @@ -0,0 +1,5073 @@ +// Auto-generated BRK JavaScript client +// Do not edit manually + +// Constants + +export const VERSION = "v0.1.0-alpha.1"; + +export const INDEXES = /** @type {const} */ ([ + "dateindex", + "decadeindex", + "difficultyepoch", + "emptyoutputindex", + "halvingepoch", + "height", + "txinindex", + "monthindex", + "opreturnindex", + "txoutindex", + "p2aaddressindex", + "p2msoutputindex", + "p2pk33addressindex", + "p2pk65addressindex", + "p2pkhaddressindex", + "p2shaddressindex", + "p2traddressindex", + "p2wpkhaddressindex", + "p2wshaddressindex", + "quarterindex", + "semesterindex", + "txindex", + "unknownoutputindex", + "weekindex", + "yearindex", + "loadedaddressindex", + "emptyaddressindex", +]); + +export const POOL_ID_TO_POOL_NAME = /** @type {const} */ ({ + pool175btc: "175btc", + onehash: "1Hash", + onem1x: "1M1X", + onethash: "1THash", + twentyoneinc: "21 Inc.", + pool50btc: "50BTC", + fiftyeightcoin: "58COIN", + sevenpool: "7pool", + eightbaochi: "8baochi", + axbt: "A-XBT", + aaopool: "AAO Pool", + antpool: "AntPool", + arkpool: "ArkPool", + asicminer: "ASICMiner", + batpool: "BATPOOL", + bcmonster: "BCMonster", + bcpoolio: "bcpool.io", + binancepool: "Binance Pool", + bitalo: "Bitalo", + bitclub: "BitClub", + bitcoinaffiliatenetwork: "Bitcoin Affiliate Network", + bitcoinindia: "Bitcoin India", + bitcoinukraine: "Bitcoin-Ukraine", + bitcoincom: "Bitcoin.com", + bitcoinrussia: "BitcoinRussia", + bitfarms: "Bitfarms", + bitfufupool: "BitFuFuPool", + bitfury: "BitFury", + bitminter: "BitMinter", + bitparking: "Bitparking", + bitsolo: "Bitsolo", + bixin: "Bixin", + blockfills: "BlockFills", + braiinspool: "Braiins Pool", + bravomining: "Bravo Mining", + btcguild: "BTC Guild", + btcnuggets: "BTC Nuggets", + btcpoolparty: "BTC Pool Party", + btccom: "BTC.com", + btctop: "BTC.TOP", + btcc: "BTCC", + btcdig: "BTCDig", + btclab: "BTCLab", + btcmp: "BTCMP", + btcserv: "BTCServ", + btpool: "BTPOOL", + bwpool: "BWPool", + bytepool: "BytePool", + canoe: "CANOE", + canoepool: "CanoePool", + carbonnegative: "Carbon Negative", + ckpool: "CKPool", + cloudhashing: "CloudHashing", + coinlab: "CoinLab", + cointerra: "Cointerra", + connectbtc: "ConnectBTC", + dcex: "DCEX", + dcexploration: "DCExploration", + digitalbtc: "digitalBTC", + digitalxmintsy: "digitalX Mintsy", + dpool: "DPOOL", + eclipsemc: "EclipseMC", + ekanembtc: "EkanemBTC", + eligius: "Eligius", + emcdpool: "EMCDPool", + entrustcharitypool: "Entrust Charity Pool", + eobot: "Eobot", + exxbw: "EXX&BW", + f2pool: "F2Pool", + foundryusa: "Foundry USA", + futurebitapollosolo: "FutureBit Apollo Solo", + gbminers: "GBMiners", + ghashio: "GHash.IO", + givemecoins: "Give Me Coins", + gogreenlight: "GoGreenLight", + haominer: "haominer", + haozhuzhu: "HAOZHUZHU", + hashbx: "HashBX", + hashpool: "HASHPOOL", + helix: "Helix", + hhtt: "HHTT", + hotpool: "HotPool", + hummerpool: "Hummerpool", + huobipool: "Huobi.pool", + innopolistech: "Innopolis Tech", + kanopool: "KanoPool", + kncminer: "KnCMiner", + kucoinpool: "KuCoinPool", + lubiancom: "Lubian.com", + luckypool: "luckyPool", + luxor: "Luxor", + marapool: "MARA Pool", + maxbtc: "MaxBTC", + maxipool: "MaxiPool", + megabigpower: "MegaBigPower", + minerium: "Minerium", + miningsquared: "Mining Squared", + miningdutch: "Mining-Dutch", + miningcity: "MiningCity", + miningkings: "MiningKings", + mmpool: "mmpool", + mtred: "Mt Red", + multicoinco: "MultiCoin.co", + multipool: "Multipool", + mybtccoinpool: "myBTCcoin Pool", + neopool: "Neopool", + nexious: "Nexious", + nicehash: "NiceHash", + nmcbit: "NMCbit", + novablock: "NovaBlock", + ocean: "OCEAN", + okexpool: "OKExPool", + okkong: "OKKONG", + okminer: "OKMINER", + okpooltop: "okpool.top", + ozcoin: "OzCoin", + parasite: "Parasite", + patels: "Patels", + pegapool: "PEGA Pool", + phashio: "PHash.IO", + phoenix: "Phoenix", + polmine: "Polmine", + poolin: "Poolin", + portlandhodl: "Portland.HODL", + publicpool: "Public Pool", + purebtccom: "PureBTC.COM", + rawpool: "Rawpool", + rigpool: "RigPool", + sbicrypto: "SBI Crypto", + secpool: "SECPOOL", + secretsuperstar: "SecretSuperstar", + shawnp0wers: "shawnp0wers", + sigmapoolcom: "Sigmapool.com", + simplecoinus: "simplecoin.us", + solock: "Solo CK", + spiderpool: "SpiderPool", + stminingcorp: "ST Mining Corp", + tangpool: "Tangpool", + tatmaspool: "TATMAS Pool", + tbdice: "TBDice", + telco214: "Telco 214", + terrapool: "Terra Pool", + tiger: "tiger", + tigerpoolnet: "tigerpool.net", + titan: "Titan", + transactioncoinmining: "transactioncoinmining", + trickysbtcpool: "Tricky's BTC Pool", + triplemining: "TripleMining", + ultimuspool: "ULTIMUSPOOL", + unknown: "Unknown", + unomp: "UNOMP", + viabtc: "ViaBTC", + waterhole: "Waterhole", + wayicn: "WAYI.CN", + whitepool: "WhitePool", + wk057: "wk057", + yourbtcnet: "Yourbtc.net", + zulupool: "Zulupool", +}); + +// Type definitions + +/** @typedef {string} Address */ +/** + * @typedef {Object} AddressChainStats + * @property {number} funded_txo_count + * @property {Sats} funded_txo_sum + * @property {number} spent_txo_count + * @property {Sats} spent_txo_sum + * @property {number} tx_count + * @property {TypeIndex} type_index + */ +/** + * @typedef {Object} AddressMempoolStats + * @property {number} funded_txo_count + * @property {Sats} funded_txo_sum + * @property {number} spent_txo_count + * @property {Sats} spent_txo_sum + * @property {number} tx_count + */ +/** + * @typedef {Object} AddressParam + * @property {Address} address + */ +/** + * @typedef {Object} AddressStats + * @property {Address} address + * @property {AddressChainStats} chain_stats + * @property {(AddressMempoolStats|null)=} mempool_stats + */ +/** + * @typedef {Object} AddressTxidsParam + * @property {(Txid|null)=} after_txid + * @property {number=} limit + */ +/** + * @typedef {Object} AddressValidation + * @property {boolean} isvalid + * @property {?string=} address + * @property {?string=} scriptPubKey + * @property {?boolean=} isscript + * @property {?boolean=} iswitness + * @property {?number=} witness_version + * @property {?string=} witness_program + */ +/** @typedef {TypeIndex} AnyAddressIndex */ +/** @typedef {number} Bitcoin */ +/** @typedef {number} BlkPosition */ +/** + * @typedef {Object} BlockCountParam + * @property {number} block_count + */ +/** + * @typedef {Object} BlockFeesEntry + * @property {Height} avgHeight + * @property {Timestamp} timestamp + * @property {Sats} avgFees + */ +/** @typedef {string} BlockHash */ +/** + * @typedef {Object} BlockHashParam + * @property {BlockHash} hash + */ +/** + * @typedef {Object} BlockHashStartIndex + * @property {BlockHash} hash + * @property {TxIndex} start_index + */ +/** + * @typedef {Object} BlockHashTxIndex + * @property {BlockHash} hash + * @property {TxIndex} index + */ +/** + * @typedef {Object} BlockInfo + * @property {BlockHash} id + * @property {Height} height + * @property {number} tx_count + * @property {number} size + * @property {Weight} weight + * @property {Timestamp} timestamp + * @property {number} difficulty + */ +/** + * @typedef {Object} BlockRewardsEntry + * @property {number} avgHeight + * @property {number} timestamp + * @property {number} avgRewards + */ +/** + * @typedef {Object} BlockSizeEntry + * @property {number} avgHeight + * @property {number} timestamp + * @property {number} avgSize + */ +/** + * @typedef {Object} BlockSizesWeights + * @property {BlockSizeEntry[]} sizes + * @property {BlockWeightEntry[]} weights + */ +/** + * @typedef {Object} BlockStatus + * @property {boolean} in_best_chain + * @property {(Height|null)=} height + * @property {(BlockHash|null)=} next_best + */ +/** + * @typedef {Object} BlockTimestamp + * @property {Height} height + * @property {BlockHash} hash + * @property {string} timestamp + */ +/** + * @typedef {Object} BlockWeightEntry + * @property {number} avgHeight + * @property {number} timestamp + * @property {number} avgWeight + */ +/** @typedef {number} Cents */ +/** @typedef {Cents} Close */ +/** + * @typedef {Object} DataRangeFormat + * @property {?number=} from + * @property {?number=} to + * @property {?number=} count + * @property {Format=} format + */ +/** @typedef {number} Date */ +/** @typedef {number} DateIndex */ +/** @typedef {number} DecadeIndex */ +/** + * @typedef {Object} DifficultyAdjustment + * @property {number} progressPercent + * @property {number} difficultyChange + * @property {number} estimatedRetargetDate + * @property {number} remainingBlocks + * @property {number} remainingTime + * @property {number} previousRetarget + * @property {Height} nextRetargetHeight + * @property {number} timeAvg + * @property {number} adjustedTimeAvg + * @property {number} timeOffset + */ +/** + * @typedef {Object} DifficultyAdjustmentEntry + * @property {Timestamp} timestamp + * @property {Height} height + * @property {number} difficulty + * @property {number} change_percent + */ +/** + * @typedef {Object} DifficultyEntry + * @property {Timestamp} timestamp + * @property {number} difficulty + * @property {Height} height + */ +/** @typedef {number} DifficultyEpoch */ +/** @typedef {number} Dollars */ +/** + * @typedef {Object} EmptyAddressData + * @property {number} tx_count + * @property {number} funded_txo_count + * @property {Sats} transfered + */ +/** @typedef {TypeIndex} EmptyAddressIndex */ +/** @typedef {TypeIndex} EmptyOutputIndex */ +/** @typedef {number} FeeRate */ +/** @typedef {("json"|"csv")} Format */ +/** @typedef {number} HalvingEpoch */ +/** + * @typedef {Object} HashrateEntry + * @property {Timestamp} timestamp + * @property {number} avgHashrate + */ +/** + * @typedef {Object} HashrateSummary + * @property {HashrateEntry[]} hashrates + * @property {DifficultyEntry[]} difficulty + * @property {number} currentHashrate + * @property {number} currentDifficulty + */ +/** + * @typedef {Object} Health + * @property {string} status + * @property {string} service + * @property {string} timestamp + */ +/** @typedef {number} Height */ +/** + * @typedef {Object} HeightParam + * @property {Height} height + */ +/** @typedef {string} Hex */ +/** @typedef {Cents} High */ +/** @typedef {("dateindex"|"decadeindex"|"difficultyepoch"|"emptyoutputindex"|"halvingepoch"|"height"|"txinindex"|"monthindex"|"opreturnindex"|"txoutindex"|"p2aaddressindex"|"p2msoutputindex"|"p2pk33addressindex"|"p2pk65addressindex"|"p2pkhaddressindex"|"p2shaddressindex"|"p2traddressindex"|"p2wpkhaddressindex"|"p2wshaddressindex"|"quarterindex"|"semesterindex"|"txindex"|"unknownoutputindex"|"weekindex"|"yearindex"|"loadedaddressindex"|"emptyaddressindex")} Index */ +/** + * @typedef {Object} IndexInfo + * @property {Index} index + * @property {string[]} aliases + */ +/** @typedef {number} Limit */ +/** + * @typedef {Object} LimitParam + * @property {Limit=} limit + */ +/** + * @typedef {Object} LoadedAddressData + * @property {number} tx_count + * @property {number} funded_txo_count + * @property {number} spent_txo_count + * @property {Sats} received + * @property {Sats} sent + * @property {Dollars} realized_cap + */ +/** @typedef {TypeIndex} LoadedAddressIndex */ +/** @typedef {Cents} Low */ +/** + * @typedef {Object} MempoolBlock + * @property {number} blockSize + * @property {number} blockVSize + * @property {number} nTx + * @property {Sats} totalFees + * @property {FeeRate} medianFee + * @property {FeeRate[]} feeRange + */ +/** + * @typedef {Object} MempoolInfo + * @property {number} count + * @property {VSize} vsize + * @property {Sats} total_fee + */ +/** @typedef {string} Metric */ +/** + * @typedef {Object} MetricCount + * @property {number} distinct_metrics + * @property {number} total_endpoints + * @property {number} lazy_endpoints + * @property {number} stored_endpoints + */ +/** + * @typedef {Object} MetricData + * @property {number} total + * @property {number} from + * @property {number} to + * @property {*[]} data + */ +/** + * @typedef {Object} MetricLeafWithSchema + * @property {string} name + * @property {string} value_type + * @property {Index[]} indexes + */ +/** + * @typedef {Object} MetricParam + * @property {Metric} metric + */ +/** + * @typedef {Object} MetricSelection + * @property {Metrics} metrics + * @property {Index} index + * @property {?number=} from + * @property {?number=} to + * @property {?number=} count + * @property {Format=} format + */ +/** + * @typedef {Object} MetricSelectionLegacy + * @property {Index} index + * @property {Metrics} ids + * @property {?number=} from + * @property {?number=} to + * @property {?number=} count + * @property {Format=} format + */ +/** + * @typedef {Object} MetricWithIndex + * @property {Metric} metric + * @property {Index} index + */ +/** @typedef {string} Metrics */ +/** @typedef {number} MonthIndex */ +/** + * @typedef {Object} OHLCCents + * @property {Open} open + * @property {High} high + * @property {Low} low + * @property {Close} close + */ +/** + * @typedef {Object} OHLCDollars + * @property {Open} open + * @property {High} high + * @property {Low} low + * @property {Close} close + */ +/** + * @typedef {Object} OHLCSats + * @property {Open} open + * @property {High} high + * @property {Low} low + * @property {Close} close + */ +/** @typedef {TypeIndex} OpReturnIndex */ +/** @typedef {Cents} Open */ +/** @typedef {number} OutPoint */ +/** @typedef {("p2pk65"|"p2pk33"|"p2pkh"|"p2ms"|"p2sh"|"opreturn"|"p2wpkh"|"p2wsh"|"p2tr"|"p2a"|"empty"|"unknown")} OutputType */ +/** @typedef {TypeIndex} P2AAddressIndex */ +/** @typedef {U8x2} P2ABytes */ +/** @typedef {TypeIndex} P2MSOutputIndex */ +/** @typedef {TypeIndex} P2PK33AddressIndex */ +/** @typedef {U8x33} P2PK33Bytes */ +/** @typedef {TypeIndex} P2PK65AddressIndex */ +/** @typedef {U8x65} P2PK65Bytes */ +/** @typedef {TypeIndex} P2PKHAddressIndex */ +/** @typedef {U8x20} P2PKHBytes */ +/** @typedef {TypeIndex} P2SHAddressIndex */ +/** @typedef {U8x20} P2SHBytes */ +/** @typedef {TypeIndex} P2TRAddressIndex */ +/** @typedef {U8x32} P2TRBytes */ +/** @typedef {TypeIndex} P2WPKHAddressIndex */ +/** @typedef {U8x20} P2WPKHBytes */ +/** @typedef {TypeIndex} P2WSHAddressIndex */ +/** @typedef {U8x32} P2WSHBytes */ +/** + * @typedef {Object} PaginatedMetrics + * @property {number} current_page + * @property {number} max_page + * @property {string[]} metrics + */ +/** + * @typedef {Object} Pagination + * @property {?number=} page + */ +/** + * @typedef {Object} PoolBlockCounts + * @property {number} all + * @property {number} 24h + * @property {number} 1w + */ +/** + * @typedef {Object} PoolBlockShares + * @property {number} all + * @property {number} 24h + * @property {number} 1w + */ +/** + * @typedef {Object} PoolDetail + * @property {PoolDetailInfo} pool + * @property {PoolBlockCounts} blockCount + * @property {PoolBlockShares} blockShare + * @property {number} estimatedHashrate + * @property {?number=} reportedHashrate + */ +/** + * @typedef {Object} PoolDetailInfo + * @property {number} id + * @property {string} name + * @property {string} link + * @property {string[]} addresses + * @property {string[]} regexes + * @property {PoolSlug} slug + */ +/** + * @typedef {Object} PoolInfo + * @property {string} name + * @property {PoolSlug} slug + * @property {number} unique_id + */ +/** @typedef {("unknown"|"blockfills"|"ultimuspool"|"terrapool"|"luxor"|"onethash"|"btccom"|"bitfarms"|"huobipool"|"wayicn"|"canoepool"|"btctop"|"bitcoincom"|"pool175btc"|"gbminers"|"axbt"|"asicminer"|"bitminter"|"bitcoinrussia"|"btcserv"|"simplecoinus"|"btcguild"|"eligius"|"ozcoin"|"eclipsemc"|"maxbtc"|"triplemining"|"coinlab"|"pool50btc"|"ghashio"|"stminingcorp"|"bitparking"|"mmpool"|"polmine"|"kncminer"|"bitalo"|"f2pool"|"hhtt"|"megabigpower"|"mtred"|"nmcbit"|"yourbtcnet"|"givemecoins"|"braiinspool"|"antpool"|"multicoinco"|"bcpoolio"|"cointerra"|"kanopool"|"solock"|"ckpool"|"nicehash"|"bitclub"|"bitcoinaffiliatenetwork"|"btcc"|"bwpool"|"exxbw"|"bitsolo"|"bitfury"|"twentyoneinc"|"digitalbtc"|"eightbaochi"|"mybtccoinpool"|"tbdice"|"hashpool"|"nexious"|"bravomining"|"hotpool"|"okexpool"|"bcmonster"|"onehash"|"bixin"|"tatmaspool"|"viabtc"|"connectbtc"|"batpool"|"waterhole"|"dcexploration"|"dcex"|"btpool"|"fiftyeightcoin"|"bitcoinindia"|"shawnp0wers"|"phashio"|"rigpool"|"haozhuzhu"|"sevenpool"|"miningkings"|"hashbx"|"dpool"|"rawpool"|"haominer"|"helix"|"bitcoinukraine"|"poolin"|"secretsuperstar"|"tigerpoolnet"|"sigmapoolcom"|"okpooltop"|"hummerpool"|"tangpool"|"bytepool"|"spiderpool"|"novablock"|"miningcity"|"binancepool"|"minerium"|"lubiancom"|"okkong"|"aaopool"|"emcdpool"|"foundryusa"|"sbicrypto"|"arkpool"|"purebtccom"|"marapool"|"kucoinpool"|"entrustcharitypool"|"okminer"|"titan"|"pegapool"|"btcnuggets"|"cloudhashing"|"digitalxmintsy"|"telco214"|"btcpoolparty"|"multipool"|"transactioncoinmining"|"btcdig"|"trickysbtcpool"|"btcmp"|"eobot"|"unomp"|"patels"|"gogreenlight"|"ekanembtc"|"canoe"|"tiger"|"onem1x"|"zulupool"|"secpool"|"ocean"|"whitepool"|"wk057"|"futurebitapollosolo"|"carbonnegative"|"portlandhodl"|"phoenix"|"neopool"|"maxipool"|"bitfufupool"|"luckypool"|"miningdutch"|"publicpool"|"miningsquared"|"innopolistech"|"btclab"|"parasite")} PoolSlug */ +/** + * @typedef {Object} PoolSlugParam + * @property {PoolSlug} slug + */ +/** + * @typedef {Object} PoolStats + * @property {number} poolId + * @property {string} name + * @property {string} link + * @property {number} blockCount + * @property {number} rank + * @property {number} emptyBlocks + * @property {PoolSlug} slug + * @property {number} share + */ +/** + * @typedef {Object} PoolsSummary + * @property {PoolStats[]} pools + * @property {number} blockCount + * @property {number} lastEstimatedHashrate + */ +/** @typedef {number} QuarterIndex */ +/** @typedef {number} RawLockTime */ +/** + * @typedef {Object} RecommendedFees + * @property {FeeRate} fastestFee + * @property {FeeRate} halfHourFee + * @property {FeeRate} hourFee + * @property {FeeRate} economyFee + * @property {FeeRate} minimumFee + */ +/** + * @typedef {Object} RewardStats + * @property {Height} startBlock + * @property {Height} endBlock + * @property {Sats} totalReward + * @property {Sats} totalFee + * @property {number} totalTx + */ +/** @typedef {number} Sats */ +/** @typedef {number} SemesterIndex */ +/** @typedef {number} StoredBool */ +/** @typedef {number} StoredF32 */ +/** @typedef {number} StoredF64 */ +/** @typedef {number} StoredI16 */ +/** @typedef {number} StoredU16 */ +/** @typedef {number} StoredU32 */ +/** @typedef {number} StoredU64 */ +/** + * @typedef {Object} SupplyState + * @property {number} utxo_count + * @property {Sats} value + */ +/** @typedef {("24h"|"3d"|"1w"|"1m"|"3m"|"6m"|"1y"|"2y"|"3y")} TimePeriod */ +/** + * @typedef {Object} TimePeriodParam + * @property {TimePeriod} time_period + */ +/** @typedef {number} Timestamp */ +/** + * @typedef {Object} TimestampParam + * @property {Timestamp} timestamp + */ +/** + * @typedef {Object} Transaction + * @property {(TxIndex|null)=} index + * @property {Txid} txid + * @property {TxVersion} version + * @property {RawLockTime} locktime + * @property {number} size + * @property {Weight} weight + * @property {number} sigops + * @property {Sats} fee + * @property {TxIn[]} vin + * @property {TxOut[]} vout + * @property {TxStatus} status + */ +/** @typedef {({ [key: string]: TreeNode }|MetricLeafWithSchema)} TreeNode */ +/** + * @typedef {Object} TxIn + * @property {Txid} txid + * @property {Vout} vout + * @property {(TxOut|null)=} prevout + * @property {string} scriptsig + * @property {string} scriptsig_asm + * @property {boolean} is_coinbase + * @property {number} sequence + * @property {?string=} inner_redeemscript_asm + */ +/** @typedef {number} TxInIndex */ +/** @typedef {number} TxIndex */ +/** + * @typedef {Object} TxOut + * @property {string} scriptpubkey + * @property {Sats} value + */ +/** @typedef {number} TxOutIndex */ +/** + * @typedef {Object} TxOutspend + * @property {boolean} spent + * @property {(Txid|null)=} txid + * @property {(Vin|null)=} vin + * @property {(TxStatus|null)=} status + */ +/** + * @typedef {Object} TxStatus + * @property {boolean} confirmed + * @property {(Height|null)=} block_height + * @property {(BlockHash|null)=} block_hash + * @property {(Timestamp|null)=} block_time + */ +/** @typedef {number} TxVersion */ +/** @typedef {string} Txid */ +/** + * @typedef {Object} TxidParam + * @property {Txid} txid + */ +/** + * @typedef {Object} TxidVout + * @property {Txid} txid + * @property {Vout} vout + */ +/** @typedef {number} TypeIndex */ +/** @typedef {number[]} U8x2 */ +/** @typedef {number[]} U8x20 */ +/** @typedef {number[]} U8x32 */ +/** @typedef {string} U8x33 */ +/** @typedef {string} U8x65 */ +/** @typedef {TypeIndex} UnknownOutputIndex */ +/** + * @typedef {Object} Utxo + * @property {Txid} txid + * @property {Vout} vout + * @property {TxStatus} status + * @property {Sats} value + */ +/** @typedef {number} VSize */ +/** + * @typedef {Object} ValidateAddressParam + * @property {string} address + */ +/** @typedef {number} Vin */ +/** @typedef {number} Vout */ +/** @typedef {number} WeekIndex */ +/** @typedef {number} Weight */ +/** @typedef {number} YearIndex */ + +/** + * @typedef {Object} BrkClientOptions + * @property {string} baseUrl - Base URL for the API + * @property {number} [timeout] - Request timeout in milliseconds + */ + +const _isBrowser = typeof window !== 'undefined' && 'caches' in window; +const _runIdle = (fn) => (globalThis.requestIdleCallback ?? setTimeout)(fn); + +/** @type {Promise} */ +const _cachePromise = _isBrowser + ? caches.open('__BRK_CLIENT__').catch(() => null) + : Promise.resolve(null); + +/** + * Custom error class for BRK client errors + */ +class BrkError extends Error { + /** + * @param {string} message + * @param {number} [status] + */ + constructor(message, status) { + super(message); + this.name = 'BrkError'; + this.status = status; + } +} + +/** + * A metric node that can fetch data for different indexes. + * @template T + */ +class MetricNode { + /** + * @param {BrkClientBase} client + * @param {string} path + */ + constructor(client, path) { + this._client = client; + this._path = path; + } + + /** + * Fetch all data points for this metric. + * @param {(value: T[]) => void} [onUpdate] - Called when data is available (may be called twice: cache then fresh) + * @returns {Promise} + */ + get(onUpdate) { + return this._client.get(this._path, onUpdate); + } + + /** + * Fetch data points within a range. + * @param {string | number} from + * @param {string | number} to + * @param {(value: T[]) => void} [onUpdate] - Called when data is available (may be called twice: cache then fresh) + * @returns {Promise} + */ + getRange(from, to, onUpdate) { + return this._client.get(`${this._path}?from=${from}&to=${to}`, onUpdate); + } +} + +/** + * Base HTTP client for making requests with caching support + */ +class BrkClientBase { + /** + * @param {BrkClientOptions|string} options + */ + constructor(options) { + const isString = typeof options === 'string'; + this.baseUrl = isString ? options : options.baseUrl; + this.timeout = isString ? 5000 : (options.timeout ?? 5000); + } + + /** + * Make a GET request with stale-while-revalidate caching + * @template T + * @param {string} path + * @param {(value: T) => void} [onUpdate] - Called when data is available + * @returns {Promise} + */ + async get(path, onUpdate) { + const url = `${this.baseUrl}${path}`; + const cache = await _cachePromise; + const cachedRes = await cache?.match(url); + const cachedJson = cachedRes ? await cachedRes.json() : null; + + if (cachedJson) onUpdate?.(cachedJson); + if (!globalThis.navigator?.onLine) { + if (cachedJson) return cachedJson; + throw new BrkError('Offline and no cached data available'); + } + + try { + const res = await fetch(url, { signal: AbortSignal.timeout(this.timeout) }); + if (!res.ok) throw new BrkError(`HTTP ${res.status}`, res.status); + if (cachedRes?.headers.get('ETag') === res.headers.get('ETag')) return cachedJson; + + const cloned = res.clone(); + const json = await res.json(); + onUpdate?.(json); + if (cache) _runIdle(() => cache.put(url, cloned)); + return json; + } catch (e) { + if (cachedJson) return cachedJson; + throw e; + } + } +} + + +// Index accessor factory functions + +/** + * @template T + * @typedef {Object} Indexes3 + * @property {MetricNode} byDateindex + * @property {MetricNode} byDecadeindex + * @property {MetricNode} byDifficultyepoch + * @property {MetricNode} byHeight + * @property {MetricNode} byMonthindex + * @property {MetricNode} byQuarterindex + * @property {MetricNode} bySemesterindex + * @property {MetricNode} byWeekindex + * @property {MetricNode} byYearindex + */ + +/** + * Create a Indexes3 accessor + * @template T + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {Indexes3} + */ +function createIndexes3(client, basePath) { + return { + byDateindex: new MetricNode(client, `${basePath}/dateindex`), + byDecadeindex: new MetricNode(client, `${basePath}/decadeindex`), + byDifficultyepoch: new MetricNode(client, `${basePath}/difficultyepoch`), + byHeight: new MetricNode(client, `${basePath}/height`), + byMonthindex: new MetricNode(client, `${basePath}/monthindex`), + byQuarterindex: new MetricNode(client, `${basePath}/quarterindex`), + bySemesterindex: new MetricNode(client, `${basePath}/semesterindex`), + byWeekindex: new MetricNode(client, `${basePath}/weekindex`), + byYearindex: new MetricNode(client, `${basePath}/yearindex`) + }; +} + +/** + * @template T + * @typedef {Object} Indexes4 + * @property {MetricNode} byDateindex + * @property {MetricNode} byDecadeindex + * @property {MetricNode} byDifficultyepoch + * @property {MetricNode} byMonthindex + * @property {MetricNode} byQuarterindex + * @property {MetricNode} bySemesterindex + * @property {MetricNode} byWeekindex + * @property {MetricNode} byYearindex + */ + +/** + * Create a Indexes4 accessor + * @template T + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {Indexes4} + */ +function createIndexes4(client, basePath) { + return { + byDateindex: new MetricNode(client, `${basePath}/dateindex`), + byDecadeindex: new MetricNode(client, `${basePath}/decadeindex`), + byDifficultyepoch: new MetricNode(client, `${basePath}/difficultyepoch`), + byMonthindex: new MetricNode(client, `${basePath}/monthindex`), + byQuarterindex: new MetricNode(client, `${basePath}/quarterindex`), + bySemesterindex: new MetricNode(client, `${basePath}/semesterindex`), + byWeekindex: new MetricNode(client, `${basePath}/weekindex`), + byYearindex: new MetricNode(client, `${basePath}/yearindex`) + }; +} + +/** + * @template T + * @typedef {Object} Indexes26 + * @property {MetricNode} byDateindex + * @property {MetricNode} byDecadeindex + * @property {MetricNode} byHeight + * @property {MetricNode} byMonthindex + * @property {MetricNode} byQuarterindex + * @property {MetricNode} bySemesterindex + * @property {MetricNode} byWeekindex + * @property {MetricNode} byYearindex + */ + +/** + * Create a Indexes26 accessor + * @template T + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {Indexes26} + */ +function createIndexes26(client, basePath) { + return { + byDateindex: new MetricNode(client, `${basePath}/dateindex`), + byDecadeindex: new MetricNode(client, `${basePath}/decadeindex`), + byHeight: new MetricNode(client, `${basePath}/height`), + byMonthindex: new MetricNode(client, `${basePath}/monthindex`), + byQuarterindex: new MetricNode(client, `${basePath}/quarterindex`), + bySemesterindex: new MetricNode(client, `${basePath}/semesterindex`), + byWeekindex: new MetricNode(client, `${basePath}/weekindex`), + byYearindex: new MetricNode(client, `${basePath}/yearindex`) + }; +} + +/** + * @template T + * @typedef {Object} Indexes + * @property {MetricNode} byDateindex + * @property {MetricNode} byDecadeindex + * @property {MetricNode} byMonthindex + * @property {MetricNode} byQuarterindex + * @property {MetricNode} bySemesterindex + * @property {MetricNode} byWeekindex + * @property {MetricNode} byYearindex + */ + +/** + * Create a Indexes accessor + * @template T + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {Indexes} + */ +function createIndexes(client, basePath) { + return { + byDateindex: new MetricNode(client, `${basePath}/dateindex`), + byDecadeindex: new MetricNode(client, `${basePath}/decadeindex`), + byMonthindex: new MetricNode(client, `${basePath}/monthindex`), + byQuarterindex: new MetricNode(client, `${basePath}/quarterindex`), + bySemesterindex: new MetricNode(client, `${basePath}/semesterindex`), + byWeekindex: new MetricNode(client, `${basePath}/weekindex`), + byYearindex: new MetricNode(client, `${basePath}/yearindex`) + }; +} + +/** + * @template T + * @typedef {Object} Indexes27 + * @property {MetricNode} byDecadeindex + * @property {MetricNode} byHeight + * @property {MetricNode} byMonthindex + * @property {MetricNode} byQuarterindex + * @property {MetricNode} bySemesterindex + * @property {MetricNode} byWeekindex + * @property {MetricNode} byYearindex + */ + +/** + * Create a Indexes27 accessor + * @template T + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {Indexes27} + */ +function createIndexes27(client, basePath) { + return { + byDecadeindex: new MetricNode(client, `${basePath}/decadeindex`), + byHeight: new MetricNode(client, `${basePath}/height`), + byMonthindex: new MetricNode(client, `${basePath}/monthindex`), + byQuarterindex: new MetricNode(client, `${basePath}/quarterindex`), + bySemesterindex: new MetricNode(client, `${basePath}/semesterindex`), + byWeekindex: new MetricNode(client, `${basePath}/weekindex`), + byYearindex: new MetricNode(client, `${basePath}/yearindex`) + }; +} + +/** + * @template T + * @typedef {Object} Indexes28 + * @property {MetricNode} byDecadeindex + * @property {MetricNode} byMonthindex + * @property {MetricNode} byQuarterindex + * @property {MetricNode} bySemesterindex + * @property {MetricNode} byWeekindex + * @property {MetricNode} byYearindex + */ + +/** + * Create a Indexes28 accessor + * @template T + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {Indexes28} + */ +function createIndexes28(client, basePath) { + return { + byDecadeindex: new MetricNode(client, `${basePath}/decadeindex`), + byMonthindex: new MetricNode(client, `${basePath}/monthindex`), + byQuarterindex: new MetricNode(client, `${basePath}/quarterindex`), + bySemesterindex: new MetricNode(client, `${basePath}/semesterindex`), + byWeekindex: new MetricNode(client, `${basePath}/weekindex`), + byYearindex: new MetricNode(client, `${basePath}/yearindex`) + }; +} + +/** + * @template T + * @typedef {Object} Indexes15 + * @property {MetricNode} byQuarterindex + * @property {MetricNode} bySemesterindex + * @property {MetricNode} byYearindex + */ + +/** + * Create a Indexes15 accessor + * @template T + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {Indexes15} + */ +function createIndexes15(client, basePath) { + return { + byQuarterindex: new MetricNode(client, `${basePath}/quarterindex`), + bySemesterindex: new MetricNode(client, `${basePath}/semesterindex`), + byYearindex: new MetricNode(client, `${basePath}/yearindex`) + }; +} + +/** + * @template T + * @typedef {Object} Indexes13 + * @property {MetricNode} byDateindex + * @property {MetricNode} byHeight + */ + +/** + * Create a Indexes13 accessor + * @template T + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {Indexes13} + */ +function createIndexes13(client, basePath) { + return { + byDateindex: new MetricNode(client, `${basePath}/dateindex`), + byHeight: new MetricNode(client, `${basePath}/height`) + }; +} + +/** + * @template T + * @typedef {Object} Indexes14 + * @property {MetricNode} byMonthindex + * @property {MetricNode} byWeekindex + */ + +/** + * Create a Indexes14 accessor + * @template T + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {Indexes14} + */ +function createIndexes14(client, basePath) { + return { + byMonthindex: new MetricNode(client, `${basePath}/monthindex`), + byWeekindex: new MetricNode(client, `${basePath}/weekindex`) + }; +} + +/** + * @template T + * @typedef {Object} Indexes2 + * @property {MetricNode} byHeight + */ + +/** + * Create a Indexes2 accessor + * @template T + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {Indexes2} + */ +function createIndexes2(client, basePath) { + return { + byHeight: new MetricNode(client, `${basePath}/height`) + }; +} + +/** + * @template T + * @typedef {Object} Indexes5 + * @property {MetricNode} byDateindex + */ + +/** + * Create a Indexes5 accessor + * @template T + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {Indexes5} + */ +function createIndexes5(client, basePath) { + return { + byDateindex: new MetricNode(client, `${basePath}/dateindex`) + }; +} + +/** + * @template T + * @typedef {Object} Indexes6 + * @property {MetricNode} byTxindex + */ + +/** + * Create a Indexes6 accessor + * @template T + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {Indexes6} + */ +function createIndexes6(client, basePath) { + return { + byTxindex: new MetricNode(client, `${basePath}/txindex`) + }; +} + +/** + * @template T + * @typedef {Object} Indexes7 + * @property {MetricNode} byDecadeindex + */ + +/** + * Create a Indexes7 accessor + * @template T + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {Indexes7} + */ +function createIndexes7(client, basePath) { + return { + byDecadeindex: new MetricNode(client, `${basePath}/decadeindex`) + }; +} + +/** + * @template T + * @typedef {Object} Indexes8 + * @property {MetricNode} byMonthindex + */ + +/** + * Create a Indexes8 accessor + * @template T + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {Indexes8} + */ +function createIndexes8(client, basePath) { + return { + byMonthindex: new MetricNode(client, `${basePath}/monthindex`) + }; +} + +/** + * @template T + * @typedef {Object} Indexes9 + * @property {MetricNode} byQuarterindex + */ + +/** + * Create a Indexes9 accessor + * @template T + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {Indexes9} + */ +function createIndexes9(client, basePath) { + return { + byQuarterindex: new MetricNode(client, `${basePath}/quarterindex`) + }; +} + +/** + * @template T + * @typedef {Object} Indexes10 + * @property {MetricNode} bySemesterindex + */ + +/** + * Create a Indexes10 accessor + * @template T + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {Indexes10} + */ +function createIndexes10(client, basePath) { + return { + bySemesterindex: new MetricNode(client, `${basePath}/semesterindex`) + }; +} + +/** + * @template T + * @typedef {Object} Indexes11 + * @property {MetricNode} byWeekindex + */ + +/** + * Create a Indexes11 accessor + * @template T + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {Indexes11} + */ +function createIndexes11(client, basePath) { + return { + byWeekindex: new MetricNode(client, `${basePath}/weekindex`) + }; +} + +/** + * @template T + * @typedef {Object} Indexes12 + * @property {MetricNode} byYearindex + */ + +/** + * Create a Indexes12 accessor + * @template T + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {Indexes12} + */ +function createIndexes12(client, basePath) { + return { + byYearindex: new MetricNode(client, `${basePath}/yearindex`) + }; +} + +/** + * @template T + * @typedef {Object} Indexes16 + * @property {MetricNode} byP2aaddressindex + */ + +/** + * Create a Indexes16 accessor + * @template T + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {Indexes16} + */ +function createIndexes16(client, basePath) { + return { + byP2aaddressindex: new MetricNode(client, `${basePath}/p2aaddressindex`) + }; +} + +/** + * @template T + * @typedef {Object} Indexes17 + * @property {MetricNode} byP2pk33addressindex + */ + +/** + * Create a Indexes17 accessor + * @template T + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {Indexes17} + */ +function createIndexes17(client, basePath) { + return { + byP2pk33addressindex: new MetricNode(client, `${basePath}/p2pk33addressindex`) + }; +} + +/** + * @template T + * @typedef {Object} Indexes18 + * @property {MetricNode} byP2pk65addressindex + */ + +/** + * Create a Indexes18 accessor + * @template T + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {Indexes18} + */ +function createIndexes18(client, basePath) { + return { + byP2pk65addressindex: new MetricNode(client, `${basePath}/p2pk65addressindex`) + }; +} + +/** + * @template T + * @typedef {Object} Indexes19 + * @property {MetricNode} byP2pkhaddressindex + */ + +/** + * Create a Indexes19 accessor + * @template T + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {Indexes19} + */ +function createIndexes19(client, basePath) { + return { + byP2pkhaddressindex: new MetricNode(client, `${basePath}/p2pkhaddressindex`) + }; +} + +/** + * @template T + * @typedef {Object} Indexes20 + * @property {MetricNode} byP2shaddressindex + */ + +/** + * Create a Indexes20 accessor + * @template T + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {Indexes20} + */ +function createIndexes20(client, basePath) { + return { + byP2shaddressindex: new MetricNode(client, `${basePath}/p2shaddressindex`) + }; +} + +/** + * @template T + * @typedef {Object} Indexes21 + * @property {MetricNode} byP2traddressindex + */ + +/** + * Create a Indexes21 accessor + * @template T + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {Indexes21} + */ +function createIndexes21(client, basePath) { + return { + byP2traddressindex: new MetricNode(client, `${basePath}/p2traddressindex`) + }; +} + +/** + * @template T + * @typedef {Object} Indexes22 + * @property {MetricNode} byP2wpkhaddressindex + */ + +/** + * Create a Indexes22 accessor + * @template T + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {Indexes22} + */ +function createIndexes22(client, basePath) { + return { + byP2wpkhaddressindex: new MetricNode(client, `${basePath}/p2wpkhaddressindex`) + }; +} + +/** + * @template T + * @typedef {Object} Indexes23 + * @property {MetricNode} byP2wshaddressindex + */ + +/** + * Create a Indexes23 accessor + * @template T + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {Indexes23} + */ +function createIndexes23(client, basePath) { + return { + byP2wshaddressindex: new MetricNode(client, `${basePath}/p2wshaddressindex`) + }; +} + +/** + * @template T + * @typedef {Object} Indexes24 + * @property {MetricNode} byTxinindex + */ + +/** + * Create a Indexes24 accessor + * @template T + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {Indexes24} + */ +function createIndexes24(client, basePath) { + return { + byTxinindex: new MetricNode(client, `${basePath}/txinindex`) + }; +} + +/** + * @template T + * @typedef {Object} Indexes25 + * @property {MetricNode} byTxoutindex + */ + +/** + * Create a Indexes25 accessor + * @template T + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {Indexes25} + */ +function createIndexes25(client, basePath) { + return { + byTxoutindex: new MetricNode(client, `${basePath}/txoutindex`) + }; +} + +/** + * @template T + * @typedef {Object} Indexes29 + * @property {MetricNode} byEmptyaddressindex + */ + +/** + * Create a Indexes29 accessor + * @template T + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {Indexes29} + */ +function createIndexes29(client, basePath) { + return { + byEmptyaddressindex: new MetricNode(client, `${basePath}/emptyaddressindex`) + }; +} + +/** + * @template T + * @typedef {Object} Indexes30 + * @property {MetricNode} byLoadedaddressindex + */ + +/** + * Create a Indexes30 accessor + * @template T + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {Indexes30} + */ +function createIndexes30(client, basePath) { + return { + byLoadedaddressindex: new MetricNode(client, `${basePath}/loadedaddressindex`) + }; +} + +// Reusable structural pattern factories + +/** + * @typedef {Object} RealizedPattern3 + * @property {Indexes5} adjustedSopr + * @property {Indexes5} adjustedSopr30dEma + * @property {Indexes5} adjustedSopr7dEma + * @property {Indexes3} adjustedValueCreated + * @property {Indexes3} adjustedValueDestroyed + * @property {BlockCountPattern} negRealizedLoss + * @property {BlockCountPattern} netRealizedPnl + * @property {Indexes} netRealizedPnlCumulative30dDelta + * @property {Indexes} netRealizedPnlCumulative30dDeltaRelToMarketCap + * @property {Indexes} netRealizedPnlCumulative30dDeltaRelToRealizedCap + * @property {Indexes2} netRealizedPnlRelToRealizedCap + * @property {Indexes3} realizedCap + * @property {Indexes} realizedCap30dDelta + * @property {Indexes3} realizedCapRelToOwnMarketCap + * @property {BlockCountPattern} realizedLoss + * @property {Indexes2} realizedLossRelToRealizedCap + * @property {Indexes3} realizedPrice + * @property {ActivePriceRatioPattern} realizedPriceExtra + * @property {BlockCountPattern} realizedProfit + * @property {Indexes2} realizedProfitRelToRealizedCap + * @property {Indexes5} realizedProfitToLossRatio + * @property {Indexes3} realizedValue + * @property {Indexes5} sellSideRiskRatio + * @property {Indexes5} sellSideRiskRatio30dEma + * @property {Indexes5} sellSideRiskRatio7dEma + * @property {Indexes5} sopr + * @property {Indexes5} sopr30dEma + * @property {Indexes5} sopr7dEma + * @property {BitcoinPattern2} totalRealizedPnl + * @property {Indexes3} valueCreated + * @property {Indexes3} valueDestroyed + */ + +/** + * Create a RealizedPattern3 pattern node + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {RealizedPattern3} + */ +function createRealizedPattern3(client, basePath) { + return { + adjustedSopr: createIndexes5(client, `${basePath}/adjusted_sopr`), + adjustedSopr30dEma: createIndexes5(client, `${basePath}/adjusted_sopr_30d_ema`), + adjustedSopr7dEma: createIndexes5(client, `${basePath}/adjusted_sopr_7d_ema`), + adjustedValueCreated: createIndexes3(client, `${basePath}/adjusted_value_created`), + adjustedValueDestroyed: createIndexes3(client, `${basePath}/adjusted_value_destroyed`), + negRealizedLoss: createBlockCountPattern(client, `${basePath}/neg_realized_loss`), + netRealizedPnl: createBlockCountPattern(client, `${basePath}/net_realized_pnl`), + netRealizedPnlCumulative30dDelta: createIndexes(client, `${basePath}/net_realized_pnl_cumulative_30d_delta`), + netRealizedPnlCumulative30dDeltaRelToMarketCap: createIndexes(client, `${basePath}/net_realized_pnl_cumulative_30d_delta_rel_to_market_cap`), + netRealizedPnlCumulative30dDeltaRelToRealizedCap: createIndexes(client, `${basePath}/net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap`), + netRealizedPnlRelToRealizedCap: createIndexes2(client, `${basePath}/net_realized_pnl_rel_to_realized_cap`), + realizedCap: createIndexes3(client, `${basePath}/realized_cap`), + realizedCap30dDelta: createIndexes(client, `${basePath}/realized_cap_30d_delta`), + realizedCapRelToOwnMarketCap: createIndexes3(client, `${basePath}/realized_cap_rel_to_own_market_cap`), + realizedLoss: createBlockCountPattern(client, `${basePath}/realized_loss`), + realizedLossRelToRealizedCap: createIndexes2(client, `${basePath}/realized_loss_rel_to_realized_cap`), + realizedPrice: createIndexes3(client, `${basePath}/realized_price`), + realizedPriceExtra: createActivePriceRatioPattern(client, `${basePath}/realized_price_extra`), + realizedProfit: createBlockCountPattern(client, `${basePath}/realized_profit`), + realizedProfitRelToRealizedCap: createIndexes2(client, `${basePath}/realized_profit_rel_to_realized_cap`), + realizedProfitToLossRatio: createIndexes5(client, `${basePath}/realized_profit_to_loss_ratio`), + realizedValue: createIndexes3(client, `${basePath}/realized_value`), + sellSideRiskRatio: createIndexes5(client, `${basePath}/sell_side_risk_ratio`), + sellSideRiskRatio30dEma: createIndexes5(client, `${basePath}/sell_side_risk_ratio_30d_ema`), + sellSideRiskRatio7dEma: createIndexes5(client, `${basePath}/sell_side_risk_ratio_7d_ema`), + sopr: createIndexes5(client, `${basePath}/sopr`), + sopr30dEma: createIndexes5(client, `${basePath}/sopr_30d_ema`), + sopr7dEma: createIndexes5(client, `${basePath}/sopr_7d_ema`), + totalRealizedPnl: createBitcoinPattern2(client, `${basePath}/total_realized_pnl`), + valueCreated: createIndexes3(client, `${basePath}/value_created`), + valueDestroyed: createIndexes3(client, `${basePath}/value_destroyed`) + }; +} + +/** + * @typedef {Object} Ratio1ySdPattern2 + * @property {Indexes} _0sdUsd + * @property {Indexes} m05sd + * @property {Indexes} m05sdUsd + * @property {Indexes} m15sd + * @property {Indexes} m15sdUsd + * @property {Indexes} m1sd + * @property {Indexes} m1sdUsd + * @property {Indexes} m25sd + * @property {Indexes} m25sdUsd + * @property {Indexes} m2sd + * @property {Indexes} m2sdUsd + * @property {Indexes} m3sd + * @property {Indexes} m3sdUsd + * @property {Indexes} p05sd + * @property {Indexes} p05sdUsd + * @property {Indexes} p15sd + * @property {Indexes} p15sdUsd + * @property {Indexes} p1sd + * @property {Indexes} p1sdUsd + * @property {Indexes} p25sd + * @property {Indexes} p25sdUsd + * @property {Indexes} p2sd + * @property {Indexes} p2sdUsd + * @property {Indexes} p3sd + * @property {Indexes} p3sdUsd + * @property {Indexes} sd + * @property {Indexes} sma + * @property {Indexes} zscore + */ + +/** + * Create a Ratio1ySdPattern2 pattern node + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {Ratio1ySdPattern2} + */ +function createRatio1ySdPattern2(client, basePath) { + return { + _0sdUsd: createIndexes(client, `${basePath}/_0sd_usd`), + m05sd: createIndexes(client, `${basePath}/m0_5sd`), + m05sdUsd: createIndexes(client, `${basePath}/m0_5sd_usd`), + m15sd: createIndexes(client, `${basePath}/m1_5sd`), + m15sdUsd: createIndexes(client, `${basePath}/m1_5sd_usd`), + m1sd: createIndexes(client, `${basePath}/m1sd`), + m1sdUsd: createIndexes(client, `${basePath}/m1sd_usd`), + m25sd: createIndexes(client, `${basePath}/m2_5sd`), + m25sdUsd: createIndexes(client, `${basePath}/m2_5sd_usd`), + m2sd: createIndexes(client, `${basePath}/m2sd`), + m2sdUsd: createIndexes(client, `${basePath}/m2sd_usd`), + m3sd: createIndexes(client, `${basePath}/m3sd`), + m3sdUsd: createIndexes(client, `${basePath}/m3sd_usd`), + p05sd: createIndexes(client, `${basePath}/p0_5sd`), + p05sdUsd: createIndexes(client, `${basePath}/p0_5sd_usd`), + p15sd: createIndexes(client, `${basePath}/p1_5sd`), + p15sdUsd: createIndexes(client, `${basePath}/p1_5sd_usd`), + p1sd: createIndexes(client, `${basePath}/p1sd`), + p1sdUsd: createIndexes(client, `${basePath}/p1sd_usd`), + p25sd: createIndexes(client, `${basePath}/p2_5sd`), + p25sdUsd: createIndexes(client, `${basePath}/p2_5sd_usd`), + p2sd: createIndexes(client, `${basePath}/p2sd`), + p2sdUsd: createIndexes(client, `${basePath}/p2sd_usd`), + p3sd: createIndexes(client, `${basePath}/p3sd`), + p3sdUsd: createIndexes(client, `${basePath}/p3sd_usd`), + sd: createIndexes(client, `${basePath}/sd`), + sma: createIndexes(client, `${basePath}/sma`), + zscore: createIndexes(client, `${basePath}/zscore`) + }; +} + +/** + * @typedef {Object} RealizedPattern2 + * @property {BlockCountPattern} negRealizedLoss + * @property {BlockCountPattern} netRealizedPnl + * @property {Indexes} netRealizedPnlCumulative30dDelta + * @property {Indexes} netRealizedPnlCumulative30dDeltaRelToMarketCap + * @property {Indexes} netRealizedPnlCumulative30dDeltaRelToRealizedCap + * @property {Indexes2} netRealizedPnlRelToRealizedCap + * @property {Indexes3} realizedCap + * @property {Indexes} realizedCap30dDelta + * @property {Indexes3} realizedCapRelToOwnMarketCap + * @property {BlockCountPattern} realizedLoss + * @property {Indexes2} realizedLossRelToRealizedCap + * @property {Indexes3} realizedPrice + * @property {ActivePriceRatioPattern} realizedPriceExtra + * @property {BlockCountPattern} realizedProfit + * @property {Indexes2} realizedProfitRelToRealizedCap + * @property {Indexes5} realizedProfitToLossRatio + * @property {Indexes3} realizedValue + * @property {Indexes5} sellSideRiskRatio + * @property {Indexes5} sellSideRiskRatio30dEma + * @property {Indexes5} sellSideRiskRatio7dEma + * @property {Indexes5} sopr + * @property {Indexes5} sopr30dEma + * @property {Indexes5} sopr7dEma + * @property {BitcoinPattern2} totalRealizedPnl + * @property {Indexes3} valueCreated + * @property {Indexes3} valueDestroyed + */ + +/** + * Create a RealizedPattern2 pattern node + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {RealizedPattern2} + */ +function createRealizedPattern2(client, basePath) { + return { + negRealizedLoss: createBlockCountPattern(client, `${basePath}/neg_realized_loss`), + netRealizedPnl: createBlockCountPattern(client, `${basePath}/net_realized_pnl`), + netRealizedPnlCumulative30dDelta: createIndexes(client, `${basePath}/net_realized_pnl_cumulative_30d_delta`), + netRealizedPnlCumulative30dDeltaRelToMarketCap: createIndexes(client, `${basePath}/net_realized_pnl_cumulative_30d_delta_rel_to_market_cap`), + netRealizedPnlCumulative30dDeltaRelToRealizedCap: createIndexes(client, `${basePath}/net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap`), + netRealizedPnlRelToRealizedCap: createIndexes2(client, `${basePath}/net_realized_pnl_rel_to_realized_cap`), + realizedCap: createIndexes3(client, `${basePath}/realized_cap`), + realizedCap30dDelta: createIndexes(client, `${basePath}/realized_cap_30d_delta`), + realizedCapRelToOwnMarketCap: createIndexes3(client, `${basePath}/realized_cap_rel_to_own_market_cap`), + realizedLoss: createBlockCountPattern(client, `${basePath}/realized_loss`), + realizedLossRelToRealizedCap: createIndexes2(client, `${basePath}/realized_loss_rel_to_realized_cap`), + realizedPrice: createIndexes3(client, `${basePath}/realized_price`), + realizedPriceExtra: createActivePriceRatioPattern(client, `${basePath}/realized_price_extra`), + realizedProfit: createBlockCountPattern(client, `${basePath}/realized_profit`), + realizedProfitRelToRealizedCap: createIndexes2(client, `${basePath}/realized_profit_rel_to_realized_cap`), + realizedProfitToLossRatio: createIndexes5(client, `${basePath}/realized_profit_to_loss_ratio`), + realizedValue: createIndexes3(client, `${basePath}/realized_value`), + sellSideRiskRatio: createIndexes5(client, `${basePath}/sell_side_risk_ratio`), + sellSideRiskRatio30dEma: createIndexes5(client, `${basePath}/sell_side_risk_ratio_30d_ema`), + sellSideRiskRatio7dEma: createIndexes5(client, `${basePath}/sell_side_risk_ratio_7d_ema`), + sopr: createIndexes5(client, `${basePath}/sopr`), + sopr30dEma: createIndexes5(client, `${basePath}/sopr_30d_ema`), + sopr7dEma: createIndexes5(client, `${basePath}/sopr_7d_ema`), + totalRealizedPnl: createBitcoinPattern2(client, `${basePath}/total_realized_pnl`), + valueCreated: createIndexes3(client, `${basePath}/value_created`), + valueDestroyed: createIndexes3(client, `${basePath}/value_destroyed`) + }; +} + +/** + * @typedef {Object} RealizedPattern + * @property {BlockCountPattern} negRealizedLoss + * @property {BlockCountPattern} netRealizedPnl + * @property {Indexes} netRealizedPnlCumulative30dDelta + * @property {Indexes} netRealizedPnlCumulative30dDeltaRelToMarketCap + * @property {Indexes} netRealizedPnlCumulative30dDeltaRelToRealizedCap + * @property {Indexes2} netRealizedPnlRelToRealizedCap + * @property {Indexes3} realizedCap + * @property {Indexes} realizedCap30dDelta + * @property {BlockCountPattern} realizedLoss + * @property {Indexes2} realizedLossRelToRealizedCap + * @property {Indexes3} realizedPrice + * @property {RealizedPriceExtraPattern} realizedPriceExtra + * @property {BlockCountPattern} realizedProfit + * @property {Indexes2} realizedProfitRelToRealizedCap + * @property {Indexes3} realizedValue + * @property {Indexes5} sellSideRiskRatio + * @property {Indexes5} sellSideRiskRatio30dEma + * @property {Indexes5} sellSideRiskRatio7dEma + * @property {Indexes5} sopr + * @property {Indexes5} sopr30dEma + * @property {Indexes5} sopr7dEma + * @property {BitcoinPattern2} totalRealizedPnl + * @property {Indexes3} valueCreated + * @property {Indexes3} valueDestroyed + */ + +/** + * Create a RealizedPattern pattern node + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {RealizedPattern} + */ +function createRealizedPattern(client, basePath) { + return { + negRealizedLoss: createBlockCountPattern(client, `${basePath}/neg_realized_loss`), + netRealizedPnl: createBlockCountPattern(client, `${basePath}/net_realized_pnl`), + netRealizedPnlCumulative30dDelta: createIndexes(client, `${basePath}/net_realized_pnl_cumulative_30d_delta`), + netRealizedPnlCumulative30dDeltaRelToMarketCap: createIndexes(client, `${basePath}/net_realized_pnl_cumulative_30d_delta_rel_to_market_cap`), + netRealizedPnlCumulative30dDeltaRelToRealizedCap: createIndexes(client, `${basePath}/net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap`), + netRealizedPnlRelToRealizedCap: createIndexes2(client, `${basePath}/net_realized_pnl_rel_to_realized_cap`), + realizedCap: createIndexes3(client, `${basePath}/realized_cap`), + realizedCap30dDelta: createIndexes(client, `${basePath}/realized_cap_30d_delta`), + realizedLoss: createBlockCountPattern(client, `${basePath}/realized_loss`), + realizedLossRelToRealizedCap: createIndexes2(client, `${basePath}/realized_loss_rel_to_realized_cap`), + realizedPrice: createIndexes3(client, `${basePath}/realized_price`), + realizedPriceExtra: createRealizedPriceExtraPattern(client, `${basePath}/realized_price_extra`), + realizedProfit: createBlockCountPattern(client, `${basePath}/realized_profit`), + realizedProfitRelToRealizedCap: createIndexes2(client, `${basePath}/realized_profit_rel_to_realized_cap`), + realizedValue: createIndexes3(client, `${basePath}/realized_value`), + sellSideRiskRatio: createIndexes5(client, `${basePath}/sell_side_risk_ratio`), + sellSideRiskRatio30dEma: createIndexes5(client, `${basePath}/sell_side_risk_ratio_30d_ema`), + sellSideRiskRatio7dEma: createIndexes5(client, `${basePath}/sell_side_risk_ratio_7d_ema`), + sopr: createIndexes5(client, `${basePath}/sopr`), + sopr30dEma: createIndexes5(client, `${basePath}/sopr_30d_ema`), + sopr7dEma: createIndexes5(client, `${basePath}/sopr_7d_ema`), + totalRealizedPnl: createBitcoinPattern2(client, `${basePath}/total_realized_pnl`), + valueCreated: createIndexes3(client, `${basePath}/value_created`), + valueDestroyed: createIndexes3(client, `${basePath}/value_destroyed`) + }; +} + +/** + * @typedef {Object} Price13dEmaPattern + * @property {Indexes} price + * @property {Indexes} ratio + * @property {Indexes} ratio1mSma + * @property {Indexes} ratio1wSma + * @property {Ratio1ySdPattern2} ratio1ySd + * @property {Ratio1ySdPattern2} ratio2ySd + * @property {Ratio1ySdPattern2} ratio4ySd + * @property {Indexes} ratioPct1 + * @property {Indexes} ratioPct1Usd + * @property {Indexes} ratioPct2 + * @property {Indexes} ratioPct2Usd + * @property {Indexes} ratioPct5 + * @property {Indexes} ratioPct5Usd + * @property {Indexes} ratioPct95 + * @property {Indexes} ratioPct95Usd + * @property {Indexes} ratioPct98 + * @property {Indexes} ratioPct98Usd + * @property {Indexes} ratioPct99 + * @property {Indexes} ratioPct99Usd + * @property {Ratio1ySdPattern2} ratioSd + */ + +/** + * Create a Price13dEmaPattern pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {Price13dEmaPattern} + */ +function createPrice13dEmaPattern(client, acc) { + return { + price: createIndexes(client, `/${acc}`), + ratio: createIndexes(client, `/${acc}_ratio`), + ratio1mSma: createIndexes(client, `/${acc}_ratio_1m_sma`), + ratio1wSma: createIndexes(client, `/${acc}_ratio_1w_sma`), + ratio1ySd: createRatio1ySdPattern2(client, `${acc}_ratio_1y_sd`), + ratio2ySd: createRatio1ySdPattern2(client, `${acc}_ratio_2y_sd`), + ratio4ySd: createRatio1ySdPattern2(client, `${acc}_ratio_4y_sd`), + ratioPct1: createIndexes(client, `/${acc}_ratio_pct1`), + ratioPct1Usd: createIndexes(client, `/${acc}_ratio_pct1_usd`), + ratioPct2: createIndexes(client, `/${acc}_ratio_pct2`), + ratioPct2Usd: createIndexes(client, `/${acc}_ratio_pct2_usd`), + ratioPct5: createIndexes(client, `/${acc}_ratio_pct5`), + ratioPct5Usd: createIndexes(client, `/${acc}_ratio_pct5_usd`), + ratioPct95: createIndexes(client, `/${acc}_ratio_pct95`), + ratioPct95Usd: createIndexes(client, `/${acc}_ratio_pct95_usd`), + ratioPct98: createIndexes(client, `/${acc}_ratio_pct98`), + ratioPct98Usd: createIndexes(client, `/${acc}_ratio_pct98_usd`), + ratioPct99: createIndexes(client, `/${acc}_ratio_pct99`), + ratioPct99Usd: createIndexes(client, `/${acc}_ratio_pct99_usd`), + ratioSd: createRatio1ySdPattern2(client, `${acc}_ratio_sd`) + }; +} + +/** + * @typedef {Object} PricePercentilesPattern + * @property {Indexes} pct05 + * @property {Indexes} pct10 + * @property {Indexes} pct15 + * @property {Indexes} pct20 + * @property {Indexes} pct25 + * @property {Indexes} pct30 + * @property {Indexes} pct35 + * @property {Indexes} pct40 + * @property {Indexes} pct45 + * @property {Indexes} pct50 + * @property {Indexes} pct55 + * @property {Indexes} pct60 + * @property {Indexes} pct65 + * @property {Indexes} pct70 + * @property {Indexes} pct75 + * @property {Indexes} pct80 + * @property {Indexes} pct85 + * @property {Indexes} pct90 + * @property {Indexes} pct95 + */ + +/** + * Create a PricePercentilesPattern pattern node + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {PricePercentilesPattern} + */ +function createPricePercentilesPattern(client, basePath) { + return { + pct05: createIndexes(client, `${basePath}/pct05`), + pct10: createIndexes(client, `${basePath}/pct10`), + pct15: createIndexes(client, `${basePath}/pct15`), + pct20: createIndexes(client, `${basePath}/pct20`), + pct25: createIndexes(client, `${basePath}/pct25`), + pct30: createIndexes(client, `${basePath}/pct30`), + pct35: createIndexes(client, `${basePath}/pct35`), + pct40: createIndexes(client, `${basePath}/pct40`), + pct45: createIndexes(client, `${basePath}/pct45`), + pct50: createIndexes(client, `${basePath}/pct50`), + pct55: createIndexes(client, `${basePath}/pct55`), + pct60: createIndexes(client, `${basePath}/pct60`), + pct65: createIndexes(client, `${basePath}/pct65`), + pct70: createIndexes(client, `${basePath}/pct70`), + pct75: createIndexes(client, `${basePath}/pct75`), + pct80: createIndexes(client, `${basePath}/pct80`), + pct85: createIndexes(client, `${basePath}/pct85`), + pct90: createIndexes(client, `${basePath}/pct90`), + pct95: createIndexes(client, `${basePath}/pct95`) + }; +} + +/** + * @typedef {Object} RelativePattern2 + * @property {Indexes27} negUnrealizedLossRelToMarketCap + * @property {Indexes27} negUnrealizedLossRelToOwnMarketCap + * @property {Indexes27} negUnrealizedLossRelToOwnTotalUnrealizedPnl + * @property {Indexes26} netUnrealizedPnlRelToMarketCap + * @property {Indexes26} netUnrealizedPnlRelToOwnMarketCap + * @property {Indexes26} netUnrealizedPnlRelToOwnTotalUnrealizedPnl + * @property {Indexes27} supplyInLossRelToCirculatingSupply + * @property {Indexes27} supplyInLossRelToOwnSupply + * @property {Indexes27} supplyInProfitRelToCirculatingSupply + * @property {Indexes27} supplyInProfitRelToOwnSupply + * @property {Indexes} supplyRelToCirculatingSupply + * @property {Indexes27} unrealizedLossRelToMarketCap + * @property {Indexes27} unrealizedLossRelToOwnMarketCap + * @property {Indexes27} unrealizedLossRelToOwnTotalUnrealizedPnl + * @property {Indexes27} unrealizedProfitRelToMarketCap + * @property {Indexes27} unrealizedProfitRelToOwnMarketCap + * @property {Indexes27} unrealizedProfitRelToOwnTotalUnrealizedPnl + */ + +/** + * Create a RelativePattern2 pattern node + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {RelativePattern2} + */ +function createRelativePattern2(client, basePath) { + return { + negUnrealizedLossRelToMarketCap: createIndexes27(client, `${basePath}/neg_unrealized_loss_rel_to_market_cap`), + negUnrealizedLossRelToOwnMarketCap: createIndexes27(client, `${basePath}/neg_unrealized_loss_rel_to_own_market_cap`), + negUnrealizedLossRelToOwnTotalUnrealizedPnl: createIndexes27(client, `${basePath}/neg_unrealized_loss_rel_to_own_total_unrealized_pnl`), + netUnrealizedPnlRelToMarketCap: createIndexes26(client, `${basePath}/net_unrealized_pnl_rel_to_market_cap`), + netUnrealizedPnlRelToOwnMarketCap: createIndexes26(client, `${basePath}/net_unrealized_pnl_rel_to_own_market_cap`), + netUnrealizedPnlRelToOwnTotalUnrealizedPnl: createIndexes26(client, `${basePath}/net_unrealized_pnl_rel_to_own_total_unrealized_pnl`), + supplyInLossRelToCirculatingSupply: createIndexes27(client, `${basePath}/supply_in_loss_rel_to_circulating_supply`), + supplyInLossRelToOwnSupply: createIndexes27(client, `${basePath}/supply_in_loss_rel_to_own_supply`), + supplyInProfitRelToCirculatingSupply: createIndexes27(client, `${basePath}/supply_in_profit_rel_to_circulating_supply`), + supplyInProfitRelToOwnSupply: createIndexes27(client, `${basePath}/supply_in_profit_rel_to_own_supply`), + supplyRelToCirculatingSupply: createIndexes(client, `${basePath}/supply_rel_to_circulating_supply`), + unrealizedLossRelToMarketCap: createIndexes27(client, `${basePath}/unrealized_loss_rel_to_market_cap`), + unrealizedLossRelToOwnMarketCap: createIndexes27(client, `${basePath}/unrealized_loss_rel_to_own_market_cap`), + unrealizedLossRelToOwnTotalUnrealizedPnl: createIndexes27(client, `${basePath}/unrealized_loss_rel_to_own_total_unrealized_pnl`), + unrealizedProfitRelToMarketCap: createIndexes27(client, `${basePath}/unrealized_profit_rel_to_market_cap`), + unrealizedProfitRelToOwnMarketCap: createIndexes27(client, `${basePath}/unrealized_profit_rel_to_own_market_cap`), + unrealizedProfitRelToOwnTotalUnrealizedPnl: createIndexes27(client, `${basePath}/unrealized_profit_rel_to_own_total_unrealized_pnl`) + }; +} + +/** + * @typedef {Object} Ratio1ySdPattern + * @property {Indexes} m05sd + * @property {Indexes} m15sd + * @property {Indexes} m1sd + * @property {Indexes} m25sd + * @property {Indexes} m2sd + * @property {Indexes} m3sd + * @property {Indexes} p05sd + * @property {Indexes} p15sd + * @property {Indexes} p1sd + * @property {Indexes} p25sd + * @property {Indexes} p2sd + * @property {Indexes} p3sd + * @property {Indexes} sd + * @property {Indexes} sma + * @property {Indexes} zscore + */ + +/** + * Create a Ratio1ySdPattern pattern node + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {Ratio1ySdPattern} + */ +function createRatio1ySdPattern(client, basePath) { + return { + m05sd: createIndexes(client, `${basePath}/m0_5sd`), + m15sd: createIndexes(client, `${basePath}/m1_5sd`), + m1sd: createIndexes(client, `${basePath}/m1sd`), + m25sd: createIndexes(client, `${basePath}/m2_5sd`), + m2sd: createIndexes(client, `${basePath}/m2sd`), + m3sd: createIndexes(client, `${basePath}/m3sd`), + p05sd: createIndexes(client, `${basePath}/p0_5sd`), + p15sd: createIndexes(client, `${basePath}/p1_5sd`), + p1sd: createIndexes(client, `${basePath}/p1sd`), + p25sd: createIndexes(client, `${basePath}/p2_5sd`), + p2sd: createIndexes(client, `${basePath}/p2sd`), + p3sd: createIndexes(client, `${basePath}/p3sd`), + sd: createIndexes(client, `${basePath}/sd`), + sma: createIndexes(client, `${basePath}/sma`), + zscore: createIndexes(client, `${basePath}/zscore`) + }; +} + +/** + * @typedef {Object} ActivePriceRatioPattern + * @property {Indexes} ratio + * @property {Indexes} ratio1mSma + * @property {Indexes} ratio1wSma + * @property {Ratio1ySdPattern} ratio1ySd + * @property {Ratio1ySdPattern} ratio2ySd + * @property {Ratio1ySdPattern} ratio4ySd + * @property {Indexes} ratioPct1 + * @property {Indexes} ratioPct2 + * @property {Indexes} ratioPct5 + * @property {Indexes} ratioPct95 + * @property {Indexes} ratioPct98 + * @property {Indexes} ratioPct99 + * @property {Ratio1ySdPattern} ratioSd + */ + +/** + * Create a ActivePriceRatioPattern pattern node + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {ActivePriceRatioPattern} + */ +function createActivePriceRatioPattern(client, basePath) { + return { + ratio: createIndexes(client, `${basePath}/ratio`), + ratio1mSma: createIndexes(client, `${basePath}/ratio_1m_sma`), + ratio1wSma: createIndexes(client, `${basePath}/ratio_1w_sma`), + ratio1ySd: createRatio1ySdPattern(client, `${basePath}/ratio_1y_sd`), + ratio2ySd: createRatio1ySdPattern(client, `${basePath}/ratio_2y_sd`), + ratio4ySd: createRatio1ySdPattern(client, `${basePath}/ratio_4y_sd`), + ratioPct1: createIndexes(client, `${basePath}/ratio_pct1`), + ratioPct2: createIndexes(client, `${basePath}/ratio_pct2`), + ratioPct5: createIndexes(client, `${basePath}/ratio_pct5`), + ratioPct95: createIndexes(client, `${basePath}/ratio_pct95`), + ratioPct98: createIndexes(client, `${basePath}/ratio_pct98`), + ratioPct99: createIndexes(client, `${basePath}/ratio_pct99`), + ratioSd: createRatio1ySdPattern(client, `${basePath}/ratio_sd`) + }; +} + +/** + * @typedef {Object} AXbtPattern + * @property {BlockCountPattern} _1dDominance + * @property {Indexes} _1mBlocksMined + * @property {Indexes} _1mDominance + * @property {Indexes} _1wBlocksMined + * @property {Indexes} _1wDominance + * @property {Indexes} _1yBlocksMined + * @property {Indexes} _1yDominance + * @property {BlockCountPattern} blocksMined + * @property {UnclaimedRewardsPattern} coinbase + * @property {Indexes} daysSinceBlock + * @property {BlockCountPattern} dominance + * @property {UnclaimedRewardsPattern} fee + * @property {UnclaimedRewardsPattern} subsidy + */ + +/** + * Create a AXbtPattern pattern node + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {AXbtPattern} + */ +function createAXbtPattern(client, basePath) { + return { + _1dDominance: createBlockCountPattern(client, `${basePath}/1d_dominance`), + _1mBlocksMined: createIndexes(client, `${basePath}/1m_blocks_mined`), + _1mDominance: createIndexes(client, `${basePath}/1m_dominance`), + _1wBlocksMined: createIndexes(client, `${basePath}/1w_blocks_mined`), + _1wDominance: createIndexes(client, `${basePath}/1w_dominance`), + _1yBlocksMined: createIndexes(client, `${basePath}/1y_blocks_mined`), + _1yDominance: createIndexes(client, `${basePath}/1y_dominance`), + blocksMined: createBlockCountPattern(client, `${basePath}/blocks_mined`), + coinbase: createUnclaimedRewardsPattern(client, `${basePath}/coinbase`), + daysSinceBlock: createIndexes(client, `${basePath}/days_since_block`), + dominance: createBlockCountPattern(client, `${basePath}/dominance`), + fee: createUnclaimedRewardsPattern(client, `${basePath}/fee`), + subsidy: createUnclaimedRewardsPattern(client, `${basePath}/subsidy`) + }; +} + +/** + * @template T + * @typedef {Object} BitcoinPattern + * @property {Indexes4} average + * @property {Indexes2} base + * @property {Indexes3} cumulative + * @property {Indexes4} max + * @property {Indexes5} median + * @property {Indexes4} min + * @property {Indexes5} pct10 + * @property {Indexes5} pct25 + * @property {Indexes5} pct75 + * @property {Indexes5} pct90 + * @property {Indexes4} sum + */ + +/** + * Create a BitcoinPattern pattern node + * @template T + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {BitcoinPattern} + */ +function createBitcoinPattern(client, basePath) { + return { + average: createIndexes4(client, `${basePath}/average`), + base: createIndexes2(client, `${basePath}/base`), + cumulative: createIndexes3(client, `${basePath}/cumulative`), + max: createIndexes4(client, `${basePath}/max`), + median: createIndexes5(client, `${basePath}/median`), + min: createIndexes4(client, `${basePath}/min`), + pct10: createIndexes5(client, `${basePath}/pct10`), + pct25: createIndexes5(client, `${basePath}/pct25`), + pct75: createIndexes5(client, `${basePath}/pct75`), + pct90: createIndexes5(client, `${basePath}/pct90`), + sum: createIndexes4(client, `${basePath}/sum`) + }; +} + +/** + * @template T + * @typedef {Object} BlockSizePattern + * @property {Indexes4} average + * @property {Indexes3} cumulative + * @property {Indexes4} max + * @property {Indexes5} median + * @property {Indexes4} min + * @property {Indexes5} pct10 + * @property {Indexes5} pct25 + * @property {Indexes5} pct75 + * @property {Indexes5} pct90 + * @property {Indexes4} sum + */ + +/** + * Create a BlockSizePattern pattern node + * @template T + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {BlockSizePattern} + */ +function createBlockSizePattern(client, basePath) { + return { + average: createIndexes4(client, `${basePath}/average`), + cumulative: createIndexes3(client, `${basePath}/cumulative`), + max: createIndexes4(client, `${basePath}/max`), + median: createIndexes5(client, `${basePath}/median`), + min: createIndexes4(client, `${basePath}/min`), + pct10: createIndexes5(client, `${basePath}/pct10`), + pct25: createIndexes5(client, `${basePath}/pct25`), + pct75: createIndexes5(client, `${basePath}/pct75`), + pct90: createIndexes5(client, `${basePath}/pct90`), + sum: createIndexes4(client, `${basePath}/sum`) + }; +} + +/** + * @typedef {Object} UnrealizedPattern + * @property {Indexes26} negUnrealizedLoss + * @property {Indexes26} netUnrealizedPnl + * @property {SupplyPattern} supplyInLoss + * @property {SupplyValuePattern} supplyInLossValue + * @property {SupplyPattern} supplyInProfit + * @property {SupplyValuePattern} supplyInProfitValue + * @property {Indexes26} totalUnrealizedPnl + * @property {Indexes26} unrealizedLoss + * @property {Indexes26} unrealizedProfit + */ + +/** + * Create a UnrealizedPattern pattern node + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {UnrealizedPattern} + */ +function createUnrealizedPattern(client, basePath) { + return { + negUnrealizedLoss: createIndexes26(client, `${basePath}/neg_unrealized_loss`), + netUnrealizedPnl: createIndexes26(client, `${basePath}/net_unrealized_pnl`), + supplyInLoss: createSupplyPattern(client, `${basePath}/supply_in_loss`), + supplyInLossValue: createSupplyValuePattern(client, `${basePath}/supply_in_loss_value`), + supplyInProfit: createSupplyPattern(client, `${basePath}/supply_in_profit`), + supplyInProfitValue: createSupplyValuePattern(client, `${basePath}/supply_in_profit_value`), + totalUnrealizedPnl: createIndexes26(client, `${basePath}/total_unrealized_pnl`), + unrealizedLoss: createIndexes26(client, `${basePath}/unrealized_loss`), + unrealizedProfit: createIndexes26(client, `${basePath}/unrealized_profit`) + }; +} + +/** + * @typedef {Object} RelativePattern + * @property {Indexes27} negUnrealizedLossRelToMarketCap + * @property {Indexes26} netUnrealizedPnlRelToMarketCap + * @property {Indexes27} supplyInLossRelToCirculatingSupply + * @property {Indexes27} supplyInLossRelToOwnSupply + * @property {Indexes27} supplyInProfitRelToCirculatingSupply + * @property {Indexes27} supplyInProfitRelToOwnSupply + * @property {Indexes} supplyRelToCirculatingSupply + * @property {Indexes27} unrealizedLossRelToMarketCap + * @property {Indexes27} unrealizedProfitRelToMarketCap + */ + +/** + * Create a RelativePattern pattern node + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {RelativePattern} + */ +function createRelativePattern(client, basePath) { + return { + negUnrealizedLossRelToMarketCap: createIndexes27(client, `${basePath}/neg_unrealized_loss_rel_to_market_cap`), + netUnrealizedPnlRelToMarketCap: createIndexes26(client, `${basePath}/net_unrealized_pnl_rel_to_market_cap`), + supplyInLossRelToCirculatingSupply: createIndexes27(client, `${basePath}/supply_in_loss_rel_to_circulating_supply`), + supplyInLossRelToOwnSupply: createIndexes27(client, `${basePath}/supply_in_loss_rel_to_own_supply`), + supplyInProfitRelToCirculatingSupply: createIndexes27(client, `${basePath}/supply_in_profit_rel_to_circulating_supply`), + supplyInProfitRelToOwnSupply: createIndexes27(client, `${basePath}/supply_in_profit_rel_to_own_supply`), + supplyRelToCirculatingSupply: createIndexes(client, `${basePath}/supply_rel_to_circulating_supply`), + unrealizedLossRelToMarketCap: createIndexes27(client, `${basePath}/unrealized_loss_rel_to_market_cap`), + unrealizedProfitRelToMarketCap: createIndexes27(client, `${basePath}/unrealized_profit_rel_to_market_cap`) + }; +} + +/** + * @template T + * @typedef {Object} AddresstypeToHeightToAddrCountPattern + * @property {Indexes16} p2a + * @property {Indexes17} p2pk33 + * @property {Indexes18} p2pk65 + * @property {Indexes19} p2pkh + * @property {Indexes20} p2sh + * @property {Indexes21} p2tr + * @property {Indexes22} p2wpkh + * @property {Indexes23} p2wsh + */ + +/** + * Create a AddresstypeToHeightToAddrCountPattern pattern node + * @template T + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {AddresstypeToHeightToAddrCountPattern} + */ +function createAddresstypeToHeightToAddrCountPattern(client, basePath) { + return { + p2a: createIndexes16(client, `${basePath}/p2a`), + p2pk33: createIndexes17(client, `${basePath}/p2pk33`), + p2pk65: createIndexes18(client, `${basePath}/p2pk65`), + p2pkh: createIndexes19(client, `${basePath}/p2pkh`), + p2sh: createIndexes20(client, `${basePath}/p2sh`), + p2tr: createIndexes21(client, `${basePath}/p2tr`), + p2wpkh: createIndexes22(client, `${basePath}/p2wpkh`), + p2wsh: createIndexes23(client, `${basePath}/p2wsh`) + }; +} + +/** + * @template T + * @typedef {Object} BlockIntervalPattern + * @property {Indexes3} average + * @property {Indexes3} max + * @property {Indexes2} median + * @property {Indexes3} min + * @property {Indexes2} pct10 + * @property {Indexes2} pct25 + * @property {Indexes2} pct75 + * @property {Indexes2} pct90 + */ + +/** + * Create a BlockIntervalPattern pattern node + * @template T + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {BlockIntervalPattern} + */ +function createBlockIntervalPattern(client, acc) { + return { + average: createIndexes3(client, `/${acc}_avg`), + max: createIndexes3(client, `/${acc}_max`), + median: createIndexes2(client, `/${acc}_median`), + min: createIndexes3(client, `/${acc}_min`), + pct10: createIndexes2(client, `/${acc}_pct10`), + pct25: createIndexes2(client, `/${acc}_pct25`), + pct75: createIndexes2(client, `/${acc}_pct75`), + pct90: createIndexes2(client, `/${acc}_pct90`) + }; +} + +/** + * @template T + * @typedef {Object} Constant0Pattern + * @property {Indexes5} dateindex + * @property {Indexes7} decadeindex + * @property {Indexes2} height + * @property {Indexes8} monthindex + * @property {Indexes9} quarterindex + * @property {Indexes10} semesterindex + * @property {Indexes11} weekindex + * @property {Indexes12} yearindex + */ + +/** + * Create a Constant0Pattern pattern node + * @template T + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {Constant0Pattern} + */ +function createConstant0Pattern(client, acc) { + return { + dateindex: createIndexes5(client, `/${acc}`), + decadeindex: createIndexes7(client, `/${acc}`), + height: createIndexes2(client, `/${acc}`), + monthindex: createIndexes8(client, `/${acc}`), + quarterindex: createIndexes9(client, `/${acc}`), + semesterindex: createIndexes10(client, `/${acc}`), + weekindex: createIndexes11(client, `/${acc}`), + yearindex: createIndexes12(client, `/${acc}`) + }; +} + +/** + * @typedef {Object} _0satsPattern + * @property {ActivityPattern} activity + * @property {Indexes3} addrCount + * @property {PricePaidPattern} pricePaid + * @property {RealizedPattern} realized + * @property {RelativePattern} relative + * @property {SupplyPattern2} supply + * @property {UnrealizedPattern} unrealized + */ + +/** + * Create a _0satsPattern pattern node + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {_0satsPattern} + */ +function create_0satsPattern(client, basePath) { + return { + activity: createActivityPattern(client, `${basePath}/activity`), + addrCount: createIndexes3(client, `${basePath}/addr_count`), + pricePaid: createPricePaidPattern(client, `${basePath}/price_paid`), + realized: createRealizedPattern(client, `${basePath}/realized`), + relative: createRelativePattern(client, `${basePath}/relative`), + supply: createSupplyPattern2(client, `${basePath}/supply`), + unrealized: createUnrealizedPattern(client, `${basePath}/unrealized`) + }; +} + +/** + * @typedef {Object} UpTo1dPattern + * @property {ActivityPattern} activity + * @property {PricePaidPattern2} pricePaid + * @property {RealizedPattern3} realized + * @property {RelativePattern2} relative + * @property {SupplyPattern2} supply + * @property {UnrealizedPattern} unrealized + */ + +/** + * Create a UpTo1dPattern pattern node + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {UpTo1dPattern} + */ +function createUpTo1dPattern(client, basePath) { + return { + activity: createActivityPattern(client, `${basePath}/activity`), + pricePaid: createPricePaidPattern2(client, `${basePath}/price_paid`), + realized: createRealizedPattern3(client, `${basePath}/realized`), + relative: createRelativePattern2(client, `${basePath}/relative`), + supply: createSupplyPattern2(client, `${basePath}/supply`), + unrealized: createUnrealizedPattern(client, `${basePath}/unrealized`) + }; +} + +/** + * @typedef {Object} _0satsPattern2 + * @property {ActivityPattern} activity + * @property {PricePaidPattern} pricePaid + * @property {RealizedPattern} realized + * @property {RelativePattern} relative + * @property {SupplyPattern2} supply + * @property {UnrealizedPattern} unrealized + */ + +/** + * Create a _0satsPattern2 pattern node + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {_0satsPattern2} + */ +function create_0satsPattern2(client, basePath) { + return { + activity: createActivityPattern(client, `${basePath}/activity`), + pricePaid: createPricePaidPattern(client, `${basePath}/price_paid`), + realized: createRealizedPattern(client, `${basePath}/realized`), + relative: createRelativePattern(client, `${basePath}/relative`), + supply: createSupplyPattern2(client, `${basePath}/supply`), + unrealized: createUnrealizedPattern(client, `${basePath}/unrealized`) + }; +} + +/** + * @typedef {Object} _10yTo12yPattern + * @property {ActivityPattern} activity + * @property {PricePaidPattern2} pricePaid + * @property {RealizedPattern2} realized + * @property {RelativePattern2} relative + * @property {SupplyPattern2} supply + * @property {UnrealizedPattern} unrealized + */ + +/** + * Create a _10yTo12yPattern pattern node + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {_10yTo12yPattern} + */ +function create_10yTo12yPattern(client, basePath) { + return { + activity: createActivityPattern(client, `${basePath}/activity`), + pricePaid: createPricePaidPattern2(client, `${basePath}/price_paid`), + realized: createRealizedPattern2(client, `${basePath}/realized`), + relative: createRelativePattern2(client, `${basePath}/relative`), + supply: createSupplyPattern2(client, `${basePath}/supply`), + unrealized: createUnrealizedPattern(client, `${basePath}/unrealized`) + }; +} + +/** + * @typedef {Object} SupplyPattern2 + * @property {SupplyPattern} supply + * @property {ActiveSupplyPattern} supplyHalf + * @property {ActiveSupplyPattern} supplyHalfValue + * @property {SupplyValuePattern} supplyValue + * @property {Indexes3} utxoCount + */ + +/** + * Create a SupplyPattern2 pattern node + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {SupplyPattern2} + */ +function createSupplyPattern2(client, basePath) { + return { + supply: createSupplyPattern(client, `${basePath}/supply`), + supplyHalf: createActiveSupplyPattern(client, `${basePath}/supply_half`), + supplyHalfValue: createActiveSupplyPattern(client, `${basePath}/supply_half_value`), + supplyValue: createSupplyValuePattern(client, `${basePath}/supply_value`), + utxoCount: createIndexes3(client, `${basePath}/utxo_count`) + }; +} + +/** + * @typedef {Object} ActivityPattern + * @property {BlockCountPattern} coinblocksDestroyed + * @property {BlockCountPattern} coindaysDestroyed + * @property {Indexes2} satblocksDestroyed + * @property {Indexes2} satdaysDestroyed + * @property {SentPattern} sent + */ + +/** + * Create a ActivityPattern pattern node + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {ActivityPattern} + */ +function createActivityPattern(client, basePath) { + return { + coinblocksDestroyed: createBlockCountPattern(client, `${basePath}/coinblocks_destroyed`), + coindaysDestroyed: createBlockCountPattern(client, `${basePath}/coindays_destroyed`), + satblocksDestroyed: createIndexes2(client, `${basePath}/satblocks_destroyed`), + satdaysDestroyed: createIndexes2(client, `${basePath}/satdays_destroyed`), + sent: createSentPattern(client, `${basePath}/sent`) + }; +} + +/** + * @typedef {Object} SentPattern + * @property {Indexes2} base + * @property {BlockCountPattern} bitcoin + * @property {BlockCountPattern} dollars + * @property {SatsPattern} sats + */ + +/** + * Create a SentPattern pattern node + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {SentPattern} + */ +function createSentPattern(client, basePath) { + return { + base: createIndexes2(client, `${basePath}/base`), + bitcoin: createBlockCountPattern(client, `${basePath}/bitcoin`), + dollars: createBlockCountPattern(client, `${basePath}/dollars`), + sats: createSatsPattern(client, `${basePath}/sats`) + }; +} + +/** + * @typedef {Object} SupplyPattern + * @property {Indexes2} base + * @property {Indexes} bitcoin + * @property {Indexes} dollars + * @property {Indexes} sats + */ + +/** + * Create a SupplyPattern pattern node + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {SupplyPattern} + */ +function createSupplyPattern(client, basePath) { + return { + base: createIndexes2(client, `${basePath}/base`), + bitcoin: createIndexes(client, `${basePath}/bitcoin`), + dollars: createIndexes(client, `${basePath}/dollars`), + sats: createIndexes(client, `${basePath}/sats`) + }; +} + +/** + * @typedef {Object} CoinbasePattern + * @property {BitcoinPattern} bitcoin + * @property {BitcoinPattern} dollars + * @property {BitcoinPattern} sats + */ + +/** + * Create a CoinbasePattern pattern node + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {CoinbasePattern} + */ +function createCoinbasePattern(client, basePath) { + return { + bitcoin: createBitcoinPattern(client, `${basePath}/bitcoin`), + dollars: createBitcoinPattern(client, `${basePath}/dollars`), + sats: createBitcoinPattern(client, `${basePath}/sats`) + }; +} + +/** + * @typedef {Object} ActiveSupplyPattern + * @property {Indexes3} bitcoin + * @property {Indexes3} dollars + * @property {Indexes3} sats + */ + +/** + * Create a ActiveSupplyPattern pattern node + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {ActiveSupplyPattern} + */ +function createActiveSupplyPattern(client, basePath) { + return { + bitcoin: createIndexes3(client, `${basePath}/bitcoin`), + dollars: createIndexes3(client, `${basePath}/dollars`), + sats: createIndexes3(client, `${basePath}/sats`) + }; +} + +/** + * @typedef {Object} UnclaimedRewardsPattern + * @property {BlockCountPattern} bitcoin + * @property {BlockCountPattern} dollars + * @property {BlockCountPattern} sats + */ + +/** + * Create a UnclaimedRewardsPattern pattern node + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {UnclaimedRewardsPattern} + */ +function createUnclaimedRewardsPattern(client, basePath) { + return { + bitcoin: createBlockCountPattern(client, `${basePath}/bitcoin`), + dollars: createBlockCountPattern(client, `${basePath}/dollars`), + sats: createBlockCountPattern(client, `${basePath}/sats`) + }; +} + +/** + * @typedef {Object} PricePaidPattern2 + * @property {Indexes3} maxPricePaid + * @property {Indexes3} minPricePaid + * @property {PricePercentilesPattern} pricePercentiles + */ + +/** + * Create a PricePaidPattern2 pattern node + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {PricePaidPattern2} + */ +function createPricePaidPattern2(client, basePath) { + return { + maxPricePaid: createIndexes3(client, `${basePath}/max_price_paid`), + minPricePaid: createIndexes3(client, `${basePath}/min_price_paid`), + pricePercentiles: createPricePercentilesPattern(client, `${basePath}/price_percentiles`) + }; +} + +/** + * @template T + * @typedef {Object} BlockCountPattern + * @property {Indexes2} base + * @property {Indexes3} cumulative + * @property {Indexes4} sum + */ + +/** + * Create a BlockCountPattern pattern node + * @template T + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {BlockCountPattern} + */ +function createBlockCountPattern(client, basePath) { + return { + base: createIndexes2(client, `${basePath}/base`), + cumulative: createIndexes3(client, `${basePath}/cumulative`), + sum: createIndexes4(client, `${basePath}/sum`) + }; +} + +/** + * @typedef {Object} SupplyValuePattern + * @property {Indexes2} bitcoin + * @property {Indexes2} dollars + */ + +/** + * Create a SupplyValuePattern pattern node + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {SupplyValuePattern} + */ +function createSupplyValuePattern(client, basePath) { + return { + bitcoin: createIndexes2(client, `${basePath}/bitcoin`), + dollars: createIndexes2(client, `${basePath}/dollars`) + }; +} + +/** + * @typedef {Object} PricePaidPattern + * @property {Indexes3} maxPricePaid + * @property {Indexes3} minPricePaid + */ + +/** + * Create a PricePaidPattern pattern node + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {PricePaidPattern} + */ +function createPricePaidPattern(client, basePath) { + return { + maxPricePaid: createIndexes3(client, `${basePath}/max_price_paid`), + minPricePaid: createIndexes3(client, `${basePath}/min_price_paid`) + }; +} + +/** + * @typedef {Object} SatsPattern + * @property {Indexes3} cumulative + * @property {Indexes4} sum + */ + +/** + * Create a SatsPattern pattern node + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {SatsPattern} + */ +function createSatsPattern(client, basePath) { + return { + cumulative: createIndexes3(client, `${basePath}/cumulative`), + sum: createIndexes4(client, `${basePath}/sum`) + }; +} + +/** + * @typedef {Object} _1dReturns1mSdPattern + * @property {Indexes} sd + * @property {Indexes} sma + */ + +/** + * Create a _1dReturns1mSdPattern pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {_1dReturns1mSdPattern} + */ +function create_1dReturns1mSdPattern(client, acc) { + return { + sd: createIndexes(client, `/${acc}_sd`), + sma: createIndexes(client, `/${acc}_sma`) + }; +} + +/** + * @template T + * @typedef {Object} BitcoinPattern2 + * @property {Indexes2} base + * @property {Indexes4} sum + */ + +/** + * Create a BitcoinPattern2 pattern node + * @template T + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {BitcoinPattern2} + */ +function createBitcoinPattern2(client, basePath) { + return { + base: createIndexes2(client, `${basePath}/base`), + sum: createIndexes4(client, `${basePath}/sum`) + }; +} + +/** + * @typedef {Object} RealizedPriceExtraPattern + * @property {Indexes} ratio + */ + +/** + * Create a RealizedPriceExtraPattern pattern node + * @param {BrkClientBase} client + * @param {string} basePath + * @returns {RealizedPriceExtraPattern} + */ +function createRealizedPriceExtraPattern(client, basePath) { + return { + ratio: createIndexes(client, `${basePath}/ratio`) + }; +} + +// Catalog tree typedefs + +/** + * @typedef {Object} CatalogTree + * @property {CatalogTree_Computed} computed + * @property {CatalogTree_Indexed} indexed + */ + +/** + * @typedef {Object} CatalogTree_Computed + * @property {CatalogTree_Computed_Blks} blks + * @property {CatalogTree_Computed_Chain} chain + * @property {CatalogTree_Computed_Cointime} cointime + * @property {CatalogTree_Computed_Constants} constants + * @property {CatalogTree_Computed_Fetched} fetched + * @property {CatalogTree_Computed_Indexes} indexes + * @property {CatalogTree_Computed_Market} market + * @property {CatalogTree_Computed_Pools} pools + * @property {CatalogTree_Computed_Price} price + * @property {CatalogTree_Computed_Stateful} stateful + * @property {CatalogTree_Computed_Txins} txins + * @property {CatalogTree_Computed_Txouts} txouts + */ + +/** + * @typedef {Object} CatalogTree_Computed_Blks + * @property {MetricNode} position + */ + +/** + * @typedef {Object} CatalogTree_Computed_Chain + * @property {Indexes} _1mBlockCount + * @property {Indexes} _1wBlockCount + * @property {Indexes} _1yBlockCount + * @property {Indexes2} _24hBlockCount + * @property {Indexes2} _24hCoinbaseSum + * @property {Indexes2} _24hCoinbaseUsdSum + * @property {Indexes} annualizedVolume + * @property {Indexes} annualizedVolumeBtc + * @property {Indexes} annualizedVolumeUsd + * @property {BlockCountPattern} blockCount + * @property {Indexes} blockCountTarget + * @property {BlockIntervalPattern} blockInterval + * @property {BlockSizePattern} blockSize + * @property {BlockSizePattern} blockVbytes + * @property {BlockSizePattern} blockWeight + * @property {Indexes3} blocksBeforeNextDifficultyAdjustment + * @property {Indexes3} blocksBeforeNextHalving + * @property {CoinbasePattern} coinbase + * @property {Indexes3} daysBeforeNextDifficultyAdjustment + * @property {Indexes3} daysBeforeNextHalving + * @property {Indexes4} difficulty + * @property {Indexes3} difficultyAdjustment + * @property {Indexes3} difficultyAsHash + * @property {Indexes} difficultyepoch + * @property {BitcoinPattern} emptyoutputCount + * @property {Indexes3} exactUtxoCount + * @property {CatalogTree_Computed_Chain_Fee} fee + * @property {Indexes5} feeDominance + * @property {CatalogTree_Computed_Chain_FeeRate} feeRate + * @property {Indexes} halvingepoch + * @property {Indexes3} hashPricePhs + * @property {Indexes3} hashPricePhsMin + * @property {Indexes3} hashPriceRebound + * @property {Indexes3} hashPriceThs + * @property {Indexes3} hashPriceThsMin + * @property {Indexes3} hashRate + * @property {Indexes} hashRate1mSma + * @property {Indexes} hashRate1wSma + * @property {Indexes} hashRate1ySma + * @property {Indexes} hashRate2mSma + * @property {Indexes3} hashValuePhs + * @property {Indexes3} hashValuePhsMin + * @property {Indexes3} hashValueRebound + * @property {Indexes3} hashValueThs + * @property {Indexes3} hashValueThsMin + * @property {Indexes} inflationRate + * @property {BlockSizePattern} inputCount + * @property {Indexes6} inputValue + * @property {Indexes} inputsPerSec + * @property {Indexes2} interval + * @property {Indexes6} isCoinbase + * @property {BitcoinPattern} opreturnCount + * @property {BlockSizePattern} outputCount + * @property {Indexes6} outputValue + * @property {Indexes} outputsPerSec + * @property {BitcoinPattern} p2aCount + * @property {BitcoinPattern} p2msCount + * @property {BitcoinPattern} p2pk33Count + * @property {BitcoinPattern} p2pk65Count + * @property {BitcoinPattern} p2pkhCount + * @property {BitcoinPattern} p2shCount + * @property {BitcoinPattern} p2trCount + * @property {BitcoinPattern} p2wpkhCount + * @property {BitcoinPattern} p2wshCount + * @property {Indexes} puellMultiple + * @property {CatalogTree_Computed_Chain_SentSum} sentSum + * @property {CoinbasePattern} subsidy + * @property {Indexes5} subsidyDominance + * @property {Indexes} subsidyUsd1ySma + * @property {MetricNode} timestamp + * @property {Indexes} txBtcVelocity + * @property {BitcoinPattern} txCount + * @property {Indexes} txPerSec + * @property {Indexes} txUsdVelocity + * @property {BlockCountPattern} txV1 + * @property {BlockCountPattern} txV2 + * @property {BlockCountPattern} txV3 + * @property {BlockIntervalPattern} txVsize + * @property {BlockIntervalPattern} txWeight + * @property {UnclaimedRewardsPattern} unclaimedRewards + * @property {BitcoinPattern} unknownoutputCount + * @property {Indexes2} vbytes + * @property {Indexes6} vsize + * @property {Indexes6} weight + */ + +/** + * @typedef {Object} CatalogTree_Computed_Chain_Fee + * @property {Indexes6} base + * @property {BlockSizePattern} bitcoin + * @property {Indexes6} bitcoinTxindex + * @property {BlockSizePattern} dollars + * @property {Indexes6} dollarsTxindex + * @property {BlockSizePattern} sats + */ + +/** + * @typedef {Object} CatalogTree_Computed_Chain_FeeRate + * @property {Indexes3} average + * @property {Indexes6} base + * @property {Indexes3} max + * @property {Indexes2} median + * @property {Indexes3} min + * @property {Indexes2} pct10 + * @property {Indexes2} pct25 + * @property {Indexes2} pct75 + * @property {Indexes2} pct90 + */ + +/** + * @typedef {Object} CatalogTree_Computed_Chain_SentSum + * @property {BitcoinPattern2} bitcoin + * @property {Indexes3} dollars + * @property {Indexes3} sats + */ + +/** + * @typedef {Object} CatalogTree_Computed_Cointime + * @property {Indexes3} activeCap + * @property {Indexes3} activePrice + * @property {ActivePriceRatioPattern} activePriceRatio + * @property {ActiveSupplyPattern} activeSupply + * @property {Indexes3} activityToVaultednessRatio + * @property {BlockCountPattern} coinblocksCreated + * @property {BlockCountPattern} coinblocksStored + * @property {Indexes} cointimeAdjInflationRate + * @property {Indexes} cointimeAdjTxBtcVelocity + * @property {Indexes} cointimeAdjTxUsdVelocity + * @property {Indexes3} cointimeCap + * @property {Indexes3} cointimePrice + * @property {ActivePriceRatioPattern} cointimePriceRatio + * @property {BlockCountPattern} cointimeValueCreated + * @property {BlockCountPattern} cointimeValueDestroyed + * @property {BlockCountPattern} cointimeValueStored + * @property {Indexes3} investorCap + * @property {Indexes3} liveliness + * @property {Indexes3} thermoCap + * @property {Indexes3} trueMarketMean + * @property {ActivePriceRatioPattern} trueMarketMeanRatio + * @property {Indexes3} vaultedCap + * @property {Indexes3} vaultedPrice + * @property {ActivePriceRatioPattern} vaultedPriceRatio + * @property {ActiveSupplyPattern} vaultedSupply + * @property {Indexes3} vaultedness + */ + +/** + * @typedef {Object} CatalogTree_Computed_Constants + * @property {Constant0Pattern} constant0 + * @property {Constant0Pattern} constant1 + * @property {Constant0Pattern} constant100 + * @property {Constant0Pattern} constant2 + * @property {Constant0Pattern} constant3 + * @property {Constant0Pattern} constant382 + * @property {Constant0Pattern} constant4 + * @property {Constant0Pattern} constant50 + * @property {Constant0Pattern} constant600 + * @property {Constant0Pattern} constant618 + * @property {Constant0Pattern} constantMinus1 + * @property {Constant0Pattern} constantMinus2 + * @property {Constant0Pattern} constantMinus3 + * @property {Constant0Pattern} constantMinus4 + */ + +/** + * @typedef {Object} CatalogTree_Computed_Fetched + * @property {Indexes13} priceOhlcInCents + */ + +/** + * @typedef {Object} CatalogTree_Computed_Indexes + * @property {Indexes13} date + * @property {Indexes2} dateFixed + * @property {Indexes13} dateindex + * @property {Indexes14} dateindexCount + * @property {MetricNode} decadeindex + * @property {MetricNode} difficultyepoch + * @property {MetricNode} emptyoutputindex + * @property {Indexes14} firstDateindex + * @property {MetricNode} firstHeight + * @property {Indexes15} firstMonthindex + * @property {Indexes7} firstYearindex + * @property {MetricNode} halvingepoch + * @property {Indexes2} height + * @property {MetricNode} heightCount + * @property {Indexes6} inputCount + * @property {MetricNode} monthindex + * @property {Indexes15} monthindexCount + * @property {MetricNode} opreturnindex + * @property {Indexes6} outputCount + * @property {Indexes16} p2aaddressindex + * @property {MetricNode} p2msoutputindex + * @property {Indexes17} p2pk33addressindex + * @property {Indexes18} p2pk65addressindex + * @property {Indexes19} p2pkhaddressindex + * @property {Indexes20} p2shaddressindex + * @property {Indexes21} p2traddressindex + * @property {Indexes22} p2wpkhaddressindex + * @property {Indexes23} p2wshaddressindex + * @property {MetricNode} quarterindex + * @property {MetricNode} semesterindex + * @property {Indexes2} timestampFixed + * @property {Indexes6} txindex + * @property {Indexes2} txindexCount + * @property {Indexes24} txinindex + * @property {Indexes25} txoutindex + * @property {MetricNode} unknownoutputindex + * @property {MetricNode} weekindex + * @property {MetricNode} yearindex + * @property {Indexes7} yearindexCount + */ + +/** + * @typedef {Object} CatalogTree_Computed_Market + * @property {_1dReturns1mSdPattern} _1dReturns1mSd + * @property {_1dReturns1mSdPattern} _1dReturns1wSd + * @property {_1dReturns1mSdPattern} _1dReturns1ySd + * @property {Indexes} _10yCagr + * @property {Indexes} _10yDcaAvgPrice + * @property {Indexes} _10yDcaCagr + * @property {Indexes} _10yDcaReturns + * @property {Indexes} _10yDcaStack + * @property {Indexes} _10yPriceReturns + * @property {Indexes} _1dPriceReturns + * @property {Indexes} _1mDcaAvgPrice + * @property {Indexes} _1mDcaReturns + * @property {Indexes} _1mDcaStack + * @property {Indexes} _1mPriceReturns + * @property {Indexes} _1wDcaAvgPrice + * @property {Indexes} _1wDcaReturns + * @property {Indexes} _1wDcaStack + * @property {Indexes} _1wPriceReturns + * @property {Indexes} _1yDcaAvgPrice + * @property {Indexes} _1yDcaReturns + * @property {Indexes} _1yDcaStack + * @property {Indexes} _1yPriceReturns + * @property {Indexes} _2yCagr + * @property {Indexes} _2yDcaAvgPrice + * @property {Indexes} _2yDcaCagr + * @property {Indexes} _2yDcaReturns + * @property {Indexes} _2yDcaStack + * @property {Indexes} _2yPriceReturns + * @property {Indexes} _3mDcaAvgPrice + * @property {Indexes} _3mDcaReturns + * @property {Indexes} _3mDcaStack + * @property {Indexes} _3mPriceReturns + * @property {Indexes} _3yCagr + * @property {Indexes} _3yDcaAvgPrice + * @property {Indexes} _3yDcaCagr + * @property {Indexes} _3yDcaReturns + * @property {Indexes} _3yDcaStack + * @property {Indexes} _3yPriceReturns + * @property {Indexes} _4yCagr + * @property {Indexes} _4yDcaAvgPrice + * @property {Indexes} _4yDcaCagr + * @property {Indexes} _4yDcaReturns + * @property {Indexes} _4yDcaStack + * @property {Indexes} _4yPriceReturns + * @property {Indexes} _5yCagr + * @property {Indexes} _5yDcaAvgPrice + * @property {Indexes} _5yDcaCagr + * @property {Indexes} _5yDcaReturns + * @property {Indexes} _5yDcaStack + * @property {Indexes} _5yPriceReturns + * @property {Indexes} _6mDcaAvgPrice + * @property {Indexes} _6mDcaReturns + * @property {Indexes} _6mDcaStack + * @property {Indexes} _6mPriceReturns + * @property {Indexes} _6yCagr + * @property {Indexes} _6yDcaAvgPrice + * @property {Indexes} _6yDcaCagr + * @property {Indexes} _6yDcaReturns + * @property {Indexes} _6yDcaStack + * @property {Indexes} _6yPriceReturns + * @property {Indexes} _8yCagr + * @property {Indexes} _8yDcaAvgPrice + * @property {Indexes} _8yDcaCagr + * @property {Indexes} _8yDcaReturns + * @property {Indexes} _8yDcaStack + * @property {Indexes} _8yPriceReturns + * @property {Indexes} daysSincePriceAth + * @property {Indexes} dcaClass2015AvgPrice + * @property {Indexes} dcaClass2015Returns + * @property {Indexes} dcaClass2015Stack + * @property {Indexes} dcaClass2016AvgPrice + * @property {Indexes} dcaClass2016Returns + * @property {Indexes} dcaClass2016Stack + * @property {Indexes} dcaClass2017AvgPrice + * @property {Indexes} dcaClass2017Returns + * @property {Indexes} dcaClass2017Stack + * @property {Indexes} dcaClass2018AvgPrice + * @property {Indexes} dcaClass2018Returns + * @property {Indexes} dcaClass2018Stack + * @property {Indexes} dcaClass2019AvgPrice + * @property {Indexes} dcaClass2019Returns + * @property {Indexes} dcaClass2019Stack + * @property {Indexes} dcaClass2020AvgPrice + * @property {Indexes} dcaClass2020Returns + * @property {Indexes} dcaClass2020Stack + * @property {Indexes} dcaClass2021AvgPrice + * @property {Indexes} dcaClass2021Returns + * @property {Indexes} dcaClass2021Stack + * @property {Indexes} dcaClass2022AvgPrice + * @property {Indexes} dcaClass2022Returns + * @property {Indexes} dcaClass2022Stack + * @property {Indexes} dcaClass2023AvgPrice + * @property {Indexes} dcaClass2023Returns + * @property {Indexes} dcaClass2023Stack + * @property {Indexes} dcaClass2024AvgPrice + * @property {Indexes} dcaClass2024Returns + * @property {Indexes} dcaClass2024Stack + * @property {Indexes} dcaClass2025AvgPrice + * @property {Indexes} dcaClass2025Returns + * @property {Indexes} dcaClass2025Stack + * @property {Indexes} maxDaysBetweenPriceAths + * @property {Indexes} maxYearsBetweenPriceAths + * @property {Indexes} price10yAgo + * @property {Price13dEmaPattern} price13dEma + * @property {Price13dEmaPattern} price13dSma + * @property {Price13dEmaPattern} price144dEma + * @property {Price13dEmaPattern} price144dSma + * @property {Indexes} price1dAgo + * @property {Indexes} price1mAgo + * @property {Price13dEmaPattern} price1mEma + * @property {Indexes} price1mMax + * @property {Indexes} price1mMin + * @property {Price13dEmaPattern} price1mSma + * @property {Indexes} price1mVolatility + * @property {Indexes} price1wAgo + * @property {Price13dEmaPattern} price1wEma + * @property {Indexes} price1wMax + * @property {Indexes} price1wMin + * @property {Price13dEmaPattern} price1wSma + * @property {Indexes} price1wVolatility + * @property {Indexes} price1yAgo + * @property {Price13dEmaPattern} price1yEma + * @property {Indexes} price1yMax + * @property {Indexes} price1yMin + * @property {Price13dEmaPattern} price1ySma + * @property {Indexes} price1yVolatility + * @property {Price13dEmaPattern} price200dEma + * @property {Price13dEmaPattern} price200dSma + * @property {Indexes} price200dSmaX08 + * @property {Indexes} price200dSmaX24 + * @property {Price13dEmaPattern} price200wEma + * @property {Price13dEmaPattern} price200wSma + * @property {Price13dEmaPattern} price21dEma + * @property {Price13dEmaPattern} price21dSma + * @property {Indexes} price2wChoppinessIndex + * @property {Indexes} price2wMax + * @property {Indexes} price2wMin + * @property {Indexes} price2yAgo + * @property {Price13dEmaPattern} price2yEma + * @property {Price13dEmaPattern} price2ySma + * @property {Price13dEmaPattern} price34dEma + * @property {Price13dEmaPattern} price34dSma + * @property {Indexes} price3mAgo + * @property {Indexes} price3yAgo + * @property {Indexes} price4yAgo + * @property {Price13dEmaPattern} price4yEma + * @property {Price13dEmaPattern} price4ySma + * @property {Price13dEmaPattern} price55dEma + * @property {Price13dEmaPattern} price55dSma + * @property {Indexes} price5yAgo + * @property {Indexes} price6mAgo + * @property {Indexes} price6yAgo + * @property {Price13dEmaPattern} price89dEma + * @property {Price13dEmaPattern} price89dSma + * @property {Price13dEmaPattern} price8dEma + * @property {Price13dEmaPattern} price8dSma + * @property {Indexes} price8yAgo + * @property {Indexes26} priceAth + * @property {Indexes26} priceDrawdown + * @property {Indexes5} priceTrueRange + * @property {Indexes5} priceTrueRange2wSum + */ + +/** + * @typedef {Object} CatalogTree_Computed_Pools + * @property {Indexes2} pool + * @property {CatalogTree_Computed_Pools_Vecs} vecs + */ + +/** + * @typedef {Object} CatalogTree_Computed_Pools_Vecs + * @property {AXbtPattern} aXbt + * @property {AXbtPattern} aaoPool + * @property {AXbtPattern} antPool + * @property {AXbtPattern} arkPool + * @property {AXbtPattern} asicMiner + * @property {AXbtPattern} batPool + * @property {AXbtPattern} bcMonster + * @property {AXbtPattern} bcpoolIo + * @property {AXbtPattern} binancePool + * @property {AXbtPattern} bitClub + * @property {AXbtPattern} bitFuFuPool + * @property {AXbtPattern} bitFury + * @property {AXbtPattern} bitMinter + * @property {AXbtPattern} bitalo + * @property {AXbtPattern} bitcoinAffiliateNetwork + * @property {AXbtPattern} bitcoinCom + * @property {AXbtPattern} bitcoinIndia + * @property {AXbtPattern} bitcoinRussia + * @property {AXbtPattern} bitcoinUkraine + * @property {AXbtPattern} bitfarms + * @property {AXbtPattern} bitparking + * @property {AXbtPattern} bitsolo + * @property {AXbtPattern} bixin + * @property {AXbtPattern} blockFills + * @property {AXbtPattern} braiinsPool + * @property {AXbtPattern} bravoMining + * @property {AXbtPattern} btPool + * @property {AXbtPattern} btcCom + * @property {AXbtPattern} btcDig + * @property {AXbtPattern} btcGuild + * @property {AXbtPattern} btcLab + * @property {AXbtPattern} btcMp + * @property {AXbtPattern} btcNuggets + * @property {AXbtPattern} btcPoolParty + * @property {AXbtPattern} btcServ + * @property {AXbtPattern} btcTop + * @property {AXbtPattern} btcc + * @property {AXbtPattern} bwPool + * @property {AXbtPattern} bytePool + * @property {AXbtPattern} canoe + * @property {AXbtPattern} canoePool + * @property {AXbtPattern} carbonNegative + * @property {AXbtPattern} ckPool + * @property {AXbtPattern} cloudHashing + * @property {AXbtPattern} coinLab + * @property {AXbtPattern} cointerra + * @property {AXbtPattern} connectBtc + * @property {AXbtPattern} dPool + * @property {AXbtPattern} dcExploration + * @property {AXbtPattern} dcex + * @property {AXbtPattern} digitalBtc + * @property {AXbtPattern} digitalXMintsy + * @property {AXbtPattern} eclipseMc + * @property {AXbtPattern} eightBaochi + * @property {AXbtPattern} ekanemBtc + * @property {AXbtPattern} eligius + * @property {AXbtPattern} emcdPool + * @property {AXbtPattern} entrustCharityPool + * @property {AXbtPattern} eobot + * @property {AXbtPattern} exxBw + * @property {AXbtPattern} f2Pool + * @property {AXbtPattern} fiftyEightCoin + * @property {AXbtPattern} foundryUsa + * @property {AXbtPattern} futureBitApolloSolo + * @property {AXbtPattern} gbMiners + * @property {AXbtPattern} ghashIo + * @property {AXbtPattern} giveMeCoins + * @property {AXbtPattern} goGreenLight + * @property {AXbtPattern} haoZhuZhu + * @property {AXbtPattern} haominer + * @property {AXbtPattern} hashBx + * @property {AXbtPattern} hashPool + * @property {AXbtPattern} helix + * @property {AXbtPattern} hhtt + * @property {AXbtPattern} hotPool + * @property {AXbtPattern} hummerpool + * @property {AXbtPattern} huobiPool + * @property {AXbtPattern} innopolisTech + * @property {AXbtPattern} kanoPool + * @property {AXbtPattern} kncMiner + * @property {AXbtPattern} kuCoinPool + * @property {AXbtPattern} lubianCom + * @property {AXbtPattern} luckyPool + * @property {AXbtPattern} luxor + * @property {AXbtPattern} maraPool + * @property {AXbtPattern} maxBtc + * @property {AXbtPattern} maxiPool + * @property {AXbtPattern} megaBigPower + * @property {AXbtPattern} minerium + * @property {AXbtPattern} miningCity + * @property {AXbtPattern} miningDutch + * @property {AXbtPattern} miningKings + * @property {AXbtPattern} miningSquared + * @property {AXbtPattern} mmpool + * @property {AXbtPattern} mtRed + * @property {AXbtPattern} multiCoinCo + * @property {AXbtPattern} multipool + * @property {AXbtPattern} myBtcCoinPool + * @property {AXbtPattern} neopool + * @property {AXbtPattern} nexious + * @property {AXbtPattern} niceHash + * @property {AXbtPattern} nmcBit + * @property {AXbtPattern} novaBlock + * @property {AXbtPattern} ocean + * @property {AXbtPattern} okExPool + * @property {AXbtPattern} okMiner + * @property {AXbtPattern} okkong + * @property {AXbtPattern} okpoolTop + * @property {AXbtPattern} oneHash + * @property {AXbtPattern} oneM1x + * @property {AXbtPattern} oneThash + * @property {AXbtPattern} ozCoin + * @property {AXbtPattern} pHashIo + * @property {AXbtPattern} parasite + * @property {AXbtPattern} patels + * @property {AXbtPattern} pegaPool + * @property {AXbtPattern} phoenix + * @property {AXbtPattern} polmine + * @property {AXbtPattern} pool175btc + * @property {AXbtPattern} pool50btc + * @property {AXbtPattern} poolin + * @property {AXbtPattern} portlandHodl + * @property {AXbtPattern} publicPool + * @property {AXbtPattern} pureBtcCom + * @property {AXbtPattern} rawpool + * @property {AXbtPattern} rigPool + * @property {AXbtPattern} sbiCrypto + * @property {AXbtPattern} secPool + * @property {AXbtPattern} secretSuperstar + * @property {AXbtPattern} sevenPool + * @property {AXbtPattern} shawnP0wers + * @property {AXbtPattern} sigmapoolCom + * @property {AXbtPattern} simplecoinUs + * @property {AXbtPattern} soloCk + * @property {AXbtPattern} spiderPool + * @property {AXbtPattern} stMiningCorp + * @property {AXbtPattern} tangpool + * @property {AXbtPattern} tatmasPool + * @property {AXbtPattern} tbDice + * @property {AXbtPattern} telco214 + * @property {AXbtPattern} terraPool + * @property {AXbtPattern} tiger + * @property {AXbtPattern} tigerpoolNet + * @property {AXbtPattern} titan + * @property {AXbtPattern} transactionCoinMining + * @property {AXbtPattern} trickysBtcPool + * @property {AXbtPattern} tripleMining + * @property {AXbtPattern} twentyOneInc + * @property {AXbtPattern} ultimusPool + * @property {AXbtPattern} unknown + * @property {AXbtPattern} unomp + * @property {AXbtPattern} viaBtc + * @property {AXbtPattern} waterhole + * @property {AXbtPattern} wayiCn + * @property {AXbtPattern} whitePool + * @property {AXbtPattern} wk057 + * @property {AXbtPattern} yourbtcNet + * @property {AXbtPattern} zulupool + */ + +/** + * @typedef {Object} CatalogTree_Computed_Price + * @property {Indexes3} priceClose + * @property {Indexes13} priceCloseInCents + * @property {Indexes3} priceCloseInSats + * @property {Indexes3} priceHigh + * @property {Indexes13} priceHighInCents + * @property {Indexes3} priceHighInSats + * @property {Indexes3} priceLow + * @property {Indexes13} priceLowInCents + * @property {Indexes3} priceLowInSats + * @property {Indexes3} priceOhlc + * @property {Indexes3} priceOhlcInSats + * @property {Indexes3} priceOpen + * @property {Indexes13} priceOpenInCents + * @property {Indexes3} priceOpenInSats + */ + +/** + * @typedef {Object} CatalogTree_Computed_Stateful + * @property {Indexes3} addrCount + * @property {CatalogTree_Computed_Stateful_AddressCohorts} addressCohorts + * @property {CatalogTree_Computed_Stateful_AddressesData} addressesData + * @property {AddresstypeToHeightToAddrCountPattern} addresstypeToHeightToAddrCount + * @property {AddresstypeToHeightToAddrCountPattern} addresstypeToHeightToEmptyAddrCount + * @property {AddresstypeToHeightToAddrCountPattern} addresstypeToIndexesToAddrCount + * @property {AddresstypeToHeightToAddrCountPattern} addresstypeToIndexesToEmptyAddrCount + * @property {AddresstypeToHeightToAddrCountPattern} anyAddressIndexes + * @property {Indexes2} chainState + * @property {Indexes3} emptyAddrCount + * @property {Indexes29} emptyaddressindex + * @property {Indexes30} loadedaddressindex + * @property {Indexes26} marketCap + * @property {SupplyPattern} opreturnSupply + * @property {SupplyPattern} unspendableSupply + * @property {CatalogTree_Computed_Stateful_UtxoCohorts} utxoCohorts + */ + +/** + * @typedef {Object} CatalogTree_Computed_Stateful_AddressCohorts + * @property {CatalogTree_Computed_Stateful_AddressCohorts_AmountRange} amountRange + * @property {CatalogTree_Computed_Stateful_AddressCohorts_GeAmount} geAmount + * @property {CatalogTree_Computed_Stateful_AddressCohorts_LtAmount} ltAmount + */ + +/** + * @typedef {Object} CatalogTree_Computed_Stateful_AddressCohorts_AmountRange + * @property {_0satsPattern} _0sats + * @property {_0satsPattern} _100btcTo1kBtc + * @property {_0satsPattern} _100kBtcOrMore + * @property {_0satsPattern} _100kSatsTo1mSats + * @property {_0satsPattern} _100satsTo1kSats + * @property {_0satsPattern} _10btcTo100btc + * @property {_0satsPattern} _10kBtcTo100kBtc + * @property {_0satsPattern} _10kSatsTo100kSats + * @property {_0satsPattern} _10mSatsTo1btc + * @property {_0satsPattern} _10satsTo100sats + * @property {_0satsPattern} _1btcTo10btc + * @property {_0satsPattern} _1kBtcTo10kBtc + * @property {_0satsPattern} _1kSatsTo10kSats + * @property {_0satsPattern} _1mSatsTo10mSats + * @property {_0satsPattern} _1satTo10sats + */ + +/** + * @typedef {Object} CatalogTree_Computed_Stateful_AddressCohorts_GeAmount + * @property {_0satsPattern} _100btc + * @property {_0satsPattern} _100kSats + * @property {_0satsPattern} _100sats + * @property {_0satsPattern} _10btc + * @property {_0satsPattern} _10kBtc + * @property {_0satsPattern} _10kSats + * @property {_0satsPattern} _10mSats + * @property {_0satsPattern} _10sats + * @property {_0satsPattern} _1btc + * @property {_0satsPattern} _1kBtc + * @property {_0satsPattern} _1kSats + * @property {_0satsPattern} _1mSats + * @property {_0satsPattern} _1sat + */ + +/** + * @typedef {Object} CatalogTree_Computed_Stateful_AddressCohorts_LtAmount + * @property {_0satsPattern} _100btc + * @property {_0satsPattern} _100kBtc + * @property {_0satsPattern} _100kSats + * @property {_0satsPattern} _100sats + * @property {_0satsPattern} _10btc + * @property {_0satsPattern} _10kBtc + * @property {_0satsPattern} _10kSats + * @property {_0satsPattern} _10mSats + * @property {_0satsPattern} _10sats + * @property {_0satsPattern} _1btc + * @property {_0satsPattern} _1kBtc + * @property {_0satsPattern} _1kSats + * @property {_0satsPattern} _1mSats + */ + +/** + * @typedef {Object} CatalogTree_Computed_Stateful_AddressesData + * @property {Indexes29} empty + * @property {Indexes30} loaded + */ + +/** + * @typedef {Object} CatalogTree_Computed_Stateful_UtxoCohorts + * @property {CatalogTree_Computed_Stateful_UtxoCohorts_AgeRange} ageRange + * @property {CatalogTree_Computed_Stateful_UtxoCohorts_All} all + * @property {CatalogTree_Computed_Stateful_UtxoCohorts_AmountRange} amountRange + * @property {CatalogTree_Computed_Stateful_UtxoCohorts_Epoch} epoch + * @property {CatalogTree_Computed_Stateful_UtxoCohorts_GeAmount} geAmount + * @property {CatalogTree_Computed_Stateful_UtxoCohorts_LtAmount} ltAmount + * @property {CatalogTree_Computed_Stateful_UtxoCohorts_MaxAge} maxAge + * @property {CatalogTree_Computed_Stateful_UtxoCohorts_MinAge} minAge + * @property {CatalogTree_Computed_Stateful_UtxoCohorts_Term} term + * @property {CatalogTree_Computed_Stateful_UtxoCohorts_Type} type + * @property {CatalogTree_Computed_Stateful_UtxoCohorts_Year} year + */ + +/** + * @typedef {Object} CatalogTree_Computed_Stateful_UtxoCohorts_AgeRange + * @property {_10yTo12yPattern} _10yTo12y + * @property {_10yTo12yPattern} _12yTo15y + * @property {_10yTo12yPattern} _1dTo1w + * @property {_10yTo12yPattern} _1mTo2m + * @property {_10yTo12yPattern} _1wTo1m + * @property {_10yTo12yPattern} _1yTo2y + * @property {_10yTo12yPattern} _2mTo3m + * @property {_10yTo12yPattern} _2yTo3y + * @property {_10yTo12yPattern} _3mTo4m + * @property {_10yTo12yPattern} _3yTo4y + * @property {_10yTo12yPattern} _4mTo5m + * @property {_10yTo12yPattern} _4yTo5y + * @property {_10yTo12yPattern} _5mTo6m + * @property {_10yTo12yPattern} _5yTo6y + * @property {_10yTo12yPattern} _6mTo1y + * @property {_10yTo12yPattern} _6yTo7y + * @property {_10yTo12yPattern} _7yTo8y + * @property {_10yTo12yPattern} _8yTo10y + * @property {_10yTo12yPattern} from15y + * @property {UpTo1dPattern} upTo1d + */ + +/** + * @typedef {Object} CatalogTree_Computed_Stateful_UtxoCohorts_All + * @property {ActivityPattern} activity + * @property {PricePaidPattern2} pricePaid + * @property {RealizedPattern3} realized + * @property {CatalogTree_Computed_Stateful_UtxoCohorts_All_Relative} relative + * @property {SupplyPattern2} supply + * @property {UnrealizedPattern} unrealized + */ + +/** + * @typedef {Object} CatalogTree_Computed_Stateful_UtxoCohorts_All_Relative + * @property {Indexes27} negUnrealizedLossRelToOwnTotalUnrealizedPnl + * @property {Indexes26} netUnrealizedPnlRelToOwnTotalUnrealizedPnl + * @property {Indexes27} supplyInLossRelToOwnSupply + * @property {Indexes27} supplyInProfitRelToOwnSupply + * @property {Indexes27} unrealizedLossRelToOwnTotalUnrealizedPnl + * @property {Indexes27} unrealizedProfitRelToOwnTotalUnrealizedPnl + */ + +/** + * @typedef {Object} CatalogTree_Computed_Stateful_UtxoCohorts_AmountRange + * @property {_0satsPattern2} _0sats + * @property {_0satsPattern2} _100btcTo1kBtc + * @property {_0satsPattern2} _100kBtcOrMore + * @property {_0satsPattern2} _100kSatsTo1mSats + * @property {_0satsPattern2} _100satsTo1kSats + * @property {_0satsPattern2} _10btcTo100btc + * @property {_0satsPattern2} _10kBtcTo100kBtc + * @property {_0satsPattern2} _10kSatsTo100kSats + * @property {_0satsPattern2} _10mSatsTo1btc + * @property {_0satsPattern2} _10satsTo100sats + * @property {_0satsPattern2} _1btcTo10btc + * @property {_0satsPattern2} _1kBtcTo10kBtc + * @property {_0satsPattern2} _1kSatsTo10kSats + * @property {_0satsPattern2} _1mSatsTo10mSats + * @property {_0satsPattern2} _1satTo10sats + */ + +/** + * @typedef {Object} CatalogTree_Computed_Stateful_UtxoCohorts_Epoch + * @property {_10yTo12yPattern} _0 + * @property {_10yTo12yPattern} _1 + * @property {_10yTo12yPattern} _2 + * @property {_10yTo12yPattern} _3 + * @property {_10yTo12yPattern} _4 + */ + +/** + * @typedef {Object} CatalogTree_Computed_Stateful_UtxoCohorts_GeAmount + * @property {_0satsPattern2} _100btc + * @property {_0satsPattern2} _100kSats + * @property {_0satsPattern2} _100sats + * @property {_0satsPattern2} _10btc + * @property {_0satsPattern2} _10kBtc + * @property {_0satsPattern2} _10kSats + * @property {_0satsPattern2} _10mSats + * @property {_0satsPattern2} _10sats + * @property {_0satsPattern2} _1btc + * @property {_0satsPattern2} _1kBtc + * @property {_0satsPattern2} _1kSats + * @property {_0satsPattern2} _1mSats + * @property {_0satsPattern2} _1sat + */ + +/** + * @typedef {Object} CatalogTree_Computed_Stateful_UtxoCohorts_LtAmount + * @property {_0satsPattern2} _100btc + * @property {_0satsPattern2} _100kBtc + * @property {_0satsPattern2} _100kSats + * @property {_0satsPattern2} _100sats + * @property {_0satsPattern2} _10btc + * @property {_0satsPattern2} _10kBtc + * @property {_0satsPattern2} _10kSats + * @property {_0satsPattern2} _10mSats + * @property {_0satsPattern2} _10sats + * @property {_0satsPattern2} _1btc + * @property {_0satsPattern2} _1kBtc + * @property {_0satsPattern2} _1kSats + * @property {_0satsPattern2} _1mSats + */ + +/** + * @typedef {Object} CatalogTree_Computed_Stateful_UtxoCohorts_MaxAge + * @property {UpTo1dPattern} _10y + * @property {UpTo1dPattern} _12y + * @property {UpTo1dPattern} _15y + * @property {UpTo1dPattern} _1m + * @property {UpTo1dPattern} _1w + * @property {UpTo1dPattern} _1y + * @property {UpTo1dPattern} _2m + * @property {UpTo1dPattern} _2y + * @property {UpTo1dPattern} _3m + * @property {UpTo1dPattern} _3y + * @property {UpTo1dPattern} _4m + * @property {UpTo1dPattern} _4y + * @property {UpTo1dPattern} _5m + * @property {UpTo1dPattern} _5y + * @property {UpTo1dPattern} _6m + * @property {UpTo1dPattern} _6y + * @property {UpTo1dPattern} _7y + * @property {UpTo1dPattern} _8y + */ + +/** + * @typedef {Object} CatalogTree_Computed_Stateful_UtxoCohorts_MinAge + * @property {_10yTo12yPattern} _10y + * @property {_10yTo12yPattern} _12y + * @property {_10yTo12yPattern} _1d + * @property {_10yTo12yPattern} _1m + * @property {_10yTo12yPattern} _1w + * @property {_10yTo12yPattern} _1y + * @property {_10yTo12yPattern} _2m + * @property {_10yTo12yPattern} _2y + * @property {_10yTo12yPattern} _3m + * @property {_10yTo12yPattern} _3y + * @property {_10yTo12yPattern} _4m + * @property {_10yTo12yPattern} _4y + * @property {_10yTo12yPattern} _5m + * @property {_10yTo12yPattern} _5y + * @property {_10yTo12yPattern} _6m + * @property {_10yTo12yPattern} _6y + * @property {_10yTo12yPattern} _7y + * @property {_10yTo12yPattern} _8y + */ + +/** + * @typedef {Object} CatalogTree_Computed_Stateful_UtxoCohorts_Term + * @property {UpTo1dPattern} long + * @property {UpTo1dPattern} short + */ + +/** + * @typedef {Object} CatalogTree_Computed_Stateful_UtxoCohorts_Type + * @property {_0satsPattern2} empty + * @property {_0satsPattern2} p2a + * @property {_0satsPattern2} p2ms + * @property {_0satsPattern2} p2pk33 + * @property {_0satsPattern2} p2pk65 + * @property {_0satsPattern2} p2pkh + * @property {_0satsPattern2} p2sh + * @property {_0satsPattern2} p2tr + * @property {_0satsPattern2} p2wpkh + * @property {_0satsPattern2} p2wsh + * @property {_0satsPattern2} unknown + */ + +/** + * @typedef {Object} CatalogTree_Computed_Stateful_UtxoCohorts_Year + * @property {_10yTo12yPattern} _2009 + * @property {_10yTo12yPattern} _2010 + * @property {_10yTo12yPattern} _2011 + * @property {_10yTo12yPattern} _2012 + * @property {_10yTo12yPattern} _2013 + * @property {_10yTo12yPattern} _2014 + * @property {_10yTo12yPattern} _2015 + * @property {_10yTo12yPattern} _2016 + * @property {_10yTo12yPattern} _2017 + * @property {_10yTo12yPattern} _2018 + * @property {_10yTo12yPattern} _2019 + * @property {_10yTo12yPattern} _2020 + * @property {_10yTo12yPattern} _2021 + * @property {_10yTo12yPattern} _2022 + * @property {_10yTo12yPattern} _2023 + * @property {_10yTo12yPattern} _2024 + * @property {_10yTo12yPattern} _2025 + * @property {_10yTo12yPattern} _2026 + */ + +/** + * @typedef {Object} CatalogTree_Computed_Txins + * @property {Indexes24} txoutindex + * @property {Indexes24} value + */ + +/** + * @typedef {Object} CatalogTree_Computed_Txouts + * @property {Indexes25} txinindex + */ + +/** + * @typedef {Object} CatalogTree_Indexed + * @property {CatalogTree_Indexed_Address} address + * @property {CatalogTree_Indexed_Block} block + * @property {CatalogTree_Indexed_Output} output + * @property {CatalogTree_Indexed_Tx} tx + * @property {CatalogTree_Indexed_Txin} txin + * @property {CatalogTree_Indexed_Txout} txout + */ + +/** + * @typedef {Object} CatalogTree_Indexed_Address + * @property {Indexes2} firstP2aaddressindex + * @property {Indexes2} firstP2pk33addressindex + * @property {Indexes2} firstP2pk65addressindex + * @property {Indexes2} firstP2pkhaddressindex + * @property {Indexes2} firstP2shaddressindex + * @property {Indexes2} firstP2traddressindex + * @property {Indexes2} firstP2wpkhaddressindex + * @property {Indexes2} firstP2wshaddressindex + * @property {Indexes16} p2abytes + * @property {Indexes17} p2pk33bytes + * @property {Indexes18} p2pk65bytes + * @property {Indexes19} p2pkhbytes + * @property {Indexes20} p2shbytes + * @property {Indexes21} p2trbytes + * @property {Indexes22} p2wpkhbytes + * @property {Indexes23} p2wshbytes + */ + +/** + * @typedef {Object} CatalogTree_Indexed_Block + * @property {Indexes2} blockhash + * @property {Indexes2} difficulty + * @property {Indexes2} timestamp + * @property {Indexes2} totalSize + * @property {Indexes2} weight + */ + +/** + * @typedef {Object} CatalogTree_Indexed_Output + * @property {Indexes2} firstEmptyoutputindex + * @property {Indexes2} firstOpreturnindex + * @property {Indexes2} firstP2msoutputindex + * @property {Indexes2} firstUnknownoutputindex + * @property {MetricNode} txindex + */ + +/** + * @typedef {Object} CatalogTree_Indexed_Tx + * @property {Indexes6} baseSize + * @property {Indexes2} firstTxindex + * @property {Indexes6} firstTxinindex + * @property {Indexes6} firstTxoutindex + * @property {Indexes6} height + * @property {Indexes6} isExplicitlyRbf + * @property {Indexes6} rawlocktime + * @property {Indexes6} totalSize + * @property {Indexes6} txid + * @property {Indexes6} txversion + */ + +/** + * @typedef {Object} CatalogTree_Indexed_Txin + * @property {Indexes2} firstTxinindex + * @property {Indexes24} outpoint + * @property {Indexes24} outputtype + * @property {Indexes24} txindex + * @property {Indexes24} typeindex + */ + +/** + * @typedef {Object} CatalogTree_Indexed_Txout + * @property {Indexes2} firstTxoutindex + * @property {Indexes25} outputtype + * @property {Indexes25} txindex + * @property {Indexes25} typeindex + * @property {Indexes25} value + */ + +/** + * Main BRK client with catalog tree and API methods + * @extends BrkClientBase + */ +class BrkClient extends BrkClientBase { + /** + * @param {BrkClientOptions|string} options + */ + constructor(options) { + super(options); + /** @type {CatalogTree} */ + this.tree = this._buildTree(''); + } + + /** + * @private + * @param {string} basePath + * @returns {CatalogTree} + */ + _buildTree(basePath) { + return { + computed: { + blks: { + position: new MetricNode(this, '/position') + }, + chain: { + _1mBlockCount: createIndexes(this, '/1m_block_count'), + _1wBlockCount: createIndexes(this, '/1w_block_count'), + _1yBlockCount: createIndexes(this, '/1y_block_count'), + _24hBlockCount: createIndexes2(this, '/24h_block_count'), + _24hCoinbaseSum: createIndexes2(this, '/24h_coinbase_sum'), + _24hCoinbaseUsdSum: createIndexes2(this, '/24h_coinbase_usd_sum'), + annualizedVolume: createIndexes(this, '/annualized_volume'), + annualizedVolumeBtc: createIndexes(this, '/annualized_volume_btc'), + annualizedVolumeUsd: createIndexes(this, '/annualized_volume_usd'), + blockCount: createBlockCountPattern(this, 'computed_chain/block_count'), + blockCountTarget: createIndexes(this, '/block_count_target'), + blockInterval: createBlockIntervalPattern(this, 'block_interval'), + blockSize: createBlockSizePattern(this, 'computed_chain/block_size'), + blockVbytes: createBlockSizePattern(this, 'computed_chain/block_vbytes'), + blockWeight: createBlockSizePattern(this, 'computed_chain/block_weight'), + blocksBeforeNextDifficultyAdjustment: createIndexes3(this, '/blocks_before_next_difficulty_adjustment'), + blocksBeforeNextHalving: createIndexes3(this, '/blocks_before_next_halving'), + coinbase: createCoinbasePattern(this, 'computed_chain/coinbase'), + daysBeforeNextDifficultyAdjustment: createIndexes3(this, '/days_before_next_difficulty_adjustment'), + daysBeforeNextHalving: createIndexes3(this, '/days_before_next_halving'), + difficulty: createIndexes4(this, '/difficulty'), + difficultyAdjustment: createIndexes3(this, '/difficulty_adjustment'), + difficultyAsHash: createIndexes3(this, '/difficulty_as_hash'), + difficultyepoch: createIndexes(this, '/difficultyepoch'), + emptyoutputCount: createBitcoinPattern(this, 'computed_chain/emptyoutput_count'), + exactUtxoCount: createIndexes3(this, '/exact_utxo_count'), + fee: { + base: createIndexes6(this, '/fee'), + bitcoin: createBlockSizePattern(this, 'fee/bitcoin'), + bitcoinTxindex: createIndexes6(this, '/fee_btc'), + dollars: createBlockSizePattern(this, 'fee/dollars'), + dollarsTxindex: createIndexes6(this, '/fee_usd'), + sats: createBlockSizePattern(this, 'fee/sats') + }, + feeDominance: createIndexes5(this, '/fee_dominance'), + feeRate: { + average: createIndexes3(this, '/fee_rate_avg'), + base: createIndexes6(this, '/fee_rate'), + max: createIndexes3(this, '/fee_rate_max'), + median: createIndexes2(this, '/fee_rate_median'), + min: createIndexes3(this, '/fee_rate_min'), + pct10: createIndexes2(this, '/fee_rate_pct10'), + pct25: createIndexes2(this, '/fee_rate_pct25'), + pct75: createIndexes2(this, '/fee_rate_pct75'), + pct90: createIndexes2(this, '/fee_rate_pct90') + }, + halvingepoch: createIndexes(this, '/halvingepoch'), + hashPricePhs: createIndexes3(this, '/hash_price_phs'), + hashPricePhsMin: createIndexes3(this, '/hash_price_phs_min'), + hashPriceRebound: createIndexes3(this, '/hash_price_rebound'), + hashPriceThs: createIndexes3(this, '/hash_price_ths'), + hashPriceThsMin: createIndexes3(this, '/hash_price_ths_min'), + hashRate: createIndexes3(this, '/hash_rate'), + hashRate1mSma: createIndexes(this, '/hash_rate_1m_sma'), + hashRate1wSma: createIndexes(this, '/hash_rate_1w_sma'), + hashRate1ySma: createIndexes(this, '/hash_rate_1y_sma'), + hashRate2mSma: createIndexes(this, '/hash_rate_2m_sma'), + hashValuePhs: createIndexes3(this, '/hash_value_phs'), + hashValuePhsMin: createIndexes3(this, '/hash_value_phs_min'), + hashValueRebound: createIndexes3(this, '/hash_value_rebound'), + hashValueThs: createIndexes3(this, '/hash_value_ths'), + hashValueThsMin: createIndexes3(this, '/hash_value_ths_min'), + inflationRate: createIndexes(this, '/inflation_rate'), + inputCount: createBlockSizePattern(this, 'computed_chain/input_count'), + inputValue: createIndexes6(this, '/input_value'), + inputsPerSec: createIndexes(this, '/inputs_per_sec'), + interval: createIndexes2(this, '/interval'), + isCoinbase: createIndexes6(this, '/is_coinbase'), + opreturnCount: createBitcoinPattern(this, 'computed_chain/opreturn_count'), + outputCount: createBlockSizePattern(this, 'computed_chain/output_count'), + outputValue: createIndexes6(this, '/output_value'), + outputsPerSec: createIndexes(this, '/outputs_per_sec'), + p2aCount: createBitcoinPattern(this, 'computed_chain/p2a_count'), + p2msCount: createBitcoinPattern(this, 'computed_chain/p2ms_count'), + p2pk33Count: createBitcoinPattern(this, 'computed_chain/p2pk33_count'), + p2pk65Count: createBitcoinPattern(this, 'computed_chain/p2pk65_count'), + p2pkhCount: createBitcoinPattern(this, 'computed_chain/p2pkh_count'), + p2shCount: createBitcoinPattern(this, 'computed_chain/p2sh_count'), + p2trCount: createBitcoinPattern(this, 'computed_chain/p2tr_count'), + p2wpkhCount: createBitcoinPattern(this, 'computed_chain/p2wpkh_count'), + p2wshCount: createBitcoinPattern(this, 'computed_chain/p2wsh_count'), + puellMultiple: createIndexes(this, '/puell_multiple'), + sentSum: { + bitcoin: createBitcoinPattern2(this, 'sent_sum/bitcoin'), + dollars: createIndexes3(this, '/sent_sum_usd'), + sats: createIndexes3(this, '/sent_sum') + }, + subsidy: createCoinbasePattern(this, 'computed_chain/subsidy'), + subsidyDominance: createIndexes5(this, '/subsidy_dominance'), + subsidyUsd1ySma: createIndexes(this, '/subsidy_usd_1y_sma'), + timestamp: new MetricNode(this, '/timestamp'), + txBtcVelocity: createIndexes(this, '/tx_btc_velocity'), + txCount: createBitcoinPattern(this, 'computed_chain/tx_count'), + txPerSec: createIndexes(this, '/tx_per_sec'), + txUsdVelocity: createIndexes(this, '/tx_usd_velocity'), + txV1: createBlockCountPattern(this, 'computed_chain/tx_v1'), + txV2: createBlockCountPattern(this, 'computed_chain/tx_v2'), + txV3: createBlockCountPattern(this, 'computed_chain/tx_v3'), + txVsize: createBlockIntervalPattern(this, 'tx_vsize'), + txWeight: createBlockIntervalPattern(this, 'tx_weight'), + unclaimedRewards: createUnclaimedRewardsPattern(this, 'computed_chain/unclaimed_rewards'), + unknownoutputCount: createBitcoinPattern(this, 'computed_chain/unknownoutput_count'), + vbytes: createIndexes2(this, '/vbytes'), + vsize: createIndexes6(this, '/vsize'), + weight: createIndexes6(this, '/weight') + }, + cointime: { + activeCap: createIndexes3(this, '/active_cap'), + activePrice: createIndexes3(this, '/active_price'), + activePriceRatio: createActivePriceRatioPattern(this, 'computed_cointime/active_price_ratio'), + activeSupply: createActiveSupplyPattern(this, 'computed_cointime/active_supply'), + activityToVaultednessRatio: createIndexes3(this, '/activity_to_vaultedness_ratio'), + coinblocksCreated: createBlockCountPattern(this, 'computed_cointime/coinblocks_created'), + coinblocksStored: createBlockCountPattern(this, 'computed_cointime/coinblocks_stored'), + cointimeAdjInflationRate: createIndexes(this, '/cointime_adj_inflation_rate'), + cointimeAdjTxBtcVelocity: createIndexes(this, '/cointime_adj_tx_btc_velocity'), + cointimeAdjTxUsdVelocity: createIndexes(this, '/cointime_adj_tx_usd_velocity'), + cointimeCap: createIndexes3(this, '/cointime_cap'), + cointimePrice: createIndexes3(this, '/cointime_price'), + cointimePriceRatio: createActivePriceRatioPattern(this, 'computed_cointime/cointime_price_ratio'), + cointimeValueCreated: createBlockCountPattern(this, 'computed_cointime/cointime_value_created'), + cointimeValueDestroyed: createBlockCountPattern(this, 'computed_cointime/cointime_value_destroyed'), + cointimeValueStored: createBlockCountPattern(this, 'computed_cointime/cointime_value_stored'), + investorCap: createIndexes3(this, '/investor_cap'), + liveliness: createIndexes3(this, '/liveliness'), + thermoCap: createIndexes3(this, '/thermo_cap'), + trueMarketMean: createIndexes3(this, '/true_market_mean'), + trueMarketMeanRatio: createActivePriceRatioPattern(this, 'computed_cointime/true_market_mean_ratio'), + vaultedCap: createIndexes3(this, '/vaulted_cap'), + vaultedPrice: createIndexes3(this, '/vaulted_price'), + vaultedPriceRatio: createActivePriceRatioPattern(this, 'computed_cointime/vaulted_price_ratio'), + vaultedSupply: createActiveSupplyPattern(this, 'computed_cointime/vaulted_supply'), + vaultedness: createIndexes3(this, '/vaultedness') + }, + constants: { + constant0: createConstant0Pattern(this, 'constant_0'), + constant1: createConstant0Pattern(this, 'constant_1'), + constant100: createConstant0Pattern(this, 'constant_100'), + constant2: createConstant0Pattern(this, 'constant_2'), + constant3: createConstant0Pattern(this, 'constant_3'), + constant382: createConstant0Pattern(this, 'constant_38_2'), + constant4: createConstant0Pattern(this, 'constant_4'), + constant50: createConstant0Pattern(this, 'constant_50'), + constant600: createConstant0Pattern(this, 'constant_600'), + constant618: createConstant0Pattern(this, 'constant_61_8'), + constantMinus1: createConstant0Pattern(this, 'constant_minus_1'), + constantMinus2: createConstant0Pattern(this, 'constant_minus_2'), + constantMinus3: createConstant0Pattern(this, 'constant_minus_3'), + constantMinus4: createConstant0Pattern(this, 'constant_minus_4') + }, + fetched: { + priceOhlcInCents: createIndexes13(this, '/price_ohlc_in_cents') + }, + indexes: { + date: createIndexes13(this, '/date'), + dateFixed: createIndexes2(this, '/date_fixed'), + dateindex: createIndexes13(this, '/dateindex'), + dateindexCount: createIndexes14(this, '/dateindex_count'), + decadeindex: new MetricNode(this, '/decadeindex'), + difficultyepoch: new MetricNode(this, '/difficultyepoch'), + emptyoutputindex: new MetricNode(this, '/emptyoutputindex'), + firstDateindex: createIndexes14(this, '/first_dateindex'), + firstHeight: new MetricNode(this, '/first_height'), + firstMonthindex: createIndexes15(this, '/first_monthindex'), + firstYearindex: createIndexes7(this, '/first_yearindex'), + halvingepoch: new MetricNode(this, '/halvingepoch'), + height: createIndexes2(this, '/height'), + heightCount: new MetricNode(this, '/height_count'), + inputCount: createIndexes6(this, '/input_count'), + monthindex: new MetricNode(this, '/monthindex'), + monthindexCount: createIndexes15(this, '/monthindex_count'), + opreturnindex: new MetricNode(this, '/opreturnindex'), + outputCount: createIndexes6(this, '/output_count'), + p2aaddressindex: createIndexes16(this, '/p2aaddressindex'), + p2msoutputindex: new MetricNode(this, '/p2msoutputindex'), + p2pk33addressindex: createIndexes17(this, '/p2pk33addressindex'), + p2pk65addressindex: createIndexes18(this, '/p2pk65addressindex'), + p2pkhaddressindex: createIndexes19(this, '/p2pkhaddressindex'), + p2shaddressindex: createIndexes20(this, '/p2shaddressindex'), + p2traddressindex: createIndexes21(this, '/p2traddressindex'), + p2wpkhaddressindex: createIndexes22(this, '/p2wpkhaddressindex'), + p2wshaddressindex: createIndexes23(this, '/p2wshaddressindex'), + quarterindex: new MetricNode(this, '/quarterindex'), + semesterindex: new MetricNode(this, '/semesterindex'), + timestampFixed: createIndexes2(this, '/timestamp_fixed'), + txindex: createIndexes6(this, '/txindex'), + txindexCount: createIndexes2(this, '/txindex_count'), + txinindex: createIndexes24(this, '/txinindex'), + txoutindex: createIndexes25(this, '/txoutindex'), + unknownoutputindex: new MetricNode(this, '/unknownoutputindex'), + weekindex: new MetricNode(this, '/weekindex'), + yearindex: new MetricNode(this, '/yearindex'), + yearindexCount: createIndexes7(this, '/yearindex_count') + }, + market: { + _1dReturns1mSd: create_1dReturns1mSdPattern(this, '1d_returns_1m_sd'), + _1dReturns1wSd: create_1dReturns1mSdPattern(this, '1d_returns_1w_sd'), + _1dReturns1ySd: create_1dReturns1mSdPattern(this, '1d_returns_1y_sd'), + _10yCagr: createIndexes(this, '/10y_cagr'), + _10yDcaAvgPrice: createIndexes(this, '/10y_dca_avg_price'), + _10yDcaCagr: createIndexes(this, '/10y_dca_cagr'), + _10yDcaReturns: createIndexes(this, '/10y_dca_returns'), + _10yDcaStack: createIndexes(this, '/10y_dca_stack'), + _10yPriceReturns: createIndexes(this, '/10y_price_returns'), + _1dPriceReturns: createIndexes(this, '/1d_price_returns'), + _1mDcaAvgPrice: createIndexes(this, '/1m_dca_avg_price'), + _1mDcaReturns: createIndexes(this, '/1m_dca_returns'), + _1mDcaStack: createIndexes(this, '/1m_dca_stack'), + _1mPriceReturns: createIndexes(this, '/1m_price_returns'), + _1wDcaAvgPrice: createIndexes(this, '/1w_dca_avg_price'), + _1wDcaReturns: createIndexes(this, '/1w_dca_returns'), + _1wDcaStack: createIndexes(this, '/1w_dca_stack'), + _1wPriceReturns: createIndexes(this, '/1w_price_returns'), + _1yDcaAvgPrice: createIndexes(this, '/1y_dca_avg_price'), + _1yDcaReturns: createIndexes(this, '/1y_dca_returns'), + _1yDcaStack: createIndexes(this, '/1y_dca_stack'), + _1yPriceReturns: createIndexes(this, '/1y_price_returns'), + _2yCagr: createIndexes(this, '/2y_cagr'), + _2yDcaAvgPrice: createIndexes(this, '/2y_dca_avg_price'), + _2yDcaCagr: createIndexes(this, '/2y_dca_cagr'), + _2yDcaReturns: createIndexes(this, '/2y_dca_returns'), + _2yDcaStack: createIndexes(this, '/2y_dca_stack'), + _2yPriceReturns: createIndexes(this, '/2y_price_returns'), + _3mDcaAvgPrice: createIndexes(this, '/3m_dca_avg_price'), + _3mDcaReturns: createIndexes(this, '/3m_dca_returns'), + _3mDcaStack: createIndexes(this, '/3m_dca_stack'), + _3mPriceReturns: createIndexes(this, '/3m_price_returns'), + _3yCagr: createIndexes(this, '/3y_cagr'), + _3yDcaAvgPrice: createIndexes(this, '/3y_dca_avg_price'), + _3yDcaCagr: createIndexes(this, '/3y_dca_cagr'), + _3yDcaReturns: createIndexes(this, '/3y_dca_returns'), + _3yDcaStack: createIndexes(this, '/3y_dca_stack'), + _3yPriceReturns: createIndexes(this, '/3y_price_returns'), + _4yCagr: createIndexes(this, '/4y_cagr'), + _4yDcaAvgPrice: createIndexes(this, '/4y_dca_avg_price'), + _4yDcaCagr: createIndexes(this, '/4y_dca_cagr'), + _4yDcaReturns: createIndexes(this, '/4y_dca_returns'), + _4yDcaStack: createIndexes(this, '/4y_dca_stack'), + _4yPriceReturns: createIndexes(this, '/4y_price_returns'), + _5yCagr: createIndexes(this, '/5y_cagr'), + _5yDcaAvgPrice: createIndexes(this, '/5y_dca_avg_price'), + _5yDcaCagr: createIndexes(this, '/5y_dca_cagr'), + _5yDcaReturns: createIndexes(this, '/5y_dca_returns'), + _5yDcaStack: createIndexes(this, '/5y_dca_stack'), + _5yPriceReturns: createIndexes(this, '/5y_price_returns'), + _6mDcaAvgPrice: createIndexes(this, '/6m_dca_avg_price'), + _6mDcaReturns: createIndexes(this, '/6m_dca_returns'), + _6mDcaStack: createIndexes(this, '/6m_dca_stack'), + _6mPriceReturns: createIndexes(this, '/6m_price_returns'), + _6yCagr: createIndexes(this, '/6y_cagr'), + _6yDcaAvgPrice: createIndexes(this, '/6y_dca_avg_price'), + _6yDcaCagr: createIndexes(this, '/6y_dca_cagr'), + _6yDcaReturns: createIndexes(this, '/6y_dca_returns'), + _6yDcaStack: createIndexes(this, '/6y_dca_stack'), + _6yPriceReturns: createIndexes(this, '/6y_price_returns'), + _8yCagr: createIndexes(this, '/8y_cagr'), + _8yDcaAvgPrice: createIndexes(this, '/8y_dca_avg_price'), + _8yDcaCagr: createIndexes(this, '/8y_dca_cagr'), + _8yDcaReturns: createIndexes(this, '/8y_dca_returns'), + _8yDcaStack: createIndexes(this, '/8y_dca_stack'), + _8yPriceReturns: createIndexes(this, '/8y_price_returns'), + daysSincePriceAth: createIndexes(this, '/days_since_price_ath'), + dcaClass2015AvgPrice: createIndexes(this, '/dca_class_2015_avg_price'), + dcaClass2015Returns: createIndexes(this, '/dca_class_2015_returns'), + dcaClass2015Stack: createIndexes(this, '/dca_class_2015_stack'), + dcaClass2016AvgPrice: createIndexes(this, '/dca_class_2016_avg_price'), + dcaClass2016Returns: createIndexes(this, '/dca_class_2016_returns'), + dcaClass2016Stack: createIndexes(this, '/dca_class_2016_stack'), + dcaClass2017AvgPrice: createIndexes(this, '/dca_class_2017_avg_price'), + dcaClass2017Returns: createIndexes(this, '/dca_class_2017_returns'), + dcaClass2017Stack: createIndexes(this, '/dca_class_2017_stack'), + dcaClass2018AvgPrice: createIndexes(this, '/dca_class_2018_avg_price'), + dcaClass2018Returns: createIndexes(this, '/dca_class_2018_returns'), + dcaClass2018Stack: createIndexes(this, '/dca_class_2018_stack'), + dcaClass2019AvgPrice: createIndexes(this, '/dca_class_2019_avg_price'), + dcaClass2019Returns: createIndexes(this, '/dca_class_2019_returns'), + dcaClass2019Stack: createIndexes(this, '/dca_class_2019_stack'), + dcaClass2020AvgPrice: createIndexes(this, '/dca_class_2020_avg_price'), + dcaClass2020Returns: createIndexes(this, '/dca_class_2020_returns'), + dcaClass2020Stack: createIndexes(this, '/dca_class_2020_stack'), + dcaClass2021AvgPrice: createIndexes(this, '/dca_class_2021_avg_price'), + dcaClass2021Returns: createIndexes(this, '/dca_class_2021_returns'), + dcaClass2021Stack: createIndexes(this, '/dca_class_2021_stack'), + dcaClass2022AvgPrice: createIndexes(this, '/dca_class_2022_avg_price'), + dcaClass2022Returns: createIndexes(this, '/dca_class_2022_returns'), + dcaClass2022Stack: createIndexes(this, '/dca_class_2022_stack'), + dcaClass2023AvgPrice: createIndexes(this, '/dca_class_2023_avg_price'), + dcaClass2023Returns: createIndexes(this, '/dca_class_2023_returns'), + dcaClass2023Stack: createIndexes(this, '/dca_class_2023_stack'), + dcaClass2024AvgPrice: createIndexes(this, '/dca_class_2024_avg_price'), + dcaClass2024Returns: createIndexes(this, '/dca_class_2024_returns'), + dcaClass2024Stack: createIndexes(this, '/dca_class_2024_stack'), + dcaClass2025AvgPrice: createIndexes(this, '/dca_class_2025_avg_price'), + dcaClass2025Returns: createIndexes(this, '/dca_class_2025_returns'), + dcaClass2025Stack: createIndexes(this, '/dca_class_2025_stack'), + maxDaysBetweenPriceAths: createIndexes(this, '/max_days_between_price_aths'), + maxYearsBetweenPriceAths: createIndexes(this, '/max_years_between_price_aths'), + price10yAgo: createIndexes(this, '/price_10y_ago'), + price13dEma: createPrice13dEmaPattern(this, 'price_13d_ema'), + price13dSma: createPrice13dEmaPattern(this, 'price_13d_sma'), + price144dEma: createPrice13dEmaPattern(this, 'price_144d_ema'), + price144dSma: createPrice13dEmaPattern(this, 'price_144d_sma'), + price1dAgo: createIndexes(this, '/price_1d_ago'), + price1mAgo: createIndexes(this, '/price_1m_ago'), + price1mEma: createPrice13dEmaPattern(this, 'price_1m_ema'), + price1mMax: createIndexes(this, '/price_1m_max'), + price1mMin: createIndexes(this, '/price_1m_min'), + price1mSma: createPrice13dEmaPattern(this, 'price_1m_sma'), + price1mVolatility: createIndexes(this, '/price_1m_volatility'), + price1wAgo: createIndexes(this, '/price_1w_ago'), + price1wEma: createPrice13dEmaPattern(this, 'price_1w_ema'), + price1wMax: createIndexes(this, '/price_1w_max'), + price1wMin: createIndexes(this, '/price_1w_min'), + price1wSma: createPrice13dEmaPattern(this, 'price_1w_sma'), + price1wVolatility: createIndexes(this, '/price_1w_volatility'), + price1yAgo: createIndexes(this, '/price_1y_ago'), + price1yEma: createPrice13dEmaPattern(this, 'price_1y_ema'), + price1yMax: createIndexes(this, '/price_1y_max'), + price1yMin: createIndexes(this, '/price_1y_min'), + price1ySma: createPrice13dEmaPattern(this, 'price_1y_sma'), + price1yVolatility: createIndexes(this, '/price_1y_volatility'), + price200dEma: createPrice13dEmaPattern(this, 'price_200d_ema'), + price200dSma: createPrice13dEmaPattern(this, 'price_200d_sma'), + price200dSmaX08: createIndexes(this, '/price_200d_sma_x0_8'), + price200dSmaX24: createIndexes(this, '/price_200d_sma_x2_4'), + price200wEma: createPrice13dEmaPattern(this, 'price_200w_ema'), + price200wSma: createPrice13dEmaPattern(this, 'price_200w_sma'), + price21dEma: createPrice13dEmaPattern(this, 'price_21d_ema'), + price21dSma: createPrice13dEmaPattern(this, 'price_21d_sma'), + price2wChoppinessIndex: createIndexes(this, '/price_2w_choppiness_index'), + price2wMax: createIndexes(this, '/price_2w_max'), + price2wMin: createIndexes(this, '/price_2w_min'), + price2yAgo: createIndexes(this, '/price_2y_ago'), + price2yEma: createPrice13dEmaPattern(this, 'price_2y_ema'), + price2ySma: createPrice13dEmaPattern(this, 'price_2y_sma'), + price34dEma: createPrice13dEmaPattern(this, 'price_34d_ema'), + price34dSma: createPrice13dEmaPattern(this, 'price_34d_sma'), + price3mAgo: createIndexes(this, '/price_3m_ago'), + price3yAgo: createIndexes(this, '/price_3y_ago'), + price4yAgo: createIndexes(this, '/price_4y_ago'), + price4yEma: createPrice13dEmaPattern(this, 'price_4y_ema'), + price4ySma: createPrice13dEmaPattern(this, 'price_4y_sma'), + price55dEma: createPrice13dEmaPattern(this, 'price_55d_ema'), + price55dSma: createPrice13dEmaPattern(this, 'price_55d_sma'), + price5yAgo: createIndexes(this, '/price_5y_ago'), + price6mAgo: createIndexes(this, '/price_6m_ago'), + price6yAgo: createIndexes(this, '/price_6y_ago'), + price89dEma: createPrice13dEmaPattern(this, 'price_89d_ema'), + price89dSma: createPrice13dEmaPattern(this, 'price_89d_sma'), + price8dEma: createPrice13dEmaPattern(this, 'price_8d_ema'), + price8dSma: createPrice13dEmaPattern(this, 'price_8d_sma'), + price8yAgo: createIndexes(this, '/price_8y_ago'), + priceAth: createIndexes26(this, '/price_ath'), + priceDrawdown: createIndexes26(this, '/price_drawdown'), + priceTrueRange: createIndexes5(this, '/price_true_range'), + priceTrueRange2wSum: createIndexes5(this, '/price_true_range_2w_sum') + }, + pools: { + pool: createIndexes2(this, '/pool'), + vecs: { + aXbt: createAXbtPattern(this, 'computed_pools_vecs/AXbt'), + aaoPool: createAXbtPattern(this, 'computed_pools_vecs/AaoPool'), + antPool: createAXbtPattern(this, 'computed_pools_vecs/AntPool'), + arkPool: createAXbtPattern(this, 'computed_pools_vecs/ArkPool'), + asicMiner: createAXbtPattern(this, 'computed_pools_vecs/AsicMiner'), + batPool: createAXbtPattern(this, 'computed_pools_vecs/BatPool'), + bcMonster: createAXbtPattern(this, 'computed_pools_vecs/BcMonster'), + bcpoolIo: createAXbtPattern(this, 'computed_pools_vecs/BcpoolIo'), + binancePool: createAXbtPattern(this, 'computed_pools_vecs/BinancePool'), + bitClub: createAXbtPattern(this, 'computed_pools_vecs/BitClub'), + bitFuFuPool: createAXbtPattern(this, 'computed_pools_vecs/BitFuFuPool'), + bitFury: createAXbtPattern(this, 'computed_pools_vecs/BitFury'), + bitMinter: createAXbtPattern(this, 'computed_pools_vecs/BitMinter'), + bitalo: createAXbtPattern(this, 'computed_pools_vecs/Bitalo'), + bitcoinAffiliateNetwork: createAXbtPattern(this, 'computed_pools_vecs/BitcoinAffiliateNetwork'), + bitcoinCom: createAXbtPattern(this, 'computed_pools_vecs/BitcoinCom'), + bitcoinIndia: createAXbtPattern(this, 'computed_pools_vecs/BitcoinIndia'), + bitcoinRussia: createAXbtPattern(this, 'computed_pools_vecs/BitcoinRussia'), + bitcoinUkraine: createAXbtPattern(this, 'computed_pools_vecs/BitcoinUkraine'), + bitfarms: createAXbtPattern(this, 'computed_pools_vecs/Bitfarms'), + bitparking: createAXbtPattern(this, 'computed_pools_vecs/Bitparking'), + bitsolo: createAXbtPattern(this, 'computed_pools_vecs/Bitsolo'), + bixin: createAXbtPattern(this, 'computed_pools_vecs/Bixin'), + blockFills: createAXbtPattern(this, 'computed_pools_vecs/BlockFills'), + braiinsPool: createAXbtPattern(this, 'computed_pools_vecs/BraiinsPool'), + bravoMining: createAXbtPattern(this, 'computed_pools_vecs/BravoMining'), + btPool: createAXbtPattern(this, 'computed_pools_vecs/BtPool'), + btcCom: createAXbtPattern(this, 'computed_pools_vecs/BtcCom'), + btcDig: createAXbtPattern(this, 'computed_pools_vecs/BtcDig'), + btcGuild: createAXbtPattern(this, 'computed_pools_vecs/BtcGuild'), + btcLab: createAXbtPattern(this, 'computed_pools_vecs/BtcLab'), + btcMp: createAXbtPattern(this, 'computed_pools_vecs/BtcMp'), + btcNuggets: createAXbtPattern(this, 'computed_pools_vecs/BtcNuggets'), + btcPoolParty: createAXbtPattern(this, 'computed_pools_vecs/BtcPoolParty'), + btcServ: createAXbtPattern(this, 'computed_pools_vecs/BtcServ'), + btcTop: createAXbtPattern(this, 'computed_pools_vecs/BtcTop'), + btcc: createAXbtPattern(this, 'computed_pools_vecs/Btcc'), + bwPool: createAXbtPattern(this, 'computed_pools_vecs/BwPool'), + bytePool: createAXbtPattern(this, 'computed_pools_vecs/BytePool'), + canoe: createAXbtPattern(this, 'computed_pools_vecs/Canoe'), + canoePool: createAXbtPattern(this, 'computed_pools_vecs/CanoePool'), + carbonNegative: createAXbtPattern(this, 'computed_pools_vecs/CarbonNegative'), + ckPool: createAXbtPattern(this, 'computed_pools_vecs/CkPool'), + cloudHashing: createAXbtPattern(this, 'computed_pools_vecs/CloudHashing'), + coinLab: createAXbtPattern(this, 'computed_pools_vecs/CoinLab'), + cointerra: createAXbtPattern(this, 'computed_pools_vecs/Cointerra'), + connectBtc: createAXbtPattern(this, 'computed_pools_vecs/ConnectBtc'), + dPool: createAXbtPattern(this, 'computed_pools_vecs/DPool'), + dcExploration: createAXbtPattern(this, 'computed_pools_vecs/DcExploration'), + dcex: createAXbtPattern(this, 'computed_pools_vecs/Dcex'), + digitalBtc: createAXbtPattern(this, 'computed_pools_vecs/DigitalBtc'), + digitalXMintsy: createAXbtPattern(this, 'computed_pools_vecs/DigitalXMintsy'), + eclipseMc: createAXbtPattern(this, 'computed_pools_vecs/EclipseMc'), + eightBaochi: createAXbtPattern(this, 'computed_pools_vecs/EightBaochi'), + ekanemBtc: createAXbtPattern(this, 'computed_pools_vecs/EkanemBtc'), + eligius: createAXbtPattern(this, 'computed_pools_vecs/Eligius'), + emcdPool: createAXbtPattern(this, 'computed_pools_vecs/EmcdPool'), + entrustCharityPool: createAXbtPattern(this, 'computed_pools_vecs/EntrustCharityPool'), + eobot: createAXbtPattern(this, 'computed_pools_vecs/Eobot'), + exxBw: createAXbtPattern(this, 'computed_pools_vecs/ExxBw'), + f2Pool: createAXbtPattern(this, 'computed_pools_vecs/F2Pool'), + fiftyEightCoin: createAXbtPattern(this, 'computed_pools_vecs/FiftyEightCoin'), + foundryUsa: createAXbtPattern(this, 'computed_pools_vecs/FoundryUsa'), + futureBitApolloSolo: createAXbtPattern(this, 'computed_pools_vecs/FutureBitApolloSolo'), + gbMiners: createAXbtPattern(this, 'computed_pools_vecs/GbMiners'), + ghashIo: createAXbtPattern(this, 'computed_pools_vecs/GhashIo'), + giveMeCoins: createAXbtPattern(this, 'computed_pools_vecs/GiveMeCoins'), + goGreenLight: createAXbtPattern(this, 'computed_pools_vecs/GoGreenLight'), + haoZhuZhu: createAXbtPattern(this, 'computed_pools_vecs/HaoZhuZhu'), + haominer: createAXbtPattern(this, 'computed_pools_vecs/Haominer'), + hashBx: createAXbtPattern(this, 'computed_pools_vecs/HashBx'), + hashPool: createAXbtPattern(this, 'computed_pools_vecs/HashPool'), + helix: createAXbtPattern(this, 'computed_pools_vecs/Helix'), + hhtt: createAXbtPattern(this, 'computed_pools_vecs/Hhtt'), + hotPool: createAXbtPattern(this, 'computed_pools_vecs/HotPool'), + hummerpool: createAXbtPattern(this, 'computed_pools_vecs/Hummerpool'), + huobiPool: createAXbtPattern(this, 'computed_pools_vecs/HuobiPool'), + innopolisTech: createAXbtPattern(this, 'computed_pools_vecs/InnopolisTech'), + kanoPool: createAXbtPattern(this, 'computed_pools_vecs/KanoPool'), + kncMiner: createAXbtPattern(this, 'computed_pools_vecs/KncMiner'), + kuCoinPool: createAXbtPattern(this, 'computed_pools_vecs/KuCoinPool'), + lubianCom: createAXbtPattern(this, 'computed_pools_vecs/LubianCom'), + luckyPool: createAXbtPattern(this, 'computed_pools_vecs/LuckyPool'), + luxor: createAXbtPattern(this, 'computed_pools_vecs/Luxor'), + maraPool: createAXbtPattern(this, 'computed_pools_vecs/MaraPool'), + maxBtc: createAXbtPattern(this, 'computed_pools_vecs/MaxBtc'), + maxiPool: createAXbtPattern(this, 'computed_pools_vecs/MaxiPool'), + megaBigPower: createAXbtPattern(this, 'computed_pools_vecs/MegaBigPower'), + minerium: createAXbtPattern(this, 'computed_pools_vecs/Minerium'), + miningCity: createAXbtPattern(this, 'computed_pools_vecs/MiningCity'), + miningDutch: createAXbtPattern(this, 'computed_pools_vecs/MiningDutch'), + miningKings: createAXbtPattern(this, 'computed_pools_vecs/MiningKings'), + miningSquared: createAXbtPattern(this, 'computed_pools_vecs/MiningSquared'), + mmpool: createAXbtPattern(this, 'computed_pools_vecs/Mmpool'), + mtRed: createAXbtPattern(this, 'computed_pools_vecs/MtRed'), + multiCoinCo: createAXbtPattern(this, 'computed_pools_vecs/MultiCoinCo'), + multipool: createAXbtPattern(this, 'computed_pools_vecs/Multipool'), + myBtcCoinPool: createAXbtPattern(this, 'computed_pools_vecs/MyBtcCoinPool'), + neopool: createAXbtPattern(this, 'computed_pools_vecs/Neopool'), + nexious: createAXbtPattern(this, 'computed_pools_vecs/Nexious'), + niceHash: createAXbtPattern(this, 'computed_pools_vecs/NiceHash'), + nmcBit: createAXbtPattern(this, 'computed_pools_vecs/NmcBit'), + novaBlock: createAXbtPattern(this, 'computed_pools_vecs/NovaBlock'), + ocean: createAXbtPattern(this, 'computed_pools_vecs/Ocean'), + okExPool: createAXbtPattern(this, 'computed_pools_vecs/OkExPool'), + okMiner: createAXbtPattern(this, 'computed_pools_vecs/OkMiner'), + okkong: createAXbtPattern(this, 'computed_pools_vecs/Okkong'), + okpoolTop: createAXbtPattern(this, 'computed_pools_vecs/OkpoolTop'), + oneHash: createAXbtPattern(this, 'computed_pools_vecs/OneHash'), + oneM1x: createAXbtPattern(this, 'computed_pools_vecs/OneM1x'), + oneThash: createAXbtPattern(this, 'computed_pools_vecs/OneThash'), + ozCoin: createAXbtPattern(this, 'computed_pools_vecs/OzCoin'), + pHashIo: createAXbtPattern(this, 'computed_pools_vecs/PHashIo'), + parasite: createAXbtPattern(this, 'computed_pools_vecs/Parasite'), + patels: createAXbtPattern(this, 'computed_pools_vecs/Patels'), + pegaPool: createAXbtPattern(this, 'computed_pools_vecs/PegaPool'), + phoenix: createAXbtPattern(this, 'computed_pools_vecs/Phoenix'), + polmine: createAXbtPattern(this, 'computed_pools_vecs/Polmine'), + pool175btc: createAXbtPattern(this, 'computed_pools_vecs/Pool175btc'), + pool50btc: createAXbtPattern(this, 'computed_pools_vecs/Pool50btc'), + poolin: createAXbtPattern(this, 'computed_pools_vecs/Poolin'), + portlandHodl: createAXbtPattern(this, 'computed_pools_vecs/PortlandHodl'), + publicPool: createAXbtPattern(this, 'computed_pools_vecs/PublicPool'), + pureBtcCom: createAXbtPattern(this, 'computed_pools_vecs/PureBtcCom'), + rawpool: createAXbtPattern(this, 'computed_pools_vecs/Rawpool'), + rigPool: createAXbtPattern(this, 'computed_pools_vecs/RigPool'), + sbiCrypto: createAXbtPattern(this, 'computed_pools_vecs/SbiCrypto'), + secPool: createAXbtPattern(this, 'computed_pools_vecs/SecPool'), + secretSuperstar: createAXbtPattern(this, 'computed_pools_vecs/SecretSuperstar'), + sevenPool: createAXbtPattern(this, 'computed_pools_vecs/SevenPool'), + shawnP0wers: createAXbtPattern(this, 'computed_pools_vecs/ShawnP0wers'), + sigmapoolCom: createAXbtPattern(this, 'computed_pools_vecs/SigmapoolCom'), + simplecoinUs: createAXbtPattern(this, 'computed_pools_vecs/SimplecoinUs'), + soloCk: createAXbtPattern(this, 'computed_pools_vecs/SoloCk'), + spiderPool: createAXbtPattern(this, 'computed_pools_vecs/SpiderPool'), + stMiningCorp: createAXbtPattern(this, 'computed_pools_vecs/StMiningCorp'), + tangpool: createAXbtPattern(this, 'computed_pools_vecs/Tangpool'), + tatmasPool: createAXbtPattern(this, 'computed_pools_vecs/TatmasPool'), + tbDice: createAXbtPattern(this, 'computed_pools_vecs/TbDice'), + telco214: createAXbtPattern(this, 'computed_pools_vecs/Telco214'), + terraPool: createAXbtPattern(this, 'computed_pools_vecs/TerraPool'), + tiger: createAXbtPattern(this, 'computed_pools_vecs/Tiger'), + tigerpoolNet: createAXbtPattern(this, 'computed_pools_vecs/TigerpoolNet'), + titan: createAXbtPattern(this, 'computed_pools_vecs/Titan'), + transactionCoinMining: createAXbtPattern(this, 'computed_pools_vecs/TransactionCoinMining'), + trickysBtcPool: createAXbtPattern(this, 'computed_pools_vecs/TrickysBtcPool'), + tripleMining: createAXbtPattern(this, 'computed_pools_vecs/TripleMining'), + twentyOneInc: createAXbtPattern(this, 'computed_pools_vecs/TwentyOneInc'), + ultimusPool: createAXbtPattern(this, 'computed_pools_vecs/UltimusPool'), + unknown: createAXbtPattern(this, 'computed_pools_vecs/Unknown'), + unomp: createAXbtPattern(this, 'computed_pools_vecs/Unomp'), + viaBtc: createAXbtPattern(this, 'computed_pools_vecs/ViaBtc'), + waterhole: createAXbtPattern(this, 'computed_pools_vecs/Waterhole'), + wayiCn: createAXbtPattern(this, 'computed_pools_vecs/WayiCn'), + whitePool: createAXbtPattern(this, 'computed_pools_vecs/WhitePool'), + wk057: createAXbtPattern(this, 'computed_pools_vecs/Wk057'), + yourbtcNet: createAXbtPattern(this, 'computed_pools_vecs/YourbtcNet'), + zulupool: createAXbtPattern(this, 'computed_pools_vecs/Zulupool') + } + }, + price: { + priceClose: createIndexes3(this, '/price_close'), + priceCloseInCents: createIndexes13(this, '/price_close_in_cents'), + priceCloseInSats: createIndexes3(this, '/price_close_in_sats'), + priceHigh: createIndexes3(this, '/price_high'), + priceHighInCents: createIndexes13(this, '/price_high_in_cents'), + priceHighInSats: createIndexes3(this, '/price_high_in_sats'), + priceLow: createIndexes3(this, '/price_low'), + priceLowInCents: createIndexes13(this, '/price_low_in_cents'), + priceLowInSats: createIndexes3(this, '/price_low_in_sats'), + priceOhlc: createIndexes3(this, '/price_ohlc'), + priceOhlcInSats: createIndexes3(this, '/price_ohlc_in_sats'), + priceOpen: createIndexes3(this, '/price_open'), + priceOpenInCents: createIndexes13(this, '/price_open_in_cents'), + priceOpenInSats: createIndexes3(this, '/price_open_in_sats') + }, + stateful: { + addrCount: createIndexes3(this, '/addr_count'), + addressCohorts: { + amountRange: { + _0sats: create_0satsPattern(this, 'computed_stateful_address_cohorts_amount_range/_0sats'), + _100btcTo1kBtc: create_0satsPattern(this, 'computed_stateful_address_cohorts_amount_range/_100btc_to_1k_btc'), + _100kBtcOrMore: create_0satsPattern(this, 'computed_stateful_address_cohorts_amount_range/_100k_btc_or_more'), + _100kSatsTo1mSats: create_0satsPattern(this, 'computed_stateful_address_cohorts_amount_range/_100k_sats_to_1m_sats'), + _100satsTo1kSats: create_0satsPattern(this, 'computed_stateful_address_cohorts_amount_range/_100sats_to_1k_sats'), + _10btcTo100btc: create_0satsPattern(this, 'computed_stateful_address_cohorts_amount_range/_10btc_to_100btc'), + _10kBtcTo100kBtc: create_0satsPattern(this, 'computed_stateful_address_cohorts_amount_range/_10k_btc_to_100k_btc'), + _10kSatsTo100kSats: create_0satsPattern(this, 'computed_stateful_address_cohorts_amount_range/_10k_sats_to_100k_sats'), + _10mSatsTo1btc: create_0satsPattern(this, 'computed_stateful_address_cohorts_amount_range/_10m_sats_to_1btc'), + _10satsTo100sats: create_0satsPattern(this, 'computed_stateful_address_cohorts_amount_range/_10sats_to_100sats'), + _1btcTo10btc: create_0satsPattern(this, 'computed_stateful_address_cohorts_amount_range/_1btc_to_10btc'), + _1kBtcTo10kBtc: create_0satsPattern(this, 'computed_stateful_address_cohorts_amount_range/_1k_btc_to_10k_btc'), + _1kSatsTo10kSats: create_0satsPattern(this, 'computed_stateful_address_cohorts_amount_range/_1k_sats_to_10k_sats'), + _1mSatsTo10mSats: create_0satsPattern(this, 'computed_stateful_address_cohorts_amount_range/_1m_sats_to_10m_sats'), + _1satTo10sats: create_0satsPattern(this, 'computed_stateful_address_cohorts_amount_range/_1sat_to_10sats') + }, + geAmount: { + _100btc: create_0satsPattern(this, 'computed_stateful_address_cohorts_ge_amount/_100btc'), + _100kSats: create_0satsPattern(this, 'computed_stateful_address_cohorts_ge_amount/_100k_sats'), + _100sats: create_0satsPattern(this, 'computed_stateful_address_cohorts_ge_amount/_100sats'), + _10btc: create_0satsPattern(this, 'computed_stateful_address_cohorts_ge_amount/_10btc'), + _10kBtc: create_0satsPattern(this, 'computed_stateful_address_cohorts_ge_amount/_10k_btc'), + _10kSats: create_0satsPattern(this, 'computed_stateful_address_cohorts_ge_amount/_10k_sats'), + _10mSats: create_0satsPattern(this, 'computed_stateful_address_cohorts_ge_amount/_10m_sats'), + _10sats: create_0satsPattern(this, 'computed_stateful_address_cohorts_ge_amount/_10sats'), + _1btc: create_0satsPattern(this, 'computed_stateful_address_cohorts_ge_amount/_1btc'), + _1kBtc: create_0satsPattern(this, 'computed_stateful_address_cohorts_ge_amount/_1k_btc'), + _1kSats: create_0satsPattern(this, 'computed_stateful_address_cohorts_ge_amount/_1k_sats'), + _1mSats: create_0satsPattern(this, 'computed_stateful_address_cohorts_ge_amount/_1m_sats'), + _1sat: create_0satsPattern(this, 'computed_stateful_address_cohorts_ge_amount/_1sat') + }, + ltAmount: { + _100btc: create_0satsPattern(this, 'computed_stateful_address_cohorts_lt_amount/_100btc'), + _100kBtc: create_0satsPattern(this, 'computed_stateful_address_cohorts_lt_amount/_100k_btc'), + _100kSats: create_0satsPattern(this, 'computed_stateful_address_cohorts_lt_amount/_100k_sats'), + _100sats: create_0satsPattern(this, 'computed_stateful_address_cohorts_lt_amount/_100sats'), + _10btc: create_0satsPattern(this, 'computed_stateful_address_cohorts_lt_amount/_10btc'), + _10kBtc: create_0satsPattern(this, 'computed_stateful_address_cohorts_lt_amount/_10k_btc'), + _10kSats: create_0satsPattern(this, 'computed_stateful_address_cohorts_lt_amount/_10k_sats'), + _10mSats: create_0satsPattern(this, 'computed_stateful_address_cohorts_lt_amount/_10m_sats'), + _10sats: create_0satsPattern(this, 'computed_stateful_address_cohorts_lt_amount/_10sats'), + _1btc: create_0satsPattern(this, 'computed_stateful_address_cohorts_lt_amount/_1btc'), + _1kBtc: create_0satsPattern(this, 'computed_stateful_address_cohorts_lt_amount/_1k_btc'), + _1kSats: create_0satsPattern(this, 'computed_stateful_address_cohorts_lt_amount/_1k_sats'), + _1mSats: create_0satsPattern(this, 'computed_stateful_address_cohorts_lt_amount/_1m_sats') + } + }, + addressesData: { + empty: createIndexes29(this, '/emptyaddressdata'), + loaded: createIndexes30(this, '/loadedaddressdata') + }, + addresstypeToHeightToAddrCount: createAddresstypeToHeightToAddrCountPattern(this, 'computed_stateful/addresstype_to_height_to_addr_count'), + addresstypeToHeightToEmptyAddrCount: createAddresstypeToHeightToAddrCountPattern(this, 'computed_stateful/addresstype_to_height_to_empty_addr_count'), + addresstypeToIndexesToAddrCount: createAddresstypeToHeightToAddrCountPattern(this, 'computed_stateful/addresstype_to_indexes_to_addr_count'), + addresstypeToIndexesToEmptyAddrCount: createAddresstypeToHeightToAddrCountPattern(this, 'computed_stateful/addresstype_to_indexes_to_empty_addr_count'), + anyAddressIndexes: createAddresstypeToHeightToAddrCountPattern(this, 'computed_stateful/any_address_indexes'), + chainState: createIndexes2(this, '/chain'), + emptyAddrCount: createIndexes3(this, '/empty_addr_count'), + emptyaddressindex: createIndexes29(this, '/emptyaddressindex'), + loadedaddressindex: createIndexes30(this, '/loadedaddressindex'), + marketCap: createIndexes26(this, '/market_cap'), + opreturnSupply: createSupplyPattern(this, 'computed_stateful/opreturn_supply'), + unspendableSupply: createSupplyPattern(this, 'computed_stateful/unspendable_supply'), + utxoCohorts: { + ageRange: { + _10yTo12y: create_10yTo12yPattern(this, 'computed_stateful_utxo_cohorts_age_range/_10y_to_12y'), + _12yTo15y: create_10yTo12yPattern(this, 'computed_stateful_utxo_cohorts_age_range/_12y_to_15y'), + _1dTo1w: create_10yTo12yPattern(this, 'computed_stateful_utxo_cohorts_age_range/_1d_to_1w'), + _1mTo2m: create_10yTo12yPattern(this, 'computed_stateful_utxo_cohorts_age_range/_1m_to_2m'), + _1wTo1m: create_10yTo12yPattern(this, 'computed_stateful_utxo_cohorts_age_range/_1w_to_1m'), + _1yTo2y: create_10yTo12yPattern(this, 'computed_stateful_utxo_cohorts_age_range/_1y_to_2y'), + _2mTo3m: create_10yTo12yPattern(this, 'computed_stateful_utxo_cohorts_age_range/_2m_to_3m'), + _2yTo3y: create_10yTo12yPattern(this, 'computed_stateful_utxo_cohorts_age_range/_2y_to_3y'), + _3mTo4m: create_10yTo12yPattern(this, 'computed_stateful_utxo_cohorts_age_range/_3m_to_4m'), + _3yTo4y: create_10yTo12yPattern(this, 'computed_stateful_utxo_cohorts_age_range/_3y_to_4y'), + _4mTo5m: create_10yTo12yPattern(this, 'computed_stateful_utxo_cohorts_age_range/_4m_to_5m'), + _4yTo5y: create_10yTo12yPattern(this, 'computed_stateful_utxo_cohorts_age_range/_4y_to_5y'), + _5mTo6m: create_10yTo12yPattern(this, 'computed_stateful_utxo_cohorts_age_range/_5m_to_6m'), + _5yTo6y: create_10yTo12yPattern(this, 'computed_stateful_utxo_cohorts_age_range/_5y_to_6y'), + _6mTo1y: create_10yTo12yPattern(this, 'computed_stateful_utxo_cohorts_age_range/_6m_to_1y'), + _6yTo7y: create_10yTo12yPattern(this, 'computed_stateful_utxo_cohorts_age_range/_6y_to_7y'), + _7yTo8y: create_10yTo12yPattern(this, 'computed_stateful_utxo_cohorts_age_range/_7y_to_8y'), + _8yTo10y: create_10yTo12yPattern(this, 'computed_stateful_utxo_cohorts_age_range/_8y_to_10y'), + from15y: create_10yTo12yPattern(this, 'computed_stateful_utxo_cohorts_age_range/from_15y'), + upTo1d: createUpTo1dPattern(this, 'computed_stateful_utxo_cohorts_age_range/up_to_1d') + }, + all: { + activity: createActivityPattern(this, 'computed_stateful_utxo_cohorts_all/activity'), + pricePaid: createPricePaidPattern2(this, 'computed_stateful_utxo_cohorts_all/price_paid'), + realized: createRealizedPattern3(this, 'computed_stateful_utxo_cohorts_all/realized'), + relative: { + negUnrealizedLossRelToOwnTotalUnrealizedPnl: createIndexes27(this, '/neg_unrealized_loss_rel_to_own_total_unrealized_pnl'), + netUnrealizedPnlRelToOwnTotalUnrealizedPnl: createIndexes26(this, '/net_unrealized_pnl_rel_to_own_total_unrealized_pnl'), + supplyInLossRelToOwnSupply: createIndexes27(this, '/supply_in_loss_rel_to_own_supply'), + supplyInProfitRelToOwnSupply: createIndexes27(this, '/supply_in_profit_rel_to_own_supply'), + unrealizedLossRelToOwnTotalUnrealizedPnl: createIndexes27(this, '/unrealized_loss_rel_to_own_total_unrealized_pnl'), + unrealizedProfitRelToOwnTotalUnrealizedPnl: createIndexes27(this, '/unrealized_profit_rel_to_own_total_unrealized_pnl') + }, + supply: createSupplyPattern2(this, 'computed_stateful_utxo_cohorts_all/supply'), + unrealized: createUnrealizedPattern(this, 'computed_stateful_utxo_cohorts_all/unrealized') + }, + amountRange: { + _0sats: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_amount_range/_0sats'), + _100btcTo1kBtc: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_amount_range/_100btc_to_1k_btc'), + _100kBtcOrMore: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_amount_range/_100k_btc_or_more'), + _100kSatsTo1mSats: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_amount_range/_100k_sats_to_1m_sats'), + _100satsTo1kSats: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_amount_range/_100sats_to_1k_sats'), + _10btcTo100btc: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_amount_range/_10btc_to_100btc'), + _10kBtcTo100kBtc: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_amount_range/_10k_btc_to_100k_btc'), + _10kSatsTo100kSats: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_amount_range/_10k_sats_to_100k_sats'), + _10mSatsTo1btc: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_amount_range/_10m_sats_to_1btc'), + _10satsTo100sats: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_amount_range/_10sats_to_100sats'), + _1btcTo10btc: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_amount_range/_1btc_to_10btc'), + _1kBtcTo10kBtc: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_amount_range/_1k_btc_to_10k_btc'), + _1kSatsTo10kSats: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_amount_range/_1k_sats_to_10k_sats'), + _1mSatsTo10mSats: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_amount_range/_1m_sats_to_10m_sats'), + _1satTo10sats: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_amount_range/_1sat_to_10sats') + }, + epoch: { + _0: create_10yTo12yPattern(this, 'epoch/_0'), + _1: create_10yTo12yPattern(this, 'epoch/_1'), + _2: create_10yTo12yPattern(this, 'epoch/_2'), + _3: create_10yTo12yPattern(this, 'epoch/_3'), + _4: create_10yTo12yPattern(this, 'epoch/_4') + }, + geAmount: { + _100btc: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_ge_amount/_100btc'), + _100kSats: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_ge_amount/_100k_sats'), + _100sats: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_ge_amount/_100sats'), + _10btc: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_ge_amount/_10btc'), + _10kBtc: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_ge_amount/_10k_btc'), + _10kSats: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_ge_amount/_10k_sats'), + _10mSats: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_ge_amount/_10m_sats'), + _10sats: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_ge_amount/_10sats'), + _1btc: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_ge_amount/_1btc'), + _1kBtc: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_ge_amount/_1k_btc'), + _1kSats: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_ge_amount/_1k_sats'), + _1mSats: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_ge_amount/_1m_sats'), + _1sat: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_ge_amount/_1sat') + }, + ltAmount: { + _100btc: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_lt_amount/_100btc'), + _100kBtc: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_lt_amount/_100k_btc'), + _100kSats: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_lt_amount/_100k_sats'), + _100sats: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_lt_amount/_100sats'), + _10btc: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_lt_amount/_10btc'), + _10kBtc: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_lt_amount/_10k_btc'), + _10kSats: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_lt_amount/_10k_sats'), + _10mSats: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_lt_amount/_10m_sats'), + _10sats: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_lt_amount/_10sats'), + _1btc: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_lt_amount/_1btc'), + _1kBtc: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_lt_amount/_1k_btc'), + _1kSats: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_lt_amount/_1k_sats'), + _1mSats: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_lt_amount/_1m_sats') + }, + maxAge: { + _10y: createUpTo1dPattern(this, 'computed_stateful_utxo_cohorts_max_age/_10y'), + _12y: createUpTo1dPattern(this, 'computed_stateful_utxo_cohorts_max_age/_12y'), + _15y: createUpTo1dPattern(this, 'computed_stateful_utxo_cohorts_max_age/_15y'), + _1m: createUpTo1dPattern(this, 'computed_stateful_utxo_cohorts_max_age/_1m'), + _1w: createUpTo1dPattern(this, 'computed_stateful_utxo_cohorts_max_age/_1w'), + _1y: createUpTo1dPattern(this, 'computed_stateful_utxo_cohorts_max_age/_1y'), + _2m: createUpTo1dPattern(this, 'computed_stateful_utxo_cohorts_max_age/_2m'), + _2y: createUpTo1dPattern(this, 'computed_stateful_utxo_cohorts_max_age/_2y'), + _3m: createUpTo1dPattern(this, 'computed_stateful_utxo_cohorts_max_age/_3m'), + _3y: createUpTo1dPattern(this, 'computed_stateful_utxo_cohorts_max_age/_3y'), + _4m: createUpTo1dPattern(this, 'computed_stateful_utxo_cohorts_max_age/_4m'), + _4y: createUpTo1dPattern(this, 'computed_stateful_utxo_cohorts_max_age/_4y'), + _5m: createUpTo1dPattern(this, 'computed_stateful_utxo_cohorts_max_age/_5m'), + _5y: createUpTo1dPattern(this, 'computed_stateful_utxo_cohorts_max_age/_5y'), + _6m: createUpTo1dPattern(this, 'computed_stateful_utxo_cohorts_max_age/_6m'), + _6y: createUpTo1dPattern(this, 'computed_stateful_utxo_cohorts_max_age/_6y'), + _7y: createUpTo1dPattern(this, 'computed_stateful_utxo_cohorts_max_age/_7y'), + _8y: createUpTo1dPattern(this, 'computed_stateful_utxo_cohorts_max_age/_8y') + }, + minAge: { + _10y: create_10yTo12yPattern(this, 'computed_stateful_utxo_cohorts_min_age/_10y'), + _12y: create_10yTo12yPattern(this, 'computed_stateful_utxo_cohorts_min_age/_12y'), + _1d: create_10yTo12yPattern(this, 'computed_stateful_utxo_cohorts_min_age/_1d'), + _1m: create_10yTo12yPattern(this, 'computed_stateful_utxo_cohorts_min_age/_1m'), + _1w: create_10yTo12yPattern(this, 'computed_stateful_utxo_cohorts_min_age/_1w'), + _1y: create_10yTo12yPattern(this, 'computed_stateful_utxo_cohorts_min_age/_1y'), + _2m: create_10yTo12yPattern(this, 'computed_stateful_utxo_cohorts_min_age/_2m'), + _2y: create_10yTo12yPattern(this, 'computed_stateful_utxo_cohorts_min_age/_2y'), + _3m: create_10yTo12yPattern(this, 'computed_stateful_utxo_cohorts_min_age/_3m'), + _3y: create_10yTo12yPattern(this, 'computed_stateful_utxo_cohorts_min_age/_3y'), + _4m: create_10yTo12yPattern(this, 'computed_stateful_utxo_cohorts_min_age/_4m'), + _4y: create_10yTo12yPattern(this, 'computed_stateful_utxo_cohorts_min_age/_4y'), + _5m: create_10yTo12yPattern(this, 'computed_stateful_utxo_cohorts_min_age/_5m'), + _5y: create_10yTo12yPattern(this, 'computed_stateful_utxo_cohorts_min_age/_5y'), + _6m: create_10yTo12yPattern(this, 'computed_stateful_utxo_cohorts_min_age/_6m'), + _6y: create_10yTo12yPattern(this, 'computed_stateful_utxo_cohorts_min_age/_6y'), + _7y: create_10yTo12yPattern(this, 'computed_stateful_utxo_cohorts_min_age/_7y'), + _8y: create_10yTo12yPattern(this, 'computed_stateful_utxo_cohorts_min_age/_8y') + }, + term: { + long: createUpTo1dPattern(this, 'computed_stateful_utxo_cohorts_term/long'), + short: createUpTo1dPattern(this, 'computed_stateful_utxo_cohorts_term/short') + }, + type: { + empty: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_type_/empty'), + p2a: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_type_/p2a'), + p2ms: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_type_/p2ms'), + p2pk33: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_type_/p2pk33'), + p2pk65: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_type_/p2pk65'), + p2pkh: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_type_/p2pkh'), + p2sh: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_type_/p2sh'), + p2tr: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_type_/p2tr'), + p2wpkh: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_type_/p2wpkh'), + p2wsh: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_type_/p2wsh'), + unknown: create_0satsPattern2(this, 'computed_stateful_utxo_cohorts_type_/unknown') + }, + year: { + _2009: create_10yTo12yPattern(this, 'year/_2009'), + _2010: create_10yTo12yPattern(this, 'year/_2010'), + _2011: create_10yTo12yPattern(this, 'year/_2011'), + _2012: create_10yTo12yPattern(this, 'year/_2012'), + _2013: create_10yTo12yPattern(this, 'year/_2013'), + _2014: create_10yTo12yPattern(this, 'year/_2014'), + _2015: create_10yTo12yPattern(this, 'year/_2015'), + _2016: create_10yTo12yPattern(this, 'year/_2016'), + _2017: create_10yTo12yPattern(this, 'year/_2017'), + _2018: create_10yTo12yPattern(this, 'year/_2018'), + _2019: create_10yTo12yPattern(this, 'year/_2019'), + _2020: create_10yTo12yPattern(this, 'year/_2020'), + _2021: create_10yTo12yPattern(this, 'year/_2021'), + _2022: create_10yTo12yPattern(this, 'year/_2022'), + _2023: create_10yTo12yPattern(this, 'year/_2023'), + _2024: create_10yTo12yPattern(this, 'year/_2024'), + _2025: create_10yTo12yPattern(this, 'year/_2025'), + _2026: create_10yTo12yPattern(this, 'year/_2026') + } + } + }, + txins: { + txoutindex: createIndexes24(this, '/txoutindex'), + value: createIndexes24(this, '/value') + }, + txouts: { + txinindex: createIndexes25(this, '/txinindex') + } + }, + indexed: { + address: { + firstP2aaddressindex: createIndexes2(this, '/first_p2aaddressindex'), + firstP2pk33addressindex: createIndexes2(this, '/first_p2pk33addressindex'), + firstP2pk65addressindex: createIndexes2(this, '/first_p2pk65addressindex'), + firstP2pkhaddressindex: createIndexes2(this, '/first_p2pkhaddressindex'), + firstP2shaddressindex: createIndexes2(this, '/first_p2shaddressindex'), + firstP2traddressindex: createIndexes2(this, '/first_p2traddressindex'), + firstP2wpkhaddressindex: createIndexes2(this, '/first_p2wpkhaddressindex'), + firstP2wshaddressindex: createIndexes2(this, '/first_p2wshaddressindex'), + p2abytes: createIndexes16(this, '/p2abytes'), + p2pk33bytes: createIndexes17(this, '/p2pk33bytes'), + p2pk65bytes: createIndexes18(this, '/p2pk65bytes'), + p2pkhbytes: createIndexes19(this, '/p2pkhbytes'), + p2shbytes: createIndexes20(this, '/p2shbytes'), + p2trbytes: createIndexes21(this, '/p2trbytes'), + p2wpkhbytes: createIndexes22(this, '/p2wpkhbytes'), + p2wshbytes: createIndexes23(this, '/p2wshbytes') + }, + block: { + blockhash: createIndexes2(this, '/blockhash'), + difficulty: createIndexes2(this, '/difficulty'), + timestamp: createIndexes2(this, '/timestamp'), + totalSize: createIndexes2(this, '/total_size'), + weight: createIndexes2(this, '/weight') + }, + output: { + firstEmptyoutputindex: createIndexes2(this, '/first_emptyoutputindex'), + firstOpreturnindex: createIndexes2(this, '/first_opreturnindex'), + firstP2msoutputindex: createIndexes2(this, '/first_p2msoutputindex'), + firstUnknownoutputindex: createIndexes2(this, '/first_unknownoutputindex'), + txindex: new MetricNode(this, '/txindex') + }, + tx: { + baseSize: createIndexes6(this, '/base_size'), + firstTxindex: createIndexes2(this, '/first_txindex'), + firstTxinindex: createIndexes6(this, '/first_txinindex'), + firstTxoutindex: createIndexes6(this, '/first_txoutindex'), + height: createIndexes6(this, '/height'), + isExplicitlyRbf: createIndexes6(this, '/is_explicitly_rbf'), + rawlocktime: createIndexes6(this, '/rawlocktime'), + totalSize: createIndexes6(this, '/total_size'), + txid: createIndexes6(this, '/txid'), + txversion: createIndexes6(this, '/txversion') + }, + txin: { + firstTxinindex: createIndexes2(this, '/first_txinindex'), + outpoint: createIndexes24(this, '/outpoint'), + outputtype: createIndexes24(this, '/outputtype'), + txindex: createIndexes24(this, '/txindex'), + typeindex: createIndexes24(this, '/typeindex') + }, + txout: { + firstTxoutindex: createIndexes2(this, '/first_txoutindex'), + outputtype: createIndexes25(this, '/outputtype'), + txindex: createIndexes25(this, '/txindex'), + typeindex: createIndexes25(this, '/typeindex'), + value: createIndexes25(this, '/value') + } + } + }; + } + + /** + * Address information + * @description Retrieve comprehensive information about a Bitcoin address including balance, transaction history, UTXOs, and estimated investment metrics. Supports all standard Bitcoin address types (P2PKH, P2SH, P2WPKH, P2WSH, P2TR, etc.). + * @param {string} address + * @returns {Promise} + */ + async getApiAddressByAddress(address) { + return this.get(`/api/address/${address}`); + } + + /** + * Address transaction IDs + * @description Get transaction IDs for an address, newest first. Use after_txid for pagination. + * @param {string} address + * @param {string=} [after_txid] Txid to paginate from (return transactions before this one) + * @param {string=} [limit] Maximum number of results to return. Defaults to 25 if not specified. + * @returns {Promise} + */ + async getApiAddressByAddressTxs(address, after_txid, limit) { + const params = new URLSearchParams(); + if (after_txid !== undefined) params.set('after_txid', String(after_txid)); + if (limit !== undefined) params.set('limit', String(limit)); + const query = params.toString(); + return this.get(`/api/address/${address}/txs${query ? '?' + query : ''}`); + } + + /** + * Address confirmed transactions + * @description Get confirmed transaction IDs for an address, 25 per page. Use ?after_txid= for pagination. + * @param {string} address + * @param {string=} [after_txid] Txid to paginate from (return transactions before this one) + * @param {string=} [limit] Maximum number of results to return. Defaults to 25 if not specified. + * @returns {Promise} + */ + async getApiAddressByAddressTxsChain(address, after_txid, limit) { + const params = new URLSearchParams(); + if (after_txid !== undefined) params.set('after_txid', String(after_txid)); + if (limit !== undefined) params.set('limit', String(limit)); + const query = params.toString(); + return this.get(`/api/address/${address}/txs/chain${query ? '?' + query : ''}`); + } + + /** + * Address mempool transactions + * @description Get unconfirmed transaction IDs for an address from the mempool (up to 50). + * @param {string} address + * @returns {Promise} + */ + async getApiAddressByAddressTxsMempool(address) { + return this.get(`/api/address/${address}/txs/mempool`); + } + + /** + * Address UTXOs + * @description Get unspent transaction outputs for an address. + * @param {string} address + * @returns {Promise} + */ + async getApiAddressByAddressUtxo(address) { + return this.get(`/api/address/${address}/utxo`); + } + + /** + * Block by height + * @description Retrieve block information by block height. Returns block metadata including hash, timestamp, difficulty, size, weight, and transaction count. + * @param {string} height + * @returns {Promise} + */ + async getApiBlockHeightByHeight(height) { + return this.get(`/api/block-height/${height}`); + } + + /** + * Block information + * @description Retrieve block information by block hash. Returns block metadata including height, timestamp, difficulty, size, weight, and transaction count. + * @param {string} hash + * @returns {Promise} + */ + async getApiBlockByHash(hash) { + return this.get(`/api/block/${hash}`); + } + + /** + * Raw block + * @description Returns the raw block data in binary format. + * @param {string} hash + * @returns {Promise} + */ + async getApiBlockByHashRaw(hash) { + return this.get(`/api/block/${hash}/raw`); + } + + /** + * Block status + * @description Retrieve the status of a block. Returns whether the block is in the best chain and, if so, its height and the hash of the next block. + * @param {string} hash + * @returns {Promise} + */ + async getApiBlockByHashStatus(hash) { + return this.get(`/api/block/${hash}/status`); + } + + /** + * Transaction ID at index + * @description Retrieve a single transaction ID at a specific index within a block. Returns plain text txid. + * @param {string} hash Bitcoin block hash + * @param {string} index Transaction index within the block (0-based) + * @returns {Promise} + */ + async getApiBlockByHashTxidByIndex(hash, index) { + return this.get(`/api/block/${hash}/txid/${index}`); + } + + /** + * Block transaction IDs + * @description Retrieve all transaction IDs in a block by block hash. + * @param {string} hash + * @returns {Promise} + */ + async getApiBlockByHashTxids(hash) { + return this.get(`/api/block/${hash}/txids`); + } + + /** + * Block transactions (paginated) + * @description Retrieve transactions in a block by block hash, starting from the specified index. Returns up to 25 transactions at a time. + * @param {string} hash Bitcoin block hash + * @param {string} start_index Starting transaction index within the block (0-based) + * @returns {Promise} + */ + async getApiBlockByHashTxsByStartIndex(hash, start_index) { + return this.get(`/api/block/${hash}/txs/${start_index}`); + } + + /** + * Recent blocks + * @description Retrieve the last 10 blocks. Returns block metadata for each block. + * @returns {Promise} + */ + async getApiBlocks() { + return this.get(`/api/blocks`); + } + + /** + * Blocks from height + * @description Retrieve up to 10 blocks going backwards from the given height. For example, height=100 returns blocks 100, 99, 98, ..., 91. Height=0 returns only block 0. + * @param {string} height + * @returns {Promise} + */ + async getApiBlocksByHeight(height) { + return this.get(`/api/blocks/${height}`); + } + + /** + * Mempool statistics + * @description Get current mempool statistics including transaction count, total vsize, and total fees. + * @returns {Promise} + */ + async getApiMempoolInfo() { + return this.get(`/api/mempool/info`); + } + + /** + * Mempool transaction IDs + * @description Get all transaction IDs currently in the mempool. + * @returns {Promise} + */ + async getApiMempoolTxids() { + return this.get(`/api/mempool/txids`); + } + + /** + * Get supported indexes for a metric + * @description Returns the list of indexes are supported by the specified metric. For example, `realized_price` might be available on dateindex, weekindex, and monthindex. + * @param {string} metric + * @returns {Promise} + */ + async getApiMetricByMetric(metric) { + return this.get(`/api/metric/${metric}`); + } + + /** + * Get metric data + * @description Fetch data for a specific metric at the given index. Use query parameters to filter by date range and format (json/csv). + * @param {string} metric Metric name + * @param {string} index Aggregation index + * @param {string=} [from] Inclusive starting index, if negative counts from end + * @param {string=} [to] Exclusive ending index, if negative counts from end + * @param {string=} [count] Number of values to return (ignored if `to` is set) + * @param {string=} [format] Format of the output + * @returns {Promise} + */ + async getApiMetricByMetricByIndex(metric, index, from, to, count, format) { + const params = new URLSearchParams(); + if (from !== undefined) params.set('from', String(from)); + if (to !== undefined) params.set('to', String(to)); + if (count !== undefined) params.set('count', String(count)); + if (format !== undefined) params.set('format', String(format)); + const query = params.toString(); + return this.get(`/api/metric/${metric}/${index}${query ? '?' + query : ''}`); + } + + /** + * Bulk metric data + * @description Fetch multiple metrics in a single request. Supports filtering by index and date range. Returns an array of MetricData objects. + * @param {string} [metrics] Requested metrics + * @param {string} [index] Index to query + * @param {string=} [from] Inclusive starting index, if negative counts from end + * @param {string=} [to] Exclusive ending index, if negative counts from end + * @param {string=} [count] Number of values to return (ignored if `to` is set) + * @param {string=} [format] Format of the output + * @returns {Promise} + */ + async getApiMetricsBulk(metrics, index, from, to, count, format) { + const params = new URLSearchParams(); + params.set('metrics', String(metrics)); + params.set('index', String(index)); + if (from !== undefined) params.set('from', String(from)); + if (to !== undefined) params.set('to', String(to)); + if (count !== undefined) params.set('count', String(count)); + if (format !== undefined) params.set('format', String(format)); + const query = params.toString(); + return this.get(`/api/metrics/bulk${query ? '?' + query : ''}`); + } + + /** + * Metrics catalog + * @description Returns the complete hierarchical catalog of available metrics organized as a tree structure. Metrics are grouped by categories and subcategories. Best viewed in an interactive JSON viewer (e.g., Firefox's built-in JSON viewer) for easy navigation of the nested structure. + * @returns {Promise} + */ + async getApiMetricsCatalog() { + return this.get(`/api/metrics/catalog`); + } + + /** + * Metric count + * @description Current metric count + * @returns {Promise} + */ + async getApiMetricsCount() { + return this.get(`/api/metrics/count`); + } + + /** + * List available indexes + * @description Returns all available indexes with their accepted query aliases. Use any alias when querying metrics. + * @returns {Promise} + */ + async getApiMetricsIndexes() { + return this.get(`/api/metrics/indexes`); + } + + /** + * Metrics list + * @description Paginated list of available metrics + * @param {string=} [page] Pagination index + * @returns {Promise} + */ + async getApiMetricsList(page) { + const params = new URLSearchParams(); + if (page !== undefined) params.set('page', String(page)); + const query = params.toString(); + return this.get(`/api/metrics/list${query ? '?' + query : ''}`); + } + + /** + * Search metrics + * @description Fuzzy search for metrics by name. Supports partial matches and typos. + * @param {string} metric + * @param {string=} [limit] + * @returns {Promise} + */ + async getApiMetricsSearchByMetric(metric, limit) { + const params = new URLSearchParams(); + if (limit !== undefined) params.set('limit', String(limit)); + const query = params.toString(); + return this.get(`/api/metrics/search/${metric}${query ? '?' + query : ''}`); + } + + /** + * Transaction information + * @description Retrieve complete transaction data by transaction ID (txid). Returns the full transaction details including inputs, outputs, and metadata. The transaction data is read directly from the blockchain data files. + * @param {string} txid + * @returns {Promise} + */ + async getApiTxByTxid(txid) { + return this.get(`/api/tx/${txid}`); + } + + /** + * Transaction hex + * @description Retrieve the raw transaction as a hex-encoded string. Returns the serialized transaction in hexadecimal format. + * @param {string} txid + * @returns {Promise} + */ + async getApiTxByTxidHex(txid) { + return this.get(`/api/tx/${txid}/hex`); + } + + /** + * Output spend status + * @description Get the spending status of a transaction output. Returns whether the output has been spent and, if so, the spending transaction details. + * @param {string} txid Transaction ID + * @param {string} vout Output index + * @returns {Promise} + */ + async getApiTxByTxidOutspendByVout(txid, vout) { + return this.get(`/api/tx/${txid}/outspend/${vout}`); + } + + /** + * All output spend statuses + * @description Get the spending status of all outputs in a transaction. Returns an array with the spend status for each output. + * @param {string} txid + * @returns {Promise} + */ + async getApiTxByTxidOutspends(txid) { + return this.get(`/api/tx/${txid}/outspends`); + } + + /** + * Transaction status + * @description Retrieve the confirmation status of a transaction. Returns whether the transaction is confirmed and, if so, the block height, hash, and timestamp. + * @param {string} txid + * @returns {Promise} + */ + async getApiTxByTxidStatus(txid) { + return this.get(`/api/tx/${txid}/status`); + } + + /** + * Difficulty adjustment + * @description Get current difficulty adjustment information including progress through the current epoch, estimated retarget date, and difficulty change prediction. + * @returns {Promise} + */ + async getApiV1DifficultyAdjustment() { + return this.get(`/api/v1/difficulty-adjustment`); + } + + /** + * Projected mempool blocks + * @description Get projected blocks from the mempool for fee estimation. Each block contains statistics about transactions that would be included if a block were mined now. + * @returns {Promise} + */ + async getApiV1FeesMempoolBlocks() { + return this.get(`/api/v1/fees/mempool-blocks`); + } + + /** + * Recommended fees + * @description Get recommended fee rates for different confirmation targets based on current mempool state. + * @returns {Promise} + */ + async getApiV1FeesRecommended() { + return this.get(`/api/v1/fees/recommended`); + } + + /** + * Block fees + * @description Get average block fees for a time period. Valid periods: 24h, 3d, 1w, 1m, 3m, 6m, 1y, 2y, 3y + * @param {string} time_period + * @returns {Promise} + */ + async getApiV1MiningBlocksFeesByTimePeriod(time_period) { + return this.get(`/api/v1/mining/blocks/fees/${time_period}`); + } + + /** + * Block rewards + * @description Get average block rewards (coinbase = subsidy + fees) for a time period. Valid periods: 24h, 3d, 1w, 1m, 3m, 6m, 1y, 2y, 3y + * @param {string} time_period + * @returns {Promise} + */ + async getApiV1MiningBlocksRewardsByTimePeriod(time_period) { + return this.get(`/api/v1/mining/blocks/rewards/${time_period}`); + } + + /** + * Block sizes and weights + * @description Get average block sizes and weights for a time period. Valid periods: 24h, 3d, 1w, 1m, 3m, 6m, 1y, 2y, 3y + * @param {string} time_period + * @returns {Promise} + */ + async getApiV1MiningBlocksSizesWeightsByTimePeriod(time_period) { + return this.get(`/api/v1/mining/blocks/sizes-weights/${time_period}`); + } + + /** + * Block by timestamp + * @description Find the block closest to a given UNIX timestamp. + * @param {string} timestamp + * @returns {Promise} + */ + async getApiV1MiningBlocksTimestampByTimestamp(timestamp) { + return this.get(`/api/v1/mining/blocks/timestamp/${timestamp}`); + } + + /** + * Difficulty adjustments (all time) + * @description Get historical difficulty adjustments. Returns array of [timestamp, height, difficulty, change_percent]. + * @returns {Promise} + */ + async getApiV1MiningDifficultyAdjustments() { + return this.get(`/api/v1/mining/difficulty-adjustments`); + } + + /** + * Difficulty adjustments + * @description Get historical difficulty adjustments for a time period. Valid periods: 24h, 3d, 1w, 1m, 3m, 6m, 1y, 2y, 3y. Returns array of [timestamp, height, difficulty, change_percent]. + * @param {string} time_period + * @returns {Promise} + */ + async getApiV1MiningDifficultyAdjustmentsByTimePeriod(time_period) { + return this.get(`/api/v1/mining/difficulty-adjustments/${time_period}`); + } + + /** + * Network hashrate (all time) + * @description Get network hashrate and difficulty data for all time. + * @returns {Promise} + */ + async getApiV1MiningHashrate() { + return this.get(`/api/v1/mining/hashrate`); + } + + /** + * Network hashrate + * @description Get network hashrate and difficulty data for a time period. Valid periods: 24h, 3d, 1w, 1m, 3m, 6m, 1y, 2y, 3y + * @param {string} time_period + * @returns {Promise} + */ + async getApiV1MiningHashrateByTimePeriod(time_period) { + return this.get(`/api/v1/mining/hashrate/${time_period}`); + } + + /** + * Mining pool details + * @description Get detailed information about a specific mining pool including block counts and shares for different time periods. + * @param {string} slug + * @returns {Promise} + */ + async getApiV1MiningPoolBySlug(slug) { + return this.get(`/api/v1/mining/pool/${slug}`); + } + + /** + * List all mining pools + * @description Get list of all known mining pools with their identifiers. + * @returns {Promise} + */ + async getApiV1MiningPools() { + return this.get(`/api/v1/mining/pools`); + } + + /** + * Mining pool statistics + * @description Get mining pool statistics for a time period. Valid periods: 24h, 3d, 1w, 1m, 3m, 6m, 1y, 2y, 3y + * @param {string} time_period + * @returns {Promise} + */ + async getApiV1MiningPoolsByTimePeriod(time_period) { + return this.get(`/api/v1/mining/pools/${time_period}`); + } + + /** + * Mining reward statistics + * @description Get mining reward statistics for the last N blocks including total rewards, fees, and transaction count. + * @param {string} block_count Number of recent blocks to include + * @returns {Promise} + */ + async getApiV1MiningRewardStatsByBlockCount(block_count) { + return this.get(`/api/v1/mining/reward-stats/${block_count}`); + } + + /** + * Validate address + * @description Validate a Bitcoin address and get information about its type and scriptPubKey. + * @param {string} address Bitcoin address to validate (can be any string) + * @returns {Promise} + */ + async getApiV1ValidateAddressByAddress(address) { + return this.get(`/api/v1/validate-address/${address}`); + } + + /** + * Health check + * @description Returns the health status of the API server + * @returns {Promise} + */ + async getHealth() { + return this.get(`/health`); + } + + /** + * API version + * @description Returns the current version of the API server + * @returns {Promise} + */ + async getVersion() { + return this.get(`/version`); + } + +} + +export { BrkClient, BrkClientBase, BrkError, MetricNode }; diff --git a/packages/brk_client/__init__.py b/packages/brk_client/__init__.py new file mode 100644 index 000000000..cedd42228 --- /dev/null +++ b/packages/brk_client/__init__.py @@ -0,0 +1,2796 @@ +# Auto-generated BRK Python client +# Do not edit manually + +from __future__ import annotations +from typing import TypeVar, Generic, Any, Optional, List, Literal, TypedDict, Final +import httpx + +T = TypeVar('T') + +# Constants + +VERSION: Final[str] = "v0.1.0-alpha.1" + +INDEXES: Final[tuple[str, ...]] = ( + "dateindex", + "decadeindex", + "difficultyepoch", + "emptyoutputindex", + "halvingepoch", + "height", + "txinindex", + "monthindex", + "opreturnindex", + "txoutindex", + "p2aaddressindex", + "p2msoutputindex", + "p2pk33addressindex", + "p2pk65addressindex", + "p2pkhaddressindex", + "p2shaddressindex", + "p2traddressindex", + "p2wpkhaddressindex", + "p2wshaddressindex", + "quarterindex", + "semesterindex", + "txindex", + "unknownoutputindex", + "weekindex", + "yearindex", + "loadedaddressindex", + "emptyaddressindex", +) + +POOL_ID_TO_POOL_NAME: Final[dict[str, str]] = { + "pool175btc": "175btc", + "onehash": "1Hash", + "onem1x": "1M1X", + "onethash": "1THash", + "twentyoneinc": "21 Inc.", + "pool50btc": "50BTC", + "fiftyeightcoin": "58COIN", + "sevenpool": "7pool", + "eightbaochi": "8baochi", + "axbt": "A-XBT", + "aaopool": "AAO Pool", + "antpool": "AntPool", + "arkpool": "ArkPool", + "asicminer": "ASICMiner", + "batpool": "BATPOOL", + "bcmonster": "BCMonster", + "bcpoolio": "bcpool.io", + "binancepool": "Binance Pool", + "bitalo": "Bitalo", + "bitclub": "BitClub", + "bitcoinaffiliatenetwork": "Bitcoin Affiliate Network", + "bitcoinindia": "Bitcoin India", + "bitcoinukraine": "Bitcoin-Ukraine", + "bitcoincom": "Bitcoin.com", + "bitcoinrussia": "BitcoinRussia", + "bitfarms": "Bitfarms", + "bitfufupool": "BitFuFuPool", + "bitfury": "BitFury", + "bitminter": "BitMinter", + "bitparking": "Bitparking", + "bitsolo": "Bitsolo", + "bixin": "Bixin", + "blockfills": "BlockFills", + "braiinspool": "Braiins Pool", + "bravomining": "Bravo Mining", + "btcguild": "BTC Guild", + "btcnuggets": "BTC Nuggets", + "btcpoolparty": "BTC Pool Party", + "btccom": "BTC.com", + "btctop": "BTC.TOP", + "btcc": "BTCC", + "btcdig": "BTCDig", + "btclab": "BTCLab", + "btcmp": "BTCMP", + "btcserv": "BTCServ", + "btpool": "BTPOOL", + "bwpool": "BWPool", + "bytepool": "BytePool", + "canoe": "CANOE", + "canoepool": "CanoePool", + "carbonnegative": "Carbon Negative", + "ckpool": "CKPool", + "cloudhashing": "CloudHashing", + "coinlab": "CoinLab", + "cointerra": "Cointerra", + "connectbtc": "ConnectBTC", + "dcex": "DCEX", + "dcexploration": "DCExploration", + "digitalbtc": "digitalBTC", + "digitalxmintsy": "digitalX Mintsy", + "dpool": "DPOOL", + "eclipsemc": "EclipseMC", + "ekanembtc": "EkanemBTC", + "eligius": "Eligius", + "emcdpool": "EMCDPool", + "entrustcharitypool": "Entrust Charity Pool", + "eobot": "Eobot", + "exxbw": "EXX&BW", + "f2pool": "F2Pool", + "foundryusa": "Foundry USA", + "futurebitapollosolo": "FutureBit Apollo Solo", + "gbminers": "GBMiners", + "ghashio": "GHash.IO", + "givemecoins": "Give Me Coins", + "gogreenlight": "GoGreenLight", + "haominer": "haominer", + "haozhuzhu": "HAOZHUZHU", + "hashbx": "HashBX", + "hashpool": "HASHPOOL", + "helix": "Helix", + "hhtt": "HHTT", + "hotpool": "HotPool", + "hummerpool": "Hummerpool", + "huobipool": "Huobi.pool", + "innopolistech": "Innopolis Tech", + "kanopool": "KanoPool", + "kncminer": "KnCMiner", + "kucoinpool": "KuCoinPool", + "lubiancom": "Lubian.com", + "luckypool": "luckyPool", + "luxor": "Luxor", + "marapool": "MARA Pool", + "maxbtc": "MaxBTC", + "maxipool": "MaxiPool", + "megabigpower": "MegaBigPower", + "minerium": "Minerium", + "miningsquared": "Mining Squared", + "miningdutch": "Mining-Dutch", + "miningcity": "MiningCity", + "miningkings": "MiningKings", + "mmpool": "mmpool", + "mtred": "Mt Red", + "multicoinco": "MultiCoin.co", + "multipool": "Multipool", + "mybtccoinpool": "myBTCcoin Pool", + "neopool": "Neopool", + "nexious": "Nexious", + "nicehash": "NiceHash", + "nmcbit": "NMCbit", + "novablock": "NovaBlock", + "ocean": "OCEAN", + "okexpool": "OKExPool", + "okkong": "OKKONG", + "okminer": "OKMINER", + "okpooltop": "okpool.top", + "ozcoin": "OzCoin", + "parasite": "Parasite", + "patels": "Patels", + "pegapool": "PEGA Pool", + "phashio": "PHash.IO", + "phoenix": "Phoenix", + "polmine": "Polmine", + "poolin": "Poolin", + "portlandhodl": "Portland.HODL", + "publicpool": "Public Pool", + "purebtccom": "PureBTC.COM", + "rawpool": "Rawpool", + "rigpool": "RigPool", + "sbicrypto": "SBI Crypto", + "secpool": "SECPOOL", + "secretsuperstar": "SecretSuperstar", + "shawnp0wers": "shawnp0wers", + "sigmapoolcom": "Sigmapool.com", + "simplecoinus": "simplecoin.us", + "solock": "Solo CK", + "spiderpool": "SpiderPool", + "stminingcorp": "ST Mining Corp", + "tangpool": "Tangpool", + "tatmaspool": "TATMAS Pool", + "tbdice": "TBDice", + "telco214": "Telco 214", + "terrapool": "Terra Pool", + "tiger": "tiger", + "tigerpoolnet": "tigerpool.net", + "titan": "Titan", + "transactioncoinmining": "transactioncoinmining", + "trickysbtcpool": "Tricky's BTC Pool", + "triplemining": "TripleMining", + "ultimuspool": "ULTIMUSPOOL", + "unknown": "Unknown", + "unomp": "UNOMP", + "viabtc": "ViaBTC", + "waterhole": "Waterhole", + "wayicn": "WAYI.CN", + "whitepool": "WhitePool", + "wk057": "wk057", + "yourbtcnet": "Yourbtc.net", + "zulupool": "Zulupool", +} + +# Type definitions + +Address = str +Sats = int +TypeIndex = int +class AddressChainStats(TypedDict): + funded_txo_count: int + funded_txo_sum: Sats + spent_txo_count: int + spent_txo_sum: Sats + tx_count: int + type_index: TypeIndex + +class AddressMempoolStats(TypedDict): + funded_txo_count: int + funded_txo_sum: Sats + spent_txo_count: int + spent_txo_sum: Sats + tx_count: int + +class AddressParam(TypedDict): + address: Address + +class AddressStats(TypedDict): + address: Address + chain_stats: AddressChainStats + mempool_stats: AddressMempoolStats | None + +Txid = str +class AddressTxidsParam(TypedDict): + after_txid: Txid | None + limit: int + +class AddressValidation(TypedDict): + isvalid: bool + address: Optional[str] + scriptPubKey: Optional[str] + isscript: Optional[bool] + iswitness: Optional[bool] + witness_version: Optional[int] + witness_program: Optional[str] + +AnyAddressIndex = TypeIndex +Bitcoin = float +BlkPosition = int +class BlockCountParam(TypedDict): + block_count: int + +Height = int +Timestamp = int +class BlockFeesEntry(TypedDict): + avgHeight: Height + timestamp: Timestamp + avgFees: Sats + +BlockHash = str +class BlockHashParam(TypedDict): + hash: BlockHash + +TxIndex = int +class BlockHashStartIndex(TypedDict): + hash: BlockHash + start_index: TxIndex + +class BlockHashTxIndex(TypedDict): + hash: BlockHash + index: TxIndex + +Weight = int +class BlockInfo(TypedDict): + id: BlockHash + height: Height + tx_count: int + size: int + weight: Weight + timestamp: Timestamp + difficulty: float + +class BlockRewardsEntry(TypedDict): + avgHeight: int + timestamp: int + avgRewards: int + +class BlockSizeEntry(TypedDict): + avgHeight: int + timestamp: int + avgSize: int + +class BlockWeightEntry(TypedDict): + avgHeight: int + timestamp: int + avgWeight: int + +class BlockSizesWeights(TypedDict): + sizes: List[BlockSizeEntry] + weights: List[BlockWeightEntry] + +class BlockStatus(TypedDict): + in_best_chain: bool + height: Height | None + next_best: BlockHash | None + +class BlockTimestamp(TypedDict): + height: Height + hash: BlockHash + timestamp: str + +Cents = int +Close = Cents +Format = Literal["json", "csv"] +class DataRangeFormat(TypedDict): + from_: Optional[int] + to: Optional[int] + count: Optional[int] + format: Format + +Date = int +DateIndex = int +DecadeIndex = int +class DifficultyAdjustment(TypedDict): + progressPercent: float + difficultyChange: float + estimatedRetargetDate: int + remainingBlocks: int + remainingTime: int + previousRetarget: float + nextRetargetHeight: Height + timeAvg: int + adjustedTimeAvg: int + timeOffset: int + +class DifficultyAdjustmentEntry(TypedDict): + timestamp: Timestamp + height: Height + difficulty: float + change_percent: float + +class DifficultyEntry(TypedDict): + timestamp: Timestamp + difficulty: float + height: Height + +DifficultyEpoch = int +Dollars = float +class EmptyAddressData(TypedDict): + tx_count: int + funded_txo_count: int + transfered: Sats + +EmptyAddressIndex = TypeIndex +EmptyOutputIndex = TypeIndex +FeeRate = float +HalvingEpoch = int +class HashrateEntry(TypedDict): + timestamp: Timestamp + avgHashrate: int + +class HashrateSummary(TypedDict): + hashrates: List[HashrateEntry] + difficulty: List[DifficultyEntry] + currentHashrate: int + currentDifficulty: float + +class Health(TypedDict): + status: str + service: str + timestamp: str + +class HeightParam(TypedDict): + height: Height + +Hex = str +High = Cents +class IndexInfo(TypedDict): + index: Index + aliases: List[str] + +Limit = int +class LimitParam(TypedDict): + limit: Limit + +class LoadedAddressData(TypedDict): + tx_count: int + funded_txo_count: int + spent_txo_count: int + received: Sats + sent: Sats + realized_cap: Dollars + +LoadedAddressIndex = TypeIndex +Low = Cents +class MempoolBlock(TypedDict): + blockSize: int + blockVSize: float + nTx: int + totalFees: Sats + medianFee: FeeRate + feeRange: List[FeeRate] + +VSize = int +class MempoolInfo(TypedDict): + count: int + vsize: VSize + total_fee: Sats + +Metric = str +class MetricCount(TypedDict): + distinct_metrics: int + total_endpoints: int + lazy_endpoints: int + stored_endpoints: int + +class MetricData(TypedDict): + total: int + from_: int + to: int + data: List[Any] + +class MetricParam(TypedDict): + metric: Metric + +Metrics = str +class MetricSelection(TypedDict): + metrics: Metrics + index: Index + from_: Optional[int] + to: Optional[int] + count: Optional[int] + format: Format + +class MetricSelectionLegacy(TypedDict): + index: Index + ids: Metrics + from_: Optional[int] + to: Optional[int] + count: Optional[int] + format: Format + +class MetricWithIndex(TypedDict): + metric: Metric + index: Index + +MonthIndex = int +Open = Cents +class OHLCCents(TypedDict): + open: Open + high: High + low: Low + close: Close + +class OHLCDollars(TypedDict): + open: Open + high: High + low: Low + close: Close + +class OHLCSats(TypedDict): + open: Open + high: High + low: Low + close: Close + +OpReturnIndex = TypeIndex +OutPoint = int +OutputType = Literal["p2pk65", "p2pk33", "p2pkh", "p2ms", "p2sh", "opreturn", "p2wpkh", "p2wsh", "p2tr", "p2a", "empty", "unknown"] +P2AAddressIndex = TypeIndex +U8x2 = List[int] +P2ABytes = U8x2 +P2MSOutputIndex = TypeIndex +P2PK33AddressIndex = TypeIndex +U8x33 = str +P2PK33Bytes = U8x33 +P2PK65AddressIndex = TypeIndex +U8x65 = str +P2PK65Bytes = U8x65 +P2PKHAddressIndex = TypeIndex +U8x20 = List[int] +P2PKHBytes = U8x20 +P2SHAddressIndex = TypeIndex +P2SHBytes = U8x20 +P2TRAddressIndex = TypeIndex +U8x32 = List[int] +P2TRBytes = U8x32 +P2WPKHAddressIndex = TypeIndex +P2WPKHBytes = U8x20 +P2WSHAddressIndex = TypeIndex +P2WSHBytes = U8x32 +class PaginatedMetrics(TypedDict): + current_page: int + max_page: int + metrics: List[str] + +class Pagination(TypedDict): + page: Optional[int] + +class PoolBlockCounts(TypedDict): + all: int + _24h: int + _1w: int + +class PoolBlockShares(TypedDict): + all: float + _24h: float + _1w: float + +PoolSlug = Literal["unknown", "blockfills", "ultimuspool", "terrapool", "luxor", "onethash", "btccom", "bitfarms", "huobipool", "wayicn", "canoepool", "btctop", "bitcoincom", "pool175btc", "gbminers", "axbt", "asicminer", "bitminter", "bitcoinrussia", "btcserv", "simplecoinus", "btcguild", "eligius", "ozcoin", "eclipsemc", "maxbtc", "triplemining", "coinlab", "pool50btc", "ghashio", "stminingcorp", "bitparking", "mmpool", "polmine", "kncminer", "bitalo", "f2pool", "hhtt", "megabigpower", "mtred", "nmcbit", "yourbtcnet", "givemecoins", "braiinspool", "antpool", "multicoinco", "bcpoolio", "cointerra", "kanopool", "solock", "ckpool", "nicehash", "bitclub", "bitcoinaffiliatenetwork", "btcc", "bwpool", "exxbw", "bitsolo", "bitfury", "twentyoneinc", "digitalbtc", "eightbaochi", "mybtccoinpool", "tbdice", "hashpool", "nexious", "bravomining", "hotpool", "okexpool", "bcmonster", "onehash", "bixin", "tatmaspool", "viabtc", "connectbtc", "batpool", "waterhole", "dcexploration", "dcex", "btpool", "fiftyeightcoin", "bitcoinindia", "shawnp0wers", "phashio", "rigpool", "haozhuzhu", "sevenpool", "miningkings", "hashbx", "dpool", "rawpool", "haominer", "helix", "bitcoinukraine", "poolin", "secretsuperstar", "tigerpoolnet", "sigmapoolcom", "okpooltop", "hummerpool", "tangpool", "bytepool", "spiderpool", "novablock", "miningcity", "binancepool", "minerium", "lubiancom", "okkong", "aaopool", "emcdpool", "foundryusa", "sbicrypto", "arkpool", "purebtccom", "marapool", "kucoinpool", "entrustcharitypool", "okminer", "titan", "pegapool", "btcnuggets", "cloudhashing", "digitalxmintsy", "telco214", "btcpoolparty", "multipool", "transactioncoinmining", "btcdig", "trickysbtcpool", "btcmp", "eobot", "unomp", "patels", "gogreenlight", "ekanembtc", "canoe", "tiger", "onem1x", "zulupool", "secpool", "ocean", "whitepool", "wk057", "futurebitapollosolo", "carbonnegative", "portlandhodl", "phoenix", "neopool", "maxipool", "bitfufupool", "luckypool", "miningdutch", "publicpool", "miningsquared", "innopolistech", "btclab", "parasite"] +class PoolDetailInfo(TypedDict): + id: int + name: str + link: str + addresses: List[str] + regexes: List[str] + slug: PoolSlug + +class PoolDetail(TypedDict): + pool: PoolDetailInfo + blockCount: PoolBlockCounts + blockShare: PoolBlockShares + estimatedHashrate: int + reportedHashrate: Optional[int] + +class PoolInfo(TypedDict): + name: str + slug: PoolSlug + unique_id: int + +class PoolSlugParam(TypedDict): + slug: PoolSlug + +class PoolStats(TypedDict): + poolId: int + name: str + link: str + blockCount: int + rank: int + emptyBlocks: int + slug: PoolSlug + share: float + +class PoolsSummary(TypedDict): + pools: List[PoolStats] + blockCount: int + lastEstimatedHashrate: int + +QuarterIndex = int +RawLockTime = int +class RecommendedFees(TypedDict): + fastestFee: FeeRate + halfHourFee: FeeRate + hourFee: FeeRate + economyFee: FeeRate + minimumFee: FeeRate + +class RewardStats(TypedDict): + startBlock: Height + endBlock: Height + totalReward: Sats + totalFee: Sats + totalTx: int + +SemesterIndex = int +StoredBool = int +StoredF32 = float +StoredF64 = float +StoredI16 = int +StoredU16 = int +StoredU32 = int +StoredU64 = int +class SupplyState(TypedDict): + utxo_count: int + value: Sats + +TimePeriod = Literal["24h", "3d", "1w", "1m", "3m", "6m", "1y", "2y", "3y"] +class TimePeriodParam(TypedDict): + time_period: TimePeriod + +class TimestampParam(TypedDict): + timestamp: Timestamp + +class TxOut(TypedDict): + scriptpubkey: str + value: Sats + +Vout = int +class TxIn(TypedDict): + txid: Txid + vout: Vout + prevout: TxOut | None + scriptsig: str + scriptsig_asm: str + is_coinbase: bool + sequence: int + inner_redeemscript_asm: Optional[str] + +class TxStatus(TypedDict): + confirmed: bool + block_height: Height | None + block_hash: BlockHash | None + block_time: Timestamp | None + +TxVersion = int +class Transaction(TypedDict): + index: TxIndex | None + txid: Txid + version: TxVersion + locktime: RawLockTime + size: int + weight: Weight + sigops: int + fee: Sats + vin: List[TxIn] + vout: List[TxOut] + status: TxStatus + +TxInIndex = int +TxOutIndex = int +Vin = int +class TxOutspend(TypedDict): + spent: bool + txid: Txid | None + vin: Vin | None + status: TxStatus | None + +class TxidParam(TypedDict): + txid: Txid + +class TxidVout(TypedDict): + txid: Txid + vout: Vout + +UnknownOutputIndex = TypeIndex +class Utxo(TypedDict): + txid: Txid + vout: Vout + status: TxStatus + value: Sats + +class ValidateAddressParam(TypedDict): + address: str + +WeekIndex = int +YearIndex = int +Index = Literal["dateindex", "decadeindex", "difficultyepoch", "emptyoutputindex", "halvingepoch", "height", "txinindex", "monthindex", "opreturnindex", "txoutindex", "p2aaddressindex", "p2msoutputindex", "p2pk33addressindex", "p2pk65addressindex", "p2pkhaddressindex", "p2shaddressindex", "p2traddressindex", "p2wpkhaddressindex", "p2wshaddressindex", "quarterindex", "semesterindex", "txindex", "unknownoutputindex", "weekindex", "yearindex", "loadedaddressindex", "emptyaddressindex"] +class MetricLeafWithSchema(TypedDict): + name: str + value_type: str + indexes: List[Index] + +TreeNode = dict[str, "TreeNode"] | MetricLeafWithSchema + +class BrkError(Exception): + """Custom error class for BRK client errors.""" + + def __init__(self, message: str, status: Optional[int] = None): + super().__init__(message) + self.status = status + + +class BrkClientBase: + """Base HTTP client for making requests.""" + + def __init__(self, base_url: str, timeout: float = 30.0): + self.base_url = base_url + self.timeout = timeout + self._client = httpx.Client(timeout=timeout) + + def get(self, path: str) -> Any: + """Make a GET request.""" + try: + response = self._client.get(f"{self.base_url}{path}") + response.raise_for_status() + return response.json() + except httpx.HTTPStatusError as e: + raise BrkError(f"HTTP error: {e.response.status_code}", e.response.status_code) + except httpx.RequestError as e: + raise BrkError(str(e)) + + def close(self): + """Close the HTTP client.""" + self._client.close() + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + self.close() + + +class MetricNode(Generic[T]): + """A metric node that can fetch data for different indexes.""" + + def __init__(self, client: BrkClientBase, path: str): + self._client = client + self._path = path + + def get(self) -> List[T]: + """Fetch all data points for this metric.""" + return self._client.get(self._path) + + def get_range(self, from_date: str, to_date: str) -> List[T]: + """Fetch data points within a date range.""" + return self._client.get(f"{self._path}?from={from_date}&to={to_date}") + + +# Index accessor classes + +class Indexes3(Generic[T]): + """Index accessor for metrics with 9 indexes.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.by_dateindex: MetricNode[T] = MetricNode(client, f'{base_path}/dateindex') + self.by_decadeindex: MetricNode[T] = MetricNode(client, f'{base_path}/decadeindex') + self.by_difficultyepoch: MetricNode[T] = MetricNode(client, f'{base_path}/difficultyepoch') + self.by_height: MetricNode[T] = MetricNode(client, f'{base_path}/height') + self.by_monthindex: MetricNode[T] = MetricNode(client, f'{base_path}/monthindex') + self.by_quarterindex: MetricNode[T] = MetricNode(client, f'{base_path}/quarterindex') + self.by_semesterindex: MetricNode[T] = MetricNode(client, f'{base_path}/semesterindex') + self.by_weekindex: MetricNode[T] = MetricNode(client, f'{base_path}/weekindex') + self.by_yearindex: MetricNode[T] = MetricNode(client, f'{base_path}/yearindex') + +class Indexes4(Generic[T]): + """Index accessor for metrics with 8 indexes.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.by_dateindex: MetricNode[T] = MetricNode(client, f'{base_path}/dateindex') + self.by_decadeindex: MetricNode[T] = MetricNode(client, f'{base_path}/decadeindex') + self.by_difficultyepoch: MetricNode[T] = MetricNode(client, f'{base_path}/difficultyepoch') + self.by_monthindex: MetricNode[T] = MetricNode(client, f'{base_path}/monthindex') + self.by_quarterindex: MetricNode[T] = MetricNode(client, f'{base_path}/quarterindex') + self.by_semesterindex: MetricNode[T] = MetricNode(client, f'{base_path}/semesterindex') + self.by_weekindex: MetricNode[T] = MetricNode(client, f'{base_path}/weekindex') + self.by_yearindex: MetricNode[T] = MetricNode(client, f'{base_path}/yearindex') + +class Indexes26(Generic[T]): + """Index accessor for metrics with 8 indexes.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.by_dateindex: MetricNode[T] = MetricNode(client, f'{base_path}/dateindex') + self.by_decadeindex: MetricNode[T] = MetricNode(client, f'{base_path}/decadeindex') + self.by_height: MetricNode[T] = MetricNode(client, f'{base_path}/height') + self.by_monthindex: MetricNode[T] = MetricNode(client, f'{base_path}/monthindex') + self.by_quarterindex: MetricNode[T] = MetricNode(client, f'{base_path}/quarterindex') + self.by_semesterindex: MetricNode[T] = MetricNode(client, f'{base_path}/semesterindex') + self.by_weekindex: MetricNode[T] = MetricNode(client, f'{base_path}/weekindex') + self.by_yearindex: MetricNode[T] = MetricNode(client, f'{base_path}/yearindex') + +class Indexes(Generic[T]): + """Index accessor for metrics with 7 indexes.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.by_dateindex: MetricNode[T] = MetricNode(client, f'{base_path}/dateindex') + self.by_decadeindex: MetricNode[T] = MetricNode(client, f'{base_path}/decadeindex') + self.by_monthindex: MetricNode[T] = MetricNode(client, f'{base_path}/monthindex') + self.by_quarterindex: MetricNode[T] = MetricNode(client, f'{base_path}/quarterindex') + self.by_semesterindex: MetricNode[T] = MetricNode(client, f'{base_path}/semesterindex') + self.by_weekindex: MetricNode[T] = MetricNode(client, f'{base_path}/weekindex') + self.by_yearindex: MetricNode[T] = MetricNode(client, f'{base_path}/yearindex') + +class Indexes27(Generic[T]): + """Index accessor for metrics with 7 indexes.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.by_decadeindex: MetricNode[T] = MetricNode(client, f'{base_path}/decadeindex') + self.by_height: MetricNode[T] = MetricNode(client, f'{base_path}/height') + self.by_monthindex: MetricNode[T] = MetricNode(client, f'{base_path}/monthindex') + self.by_quarterindex: MetricNode[T] = MetricNode(client, f'{base_path}/quarterindex') + self.by_semesterindex: MetricNode[T] = MetricNode(client, f'{base_path}/semesterindex') + self.by_weekindex: MetricNode[T] = MetricNode(client, f'{base_path}/weekindex') + self.by_yearindex: MetricNode[T] = MetricNode(client, f'{base_path}/yearindex') + +class Indexes28(Generic[T]): + """Index accessor for metrics with 6 indexes.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.by_decadeindex: MetricNode[T] = MetricNode(client, f'{base_path}/decadeindex') + self.by_monthindex: MetricNode[T] = MetricNode(client, f'{base_path}/monthindex') + self.by_quarterindex: MetricNode[T] = MetricNode(client, f'{base_path}/quarterindex') + self.by_semesterindex: MetricNode[T] = MetricNode(client, f'{base_path}/semesterindex') + self.by_weekindex: MetricNode[T] = MetricNode(client, f'{base_path}/weekindex') + self.by_yearindex: MetricNode[T] = MetricNode(client, f'{base_path}/yearindex') + +class Indexes15(Generic[T]): + """Index accessor for metrics with 3 indexes.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.by_quarterindex: MetricNode[T] = MetricNode(client, f'{base_path}/quarterindex') + self.by_semesterindex: MetricNode[T] = MetricNode(client, f'{base_path}/semesterindex') + self.by_yearindex: MetricNode[T] = MetricNode(client, f'{base_path}/yearindex') + +class Indexes13(Generic[T]): + """Index accessor for metrics with 2 indexes.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.by_dateindex: MetricNode[T] = MetricNode(client, f'{base_path}/dateindex') + self.by_height: MetricNode[T] = MetricNode(client, f'{base_path}/height') + +class Indexes14(Generic[T]): + """Index accessor for metrics with 2 indexes.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.by_monthindex: MetricNode[T] = MetricNode(client, f'{base_path}/monthindex') + self.by_weekindex: MetricNode[T] = MetricNode(client, f'{base_path}/weekindex') + +class Indexes2(Generic[T]): + """Index accessor for metrics with 1 indexes.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.by_height: MetricNode[T] = MetricNode(client, f'{base_path}/height') + +class Indexes5(Generic[T]): + """Index accessor for metrics with 1 indexes.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.by_dateindex: MetricNode[T] = MetricNode(client, f'{base_path}/dateindex') + +class Indexes6(Generic[T]): + """Index accessor for metrics with 1 indexes.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.by_txindex: MetricNode[T] = MetricNode(client, f'{base_path}/txindex') + +class Indexes7(Generic[T]): + """Index accessor for metrics with 1 indexes.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.by_decadeindex: MetricNode[T] = MetricNode(client, f'{base_path}/decadeindex') + +class Indexes8(Generic[T]): + """Index accessor for metrics with 1 indexes.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.by_monthindex: MetricNode[T] = MetricNode(client, f'{base_path}/monthindex') + +class Indexes9(Generic[T]): + """Index accessor for metrics with 1 indexes.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.by_quarterindex: MetricNode[T] = MetricNode(client, f'{base_path}/quarterindex') + +class Indexes10(Generic[T]): + """Index accessor for metrics with 1 indexes.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.by_semesterindex: MetricNode[T] = MetricNode(client, f'{base_path}/semesterindex') + +class Indexes11(Generic[T]): + """Index accessor for metrics with 1 indexes.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.by_weekindex: MetricNode[T] = MetricNode(client, f'{base_path}/weekindex') + +class Indexes12(Generic[T]): + """Index accessor for metrics with 1 indexes.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.by_yearindex: MetricNode[T] = MetricNode(client, f'{base_path}/yearindex') + +class Indexes16(Generic[T]): + """Index accessor for metrics with 1 indexes.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.by_p2aaddressindex: MetricNode[T] = MetricNode(client, f'{base_path}/p2aaddressindex') + +class Indexes17(Generic[T]): + """Index accessor for metrics with 1 indexes.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.by_p2pk33addressindex: MetricNode[T] = MetricNode(client, f'{base_path}/p2pk33addressindex') + +class Indexes18(Generic[T]): + """Index accessor for metrics with 1 indexes.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.by_p2pk65addressindex: MetricNode[T] = MetricNode(client, f'{base_path}/p2pk65addressindex') + +class Indexes19(Generic[T]): + """Index accessor for metrics with 1 indexes.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.by_p2pkhaddressindex: MetricNode[T] = MetricNode(client, f'{base_path}/p2pkhaddressindex') + +class Indexes20(Generic[T]): + """Index accessor for metrics with 1 indexes.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.by_p2shaddressindex: MetricNode[T] = MetricNode(client, f'{base_path}/p2shaddressindex') + +class Indexes21(Generic[T]): + """Index accessor for metrics with 1 indexes.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.by_p2traddressindex: MetricNode[T] = MetricNode(client, f'{base_path}/p2traddressindex') + +class Indexes22(Generic[T]): + """Index accessor for metrics with 1 indexes.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.by_p2wpkhaddressindex: MetricNode[T] = MetricNode(client, f'{base_path}/p2wpkhaddressindex') + +class Indexes23(Generic[T]): + """Index accessor for metrics with 1 indexes.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.by_p2wshaddressindex: MetricNode[T] = MetricNode(client, f'{base_path}/p2wshaddressindex') + +class Indexes24(Generic[T]): + """Index accessor for metrics with 1 indexes.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.by_txinindex: MetricNode[T] = MetricNode(client, f'{base_path}/txinindex') + +class Indexes25(Generic[T]): + """Index accessor for metrics with 1 indexes.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.by_txoutindex: MetricNode[T] = MetricNode(client, f'{base_path}/txoutindex') + +class Indexes29(Generic[T]): + """Index accessor for metrics with 1 indexes.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.by_emptyaddressindex: MetricNode[T] = MetricNode(client, f'{base_path}/emptyaddressindex') + +class Indexes30(Generic[T]): + """Index accessor for metrics with 1 indexes.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.by_loadedaddressindex: MetricNode[T] = MetricNode(client, f'{base_path}/loadedaddressindex') + +# Reusable structural pattern classes + +class RealizedPattern3: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.adjusted_sopr: Indexes5[StoredF64] = Indexes5(client, f'{base_path}/adjusted_sopr') + self.adjusted_sopr_30d_ema: Indexes5[StoredF64] = Indexes5(client, f'{base_path}/adjusted_sopr_30d_ema') + self.adjusted_sopr_7d_ema: Indexes5[StoredF64] = Indexes5(client, f'{base_path}/adjusted_sopr_7d_ema') + self.adjusted_value_created: Indexes3[Dollars] = Indexes3(client, f'{base_path}/adjusted_value_created') + self.adjusted_value_destroyed: Indexes3[Dollars] = Indexes3(client, f'{base_path}/adjusted_value_destroyed') + self.neg_realized_loss: BlockCountPattern[Dollars] = BlockCountPattern(client, f'{base_path}/neg_realized_loss') + self.net_realized_pnl: BlockCountPattern[Dollars] = BlockCountPattern(client, f'{base_path}/net_realized_pnl') + self.net_realized_pnl_cumulative_30d_delta: Indexes[Dollars] = Indexes(client, f'{base_path}/net_realized_pnl_cumulative_30d_delta') + self.net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: Indexes[StoredF32] = Indexes(client, f'{base_path}/net_realized_pnl_cumulative_30d_delta_rel_to_market_cap') + self.net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: Indexes[StoredF32] = Indexes(client, f'{base_path}/net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap') + self.net_realized_pnl_rel_to_realized_cap: Indexes2[StoredF32] = Indexes2(client, f'{base_path}/net_realized_pnl_rel_to_realized_cap') + self.realized_cap: Indexes3[Dollars] = Indexes3(client, f'{base_path}/realized_cap') + self.realized_cap_30d_delta: Indexes[Dollars] = Indexes(client, f'{base_path}/realized_cap_30d_delta') + self.realized_cap_rel_to_own_market_cap: Indexes3[StoredF32] = Indexes3(client, f'{base_path}/realized_cap_rel_to_own_market_cap') + self.realized_loss: BlockCountPattern[Dollars] = BlockCountPattern(client, f'{base_path}/realized_loss') + self.realized_loss_rel_to_realized_cap: Indexes2[StoredF32] = Indexes2(client, f'{base_path}/realized_loss_rel_to_realized_cap') + self.realized_price: Indexes3[Dollars] = Indexes3(client, f'{base_path}/realized_price') + self.realized_price_extra: ActivePriceRatioPattern = ActivePriceRatioPattern(client, f'{base_path}/realized_price_extra') + self.realized_profit: BlockCountPattern[Dollars] = BlockCountPattern(client, f'{base_path}/realized_profit') + self.realized_profit_rel_to_realized_cap: Indexes2[StoredF32] = Indexes2(client, f'{base_path}/realized_profit_rel_to_realized_cap') + self.realized_profit_to_loss_ratio: Indexes5[StoredF64] = Indexes5(client, f'{base_path}/realized_profit_to_loss_ratio') + self.realized_value: Indexes3[Dollars] = Indexes3(client, f'{base_path}/realized_value') + self.sell_side_risk_ratio: Indexes5[StoredF32] = Indexes5(client, f'{base_path}/sell_side_risk_ratio') + self.sell_side_risk_ratio_30d_ema: Indexes5[StoredF32] = Indexes5(client, f'{base_path}/sell_side_risk_ratio_30d_ema') + self.sell_side_risk_ratio_7d_ema: Indexes5[StoredF32] = Indexes5(client, f'{base_path}/sell_side_risk_ratio_7d_ema') + self.sopr: Indexes5[StoredF64] = Indexes5(client, f'{base_path}/sopr') + self.sopr_30d_ema: Indexes5[StoredF64] = Indexes5(client, f'{base_path}/sopr_30d_ema') + self.sopr_7d_ema: Indexes5[StoredF64] = Indexes5(client, f'{base_path}/sopr_7d_ema') + self.total_realized_pnl: BitcoinPattern2[Dollars] = BitcoinPattern2(client, f'{base_path}/total_realized_pnl') + self.value_created: Indexes3[Dollars] = Indexes3(client, f'{base_path}/value_created') + self.value_destroyed: Indexes3[Dollars] = Indexes3(client, f'{base_path}/value_destroyed') + +class Ratio1ySdPattern2: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self._0sd_usd: Indexes[Dollars] = Indexes(client, f'{base_path}/_0sd_usd') + self.m0_5sd: Indexes[StoredF32] = Indexes(client, f'{base_path}/m0_5sd') + self.m0_5sd_usd: Indexes[Dollars] = Indexes(client, f'{base_path}/m0_5sd_usd') + self.m1_5sd: Indexes[StoredF32] = Indexes(client, f'{base_path}/m1_5sd') + self.m1_5sd_usd: Indexes[Dollars] = Indexes(client, f'{base_path}/m1_5sd_usd') + self.m1sd: Indexes[StoredF32] = Indexes(client, f'{base_path}/m1sd') + self.m1sd_usd: Indexes[Dollars] = Indexes(client, f'{base_path}/m1sd_usd') + self.m2_5sd: Indexes[StoredF32] = Indexes(client, f'{base_path}/m2_5sd') + self.m2_5sd_usd: Indexes[Dollars] = Indexes(client, f'{base_path}/m2_5sd_usd') + self.m2sd: Indexes[StoredF32] = Indexes(client, f'{base_path}/m2sd') + self.m2sd_usd: Indexes[Dollars] = Indexes(client, f'{base_path}/m2sd_usd') + self.m3sd: Indexes[StoredF32] = Indexes(client, f'{base_path}/m3sd') + self.m3sd_usd: Indexes[Dollars] = Indexes(client, f'{base_path}/m3sd_usd') + self.p0_5sd: Indexes[StoredF32] = Indexes(client, f'{base_path}/p0_5sd') + self.p0_5sd_usd: Indexes[Dollars] = Indexes(client, f'{base_path}/p0_5sd_usd') + self.p1_5sd: Indexes[StoredF32] = Indexes(client, f'{base_path}/p1_5sd') + self.p1_5sd_usd: Indexes[Dollars] = Indexes(client, f'{base_path}/p1_5sd_usd') + self.p1sd: Indexes[StoredF32] = Indexes(client, f'{base_path}/p1sd') + self.p1sd_usd: Indexes[Dollars] = Indexes(client, f'{base_path}/p1sd_usd') + self.p2_5sd: Indexes[StoredF32] = Indexes(client, f'{base_path}/p2_5sd') + self.p2_5sd_usd: Indexes[Dollars] = Indexes(client, f'{base_path}/p2_5sd_usd') + self.p2sd: Indexes[StoredF32] = Indexes(client, f'{base_path}/p2sd') + self.p2sd_usd: Indexes[Dollars] = Indexes(client, f'{base_path}/p2sd_usd') + self.p3sd: Indexes[StoredF32] = Indexes(client, f'{base_path}/p3sd') + self.p3sd_usd: Indexes[Dollars] = Indexes(client, f'{base_path}/p3sd_usd') + self.sd: Indexes[StoredF32] = Indexes(client, f'{base_path}/sd') + self.sma: Indexes[StoredF32] = Indexes(client, f'{base_path}/sma') + self.zscore: Indexes[StoredF32] = Indexes(client, f'{base_path}/zscore') + +class RealizedPattern2: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.neg_realized_loss: BlockCountPattern[Dollars] = BlockCountPattern(client, f'{base_path}/neg_realized_loss') + self.net_realized_pnl: BlockCountPattern[Dollars] = BlockCountPattern(client, f'{base_path}/net_realized_pnl') + self.net_realized_pnl_cumulative_30d_delta: Indexes[Dollars] = Indexes(client, f'{base_path}/net_realized_pnl_cumulative_30d_delta') + self.net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: Indexes[StoredF32] = Indexes(client, f'{base_path}/net_realized_pnl_cumulative_30d_delta_rel_to_market_cap') + self.net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: Indexes[StoredF32] = Indexes(client, f'{base_path}/net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap') + self.net_realized_pnl_rel_to_realized_cap: Indexes2[StoredF32] = Indexes2(client, f'{base_path}/net_realized_pnl_rel_to_realized_cap') + self.realized_cap: Indexes3[Dollars] = Indexes3(client, f'{base_path}/realized_cap') + self.realized_cap_30d_delta: Indexes[Dollars] = Indexes(client, f'{base_path}/realized_cap_30d_delta') + self.realized_cap_rel_to_own_market_cap: Indexes3[StoredF32] = Indexes3(client, f'{base_path}/realized_cap_rel_to_own_market_cap') + self.realized_loss: BlockCountPattern[Dollars] = BlockCountPattern(client, f'{base_path}/realized_loss') + self.realized_loss_rel_to_realized_cap: Indexes2[StoredF32] = Indexes2(client, f'{base_path}/realized_loss_rel_to_realized_cap') + self.realized_price: Indexes3[Dollars] = Indexes3(client, f'{base_path}/realized_price') + self.realized_price_extra: ActivePriceRatioPattern = ActivePriceRatioPattern(client, f'{base_path}/realized_price_extra') + self.realized_profit: BlockCountPattern[Dollars] = BlockCountPattern(client, f'{base_path}/realized_profit') + self.realized_profit_rel_to_realized_cap: Indexes2[StoredF32] = Indexes2(client, f'{base_path}/realized_profit_rel_to_realized_cap') + self.realized_profit_to_loss_ratio: Indexes5[StoredF64] = Indexes5(client, f'{base_path}/realized_profit_to_loss_ratio') + self.realized_value: Indexes3[Dollars] = Indexes3(client, f'{base_path}/realized_value') + self.sell_side_risk_ratio: Indexes5[StoredF32] = Indexes5(client, f'{base_path}/sell_side_risk_ratio') + self.sell_side_risk_ratio_30d_ema: Indexes5[StoredF32] = Indexes5(client, f'{base_path}/sell_side_risk_ratio_30d_ema') + self.sell_side_risk_ratio_7d_ema: Indexes5[StoredF32] = Indexes5(client, f'{base_path}/sell_side_risk_ratio_7d_ema') + self.sopr: Indexes5[StoredF64] = Indexes5(client, f'{base_path}/sopr') + self.sopr_30d_ema: Indexes5[StoredF64] = Indexes5(client, f'{base_path}/sopr_30d_ema') + self.sopr_7d_ema: Indexes5[StoredF64] = Indexes5(client, f'{base_path}/sopr_7d_ema') + self.total_realized_pnl: BitcoinPattern2[Dollars] = BitcoinPattern2(client, f'{base_path}/total_realized_pnl') + self.value_created: Indexes3[Dollars] = Indexes3(client, f'{base_path}/value_created') + self.value_destroyed: Indexes3[Dollars] = Indexes3(client, f'{base_path}/value_destroyed') + +class RealizedPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.neg_realized_loss: BlockCountPattern[Dollars] = BlockCountPattern(client, f'{base_path}/neg_realized_loss') + self.net_realized_pnl: BlockCountPattern[Dollars] = BlockCountPattern(client, f'{base_path}/net_realized_pnl') + self.net_realized_pnl_cumulative_30d_delta: Indexes[Dollars] = Indexes(client, f'{base_path}/net_realized_pnl_cumulative_30d_delta') + self.net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: Indexes[StoredF32] = Indexes(client, f'{base_path}/net_realized_pnl_cumulative_30d_delta_rel_to_market_cap') + self.net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: Indexes[StoredF32] = Indexes(client, f'{base_path}/net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap') + self.net_realized_pnl_rel_to_realized_cap: Indexes2[StoredF32] = Indexes2(client, f'{base_path}/net_realized_pnl_rel_to_realized_cap') + self.realized_cap: Indexes3[Dollars] = Indexes3(client, f'{base_path}/realized_cap') + self.realized_cap_30d_delta: Indexes[Dollars] = Indexes(client, f'{base_path}/realized_cap_30d_delta') + self.realized_loss: BlockCountPattern[Dollars] = BlockCountPattern(client, f'{base_path}/realized_loss') + self.realized_loss_rel_to_realized_cap: Indexes2[StoredF32] = Indexes2(client, f'{base_path}/realized_loss_rel_to_realized_cap') + self.realized_price: Indexes3[Dollars] = Indexes3(client, f'{base_path}/realized_price') + self.realized_price_extra: RealizedPriceExtraPattern = RealizedPriceExtraPattern(client, f'{base_path}/realized_price_extra') + self.realized_profit: BlockCountPattern[Dollars] = BlockCountPattern(client, f'{base_path}/realized_profit') + self.realized_profit_rel_to_realized_cap: Indexes2[StoredF32] = Indexes2(client, f'{base_path}/realized_profit_rel_to_realized_cap') + self.realized_value: Indexes3[Dollars] = Indexes3(client, f'{base_path}/realized_value') + self.sell_side_risk_ratio: Indexes5[StoredF32] = Indexes5(client, f'{base_path}/sell_side_risk_ratio') + self.sell_side_risk_ratio_30d_ema: Indexes5[StoredF32] = Indexes5(client, f'{base_path}/sell_side_risk_ratio_30d_ema') + self.sell_side_risk_ratio_7d_ema: Indexes5[StoredF32] = Indexes5(client, f'{base_path}/sell_side_risk_ratio_7d_ema') + self.sopr: Indexes5[StoredF64] = Indexes5(client, f'{base_path}/sopr') + self.sopr_30d_ema: Indexes5[StoredF64] = Indexes5(client, f'{base_path}/sopr_30d_ema') + self.sopr_7d_ema: Indexes5[StoredF64] = Indexes5(client, f'{base_path}/sopr_7d_ema') + self.total_realized_pnl: BitcoinPattern2[Dollars] = BitcoinPattern2(client, f'{base_path}/total_realized_pnl') + self.value_created: Indexes3[Dollars] = Indexes3(client, f'{base_path}/value_created') + self.value_destroyed: Indexes3[Dollars] = Indexes3(client, f'{base_path}/value_destroyed') + +class Price13dEmaPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.price: Indexes[Dollars] = Indexes(client, f'/{acc}') + self.ratio: Indexes[StoredF32] = Indexes(client, f'/{acc}_ratio') + self.ratio_1m_sma: Indexes[StoredF32] = Indexes(client, f'/{acc}_ratio_1m_sma') + self.ratio_1w_sma: Indexes[StoredF32] = Indexes(client, f'/{acc}_ratio_1w_sma') + self.ratio_1y_sd: Ratio1ySdPattern2 = Ratio1ySdPattern2(client, f'{acc}_ratio_1y_sd') + self.ratio_2y_sd: Ratio1ySdPattern2 = Ratio1ySdPattern2(client, f'{acc}_ratio_2y_sd') + self.ratio_4y_sd: Ratio1ySdPattern2 = Ratio1ySdPattern2(client, f'{acc}_ratio_4y_sd') + self.ratio_pct1: Indexes[StoredF32] = Indexes(client, f'/{acc}_ratio_pct1') + self.ratio_pct1_usd: Indexes[Dollars] = Indexes(client, f'/{acc}_ratio_pct1_usd') + self.ratio_pct2: Indexes[StoredF32] = Indexes(client, f'/{acc}_ratio_pct2') + self.ratio_pct2_usd: Indexes[Dollars] = Indexes(client, f'/{acc}_ratio_pct2_usd') + self.ratio_pct5: Indexes[StoredF32] = Indexes(client, f'/{acc}_ratio_pct5') + self.ratio_pct5_usd: Indexes[Dollars] = Indexes(client, f'/{acc}_ratio_pct5_usd') + self.ratio_pct95: Indexes[StoredF32] = Indexes(client, f'/{acc}_ratio_pct95') + self.ratio_pct95_usd: Indexes[Dollars] = Indexes(client, f'/{acc}_ratio_pct95_usd') + self.ratio_pct98: Indexes[StoredF32] = Indexes(client, f'/{acc}_ratio_pct98') + self.ratio_pct98_usd: Indexes[Dollars] = Indexes(client, f'/{acc}_ratio_pct98_usd') + self.ratio_pct99: Indexes[StoredF32] = Indexes(client, f'/{acc}_ratio_pct99') + self.ratio_pct99_usd: Indexes[Dollars] = Indexes(client, f'/{acc}_ratio_pct99_usd') + self.ratio_sd: Ratio1ySdPattern2 = Ratio1ySdPattern2(client, f'{acc}_ratio_sd') + +class PricePercentilesPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.pct05: Indexes[Dollars] = Indexes(client, f'{base_path}/pct05') + self.pct10: Indexes[Dollars] = Indexes(client, f'{base_path}/pct10') + self.pct15: Indexes[Dollars] = Indexes(client, f'{base_path}/pct15') + self.pct20: Indexes[Dollars] = Indexes(client, f'{base_path}/pct20') + self.pct25: Indexes[Dollars] = Indexes(client, f'{base_path}/pct25') + self.pct30: Indexes[Dollars] = Indexes(client, f'{base_path}/pct30') + self.pct35: Indexes[Dollars] = Indexes(client, f'{base_path}/pct35') + self.pct40: Indexes[Dollars] = Indexes(client, f'{base_path}/pct40') + self.pct45: Indexes[Dollars] = Indexes(client, f'{base_path}/pct45') + self.pct50: Indexes[Dollars] = Indexes(client, f'{base_path}/pct50') + self.pct55: Indexes[Dollars] = Indexes(client, f'{base_path}/pct55') + self.pct60: Indexes[Dollars] = Indexes(client, f'{base_path}/pct60') + self.pct65: Indexes[Dollars] = Indexes(client, f'{base_path}/pct65') + self.pct70: Indexes[Dollars] = Indexes(client, f'{base_path}/pct70') + self.pct75: Indexes[Dollars] = Indexes(client, f'{base_path}/pct75') + self.pct80: Indexes[Dollars] = Indexes(client, f'{base_path}/pct80') + self.pct85: Indexes[Dollars] = Indexes(client, f'{base_path}/pct85') + self.pct90: Indexes[Dollars] = Indexes(client, f'{base_path}/pct90') + self.pct95: Indexes[Dollars] = Indexes(client, f'{base_path}/pct95') + +class RelativePattern2: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.neg_unrealized_loss_rel_to_market_cap: Indexes27[StoredF32] = Indexes27(client, f'{base_path}/neg_unrealized_loss_rel_to_market_cap') + self.neg_unrealized_loss_rel_to_own_market_cap: Indexes27[StoredF32] = Indexes27(client, f'{base_path}/neg_unrealized_loss_rel_to_own_market_cap') + self.neg_unrealized_loss_rel_to_own_total_unrealized_pnl: Indexes27[StoredF32] = Indexes27(client, f'{base_path}/neg_unrealized_loss_rel_to_own_total_unrealized_pnl') + self.net_unrealized_pnl_rel_to_market_cap: Indexes26[StoredF32] = Indexes26(client, f'{base_path}/net_unrealized_pnl_rel_to_market_cap') + self.net_unrealized_pnl_rel_to_own_market_cap: Indexes26[StoredF32] = Indexes26(client, f'{base_path}/net_unrealized_pnl_rel_to_own_market_cap') + self.net_unrealized_pnl_rel_to_own_total_unrealized_pnl: Indexes26[StoredF32] = Indexes26(client, f'{base_path}/net_unrealized_pnl_rel_to_own_total_unrealized_pnl') + self.supply_in_loss_rel_to_circulating_supply: Indexes27[StoredF64] = Indexes27(client, f'{base_path}/supply_in_loss_rel_to_circulating_supply') + self.supply_in_loss_rel_to_own_supply: Indexes27[StoredF64] = Indexes27(client, f'{base_path}/supply_in_loss_rel_to_own_supply') + self.supply_in_profit_rel_to_circulating_supply: Indexes27[StoredF64] = Indexes27(client, f'{base_path}/supply_in_profit_rel_to_circulating_supply') + self.supply_in_profit_rel_to_own_supply: Indexes27[StoredF64] = Indexes27(client, f'{base_path}/supply_in_profit_rel_to_own_supply') + self.supply_rel_to_circulating_supply: Indexes[StoredF64] = Indexes(client, f'{base_path}/supply_rel_to_circulating_supply') + self.unrealized_loss_rel_to_market_cap: Indexes27[StoredF32] = Indexes27(client, f'{base_path}/unrealized_loss_rel_to_market_cap') + self.unrealized_loss_rel_to_own_market_cap: Indexes27[StoredF32] = Indexes27(client, f'{base_path}/unrealized_loss_rel_to_own_market_cap') + self.unrealized_loss_rel_to_own_total_unrealized_pnl: Indexes27[StoredF32] = Indexes27(client, f'{base_path}/unrealized_loss_rel_to_own_total_unrealized_pnl') + self.unrealized_profit_rel_to_market_cap: Indexes27[StoredF32] = Indexes27(client, f'{base_path}/unrealized_profit_rel_to_market_cap') + self.unrealized_profit_rel_to_own_market_cap: Indexes27[StoredF32] = Indexes27(client, f'{base_path}/unrealized_profit_rel_to_own_market_cap') + self.unrealized_profit_rel_to_own_total_unrealized_pnl: Indexes27[StoredF32] = Indexes27(client, f'{base_path}/unrealized_profit_rel_to_own_total_unrealized_pnl') + +class Ratio1ySdPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.m0_5sd: Indexes[StoredF32] = Indexes(client, f'{base_path}/m0_5sd') + self.m1_5sd: Indexes[StoredF32] = Indexes(client, f'{base_path}/m1_5sd') + self.m1sd: Indexes[StoredF32] = Indexes(client, f'{base_path}/m1sd') + self.m2_5sd: Indexes[StoredF32] = Indexes(client, f'{base_path}/m2_5sd') + self.m2sd: Indexes[StoredF32] = Indexes(client, f'{base_path}/m2sd') + self.m3sd: Indexes[StoredF32] = Indexes(client, f'{base_path}/m3sd') + self.p0_5sd: Indexes[StoredF32] = Indexes(client, f'{base_path}/p0_5sd') + self.p1_5sd: Indexes[StoredF32] = Indexes(client, f'{base_path}/p1_5sd') + self.p1sd: Indexes[StoredF32] = Indexes(client, f'{base_path}/p1sd') + self.p2_5sd: Indexes[StoredF32] = Indexes(client, f'{base_path}/p2_5sd') + self.p2sd: Indexes[StoredF32] = Indexes(client, f'{base_path}/p2sd') + self.p3sd: Indexes[StoredF32] = Indexes(client, f'{base_path}/p3sd') + self.sd: Indexes[StoredF32] = Indexes(client, f'{base_path}/sd') + self.sma: Indexes[StoredF32] = Indexes(client, f'{base_path}/sma') + self.zscore: Indexes[StoredF32] = Indexes(client, f'{base_path}/zscore') + +class ActivePriceRatioPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.ratio: Indexes[StoredF32] = Indexes(client, f'{base_path}/ratio') + self.ratio_1m_sma: Indexes[StoredF32] = Indexes(client, f'{base_path}/ratio_1m_sma') + self.ratio_1w_sma: Indexes[StoredF32] = Indexes(client, f'{base_path}/ratio_1w_sma') + self.ratio_1y_sd: Ratio1ySdPattern = Ratio1ySdPattern(client, f'{base_path}/ratio_1y_sd') + self.ratio_2y_sd: Ratio1ySdPattern = Ratio1ySdPattern(client, f'{base_path}/ratio_2y_sd') + self.ratio_4y_sd: Ratio1ySdPattern = Ratio1ySdPattern(client, f'{base_path}/ratio_4y_sd') + self.ratio_pct1: Indexes[StoredF32] = Indexes(client, f'{base_path}/ratio_pct1') + self.ratio_pct2: Indexes[StoredF32] = Indexes(client, f'{base_path}/ratio_pct2') + self.ratio_pct5: Indexes[StoredF32] = Indexes(client, f'{base_path}/ratio_pct5') + self.ratio_pct95: Indexes[StoredF32] = Indexes(client, f'{base_path}/ratio_pct95') + self.ratio_pct98: Indexes[StoredF32] = Indexes(client, f'{base_path}/ratio_pct98') + self.ratio_pct99: Indexes[StoredF32] = Indexes(client, f'{base_path}/ratio_pct99') + self.ratio_sd: Ratio1ySdPattern = Ratio1ySdPattern(client, f'{base_path}/ratio_sd') + +class AXbtPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self._1d_dominance: BlockCountPattern[StoredF32] = BlockCountPattern(client, f'{base_path}/1d_dominance') + self._1m_blocks_mined: Indexes[StoredU32] = Indexes(client, f'{base_path}/1m_blocks_mined') + self._1m_dominance: Indexes[StoredF32] = Indexes(client, f'{base_path}/1m_dominance') + self._1w_blocks_mined: Indexes[StoredU32] = Indexes(client, f'{base_path}/1w_blocks_mined') + self._1w_dominance: Indexes[StoredF32] = Indexes(client, f'{base_path}/1w_dominance') + self._1y_blocks_mined: Indexes[StoredU32] = Indexes(client, f'{base_path}/1y_blocks_mined') + self._1y_dominance: Indexes[StoredF32] = Indexes(client, f'{base_path}/1y_dominance') + self.blocks_mined: BlockCountPattern[StoredU32] = BlockCountPattern(client, f'{base_path}/blocks_mined') + self.coinbase: UnclaimedRewardsPattern = UnclaimedRewardsPattern(client, f'{base_path}/coinbase') + self.days_since_block: Indexes[StoredU16] = Indexes(client, f'{base_path}/days_since_block') + self.dominance: BlockCountPattern[StoredF32] = BlockCountPattern(client, f'{base_path}/dominance') + self.fee: UnclaimedRewardsPattern = UnclaimedRewardsPattern(client, f'{base_path}/fee') + self.subsidy: UnclaimedRewardsPattern = UnclaimedRewardsPattern(client, f'{base_path}/subsidy') + +class BitcoinPattern(Generic[T]): + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.average: Indexes4[T] = Indexes4(client, f'{base_path}/average') + self.base: Indexes2[T] = Indexes2(client, f'{base_path}/base') + self.cumulative: Indexes3[T] = Indexes3(client, f'{base_path}/cumulative') + self.max: Indexes4[T] = Indexes4(client, f'{base_path}/max') + self.median: Indexes5[T] = Indexes5(client, f'{base_path}/median') + self.min: Indexes4[T] = Indexes4(client, f'{base_path}/min') + self.pct10: Indexes5[T] = Indexes5(client, f'{base_path}/pct10') + self.pct25: Indexes5[T] = Indexes5(client, f'{base_path}/pct25') + self.pct75: Indexes5[T] = Indexes5(client, f'{base_path}/pct75') + self.pct90: Indexes5[T] = Indexes5(client, f'{base_path}/pct90') + self.sum: Indexes4[T] = Indexes4(client, f'{base_path}/sum') + +class BlockSizePattern(Generic[T]): + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.average: Indexes4[T] = Indexes4(client, f'{base_path}/average') + self.cumulative: Indexes3[T] = Indexes3(client, f'{base_path}/cumulative') + self.max: Indexes4[T] = Indexes4(client, f'{base_path}/max') + self.median: Indexes5[T] = Indexes5(client, f'{base_path}/median') + self.min: Indexes4[T] = Indexes4(client, f'{base_path}/min') + self.pct10: Indexes5[T] = Indexes5(client, f'{base_path}/pct10') + self.pct25: Indexes5[T] = Indexes5(client, f'{base_path}/pct25') + self.pct75: Indexes5[T] = Indexes5(client, f'{base_path}/pct75') + self.pct90: Indexes5[T] = Indexes5(client, f'{base_path}/pct90') + self.sum: Indexes4[T] = Indexes4(client, f'{base_path}/sum') + +class UnrealizedPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.neg_unrealized_loss: Indexes26[Dollars] = Indexes26(client, f'{base_path}/neg_unrealized_loss') + self.net_unrealized_pnl: Indexes26[Dollars] = Indexes26(client, f'{base_path}/net_unrealized_pnl') + self.supply_in_loss: SupplyPattern = SupplyPattern(client, f'{base_path}/supply_in_loss') + self.supply_in_loss_value: SupplyValuePattern = SupplyValuePattern(client, f'{base_path}/supply_in_loss_value') + self.supply_in_profit: SupplyPattern = SupplyPattern(client, f'{base_path}/supply_in_profit') + self.supply_in_profit_value: SupplyValuePattern = SupplyValuePattern(client, f'{base_path}/supply_in_profit_value') + self.total_unrealized_pnl: Indexes26[Dollars] = Indexes26(client, f'{base_path}/total_unrealized_pnl') + self.unrealized_loss: Indexes26[Dollars] = Indexes26(client, f'{base_path}/unrealized_loss') + self.unrealized_profit: Indexes26[Dollars] = Indexes26(client, f'{base_path}/unrealized_profit') + +class RelativePattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.neg_unrealized_loss_rel_to_market_cap: Indexes27[StoredF32] = Indexes27(client, f'{base_path}/neg_unrealized_loss_rel_to_market_cap') + self.net_unrealized_pnl_rel_to_market_cap: Indexes26[StoredF32] = Indexes26(client, f'{base_path}/net_unrealized_pnl_rel_to_market_cap') + self.supply_in_loss_rel_to_circulating_supply: Indexes27[StoredF64] = Indexes27(client, f'{base_path}/supply_in_loss_rel_to_circulating_supply') + self.supply_in_loss_rel_to_own_supply: Indexes27[StoredF64] = Indexes27(client, f'{base_path}/supply_in_loss_rel_to_own_supply') + self.supply_in_profit_rel_to_circulating_supply: Indexes27[StoredF64] = Indexes27(client, f'{base_path}/supply_in_profit_rel_to_circulating_supply') + self.supply_in_profit_rel_to_own_supply: Indexes27[StoredF64] = Indexes27(client, f'{base_path}/supply_in_profit_rel_to_own_supply') + self.supply_rel_to_circulating_supply: Indexes[StoredF64] = Indexes(client, f'{base_path}/supply_rel_to_circulating_supply') + self.unrealized_loss_rel_to_market_cap: Indexes27[StoredF32] = Indexes27(client, f'{base_path}/unrealized_loss_rel_to_market_cap') + self.unrealized_profit_rel_to_market_cap: Indexes27[StoredF32] = Indexes27(client, f'{base_path}/unrealized_profit_rel_to_market_cap') + +class AddresstypeToHeightToAddrCountPattern(Generic[T]): + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.p2a: Indexes16[T] = Indexes16(client, f'{base_path}/p2a') + self.p2pk33: Indexes17[T] = Indexes17(client, f'{base_path}/p2pk33') + self.p2pk65: Indexes18[T] = Indexes18(client, f'{base_path}/p2pk65') + self.p2pkh: Indexes19[T] = Indexes19(client, f'{base_path}/p2pkh') + self.p2sh: Indexes20[T] = Indexes20(client, f'{base_path}/p2sh') + self.p2tr: Indexes21[T] = Indexes21(client, f'{base_path}/p2tr') + self.p2wpkh: Indexes22[T] = Indexes22(client, f'{base_path}/p2wpkh') + self.p2wsh: Indexes23[T] = Indexes23(client, f'{base_path}/p2wsh') + +class BlockIntervalPattern(Generic[T]): + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.average: Indexes3[T] = Indexes3(client, f'/{acc}_avg') + self.max: Indexes3[T] = Indexes3(client, f'/{acc}_max') + self.median: Indexes2[T] = Indexes2(client, f'/{acc}_median') + self.min: Indexes3[T] = Indexes3(client, f'/{acc}_min') + self.pct10: Indexes2[T] = Indexes2(client, f'/{acc}_pct10') + self.pct25: Indexes2[T] = Indexes2(client, f'/{acc}_pct25') + self.pct75: Indexes2[T] = Indexes2(client, f'/{acc}_pct75') + self.pct90: Indexes2[T] = Indexes2(client, f'/{acc}_pct90') + +class Constant0Pattern(Generic[T]): + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.dateindex: Indexes5[T] = Indexes5(client, f'/{acc}') + self.decadeindex: Indexes7[T] = Indexes7(client, f'/{acc}') + self.height: Indexes2[T] = Indexes2(client, f'/{acc}') + self.monthindex: Indexes8[T] = Indexes8(client, f'/{acc}') + self.quarterindex: Indexes9[T] = Indexes9(client, f'/{acc}') + self.semesterindex: Indexes10[T] = Indexes10(client, f'/{acc}') + self.weekindex: Indexes11[T] = Indexes11(client, f'/{acc}') + self.yearindex: Indexes12[T] = Indexes12(client, f'/{acc}') + +class _0satsPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.activity: ActivityPattern = ActivityPattern(client, f'{base_path}/activity') + self.addr_count: Indexes3[StoredU64] = Indexes3(client, f'{base_path}/addr_count') + self.price_paid: PricePaidPattern = PricePaidPattern(client, f'{base_path}/price_paid') + self.realized: RealizedPattern = RealizedPattern(client, f'{base_path}/realized') + self.relative: RelativePattern = RelativePattern(client, f'{base_path}/relative') + self.supply: SupplyPattern2 = SupplyPattern2(client, f'{base_path}/supply') + self.unrealized: UnrealizedPattern = UnrealizedPattern(client, f'{base_path}/unrealized') + +class UpTo1dPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.activity: ActivityPattern = ActivityPattern(client, f'{base_path}/activity') + self.price_paid: PricePaidPattern2 = PricePaidPattern2(client, f'{base_path}/price_paid') + self.realized: RealizedPattern3 = RealizedPattern3(client, f'{base_path}/realized') + self.relative: RelativePattern2 = RelativePattern2(client, f'{base_path}/relative') + self.supply: SupplyPattern2 = SupplyPattern2(client, f'{base_path}/supply') + self.unrealized: UnrealizedPattern = UnrealizedPattern(client, f'{base_path}/unrealized') + +class _0satsPattern2: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.activity: ActivityPattern = ActivityPattern(client, f'{base_path}/activity') + self.price_paid: PricePaidPattern = PricePaidPattern(client, f'{base_path}/price_paid') + self.realized: RealizedPattern = RealizedPattern(client, f'{base_path}/realized') + self.relative: RelativePattern = RelativePattern(client, f'{base_path}/relative') + self.supply: SupplyPattern2 = SupplyPattern2(client, f'{base_path}/supply') + self.unrealized: UnrealizedPattern = UnrealizedPattern(client, f'{base_path}/unrealized') + +class _10yTo12yPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.activity: ActivityPattern = ActivityPattern(client, f'{base_path}/activity') + self.price_paid: PricePaidPattern2 = PricePaidPattern2(client, f'{base_path}/price_paid') + self.realized: RealizedPattern2 = RealizedPattern2(client, f'{base_path}/realized') + self.relative: RelativePattern2 = RelativePattern2(client, f'{base_path}/relative') + self.supply: SupplyPattern2 = SupplyPattern2(client, f'{base_path}/supply') + self.unrealized: UnrealizedPattern = UnrealizedPattern(client, f'{base_path}/unrealized') + +class SupplyPattern2: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.supply: SupplyPattern = SupplyPattern(client, f'{base_path}/supply') + self.supply_half: ActiveSupplyPattern = ActiveSupplyPattern(client, f'{base_path}/supply_half') + self.supply_half_value: ActiveSupplyPattern = ActiveSupplyPattern(client, f'{base_path}/supply_half_value') + self.supply_value: SupplyValuePattern = SupplyValuePattern(client, f'{base_path}/supply_value') + self.utxo_count: Indexes3[StoredU64] = Indexes3(client, f'{base_path}/utxo_count') + +class ActivityPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.coinblocks_destroyed: BlockCountPattern[StoredF64] = BlockCountPattern(client, f'{base_path}/coinblocks_destroyed') + self.coindays_destroyed: BlockCountPattern[StoredF64] = BlockCountPattern(client, f'{base_path}/coindays_destroyed') + self.satblocks_destroyed: Indexes2[Sats] = Indexes2(client, f'{base_path}/satblocks_destroyed') + self.satdays_destroyed: Indexes2[Sats] = Indexes2(client, f'{base_path}/satdays_destroyed') + self.sent: SentPattern = SentPattern(client, f'{base_path}/sent') + +class SentPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.base: Indexes2[Sats] = Indexes2(client, f'{base_path}/base') + self.bitcoin: BlockCountPattern[Bitcoin] = BlockCountPattern(client, f'{base_path}/bitcoin') + self.dollars: BlockCountPattern[Dollars] = BlockCountPattern(client, f'{base_path}/dollars') + self.sats: SatsPattern = SatsPattern(client, f'{base_path}/sats') + +class SupplyPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.base: Indexes2[Sats] = Indexes2(client, f'{base_path}/base') + self.bitcoin: Indexes[Bitcoin] = Indexes(client, f'{base_path}/bitcoin') + self.dollars: Indexes[Dollars] = Indexes(client, f'{base_path}/dollars') + self.sats: Indexes[Sats] = Indexes(client, f'{base_path}/sats') + +class CoinbasePattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.bitcoin: BitcoinPattern[Bitcoin] = BitcoinPattern(client, f'{base_path}/bitcoin') + self.dollars: BitcoinPattern[Dollars] = BitcoinPattern(client, f'{base_path}/dollars') + self.sats: BitcoinPattern[Sats] = BitcoinPattern(client, f'{base_path}/sats') + +class ActiveSupplyPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.bitcoin: Indexes3[Bitcoin] = Indexes3(client, f'{base_path}/bitcoin') + self.dollars: Indexes3[Dollars] = Indexes3(client, f'{base_path}/dollars') + self.sats: Indexes3[Sats] = Indexes3(client, f'{base_path}/sats') + +class UnclaimedRewardsPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.bitcoin: BlockCountPattern[Bitcoin] = BlockCountPattern(client, f'{base_path}/bitcoin') + self.dollars: BlockCountPattern[Dollars] = BlockCountPattern(client, f'{base_path}/dollars') + self.sats: BlockCountPattern[Sats] = BlockCountPattern(client, f'{base_path}/sats') + +class PricePaidPattern2: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.max_price_paid: Indexes3[Dollars] = Indexes3(client, f'{base_path}/max_price_paid') + self.min_price_paid: Indexes3[Dollars] = Indexes3(client, f'{base_path}/min_price_paid') + self.price_percentiles: PricePercentilesPattern = PricePercentilesPattern(client, f'{base_path}/price_percentiles') + +class BlockCountPattern(Generic[T]): + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.base: Indexes2[T] = Indexes2(client, f'{base_path}/base') + self.cumulative: Indexes3[T] = Indexes3(client, f'{base_path}/cumulative') + self.sum: Indexes4[T] = Indexes4(client, f'{base_path}/sum') + +class SupplyValuePattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.bitcoin: Indexes2[Bitcoin] = Indexes2(client, f'{base_path}/bitcoin') + self.dollars: Indexes2[Dollars] = Indexes2(client, f'{base_path}/dollars') + +class PricePaidPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.max_price_paid: Indexes3[Dollars] = Indexes3(client, f'{base_path}/max_price_paid') + self.min_price_paid: Indexes3[Dollars] = Indexes3(client, f'{base_path}/min_price_paid') + +class SatsPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.cumulative: Indexes3[Sats] = Indexes3(client, f'{base_path}/cumulative') + self.sum: Indexes4[Sats] = Indexes4(client, f'{base_path}/sum') + +class _1dReturns1mSdPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.sd: Indexes[StoredF32] = Indexes(client, f'/{acc}_sd') + self.sma: Indexes[StoredF32] = Indexes(client, f'/{acc}_sma') + +class BitcoinPattern2(Generic[T]): + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.base: Indexes2[T] = Indexes2(client, f'{base_path}/base') + self.sum: Indexes4[T] = Indexes4(client, f'{base_path}/sum') + +class RealizedPriceExtraPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, base_path: str): + self.ratio: Indexes[StoredF32] = Indexes(client, f'{base_path}/ratio') + +# Catalog tree classes + +class CatalogTree: + """Catalog tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.computed: CatalogTree_Computed = CatalogTree_Computed(client, f'{base_path}/computed') + self.indexed: CatalogTree_Indexed = CatalogTree_Indexed(client, f'{base_path}/indexed') + +class CatalogTree_Computed: + """Catalog tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.blks: CatalogTree_Computed_Blks = CatalogTree_Computed_Blks(client, f'{base_path}/blks') + self.chain: CatalogTree_Computed_Chain = CatalogTree_Computed_Chain(client, f'{base_path}/chain') + self.cointime: CatalogTree_Computed_Cointime = CatalogTree_Computed_Cointime(client, f'{base_path}/cointime') + self.constants: CatalogTree_Computed_Constants = CatalogTree_Computed_Constants(client, f'{base_path}/constants') + self.fetched: CatalogTree_Computed_Fetched = CatalogTree_Computed_Fetched(client, f'{base_path}/fetched') + self.indexes: CatalogTree_Computed_Indexes = CatalogTree_Computed_Indexes(client, f'{base_path}/indexes') + self.market: CatalogTree_Computed_Market = CatalogTree_Computed_Market(client, f'{base_path}/market') + self.pools: CatalogTree_Computed_Pools = CatalogTree_Computed_Pools(client, f'{base_path}/pools') + self.price: CatalogTree_Computed_Price = CatalogTree_Computed_Price(client, f'{base_path}/price') + self.stateful: CatalogTree_Computed_Stateful = CatalogTree_Computed_Stateful(client, f'{base_path}/stateful') + self.txins: CatalogTree_Computed_Txins = CatalogTree_Computed_Txins(client, f'{base_path}/txins') + self.txouts: CatalogTree_Computed_Txouts = CatalogTree_Computed_Txouts(client, f'{base_path}/txouts') + +class CatalogTree_Computed_Blks: + """Catalog tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.position: MetricNode[BlkPosition] = MetricNode(client, f'{base_path}/position') + +class CatalogTree_Computed_Chain: + """Catalog tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._1m_block_count: Indexes[StoredU32] = Indexes(client, f'{base_path}/1m_block_count') + self._1w_block_count: Indexes[StoredU32] = Indexes(client, f'{base_path}/1w_block_count') + self._1y_block_count: Indexes[StoredU32] = Indexes(client, f'{base_path}/1y_block_count') + self._24h_block_count: Indexes2[StoredU32] = Indexes2(client, f'{base_path}/24h_block_count') + self._24h_coinbase_sum: Indexes2[Sats] = Indexes2(client, f'{base_path}/24h_coinbase_sum') + self._24h_coinbase_usd_sum: Indexes2[Dollars] = Indexes2(client, f'{base_path}/24h_coinbase_usd_sum') + self.annualized_volume: Indexes[Sats] = Indexes(client, f'{base_path}/annualized_volume') + self.annualized_volume_btc: Indexes[Bitcoin] = Indexes(client, f'{base_path}/annualized_volume_btc') + self.annualized_volume_usd: Indexes[Dollars] = Indexes(client, f'{base_path}/annualized_volume_usd') + self.block_count: BlockCountPattern[StoredU32] = BlockCountPattern(client, f'{base_path}/block_count') + self.block_count_target: Indexes[StoredU64] = Indexes(client, f'{base_path}/block_count_target') + self.block_interval: BlockIntervalPattern[Timestamp] = BlockIntervalPattern(client, 'block_interval') + self.block_size: BlockSizePattern[StoredU64] = BlockSizePattern(client, f'{base_path}/block_size') + self.block_vbytes: BlockSizePattern[StoredU64] = BlockSizePattern(client, f'{base_path}/block_vbytes') + self.block_weight: BlockSizePattern[Weight] = BlockSizePattern(client, f'{base_path}/block_weight') + self.blocks_before_next_difficulty_adjustment: Indexes3[StoredU32] = Indexes3(client, f'{base_path}/blocks_before_next_difficulty_adjustment') + self.blocks_before_next_halving: Indexes3[StoredU32] = Indexes3(client, f'{base_path}/blocks_before_next_halving') + self.coinbase: CoinbasePattern = CoinbasePattern(client, f'{base_path}/coinbase') + self.days_before_next_difficulty_adjustment: Indexes3[StoredF32] = Indexes3(client, f'{base_path}/days_before_next_difficulty_adjustment') + self.days_before_next_halving: Indexes3[StoredF32] = Indexes3(client, f'{base_path}/days_before_next_halving') + self.difficulty: Indexes4[StoredF64] = Indexes4(client, f'{base_path}/difficulty') + self.difficulty_adjustment: Indexes3[StoredF32] = Indexes3(client, f'{base_path}/difficulty_adjustment') + self.difficulty_as_hash: Indexes3[StoredF32] = Indexes3(client, f'{base_path}/difficulty_as_hash') + self.difficultyepoch: Indexes[DifficultyEpoch] = Indexes(client, f'{base_path}/difficultyepoch') + self.emptyoutput_count: BitcoinPattern[StoredU64] = BitcoinPattern(client, f'{base_path}/emptyoutput_count') + self.exact_utxo_count: Indexes3[StoredU64] = Indexes3(client, f'{base_path}/exact_utxo_count') + self.fee: CatalogTree_Computed_Chain_Fee = CatalogTree_Computed_Chain_Fee(client, f'{base_path}/fee') + self.fee_dominance: Indexes5[StoredF32] = Indexes5(client, f'{base_path}/fee_dominance') + self.fee_rate: CatalogTree_Computed_Chain_FeeRate = CatalogTree_Computed_Chain_FeeRate(client, f'{base_path}/fee_rate') + self.halvingepoch: Indexes[HalvingEpoch] = Indexes(client, f'{base_path}/halvingepoch') + self.hash_price_phs: Indexes3[StoredF32] = Indexes3(client, f'{base_path}/hash_price_phs') + self.hash_price_phs_min: Indexes3[StoredF32] = Indexes3(client, f'{base_path}/hash_price_phs_min') + self.hash_price_rebound: Indexes3[StoredF32] = Indexes3(client, f'{base_path}/hash_price_rebound') + self.hash_price_ths: Indexes3[StoredF32] = Indexes3(client, f'{base_path}/hash_price_ths') + self.hash_price_ths_min: Indexes3[StoredF32] = Indexes3(client, f'{base_path}/hash_price_ths_min') + self.hash_rate: Indexes3[StoredF64] = Indexes3(client, f'{base_path}/hash_rate') + self.hash_rate_1m_sma: Indexes[StoredF32] = Indexes(client, f'{base_path}/hash_rate_1m_sma') + self.hash_rate_1w_sma: Indexes[StoredF64] = Indexes(client, f'{base_path}/hash_rate_1w_sma') + self.hash_rate_1y_sma: Indexes[StoredF32] = Indexes(client, f'{base_path}/hash_rate_1y_sma') + self.hash_rate_2m_sma: Indexes[StoredF32] = Indexes(client, f'{base_path}/hash_rate_2m_sma') + self.hash_value_phs: Indexes3[StoredF32] = Indexes3(client, f'{base_path}/hash_value_phs') + self.hash_value_phs_min: Indexes3[StoredF32] = Indexes3(client, f'{base_path}/hash_value_phs_min') + self.hash_value_rebound: Indexes3[StoredF32] = Indexes3(client, f'{base_path}/hash_value_rebound') + self.hash_value_ths: Indexes3[StoredF32] = Indexes3(client, f'{base_path}/hash_value_ths') + self.hash_value_ths_min: Indexes3[StoredF32] = Indexes3(client, f'{base_path}/hash_value_ths_min') + self.inflation_rate: Indexes[StoredF32] = Indexes(client, f'{base_path}/inflation_rate') + self.input_count: BlockSizePattern[StoredU64] = BlockSizePattern(client, f'{base_path}/input_count') + self.input_value: Indexes6[Sats] = Indexes6(client, f'{base_path}/input_value') + self.inputs_per_sec: Indexes[StoredF32] = Indexes(client, f'{base_path}/inputs_per_sec') + self.interval: Indexes2[Timestamp] = Indexes2(client, f'{base_path}/interval') + self.is_coinbase: Indexes6[StoredBool] = Indexes6(client, f'{base_path}/is_coinbase') + self.opreturn_count: BitcoinPattern[StoredU64] = BitcoinPattern(client, f'{base_path}/opreturn_count') + self.output_count: BlockSizePattern[StoredU64] = BlockSizePattern(client, f'{base_path}/output_count') + self.output_value: Indexes6[Sats] = Indexes6(client, f'{base_path}/output_value') + self.outputs_per_sec: Indexes[StoredF32] = Indexes(client, f'{base_path}/outputs_per_sec') + self.p2a_count: BitcoinPattern[StoredU64] = BitcoinPattern(client, f'{base_path}/p2a_count') + self.p2ms_count: BitcoinPattern[StoredU64] = BitcoinPattern(client, f'{base_path}/p2ms_count') + self.p2pk33_count: BitcoinPattern[StoredU64] = BitcoinPattern(client, f'{base_path}/p2pk33_count') + self.p2pk65_count: BitcoinPattern[StoredU64] = BitcoinPattern(client, f'{base_path}/p2pk65_count') + self.p2pkh_count: BitcoinPattern[StoredU64] = BitcoinPattern(client, f'{base_path}/p2pkh_count') + self.p2sh_count: BitcoinPattern[StoredU64] = BitcoinPattern(client, f'{base_path}/p2sh_count') + self.p2tr_count: BitcoinPattern[StoredU64] = BitcoinPattern(client, f'{base_path}/p2tr_count') + self.p2wpkh_count: BitcoinPattern[StoredU64] = BitcoinPattern(client, f'{base_path}/p2wpkh_count') + self.p2wsh_count: BitcoinPattern[StoredU64] = BitcoinPattern(client, f'{base_path}/p2wsh_count') + self.puell_multiple: Indexes[StoredF32] = Indexes(client, f'{base_path}/puell_multiple') + self.sent_sum: CatalogTree_Computed_Chain_SentSum = CatalogTree_Computed_Chain_SentSum(client, f'{base_path}/sent_sum') + self.subsidy: CoinbasePattern = CoinbasePattern(client, f'{base_path}/subsidy') + self.subsidy_dominance: Indexes5[StoredF32] = Indexes5(client, f'{base_path}/subsidy_dominance') + self.subsidy_usd_1y_sma: Indexes[Dollars] = Indexes(client, f'{base_path}/subsidy_usd_1y_sma') + self.timestamp: MetricNode[Timestamp] = MetricNode(client, f'{base_path}/timestamp') + self.tx_btc_velocity: Indexes[StoredF64] = Indexes(client, f'{base_path}/tx_btc_velocity') + self.tx_count: BitcoinPattern[StoredU64] = BitcoinPattern(client, f'{base_path}/tx_count') + self.tx_per_sec: Indexes[StoredF32] = Indexes(client, f'{base_path}/tx_per_sec') + self.tx_usd_velocity: Indexes[StoredF64] = Indexes(client, f'{base_path}/tx_usd_velocity') + self.tx_v1: BlockCountPattern[StoredU64] = BlockCountPattern(client, f'{base_path}/tx_v1') + self.tx_v2: BlockCountPattern[StoredU64] = BlockCountPattern(client, f'{base_path}/tx_v2') + self.tx_v3: BlockCountPattern[StoredU64] = BlockCountPattern(client, f'{base_path}/tx_v3') + self.tx_vsize: BlockIntervalPattern[VSize] = BlockIntervalPattern(client, 'tx_vsize') + self.tx_weight: BlockIntervalPattern[Weight] = BlockIntervalPattern(client, 'tx_weight') + self.unclaimed_rewards: UnclaimedRewardsPattern = UnclaimedRewardsPattern(client, f'{base_path}/unclaimed_rewards') + self.unknownoutput_count: BitcoinPattern[StoredU64] = BitcoinPattern(client, f'{base_path}/unknownoutput_count') + self.vbytes: Indexes2[StoredU64] = Indexes2(client, f'{base_path}/vbytes') + self.vsize: Indexes6[VSize] = Indexes6(client, f'{base_path}/vsize') + self.weight: Indexes6[Weight] = Indexes6(client, f'{base_path}/weight') + +class CatalogTree_Computed_Chain_Fee: + """Catalog tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.base: Indexes6[Sats] = Indexes6(client, f'{base_path}/base') + self.bitcoin: BlockSizePattern[Bitcoin] = BlockSizePattern(client, f'{base_path}/bitcoin') + self.bitcoin_txindex: Indexes6[Bitcoin] = Indexes6(client, f'{base_path}/bitcoin_txindex') + self.dollars: BlockSizePattern[Dollars] = BlockSizePattern(client, f'{base_path}/dollars') + self.dollars_txindex: Indexes6[Dollars] = Indexes6(client, f'{base_path}/dollars_txindex') + self.sats: BlockSizePattern[Sats] = BlockSizePattern(client, f'{base_path}/sats') + +class CatalogTree_Computed_Chain_FeeRate: + """Catalog tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.average: Indexes3[FeeRate] = Indexes3(client, f'{base_path}/average') + self.base: Indexes6[FeeRate] = Indexes6(client, f'{base_path}/base') + self.max: Indexes3[FeeRate] = Indexes3(client, f'{base_path}/max') + self.median: Indexes2[FeeRate] = Indexes2(client, f'{base_path}/median') + self.min: Indexes3[FeeRate] = Indexes3(client, f'{base_path}/min') + self.pct10: Indexes2[FeeRate] = Indexes2(client, f'{base_path}/pct10') + self.pct25: Indexes2[FeeRate] = Indexes2(client, f'{base_path}/pct25') + self.pct75: Indexes2[FeeRate] = Indexes2(client, f'{base_path}/pct75') + self.pct90: Indexes2[FeeRate] = Indexes2(client, f'{base_path}/pct90') + +class CatalogTree_Computed_Chain_SentSum: + """Catalog tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.bitcoin: BitcoinPattern2[Bitcoin] = BitcoinPattern2(client, f'{base_path}/bitcoin') + self.dollars: Indexes3[Dollars] = Indexes3(client, f'{base_path}/dollars') + self.sats: Indexes3[Sats] = Indexes3(client, f'{base_path}/sats') + +class CatalogTree_Computed_Cointime: + """Catalog tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.active_cap: Indexes3[Dollars] = Indexes3(client, f'{base_path}/active_cap') + self.active_price: Indexes3[Dollars] = Indexes3(client, f'{base_path}/active_price') + self.active_price_ratio: ActivePriceRatioPattern = ActivePriceRatioPattern(client, f'{base_path}/active_price_ratio') + self.active_supply: ActiveSupplyPattern = ActiveSupplyPattern(client, f'{base_path}/active_supply') + self.activity_to_vaultedness_ratio: Indexes3[StoredF64] = Indexes3(client, f'{base_path}/activity_to_vaultedness_ratio') + self.coinblocks_created: BlockCountPattern[StoredF64] = BlockCountPattern(client, f'{base_path}/coinblocks_created') + self.coinblocks_stored: BlockCountPattern[StoredF64] = BlockCountPattern(client, f'{base_path}/coinblocks_stored') + self.cointime_adj_inflation_rate: Indexes[StoredF32] = Indexes(client, f'{base_path}/cointime_adj_inflation_rate') + self.cointime_adj_tx_btc_velocity: Indexes[StoredF64] = Indexes(client, f'{base_path}/cointime_adj_tx_btc_velocity') + self.cointime_adj_tx_usd_velocity: Indexes[StoredF64] = Indexes(client, f'{base_path}/cointime_adj_tx_usd_velocity') + self.cointime_cap: Indexes3[Dollars] = Indexes3(client, f'{base_path}/cointime_cap') + self.cointime_price: Indexes3[Dollars] = Indexes3(client, f'{base_path}/cointime_price') + self.cointime_price_ratio: ActivePriceRatioPattern = ActivePriceRatioPattern(client, f'{base_path}/cointime_price_ratio') + self.cointime_value_created: BlockCountPattern[StoredF64] = BlockCountPattern(client, f'{base_path}/cointime_value_created') + self.cointime_value_destroyed: BlockCountPattern[StoredF64] = BlockCountPattern(client, f'{base_path}/cointime_value_destroyed') + self.cointime_value_stored: BlockCountPattern[StoredF64] = BlockCountPattern(client, f'{base_path}/cointime_value_stored') + self.investor_cap: Indexes3[Dollars] = Indexes3(client, f'{base_path}/investor_cap') + self.liveliness: Indexes3[StoredF64] = Indexes3(client, f'{base_path}/liveliness') + self.thermo_cap: Indexes3[Dollars] = Indexes3(client, f'{base_path}/thermo_cap') + self.true_market_mean: Indexes3[Dollars] = Indexes3(client, f'{base_path}/true_market_mean') + self.true_market_mean_ratio: ActivePriceRatioPattern = ActivePriceRatioPattern(client, f'{base_path}/true_market_mean_ratio') + self.vaulted_cap: Indexes3[Dollars] = Indexes3(client, f'{base_path}/vaulted_cap') + self.vaulted_price: Indexes3[Dollars] = Indexes3(client, f'{base_path}/vaulted_price') + self.vaulted_price_ratio: ActivePriceRatioPattern = ActivePriceRatioPattern(client, f'{base_path}/vaulted_price_ratio') + self.vaulted_supply: ActiveSupplyPattern = ActiveSupplyPattern(client, f'{base_path}/vaulted_supply') + self.vaultedness: Indexes3[StoredF64] = Indexes3(client, f'{base_path}/vaultedness') + +class CatalogTree_Computed_Constants: + """Catalog tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.constant_0: Constant0Pattern[StoredU16] = Constant0Pattern(client, 'constant_0') + self.constant_1: Constant0Pattern[StoredU16] = Constant0Pattern(client, 'constant_1') + self.constant_100: Constant0Pattern[StoredU16] = Constant0Pattern(client, 'constant_100') + self.constant_2: Constant0Pattern[StoredU16] = Constant0Pattern(client, 'constant_2') + self.constant_3: Constant0Pattern[StoredU16] = Constant0Pattern(client, 'constant_3') + self.constant_38_2: Constant0Pattern[StoredF32] = Constant0Pattern(client, 'constant_38_2') + self.constant_4: Constant0Pattern[StoredU16] = Constant0Pattern(client, 'constant_4') + self.constant_50: Constant0Pattern[StoredU16] = Constant0Pattern(client, 'constant_50') + self.constant_600: Constant0Pattern[StoredU16] = Constant0Pattern(client, 'constant_600') + self.constant_61_8: Constant0Pattern[StoredF32] = Constant0Pattern(client, 'constant_61_8') + self.constant_minus_1: Constant0Pattern[StoredI16] = Constant0Pattern(client, 'constant_minus_1') + self.constant_minus_2: Constant0Pattern[StoredI16] = Constant0Pattern(client, 'constant_minus_2') + self.constant_minus_3: Constant0Pattern[StoredI16] = Constant0Pattern(client, 'constant_minus_3') + self.constant_minus_4: Constant0Pattern[StoredI16] = Constant0Pattern(client, 'constant_minus_4') + +class CatalogTree_Computed_Fetched: + """Catalog tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.price_ohlc_in_cents: Indexes13[OHLCCents] = Indexes13(client, f'{base_path}/price_ohlc_in_cents') + +class CatalogTree_Computed_Indexes: + """Catalog tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.date: Indexes13[Date] = Indexes13(client, f'{base_path}/date') + self.date_fixed: Indexes2[Date] = Indexes2(client, f'{base_path}/date_fixed') + self.dateindex: Indexes13[DateIndex] = Indexes13(client, f'{base_path}/dateindex') + self.dateindex_count: Indexes14[StoredU64] = Indexes14(client, f'{base_path}/dateindex_count') + self.decadeindex: MetricNode[DecadeIndex] = MetricNode(client, f'{base_path}/decadeindex') + self.difficultyepoch: MetricNode[DifficultyEpoch] = MetricNode(client, f'{base_path}/difficultyepoch') + self.emptyoutputindex: MetricNode[EmptyOutputIndex] = MetricNode(client, f'{base_path}/emptyoutputindex') + self.first_dateindex: Indexes14[DateIndex] = Indexes14(client, f'{base_path}/first_dateindex') + self.first_height: MetricNode[Height] = MetricNode(client, f'{base_path}/first_height') + self.first_monthindex: Indexes15[MonthIndex] = Indexes15(client, f'{base_path}/first_monthindex') + self.first_yearindex: Indexes7[YearIndex] = Indexes7(client, f'{base_path}/first_yearindex') + self.halvingepoch: MetricNode[HalvingEpoch] = MetricNode(client, f'{base_path}/halvingepoch') + self.height: Indexes2[Height] = Indexes2(client, f'{base_path}/height') + self.height_count: MetricNode[StoredU64] = MetricNode(client, f'{base_path}/height_count') + self.input_count: Indexes6[StoredU64] = Indexes6(client, f'{base_path}/input_count') + self.monthindex: MetricNode[MonthIndex] = MetricNode(client, f'{base_path}/monthindex') + self.monthindex_count: Indexes15[StoredU64] = Indexes15(client, f'{base_path}/monthindex_count') + self.opreturnindex: MetricNode[OpReturnIndex] = MetricNode(client, f'{base_path}/opreturnindex') + self.output_count: Indexes6[StoredU64] = Indexes6(client, f'{base_path}/output_count') + self.p2aaddressindex: Indexes16[P2AAddressIndex] = Indexes16(client, f'{base_path}/p2aaddressindex') + self.p2msoutputindex: MetricNode[P2MSOutputIndex] = MetricNode(client, f'{base_path}/p2msoutputindex') + self.p2pk33addressindex: Indexes17[P2PK33AddressIndex] = Indexes17(client, f'{base_path}/p2pk33addressindex') + self.p2pk65addressindex: Indexes18[P2PK65AddressIndex] = Indexes18(client, f'{base_path}/p2pk65addressindex') + self.p2pkhaddressindex: Indexes19[P2PKHAddressIndex] = Indexes19(client, f'{base_path}/p2pkhaddressindex') + self.p2shaddressindex: Indexes20[P2SHAddressIndex] = Indexes20(client, f'{base_path}/p2shaddressindex') + self.p2traddressindex: Indexes21[P2TRAddressIndex] = Indexes21(client, f'{base_path}/p2traddressindex') + self.p2wpkhaddressindex: Indexes22[P2WPKHAddressIndex] = Indexes22(client, f'{base_path}/p2wpkhaddressindex') + self.p2wshaddressindex: Indexes23[P2WSHAddressIndex] = Indexes23(client, f'{base_path}/p2wshaddressindex') + self.quarterindex: MetricNode[QuarterIndex] = MetricNode(client, f'{base_path}/quarterindex') + self.semesterindex: MetricNode[SemesterIndex] = MetricNode(client, f'{base_path}/semesterindex') + self.timestamp_fixed: Indexes2[Timestamp] = Indexes2(client, f'{base_path}/timestamp_fixed') + self.txindex: Indexes6[TxIndex] = Indexes6(client, f'{base_path}/txindex') + self.txindex_count: Indexes2[StoredU64] = Indexes2(client, f'{base_path}/txindex_count') + self.txinindex: Indexes24[TxInIndex] = Indexes24(client, f'{base_path}/txinindex') + self.txoutindex: Indexes25[TxOutIndex] = Indexes25(client, f'{base_path}/txoutindex') + self.unknownoutputindex: MetricNode[UnknownOutputIndex] = MetricNode(client, f'{base_path}/unknownoutputindex') + self.weekindex: MetricNode[WeekIndex] = MetricNode(client, f'{base_path}/weekindex') + self.yearindex: MetricNode[YearIndex] = MetricNode(client, f'{base_path}/yearindex') + self.yearindex_count: Indexes7[StoredU64] = Indexes7(client, f'{base_path}/yearindex_count') + +class CatalogTree_Computed_Market: + """Catalog tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._1d_returns_1m_sd: _1dReturns1mSdPattern = _1dReturns1mSdPattern(client, '1d_returns_1m_sd') + self._1d_returns_1w_sd: _1dReturns1mSdPattern = _1dReturns1mSdPattern(client, '1d_returns_1w_sd') + self._1d_returns_1y_sd: _1dReturns1mSdPattern = _1dReturns1mSdPattern(client, '1d_returns_1y_sd') + self._10y_cagr: Indexes[StoredF32] = Indexes(client, f'{base_path}/_10y_cagr') + self._10y_dca_avg_price: Indexes[Dollars] = Indexes(client, f'{base_path}/_10y_dca_avg_price') + self._10y_dca_cagr: Indexes[StoredF32] = Indexes(client, f'{base_path}/_10y_dca_cagr') + self._10y_dca_returns: Indexes[StoredF32] = Indexes(client, f'{base_path}/_10y_dca_returns') + self._10y_dca_stack: Indexes[Sats] = Indexes(client, f'{base_path}/_10y_dca_stack') + self._10y_price_returns: Indexes[StoredF32] = Indexes(client, f'{base_path}/_10y_price_returns') + self._1d_price_returns: Indexes[StoredF32] = Indexes(client, f'{base_path}/_1d_price_returns') + self._1m_dca_avg_price: Indexes[Dollars] = Indexes(client, f'{base_path}/_1m_dca_avg_price') + self._1m_dca_returns: Indexes[StoredF32] = Indexes(client, f'{base_path}/_1m_dca_returns') + self._1m_dca_stack: Indexes[Sats] = Indexes(client, f'{base_path}/_1m_dca_stack') + self._1m_price_returns: Indexes[StoredF32] = Indexes(client, f'{base_path}/_1m_price_returns') + self._1w_dca_avg_price: Indexes[Dollars] = Indexes(client, f'{base_path}/_1w_dca_avg_price') + self._1w_dca_returns: Indexes[StoredF32] = Indexes(client, f'{base_path}/_1w_dca_returns') + self._1w_dca_stack: Indexes[Sats] = Indexes(client, f'{base_path}/_1w_dca_stack') + self._1w_price_returns: Indexes[StoredF32] = Indexes(client, f'{base_path}/_1w_price_returns') + self._1y_dca_avg_price: Indexes[Dollars] = Indexes(client, f'{base_path}/_1y_dca_avg_price') + self._1y_dca_returns: Indexes[StoredF32] = Indexes(client, f'{base_path}/_1y_dca_returns') + self._1y_dca_stack: Indexes[Sats] = Indexes(client, f'{base_path}/_1y_dca_stack') + self._1y_price_returns: Indexes[StoredF32] = Indexes(client, f'{base_path}/_1y_price_returns') + self._2y_cagr: Indexes[StoredF32] = Indexes(client, f'{base_path}/_2y_cagr') + self._2y_dca_avg_price: Indexes[Dollars] = Indexes(client, f'{base_path}/_2y_dca_avg_price') + self._2y_dca_cagr: Indexes[StoredF32] = Indexes(client, f'{base_path}/_2y_dca_cagr') + self._2y_dca_returns: Indexes[StoredF32] = Indexes(client, f'{base_path}/_2y_dca_returns') + self._2y_dca_stack: Indexes[Sats] = Indexes(client, f'{base_path}/_2y_dca_stack') + self._2y_price_returns: Indexes[StoredF32] = Indexes(client, f'{base_path}/_2y_price_returns') + self._3m_dca_avg_price: Indexes[Dollars] = Indexes(client, f'{base_path}/_3m_dca_avg_price') + self._3m_dca_returns: Indexes[StoredF32] = Indexes(client, f'{base_path}/_3m_dca_returns') + self._3m_dca_stack: Indexes[Sats] = Indexes(client, f'{base_path}/_3m_dca_stack') + self._3m_price_returns: Indexes[StoredF32] = Indexes(client, f'{base_path}/_3m_price_returns') + self._3y_cagr: Indexes[StoredF32] = Indexes(client, f'{base_path}/_3y_cagr') + self._3y_dca_avg_price: Indexes[Dollars] = Indexes(client, f'{base_path}/_3y_dca_avg_price') + self._3y_dca_cagr: Indexes[StoredF32] = Indexes(client, f'{base_path}/_3y_dca_cagr') + self._3y_dca_returns: Indexes[StoredF32] = Indexes(client, f'{base_path}/_3y_dca_returns') + self._3y_dca_stack: Indexes[Sats] = Indexes(client, f'{base_path}/_3y_dca_stack') + self._3y_price_returns: Indexes[StoredF32] = Indexes(client, f'{base_path}/_3y_price_returns') + self._4y_cagr: Indexes[StoredF32] = Indexes(client, f'{base_path}/_4y_cagr') + self._4y_dca_avg_price: Indexes[Dollars] = Indexes(client, f'{base_path}/_4y_dca_avg_price') + self._4y_dca_cagr: Indexes[StoredF32] = Indexes(client, f'{base_path}/_4y_dca_cagr') + self._4y_dca_returns: Indexes[StoredF32] = Indexes(client, f'{base_path}/_4y_dca_returns') + self._4y_dca_stack: Indexes[Sats] = Indexes(client, f'{base_path}/_4y_dca_stack') + self._4y_price_returns: Indexes[StoredF32] = Indexes(client, f'{base_path}/_4y_price_returns') + self._5y_cagr: Indexes[StoredF32] = Indexes(client, f'{base_path}/_5y_cagr') + self._5y_dca_avg_price: Indexes[Dollars] = Indexes(client, f'{base_path}/_5y_dca_avg_price') + self._5y_dca_cagr: Indexes[StoredF32] = Indexes(client, f'{base_path}/_5y_dca_cagr') + self._5y_dca_returns: Indexes[StoredF32] = Indexes(client, f'{base_path}/_5y_dca_returns') + self._5y_dca_stack: Indexes[Sats] = Indexes(client, f'{base_path}/_5y_dca_stack') + self._5y_price_returns: Indexes[StoredF32] = Indexes(client, f'{base_path}/_5y_price_returns') + self._6m_dca_avg_price: Indexes[Dollars] = Indexes(client, f'{base_path}/_6m_dca_avg_price') + self._6m_dca_returns: Indexes[StoredF32] = Indexes(client, f'{base_path}/_6m_dca_returns') + self._6m_dca_stack: Indexes[Sats] = Indexes(client, f'{base_path}/_6m_dca_stack') + self._6m_price_returns: Indexes[StoredF32] = Indexes(client, f'{base_path}/_6m_price_returns') + self._6y_cagr: Indexes[StoredF32] = Indexes(client, f'{base_path}/_6y_cagr') + self._6y_dca_avg_price: Indexes[Dollars] = Indexes(client, f'{base_path}/_6y_dca_avg_price') + self._6y_dca_cagr: Indexes[StoredF32] = Indexes(client, f'{base_path}/_6y_dca_cagr') + self._6y_dca_returns: Indexes[StoredF32] = Indexes(client, f'{base_path}/_6y_dca_returns') + self._6y_dca_stack: Indexes[Sats] = Indexes(client, f'{base_path}/_6y_dca_stack') + self._6y_price_returns: Indexes[StoredF32] = Indexes(client, f'{base_path}/_6y_price_returns') + self._8y_cagr: Indexes[StoredF32] = Indexes(client, f'{base_path}/_8y_cagr') + self._8y_dca_avg_price: Indexes[Dollars] = Indexes(client, f'{base_path}/_8y_dca_avg_price') + self._8y_dca_cagr: Indexes[StoredF32] = Indexes(client, f'{base_path}/_8y_dca_cagr') + self._8y_dca_returns: Indexes[StoredF32] = Indexes(client, f'{base_path}/_8y_dca_returns') + self._8y_dca_stack: Indexes[Sats] = Indexes(client, f'{base_path}/_8y_dca_stack') + self._8y_price_returns: Indexes[StoredF32] = Indexes(client, f'{base_path}/_8y_price_returns') + self.days_since_price_ath: Indexes[StoredU16] = Indexes(client, f'{base_path}/days_since_price_ath') + self.dca_class_2015_avg_price: Indexes[Dollars] = Indexes(client, f'{base_path}/dca_class_2015_avg_price') + self.dca_class_2015_returns: Indexes[StoredF32] = Indexes(client, f'{base_path}/dca_class_2015_returns') + self.dca_class_2015_stack: Indexes[Sats] = Indexes(client, f'{base_path}/dca_class_2015_stack') + self.dca_class_2016_avg_price: Indexes[Dollars] = Indexes(client, f'{base_path}/dca_class_2016_avg_price') + self.dca_class_2016_returns: Indexes[StoredF32] = Indexes(client, f'{base_path}/dca_class_2016_returns') + self.dca_class_2016_stack: Indexes[Sats] = Indexes(client, f'{base_path}/dca_class_2016_stack') + self.dca_class_2017_avg_price: Indexes[Dollars] = Indexes(client, f'{base_path}/dca_class_2017_avg_price') + self.dca_class_2017_returns: Indexes[StoredF32] = Indexes(client, f'{base_path}/dca_class_2017_returns') + self.dca_class_2017_stack: Indexes[Sats] = Indexes(client, f'{base_path}/dca_class_2017_stack') + self.dca_class_2018_avg_price: Indexes[Dollars] = Indexes(client, f'{base_path}/dca_class_2018_avg_price') + self.dca_class_2018_returns: Indexes[StoredF32] = Indexes(client, f'{base_path}/dca_class_2018_returns') + self.dca_class_2018_stack: Indexes[Sats] = Indexes(client, f'{base_path}/dca_class_2018_stack') + self.dca_class_2019_avg_price: Indexes[Dollars] = Indexes(client, f'{base_path}/dca_class_2019_avg_price') + self.dca_class_2019_returns: Indexes[StoredF32] = Indexes(client, f'{base_path}/dca_class_2019_returns') + self.dca_class_2019_stack: Indexes[Sats] = Indexes(client, f'{base_path}/dca_class_2019_stack') + self.dca_class_2020_avg_price: Indexes[Dollars] = Indexes(client, f'{base_path}/dca_class_2020_avg_price') + self.dca_class_2020_returns: Indexes[StoredF32] = Indexes(client, f'{base_path}/dca_class_2020_returns') + self.dca_class_2020_stack: Indexes[Sats] = Indexes(client, f'{base_path}/dca_class_2020_stack') + self.dca_class_2021_avg_price: Indexes[Dollars] = Indexes(client, f'{base_path}/dca_class_2021_avg_price') + self.dca_class_2021_returns: Indexes[StoredF32] = Indexes(client, f'{base_path}/dca_class_2021_returns') + self.dca_class_2021_stack: Indexes[Sats] = Indexes(client, f'{base_path}/dca_class_2021_stack') + self.dca_class_2022_avg_price: Indexes[Dollars] = Indexes(client, f'{base_path}/dca_class_2022_avg_price') + self.dca_class_2022_returns: Indexes[StoredF32] = Indexes(client, f'{base_path}/dca_class_2022_returns') + self.dca_class_2022_stack: Indexes[Sats] = Indexes(client, f'{base_path}/dca_class_2022_stack') + self.dca_class_2023_avg_price: Indexes[Dollars] = Indexes(client, f'{base_path}/dca_class_2023_avg_price') + self.dca_class_2023_returns: Indexes[StoredF32] = Indexes(client, f'{base_path}/dca_class_2023_returns') + self.dca_class_2023_stack: Indexes[Sats] = Indexes(client, f'{base_path}/dca_class_2023_stack') + self.dca_class_2024_avg_price: Indexes[Dollars] = Indexes(client, f'{base_path}/dca_class_2024_avg_price') + self.dca_class_2024_returns: Indexes[StoredF32] = Indexes(client, f'{base_path}/dca_class_2024_returns') + self.dca_class_2024_stack: Indexes[Sats] = Indexes(client, f'{base_path}/dca_class_2024_stack') + self.dca_class_2025_avg_price: Indexes[Dollars] = Indexes(client, f'{base_path}/dca_class_2025_avg_price') + self.dca_class_2025_returns: Indexes[StoredF32] = Indexes(client, f'{base_path}/dca_class_2025_returns') + self.dca_class_2025_stack: Indexes[Sats] = Indexes(client, f'{base_path}/dca_class_2025_stack') + self.max_days_between_price_aths: Indexes[StoredU16] = Indexes(client, f'{base_path}/max_days_between_price_aths') + self.max_years_between_price_aths: Indexes[StoredF32] = Indexes(client, f'{base_path}/max_years_between_price_aths') + self.price_10y_ago: Indexes[Dollars] = Indexes(client, f'{base_path}/price_10y_ago') + self.price_13d_ema: Price13dEmaPattern = Price13dEmaPattern(client, 'price_13d_ema') + self.price_13d_sma: Price13dEmaPattern = Price13dEmaPattern(client, 'price_13d_sma') + self.price_144d_ema: Price13dEmaPattern = Price13dEmaPattern(client, 'price_144d_ema') + self.price_144d_sma: Price13dEmaPattern = Price13dEmaPattern(client, 'price_144d_sma') + self.price_1d_ago: Indexes[Dollars] = Indexes(client, f'{base_path}/price_1d_ago') + self.price_1m_ago: Indexes[Dollars] = Indexes(client, f'{base_path}/price_1m_ago') + self.price_1m_ema: Price13dEmaPattern = Price13dEmaPattern(client, 'price_1m_ema') + self.price_1m_max: Indexes[Dollars] = Indexes(client, f'{base_path}/price_1m_max') + self.price_1m_min: Indexes[Dollars] = Indexes(client, f'{base_path}/price_1m_min') + self.price_1m_sma: Price13dEmaPattern = Price13dEmaPattern(client, 'price_1m_sma') + self.price_1m_volatility: Indexes[StoredF32] = Indexes(client, f'{base_path}/price_1m_volatility') + self.price_1w_ago: Indexes[Dollars] = Indexes(client, f'{base_path}/price_1w_ago') + self.price_1w_ema: Price13dEmaPattern = Price13dEmaPattern(client, 'price_1w_ema') + self.price_1w_max: Indexes[Dollars] = Indexes(client, f'{base_path}/price_1w_max') + self.price_1w_min: Indexes[Dollars] = Indexes(client, f'{base_path}/price_1w_min') + self.price_1w_sma: Price13dEmaPattern = Price13dEmaPattern(client, 'price_1w_sma') + self.price_1w_volatility: Indexes[StoredF32] = Indexes(client, f'{base_path}/price_1w_volatility') + self.price_1y_ago: Indexes[Dollars] = Indexes(client, f'{base_path}/price_1y_ago') + self.price_1y_ema: Price13dEmaPattern = Price13dEmaPattern(client, 'price_1y_ema') + self.price_1y_max: Indexes[Dollars] = Indexes(client, f'{base_path}/price_1y_max') + self.price_1y_min: Indexes[Dollars] = Indexes(client, f'{base_path}/price_1y_min') + self.price_1y_sma: Price13dEmaPattern = Price13dEmaPattern(client, 'price_1y_sma') + self.price_1y_volatility: Indexes[StoredF32] = Indexes(client, f'{base_path}/price_1y_volatility') + self.price_200d_ema: Price13dEmaPattern = Price13dEmaPattern(client, 'price_200d_ema') + self.price_200d_sma: Price13dEmaPattern = Price13dEmaPattern(client, 'price_200d_sma') + self.price_200d_sma_x0_8: Indexes[Dollars] = Indexes(client, f'{base_path}/price_200d_sma_x0_8') + self.price_200d_sma_x2_4: Indexes[Dollars] = Indexes(client, f'{base_path}/price_200d_sma_x2_4') + self.price_200w_ema: Price13dEmaPattern = Price13dEmaPattern(client, 'price_200w_ema') + self.price_200w_sma: Price13dEmaPattern = Price13dEmaPattern(client, 'price_200w_sma') + self.price_21d_ema: Price13dEmaPattern = Price13dEmaPattern(client, 'price_21d_ema') + self.price_21d_sma: Price13dEmaPattern = Price13dEmaPattern(client, 'price_21d_sma') + self.price_2w_choppiness_index: Indexes[StoredF32] = Indexes(client, f'{base_path}/price_2w_choppiness_index') + self.price_2w_max: Indexes[Dollars] = Indexes(client, f'{base_path}/price_2w_max') + self.price_2w_min: Indexes[Dollars] = Indexes(client, f'{base_path}/price_2w_min') + self.price_2y_ago: Indexes[Dollars] = Indexes(client, f'{base_path}/price_2y_ago') + self.price_2y_ema: Price13dEmaPattern = Price13dEmaPattern(client, 'price_2y_ema') + self.price_2y_sma: Price13dEmaPattern = Price13dEmaPattern(client, 'price_2y_sma') + self.price_34d_ema: Price13dEmaPattern = Price13dEmaPattern(client, 'price_34d_ema') + self.price_34d_sma: Price13dEmaPattern = Price13dEmaPattern(client, 'price_34d_sma') + self.price_3m_ago: Indexes[Dollars] = Indexes(client, f'{base_path}/price_3m_ago') + self.price_3y_ago: Indexes[Dollars] = Indexes(client, f'{base_path}/price_3y_ago') + self.price_4y_ago: Indexes[Dollars] = Indexes(client, f'{base_path}/price_4y_ago') + self.price_4y_ema: Price13dEmaPattern = Price13dEmaPattern(client, 'price_4y_ema') + self.price_4y_sma: Price13dEmaPattern = Price13dEmaPattern(client, 'price_4y_sma') + self.price_55d_ema: Price13dEmaPattern = Price13dEmaPattern(client, 'price_55d_ema') + self.price_55d_sma: Price13dEmaPattern = Price13dEmaPattern(client, 'price_55d_sma') + self.price_5y_ago: Indexes[Dollars] = Indexes(client, f'{base_path}/price_5y_ago') + self.price_6m_ago: Indexes[Dollars] = Indexes(client, f'{base_path}/price_6m_ago') + self.price_6y_ago: Indexes[Dollars] = Indexes(client, f'{base_path}/price_6y_ago') + self.price_89d_ema: Price13dEmaPattern = Price13dEmaPattern(client, 'price_89d_ema') + self.price_89d_sma: Price13dEmaPattern = Price13dEmaPattern(client, 'price_89d_sma') + self.price_8d_ema: Price13dEmaPattern = Price13dEmaPattern(client, 'price_8d_ema') + self.price_8d_sma: Price13dEmaPattern = Price13dEmaPattern(client, 'price_8d_sma') + self.price_8y_ago: Indexes[Dollars] = Indexes(client, f'{base_path}/price_8y_ago') + self.price_ath: Indexes26[Dollars] = Indexes26(client, f'{base_path}/price_ath') + self.price_drawdown: Indexes26[StoredF32] = Indexes26(client, f'{base_path}/price_drawdown') + self.price_true_range: Indexes5[StoredF32] = Indexes5(client, f'{base_path}/price_true_range') + self.price_true_range_2w_sum: Indexes5[StoredF32] = Indexes5(client, f'{base_path}/price_true_range_2w_sum') + +class CatalogTree_Computed_Pools: + """Catalog tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.pool: Indexes2[PoolSlug] = Indexes2(client, f'{base_path}/pool') + self.vecs: CatalogTree_Computed_Pools_Vecs = CatalogTree_Computed_Pools_Vecs(client, f'{base_path}/vecs') + +class CatalogTree_Computed_Pools_Vecs: + """Catalog tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.AXbt: AXbtPattern = AXbtPattern(client, f'{base_path}/AXbt') + self.AaoPool: AXbtPattern = AXbtPattern(client, f'{base_path}/AaoPool') + self.AntPool: AXbtPattern = AXbtPattern(client, f'{base_path}/AntPool') + self.ArkPool: AXbtPattern = AXbtPattern(client, f'{base_path}/ArkPool') + self.AsicMiner: AXbtPattern = AXbtPattern(client, f'{base_path}/AsicMiner') + self.BatPool: AXbtPattern = AXbtPattern(client, f'{base_path}/BatPool') + self.BcMonster: AXbtPattern = AXbtPattern(client, f'{base_path}/BcMonster') + self.BcpoolIo: AXbtPattern = AXbtPattern(client, f'{base_path}/BcpoolIo') + self.BinancePool: AXbtPattern = AXbtPattern(client, f'{base_path}/BinancePool') + self.BitClub: AXbtPattern = AXbtPattern(client, f'{base_path}/BitClub') + self.BitFuFuPool: AXbtPattern = AXbtPattern(client, f'{base_path}/BitFuFuPool') + self.BitFury: AXbtPattern = AXbtPattern(client, f'{base_path}/BitFury') + self.BitMinter: AXbtPattern = AXbtPattern(client, f'{base_path}/BitMinter') + self.Bitalo: AXbtPattern = AXbtPattern(client, f'{base_path}/Bitalo') + self.BitcoinAffiliateNetwork: AXbtPattern = AXbtPattern(client, f'{base_path}/BitcoinAffiliateNetwork') + self.BitcoinCom: AXbtPattern = AXbtPattern(client, f'{base_path}/BitcoinCom') + self.BitcoinIndia: AXbtPattern = AXbtPattern(client, f'{base_path}/BitcoinIndia') + self.BitcoinRussia: AXbtPattern = AXbtPattern(client, f'{base_path}/BitcoinRussia') + self.BitcoinUkraine: AXbtPattern = AXbtPattern(client, f'{base_path}/BitcoinUkraine') + self.Bitfarms: AXbtPattern = AXbtPattern(client, f'{base_path}/Bitfarms') + self.Bitparking: AXbtPattern = AXbtPattern(client, f'{base_path}/Bitparking') + self.Bitsolo: AXbtPattern = AXbtPattern(client, f'{base_path}/Bitsolo') + self.Bixin: AXbtPattern = AXbtPattern(client, f'{base_path}/Bixin') + self.BlockFills: AXbtPattern = AXbtPattern(client, f'{base_path}/BlockFills') + self.BraiinsPool: AXbtPattern = AXbtPattern(client, f'{base_path}/BraiinsPool') + self.BravoMining: AXbtPattern = AXbtPattern(client, f'{base_path}/BravoMining') + self.BtPool: AXbtPattern = AXbtPattern(client, f'{base_path}/BtPool') + self.BtcCom: AXbtPattern = AXbtPattern(client, f'{base_path}/BtcCom') + self.BtcDig: AXbtPattern = AXbtPattern(client, f'{base_path}/BtcDig') + self.BtcGuild: AXbtPattern = AXbtPattern(client, f'{base_path}/BtcGuild') + self.BtcLab: AXbtPattern = AXbtPattern(client, f'{base_path}/BtcLab') + self.BtcMp: AXbtPattern = AXbtPattern(client, f'{base_path}/BtcMp') + self.BtcNuggets: AXbtPattern = AXbtPattern(client, f'{base_path}/BtcNuggets') + self.BtcPoolParty: AXbtPattern = AXbtPattern(client, f'{base_path}/BtcPoolParty') + self.BtcServ: AXbtPattern = AXbtPattern(client, f'{base_path}/BtcServ') + self.BtcTop: AXbtPattern = AXbtPattern(client, f'{base_path}/BtcTop') + self.Btcc: AXbtPattern = AXbtPattern(client, f'{base_path}/Btcc') + self.BwPool: AXbtPattern = AXbtPattern(client, f'{base_path}/BwPool') + self.BytePool: AXbtPattern = AXbtPattern(client, f'{base_path}/BytePool') + self.Canoe: AXbtPattern = AXbtPattern(client, f'{base_path}/Canoe') + self.CanoePool: AXbtPattern = AXbtPattern(client, f'{base_path}/CanoePool') + self.CarbonNegative: AXbtPattern = AXbtPattern(client, f'{base_path}/CarbonNegative') + self.CkPool: AXbtPattern = AXbtPattern(client, f'{base_path}/CkPool') + self.CloudHashing: AXbtPattern = AXbtPattern(client, f'{base_path}/CloudHashing') + self.CoinLab: AXbtPattern = AXbtPattern(client, f'{base_path}/CoinLab') + self.Cointerra: AXbtPattern = AXbtPattern(client, f'{base_path}/Cointerra') + self.ConnectBtc: AXbtPattern = AXbtPattern(client, f'{base_path}/ConnectBtc') + self.DPool: AXbtPattern = AXbtPattern(client, f'{base_path}/DPool') + self.DcExploration: AXbtPattern = AXbtPattern(client, f'{base_path}/DcExploration') + self.Dcex: AXbtPattern = AXbtPattern(client, f'{base_path}/Dcex') + self.DigitalBtc: AXbtPattern = AXbtPattern(client, f'{base_path}/DigitalBtc') + self.DigitalXMintsy: AXbtPattern = AXbtPattern(client, f'{base_path}/DigitalXMintsy') + self.EclipseMc: AXbtPattern = AXbtPattern(client, f'{base_path}/EclipseMc') + self.EightBaochi: AXbtPattern = AXbtPattern(client, f'{base_path}/EightBaochi') + self.EkanemBtc: AXbtPattern = AXbtPattern(client, f'{base_path}/EkanemBtc') + self.Eligius: AXbtPattern = AXbtPattern(client, f'{base_path}/Eligius') + self.EmcdPool: AXbtPattern = AXbtPattern(client, f'{base_path}/EmcdPool') + self.EntrustCharityPool: AXbtPattern = AXbtPattern(client, f'{base_path}/EntrustCharityPool') + self.Eobot: AXbtPattern = AXbtPattern(client, f'{base_path}/Eobot') + self.ExxBw: AXbtPattern = AXbtPattern(client, f'{base_path}/ExxBw') + self.F2Pool: AXbtPattern = AXbtPattern(client, f'{base_path}/F2Pool') + self.FiftyEightCoin: AXbtPattern = AXbtPattern(client, f'{base_path}/FiftyEightCoin') + self.FoundryUsa: AXbtPattern = AXbtPattern(client, f'{base_path}/FoundryUsa') + self.FutureBitApolloSolo: AXbtPattern = AXbtPattern(client, f'{base_path}/FutureBitApolloSolo') + self.GbMiners: AXbtPattern = AXbtPattern(client, f'{base_path}/GbMiners') + self.GhashIo: AXbtPattern = AXbtPattern(client, f'{base_path}/GhashIo') + self.GiveMeCoins: AXbtPattern = AXbtPattern(client, f'{base_path}/GiveMeCoins') + self.GoGreenLight: AXbtPattern = AXbtPattern(client, f'{base_path}/GoGreenLight') + self.HaoZhuZhu: AXbtPattern = AXbtPattern(client, f'{base_path}/HaoZhuZhu') + self.Haominer: AXbtPattern = AXbtPattern(client, f'{base_path}/Haominer') + self.HashBx: AXbtPattern = AXbtPattern(client, f'{base_path}/HashBx') + self.HashPool: AXbtPattern = AXbtPattern(client, f'{base_path}/HashPool') + self.Helix: AXbtPattern = AXbtPattern(client, f'{base_path}/Helix') + self.Hhtt: AXbtPattern = AXbtPattern(client, f'{base_path}/Hhtt') + self.HotPool: AXbtPattern = AXbtPattern(client, f'{base_path}/HotPool') + self.Hummerpool: AXbtPattern = AXbtPattern(client, f'{base_path}/Hummerpool') + self.HuobiPool: AXbtPattern = AXbtPattern(client, f'{base_path}/HuobiPool') + self.InnopolisTech: AXbtPattern = AXbtPattern(client, f'{base_path}/InnopolisTech') + self.KanoPool: AXbtPattern = AXbtPattern(client, f'{base_path}/KanoPool') + self.KncMiner: AXbtPattern = AXbtPattern(client, f'{base_path}/KncMiner') + self.KuCoinPool: AXbtPattern = AXbtPattern(client, f'{base_path}/KuCoinPool') + self.LubianCom: AXbtPattern = AXbtPattern(client, f'{base_path}/LubianCom') + self.LuckyPool: AXbtPattern = AXbtPattern(client, f'{base_path}/LuckyPool') + self.Luxor: AXbtPattern = AXbtPattern(client, f'{base_path}/Luxor') + self.MaraPool: AXbtPattern = AXbtPattern(client, f'{base_path}/MaraPool') + self.MaxBtc: AXbtPattern = AXbtPattern(client, f'{base_path}/MaxBtc') + self.MaxiPool: AXbtPattern = AXbtPattern(client, f'{base_path}/MaxiPool') + self.MegaBigPower: AXbtPattern = AXbtPattern(client, f'{base_path}/MegaBigPower') + self.Minerium: AXbtPattern = AXbtPattern(client, f'{base_path}/Minerium') + self.MiningCity: AXbtPattern = AXbtPattern(client, f'{base_path}/MiningCity') + self.MiningDutch: AXbtPattern = AXbtPattern(client, f'{base_path}/MiningDutch') + self.MiningKings: AXbtPattern = AXbtPattern(client, f'{base_path}/MiningKings') + self.MiningSquared: AXbtPattern = AXbtPattern(client, f'{base_path}/MiningSquared') + self.Mmpool: AXbtPattern = AXbtPattern(client, f'{base_path}/Mmpool') + self.MtRed: AXbtPattern = AXbtPattern(client, f'{base_path}/MtRed') + self.MultiCoinCo: AXbtPattern = AXbtPattern(client, f'{base_path}/MultiCoinCo') + self.Multipool: AXbtPattern = AXbtPattern(client, f'{base_path}/Multipool') + self.MyBtcCoinPool: AXbtPattern = AXbtPattern(client, f'{base_path}/MyBtcCoinPool') + self.Neopool: AXbtPattern = AXbtPattern(client, f'{base_path}/Neopool') + self.Nexious: AXbtPattern = AXbtPattern(client, f'{base_path}/Nexious') + self.NiceHash: AXbtPattern = AXbtPattern(client, f'{base_path}/NiceHash') + self.NmcBit: AXbtPattern = AXbtPattern(client, f'{base_path}/NmcBit') + self.NovaBlock: AXbtPattern = AXbtPattern(client, f'{base_path}/NovaBlock') + self.Ocean: AXbtPattern = AXbtPattern(client, f'{base_path}/Ocean') + self.OkExPool: AXbtPattern = AXbtPattern(client, f'{base_path}/OkExPool') + self.OkMiner: AXbtPattern = AXbtPattern(client, f'{base_path}/OkMiner') + self.Okkong: AXbtPattern = AXbtPattern(client, f'{base_path}/Okkong') + self.OkpoolTop: AXbtPattern = AXbtPattern(client, f'{base_path}/OkpoolTop') + self.OneHash: AXbtPattern = AXbtPattern(client, f'{base_path}/OneHash') + self.OneM1x: AXbtPattern = AXbtPattern(client, f'{base_path}/OneM1x') + self.OneThash: AXbtPattern = AXbtPattern(client, f'{base_path}/OneThash') + self.OzCoin: AXbtPattern = AXbtPattern(client, f'{base_path}/OzCoin') + self.PHashIo: AXbtPattern = AXbtPattern(client, f'{base_path}/PHashIo') + self.Parasite: AXbtPattern = AXbtPattern(client, f'{base_path}/Parasite') + self.Patels: AXbtPattern = AXbtPattern(client, f'{base_path}/Patels') + self.PegaPool: AXbtPattern = AXbtPattern(client, f'{base_path}/PegaPool') + self.Phoenix: AXbtPattern = AXbtPattern(client, f'{base_path}/Phoenix') + self.Polmine: AXbtPattern = AXbtPattern(client, f'{base_path}/Polmine') + self.Pool175btc: AXbtPattern = AXbtPattern(client, f'{base_path}/Pool175btc') + self.Pool50btc: AXbtPattern = AXbtPattern(client, f'{base_path}/Pool50btc') + self.Poolin: AXbtPattern = AXbtPattern(client, f'{base_path}/Poolin') + self.PortlandHodl: AXbtPattern = AXbtPattern(client, f'{base_path}/PortlandHodl') + self.PublicPool: AXbtPattern = AXbtPattern(client, f'{base_path}/PublicPool') + self.PureBtcCom: AXbtPattern = AXbtPattern(client, f'{base_path}/PureBtcCom') + self.Rawpool: AXbtPattern = AXbtPattern(client, f'{base_path}/Rawpool') + self.RigPool: AXbtPattern = AXbtPattern(client, f'{base_path}/RigPool') + self.SbiCrypto: AXbtPattern = AXbtPattern(client, f'{base_path}/SbiCrypto') + self.SecPool: AXbtPattern = AXbtPattern(client, f'{base_path}/SecPool') + self.SecretSuperstar: AXbtPattern = AXbtPattern(client, f'{base_path}/SecretSuperstar') + self.SevenPool: AXbtPattern = AXbtPattern(client, f'{base_path}/SevenPool') + self.ShawnP0wers: AXbtPattern = AXbtPattern(client, f'{base_path}/ShawnP0wers') + self.SigmapoolCom: AXbtPattern = AXbtPattern(client, f'{base_path}/SigmapoolCom') + self.SimplecoinUs: AXbtPattern = AXbtPattern(client, f'{base_path}/SimplecoinUs') + self.SoloCk: AXbtPattern = AXbtPattern(client, f'{base_path}/SoloCk') + self.SpiderPool: AXbtPattern = AXbtPattern(client, f'{base_path}/SpiderPool') + self.StMiningCorp: AXbtPattern = AXbtPattern(client, f'{base_path}/StMiningCorp') + self.Tangpool: AXbtPattern = AXbtPattern(client, f'{base_path}/Tangpool') + self.TatmasPool: AXbtPattern = AXbtPattern(client, f'{base_path}/TatmasPool') + self.TbDice: AXbtPattern = AXbtPattern(client, f'{base_path}/TbDice') + self.Telco214: AXbtPattern = AXbtPattern(client, f'{base_path}/Telco214') + self.TerraPool: AXbtPattern = AXbtPattern(client, f'{base_path}/TerraPool') + self.Tiger: AXbtPattern = AXbtPattern(client, f'{base_path}/Tiger') + self.TigerpoolNet: AXbtPattern = AXbtPattern(client, f'{base_path}/TigerpoolNet') + self.Titan: AXbtPattern = AXbtPattern(client, f'{base_path}/Titan') + self.TransactionCoinMining: AXbtPattern = AXbtPattern(client, f'{base_path}/TransactionCoinMining') + self.TrickysBtcPool: AXbtPattern = AXbtPattern(client, f'{base_path}/TrickysBtcPool') + self.TripleMining: AXbtPattern = AXbtPattern(client, f'{base_path}/TripleMining') + self.TwentyOneInc: AXbtPattern = AXbtPattern(client, f'{base_path}/TwentyOneInc') + self.UltimusPool: AXbtPattern = AXbtPattern(client, f'{base_path}/UltimusPool') + self.Unknown: AXbtPattern = AXbtPattern(client, f'{base_path}/Unknown') + self.Unomp: AXbtPattern = AXbtPattern(client, f'{base_path}/Unomp') + self.ViaBtc: AXbtPattern = AXbtPattern(client, f'{base_path}/ViaBtc') + self.Waterhole: AXbtPattern = AXbtPattern(client, f'{base_path}/Waterhole') + self.WayiCn: AXbtPattern = AXbtPattern(client, f'{base_path}/WayiCn') + self.WhitePool: AXbtPattern = AXbtPattern(client, f'{base_path}/WhitePool') + self.Wk057: AXbtPattern = AXbtPattern(client, f'{base_path}/Wk057') + self.YourbtcNet: AXbtPattern = AXbtPattern(client, f'{base_path}/YourbtcNet') + self.Zulupool: AXbtPattern = AXbtPattern(client, f'{base_path}/Zulupool') + +class CatalogTree_Computed_Price: + """Catalog tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.price_close: Indexes3[Dollars] = Indexes3(client, f'{base_path}/price_close') + self.price_close_in_cents: Indexes13[Cents] = Indexes13(client, f'{base_path}/price_close_in_cents') + self.price_close_in_sats: Indexes3[Sats] = Indexes3(client, f'{base_path}/price_close_in_sats') + self.price_high: Indexes3[Dollars] = Indexes3(client, f'{base_path}/price_high') + self.price_high_in_cents: Indexes13[Cents] = Indexes13(client, f'{base_path}/price_high_in_cents') + self.price_high_in_sats: Indexes3[Sats] = Indexes3(client, f'{base_path}/price_high_in_sats') + self.price_low: Indexes3[Dollars] = Indexes3(client, f'{base_path}/price_low') + self.price_low_in_cents: Indexes13[Cents] = Indexes13(client, f'{base_path}/price_low_in_cents') + self.price_low_in_sats: Indexes3[Sats] = Indexes3(client, f'{base_path}/price_low_in_sats') + self.price_ohlc: Indexes3[OHLCDollars] = Indexes3(client, f'{base_path}/price_ohlc') + self.price_ohlc_in_sats: Indexes3[OHLCSats] = Indexes3(client, f'{base_path}/price_ohlc_in_sats') + self.price_open: Indexes3[Dollars] = Indexes3(client, f'{base_path}/price_open') + self.price_open_in_cents: Indexes13[Cents] = Indexes13(client, f'{base_path}/price_open_in_cents') + self.price_open_in_sats: Indexes3[Sats] = Indexes3(client, f'{base_path}/price_open_in_sats') + +class CatalogTree_Computed_Stateful: + """Catalog tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.addr_count: Indexes3[StoredU64] = Indexes3(client, f'{base_path}/addr_count') + self.address_cohorts: CatalogTree_Computed_Stateful_AddressCohorts = CatalogTree_Computed_Stateful_AddressCohorts(client, f'{base_path}/address_cohorts') + self.addresses_data: CatalogTree_Computed_Stateful_AddressesData = CatalogTree_Computed_Stateful_AddressesData(client, f'{base_path}/addresses_data') + self.addresstype_to_height_to_addr_count: AddresstypeToHeightToAddrCountPattern[StoredU64] = AddresstypeToHeightToAddrCountPattern(client, f'{base_path}/addresstype_to_height_to_addr_count') + self.addresstype_to_height_to_empty_addr_count: AddresstypeToHeightToAddrCountPattern[StoredU64] = AddresstypeToHeightToAddrCountPattern(client, f'{base_path}/addresstype_to_height_to_empty_addr_count') + self.addresstype_to_indexes_to_addr_count: AddresstypeToHeightToAddrCountPattern[StoredU64] = AddresstypeToHeightToAddrCountPattern(client, f'{base_path}/addresstype_to_indexes_to_addr_count') + self.addresstype_to_indexes_to_empty_addr_count: AddresstypeToHeightToAddrCountPattern[StoredU64] = AddresstypeToHeightToAddrCountPattern(client, f'{base_path}/addresstype_to_indexes_to_empty_addr_count') + self.any_address_indexes: AddresstypeToHeightToAddrCountPattern[AnyAddressIndex] = AddresstypeToHeightToAddrCountPattern(client, f'{base_path}/any_address_indexes') + self.chain_state: Indexes2[SupplyState] = Indexes2(client, f'{base_path}/chain_state') + self.empty_addr_count: Indexes3[StoredU64] = Indexes3(client, f'{base_path}/empty_addr_count') + self.emptyaddressindex: Indexes29[EmptyAddressIndex] = Indexes29(client, f'{base_path}/emptyaddressindex') + self.loadedaddressindex: Indexes30[LoadedAddressIndex] = Indexes30(client, f'{base_path}/loadedaddressindex') + self.market_cap: Indexes26[Dollars] = Indexes26(client, f'{base_path}/market_cap') + self.opreturn_supply: SupplyPattern = SupplyPattern(client, f'{base_path}/opreturn_supply') + self.unspendable_supply: SupplyPattern = SupplyPattern(client, f'{base_path}/unspendable_supply') + self.utxo_cohorts: CatalogTree_Computed_Stateful_UtxoCohorts = CatalogTree_Computed_Stateful_UtxoCohorts(client, f'{base_path}/utxo_cohorts') + +class CatalogTree_Computed_Stateful_AddressCohorts: + """Catalog tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.amount_range: CatalogTree_Computed_Stateful_AddressCohorts_AmountRange = CatalogTree_Computed_Stateful_AddressCohorts_AmountRange(client, f'{base_path}/amount_range') + self.ge_amount: CatalogTree_Computed_Stateful_AddressCohorts_GeAmount = CatalogTree_Computed_Stateful_AddressCohorts_GeAmount(client, f'{base_path}/ge_amount') + self.lt_amount: CatalogTree_Computed_Stateful_AddressCohorts_LtAmount = CatalogTree_Computed_Stateful_AddressCohorts_LtAmount(client, f'{base_path}/lt_amount') + +class CatalogTree_Computed_Stateful_AddressCohorts_AmountRange: + """Catalog tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._0sats: _0satsPattern = _0satsPattern(client, f'{base_path}/_0sats') + self._100btc_to_1k_btc: _0satsPattern = _0satsPattern(client, f'{base_path}/_100btc_to_1k_btc') + self._100k_btc_or_more: _0satsPattern = _0satsPattern(client, f'{base_path}/_100k_btc_or_more') + self._100k_sats_to_1m_sats: _0satsPattern = _0satsPattern(client, f'{base_path}/_100k_sats_to_1m_sats') + self._100sats_to_1k_sats: _0satsPattern = _0satsPattern(client, f'{base_path}/_100sats_to_1k_sats') + self._10btc_to_100btc: _0satsPattern = _0satsPattern(client, f'{base_path}/_10btc_to_100btc') + self._10k_btc_to_100k_btc: _0satsPattern = _0satsPattern(client, f'{base_path}/_10k_btc_to_100k_btc') + self._10k_sats_to_100k_sats: _0satsPattern = _0satsPattern(client, f'{base_path}/_10k_sats_to_100k_sats') + self._10m_sats_to_1btc: _0satsPattern = _0satsPattern(client, f'{base_path}/_10m_sats_to_1btc') + self._10sats_to_100sats: _0satsPattern = _0satsPattern(client, f'{base_path}/_10sats_to_100sats') + self._1btc_to_10btc: _0satsPattern = _0satsPattern(client, f'{base_path}/_1btc_to_10btc') + self._1k_btc_to_10k_btc: _0satsPattern = _0satsPattern(client, f'{base_path}/_1k_btc_to_10k_btc') + self._1k_sats_to_10k_sats: _0satsPattern = _0satsPattern(client, f'{base_path}/_1k_sats_to_10k_sats') + self._1m_sats_to_10m_sats: _0satsPattern = _0satsPattern(client, f'{base_path}/_1m_sats_to_10m_sats') + self._1sat_to_10sats: _0satsPattern = _0satsPattern(client, f'{base_path}/_1sat_to_10sats') + +class CatalogTree_Computed_Stateful_AddressCohorts_GeAmount: + """Catalog tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._100btc: _0satsPattern = _0satsPattern(client, f'{base_path}/_100btc') + self._100k_sats: _0satsPattern = _0satsPattern(client, f'{base_path}/_100k_sats') + self._100sats: _0satsPattern = _0satsPattern(client, f'{base_path}/_100sats') + self._10btc: _0satsPattern = _0satsPattern(client, f'{base_path}/_10btc') + self._10k_btc: _0satsPattern = _0satsPattern(client, f'{base_path}/_10k_btc') + self._10k_sats: _0satsPattern = _0satsPattern(client, f'{base_path}/_10k_sats') + self._10m_sats: _0satsPattern = _0satsPattern(client, f'{base_path}/_10m_sats') + self._10sats: _0satsPattern = _0satsPattern(client, f'{base_path}/_10sats') + self._1btc: _0satsPattern = _0satsPattern(client, f'{base_path}/_1btc') + self._1k_btc: _0satsPattern = _0satsPattern(client, f'{base_path}/_1k_btc') + self._1k_sats: _0satsPattern = _0satsPattern(client, f'{base_path}/_1k_sats') + self._1m_sats: _0satsPattern = _0satsPattern(client, f'{base_path}/_1m_sats') + self._1sat: _0satsPattern = _0satsPattern(client, f'{base_path}/_1sat') + +class CatalogTree_Computed_Stateful_AddressCohorts_LtAmount: + """Catalog tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._100btc: _0satsPattern = _0satsPattern(client, f'{base_path}/_100btc') + self._100k_btc: _0satsPattern = _0satsPattern(client, f'{base_path}/_100k_btc') + self._100k_sats: _0satsPattern = _0satsPattern(client, f'{base_path}/_100k_sats') + self._100sats: _0satsPattern = _0satsPattern(client, f'{base_path}/_100sats') + self._10btc: _0satsPattern = _0satsPattern(client, f'{base_path}/_10btc') + self._10k_btc: _0satsPattern = _0satsPattern(client, f'{base_path}/_10k_btc') + self._10k_sats: _0satsPattern = _0satsPattern(client, f'{base_path}/_10k_sats') + self._10m_sats: _0satsPattern = _0satsPattern(client, f'{base_path}/_10m_sats') + self._10sats: _0satsPattern = _0satsPattern(client, f'{base_path}/_10sats') + self._1btc: _0satsPattern = _0satsPattern(client, f'{base_path}/_1btc') + self._1k_btc: _0satsPattern = _0satsPattern(client, f'{base_path}/_1k_btc') + self._1k_sats: _0satsPattern = _0satsPattern(client, f'{base_path}/_1k_sats') + self._1m_sats: _0satsPattern = _0satsPattern(client, f'{base_path}/_1m_sats') + +class CatalogTree_Computed_Stateful_AddressesData: + """Catalog tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.empty: Indexes29[EmptyAddressData] = Indexes29(client, f'{base_path}/empty') + self.loaded: Indexes30[LoadedAddressData] = Indexes30(client, f'{base_path}/loaded') + +class CatalogTree_Computed_Stateful_UtxoCohorts: + """Catalog tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.age_range: CatalogTree_Computed_Stateful_UtxoCohorts_AgeRange = CatalogTree_Computed_Stateful_UtxoCohorts_AgeRange(client, f'{base_path}/age_range') + self.all: CatalogTree_Computed_Stateful_UtxoCohorts_All = CatalogTree_Computed_Stateful_UtxoCohorts_All(client, f'{base_path}/all') + self.amount_range: CatalogTree_Computed_Stateful_UtxoCohorts_AmountRange = CatalogTree_Computed_Stateful_UtxoCohorts_AmountRange(client, f'{base_path}/amount_range') + self.epoch: CatalogTree_Computed_Stateful_UtxoCohorts_Epoch = CatalogTree_Computed_Stateful_UtxoCohorts_Epoch(client, f'{base_path}/epoch') + self.ge_amount: CatalogTree_Computed_Stateful_UtxoCohorts_GeAmount = CatalogTree_Computed_Stateful_UtxoCohorts_GeAmount(client, f'{base_path}/ge_amount') + self.lt_amount: CatalogTree_Computed_Stateful_UtxoCohorts_LtAmount = CatalogTree_Computed_Stateful_UtxoCohorts_LtAmount(client, f'{base_path}/lt_amount') + self.max_age: CatalogTree_Computed_Stateful_UtxoCohorts_MaxAge = CatalogTree_Computed_Stateful_UtxoCohorts_MaxAge(client, f'{base_path}/max_age') + self.min_age: CatalogTree_Computed_Stateful_UtxoCohorts_MinAge = CatalogTree_Computed_Stateful_UtxoCohorts_MinAge(client, f'{base_path}/min_age') + self.term: CatalogTree_Computed_Stateful_UtxoCohorts_Term = CatalogTree_Computed_Stateful_UtxoCohorts_Term(client, f'{base_path}/term') + self.type_: CatalogTree_Computed_Stateful_UtxoCohorts_Type = CatalogTree_Computed_Stateful_UtxoCohorts_Type(client, f'{base_path}/type_') + self.year: CatalogTree_Computed_Stateful_UtxoCohorts_Year = CatalogTree_Computed_Stateful_UtxoCohorts_Year(client, f'{base_path}/year') + +class CatalogTree_Computed_Stateful_UtxoCohorts_AgeRange: + """Catalog tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._10y_to_12y: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_10y_to_12y') + self._12y_to_15y: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_12y_to_15y') + self._1d_to_1w: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_1d_to_1w') + self._1m_to_2m: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_1m_to_2m') + self._1w_to_1m: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_1w_to_1m') + self._1y_to_2y: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_1y_to_2y') + self._2m_to_3m: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_2m_to_3m') + self._2y_to_3y: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_2y_to_3y') + self._3m_to_4m: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_3m_to_4m') + self._3y_to_4y: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_3y_to_4y') + self._4m_to_5m: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_4m_to_5m') + self._4y_to_5y: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_4y_to_5y') + self._5m_to_6m: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_5m_to_6m') + self._5y_to_6y: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_5y_to_6y') + self._6m_to_1y: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_6m_to_1y') + self._6y_to_7y: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_6y_to_7y') + self._7y_to_8y: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_7y_to_8y') + self._8y_to_10y: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_8y_to_10y') + self.from_15y: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/from_15y') + self.up_to_1d: UpTo1dPattern = UpTo1dPattern(client, f'{base_path}/up_to_1d') + +class CatalogTree_Computed_Stateful_UtxoCohorts_All: + """Catalog tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.activity: ActivityPattern = ActivityPattern(client, f'{base_path}/activity') + self.price_paid: PricePaidPattern2 = PricePaidPattern2(client, f'{base_path}/price_paid') + self.realized: RealizedPattern3 = RealizedPattern3(client, f'{base_path}/realized') + self.relative: CatalogTree_Computed_Stateful_UtxoCohorts_All_Relative = CatalogTree_Computed_Stateful_UtxoCohorts_All_Relative(client, f'{base_path}/relative') + self.supply: SupplyPattern2 = SupplyPattern2(client, f'{base_path}/supply') + self.unrealized: UnrealizedPattern = UnrealizedPattern(client, f'{base_path}/unrealized') + +class CatalogTree_Computed_Stateful_UtxoCohorts_All_Relative: + """Catalog tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.neg_unrealized_loss_rel_to_own_total_unrealized_pnl: Indexes27[StoredF32] = Indexes27(client, f'{base_path}/neg_unrealized_loss_rel_to_own_total_unrealized_pnl') + self.net_unrealized_pnl_rel_to_own_total_unrealized_pnl: Indexes26[StoredF32] = Indexes26(client, f'{base_path}/net_unrealized_pnl_rel_to_own_total_unrealized_pnl') + self.supply_in_loss_rel_to_own_supply: Indexes27[StoredF64] = Indexes27(client, f'{base_path}/supply_in_loss_rel_to_own_supply') + self.supply_in_profit_rel_to_own_supply: Indexes27[StoredF64] = Indexes27(client, f'{base_path}/supply_in_profit_rel_to_own_supply') + self.unrealized_loss_rel_to_own_total_unrealized_pnl: Indexes27[StoredF32] = Indexes27(client, f'{base_path}/unrealized_loss_rel_to_own_total_unrealized_pnl') + self.unrealized_profit_rel_to_own_total_unrealized_pnl: Indexes27[StoredF32] = Indexes27(client, f'{base_path}/unrealized_profit_rel_to_own_total_unrealized_pnl') + +class CatalogTree_Computed_Stateful_UtxoCohorts_AmountRange: + """Catalog tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._0sats: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/_0sats') + self._100btc_to_1k_btc: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/_100btc_to_1k_btc') + self._100k_btc_or_more: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/_100k_btc_or_more') + self._100k_sats_to_1m_sats: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/_100k_sats_to_1m_sats') + self._100sats_to_1k_sats: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/_100sats_to_1k_sats') + self._10btc_to_100btc: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/_10btc_to_100btc') + self._10k_btc_to_100k_btc: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/_10k_btc_to_100k_btc') + self._10k_sats_to_100k_sats: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/_10k_sats_to_100k_sats') + self._10m_sats_to_1btc: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/_10m_sats_to_1btc') + self._10sats_to_100sats: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/_10sats_to_100sats') + self._1btc_to_10btc: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/_1btc_to_10btc') + self._1k_btc_to_10k_btc: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/_1k_btc_to_10k_btc') + self._1k_sats_to_10k_sats: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/_1k_sats_to_10k_sats') + self._1m_sats_to_10m_sats: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/_1m_sats_to_10m_sats') + self._1sat_to_10sats: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/_1sat_to_10sats') + +class CatalogTree_Computed_Stateful_UtxoCohorts_Epoch: + """Catalog tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._0: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_0') + self._1: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_1') + self._2: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_2') + self._3: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_3') + self._4: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_4') + +class CatalogTree_Computed_Stateful_UtxoCohorts_GeAmount: + """Catalog tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._100btc: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/_100btc') + self._100k_sats: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/_100k_sats') + self._100sats: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/_100sats') + self._10btc: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/_10btc') + self._10k_btc: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/_10k_btc') + self._10k_sats: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/_10k_sats') + self._10m_sats: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/_10m_sats') + self._10sats: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/_10sats') + self._1btc: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/_1btc') + self._1k_btc: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/_1k_btc') + self._1k_sats: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/_1k_sats') + self._1m_sats: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/_1m_sats') + self._1sat: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/_1sat') + +class CatalogTree_Computed_Stateful_UtxoCohorts_LtAmount: + """Catalog tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._100btc: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/_100btc') + self._100k_btc: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/_100k_btc') + self._100k_sats: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/_100k_sats') + self._100sats: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/_100sats') + self._10btc: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/_10btc') + self._10k_btc: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/_10k_btc') + self._10k_sats: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/_10k_sats') + self._10m_sats: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/_10m_sats') + self._10sats: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/_10sats') + self._1btc: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/_1btc') + self._1k_btc: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/_1k_btc') + self._1k_sats: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/_1k_sats') + self._1m_sats: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/_1m_sats') + +class CatalogTree_Computed_Stateful_UtxoCohorts_MaxAge: + """Catalog tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._10y: UpTo1dPattern = UpTo1dPattern(client, f'{base_path}/_10y') + self._12y: UpTo1dPattern = UpTo1dPattern(client, f'{base_path}/_12y') + self._15y: UpTo1dPattern = UpTo1dPattern(client, f'{base_path}/_15y') + self._1m: UpTo1dPattern = UpTo1dPattern(client, f'{base_path}/_1m') + self._1w: UpTo1dPattern = UpTo1dPattern(client, f'{base_path}/_1w') + self._1y: UpTo1dPattern = UpTo1dPattern(client, f'{base_path}/_1y') + self._2m: UpTo1dPattern = UpTo1dPattern(client, f'{base_path}/_2m') + self._2y: UpTo1dPattern = UpTo1dPattern(client, f'{base_path}/_2y') + self._3m: UpTo1dPattern = UpTo1dPattern(client, f'{base_path}/_3m') + self._3y: UpTo1dPattern = UpTo1dPattern(client, f'{base_path}/_3y') + self._4m: UpTo1dPattern = UpTo1dPattern(client, f'{base_path}/_4m') + self._4y: UpTo1dPattern = UpTo1dPattern(client, f'{base_path}/_4y') + self._5m: UpTo1dPattern = UpTo1dPattern(client, f'{base_path}/_5m') + self._5y: UpTo1dPattern = UpTo1dPattern(client, f'{base_path}/_5y') + self._6m: UpTo1dPattern = UpTo1dPattern(client, f'{base_path}/_6m') + self._6y: UpTo1dPattern = UpTo1dPattern(client, f'{base_path}/_6y') + self._7y: UpTo1dPattern = UpTo1dPattern(client, f'{base_path}/_7y') + self._8y: UpTo1dPattern = UpTo1dPattern(client, f'{base_path}/_8y') + +class CatalogTree_Computed_Stateful_UtxoCohorts_MinAge: + """Catalog tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._10y: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_10y') + self._12y: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_12y') + self._1d: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_1d') + self._1m: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_1m') + self._1w: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_1w') + self._1y: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_1y') + self._2m: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_2m') + self._2y: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_2y') + self._3m: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_3m') + self._3y: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_3y') + self._4m: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_4m') + self._4y: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_4y') + self._5m: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_5m') + self._5y: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_5y') + self._6m: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_6m') + self._6y: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_6y') + self._7y: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_7y') + self._8y: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_8y') + +class CatalogTree_Computed_Stateful_UtxoCohorts_Term: + """Catalog tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.long: UpTo1dPattern = UpTo1dPattern(client, f'{base_path}/long') + self.short: UpTo1dPattern = UpTo1dPattern(client, f'{base_path}/short') + +class CatalogTree_Computed_Stateful_UtxoCohorts_Type: + """Catalog tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.empty: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/empty') + self.p2a: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/p2a') + self.p2ms: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/p2ms') + self.p2pk33: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/p2pk33') + self.p2pk65: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/p2pk65') + self.p2pkh: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/p2pkh') + self.p2sh: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/p2sh') + self.p2tr: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/p2tr') + self.p2wpkh: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/p2wpkh') + self.p2wsh: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/p2wsh') + self.unknown: _0satsPattern2 = _0satsPattern2(client, f'{base_path}/unknown') + +class CatalogTree_Computed_Stateful_UtxoCohorts_Year: + """Catalog tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._2009: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_2009') + self._2010: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_2010') + self._2011: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_2011') + self._2012: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_2012') + self._2013: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_2013') + self._2014: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_2014') + self._2015: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_2015') + self._2016: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_2016') + self._2017: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_2017') + self._2018: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_2018') + self._2019: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_2019') + self._2020: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_2020') + self._2021: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_2021') + self._2022: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_2022') + self._2023: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_2023') + self._2024: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_2024') + self._2025: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_2025') + self._2026: _10yTo12yPattern = _10yTo12yPattern(client, f'{base_path}/_2026') + +class CatalogTree_Computed_Txins: + """Catalog tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.txoutindex: Indexes24[TxOutIndex] = Indexes24(client, f'{base_path}/txoutindex') + self.value: Indexes24[Sats] = Indexes24(client, f'{base_path}/value') + +class CatalogTree_Computed_Txouts: + """Catalog tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.txinindex: Indexes25[TxInIndex] = Indexes25(client, f'{base_path}/txinindex') + +class CatalogTree_Indexed: + """Catalog tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.address: CatalogTree_Indexed_Address = CatalogTree_Indexed_Address(client, f'{base_path}/address') + self.block: CatalogTree_Indexed_Block = CatalogTree_Indexed_Block(client, f'{base_path}/block') + self.output: CatalogTree_Indexed_Output = CatalogTree_Indexed_Output(client, f'{base_path}/output') + self.tx: CatalogTree_Indexed_Tx = CatalogTree_Indexed_Tx(client, f'{base_path}/tx') + self.txin: CatalogTree_Indexed_Txin = CatalogTree_Indexed_Txin(client, f'{base_path}/txin') + self.txout: CatalogTree_Indexed_Txout = CatalogTree_Indexed_Txout(client, f'{base_path}/txout') + +class CatalogTree_Indexed_Address: + """Catalog tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.first_p2aaddressindex: Indexes2[P2AAddressIndex] = Indexes2(client, f'{base_path}/first_p2aaddressindex') + self.first_p2pk33addressindex: Indexes2[P2PK33AddressIndex] = Indexes2(client, f'{base_path}/first_p2pk33addressindex') + self.first_p2pk65addressindex: Indexes2[P2PK65AddressIndex] = Indexes2(client, f'{base_path}/first_p2pk65addressindex') + self.first_p2pkhaddressindex: Indexes2[P2PKHAddressIndex] = Indexes2(client, f'{base_path}/first_p2pkhaddressindex') + self.first_p2shaddressindex: Indexes2[P2SHAddressIndex] = Indexes2(client, f'{base_path}/first_p2shaddressindex') + self.first_p2traddressindex: Indexes2[P2TRAddressIndex] = Indexes2(client, f'{base_path}/first_p2traddressindex') + self.first_p2wpkhaddressindex: Indexes2[P2WPKHAddressIndex] = Indexes2(client, f'{base_path}/first_p2wpkhaddressindex') + self.first_p2wshaddressindex: Indexes2[P2WSHAddressIndex] = Indexes2(client, f'{base_path}/first_p2wshaddressindex') + self.p2abytes: Indexes16[P2ABytes] = Indexes16(client, f'{base_path}/p2abytes') + self.p2pk33bytes: Indexes17[P2PK33Bytes] = Indexes17(client, f'{base_path}/p2pk33bytes') + self.p2pk65bytes: Indexes18[P2PK65Bytes] = Indexes18(client, f'{base_path}/p2pk65bytes') + self.p2pkhbytes: Indexes19[P2PKHBytes] = Indexes19(client, f'{base_path}/p2pkhbytes') + self.p2shbytes: Indexes20[P2SHBytes] = Indexes20(client, f'{base_path}/p2shbytes') + self.p2trbytes: Indexes21[P2TRBytes] = Indexes21(client, f'{base_path}/p2trbytes') + self.p2wpkhbytes: Indexes22[P2WPKHBytes] = Indexes22(client, f'{base_path}/p2wpkhbytes') + self.p2wshbytes: Indexes23[P2WSHBytes] = Indexes23(client, f'{base_path}/p2wshbytes') + +class CatalogTree_Indexed_Block: + """Catalog tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.blockhash: Indexes2[BlockHash] = Indexes2(client, f'{base_path}/blockhash') + self.difficulty: Indexes2[StoredF64] = Indexes2(client, f'{base_path}/difficulty') + self.timestamp: Indexes2[Timestamp] = Indexes2(client, f'{base_path}/timestamp') + self.total_size: Indexes2[StoredU64] = Indexes2(client, f'{base_path}/total_size') + self.weight: Indexes2[Weight] = Indexes2(client, f'{base_path}/weight') + +class CatalogTree_Indexed_Output: + """Catalog tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.first_emptyoutputindex: Indexes2[EmptyOutputIndex] = Indexes2(client, f'{base_path}/first_emptyoutputindex') + self.first_opreturnindex: Indexes2[OpReturnIndex] = Indexes2(client, f'{base_path}/first_opreturnindex') + self.first_p2msoutputindex: Indexes2[P2MSOutputIndex] = Indexes2(client, f'{base_path}/first_p2msoutputindex') + self.first_unknownoutputindex: Indexes2[UnknownOutputIndex] = Indexes2(client, f'{base_path}/first_unknownoutputindex') + self.txindex: MetricNode[TxIndex] = MetricNode(client, f'{base_path}/txindex') + +class CatalogTree_Indexed_Tx: + """Catalog tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.base_size: Indexes6[StoredU32] = Indexes6(client, f'{base_path}/base_size') + self.first_txindex: Indexes2[TxIndex] = Indexes2(client, f'{base_path}/first_txindex') + self.first_txinindex: Indexes6[TxInIndex] = Indexes6(client, f'{base_path}/first_txinindex') + self.first_txoutindex: Indexes6[TxOutIndex] = Indexes6(client, f'{base_path}/first_txoutindex') + self.height: Indexes6[Height] = Indexes6(client, f'{base_path}/height') + self.is_explicitly_rbf: Indexes6[StoredBool] = Indexes6(client, f'{base_path}/is_explicitly_rbf') + self.rawlocktime: Indexes6[RawLockTime] = Indexes6(client, f'{base_path}/rawlocktime') + self.total_size: Indexes6[StoredU32] = Indexes6(client, f'{base_path}/total_size') + self.txid: Indexes6[Txid] = Indexes6(client, f'{base_path}/txid') + self.txversion: Indexes6[TxVersion] = Indexes6(client, f'{base_path}/txversion') + +class CatalogTree_Indexed_Txin: + """Catalog tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.first_txinindex: Indexes2[TxInIndex] = Indexes2(client, f'{base_path}/first_txinindex') + self.outpoint: Indexes24[OutPoint] = Indexes24(client, f'{base_path}/outpoint') + self.outputtype: Indexes24[OutputType] = Indexes24(client, f'{base_path}/outputtype') + self.txindex: Indexes24[TxIndex] = Indexes24(client, f'{base_path}/txindex') + self.typeindex: Indexes24[TypeIndex] = Indexes24(client, f'{base_path}/typeindex') + +class CatalogTree_Indexed_Txout: + """Catalog tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.first_txoutindex: Indexes2[TxOutIndex] = Indexes2(client, f'{base_path}/first_txoutindex') + self.outputtype: Indexes25[OutputType] = Indexes25(client, f'{base_path}/outputtype') + self.txindex: Indexes25[TxIndex] = Indexes25(client, f'{base_path}/txindex') + self.typeindex: Indexes25[TypeIndex] = Indexes25(client, f'{base_path}/typeindex') + self.value: Indexes25[Sats] = Indexes25(client, f'{base_path}/value') + +class BrkClient(BrkClientBase): + """Main BRK client with catalog tree and API methods.""" + + def __init__(self, base_url: str = 'http://localhost:3000', timeout: float = 30.0): + super().__init__(base_url, timeout) + self.tree = CatalogTree(self) + + def get_api_address_by_address(self, address: str) -> AddressStats: + """Address information. + + Retrieve comprehensive information about a Bitcoin address including balance, transaction history, UTXOs, and estimated investment metrics. Supports all standard Bitcoin address types (P2PKH, P2SH, P2WPKH, P2WSH, P2TR, etc.).""" + return self.get(f'/api/address/{address}') + + def get_api_address_by_address_txs(self, address: str, after_txid: Optional[str] = None, limit: Optional[str] = None) -> List[Txid]: + """Address transaction IDs. + + Get transaction IDs for an address, newest first. Use after_txid for pagination.""" + params = [] + if after_txid is not None: params.append(f'after_txid={after_txid}') + if limit is not None: params.append(f'limit={limit}') + query = '&'.join(params) + return self.get(f'/api/address/{address}/txs{"?" + query if query else ""}') + + def get_api_address_by_address_txs_chain(self, address: str, after_txid: Optional[str] = None, limit: Optional[str] = None) -> List[Txid]: + """Address confirmed transactions. + + Get confirmed transaction IDs for an address, 25 per page. Use ?after_txid= for pagination.""" + params = [] + if after_txid is not None: params.append(f'after_txid={after_txid}') + if limit is not None: params.append(f'limit={limit}') + query = '&'.join(params) + return self.get(f'/api/address/{address}/txs/chain{"?" + query if query else ""}') + + def get_api_address_by_address_txs_mempool(self, address: str) -> List[Txid]: + """Address mempool transactions. + + Get unconfirmed transaction IDs for an address from the mempool (up to 50).""" + return self.get(f'/api/address/{address}/txs/mempool') + + def get_api_address_by_address_utxo(self, address: str) -> List[Utxo]: + """Address UTXOs. + + Get unspent transaction outputs for an address.""" + return self.get(f'/api/address/{address}/utxo') + + def get_api_block_height_by_height(self, height: str) -> BlockInfo: + """Block by height. + + Retrieve block information by block height. Returns block metadata including hash, timestamp, difficulty, size, weight, and transaction count.""" + return self.get(f'/api/block-height/{height}') + + def get_api_block_by_hash(self, hash: str) -> BlockInfo: + """Block information. + + Retrieve block information by block hash. Returns block metadata including height, timestamp, difficulty, size, weight, and transaction count.""" + return self.get(f'/api/block/{hash}') + + def get_api_block_by_hash_raw(self, hash: str) -> List[int]: + """Raw block. + + Returns the raw block data in binary format.""" + return self.get(f'/api/block/{hash}/raw') + + def get_api_block_by_hash_status(self, hash: str) -> BlockStatus: + """Block status. + + Retrieve the status of a block. Returns whether the block is in the best chain and, if so, its height and the hash of the next block.""" + return self.get(f'/api/block/{hash}/status') + + def get_api_block_by_hash_txid_by_index(self, hash: str, index: str) -> Txid: + """Transaction ID at index. + + Retrieve a single transaction ID at a specific index within a block. Returns plain text txid.""" + return self.get(f'/api/block/{hash}/txid/{index}') + + def get_api_block_by_hash_txids(self, hash: str) -> List[Txid]: + """Block transaction IDs. + + Retrieve all transaction IDs in a block by block hash.""" + return self.get(f'/api/block/{hash}/txids') + + def get_api_block_by_hash_txs_by_start_index(self, hash: str, start_index: str) -> List[Transaction]: + """Block transactions (paginated). + + Retrieve transactions in a block by block hash, starting from the specified index. Returns up to 25 transactions at a time.""" + return self.get(f'/api/block/{hash}/txs/{start_index}') + + def get_api_blocks(self) -> List[BlockInfo]: + """Recent blocks. + + Retrieve the last 10 blocks. Returns block metadata for each block.""" + return self.get('/api/blocks') + + def get_api_blocks_by_height(self, height: str) -> List[BlockInfo]: + """Blocks from height. + + Retrieve up to 10 blocks going backwards from the given height. For example, height=100 returns blocks 100, 99, 98, ..., 91. Height=0 returns only block 0.""" + return self.get(f'/api/blocks/{height}') + + def get_api_mempool_info(self) -> MempoolInfo: + """Mempool statistics. + + Get current mempool statistics including transaction count, total vsize, and total fees.""" + return self.get('/api/mempool/info') + + def get_api_mempool_txids(self) -> List[Txid]: + """Mempool transaction IDs. + + Get all transaction IDs currently in the mempool.""" + return self.get('/api/mempool/txids') + + def get_api_metric_by_metric(self, metric: str) -> List[Index]: + """Get supported indexes for a metric. + + Returns the list of indexes are supported by the specified metric. For example, `realized_price` might be available on dateindex, weekindex, and monthindex.""" + return self.get(f'/api/metric/{metric}') + + def get_api_metric_by_metric_by_index(self, metric: str, index: str, from_: Optional[str] = None, to: Optional[str] = None, count: Optional[str] = None, format: Optional[str] = None) -> MetricData: + """Get metric data. + + Fetch data for a specific metric at the given index. Use query parameters to filter by date range and format (json/csv).""" + params = [] + if from_ is not None: params.append(f'from={from_}') + if to is not None: params.append(f'to={to}') + if count is not None: params.append(f'count={count}') + if format is not None: params.append(f'format={format}') + query = '&'.join(params) + return self.get(f'/api/metric/{metric}/{index}{"?" + query if query else ""}') + + def get_api_metrics_bulk(self, metrics: str, index: str, from_: Optional[str] = None, to: Optional[str] = None, count: Optional[str] = None, format: Optional[str] = None) -> List[MetricData]: + """Bulk metric data. + + Fetch multiple metrics in a single request. Supports filtering by index and date range. Returns an array of MetricData objects.""" + params = [] + params.append(f'metrics={metrics}') + params.append(f'index={index}') + if from_ is not None: params.append(f'from={from_}') + if to is not None: params.append(f'to={to}') + if count is not None: params.append(f'count={count}') + if format is not None: params.append(f'format={format}') + query = '&'.join(params) + return self.get(f'/api/metrics/bulk{"?" + query if query else ""}') + + def get_api_metrics_catalog(self) -> TreeNode: + """Metrics catalog. + + Returns the complete hierarchical catalog of available metrics organized as a tree structure. Metrics are grouped by categories and subcategories. Best viewed in an interactive JSON viewer (e.g., Firefox's built-in JSON viewer) for easy navigation of the nested structure.""" + return self.get('/api/metrics/catalog') + + def get_api_metrics_count(self) -> List[MetricCount]: + """Metric count. + + Current metric count""" + return self.get('/api/metrics/count') + + def get_api_metrics_indexes(self) -> List[IndexInfo]: + """List available indexes. + + Returns all available indexes with their accepted query aliases. Use any alias when querying metrics.""" + return self.get('/api/metrics/indexes') + + def get_api_metrics_list(self, page: Optional[str] = None) -> PaginatedMetrics: + """Metrics list. + + Paginated list of available metrics""" + params = [] + if page is not None: params.append(f'page={page}') + query = '&'.join(params) + return self.get(f'/api/metrics/list{"?" + query if query else ""}') + + def get_api_metrics_search_by_metric(self, metric: str, limit: Optional[str] = None) -> List[Metric]: + """Search metrics. + + Fuzzy search for metrics by name. Supports partial matches and typos.""" + params = [] + if limit is not None: params.append(f'limit={limit}') + query = '&'.join(params) + return self.get(f'/api/metrics/search/{metric}{"?" + query if query else ""}') + + def get_api_tx_by_txid(self, txid: str) -> Transaction: + """Transaction information. + + Retrieve complete transaction data by transaction ID (txid). Returns the full transaction details including inputs, outputs, and metadata. The transaction data is read directly from the blockchain data files.""" + return self.get(f'/api/tx/{txid}') + + def get_api_tx_by_txid_hex(self, txid: str) -> Hex: + """Transaction hex. + + Retrieve the raw transaction as a hex-encoded string. Returns the serialized transaction in hexadecimal format.""" + return self.get(f'/api/tx/{txid}/hex') + + def get_api_tx_by_txid_outspend_by_vout(self, txid: str, vout: str) -> TxOutspend: + """Output spend status. + + Get the spending status of a transaction output. Returns whether the output has been spent and, if so, the spending transaction details.""" + return self.get(f'/api/tx/{txid}/outspend/{vout}') + + def get_api_tx_by_txid_outspends(self, txid: str) -> List[TxOutspend]: + """All output spend statuses. + + Get the spending status of all outputs in a transaction. Returns an array with the spend status for each output.""" + return self.get(f'/api/tx/{txid}/outspends') + + def get_api_tx_by_txid_status(self, txid: str) -> TxStatus: + """Transaction status. + + Retrieve the confirmation status of a transaction. Returns whether the transaction is confirmed and, if so, the block height, hash, and timestamp.""" + return self.get(f'/api/tx/{txid}/status') + + def get_api_v1_difficulty_adjustment(self) -> DifficultyAdjustment: + """Difficulty adjustment. + + Get current difficulty adjustment information including progress through the current epoch, estimated retarget date, and difficulty change prediction.""" + return self.get('/api/v1/difficulty-adjustment') + + def get_api_v1_fees_mempool_blocks(self) -> List[MempoolBlock]: + """Projected mempool blocks. + + Get projected blocks from the mempool for fee estimation. Each block contains statistics about transactions that would be included if a block were mined now.""" + return self.get('/api/v1/fees/mempool-blocks') + + def get_api_v1_fees_recommended(self) -> RecommendedFees: + """Recommended fees. + + Get recommended fee rates for different confirmation targets based on current mempool state.""" + return self.get('/api/v1/fees/recommended') + + def get_api_v1_mining_blocks_fees_by_time_period(self, time_period: str) -> List[BlockFeesEntry]: + """Block fees. + + Get average block fees for a time period. Valid periods: 24h, 3d, 1w, 1m, 3m, 6m, 1y, 2y, 3y""" + return self.get(f'/api/v1/mining/blocks/fees/{time_period}') + + def get_api_v1_mining_blocks_rewards_by_time_period(self, time_period: str) -> List[BlockRewardsEntry]: + """Block rewards. + + Get average block rewards (coinbase = subsidy + fees) for a time period. Valid periods: 24h, 3d, 1w, 1m, 3m, 6m, 1y, 2y, 3y""" + return self.get(f'/api/v1/mining/blocks/rewards/{time_period}') + + def get_api_v1_mining_blocks_sizes_weights_by_time_period(self, time_period: str) -> BlockSizesWeights: + """Block sizes and weights. + + Get average block sizes and weights for a time period. Valid periods: 24h, 3d, 1w, 1m, 3m, 6m, 1y, 2y, 3y""" + return self.get(f'/api/v1/mining/blocks/sizes-weights/{time_period}') + + def get_api_v1_mining_blocks_timestamp_by_timestamp(self, timestamp: str) -> BlockTimestamp: + """Block by timestamp. + + Find the block closest to a given UNIX timestamp.""" + return self.get(f'/api/v1/mining/blocks/timestamp/{timestamp}') + + def get_api_v1_mining_difficulty_adjustments(self) -> List[DifficultyAdjustmentEntry]: + """Difficulty adjustments (all time). + + Get historical difficulty adjustments. Returns array of [timestamp, height, difficulty, change_percent].""" + return self.get('/api/v1/mining/difficulty-adjustments') + + def get_api_v1_mining_difficulty_adjustments_by_time_period(self, time_period: str) -> List[DifficultyAdjustmentEntry]: + """Difficulty adjustments. + + Get historical difficulty adjustments for a time period. Valid periods: 24h, 3d, 1w, 1m, 3m, 6m, 1y, 2y, 3y. Returns array of [timestamp, height, difficulty, change_percent].""" + return self.get(f'/api/v1/mining/difficulty-adjustments/{time_period}') + + def get_api_v1_mining_hashrate(self) -> HashrateSummary: + """Network hashrate (all time). + + Get network hashrate and difficulty data for all time.""" + return self.get('/api/v1/mining/hashrate') + + def get_api_v1_mining_hashrate_by_time_period(self, time_period: str) -> HashrateSummary: + """Network hashrate. + + Get network hashrate and difficulty data for a time period. Valid periods: 24h, 3d, 1w, 1m, 3m, 6m, 1y, 2y, 3y""" + return self.get(f'/api/v1/mining/hashrate/{time_period}') + + def get_api_v1_mining_pool_by_slug(self, slug: str) -> PoolDetail: + """Mining pool details. + + Get detailed information about a specific mining pool including block counts and shares for different time periods.""" + return self.get(f'/api/v1/mining/pool/{slug}') + + def get_api_v1_mining_pools(self) -> List[PoolInfo]: + """List all mining pools. + + Get list of all known mining pools with their identifiers.""" + return self.get('/api/v1/mining/pools') + + def get_api_v1_mining_pools_by_time_period(self, time_period: str) -> PoolsSummary: + """Mining pool statistics. + + Get mining pool statistics for a time period. Valid periods: 24h, 3d, 1w, 1m, 3m, 6m, 1y, 2y, 3y""" + return self.get(f'/api/v1/mining/pools/{time_period}') + + def get_api_v1_mining_reward_stats_by_block_count(self, block_count: str) -> RewardStats: + """Mining reward statistics. + + Get mining reward statistics for the last N blocks including total rewards, fees, and transaction count.""" + return self.get(f'/api/v1/mining/reward-stats/{block_count}') + + def get_api_v1_validate_address_by_address(self, address: str) -> AddressValidation: + """Validate address. + + Validate a Bitcoin address and get information about its type and scriptPubKey.""" + return self.get(f'/api/v1/validate-address/{address}') + + def get_health(self) -> Health: + """Health check. + + Returns the health status of the API server""" + return self.get('/health') + + def get_version(self) -> str: + """API version. + + Returns the current version of the API server""" + return self.get('/version') +