clients: snapshot

This commit is contained in:
nym21
2026-01-13 23:14:26 +01:00
parent e77993fb76
commit 524ab3de05
18 changed files with 3315 additions and 5341 deletions

View File

@@ -33,14 +33,6 @@ fn get_shortest_leaf_name(node: &TreeNode) -> Option<String> {
}
}
/// Get all leaf names from a tree node.
pub fn get_all_leaf_names(node: &TreeNode) -> Vec<String> {
match node {
TreeNode::Leaf(leaf) => vec![leaf.name().to_string()],
TreeNode::Branch(children) => children.values().flat_map(get_all_leaf_names).collect(),
}
}
/// Get the field signature for a branch node's children.
pub fn get_node_fields(
children: &BTreeMap<String, TreeNode>,
@@ -78,11 +70,9 @@ pub fn get_node_fields(
}
/// Detect index patterns (sets of indexes that appear together on metrics).
pub fn detect_index_patterns(tree: &TreeNode) -> (BTreeSet<Index>, Vec<IndexSetPattern>) {
let mut used_indexes: BTreeSet<Index> = BTreeSet::new();
pub fn detect_index_patterns(tree: &TreeNode) -> Vec<IndexSetPattern> {
let mut unique_index_sets: BTreeSet<BTreeSet<Index>> = BTreeSet::new();
collect_indexes_from_tree(tree, &mut used_indexes, &mut unique_index_sets);
collect_index_sets_from_tree(tree, &mut unique_index_sets);
// Sort by count (descending) then by first index name for deterministic ordering
let mut sorted_sets: Vec<_> = unique_index_sets
@@ -96,31 +86,27 @@ pub fn detect_index_patterns(tree: &TreeNode) -> (BTreeSet<Index>, Vec<IndexSetP
});
// Assign unique sequential names
let patterns: Vec<IndexSetPattern> = sorted_sets
sorted_sets
.into_iter()
.enumerate()
.map(|(i, indexes)| IndexSetPattern {
name: format!("MetricPattern{}", i + 1),
indexes,
})
.collect();
(used_indexes, patterns)
.collect()
}
fn collect_indexes_from_tree(
fn collect_index_sets_from_tree(
node: &TreeNode,
used_indexes: &mut BTreeSet<Index>,
unique_index_sets: &mut BTreeSet<BTreeSet<Index>>,
) {
match node {
TreeNode::Leaf(leaf) => {
used_indexes.extend(leaf.indexes().iter().cloned());
unique_index_sets.insert(leaf.indexes().clone());
}
TreeNode::Branch(children) => {
for child in children.values() {
collect_indexes_from_tree(child, used_indexes, unique_index_sets);
collect_index_sets_from_tree(child, unique_index_sets);
}
}
}
@@ -136,17 +122,6 @@ pub struct PatternBaseResult {
pub has_outlier: bool,
}
impl PatternBaseResult {
/// Returns true if an inline type should be generated instead of using a pattern factory.
///
/// This is the case when:
/// - The child fields don't match a parameterizable pattern, OR
/// - An outlier was detected during pattern analysis
pub fn should_inline(&self, is_parameterizable: bool) -> bool {
!is_parameterizable || self.has_outlier
}
}
/// Get the metric base for a pattern instance by analyzing direct children.
///
/// Uses the shortest leaf names from direct children to find common prefix/suffix.

View File

@@ -1,6 +1,6 @@
//! JavaScript language syntax implementation.
use crate::{GenericSyntax, LanguageSyntax, to_camel_case, to_pascal_case};
use crate::{GenericSyntax, LanguageSyntax, to_camel_case};
/// JavaScript-specific code generation syntax.
pub struct JavaScriptSyntax;
@@ -52,41 +52,6 @@ impl LanguageSyntax for JavaScriptSyntax {
GenericSyntax::JAVASCRIPT
}
fn struct_header(&self, name: &str, generic_params: &str, doc: Option<&str>) -> String {
let mut result = String::new();
if let Some(doc) = doc {
result.push_str(&format!("/** {} */\n", doc));
}
// JavaScript uses factory functions that return object literals
result.push_str(&format!(
"function create{}{}(client, basePath) {{\n return {{\n",
name, generic_params
));
result
}
fn struct_footer(&self) -> String {
" };\n}\n".to_string()
}
fn constructor_header(&self, _params: &str) -> String {
// JavaScript factory functions don't have a separate constructor
String::new()
}
fn constructor_footer(&self) -> String {
String::new()
}
fn field_declaration(&self, indent: &str, _name: &str, type_ann: &str) -> String {
// JSDoc property declaration
format!("{}/** @type {{{}}} */\n", indent, type_ann)
}
fn index_field_name(&self, index_name: &str) -> String {
format!("by{}", to_pascal_case(index_name))
}
fn string_literal(&self, value: &str) -> String {
format!("'{}'", value)
}

View File

@@ -47,35 +47,6 @@ impl LanguageSyntax for PythonSyntax {
GenericSyntax::PYTHON
}
fn struct_header(&self, name: &str, generic_params: &str, doc: Option<&str>) -> String {
let mut result = format!("class {}{}:\n", name, generic_params);
if let Some(doc) = doc {
result.push_str(&format!(" \"\"\"{}\"\"\"\n", doc));
}
result
}
fn struct_footer(&self) -> String {
String::new()
}
fn constructor_header(&self, params: &str) -> String {
format!(" def __init__(self{}) -> None:\n", params)
}
fn constructor_footer(&self) -> String {
String::new()
}
fn field_declaration(&self, _indent: &str, _name: &str, _type_ann: &str) -> String {
// Python uses __init__ for field declarations, so this is a no-op
String::new()
}
fn index_field_name(&self, index_name: &str) -> String {
to_snake_case(index_name)
}
fn string_literal(&self, value: &str) -> String {
format!("'{}'", value)
}

View File

@@ -48,35 +48,6 @@ impl LanguageSyntax for RustSyntax {
GenericSyntax::RUST
}
fn struct_header(&self, name: &str, generic_params: &str, doc: Option<&str>) -> String {
let mut result = String::new();
if let Some(doc) = doc {
result.push_str(&format!("/// {}\n", doc));
}
result.push_str(&format!("pub struct {}{} {{\n", name, generic_params));
result
}
fn struct_footer(&self) -> String {
"}\n".to_string()
}
fn constructor_header(&self, params: &str) -> String {
format!(" pub fn new({}) -> Self {{\n Self {{\n", params)
}
fn constructor_footer(&self) -> String {
" }\n }\n".to_string()
}
fn field_declaration(&self, indent: &str, name: &str, type_ann: &str) -> String {
format!("{}pub {}: {},\n", indent, name, type_ann)
}
fn index_field_name(&self, index_name: &str) -> String {
format!("by_{}", to_snake_case(index_name))
}
fn string_literal(&self, value: &str) -> String {
format!("\"{}\".to_string()", value)
}

View File

@@ -80,26 +80,6 @@ pub fn generate_parameterized_field<S: LanguageSyntax>(
writeln!(output, "{}", syntax.field_init(indent, &field_name, &type_ann, &value)).unwrap();
}
/// Generate a tree-path field using the language syntax.
///
/// This is the fallback for non-parameterizable patterns where fields
/// use a base path that's extended with the field name.
pub fn generate_tree_path_field<S: LanguageSyntax>(
output: &mut String,
syntax: &S,
field: &PatternField,
pattern: &StructuralPattern,
metadata: &ClientMetadata,
indent: &str,
) {
let field_name = syntax.field_name(&field.name);
let type_ann = metadata.field_type_annotation(field, false, None, syntax.generic_syntax());
let path_expr = compute_path_expr(syntax, pattern, field, "base_path");
let value = compute_field_value(syntax, field, metadata, &path_expr);
writeln!(output, "{}", syntax.field_init(indent, &field_name, &type_ann, &value)).unwrap();
}
/// Generate a tree node field with a specific child node for pattern instance base detection.
///
/// This is used when generating tree nodes where we need to detect the pattern instance

View File

@@ -27,8 +27,6 @@ pub struct ChildContext<'a> {
pub should_inline: bool,
/// The type name to use for inline branches.
pub inline_type_name: String,
/// Whether the pattern is parameterizable (has ::new() constructor).
pub is_parameterizable: bool,
}
/// Context for generating a tree node, returned by `prepare_tree_node`.
@@ -86,11 +84,6 @@ pub fn prepare_tree_node<'a>(
.as_ref()
.is_some_and(|cf| metadata.matches_pattern(cf));
// For constructors: only use ::new() if parameterizable
let is_parameterizable = child_fields
.as_ref()
.is_some_and(|cf| metadata.is_parameterizable_fields(cf));
// should_inline determines if we generate an inline struct type
// We inline only if it's a branch AND doesn't match any pattern
let should_inline = !is_leaf && !matches_any_pattern;
@@ -111,7 +104,6 @@ pub fn prepare_tree_node<'a>(
is_leaf,
should_inline,
inline_type_name,
is_parameterizable,
}
})
.collect();

View File

@@ -21,8 +21,6 @@ pub struct Endpoint {
pub summary: Option<String>,
/// Detailed description
pub description: Option<String>,
/// Tags for grouping
pub tags: Vec<String>,
/// Path parameters
pub path_params: Vec<Parameter>,
/// Query parameters
@@ -200,7 +198,6 @@ fn extract_endpoint(path: &str, method: &str, operation: &Operation) -> Option<E
operation_id: operation.operation_id.clone(),
summary: operation.summary.clone(),
description: operation.description.clone(),
tags: operation.tags.clone(),
path_params,
query_params,
response_type,

View File

@@ -80,39 +80,6 @@ pub trait LanguageSyntax {
/// - Rust: `<T>` with default `_`
fn generic_syntax(&self) -> GenericSyntax;
/// Generate a struct/class header.
///
/// # Arguments
/// * `name` - The type name
/// * `generic_params` - Generic parameters (e.g., "<T>" or "[T]"), empty if none
/// * `doc` - Optional documentation string
fn struct_header(&self, name: &str, generic_params: &str, doc: Option<&str>) -> String;
/// Generate a struct/class footer.
fn struct_footer(&self) -> String;
/// Generate a constructor/init method header.
///
/// # Arguments
/// * `params` - Constructor parameters (language-specific format)
fn constructor_header(&self, params: &str) -> String;
/// Generate a constructor/init method footer.
fn constructor_footer(&self) -> String;
/// Generate a field declaration (for struct body, not init).
///
/// # Arguments
/// * `indent` - The indentation string
/// * `name` - The field name
/// * `type_ann` - The type annotation
fn field_declaration(&self, indent: &str, name: &str, type_ann: &str) -> String;
/// Format an index field name from an Index.
///
/// E.g., `by_date_height`, `by_date`, etc.
fn index_field_name(&self, index_name: &str) -> String;
/// Format a string literal.
///
/// - Python/JavaScript: `'value'` (single quotes)

View File

@@ -15,8 +15,6 @@ pub struct ClientMetadata {
pub catalog: brk_types::TreeNode,
/// Structural patterns - tree node shapes that repeat
pub structural_patterns: Vec<StructuralPattern>,
/// All indexes used across the catalog
pub used_indexes: BTreeSet<Index>,
/// Index set patterns - sets of indexes that appear together on metrics
pub index_set_patterns: Vec<IndexSetPattern>,
/// Maps concrete field signatures to pattern names
@@ -35,12 +33,11 @@ impl ClientMetadata {
pub fn from_catalog(catalog: brk_types::TreeNode) -> Self {
let (structural_patterns, concrete_to_pattern, concrete_to_type_param) =
analysis::detect_structural_patterns(&catalog);
let (used_indexes, index_set_patterns) = analysis::detect_index_patterns(&catalog);
let index_set_patterns = analysis::detect_index_patterns(&catalog);
ClientMetadata {
catalog,
structural_patterns,
used_indexes,
index_set_patterns,
concrete_to_pattern,
concrete_to_type_param,
@@ -98,20 +95,6 @@ impl ClientMetadata {
|| self.structural_patterns.iter().any(|p| p.fields == fields)
}
/// Check if child fields match a parameterizable pattern.
/// Returns true only if the fields match a pattern AND that pattern is parameterizable.
pub fn is_parameterizable_fields(&self, fields: &[PatternField]) -> bool {
self.concrete_to_pattern
.get(fields)
.or_else(|| {
self.structural_patterns
.iter()
.find(|p| p.fields == fields)
.map(|p| &p.name)
})
.is_some_and(|name| self.is_parameterizable(name))
}
/// Resolve the type name for a tree field.
/// If the field matches ANY pattern (parameterizable or not), returns pattern type.
/// Otherwise returns the inline type name (parent_child format).
@@ -148,11 +131,6 @@ impl ClientMetadata {
lookup
}
/// Check if a field should use a shared index accessor.
pub fn field_uses_accessor(&self, field: &PatternField) -> bool {
self.find_index_set_pattern(&field.indexes).is_some()
}
/// Generate type annotation for a field with language-specific syntax.
pub fn field_type_annotation(
&self,

View File

@@ -29,11 +29,6 @@ pub struct StructuralPattern {
}
impl StructuralPattern {
/// Returns true if this pattern contains any leaf fields.
pub fn contains_leaves(&self) -> bool {
self.fields.iter().any(|f| f.is_leaf())
}
/// Returns true if this pattern can be parameterized with an accumulator.
pub fn is_parameterizable(&self) -> bool {
self.mode.is_some()
@@ -52,11 +47,6 @@ impl StructuralPattern {
pub fn is_suffix_mode(&self) -> bool {
matches!(&self.mode, Some(PatternMode::Suffix { .. }))
}
/// Returns true if this pattern is in prefix mode.
pub fn is_prefix_mode(&self) -> bool {
matches!(&self.mode, Some(PatternMode::Prefix { .. }))
}
}
/// A field in a structural pattern.

View File

@@ -269,13 +269,54 @@ fn test_parameterizable_patterns_have_mode() {
}
}
#[test]
fn test_fee_rate_pattern_relatives() {
let catalog = load_catalog();
let (patterns, _, _) = brk_bindgen::detect_structural_patterns(&catalog);
let fee_rate_pattern = patterns
.iter()
.find(|p| p.name == "FeeRatePattern")
.expect("FeeRatePattern should exist");
println!("FeeRatePattern mode:");
if let Some(mode) = &fee_rate_pattern.mode {
match mode {
brk_bindgen::PatternMode::Suffix { relatives } => {
println!(" Suffix mode:");
for (field, relative) in relatives {
println!(" {} -> '{}'", field, relative);
}
}
brk_bindgen::PatternMode::Prefix { prefixes } => {
println!(" Prefix mode:");
for (field, prefix) in prefixes {
println!(" {} -> '{}'", field, prefix);
}
}
}
} else {
println!(" No mode (not parameterizable)");
}
// Check that relatives are correct - should be "average", "max", etc.
// NOT "tx_weight_average", "tx_weight_max", etc.
if let Some(brk_bindgen::PatternMode::Suffix { relatives }) = &fee_rate_pattern.mode {
assert_eq!(
relatives.get("average"),
Some(&"average".to_string()),
"average relative should be 'average', not 'tx_weight_average'"
);
}
}
#[test]
fn test_index_patterns() {
let catalog = load_catalog();
let (used_indexes, index_patterns) = brk_bindgen::detect_index_patterns(&catalog);
let index_patterns = brk_bindgen::detect_index_patterns(&catalog);
println!("Used indexes: {:?}", used_indexes);
// println!("Used indexes: {:?}", used_indexes);
println!("Index set patterns: {}", index_patterns.len());
for pattern in &index_patterns {

View File

@@ -2642,56 +2642,6 @@ impl Price111dSmaPattern {
}
}
/// Pattern struct for repeated tree structure.
pub struct ActivePriceRatioPattern {
pub ratio: MetricPattern4<StoredF32>,
pub ratio_1m_sma: MetricPattern4<StoredF32>,
pub ratio_1w_sma: MetricPattern4<StoredF32>,
pub ratio_1y_sd: Ratio1ySdPattern,
pub ratio_2y_sd: Ratio1ySdPattern,
pub ratio_4y_sd: Ratio1ySdPattern,
pub ratio_pct1: MetricPattern4<StoredF32>,
pub ratio_pct1_usd: MetricPattern4<Dollars>,
pub ratio_pct2: MetricPattern4<StoredF32>,
pub ratio_pct2_usd: MetricPattern4<Dollars>,
pub ratio_pct5: MetricPattern4<StoredF32>,
pub ratio_pct5_usd: MetricPattern4<Dollars>,
pub ratio_pct95: MetricPattern4<StoredF32>,
pub ratio_pct95_usd: MetricPattern4<Dollars>,
pub ratio_pct98: MetricPattern4<StoredF32>,
pub ratio_pct98_usd: MetricPattern4<Dollars>,
pub ratio_pct99: MetricPattern4<StoredF32>,
pub ratio_pct99_usd: MetricPattern4<Dollars>,
pub ratio_sd: Ratio1ySdPattern,
}
impl ActivePriceRatioPattern {
/// Create a new pattern node with accumulated metric name.
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
Self {
ratio: MetricPattern4::new(client.clone(), acc.clone()),
ratio_1m_sma: MetricPattern4::new(client.clone(), _m(&acc, "1m_sma")),
ratio_1w_sma: MetricPattern4::new(client.clone(), _m(&acc, "1w_sma")),
ratio_1y_sd: Ratio1ySdPattern::new(client.clone(), _m(&acc, "1y")),
ratio_2y_sd: Ratio1ySdPattern::new(client.clone(), _m(&acc, "2y")),
ratio_4y_sd: Ratio1ySdPattern::new(client.clone(), _m(&acc, "4y")),
ratio_pct1: MetricPattern4::new(client.clone(), _m(&acc, "pct1")),
ratio_pct1_usd: MetricPattern4::new(client.clone(), _m(&acc, "pct1_usd")),
ratio_pct2: MetricPattern4::new(client.clone(), _m(&acc, "pct2")),
ratio_pct2_usd: MetricPattern4::new(client.clone(), _m(&acc, "pct2_usd")),
ratio_pct5: MetricPattern4::new(client.clone(), _m(&acc, "pct5")),
ratio_pct5_usd: MetricPattern4::new(client.clone(), _m(&acc, "pct5_usd")),
ratio_pct95: MetricPattern4::new(client.clone(), _m(&acc, "pct95")),
ratio_pct95_usd: MetricPattern4::new(client.clone(), _m(&acc, "pct95_usd")),
ratio_pct98: MetricPattern4::new(client.clone(), _m(&acc, "pct98")),
ratio_pct98_usd: MetricPattern4::new(client.clone(), _m(&acc, "pct98_usd")),
ratio_pct99: MetricPattern4::new(client.clone(), _m(&acc, "pct99")),
ratio_pct99_usd: MetricPattern4::new(client.clone(), _m(&acc, "pct99_usd")),
ratio_sd: Ratio1ySdPattern::new(client.clone(), acc.clone()),
}
}
}
/// Pattern struct for repeated tree structure.
pub struct PercentilesPattern {
pub pct05: MetricPattern4<Dollars>,
@@ -2742,6 +2692,56 @@ impl PercentilesPattern {
}
}
/// Pattern struct for repeated tree structure.
pub struct ActivePriceRatioPattern {
pub ratio: MetricPattern4<StoredF32>,
pub ratio_1m_sma: MetricPattern4<StoredF32>,
pub ratio_1w_sma: MetricPattern4<StoredF32>,
pub ratio_1y_sd: Ratio1ySdPattern,
pub ratio_2y_sd: Ratio1ySdPattern,
pub ratio_4y_sd: Ratio1ySdPattern,
pub ratio_pct1: MetricPattern4<StoredF32>,
pub ratio_pct1_usd: MetricPattern4<Dollars>,
pub ratio_pct2: MetricPattern4<StoredF32>,
pub ratio_pct2_usd: MetricPattern4<Dollars>,
pub ratio_pct5: MetricPattern4<StoredF32>,
pub ratio_pct5_usd: MetricPattern4<Dollars>,
pub ratio_pct95: MetricPattern4<StoredF32>,
pub ratio_pct95_usd: MetricPattern4<Dollars>,
pub ratio_pct98: MetricPattern4<StoredF32>,
pub ratio_pct98_usd: MetricPattern4<Dollars>,
pub ratio_pct99: MetricPattern4<StoredF32>,
pub ratio_pct99_usd: MetricPattern4<Dollars>,
pub ratio_sd: Ratio1ySdPattern,
}
impl ActivePriceRatioPattern {
/// Create a new pattern node with accumulated metric name.
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
Self {
ratio: MetricPattern4::new(client.clone(), acc.clone()),
ratio_1m_sma: MetricPattern4::new(client.clone(), _m(&acc, "1m_sma")),
ratio_1w_sma: MetricPattern4::new(client.clone(), _m(&acc, "1w_sma")),
ratio_1y_sd: Ratio1ySdPattern::new(client.clone(), _m(&acc, "1y")),
ratio_2y_sd: Ratio1ySdPattern::new(client.clone(), _m(&acc, "2y")),
ratio_4y_sd: Ratio1ySdPattern::new(client.clone(), _m(&acc, "4y")),
ratio_pct1: MetricPattern4::new(client.clone(), _m(&acc, "pct1")),
ratio_pct1_usd: MetricPattern4::new(client.clone(), _m(&acc, "pct1_usd")),
ratio_pct2: MetricPattern4::new(client.clone(), _m(&acc, "pct2")),
ratio_pct2_usd: MetricPattern4::new(client.clone(), _m(&acc, "pct2_usd")),
ratio_pct5: MetricPattern4::new(client.clone(), _m(&acc, "pct5")),
ratio_pct5_usd: MetricPattern4::new(client.clone(), _m(&acc, "pct5_usd")),
ratio_pct95: MetricPattern4::new(client.clone(), _m(&acc, "pct95")),
ratio_pct95_usd: MetricPattern4::new(client.clone(), _m(&acc, "pct95_usd")),
ratio_pct98: MetricPattern4::new(client.clone(), _m(&acc, "pct98")),
ratio_pct98_usd: MetricPattern4::new(client.clone(), _m(&acc, "pct98_usd")),
ratio_pct99: MetricPattern4::new(client.clone(), _m(&acc, "pct99")),
ratio_pct99_usd: MetricPattern4::new(client.clone(), _m(&acc, "pct99_usd")),
ratio_sd: Ratio1ySdPattern::new(client.clone(), acc.clone()),
}
}
}
/// Pattern struct for repeated tree structure.
pub struct RelativePattern5 {
pub neg_unrealized_loss_rel_to_market_cap: MetricPattern1<StoredF32>,
@@ -3042,38 +3042,6 @@ impl<T: DeserializeOwned> DollarsPattern<T> {
}
}
/// Pattern struct for repeated tree structure.
pub struct RelativePattern2 {
pub neg_unrealized_loss_rel_to_own_market_cap: MetricPattern1<StoredF32>,
pub neg_unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1<StoredF32>,
pub net_unrealized_pnl_rel_to_own_market_cap: MetricPattern1<StoredF32>,
pub net_unrealized_pnl_rel_to_own_total_unrealized_pnl: MetricPattern1<StoredF32>,
pub supply_in_loss_rel_to_own_supply: MetricPattern1<StoredF64>,
pub supply_in_profit_rel_to_own_supply: MetricPattern1<StoredF64>,
pub unrealized_loss_rel_to_own_market_cap: MetricPattern1<StoredF32>,
pub unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1<StoredF32>,
pub unrealized_profit_rel_to_own_market_cap: MetricPattern1<StoredF32>,
pub unrealized_profit_rel_to_own_total_unrealized_pnl: MetricPattern1<StoredF32>,
}
impl RelativePattern2 {
/// Create a new pattern node with accumulated metric name.
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
Self {
neg_unrealized_loss_rel_to_own_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "neg_unrealized_loss_rel_to_own_market_cap")),
neg_unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "neg_unrealized_loss_rel_to_own_total_unrealized_pnl")),
net_unrealized_pnl_rel_to_own_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "net_unrealized_pnl_rel_to_own_market_cap")),
net_unrealized_pnl_rel_to_own_total_unrealized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "net_unrealized_pnl_rel_to_own_total_unrealized_pnl")),
supply_in_loss_rel_to_own_supply: MetricPattern1::new(client.clone(), _m(&acc, "supply_in_loss_rel_to_own_supply")),
supply_in_profit_rel_to_own_supply: MetricPattern1::new(client.clone(), _m(&acc, "supply_in_profit_rel_to_own_supply")),
unrealized_loss_rel_to_own_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_loss_rel_to_own_market_cap")),
unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_loss_rel_to_own_total_unrealized_pnl")),
unrealized_profit_rel_to_own_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_profit_rel_to_own_market_cap")),
unrealized_profit_rel_to_own_total_unrealized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_profit_rel_to_own_total_unrealized_pnl")),
}
}
}
/// Pattern struct for repeated tree structure.
pub struct RelativePattern {
pub neg_unrealized_loss_rel_to_market_cap: MetricPattern1<StoredF32>,
@@ -3106,6 +3074,38 @@ impl RelativePattern {
}
}
/// Pattern struct for repeated tree structure.
pub struct RelativePattern2 {
pub neg_unrealized_loss_rel_to_own_market_cap: MetricPattern1<StoredF32>,
pub neg_unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1<StoredF32>,
pub net_unrealized_pnl_rel_to_own_market_cap: MetricPattern1<StoredF32>,
pub net_unrealized_pnl_rel_to_own_total_unrealized_pnl: MetricPattern1<StoredF32>,
pub supply_in_loss_rel_to_own_supply: MetricPattern1<StoredF64>,
pub supply_in_profit_rel_to_own_supply: MetricPattern1<StoredF64>,
pub unrealized_loss_rel_to_own_market_cap: MetricPattern1<StoredF32>,
pub unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1<StoredF32>,
pub unrealized_profit_rel_to_own_market_cap: MetricPattern1<StoredF32>,
pub unrealized_profit_rel_to_own_total_unrealized_pnl: MetricPattern1<StoredF32>,
}
impl RelativePattern2 {
/// Create a new pattern node with accumulated metric name.
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
Self {
neg_unrealized_loss_rel_to_own_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "neg_unrealized_loss_rel_to_own_market_cap")),
neg_unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "neg_unrealized_loss_rel_to_own_total_unrealized_pnl")),
net_unrealized_pnl_rel_to_own_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "net_unrealized_pnl_rel_to_own_market_cap")),
net_unrealized_pnl_rel_to_own_total_unrealized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "net_unrealized_pnl_rel_to_own_total_unrealized_pnl")),
supply_in_loss_rel_to_own_supply: MetricPattern1::new(client.clone(), _m(&acc, "supply_in_loss_rel_to_own_supply")),
supply_in_profit_rel_to_own_supply: MetricPattern1::new(client.clone(), _m(&acc, "supply_in_profit_rel_to_own_supply")),
unrealized_loss_rel_to_own_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_loss_rel_to_own_market_cap")),
unrealized_loss_rel_to_own_total_unrealized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_loss_rel_to_own_total_unrealized_pnl")),
unrealized_profit_rel_to_own_market_cap: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_profit_rel_to_own_market_cap")),
unrealized_profit_rel_to_own_total_unrealized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_profit_rel_to_own_total_unrealized_pnl")),
}
}
}
/// Pattern struct for repeated tree structure.
pub struct CountPattern2<T> {
pub average: MetricPattern1<T>,
@@ -3257,24 +3257,50 @@ impl _0satsPattern {
}
/// Pattern struct for repeated tree structure.
pub struct _10yPattern {
pub struct PeriodCagrPattern {
pub _10y: MetricPattern4<StoredF32>,
pub _2y: MetricPattern4<StoredF32>,
pub _3y: MetricPattern4<StoredF32>,
pub _4y: MetricPattern4<StoredF32>,
pub _5y: MetricPattern4<StoredF32>,
pub _6y: MetricPattern4<StoredF32>,
pub _8y: MetricPattern4<StoredF32>,
}
impl PeriodCagrPattern {
/// Create a new pattern node with accumulated metric name.
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
Self {
_10y: MetricPattern4::new(client.clone(), _p("10y", &acc)),
_2y: MetricPattern4::new(client.clone(), _p("2y", &acc)),
_3y: MetricPattern4::new(client.clone(), _p("3y", &acc)),
_4y: MetricPattern4::new(client.clone(), _p("4y", &acc)),
_5y: MetricPattern4::new(client.clone(), _p("5y", &acc)),
_6y: MetricPattern4::new(client.clone(), _p("6y", &acc)),
_8y: MetricPattern4::new(client.clone(), _p("8y", &acc)),
}
}
}
/// Pattern struct for repeated tree structure.
pub struct _100btcPattern {
pub activity: ActivityPattern2,
pub cost_basis: CostBasisPattern,
pub outputs: OutputsPattern,
pub realized: RealizedPattern4,
pub realized: RealizedPattern,
pub relative: RelativePattern,
pub supply: SupplyPattern2,
pub unrealized: UnrealizedPattern,
}
impl _10yPattern {
impl _100btcPattern {
/// Create a new pattern node with accumulated metric name.
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
Self {
activity: ActivityPattern2::new(client.clone(), acc.clone()),
cost_basis: CostBasisPattern::new(client.clone(), acc.clone()),
outputs: OutputsPattern::new(client.clone(), _m(&acc, "utxo_count")),
realized: RealizedPattern4::new(client.clone(), acc.clone()),
realized: RealizedPattern::new(client.clone(), acc.clone()),
relative: RelativePattern::new(client.clone(), acc.clone()),
supply: SupplyPattern2::new(client.clone(), _m(&acc, "supply")),
unrealized: UnrealizedPattern::new(client.clone(), acc.clone()),
@@ -3308,32 +3334,6 @@ impl _0satsPattern2 {
}
}
/// Pattern struct for repeated tree structure.
pub struct _100btcPattern {
pub activity: ActivityPattern2,
pub cost_basis: CostBasisPattern,
pub outputs: OutputsPattern,
pub realized: RealizedPattern,
pub relative: RelativePattern,
pub supply: SupplyPattern2,
pub unrealized: UnrealizedPattern,
}
impl _100btcPattern {
/// Create a new pattern node with accumulated metric name.
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
Self {
activity: ActivityPattern2::new(client.clone(), acc.clone()),
cost_basis: CostBasisPattern::new(client.clone(), acc.clone()),
outputs: OutputsPattern::new(client.clone(), _m(&acc, "utxo_count")),
realized: RealizedPattern::new(client.clone(), acc.clone()),
relative: RelativePattern::new(client.clone(), acc.clone()),
supply: SupplyPattern2::new(client.clone(), _m(&acc, "supply")),
unrealized: UnrealizedPattern::new(client.clone(), acc.clone()),
}
}
}
/// Pattern struct for repeated tree structure.
pub struct UnrealizedPattern {
pub neg_unrealized_loss: MetricPattern1<Dollars>,
@@ -3387,27 +3387,27 @@ impl _10yTo12yPattern {
}
/// Pattern struct for repeated tree structure.
pub struct PeriodCagrPattern {
pub _10y: MetricPattern4<StoredF32>,
pub _2y: MetricPattern4<StoredF32>,
pub _3y: MetricPattern4<StoredF32>,
pub _4y: MetricPattern4<StoredF32>,
pub _5y: MetricPattern4<StoredF32>,
pub _6y: MetricPattern4<StoredF32>,
pub _8y: MetricPattern4<StoredF32>,
pub struct _10yPattern {
pub activity: ActivityPattern2,
pub cost_basis: CostBasisPattern,
pub outputs: OutputsPattern,
pub realized: RealizedPattern4,
pub relative: RelativePattern,
pub supply: SupplyPattern2,
pub unrealized: UnrealizedPattern,
}
impl PeriodCagrPattern {
impl _10yPattern {
/// Create a new pattern node with accumulated metric name.
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
Self {
_10y: MetricPattern4::new(client.clone(), _p("10y", &acc)),
_2y: MetricPattern4::new(client.clone(), _p("2y", &acc)),
_3y: MetricPattern4::new(client.clone(), _p("3y", &acc)),
_4y: MetricPattern4::new(client.clone(), _p("4y", &acc)),
_5y: MetricPattern4::new(client.clone(), _p("5y", &acc)),
_6y: MetricPattern4::new(client.clone(), _p("6y", &acc)),
_8y: MetricPattern4::new(client.clone(), _p("8y", &acc)),
activity: ActivityPattern2::new(client.clone(), acc.clone()),
cost_basis: CostBasisPattern::new(client.clone(), acc.clone()),
outputs: OutputsPattern::new(client.clone(), _m(&acc, "utxo_count")),
realized: RealizedPattern4::new(client.clone(), acc.clone()),
relative: RelativePattern::new(client.clone(), acc.clone()),
supply: SupplyPattern2::new(client.clone(), _m(&acc, "supply")),
unrealized: UnrealizedPattern::new(client.clone(), acc.clone()),
}
}
}
@@ -3454,24 +3454,6 @@ impl<T: DeserializeOwned> SplitPattern2<T> {
}
}
/// Pattern struct for repeated tree structure.
pub struct CostBasisPattern2 {
pub max: MetricPattern1<Dollars>,
pub min: MetricPattern1<Dollars>,
pub percentiles: PercentilesPattern,
}
impl CostBasisPattern2 {
/// Create a new pattern node with accumulated metric name.
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
Self {
max: MetricPattern1::new(client.clone(), _m(&acc, "max_cost_basis")),
min: MetricPattern1::new(client.clone(), _m(&acc, "min_cost_basis")),
percentiles: PercentilesPattern::new(client.clone(), _m(&acc, "cost_basis")),
}
}
}
/// Pattern struct for repeated tree structure.
pub struct UnclaimedRewardsPattern {
pub bitcoin: BitcoinPattern2<Bitcoin>,
@@ -3508,24 +3490,6 @@ impl _2015Pattern {
}
}
/// Pattern struct for repeated tree structure.
pub struct ActiveSupplyPattern {
pub bitcoin: MetricPattern1<Bitcoin>,
pub dollars: MetricPattern1<Dollars>,
pub sats: MetricPattern1<Sats>,
}
impl ActiveSupplyPattern {
/// Create a new pattern node with accumulated metric name.
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
Self {
bitcoin: MetricPattern1::new(client.clone(), _m(&acc, "btc")),
dollars: MetricPattern1::new(client.clone(), _m(&acc, "usd")),
sats: MetricPattern1::new(client.clone(), acc.clone()),
}
}
}
/// Pattern struct for repeated tree structure.
pub struct CoinbasePattern {
pub bitcoin: BitcoinPattern,
@@ -3544,6 +3508,24 @@ impl CoinbasePattern {
}
}
/// Pattern struct for repeated tree structure.
pub struct CostBasisPattern2 {
pub max: MetricPattern1<Dollars>,
pub min: MetricPattern1<Dollars>,
pub percentiles: PercentilesPattern,
}
impl CostBasisPattern2 {
/// Create a new pattern node with accumulated metric name.
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
Self {
max: MetricPattern1::new(client.clone(), _m(&acc, "max_cost_basis")),
min: MetricPattern1::new(client.clone(), _m(&acc, "min_cost_basis")),
percentiles: PercentilesPattern::new(client.clone(), _m(&acc, "cost_basis")),
}
}
}
/// Pattern struct for repeated tree structure.
pub struct SegwitAdoptionPattern {
pub base: MetricPattern11<StoredF32>,
@@ -3562,6 +3544,24 @@ impl SegwitAdoptionPattern {
}
}
/// Pattern struct for repeated tree structure.
pub struct ActiveSupplyPattern {
pub bitcoin: MetricPattern1<Bitcoin>,
pub dollars: MetricPattern1<Dollars>,
pub sats: MetricPattern1<Sats>,
}
impl ActiveSupplyPattern {
/// Create a new pattern node with accumulated metric name.
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
Self {
bitcoin: MetricPattern1::new(client.clone(), _m(&acc, "btc")),
dollars: MetricPattern1::new(client.clone(), _m(&acc, "usd")),
sats: MetricPattern1::new(client.clone(), acc.clone()),
}
}
}
/// Pattern struct for repeated tree structure.
pub struct CoinbasePattern2 {
pub bitcoin: BlockCountPattern<Bitcoin>,
@@ -3580,38 +3580,6 @@ impl CoinbasePattern2 {
}
}
/// Pattern struct for repeated tree structure.
pub struct RelativePattern4 {
pub supply_in_loss_rel_to_own_supply: MetricPattern1<StoredF64>,
pub supply_in_profit_rel_to_own_supply: MetricPattern1<StoredF64>,
}
impl RelativePattern4 {
/// Create a new pattern node with accumulated metric name.
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
Self {
supply_in_loss_rel_to_own_supply: MetricPattern1::new(client.clone(), _m(&acc, "loss_rel_to_own_supply")),
supply_in_profit_rel_to_own_supply: MetricPattern1::new(client.clone(), _m(&acc, "profit_rel_to_own_supply")),
}
}
}
/// Pattern struct for repeated tree structure.
pub struct CostBasisPattern {
pub max: MetricPattern1<Dollars>,
pub min: MetricPattern1<Dollars>,
}
impl CostBasisPattern {
/// Create a new pattern node with accumulated metric name.
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
Self {
max: MetricPattern1::new(client.clone(), _m(&acc, "max_cost_basis")),
min: MetricPattern1::new(client.clone(), _m(&acc, "min_cost_basis")),
}
}
}
/// Pattern struct for repeated tree structure.
pub struct _1dReturns1mSdPattern {
pub sd: MetricPattern4<StoredF32>,
@@ -3644,6 +3612,38 @@ impl SupplyPattern2 {
}
}
/// Pattern struct for repeated tree structure.
pub struct CostBasisPattern {
pub max: MetricPattern1<Dollars>,
pub min: MetricPattern1<Dollars>,
}
impl CostBasisPattern {
/// Create a new pattern node with accumulated metric name.
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
Self {
max: MetricPattern1::new(client.clone(), _m(&acc, "max_cost_basis")),
min: MetricPattern1::new(client.clone(), _m(&acc, "min_cost_basis")),
}
}
}
/// Pattern struct for repeated tree structure.
pub struct RelativePattern4 {
pub supply_in_loss_rel_to_own_supply: MetricPattern1<StoredF64>,
pub supply_in_profit_rel_to_own_supply: MetricPattern1<StoredF64>,
}
impl RelativePattern4 {
/// Create a new pattern node with accumulated metric name.
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
Self {
supply_in_loss_rel_to_own_supply: MetricPattern1::new(client.clone(), _m(&acc, "loss_rel_to_own_supply")),
supply_in_profit_rel_to_own_supply: MetricPattern1::new(client.clone(), _m(&acc, "profit_rel_to_own_supply")),
}
}
}
/// Pattern struct for repeated tree structure.
pub struct SatsPattern<T> {
pub ohlc: MetricPattern1<T>,
@@ -3654,24 +3654,8 @@ impl<T: DeserializeOwned> SatsPattern<T> {
/// Create a new pattern node with accumulated metric name.
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
Self {
ohlc: MetricPattern1::new(client.clone(), _m(&acc, "ohlc")),
split: SplitPattern2::new(client.clone(), acc.clone()),
}
}
}
/// Pattern struct for repeated tree structure.
pub struct BitcoinPattern2<T> {
pub cumulative: MetricPattern2<T>,
pub sum: MetricPattern1<T>,
}
impl<T: DeserializeOwned> BitcoinPattern2<T> {
/// Create a new pattern node with accumulated metric name.
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
Self {
cumulative: MetricPattern2::new(client.clone(), _m(&acc, "cumulative")),
sum: MetricPattern1::new(client.clone(), acc.clone()),
ohlc: MetricPattern1::new(client.clone(), _m(&acc, "ohlc_sats")),
split: SplitPattern2::new(client.clone(), _m(&acc, "sats")),
}
}
}
@@ -3692,6 +3676,22 @@ impl<T: DeserializeOwned> BlockCountPattern<T> {
}
}
/// Pattern struct for repeated tree structure.
pub struct BitcoinPattern2<T> {
pub cumulative: MetricPattern2<T>,
pub sum: MetricPattern1<T>,
}
impl<T: DeserializeOwned> BitcoinPattern2<T> {
/// Create a new pattern node with accumulated metric name.
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
Self {
cumulative: MetricPattern2::new(client.clone(), _m(&acc, "cumulative")),
sum: MetricPattern1::new(client.clone(), acc.clone()),
}
}
}
/// Pattern struct for repeated tree structure.
pub struct OutputsPattern {
pub utxo_count: MetricPattern1<StoredU64>,
@@ -6265,17 +6265,17 @@ impl MetricsTree_Price_Cents_Split {
/// Metrics tree node.
pub struct MetricsTree_Price_Oracle {
pub ohlc: MetricPattern6<OHLCCents>,
pub price: MetricPattern11<Cents>,
pub ohlc_cents: MetricPattern6<OHLCCents>,
pub price_cents: MetricPattern11<Cents>,
pub tx_count: MetricPattern6<StoredU32>,
}
impl MetricsTree_Price_Oracle {
pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self {
Self {
ohlc: MetricPattern6::new(client.clone(), "oracle_dateindex_to_ohlc".to_string()),
price: MetricPattern11::new(client.clone(), "oracle_height_to_price".to_string()),
tx_count: MetricPattern6::new(client.clone(), "oracle_dateindex_to_tx_count".to_string()),
ohlc_cents: MetricPattern6::new(client.clone(), "oracle_ohlc_cents".to_string()),
price_cents: MetricPattern11::new(client.clone(), "orange_price_cents".to_string()),
tx_count: MetricPattern6::new(client.clone(), "oracle_tx_count".to_string()),
}
}
}

View File

@@ -30,13 +30,15 @@ impl Vecs {
exit: &Exit,
) -> Result<()> {
// Validate versions
self.price
self.price_cents
.validate_computed_version_or_reset(indexer.vecs.outputs.value.version())?;
self.ohlc
self.ohlc_cents
.validate_computed_version_or_reset(indexes.dateindex.date.version())?;
let last_height = Height::from(indexer.vecs.blocks.timestamp.len());
let start_height = starting_indexes.height.min(Height::from(self.price.len()));
let start_height = starting_indexes
.height
.min(Height::from(self.price_cents.len()));
if start_height >= last_height {
return Ok(());
@@ -78,7 +80,7 @@ impl Vecs {
// Previous price for fallback (default ~$100,000)
let mut prev_price = if start_height > Height::ZERO {
self.price
self.price_cents
.iter()?
.get(start_height.decremented().unwrap())
.unwrap_or(Cents::from(10_000_000i64))
@@ -271,14 +273,14 @@ impl Vecs {
prev_price = price_cents;
self.price
self.price_cents
.truncate_push_at(height.to_usize(), price_cents)?;
}
// Write height prices
{
let _lock = exit.lock();
self.price.write()?;
self.price_cents.write()?;
}
info!("Oracle price computation: 100%");
@@ -299,14 +301,14 @@ impl Vecs {
let last_dateindex = DateIndex::from(indexes.dateindex.date.len());
let start_dateindex = starting_indexes
.dateindex
.min(DateIndex::from(self.ohlc.len()));
.min(DateIndex::from(self.ohlc_cents.len()));
if start_dateindex >= last_dateindex {
return Ok(());
}
let last_height = Height::from(self.price.len());
let mut height_to_price_iter = self.price.iter()?;
let last_height = Height::from(self.price_cents.len());
let mut height_to_price_iter = self.price_cents.iter()?;
let mut dateindex_to_first_height_iter = indexes.dateindex.first_height.iter();
let mut height_count_iter = indexes.dateindex.height_count.iter();
@@ -359,7 +361,7 @@ impl Vecs {
} else {
// No prices for this day, use previous
if dateindex > DateIndex::from(0usize) {
self.ohlc
self.ohlc_cents
.iter()?
.get(dateindex.decremented().unwrap())
.unwrap_or_default()
@@ -368,7 +370,8 @@ impl Vecs {
}
};
self.ohlc.truncate_push_at(dateindex.to_usize(), ohlc)?;
self.ohlc_cents
.truncate_push_at(dateindex.to_usize(), ohlc)?;
self.tx_count
.truncate_push_at(dateindex.to_usize(), StoredU32::from(tx_count))?;
}
@@ -376,7 +379,7 @@ impl Vecs {
// Write daily data
{
let _lock = exit.lock();
self.ohlc.write()?;
self.ohlc_cents.write()?;
self.tx_count.write()?;
}

View File

@@ -6,15 +6,14 @@ use super::Vecs;
impl Vecs {
pub fn forced_import(db: &Database, version: Version) -> Result<Self> {
let height_to_price = PcoVec::forced_import(db, "oracle_height_to_price", version)?;
let dateindex_to_ohlc = BytesVec::forced_import(db, "oracle_dateindex_to_ohlc", version)?;
let dateindex_to_tx_count =
PcoVec::forced_import(db, "oracle_dateindex_to_tx_count", version)?;
let price_cents = PcoVec::forced_import(db, "orange_price_cents", version)?;
let ohlc_cents = BytesVec::forced_import(db, "oracle_ohlc_cents", version)?;
let tx_count = PcoVec::forced_import(db, "oracle_tx_count", version)?;
Ok(Self {
price: height_to_price,
ohlc: dateindex_to_ohlc,
tx_count: dateindex_to_tx_count,
price_cents,
ohlc_cents,
tx_count,
})
}
}

View File

@@ -7,11 +7,11 @@ use vecdb::{BytesVec, PcoVec};
pub struct Vecs {
/// Per-block price estimate in cents
/// This enables OHLC derivation for any time period
pub price: PcoVec<Height, Cents>,
pub price_cents: PcoVec<Height, Cents>,
/// Daily OHLC derived from height_to_price
/// Uses BytesVec because OHLCCents is a complex type
pub ohlc: BytesVec<DateIndex, OHLCCents>,
pub ohlc_cents: BytesVec<DateIndex, OHLCCents>,
/// Number of qualifying transactions per day (for confidence)
pub tx_count: PcoVec<DateIndex, StoredU32>,

View File

@@ -14,7 +14,7 @@ impl Vecs {
indexes: &indexes::Vecs,
) -> Result<Self> {
let txindex_to_weight = LazyVecFrom2::init(
"weight",
"tx_weight",
version,
indexer.vecs.transactions.base_size.boxed_clone(),
indexer.vecs.transactions.total_size.boxed_clone(),
@@ -28,7 +28,7 @@ impl Vecs {
);
let txindex_to_vsize = LazyVecFrom2::init(
"vsize",
"tx_vsize",
version,
indexer.vecs.transactions.base_size.boxed_clone(),
indexer.vecs.transactions.total_size.boxed_clone(),

View File

@@ -2902,59 +2902,6 @@ function createPrice111dSmaPattern(client, acc) {
};
}
/**
* @typedef {Object} ActivePriceRatioPattern
* @property {MetricPattern4<StoredF32>} ratio
* @property {MetricPattern4<StoredF32>} ratio1mSma
* @property {MetricPattern4<StoredF32>} ratio1wSma
* @property {Ratio1ySdPattern} ratio1ySd
* @property {Ratio1ySdPattern} ratio2ySd
* @property {Ratio1ySdPattern} ratio4ySd
* @property {MetricPattern4<StoredF32>} ratioPct1
* @property {MetricPattern4<Dollars>} ratioPct1Usd
* @property {MetricPattern4<StoredF32>} ratioPct2
* @property {MetricPattern4<Dollars>} ratioPct2Usd
* @property {MetricPattern4<StoredF32>} ratioPct5
* @property {MetricPattern4<Dollars>} ratioPct5Usd
* @property {MetricPattern4<StoredF32>} ratioPct95
* @property {MetricPattern4<Dollars>} ratioPct95Usd
* @property {MetricPattern4<StoredF32>} ratioPct98
* @property {MetricPattern4<Dollars>} ratioPct98Usd
* @property {MetricPattern4<StoredF32>} ratioPct99
* @property {MetricPattern4<Dollars>} ratioPct99Usd
* @property {Ratio1ySdPattern} ratioSd
*/
/**
* Create a ActivePriceRatioPattern pattern node
* @param {BrkClientBase} client
* @param {string} acc - Accumulated metric name
* @returns {ActivePriceRatioPattern}
*/
function createActivePriceRatioPattern(client, acc) {
return {
ratio: createMetricPattern4(client, acc),
ratio1mSma: createMetricPattern4(client, _m(acc, "1m_sma")),
ratio1wSma: createMetricPattern4(client, _m(acc, "1w_sma")),
ratio1ySd: createRatio1ySdPattern(client, _m(acc, "1y")),
ratio2ySd: createRatio1ySdPattern(client, _m(acc, "2y")),
ratio4ySd: createRatio1ySdPattern(client, _m(acc, "4y")),
ratioPct1: createMetricPattern4(client, _m(acc, "pct1")),
ratioPct1Usd: createMetricPattern4(client, _m(acc, "pct1_usd")),
ratioPct2: createMetricPattern4(client, _m(acc, "pct2")),
ratioPct2Usd: createMetricPattern4(client, _m(acc, "pct2_usd")),
ratioPct5: createMetricPattern4(client, _m(acc, "pct5")),
ratioPct5Usd: createMetricPattern4(client, _m(acc, "pct5_usd")),
ratioPct95: createMetricPattern4(client, _m(acc, "pct95")),
ratioPct95Usd: createMetricPattern4(client, _m(acc, "pct95_usd")),
ratioPct98: createMetricPattern4(client, _m(acc, "pct98")),
ratioPct98Usd: createMetricPattern4(client, _m(acc, "pct98_usd")),
ratioPct99: createMetricPattern4(client, _m(acc, "pct99")),
ratioPct99Usd: createMetricPattern4(client, _m(acc, "pct99_usd")),
ratioSd: createRatio1ySdPattern(client, acc),
};
}
/**
* @typedef {Object} PercentilesPattern
* @property {MetricPattern4<Dollars>} pct05
@@ -3008,6 +2955,59 @@ function createPercentilesPattern(client, acc) {
};
}
/**
* @typedef {Object} ActivePriceRatioPattern
* @property {MetricPattern4<StoredF32>} ratio
* @property {MetricPattern4<StoredF32>} ratio1mSma
* @property {MetricPattern4<StoredF32>} ratio1wSma
* @property {Ratio1ySdPattern} ratio1ySd
* @property {Ratio1ySdPattern} ratio2ySd
* @property {Ratio1ySdPattern} ratio4ySd
* @property {MetricPattern4<StoredF32>} ratioPct1
* @property {MetricPattern4<Dollars>} ratioPct1Usd
* @property {MetricPattern4<StoredF32>} ratioPct2
* @property {MetricPattern4<Dollars>} ratioPct2Usd
* @property {MetricPattern4<StoredF32>} ratioPct5
* @property {MetricPattern4<Dollars>} ratioPct5Usd
* @property {MetricPattern4<StoredF32>} ratioPct95
* @property {MetricPattern4<Dollars>} ratioPct95Usd
* @property {MetricPattern4<StoredF32>} ratioPct98
* @property {MetricPattern4<Dollars>} ratioPct98Usd
* @property {MetricPattern4<StoredF32>} ratioPct99
* @property {MetricPattern4<Dollars>} ratioPct99Usd
* @property {Ratio1ySdPattern} ratioSd
*/
/**
* Create a ActivePriceRatioPattern pattern node
* @param {BrkClientBase} client
* @param {string} acc - Accumulated metric name
* @returns {ActivePriceRatioPattern}
*/
function createActivePriceRatioPattern(client, acc) {
return {
ratio: createMetricPattern4(client, acc),
ratio1mSma: createMetricPattern4(client, _m(acc, "1m_sma")),
ratio1wSma: createMetricPattern4(client, _m(acc, "1w_sma")),
ratio1ySd: createRatio1ySdPattern(client, _m(acc, "1y")),
ratio2ySd: createRatio1ySdPattern(client, _m(acc, "2y")),
ratio4ySd: createRatio1ySdPattern(client, _m(acc, "4y")),
ratioPct1: createMetricPattern4(client, _m(acc, "pct1")),
ratioPct1Usd: createMetricPattern4(client, _m(acc, "pct1_usd")),
ratioPct2: createMetricPattern4(client, _m(acc, "pct2")),
ratioPct2Usd: createMetricPattern4(client, _m(acc, "pct2_usd")),
ratioPct5: createMetricPattern4(client, _m(acc, "pct5")),
ratioPct5Usd: createMetricPattern4(client, _m(acc, "pct5_usd")),
ratioPct95: createMetricPattern4(client, _m(acc, "pct95")),
ratioPct95Usd: createMetricPattern4(client, _m(acc, "pct95_usd")),
ratioPct98: createMetricPattern4(client, _m(acc, "pct98")),
ratioPct98Usd: createMetricPattern4(client, _m(acc, "pct98_usd")),
ratioPct99: createMetricPattern4(client, _m(acc, "pct99")),
ratioPct99Usd: createMetricPattern4(client, _m(acc, "pct99_usd")),
ratioSd: createRatio1ySdPattern(client, acc),
};
}
/**
* @typedef {Object} RelativePattern5
* @property {MetricPattern1<StoredF32>} negUnrealizedLossRelToMarketCap
@@ -3391,6 +3391,68 @@ function createDollarsPattern(client, acc) {
};
}
/**
* @typedef {Object} RelativePattern
* @property {MetricPattern1<StoredF32>} negUnrealizedLossRelToMarketCap
* @property {MetricPattern1<StoredF32>} netUnrealizedPnlRelToMarketCap
* @property {MetricPattern1<StoredF32>} nupl
* @property {MetricPattern1<StoredF64>} supplyInLossRelToCirculatingSupply
* @property {MetricPattern1<StoredF64>} supplyInLossRelToOwnSupply
* @property {MetricPattern1<StoredF64>} supplyInProfitRelToCirculatingSupply
* @property {MetricPattern1<StoredF64>} supplyInProfitRelToOwnSupply
* @property {MetricPattern4<StoredF64>} supplyRelToCirculatingSupply
* @property {MetricPattern1<StoredF32>} unrealizedLossRelToMarketCap
* @property {MetricPattern1<StoredF32>} unrealizedProfitRelToMarketCap
*/
/**
* Create a RelativePattern pattern node
* @param {BrkClientBase} client
* @param {string} acc - Accumulated metric name
* @returns {RelativePattern}
*/
function createRelativePattern(client, acc) {
return {
negUnrealizedLossRelToMarketCap: createMetricPattern1(
client,
_m(acc, "neg_unrealized_loss_rel_to_market_cap"),
),
netUnrealizedPnlRelToMarketCap: createMetricPattern1(
client,
_m(acc, "net_unrealized_pnl_rel_to_market_cap"),
),
nupl: createMetricPattern1(client, _m(acc, "nupl")),
supplyInLossRelToCirculatingSupply: createMetricPattern1(
client,
_m(acc, "supply_in_loss_rel_to_circulating_supply"),
),
supplyInLossRelToOwnSupply: createMetricPattern1(
client,
_m(acc, "supply_in_loss_rel_to_own_supply"),
),
supplyInProfitRelToCirculatingSupply: createMetricPattern1(
client,
_m(acc, "supply_in_profit_rel_to_circulating_supply"),
),
supplyInProfitRelToOwnSupply: createMetricPattern1(
client,
_m(acc, "supply_in_profit_rel_to_own_supply"),
),
supplyRelToCirculatingSupply: createMetricPattern4(
client,
_m(acc, "supply_rel_to_circulating_supply"),
),
unrealizedLossRelToMarketCap: createMetricPattern1(
client,
_m(acc, "unrealized_loss_rel_to_market_cap"),
),
unrealizedProfitRelToMarketCap: createMetricPattern1(
client,
_m(acc, "unrealized_profit_rel_to_market_cap"),
),
};
}
/**
* @typedef {Object} RelativePattern2
* @property {MetricPattern1<StoredF32>} negUnrealizedLossRelToOwnMarketCap
@@ -3456,68 +3518,6 @@ function createRelativePattern2(client, acc) {
};
}
/**
* @typedef {Object} RelativePattern
* @property {MetricPattern1<StoredF32>} negUnrealizedLossRelToMarketCap
* @property {MetricPattern1<StoredF32>} netUnrealizedPnlRelToMarketCap
* @property {MetricPattern1<StoredF32>} nupl
* @property {MetricPattern1<StoredF64>} supplyInLossRelToCirculatingSupply
* @property {MetricPattern1<StoredF64>} supplyInLossRelToOwnSupply
* @property {MetricPattern1<StoredF64>} supplyInProfitRelToCirculatingSupply
* @property {MetricPattern1<StoredF64>} supplyInProfitRelToOwnSupply
* @property {MetricPattern4<StoredF64>} supplyRelToCirculatingSupply
* @property {MetricPattern1<StoredF32>} unrealizedLossRelToMarketCap
* @property {MetricPattern1<StoredF32>} unrealizedProfitRelToMarketCap
*/
/**
* Create a RelativePattern pattern node
* @param {BrkClientBase} client
* @param {string} acc - Accumulated metric name
* @returns {RelativePattern}
*/
function createRelativePattern(client, acc) {
return {
negUnrealizedLossRelToMarketCap: createMetricPattern1(
client,
_m(acc, "neg_unrealized_loss_rel_to_market_cap"),
),
netUnrealizedPnlRelToMarketCap: createMetricPattern1(
client,
_m(acc, "net_unrealized_pnl_rel_to_market_cap"),
),
nupl: createMetricPattern1(client, _m(acc, "nupl")),
supplyInLossRelToCirculatingSupply: createMetricPattern1(
client,
_m(acc, "supply_in_loss_rel_to_circulating_supply"),
),
supplyInLossRelToOwnSupply: createMetricPattern1(
client,
_m(acc, "supply_in_loss_rel_to_own_supply"),
),
supplyInProfitRelToCirculatingSupply: createMetricPattern1(
client,
_m(acc, "supply_in_profit_rel_to_circulating_supply"),
),
supplyInProfitRelToOwnSupply: createMetricPattern1(
client,
_m(acc, "supply_in_profit_rel_to_own_supply"),
),
supplyRelToCirculatingSupply: createMetricPattern4(
client,
_m(acc, "supply_rel_to_circulating_supply"),
),
unrealizedLossRelToMarketCap: createMetricPattern1(
client,
_m(acc, "unrealized_loss_rel_to_market_cap"),
),
unrealizedProfitRelToMarketCap: createMetricPattern1(
client,
_m(acc, "unrealized_profit_rel_to_market_cap"),
),
};
}
/**
* @template T
* @typedef {Object} CountPattern2
@@ -3690,28 +3690,57 @@ function create_0satsPattern(client, acc) {
}
/**
* @typedef {Object} _10yPattern
* @typedef {Object} PeriodCagrPattern
* @property {MetricPattern4<StoredF32>} _10y
* @property {MetricPattern4<StoredF32>} _2y
* @property {MetricPattern4<StoredF32>} _3y
* @property {MetricPattern4<StoredF32>} _4y
* @property {MetricPattern4<StoredF32>} _5y
* @property {MetricPattern4<StoredF32>} _6y
* @property {MetricPattern4<StoredF32>} _8y
*/
/**
* Create a PeriodCagrPattern pattern node
* @param {BrkClientBase} client
* @param {string} acc - Accumulated metric name
* @returns {PeriodCagrPattern}
*/
function createPeriodCagrPattern(client, acc) {
return {
_10y: createMetricPattern4(client, _p("10y", acc)),
_2y: createMetricPattern4(client, _p("2y", acc)),
_3y: createMetricPattern4(client, _p("3y", acc)),
_4y: createMetricPattern4(client, _p("4y", acc)),
_5y: createMetricPattern4(client, _p("5y", acc)),
_6y: createMetricPattern4(client, _p("6y", acc)),
_8y: createMetricPattern4(client, _p("8y", acc)),
};
}
/**
* @typedef {Object} _100btcPattern
* @property {ActivityPattern2} activity
* @property {CostBasisPattern} costBasis
* @property {OutputsPattern} outputs
* @property {RealizedPattern4} realized
* @property {RealizedPattern} realized
* @property {RelativePattern} relative
* @property {SupplyPattern2} supply
* @property {UnrealizedPattern} unrealized
*/
/**
* Create a _10yPattern pattern node
* Create a _100btcPattern pattern node
* @param {BrkClientBase} client
* @param {string} acc - Accumulated metric name
* @returns {_10yPattern}
* @returns {_100btcPattern}
*/
function create_10yPattern(client, acc) {
function create_100btcPattern(client, acc) {
return {
activity: createActivityPattern2(client, acc),
costBasis: createCostBasisPattern(client, acc),
outputs: createOutputsPattern(client, _m(acc, "utxo_count")),
realized: createRealizedPattern4(client, acc),
realized: createRealizedPattern(client, acc),
relative: createRelativePattern(client, acc),
supply: createSupplyPattern2(client, _m(acc, "supply")),
unrealized: createUnrealizedPattern(client, acc),
@@ -3747,35 +3776,6 @@ function create_0satsPattern2(client, acc) {
};
}
/**
* @typedef {Object} _100btcPattern
* @property {ActivityPattern2} activity
* @property {CostBasisPattern} costBasis
* @property {OutputsPattern} outputs
* @property {RealizedPattern} realized
* @property {RelativePattern} relative
* @property {SupplyPattern2} supply
* @property {UnrealizedPattern} unrealized
*/
/**
* Create a _100btcPattern pattern node
* @param {BrkClientBase} client
* @param {string} acc - Accumulated metric name
* @returns {_100btcPattern}
*/
function create_100btcPattern(client, acc) {
return {
activity: createActivityPattern2(client, acc),
costBasis: createCostBasisPattern(client, acc),
outputs: createOutputsPattern(client, _m(acc, "utxo_count")),
realized: createRealizedPattern(client, acc),
relative: createRelativePattern(client, acc),
supply: createSupplyPattern2(client, _m(acc, "supply")),
unrealized: createUnrealizedPattern(client, acc),
};
}
/**
* @typedef {Object} UnrealizedPattern
* @property {MetricPattern1<Dollars>} negUnrealizedLoss
@@ -3850,31 +3850,31 @@ function create_10yTo12yPattern(client, acc) {
}
/**
* @typedef {Object} PeriodCagrPattern
* @property {MetricPattern4<StoredF32>} _10y
* @property {MetricPattern4<StoredF32>} _2y
* @property {MetricPattern4<StoredF32>} _3y
* @property {MetricPattern4<StoredF32>} _4y
* @property {MetricPattern4<StoredF32>} _5y
* @property {MetricPattern4<StoredF32>} _6y
* @property {MetricPattern4<StoredF32>} _8y
* @typedef {Object} _10yPattern
* @property {ActivityPattern2} activity
* @property {CostBasisPattern} costBasis
* @property {OutputsPattern} outputs
* @property {RealizedPattern4} realized
* @property {RelativePattern} relative
* @property {SupplyPattern2} supply
* @property {UnrealizedPattern} unrealized
*/
/**
* Create a PeriodCagrPattern pattern node
* Create a _10yPattern pattern node
* @param {BrkClientBase} client
* @param {string} acc - Accumulated metric name
* @returns {PeriodCagrPattern}
* @returns {_10yPattern}
*/
function createPeriodCagrPattern(client, acc) {
function create_10yPattern(client, acc) {
return {
_10y: createMetricPattern4(client, _p("10y", acc)),
_2y: createMetricPattern4(client, _p("2y", acc)),
_3y: createMetricPattern4(client, _p("3y", acc)),
_4y: createMetricPattern4(client, _p("4y", acc)),
_5y: createMetricPattern4(client, _p("5y", acc)),
_6y: createMetricPattern4(client, _p("6y", acc)),
_8y: createMetricPattern4(client, _p("8y", acc)),
activity: createActivityPattern2(client, acc),
costBasis: createCostBasisPattern(client, acc),
outputs: createOutputsPattern(client, _m(acc, "utxo_count")),
realized: createRealizedPattern4(client, acc),
relative: createRelativePattern(client, acc),
supply: createSupplyPattern2(client, _m(acc, "supply")),
unrealized: createUnrealizedPattern(client, acc),
};
}
@@ -3940,27 +3940,6 @@ function createSplitPattern2(client, acc) {
};
}
/**
* @typedef {Object} CostBasisPattern2
* @property {MetricPattern1<Dollars>} max
* @property {MetricPattern1<Dollars>} min
* @property {PercentilesPattern} percentiles
*/
/**
* Create a CostBasisPattern2 pattern node
* @param {BrkClientBase} client
* @param {string} acc - Accumulated metric name
* @returns {CostBasisPattern2}
*/
function createCostBasisPattern2(client, acc) {
return {
max: createMetricPattern1(client, _m(acc, "max_cost_basis")),
min: createMetricPattern1(client, _m(acc, "min_cost_basis")),
percentiles: createPercentilesPattern(client, _m(acc, "cost_basis")),
};
}
/**
* @typedef {Object} UnclaimedRewardsPattern
* @property {BitcoinPattern2<Bitcoin>} bitcoin
@@ -4003,27 +3982,6 @@ function create_2015Pattern(client, acc) {
};
}
/**
* @typedef {Object} ActiveSupplyPattern
* @property {MetricPattern1<Bitcoin>} bitcoin
* @property {MetricPattern1<Dollars>} dollars
* @property {MetricPattern1<Sats>} sats
*/
/**
* Create a ActiveSupplyPattern pattern node
* @param {BrkClientBase} client
* @param {string} acc - Accumulated metric name
* @returns {ActiveSupplyPattern}
*/
function createActiveSupplyPattern(client, acc) {
return {
bitcoin: createMetricPattern1(client, _m(acc, "btc")),
dollars: createMetricPattern1(client, _m(acc, "usd")),
sats: createMetricPattern1(client, acc),
};
}
/**
* @typedef {Object} CoinbasePattern
* @property {BitcoinPattern} bitcoin
@@ -4045,6 +4003,27 @@ function createCoinbasePattern(client, acc) {
};
}
/**
* @typedef {Object} CostBasisPattern2
* @property {MetricPattern1<Dollars>} max
* @property {MetricPattern1<Dollars>} min
* @property {PercentilesPattern} percentiles
*/
/**
* Create a CostBasisPattern2 pattern node
* @param {BrkClientBase} client
* @param {string} acc - Accumulated metric name
* @returns {CostBasisPattern2}
*/
function createCostBasisPattern2(client, acc) {
return {
max: createMetricPattern1(client, _m(acc, "max_cost_basis")),
min: createMetricPattern1(client, _m(acc, "min_cost_basis")),
percentiles: createPercentilesPattern(client, _m(acc, "cost_basis")),
};
}
/**
* @typedef {Object} SegwitAdoptionPattern
* @property {MetricPattern11<StoredF32>} base
@@ -4066,6 +4045,27 @@ function createSegwitAdoptionPattern(client, acc) {
};
}
/**
* @typedef {Object} ActiveSupplyPattern
* @property {MetricPattern1<Bitcoin>} bitcoin
* @property {MetricPattern1<Dollars>} dollars
* @property {MetricPattern1<Sats>} sats
*/
/**
* Create a ActiveSupplyPattern pattern node
* @param {BrkClientBase} client
* @param {string} acc - Accumulated metric name
* @returns {ActiveSupplyPattern}
*/
function createActiveSupplyPattern(client, acc) {
return {
bitcoin: createMetricPattern1(client, _m(acc, "btc")),
dollars: createMetricPattern1(client, _m(acc, "usd")),
sats: createMetricPattern1(client, acc),
};
}
/**
* @typedef {Object} CoinbasePattern2
* @property {BlockCountPattern<Bitcoin>} bitcoin
@@ -4087,50 +4087,6 @@ function createCoinbasePattern2(client, acc) {
};
}
/**
* @typedef {Object} RelativePattern4
* @property {MetricPattern1<StoredF64>} supplyInLossRelToOwnSupply
* @property {MetricPattern1<StoredF64>} supplyInProfitRelToOwnSupply
*/
/**
* Create a RelativePattern4 pattern node
* @param {BrkClientBase} client
* @param {string} acc - Accumulated metric name
* @returns {RelativePattern4}
*/
function createRelativePattern4(client, acc) {
return {
supplyInLossRelToOwnSupply: createMetricPattern1(
client,
_m(acc, "loss_rel_to_own_supply"),
),
supplyInProfitRelToOwnSupply: createMetricPattern1(
client,
_m(acc, "profit_rel_to_own_supply"),
),
};
}
/**
* @typedef {Object} CostBasisPattern
* @property {MetricPattern1<Dollars>} max
* @property {MetricPattern1<Dollars>} min
*/
/**
* Create a CostBasisPattern pattern node
* @param {BrkClientBase} client
* @param {string} acc - Accumulated metric name
* @returns {CostBasisPattern}
*/
function createCostBasisPattern(client, acc) {
return {
max: createMetricPattern1(client, _m(acc, "max_cost_basis")),
min: createMetricPattern1(client, _m(acc, "min_cost_basis")),
};
}
/**
* @typedef {Object} _1dReturns1mSdPattern
* @property {MetricPattern4<StoredF32>} sd
@@ -4169,6 +4125,50 @@ function createSupplyPattern2(client, acc) {
};
}
/**
* @typedef {Object} CostBasisPattern
* @property {MetricPattern1<Dollars>} max
* @property {MetricPattern1<Dollars>} min
*/
/**
* Create a CostBasisPattern pattern node
* @param {BrkClientBase} client
* @param {string} acc - Accumulated metric name
* @returns {CostBasisPattern}
*/
function createCostBasisPattern(client, acc) {
return {
max: createMetricPattern1(client, _m(acc, "max_cost_basis")),
min: createMetricPattern1(client, _m(acc, "min_cost_basis")),
};
}
/**
* @typedef {Object} RelativePattern4
* @property {MetricPattern1<StoredF64>} supplyInLossRelToOwnSupply
* @property {MetricPattern1<StoredF64>} supplyInProfitRelToOwnSupply
*/
/**
* Create a RelativePattern4 pattern node
* @param {BrkClientBase} client
* @param {string} acc - Accumulated metric name
* @returns {RelativePattern4}
*/
function createRelativePattern4(client, acc) {
return {
supplyInLossRelToOwnSupply: createMetricPattern1(
client,
_m(acc, "loss_rel_to_own_supply"),
),
supplyInProfitRelToOwnSupply: createMetricPattern1(
client,
_m(acc, "profit_rel_to_own_supply"),
),
};
}
/**
* @template T
* @typedef {Object} SatsPattern
@@ -4185,29 +4185,8 @@ function createSupplyPattern2(client, acc) {
*/
function createSatsPattern(client, acc) {
return {
ohlc: createMetricPattern1(client, _m(acc, "ohlc")),
split: createSplitPattern2(client, acc),
};
}
/**
* @template T
* @typedef {Object} BitcoinPattern2
* @property {MetricPattern2<T>} cumulative
* @property {MetricPattern1<T>} sum
*/
/**
* Create a BitcoinPattern2 pattern node
* @template T
* @param {BrkClientBase} client
* @param {string} acc - Accumulated metric name
* @returns {BitcoinPattern2<T>}
*/
function createBitcoinPattern2(client, acc) {
return {
cumulative: createMetricPattern2(client, _m(acc, "cumulative")),
sum: createMetricPattern1(client, acc),
ohlc: createMetricPattern1(client, _m(acc, "ohlc_sats")),
split: createSplitPattern2(client, _m(acc, "sats")),
};
}
@@ -4232,6 +4211,27 @@ function createBlockCountPattern(client, acc) {
};
}
/**
* @template T
* @typedef {Object} BitcoinPattern2
* @property {MetricPattern2<T>} cumulative
* @property {MetricPattern1<T>} sum
*/
/**
* Create a BitcoinPattern2 pattern node
* @template T
* @param {BrkClientBase} client
* @param {string} acc - Accumulated metric name
* @returns {BitcoinPattern2<T>}
*/
function createBitcoinPattern2(client, acc) {
return {
cumulative: createMetricPattern2(client, _m(acc, "cumulative")),
sum: createMetricPattern1(client, acc),
};
}
/**
* @typedef {Object} OutputsPattern
* @property {MetricPattern1<StoredU64>} utxoCount
@@ -5407,8 +5407,8 @@ function createRealizedPriceExtraPattern(client, acc) {
/**
* @typedef {Object} MetricsTree_Price_Oracle
* @property {MetricPattern6<OHLCCents>} ohlc
* @property {MetricPattern11<Cents>} price
* @property {MetricPattern6<OHLCCents>} ohlcCents
* @property {MetricPattern11<Cents>} priceCents
* @property {MetricPattern6<StoredU32>} txCount
*/
@@ -7616,9 +7616,9 @@ class BrkClient extends BrkClientBase {
},
},
oracle: {
ohlc: createMetricPattern6(this, "oracle_dateindex_to_ohlc"),
price: createMetricPattern11(this, "oracle_height_to_price"),
txCount: createMetricPattern6(this, "oracle_dateindex_to_tx_count"),
ohlcCents: createMetricPattern6(this, "oracle_ohlc_cents"),
priceCents: createMetricPattern11(this, "orange_price_cents"),
txCount: createMetricPattern6(this, "oracle_tx_count"),
},
sats: createSatsPattern(this, "price"),
usd: createSatsPattern(this, "price"),
@@ -7724,28 +7724,8 @@ class BrkClient extends BrkClientBase {
isExplicitlyRbf: createMetricPattern27(this, "is_explicitly_rbf"),
rawlocktime: createMetricPattern27(this, "rawlocktime"),
size: {
vsize: {
average: createMetricPattern1(this, "tx_vsize_average"),
max: createMetricPattern1(this, "tx_vsize_max"),
median: createMetricPattern11(this, "tx_vsize_median"),
min: createMetricPattern1(this, "tx_vsize_min"),
pct10: createMetricPattern11(this, "tx_vsize_pct10"),
pct25: createMetricPattern11(this, "tx_vsize_pct25"),
pct75: createMetricPattern11(this, "tx_vsize_pct75"),
pct90: createMetricPattern11(this, "tx_vsize_pct90"),
txindex: createMetricPattern27(this, "vsize"),
},
weight: {
average: createMetricPattern1(this, "tx_weight_average"),
max: createMetricPattern1(this, "tx_weight_max"),
median: createMetricPattern11(this, "tx_weight_median"),
min: createMetricPattern1(this, "tx_weight_min"),
pct10: createMetricPattern11(this, "tx_weight_pct10"),
pct25: createMetricPattern11(this, "tx_weight_pct25"),
pct75: createMetricPattern11(this, "tx_weight_pct75"),
pct90: createMetricPattern11(this, "tx_weight_pct90"),
txindex: createMetricPattern27(this, "weight"),
},
vsize: createFeeRatePattern(this, "tx_vsize"),
weight: createFeeRatePattern(this, "tx_weight"),
},
totalSize: createMetricPattern27(this, "total_size"),
txid: createMetricPattern27(this, "txid"),

File diff suppressed because it is too large Load Diff