diff --git a/crates/brk_client/src/lib.rs b/crates/brk_client/src/lib.rs index 7147059c0..c5346129e 100644 --- a/crates/brk_client/src/lib.rs +++ b/crates/brk_client/src/lib.rs @@ -1127,108 +1127,6 @@ impl _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern { } } -/// Pattern struct for repeated tree structure. -pub struct InvestedNegNetNuplSupplyUnrealizedPattern3 { - pub invested_capital_in_loss_rel_to_realized_cap: BpsPercentRatioPattern, - pub invested_capital_in_profit_rel_to_realized_cap: BpsPercentRatioPattern, - pub neg_unrealized_loss_rel_to_market_cap: BpsPercentRatioPattern, - pub neg_unrealized_loss_rel_to_own_gross_pnl: BpsPercentRatioPattern, - pub neg_unrealized_loss_rel_to_own_market_cap: BpsPercentRatioPattern, - pub net_unrealized_pnl_rel_to_market_cap: BpsPercentRatioPattern, - pub net_unrealized_pnl_rel_to_own_gross_pnl: BpsPercentRatioPattern, - pub net_unrealized_pnl_rel_to_own_market_cap: BpsPercentRatioPattern, - pub nupl: MetricPattern1, - pub supply_in_loss_rel_to_circulating_supply: BpsPercentRatioPattern, - pub supply_in_loss_rel_to_own_supply: BpsPercentRatioPattern, - pub supply_in_profit_rel_to_circulating_supply: BpsPercentRatioPattern, - pub supply_in_profit_rel_to_own_supply: BpsPercentRatioPattern, - pub supply_rel_to_circulating_supply: BpsPercentRatioPattern, - pub unrealized_loss_rel_to_market_cap: BpsPercentRatioPattern, - pub unrealized_loss_rel_to_own_gross_pnl: BpsPercentRatioPattern, - pub unrealized_loss_rel_to_own_market_cap: BpsPercentRatioPattern, - pub unrealized_profit_rel_to_market_cap: BpsPercentRatioPattern, - pub unrealized_profit_rel_to_own_gross_pnl: BpsPercentRatioPattern, - pub unrealized_profit_rel_to_own_market_cap: BpsPercentRatioPattern, -} - -impl InvestedNegNetNuplSupplyUnrealizedPattern3 { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - invested_capital_in_loss_rel_to_realized_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "invested_capital_in_loss_rel_to_realized_cap")), - invested_capital_in_profit_rel_to_realized_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "invested_capital_in_profit_rel_to_realized_cap")), - neg_unrealized_loss_rel_to_market_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "neg_unrealized_loss_rel_to_market_cap")), - neg_unrealized_loss_rel_to_own_gross_pnl: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "neg_unrealized_loss_rel_to_own_gross_pnl")), - neg_unrealized_loss_rel_to_own_market_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "neg_unrealized_loss_rel_to_own_market_cap")), - net_unrealized_pnl_rel_to_market_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "net_unrealized_pnl_rel_to_market_cap")), - net_unrealized_pnl_rel_to_own_gross_pnl: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "net_unrealized_pnl_rel_to_own_gross_pnl")), - net_unrealized_pnl_rel_to_own_market_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "net_unrealized_pnl_rel_to_own_market_cap")), - nupl: MetricPattern1::new(client.clone(), _m(&acc, "nupl")), - supply_in_loss_rel_to_circulating_supply: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "supply_in_loss_rel_to_circulating_supply")), - supply_in_loss_rel_to_own_supply: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "supply_in_loss_rel_to_own_supply")), - supply_in_profit_rel_to_circulating_supply: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "supply_in_profit_rel_to_circulating_supply")), - supply_in_profit_rel_to_own_supply: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "supply_in_profit_rel_to_own_supply")), - supply_rel_to_circulating_supply: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "supply_rel_to_circulating_supply")), - unrealized_loss_rel_to_market_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "unrealized_loss_rel_to_market_cap")), - unrealized_loss_rel_to_own_gross_pnl: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "unrealized_loss_rel_to_own_gross_pnl")), - unrealized_loss_rel_to_own_market_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "unrealized_loss_rel_to_own_market_cap")), - unrealized_profit_rel_to_market_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "unrealized_profit_rel_to_market_cap")), - unrealized_profit_rel_to_own_gross_pnl: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "unrealized_profit_rel_to_own_gross_pnl")), - unrealized_profit_rel_to_own_market_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "unrealized_profit_rel_to_own_market_cap")), - } - } -} - -/// Pattern struct for repeated tree structure. -pub struct GrossMvrvNegNetRealizedSentSoprValuePattern { - pub gross_pnl: CentsUsdPattern, - pub mvrv: MetricPattern1, - pub neg_realized_loss: MetricPattern1, - pub net_realized_pnl: CumulativeHeightPattern, - pub realized_cap: MetricPattern1, - pub realized_cap_cents: MetricPattern1, - pub realized_cap_change_1m: MetricPattern1, - pub realized_loss: CumulativeHeightPattern, - pub realized_price: CentsSatsUsdPattern, - pub realized_price_ratio: BpsRatioPattern, - pub realized_price_ratio_percentiles: RatioPattern, - pub realized_profit: CumulativeHeightPattern, - pub sent_in_loss: BaseCumulativePattern, - pub sent_in_profit: BaseCumulativePattern, - pub sopr: _1m1w1y24hPattern, - pub value_created: MetricPattern1, - pub value_created_sum: _1m1w1y24hPattern, - pub value_destroyed: MetricPattern1, - pub value_destroyed_sum: _1m1w1y24hPattern, -} - -impl GrossMvrvNegNetRealizedSentSoprValuePattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - gross_pnl: CentsUsdPattern::new(client.clone(), _m(&acc, "realized_gross_pnl")), - mvrv: MetricPattern1::new(client.clone(), _m(&acc, "mvrv")), - neg_realized_loss: MetricPattern1::new(client.clone(), _m(&acc, "neg_realized_loss")), - net_realized_pnl: CumulativeHeightPattern::new(client.clone(), _m(&acc, "net_realized_pnl")), - realized_cap: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap")), - realized_cap_cents: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap_cents")), - realized_cap_change_1m: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap_change_1m")), - realized_loss: CumulativeHeightPattern::new(client.clone(), _m(&acc, "realized_loss")), - realized_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "realized_price")), - realized_price_ratio: BpsRatioPattern::new(client.clone(), _m(&acc, "realized_price_ratio")), - realized_price_ratio_percentiles: RatioPattern::new(client.clone(), _m(&acc, "realized_price_ratio")), - realized_profit: CumulativeHeightPattern::new(client.clone(), _m(&acc, "realized_profit")), - sent_in_loss: BaseCumulativePattern::new(client.clone(), _m(&acc, "sent_in_loss")), - sent_in_profit: BaseCumulativePattern::new(client.clone(), _m(&acc, "sent_in_profit")), - sopr: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "sopr")), - value_created: MetricPattern1::new(client.clone(), _m(&acc, "value_created")), - value_created_sum: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "value_created")), - value_destroyed: MetricPattern1::new(client.clone(), _m(&acc, "value_destroyed")), - value_destroyed_sum: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "value_destroyed")), - } - } -} - /// Pattern struct for repeated tree structure. pub struct Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern { pub pct05: CentsSatsUsdPattern, @@ -1279,6 +1177,98 @@ impl Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75 } } +/// Pattern struct for repeated tree structure. +pub struct InvestedNetNuplSupplyUnrealizedPattern3 { + pub invested_capital_in_loss_rel_to_realized_cap: BpsPercentRatioPattern, + pub invested_capital_in_profit_rel_to_realized_cap: BpsPercentRatioPattern, + pub net_unrealized_pnl_rel_to_market_cap: BpsPercentRatioPattern, + pub net_unrealized_pnl_rel_to_own_gross_pnl: BpsPercentRatioPattern, + pub net_unrealized_pnl_rel_to_own_market_cap: BpsPercentRatioPattern, + pub nupl: MetricPattern1, + pub supply_in_loss_rel_to_circulating_supply: BpsPercentRatioPattern, + pub supply_in_loss_rel_to_own_supply: BpsPercentRatioPattern, + pub supply_in_profit_rel_to_circulating_supply: BpsPercentRatioPattern, + pub supply_in_profit_rel_to_own_supply: BpsPercentRatioPattern, + pub supply_rel_to_circulating_supply: BpsPercentRatioPattern, + pub unrealized_loss_rel_to_market_cap: BpsPercentRatioPattern, + pub unrealized_loss_rel_to_own_gross_pnl: BpsPercentRatioPattern, + pub unrealized_loss_rel_to_own_market_cap: BpsPercentRatioPattern, + pub unrealized_profit_rel_to_market_cap: BpsPercentRatioPattern, + pub unrealized_profit_rel_to_own_gross_pnl: BpsPercentRatioPattern, + pub unrealized_profit_rel_to_own_market_cap: BpsPercentRatioPattern, +} + +impl InvestedNetNuplSupplyUnrealizedPattern3 { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + invested_capital_in_loss_rel_to_realized_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "invested_capital_in_loss_rel_to_realized_cap")), + invested_capital_in_profit_rel_to_realized_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "invested_capital_in_profit_rel_to_realized_cap")), + net_unrealized_pnl_rel_to_market_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "net_unrealized_pnl_rel_to_market_cap")), + net_unrealized_pnl_rel_to_own_gross_pnl: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "net_unrealized_pnl_rel_to_own_gross_pnl")), + net_unrealized_pnl_rel_to_own_market_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "net_unrealized_pnl_rel_to_own_market_cap")), + nupl: MetricPattern1::new(client.clone(), _m(&acc, "nupl")), + supply_in_loss_rel_to_circulating_supply: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "supply_in_loss_rel_to_circulating_supply")), + supply_in_loss_rel_to_own_supply: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "supply_in_loss_rel_to_own_supply")), + supply_in_profit_rel_to_circulating_supply: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "supply_in_profit_rel_to_circulating_supply")), + supply_in_profit_rel_to_own_supply: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "supply_in_profit_rel_to_own_supply")), + supply_rel_to_circulating_supply: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "supply_rel_to_circulating_supply")), + unrealized_loss_rel_to_market_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "unrealized_loss_rel_to_market_cap")), + unrealized_loss_rel_to_own_gross_pnl: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "unrealized_loss_rel_to_own_gross_pnl")), + unrealized_loss_rel_to_own_market_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "unrealized_loss_rel_to_own_market_cap")), + unrealized_profit_rel_to_market_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "unrealized_profit_rel_to_market_cap")), + unrealized_profit_rel_to_own_gross_pnl: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "unrealized_profit_rel_to_own_gross_pnl")), + unrealized_profit_rel_to_own_market_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "unrealized_profit_rel_to_own_market_cap")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct MvrvNegNetRealizedSentSoprValuePattern { + pub mvrv: MetricPattern1, + pub neg_realized_loss: MetricPattern1, + pub net_realized_pnl: CumulativeHeightPattern, + pub realized_cap: MetricPattern1, + pub realized_cap_cents: MetricPattern1, + pub realized_cap_change_1m: MetricPattern1, + pub realized_loss: CumulativeHeightPattern, + pub realized_price: CentsSatsUsdPattern, + pub realized_price_ratio: BpsRatioPattern, + pub realized_profit: CumulativeHeightPattern, + pub sent_in_loss: BaseCumulativePattern, + pub sent_in_profit: BaseCumulativePattern, + pub sopr: _1m1w1y24hPattern, + pub value_created: MetricPattern1, + pub value_created_sum: _1m1w1y24hPattern, + pub value_destroyed: MetricPattern1, + pub value_destroyed_sum: _1m1w1y24hPattern, +} + +impl MvrvNegNetRealizedSentSoprValuePattern { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + mvrv: MetricPattern1::new(client.clone(), _m(&acc, "mvrv")), + neg_realized_loss: MetricPattern1::new(client.clone(), _m(&acc, "neg_realized_loss")), + net_realized_pnl: CumulativeHeightPattern::new(client.clone(), _m(&acc, "net_realized_pnl")), + realized_cap: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap")), + realized_cap_cents: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap_cents")), + realized_cap_change_1m: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap_change_1m")), + realized_loss: CumulativeHeightPattern::new(client.clone(), _m(&acc, "realized_loss")), + realized_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "realized_price")), + realized_price_ratio: BpsRatioPattern::new(client.clone(), _m(&acc, "realized_price_ratio")), + realized_profit: CumulativeHeightPattern::new(client.clone(), _m(&acc, "realized_profit")), + sent_in_loss: BaseCumulativePattern::new(client.clone(), _m(&acc, "sent_in_loss")), + sent_in_profit: BaseCumulativePattern::new(client.clone(), _m(&acc, "sent_in_profit")), + sopr: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "sopr")), + value_created: MetricPattern1::new(client.clone(), _m(&acc, "value_created")), + value_created_sum: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "value_created")), + value_destroyed: MetricPattern1::new(client.clone(), _m(&acc, "value_destroyed")), + value_destroyed_sum: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "value_destroyed")), + } + } +} + /// Pattern struct for repeated tree structure. pub struct BpsRatioPattern2 { pub bps: MetricPattern1, @@ -1479,42 +1469,6 @@ impl _10y1m1w1y2y3m3y4y5y6m6y8yPattern3 { } } -/// Pattern struct for repeated tree structure. -pub struct InvestedNegNetNuplSupplyUnrealizedPattern { - pub invested_capital_in_loss_rel_to_realized_cap: BpsPercentRatioPattern, - pub invested_capital_in_profit_rel_to_realized_cap: BpsPercentRatioPattern, - pub neg_unrealized_loss_rel_to_market_cap: BpsPercentRatioPattern, - pub net_unrealized_pnl_rel_to_market_cap: BpsPercentRatioPattern, - pub nupl: MetricPattern1, - pub supply_in_loss_rel_to_circulating_supply: BpsPercentRatioPattern, - pub supply_in_loss_rel_to_own_supply: BpsPercentRatioPattern, - pub supply_in_profit_rel_to_circulating_supply: BpsPercentRatioPattern, - pub supply_in_profit_rel_to_own_supply: BpsPercentRatioPattern, - pub supply_rel_to_circulating_supply: BpsPercentRatioPattern, - pub unrealized_loss_rel_to_market_cap: BpsPercentRatioPattern, - pub unrealized_profit_rel_to_market_cap: BpsPercentRatioPattern, -} - -impl InvestedNegNetNuplSupplyUnrealizedPattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - invested_capital_in_loss_rel_to_realized_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "invested_capital_in_loss_rel_to_realized_cap")), - invested_capital_in_profit_rel_to_realized_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "invested_capital_in_profit_rel_to_realized_cap")), - neg_unrealized_loss_rel_to_market_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "neg_unrealized_loss_rel_to_market_cap")), - net_unrealized_pnl_rel_to_market_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "net_unrealized_pnl_rel_to_market_cap")), - nupl: MetricPattern1::new(client.clone(), _m(&acc, "nupl")), - supply_in_loss_rel_to_circulating_supply: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "supply_in_loss_rel_to_circulating_supply")), - supply_in_loss_rel_to_own_supply: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "supply_in_loss_rel_to_own_supply")), - supply_in_profit_rel_to_circulating_supply: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "supply_in_profit_rel_to_circulating_supply")), - supply_in_profit_rel_to_own_supply: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "supply_in_profit_rel_to_own_supply")), - supply_rel_to_circulating_supply: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "supply_rel_to_circulating_supply")), - unrealized_loss_rel_to_market_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "unrealized_loss_rel_to_market_cap")), - unrealized_profit_rel_to_market_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "unrealized_profit_rel_to_market_cap")), - } - } -} - /// Pattern struct for repeated tree structure. pub struct _1m1w1y24hBaseBpsCumulativeHeightPercentRatioSumPattern { pub _1m: BpsPercentRatioPattern, @@ -1617,6 +1571,40 @@ impl AverageCumulativeHeightMaxMedianMinPct10Pct25Pct75Pct90SumPattern { } } +/// Pattern struct for repeated tree structure. +pub struct InvestedNetNuplSupplyUnrealizedPattern { + pub invested_capital_in_loss_rel_to_realized_cap: BpsPercentRatioPattern, + pub invested_capital_in_profit_rel_to_realized_cap: BpsPercentRatioPattern, + pub net_unrealized_pnl_rel_to_market_cap: BpsPercentRatioPattern, + pub nupl: MetricPattern1, + pub supply_in_loss_rel_to_circulating_supply: BpsPercentRatioPattern, + pub supply_in_loss_rel_to_own_supply: BpsPercentRatioPattern, + pub supply_in_profit_rel_to_circulating_supply: BpsPercentRatioPattern, + pub supply_in_profit_rel_to_own_supply: BpsPercentRatioPattern, + pub supply_rel_to_circulating_supply: BpsPercentRatioPattern, + pub unrealized_loss_rel_to_market_cap: BpsPercentRatioPattern, + pub unrealized_profit_rel_to_market_cap: BpsPercentRatioPattern, +} + +impl InvestedNetNuplSupplyUnrealizedPattern { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + invested_capital_in_loss_rel_to_realized_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "invested_capital_in_loss_rel_to_realized_cap")), + invested_capital_in_profit_rel_to_realized_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "invested_capital_in_profit_rel_to_realized_cap")), + net_unrealized_pnl_rel_to_market_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "net_unrealized_pnl_rel_to_market_cap")), + nupl: MetricPattern1::new(client.clone(), _m(&acc, "nupl")), + supply_in_loss_rel_to_circulating_supply: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "supply_in_loss_rel_to_circulating_supply")), + supply_in_loss_rel_to_own_supply: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "supply_in_loss_rel_to_own_supply")), + supply_in_profit_rel_to_circulating_supply: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "supply_in_profit_rel_to_circulating_supply")), + supply_in_profit_rel_to_own_supply: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "supply_in_profit_rel_to_own_supply")), + supply_rel_to_circulating_supply: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "supply_rel_to_circulating_supply")), + unrealized_loss_rel_to_market_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "unrealized_loss_rel_to_market_cap")), + unrealized_profit_rel_to_market_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "unrealized_profit_rel_to_market_cap")), + } + } +} + /// Pattern struct for repeated tree structure. pub struct AverageGainsLossesRsiStochPattern { pub average_gain: MetricPattern1, @@ -1709,6 +1697,36 @@ impl AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2 { } } +/// Pattern struct for repeated tree structure. +pub struct AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern { + pub average: _1m1w1y24hPattern, + pub height: MetricPattern18, + pub max: _1m1w1y24hPattern, + pub median: _1m1w1y24hPattern, + pub min: _1m1w1y24hPattern, + pub pct10: _1m1w1y24hPattern, + pub pct25: _1m1w1y24hPattern, + pub pct75: _1m1w1y24hPattern, + pub pct90: _1m1w1y24hPattern, +} + +impl AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + average: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "average")), + height: MetricPattern18::new(client.clone(), acc.clone()), + max: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "max")), + median: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "median")), + min: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "min")), + pct10: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "p10")), + pct25: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "p25")), + pct75: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "p75")), + pct90: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "p90")), + } + } +} + /// Pattern struct for repeated tree structure. pub struct AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern { pub average: _1m1w1y24hPattern, @@ -1739,36 +1757,6 @@ impl AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern { } } -/// Pattern struct for repeated tree structure. -pub struct AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern { - pub average: _1m1w1y24hPattern, - pub height: MetricPattern18, - pub max: _1m1w1y24hPattern, - pub median: _1m1w1y24hPattern, - pub min: _1m1w1y24hPattern, - pub pct10: _1m1w1y24hPattern, - pub pct25: _1m1w1y24hPattern, - pub pct75: _1m1w1y24hPattern, - pub pct90: _1m1w1y24hPattern, -} - -impl AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - average: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "average")), - height: MetricPattern18::new(client.clone(), acc.clone()), - max: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "max")), - median: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "median")), - min: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "min")), - pct10: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "p10")), - pct25: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "p25")), - pct75: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "p75")), - pct90: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "p90")), - } - } -} - /// Pattern struct for repeated tree structure. pub struct _1m1w1y24hBtcCentsSatsUsdPattern { pub _1m: BtcCentsSatsUsdPattern, @@ -1884,8 +1872,8 @@ pub struct ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern { pub activity: CoinblocksCoindaysSentPattern, pub cost_basis: MaxMinPattern, pub outputs: UtxoPattern, - pub realized: GrossMvrvNegNetRealizedSentSoprValuePattern, - pub relative: InvestedNegNetNuplSupplyUnrealizedPattern, + pub realized: MvrvNegNetRealizedSentSoprValuePattern, + pub relative: InvestedNetNuplSupplyUnrealizedPattern, pub supply: ChangeHalvedTotalPattern, pub unrealized: GreedGrossInvestedInvestorNegNetPainSupplyUnrealizedPattern, } @@ -1897,40 +1885,14 @@ impl ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern { activity: CoinblocksCoindaysSentPattern::new(client.clone(), acc.clone()), cost_basis: MaxMinPattern::new(client.clone(), _m(&acc, "cost_basis")), outputs: UtxoPattern::new(client.clone(), _m(&acc, "utxo_count")), - realized: GrossMvrvNegNetRealizedSentSoprValuePattern::new(client.clone(), acc.clone()), - relative: InvestedNegNetNuplSupplyUnrealizedPattern::new(client.clone(), acc.clone()), + realized: MvrvNegNetRealizedSentSoprValuePattern::new(client.clone(), acc.clone()), + relative: InvestedNetNuplSupplyUnrealizedPattern::new(client.clone(), acc.clone()), supply: ChangeHalvedTotalPattern::new(client.clone(), _m(&acc, "supply")), unrealized: GreedGrossInvestedInvestorNegNetPainSupplyUnrealizedPattern::new(client.clone(), acc.clone()), } } } -/// Pattern struct for repeated tree structure. -pub struct GrossNegNetSupplyUnrealizedPattern { - pub gross_pnl: CentsUsdPattern, - pub neg_unrealized_loss: MetricPattern1, - pub net_unrealized_pnl: CentsUsdPattern, - pub supply_in_loss: BtcCentsSatsUsdPattern, - pub supply_in_profit: BtcCentsSatsUsdPattern, - pub unrealized_loss: CentsUsdPattern, - pub unrealized_profit: CentsUsdPattern, -} - -impl GrossNegNetSupplyUnrealizedPattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - gross_pnl: CentsUsdPattern::new(client.clone(), _m(&acc, "unrealized_gross_pnl")), - neg_unrealized_loss: MetricPattern1::new(client.clone(), _m(&acc, "neg_unrealized_loss")), - net_unrealized_pnl: CentsUsdPattern::new(client.clone(), _m(&acc, "net_unrealized_pnl")), - supply_in_loss: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "supply_in_loss")), - supply_in_profit: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "supply_in_profit")), - unrealized_loss: CentsUsdPattern::new(client.clone(), _m(&acc, "unrealized_loss")), - unrealized_profit: CentsUsdPattern::new(client.clone(), _m(&acc, "unrealized_profit")), - } - } -} - /// Pattern struct for repeated tree structure. pub struct MvrvRealizedPattern { pub mvrv: MetricPattern1, @@ -1957,38 +1919,14 @@ impl MvrvRealizedPattern { } } -/// Pattern struct for repeated tree structure. -pub struct _1m1w1y24hBaseCumulativePattern { - pub _1m: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2, - pub _1w: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2, - pub _1y: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2, - pub _24h: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2, - pub base: BtcCentsSatsUsdPattern, - pub cumulative: BtcCentsSatsUsdPattern, -} - -impl _1m1w1y24hBaseCumulativePattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - _1m: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), _m(&acc, "1m")), - _1w: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), _m(&acc, "1w")), - _1y: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), _m(&acc, "1y")), - _24h: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), _m(&acc, "24h")), - base: BtcCentsSatsUsdPattern::new(client.clone(), acc.clone()), - cumulative: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "cumulative")), - } - } -} - /// Pattern struct for repeated tree structure. pub struct ActivityOutputsRealizedRelativeSupplyUnrealizedPattern2 { pub activity: SentPattern, pub outputs: UtxoPattern, - pub realized: GrossMvrvNegNetRealizedSentSoprValuePattern, + pub realized: MvrvNegNetRealizedSentSoprValuePattern, pub relative: SupplyPattern3, pub supply: ChangeHalvedTotalPattern, - pub unrealized: GrossNegNetSupplyUnrealizedPattern, + pub unrealized: NegNetSupplyUnrealizedPattern, } impl ActivityOutputsRealizedRelativeSupplyUnrealizedPattern2 { @@ -1997,10 +1935,10 @@ impl ActivityOutputsRealizedRelativeSupplyUnrealizedPattern2 { Self { activity: SentPattern::new(client.clone(), _m(&acc, "sent")), outputs: UtxoPattern::new(client.clone(), _m(&acc, "utxo_count")), - realized: GrossMvrvNegNetRealizedSentSoprValuePattern::new(client.clone(), acc.clone()), + realized: MvrvNegNetRealizedSentSoprValuePattern::new(client.clone(), acc.clone()), relative: SupplyPattern3::new(client.clone(), _m(&acc, "supply")), supply: ChangeHalvedTotalPattern::new(client.clone(), _m(&acc, "supply")), - unrealized: GrossNegNetSupplyUnrealizedPattern::new(client.clone(), acc.clone()), + unrealized: NegNetSupplyUnrealizedPattern::new(client.clone(), acc.clone()), } } } @@ -2030,25 +1968,25 @@ impl ActivityOutputsRealizedRelativeSupplyUnrealizedPattern { } /// Pattern struct for repeated tree structure. -pub struct BalanceBothReactivatedReceivingSendingPattern { - pub balance_decreased: AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern, - pub balance_increased: AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern, - pub both: AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern, - pub reactivated: AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern, - pub receiving: AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern, - pub sending: AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern, +pub struct NegNetSupplyUnrealizedPattern { + pub neg_unrealized_loss: MetricPattern1, + pub net_unrealized_pnl: CentsUsdPattern, + pub supply_in_loss: BtcCentsSatsUsdPattern, + pub supply_in_profit: BtcCentsSatsUsdPattern, + pub unrealized_loss: CentsUsdPattern, + pub unrealized_profit: CentsUsdPattern, } -impl BalanceBothReactivatedReceivingSendingPattern { +impl NegNetSupplyUnrealizedPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - balance_decreased: AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern::new(client.clone(), _m(&acc, "balance_decreased")), - balance_increased: AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern::new(client.clone(), _m(&acc, "balance_increased")), - both: AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern::new(client.clone(), _m(&acc, "both")), - reactivated: AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern::new(client.clone(), _m(&acc, "reactivated")), - receiving: AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern::new(client.clone(), _m(&acc, "receiving")), - sending: AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern::new(client.clone(), _m(&acc, "sending")), + neg_unrealized_loss: MetricPattern1::new(client.clone(), _m(&acc, "neg_unrealized_loss")), + net_unrealized_pnl: CentsUsdPattern::new(client.clone(), _m(&acc, "net_unrealized_pnl")), + supply_in_loss: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "supply_in_loss")), + supply_in_profit: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "supply_in_profit")), + unrealized_loss: CentsUsdPattern::new(client.clone(), _m(&acc, "unrealized_loss")), + unrealized_profit: CentsUsdPattern::new(client.clone(), _m(&acc, "unrealized_profit")), } } } @@ -2119,6 +2057,28 @@ impl SupplyPattern3 { } } +/// Pattern struct for repeated tree structure. +pub struct _1m1w1y24hHeightPattern { + pub _1m: MetricPattern1, + pub _1w: MetricPattern1, + pub _1y: MetricPattern1, + pub _24h: MetricPattern1, + pub height: MetricPattern18, +} + +impl _1m1w1y24hHeightPattern { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + _1m: MetricPattern1::new(client.clone(), _m(&acc, "average_1m")), + _1w: MetricPattern1::new(client.clone(), _m(&acc, "average_1w")), + _1y: MetricPattern1::new(client.clone(), _m(&acc, "average_1y")), + _24h: MetricPattern1::new(client.clone(), _m(&acc, "average_24h")), + height: MetricPattern18::new(client.clone(), acc.clone()), + } + } +} + /// Pattern struct for repeated tree structure. pub struct _1m1w1y24hPattern6 { pub _1m: BaseBtcCentsSatsUsdPattern, @@ -2179,6 +2139,26 @@ impl _1m1w1y24hPattern5 { } } +/// Pattern struct for repeated tree structure. +pub struct BothReactivatedReceivingSendingPattern { + pub both: _1m1w1y24hHeightPattern, + pub reactivated: _1m1w1y24hHeightPattern, + pub receiving: _1m1w1y24hHeightPattern, + pub sending: _1m1w1y24hHeightPattern, +} + +impl BothReactivatedReceivingSendingPattern { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + both: _1m1w1y24hHeightPattern::new(client.clone(), _m(&acc, "both")), + reactivated: _1m1w1y24hHeightPattern::new(client.clone(), _m(&acc, "reactivated")), + receiving: _1m1w1y24hHeightPattern::new(client.clone(), _m(&acc, "receiving")), + sending: _1m1w1y24hHeightPattern::new(client.clone(), _m(&acc, "sending")), + } + } +} + /// Pattern struct for repeated tree structure. pub struct BtcCentsSatsUsdPattern { pub btc: MetricPattern1, @@ -2298,13 +2278,13 @@ impl BaseCumulativeSumPattern { } /// Pattern struct for repeated tree structure. -pub struct BpsPercentRatioPattern2 { - pub bps: AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern, +pub struct BpsPercentRatioPattern3 { + pub bps: AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern, pub percent: MetricPattern1, pub ratio: MetricPattern1, } -impl BpsPercentRatioPattern2 { +impl BpsPercentRatioPattern3 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -2732,11 +2712,11 @@ pub struct MetricsTree_Blocks { pub total_size: MetricPattern18, pub weight: MetricsTree_Blocks_Weight, pub count: MetricsTree_Blocks_Count, - pub interval: AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern, + pub interval: _1m1w1y24hHeightPattern, pub halving: MetricsTree_Blocks_Halving, pub vbytes: AverageCumulativeHeightMaxMedianMinPct10Pct25Pct75Pct90SumPattern, pub size: MetricsTree_Blocks_Size, - pub fullness: BpsPercentRatioPattern2, + pub fullness: MetricsTree_Blocks_Fullness, } impl MetricsTree_Blocks { @@ -2748,11 +2728,11 @@ impl MetricsTree_Blocks { total_size: MetricPattern18::new(client.clone(), "total_size".to_string()), weight: MetricsTree_Blocks_Weight::new(client.clone(), format!("{base_path}_weight")), count: MetricsTree_Blocks_Count::new(client.clone(), format!("{base_path}_count")), - interval: AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern::new(client.clone(), "block_interval".to_string()), + interval: _1m1w1y24hHeightPattern::new(client.clone(), "block_interval".to_string()), halving: MetricsTree_Blocks_Halving::new(client.clone(), format!("{base_path}_halving")), vbytes: AverageCumulativeHeightMaxMedianMinPct10Pct25Pct75Pct90SumPattern::new(client.clone(), "block_vbytes".to_string()), size: MetricsTree_Blocks_Size::new(client.clone(), format!("{base_path}_size")), - fullness: BpsPercentRatioPattern2::new(client.clone(), "block_fullness".to_string()), + fullness: MetricsTree_Blocks_Fullness::new(client.clone(), format!("{base_path}_fullness")), } } } @@ -2981,6 +2961,23 @@ impl MetricsTree_Blocks_Size { } } +/// Metrics tree node. +pub struct MetricsTree_Blocks_Fullness { + pub bps: _1m1w1y24hHeightPattern, + pub ratio: MetricPattern1, + pub percent: MetricPattern1, +} + +impl MetricsTree_Blocks_Fullness { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + bps: _1m1w1y24hHeightPattern::new(client.clone(), "block_fullness_bps".to_string()), + ratio: MetricPattern1::new(client.clone(), "block_fullness_ratio".to_string()), + percent: MetricPattern1::new(client.clone(), "block_fullness".to_string()), + } + } +} + /// Metrics tree node. pub struct MetricsTree_Transactions { pub first_txindex: MetricPattern18, @@ -3319,13 +3316,13 @@ impl MetricsTree_Scripts_Count { /// Metrics tree node. pub struct MetricsTree_Scripts_Value { - pub opreturn: _1m1w1y24hBaseCumulativePattern, + pub opreturn: BaseCumulativePattern, } impl MetricsTree_Scripts_Value { pub fn new(client: Arc, base_path: String) -> Self { Self { - opreturn: _1m1w1y24hBaseCumulativePattern::new(client.clone(), "opreturn_value".to_string()), + opreturn: BaseCumulativePattern::new(client.clone(), "opreturn_value".to_string()), } } } @@ -3362,9 +3359,9 @@ impl MetricsTree_Mining { /// Metrics tree node. pub struct MetricsTree_Mining_Rewards { - pub coinbase: _1m1w1y24hBaseCumulativePattern, - pub subsidy: _1m1w1y24hBaseCumulativePattern, - pub fees: _1m1w1y24hBaseCumulativePattern, + pub coinbase: BaseCumulativeSumPattern, + pub subsidy: BaseCumulativePattern, + pub fees: MetricsTree_Mining_Rewards_Fees, pub unclaimed_rewards: BaseCumulativeSumPattern, pub fee_dominance: BpsPercentRatioPattern, pub fee_dominance_rolling: _1m1w1y24hPattern2, @@ -3376,9 +3373,9 @@ pub struct MetricsTree_Mining_Rewards { impl MetricsTree_Mining_Rewards { pub fn new(client: Arc, base_path: String) -> Self { Self { - coinbase: _1m1w1y24hBaseCumulativePattern::new(client.clone(), "coinbase".to_string()), - subsidy: _1m1w1y24hBaseCumulativePattern::new(client.clone(), "subsidy".to_string()), - fees: _1m1w1y24hBaseCumulativePattern::new(client.clone(), "fees".to_string()), + coinbase: BaseCumulativeSumPattern::new(client.clone(), "coinbase".to_string()), + subsidy: BaseCumulativePattern::new(client.clone(), "subsidy".to_string()), + fees: MetricsTree_Mining_Rewards_Fees::new(client.clone(), format!("{base_path}_fees")), unclaimed_rewards: BaseCumulativeSumPattern::new(client.clone(), "unclaimed_rewards".to_string()), fee_dominance: BpsPercentRatioPattern::new(client.clone(), "fee_dominance".to_string()), fee_dominance_rolling: _1m1w1y24hPattern2::new(client.clone(), "fee_dominance".to_string()), @@ -3389,6 +3386,29 @@ impl MetricsTree_Mining_Rewards { } } +/// Metrics tree node. +pub struct MetricsTree_Mining_Rewards_Fees { + pub base: BtcCentsSatsUsdPattern, + pub cumulative: BtcCentsSatsUsdPattern, + pub _24h: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2, + pub _1w: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2, + pub _1m: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2, + pub _1y: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2, +} + +impl MetricsTree_Mining_Rewards_Fees { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + base: BtcCentsSatsUsdPattern::new(client.clone(), "fees".to_string()), + cumulative: BtcCentsSatsUsdPattern::new(client.clone(), "fees_cumulative".to_string()), + _24h: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), "fees_24h".to_string()), + _1w: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), "fees_1w".to_string()), + _1m: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), "fees_1m".to_string()), + _1y: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), "fees_1y".to_string()), + } + } +} + /// Metrics tree node. pub struct MetricsTree_Mining_Hashrate { pub hash_rate: MetricPattern1, @@ -5552,7 +5572,6 @@ pub struct MetricsTree_Distribution_UtxoCohorts_All_Relative { pub unrealized_profit_rel_to_market_cap: BpsPercentRatioPattern, pub unrealized_loss_rel_to_market_cap: BpsPercentRatioPattern, pub net_unrealized_pnl_rel_to_market_cap: BpsPercentRatioPattern, - pub neg_unrealized_loss_rel_to_market_cap: BpsPercentRatioPattern, pub nupl: MetricPattern1, pub invested_capital_in_profit_rel_to_realized_cap: BpsPercentRatioPattern, pub invested_capital_in_loss_rel_to_realized_cap: BpsPercentRatioPattern, @@ -5560,7 +5579,6 @@ pub struct MetricsTree_Distribution_UtxoCohorts_All_Relative { pub supply_in_loss_rel_to_own_supply: BpsPercentRatioPattern, pub unrealized_profit_rel_to_own_gross_pnl: BpsPercentRatioPattern, pub unrealized_loss_rel_to_own_gross_pnl: BpsPercentRatioPattern, - pub neg_unrealized_loss_rel_to_own_gross_pnl: BpsPercentRatioPattern, pub net_unrealized_pnl_rel_to_own_gross_pnl: BpsPercentRatioPattern, } @@ -5570,7 +5588,6 @@ impl MetricsTree_Distribution_UtxoCohorts_All_Relative { unrealized_profit_rel_to_market_cap: BpsPercentRatioPattern::new(client.clone(), "unrealized_profit_rel_to_market_cap".to_string()), unrealized_loss_rel_to_market_cap: BpsPercentRatioPattern::new(client.clone(), "unrealized_loss_rel_to_market_cap".to_string()), net_unrealized_pnl_rel_to_market_cap: BpsPercentRatioPattern::new(client.clone(), "net_unrealized_pnl_rel_to_market_cap".to_string()), - neg_unrealized_loss_rel_to_market_cap: BpsPercentRatioPattern::new(client.clone(), "neg_unrealized_loss_rel_to_market_cap".to_string()), nupl: MetricPattern1::new(client.clone(), "nupl".to_string()), invested_capital_in_profit_rel_to_realized_cap: BpsPercentRatioPattern::new(client.clone(), "invested_capital_in_profit_rel_to_realized_cap".to_string()), invested_capital_in_loss_rel_to_realized_cap: BpsPercentRatioPattern::new(client.clone(), "invested_capital_in_loss_rel_to_realized_cap".to_string()), @@ -5578,7 +5595,6 @@ impl MetricsTree_Distribution_UtxoCohorts_All_Relative { supply_in_loss_rel_to_own_supply: BpsPercentRatioPattern::new(client.clone(), "supply_in_loss_rel_to_own_supply".to_string()), unrealized_profit_rel_to_own_gross_pnl: BpsPercentRatioPattern::new(client.clone(), "unrealized_profit_rel_to_own_gross_pnl".to_string()), unrealized_loss_rel_to_own_gross_pnl: BpsPercentRatioPattern::new(client.clone(), "unrealized_loss_rel_to_own_gross_pnl".to_string()), - neg_unrealized_loss_rel_to_own_gross_pnl: BpsPercentRatioPattern::new(client.clone(), "neg_unrealized_loss_rel_to_own_gross_pnl".to_string()), net_unrealized_pnl_rel_to_own_gross_pnl: BpsPercentRatioPattern::new(client.clone(), "net_unrealized_pnl_rel_to_own_gross_pnl".to_string()), } } @@ -5592,7 +5608,7 @@ pub struct MetricsTree_Distribution_UtxoCohorts_Sth { pub realized: CapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprUpperValuePattern, pub cost_basis: InvestedMaxMinPercentilesPattern, pub unrealized: GreedGrossInvestedInvestorNegNetPainSupplyUnrealizedPattern, - pub relative: InvestedNegNetNuplSupplyUnrealizedPattern3, + pub relative: InvestedNetNuplSupplyUnrealizedPattern3, pub dormancy: MetricPattern1, pub velocity: MetricPattern1, pub adjusted_value_created: MetricPattern1, @@ -5612,7 +5628,7 @@ impl MetricsTree_Distribution_UtxoCohorts_Sth { realized: CapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprUpperValuePattern::new(client.clone(), "sth".to_string()), cost_basis: InvestedMaxMinPercentilesPattern::new(client.clone(), "sth".to_string()), unrealized: GreedGrossInvestedInvestorNegNetPainSupplyUnrealizedPattern::new(client.clone(), "sth".to_string()), - relative: InvestedNegNetNuplSupplyUnrealizedPattern3::new(client.clone(), "sth".to_string()), + relative: InvestedNetNuplSupplyUnrealizedPattern3::new(client.clone(), "sth".to_string()), dormancy: MetricPattern1::new(client.clone(), "sth_dormancy".to_string()), velocity: MetricPattern1::new(client.clone(), "sth_velocity".to_string()), adjusted_value_created: MetricPattern1::new(client.clone(), "sth_adjusted_value_created".to_string()), @@ -5633,7 +5649,7 @@ pub struct MetricsTree_Distribution_UtxoCohorts_Lth { pub realized: CapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprUpperValuePattern, pub cost_basis: InvestedMaxMinPercentilesPattern, pub unrealized: GreedGrossInvestedInvestorNegNetPainSupplyUnrealizedPattern, - pub relative: InvestedNegNetNuplSupplyUnrealizedPattern3, + pub relative: InvestedNetNuplSupplyUnrealizedPattern3, pub dormancy: MetricPattern1, pub velocity: MetricPattern1, } @@ -5647,7 +5663,7 @@ impl MetricsTree_Distribution_UtxoCohorts_Lth { realized: CapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprUpperValuePattern::new(client.clone(), "lth".to_string()), cost_basis: InvestedMaxMinPercentilesPattern::new(client.clone(), "lth".to_string()), unrealized: GreedGrossInvestedInvestorNegNetPainSupplyUnrealizedPattern::new(client.clone(), "lth".to_string()), - relative: InvestedNegNetNuplSupplyUnrealizedPattern3::new(client.clone(), "lth".to_string()), + relative: InvestedNetNuplSupplyUnrealizedPattern3::new(client.clone(), "lth".to_string()), dormancy: MetricPattern1::new(client.clone(), "lth_dormancy".to_string()), velocity: MetricPattern1::new(client.clone(), "lth_velocity".to_string()), } @@ -6151,29 +6167,29 @@ impl MetricsTree_Distribution_AddressCohorts_LtAmount { /// Metrics tree node. pub struct MetricsTree_Distribution_AddressActivity { - pub all: BalanceBothReactivatedReceivingSendingPattern, - pub p2pk65: BalanceBothReactivatedReceivingSendingPattern, - pub p2pk33: BalanceBothReactivatedReceivingSendingPattern, - pub p2pkh: BalanceBothReactivatedReceivingSendingPattern, - pub p2sh: BalanceBothReactivatedReceivingSendingPattern, - pub p2wpkh: BalanceBothReactivatedReceivingSendingPattern, - pub p2wsh: BalanceBothReactivatedReceivingSendingPattern, - pub p2tr: BalanceBothReactivatedReceivingSendingPattern, - pub p2a: BalanceBothReactivatedReceivingSendingPattern, + pub all: BothReactivatedReceivingSendingPattern, + pub p2pk65: BothReactivatedReceivingSendingPattern, + pub p2pk33: BothReactivatedReceivingSendingPattern, + pub p2pkh: BothReactivatedReceivingSendingPattern, + pub p2sh: BothReactivatedReceivingSendingPattern, + pub p2wpkh: BothReactivatedReceivingSendingPattern, + pub p2wsh: BothReactivatedReceivingSendingPattern, + pub p2tr: BothReactivatedReceivingSendingPattern, + pub p2a: BothReactivatedReceivingSendingPattern, } impl MetricsTree_Distribution_AddressActivity { pub fn new(client: Arc, base_path: String) -> Self { Self { - all: BalanceBothReactivatedReceivingSendingPattern::new(client.clone(), "address_activity".to_string()), - p2pk65: BalanceBothReactivatedReceivingSendingPattern::new(client.clone(), "p2pk65_address_activity".to_string()), - p2pk33: BalanceBothReactivatedReceivingSendingPattern::new(client.clone(), "p2pk33_address_activity".to_string()), - p2pkh: BalanceBothReactivatedReceivingSendingPattern::new(client.clone(), "p2pkh_address_activity".to_string()), - p2sh: BalanceBothReactivatedReceivingSendingPattern::new(client.clone(), "p2sh_address_activity".to_string()), - p2wpkh: BalanceBothReactivatedReceivingSendingPattern::new(client.clone(), "p2wpkh_address_activity".to_string()), - p2wsh: BalanceBothReactivatedReceivingSendingPattern::new(client.clone(), "p2wsh_address_activity".to_string()), - p2tr: BalanceBothReactivatedReceivingSendingPattern::new(client.clone(), "p2tr_address_activity".to_string()), - p2a: BalanceBothReactivatedReceivingSendingPattern::new(client.clone(), "p2a_address_activity".to_string()), + all: BothReactivatedReceivingSendingPattern::new(client.clone(), "address_activity".to_string()), + p2pk65: BothReactivatedReceivingSendingPattern::new(client.clone(), "p2pk65_address_activity".to_string()), + p2pk33: BothReactivatedReceivingSendingPattern::new(client.clone(), "p2pk33_address_activity".to_string()), + p2pkh: BothReactivatedReceivingSendingPattern::new(client.clone(), "p2pkh_address_activity".to_string()), + p2sh: BothReactivatedReceivingSendingPattern::new(client.clone(), "p2sh_address_activity".to_string()), + p2wpkh: BothReactivatedReceivingSendingPattern::new(client.clone(), "p2wpkh_address_activity".to_string()), + p2wsh: BothReactivatedReceivingSendingPattern::new(client.clone(), "p2wsh_address_activity".to_string()), + p2tr: BothReactivatedReceivingSendingPattern::new(client.clone(), "p2tr_address_activity".to_string()), + p2a: BothReactivatedReceivingSendingPattern::new(client.clone(), "p2a_address_activity".to_string()), } } } @@ -6238,29 +6254,29 @@ impl MetricsTree_Distribution_NewAddrCount { /// Metrics tree node. pub struct MetricsTree_Distribution_GrowthRate { - pub all: BpsPercentRatioPattern2, - pub p2pk65: BpsPercentRatioPattern2, - pub p2pk33: BpsPercentRatioPattern2, - pub p2pkh: BpsPercentRatioPattern2, - pub p2sh: BpsPercentRatioPattern2, - pub p2wpkh: BpsPercentRatioPattern2, - pub p2wsh: BpsPercentRatioPattern2, - pub p2tr: BpsPercentRatioPattern2, - pub p2a: BpsPercentRatioPattern2, + pub all: BpsPercentRatioPattern3, + pub p2pk65: BpsPercentRatioPattern3, + pub p2pk33: BpsPercentRatioPattern3, + pub p2pkh: BpsPercentRatioPattern3, + pub p2sh: BpsPercentRatioPattern3, + pub p2wpkh: BpsPercentRatioPattern3, + pub p2wsh: BpsPercentRatioPattern3, + pub p2tr: BpsPercentRatioPattern3, + pub p2a: BpsPercentRatioPattern3, } impl MetricsTree_Distribution_GrowthRate { pub fn new(client: Arc, base_path: String) -> Self { Self { - all: BpsPercentRatioPattern2::new(client.clone(), "growth_rate".to_string()), - p2pk65: BpsPercentRatioPattern2::new(client.clone(), "p2pk65_growth_rate".to_string()), - p2pk33: BpsPercentRatioPattern2::new(client.clone(), "p2pk33_growth_rate".to_string()), - p2pkh: BpsPercentRatioPattern2::new(client.clone(), "p2pkh_growth_rate".to_string()), - p2sh: BpsPercentRatioPattern2::new(client.clone(), "p2sh_growth_rate".to_string()), - p2wpkh: BpsPercentRatioPattern2::new(client.clone(), "p2wpkh_growth_rate".to_string()), - p2wsh: BpsPercentRatioPattern2::new(client.clone(), "p2wsh_growth_rate".to_string()), - p2tr: BpsPercentRatioPattern2::new(client.clone(), "p2tr_growth_rate".to_string()), - p2a: BpsPercentRatioPattern2::new(client.clone(), "p2a_growth_rate".to_string()), + all: BpsPercentRatioPattern3::new(client.clone(), "growth_rate".to_string()), + p2pk65: BpsPercentRatioPattern3::new(client.clone(), "p2pk65_growth_rate".to_string()), + p2pk33: BpsPercentRatioPattern3::new(client.clone(), "p2pk33_growth_rate".to_string()), + p2pkh: BpsPercentRatioPattern3::new(client.clone(), "p2pkh_growth_rate".to_string()), + p2sh: BpsPercentRatioPattern3::new(client.clone(), "p2sh_growth_rate".to_string()), + p2wpkh: BpsPercentRatioPattern3::new(client.clone(), "p2wpkh_growth_rate".to_string()), + p2wsh: BpsPercentRatioPattern3::new(client.clone(), "p2wsh_growth_rate".to_string()), + p2tr: BpsPercentRatioPattern3::new(client.clone(), "p2tr_growth_rate".to_string()), + p2a: BpsPercentRatioPattern3::new(client.clone(), "p2a_growth_rate".to_string()), } } } diff --git a/crates/brk_computer/src/blocks/interval/import.rs b/crates/brk_computer/src/blocks/interval/import.rs index 88c00eddf..6247e46ae 100644 --- a/crates/brk_computer/src/blocks/interval/import.rs +++ b/crates/brk_computer/src/blocks/interval/import.rs @@ -3,7 +3,7 @@ use brk_types::Version; use vecdb::Database; use super::Vecs; -use crate::{indexes, internal::ComputedFromHeightDistribution}; +use crate::{indexes, internal::ComputedFromHeightRollingAverage}; impl Vecs { pub(crate) fn forced_import( @@ -11,8 +11,12 @@ impl Vecs { version: Version, indexes: &indexes::Vecs, ) -> Result { - let interval = - ComputedFromHeightDistribution::forced_import(db, "block_interval", version, indexes)?; + let interval = ComputedFromHeightRollingAverage::forced_import( + db, + "block_interval", + version, + indexes, + )?; Ok(Self(interval)) } diff --git a/crates/brk_computer/src/blocks/interval/vecs.rs b/crates/brk_computer/src/blocks/interval/vecs.rs index eb9cecabb..24f39759f 100644 --- a/crates/brk_computer/src/blocks/interval/vecs.rs +++ b/crates/brk_computer/src/blocks/interval/vecs.rs @@ -4,9 +4,9 @@ use brk_traversable::Traversable; use brk_types::Timestamp; use vecdb::{Rw, StorageMode}; -use crate::internal::ComputedFromHeightDistribution; +use crate::internal::ComputedFromHeightRollingAverage; #[derive(Deref, DerefMut, Traversable)] pub struct Vecs( - #[traversable(flatten)] pub ComputedFromHeightDistribution, + #[traversable(flatten)] pub ComputedFromHeightRollingAverage, ); diff --git a/crates/brk_computer/src/blocks/weight/import.rs b/crates/brk_computer/src/blocks/weight/import.rs index 455ced995..2ff9549f2 100644 --- a/crates/brk_computer/src/blocks/weight/import.rs +++ b/crates/brk_computer/src/blocks/weight/import.rs @@ -5,7 +5,7 @@ use vecdb::Database; use super::Vecs; use crate::{ indexes, - internal::{ComputedHeightDerivedFull, PercentFromHeightDistribution}, + internal::{ComputedHeightDerivedFull, PercentFromHeightRollingAverage}, }; impl Vecs { @@ -17,8 +17,12 @@ impl Vecs { let weight = ComputedHeightDerivedFull::forced_import(db, "block_weight", version, indexes)?; - let fullness = - PercentFromHeightDistribution::forced_import(db, "block_fullness", version, indexes)?; + let fullness = PercentFromHeightRollingAverage::forced_import( + db, + "block_fullness", + version, + indexes, + )?; Ok(Self { weight, fullness }) } diff --git a/crates/brk_computer/src/blocks/weight/vecs.rs b/crates/brk_computer/src/blocks/weight/vecs.rs index 2bb8b09a8..b9c972944 100644 --- a/crates/brk_computer/src/blocks/weight/vecs.rs +++ b/crates/brk_computer/src/blocks/weight/vecs.rs @@ -2,10 +2,10 @@ use brk_traversable::Traversable; use brk_types::{BasisPoints16, Weight}; use vecdb::{Rw, StorageMode}; -use crate::internal::{ComputedHeightDerivedFull, PercentFromHeightDistribution}; +use crate::internal::{ComputedHeightDerivedFull, PercentFromHeightRollingAverage}; #[derive(Traversable)] pub struct Vecs { pub weight: ComputedHeightDerivedFull, - pub fullness: PercentFromHeightDistribution, + pub fullness: PercentFromHeightRollingAverage, } diff --git a/crates/brk_computer/src/distribution/address/activity.rs b/crates/brk_computer/src/distribution/address/activity.rs index c590e04de..d9a8bffb1 100644 --- a/crates/brk_computer/src/distribution/address/activity.rs +++ b/crates/brk_computer/src/distribution/address/activity.rs @@ -8,11 +8,6 @@ //! | `sending` | Unique addresses that sent this block | //! | `reactivated` | Addresses that were empty and now have funds | //! | `both` | Addresses that both sent AND received same block | -//! | `balance_increased` | Receive-only addresses (balance definitely increased) | -//! | `balance_decreased` | Send-only addresses (balance definitely decreased) | -//! -//! Note: `balance_increased` and `balance_decreased` exclude "both" addresses -//! since their net balance change requires more complex tracking. use brk_cohort::ByAddressType; use brk_error::Result; @@ -24,14 +19,10 @@ use vecdb::{AnyStoredVec, AnyVec, Database, Exit, Rw, StorageMode, WritableVec}; use crate::{ indexes, - internal::{ComputedFromHeightDistribution, WindowStarts}, + internal::{ComputedFromHeightRollingAverage, WindowStarts}, }; /// Per-block activity counts - reset each block. -/// -/// Note: `balance_increased` and `balance_decreased` are derived: -/// - `balance_increased = receiving - both` (receive-only addresses) -/// - `balance_decreased = sending - both` (send-only addresses) #[derive(Debug, Default, Clone)] pub struct BlockActivityCounts { pub reactivated: u32, @@ -74,12 +65,10 @@ impl AddressTypeToActivityCounts { /// Activity count vectors for a single category (e.g., one address type or "all"). #[derive(Traversable)] pub struct ActivityCountVecs { - pub reactivated: ComputedFromHeightDistribution, - pub sending: ComputedFromHeightDistribution, - pub receiving: ComputedFromHeightDistribution, - pub balance_increased: ComputedFromHeightDistribution, - pub balance_decreased: ComputedFromHeightDistribution, - pub both: ComputedFromHeightDistribution, + pub reactivated: ComputedFromHeightRollingAverage, + pub sending: ComputedFromHeightRollingAverage, + pub receiving: ComputedFromHeightRollingAverage, + pub both: ComputedFromHeightRollingAverage, } impl ActivityCountVecs { @@ -90,37 +79,25 @@ impl ActivityCountVecs { indexes: &indexes::Vecs, ) -> Result { Ok(Self { - reactivated: ComputedFromHeightDistribution::forced_import( + reactivated: ComputedFromHeightRollingAverage::forced_import( db, &format!("{name}_reactivated"), version, indexes, )?, - sending: ComputedFromHeightDistribution::forced_import( + sending: ComputedFromHeightRollingAverage::forced_import( db, &format!("{name}_sending"), version, indexes, )?, - receiving: ComputedFromHeightDistribution::forced_import( + receiving: ComputedFromHeightRollingAverage::forced_import( db, &format!("{name}_receiving"), version, indexes, )?, - balance_increased: ComputedFromHeightDistribution::forced_import( - db, - &format!("{name}_balance_increased"), - version, - indexes, - )?, - balance_decreased: ComputedFromHeightDistribution::forced_import( - db, - &format!("{name}_balance_decreased"), - version, - indexes, - )?, - both: ComputedFromHeightDistribution::forced_import( + both: ComputedFromHeightRollingAverage::forced_import( db, &format!("{name}_both"), version, @@ -135,8 +112,6 @@ impl ActivityCountVecs { .len() .min(self.sending.height.len()) .min(self.receiving.height.len()) - .min(self.balance_increased.height.len()) - .min(self.balance_decreased.height.len()) .min(self.both.height.len()) } @@ -147,8 +122,6 @@ impl ActivityCountVecs { &mut self.reactivated.height as &mut dyn AnyStoredVec, &mut self.sending.height as &mut dyn AnyStoredVec, &mut self.receiving.height as &mut dyn AnyStoredVec, - &mut self.balance_increased.height as &mut dyn AnyStoredVec, - &mut self.balance_decreased.height as &mut dyn AnyStoredVec, &mut self.both.height as &mut dyn AnyStoredVec, ] .into_par_iter() @@ -158,8 +131,6 @@ impl ActivityCountVecs { self.reactivated.height.reset()?; self.sending.height.reset()?; self.receiving.height.reset()?; - self.balance_increased.height.reset()?; - self.balance_decreased.height.reset()?; self.both.height.reset()?; Ok(()) } @@ -178,14 +149,6 @@ impl ActivityCountVecs { self.receiving .height .truncate_push(height, counts.receiving.into())?; - // Derived: balance_increased = receiving - both (receive-only addresses) - self.balance_increased - .height - .truncate_push(height, (counts.receiving - counts.both).into())?; - // Derived: balance_decreased = sending - both (send-only addresses) - self.balance_decreased - .height - .truncate_push(height, (counts.sending - counts.both).into())?; self.both.height.truncate_push(height, counts.both.into())?; Ok(()) } @@ -199,10 +162,6 @@ impl ActivityCountVecs { self.reactivated.compute_rest(max_from, windows, exit)?; self.sending.compute_rest(max_from, windows, exit)?; self.receiving.compute_rest(max_from, windows, exit)?; - self.balance_increased - .compute_rest(max_from, windows, exit)?; - self.balance_decreased - .compute_rest(max_from, windows, exit)?; self.both.compute_rest(max_from, windows, exit)?; Ok(()) } @@ -254,8 +213,6 @@ impl AddressTypeToActivityCountVecs { vecs.push(&mut type_vecs.reactivated.height); vecs.push(&mut type_vecs.sending.height); vecs.push(&mut type_vecs.receiving.height); - vecs.push(&mut type_vecs.balance_increased.height); - vecs.push(&mut type_vecs.balance_decreased.height); vecs.push(&mut type_vecs.both.height); } vecs.into_par_iter() diff --git a/crates/brk_computer/src/distribution/metrics/realized/base.rs b/crates/brk_computer/src/distribution/metrics/realized/base.rs index d6add4968..aeb11e931 100644 --- a/crates/brk_computer/src/distribution/metrics/realized/base.rs +++ b/crates/brk_computer/src/distribution/metrics/realized/base.rs @@ -11,7 +11,6 @@ use crate::{ distribution::state::RealizedOps, internal::{ ComputedFromHeight, ComputedFromHeightCumulative, - ComputedFromHeightRatioPercentiles, FiatFromHeight, LazyFromHeight, NegCentsUnsignedToDollars, RatioCents64, RollingWindows, ValueFromHeightCumulative, }, @@ -33,7 +32,6 @@ pub struct RealizedBase { pub neg_realized_loss: LazyFromHeight, pub net_realized_pnl: ComputedFromHeightCumulative, - pub gross_pnl: FiatFromHeight, pub value_created: ComputedFromHeight, pub value_destroyed: ComputedFromHeight, @@ -41,8 +39,6 @@ pub struct RealizedBase { pub value_destroyed_sum: RollingWindows, pub sopr: RollingWindows, - pub realized_price_ratio_percentiles: ComputedFromHeightRatioPercentiles, - pub sent_in_profit: ValueFromHeightCumulative, pub sent_in_loss: ValueFromHeightCumulative, } @@ -62,7 +58,6 @@ impl RealizedBase { ); let net_realized_pnl = cfg.import("net_realized_pnl", v0)?; - let gross_pnl = cfg.import("realized_gross_pnl", v0)?; let value_created = cfg.import("value_created", v0)?; let value_destroyed = cfg.import("value_destroyed", v0)?; @@ -70,26 +65,16 @@ impl RealizedBase { let value_destroyed_sum = cfg.import("value_destroyed", v1)?; let sopr = cfg.import("sopr", v1)?; - let realized_price_ratio_percentiles = - ComputedFromHeightRatioPercentiles::forced_import( - cfg.db, - &cfg.name("realized_price"), - cfg.version + v1, - cfg.indexes, - )?; - Ok(Self { minimal, realized_cap_change_1m: cfg.import("realized_cap_change_1m", v0)?, neg_realized_loss, net_realized_pnl, - gross_pnl, value_created, value_destroyed, value_created_sum, value_destroyed_sum, sopr, - realized_price_ratio_percentiles, sent_in_profit: cfg.import("sent_in_profit", v0)?, sent_in_loss: cfg.import("sent_in_loss", v0)?, }) @@ -176,13 +161,6 @@ impl RealizedBase { Ok(()) })?; - self.gross_pnl.cents.height.compute_add( - starting_indexes.height, - &self.minimal.realized_profit.height, - &self.minimal.realized_loss.height, - exit, - )?; - Ok(()) } @@ -234,15 +212,6 @@ impl RealizedBase { )?; } - // Realized price ratio percentiles - self.realized_price_ratio_percentiles.compute( - blocks, - starting_indexes, - exit, - &self.minimal.realized_price_ratio.ratio.height, - &self.minimal.realized_price.cents.height, - )?; - Ok(()) } } diff --git a/crates/brk_computer/src/distribution/metrics/realized/full.rs b/crates/brk_computer/src/distribution/metrics/realized/full.rs index 800658af8..67a132175 100644 --- a/crates/brk_computer/src/distribution/metrics/realized/full.rs +++ b/crates/brk_computer/src/distribution/metrics/realized/full.rs @@ -14,7 +14,7 @@ use crate::{ blocks, distribution::state::RealizedState, internal::{ - CentsUnsignedToDollars, ComputedFromHeight, ComputedFromHeightCumulative, + CentsUnsignedToDollars, ComputedFromHeight, ComputedFromHeightCumulative, FiatFromHeight, ComputedFromHeightRatio, ComputedFromHeightRatioPercentiles, ComputedFromHeightRatioStdDevBands, LazyFromHeight, PercentFromHeight, PercentRollingEmas1w1m, PercentRollingWindows, Price, RatioCents64, RatioCentsBp32, @@ -35,6 +35,8 @@ pub struct RealizedFull { #[traversable(flatten)] pub core: RealizedBase, + pub gross_pnl: FiatFromHeight, + pub realized_profit_rel_to_realized_cap: PercentFromHeight, pub realized_loss_rel_to_realized_cap: PercentFromHeight, pub net_realized_pnl_rel_to_realized_cap: PercentFromHeight, @@ -83,6 +85,7 @@ pub struct RealizedFull { pub sent_in_profit_ema: RollingEmas2w, pub sent_in_loss_ema: RollingEmas2w, + pub realized_price_ratio_percentiles: ComputedFromHeightRatioPercentiles, pub realized_price_ratio_std_dev: ComputedFromHeightRatioStdDevBands, pub investor_price_ratio_percentiles: ComputedFromHeightRatioPercentiles, } @@ -94,6 +97,8 @@ impl RealizedFull { let core = RealizedBase::forced_import(cfg)?; + let gross_pnl = cfg.import("realized_gross_pnl", v0)?; + let profit_value_created = cfg.import("profit_value_created", v0)?; let profit_value_destroyed: ComputedFromHeight = cfg.import("profit_value_destroyed", v0)?; @@ -154,6 +159,7 @@ impl RealizedFull { Ok(Self { core, + gross_pnl, realized_profit_rel_to_realized_cap, realized_loss_rel_to_realized_cap, net_realized_pnl_rel_to_realized_cap, @@ -191,6 +197,12 @@ impl RealizedFull { sopr_24h_ema, sent_in_profit_ema, sent_in_loss_ema, + realized_price_ratio_percentiles: ComputedFromHeightRatioPercentiles::forced_import( + cfg.db, + &realized_price_name, + realized_price_version, + cfg.indexes, + )?, realized_price_ratio_std_dev: ComputedFromHeightRatioStdDevBands::forced_import( cfg.db, &realized_price_name, @@ -366,12 +378,19 @@ impl RealizedFull { exit, )?; - // Gross PnL rolling sum + // Gross PnL + self.gross_pnl.cents.height.compute_add( + starting_indexes.height, + &self.core.minimal.realized_profit.height, + &self.core.minimal.realized_loss.height, + exit, + )?; + let window_starts = blocks.count.window_starts(); self.gross_pnl_sum.compute_rolling_sum( starting_indexes.height, &window_starts, - &self.core.gross_pnl.cents.height, + &self.gross_pnl.cents.height, exit, )?; @@ -510,7 +529,14 @@ impl RealizedFull { )?; } - // Realized price stddev bands + self.realized_price_ratio_percentiles.compute( + blocks, + starting_indexes, + exit, + &self.core.minimal.realized_price_ratio.ratio.height, + &self.core.minimal.realized_price.cents.height, + )?; + self.realized_price_ratio_std_dev.compute( blocks, starting_indexes, diff --git a/crates/brk_computer/src/distribution/metrics/relative/extended_own_market_cap.rs b/crates/brk_computer/src/distribution/metrics/relative/extended_own_market_cap.rs index 4994d8cb1..b2ecbc596 100644 --- a/crates/brk_computer/src/distribution/metrics/relative/extended_own_market_cap.rs +++ b/crates/brk_computer/src/distribution/metrics/relative/extended_own_market_cap.rs @@ -3,9 +3,7 @@ use brk_traversable::Traversable; use brk_types::{BasisPoints16, BasisPoints32, BasisPointsSigned32, Dollars, Height, Version}; use vecdb::{Exit, ReadableVec, Rw, StorageMode}; -use crate::internal::{ - NegRatioDollarsBps32, PercentFromHeight, RatioDollarsBp16, RatioDollarsBp32, RatioDollarsBps32, -}; +use crate::internal::{PercentFromHeight, RatioDollarsBp16, RatioDollarsBp32, RatioDollarsBps32}; use crate::distribution::metrics::{ImportConfig, UnrealizedFull}; @@ -14,7 +12,6 @@ use crate::distribution::metrics::{ImportConfig, UnrealizedFull}; pub struct RelativeExtendedOwnMarketCap { pub unrealized_profit_rel_to_own_market_cap: PercentFromHeight, pub unrealized_loss_rel_to_own_market_cap: PercentFromHeight, - pub neg_unrealized_loss_rel_to_own_market_cap: PercentFromHeight, pub net_unrealized_pnl_rel_to_own_market_cap: PercentFromHeight, } @@ -27,8 +24,6 @@ impl RelativeExtendedOwnMarketCap { .import("unrealized_profit_rel_to_own_market_cap", v2)?, unrealized_loss_rel_to_own_market_cap: cfg .import("unrealized_loss_rel_to_own_market_cap", Version::new(3))?, - neg_unrealized_loss_rel_to_own_market_cap: cfg - .import("neg_unrealized_loss_rel_to_own_market_cap", Version::new(3))?, net_unrealized_pnl_rel_to_own_market_cap: cfg .import("net_unrealized_pnl_rel_to_own_market_cap", Version::new(3))?, }) @@ -55,13 +50,6 @@ impl RelativeExtendedOwnMarketCap { own_market_cap, exit, )?; - self.neg_unrealized_loss_rel_to_own_market_cap - .compute_binary::( - max_from, - &unrealized.unrealized_loss.usd.height, - own_market_cap, - exit, - )?; self.net_unrealized_pnl_rel_to_own_market_cap .compute_binary::( max_from, diff --git a/crates/brk_computer/src/distribution/metrics/relative/extended_own_pnl.rs b/crates/brk_computer/src/distribution/metrics/relative/extended_own_pnl.rs index 26dce8054..a289de4d1 100644 --- a/crates/brk_computer/src/distribution/metrics/relative/extended_own_pnl.rs +++ b/crates/brk_computer/src/distribution/metrics/relative/extended_own_pnl.rs @@ -3,9 +3,7 @@ use brk_traversable::Traversable; use brk_types::{BasisPoints16, BasisPointsSigned32, Dollars, Height, Version}; use vecdb::{Exit, Rw, StorageMode}; -use crate::internal::{ - NegRatioDollarsBps32, PercentFromHeight, RatioDollarsBp16, RatioDollarsBps32, -}; +use crate::internal::{PercentFromHeight, RatioDollarsBp16, RatioDollarsBps32}; use crate::distribution::metrics::{ImportConfig, UnrealizedFull}; @@ -14,7 +12,6 @@ use crate::distribution::metrics::{ImportConfig, UnrealizedFull}; pub struct RelativeExtendedOwnPnl { pub unrealized_profit_rel_to_own_gross_pnl: PercentFromHeight, pub unrealized_loss_rel_to_own_gross_pnl: PercentFromHeight, - pub neg_unrealized_loss_rel_to_own_gross_pnl: PercentFromHeight, pub net_unrealized_pnl_rel_to_own_gross_pnl: PercentFromHeight, } @@ -27,8 +24,6 @@ impl RelativeExtendedOwnPnl { .import("unrealized_profit_rel_to_own_gross_pnl", v1)?, unrealized_loss_rel_to_own_gross_pnl: cfg .import("unrealized_loss_rel_to_own_gross_pnl", v1)?, - neg_unrealized_loss_rel_to_own_gross_pnl: cfg - .import("neg_unrealized_loss_rel_to_own_gross_pnl", Version::new(2))?, net_unrealized_pnl_rel_to_own_gross_pnl: cfg .import("net_unrealized_pnl_rel_to_own_gross_pnl", Version::new(3))?, }) @@ -54,13 +49,6 @@ impl RelativeExtendedOwnPnl { &unrealized.gross_pnl.usd.height, exit, )?; - self.neg_unrealized_loss_rel_to_own_gross_pnl - .compute_binary::( - max_from, - &unrealized.unrealized_loss.usd.height, - &unrealized.gross_pnl.usd.height, - exit, - )?; self.net_unrealized_pnl_rel_to_own_gross_pnl .compute_binary::( max_from, diff --git a/crates/brk_computer/src/distribution/metrics/relative/full.rs b/crates/brk_computer/src/distribution/metrics/relative/full.rs index be2bb20f6..08a256041 100644 --- a/crates/brk_computer/src/distribution/metrics/relative/full.rs +++ b/crates/brk_computer/src/distribution/metrics/relative/full.rs @@ -7,8 +7,7 @@ use derive_more::{Deref, DerefMut}; use vecdb::{Exit, ReadableCloneableVec, ReadableVec, Rw, StorageMode}; use crate::internal::{ - Bps32ToFloat, LazyFromHeight, NegRatioDollarsBps32, PercentFromHeight, RatioDollarsBp16, - RatioDollarsBps32, + Bps32ToFloat, LazyFromHeight, PercentFromHeight, RatioDollarsBp16, RatioDollarsBps32, }; use crate::distribution::metrics::{ImportConfig, RealizedBase, UnrealizedFull}; @@ -26,7 +25,6 @@ pub struct RelativeFull { pub unrealized_profit_rel_to_market_cap: PercentFromHeight, pub unrealized_loss_rel_to_market_cap: PercentFromHeight, pub net_unrealized_pnl_rel_to_market_cap: PercentFromHeight, - pub neg_unrealized_loss_rel_to_market_cap: PercentFromHeight, pub nupl: LazyFromHeight, pub invested_capital_in_profit_rel_to_realized_cap: PercentFromHeight, @@ -60,8 +58,6 @@ impl RelativeFull { unrealized_loss_rel_to_market_cap: cfg .import("unrealized_loss_rel_to_market_cap", v2)?, net_unrealized_pnl_rel_to_market_cap, - neg_unrealized_loss_rel_to_market_cap: cfg - .import("neg_unrealized_loss_rel_to_market_cap", v3)?, nupl, invested_capital_in_profit_rel_to_realized_cap: cfg.import( "invested_capital_in_profit_rel_to_realized_cap", @@ -111,14 +107,6 @@ impl RelativeFull { market_cap, exit, )?; - self.neg_unrealized_loss_rel_to_market_cap - .compute_binary::( - max_from, - &unrealized.unrealized_loss.usd.height, - market_cap, - exit, - )?; - self.invested_capital_in_profit_rel_to_realized_cap .compute_binary::( max_from, diff --git a/crates/brk_computer/src/distribution/metrics/unrealized/base.rs b/crates/brk_computer/src/distribution/metrics/unrealized/base.rs index 1faf752e5..cc318314b 100644 --- a/crates/brk_computer/src/distribution/metrics/unrealized/base.rs +++ b/crates/brk_computer/src/distribution/metrics/unrealized/base.rs @@ -29,8 +29,6 @@ pub struct UnrealizedBase { pub neg_unrealized_loss: LazyFromHeight, - pub gross_pnl: FiatFromHeight, - pub net_unrealized_pnl: FiatFromHeight, } @@ -50,8 +48,6 @@ impl UnrealizedBase { &unrealized_loss.cents, ); - let gross_pnl = cfg.import("unrealized_gross_pnl", v0)?; - let net_unrealized_pnl = cfg.import("net_unrealized_pnl", v0)?; Ok(Self { @@ -60,7 +56,6 @@ impl UnrealizedBase { unrealized_profit, unrealized_loss, neg_unrealized_loss, - gross_pnl, net_unrealized_pnl, }) } @@ -131,13 +126,6 @@ impl UnrealizedBase { starting_indexes: &Indexes, exit: &Exit, ) -> Result<()> { - self.gross_pnl.cents.height.compute_add( - starting_indexes.height, - &self.unrealized_profit.cents.height, - &self.unrealized_loss.cents.height, - exit, - )?; - self.net_unrealized_pnl .cents .height diff --git a/crates/brk_computer/src/distribution/metrics/unrealized/full.rs b/crates/brk_computer/src/distribution/metrics/unrealized/full.rs index c8264aba6..eff8391d3 100644 --- a/crates/brk_computer/src/distribution/metrics/unrealized/full.rs +++ b/crates/brk_computer/src/distribution/metrics/unrealized/full.rs @@ -26,7 +26,8 @@ pub struct UnrealizedFull { #[traversable(flatten)] pub base: UnrealizedBase, - // --- Source-only fields --- + pub gross_pnl: FiatFromHeight, + pub invested_capital_in_profit: FiatFromHeight, pub invested_capital_in_loss: FiatFromHeight, @@ -47,6 +48,8 @@ impl UnrealizedFull { let base = UnrealizedBase::forced_import(cfg)?; + let gross_pnl = cfg.import("unrealized_gross_pnl", v0)?; + let invested_capital_in_profit = cfg.import("invested_capital_in_profit", v0)?; let invested_capital_in_loss = cfg.import("invested_capital_in_loss", v0)?; @@ -62,6 +65,7 @@ impl UnrealizedFull { Ok(Self { base, + gross_pnl, invested_capital_in_profit, invested_capital_in_loss, invested_capital_in_profit_raw, @@ -218,10 +222,16 @@ impl UnrealizedFull { starting_indexes: &Indexes, exit: &Exit, ) -> Result<()> { - // Complete-tier: net_unrealized_pnl self.base.compute_rest(starting_indexes, exit)?; - // Extended-only: Pain index (investor_price_of_losers - spot) + self.gross_pnl.cents.height.compute_add( + starting_indexes.height, + &self.base.unrealized_profit.cents.height, + &self.base.unrealized_loss.cents.height, + exit, + )?; + + // Pain index (investor_price_of_losers - spot) self.pain_index.cents.height.compute_transform3( starting_indexes.height, &self.investor_cap_in_loss_raw, diff --git a/crates/brk_computer/src/internal/from_height/computed/mod.rs b/crates/brk_computer/src/internal/from_height/computed/mod.rs index d6719ef57..9e957e923 100644 --- a/crates/brk_computer/src/internal/from_height/computed/mod.rs +++ b/crates/brk_computer/src/internal/from_height/computed/mod.rs @@ -3,9 +3,11 @@ mod cumulative; mod cumulative_sum; mod distribution; mod full; +mod rolling_average; pub use aggregated::*; pub use cumulative::*; pub use cumulative_sum::*; pub use distribution::*; pub use full::*; +pub use rolling_average::*; diff --git a/crates/brk_computer/src/internal/from_height/computed/rolling_average.rs b/crates/brk_computer/src/internal/from_height/computed/rolling_average.rs new file mode 100644 index 000000000..9f821093c --- /dev/null +++ b/crates/brk_computer/src/internal/from_height/computed/rolling_average.rs @@ -0,0 +1,78 @@ +//! ComputedFromHeight with rolling average (no distribution stats). +//! +//! Stored height data + 4-window rolling averages (24h, 1w, 1m, 1y). +//! Use instead of ComputedFromHeightDistribution when only the average +//! is analytically useful (e.g., block interval, activity counts). + +use brk_error::Result; + +use brk_traversable::Traversable; +use brk_types::{Height, Version}; +use schemars::JsonSchema; +use vecdb::{Database, EagerVec, Exit, ImportableVec, PcoVec, Rw, StorageMode}; + +use crate::indexes; + +use crate::internal::{NumericValue, RollingWindows, WindowStarts}; + +#[derive(Traversable)] +pub struct ComputedFromHeightRollingAverage +where + T: NumericValue + JsonSchema, +{ + pub height: M::Stored>>, + #[traversable(flatten)] + pub average: RollingWindows, +} + +impl ComputedFromHeightRollingAverage +where + T: NumericValue + JsonSchema, +{ + pub(crate) fn forced_import( + db: &Database, + name: &str, + version: Version, + indexes: &indexes::Vecs, + ) -> Result { + let height: EagerVec> = EagerVec::forced_import(db, name, version)?; + let average = + RollingWindows::forced_import(db, &format!("{name}_average"), version, indexes)?; + + Ok(Self { height, average }) + } + + /// Compute height data via closure, then rolling averages. + pub(crate) fn compute( + &mut self, + max_from: Height, + windows: &WindowStarts<'_>, + exit: &Exit, + compute_height: impl FnOnce(&mut EagerVec>) -> Result<()>, + ) -> Result<()> + where + T: Default, + f64: From, + { + compute_height(&mut self.height)?; + self.compute_rest(max_from, windows, exit) + } + + /// Compute rolling averages from already-populated height data. + pub(crate) fn compute_rest( + &mut self, + max_from: Height, + windows: &WindowStarts<'_>, + exit: &Exit, + ) -> Result<()> + where + T: Default, + f64: From, + { + for (w, starts) in self.average.0.as_mut_array().into_iter().zip(windows.as_array()) { + w.height + .compute_rolling_average(max_from, *starts, &self.height, exit)?; + } + Ok(()) + } +} diff --git a/crates/brk_computer/src/internal/from_height/percent/mod.rs b/crates/brk_computer/src/internal/from_height/percent/mod.rs index 2f366af34..4ac92d769 100644 --- a/crates/brk_computer/src/internal/from_height/percent/mod.rs +++ b/crates/brk_computer/src/internal/from_height/percent/mod.rs @@ -1,5 +1,7 @@ mod base; mod distribution; +mod rolling_average; pub use base::*; pub use distribution::*; +pub use rolling_average::*; diff --git a/crates/brk_computer/src/internal/from_height/percent/rolling_average.rs b/crates/brk_computer/src/internal/from_height/percent/rolling_average.rs new file mode 100644 index 000000000..a02a62c45 --- /dev/null +++ b/crates/brk_computer/src/internal/from_height/percent/rolling_average.rs @@ -0,0 +1,69 @@ +use brk_error::Result; +use brk_traversable::Traversable; +use brk_types::{Height, StoredF32, Version}; +use vecdb::{Database, EagerVec, Exit, PcoVec, ReadableCloneableVec, Rw, StorageMode}; + +use crate::{ + indexes, + internal::{BpsType, WindowStarts}, +}; + +use crate::internal::{ComputedFromHeightRollingAverage, LazyFromHeight}; + +/// Like PercentFromHeight but with rolling average stats on the bps data. +#[derive(Traversable)] +pub struct PercentFromHeightRollingAverage { + pub bps: ComputedFromHeightRollingAverage, + pub ratio: LazyFromHeight, + pub percent: LazyFromHeight, +} + +impl PercentFromHeightRollingAverage { + pub(crate) fn forced_import( + db: &Database, + name: &str, + version: Version, + indexes: &indexes::Vecs, + ) -> Result { + let bps = ComputedFromHeightRollingAverage::forced_import( + db, + &format!("{name}_bps"), + version, + indexes, + )?; + + let ratio = LazyFromHeight::from_height_source::( + &format!("{name}_ratio"), + version, + bps.height.read_only_boxed_clone(), + indexes, + ); + + let percent = LazyFromHeight::from_height_source::( + name, + version, + bps.height.read_only_boxed_clone(), + indexes, + ); + + Ok(Self { + bps, + ratio, + percent, + }) + } + + pub(crate) fn compute( + &mut self, + max_from: Height, + windows: &WindowStarts<'_>, + exit: &Exit, + compute_height: impl FnOnce(&mut EagerVec>) -> Result<()>, + ) -> Result<()> + where + B: Default, + f64: From, + { + self.bps.compute(max_from, windows, exit, compute_height) + } +} diff --git a/crates/brk_computer/src/internal/from_height/value/cumulative.rs b/crates/brk_computer/src/internal/from_height/value/cumulative.rs index 5bc2ab549..9c4a02e71 100644 --- a/crates/brk_computer/src/internal/from_height/value/cumulative.rs +++ b/crates/brk_computer/src/internal/from_height/value/cumulative.rs @@ -1,7 +1,7 @@ use brk_error::Result; use brk_traversable::Traversable; use brk_types::{Cents, Height, Sats, Version}; -use vecdb::{Database, Exit, Rw, StorageMode}; +use vecdb::{Database, EagerVec, Exit, PcoVec, Rw, StorageMode}; use crate::{ indexes, @@ -32,6 +32,17 @@ impl ValueFromHeightCumulative { }) } + pub(crate) fn compute_with( + &mut self, + max_from: Height, + prices: &prices::Vecs, + exit: &Exit, + compute_sats: impl FnOnce(&mut EagerVec>) -> Result<()>, + ) -> Result<()> { + compute_sats(&mut self.base.sats.height)?; + self.compute(prices, max_from, exit) + } + pub(crate) fn compute( &mut self, prices: &prices::Vecs, diff --git a/crates/brk_computer/src/internal/transform/mod.rs b/crates/brk_computer/src/internal/transform/mod.rs index fa60167b5..e1d775d2f 100644 --- a/crates/brk_computer/src/internal/transform/mod.rs +++ b/crates/brk_computer/src/internal/transform/mod.rs @@ -23,7 +23,7 @@ pub use derived::{ RatioCents64, TimesSqrt, }; pub use ratio::{ - NegRatioDollarsBps32, RatioCentsBp32, RatioCentsSignedCentsBps32, + RatioCentsBp32, RatioCentsSignedCentsBps32, RatioCentsSignedDollarsBps32, RatioDiffCentsBps32, RatioDiffDollarsBps32, RatioDiffF32Bps32, RatioDollarsBp16, RatioDollarsBp32, RatioDollarsBps32, RatioSatsBp16, RatioU32Bp16, RatioU64Bp16, diff --git a/crates/brk_computer/src/internal/transform/ratio.rs b/crates/brk_computer/src/internal/transform/ratio.rs index 7fbe67bce..99d9248df 100644 --- a/crates/brk_computer/src/internal/transform/ratio.rs +++ b/crates/brk_computer/src/internal/transform/ratio.rs @@ -84,20 +84,6 @@ impl BinaryTransform for RatioDollarsBps3 } } -pub struct NegRatioDollarsBps32; - -impl BinaryTransform for NegRatioDollarsBps32 { - #[inline(always)] - fn apply(numerator: Dollars, denominator: Dollars) -> BasisPointsSigned32 { - let ratio = *(numerator / denominator); - if ratio.is_finite() { - BasisPointsSigned32::from(-ratio) - } else { - BasisPointsSigned32::ZERO - } - } -} - pub struct RatioCentsSignedCentsBps32; impl BinaryTransform for RatioCentsSignedCentsBps32 { diff --git a/crates/brk_computer/src/mining/compute.rs b/crates/brk_computer/src/mining/compute.rs index 7bc8a07a1..423ae01fc 100644 --- a/crates/brk_computer/src/mining/compute.rs +++ b/crates/brk_computer/src/mining/compute.rs @@ -32,8 +32,8 @@ impl Vecs { self.hashrate.compute( &blocks.count, &blocks.difficulty, - &self.rewards.coinbase.rolling._24h.sum.sats.height, - &self.rewards.coinbase.rolling._24h.sum.usd.height, + &self.rewards.coinbase.sum._24h.sats.height, + &self.rewards.coinbase.sum._24h.usd.height, starting_indexes, exit, )?; diff --git a/crates/brk_computer/src/mining/rewards/compute.rs b/crates/brk_computer/src/mining/rewards/compute.rs index 331bfea4f..a72cf76cf 100644 --- a/crates/brk_computer/src/mining/rewards/compute.rs +++ b/crates/brk_computer/src/mining/rewards/compute.rs @@ -76,29 +76,21 @@ impl Vecs { }, )?; - self.subsidy.compute( + self.subsidy.base.sats.height.compute_transform2( starting_indexes.height, - &window_starts, - prices, - exit, - |vec| { - vec.compute_transform2( - starting_indexes.height, - &self.coinbase.base.sats.height, - &self.fees.base.sats.height, - |(height, coinbase, fees, ..)| { - ( - height, - coinbase.checked_sub(fees).unwrap_or_else(|| { - panic!("coinbase {coinbase:?} < fees {fees:?} at {height:?}") - }), - ) - }, - exit, - )?; - Ok(()) + &self.coinbase.base.sats.height, + &self.fees.base.sats.height, + |(height, coinbase, fees, ..)| { + ( + height, + coinbase.checked_sub(fees).unwrap_or_else(|| { + panic!("coinbase {coinbase:?} < fees {fees:?} at {height:?}") + }), + ) }, + exit, )?; + self.subsidy.compute(prices, starting_indexes.height, exit)?; self.unclaimed_rewards.compute( starting_indexes.height, @@ -135,12 +127,12 @@ impl Vecs { .as_mut_array() .into_iter() .zip(self.fees.rolling.as_array()) - .zip(self.coinbase.rolling.as_array()) + .zip(self.coinbase.sum.as_array()) { fee_dom.compute_binary::( starting_indexes.height, &fees_w.sum.sats.height, - &coinbase_w.sum.sats.height, + &coinbase_w.sats.height, exit, )?; } diff --git a/crates/brk_computer/src/mining/rewards/import.rs b/crates/brk_computer/src/mining/rewards/import.rs index 36198cd45..5df1fc10a 100644 --- a/crates/brk_computer/src/mining/rewards/import.rs +++ b/crates/brk_computer/src/mining/rewards/import.rs @@ -6,8 +6,8 @@ use super::Vecs; use crate::{ indexes, internal::{ - FiatFromHeight, PercentFromHeight, PercentRollingWindows, ValueFromHeightCumulativeSum, - ValueFromHeightFull, + FiatFromHeight, PercentFromHeight, PercentRollingWindows, ValueFromHeightCumulative, + ValueFromHeightCumulativeSum, ValueFromHeightFull, }, }; @@ -18,8 +18,8 @@ impl Vecs { indexes: &indexes::Vecs, ) -> Result { Ok(Self { - coinbase: ValueFromHeightFull::forced_import(db, "coinbase", version, indexes)?, - subsidy: ValueFromHeightFull::forced_import(db, "subsidy", version, indexes)?, + coinbase: ValueFromHeightCumulativeSum::forced_import(db, "coinbase", version, indexes)?, + subsidy: ValueFromHeightCumulative::forced_import(db, "subsidy", version, indexes)?, fees: ValueFromHeightFull::forced_import(db, "fees", version, indexes)?, unclaimed_rewards: ValueFromHeightCumulativeSum::forced_import( db, diff --git a/crates/brk_computer/src/mining/rewards/vecs.rs b/crates/brk_computer/src/mining/rewards/vecs.rs index 0ef1ec081..9e8d15d43 100644 --- a/crates/brk_computer/src/mining/rewards/vecs.rs +++ b/crates/brk_computer/src/mining/rewards/vecs.rs @@ -3,14 +3,14 @@ use brk_types::{BasisPoints16, Cents}; use vecdb::{Rw, StorageMode}; use crate::internal::{ - FiatFromHeight, PercentFromHeight, PercentRollingWindows, ValueFromHeightCumulativeSum, - ValueFromHeightFull, + FiatFromHeight, PercentFromHeight, PercentRollingWindows, ValueFromHeightCumulative, + ValueFromHeightCumulativeSum, ValueFromHeightFull, }; #[derive(Traversable)] pub struct Vecs { - pub coinbase: ValueFromHeightFull, - pub subsidy: ValueFromHeightFull, + pub coinbase: ValueFromHeightCumulativeSum, + pub subsidy: ValueFromHeightCumulative, pub fees: ValueFromHeightFull, pub unclaimed_rewards: ValueFromHeightCumulativeSum, pub fee_dominance: PercentFromHeight, diff --git a/crates/brk_computer/src/scripts/compute.rs b/crates/brk_computer/src/scripts/compute.rs index d25cd9e02..3707c5093 100644 --- a/crates/brk_computer/src/scripts/compute.rs +++ b/crates/brk_computer/src/scripts/compute.rs @@ -21,7 +21,7 @@ impl Vecs { .compute(indexer, &blocks.count, starting_indexes, exit)?; self.value - .compute(indexer, &blocks.count, prices, starting_indexes, exit)?; + .compute(indexer, prices, starting_indexes, exit)?; self.adoption .compute(&self.count, &outputs.count, starting_indexes, exit)?; diff --git a/crates/brk_computer/src/scripts/value/compute.rs b/crates/brk_computer/src/scripts/value/compute.rs index 91ad9d6b7..af83cf9b4 100644 --- a/crates/brk_computer/src/scripts/value/compute.rs +++ b/crates/brk_computer/src/scripts/value/compute.rs @@ -4,22 +4,18 @@ use brk_types::{Height, Indexes, OutputType, Sats, TxOutIndex}; use vecdb::{AnyStoredVec, AnyVec, Exit, ReadableVec, VecIndex, WritableVec}; use super::Vecs; -use crate::{blocks, prices}; +use crate::prices; impl Vecs { pub(crate) fn compute( &mut self, indexer: &Indexer, - count_vecs: &blocks::CountVecs, prices: &prices::Vecs, starting_indexes: &Indexes, exit: &Exit, ) -> Result<()> { - let window_starts = count_vecs.window_starts(); - - self.opreturn.compute( + self.opreturn.compute_with( starting_indexes.height, - &window_starts, prices, exit, |height_vec| { diff --git a/crates/brk_computer/src/scripts/value/import.rs b/crates/brk_computer/src/scripts/value/import.rs index 1837470c7..e37a88849 100644 --- a/crates/brk_computer/src/scripts/value/import.rs +++ b/crates/brk_computer/src/scripts/value/import.rs @@ -3,7 +3,7 @@ use brk_types::Version; use vecdb::Database; use super::Vecs; -use crate::{indexes, internal::ValueFromHeightFull}; +use crate::{indexes, internal::ValueFromHeightCumulative}; impl Vecs { pub(crate) fn forced_import( @@ -12,7 +12,12 @@ impl Vecs { indexes: &indexes::Vecs, ) -> Result { Ok(Self { - opreturn: ValueFromHeightFull::forced_import(db, "opreturn_value", version, indexes)?, + opreturn: ValueFromHeightCumulative::forced_import( + db, + "opreturn_value", + version, + indexes, + )?, }) } } diff --git a/crates/brk_computer/src/scripts/value/vecs.rs b/crates/brk_computer/src/scripts/value/vecs.rs index 1f570b72f..76602cf7e 100644 --- a/crates/brk_computer/src/scripts/value/vecs.rs +++ b/crates/brk_computer/src/scripts/value/vecs.rs @@ -1,9 +1,9 @@ use brk_traversable::Traversable; use vecdb::{Rw, StorageMode}; -use crate::internal::ValueFromHeightFull; +use crate::internal::ValueFromHeightCumulative; #[derive(Traversable)] pub struct Vecs { - pub opreturn: ValueFromHeightFull, + pub opreturn: ValueFromHeightCumulative, } diff --git a/crates/brk_query/src/impl/mining/block_rewards.rs b/crates/brk_query/src/impl/mining/block_rewards.rs index 3d4044448..b87b5b5f5 100644 --- a/crates/brk_query/src/impl/mining/block_rewards.rs +++ b/crates/brk_query/src/impl/mining/block_rewards.rs @@ -1,39 +1,91 @@ use brk_error::Result; -use brk_types::{BlockRewardsEntry, TimePeriod}; -use vecdb::{ReadableOptionVec, VecIndex}; +use brk_types::{BlockRewardsEntry, Height, Sats, TimePeriod}; +use vecdb::{ReadableVec, VecIndex}; -use super::day1_iter::Day1Iter; use crate::Query; impl Query { pub fn block_rewards(&self, time_period: TimePeriod) -> Result> { let computer = self.computer(); - let current_height = self.height(); - let start = current_height - .to_usize() - .saturating_sub(time_period.block_count()); + let indexer = self.indexer(); + let current_height = self.height().to_usize(); + let start = current_height.saturating_sub(time_period.block_count()); - let iter = Day1Iter::new(computer, start, current_height.to_usize()); + let coinbase_vec = &computer.mining.rewards.coinbase.base.sats.height; + let timestamp_vec = &indexer.vecs.blocks.timestamp; - let rewards_vec = &computer - .mining - .rewards - .coinbase - .rolling - ._24h - .distribution - .average - .sats - .day1; + match time_period { + // Per-block, exact rewards + TimePeriod::Day | TimePeriod::ThreeDays => { + let rewards: Vec = + coinbase_vec.collect_range_at(start, current_height + 1); + let timestamps: Vec = + timestamp_vec.collect_range_at(start, current_height + 1); - Ok(iter.collect(|di, ts, h| { - rewards_vec - .collect_one_flat(di) - .map(|reward| BlockRewardsEntry { - avg_height: h.into(), - timestamp: *ts, - avg_rewards: *reward, - }) - })) + Ok(rewards + .iter() + .zip(timestamps.iter()) + .enumerate() + .map(|(i, (reward, ts))| BlockRewardsEntry { + avg_height: (start + i) as u32, + timestamp: **ts, + avg_rewards: **reward, + }) + .collect()) + } + // Daily averages, sampled to ~200 points + _ => { + let first_height_vec = &computer.indexes.day1.first_height; + let day1_vec = &computer.indexes.height.day1; + + let start_di = day1_vec + .collect_one(Height::from(start)) + .unwrap_or_default(); + let end_di = day1_vec + .collect_one(Height::from(current_height)) + .unwrap_or_default(); + + let total_days = + end_di.to_usize().saturating_sub(start_di.to_usize()) + 1; + let step = (total_days / 200).max(1); + + let mut entries = Vec::with_capacity(total_days / step + 1); + let mut di = start_di.to_usize(); + + while di <= end_di.to_usize() { + let day = brk_types::Day1::from(di); + let next_day = brk_types::Day1::from(di + 1); + + if let Some(first_h) = first_height_vec.collect_one(day) { + let next_h = first_height_vec + .collect_one(next_day) + .unwrap_or(Height::from(current_height + 1)); + + let block_count = next_h.to_usize() - first_h.to_usize(); + if block_count > 0 { + let sum = coinbase_vec.fold_range( + first_h, + next_h, + Sats::ZERO, + |acc, v| acc + v, + ); + let avg = *sum / block_count as u64; + + if let Some(ts) = timestamp_vec.collect_one(first_h) { + entries.push(BlockRewardsEntry { + avg_height: first_h.to_usize() as u32, + timestamp: *ts, + avg_rewards: avg, + }); + } + } + } + + di += step; + } + + Ok(entries) + } + } } } diff --git a/modules/brk-client/index.js b/modules/brk-client/index.js index 9e4042550..c66fba177 100644 --- a/modules/brk-client/index.js +++ b/modules/brk-client/index.js @@ -1763,114 +1763,6 @@ function create_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern(client }; } -/** - * @typedef {Object} InvestedNegNetNuplSupplyUnrealizedPattern3 - * @property {BpsPercentRatioPattern} investedCapitalInLossRelToRealizedCap - * @property {BpsPercentRatioPattern} investedCapitalInProfitRelToRealizedCap - * @property {BpsPercentRatioPattern} negUnrealizedLossRelToMarketCap - * @property {BpsPercentRatioPattern} negUnrealizedLossRelToOwnGrossPnl - * @property {BpsPercentRatioPattern} negUnrealizedLossRelToOwnMarketCap - * @property {BpsPercentRatioPattern} netUnrealizedPnlRelToMarketCap - * @property {BpsPercentRatioPattern} netUnrealizedPnlRelToOwnGrossPnl - * @property {BpsPercentRatioPattern} netUnrealizedPnlRelToOwnMarketCap - * @property {MetricPattern1} nupl - * @property {BpsPercentRatioPattern} supplyInLossRelToCirculatingSupply - * @property {BpsPercentRatioPattern} supplyInLossRelToOwnSupply - * @property {BpsPercentRatioPattern} supplyInProfitRelToCirculatingSupply - * @property {BpsPercentRatioPattern} supplyInProfitRelToOwnSupply - * @property {BpsPercentRatioPattern} supplyRelToCirculatingSupply - * @property {BpsPercentRatioPattern} unrealizedLossRelToMarketCap - * @property {BpsPercentRatioPattern} unrealizedLossRelToOwnGrossPnl - * @property {BpsPercentRatioPattern} unrealizedLossRelToOwnMarketCap - * @property {BpsPercentRatioPattern} unrealizedProfitRelToMarketCap - * @property {BpsPercentRatioPattern} unrealizedProfitRelToOwnGrossPnl - * @property {BpsPercentRatioPattern} unrealizedProfitRelToOwnMarketCap - */ - -/** - * Create a InvestedNegNetNuplSupplyUnrealizedPattern3 pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {InvestedNegNetNuplSupplyUnrealizedPattern3} - */ -function createInvestedNegNetNuplSupplyUnrealizedPattern3(client, acc) { - return { - investedCapitalInLossRelToRealizedCap: createBpsPercentRatioPattern(client, _m(acc, 'invested_capital_in_loss_rel_to_realized_cap')), - investedCapitalInProfitRelToRealizedCap: createBpsPercentRatioPattern(client, _m(acc, 'invested_capital_in_profit_rel_to_realized_cap')), - negUnrealizedLossRelToMarketCap: createBpsPercentRatioPattern(client, _m(acc, 'neg_unrealized_loss_rel_to_market_cap')), - negUnrealizedLossRelToOwnGrossPnl: createBpsPercentRatioPattern(client, _m(acc, 'neg_unrealized_loss_rel_to_own_gross_pnl')), - negUnrealizedLossRelToOwnMarketCap: createBpsPercentRatioPattern(client, _m(acc, 'neg_unrealized_loss_rel_to_own_market_cap')), - netUnrealizedPnlRelToMarketCap: createBpsPercentRatioPattern(client, _m(acc, 'net_unrealized_pnl_rel_to_market_cap')), - netUnrealizedPnlRelToOwnGrossPnl: createBpsPercentRatioPattern(client, _m(acc, 'net_unrealized_pnl_rel_to_own_gross_pnl')), - netUnrealizedPnlRelToOwnMarketCap: createBpsPercentRatioPattern(client, _m(acc, 'net_unrealized_pnl_rel_to_own_market_cap')), - nupl: createMetricPattern1(client, _m(acc, 'nupl')), - supplyInLossRelToCirculatingSupply: createBpsPercentRatioPattern(client, _m(acc, 'supply_in_loss_rel_to_circulating_supply')), - supplyInLossRelToOwnSupply: createBpsPercentRatioPattern(client, _m(acc, 'supply_in_loss_rel_to_own_supply')), - supplyInProfitRelToCirculatingSupply: createBpsPercentRatioPattern(client, _m(acc, 'supply_in_profit_rel_to_circulating_supply')), - supplyInProfitRelToOwnSupply: createBpsPercentRatioPattern(client, _m(acc, 'supply_in_profit_rel_to_own_supply')), - supplyRelToCirculatingSupply: createBpsPercentRatioPattern(client, _m(acc, 'supply_rel_to_circulating_supply')), - unrealizedLossRelToMarketCap: createBpsPercentRatioPattern(client, _m(acc, 'unrealized_loss_rel_to_market_cap')), - unrealizedLossRelToOwnGrossPnl: createBpsPercentRatioPattern(client, _m(acc, 'unrealized_loss_rel_to_own_gross_pnl')), - unrealizedLossRelToOwnMarketCap: createBpsPercentRatioPattern(client, _m(acc, 'unrealized_loss_rel_to_own_market_cap')), - unrealizedProfitRelToMarketCap: createBpsPercentRatioPattern(client, _m(acc, 'unrealized_profit_rel_to_market_cap')), - unrealizedProfitRelToOwnGrossPnl: createBpsPercentRatioPattern(client, _m(acc, 'unrealized_profit_rel_to_own_gross_pnl')), - unrealizedProfitRelToOwnMarketCap: createBpsPercentRatioPattern(client, _m(acc, 'unrealized_profit_rel_to_own_market_cap')), - }; -} - -/** - * @typedef {Object} GrossMvrvNegNetRealizedSentSoprValuePattern - * @property {CentsUsdPattern} grossPnl - * @property {MetricPattern1} mvrv - * @property {MetricPattern1} negRealizedLoss - * @property {CumulativeHeightPattern} netRealizedPnl - * @property {MetricPattern1} realizedCap - * @property {MetricPattern1} realizedCapCents - * @property {MetricPattern1} realizedCapChange1m - * @property {CumulativeHeightPattern} realizedLoss - * @property {CentsSatsUsdPattern} realizedPrice - * @property {BpsRatioPattern} realizedPriceRatio - * @property {RatioPattern} realizedPriceRatioPercentiles - * @property {CumulativeHeightPattern} realizedProfit - * @property {BaseCumulativePattern} sentInLoss - * @property {BaseCumulativePattern} sentInProfit - * @property {_1m1w1y24hPattern} sopr - * @property {MetricPattern1} valueCreated - * @property {_1m1w1y24hPattern} valueCreatedSum - * @property {MetricPattern1} valueDestroyed - * @property {_1m1w1y24hPattern} valueDestroyedSum - */ - -/** - * Create a GrossMvrvNegNetRealizedSentSoprValuePattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {GrossMvrvNegNetRealizedSentSoprValuePattern} - */ -function createGrossMvrvNegNetRealizedSentSoprValuePattern(client, acc) { - return { - grossPnl: createCentsUsdPattern(client, _m(acc, 'realized_gross_pnl')), - mvrv: createMetricPattern1(client, _m(acc, 'mvrv')), - negRealizedLoss: createMetricPattern1(client, _m(acc, 'neg_realized_loss')), - netRealizedPnl: createCumulativeHeightPattern(client, _m(acc, 'net_realized_pnl')), - realizedCap: createMetricPattern1(client, _m(acc, 'realized_cap')), - realizedCapCents: createMetricPattern1(client, _m(acc, 'realized_cap_cents')), - realizedCapChange1m: createMetricPattern1(client, _m(acc, 'realized_cap_change_1m')), - realizedLoss: createCumulativeHeightPattern(client, _m(acc, 'realized_loss')), - realizedPrice: createCentsSatsUsdPattern(client, _m(acc, 'realized_price')), - realizedPriceRatio: createBpsRatioPattern(client, _m(acc, 'realized_price_ratio')), - realizedPriceRatioPercentiles: createRatioPattern(client, _m(acc, 'realized_price_ratio')), - realizedProfit: createCumulativeHeightPattern(client, _m(acc, 'realized_profit')), - sentInLoss: createBaseCumulativePattern(client, _m(acc, 'sent_in_loss')), - sentInProfit: createBaseCumulativePattern(client, _m(acc, 'sent_in_profit')), - sopr: create_1m1w1y24hPattern(client, _m(acc, 'sopr')), - valueCreated: createMetricPattern1(client, _m(acc, 'value_created')), - valueCreatedSum: create_1m1w1y24hPattern(client, _m(acc, 'value_created')), - valueDestroyed: createMetricPattern1(client, _m(acc, 'value_destroyed')), - valueDestroyedSum: create_1m1w1y24hPattern(client, _m(acc, 'value_destroyed')), - }; -} - /** * @typedef {Object} Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern * @property {CentsSatsUsdPattern} pct05 @@ -1924,6 +1816,104 @@ function createPct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65 }; } +/** + * @typedef {Object} InvestedNetNuplSupplyUnrealizedPattern3 + * @property {BpsPercentRatioPattern} investedCapitalInLossRelToRealizedCap + * @property {BpsPercentRatioPattern} investedCapitalInProfitRelToRealizedCap + * @property {BpsPercentRatioPattern} netUnrealizedPnlRelToMarketCap + * @property {BpsPercentRatioPattern} netUnrealizedPnlRelToOwnGrossPnl + * @property {BpsPercentRatioPattern} netUnrealizedPnlRelToOwnMarketCap + * @property {MetricPattern1} nupl + * @property {BpsPercentRatioPattern} supplyInLossRelToCirculatingSupply + * @property {BpsPercentRatioPattern} supplyInLossRelToOwnSupply + * @property {BpsPercentRatioPattern} supplyInProfitRelToCirculatingSupply + * @property {BpsPercentRatioPattern} supplyInProfitRelToOwnSupply + * @property {BpsPercentRatioPattern} supplyRelToCirculatingSupply + * @property {BpsPercentRatioPattern} unrealizedLossRelToMarketCap + * @property {BpsPercentRatioPattern} unrealizedLossRelToOwnGrossPnl + * @property {BpsPercentRatioPattern} unrealizedLossRelToOwnMarketCap + * @property {BpsPercentRatioPattern} unrealizedProfitRelToMarketCap + * @property {BpsPercentRatioPattern} unrealizedProfitRelToOwnGrossPnl + * @property {BpsPercentRatioPattern} unrealizedProfitRelToOwnMarketCap + */ + +/** + * Create a InvestedNetNuplSupplyUnrealizedPattern3 pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {InvestedNetNuplSupplyUnrealizedPattern3} + */ +function createInvestedNetNuplSupplyUnrealizedPattern3(client, acc) { + return { + investedCapitalInLossRelToRealizedCap: createBpsPercentRatioPattern(client, _m(acc, 'invested_capital_in_loss_rel_to_realized_cap')), + investedCapitalInProfitRelToRealizedCap: createBpsPercentRatioPattern(client, _m(acc, 'invested_capital_in_profit_rel_to_realized_cap')), + netUnrealizedPnlRelToMarketCap: createBpsPercentRatioPattern(client, _m(acc, 'net_unrealized_pnl_rel_to_market_cap')), + netUnrealizedPnlRelToOwnGrossPnl: createBpsPercentRatioPattern(client, _m(acc, 'net_unrealized_pnl_rel_to_own_gross_pnl')), + netUnrealizedPnlRelToOwnMarketCap: createBpsPercentRatioPattern(client, _m(acc, 'net_unrealized_pnl_rel_to_own_market_cap')), + nupl: createMetricPattern1(client, _m(acc, 'nupl')), + supplyInLossRelToCirculatingSupply: createBpsPercentRatioPattern(client, _m(acc, 'supply_in_loss_rel_to_circulating_supply')), + supplyInLossRelToOwnSupply: createBpsPercentRatioPattern(client, _m(acc, 'supply_in_loss_rel_to_own_supply')), + supplyInProfitRelToCirculatingSupply: createBpsPercentRatioPattern(client, _m(acc, 'supply_in_profit_rel_to_circulating_supply')), + supplyInProfitRelToOwnSupply: createBpsPercentRatioPattern(client, _m(acc, 'supply_in_profit_rel_to_own_supply')), + supplyRelToCirculatingSupply: createBpsPercentRatioPattern(client, _m(acc, 'supply_rel_to_circulating_supply')), + unrealizedLossRelToMarketCap: createBpsPercentRatioPattern(client, _m(acc, 'unrealized_loss_rel_to_market_cap')), + unrealizedLossRelToOwnGrossPnl: createBpsPercentRatioPattern(client, _m(acc, 'unrealized_loss_rel_to_own_gross_pnl')), + unrealizedLossRelToOwnMarketCap: createBpsPercentRatioPattern(client, _m(acc, 'unrealized_loss_rel_to_own_market_cap')), + unrealizedProfitRelToMarketCap: createBpsPercentRatioPattern(client, _m(acc, 'unrealized_profit_rel_to_market_cap')), + unrealizedProfitRelToOwnGrossPnl: createBpsPercentRatioPattern(client, _m(acc, 'unrealized_profit_rel_to_own_gross_pnl')), + unrealizedProfitRelToOwnMarketCap: createBpsPercentRatioPattern(client, _m(acc, 'unrealized_profit_rel_to_own_market_cap')), + }; +} + +/** + * @typedef {Object} MvrvNegNetRealizedSentSoprValuePattern + * @property {MetricPattern1} mvrv + * @property {MetricPattern1} negRealizedLoss + * @property {CumulativeHeightPattern} netRealizedPnl + * @property {MetricPattern1} realizedCap + * @property {MetricPattern1} realizedCapCents + * @property {MetricPattern1} realizedCapChange1m + * @property {CumulativeHeightPattern} realizedLoss + * @property {CentsSatsUsdPattern} realizedPrice + * @property {BpsRatioPattern} realizedPriceRatio + * @property {CumulativeHeightPattern} realizedProfit + * @property {BaseCumulativePattern} sentInLoss + * @property {BaseCumulativePattern} sentInProfit + * @property {_1m1w1y24hPattern} sopr + * @property {MetricPattern1} valueCreated + * @property {_1m1w1y24hPattern} valueCreatedSum + * @property {MetricPattern1} valueDestroyed + * @property {_1m1w1y24hPattern} valueDestroyedSum + */ + +/** + * Create a MvrvNegNetRealizedSentSoprValuePattern pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {MvrvNegNetRealizedSentSoprValuePattern} + */ +function createMvrvNegNetRealizedSentSoprValuePattern(client, acc) { + return { + mvrv: createMetricPattern1(client, _m(acc, 'mvrv')), + negRealizedLoss: createMetricPattern1(client, _m(acc, 'neg_realized_loss')), + netRealizedPnl: createCumulativeHeightPattern(client, _m(acc, 'net_realized_pnl')), + realizedCap: createMetricPattern1(client, _m(acc, 'realized_cap')), + realizedCapCents: createMetricPattern1(client, _m(acc, 'realized_cap_cents')), + realizedCapChange1m: createMetricPattern1(client, _m(acc, 'realized_cap_change_1m')), + realizedLoss: createCumulativeHeightPattern(client, _m(acc, 'realized_loss')), + realizedPrice: createCentsSatsUsdPattern(client, _m(acc, 'realized_price')), + realizedPriceRatio: createBpsRatioPattern(client, _m(acc, 'realized_price_ratio')), + realizedProfit: createCumulativeHeightPattern(client, _m(acc, 'realized_profit')), + sentInLoss: createBaseCumulativePattern(client, _m(acc, 'sent_in_loss')), + sentInProfit: createBaseCumulativePattern(client, _m(acc, 'sent_in_profit')), + sopr: create_1m1w1y24hPattern(client, _m(acc, 'sopr')), + valueCreated: createMetricPattern1(client, _m(acc, 'value_created')), + valueCreatedSum: create_1m1w1y24hPattern(client, _m(acc, 'value_created')), + valueDestroyed: createMetricPattern1(client, _m(acc, 'value_destroyed')), + valueDestroyedSum: create_1m1w1y24hPattern(client, _m(acc, 'value_destroyed')), + }; +} + /** * @typedef {Object} BpsRatioPattern2 * @property {MetricPattern1} bps @@ -2139,45 +2129,6 @@ function create_10y1m1w1y2y3m3y4y5y6m6y8yPattern3(client, acc) { }; } -/** - * @typedef {Object} InvestedNegNetNuplSupplyUnrealizedPattern - * @property {BpsPercentRatioPattern} investedCapitalInLossRelToRealizedCap - * @property {BpsPercentRatioPattern} investedCapitalInProfitRelToRealizedCap - * @property {BpsPercentRatioPattern} negUnrealizedLossRelToMarketCap - * @property {BpsPercentRatioPattern} netUnrealizedPnlRelToMarketCap - * @property {MetricPattern1} nupl - * @property {BpsPercentRatioPattern} supplyInLossRelToCirculatingSupply - * @property {BpsPercentRatioPattern} supplyInLossRelToOwnSupply - * @property {BpsPercentRatioPattern} supplyInProfitRelToCirculatingSupply - * @property {BpsPercentRatioPattern} supplyInProfitRelToOwnSupply - * @property {BpsPercentRatioPattern} supplyRelToCirculatingSupply - * @property {BpsPercentRatioPattern} unrealizedLossRelToMarketCap - * @property {BpsPercentRatioPattern} unrealizedProfitRelToMarketCap - */ - -/** - * Create a InvestedNegNetNuplSupplyUnrealizedPattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {InvestedNegNetNuplSupplyUnrealizedPattern} - */ -function createInvestedNegNetNuplSupplyUnrealizedPattern(client, acc) { - return { - investedCapitalInLossRelToRealizedCap: createBpsPercentRatioPattern(client, _m(acc, 'invested_capital_in_loss_rel_to_realized_cap')), - investedCapitalInProfitRelToRealizedCap: createBpsPercentRatioPattern(client, _m(acc, 'invested_capital_in_profit_rel_to_realized_cap')), - negUnrealizedLossRelToMarketCap: createBpsPercentRatioPattern(client, _m(acc, 'neg_unrealized_loss_rel_to_market_cap')), - netUnrealizedPnlRelToMarketCap: createBpsPercentRatioPattern(client, _m(acc, 'net_unrealized_pnl_rel_to_market_cap')), - nupl: createMetricPattern1(client, _m(acc, 'nupl')), - supplyInLossRelToCirculatingSupply: createBpsPercentRatioPattern(client, _m(acc, 'supply_in_loss_rel_to_circulating_supply')), - supplyInLossRelToOwnSupply: createBpsPercentRatioPattern(client, _m(acc, 'supply_in_loss_rel_to_own_supply')), - supplyInProfitRelToCirculatingSupply: createBpsPercentRatioPattern(client, _m(acc, 'supply_in_profit_rel_to_circulating_supply')), - supplyInProfitRelToOwnSupply: createBpsPercentRatioPattern(client, _m(acc, 'supply_in_profit_rel_to_own_supply')), - supplyRelToCirculatingSupply: createBpsPercentRatioPattern(client, _m(acc, 'supply_rel_to_circulating_supply')), - unrealizedLossRelToMarketCap: createBpsPercentRatioPattern(client, _m(acc, 'unrealized_loss_rel_to_market_cap')), - unrealizedProfitRelToMarketCap: createBpsPercentRatioPattern(client, _m(acc, 'unrealized_profit_rel_to_market_cap')), - }; -} - /** * @typedef {Object} _1m1w1y24hBaseBpsCumulativeHeightPercentRatioSumPattern * @property {BpsPercentRatioPattern} _1m @@ -2289,6 +2240,43 @@ function createAverageCumulativeHeightMaxMedianMinPct10Pct25Pct75Pct90SumPattern }; } +/** + * @typedef {Object} InvestedNetNuplSupplyUnrealizedPattern + * @property {BpsPercentRatioPattern} investedCapitalInLossRelToRealizedCap + * @property {BpsPercentRatioPattern} investedCapitalInProfitRelToRealizedCap + * @property {BpsPercentRatioPattern} netUnrealizedPnlRelToMarketCap + * @property {MetricPattern1} nupl + * @property {BpsPercentRatioPattern} supplyInLossRelToCirculatingSupply + * @property {BpsPercentRatioPattern} supplyInLossRelToOwnSupply + * @property {BpsPercentRatioPattern} supplyInProfitRelToCirculatingSupply + * @property {BpsPercentRatioPattern} supplyInProfitRelToOwnSupply + * @property {BpsPercentRatioPattern} supplyRelToCirculatingSupply + * @property {BpsPercentRatioPattern} unrealizedLossRelToMarketCap + * @property {BpsPercentRatioPattern} unrealizedProfitRelToMarketCap + */ + +/** + * Create a InvestedNetNuplSupplyUnrealizedPattern pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {InvestedNetNuplSupplyUnrealizedPattern} + */ +function createInvestedNetNuplSupplyUnrealizedPattern(client, acc) { + return { + investedCapitalInLossRelToRealizedCap: createBpsPercentRatioPattern(client, _m(acc, 'invested_capital_in_loss_rel_to_realized_cap')), + investedCapitalInProfitRelToRealizedCap: createBpsPercentRatioPattern(client, _m(acc, 'invested_capital_in_profit_rel_to_realized_cap')), + netUnrealizedPnlRelToMarketCap: createBpsPercentRatioPattern(client, _m(acc, 'net_unrealized_pnl_rel_to_market_cap')), + nupl: createMetricPattern1(client, _m(acc, 'nupl')), + supplyInLossRelToCirculatingSupply: createBpsPercentRatioPattern(client, _m(acc, 'supply_in_loss_rel_to_circulating_supply')), + supplyInLossRelToOwnSupply: createBpsPercentRatioPattern(client, _m(acc, 'supply_in_loss_rel_to_own_supply')), + supplyInProfitRelToCirculatingSupply: createBpsPercentRatioPattern(client, _m(acc, 'supply_in_profit_rel_to_circulating_supply')), + supplyInProfitRelToOwnSupply: createBpsPercentRatioPattern(client, _m(acc, 'supply_in_profit_rel_to_own_supply')), + supplyRelToCirculatingSupply: createBpsPercentRatioPattern(client, _m(acc, 'supply_rel_to_circulating_supply')), + unrealizedLossRelToMarketCap: createBpsPercentRatioPattern(client, _m(acc, 'unrealized_loss_rel_to_market_cap')), + unrealizedProfitRelToMarketCap: createBpsPercentRatioPattern(client, _m(acc, 'unrealized_profit_rel_to_market_cap')), + }; +} + /** * @typedef {Object} AverageGainsLossesRsiStochPattern * @property {MetricPattern1} averageGain @@ -2390,6 +2378,39 @@ function createAverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, acc) { }; } +/** + * @typedef {Object} AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern + * @property {_1m1w1y24hPattern} average + * @property {MetricPattern18} height + * @property {_1m1w1y24hPattern} max + * @property {_1m1w1y24hPattern} median + * @property {_1m1w1y24hPattern} min + * @property {_1m1w1y24hPattern} pct10 + * @property {_1m1w1y24hPattern} pct25 + * @property {_1m1w1y24hPattern} pct75 + * @property {_1m1w1y24hPattern} pct90 + */ + +/** + * Create a AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern} + */ +function createAverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, acc) { + return { + average: create_1m1w1y24hPattern(client, _m(acc, 'average')), + height: createMetricPattern18(client, acc), + max: create_1m1w1y24hPattern(client, _m(acc, 'max')), + median: create_1m1w1y24hPattern(client, _m(acc, 'median')), + min: create_1m1w1y24hPattern(client, _m(acc, 'min')), + pct10: create_1m1w1y24hPattern(client, _m(acc, 'p10')), + pct25: create_1m1w1y24hPattern(client, _m(acc, 'p25')), + pct75: create_1m1w1y24hPattern(client, _m(acc, 'p75')), + pct90: create_1m1w1y24hPattern(client, _m(acc, 'p90')), + }; +} + /** * @typedef {Object} AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern * @property {_1m1w1y24hPattern} average @@ -2423,41 +2444,6 @@ function createAverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern(client, acc) { }; } -/** - * @template T - * @typedef {Object} AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern - * @property {_1m1w1y24hPattern} average - * @property {MetricPattern18} height - * @property {_1m1w1y24hPattern} max - * @property {_1m1w1y24hPattern} median - * @property {_1m1w1y24hPattern} min - * @property {_1m1w1y24hPattern} pct10 - * @property {_1m1w1y24hPattern} pct25 - * @property {_1m1w1y24hPattern} pct75 - * @property {_1m1w1y24hPattern} pct90 - */ - -/** - * Create a AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern pattern node - * @template T - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern} - */ -function createAverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, acc) { - return { - average: create_1m1w1y24hPattern(client, _m(acc, 'average')), - height: createMetricPattern18(client, acc), - max: create_1m1w1y24hPattern(client, _m(acc, 'max')), - median: create_1m1w1y24hPattern(client, _m(acc, 'median')), - min: create_1m1w1y24hPattern(client, _m(acc, 'min')), - pct10: create_1m1w1y24hPattern(client, _m(acc, 'p10')), - pct25: create_1m1w1y24hPattern(client, _m(acc, 'p25')), - pct75: create_1m1w1y24hPattern(client, _m(acc, 'p75')), - pct90: create_1m1w1y24hPattern(client, _m(acc, 'p90')), - }; -} - /** * @typedef {Object} _1m1w1y24hBtcCentsSatsUsdPattern * @property {BtcCentsSatsUsdPattern} _1m @@ -2587,8 +2573,8 @@ function create_10y2y3y4y5y6y8yPattern(client, acc) { * @property {CoinblocksCoindaysSentPattern} activity * @property {MaxMinPattern} costBasis * @property {UtxoPattern} outputs - * @property {GrossMvrvNegNetRealizedSentSoprValuePattern} realized - * @property {InvestedNegNetNuplSupplyUnrealizedPattern} relative + * @property {MvrvNegNetRealizedSentSoprValuePattern} realized + * @property {InvestedNetNuplSupplyUnrealizedPattern} relative * @property {ChangeHalvedTotalPattern} supply * @property {GreedGrossInvestedInvestorNegNetPainSupplyUnrealizedPattern} unrealized */ @@ -2604,42 +2590,13 @@ function createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(client activity: createCoinblocksCoindaysSentPattern(client, acc), costBasis: createMaxMinPattern(client, _m(acc, 'cost_basis')), outputs: createUtxoPattern(client, _m(acc, 'utxo_count')), - realized: createGrossMvrvNegNetRealizedSentSoprValuePattern(client, acc), - relative: createInvestedNegNetNuplSupplyUnrealizedPattern(client, acc), + realized: createMvrvNegNetRealizedSentSoprValuePattern(client, acc), + relative: createInvestedNetNuplSupplyUnrealizedPattern(client, acc), supply: createChangeHalvedTotalPattern(client, _m(acc, 'supply')), unrealized: createGreedGrossInvestedInvestorNegNetPainSupplyUnrealizedPattern(client, acc), }; } -/** - * @typedef {Object} GrossNegNetSupplyUnrealizedPattern - * @property {CentsUsdPattern} grossPnl - * @property {MetricPattern1} negUnrealizedLoss - * @property {CentsUsdPattern} netUnrealizedPnl - * @property {BtcCentsSatsUsdPattern} supplyInLoss - * @property {BtcCentsSatsUsdPattern} supplyInProfit - * @property {CentsUsdPattern} unrealizedLoss - * @property {CentsUsdPattern} unrealizedProfit - */ - -/** - * Create a GrossNegNetSupplyUnrealizedPattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {GrossNegNetSupplyUnrealizedPattern} - */ -function createGrossNegNetSupplyUnrealizedPattern(client, acc) { - return { - grossPnl: createCentsUsdPattern(client, _m(acc, 'unrealized_gross_pnl')), - negUnrealizedLoss: createMetricPattern1(client, _m(acc, 'neg_unrealized_loss')), - netUnrealizedPnl: createCentsUsdPattern(client, _m(acc, 'net_unrealized_pnl')), - supplyInLoss: createBtcCentsSatsUsdPattern(client, _m(acc, 'supply_in_loss')), - supplyInProfit: createBtcCentsSatsUsdPattern(client, _m(acc, 'supply_in_profit')), - unrealizedLoss: createCentsUsdPattern(client, _m(acc, 'unrealized_loss')), - unrealizedProfit: createCentsUsdPattern(client, _m(acc, 'unrealized_profit')), - }; -} - /** * @typedef {Object} MvrvRealizedPattern * @property {MetricPattern1} mvrv @@ -2669,41 +2626,14 @@ function createMvrvRealizedPattern(client, acc) { }; } -/** - * @typedef {Object} _1m1w1y24hBaseCumulativePattern - * @property {AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} _1m - * @property {AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} _1w - * @property {AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} _1y - * @property {AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} _24h - * @property {BtcCentsSatsUsdPattern} base - * @property {BtcCentsSatsUsdPattern} cumulative - */ - -/** - * Create a _1m1w1y24hBaseCumulativePattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {_1m1w1y24hBaseCumulativePattern} - */ -function create_1m1w1y24hBaseCumulativePattern(client, acc) { - return { - _1m: createAverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, _m(acc, '1m')), - _1w: createAverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, _m(acc, '1w')), - _1y: createAverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, _m(acc, '1y')), - _24h: createAverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, _m(acc, '24h')), - base: createBtcCentsSatsUsdPattern(client, acc), - cumulative: createBtcCentsSatsUsdPattern(client, _m(acc, 'cumulative')), - }; -} - /** * @typedef {Object} ActivityOutputsRealizedRelativeSupplyUnrealizedPattern2 * @property {SentPattern} activity * @property {UtxoPattern} outputs - * @property {GrossMvrvNegNetRealizedSentSoprValuePattern} realized + * @property {MvrvNegNetRealizedSentSoprValuePattern} realized * @property {SupplyPattern3} relative * @property {ChangeHalvedTotalPattern} supply - * @property {GrossNegNetSupplyUnrealizedPattern} unrealized + * @property {NegNetSupplyUnrealizedPattern} unrealized */ /** @@ -2716,10 +2646,10 @@ function createActivityOutputsRealizedRelativeSupplyUnrealizedPattern2(client, a return { activity: createSentPattern(client, _m(acc, 'sent')), outputs: createUtxoPattern(client, _m(acc, 'utxo_count')), - realized: createGrossMvrvNegNetRealizedSentSoprValuePattern(client, acc), + realized: createMvrvNegNetRealizedSentSoprValuePattern(client, acc), relative: createSupplyPattern3(client, _m(acc, 'supply')), supply: createChangeHalvedTotalPattern(client, _m(acc, 'supply')), - unrealized: createGrossNegNetSupplyUnrealizedPattern(client, acc), + unrealized: createNegNetSupplyUnrealizedPattern(client, acc), }; } @@ -2751,29 +2681,29 @@ function createActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, ac } /** - * @typedef {Object} BalanceBothReactivatedReceivingSendingPattern - * @property {AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern} balanceDecreased - * @property {AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern} balanceIncreased - * @property {AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern} both - * @property {AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern} reactivated - * @property {AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern} receiving - * @property {AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern} sending + * @typedef {Object} NegNetSupplyUnrealizedPattern + * @property {MetricPattern1} negUnrealizedLoss + * @property {CentsUsdPattern} netUnrealizedPnl + * @property {BtcCentsSatsUsdPattern} supplyInLoss + * @property {BtcCentsSatsUsdPattern} supplyInProfit + * @property {CentsUsdPattern} unrealizedLoss + * @property {CentsUsdPattern} unrealizedProfit */ /** - * Create a BalanceBothReactivatedReceivingSendingPattern pattern node + * Create a NegNetSupplyUnrealizedPattern pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {BalanceBothReactivatedReceivingSendingPattern} + * @returns {NegNetSupplyUnrealizedPattern} */ -function createBalanceBothReactivatedReceivingSendingPattern(client, acc) { +function createNegNetSupplyUnrealizedPattern(client, acc) { return { - balanceDecreased: createAverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, _m(acc, 'balance_decreased')), - balanceIncreased: createAverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, _m(acc, 'balance_increased')), - both: createAverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, _m(acc, 'both')), - reactivated: createAverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, _m(acc, 'reactivated')), - receiving: createAverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, _m(acc, 'receiving')), - sending: createAverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, _m(acc, 'sending')), + negUnrealizedLoss: createMetricPattern1(client, _m(acc, 'neg_unrealized_loss')), + netUnrealizedPnl: createCentsUsdPattern(client, _m(acc, 'net_unrealized_pnl')), + supplyInLoss: createBtcCentsSatsUsdPattern(client, _m(acc, 'supply_in_loss')), + supplyInProfit: createBtcCentsSatsUsdPattern(client, _m(acc, 'supply_in_profit')), + unrealizedLoss: createCentsUsdPattern(client, _m(acc, 'unrealized_loss')), + unrealizedProfit: createCentsUsdPattern(client, _m(acc, 'unrealized_profit')), }; } @@ -2852,6 +2782,33 @@ function createSupplyPattern3(client, acc) { }; } +/** + * @template T + * @typedef {Object} _1m1w1y24hHeightPattern + * @property {MetricPattern1} _1m + * @property {MetricPattern1} _1w + * @property {MetricPattern1} _1y + * @property {MetricPattern1} _24h + * @property {MetricPattern18} height + */ + +/** + * Create a _1m1w1y24hHeightPattern pattern node + * @template T + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {_1m1w1y24hHeightPattern} + */ +function create_1m1w1y24hHeightPattern(client, acc) { + return { + _1m: createMetricPattern1(client, _m(acc, 'average_1m')), + _1w: createMetricPattern1(client, _m(acc, 'average_1w')), + _1y: createMetricPattern1(client, _m(acc, 'average_1y')), + _24h: createMetricPattern1(client, _m(acc, 'average_24h')), + height: createMetricPattern18(client, acc), + }; +} + /** * @typedef {Object} _1m1w1y24hPattern6 * @property {BaseBtcCentsSatsUsdPattern} _1m @@ -2921,6 +2878,29 @@ function create_1m1w1y24hPattern5(client, acc) { }; } +/** + * @typedef {Object} BothReactivatedReceivingSendingPattern + * @property {_1m1w1y24hHeightPattern} both + * @property {_1m1w1y24hHeightPattern} reactivated + * @property {_1m1w1y24hHeightPattern} receiving + * @property {_1m1w1y24hHeightPattern} sending + */ + +/** + * Create a BothReactivatedReceivingSendingPattern pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {BothReactivatedReceivingSendingPattern} + */ +function createBothReactivatedReceivingSendingPattern(client, acc) { + return { + both: create_1m1w1y24hHeightPattern(client, _m(acc, 'both')), + reactivated: create_1m1w1y24hHeightPattern(client, _m(acc, 'reactivated')), + receiving: create_1m1w1y24hHeightPattern(client, _m(acc, 'receiving')), + sending: create_1m1w1y24hHeightPattern(client, _m(acc, 'sending')), + }; +} + /** * @typedef {Object} BtcCentsSatsUsdPattern * @property {MetricPattern1} btc @@ -3060,19 +3040,19 @@ function createBaseCumulativeSumPattern(client, acc) { } /** - * @typedef {Object} BpsPercentRatioPattern2 - * @property {AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern} bps + * @typedef {Object} BpsPercentRatioPattern3 + * @property {AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern} bps * @property {MetricPattern1} percent * @property {MetricPattern1} ratio */ /** - * Create a BpsPercentRatioPattern2 pattern node + * Create a BpsPercentRatioPattern3 pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {BpsPercentRatioPattern2} + * @returns {BpsPercentRatioPattern3} */ -function createBpsPercentRatioPattern2(client, acc) { +function createBpsPercentRatioPattern3(client, acc) { return { bps: createAverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, _m(acc, 'bps')), percent: createMetricPattern1(client, acc), @@ -3546,11 +3526,11 @@ function create_2wPattern(client, acc) { * @property {MetricPattern18} totalSize * @property {MetricsTree_Blocks_Weight} weight * @property {MetricsTree_Blocks_Count} count - * @property {AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern} interval + * @property {_1m1w1y24hHeightPattern} interval * @property {MetricsTree_Blocks_Halving} halving * @property {AverageCumulativeHeightMaxMedianMinPct10Pct25Pct75Pct90SumPattern} vbytes * @property {MetricsTree_Blocks_Size} size - * @property {BpsPercentRatioPattern2} fullness + * @property {MetricsTree_Blocks_Fullness} fullness */ /** @@ -3656,6 +3636,13 @@ function create_2wPattern(client, acc) { * @property {_1m1w1y24hPattern} pct90 */ +/** + * @typedef {Object} MetricsTree_Blocks_Fullness + * @property {_1m1w1y24hHeightPattern} bps + * @property {MetricPattern1} ratio + * @property {MetricPattern1} percent + */ + /** * @typedef {Object} MetricsTree_Transactions * @property {MetricPattern18} firstTxindex @@ -3805,7 +3792,7 @@ function create_2wPattern(client, acc) { /** * @typedef {Object} MetricsTree_Scripts_Value - * @property {_1m1w1y24hBaseCumulativePattern} opreturn + * @property {BaseCumulativePattern} opreturn */ /** @@ -3822,9 +3809,9 @@ function create_2wPattern(client, acc) { /** * @typedef {Object} MetricsTree_Mining_Rewards - * @property {_1m1w1y24hBaseCumulativePattern} coinbase - * @property {_1m1w1y24hBaseCumulativePattern} subsidy - * @property {_1m1w1y24hBaseCumulativePattern} fees + * @property {BaseCumulativeSumPattern} coinbase + * @property {BaseCumulativePattern} subsidy + * @property {MetricsTree_Mining_Rewards_Fees} fees * @property {BaseCumulativeSumPattern} unclaimedRewards * @property {BpsPercentRatioPattern} feeDominance * @property {_1m1w1y24hPattern2} feeDominanceRolling @@ -3833,6 +3820,16 @@ function create_2wPattern(client, acc) { * @property {CentsUsdPattern} subsidySma1y */ +/** + * @typedef {Object} MetricsTree_Mining_Rewards_Fees + * @property {BtcCentsSatsUsdPattern} base + * @property {BtcCentsSatsUsdPattern} cumulative + * @property {AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} _24h + * @property {AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} _1w + * @property {AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} _1m + * @property {AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} _1y + */ + /** * @typedef {Object} MetricsTree_Mining_Hashrate * @property {MetricPattern1} hashRate @@ -4794,7 +4791,6 @@ function create_2wPattern(client, acc) { * @property {BpsPercentRatioPattern} unrealizedProfitRelToMarketCap * @property {BpsPercentRatioPattern} unrealizedLossRelToMarketCap * @property {BpsPercentRatioPattern} netUnrealizedPnlRelToMarketCap - * @property {BpsPercentRatioPattern} negUnrealizedLossRelToMarketCap * @property {MetricPattern1} nupl * @property {BpsPercentRatioPattern} investedCapitalInProfitRelToRealizedCap * @property {BpsPercentRatioPattern} investedCapitalInLossRelToRealizedCap @@ -4802,7 +4798,6 @@ function create_2wPattern(client, acc) { * @property {BpsPercentRatioPattern} supplyInLossRelToOwnSupply * @property {BpsPercentRatioPattern} unrealizedProfitRelToOwnGrossPnl * @property {BpsPercentRatioPattern} unrealizedLossRelToOwnGrossPnl - * @property {BpsPercentRatioPattern} negUnrealizedLossRelToOwnGrossPnl * @property {BpsPercentRatioPattern} netUnrealizedPnlRelToOwnGrossPnl */ @@ -4814,7 +4809,7 @@ function create_2wPattern(client, acc) { * @property {CapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprUpperValuePattern} realized * @property {InvestedMaxMinPercentilesPattern} costBasis * @property {GreedGrossInvestedInvestorNegNetPainSupplyUnrealizedPattern} unrealized - * @property {InvestedNegNetNuplSupplyUnrealizedPattern3} relative + * @property {InvestedNetNuplSupplyUnrealizedPattern3} relative * @property {MetricPattern1} dormancy * @property {MetricPattern1} velocity * @property {MetricPattern1} adjustedValueCreated @@ -4833,7 +4828,7 @@ function create_2wPattern(client, acc) { * @property {CapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprUpperValuePattern} realized * @property {InvestedMaxMinPercentilesPattern} costBasis * @property {GreedGrossInvestedInvestorNegNetPainSupplyUnrealizedPattern} unrealized - * @property {InvestedNegNetNuplSupplyUnrealizedPattern3} relative + * @property {InvestedNetNuplSupplyUnrealizedPattern3} relative * @property {MetricPattern1} dormancy * @property {MetricPattern1} velocity */ @@ -5068,15 +5063,15 @@ function create_2wPattern(client, acc) { /** * @typedef {Object} MetricsTree_Distribution_AddressActivity - * @property {BalanceBothReactivatedReceivingSendingPattern} all - * @property {BalanceBothReactivatedReceivingSendingPattern} p2pk65 - * @property {BalanceBothReactivatedReceivingSendingPattern} p2pk33 - * @property {BalanceBothReactivatedReceivingSendingPattern} p2pkh - * @property {BalanceBothReactivatedReceivingSendingPattern} p2sh - * @property {BalanceBothReactivatedReceivingSendingPattern} p2wpkh - * @property {BalanceBothReactivatedReceivingSendingPattern} p2wsh - * @property {BalanceBothReactivatedReceivingSendingPattern} p2tr - * @property {BalanceBothReactivatedReceivingSendingPattern} p2a + * @property {BothReactivatedReceivingSendingPattern} all + * @property {BothReactivatedReceivingSendingPattern} p2pk65 + * @property {BothReactivatedReceivingSendingPattern} p2pk33 + * @property {BothReactivatedReceivingSendingPattern} p2pkh + * @property {BothReactivatedReceivingSendingPattern} p2sh + * @property {BothReactivatedReceivingSendingPattern} p2wpkh + * @property {BothReactivatedReceivingSendingPattern} p2wsh + * @property {BothReactivatedReceivingSendingPattern} p2tr + * @property {BothReactivatedReceivingSendingPattern} p2a */ /** @@ -5107,15 +5102,15 @@ function create_2wPattern(client, acc) { /** * @typedef {Object} MetricsTree_Distribution_GrowthRate - * @property {BpsPercentRatioPattern2} all - * @property {BpsPercentRatioPattern2} p2pk65 - * @property {BpsPercentRatioPattern2} p2pk33 - * @property {BpsPercentRatioPattern2} p2pkh - * @property {BpsPercentRatioPattern2} p2sh - * @property {BpsPercentRatioPattern2} p2wpkh - * @property {BpsPercentRatioPattern2} p2wsh - * @property {BpsPercentRatioPattern2} p2tr - * @property {BpsPercentRatioPattern2} p2a + * @property {BpsPercentRatioPattern3} all + * @property {BpsPercentRatioPattern3} p2pk65 + * @property {BpsPercentRatioPattern3} p2pk33 + * @property {BpsPercentRatioPattern3} p2pkh + * @property {BpsPercentRatioPattern3} p2sh + * @property {BpsPercentRatioPattern3} p2wpkh + * @property {BpsPercentRatioPattern3} p2wsh + * @property {BpsPercentRatioPattern3} p2tr + * @property {BpsPercentRatioPattern3} p2a */ /** @@ -6165,7 +6160,7 @@ class BrkClient extends BrkClientBase { height14yAgo: createMetricPattern18(this, 'height_14y_ago'), height26yAgo: createMetricPattern18(this, 'height_26y_ago'), }, - interval: createAverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern(this, 'block_interval'), + interval: create_1m1w1y24hHeightPattern(this, 'block_interval'), halving: { epoch: createMetricPattern1(this, 'halving_epoch'), blocksBeforeNextHalving: createMetricPattern1(this, 'blocks_before_next_halving'), @@ -6184,7 +6179,11 @@ class BrkClient extends BrkClientBase { pct75: create_1m1w1y24hPattern(this, 'block_size_p75'), pct90: create_1m1w1y24hPattern(this, 'block_size_p90'), }, - fullness: createBpsPercentRatioPattern2(this, 'block_fullness'), + fullness: { + bps: create_1m1w1y24hHeightPattern(this, 'block_fullness_bps'), + ratio: createMetricPattern1(this, 'block_fullness_ratio'), + percent: createMetricPattern1(this, 'block_fullness'), + }, }, transactions: { firstTxindex: createMetricPattern18(this, 'first_txindex'), @@ -6294,7 +6293,7 @@ class BrkClient extends BrkClientBase { segwit: createCumulativeHeightSumPattern(this, 'segwit_count'), }, value: { - opreturn: create_1m1w1y24hBaseCumulativePattern(this, 'opreturn_value'), + opreturn: createBaseCumulativePattern(this, 'opreturn_value'), }, adoption: { taproot: createBpsPercentRatioPattern(this, 'taproot_adoption'), @@ -6303,9 +6302,16 @@ class BrkClient extends BrkClientBase { }, mining: { rewards: { - coinbase: create_1m1w1y24hBaseCumulativePattern(this, 'coinbase'), - subsidy: create_1m1w1y24hBaseCumulativePattern(this, 'subsidy'), - fees: create_1m1w1y24hBaseCumulativePattern(this, 'fees'), + coinbase: createBaseCumulativeSumPattern(this, 'coinbase'), + subsidy: createBaseCumulativePattern(this, 'subsidy'), + fees: { + base: createBtcCentsSatsUsdPattern(this, 'fees'), + cumulative: createBtcCentsSatsUsdPattern(this, 'fees_cumulative'), + _24h: createAverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(this, 'fees_24h'), + _1w: createAverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(this, 'fees_1w'), + _1m: createAverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(this, 'fees_1m'), + _1y: createAverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(this, 'fees_1y'), + }, unclaimedRewards: createBaseCumulativeSumPattern(this, 'unclaimed_rewards'), feeDominance: createBpsPercentRatioPattern(this, 'fee_dominance'), feeDominanceRolling: create_1m1w1y24hPattern2(this, 'fee_dominance'), @@ -7011,7 +7017,6 @@ class BrkClient extends BrkClientBase { unrealizedProfitRelToMarketCap: createBpsPercentRatioPattern(this, 'unrealized_profit_rel_to_market_cap'), unrealizedLossRelToMarketCap: createBpsPercentRatioPattern(this, 'unrealized_loss_rel_to_market_cap'), netUnrealizedPnlRelToMarketCap: createBpsPercentRatioPattern(this, 'net_unrealized_pnl_rel_to_market_cap'), - negUnrealizedLossRelToMarketCap: createBpsPercentRatioPattern(this, 'neg_unrealized_loss_rel_to_market_cap'), nupl: createMetricPattern1(this, 'nupl'), investedCapitalInProfitRelToRealizedCap: createBpsPercentRatioPattern(this, 'invested_capital_in_profit_rel_to_realized_cap'), investedCapitalInLossRelToRealizedCap: createBpsPercentRatioPattern(this, 'invested_capital_in_loss_rel_to_realized_cap'), @@ -7019,7 +7024,6 @@ class BrkClient extends BrkClientBase { supplyInLossRelToOwnSupply: createBpsPercentRatioPattern(this, 'supply_in_loss_rel_to_own_supply'), unrealizedProfitRelToOwnGrossPnl: createBpsPercentRatioPattern(this, 'unrealized_profit_rel_to_own_gross_pnl'), unrealizedLossRelToOwnGrossPnl: createBpsPercentRatioPattern(this, 'unrealized_loss_rel_to_own_gross_pnl'), - negUnrealizedLossRelToOwnGrossPnl: createBpsPercentRatioPattern(this, 'neg_unrealized_loss_rel_to_own_gross_pnl'), netUnrealizedPnlRelToOwnGrossPnl: createBpsPercentRatioPattern(this, 'net_unrealized_pnl_rel_to_own_gross_pnl'), }, dormancy: createMetricPattern1(this, 'dormancy'), @@ -7032,7 +7036,7 @@ class BrkClient extends BrkClientBase { realized: createCapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprUpperValuePattern(this, 'sth'), costBasis: createInvestedMaxMinPercentilesPattern(this, 'sth'), unrealized: createGreedGrossInvestedInvestorNegNetPainSupplyUnrealizedPattern(this, 'sth'), - relative: createInvestedNegNetNuplSupplyUnrealizedPattern3(this, 'sth'), + relative: createInvestedNetNuplSupplyUnrealizedPattern3(this, 'sth'), dormancy: createMetricPattern1(this, 'sth_dormancy'), velocity: createMetricPattern1(this, 'sth_velocity'), adjustedValueCreated: createMetricPattern1(this, 'sth_adjusted_value_created'), @@ -7049,7 +7053,7 @@ class BrkClient extends BrkClientBase { realized: createCapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprUpperValuePattern(this, 'lth'), costBasis: createInvestedMaxMinPercentilesPattern(this, 'lth'), unrealized: createGreedGrossInvestedInvestorNegNetPainSupplyUnrealizedPattern(this, 'lth'), - relative: createInvestedNegNetNuplSupplyUnrealizedPattern3(this, 'lth'), + relative: createInvestedNetNuplSupplyUnrealizedPattern3(this, 'lth'), dormancy: createMetricPattern1(this, 'lth_dormancy'), velocity: createMetricPattern1(this, 'lth_velocity'), }, @@ -7256,15 +7260,15 @@ class BrkClient extends BrkClientBase { addrCount: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern(this, 'addr_count'), emptyAddrCount: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern(this, 'empty_addr_count'), addressActivity: { - all: createBalanceBothReactivatedReceivingSendingPattern(this, 'address_activity'), - p2pk65: createBalanceBothReactivatedReceivingSendingPattern(this, 'p2pk65_address_activity'), - p2pk33: createBalanceBothReactivatedReceivingSendingPattern(this, 'p2pk33_address_activity'), - p2pkh: createBalanceBothReactivatedReceivingSendingPattern(this, 'p2pkh_address_activity'), - p2sh: createBalanceBothReactivatedReceivingSendingPattern(this, 'p2sh_address_activity'), - p2wpkh: createBalanceBothReactivatedReceivingSendingPattern(this, 'p2wpkh_address_activity'), - p2wsh: createBalanceBothReactivatedReceivingSendingPattern(this, 'p2wsh_address_activity'), - p2tr: createBalanceBothReactivatedReceivingSendingPattern(this, 'p2tr_address_activity'), - p2a: createBalanceBothReactivatedReceivingSendingPattern(this, 'p2a_address_activity'), + all: createBothReactivatedReceivingSendingPattern(this, 'address_activity'), + p2pk65: createBothReactivatedReceivingSendingPattern(this, 'p2pk65_address_activity'), + p2pk33: createBothReactivatedReceivingSendingPattern(this, 'p2pk33_address_activity'), + p2pkh: createBothReactivatedReceivingSendingPattern(this, 'p2pkh_address_activity'), + p2sh: createBothReactivatedReceivingSendingPattern(this, 'p2sh_address_activity'), + p2wpkh: createBothReactivatedReceivingSendingPattern(this, 'p2wpkh_address_activity'), + p2wsh: createBothReactivatedReceivingSendingPattern(this, 'p2wsh_address_activity'), + p2tr: createBothReactivatedReceivingSendingPattern(this, 'p2tr_address_activity'), + p2a: createBothReactivatedReceivingSendingPattern(this, 'p2a_address_activity'), }, totalAddrCount: { all: createMetricPattern1(this, 'total_addr_count'), @@ -7289,15 +7293,15 @@ class BrkClient extends BrkClientBase { p2a: createAverageCumulativeHeightMaxMedianMinPct10Pct25Pct75Pct90SumPattern(this, 'p2a_new_addr_count'), }, growthRate: { - all: createBpsPercentRatioPattern2(this, 'growth_rate'), - p2pk65: createBpsPercentRatioPattern2(this, 'p2pk65_growth_rate'), - p2pk33: createBpsPercentRatioPattern2(this, 'p2pk33_growth_rate'), - p2pkh: createBpsPercentRatioPattern2(this, 'p2pkh_growth_rate'), - p2sh: createBpsPercentRatioPattern2(this, 'p2sh_growth_rate'), - p2wpkh: createBpsPercentRatioPattern2(this, 'p2wpkh_growth_rate'), - p2wsh: createBpsPercentRatioPattern2(this, 'p2wsh_growth_rate'), - p2tr: createBpsPercentRatioPattern2(this, 'p2tr_growth_rate'), - p2a: createBpsPercentRatioPattern2(this, 'p2a_growth_rate'), + all: createBpsPercentRatioPattern3(this, 'growth_rate'), + p2pk65: createBpsPercentRatioPattern3(this, 'p2pk65_growth_rate'), + p2pk33: createBpsPercentRatioPattern3(this, 'p2pk33_growth_rate'), + p2pkh: createBpsPercentRatioPattern3(this, 'p2pkh_growth_rate'), + p2sh: createBpsPercentRatioPattern3(this, 'p2sh_growth_rate'), + p2wpkh: createBpsPercentRatioPattern3(this, 'p2wpkh_growth_rate'), + p2wsh: createBpsPercentRatioPattern3(this, 'p2wsh_growth_rate'), + p2tr: createBpsPercentRatioPattern3(this, 'p2tr_growth_rate'), + p2a: createBpsPercentRatioPattern3(this, 'p2a_growth_rate'), }, fundedaddressindex: createMetricPattern34(this, 'fundedaddressindex'), emptyaddressindex: createMetricPattern35(this, 'emptyaddressindex'), diff --git a/packages/brk_client/brk_client/__init__.py b/packages/brk_client/brk_client/__init__.py index 0fa5e3e43..f3b1f5101 100644 --- a/packages/brk_client/brk_client/__init__.py +++ b/packages/brk_client/brk_client/__init__.py @@ -2158,57 +2158,6 @@ class _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern: self.sma: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'sma_4y')) self.zscore: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'zscore_4y')) -class InvestedNegNetNuplSupplyUnrealizedPattern3: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.invested_capital_in_loss_rel_to_realized_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'invested_capital_in_loss_rel_to_realized_cap')) - self.invested_capital_in_profit_rel_to_realized_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'invested_capital_in_profit_rel_to_realized_cap')) - self.neg_unrealized_loss_rel_to_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'neg_unrealized_loss_rel_to_market_cap')) - self.neg_unrealized_loss_rel_to_own_gross_pnl: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'neg_unrealized_loss_rel_to_own_gross_pnl')) - self.neg_unrealized_loss_rel_to_own_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'neg_unrealized_loss_rel_to_own_market_cap')) - self.net_unrealized_pnl_rel_to_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'net_unrealized_pnl_rel_to_market_cap')) - self.net_unrealized_pnl_rel_to_own_gross_pnl: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'net_unrealized_pnl_rel_to_own_gross_pnl')) - self.net_unrealized_pnl_rel_to_own_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'net_unrealized_pnl_rel_to_own_market_cap')) - self.nupl: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'nupl')) - self.supply_in_loss_rel_to_circulating_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'supply_in_loss_rel_to_circulating_supply')) - self.supply_in_loss_rel_to_own_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'supply_in_loss_rel_to_own_supply')) - self.supply_in_profit_rel_to_circulating_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'supply_in_profit_rel_to_circulating_supply')) - self.supply_in_profit_rel_to_own_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'supply_in_profit_rel_to_own_supply')) - self.supply_rel_to_circulating_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'supply_rel_to_circulating_supply')) - self.unrealized_loss_rel_to_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'unrealized_loss_rel_to_market_cap')) - self.unrealized_loss_rel_to_own_gross_pnl: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'unrealized_loss_rel_to_own_gross_pnl')) - self.unrealized_loss_rel_to_own_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'unrealized_loss_rel_to_own_market_cap')) - self.unrealized_profit_rel_to_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'unrealized_profit_rel_to_market_cap')) - self.unrealized_profit_rel_to_own_gross_pnl: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'unrealized_profit_rel_to_own_gross_pnl')) - self.unrealized_profit_rel_to_own_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'unrealized_profit_rel_to_own_market_cap')) - -class GrossMvrvNegNetRealizedSentSoprValuePattern: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.gross_pnl: CentsUsdPattern = CentsUsdPattern(client, _m(acc, 'realized_gross_pnl')) - self.mvrv: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'mvrv')) - self.neg_realized_loss: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'neg_realized_loss')) - self.net_realized_pnl: CumulativeHeightPattern[CentsSigned] = CumulativeHeightPattern(client, _m(acc, 'net_realized_pnl')) - self.realized_cap: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_cap')) - self.realized_cap_cents: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_cap_cents')) - self.realized_cap_change_1m: MetricPattern1[CentsSigned] = MetricPattern1(client, _m(acc, 'realized_cap_change_1m')) - self.realized_loss: CumulativeHeightPattern[Cents] = CumulativeHeightPattern(client, _m(acc, 'realized_loss')) - self.realized_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'realized_price')) - self.realized_price_ratio: BpsRatioPattern = BpsRatioPattern(client, _m(acc, 'realized_price_ratio')) - self.realized_price_ratio_percentiles: RatioPattern = RatioPattern(client, _m(acc, 'realized_price_ratio')) - self.realized_profit: CumulativeHeightPattern[Cents] = CumulativeHeightPattern(client, _m(acc, 'realized_profit')) - self.sent_in_loss: BaseCumulativePattern = BaseCumulativePattern(client, _m(acc, 'sent_in_loss')) - self.sent_in_profit: BaseCumulativePattern = BaseCumulativePattern(client, _m(acc, 'sent_in_profit')) - self.sopr: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, _m(acc, 'sopr')) - self.value_created: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_created')) - self.value_created_sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, _m(acc, 'value_created')) - self.value_destroyed: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_destroyed')) - self.value_destroyed_sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, _m(acc, 'value_destroyed')) - class Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern: """Pattern struct for repeated tree structure.""" @@ -2234,6 +2183,52 @@ class Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct7 self.pct90: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'pct90')) self.pct95: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'pct95')) +class InvestedNetNuplSupplyUnrealizedPattern3: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.invested_capital_in_loss_rel_to_realized_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'invested_capital_in_loss_rel_to_realized_cap')) + self.invested_capital_in_profit_rel_to_realized_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'invested_capital_in_profit_rel_to_realized_cap')) + self.net_unrealized_pnl_rel_to_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'net_unrealized_pnl_rel_to_market_cap')) + self.net_unrealized_pnl_rel_to_own_gross_pnl: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'net_unrealized_pnl_rel_to_own_gross_pnl')) + self.net_unrealized_pnl_rel_to_own_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'net_unrealized_pnl_rel_to_own_market_cap')) + self.nupl: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'nupl')) + self.supply_in_loss_rel_to_circulating_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'supply_in_loss_rel_to_circulating_supply')) + self.supply_in_loss_rel_to_own_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'supply_in_loss_rel_to_own_supply')) + self.supply_in_profit_rel_to_circulating_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'supply_in_profit_rel_to_circulating_supply')) + self.supply_in_profit_rel_to_own_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'supply_in_profit_rel_to_own_supply')) + self.supply_rel_to_circulating_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'supply_rel_to_circulating_supply')) + self.unrealized_loss_rel_to_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'unrealized_loss_rel_to_market_cap')) + self.unrealized_loss_rel_to_own_gross_pnl: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'unrealized_loss_rel_to_own_gross_pnl')) + self.unrealized_loss_rel_to_own_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'unrealized_loss_rel_to_own_market_cap')) + self.unrealized_profit_rel_to_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'unrealized_profit_rel_to_market_cap')) + self.unrealized_profit_rel_to_own_gross_pnl: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'unrealized_profit_rel_to_own_gross_pnl')) + self.unrealized_profit_rel_to_own_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'unrealized_profit_rel_to_own_market_cap')) + +class MvrvNegNetRealizedSentSoprValuePattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.mvrv: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'mvrv')) + self.neg_realized_loss: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'neg_realized_loss')) + self.net_realized_pnl: CumulativeHeightPattern[CentsSigned] = CumulativeHeightPattern(client, _m(acc, 'net_realized_pnl')) + self.realized_cap: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_cap')) + self.realized_cap_cents: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_cap_cents')) + self.realized_cap_change_1m: MetricPattern1[CentsSigned] = MetricPattern1(client, _m(acc, 'realized_cap_change_1m')) + self.realized_loss: CumulativeHeightPattern[Cents] = CumulativeHeightPattern(client, _m(acc, 'realized_loss')) + self.realized_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'realized_price')) + self.realized_price_ratio: BpsRatioPattern = BpsRatioPattern(client, _m(acc, 'realized_price_ratio')) + self.realized_profit: CumulativeHeightPattern[Cents] = CumulativeHeightPattern(client, _m(acc, 'realized_profit')) + self.sent_in_loss: BaseCumulativePattern = BaseCumulativePattern(client, _m(acc, 'sent_in_loss')) + self.sent_in_profit: BaseCumulativePattern = BaseCumulativePattern(client, _m(acc, 'sent_in_profit')) + self.sopr: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, _m(acc, 'sopr')) + self.value_created: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_created')) + self.value_created_sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, _m(acc, 'value_created')) + self.value_destroyed: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_destroyed')) + self.value_destroyed_sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, _m(acc, 'value_destroyed')) + class BpsRatioPattern2: """Pattern struct for repeated tree structure.""" @@ -2334,24 +2329,6 @@ class _10y1m1w1y2y3m3y4y5y6m6y8yPattern3: self._6y: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, '6y')) self._8y: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, '8y')) -class InvestedNegNetNuplSupplyUnrealizedPattern: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.invested_capital_in_loss_rel_to_realized_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'invested_capital_in_loss_rel_to_realized_cap')) - self.invested_capital_in_profit_rel_to_realized_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'invested_capital_in_profit_rel_to_realized_cap')) - self.neg_unrealized_loss_rel_to_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'neg_unrealized_loss_rel_to_market_cap')) - self.net_unrealized_pnl_rel_to_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'net_unrealized_pnl_rel_to_market_cap')) - self.nupl: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'nupl')) - self.supply_in_loss_rel_to_circulating_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'supply_in_loss_rel_to_circulating_supply')) - self.supply_in_loss_rel_to_own_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'supply_in_loss_rel_to_own_supply')) - self.supply_in_profit_rel_to_circulating_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'supply_in_profit_rel_to_circulating_supply')) - self.supply_in_profit_rel_to_own_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'supply_in_profit_rel_to_own_supply')) - self.supply_rel_to_circulating_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'supply_rel_to_circulating_supply')) - self.unrealized_loss_rel_to_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'unrealized_loss_rel_to_market_cap')) - self.unrealized_profit_rel_to_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'unrealized_profit_rel_to_market_cap')) - class _1m1w1y24hBaseBpsCumulativeHeightPercentRatioSumPattern: """Pattern struct for repeated tree structure.""" @@ -2403,6 +2380,23 @@ class AverageCumulativeHeightMaxMedianMinPct10Pct25Pct75Pct90SumPattern: self.pct90: _1m1w1y24hPattern[StoredU64] = _1m1w1y24hPattern(client, _m(acc, 'p90')) self.sum: _1m1w1y24hPattern[StoredU64] = _1m1w1y24hPattern(client, _m(acc, 'sum')) +class InvestedNetNuplSupplyUnrealizedPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.invested_capital_in_loss_rel_to_realized_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'invested_capital_in_loss_rel_to_realized_cap')) + self.invested_capital_in_profit_rel_to_realized_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'invested_capital_in_profit_rel_to_realized_cap')) + self.net_unrealized_pnl_rel_to_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'net_unrealized_pnl_rel_to_market_cap')) + self.nupl: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'nupl')) + self.supply_in_loss_rel_to_circulating_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'supply_in_loss_rel_to_circulating_supply')) + self.supply_in_loss_rel_to_own_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'supply_in_loss_rel_to_own_supply')) + self.supply_in_profit_rel_to_circulating_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'supply_in_profit_rel_to_circulating_supply')) + self.supply_in_profit_rel_to_own_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'supply_in_profit_rel_to_own_supply')) + self.supply_rel_to_circulating_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'supply_rel_to_circulating_supply')) + self.unrealized_loss_rel_to_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'unrealized_loss_rel_to_market_cap')) + self.unrealized_profit_rel_to_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'unrealized_profit_rel_to_market_cap')) + class AverageGainsLossesRsiStochPattern: """Pattern struct for repeated tree structure.""" @@ -2449,6 +2443,21 @@ class AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2: self.pct90: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'p90')) self.sum: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'sum')) +class AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.average: _1m1w1y24hPattern[BasisPoints16] = _1m1w1y24hPattern(client, _m(acc, 'average')) + self.height: MetricPattern18[BasisPoints16] = MetricPattern18(client, acc) + self.max: _1m1w1y24hPattern[BasisPoints16] = _1m1w1y24hPattern(client, _m(acc, 'max')) + self.median: _1m1w1y24hPattern[BasisPoints16] = _1m1w1y24hPattern(client, _m(acc, 'median')) + self.min: _1m1w1y24hPattern[BasisPoints16] = _1m1w1y24hPattern(client, _m(acc, 'min')) + self.pct10: _1m1w1y24hPattern[BasisPoints16] = _1m1w1y24hPattern(client, _m(acc, 'p10')) + self.pct25: _1m1w1y24hPattern[BasisPoints16] = _1m1w1y24hPattern(client, _m(acc, 'p25')) + self.pct75: _1m1w1y24hPattern[BasisPoints16] = _1m1w1y24hPattern(client, _m(acc, 'p75')) + self.pct90: _1m1w1y24hPattern[BasisPoints16] = _1m1w1y24hPattern(client, _m(acc, 'p90')) + class AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern: """Pattern struct for repeated tree structure.""" @@ -2464,21 +2473,6 @@ class AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern: self.pct90: _1m1w1y24hPattern[StoredU64] = _1m1w1y24hPattern(client, _m(acc, 'p90')) self.sum: _1m1w1y24hPattern[StoredU64] = _1m1w1y24hPattern(client, _m(acc, 'sum')) -class AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern(Generic[T]): - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.average: _1m1w1y24hPattern[T] = _1m1w1y24hPattern(client, _m(acc, 'average')) - self.height: MetricPattern18[T] = MetricPattern18(client, acc) - self.max: _1m1w1y24hPattern[T] = _1m1w1y24hPattern(client, _m(acc, 'max')) - self.median: _1m1w1y24hPattern[T] = _1m1w1y24hPattern(client, _m(acc, 'median')) - self.min: _1m1w1y24hPattern[T] = _1m1w1y24hPattern(client, _m(acc, 'min')) - self.pct10: _1m1w1y24hPattern[T] = _1m1w1y24hPattern(client, _m(acc, 'p10')) - self.pct25: _1m1w1y24hPattern[T] = _1m1w1y24hPattern(client, _m(acc, 'p25')) - self.pct75: _1m1w1y24hPattern[T] = _1m1w1y24hPattern(client, _m(acc, 'p75')) - self.pct90: _1m1w1y24hPattern[T] = _1m1w1y24hPattern(client, _m(acc, 'p90')) - class _1m1w1y24hBtcCentsSatsUsdPattern: """Pattern struct for repeated tree structure.""" @@ -2542,24 +2536,11 @@ class ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern: self.activity: CoinblocksCoindaysSentPattern = CoinblocksCoindaysSentPattern(client, acc) self.cost_basis: MaxMinPattern = MaxMinPattern(client, _m(acc, 'cost_basis')) self.outputs: UtxoPattern = UtxoPattern(client, _m(acc, 'utxo_count')) - self.realized: GrossMvrvNegNetRealizedSentSoprValuePattern = GrossMvrvNegNetRealizedSentSoprValuePattern(client, acc) - self.relative: InvestedNegNetNuplSupplyUnrealizedPattern = InvestedNegNetNuplSupplyUnrealizedPattern(client, acc) + self.realized: MvrvNegNetRealizedSentSoprValuePattern = MvrvNegNetRealizedSentSoprValuePattern(client, acc) + self.relative: InvestedNetNuplSupplyUnrealizedPattern = InvestedNetNuplSupplyUnrealizedPattern(client, acc) self.supply: ChangeHalvedTotalPattern = ChangeHalvedTotalPattern(client, _m(acc, 'supply')) self.unrealized: GreedGrossInvestedInvestorNegNetPainSupplyUnrealizedPattern = GreedGrossInvestedInvestorNegNetPainSupplyUnrealizedPattern(client, acc) -class GrossNegNetSupplyUnrealizedPattern: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.gross_pnl: CentsUsdPattern = CentsUsdPattern(client, _m(acc, 'unrealized_gross_pnl')) - self.neg_unrealized_loss: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'neg_unrealized_loss')) - self.net_unrealized_pnl: CentsUsdPattern = CentsUsdPattern(client, _m(acc, 'net_unrealized_pnl')) - self.supply_in_loss: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'supply_in_loss')) - self.supply_in_profit: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'supply_in_profit')) - self.unrealized_loss: CentsUsdPattern = CentsUsdPattern(client, _m(acc, 'unrealized_loss')) - self.unrealized_profit: CentsUsdPattern = CentsUsdPattern(client, _m(acc, 'unrealized_profit')) - class MvrvRealizedPattern: """Pattern struct for repeated tree structure.""" @@ -2573,18 +2554,6 @@ class MvrvRealizedPattern: self.realized_price_ratio: BpsRatioPattern = BpsRatioPattern(client, _m(acc, 'realized_price_ratio')) self.realized_profit: CumulativeHeightPattern[Cents] = CumulativeHeightPattern(client, _m(acc, 'realized_profit')) -class _1m1w1y24hBaseCumulativePattern: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self._1m: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2 = AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, _m(acc, '1m')) - self._1w: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2 = AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, _m(acc, '1w')) - self._1y: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2 = AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, _m(acc, '1y')) - self._24h: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2 = AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, _m(acc, '24h')) - self.base: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, acc) - self.cumulative: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'cumulative')) - class ActivityOutputsRealizedRelativeSupplyUnrealizedPattern2: """Pattern struct for repeated tree structure.""" @@ -2592,10 +2561,10 @@ class ActivityOutputsRealizedRelativeSupplyUnrealizedPattern2: """Create pattern node with accumulated metric name.""" self.activity: SentPattern = SentPattern(client, _m(acc, 'sent')) self.outputs: UtxoPattern = UtxoPattern(client, _m(acc, 'utxo_count')) - self.realized: GrossMvrvNegNetRealizedSentSoprValuePattern = GrossMvrvNegNetRealizedSentSoprValuePattern(client, acc) + self.realized: MvrvNegNetRealizedSentSoprValuePattern = MvrvNegNetRealizedSentSoprValuePattern(client, acc) self.relative: SupplyPattern3 = SupplyPattern3(client, _m(acc, 'supply')) self.supply: ChangeHalvedTotalPattern = ChangeHalvedTotalPattern(client, _m(acc, 'supply')) - self.unrealized: GrossNegNetSupplyUnrealizedPattern = GrossNegNetSupplyUnrealizedPattern(client, acc) + self.unrealized: NegNetSupplyUnrealizedPattern = NegNetSupplyUnrealizedPattern(client, acc) class ActivityOutputsRealizedRelativeSupplyUnrealizedPattern: """Pattern struct for repeated tree structure.""" @@ -2609,17 +2578,17 @@ class ActivityOutputsRealizedRelativeSupplyUnrealizedPattern: self.supply: ChangeHalvedTotalPattern = ChangeHalvedTotalPattern(client, _m(acc, 'supply')) self.unrealized: SupplyPattern2 = SupplyPattern2(client, _m(acc, 'supply_in')) -class BalanceBothReactivatedReceivingSendingPattern: +class NegNetSupplyUnrealizedPattern: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.balance_decreased: AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern[StoredU32] = AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, _m(acc, 'balance_decreased')) - self.balance_increased: AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern[StoredU32] = AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, _m(acc, 'balance_increased')) - self.both: AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern[StoredU32] = AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, _m(acc, 'both')) - self.reactivated: AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern[StoredU32] = AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, _m(acc, 'reactivated')) - self.receiving: AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern[StoredU32] = AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, _m(acc, 'receiving')) - self.sending: AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern[StoredU32] = AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, _m(acc, 'sending')) + self.neg_unrealized_loss: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'neg_unrealized_loss')) + self.net_unrealized_pnl: CentsUsdPattern = CentsUsdPattern(client, _m(acc, 'net_unrealized_pnl')) + self.supply_in_loss: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'supply_in_loss')) + self.supply_in_profit: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'supply_in_profit')) + self.unrealized_loss: CentsUsdPattern = CentsUsdPattern(client, _m(acc, 'unrealized_loss')) + self.unrealized_profit: CentsUsdPattern = CentsUsdPattern(client, _m(acc, 'unrealized_profit')) class BaseBtcCentsSatsUsdPattern: """Pattern struct for repeated tree structure.""" @@ -2654,6 +2623,17 @@ class SupplyPattern3: self.supply_in_profit_rel_to_own_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'in_profit_rel_to_own_supply')) self.supply_rel_to_circulating_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'rel_to_circulating_supply')) +class _1m1w1y24hHeightPattern(Generic[T]): + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self._1m: MetricPattern1[T] = MetricPattern1(client, _m(acc, 'average_1m')) + self._1w: MetricPattern1[T] = MetricPattern1(client, _m(acc, 'average_1w')) + self._1y: MetricPattern1[T] = MetricPattern1(client, _m(acc, 'average_1y')) + self._24h: MetricPattern1[T] = MetricPattern1(client, _m(acc, 'average_24h')) + self.height: MetricPattern18[T] = MetricPattern18(client, acc) + class _1m1w1y24hPattern6: """Pattern struct for repeated tree structure.""" @@ -2684,6 +2664,16 @@ class _1m1w1y24hPattern5: self._1y: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, '1y')) self._24h: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, '24h')) +class BothReactivatedReceivingSendingPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.both: _1m1w1y24hHeightPattern[StoredU32] = _1m1w1y24hHeightPattern(client, _m(acc, 'both')) + self.reactivated: _1m1w1y24hHeightPattern[StoredU32] = _1m1w1y24hHeightPattern(client, _m(acc, 'reactivated')) + self.receiving: _1m1w1y24hHeightPattern[StoredU32] = _1m1w1y24hHeightPattern(client, _m(acc, 'receiving')) + self.sending: _1m1w1y24hHeightPattern[StoredU32] = _1m1w1y24hHeightPattern(client, _m(acc, 'sending')) + class BtcCentsSatsUsdPattern: """Pattern struct for repeated tree structure.""" @@ -2743,12 +2733,12 @@ class BaseCumulativeSumPattern: self.cumulative: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'cumulative')) self.sum: _1m1w1y24hPattern5 = _1m1w1y24hPattern5(client, _m(acc, 'sum')) -class BpsPercentRatioPattern2: +class BpsPercentRatioPattern3: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.bps: AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern[BasisPoints16] = AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, _m(acc, 'bps')) + self.bps: AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern = AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, _m(acc, 'bps')) self.percent: MetricPattern1[StoredF32] = MetricPattern1(client, acc) self.ratio: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'ratio')) @@ -3045,6 +3035,14 @@ class MetricsTree_Blocks_Size: self.pct75: _1m1w1y24hPattern[StoredU64] = _1m1w1y24hPattern(client, 'block_size_p75') self.pct90: _1m1w1y24hPattern[StoredU64] = _1m1w1y24hPattern(client, 'block_size_p90') +class MetricsTree_Blocks_Fullness: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.bps: _1m1w1y24hHeightPattern[BasisPoints16] = _1m1w1y24hHeightPattern(client, 'block_fullness_bps') + self.ratio: MetricPattern1[StoredF32] = MetricPattern1(client, 'block_fullness_ratio') + self.percent: MetricPattern1[StoredF32] = MetricPattern1(client, 'block_fullness') + class MetricsTree_Blocks: """Metrics tree node.""" @@ -3055,11 +3053,11 @@ class MetricsTree_Blocks: self.total_size: MetricPattern18[StoredU64] = MetricPattern18(client, 'total_size') self.weight: MetricsTree_Blocks_Weight = MetricsTree_Blocks_Weight(client) self.count: MetricsTree_Blocks_Count = MetricsTree_Blocks_Count(client) - self.interval: AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern[Timestamp] = AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, 'block_interval') + self.interval: _1m1w1y24hHeightPattern[Timestamp] = _1m1w1y24hHeightPattern(client, 'block_interval') self.halving: MetricsTree_Blocks_Halving = MetricsTree_Blocks_Halving(client) self.vbytes: AverageCumulativeHeightMaxMedianMinPct10Pct25Pct75Pct90SumPattern = AverageCumulativeHeightMaxMedianMinPct10Pct25Pct75Pct90SumPattern(client, 'block_vbytes') self.size: MetricsTree_Blocks_Size = MetricsTree_Blocks_Size(client) - self.fullness: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, 'block_fullness') + self.fullness: MetricsTree_Blocks_Fullness = MetricsTree_Blocks_Fullness(client) class MetricsTree_Transactions_Count: """Metrics tree node.""" @@ -3210,7 +3208,7 @@ class MetricsTree_Scripts_Value: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.opreturn: _1m1w1y24hBaseCumulativePattern = _1m1w1y24hBaseCumulativePattern(client, 'opreturn_value') + self.opreturn: BaseCumulativePattern = BaseCumulativePattern(client, 'opreturn_value') class MetricsTree_Scripts_Adoption: """Metrics tree node.""" @@ -3235,13 +3233,24 @@ class MetricsTree_Scripts: self.value: MetricsTree_Scripts_Value = MetricsTree_Scripts_Value(client) self.adoption: MetricsTree_Scripts_Adoption = MetricsTree_Scripts_Adoption(client) +class MetricsTree_Mining_Rewards_Fees: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.base: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'fees') + self.cumulative: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'fees_cumulative') + self._24h: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2 = AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, 'fees_24h') + self._1w: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2 = AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, 'fees_1w') + self._1m: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2 = AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, 'fees_1m') + self._1y: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2 = AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, 'fees_1y') + class MetricsTree_Mining_Rewards: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.coinbase: _1m1w1y24hBaseCumulativePattern = _1m1w1y24hBaseCumulativePattern(client, 'coinbase') - self.subsidy: _1m1w1y24hBaseCumulativePattern = _1m1w1y24hBaseCumulativePattern(client, 'subsidy') - self.fees: _1m1w1y24hBaseCumulativePattern = _1m1w1y24hBaseCumulativePattern(client, 'fees') + self.coinbase: BaseCumulativeSumPattern = BaseCumulativeSumPattern(client, 'coinbase') + self.subsidy: BaseCumulativePattern = BaseCumulativePattern(client, 'subsidy') + self.fees: MetricsTree_Mining_Rewards_Fees = MetricsTree_Mining_Rewards_Fees(client) self.unclaimed_rewards: BaseCumulativeSumPattern = BaseCumulativeSumPattern(client, 'unclaimed_rewards') self.fee_dominance: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'fee_dominance') self.fee_dominance_rolling: _1m1w1y24hPattern2 = _1m1w1y24hPattern2(client, 'fee_dominance') @@ -4251,7 +4260,6 @@ class MetricsTree_Distribution_UtxoCohorts_All_Relative: self.unrealized_profit_rel_to_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'unrealized_profit_rel_to_market_cap') self.unrealized_loss_rel_to_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'unrealized_loss_rel_to_market_cap') self.net_unrealized_pnl_rel_to_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'net_unrealized_pnl_rel_to_market_cap') - self.neg_unrealized_loss_rel_to_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'neg_unrealized_loss_rel_to_market_cap') self.nupl: MetricPattern1[StoredF32] = MetricPattern1(client, 'nupl') self.invested_capital_in_profit_rel_to_realized_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'invested_capital_in_profit_rel_to_realized_cap') self.invested_capital_in_loss_rel_to_realized_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'invested_capital_in_loss_rel_to_realized_cap') @@ -4259,7 +4267,6 @@ class MetricsTree_Distribution_UtxoCohorts_All_Relative: self.supply_in_loss_rel_to_own_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'supply_in_loss_rel_to_own_supply') self.unrealized_profit_rel_to_own_gross_pnl: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'unrealized_profit_rel_to_own_gross_pnl') self.unrealized_loss_rel_to_own_gross_pnl: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'unrealized_loss_rel_to_own_gross_pnl') - self.neg_unrealized_loss_rel_to_own_gross_pnl: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'neg_unrealized_loss_rel_to_own_gross_pnl') self.net_unrealized_pnl_rel_to_own_gross_pnl: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'net_unrealized_pnl_rel_to_own_gross_pnl') class MetricsTree_Distribution_UtxoCohorts_All: @@ -4287,7 +4294,7 @@ class MetricsTree_Distribution_UtxoCohorts_Sth: self.realized: CapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprUpperValuePattern = CapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprUpperValuePattern(client, 'sth') self.cost_basis: InvestedMaxMinPercentilesPattern = InvestedMaxMinPercentilesPattern(client, 'sth') self.unrealized: GreedGrossInvestedInvestorNegNetPainSupplyUnrealizedPattern = GreedGrossInvestedInvestorNegNetPainSupplyUnrealizedPattern(client, 'sth') - self.relative: InvestedNegNetNuplSupplyUnrealizedPattern3 = InvestedNegNetNuplSupplyUnrealizedPattern3(client, 'sth') + self.relative: InvestedNetNuplSupplyUnrealizedPattern3 = InvestedNetNuplSupplyUnrealizedPattern3(client, 'sth') self.dormancy: MetricPattern1[StoredF32] = MetricPattern1(client, 'sth_dormancy') self.velocity: MetricPattern1[StoredF32] = MetricPattern1(client, 'sth_velocity') self.adjusted_value_created: MetricPattern1[Cents] = MetricPattern1(client, 'sth_adjusted_value_created') @@ -4307,7 +4314,7 @@ class MetricsTree_Distribution_UtxoCohorts_Lth: self.realized: CapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprUpperValuePattern = CapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprUpperValuePattern(client, 'lth') self.cost_basis: InvestedMaxMinPercentilesPattern = InvestedMaxMinPercentilesPattern(client, 'lth') self.unrealized: GreedGrossInvestedInvestorNegNetPainSupplyUnrealizedPattern = GreedGrossInvestedInvestorNegNetPainSupplyUnrealizedPattern(client, 'lth') - self.relative: InvestedNegNetNuplSupplyUnrealizedPattern3 = InvestedNegNetNuplSupplyUnrealizedPattern3(client, 'lth') + self.relative: InvestedNetNuplSupplyUnrealizedPattern3 = InvestedNetNuplSupplyUnrealizedPattern3(client, 'lth') self.dormancy: MetricPattern1[StoredF32] = MetricPattern1(client, 'lth_dormancy') self.velocity: MetricPattern1[StoredF32] = MetricPattern1(client, 'lth_velocity') @@ -4573,15 +4580,15 @@ class MetricsTree_Distribution_AddressActivity: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.all: BalanceBothReactivatedReceivingSendingPattern = BalanceBothReactivatedReceivingSendingPattern(client, 'address_activity') - self.p2pk65: BalanceBothReactivatedReceivingSendingPattern = BalanceBothReactivatedReceivingSendingPattern(client, 'p2pk65_address_activity') - self.p2pk33: BalanceBothReactivatedReceivingSendingPattern = BalanceBothReactivatedReceivingSendingPattern(client, 'p2pk33_address_activity') - self.p2pkh: BalanceBothReactivatedReceivingSendingPattern = BalanceBothReactivatedReceivingSendingPattern(client, 'p2pkh_address_activity') - self.p2sh: BalanceBothReactivatedReceivingSendingPattern = BalanceBothReactivatedReceivingSendingPattern(client, 'p2sh_address_activity') - self.p2wpkh: BalanceBothReactivatedReceivingSendingPattern = BalanceBothReactivatedReceivingSendingPattern(client, 'p2wpkh_address_activity') - self.p2wsh: BalanceBothReactivatedReceivingSendingPattern = BalanceBothReactivatedReceivingSendingPattern(client, 'p2wsh_address_activity') - self.p2tr: BalanceBothReactivatedReceivingSendingPattern = BalanceBothReactivatedReceivingSendingPattern(client, 'p2tr_address_activity') - self.p2a: BalanceBothReactivatedReceivingSendingPattern = BalanceBothReactivatedReceivingSendingPattern(client, 'p2a_address_activity') + self.all: BothReactivatedReceivingSendingPattern = BothReactivatedReceivingSendingPattern(client, 'address_activity') + self.p2pk65: BothReactivatedReceivingSendingPattern = BothReactivatedReceivingSendingPattern(client, 'p2pk65_address_activity') + self.p2pk33: BothReactivatedReceivingSendingPattern = BothReactivatedReceivingSendingPattern(client, 'p2pk33_address_activity') + self.p2pkh: BothReactivatedReceivingSendingPattern = BothReactivatedReceivingSendingPattern(client, 'p2pkh_address_activity') + self.p2sh: BothReactivatedReceivingSendingPattern = BothReactivatedReceivingSendingPattern(client, 'p2sh_address_activity') + self.p2wpkh: BothReactivatedReceivingSendingPattern = BothReactivatedReceivingSendingPattern(client, 'p2wpkh_address_activity') + self.p2wsh: BothReactivatedReceivingSendingPattern = BothReactivatedReceivingSendingPattern(client, 'p2wsh_address_activity') + self.p2tr: BothReactivatedReceivingSendingPattern = BothReactivatedReceivingSendingPattern(client, 'p2tr_address_activity') + self.p2a: BothReactivatedReceivingSendingPattern = BothReactivatedReceivingSendingPattern(client, 'p2a_address_activity') class MetricsTree_Distribution_TotalAddrCount: """Metrics tree node.""" @@ -4615,15 +4622,15 @@ class MetricsTree_Distribution_GrowthRate: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.all: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, 'growth_rate') - self.p2pk65: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, 'p2pk65_growth_rate') - self.p2pk33: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, 'p2pk33_growth_rate') - self.p2pkh: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, 'p2pkh_growth_rate') - self.p2sh: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, 'p2sh_growth_rate') - self.p2wpkh: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, 'p2wpkh_growth_rate') - self.p2wsh: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, 'p2wsh_growth_rate') - self.p2tr: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, 'p2tr_growth_rate') - self.p2a: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, 'p2a_growth_rate') + self.all: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'growth_rate') + self.p2pk65: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'p2pk65_growth_rate') + self.p2pk33: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'p2pk33_growth_rate') + self.p2pkh: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'p2pkh_growth_rate') + self.p2sh: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'p2sh_growth_rate') + self.p2wpkh: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'p2wpkh_growth_rate') + self.p2wsh: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'p2wsh_growth_rate') + self.p2tr: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'p2tr_growth_rate') + self.p2a: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'p2a_growth_rate') class MetricsTree_Distribution: """Metrics tree node."""