From c2135a706605beb4ea2249d8ebd3ebcff7c1411a Mon Sep 17 00:00:00 2001 From: nym21 Date: Thu, 12 Mar 2026 13:46:13 +0100 Subject: [PATCH] global: snapshot --- Cargo.lock | 17 +- crates/brk_client/src/lib.rs | 845 ++++++++++-------- crates/brk_cohort/src/age_range.rs | 48 +- crates/brk_cohort/src/amount_range.rs | 80 +- crates/brk_computer/Cargo.toml | 1 - .../src/distribution/address/address_count.rs | 40 +- .../src/distribution/address/delta.rs | 12 +- .../src/distribution/address/mod.rs | 10 +- ...new_addr_count.rs => new_address_count.rs} | 16 +- ...l_addr_count.rs => total_address_count.rs} | 24 +- .../src/distribution/block/cohort/received.rs | 12 +- .../src/distribution/block/cohort/sent.rs | 10 +- .../distribution/cohorts/address/groups.rs | 4 +- .../src/distribution/cohorts/address/vecs.rs | 30 +- .../src/distribution/cohorts/utxo/groups.rs | 18 +- .../src/distribution/cohorts/utxo/receive.rs | 6 +- .../distribution/cohorts/utxo/tick_tock.rs | 2 +- .../src/distribution/compute/block_loop.rs | 26 +- .../src/distribution/metrics/cohort/all.rs | 8 +- .../metrics/cohort/extended_adjusted.rs | 8 +- .../distribution/metrics/realized/adjusted.rs | 20 +- .../src/distribution/metrics/realized/full.rs | 14 +- .../relative/extended_own_market_cap.rs | 30 +- .../src/distribution/metrics/relative/full.rs | 38 +- .../distribution/metrics/relative/to_all.rs | 24 +- .../src/distribution/metrics/supply/base.rs | 8 +- .../metrics/unrealized/minimal.rs | 47 + .../src/distribution/state/cohort/address.rs | 20 +- crates/brk_computer/src/distribution/vecs.rs | 34 +- .../src/indexes/cached_mappings.rs | 48 + crates/brk_computer/src/indexes/mod.rs | 86 +- .../per_block/computed/resolutions.rs | 134 +-- .../src/internal/per_block/price.rs | 2 +- .../internal/per_block/ratio/percentiles.rs | 18 +- .../src/internal/per_block/stddev/extended.rs | 2 +- crates/brk_server/Cargo.toml | 2 +- crates/brk_traversable/src/lib.rs | 9 +- crates/brk_types/src/index.rs | 2 +- crates/brk_types/src/treenode.rs | 85 +- modules/brk-client/index.js | 824 +++++++++-------- packages/brk_client/brk_client/__init__.py | 521 ++++++----- 41 files changed, 1788 insertions(+), 1397 deletions(-) rename crates/brk_computer/src/distribution/address/{new_addr_count.rs => new_address_count.rs} (79%) rename crates/brk_computer/src/distribution/address/{total_addr_count.rs => total_address_count.rs} (74%) create mode 100644 crates/brk_computer/src/distribution/metrics/unrealized/minimal.rs create mode 100644 crates/brk_computer/src/indexes/cached_mappings.rs diff --git a/Cargo.lock b/Cargo.lock index 0cc2c0555..32e9a2050 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -468,7 +468,6 @@ dependencies = [ "brk_types", "color-eyre", "derive_more", - "pco", "rayon", "rustc-hash", "schemars", @@ -1131,7 +1130,7 @@ dependencies = [ "libc", "option-ext", "redox_users", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -1209,7 +1208,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] @@ -1872,7 +1871,7 @@ dependencies = [ "portable-atomic", "portable-atomic-util", "serde_core", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] @@ -2392,9 +2391,9 @@ dependencies = [ [[package]] name = "quick_cache" -version = "0.6.18" +version = "0.6.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ada44a88ef953a3294f6eb55d2007ba44646015e18613d2f213016379203ef3" +checksum = "530e84778a55de0f52645a51d4e3b9554978acd6a1e7cd50b6a6784692b3029e" dependencies = [ "ahash", "equivalent", @@ -2634,7 +2633,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] @@ -2993,7 +2992,7 @@ dependencies = [ "getrandom 0.4.2", "once_cell", "rustix", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] @@ -3484,7 +3483,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] diff --git a/crates/brk_client/src/lib.rs b/crates/brk_client/src/lib.rs index 8baa5a540..923665bad 100644 --- a/crates/brk_client/src/lib.rs +++ b/crates/brk_client/src/lib.rs @@ -1013,18 +1013,18 @@ impl _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern { pub fn new(client: Arc, acc: String) -> Self { Self { _0sd: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "0sd_4y")), - m0_5sd: PriceValuePattern::new(client.clone(), _m(&acc, "m0_5sd_4y")), - m1_5sd: PriceValuePattern::new(client.clone(), _m(&acc, "m1_5sd_4y")), - m1sd: PriceValuePattern::new(client.clone(), _m(&acc, "m1sd_4y")), - m2_5sd: PriceValuePattern::new(client.clone(), _m(&acc, "m2_5sd_4y")), - m2sd: PriceValuePattern::new(client.clone(), _m(&acc, "m2sd_4y")), - m3sd: PriceValuePattern::new(client.clone(), _m(&acc, "m3sd_4y")), - p0_5sd: PriceValuePattern::new(client.clone(), _m(&acc, "p0_5sd_4y")), - p1_5sd: PriceValuePattern::new(client.clone(), _m(&acc, "p1_5sd_4y")), - p1sd: PriceValuePattern::new(client.clone(), _m(&acc, "p1sd_4y")), - p2_5sd: PriceValuePattern::new(client.clone(), _m(&acc, "p2_5sd_4y")), - p2sd: PriceValuePattern::new(client.clone(), _m(&acc, "p2sd_4y")), - p3sd: PriceValuePattern::new(client.clone(), _m(&acc, "p3sd_4y")), + m0_5sd: PriceValuePattern::new(client.clone(), acc.clone()), + m1_5sd: PriceValuePattern::new(client.clone(), acc.clone()), + m1sd: PriceValuePattern::new(client.clone(), acc.clone()), + m2_5sd: PriceValuePattern::new(client.clone(), acc.clone()), + m2sd: PriceValuePattern::new(client.clone(), acc.clone()), + m3sd: PriceValuePattern::new(client.clone(), acc.clone()), + p0_5sd: PriceValuePattern::new(client.clone(), acc.clone()), + p1_5sd: PriceValuePattern::new(client.clone(), acc.clone()), + p1sd: PriceValuePattern::new(client.clone(), acc.clone()), + p2_5sd: PriceValuePattern::new(client.clone(), acc.clone()), + p2sd: PriceValuePattern::new(client.clone(), acc.clone()), + p3sd: PriceValuePattern::new(client.clone(), acc.clone()), sd: MetricPattern1::new(client.clone(), _m(&acc, "sd_4y")), zscore: MetricPattern1::new(client.clone(), _m(&acc, "zscore_4y")), } @@ -1375,12 +1375,12 @@ impl BpsCentsPercentilesRatioSatsSmaStdUsdPattern { Self { bps: MetricPattern1::new(client.clone(), _m(&acc, "ratio_bps")), cents: MetricPattern1::new(client.clone(), _m(&acc, "cents")), - percentiles: Pct1Pct2Pct5Pct95Pct98Pct99Pattern::new(client.clone(), _m(&acc, "ratio")), + percentiles: Pct1Pct2Pct5Pct95Pct98Pct99Pattern::new(client.clone(), acc.clone()), ratio: MetricPattern1::new(client.clone(), _m(&acc, "ratio")), sats: MetricPattern1::new(client.clone(), _m(&acc, "sats")), sma: _1m1w1y2y4yAllPattern::new(client.clone(), _m(&acc, "ratio_sma")), std_dev: _1y2y4yAllPattern::new(client.clone(), _m(&acc, "ratio")), - usd: MetricPattern1::new(client.clone(), _m(&acc, "usd")), + usd: MetricPattern1::new(client.clone(), acc.clone()), } } } @@ -1421,8 +1421,8 @@ pub struct CapitulationCumulativeNegativeRawRelSumValuePattern { pub raw: CentsUsdPattern, pub rel_to_rcap: BpsPercentRatioPattern, pub sum: _1m1w1y24hPattern5, - pub value_created: BaseSumPattern, - pub value_destroyed: BaseSumPattern, + pub value_created: RawSumPattern, + pub value_destroyed: RawSumPattern, } impl CapitulationCumulativeNegativeRawRelSumValuePattern { @@ -1433,10 +1433,10 @@ impl CapitulationCumulativeNegativeRawRelSumValuePattern { cumulative: MetricPattern1::new(client.clone(), _m(&acc, "realized_loss_cumulative")), negative: MetricPattern1::new(client.clone(), _m(&acc, "neg_realized_loss")), raw: CentsUsdPattern::new(client.clone(), _m(&acc, "realized_loss")), - rel_to_rcap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "realized_loss_rel_to_realized_cap")), + rel_to_rcap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "realized_loss_rel_to_rcap")), sum: _1m1w1y24hPattern5::new(client.clone(), _m(&acc, "realized_loss")), - value_created: BaseSumPattern::new(client.clone(), _m(&acc, "loss_value_created")), - value_destroyed: BaseSumPattern::new(client.clone(), _m(&acc, "loss_value_destroyed")), + value_created: RawSumPattern::new(client.clone(), _m(&acc, "loss_value_created")), + value_destroyed: RawSumPattern::new(client.clone(), _m(&acc, "loss_value_destroyed")), } } } @@ -1554,8 +1554,8 @@ pub struct CumulativeDistributionRawRelSumValuePattern { pub raw: CentsUsdPattern, pub rel_to_rcap: BpsPercentRatioPattern, pub sum: _1m1w1y24hPattern5, - pub value_created: BaseSumPattern, - pub value_destroyed: BaseSumPattern, + pub value_created: RawSumPattern, + pub value_destroyed: RawSumPattern, } impl CumulativeDistributionRawRelSumValuePattern { @@ -1565,10 +1565,10 @@ impl CumulativeDistributionRawRelSumValuePattern { cumulative: MetricPattern1::new(client.clone(), _m(&acc, "realized_profit_cumulative")), distribution_flow: MetricPattern1::new(client.clone(), _m(&acc, "profit_flow")), raw: CentsUsdPattern::new(client.clone(), _m(&acc, "realized_profit")), - rel_to_rcap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "realized_profit_rel_to_realized_cap")), + rel_to_rcap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "realized_profit_rel_to_rcap")), sum: _1m1w1y24hPattern5::new(client.clone(), _m(&acc, "realized_profit")), - value_created: BaseSumPattern::new(client.clone(), _m(&acc, "profit_value_created")), - value_destroyed: BaseSumPattern::new(client.clone(), _m(&acc, "profit_value_destroyed")), + value_created: RawSumPattern::new(client.clone(), _m(&acc, "profit_value_created")), + value_destroyed: RawSumPattern::new(client.clone(), _m(&acc, "profit_value_destroyed")), } } } @@ -1639,10 +1639,10 @@ impl BpsCentsPercentilesRatioSatsUsdPattern { Self { bps: MetricPattern1::new(client.clone(), _m(&acc, "ratio_bps")), cents: MetricPattern1::new(client.clone(), _m(&acc, "cents")), - percentiles: Pct1Pct2Pct5Pct95Pct98Pct99Pattern::new(client.clone(), _m(&acc, "ratio")), + percentiles: Pct1Pct2Pct5Pct95Pct98Pct99Pattern::new(client.clone(), acc.clone()), ratio: MetricPattern1::new(client.clone(), _m(&acc, "ratio")), sats: MetricPattern1::new(client.clone(), _m(&acc, "sats")), - usd: MetricPattern1::new(client.clone(), _m(&acc, "usd")), + usd: MetricPattern1::new(client.clone(), acc.clone()), } } } @@ -1652,7 +1652,7 @@ pub struct BtcCentsRelSatsUsdPattern3 { pub btc: MetricPattern1, pub cents: MetricPattern1, pub rel_to_circulating: BpsPercentRatioPattern, - pub rel_to_own_supply: BpsPercentRatioPattern, + pub rel_to_own: BpsPercentRatioPattern, pub sats: MetricPattern1, pub usd: MetricPattern1, } @@ -1663,8 +1663,8 @@ impl BtcCentsRelSatsUsdPattern3 { Self { btc: MetricPattern1::new(client.clone(), acc.clone()), cents: MetricPattern1::new(client.clone(), _m(&acc, "cents")), - rel_to_circulating: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "rel_to_circulating_supply")), - rel_to_own_supply: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "rel_to_own_supply")), + rel_to_circulating: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "rel_to_circulating")), + rel_to_own: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "rel_to_own")), sats: MetricPattern1::new(client.clone(), _m(&acc, "sats")), usd: MetricPattern1::new(client.clone(), _m(&acc, "usd")), } @@ -1689,55 +1689,55 @@ impl ChangeCumulativeDeltaRawRelSumPattern { cumulative: MetricPattern1::new(client.clone(), _m(&acc, "realized_pnl_cumulative")), delta: ChangeRatePattern4::new(client.clone(), _m(&acc, "pnl_delta")), raw: MetricPattern1::new(client.clone(), _m(&acc, "realized_pnl")), - rel_to_rcap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "realized_pnl_rel_to_realized_cap")), + rel_to_rcap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "realized_pnl_rel_to_rcap")), sum: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "realized_pnl")), } } } /// Pattern struct for repeated tree structure. -pub struct DeltaHalvedInRelTotalPattern2 { +pub struct DeltaHalfInRelTotalPattern2 { pub delta: ChangeRatePattern, - pub halved: BtcCentsSatsUsdPattern, + pub half: BtcCentsSatsUsdPattern, pub in_loss: BtcCentsRelSatsUsdPattern3, pub in_profit: BtcCentsRelSatsUsdPattern3, pub rel_to_circulating: BpsPercentRatioPattern, pub total: BtcCentsSatsUsdPattern, } -impl DeltaHalvedInRelTotalPattern2 { +impl DeltaHalfInRelTotalPattern2 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { delta: ChangeRatePattern::new(client.clone(), _m(&acc, "delta")), - halved: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "halved")), + half: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "half")), in_loss: BtcCentsRelSatsUsdPattern3::new(client.clone(), _m(&acc, "in_loss")), in_profit: BtcCentsRelSatsUsdPattern3::new(client.clone(), _m(&acc, "in_profit")), - rel_to_circulating: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "rel_to_circulating_supply")), + rel_to_circulating: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "rel_to_circulating")), total: BtcCentsSatsUsdPattern::new(client.clone(), acc.clone()), } } } /// Pattern struct for repeated tree structure. -pub struct DeltaHalvedInRelTotalPattern { +pub struct DeltaHalfInRelTotalPattern { pub delta: ChangeRatePattern2, - pub halved: BtcCentsSatsUsdPattern, + pub half: BtcCentsSatsUsdPattern, pub in_loss: BtcCentsRelSatsUsdPattern, pub in_profit: BtcCentsRelSatsUsdPattern, pub rel_to_circulating: BpsPercentRatioPattern, pub total: BtcCentsSatsUsdPattern, } -impl DeltaHalvedInRelTotalPattern { +impl DeltaHalfInRelTotalPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { delta: ChangeRatePattern2::new(client.clone(), _m(&acc, "delta")), - halved: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "halved")), + half: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "half")), in_loss: BtcCentsRelSatsUsdPattern::new(client.clone(), _m(&acc, "in_loss")), in_profit: BtcCentsRelSatsUsdPattern::new(client.clone(), _m(&acc, "in_profit")), - rel_to_circulating: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "rel_to_circulating_supply")), + rel_to_circulating: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "rel_to_circulating")), total: BtcCentsSatsUsdPattern::new(client.clone(), acc.clone()), } } @@ -1747,9 +1747,9 @@ impl DeltaHalvedInRelTotalPattern { pub struct NegativeRawRelSumPattern2 { pub negative: MetricPattern1, pub raw: CentsUsdPattern, - pub rel_to_market_cap: BpsPercentRatioPattern, + pub rel_to_mcap: BpsPercentRatioPattern, pub rel_to_own_gross: BpsPercentRatioPattern, - pub rel_to_own_market_cap: BpsPercentRatioPattern, + pub rel_to_own_mcap: BpsPercentRatioPattern, pub sum: _24hPattern, } @@ -1759,9 +1759,9 @@ impl NegativeRawRelSumPattern2 { Self { negative: MetricPattern1::new(client.clone(), _m(&acc, "neg_unrealized_loss")), raw: CentsUsdPattern::new(client.clone(), _m(&acc, "unrealized_loss")), - rel_to_market_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "unrealized_loss_rel_to_market_cap")), + rel_to_mcap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "unrealized_loss_rel_to_mcap")), rel_to_own_gross: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "unrealized_loss_rel_to_own_gross_pnl")), - rel_to_own_market_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "unrealized_loss_rel_to_own_market_cap")), + rel_to_own_mcap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "unrealized_loss_rel_to_own_mcap")), sum: _24hPattern::new(client.clone(), _m(&acc, "unrealized_loss_24h")), } } @@ -1781,12 +1781,12 @@ impl Pct1Pct2Pct5Pct95Pct98Pct99Pattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - pct1: BpsPriceRatioPattern::new(client.clone(), _m(&acc, "pct1")), - pct2: BpsPriceRatioPattern::new(client.clone(), _m(&acc, "pct2")), - pct5: BpsPriceRatioPattern::new(client.clone(), _m(&acc, "pct5")), - pct95: BpsPriceRatioPattern::new(client.clone(), _m(&acc, "pct95")), - pct98: BpsPriceRatioPattern::new(client.clone(), _m(&acc, "pct98")), - pct99: BpsPriceRatioPattern::new(client.clone(), _m(&acc, "pct99")), + pct1: BpsPriceRatioPattern::new(client.clone(), acc.clone()), + pct2: BpsPriceRatioPattern::new(client.clone(), acc.clone()), + pct5: BpsPriceRatioPattern::new(client.clone(), acc.clone()), + pct95: BpsPriceRatioPattern::new(client.clone(), acc.clone()), + pct98: BpsPriceRatioPattern::new(client.clone(), acc.clone()), + pct99: BpsPriceRatioPattern::new(client.clone(), acc.clone()), } } } @@ -1796,7 +1796,7 @@ pub struct ActivityOutputsRealizedSupplyUnrealizedPattern { pub activity: CoindaysSentPattern, pub outputs: UnspentPattern2, pub realized: CapLossMvrvNetNuplPriceProfitSoprPattern, - pub supply: DeltaHalvedInRelTotalPattern, + pub supply: DeltaHalfInRelTotalPattern, pub unrealized: InvestedInvestorLossNetProfitPattern, } @@ -1807,7 +1807,7 @@ impl ActivityOutputsRealizedSupplyUnrealizedPattern { activity: CoindaysSentPattern::new(client.clone(), acc.clone()), outputs: UnspentPattern2::new(client.clone(), _m(&acc, "utxo_count")), realized: CapLossMvrvNetNuplPriceProfitSoprPattern::new(client.clone(), acc.clone()), - supply: DeltaHalvedInRelTotalPattern::new(client.clone(), _m(&acc, "supply")), + supply: DeltaHalfInRelTotalPattern::new(client.clone(), _m(&acc, "supply")), unrealized: InvestedInvestorLossNetProfitPattern::new(client.clone(), acc.clone()), } } @@ -1818,7 +1818,7 @@ pub struct ActivityOutputsRealizedSupplyUnrealizedPattern2 { pub activity: CoindaysSentPattern, pub outputs: UnspentPattern2, pub realized: CapLossMvrvNetNuplPriceProfitSoprPattern, - pub supply: DeltaHalvedInRelTotalPattern, + pub supply: DeltaHalfInRelTotalPattern, pub unrealized: LossNetProfitPattern, } @@ -1829,7 +1829,7 @@ impl ActivityOutputsRealizedSupplyUnrealizedPattern2 { activity: CoindaysSentPattern::new(client.clone(), acc.clone()), outputs: UnspentPattern2::new(client.clone(), _m(&acc, "utxo_count")), realized: CapLossMvrvNetNuplPriceProfitSoprPattern::new(client.clone(), acc.clone()), - supply: DeltaHalvedInRelTotalPattern::new(client.clone(), _m(&acc, "supply")), + supply: DeltaHalfInRelTotalPattern::new(client.clone(), _m(&acc, "supply")), unrealized: LossNetProfitPattern::new(client.clone(), acc.clone()), } } @@ -1852,7 +1852,7 @@ impl BpsCentsRatioSatsUsdPattern { cents: MetricPattern1::new(client.clone(), _m(&acc, "cents")), ratio: MetricPattern1::new(client.clone(), _m(&acc, "ratio")), sats: MetricPattern1::new(client.clone(), _m(&acc, "sats")), - usd: MetricPattern1::new(client.clone(), _m(&acc, "usd")), + usd: MetricPattern1::new(client.clone(), acc.clone()), } } } @@ -1872,7 +1872,7 @@ impl BtcCentsRelSatsUsdPattern { Self { btc: MetricPattern1::new(client.clone(), acc.clone()), cents: MetricPattern1::new(client.clone(), _m(&acc, "cents")), - rel_to_circulating: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "rel_to_circulating_supply")), + rel_to_circulating: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "rel_to_circulating")), sats: MetricPattern1::new(client.clone(), _m(&acc, "sats")), usd: MetricPattern1::new(client.clone(), _m(&acc, "usd")), } @@ -1883,7 +1883,7 @@ impl BtcCentsRelSatsUsdPattern { pub struct BtcCentsRelSatsUsdPattern2 { pub btc: MetricPattern1, pub cents: MetricPattern1, - pub rel_to_own_supply: BpsPercentRatioPattern, + pub rel_to_own: BpsPercentRatioPattern, pub sats: MetricPattern1, pub usd: MetricPattern1, } @@ -1894,7 +1894,7 @@ impl BtcCentsRelSatsUsdPattern2 { Self { btc: MetricPattern1::new(client.clone(), acc.clone()), cents: MetricPattern1::new(client.clone(), _m(&acc, "cents")), - rel_to_own_supply: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "rel_to_own_supply")), + rel_to_own: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "rel_to_own")), sats: MetricPattern1::new(client.clone(), _m(&acc, "sats")), usd: MetricPattern1::new(client.clone(), _m(&acc, "usd")), } @@ -1917,7 +1917,7 @@ impl CentsDeltaRawRelUsdPattern { cents: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap_cents")), delta: ChangeRatePattern4::new(client.clone(), _m(&acc, "realized_cap_delta")), raw: MetricPattern18::new(client.clone(), _m(&acc, "cap_raw")), - rel_to_own_mcap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "realized_cap_rel_to_own_market_cap")), + rel_to_own_mcap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "realized_cap_rel_to_own_mcap")), usd: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap")), } } @@ -2036,9 +2036,9 @@ impl PhsReboundThsPattern { /// Pattern struct for repeated tree structure. pub struct RawRelSumPattern2 { pub raw: CentsUsdPattern, - pub rel_to_market_cap: BpsPercentRatioPattern, + pub rel_to_mcap: BpsPercentRatioPattern, pub rel_to_own_gross: BpsPercentRatioPattern, - pub rel_to_own_market_cap: BpsPercentRatioPattern, + pub rel_to_own_mcap: BpsPercentRatioPattern, pub sum: _24hPattern, } @@ -2047,9 +2047,9 @@ impl RawRelSumPattern2 { pub fn new(client: Arc, acc: String) -> Self { Self { raw: CentsUsdPattern::new(client.clone(), acc.clone()), - rel_to_market_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "rel_to_market_cap")), + rel_to_mcap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "rel_to_mcap")), rel_to_own_gross: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "rel_to_own_gross_pnl")), - rel_to_own_market_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "rel_to_own_market_cap")), + rel_to_own_mcap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "rel_to_own_mcap")), sum: _24hPattern::new(client.clone(), _m(&acc, "24h")), } } @@ -2218,21 +2218,21 @@ impl _1y2y4yAllPattern { } /// Pattern struct for repeated tree structure. -pub struct AddrOutputsRealizedSupplyPattern { - pub addr_count: BaseDeltaPattern, +pub struct AddressOutputsRealizedSupplyPattern { + pub address_count: DeltaRawPattern, pub outputs: UnspentPattern, pub realized: CapLossMvrvNuplPriceProfitSoprPattern, - pub supply: HalvedTotalPattern, + pub supply: HalfTotalPattern, } -impl AddrOutputsRealizedSupplyPattern { +impl AddressOutputsRealizedSupplyPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - addr_count: BaseDeltaPattern::new(client.clone(), _m(&acc, "addr_count")), + address_count: DeltaRawPattern::new(client.clone(), _m(&acc, "address_count")), outputs: UnspentPattern::new(client.clone(), _m(&acc, "utxo_count")), realized: CapLossMvrvNuplPriceProfitSoprPattern::new(client.clone(), acc.clone()), - supply: HalvedTotalPattern::new(client.clone(), _m(&acc, "supply")), + supply: HalfTotalPattern::new(client.clone(), _m(&acc, "supply")), } } } @@ -2249,7 +2249,7 @@ impl AdjustedRatioValuePattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - adjusted: RatioValuePattern2::new(client.clone(), _m(&acc, "adjusted")), + adjusted: RatioValuePattern2::new(client.clone(), acc.clone()), ratio: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "sopr")), value_created: RawSumPattern::new(client.clone(), _m(&acc, "value_created")), value_destroyed: RawSumPattern::new(client.clone(), _m(&acc, "value_destroyed")), @@ -2321,7 +2321,7 @@ impl CapLowerPriceUpperPattern { pub struct CentsRelUsdPattern2 { pub cents: MetricPattern1, pub rel_to_own_gross: BpsPercentRatioPattern, - pub rel_to_own_market_cap: BpsPercentRatioPattern, + pub rel_to_own_mcap: BpsPercentRatioPattern, pub usd: MetricPattern1, } @@ -2331,7 +2331,7 @@ impl CentsRelUsdPattern2 { Self { cents: MetricPattern1::new(client.clone(), _m(&acc, "cents")), rel_to_own_gross: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "rel_to_own_gross_pnl")), - rel_to_own_market_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "rel_to_own_market_cap")), + rel_to_own_mcap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "rel_to_own_mcap")), usd: MetricPattern1::new(client.clone(), acc.clone()), } } @@ -2358,18 +2358,18 @@ impl CumulativeNegativeRawSumPattern { } /// Pattern struct for repeated tree structure. -pub struct HalvedInTotalPattern { - pub halved: BtcCentsSatsUsdPattern, +pub struct HalfInTotalPattern { + pub half: BtcCentsSatsUsdPattern, pub in_loss: BtcCentsSatsUsdPattern, pub in_profit: BtcCentsSatsUsdPattern, pub total: BtcCentsSatsUsdPattern, } -impl HalvedInTotalPattern { +impl HalfInTotalPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - halved: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "halved")), + half: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "half")), in_loss: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "in_loss")), in_profit: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "in_profit")), total: BtcCentsSatsUsdPattern::new(client.clone(), acc.clone()), @@ -2421,7 +2421,7 @@ impl InRawSumPattern2 { pub struct OutputsRealizedSupplyUnrealizedPattern { pub outputs: UnspentPattern, pub realized: CapLossMvrvNuplPriceProfitSoprPattern, - pub supply: HalvedInTotalPattern, + pub supply: HalfInTotalPattern, pub unrealized: LossProfitPattern, } @@ -2431,7 +2431,7 @@ impl OutputsRealizedSupplyUnrealizedPattern { Self { outputs: UnspentPattern::new(client.clone(), _m(&acc, "utxo_count")), realized: CapLossMvrvNuplPriceProfitSoprPattern::new(client.clone(), acc.clone()), - supply: HalvedInTotalPattern::new(client.clone(), _m(&acc, "supply")), + supply: HalfInTotalPattern::new(client.clone(), _m(&acc, "supply")), unrealized: LossProfitPattern::new(client.clone(), _m(&acc, "unrealized")), } } @@ -2522,9 +2522,9 @@ impl BpsPriceRatioPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - bps: MetricPattern1::new(client.clone(), _m(&acc, "bps")), - price: CentsSatsUsdPattern::new(client.clone(), acc.clone()), - ratio: MetricPattern1::new(client.clone(), acc.clone()), + bps: MetricPattern1::new(client.clone(), _m(&acc, "ratio_pct99_bps")), + price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "pct99")), + ratio: MetricPattern1::new(client.clone(), _m(&acc, "ratio_pct99")), } } } @@ -2596,7 +2596,7 @@ impl CentsSatsUsdPattern { Self { cents: MetricPattern1::new(client.clone(), _m(&acc, "cents")), sats: MetricPattern1::new(client.clone(), _m(&acc, "sats")), - usd: MetricPattern1::new(client.clone(), _m(&acc, "usd")), + usd: MetricPattern1::new(client.clone(), acc.clone()), } } } @@ -2614,7 +2614,7 @@ impl CumulativeRawRelPattern { Self { cumulative: MetricPattern1::new(client.clone(), _m(&acc, "cumulative")), raw: MetricPattern1::new(client.clone(), acc.clone()), - rel_to_rcap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "rel_to_realized_cap")), + rel_to_rcap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "rel_to_rcap")), } } } @@ -2695,7 +2695,7 @@ impl NegativeRawSumPattern { pub struct OutputsRealizedSupplyPattern { pub outputs: UnspentPattern, pub realized: CapLossMvrvNuplPriceProfitSoprPattern, - pub supply: HalvedTotalPattern, + pub supply: HalfTotalPattern, } impl OutputsRealizedSupplyPattern { @@ -2704,7 +2704,7 @@ impl OutputsRealizedSupplyPattern { Self { outputs: UnspentPattern::new(client.clone(), _m(&acc, "utxo_count")), realized: CapLossMvrvNuplPriceProfitSoprPattern::new(client.clone(), acc.clone()), - supply: HalvedTotalPattern::new(client.clone(), _m(&acc, "supply")), + supply: HalfTotalPattern::new(client.clone(), _m(&acc, "supply")), } } } @@ -2712,17 +2712,17 @@ impl OutputsRealizedSupplyPattern { /// Pattern struct for repeated tree structure. pub struct RatioValuePattern2 { pub ratio: _1m1w1y24hPattern, - pub value_created: BaseSumPattern, - pub value_destroyed: BaseSumPattern, + pub value_created: RawSumPattern, + pub value_destroyed: RawSumPattern, } impl RatioValuePattern2 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - ratio: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "sopr")), - value_created: BaseSumPattern::new(client.clone(), _m(&acc, "value_created")), - value_destroyed: BaseSumPattern::new(client.clone(), _m(&acc, "value_destroyed")), + ratio: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "asopr")), + value_created: RawSumPattern::new(client.clone(), _m(&acc, "adj_value_created")), + value_destroyed: RawSumPattern::new(client.clone(), _m(&acc, "adj_value_destroyed")), } } } @@ -2799,54 +2799,6 @@ impl CumulativeRawSumPattern { } } -/// Pattern struct for repeated tree structure. -pub struct BaseSumPattern { - pub base: MetricPattern1, - pub sum: _1m1w1y24hPattern, -} - -impl BaseSumPattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - base: MetricPattern1::new(client.clone(), acc.clone()), - sum: _1m1w1y24hPattern::new(client.clone(), acc.clone()), - } - } -} - -/// Pattern struct for repeated tree structure. -pub struct BaseDeltaPattern2 { - pub base: MetricPattern1, - pub delta: ChangeRatePattern, -} - -impl BaseDeltaPattern2 { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - base: MetricPattern1::new(client.clone(), acc.clone()), - delta: ChangeRatePattern::new(client.clone(), _m(&acc, "delta")), - } - } -} - -/// Pattern struct for repeated tree structure. -pub struct BaseDeltaPattern { - pub base: MetricPattern1, - pub delta: ChangeRatePattern2, -} - -impl BaseDeltaPattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - base: MetricPattern1::new(client.clone(), acc.clone()), - delta: ChangeRatePattern2::new(client.clone(), _m(&acc, "delta")), - } - } -} - /// Pattern struct for repeated tree structure. pub struct BlocksDominancePattern { pub blocks_mined: CumulativeRawPattern, @@ -2976,16 +2928,48 @@ impl CoindaysSentPattern { } /// Pattern struct for repeated tree structure. -pub struct HalvedTotalPattern { - pub halved: BtcCentsSatsUsdPattern, - pub total: BtcCentsSatsUsdPattern, +pub struct DeltaRawPattern2 { + pub delta: ChangeRatePattern, + pub raw: MetricPattern1, } -impl HalvedTotalPattern { +impl DeltaRawPattern2 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - halved: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "halved")), + delta: ChangeRatePattern::new(client.clone(), _m(&acc, "delta")), + raw: MetricPattern1::new(client.clone(), acc.clone()), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct DeltaRawPattern { + pub delta: ChangeRatePattern2, + pub raw: MetricPattern1, +} + +impl DeltaRawPattern { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + delta: ChangeRatePattern2::new(client.clone(), _m(&acc, "delta")), + raw: MetricPattern1::new(client.clone(), acc.clone()), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct HalfTotalPattern { + pub half: BtcCentsSatsUsdPattern, + pub total: BtcCentsSatsUsdPattern, +} + +impl HalfTotalPattern { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + half: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "half")), total: BtcCentsSatsUsdPattern::new(client.clone(), acc.clone()), } } @@ -3049,8 +3033,8 @@ impl PriceValuePattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - price: CentsSatsUsdPattern::new(client.clone(), acc.clone()), - value: MetricPattern1::new(client.clone(), acc.clone()), + price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "p3sd_4y")), + value: MetricPattern1::new(client.clone(), _m(&acc, "ratio_p3sd_4y")), } } } @@ -3129,8 +3113,8 @@ impl RelPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - rel_to_mcap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "market_cap")), - rel_to_rcap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "realized_cap")), + rel_to_mcap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "mcap")), + rel_to_rcap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "rcap")), } } } @@ -3194,7 +3178,7 @@ impl RawSumPattern { pub fn new(client: Arc, acc: String) -> Self { Self { raw: MetricPattern1::new(client.clone(), acc.clone()), - sum: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "sum")), + sum: _1m1w1y24hPattern::new(client.clone(), acc.clone()), } } } @@ -3273,28 +3257,28 @@ impl _24hPattern { /// Pattern struct for repeated tree structure. pub struct UnspentPattern2 { - pub unspent_count: BaseDeltaPattern, + pub unspent_count: DeltaRawPattern, } impl UnspentPattern2 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - unspent_count: BaseDeltaPattern::new(client.clone(), acc.clone()), + unspent_count: DeltaRawPattern::new(client.clone(), acc.clone()), } } } /// Pattern struct for repeated tree structure. pub struct UnspentPattern3 { - pub unspent_count: BaseDeltaPattern2, + pub unspent_count: DeltaRawPattern2, } impl UnspentPattern3 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - unspent_count: BaseDeltaPattern2::new(client.clone(), acc.clone()), + unspent_count: DeltaRawPattern2::new(client.clone(), acc.clone()), } } } @@ -3510,7 +3494,7 @@ impl MetricsTree_Blocks_Size { /// Metrics tree node. pub struct MetricsTree_Blocks_Weight { - pub base: MetricPattern18, + pub raw: MetricPattern18, pub cumulative: MetricPattern1, pub sum: _1m1w1y24hPattern, pub average: _1m1w1y24hPattern, @@ -3526,7 +3510,7 @@ pub struct MetricsTree_Blocks_Weight { impl MetricsTree_Blocks_Weight { pub fn new(client: Arc, base_path: String) -> Self { Self { - base: MetricPattern18::new(client.clone(), "block_weight".to_string()), + raw: MetricPattern18::new(client.clone(), "block_weight".to_string()), cumulative: MetricPattern1::new(client.clone(), "block_weight_cumulative".to_string()), sum: _1m1w1y24hPattern::new(client.clone(), "block_weight_sum".to_string()), average: _1m1w1y24hPattern::new(client.clone(), "block_weight_average".to_string()), @@ -5579,20 +5563,54 @@ pub struct MetricsTree_Market_MovingAverage_Sma_200d { pub sats: MetricPattern1, pub bps: MetricPattern1, pub ratio: MetricPattern1, - pub x2_4: CentsSatsUsdPattern, - pub x0_8: CentsSatsUsdPattern, + pub x2_4: MetricsTree_Market_MovingAverage_Sma_200d_X24, + pub x0_8: MetricsTree_Market_MovingAverage_Sma_200d_X08, } impl MetricsTree_Market_MovingAverage_Sma_200d { pub fn new(client: Arc, base_path: String) -> Self { Self { cents: MetricPattern1::new(client.clone(), "price_sma_200d_cents".to_string()), - usd: MetricPattern1::new(client.clone(), "price_sma_200d_usd".to_string()), + usd: MetricPattern1::new(client.clone(), "price_sma_200d".to_string()), sats: MetricPattern1::new(client.clone(), "price_sma_200d_sats".to_string()), bps: MetricPattern1::new(client.clone(), "price_sma_200d_ratio_bps".to_string()), ratio: MetricPattern1::new(client.clone(), "price_sma_200d_ratio".to_string()), - x2_4: CentsSatsUsdPattern::new(client.clone(), "price_sma_200d_x2_4".to_string()), - x0_8: CentsSatsUsdPattern::new(client.clone(), "price_sma_200d_x0_8".to_string()), + x2_4: MetricsTree_Market_MovingAverage_Sma_200d_X24::new(client.clone(), format!("{base_path}_x2_4")), + x0_8: MetricsTree_Market_MovingAverage_Sma_200d_X08::new(client.clone(), format!("{base_path}_x0_8")), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Market_MovingAverage_Sma_200d_X24 { + pub cents: MetricPattern1, + pub usd: MetricPattern1, + pub sats: MetricPattern1, +} + +impl MetricsTree_Market_MovingAverage_Sma_200d_X24 { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + cents: MetricPattern1::new(client.clone(), "price_sma_200d_x2_4_cents".to_string()), + usd: MetricPattern1::new(client.clone(), "price_sma_200d_x2_4_usd".to_string()), + sats: MetricPattern1::new(client.clone(), "price_sma_200d_x2_4_sats".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Market_MovingAverage_Sma_200d_X08 { + pub cents: MetricPattern1, + pub usd: MetricPattern1, + pub sats: MetricPattern1, +} + +impl MetricsTree_Market_MovingAverage_Sma_200d_X08 { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + cents: MetricPattern1::new(client.clone(), "price_sma_200d_x0_8_cents".to_string()), + usd: MetricPattern1::new(client.clone(), "price_sma_200d_x0_8_usd".to_string()), + sats: MetricPattern1::new(client.clone(), "price_sma_200d_x0_8_sats".to_string()), } } } @@ -5604,18 +5622,35 @@ pub struct MetricsTree_Market_MovingAverage_Sma_350d { pub sats: MetricPattern1, pub bps: MetricPattern1, pub ratio: MetricPattern1, - pub x2: CentsSatsUsdPattern, + pub x2: MetricsTree_Market_MovingAverage_Sma_350d_X2, } impl MetricsTree_Market_MovingAverage_Sma_350d { pub fn new(client: Arc, base_path: String) -> Self { Self { cents: MetricPattern1::new(client.clone(), "price_sma_350d_cents".to_string()), - usd: MetricPattern1::new(client.clone(), "price_sma_350d_usd".to_string()), + usd: MetricPattern1::new(client.clone(), "price_sma_350d".to_string()), sats: MetricPattern1::new(client.clone(), "price_sma_350d_sats".to_string()), bps: MetricPattern1::new(client.clone(), "price_sma_350d_ratio_bps".to_string()), ratio: MetricPattern1::new(client.clone(), "price_sma_350d_ratio".to_string()), - x2: CentsSatsUsdPattern::new(client.clone(), "price_sma_350d_x2".to_string()), + x2: MetricsTree_Market_MovingAverage_Sma_350d_X2::new(client.clone(), format!("{base_path}_x2")), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Market_MovingAverage_Sma_350d_X2 { + pub cents: MetricPattern1, + pub usd: MetricPattern1, + pub sats: MetricPattern1, +} + +impl MetricsTree_Market_MovingAverage_Sma_350d_X2 { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + cents: MetricPattern1::new(client.clone(), "price_sma_350d_x2_cents".to_string()), + usd: MetricPattern1::new(client.clone(), "price_sma_350d_x2_usd".to_string()), + sats: MetricPattern1::new(client.clone(), "price_sma_350d_x2_sats".to_string()), } } } @@ -6460,7 +6495,7 @@ pub struct MetricsTree_Prices_Split { pub open: CentsSatsUsdPattern2, pub high: CentsSatsUsdPattern2, pub low: CentsSatsUsdPattern2, - pub close: MetricsTree_Prices_Split_Close, + pub close: CentsSatsUsdPattern2, } impl MetricsTree_Prices_Split { @@ -6469,24 +6504,7 @@ impl MetricsTree_Prices_Split { open: CentsSatsUsdPattern2::new(client.clone(), "price_open".to_string()), high: CentsSatsUsdPattern2::new(client.clone(), "price_high".to_string()), low: CentsSatsUsdPattern2::new(client.clone(), "price_low".to_string()), - close: MetricsTree_Prices_Split_Close::new(client.clone(), format!("{base_path}_close")), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Prices_Split_Close { - pub cents: MetricPattern2, - pub usd: MetricPattern2, - pub sats: MetricPattern2, -} - -impl MetricsTree_Prices_Split_Close { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - cents: MetricPattern2::new(client.clone(), "price_close_cents".to_string()), - usd: MetricPattern2::new(client.clone(), "price_close".to_string()), - sats: MetricPattern2::new(client.clone(), "price_close_sats".to_string()), + close: CentsSatsUsdPattern2::new(client.clone(), "price_close".to_string()), } } } @@ -6561,10 +6579,10 @@ impl MetricsTree_Distribution_Addresses { Self { indexes: MetricsTree_Distribution_Addresses_Indexes::new(client.clone(), format!("{base_path}_indexes")), data: MetricsTree_Distribution_Addresses_Data::new(client.clone(), format!("{base_path}_data")), - funded: AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3::new(client.clone(), "addr_count".to_string()), - empty: AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3::new(client.clone(), "empty_addr_count".to_string()), + funded: AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3::new(client.clone(), "address_count".to_string()), + empty: AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3::new(client.clone(), "empty_address_count".to_string()), activity: MetricsTree_Distribution_Addresses_Activity::new(client.clone(), format!("{base_path}_activity")), - total: AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3::new(client.clone(), "total_addr_count".to_string()), + total: AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3::new(client.clone(), "total_address_count".to_string()), new: MetricsTree_Distribution_Addresses_New::new(client.clone(), format!("{base_path}_new")), delta: MetricsTree_Distribution_Addresses_Delta::new(client.clone(), format!("{base_path}_delta")), } @@ -6648,29 +6666,164 @@ impl MetricsTree_Distribution_Addresses_Activity { /// Metrics tree node. pub struct MetricsTree_Distribution_Addresses_New { - pub all: RawSumPattern, - pub p2pk65: RawSumPattern, - pub p2pk33: RawSumPattern, - pub p2pkh: RawSumPattern, - pub p2sh: RawSumPattern, - pub p2wpkh: RawSumPattern, - pub p2wsh: RawSumPattern, - pub p2tr: RawSumPattern, - pub p2a: RawSumPattern, + pub all: MetricsTree_Distribution_Addresses_New_All, + pub p2pk65: MetricsTree_Distribution_Addresses_New_P2pk65, + pub p2pk33: MetricsTree_Distribution_Addresses_New_P2pk33, + pub p2pkh: MetricsTree_Distribution_Addresses_New_P2pkh, + pub p2sh: MetricsTree_Distribution_Addresses_New_P2sh, + pub p2wpkh: MetricsTree_Distribution_Addresses_New_P2wpkh, + pub p2wsh: MetricsTree_Distribution_Addresses_New_P2wsh, + pub p2tr: MetricsTree_Distribution_Addresses_New_P2tr, + pub p2a: MetricsTree_Distribution_Addresses_New_P2a, } impl MetricsTree_Distribution_Addresses_New { pub fn new(client: Arc, base_path: String) -> Self { Self { - all: RawSumPattern::new(client.clone(), "new_addr_count".to_string()), - p2pk65: RawSumPattern::new(client.clone(), "p2pk65_new_addr_count".to_string()), - p2pk33: RawSumPattern::new(client.clone(), "p2pk33_new_addr_count".to_string()), - p2pkh: RawSumPattern::new(client.clone(), "p2pkh_new_addr_count".to_string()), - p2sh: RawSumPattern::new(client.clone(), "p2sh_new_addr_count".to_string()), - p2wpkh: RawSumPattern::new(client.clone(), "p2wpkh_new_addr_count".to_string()), - p2wsh: RawSumPattern::new(client.clone(), "p2wsh_new_addr_count".to_string()), - p2tr: RawSumPattern::new(client.clone(), "p2tr_new_addr_count".to_string()), - p2a: RawSumPattern::new(client.clone(), "p2a_new_addr_count".to_string()), + all: MetricsTree_Distribution_Addresses_New_All::new(client.clone(), format!("{base_path}_all")), + p2pk65: MetricsTree_Distribution_Addresses_New_P2pk65::new(client.clone(), format!("{base_path}_p2pk65")), + p2pk33: MetricsTree_Distribution_Addresses_New_P2pk33::new(client.clone(), format!("{base_path}_p2pk33")), + p2pkh: MetricsTree_Distribution_Addresses_New_P2pkh::new(client.clone(), format!("{base_path}_p2pkh")), + p2sh: MetricsTree_Distribution_Addresses_New_P2sh::new(client.clone(), format!("{base_path}_p2sh")), + p2wpkh: MetricsTree_Distribution_Addresses_New_P2wpkh::new(client.clone(), format!("{base_path}_p2wpkh")), + p2wsh: MetricsTree_Distribution_Addresses_New_P2wsh::new(client.clone(), format!("{base_path}_p2wsh")), + p2tr: MetricsTree_Distribution_Addresses_New_P2tr::new(client.clone(), format!("{base_path}_p2tr")), + p2a: MetricsTree_Distribution_Addresses_New_P2a::new(client.clone(), format!("{base_path}_p2a")), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Distribution_Addresses_New_All { + pub raw: MetricPattern1, + pub sum: _1m1w1y24hPattern, +} + +impl MetricsTree_Distribution_Addresses_New_All { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + raw: MetricPattern1::new(client.clone(), "new_address_count".to_string()), + sum: _1m1w1y24hPattern::new(client.clone(), "new_address_count_sum".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Distribution_Addresses_New_P2pk65 { + pub raw: MetricPattern1, + pub sum: _1m1w1y24hPattern, +} + +impl MetricsTree_Distribution_Addresses_New_P2pk65 { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + raw: MetricPattern1::new(client.clone(), "p2pk65_new_address_count".to_string()), + sum: _1m1w1y24hPattern::new(client.clone(), "p2pk65_new_address_count_sum".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Distribution_Addresses_New_P2pk33 { + pub raw: MetricPattern1, + pub sum: _1m1w1y24hPattern, +} + +impl MetricsTree_Distribution_Addresses_New_P2pk33 { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + raw: MetricPattern1::new(client.clone(), "p2pk33_new_address_count".to_string()), + sum: _1m1w1y24hPattern::new(client.clone(), "p2pk33_new_address_count_sum".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Distribution_Addresses_New_P2pkh { + pub raw: MetricPattern1, + pub sum: _1m1w1y24hPattern, +} + +impl MetricsTree_Distribution_Addresses_New_P2pkh { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + raw: MetricPattern1::new(client.clone(), "p2pkh_new_address_count".to_string()), + sum: _1m1w1y24hPattern::new(client.clone(), "p2pkh_new_address_count_sum".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Distribution_Addresses_New_P2sh { + pub raw: MetricPattern1, + pub sum: _1m1w1y24hPattern, +} + +impl MetricsTree_Distribution_Addresses_New_P2sh { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + raw: MetricPattern1::new(client.clone(), "p2sh_new_address_count".to_string()), + sum: _1m1w1y24hPattern::new(client.clone(), "p2sh_new_address_count_sum".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Distribution_Addresses_New_P2wpkh { + pub raw: MetricPattern1, + pub sum: _1m1w1y24hPattern, +} + +impl MetricsTree_Distribution_Addresses_New_P2wpkh { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + raw: MetricPattern1::new(client.clone(), "p2wpkh_new_address_count".to_string()), + sum: _1m1w1y24hPattern::new(client.clone(), "p2wpkh_new_address_count_sum".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Distribution_Addresses_New_P2wsh { + pub raw: MetricPattern1, + pub sum: _1m1w1y24hPattern, +} + +impl MetricsTree_Distribution_Addresses_New_P2wsh { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + raw: MetricPattern1::new(client.clone(), "p2wsh_new_address_count".to_string()), + sum: _1m1w1y24hPattern::new(client.clone(), "p2wsh_new_address_count_sum".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Distribution_Addresses_New_P2tr { + pub raw: MetricPattern1, + pub sum: _1m1w1y24hPattern, +} + +impl MetricsTree_Distribution_Addresses_New_P2tr { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + raw: MetricPattern1::new(client.clone(), "p2tr_new_address_count".to_string()), + sum: _1m1w1y24hPattern::new(client.clone(), "p2tr_new_address_count_sum".to_string()), + } + } +} + +/// Metrics tree node. +pub struct MetricsTree_Distribution_Addresses_New_P2a { + pub raw: MetricPattern1, + pub sum: _1m1w1y24hPattern, +} + +impl MetricsTree_Distribution_Addresses_New_P2a { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + raw: MetricPattern1::new(client.clone(), "p2a_new_address_count".to_string()), + sum: _1m1w1y24hPattern::new(client.clone(), "p2a_new_address_count_sum".to_string()), } } } @@ -6691,15 +6844,15 @@ pub struct MetricsTree_Distribution_Addresses_Delta { impl MetricsTree_Distribution_Addresses_Delta { pub fn new(client: Arc, base_path: String) -> Self { Self { - all: ChangeRatePattern::new(client.clone(), "addr_count".to_string()), - p2pk65: ChangeRatePattern::new(client.clone(), "p2pk65_addr_count".to_string()), - p2pk33: ChangeRatePattern::new(client.clone(), "p2pk33_addr_count".to_string()), - p2pkh: ChangeRatePattern::new(client.clone(), "p2pkh_addr_count".to_string()), - p2sh: ChangeRatePattern::new(client.clone(), "p2sh_addr_count".to_string()), - p2wpkh: ChangeRatePattern::new(client.clone(), "p2wpkh_addr_count".to_string()), - p2wsh: ChangeRatePattern::new(client.clone(), "p2wsh_addr_count".to_string()), - p2tr: ChangeRatePattern::new(client.clone(), "p2tr_addr_count".to_string()), - p2a: ChangeRatePattern::new(client.clone(), "p2a_addr_count".to_string()), + all: ChangeRatePattern::new(client.clone(), "address_count".to_string()), + p2pk65: ChangeRatePattern::new(client.clone(), "p2pk65_address_count".to_string()), + p2pk33: ChangeRatePattern::new(client.clone(), "p2pk33_address_count".to_string()), + p2pkh: ChangeRatePattern::new(client.clone(), "p2pkh_address_count".to_string()), + p2sh: ChangeRatePattern::new(client.clone(), "p2sh_address_count".to_string()), + p2wpkh: ChangeRatePattern::new(client.clone(), "p2wpkh_address_count".to_string()), + p2wsh: ChangeRatePattern::new(client.clone(), "p2wsh_address_count".to_string()), + p2tr: ChangeRatePattern::new(client.clone(), "p2tr_address_count".to_string()), + p2a: ChangeRatePattern::new(client.clone(), "p2a_address_count".to_string()), } } } @@ -6787,7 +6940,7 @@ pub struct MetricsTree_Distribution_Cohorts_Utxo_All_Supply { pub in_profit: BtcCentsRelSatsUsdPattern2, pub in_loss: BtcCentsRelSatsUsdPattern2, pub total: BtcCentsSatsUsdPattern, - pub halved: BtcCentsSatsUsdPattern, + pub half: BtcCentsSatsUsdPattern, } impl MetricsTree_Distribution_Cohorts_Utxo_All_Supply { @@ -6797,7 +6950,7 @@ impl MetricsTree_Distribution_Cohorts_Utxo_All_Supply { in_profit: BtcCentsRelSatsUsdPattern2::new(client.clone(), "supply_in_profit".to_string()), in_loss: BtcCentsRelSatsUsdPattern2::new(client.clone(), "supply_in_loss".to_string()), total: BtcCentsSatsUsdPattern::new(client.clone(), "supply".to_string()), - halved: BtcCentsSatsUsdPattern::new(client.clone(), "supply_halved".to_string()), + half: BtcCentsSatsUsdPattern::new(client.clone(), "supply_half".to_string()), } } } @@ -6832,7 +6985,7 @@ pub struct MetricsTree_Distribution_Cohorts_Utxo_All_Unrealized_Loss { pub negative: MetricPattern1, pub raw: CentsUsdPattern, pub sum: _24hPattern, - pub rel_to_market_cap: BpsPercentRatioPattern, + pub rel_to_mcap: BpsPercentRatioPattern, pub rel_to_own_gross: BpsPercentRatioPattern, } @@ -6842,7 +6995,7 @@ impl MetricsTree_Distribution_Cohorts_Utxo_All_Unrealized_Loss { negative: MetricPattern1::new(client.clone(), "neg_unrealized_loss".to_string()), raw: CentsUsdPattern::new(client.clone(), "unrealized_loss".to_string()), sum: _24hPattern::new(client.clone(), "unrealized_loss_24h".to_string()), - rel_to_market_cap: BpsPercentRatioPattern::new(client.clone(), "unrealized_loss_rel_to_market_cap".to_string()), + rel_to_mcap: BpsPercentRatioPattern::new(client.clone(), "unrealized_loss_rel_to_mcap".to_string()), rel_to_own_gross: BpsPercentRatioPattern::new(client.clone(), "unrealized_loss_rel_to_own_gross_pnl".to_string()), } } @@ -6869,7 +7022,7 @@ impl MetricsTree_Distribution_Cohorts_Utxo_All_Unrealized_NetPnl { pub struct MetricsTree_Distribution_Cohorts_Utxo_All_Unrealized_Profit { pub raw: CentsUsdPattern, pub sum: _24hPattern, - pub rel_to_market_cap: BpsPercentRatioPattern, + pub rel_to_mcap: BpsPercentRatioPattern, pub rel_to_own_gross: BpsPercentRatioPattern, } @@ -6878,7 +7031,7 @@ impl MetricsTree_Distribution_Cohorts_Utxo_All_Unrealized_Profit { Self { raw: CentsUsdPattern::new(client.clone(), "unrealized_profit".to_string()), sum: _24hPattern::new(client.clone(), "unrealized_profit_24h".to_string()), - rel_to_market_cap: BpsPercentRatioPattern::new(client.clone(), "unrealized_profit_rel_to_market_cap".to_string()), + rel_to_mcap: BpsPercentRatioPattern::new(client.clone(), "unrealized_profit_rel_to_mcap".to_string()), rel_to_own_gross: BpsPercentRatioPattern::new(client.clone(), "unrealized_profit_rel_to_own_gross_pnl".to_string()), } } @@ -6887,7 +7040,7 @@ impl MetricsTree_Distribution_Cohorts_Utxo_All_Unrealized_Profit { /// Metrics tree node. pub struct MetricsTree_Distribution_Cohorts_Utxo_Sth { pub realized: CapGrossInvestorLossMvrvNetNuplPeakPriceProfitSoprPattern, - pub supply: DeltaHalvedInRelTotalPattern2, + pub supply: DeltaHalfInRelTotalPattern2, pub outputs: UnspentPattern3, pub activity: CoindaysCoinyearsDormancySentVelocityPattern, pub cost_basis: InvestedMaxMinPercentilesSupplyPattern, @@ -6898,7 +7051,7 @@ impl MetricsTree_Distribution_Cohorts_Utxo_Sth { pub fn new(client: Arc, base_path: String) -> Self { Self { realized: CapGrossInvestorLossMvrvNetNuplPeakPriceProfitSoprPattern::new(client.clone(), "sth".to_string()), - supply: DeltaHalvedInRelTotalPattern2::new(client.clone(), "sth_supply".to_string()), + supply: DeltaHalfInRelTotalPattern2::new(client.clone(), "sth_supply".to_string()), outputs: UnspentPattern3::new(client.clone(), "sth_utxo_count".to_string()), activity: CoindaysCoinyearsDormancySentVelocityPattern::new(client.clone(), "sth".to_string()), cost_basis: InvestedMaxMinPercentilesSupplyPattern::new(client.clone(), "sth".to_string()), @@ -6909,7 +7062,7 @@ impl MetricsTree_Distribution_Cohorts_Utxo_Sth { /// Metrics tree node. pub struct MetricsTree_Distribution_Cohorts_Utxo_Lth { - pub supply: DeltaHalvedInRelTotalPattern2, + pub supply: DeltaHalfInRelTotalPattern2, pub outputs: UnspentPattern3, pub activity: CoindaysCoinyearsDormancySentVelocityPattern, pub realized: MetricsTree_Distribution_Cohorts_Utxo_Lth_Realized, @@ -6920,7 +7073,7 @@ pub struct MetricsTree_Distribution_Cohorts_Utxo_Lth { impl MetricsTree_Distribution_Cohorts_Utxo_Lth { pub fn new(client: Arc, base_path: String) -> Self { Self { - supply: DeltaHalvedInRelTotalPattern2::new(client.clone(), "lth_supply".to_string()), + supply: DeltaHalfInRelTotalPattern2::new(client.clone(), "lth_supply".to_string()), outputs: UnspentPattern3::new(client.clone(), "lth_utxo_count".to_string()), activity: CoindaysCoinyearsDormancySentVelocityPattern::new(client.clone(), "lth".to_string()), realized: MetricsTree_Distribution_Cohorts_Utxo_Lth_Realized::new(client.clone(), format!("{base_path}_realized")), @@ -6967,54 +7120,24 @@ impl MetricsTree_Distribution_Cohorts_Utxo_Lth_Realized { /// Metrics tree node. pub struct MetricsTree_Distribution_Cohorts_Utxo_Lth_Realized_Sopr { - pub value_created: MetricsTree_Distribution_Cohorts_Utxo_Lth_Realized_Sopr_ValueCreated, - pub value_destroyed: MetricsTree_Distribution_Cohorts_Utxo_Lth_Realized_Sopr_ValueDestroyed, + pub value_created: RawSumPattern, + pub value_destroyed: RawSumPattern, pub ratio: _1m1w1y24hPattern, } impl MetricsTree_Distribution_Cohorts_Utxo_Lth_Realized_Sopr { pub fn new(client: Arc, base_path: String) -> Self { Self { - value_created: MetricsTree_Distribution_Cohorts_Utxo_Lth_Realized_Sopr_ValueCreated::new(client.clone(), format!("{base_path}_value_created")), - value_destroyed: MetricsTree_Distribution_Cohorts_Utxo_Lth_Realized_Sopr_ValueDestroyed::new(client.clone(), format!("{base_path}_value_destroyed")), + value_created: RawSumPattern::new(client.clone(), "lth_value_created".to_string()), + value_destroyed: RawSumPattern::new(client.clone(), "lth_value_destroyed".to_string()), ratio: _1m1w1y24hPattern::new(client.clone(), "lth_sopr".to_string()), } } } -/// Metrics tree node. -pub struct MetricsTree_Distribution_Cohorts_Utxo_Lth_Realized_Sopr_ValueCreated { - pub sum: _1m1w1y24hPattern, - pub raw: MetricPattern1, -} - -impl MetricsTree_Distribution_Cohorts_Utxo_Lth_Realized_Sopr_ValueCreated { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - sum: _1m1w1y24hPattern::new(client.clone(), "lth_value_created".to_string()), - raw: MetricPattern1::new(client.clone(), "lth_value_created".to_string()), - } - } -} - -/// Metrics tree node. -pub struct MetricsTree_Distribution_Cohorts_Utxo_Lth_Realized_Sopr_ValueDestroyed { - pub sum: _1m1w1y24hPattern, - pub raw: MetricPattern1, -} - -impl MetricsTree_Distribution_Cohorts_Utxo_Lth_Realized_Sopr_ValueDestroyed { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - sum: _1m1w1y24hPattern::new(client.clone(), "lth_value_destroyed".to_string()), - raw: MetricPattern1::new(client.clone(), "lth_value_destroyed".to_string()), - } - } -} - /// Metrics tree node. pub struct MetricsTree_Distribution_Cohorts_Utxo_AgeRange { - pub up_to_1h: ActivityOutputsRealizedSupplyUnrealizedPattern, + pub under_1h: ActivityOutputsRealizedSupplyUnrealizedPattern, pub _1h_to_1d: ActivityOutputsRealizedSupplyUnrealizedPattern, pub _1d_to_1w: ActivityOutputsRealizedSupplyUnrealizedPattern, pub _1w_to_1m: ActivityOutputsRealizedSupplyUnrealizedPattern, @@ -7034,13 +7157,13 @@ pub struct MetricsTree_Distribution_Cohorts_Utxo_AgeRange { pub _8y_to_10y: ActivityOutputsRealizedSupplyUnrealizedPattern, pub _10y_to_12y: ActivityOutputsRealizedSupplyUnrealizedPattern, pub _12y_to_15y: ActivityOutputsRealizedSupplyUnrealizedPattern, - pub from_15y: ActivityOutputsRealizedSupplyUnrealizedPattern, + pub over_15y: ActivityOutputsRealizedSupplyUnrealizedPattern, } impl MetricsTree_Distribution_Cohorts_Utxo_AgeRange { pub fn new(client: Arc, base_path: String) -> Self { Self { - up_to_1h: ActivityOutputsRealizedSupplyUnrealizedPattern::new(client.clone(), "utxos_under_1h_old".to_string()), + under_1h: ActivityOutputsRealizedSupplyUnrealizedPattern::new(client.clone(), "utxos_under_1h_old".to_string()), _1h_to_1d: ActivityOutputsRealizedSupplyUnrealizedPattern::new(client.clone(), "utxos_1h_to_1d_old".to_string()), _1d_to_1w: ActivityOutputsRealizedSupplyUnrealizedPattern::new(client.clone(), "utxos_1d_to_1w_old".to_string()), _1w_to_1m: ActivityOutputsRealizedSupplyUnrealizedPattern::new(client.clone(), "utxos_1w_to_1m_old".to_string()), @@ -7060,7 +7183,7 @@ impl MetricsTree_Distribution_Cohorts_Utxo_AgeRange { _8y_to_10y: ActivityOutputsRealizedSupplyUnrealizedPattern::new(client.clone(), "utxos_8y_to_10y_old".to_string()), _10y_to_12y: ActivityOutputsRealizedSupplyUnrealizedPattern::new(client.clone(), "utxos_10y_to_12y_old".to_string()), _12y_to_15y: ActivityOutputsRealizedSupplyUnrealizedPattern::new(client.clone(), "utxos_12y_to_15y_old".to_string()), - from_15y: ActivityOutputsRealizedSupplyUnrealizedPattern::new(client.clone(), "utxos_over_15y_old".to_string()), + over_15y: ActivityOutputsRealizedSupplyUnrealizedPattern::new(client.clone(), "utxos_over_15y_old".to_string()), } } } @@ -7280,27 +7403,27 @@ pub struct MetricsTree_Distribution_Cohorts_Utxo_AmountRange { pub _100btc_to_1k_btc: OutputsRealizedSupplyPattern, pub _1k_btc_to_10k_btc: OutputsRealizedSupplyPattern, pub _10k_btc_to_100k_btc: OutputsRealizedSupplyPattern, - pub _100k_btc_or_more: OutputsRealizedSupplyPattern, + pub over_100k_btc: OutputsRealizedSupplyPattern, } impl MetricsTree_Distribution_Cohorts_Utxo_AmountRange { pub fn new(client: Arc, base_path: String) -> Self { Self { - _0sats: OutputsRealizedSupplyPattern::new(client.clone(), "utxos_with_0sats".to_string()), - _1sat_to_10sats: OutputsRealizedSupplyPattern::new(client.clone(), "utxos_above_1sat_under_10sats".to_string()), - _10sats_to_100sats: OutputsRealizedSupplyPattern::new(client.clone(), "utxos_above_10sats_under_100sats".to_string()), - _100sats_to_1k_sats: OutputsRealizedSupplyPattern::new(client.clone(), "utxos_above_100sats_under_1k_sats".to_string()), - _1k_sats_to_10k_sats: OutputsRealizedSupplyPattern::new(client.clone(), "utxos_above_1k_sats_under_10k_sats".to_string()), - _10k_sats_to_100k_sats: OutputsRealizedSupplyPattern::new(client.clone(), "utxos_above_10k_sats_under_100k_sats".to_string()), - _100k_sats_to_1m_sats: OutputsRealizedSupplyPattern::new(client.clone(), "utxos_above_100k_sats_under_1m_sats".to_string()), - _1m_sats_to_10m_sats: OutputsRealizedSupplyPattern::new(client.clone(), "utxos_above_1m_sats_under_10m_sats".to_string()), - _10m_sats_to_1btc: OutputsRealizedSupplyPattern::new(client.clone(), "utxos_above_10m_sats_under_1btc".to_string()), - _1btc_to_10btc: OutputsRealizedSupplyPattern::new(client.clone(), "utxos_above_1btc_under_10btc".to_string()), - _10btc_to_100btc: OutputsRealizedSupplyPattern::new(client.clone(), "utxos_above_10btc_under_100btc".to_string()), - _100btc_to_1k_btc: OutputsRealizedSupplyPattern::new(client.clone(), "utxos_above_100btc_under_1k_btc".to_string()), - _1k_btc_to_10k_btc: OutputsRealizedSupplyPattern::new(client.clone(), "utxos_above_1k_btc_under_10k_btc".to_string()), - _10k_btc_to_100k_btc: OutputsRealizedSupplyPattern::new(client.clone(), "utxos_above_10k_btc_under_100k_btc".to_string()), - _100k_btc_or_more: OutputsRealizedSupplyPattern::new(client.clone(), "utxos_above_100k_btc".to_string()), + _0sats: OutputsRealizedSupplyPattern::new(client.clone(), "utxos_0sats".to_string()), + _1sat_to_10sats: OutputsRealizedSupplyPattern::new(client.clone(), "utxos_1sat_to_10sats".to_string()), + _10sats_to_100sats: OutputsRealizedSupplyPattern::new(client.clone(), "utxos_10sats_to_100sats".to_string()), + _100sats_to_1k_sats: OutputsRealizedSupplyPattern::new(client.clone(), "utxos_100sats_to_1k_sats".to_string()), + _1k_sats_to_10k_sats: OutputsRealizedSupplyPattern::new(client.clone(), "utxos_1k_sats_to_10k_sats".to_string()), + _10k_sats_to_100k_sats: OutputsRealizedSupplyPattern::new(client.clone(), "utxos_10k_sats_to_100k_sats".to_string()), + _100k_sats_to_1m_sats: OutputsRealizedSupplyPattern::new(client.clone(), "utxos_100k_sats_to_1m_sats".to_string()), + _1m_sats_to_10m_sats: OutputsRealizedSupplyPattern::new(client.clone(), "utxos_1m_sats_to_10m_sats".to_string()), + _10m_sats_to_1btc: OutputsRealizedSupplyPattern::new(client.clone(), "utxos_10m_sats_to_1btc".to_string()), + _1btc_to_10btc: OutputsRealizedSupplyPattern::new(client.clone(), "utxos_1btc_to_10btc".to_string()), + _10btc_to_100btc: OutputsRealizedSupplyPattern::new(client.clone(), "utxos_10btc_to_100btc".to_string()), + _100btc_to_1k_btc: OutputsRealizedSupplyPattern::new(client.clone(), "utxos_100btc_to_1k_btc".to_string()), + _1k_btc_to_10k_btc: OutputsRealizedSupplyPattern::new(client.clone(), "utxos_1k_btc_to_10k_btc".to_string()), + _10k_btc_to_100k_btc: OutputsRealizedSupplyPattern::new(client.clone(), "utxos_10k_btc_to_100k_btc".to_string()), + over_100k_btc: OutputsRealizedSupplyPattern::new(client.clone(), "utxos_over_100k_btc".to_string()), } } } @@ -7523,7 +7646,7 @@ impl MetricsTree_Distribution_Cohorts_Utxo_Profitability_Loss { /// Metrics tree node. pub struct MetricsTree_Distribution_Cohorts_Utxo_Matured { - pub up_to_1h: BtcCentsSatsUsdPattern, + pub under_1h: BtcCentsSatsUsdPattern, pub _1h_to_1d: BtcCentsSatsUsdPattern, pub _1d_to_1w: BtcCentsSatsUsdPattern, pub _1w_to_1m: BtcCentsSatsUsdPattern, @@ -7543,13 +7666,13 @@ pub struct MetricsTree_Distribution_Cohorts_Utxo_Matured { pub _8y_to_10y: BtcCentsSatsUsdPattern, pub _10y_to_12y: BtcCentsSatsUsdPattern, pub _12y_to_15y: BtcCentsSatsUsdPattern, - pub from_15y: BtcCentsSatsUsdPattern, + pub over_15y: BtcCentsSatsUsdPattern, } impl MetricsTree_Distribution_Cohorts_Utxo_Matured { pub fn new(client: Arc, base_path: String) -> Self { Self { - up_to_1h: BtcCentsSatsUsdPattern::new(client.clone(), "utxo_under_1h_old_matured".to_string()), + under_1h: BtcCentsSatsUsdPattern::new(client.clone(), "utxo_under_1h_old_matured".to_string()), _1h_to_1d: BtcCentsSatsUsdPattern::new(client.clone(), "utxo_1h_to_1d_old_matured".to_string()), _1d_to_1w: BtcCentsSatsUsdPattern::new(client.clone(), "utxo_1d_to_1w_old_matured".to_string()), _1w_to_1m: BtcCentsSatsUsdPattern::new(client.clone(), "utxo_1w_to_1m_old_matured".to_string()), @@ -7569,7 +7692,7 @@ impl MetricsTree_Distribution_Cohorts_Utxo_Matured { _8y_to_10y: BtcCentsSatsUsdPattern::new(client.clone(), "utxo_8y_to_10y_old_matured".to_string()), _10y_to_12y: BtcCentsSatsUsdPattern::new(client.clone(), "utxo_10y_to_12y_old_matured".to_string()), _12y_to_15y: BtcCentsSatsUsdPattern::new(client.clone(), "utxo_12y_to_15y_old_matured".to_string()), - from_15y: BtcCentsSatsUsdPattern::new(client.clone(), "utxo_over_15y_old_matured".to_string()), + over_15y: BtcCentsSatsUsdPattern::new(client.clone(), "utxo_over_15y_old_matured".to_string()), } } } @@ -7593,115 +7716,115 @@ impl MetricsTree_Distribution_Cohorts_Address { /// Metrics tree node. pub struct MetricsTree_Distribution_Cohorts_Address_OverAmount { - pub _1sat: AddrOutputsRealizedSupplyPattern, - pub _10sats: AddrOutputsRealizedSupplyPattern, - pub _100sats: AddrOutputsRealizedSupplyPattern, - pub _1k_sats: AddrOutputsRealizedSupplyPattern, - pub _10k_sats: AddrOutputsRealizedSupplyPattern, - pub _100k_sats: AddrOutputsRealizedSupplyPattern, - pub _1m_sats: AddrOutputsRealizedSupplyPattern, - pub _10m_sats: AddrOutputsRealizedSupplyPattern, - pub _1btc: AddrOutputsRealizedSupplyPattern, - pub _10btc: AddrOutputsRealizedSupplyPattern, - pub _100btc: AddrOutputsRealizedSupplyPattern, - pub _1k_btc: AddrOutputsRealizedSupplyPattern, - pub _10k_btc: AddrOutputsRealizedSupplyPattern, + pub _1sat: AddressOutputsRealizedSupplyPattern, + pub _10sats: AddressOutputsRealizedSupplyPattern, + pub _100sats: AddressOutputsRealizedSupplyPattern, + pub _1k_sats: AddressOutputsRealizedSupplyPattern, + pub _10k_sats: AddressOutputsRealizedSupplyPattern, + pub _100k_sats: AddressOutputsRealizedSupplyPattern, + pub _1m_sats: AddressOutputsRealizedSupplyPattern, + pub _10m_sats: AddressOutputsRealizedSupplyPattern, + pub _1btc: AddressOutputsRealizedSupplyPattern, + pub _10btc: AddressOutputsRealizedSupplyPattern, + pub _100btc: AddressOutputsRealizedSupplyPattern, + pub _1k_btc: AddressOutputsRealizedSupplyPattern, + pub _10k_btc: AddressOutputsRealizedSupplyPattern, } impl MetricsTree_Distribution_Cohorts_Address_OverAmount { pub fn new(client: Arc, base_path: String) -> Self { Self { - _1sat: AddrOutputsRealizedSupplyPattern::new(client.clone(), "addrs_over_1sat".to_string()), - _10sats: AddrOutputsRealizedSupplyPattern::new(client.clone(), "addrs_over_10sats".to_string()), - _100sats: AddrOutputsRealizedSupplyPattern::new(client.clone(), "addrs_over_100sats".to_string()), - _1k_sats: AddrOutputsRealizedSupplyPattern::new(client.clone(), "addrs_over_1k_sats".to_string()), - _10k_sats: AddrOutputsRealizedSupplyPattern::new(client.clone(), "addrs_over_10k_sats".to_string()), - _100k_sats: AddrOutputsRealizedSupplyPattern::new(client.clone(), "addrs_over_100k_sats".to_string()), - _1m_sats: AddrOutputsRealizedSupplyPattern::new(client.clone(), "addrs_over_1m_sats".to_string()), - _10m_sats: AddrOutputsRealizedSupplyPattern::new(client.clone(), "addrs_over_10m_sats".to_string()), - _1btc: AddrOutputsRealizedSupplyPattern::new(client.clone(), "addrs_over_1btc".to_string()), - _10btc: AddrOutputsRealizedSupplyPattern::new(client.clone(), "addrs_over_10btc".to_string()), - _100btc: AddrOutputsRealizedSupplyPattern::new(client.clone(), "addrs_over_100btc".to_string()), - _1k_btc: AddrOutputsRealizedSupplyPattern::new(client.clone(), "addrs_over_1k_btc".to_string()), - _10k_btc: AddrOutputsRealizedSupplyPattern::new(client.clone(), "addrs_over_10k_btc".to_string()), + _1sat: AddressOutputsRealizedSupplyPattern::new(client.clone(), "addrs_over_1sat".to_string()), + _10sats: AddressOutputsRealizedSupplyPattern::new(client.clone(), "addrs_over_10sats".to_string()), + _100sats: AddressOutputsRealizedSupplyPattern::new(client.clone(), "addrs_over_100sats".to_string()), + _1k_sats: AddressOutputsRealizedSupplyPattern::new(client.clone(), "addrs_over_1k_sats".to_string()), + _10k_sats: AddressOutputsRealizedSupplyPattern::new(client.clone(), "addrs_over_10k_sats".to_string()), + _100k_sats: AddressOutputsRealizedSupplyPattern::new(client.clone(), "addrs_over_100k_sats".to_string()), + _1m_sats: AddressOutputsRealizedSupplyPattern::new(client.clone(), "addrs_over_1m_sats".to_string()), + _10m_sats: AddressOutputsRealizedSupplyPattern::new(client.clone(), "addrs_over_10m_sats".to_string()), + _1btc: AddressOutputsRealizedSupplyPattern::new(client.clone(), "addrs_over_1btc".to_string()), + _10btc: AddressOutputsRealizedSupplyPattern::new(client.clone(), "addrs_over_10btc".to_string()), + _100btc: AddressOutputsRealizedSupplyPattern::new(client.clone(), "addrs_over_100btc".to_string()), + _1k_btc: AddressOutputsRealizedSupplyPattern::new(client.clone(), "addrs_over_1k_btc".to_string()), + _10k_btc: AddressOutputsRealizedSupplyPattern::new(client.clone(), "addrs_over_10k_btc".to_string()), } } } /// Metrics tree node. pub struct MetricsTree_Distribution_Cohorts_Address_AmountRange { - pub _0sats: AddrOutputsRealizedSupplyPattern, - pub _1sat_to_10sats: AddrOutputsRealizedSupplyPattern, - pub _10sats_to_100sats: AddrOutputsRealizedSupplyPattern, - pub _100sats_to_1k_sats: AddrOutputsRealizedSupplyPattern, - pub _1k_sats_to_10k_sats: AddrOutputsRealizedSupplyPattern, - pub _10k_sats_to_100k_sats: AddrOutputsRealizedSupplyPattern, - pub _100k_sats_to_1m_sats: AddrOutputsRealizedSupplyPattern, - pub _1m_sats_to_10m_sats: AddrOutputsRealizedSupplyPattern, - pub _10m_sats_to_1btc: AddrOutputsRealizedSupplyPattern, - pub _1btc_to_10btc: AddrOutputsRealizedSupplyPattern, - pub _10btc_to_100btc: AddrOutputsRealizedSupplyPattern, - pub _100btc_to_1k_btc: AddrOutputsRealizedSupplyPattern, - pub _1k_btc_to_10k_btc: AddrOutputsRealizedSupplyPattern, - pub _10k_btc_to_100k_btc: AddrOutputsRealizedSupplyPattern, - pub _100k_btc_or_more: AddrOutputsRealizedSupplyPattern, + pub _0sats: AddressOutputsRealizedSupplyPattern, + pub _1sat_to_10sats: AddressOutputsRealizedSupplyPattern, + pub _10sats_to_100sats: AddressOutputsRealizedSupplyPattern, + pub _100sats_to_1k_sats: AddressOutputsRealizedSupplyPattern, + pub _1k_sats_to_10k_sats: AddressOutputsRealizedSupplyPattern, + pub _10k_sats_to_100k_sats: AddressOutputsRealizedSupplyPattern, + pub _100k_sats_to_1m_sats: AddressOutputsRealizedSupplyPattern, + pub _1m_sats_to_10m_sats: AddressOutputsRealizedSupplyPattern, + pub _10m_sats_to_1btc: AddressOutputsRealizedSupplyPattern, + pub _1btc_to_10btc: AddressOutputsRealizedSupplyPattern, + pub _10btc_to_100btc: AddressOutputsRealizedSupplyPattern, + pub _100btc_to_1k_btc: AddressOutputsRealizedSupplyPattern, + pub _1k_btc_to_10k_btc: AddressOutputsRealizedSupplyPattern, + pub _10k_btc_to_100k_btc: AddressOutputsRealizedSupplyPattern, + pub over_100k_btc: AddressOutputsRealizedSupplyPattern, } impl MetricsTree_Distribution_Cohorts_Address_AmountRange { pub fn new(client: Arc, base_path: String) -> Self { Self { - _0sats: AddrOutputsRealizedSupplyPattern::new(client.clone(), "addrs_with_0sats".to_string()), - _1sat_to_10sats: AddrOutputsRealizedSupplyPattern::new(client.clone(), "addrs_above_1sat_under_10sats".to_string()), - _10sats_to_100sats: AddrOutputsRealizedSupplyPattern::new(client.clone(), "addrs_above_10sats_under_100sats".to_string()), - _100sats_to_1k_sats: AddrOutputsRealizedSupplyPattern::new(client.clone(), "addrs_above_100sats_under_1k_sats".to_string()), - _1k_sats_to_10k_sats: AddrOutputsRealizedSupplyPattern::new(client.clone(), "addrs_above_1k_sats_under_10k_sats".to_string()), - _10k_sats_to_100k_sats: AddrOutputsRealizedSupplyPattern::new(client.clone(), "addrs_above_10k_sats_under_100k_sats".to_string()), - _100k_sats_to_1m_sats: AddrOutputsRealizedSupplyPattern::new(client.clone(), "addrs_above_100k_sats_under_1m_sats".to_string()), - _1m_sats_to_10m_sats: AddrOutputsRealizedSupplyPattern::new(client.clone(), "addrs_above_1m_sats_under_10m_sats".to_string()), - _10m_sats_to_1btc: AddrOutputsRealizedSupplyPattern::new(client.clone(), "addrs_above_10m_sats_under_1btc".to_string()), - _1btc_to_10btc: AddrOutputsRealizedSupplyPattern::new(client.clone(), "addrs_above_1btc_under_10btc".to_string()), - _10btc_to_100btc: AddrOutputsRealizedSupplyPattern::new(client.clone(), "addrs_above_10btc_under_100btc".to_string()), - _100btc_to_1k_btc: AddrOutputsRealizedSupplyPattern::new(client.clone(), "addrs_above_100btc_under_1k_btc".to_string()), - _1k_btc_to_10k_btc: AddrOutputsRealizedSupplyPattern::new(client.clone(), "addrs_above_1k_btc_under_10k_btc".to_string()), - _10k_btc_to_100k_btc: AddrOutputsRealizedSupplyPattern::new(client.clone(), "addrs_above_10k_btc_under_100k_btc".to_string()), - _100k_btc_or_more: AddrOutputsRealizedSupplyPattern::new(client.clone(), "addrs_above_100k_btc".to_string()), + _0sats: AddressOutputsRealizedSupplyPattern::new(client.clone(), "addrs_0sats".to_string()), + _1sat_to_10sats: AddressOutputsRealizedSupplyPattern::new(client.clone(), "addrs_1sat_to_10sats".to_string()), + _10sats_to_100sats: AddressOutputsRealizedSupplyPattern::new(client.clone(), "addrs_10sats_to_100sats".to_string()), + _100sats_to_1k_sats: AddressOutputsRealizedSupplyPattern::new(client.clone(), "addrs_100sats_to_1k_sats".to_string()), + _1k_sats_to_10k_sats: AddressOutputsRealizedSupplyPattern::new(client.clone(), "addrs_1k_sats_to_10k_sats".to_string()), + _10k_sats_to_100k_sats: AddressOutputsRealizedSupplyPattern::new(client.clone(), "addrs_10k_sats_to_100k_sats".to_string()), + _100k_sats_to_1m_sats: AddressOutputsRealizedSupplyPattern::new(client.clone(), "addrs_100k_sats_to_1m_sats".to_string()), + _1m_sats_to_10m_sats: AddressOutputsRealizedSupplyPattern::new(client.clone(), "addrs_1m_sats_to_10m_sats".to_string()), + _10m_sats_to_1btc: AddressOutputsRealizedSupplyPattern::new(client.clone(), "addrs_10m_sats_to_1btc".to_string()), + _1btc_to_10btc: AddressOutputsRealizedSupplyPattern::new(client.clone(), "addrs_1btc_to_10btc".to_string()), + _10btc_to_100btc: AddressOutputsRealizedSupplyPattern::new(client.clone(), "addrs_10btc_to_100btc".to_string()), + _100btc_to_1k_btc: AddressOutputsRealizedSupplyPattern::new(client.clone(), "addrs_100btc_to_1k_btc".to_string()), + _1k_btc_to_10k_btc: AddressOutputsRealizedSupplyPattern::new(client.clone(), "addrs_1k_btc_to_10k_btc".to_string()), + _10k_btc_to_100k_btc: AddressOutputsRealizedSupplyPattern::new(client.clone(), "addrs_10k_btc_to_100k_btc".to_string()), + over_100k_btc: AddressOutputsRealizedSupplyPattern::new(client.clone(), "addrs_over_100k_btc".to_string()), } } } /// Metrics tree node. pub struct MetricsTree_Distribution_Cohorts_Address_UnderAmount { - pub _10sats: AddrOutputsRealizedSupplyPattern, - pub _100sats: AddrOutputsRealizedSupplyPattern, - pub _1k_sats: AddrOutputsRealizedSupplyPattern, - pub _10k_sats: AddrOutputsRealizedSupplyPattern, - pub _100k_sats: AddrOutputsRealizedSupplyPattern, - pub _1m_sats: AddrOutputsRealizedSupplyPattern, - pub _10m_sats: AddrOutputsRealizedSupplyPattern, - pub _1btc: AddrOutputsRealizedSupplyPattern, - pub _10btc: AddrOutputsRealizedSupplyPattern, - pub _100btc: AddrOutputsRealizedSupplyPattern, - pub _1k_btc: AddrOutputsRealizedSupplyPattern, - pub _10k_btc: AddrOutputsRealizedSupplyPattern, - pub _100k_btc: AddrOutputsRealizedSupplyPattern, + pub _10sats: AddressOutputsRealizedSupplyPattern, + pub _100sats: AddressOutputsRealizedSupplyPattern, + pub _1k_sats: AddressOutputsRealizedSupplyPattern, + pub _10k_sats: AddressOutputsRealizedSupplyPattern, + pub _100k_sats: AddressOutputsRealizedSupplyPattern, + pub _1m_sats: AddressOutputsRealizedSupplyPattern, + pub _10m_sats: AddressOutputsRealizedSupplyPattern, + pub _1btc: AddressOutputsRealizedSupplyPattern, + pub _10btc: AddressOutputsRealizedSupplyPattern, + pub _100btc: AddressOutputsRealizedSupplyPattern, + pub _1k_btc: AddressOutputsRealizedSupplyPattern, + pub _10k_btc: AddressOutputsRealizedSupplyPattern, + pub _100k_btc: AddressOutputsRealizedSupplyPattern, } impl MetricsTree_Distribution_Cohorts_Address_UnderAmount { pub fn new(client: Arc, base_path: String) -> Self { Self { - _10sats: AddrOutputsRealizedSupplyPattern::new(client.clone(), "addrs_under_10sats".to_string()), - _100sats: AddrOutputsRealizedSupplyPattern::new(client.clone(), "addrs_under_100sats".to_string()), - _1k_sats: AddrOutputsRealizedSupplyPattern::new(client.clone(), "addrs_under_1k_sats".to_string()), - _10k_sats: AddrOutputsRealizedSupplyPattern::new(client.clone(), "addrs_under_10k_sats".to_string()), - _100k_sats: AddrOutputsRealizedSupplyPattern::new(client.clone(), "addrs_under_100k_sats".to_string()), - _1m_sats: AddrOutputsRealizedSupplyPattern::new(client.clone(), "addrs_under_1m_sats".to_string()), - _10m_sats: AddrOutputsRealizedSupplyPattern::new(client.clone(), "addrs_under_10m_sats".to_string()), - _1btc: AddrOutputsRealizedSupplyPattern::new(client.clone(), "addrs_under_1btc".to_string()), - _10btc: AddrOutputsRealizedSupplyPattern::new(client.clone(), "addrs_under_10btc".to_string()), - _100btc: AddrOutputsRealizedSupplyPattern::new(client.clone(), "addrs_under_100btc".to_string()), - _1k_btc: AddrOutputsRealizedSupplyPattern::new(client.clone(), "addrs_under_1k_btc".to_string()), - _10k_btc: AddrOutputsRealizedSupplyPattern::new(client.clone(), "addrs_under_10k_btc".to_string()), - _100k_btc: AddrOutputsRealizedSupplyPattern::new(client.clone(), "addrs_under_100k_btc".to_string()), + _10sats: AddressOutputsRealizedSupplyPattern::new(client.clone(), "addrs_under_10sats".to_string()), + _100sats: AddressOutputsRealizedSupplyPattern::new(client.clone(), "addrs_under_100sats".to_string()), + _1k_sats: AddressOutputsRealizedSupplyPattern::new(client.clone(), "addrs_under_1k_sats".to_string()), + _10k_sats: AddressOutputsRealizedSupplyPattern::new(client.clone(), "addrs_under_10k_sats".to_string()), + _100k_sats: AddressOutputsRealizedSupplyPattern::new(client.clone(), "addrs_under_100k_sats".to_string()), + _1m_sats: AddressOutputsRealizedSupplyPattern::new(client.clone(), "addrs_under_1m_sats".to_string()), + _10m_sats: AddressOutputsRealizedSupplyPattern::new(client.clone(), "addrs_under_10m_sats".to_string()), + _1btc: AddressOutputsRealizedSupplyPattern::new(client.clone(), "addrs_under_1btc".to_string()), + _10btc: AddressOutputsRealizedSupplyPattern::new(client.clone(), "addrs_under_10btc".to_string()), + _100btc: AddressOutputsRealizedSupplyPattern::new(client.clone(), "addrs_under_100btc".to_string()), + _1k_btc: AddressOutputsRealizedSupplyPattern::new(client.clone(), "addrs_under_1k_btc".to_string()), + _10k_btc: AddressOutputsRealizedSupplyPattern::new(client.clone(), "addrs_under_10k_btc".to_string()), + _100k_btc: AddressOutputsRealizedSupplyPattern::new(client.clone(), "addrs_under_100k_btc".to_string()), } } } diff --git a/crates/brk_cohort/src/age_range.rs b/crates/brk_cohort/src/age_range.rs index cf51d08ec..09b5657ab 100644 --- a/crates/brk_cohort/src/age_range.rs +++ b/crates/brk_cohort/src/age_range.rs @@ -39,7 +39,7 @@ pub const AGE_BOUNDARIES: [usize; 20] = [ /// Age range bounds (end = usize::MAX means unbounded) pub const AGE_RANGE_BOUNDS: AgeRange> = AgeRange { - up_to_1h: 0..HOURS_1H, + under_1h: 0..HOURS_1H, _1h_to_1d: HOURS_1H..HOURS_1D, _1d_to_1w: HOURS_1D..HOURS_1W, _1w_to_1m: HOURS_1W..HOURS_1M, @@ -59,12 +59,12 @@ pub const AGE_RANGE_BOUNDS: AgeRange> = AgeRange { _8y_to_10y: HOURS_8Y..HOURS_10Y, _10y_to_12y: HOURS_10Y..HOURS_12Y, _12y_to_15y: HOURS_12Y..HOURS_15Y, - from_15y: HOURS_15Y..usize::MAX, + over_15y: HOURS_15Y..usize::MAX, }; /// Age range filters pub const AGE_RANGE_FILTERS: AgeRange = AgeRange { - up_to_1h: Filter::Time(TimeFilter::Range(AGE_RANGE_BOUNDS.up_to_1h)), + under_1h: Filter::Time(TimeFilter::Range(AGE_RANGE_BOUNDS.under_1h)), _1h_to_1d: Filter::Time(TimeFilter::Range(AGE_RANGE_BOUNDS._1h_to_1d)), _1d_to_1w: Filter::Time(TimeFilter::Range(AGE_RANGE_BOUNDS._1d_to_1w)), _1w_to_1m: Filter::Time(TimeFilter::Range(AGE_RANGE_BOUNDS._1w_to_1m)), @@ -84,12 +84,12 @@ pub const AGE_RANGE_FILTERS: AgeRange = AgeRange { _8y_to_10y: Filter::Time(TimeFilter::Range(AGE_RANGE_BOUNDS._8y_to_10y)), _10y_to_12y: Filter::Time(TimeFilter::Range(AGE_RANGE_BOUNDS._10y_to_12y)), _12y_to_15y: Filter::Time(TimeFilter::Range(AGE_RANGE_BOUNDS._12y_to_15y)), - from_15y: Filter::Time(TimeFilter::Range(AGE_RANGE_BOUNDS.from_15y)), + over_15y: Filter::Time(TimeFilter::Range(AGE_RANGE_BOUNDS.over_15y)), }; /// Age range names pub const AGE_RANGE_NAMES: AgeRange = AgeRange { - up_to_1h: CohortName::new("under_1h_old", "<1h", "Under 1 Hour Old"), + under_1h: CohortName::new("under_1h_old", "<1h", "Under 1 Hour Old"), _1h_to_1d: CohortName::new("1h_to_1d_old", "1h-1d", "1 Hour to 1 Day Old"), _1d_to_1w: CohortName::new("1d_to_1w_old", "1d-1w", "1 Day to 1 Week Old"), _1w_to_1m: CohortName::new("1w_to_1m_old", "1w-1m", "1 Week to 1 Month Old"), @@ -109,7 +109,7 @@ pub const AGE_RANGE_NAMES: AgeRange = AgeRange { _8y_to_10y: CohortName::new("8y_to_10y_old", "8y-10y", "8 to 10 Years Old"), _10y_to_12y: CohortName::new("10y_to_12y_old", "10y-12y", "10 to 12 Years Old"), _12y_to_15y: CohortName::new("12y_to_15y_old", "12y-15y", "12 to 15 Years Old"), - from_15y: CohortName::new("over_15y_old", "15y+", "15+ Years Old"), + over_15y: CohortName::new("over_15y_old", "15y+", "15+ Years Old"), }; impl AgeRange { @@ -120,7 +120,7 @@ impl AgeRange { #[derive(Default, Clone, Traversable, Serialize)] pub struct AgeRange { - pub up_to_1h: T, + pub under_1h: T, pub _1h_to_1d: T, pub _1d_to_1w: T, pub _1w_to_1m: T, @@ -140,7 +140,7 @@ pub struct AgeRange { pub _8y_to_10y: T, pub _10y_to_12y: T, pub _12y_to_15y: T, - pub from_15y: T, + pub over_15y: T, } impl AgeRange { @@ -148,7 +148,7 @@ impl AgeRange { #[inline] pub fn get_mut(&mut self, age: Age) -> &mut T { match age.hours() { - 0..HOURS_1H => &mut self.up_to_1h, + 0..HOURS_1H => &mut self.under_1h, HOURS_1H..HOURS_1D => &mut self._1h_to_1d, HOURS_1D..HOURS_1W => &mut self._1d_to_1w, HOURS_1W..HOURS_1M => &mut self._1w_to_1m, @@ -168,7 +168,7 @@ impl AgeRange { HOURS_8Y..HOURS_10Y => &mut self._8y_to_10y, HOURS_10Y..HOURS_12Y => &mut self._10y_to_12y, HOURS_12Y..HOURS_15Y => &mut self._12y_to_15y, - _ => &mut self.from_15y, + _ => &mut self.over_15y, } } @@ -176,7 +176,7 @@ impl AgeRange { #[inline] pub fn get(&self, age: Age) -> &T { match age.hours() { - 0..HOURS_1H => &self.up_to_1h, + 0..HOURS_1H => &self.under_1h, HOURS_1H..HOURS_1D => &self._1h_to_1d, HOURS_1D..HOURS_1W => &self._1d_to_1w, HOURS_1W..HOURS_1M => &self._1w_to_1m, @@ -196,14 +196,14 @@ impl AgeRange { HOURS_8Y..HOURS_10Y => &self._8y_to_10y, HOURS_10Y..HOURS_12Y => &self._10y_to_12y, HOURS_12Y..HOURS_15Y => &self._12y_to_15y, - _ => &self.from_15y, + _ => &self.over_15y, } } pub fn from_array(arr: [T; 21]) -> Self { let [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20] = arr; Self { - up_to_1h: a0, + under_1h: a0, _1h_to_1d: a1, _1d_to_1w: a2, _1w_to_1m: a3, @@ -223,7 +223,7 @@ impl AgeRange { _8y_to_10y: a17, _10y_to_12y: a18, _12y_to_15y: a19, - from_15y: a20, + over_15y: a20, } } @@ -234,7 +234,7 @@ impl AgeRange { let f = AGE_RANGE_FILTERS; let n = AGE_RANGE_NAMES; Self { - up_to_1h: create(f.up_to_1h.clone(), n.up_to_1h.id), + under_1h: create(f.under_1h.clone(), n.under_1h.id), _1h_to_1d: create(f._1h_to_1d.clone(), n._1h_to_1d.id), _1d_to_1w: create(f._1d_to_1w.clone(), n._1d_to_1w.id), _1w_to_1m: create(f._1w_to_1m.clone(), n._1w_to_1m.id), @@ -254,7 +254,7 @@ impl AgeRange { _8y_to_10y: create(f._8y_to_10y.clone(), n._8y_to_10y.id), _10y_to_12y: create(f._10y_to_12y.clone(), n._10y_to_12y.id), _12y_to_15y: create(f._12y_to_15y.clone(), n._12y_to_15y.id), - from_15y: create(f.from_15y.clone(), n.from_15y.id), + over_15y: create(f.over_15y.clone(), n.over_15y.id), } } @@ -265,7 +265,7 @@ impl AgeRange { let f = AGE_RANGE_FILTERS; let n = AGE_RANGE_NAMES; Ok(Self { - up_to_1h: create(f.up_to_1h.clone(), n.up_to_1h.id)?, + under_1h: create(f.under_1h.clone(), n.under_1h.id)?, _1h_to_1d: create(f._1h_to_1d.clone(), n._1h_to_1d.id)?, _1d_to_1w: create(f._1d_to_1w.clone(), n._1d_to_1w.id)?, _1w_to_1m: create(f._1w_to_1m.clone(), n._1w_to_1m.id)?, @@ -285,13 +285,13 @@ impl AgeRange { _8y_to_10y: create(f._8y_to_10y.clone(), n._8y_to_10y.id)?, _10y_to_12y: create(f._10y_to_12y.clone(), n._10y_to_12y.id)?, _12y_to_15y: create(f._12y_to_15y.clone(), n._12y_to_15y.id)?, - from_15y: create(f.from_15y.clone(), n.from_15y.id)?, + over_15y: create(f.over_15y.clone(), n.over_15y.id)?, }) } pub fn iter(&self) -> impl Iterator { [ - &self.up_to_1h, + &self.under_1h, &self._1h_to_1d, &self._1d_to_1w, &self._1w_to_1m, @@ -311,14 +311,14 @@ impl AgeRange { &self._8y_to_10y, &self._10y_to_12y, &self._12y_to_15y, - &self.from_15y, + &self.over_15y, ] .into_iter() } pub fn iter_mut(&mut self) -> impl Iterator { [ - &mut self.up_to_1h, + &mut self.under_1h, &mut self._1h_to_1d, &mut self._1d_to_1w, &mut self._1w_to_1m, @@ -338,7 +338,7 @@ impl AgeRange { &mut self._8y_to_10y, &mut self._10y_to_12y, &mut self._12y_to_15y, - &mut self.from_15y, + &mut self.over_15y, ] .into_iter() } @@ -348,7 +348,7 @@ impl AgeRange { T: Send + Sync, { [ - &mut self.up_to_1h, + &mut self.under_1h, &mut self._1h_to_1d, &mut self._1d_to_1w, &mut self._1w_to_1m, @@ -368,7 +368,7 @@ impl AgeRange { &mut self._8y_to_10y, &mut self._10y_to_12y, &mut self._12y_to_15y, - &mut self.from_15y, + &mut self.over_15y, ] .into_par_iter() } diff --git a/crates/brk_cohort/src/amount_range.rs b/crates/brk_cohort/src/amount_range.rs index ed54c7dc3..a5338031a 100644 --- a/crates/brk_cohort/src/amount_range.rs +++ b/crates/brk_cohort/src/amount_range.rs @@ -74,50 +74,26 @@ pub const AMOUNT_RANGE_BOUNDS: AmountRange> = AmountRange { _100btc_to_1k_btc: Sats::_100BTC..Sats::_1K_BTC, _1k_btc_to_10k_btc: Sats::_1K_BTC..Sats::_10K_BTC, _10k_btc_to_100k_btc: Sats::_10K_BTC..Sats::_100K_BTC, - _100k_btc_or_more: Sats::_100K_BTC..Sats::MAX, + over_100k_btc: Sats::_100K_BTC..Sats::MAX, }; /// Amount range names pub const AMOUNT_RANGE_NAMES: AmountRange = AmountRange { - _0sats: CohortName::new("with_0sats", "0 sats", "0 Sats"), - _1sat_to_10sats: CohortName::new("above_1sat_under_10sats", "1-10 sats", "1-10 Sats"), - _10sats_to_100sats: CohortName::new("above_10sats_under_100sats", "10-100 sats", "10-100 Sats"), - _100sats_to_1k_sats: CohortName::new( - "above_100sats_under_1k_sats", - "100-1k sats", - "100-1K Sats", - ), - _1k_sats_to_10k_sats: CohortName::new( - "above_1k_sats_under_10k_sats", - "1k-10k sats", - "1K-10K Sats", - ), - _10k_sats_to_100k_sats: CohortName::new( - "above_10k_sats_under_100k_sats", - "10k-100k sats", - "10K-100K Sats", - ), - _100k_sats_to_1m_sats: CohortName::new( - "above_100k_sats_under_1m_sats", - "100k-1M sats", - "100K-1M Sats", - ), - _1m_sats_to_10m_sats: CohortName::new( - "above_1m_sats_under_10m_sats", - "1M-10M sats", - "1M-10M Sats", - ), - _10m_sats_to_1btc: CohortName::new("above_10m_sats_under_1btc", "0.1-1 BTC", "0.1-1 BTC"), - _1btc_to_10btc: CohortName::new("above_1btc_under_10btc", "1-10 BTC", "1-10 BTC"), - _10btc_to_100btc: CohortName::new("above_10btc_under_100btc", "10-100 BTC", "10-100 BTC"), - _100btc_to_1k_btc: CohortName::new("above_100btc_under_1k_btc", "100-1k BTC", "100-1K BTC"), - _1k_btc_to_10k_btc: CohortName::new("above_1k_btc_under_10k_btc", "1k-10k BTC", "1K-10K BTC"), - _10k_btc_to_100k_btc: CohortName::new( - "above_10k_btc_under_100k_btc", - "10k-100k BTC", - "10K-100K BTC", - ), - _100k_btc_or_more: CohortName::new("above_100k_btc", "100k+ BTC", "100K+ BTC"), + _0sats: CohortName::new("0sats", "0 sats", "0 Sats"), + _1sat_to_10sats: CohortName::new("1sat_to_10sats", "1-10 sats", "1-10 Sats"), + _10sats_to_100sats: CohortName::new("10sats_to_100sats", "10-100 sats", "10-100 Sats"), + _100sats_to_1k_sats: CohortName::new("100sats_to_1k_sats", "100-1k sats", "100-1K Sats"), + _1k_sats_to_10k_sats: CohortName::new("1k_sats_to_10k_sats", "1k-10k sats", "1K-10K Sats"), + _10k_sats_to_100k_sats: CohortName::new("10k_sats_to_100k_sats", "10k-100k sats", "10K-100K Sats"), + _100k_sats_to_1m_sats: CohortName::new("100k_sats_to_1m_sats", "100k-1M sats", "100K-1M Sats"), + _1m_sats_to_10m_sats: CohortName::new("1m_sats_to_10m_sats", "1M-10M sats", "1M-10M Sats"), + _10m_sats_to_1btc: CohortName::new("10m_sats_to_1btc", "0.1-1 BTC", "0.1-1 BTC"), + _1btc_to_10btc: CohortName::new("1btc_to_10btc", "1-10 BTC", "1-10 BTC"), + _10btc_to_100btc: CohortName::new("10btc_to_100btc", "10-100 BTC", "10-100 BTC"), + _100btc_to_1k_btc: CohortName::new("100btc_to_1k_btc", "100-1k BTC", "100-1K BTC"), + _1k_btc_to_10k_btc: CohortName::new("1k_btc_to_10k_btc", "1k-10k BTC", "1K-10K BTC"), + _10k_btc_to_100k_btc: CohortName::new("10k_btc_to_100k_btc", "10k-100k BTC", "10K-100K BTC"), + over_100k_btc: CohortName::new("over_100k_btc", "100k+ BTC", "100K+ BTC"), }; /// Amount range filters @@ -148,7 +124,7 @@ pub const AMOUNT_RANGE_FILTERS: AmountRange = AmountRange { _10k_btc_to_100k_btc: Filter::Amount(AmountFilter::Range( AMOUNT_RANGE_BOUNDS._10k_btc_to_100k_btc, )), - _100k_btc_or_more: Filter::Amount(AmountFilter::Range(AMOUNT_RANGE_BOUNDS._100k_btc_or_more)), + over_100k_btc: Filter::Amount(AmountFilter::Range(AMOUNT_RANGE_BOUNDS.over_100k_btc)), }; #[derive(Debug, Default, Clone, Traversable, Serialize)] @@ -167,7 +143,7 @@ pub struct AmountRange { pub _100btc_to_1k_btc: T, pub _1k_btc_to_10k_btc: T, pub _10k_btc_to_100k_btc: T, - pub _100k_btc_or_more: T, + pub over_100k_btc: T, } impl AmountRange { @@ -204,7 +180,7 @@ impl AmountRange { _100btc_to_1k_btc: create(f._100btc_to_1k_btc.clone(), n._100btc_to_1k_btc.id), _1k_btc_to_10k_btc: create(f._1k_btc_to_10k_btc.clone(), n._1k_btc_to_10k_btc.id), _10k_btc_to_100k_btc: create(f._10k_btc_to_100k_btc.clone(), n._10k_btc_to_100k_btc.id), - _100k_btc_or_more: create(f._100k_btc_or_more.clone(), n._100k_btc_or_more.id), + over_100k_btc: create(f.over_100k_btc.clone(), n.over_100k_btc.id), } } @@ -244,7 +220,7 @@ impl AmountRange { f._10k_btc_to_100k_btc.clone(), n._10k_btc_to_100k_btc.id, )?, - _100k_btc_or_more: create(f._100k_btc_or_more.clone(), n._100k_btc_or_more.id)?, + over_100k_btc: create(f.over_100k_btc.clone(), n.over_100k_btc.id)?, }) } @@ -265,7 +241,7 @@ impl AmountRange { 11 => &self._100btc_to_1k_btc, 12 => &self._1k_btc_to_10k_btc, 13 => &self._10k_btc_to_100k_btc, - _ => &self._100k_btc_or_more, + _ => &self.over_100k_btc, } } @@ -293,7 +269,7 @@ impl AmountRange { 11 => &mut self._100btc_to_1k_btc, 12 => &mut self._1k_btc_to_10k_btc, 13 => &mut self._10k_btc_to_100k_btc, - _ => &mut self._100k_btc_or_more, + _ => &mut self.over_100k_btc, } } @@ -313,7 +289,7 @@ impl AmountRange { &self._100btc_to_1k_btc, &self._1k_btc_to_10k_btc, &self._10k_btc_to_100k_btc, - &self._100k_btc_or_more, + &self.over_100k_btc, ] .into_iter() } @@ -334,7 +310,7 @@ impl AmountRange { (Sats::_100BTC, &self._100btc_to_1k_btc), (Sats::_1K_BTC, &self._1k_btc_to_10k_btc), (Sats::_10K_BTC, &self._10k_btc_to_100k_btc), - (Sats::_100K_BTC, &self._100k_btc_or_more), + (Sats::_100K_BTC, &self.over_100k_btc), ] .into_iter() } @@ -355,7 +331,7 @@ impl AmountRange { &mut self._100btc_to_1k_btc, &mut self._1k_btc_to_10k_btc, &mut self._10k_btc_to_100k_btc, - &mut self._100k_btc_or_more, + &mut self.over_100k_btc, ] .into_iter() } @@ -379,7 +355,7 @@ impl AmountRange { &mut self._100btc_to_1k_btc, &mut self._1k_btc_to_10k_btc, &mut self._10k_btc_to_100k_btc, - &mut self._100k_btc_or_more, + &mut self.over_100k_btc, ] .into_par_iter() } @@ -406,7 +382,7 @@ where _100btc_to_1k_btc: self._100btc_to_1k_btc + rhs._100btc_to_1k_btc, _1k_btc_to_10k_btc: self._1k_btc_to_10k_btc + rhs._1k_btc_to_10k_btc, _10k_btc_to_100k_btc: self._10k_btc_to_100k_btc + rhs._10k_btc_to_100k_btc, - _100k_btc_or_more: self._100k_btc_or_more + rhs._100k_btc_or_more, + over_100k_btc: self.over_100k_btc + rhs.over_100k_btc, } } } @@ -430,6 +406,6 @@ where self._100btc_to_1k_btc += rhs._100btc_to_1k_btc; self._1k_btc_to_10k_btc += rhs._1k_btc_to_10k_btc; self._10k_btc_to_100k_btc += rhs._10k_btc_to_100k_btc; - self._100k_btc_or_more += rhs._100k_btc_or_more; + self.over_100k_btc += rhs.over_100k_btc; } } diff --git a/crates/brk_computer/Cargo.toml b/crates/brk_computer/Cargo.toml index d54949372..f511ea3a6 100644 --- a/crates/brk_computer/Cargo.toml +++ b/crates/brk_computer/Cargo.toml @@ -22,7 +22,6 @@ brk_store = { workspace = true } brk_traversable = { workspace = true } brk_types = { workspace = true } derive_more = { workspace = true } -pco = { workspace = true } tracing = { workspace = true } rayon = { workspace = true } rustc-hash = { workspace = true } diff --git a/crates/brk_computer/src/distribution/address/address_count.rs b/crates/brk_computer/src/distribution/address/address_count.rs index 1efe10cb9..b4d01b250 100644 --- a/crates/brk_computer/src/distribution/address/address_count.rs +++ b/crates/brk_computer/src/distribution/address/address_count.rs @@ -12,11 +12,11 @@ use vecdb::{ use crate::{indexes, internal::ComputedPerBlock}; #[derive(Deref, DerefMut, Traversable)] -pub struct AddrCountVecs( +pub struct AddressCountVecs( #[traversable(flatten)] pub ComputedPerBlock, ); -impl AddrCountVecs { +impl AddressCountVecs { pub(crate) fn forced_import( db: &Database, name: &str, @@ -40,9 +40,9 @@ impl AddressTypeToAddressCount { } } -impl From<(&AddressTypeToAddrCountVecs, Height)> for AddressTypeToAddressCount { +impl From<(&AddressTypeToAddressCountVecs, Height)> for AddressTypeToAddressCount { #[inline] - fn from((groups, starting_height): (&AddressTypeToAddrCountVecs, Height)) -> Self { + fn from((groups, starting_height): (&AddressTypeToAddressCountVecs, Height)) -> Self { if let Some(prev_height) = starting_height.decremented() { Self(ByAddressType { p2pk65: groups @@ -102,25 +102,25 @@ impl From<(&AddressTypeToAddrCountVecs, Height)> for AddressTypeToAddressCount { /// Address count per address type, with height + derived indexes. #[derive(Deref, DerefMut, Traversable)] -pub struct AddressTypeToAddrCountVecs(ByAddressType>); +pub struct AddressTypeToAddressCountVecs(ByAddressType>); -impl From> for AddressTypeToAddrCountVecs { +impl From> for AddressTypeToAddressCountVecs { #[inline] - fn from(value: ByAddressType) -> Self { + fn from(value: ByAddressType) -> Self { Self(value) } } -impl AddressTypeToAddrCountVecs { +impl AddressTypeToAddressCountVecs { pub(crate) fn forced_import( db: &Database, name: &str, version: Version, indexes: &indexes::Vecs, ) -> Result { - Ok(Self::from(ByAddressType::::new_with_name( + Ok(Self::from(ByAddressType::::new_with_name( |type_name| { - AddrCountVecs::forced_import(db, &format!("{type_name}_{name}"), version, indexes) + AddressCountVecs::forced_import(db, &format!("{type_name}_{name}"), version, indexes) }, )?)) } @@ -140,9 +140,9 @@ impl AddressTypeToAddrCountVecs { pub(crate) fn truncate_push_height( &mut self, height: Height, - addr_counts: &AddressTypeToAddressCount, + address_counts: &AddressTypeToAddressCount, ) -> Result<()> { - for (vecs, &count) in self.0.values_mut().zip(addr_counts.values()) { + for (vecs, &count) in self.0.values_mut().zip(address_counts.values()) { vecs.height.truncate_push(height, count.into())?; } Ok(()) @@ -162,13 +162,13 @@ impl AddressTypeToAddrCountVecs { } #[derive(Traversable)] -pub struct AddrCountsVecs { - pub all: AddrCountVecs, +pub struct AddressCountsVecs { + pub all: AddressCountVecs, #[traversable(flatten)] - pub by_addresstype: AddressTypeToAddrCountVecs, + pub by_addresstype: AddressTypeToAddressCountVecs, } -impl AddrCountsVecs { +impl AddressCountsVecs { pub(crate) fn forced_import( db: &Database, name: &str, @@ -176,8 +176,8 @@ impl AddrCountsVecs { indexes: &indexes::Vecs, ) -> Result { Ok(Self { - all: AddrCountVecs::forced_import(db, name, version, indexes)?, - by_addresstype: AddressTypeToAddrCountVecs::forced_import(db, name, version, indexes)?, + all: AddressCountVecs::forced_import(db, name, version, indexes)?, + by_addresstype: AddressTypeToAddressCountVecs::forced_import(db, name, version, indexes)?, }) } @@ -202,11 +202,11 @@ impl AddrCountsVecs { &mut self, height: Height, total: u64, - addr_counts: &AddressTypeToAddressCount, + address_counts: &AddressTypeToAddressCount, ) -> Result<()> { self.all.height.truncate_push(height, total.into())?; self.by_addresstype - .truncate_push_height(height, addr_counts)?; + .truncate_push_height(height, address_counts)?; Ok(()) } diff --git a/crates/brk_computer/src/distribution/address/delta.rs b/crates/brk_computer/src/distribution/address/delta.rs index a6f8cc85f..b20e2840b 100644 --- a/crates/brk_computer/src/distribution/address/delta.rs +++ b/crates/brk_computer/src/distribution/address/delta.rs @@ -9,7 +9,7 @@ use crate::{ internal::{WindowStarts, RollingDelta}, }; -use super::AddrCountsVecs; +use super::AddressCountsVecs; #[derive(Traversable)] pub struct DeltaVecs { @@ -26,10 +26,10 @@ impl DeltaVecs { ) -> Result { let version = version + Version::TWO; - let all = RollingDelta::forced_import(db, "addr_count", version, indexes)?; + let all = RollingDelta::forced_import(db, "address_count", version, indexes)?; let by_addresstype = ByAddressType::new_with_name(|name| { - RollingDelta::forced_import(db, &format!("{name}_addr_count"), version, indexes) + RollingDelta::forced_import(db, &format!("{name}_address_count"), version, indexes) })?; Ok(Self { @@ -42,16 +42,16 @@ impl DeltaVecs { &mut self, max_from: Height, windows: &WindowStarts<'_>, - addr_count: &AddrCountsVecs, + address_count: &AddressCountsVecs, exit: &Exit, ) -> Result<()> { self.all - .compute(max_from, windows, &addr_count.all.height, exit)?; + .compute(max_from, windows, &address_count.all.height, exit)?; for ((_, growth), (_, addr)) in self .by_addresstype .iter_mut() - .zip(addr_count.by_addresstype.iter()) + .zip(address_count.by_addresstype.iter()) { growth.compute(max_from, windows, &addr.height, exit)?; } diff --git a/crates/brk_computer/src/distribution/address/mod.rs b/crates/brk_computer/src/distribution/address/mod.rs index 1e43ae339..5ef4caadd 100644 --- a/crates/brk_computer/src/distribution/address/mod.rs +++ b/crates/brk_computer/src/distribution/address/mod.rs @@ -3,15 +3,15 @@ mod address_count; mod data; mod delta; mod indexes; -mod new_addr_count; -mod total_addr_count; +mod new_address_count; +mod total_address_count; mod type_map; pub use activity::{AddressActivityVecs, AddressTypeToActivityCounts}; -pub use address_count::{AddrCountsVecs, AddressTypeToAddressCount}; +pub use address_count::{AddressCountsVecs, AddressTypeToAddressCount}; pub use data::AddressesDataVecs; pub use delta::DeltaVecs; pub use indexes::AnyAddressIndexesVecs; -pub use new_addr_count::NewAddrCountVecs; -pub use total_addr_count::TotalAddrCountVecs; +pub use new_address_count::NewAddressCountVecs; +pub use total_address_count::TotalAddressCountVecs; pub use type_map::{AddressTypeToTypeIndexMap, AddressTypeToVec, HeightToAddressTypeToVec}; diff --git a/crates/brk_computer/src/distribution/address/new_addr_count.rs b/crates/brk_computer/src/distribution/address/new_address_count.rs similarity index 79% rename from crates/brk_computer/src/distribution/address/new_addr_count.rs rename to crates/brk_computer/src/distribution/address/new_address_count.rs index ce8563faf..8dd1e58d5 100644 --- a/crates/brk_computer/src/distribution/address/new_addr_count.rs +++ b/crates/brk_computer/src/distribution/address/new_address_count.rs @@ -9,29 +9,29 @@ use crate::{ internal::{ComputedPerBlockSum, WindowStarts}, }; -use super::TotalAddrCountVecs; +use super::TotalAddressCountVecs; /// New address count per block (global + per-type) #[derive(Traversable)] -pub struct NewAddrCountVecs { +pub struct NewAddressCountVecs { pub all: ComputedPerBlockSum, #[traversable(flatten)] pub by_addresstype: ByAddressType>, } -impl NewAddrCountVecs { +impl NewAddressCountVecs { pub(crate) fn forced_import( db: &Database, version: Version, indexes: &indexes::Vecs, ) -> Result { - let all = ComputedPerBlockSum::forced_import(db, "new_addr_count", version, indexes)?; + let all = ComputedPerBlockSum::forced_import(db, "new_address_count", version, indexes)?; let by_addresstype: ByAddressType> = ByAddressType::new_with_name(|name| { ComputedPerBlockSum::forced_import( db, - &format!("{name}_new_addr_count"), + &format!("{name}_new_address_count"), version, indexes, ) @@ -47,17 +47,17 @@ impl NewAddrCountVecs { &mut self, max_from: Height, windows: &WindowStarts<'_>, - total_addr_count: &TotalAddrCountVecs, + total_address_count: &TotalAddressCountVecs, exit: &Exit, ) -> Result<()> { self.all.compute(max_from, windows, exit, |height_vec| { - Ok(height_vec.compute_change(max_from, &total_addr_count.all.height, 1, exit)?) + Ok(height_vec.compute_change(max_from, &total_address_count.all.height, 1, exit)?) })?; for ((_, new), (_, total)) in self .by_addresstype .iter_mut() - .zip(total_addr_count.by_addresstype.iter()) + .zip(total_address_count.by_addresstype.iter()) { new.compute(max_from, windows, exit, |height_vec| { Ok(height_vec.compute_change(max_from, &total.height, 1, exit)?) diff --git a/crates/brk_computer/src/distribution/address/total_addr_count.rs b/crates/brk_computer/src/distribution/address/total_address_count.rs similarity index 74% rename from crates/brk_computer/src/distribution/address/total_addr_count.rs rename to crates/brk_computer/src/distribution/address/total_address_count.rs index e7a72917e..17ded9c7a 100644 --- a/crates/brk_computer/src/distribution/address/total_addr_count.rs +++ b/crates/brk_computer/src/distribution/address/total_address_count.rs @@ -6,29 +6,29 @@ use vecdb::{Database, Exit, Rw, StorageMode}; use crate::{indexes, internal::ComputedPerBlock}; -use super::AddrCountsVecs; +use super::AddressCountsVecs; /// Total address count (global + per-type) with all derived indexes #[derive(Traversable)] -pub struct TotalAddrCountVecs { +pub struct TotalAddressCountVecs { pub all: ComputedPerBlock, #[traversable(flatten)] pub by_addresstype: ByAddressType>, } -impl TotalAddrCountVecs { +impl TotalAddressCountVecs { pub(crate) fn forced_import( db: &Database, version: Version, indexes: &indexes::Vecs, ) -> Result { - let all = ComputedPerBlock::forced_import(db, "total_addr_count", version, indexes)?; + let all = ComputedPerBlock::forced_import(db, "total_address_count", version, indexes)?; let by_addresstype: ByAddressType> = ByAddressType::new_with_name(|name| { ComputedPerBlock::forced_import( db, - &format!("{name}_total_addr_count"), + &format!("{name}_total_address_count"), version, indexes, ) @@ -40,26 +40,26 @@ impl TotalAddrCountVecs { }) } - /// Eagerly compute total = addr_count + empty_addr_count. + /// Eagerly compute total = address_count + empty_address_count. pub(crate) fn compute( &mut self, max_from: Height, - addr_count: &AddrCountsVecs, - empty_addr_count: &AddrCountsVecs, + address_count: &AddressCountsVecs, + empty_address_count: &AddressCountsVecs, exit: &Exit, ) -> Result<()> { self.all.height.compute_add( max_from, - &addr_count.all.height, - &empty_addr_count.all.height, + &address_count.all.height, + &empty_address_count.all.height, exit, )?; for ((_, total), ((_, addr), (_, empty))) in self.by_addresstype.iter_mut().zip( - addr_count + address_count .by_addresstype .iter() - .zip(empty_addr_count.by_addresstype.iter()), + .zip(empty_address_count.by_addresstype.iter()), ) { total .height diff --git a/crates/brk_computer/src/distribution/block/cohort/received.rs b/crates/brk_computer/src/distribution/block/cohort/received.rs index ecb243d20..a863304a1 100644 --- a/crates/brk_computer/src/distribution/block/cohort/received.rs +++ b/crates/brk_computer/src/distribution/block/cohort/received.rs @@ -22,8 +22,8 @@ pub(crate) fn process_received( cohorts: &mut AddressCohorts, lookup: &mut AddressLookup<'_>, price: Cents, - addr_count: &mut ByAddressType, - empty_addr_count: &mut ByAddressType, + address_count: &mut ByAddressType, + empty_address_count: &mut ByAddressType, activity_counts: &mut AddressTypeToActivityCounts, ) { let max_type_len = received_data.iter().map(|(_, v)| v.len()).max().unwrap_or(0); @@ -36,8 +36,8 @@ pub(crate) fn process_received( } // Cache mutable refs for this address type - let type_addr_count = addr_count.get_mut(output_type).unwrap(); - let type_empty_count = empty_addr_count.get_mut(output_type).unwrap(); + let type_address_count = address_count.get_mut(output_type).unwrap(); + let type_empty_count = empty_address_count.get_mut(output_type).unwrap(); let type_activity = activity_counts.get_mut_unwrap(output_type); // Aggregate receives by address - each address processed exactly once @@ -55,10 +55,10 @@ pub(crate) fn process_received( match status { TrackingStatus::New => { - *type_addr_count += 1; + *type_address_count += 1; } TrackingStatus::WasEmpty => { - *type_addr_count += 1; + *type_address_count += 1; *type_empty_count -= 1; // Reactivated - was empty, now has funds type_activity.reactivated += 1; diff --git a/crates/brk_computer/src/distribution/block/cohort/sent.rs b/crates/brk_computer/src/distribution/block/cohort/sent.rs index c71709868..a85a7c91f 100644 --- a/crates/brk_computer/src/distribution/block/cohort/sent.rs +++ b/crates/brk_computer/src/distribution/block/cohort/sent.rs @@ -32,8 +32,8 @@ pub(crate) fn process_sent( lookup: &mut AddressLookup<'_>, current_price: Cents, price_range_max: &PriceRangeMax, - addr_count: &mut ByAddressType, - empty_addr_count: &mut ByAddressType, + address_count: &mut ByAddressType, + empty_address_count: &mut ByAddressType, activity_counts: &mut AddressTypeToActivityCounts, received_addresses: &ByAddressType>, height_to_price: &[Cents], @@ -55,8 +55,8 @@ pub(crate) fn process_sent( for (output_type, vec) in by_type.unwrap().into_iter() { // Cache mutable refs for this address type - let type_addr_count = addr_count.get_mut(output_type).unwrap(); - let type_empty_count = empty_addr_count.get_mut(output_type).unwrap(); + let type_address_count = address_count.get_mut(output_type).unwrap(); + let type_empty_count = empty_address_count.get_mut(output_type).unwrap(); let type_activity = activity_counts.get_mut_unwrap(output_type); let type_received = received_addresses.get(output_type); let type_seen = seen_senders.get_mut_unwrap(output_type); @@ -126,7 +126,7 @@ pub(crate) fn process_sent( unreachable!() } - *type_addr_count -= 1; + *type_address_count -= 1; *type_empty_count += 1; // Move from funded to empty diff --git a/crates/brk_computer/src/distribution/cohorts/address/groups.rs b/crates/brk_computer/src/distribution/cohorts/address/groups.rs index f1cf4abd3..d0d489a56 100644 --- a/crates/brk_computer/src/distribution/cohorts/address/groups.rs +++ b/crates/brk_computer/src/distribution/cohorts/address/groups.rs @@ -96,10 +96,10 @@ impl AddressCohorts { exit: &Exit, ) -> Result<()> { self.par_iter_mut().try_for_each(|v| { - v.addr_count_delta.compute( + v.address_count_delta.compute( starting_indexes.height, &blocks.lookback._1m, - &v.addr_count.height, + &v.address_count.height, exit, ) })?; diff --git a/crates/brk_computer/src/distribution/cohorts/address/vecs.rs b/crates/brk_computer/src/distribution/cohorts/address/vecs.rs index 3c115360e..32f708dcb 100644 --- a/crates/brk_computer/src/distribution/cohorts/address/vecs.rs +++ b/crates/brk_computer/src/distribution/cohorts/address/vecs.rs @@ -28,9 +28,9 @@ pub struct AddressCohortVecs { #[traversable(flatten)] pub metrics: MinimalCohortMetrics, - pub addr_count: ComputedPerBlock, - #[traversable(wrap = "addr_count", rename = "delta")] - pub addr_count_delta: RollingDelta1m, + pub address_count: ComputedPerBlock, + #[traversable(wrap = "address_count", rename = "delta")] + pub address_count_delta: RollingDelta1m, } impl AddressCohortVecs { @@ -59,15 +59,15 @@ impl AddressCohortVecs { metrics: MinimalCohortMetrics::forced_import(&cfg)?, - addr_count: ComputedPerBlock::forced_import( + address_count: ComputedPerBlock::forced_import( db, - &cfg.name("addr_count"), + &cfg.name("address_count"), version, indexes, )?, - addr_count_delta: RollingDelta1m::forced_import( + address_count_delta: RollingDelta1m::forced_import( db, - &cfg.name("addr_count_delta"), + &cfg.name("address_count_delta"), version + Version::ONE, indexes, )?, @@ -82,7 +82,7 @@ impl AddressCohortVecs { &mut self, ) -> impl ParallelIterator { let mut vecs: Vec<&mut dyn AnyStoredVec> = Vec::new(); - vecs.push(&mut self.addr_count.height as &mut dyn AnyStoredVec); + vecs.push(&mut self.address_count.height as &mut dyn AnyStoredVec); vecs.extend(self.metrics.collect_all_vecs_mut()); vecs.into_par_iter() } @@ -103,7 +103,7 @@ impl Filtered for AddressCohortVecs { impl DynCohortVecs for AddressCohortVecs { fn min_stateful_len(&self) -> usize { - self.addr_count + self.address_count .height .len() .min(self.metrics.min_stateful_len()) @@ -136,7 +136,7 @@ impl DynCohortVecs for AddressCohortVecs { .height .collect_one(prev_height) .unwrap(); - state.addr_count = *self.addr_count.height.collect_one(prev_height).unwrap(); + state.address_count = *self.address_count.height.collect_one(prev_height).unwrap(); state.inner.restore_realized_cap(); @@ -155,7 +155,7 @@ impl DynCohortVecs for AddressCohortVecs { fn validate_computed_versions(&mut self, base_version: Version) -> Result<()> { use vecdb::WritableVec; - self.addr_count + self.address_count .height .validate_computed_version_or_reset(base_version)?; Ok(()) @@ -167,9 +167,9 @@ impl DynCohortVecs for AddressCohortVecs { } if let Some(state) = self.state.as_ref() { - self.addr_count + self.address_count .height - .truncate_push(height, state.addr_count.into())?; + .truncate_push(height, state.address_count.into())?; self.metrics.supply.truncate_push(height, &state.inner)?; self.metrics.outputs.truncate_push(height, &state.inner)?; self.metrics.realized.truncate_push(height, &state.inner)?; @@ -226,11 +226,11 @@ impl CohortVecs for AddressCohortVecs { others: &[&Self], exit: &Exit, ) -> Result<()> { - self.addr_count.height.compute_sum_of_others( + self.address_count.height.compute_sum_of_others( starting_indexes.height, others .iter() - .map(|v| &v.addr_count.height) + .map(|v| &v.address_count.height) .collect::>() .as_slice(), exit, diff --git a/crates/brk_computer/src/distribution/cohorts/utxo/groups.rs b/crates/brk_computer/src/distribution/cohorts/utxo/groups.rs index 96858280e..e1b89c182 100644 --- a/crates/brk_computer/src/distribution/cohorts/utxo/groups.rs +++ b/crates/brk_computer/src/distribution/cohorts/utxo/groups.rs @@ -520,10 +520,10 @@ impl UTXOCohorts { where HM: ReadableVec + Sync, { - // Get up_to_1h value sources for adjusted computation (cloned to avoid borrow conflicts). - let up_to_1h_value_created = self + // Get under_1h value sources for adjusted computation (cloned to avoid borrow conflicts). + let under_1h_value_created = self .age_range - .up_to_1h + .under_1h .metrics .realized .minimal @@ -532,9 +532,9 @@ impl UTXOCohorts { .raw .height .read_only_clone(); - let up_to_1h_value_destroyed = self + let under_1h_value_destroyed = self .age_range - .up_to_1h + .under_1h .metrics .realized .minimal @@ -550,8 +550,8 @@ impl UTXOCohorts { prices, starting_indexes, height_to_market_cap, - &up_to_1h_value_created, - &up_to_1h_value_destroyed, + &under_1h_value_created, + &under_1h_value_destroyed, exit, )?; @@ -576,8 +576,8 @@ impl UTXOCohorts { // All remaining groups run in parallel. Each closure owns an exclusive &mut // to its field and shares read-only references to common data. - let vc = &up_to_1h_value_created; - let vd = &up_to_1h_value_destroyed; + let vc = &under_1h_value_created; + let vd = &under_1h_value_destroyed; let ss = &all_supply_sats; let tasks: Vec Result<()> + Send + '_>> = vec![ diff --git a/crates/brk_computer/src/distribution/cohorts/utxo/receive.rs b/crates/brk_computer/src/distribution/cohorts/utxo/receive.rs index 43b7d986e..6a2f02f54 100644 --- a/crates/brk_computer/src/distribution/cohorts/utxo/receive.rs +++ b/crates/brk_computer/src/distribution/cohorts/utxo/receive.rs @@ -9,7 +9,7 @@ impl UTXOCohorts { /// Process received outputs for this block. /// /// New UTXOs are added to: - /// - The "up_to_1h" age cohort (all new UTXOs start at 0 hours old) + /// - The "under_1h" age cohort (all new UTXOs start at 0 hours old) /// - The appropriate epoch cohort based on block height /// - The appropriate class cohort based on block timestamp /// - The appropriate output type cohort (P2PKH, P2SH, etc.) @@ -26,9 +26,9 @@ impl UTXOCohorts { // Pre-compute snapshot once for the 3 cohorts sharing the same supply_state let snapshot = CostBasisSnapshot::from_utxo(price, &supply_state); - // New UTXOs go into up_to_1h, current epoch, and current class + // New UTXOs go into under_1h, current epoch, and current class self.age_range - .up_to_1h + .under_1h .state .as_mut() .unwrap() diff --git a/crates/brk_computer/src/distribution/cohorts/utxo/tick_tock.rs b/crates/brk_computer/src/distribution/cohorts/utxo/tick_tock.rs index f37737bc6..ba08d716f 100644 --- a/crates/brk_computer/src/distribution/cohorts/utxo/tick_tock.rs +++ b/crates/brk_computer/src/distribution/cohorts/utxo/tick_tock.rs @@ -17,7 +17,7 @@ impl UTXOCohorts { /// Complexity: O(k * c) where k = 20 boundaries, c = ~1 (forward scan steps). /// /// Returns how many sats matured INTO each cohort from the younger adjacent one. - /// `up_to_1h` is always zero since nothing ages into the youngest cohort. + /// `under_1h` is always zero since nothing ages into the youngest cohort. pub(crate) fn tick_tock_next_block( &mut self, chain_state: &[BlockState], diff --git a/crates/brk_computer/src/distribution/compute/block_loop.rs b/crates/brk_computer/src/distribution/compute/block_loop.rs index 9f4d7a5ee..c9179b5a9 100644 --- a/crates/brk_computer/src/distribution/compute/block_loop.rs +++ b/crates/brk_computer/src/distribution/compute/block_loop.rs @@ -183,22 +183,22 @@ pub(crate) fn process_blocks( .collect_range_at(start_usize, end_usize); // Track running totals - recover from previous height if resuming - debug!("recovering addr_counts from height {}", starting_height); - let (mut addr_counts, mut empty_addr_counts) = if starting_height > Height::ZERO { - let addr_counts = + debug!("recovering address_counts from height {}", starting_height); + let (mut address_counts, mut empty_address_counts) = if starting_height > Height::ZERO { + let address_counts = AddressTypeToAddressCount::from((&vecs.addresses.funded.by_addresstype, starting_height)); - let empty_addr_counts = AddressTypeToAddressCount::from(( + let empty_address_counts = AddressTypeToAddressCount::from(( &vecs.addresses.empty.by_addresstype, starting_height, )); - (addr_counts, empty_addr_counts) + (address_counts, empty_address_counts) } else { ( AddressTypeToAddressCount::default(), AddressTypeToAddressCount::default(), ) }; - debug!("addr_counts recovered"); + debug!("address_counts recovered"); // Track activity counts - reset each block let mut activity_counts = AddressTypeToActivityCounts::default(); @@ -406,8 +406,8 @@ pub(crate) fn process_blocks( &mut vecs.address_cohorts, &mut lookup, block_price, - &mut addr_counts, - &mut empty_addr_counts, + &mut address_counts, + &mut empty_address_counts, &mut activity_counts, ); @@ -418,8 +418,8 @@ pub(crate) fn process_blocks( &mut lookup, block_price, ctx.price_range_max, - &mut addr_counts, - &mut empty_addr_counts, + &mut address_counts, + &mut empty_address_counts, &mut activity_counts, &received_addresses, height_to_price_vec, @@ -437,11 +437,11 @@ pub(crate) fn process_blocks( // Push to height-indexed vectors vecs.addresses.funded - .truncate_push_height(height, addr_counts.sum(), &addr_counts)?; + .truncate_push_height(height, address_counts.sum(), &address_counts)?; vecs.addresses.empty.truncate_push_height( height, - empty_addr_counts.sum(), - &empty_addr_counts, + empty_address_counts.sum(), + &empty_address_counts, )?; vecs.addresses.activity .truncate_push_height(height, &activity_counts)?; diff --git a/crates/brk_computer/src/distribution/metrics/cohort/all.rs b/crates/brk_computer/src/distribution/metrics/cohort/all.rs index 5a5b0c518..50842c16b 100644 --- a/crates/brk_computer/src/distribution/metrics/cohort/all.rs +++ b/crates/brk_computer/src/distribution/metrics/cohort/all.rs @@ -114,8 +114,8 @@ impl AllCohortMetrics { prices: &prices::Vecs, starting_indexes: &Indexes, height_to_market_cap: &impl ReadableVec, - up_to_1h_value_created: &impl ReadableVec, - up_to_1h_value_destroyed: &impl ReadableVec, + under_1h_value_created: &impl ReadableVec, + under_1h_value_destroyed: &impl ReadableVec, exit: &Exit, ) -> Result<()> { self.realized.compute_rest_part2( @@ -132,8 +132,8 @@ impl AllCohortMetrics { starting_indexes, &self.realized.minimal.sopr.value_created.raw.height, &self.realized.minimal.sopr.value_destroyed.raw.height, - up_to_1h_value_created, - up_to_1h_value_destroyed, + under_1h_value_created, + under_1h_value_destroyed, exit, )?; diff --git a/crates/brk_computer/src/distribution/metrics/cohort/extended_adjusted.rs b/crates/brk_computer/src/distribution/metrics/cohort/extended_adjusted.rs index 9e0ccd7b3..1b58f9ca9 100644 --- a/crates/brk_computer/src/distribution/metrics/cohort/extended_adjusted.rs +++ b/crates/brk_computer/src/distribution/metrics/cohort/extended_adjusted.rs @@ -63,8 +63,8 @@ impl ExtendedAdjustedCohortMetrics { prices: &prices::Vecs, starting_indexes: &Indexes, height_to_market_cap: &impl ReadableVec, - up_to_1h_value_created: &impl ReadableVec, - up_to_1h_value_destroyed: &impl ReadableVec, + under_1h_value_created: &impl ReadableVec, + under_1h_value_destroyed: &impl ReadableVec, all_supply_sats: &impl ReadableVec, exit: &Exit, ) -> Result<()> { @@ -82,8 +82,8 @@ impl ExtendedAdjustedCohortMetrics { starting_indexes, &self.inner.realized.minimal.sopr.value_created.raw.height, &self.inner.realized.minimal.sopr.value_destroyed.raw.height, - up_to_1h_value_created, - up_to_1h_value_destroyed, + under_1h_value_created, + under_1h_value_destroyed, exit, )?; diff --git a/crates/brk_computer/src/distribution/metrics/realized/adjusted.rs b/crates/brk_computer/src/distribution/metrics/realized/adjusted.rs index 35042eb9b..556b6aff0 100644 --- a/crates/brk_computer/src/distribution/metrics/realized/adjusted.rs +++ b/crates/brk_computer/src/distribution/metrics/realized/adjusted.rs @@ -24,11 +24,11 @@ pub struct AdjustedSopr { impl AdjustedSopr { pub(crate) fn forced_import(cfg: &ImportConfig) -> Result { Ok(Self { - value_created: cfg.import("adjusted_value_created", Version::ZERO)?, - value_destroyed: cfg.import("adjusted_value_destroyed", Version::ZERO)?, - value_created_sum: cfg.import("adjusted_value_created", Version::ONE)?, - value_destroyed_sum: cfg.import("adjusted_value_destroyed", Version::ONE)?, - ratio: cfg.import("adjusted_sopr", Version::ONE)?, + value_created: cfg.import("adj_value_created", Version::ZERO)?, + value_destroyed: cfg.import("adj_value_destroyed", Version::ZERO)?, + value_created_sum: cfg.import("adj_value_created", Version::ONE)?, + value_destroyed_sum: cfg.import("adj_value_destroyed", Version::ONE)?, + ratio: cfg.import("asopr", Version::ONE)?, }) } @@ -39,21 +39,21 @@ impl AdjustedSopr { starting_indexes: &Indexes, base_value_created: &impl ReadableVec, base_value_destroyed: &impl ReadableVec, - up_to_1h_value_created: &impl ReadableVec, - up_to_1h_value_destroyed: &impl ReadableVec, + under_1h_value_created: &impl ReadableVec, + under_1h_value_destroyed: &impl ReadableVec, exit: &Exit, ) -> Result<()> { - // Compute value_created = base.value_created - up_to_1h.value_created + // Compute value_created = base.value_created - under_1h.value_created self.value_created.height.compute_subtract( starting_indexes.height, base_value_created, - up_to_1h_value_created, + under_1h_value_created, exit, )?; self.value_destroyed.height.compute_subtract( starting_indexes.height, base_value_destroyed, - up_to_1h_value_destroyed, + under_1h_value_destroyed, exit, )?; diff --git a/crates/brk_computer/src/distribution/metrics/realized/full.rs b/crates/brk_computer/src/distribution/metrics/realized/full.rs index 32df5d554..5fbb25e68 100644 --- a/crates/brk_computer/src/distribution/metrics/realized/full.rs +++ b/crates/brk_computer/src/distribution/metrics/realized/full.rs @@ -154,7 +154,7 @@ impl RealizedFull { &profit_value_destroyed, ); let profit = RealizedProfit { - rel_to_rcap: cfg.import("realized_profit_rel_to_realized_cap", Version::new(2))?, + rel_to_rcap: cfg.import("realized_profit_rel_to_rcap", Version::new(2))?, value_created: cfg.import("profit_value_created", v0)?, value_destroyed: profit_value_destroyed, value_created_sum: cfg.import("profit_value_created", v1)?, @@ -173,7 +173,7 @@ impl RealizedFull { &loss_value_destroyed, ); let loss = RealizedLoss { - rel_to_rcap: cfg.import("realized_loss_rel_to_realized_cap", Version::new(2))?, + rel_to_rcap: cfg.import("realized_loss_rel_to_rcap", Version::new(2))?, value_created: cfg.import("loss_value_created", v0)?, value_destroyed: loss_value_destroyed, value_created_sum: cfg.import("loss_value_created", v1)?, @@ -192,15 +192,15 @@ impl RealizedFull { // Net PnL let net_pnl = RealizedNetPnl { rel_to_rcap: cfg - .import("net_realized_pnl_rel_to_realized_cap", Version::new(2))?, + .import("net_realized_pnl_rel_to_rcap", Version::new(2))?, cumulative: cfg.import("net_realized_pnl_cumulative", v1)?, sum_extended: cfg.import("net_realized_pnl", v1)?, delta: cfg.import("net_pnl_delta", Version::new(5))?, delta_extended: cfg.import("net_pnl_delta", Version::new(5))?, change_1m_rel_to_rcap: cfg - .import("net_pnl_change_1m_rel_to_realized_cap", Version::new(4))?, + .import("net_pnl_change_1m_rel_to_rcap", Version::new(4))?, change_1m_rel_to_mcap: cfg - .import("net_pnl_change_1m_rel_to_market_cap", Version::new(4))?, + .import("net_pnl_change_1m_rel_to_mcap", Version::new(4))?, }; // SOPR @@ -214,7 +214,7 @@ impl RealizedFull { let peak_regret = RealizedPeakRegret { value: cfg.import("realized_peak_regret", Version::new(2))?, rel_to_rcap: cfg - .import("realized_peak_regret_rel_to_realized_cap", Version::new(2))?, + .import("realized_peak_regret_rel_to_rcap", Version::new(2))?, }; // Investor @@ -241,7 +241,7 @@ impl RealizedFull { profit_to_loss_ratio: cfg.import("realized_profit_to_loss_ratio", v1)?, cap_delta_extended: cfg.import("realized_cap_delta", Version::new(5))?, cap_raw: cfg.import("cap_raw", v0)?, - cap_rel_to_own_mcap: cfg.import("realized_cap_rel_to_own_market_cap", v1)?, + cap_rel_to_own_mcap: cfg.import("realized_cap_rel_to_own_mcap", v1)?, price_ratio_percentiles: RatioPerBlockPercentiles::forced_import( cfg.db, &realized_price_name, 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 1884f03eb..ecece17a9 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 @@ -10,12 +10,12 @@ use crate::distribution::metrics::{ImportConfig, UnrealizedCore}; /// Extended relative metrics for own market cap (extended && rel_to_all). #[derive(Traversable)] pub struct RelativeExtendedOwnMarketCap { - #[traversable(wrap = "unrealized/profit", rename = "rel_to_own_market_cap")] - pub unrealized_profit_rel_to_own_market_cap: PercentPerBlock, - #[traversable(wrap = "unrealized/loss", rename = "rel_to_own_market_cap")] - pub unrealized_loss_rel_to_own_market_cap: PercentPerBlock, - #[traversable(wrap = "unrealized/net_pnl", rename = "rel_to_own_market_cap")] - pub net_unrealized_pnl_rel_to_own_market_cap: PercentPerBlock, + #[traversable(wrap = "unrealized/profit", rename = "rel_to_own_mcap")] + pub unrealized_profit_rel_to_own_mcap: PercentPerBlock, + #[traversable(wrap = "unrealized/loss", rename = "rel_to_own_mcap")] + pub unrealized_loss_rel_to_own_mcap: PercentPerBlock, + #[traversable(wrap = "unrealized/net_pnl", rename = "rel_to_own_mcap")] + pub net_unrealized_pnl_rel_to_own_mcap: PercentPerBlock, } impl RelativeExtendedOwnMarketCap { @@ -23,12 +23,12 @@ impl RelativeExtendedOwnMarketCap { let v2 = Version::new(2); Ok(Self { - unrealized_profit_rel_to_own_market_cap: cfg - .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))?, - net_unrealized_pnl_rel_to_own_market_cap: cfg - .import("net_unrealized_pnl_rel_to_own_market_cap", Version::new(3))?, + unrealized_profit_rel_to_own_mcap: cfg + .import("unrealized_profit_rel_to_own_mcap", v2)?, + unrealized_loss_rel_to_own_mcap: cfg + .import("unrealized_loss_rel_to_own_mcap", Version::new(3))?, + net_unrealized_pnl_rel_to_own_mcap: cfg + .import("net_unrealized_pnl_rel_to_own_mcap", Version::new(3))?, }) } @@ -39,21 +39,21 @@ impl RelativeExtendedOwnMarketCap { own_market_cap: &impl ReadableVec, exit: &Exit, ) -> Result<()> { - self.unrealized_profit_rel_to_own_market_cap + self.unrealized_profit_rel_to_own_mcap .compute_binary::( max_from, &unrealized.profit.raw.usd.height, own_market_cap, exit, )?; - self.unrealized_loss_rel_to_own_market_cap + self.unrealized_loss_rel_to_own_mcap .compute_binary::( max_from, &unrealized.loss.raw.usd.height, own_market_cap, exit, )?; - self.net_unrealized_pnl_rel_to_own_market_cap + self.net_unrealized_pnl_rel_to_own_mcap .compute_binary::( max_from, &unrealized.net_pnl.usd.height, diff --git a/crates/brk_computer/src/distribution/metrics/relative/full.rs b/crates/brk_computer/src/distribution/metrics/relative/full.rs index ef79b7047..6b217c70f 100644 --- a/crates/brk_computer/src/distribution/metrics/relative/full.rs +++ b/crates/brk_computer/src/distribution/metrics/relative/full.rs @@ -11,15 +11,15 @@ use crate::{ /// Full relative metrics (sth/lth/all tier). #[derive(Traversable)] pub struct RelativeFull { - #[traversable(wrap = "supply/in_profit", rename = "rel_to_own_supply")] - pub supply_in_profit_rel_to_own_supply: PercentPerBlock, - #[traversable(wrap = "supply/in_loss", rename = "rel_to_own_supply")] - pub supply_in_loss_rel_to_own_supply: PercentPerBlock, + #[traversable(wrap = "supply/in_profit", rename = "rel_to_own")] + pub supply_in_profit_rel_to_own: PercentPerBlock, + #[traversable(wrap = "supply/in_loss", rename = "rel_to_own")] + pub supply_in_loss_rel_to_own: PercentPerBlock, - #[traversable(wrap = "unrealized/profit", rename = "rel_to_market_cap")] - pub unrealized_profit_rel_to_market_cap: PercentPerBlock, - #[traversable(wrap = "unrealized/loss", rename = "rel_to_market_cap")] - pub unrealized_loss_rel_to_market_cap: PercentPerBlock, + #[traversable(wrap = "unrealized/profit", rename = "rel_to_mcap")] + pub unrealized_profit_rel_to_mcap: PercentPerBlock, + #[traversable(wrap = "unrealized/loss", rename = "rel_to_mcap")] + pub unrealized_loss_rel_to_mcap: PercentPerBlock, } impl RelativeFull { @@ -28,13 +28,13 @@ impl RelativeFull { let v2 = Version::new(2); Ok(Self { - supply_in_profit_rel_to_own_supply: cfg - .import("supply_in_profit_rel_to_own_supply", v1)?, - supply_in_loss_rel_to_own_supply: cfg.import("supply_in_loss_rel_to_own_supply", v1)?, - unrealized_profit_rel_to_market_cap: cfg - .import("unrealized_profit_rel_to_market_cap", v2)?, - unrealized_loss_rel_to_market_cap: cfg - .import("unrealized_loss_rel_to_market_cap", v2)?, + supply_in_profit_rel_to_own: cfg + .import("supply_in_profit_rel_to_own", v1)?, + supply_in_loss_rel_to_own: cfg.import("supply_in_loss_rel_to_own", v1)?, + unrealized_profit_rel_to_mcap: cfg + .import("unrealized_profit_rel_to_mcap", v2)?, + unrealized_loss_rel_to_mcap: cfg + .import("unrealized_loss_rel_to_mcap", v2)?, }) } @@ -46,14 +46,14 @@ impl RelativeFull { market_cap: &impl ReadableVec, exit: &Exit, ) -> Result<()> { - self.supply_in_profit_rel_to_own_supply + self.supply_in_profit_rel_to_own .compute_binary::( max_from, &supply.in_profit.sats.height, &supply.total.sats.height, exit, )?; - self.supply_in_loss_rel_to_own_supply + self.supply_in_loss_rel_to_own .compute_binary::( max_from, &supply.in_loss.sats.height, @@ -61,14 +61,14 @@ impl RelativeFull { exit, )?; - self.unrealized_profit_rel_to_market_cap + self.unrealized_profit_rel_to_mcap .compute_binary::( max_from, &unrealized.profit.raw.usd.height, market_cap, exit, )?; - self.unrealized_loss_rel_to_market_cap + self.unrealized_loss_rel_to_mcap .compute_binary::( max_from, &unrealized.loss.raw.usd.height, diff --git a/crates/brk_computer/src/distribution/metrics/relative/to_all.rs b/crates/brk_computer/src/distribution/metrics/relative/to_all.rs index 28e57d269..a9d24e610 100644 --- a/crates/brk_computer/src/distribution/metrics/relative/to_all.rs +++ b/crates/brk_computer/src/distribution/metrics/relative/to_all.rs @@ -11,22 +11,22 @@ use crate::distribution::metrics::{ImportConfig, SupplyCore}; #[derive(Traversable)] pub struct RelativeToAll { #[traversable(wrap = "supply", rename = "rel_to_circulating")] - pub supply_rel_to_circulating_supply: PercentPerBlock, + pub supply_rel_to_circulating: PercentPerBlock, #[traversable(wrap = "supply/in_profit", rename = "rel_to_circulating")] - pub supply_in_profit_rel_to_circulating_supply: PercentPerBlock, + pub supply_in_profit_rel_to_circulating: PercentPerBlock, #[traversable(wrap = "supply/in_loss", rename = "rel_to_circulating")] - pub supply_in_loss_rel_to_circulating_supply: PercentPerBlock, + pub supply_in_loss_rel_to_circulating: PercentPerBlock, } impl RelativeToAll { pub(crate) fn forced_import(cfg: &ImportConfig) -> Result { Ok(Self { - supply_rel_to_circulating_supply: cfg - .import("supply_rel_to_circulating_supply", Version::ONE)?, - supply_in_profit_rel_to_circulating_supply: cfg - .import("supply_in_profit_rel_to_circulating_supply", Version::ONE)?, - supply_in_loss_rel_to_circulating_supply: cfg - .import("supply_in_loss_rel_to_circulating_supply", Version::ONE)?, + supply_rel_to_circulating: cfg + .import("supply_rel_to_circulating", Version::ONE)?, + supply_in_profit_rel_to_circulating: cfg + .import("supply_in_profit_rel_to_circulating", Version::ONE)?, + supply_in_loss_rel_to_circulating: cfg + .import("supply_in_loss_rel_to_circulating", Version::ONE)?, }) } @@ -37,21 +37,21 @@ impl RelativeToAll { all_supply_sats: &impl ReadableVec, exit: &Exit, ) -> Result<()> { - self.supply_rel_to_circulating_supply + self.supply_rel_to_circulating .compute_binary::( max_from, &supply.total.sats.height, all_supply_sats, exit, )?; - self.supply_in_profit_rel_to_circulating_supply + self.supply_in_profit_rel_to_circulating .compute_binary::( max_from, &supply.in_profit.sats.height, all_supply_sats, exit, )?; - self.supply_in_loss_rel_to_circulating_supply + self.supply_in_loss_rel_to_circulating .compute_binary::( max_from, &supply.in_loss.sats.height, diff --git a/crates/brk_computer/src/distribution/metrics/supply/base.rs b/crates/brk_computer/src/distribution/metrics/supply/base.rs index 9e89b378f..8daf66b46 100644 --- a/crates/brk_computer/src/distribution/metrics/supply/base.rs +++ b/crates/brk_computer/src/distribution/metrics/supply/base.rs @@ -16,23 +16,23 @@ use crate::distribution::metrics::ImportConfig; #[derive(Traversable)] pub struct SupplyBase { pub total: AmountPerBlock, - pub halved: LazyAmountPerBlock, + pub half: LazyAmountPerBlock, } impl SupplyBase { pub(crate) fn forced_import(cfg: &ImportConfig) -> Result { let supply = cfg.import("supply", Version::ZERO)?; - let supply_halved = LazyAmountPerBlock::from_block_source::< + let supply_half = LazyAmountPerBlock::from_block_source::< HalveSats, HalveSatsToBitcoin, HalveCents, HalveDollars, - >(&cfg.name("supply_halved"), &supply, cfg.version); + >(&cfg.name("supply_half"), &supply, cfg.version); Ok(Self { total: supply, - halved: supply_halved, + half: supply_half, }) } diff --git a/crates/brk_computer/src/distribution/metrics/unrealized/minimal.rs b/crates/brk_computer/src/distribution/metrics/unrealized/minimal.rs new file mode 100644 index 000000000..95d57018e --- /dev/null +++ b/crates/brk_computer/src/distribution/metrics/unrealized/minimal.rs @@ -0,0 +1,47 @@ +use brk_error::Result; +use brk_traversable::Traversable; +use brk_types::{BasisPointsSigned32, Cents, Height, Version}; +use vecdb::{Exit, ReadableVec, Rw, StorageMode}; + +use crate::internal::RatioPerBlock; + +use crate::distribution::metrics::ImportConfig; + +#[derive(Traversable)] +pub struct UnrealizedMinimal { + pub nupl: RatioPerBlock, +} + +impl UnrealizedMinimal { + pub(crate) fn forced_import(cfg: &ImportConfig) -> Result { + Ok(Self { + nupl: cfg.import("nupl", Version::ONE)?, + }) + } + + pub(crate) fn compute( + &mut self, + max_from: Height, + spot_price: &impl ReadableVec, + realized_price: &impl ReadableVec, + exit: &Exit, + ) -> Result<()> { + self.nupl.bps.height.compute_transform2( + max_from, + spot_price, + realized_price, + |(i, price, realized_price, ..)| { + let p = price.as_u128(); + if p == 0 { + (i, BasisPointsSigned32::ZERO) + } else { + let rp = realized_price.as_u128(); + let nupl_bps = ((p as i128 - rp as i128) * 10000) / p as i128; + (i, BasisPointsSigned32::from(nupl_bps as i32)) + } + }, + exit, + )?; + Ok(()) + } +} diff --git a/crates/brk_computer/src/distribution/state/cohort/address.rs b/crates/brk_computer/src/distribution/state/cohort/address.rs index 94afbd961..2df90b2e9 100644 --- a/crates/brk_computer/src/distribution/state/cohort/address.rs +++ b/crates/brk_computer/src/distribution/state/cohort/address.rs @@ -11,21 +11,21 @@ use super::base::CohortState; const COST_BASIS_PRICE_DIGITS: i32 = 4; pub struct AddressCohortState { - pub addr_count: u64, + pub address_count: u64, pub inner: CohortState, } impl AddressCohortState { pub(crate) fn new(path: &Path, name: &str) -> Self { Self { - addr_count: 0, + address_count: 0, inner: CohortState::new(path, name).with_price_rounding(COST_BASIS_PRICE_DIGITS), } } /// Reset state for fresh start. pub(crate) fn reset(&mut self) { - self.addr_count = 0; + self.address_count = 0; self.inner.supply = SupplyState::default(); self.inner.sent = Sats::ZERO; self.inner.satdays_destroyed = Sats::ZERO; @@ -84,7 +84,7 @@ impl AddressCohortState { } pub(crate) fn add(&mut self, addressdata: &FundedAddressData) { - self.addr_count += 1; + self.address_count += 1; self.inner .increment_snapshot(&addressdata.cost_basis_snapshot()); } @@ -96,12 +96,12 @@ impl AddressCohortState { if unlikely(self.inner.supply.utxo_count < snapshot.supply_state.utxo_count) { panic!( "AddressCohortState::subtract underflow!\n\ - Cohort state: addr_count={}, supply={}\n\ + Cohort state: address_count={}, supply={}\n\ Address being subtracted: {}\n\ Address supply: {}\n\ Realized price: {}\n\ This means the address is not properly tracked in this cohort.", - self.addr_count, + self.address_count, self.inner.supply, addressdata, snapshot.supply_state, @@ -111,12 +111,12 @@ impl AddressCohortState { if unlikely(self.inner.supply.value < snapshot.supply_state.value) { panic!( "AddressCohortState::subtract value underflow!\n\ - Cohort state: addr_count={}, supply={}\n\ + Cohort state: address_count={}, supply={}\n\ Address being subtracted: {}\n\ Address supply: {}\n\ Realized price: {}\n\ This means the address is not properly tracked in this cohort.", - self.addr_count, + self.address_count, self.inner.supply, addressdata, snapshot.supply_state, @@ -124,9 +124,9 @@ impl AddressCohortState { ); } - self.addr_count = self.addr_count.checked_sub(1).unwrap_or_else(|| { + self.address_count = self.address_count.checked_sub(1).unwrap_or_else(|| { panic!( - "AddressCohortState::subtract addr_count underflow! addr_count=0\n\ + "AddressCohortState::subtract address_count underflow! address_count=0\n\ Address being subtracted: {}\n\ Realized price: {}", addressdata, snapshot.realized_price diff --git a/crates/brk_computer/src/distribution/vecs.rs b/crates/brk_computer/src/distribution/vecs.rs index cbb1fc881..8e29e42af 100644 --- a/crates/brk_computer/src/distribution/vecs.rs +++ b/crates/brk_computer/src/distribution/vecs.rs @@ -30,7 +30,7 @@ use crate::{ use super::{ AddressCohorts, AddressesDataVecs, AnyAddressIndexesVecs, RangeMap, UTXOCohorts, address::{ - AddrCountsVecs, AddressActivityVecs, DeltaVecs, NewAddrCountVecs, TotalAddrCountVecs, + AddressCountsVecs, AddressActivityVecs, DeltaVecs, NewAddressCountVecs, TotalAddressCountVecs, }, compute::aggregates, }; @@ -39,11 +39,11 @@ const VERSION: Version = Version::new(22); #[derive(Traversable)] pub struct AddressMetricsVecs { - pub funded: AddrCountsVecs, - pub empty: AddrCountsVecs, + pub funded: AddressCountsVecs, + pub empty: AddressCountsVecs, pub activity: AddressActivityVecs, - pub total: TotalAddrCountVecs, - pub new: NewAddrCountVecs, + pub total: TotalAddressCountVecs, + pub new: NewAddressCountVecs, pub delta: DeltaVecs, #[traversable(wrap = "indexes", rename = "funded")] pub funded_index: @@ -135,19 +135,19 @@ impl Vecs { |index, _| index, ); - let addr_count = AddrCountsVecs::forced_import(&db, "addr_count", version, indexes)?; - let empty_addr_count = - AddrCountsVecs::forced_import(&db, "empty_addr_count", version, indexes)?; + let address_count = AddressCountsVecs::forced_import(&db, "address_count", version, indexes)?; + let empty_address_count = + AddressCountsVecs::forced_import(&db, "empty_address_count", version, indexes)?; let address_activity = AddressActivityVecs::forced_import(&db, "address_activity", version, indexes)?; - // Stored total = addr_count + empty_addr_count (global + per-type, with all derived indexes) - let total_addr_count = TotalAddrCountVecs::forced_import(&db, version, indexes)?; + // Stored total = address_count + empty_address_count (global + per-type, with all derived indexes) + let total_address_count = TotalAddressCountVecs::forced_import(&db, version, indexes)?; // Per-block delta of total (global + per-type) - let new_addr_count = NewAddrCountVecs::forced_import(&db, version, indexes)?; + let new_address_count = NewAddressCountVecs::forced_import(&db, version, indexes)?; - // Growth rate: new / addr_count (global + per-type) + // Growth rate: new / address_count (global + per-type) let delta = DeltaVecs::forced_import(&db, version, indexes)?; let this = Self { @@ -157,11 +157,11 @@ impl Vecs { )?, addresses: AddressMetricsVecs { - funded: addr_count, - empty: empty_addr_count, + funded: address_count, + empty: empty_address_count, activity: address_activity, - total: total_addr_count, - new: new_addr_count, + total: total_address_count, + new: new_address_count, delta, funded_index: funded_address_index, empty_index: empty_address_index, @@ -423,7 +423,7 @@ impl Vecs { self.addresses.funded.compute_rest(starting_indexes, exit)?; self.addresses.empty.compute_rest(starting_indexes, exit)?; - // 6c. Compute total_addr_count = addr_count + empty_addr_count + // 6c. Compute total_address_count = address_count + empty_address_count self.addresses.total.compute( starting_indexes.height, &self.addresses.funded, diff --git a/crates/brk_computer/src/indexes/cached_mappings.rs b/crates/brk_computer/src/indexes/cached_mappings.rs new file mode 100644 index 000000000..edca6f8d5 --- /dev/null +++ b/crates/brk_computer/src/indexes/cached_mappings.rs @@ -0,0 +1,48 @@ +use brk_types::{ + Day1, Day3, Epoch, Halving, Height, Hour1, Hour4, Hour12, Minute10, Minute30, Month1, Month3, + Month6, Week1, Year1, Year10, +}; +use vecdb::CachedVec; + +use super::Vecs; + +#[derive(Clone)] +pub struct CachedMappings { + pub minute10_first_height: CachedVec, + pub minute30_first_height: CachedVec, + pub hour1_first_height: CachedVec, + pub hour4_first_height: CachedVec, + pub hour12_first_height: CachedVec, + pub day1_first_height: CachedVec, + pub day3_first_height: CachedVec, + pub week1_first_height: CachedVec, + pub month1_first_height: CachedVec, + pub month3_first_height: CachedVec, + pub month6_first_height: CachedVec, + pub year1_first_height: CachedVec, + pub year10_first_height: CachedVec, + pub halving_identity: CachedVec, + pub epoch_identity: CachedVec, +} + +impl CachedMappings { + pub fn new(vecs: &Vecs) -> Self { + Self { + minute10_first_height: CachedVec::new(&vecs.minute10.first_height), + minute30_first_height: CachedVec::new(&vecs.minute30.first_height), + hour1_first_height: CachedVec::new(&vecs.hour1.first_height), + hour4_first_height: CachedVec::new(&vecs.hour4.first_height), + hour12_first_height: CachedVec::new(&vecs.hour12.first_height), + day1_first_height: CachedVec::new(&vecs.day1.first_height), + day3_first_height: CachedVec::new(&vecs.day3.first_height), + week1_first_height: CachedVec::new(&vecs.week1.first_height), + month1_first_height: CachedVec::new(&vecs.month1.first_height), + month3_first_height: CachedVec::new(&vecs.month3.first_height), + month6_first_height: CachedVec::new(&vecs.month6.first_height), + year1_first_height: CachedVec::new(&vecs.year1.first_height), + year10_first_height: CachedVec::new(&vecs.year10.first_height), + halving_identity: CachedVec::new(&vecs.halving.identity), + epoch_identity: CachedVec::new(&vecs.epoch.identity), + } + } +} diff --git a/crates/brk_computer/src/indexes/mod.rs b/crates/brk_computer/src/indexes/mod.rs index 635b7e4ab..afe234454 100644 --- a/crates/brk_computer/src/indexes/mod.rs +++ b/crates/brk_computer/src/indexes/mod.rs @@ -1,4 +1,5 @@ mod address; +mod cached_mappings; mod day1; mod day3; mod epoch; @@ -28,13 +29,14 @@ use brk_types::{ Date, Day1, Day3, Height, Hour1, Hour4, Hour12, Indexes, Minute10, Minute30, Month1, Month3, Month6, Version, Week1, Year1, Year10, }; -use vecdb::{Database, Exit, ReadableVec, Rw, StorageMode}; +use vecdb::{CachedVec, Database, Exit, ReadableVec, Rw, StorageMode}; use crate::{ blocks, internal::{finalize_db, open_db}, }; +pub use cached_mappings::CachedMappings; pub use address::Vecs as AddressVecs; pub use day1::Vecs as Day1Vecs; pub use day3::Vecs as Day3Vecs; @@ -61,6 +63,8 @@ pub const DB_NAME: &str = "indexes"; #[derive(Traversable)] pub struct Vecs { db: Database, + #[traversable(skip)] + pub cached_mappings: CachedMappings, pub address: AddressVecs, pub height: HeightVecs, pub epoch: EpochVecs, @@ -93,27 +97,67 @@ impl Vecs { let version = parent_version; + let address = AddressVecs::forced_import(version, indexer); + let height = HeightVecs::forced_import(&db, version)?; + let epoch = EpochVecs::forced_import(&db, version)?; + let halving = HalvingVecs::forced_import(&db, version)?; + let minute10 = Minute10Vecs::forced_import(&db, version)?; + let minute30 = Minute30Vecs::forced_import(&db, version)?; + let hour1 = Hour1Vecs::forced_import(&db, version)?; + let hour4 = Hour4Vecs::forced_import(&db, version)?; + let hour12 = Hour12Vecs::forced_import(&db, version)?; + let day1 = Day1Vecs::forced_import(&db, version)?; + let day3 = Day3Vecs::forced_import(&db, version)?; + let week1 = Week1Vecs::forced_import(&db, version)?; + let month1 = Month1Vecs::forced_import(&db, version)?; + let month3 = Month3Vecs::forced_import(&db, version)?; + let month6 = Month6Vecs::forced_import(&db, version)?; + let year1 = Year1Vecs::forced_import(&db, version)?; + let year10 = Year10Vecs::forced_import(&db, version)?; + let txindex = TxIndexVecs::forced_import(&db, version, indexer)?; + let txinindex = TxInIndexVecs::forced_import(version, indexer); + let txoutindex = TxOutIndexVecs::forced_import(version, indexer); + + let cached_mappings = CachedMappings { + minute10_first_height: CachedVec::new(&minute10.first_height), + minute30_first_height: CachedVec::new(&minute30.first_height), + hour1_first_height: CachedVec::new(&hour1.first_height), + hour4_first_height: CachedVec::new(&hour4.first_height), + hour12_first_height: CachedVec::new(&hour12.first_height), + day1_first_height: CachedVec::new(&day1.first_height), + day3_first_height: CachedVec::new(&day3.first_height), + week1_first_height: CachedVec::new(&week1.first_height), + month1_first_height: CachedVec::new(&month1.first_height), + month3_first_height: CachedVec::new(&month3.first_height), + month6_first_height: CachedVec::new(&month6.first_height), + year1_first_height: CachedVec::new(&year1.first_height), + year10_first_height: CachedVec::new(&year10.first_height), + halving_identity: CachedVec::new(&halving.identity), + epoch_identity: CachedVec::new(&epoch.identity), + }; + let this = Self { - address: AddressVecs::forced_import(version, indexer), - height: HeightVecs::forced_import(&db, version)?, - epoch: EpochVecs::forced_import(&db, version)?, - halving: HalvingVecs::forced_import(&db, version)?, - minute10: Minute10Vecs::forced_import(&db, version)?, - minute30: Minute30Vecs::forced_import(&db, version)?, - hour1: Hour1Vecs::forced_import(&db, version)?, - hour4: Hour4Vecs::forced_import(&db, version)?, - hour12: Hour12Vecs::forced_import(&db, version)?, - day1: Day1Vecs::forced_import(&db, version)?, - day3: Day3Vecs::forced_import(&db, version)?, - week1: Week1Vecs::forced_import(&db, version)?, - month1: Month1Vecs::forced_import(&db, version)?, - month3: Month3Vecs::forced_import(&db, version)?, - month6: Month6Vecs::forced_import(&db, version)?, - year1: Year1Vecs::forced_import(&db, version)?, - year10: Year10Vecs::forced_import(&db, version)?, - txindex: TxIndexVecs::forced_import(&db, version, indexer)?, - txinindex: TxInIndexVecs::forced_import(version, indexer), - txoutindex: TxOutIndexVecs::forced_import(version, indexer), + cached_mappings, + address, + height, + epoch, + halving, + minute10, + minute30, + hour1, + hour4, + hour12, + day1, + day3, + week1, + month1, + month3, + month6, + year1, + year10, + txindex, + txinindex, + txoutindex, db, }; diff --git a/crates/brk_computer/src/internal/per_block/computed/resolutions.rs b/crates/brk_computer/src/internal/per_block/computed/resolutions.rs index 87ae46742..57e8d6a1c 100644 --- a/crates/brk_computer/src/internal/per_block/computed/resolutions.rs +++ b/crates/brk_computer/src/internal/per_block/computed/resolutions.rs @@ -1,3 +1,5 @@ +use std::marker::PhantomData; + use brk_traversable::Traversable; use brk_types::{ Day1, Day3, Epoch, FromCoarserIndex, Halving, Height, Hour1, Hour4, Hour12, Minute10, Minute30, @@ -6,7 +8,7 @@ use brk_types::{ use derive_more::{Deref, DerefMut}; use schemars::JsonSchema; use vecdb::{ - Cursor, LazyAggVec, ReadOnlyClone, ReadableBoxedVec, ReadableCloneableVec, VecIndex, VecValue, + AggFold, Cursor, LazyAggVec, ReadOnlyClone, ReadableBoxedVec, ReadableVec, VecIndex, VecValue, }; use crate::{ @@ -14,6 +16,53 @@ use crate::{ internal::{ComputedVecValue, NumericValue, PerResolution}, }; +/// Aggregation strategy for epoch-based indices (Halving, Epoch). +/// +/// Uses `FromCoarserIndex::max_from` to compute the target height for each +/// coarse index, rather than reading from the mapping. The mapping is only +/// used for its length. +pub struct CoarserIndex(PhantomData); + +impl AggFold for CoarserIndex +where + I: VecIndex, + O: VecValue, + S1I: VecIndex + FromCoarserIndex, + S2T: VecValue, +{ + #[inline] + fn try_fold + ?Sized, B, E, F: FnMut(B, O) -> Result>( + source: &S, + mapping: &[S2T], + from: usize, + to: usize, + init: B, + mut f: F, + ) -> Result { + let mapping_len = mapping.len(); + let source_len = source.len(); + let mut cursor = Cursor::new(source); + let mut acc = init; + for i in from..to.min(mapping_len) { + let target = S1I::max_from(I::from(i), source_len); + if let Some(v) = cursor.get(target) { + acc = f(acc, v)?; + } + } + Ok(acc) + } + + #[inline] + fn collect_one + ?Sized>( + source: &S, + _mapping: &[S2T], + index: usize, + ) -> Option { + let target = S1I::max_from(I::from(index), source.len()); + source.collect_one_at(target) + } +} + #[derive(Clone, Deref, DerefMut, Traversable)] #[traversable(transparent)] pub struct Resolutions( @@ -32,8 +81,8 @@ pub struct Resolutions( LazyAggVec, Height, Height, T>, LazyAggVec, Height, Height, T>, LazyAggVec, Height, Height, T>, - LazyAggVec, - LazyAggVec, + LazyAggVec>, + LazyAggVec>, >, ) where @@ -59,71 +108,38 @@ where version: Version, indexes: &indexes::Vecs, ) -> Self { - macro_rules! period { - ($idx:ident) => { - LazyAggVec::sparse_from_first_index( - name, - version, - height_source.clone(), - indexes.$idx.first_height.read_only_boxed_clone(), - ) - }; - } + let cm = &indexes.cached_mappings; - fn for_each_range< - I: VecIndex, - O: VecValue, - S1I: VecIndex + FromCoarserIndex, - S2T: VecValue, - >( - from: usize, - to: usize, - source: &ReadableBoxedVec, - mapping: &ReadableBoxedVec, - f: &mut dyn FnMut(O), - ) { - let mapping_len = mapping.len(); - let source_len = source.len(); - let mut cursor = Cursor::new(&**source); - for i in from..to { - if i >= mapping_len { - break; - } - let target = S1I::max_from(I::from(i), source_len); - if let Some(v) = cursor.get(target) { - f(v); - } - } - } - - macro_rules! epoch { - ($idx:ident) => { + macro_rules! res { + ($cached:expr) => {{ + let cached = $cached.clone(); + let mapping_version = cached.version(); LazyAggVec::new( name, version, + mapping_version, height_source.clone(), - indexes.$idx.identity.read_only_boxed_clone(), - for_each_range, + move || cached.get(), ) - }; + }}; } Self(PerResolution { - minute10: period!(minute10), - minute30: period!(minute30), - hour1: period!(hour1), - hour4: period!(hour4), - hour12: period!(hour12), - day1: period!(day1), - day3: period!(day3), - week1: period!(week1), - month1: period!(month1), - month3: period!(month3), - month6: period!(month6), - year1: period!(year1), - year10: period!(year10), - halving: epoch!(halving), - epoch: epoch!(epoch), + minute10: res!(cm.minute10_first_height), + minute30: res!(cm.minute30_first_height), + hour1: res!(cm.hour1_first_height), + hour4: res!(cm.hour4_first_height), + hour12: res!(cm.hour12_first_height), + day1: res!(cm.day1_first_height), + day3: res!(cm.day3_first_height), + week1: res!(cm.week1_first_height), + month1: res!(cm.month1_first_height), + month3: res!(cm.month3_first_height), + month6: res!(cm.month6_first_height), + year1: res!(cm.year1_first_height), + year10: res!(cm.year10_first_height), + halving: res!(cm.halving_identity), + epoch: res!(cm.epoch_identity), }) } } diff --git a/crates/brk_computer/src/internal/per_block/price.rs b/crates/brk_computer/src/internal/per_block/price.rs index 47ce01f07..c6af82837 100644 --- a/crates/brk_computer/src/internal/per_block/price.rs +++ b/crates/brk_computer/src/internal/per_block/price.rs @@ -35,7 +35,7 @@ impl Price> { let cents = ComputedPerBlock::forced_import(db, &format!("{name}_cents"), version, indexes)?; let usd = LazyPerBlock::from_computed::( - &format!("{name}_usd"), + name, version, cents.height.read_only_boxed_clone(), ¢s, diff --git a/crates/brk_computer/src/internal/per_block/ratio/percentiles.rs b/crates/brk_computer/src/internal/per_block/ratio/percentiles.rs index 25ce422ec..d11caffdb 100644 --- a/crates/brk_computer/src/internal/per_block/ratio/percentiles.rs +++ b/crates/brk_computer/src/internal/per_block/ratio/percentiles.rs @@ -62,21 +62,21 @@ impl RatioPerBlockPercentiles { } macro_rules! import_band { - ($suffix:expr) => { + ($pct:expr) => { RatioBand { - ratio: import_ratio!($suffix), - price: import_price!($suffix), + ratio: import_ratio!(concat!("ratio_", $pct)), + price: import_price!($pct), } }; } Ok(Self { - pct99: import_band!("ratio_pct99"), - pct98: import_band!("ratio_pct98"), - pct95: import_band!("ratio_pct95"), - pct5: import_band!("ratio_pct5"), - pct2: import_band!("ratio_pct2"), - pct1: import_band!("ratio_pct1"), + pct99: import_band!("pct99"), + pct98: import_band!("pct98"), + pct95: import_band!("pct95"), + pct5: import_band!("pct5"), + pct2: import_band!("pct2"), + pct1: import_band!("pct1"), expanding_pct: ExpandingPercentiles::default(), }) } diff --git a/crates/brk_computer/src/internal/per_block/stddev/extended.rs b/crates/brk_computer/src/internal/per_block/stddev/extended.rs index 306501201..5e1b01016 100644 --- a/crates/brk_computer/src/internal/per_block/stddev/extended.rs +++ b/crates/brk_computer/src/internal/per_block/stddev/extended.rs @@ -71,7 +71,7 @@ impl StdDevPerBlockExtended { macro_rules! import_band { ($suffix:expr) => { StdDevBand { - value: import!($suffix), + value: import!(concat!("ratio_", $suffix)), price: import_price!($suffix), } }; diff --git a/crates/brk_server/Cargo.toml b/crates/brk_server/Cargo.toml index 148215a0a..3ec358b91 100644 --- a/crates/brk_server/Cargo.toml +++ b/crates/brk_server/Cargo.toml @@ -31,7 +31,7 @@ derive_more = { workspace = true } vecdb = { workspace = true } zstd = "0.13" jiff = { workspace = true } -quick_cache = "0.6.18" +quick_cache = "0.6.19" schemars = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } diff --git a/crates/brk_traversable/src/lib.rs b/crates/brk_traversable/src/lib.rs index d735866de..58d4e946f 100644 --- a/crates/brk_traversable/src/lib.rs +++ b/crates/brk_traversable/src/lib.rs @@ -8,9 +8,9 @@ pub use brk_traversable_derive::Traversable; use schemars::JsonSchema; use serde::Serialize; use vecdb::{ - AnyExportableVec, AnyVec, BytesVec, BytesVecValue, CompressionStrategy, EagerVec, Formattable, - LazyAggVec, LazyVecFrom1, LazyVecFrom2, LazyVecFrom3, RawStrategy, ReadOnlyCompressedVec, - ReadOnlyRawVec, StoredVec, VecIndex, VecValue, + AggFold, AnyExportableVec, AnyVec, BytesVec, BytesVecValue, CompressionStrategy, EagerVec, + Formattable, LazyAggVec, LazyVecFrom1, LazyVecFrom2, LazyVecFrom3, RawStrategy, + ReadOnlyCompressedVec, ReadOnlyRawVec, StoredVec, VecIndex, VecValue, }; pub trait Traversable { @@ -217,13 +217,14 @@ where } } -impl Traversable for LazyAggVec +impl Traversable for LazyAggVec where I: VecIndex, O: VecValue + Formattable + Serialize + JsonSchema, S1I: VecIndex, S2T: VecValue, S1T: VecValue, + Strat: AggFold, { fn iter_any_exportable(&self) -> impl Iterator { std::iter::once(self as &dyn AnyExportableVec) diff --git a/crates/brk_types/src/index.rs b/crates/brk_types/src/index.rs index 075f3d620..e2aea1af8 100644 --- a/crates/brk_types/src/index.rs +++ b/crates/brk_types/src/index.rs @@ -298,7 +298,7 @@ impl<'de> Deserialize<'de> for Index { D: serde::Deserializer<'de>, { let str = String::deserialize(deserializer)?; - Index::try_from(str.as_str()).map_err(|e| serde::de::Error::custom(e)) + Index::try_from(str.as_str()).map_err(serde::de::Error::custom) } } diff --git a/crates/brk_types/src/treenode.rs b/crates/brk_types/src/treenode.rs index 8383bfdfe..b8a41ed75 100644 --- a/crates/brk_types/src/treenode.rs +++ b/crates/brk_types/src/treenode.rs @@ -46,32 +46,47 @@ pub struct MetricLeafWithSchema { pub schema: serde_json::Value, } -/// Extract JSON type from a schema, following $ref if needed. +/// Extract JSON type from a root schema, following $ref and composition keywords. pub fn extract_json_type(schema: &serde_json::Value) -> String { + extract_json_type_inner(schema, schema) +} + +fn extract_json_type_inner(node: &serde_json::Value, root: &serde_json::Value) -> String { // Direct type field - if let Some(t) = schema.get("type").and_then(|v| v.as_str()) { + if let Some(t) = node.get("type").and_then(|v| v.as_str()) { return t.to_string(); } - // Handle $ref - look up in definitions - if let Some(ref_path) = schema.get("$ref").and_then(|v| v.as_str()) + // Handle $ref - resolve against root definitions + if let Some(ref_path) = node.get("$ref").and_then(|v| v.as_str()) && let Some(def_name) = ref_path.rsplit('/').next() { - // Check both "$defs" (draft 2020-12) and "definitions" (older drafts) for defs_key in &["$defs", "definitions"] { - if let Some(defs) = schema.get(defs_key) + if let Some(defs) = root.get(defs_key) && let Some(def) = defs.get(def_name) { - return extract_json_type(def); + return extract_json_type_inner(def, root); } } } // Handle allOf with single element - if let Some(all_of) = schema.get("allOf").and_then(|v| v.as_array()) + if let Some(all_of) = node.get("allOf").and_then(|v| v.as_array()) && all_of.len() == 1 { - return extract_json_type(&all_of[0]); + return extract_json_type_inner(&all_of[0], root); + } + + // Handle anyOf/oneOf (e.g. Option generates {"anyOf": [{"type":"null"}, ...]}) + for key in &["anyOf", "oneOf"] { + if let Some(variants) = node.get(key).and_then(|v| v.as_array()) { + for variant in variants { + let t = extract_json_type_inner(variant, root); + if t != "null" { + return t; + } + } + } } "object".to_string() @@ -136,7 +151,7 @@ pub enum TreeNode { Leaf(MetricLeafWithSchema), } -const BASE: &str = "base"; +const BASE: &str = "raw"; impl TreeNode { pub fn is_empty(&self) -> bool { @@ -708,13 +723,13 @@ mod tests { #[test] fn case3_computed_block_sum() { // ComputedBlockSum: - // - height: wrap="base" → Branch { "base": Leaf(height) } + // - height: wrap="raw" → Branch { "raw": Leaf(height) } // - rest (flatten): DerivedComputedBlockSum → branches with "sum" children let tree = branch(vec![ - // height wrapped as "base" + // height wrapped as "raw" ( "height", - branch(vec![("base", leaf("metric", Index::Height))]), + branch(vec![("raw", leaf("metric", Index::Height))]), ), // rest (flattened) produces branches ( @@ -729,7 +744,7 @@ mod tests { let merged = tree.merge_branches().unwrap(); - // DESIRED: { "base": Leaf(height), "sum": Leaf(day1, week1) } + // DESIRED: { "raw": Leaf(height), "sum": Leaf(day1, week1) } match &merged { TreeNode::Branch(map) => { assert_eq!( @@ -740,7 +755,7 @@ mod tests { ); // base should have Height only - let base_indexes = get_leaf_indexes(map.get("base").unwrap()).unwrap(); + let base_indexes = get_leaf_indexes(map.get("raw").unwrap()).unwrap(); assert!(base_indexes.contains(&Index::Height)); assert_eq!(base_indexes.len(), 1); @@ -759,13 +774,13 @@ mod tests { #[test] fn case4_computed_block_last() { // ComputedBlockLast: - // - height: wrap="base" → Branch { "base": Leaf(height) } + // - height: wrap="raw" → Branch { "raw": Leaf(height) } // - rest (flatten): DerivedComputedBlockLast → branches with "last" children let tree = branch(vec![ - // height wrapped as "base" + // height wrapped as "raw" ( "height", - branch(vec![("base", leaf("metric", Index::Height))]), + branch(vec![("raw", leaf("metric", Index::Height))]), ), // rest (flattened) produces branches with "last" key ( @@ -780,7 +795,7 @@ mod tests { let merged = tree.merge_branches().unwrap(); - // DESIRED: { "base": Leaf(height), "last": Leaf(day1, week1) } + // DESIRED: { "raw": Leaf(height), "last": Leaf(day1, week1) } match &merged { TreeNode::Branch(map) => { assert_eq!( @@ -791,7 +806,7 @@ mod tests { ); // base should have Height only - let base_indexes = get_leaf_indexes(map.get("base").unwrap()).unwrap(); + let base_indexes = get_leaf_indexes(map.get("raw").unwrap()).unwrap(); assert!(base_indexes.contains(&Index::Height)); assert_eq!(base_indexes.len(), 1); @@ -810,17 +825,17 @@ mod tests { #[test] fn case5_computed_block_full() { // ComputedBlockFull has: - // - height: wrapped as "base" (raw values, not aggregated) + // - height: wrapped as "raw" (raw values, not aggregated) // - rest (flatten): DerivedComputedBlockFull { // height_cumulative: CumulativeVec → Branch{"cumulative": Leaf} // day1: Full → Branch{avg, min, max, sum, cumulative} // dates (flatten): more aggregation branches // } let tree = branch(vec![ - // height wrapped as "base" (raw values at height granularity) + // height wrapped as "raw" (raw values at height granularity) ( "height", - branch(vec![("base", leaf("metric", Index::Height))]), + branch(vec![("raw", leaf("metric", Index::Height))]), ), // height_cumulative wrapped as cumulative ( @@ -867,7 +882,7 @@ mod tests { ); // base should have Height only - let base_indexes = get_leaf_indexes(map.get("base").unwrap()).unwrap(); + let base_indexes = get_leaf_indexes(map.get("raw").unwrap()).unwrap(); assert!(base_indexes.contains(&Index::Height)); assert_eq!(base_indexes.len(), 1); @@ -991,7 +1006,7 @@ mod tests { // ========== Case 8: BinaryBlockSumCum ========== // After derive applies all inner merges and flatten, before parent merge: - // - height wrapped as "base" → { base: Leaf(Height) } + // - height wrapped as "raw" → { base: Leaf(Height) } // - height_cumulative wrapped as "cumulative" → { cumulative: Leaf(Height) } // - rest (flatten): children from already-merged inner struct inserted directly // @@ -1002,10 +1017,10 @@ mod tests { fn case8_binary_block_sum_cum() { // Tree AFTER derive applies inner merges, flatten lifts rest's children: let tree = branch(vec![ - // height with wrap="base" + // height with wrap="raw" ( "height", - branch(vec![("base", leaf("metric", Index::Height))]), + branch(vec![("raw", leaf("metric", Index::Height))]), ), // height_cumulative with wrap="cumulative" ( @@ -1040,7 +1055,7 @@ mod tests { ); // base: only Height - let base_indexes = get_leaf_indexes(map.get("base").unwrap()).unwrap(); + let base_indexes = get_leaf_indexes(map.get("raw").unwrap()).unwrap(); assert_eq!(base_indexes.len(), 1); assert!(base_indexes.contains(&Index::Height)); @@ -1067,19 +1082,19 @@ mod tests { // Each denomination has already been merged internally // Simulating the output after inner merge let sats_merged = branch(vec![ - ("base", leaf("metric", Index::Height)), + ("raw", leaf("metric", Index::Height)), ("sum", leaf("metric_sum", Index::Day1)), ("cumulative", leaf("metric_cumulative", Index::Height)), ]); let bitcoin_merged = branch(vec![ - ("base", leaf("metric_btc", Index::Height)), + ("raw", leaf("metric_btc", Index::Height)), ("sum", leaf("metric_btc_sum", Index::Day1)), ("cumulative", leaf("metric_btc_cumulative", Index::Height)), ]); let dollars_merged = branch(vec![ - ("base", leaf("metric_usd", Index::Height)), + ("raw", leaf("metric_usd", Index::Height)), ("sum", leaf("metric_usd_sum", Index::Day1)), ("cumulative", leaf("metric_usd_cumulative", Index::Height)), ]); @@ -1099,7 +1114,7 @@ mod tests { match map.get(denom) { Some(TreeNode::Branch(inner)) => { assert_eq!(inner.len(), 3); - assert!(inner.contains_key("base")); + assert!(inner.contains_key("raw")); assert!(inner.contains_key("sum")); assert!(inner.contains_key("cumulative")); } @@ -1156,14 +1171,14 @@ mod tests { #[test] fn case10_computed_date_last_collapses_to_leaf() { // ComputedDateLast with merge: - // - day1 with wrap="base" → { base: Leaf } + // - day1 with wrap="raw" → { base: Leaf } // - rest (flatten): DerivedDateLast already merged to Leaf // → flatten inserts with field name "rest" as key // // Both have same metric name → collapses to single Leaf let tree = branch(vec![ - // day1 with wrap="base" - ("day1", branch(vec![("base", leaf("metric", Index::Day1))])), + // day1 with wrap="raw" + ("day1", branch(vec![("raw", leaf("metric", Index::Day1))])), // rest (flatten): DerivedDateLast merged to Leaf // Same metric name as base ("rest", leaf("metric", Index::Week1)), diff --git a/modules/brk-client/index.js b/modules/brk-client/index.js index d87f85e3b..f58658fa8 100644 --- a/modules/brk-client/index.js +++ b/modules/brk-client/index.js @@ -1690,18 +1690,18 @@ function createPct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65 function create_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern(client, acc) { return { _0sd: createCentsSatsUsdPattern(client, _m(acc, '0sd_4y')), - m05sd: createPriceValuePattern(client, _m(acc, 'm0_5sd_4y')), - m15sd: createPriceValuePattern(client, _m(acc, 'm1_5sd_4y')), - m1sd: createPriceValuePattern(client, _m(acc, 'm1sd_4y')), - m25sd: createPriceValuePattern(client, _m(acc, 'm2_5sd_4y')), - m2sd: createPriceValuePattern(client, _m(acc, 'm2sd_4y')), - m3sd: createPriceValuePattern(client, _m(acc, 'm3sd_4y')), - p05sd: createPriceValuePattern(client, _m(acc, 'p0_5sd_4y')), - p15sd: createPriceValuePattern(client, _m(acc, 'p1_5sd_4y')), - p1sd: createPriceValuePattern(client, _m(acc, 'p1sd_4y')), - p25sd: createPriceValuePattern(client, _m(acc, 'p2_5sd_4y')), - p2sd: createPriceValuePattern(client, _m(acc, 'p2sd_4y')), - p3sd: createPriceValuePattern(client, _m(acc, 'p3sd_4y')), + m05sd: createPriceValuePattern(client, acc), + m15sd: createPriceValuePattern(client, acc), + m1sd: createPriceValuePattern(client, acc), + m25sd: createPriceValuePattern(client, acc), + m2sd: createPriceValuePattern(client, acc), + m3sd: createPriceValuePattern(client, acc), + p05sd: createPriceValuePattern(client, acc), + p15sd: createPriceValuePattern(client, acc), + p1sd: createPriceValuePattern(client, acc), + p25sd: createPriceValuePattern(client, acc), + p2sd: createPriceValuePattern(client, acc), + p3sd: createPriceValuePattern(client, acc), sd: createMetricPattern1(client, _m(acc, 'sd_4y')), zscore: createMetricPattern1(client, _m(acc, 'zscore_4y')), }; @@ -2085,12 +2085,12 @@ function createBpsCentsPercentilesRatioSatsSmaStdUsdPattern(client, acc) { return { bps: createMetricPattern1(client, _m(acc, 'ratio_bps')), cents: createMetricPattern1(client, _m(acc, 'cents')), - percentiles: createPct1Pct2Pct5Pct95Pct98Pct99Pattern(client, _m(acc, 'ratio')), + percentiles: createPct1Pct2Pct5Pct95Pct98Pct99Pattern(client, acc), ratio: createMetricPattern1(client, _m(acc, 'ratio')), sats: createMetricPattern1(client, _m(acc, 'sats')), sma: create_1m1w1y2y4yAllPattern(client, _m(acc, 'ratio_sma')), stdDev: create_1y2y4yAllPattern(client, _m(acc, 'ratio')), - usd: createMetricPattern1(client, _m(acc, 'usd')), + usd: createMetricPattern1(client, acc), }; } @@ -2133,8 +2133,8 @@ function createCapLossMvrvNetNuplPriceProfitSoprPattern(client, acc) { * @property {CentsUsdPattern} raw * @property {BpsPercentRatioPattern} relToRcap * @property {_1m1w1y24hPattern5} sum - * @property {BaseSumPattern} valueCreated - * @property {BaseSumPattern} valueDestroyed + * @property {RawSumPattern} valueCreated + * @property {RawSumPattern} valueDestroyed */ /** @@ -2149,10 +2149,10 @@ function createCapitulationCumulativeNegativeRawRelSumValuePattern(client, acc) cumulative: createMetricPattern1(client, _m(acc, 'realized_loss_cumulative')), negative: createMetricPattern1(client, _m(acc, 'neg_realized_loss')), raw: createCentsUsdPattern(client, _m(acc, 'realized_loss')), - relToRcap: createBpsPercentRatioPattern(client, _m(acc, 'realized_loss_rel_to_realized_cap')), + relToRcap: createBpsPercentRatioPattern(client, _m(acc, 'realized_loss_rel_to_rcap')), sum: create_1m1w1y24hPattern5(client, _m(acc, 'realized_loss')), - valueCreated: createBaseSumPattern(client, _m(acc, 'loss_value_created')), - valueDestroyed: createBaseSumPattern(client, _m(acc, 'loss_value_destroyed')), + valueCreated: createRawSumPattern(client, _m(acc, 'loss_value_created')), + valueDestroyed: createRawSumPattern(client, _m(acc, 'loss_value_destroyed')), }; } @@ -2283,8 +2283,8 @@ function createCapLossMvrvNuplPriceProfitSoprPattern(client, acc) { * @property {CentsUsdPattern} raw * @property {BpsPercentRatioPattern} relToRcap * @property {_1m1w1y24hPattern5} sum - * @property {BaseSumPattern} valueCreated - * @property {BaseSumPattern} valueDestroyed + * @property {RawSumPattern} valueCreated + * @property {RawSumPattern} valueDestroyed */ /** @@ -2298,10 +2298,10 @@ function createCumulativeDistributionRawRelSumValuePattern(client, acc) { cumulative: createMetricPattern1(client, _m(acc, 'realized_profit_cumulative')), distributionFlow: createMetricPattern1(client, _m(acc, 'profit_flow')), raw: createCentsUsdPattern(client, _m(acc, 'realized_profit')), - relToRcap: createBpsPercentRatioPattern(client, _m(acc, 'realized_profit_rel_to_realized_cap')), + relToRcap: createBpsPercentRatioPattern(client, _m(acc, 'realized_profit_rel_to_rcap')), sum: create_1m1w1y24hPattern5(client, _m(acc, 'realized_profit')), - valueCreated: createBaseSumPattern(client, _m(acc, 'profit_value_created')), - valueDestroyed: createBaseSumPattern(client, _m(acc, 'profit_value_destroyed')), + valueCreated: createRawSumPattern(client, _m(acc, 'profit_value_created')), + valueDestroyed: createRawSumPattern(client, _m(acc, 'profit_value_destroyed')), }; } @@ -2381,10 +2381,10 @@ function createBpsCentsPercentilesRatioSatsUsdPattern(client, acc) { return { bps: createMetricPattern1(client, _m(acc, 'ratio_bps')), cents: createMetricPattern1(client, _m(acc, 'cents')), - percentiles: createPct1Pct2Pct5Pct95Pct98Pct99Pattern(client, _m(acc, 'ratio')), + percentiles: createPct1Pct2Pct5Pct95Pct98Pct99Pattern(client, acc), ratio: createMetricPattern1(client, _m(acc, 'ratio')), sats: createMetricPattern1(client, _m(acc, 'sats')), - usd: createMetricPattern1(client, _m(acc, 'usd')), + usd: createMetricPattern1(client, acc), }; } @@ -2393,7 +2393,7 @@ function createBpsCentsPercentilesRatioSatsUsdPattern(client, acc) { * @property {MetricPattern1} btc * @property {MetricPattern1} cents * @property {BpsPercentRatioPattern} relToCirculating - * @property {BpsPercentRatioPattern} relToOwnSupply + * @property {BpsPercentRatioPattern} relToOwn * @property {MetricPattern1} sats * @property {MetricPattern1} usd */ @@ -2408,8 +2408,8 @@ function createBtcCentsRelSatsUsdPattern3(client, acc) { return { btc: createMetricPattern1(client, acc), cents: createMetricPattern1(client, _m(acc, 'cents')), - relToCirculating: createBpsPercentRatioPattern(client, _m(acc, 'rel_to_circulating_supply')), - relToOwnSupply: createBpsPercentRatioPattern(client, _m(acc, 'rel_to_own_supply')), + relToCirculating: createBpsPercentRatioPattern(client, _m(acc, 'rel_to_circulating')), + relToOwn: createBpsPercentRatioPattern(client, _m(acc, 'rel_to_own')), sats: createMetricPattern1(client, _m(acc, 'sats')), usd: createMetricPattern1(client, _m(acc, 'usd')), }; @@ -2437,15 +2437,15 @@ function createChangeCumulativeDeltaRawRelSumPattern(client, acc) { cumulative: createMetricPattern1(client, _m(acc, 'realized_pnl_cumulative')), delta: createChangeRatePattern4(client, _m(acc, 'pnl_delta')), raw: createMetricPattern1(client, _m(acc, 'realized_pnl')), - relToRcap: createBpsPercentRatioPattern(client, _m(acc, 'realized_pnl_rel_to_realized_cap')), + relToRcap: createBpsPercentRatioPattern(client, _m(acc, 'realized_pnl_rel_to_rcap')), sum: create_1m1w1y24hPattern(client, _m(acc, 'realized_pnl')), }; } /** - * @typedef {Object} DeltaHalvedInRelTotalPattern2 + * @typedef {Object} DeltaHalfInRelTotalPattern2 * @property {ChangeRatePattern} delta - * @property {BtcCentsSatsUsdPattern} halved + * @property {BtcCentsSatsUsdPattern} half * @property {BtcCentsRelSatsUsdPattern3} inLoss * @property {BtcCentsRelSatsUsdPattern3} inProfit * @property {BpsPercentRatioPattern} relToCirculating @@ -2453,26 +2453,26 @@ function createChangeCumulativeDeltaRawRelSumPattern(client, acc) { */ /** - * Create a DeltaHalvedInRelTotalPattern2 pattern node + * Create a DeltaHalfInRelTotalPattern2 pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {DeltaHalvedInRelTotalPattern2} + * @returns {DeltaHalfInRelTotalPattern2} */ -function createDeltaHalvedInRelTotalPattern2(client, acc) { +function createDeltaHalfInRelTotalPattern2(client, acc) { return { delta: createChangeRatePattern(client, _m(acc, 'delta')), - halved: createBtcCentsSatsUsdPattern(client, _m(acc, 'halved')), + half: createBtcCentsSatsUsdPattern(client, _m(acc, 'half')), inLoss: createBtcCentsRelSatsUsdPattern3(client, _m(acc, 'in_loss')), inProfit: createBtcCentsRelSatsUsdPattern3(client, _m(acc, 'in_profit')), - relToCirculating: createBpsPercentRatioPattern(client, _m(acc, 'rel_to_circulating_supply')), + relToCirculating: createBpsPercentRatioPattern(client, _m(acc, 'rel_to_circulating')), total: createBtcCentsSatsUsdPattern(client, acc), }; } /** - * @typedef {Object} DeltaHalvedInRelTotalPattern + * @typedef {Object} DeltaHalfInRelTotalPattern * @property {ChangeRatePattern2} delta - * @property {BtcCentsSatsUsdPattern} halved + * @property {BtcCentsSatsUsdPattern} half * @property {BtcCentsRelSatsUsdPattern} inLoss * @property {BtcCentsRelSatsUsdPattern} inProfit * @property {BpsPercentRatioPattern} relToCirculating @@ -2480,18 +2480,18 @@ function createDeltaHalvedInRelTotalPattern2(client, acc) { */ /** - * Create a DeltaHalvedInRelTotalPattern pattern node + * Create a DeltaHalfInRelTotalPattern pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {DeltaHalvedInRelTotalPattern} + * @returns {DeltaHalfInRelTotalPattern} */ -function createDeltaHalvedInRelTotalPattern(client, acc) { +function createDeltaHalfInRelTotalPattern(client, acc) { return { delta: createChangeRatePattern2(client, _m(acc, 'delta')), - halved: createBtcCentsSatsUsdPattern(client, _m(acc, 'halved')), + half: createBtcCentsSatsUsdPattern(client, _m(acc, 'half')), inLoss: createBtcCentsRelSatsUsdPattern(client, _m(acc, 'in_loss')), inProfit: createBtcCentsRelSatsUsdPattern(client, _m(acc, 'in_profit')), - relToCirculating: createBpsPercentRatioPattern(client, _m(acc, 'rel_to_circulating_supply')), + relToCirculating: createBpsPercentRatioPattern(client, _m(acc, 'rel_to_circulating')), total: createBtcCentsSatsUsdPattern(client, acc), }; } @@ -2500,9 +2500,9 @@ function createDeltaHalvedInRelTotalPattern(client, acc) { * @typedef {Object} NegativeRawRelSumPattern2 * @property {MetricPattern1} negative * @property {CentsUsdPattern} raw - * @property {BpsPercentRatioPattern} relToMarketCap + * @property {BpsPercentRatioPattern} relToMcap * @property {BpsPercentRatioPattern} relToOwnGross - * @property {BpsPercentRatioPattern} relToOwnMarketCap + * @property {BpsPercentRatioPattern} relToOwnMcap * @property {_24hPattern} sum */ @@ -2516,9 +2516,9 @@ function createNegativeRawRelSumPattern2(client, acc) { return { negative: createMetricPattern1(client, _m(acc, 'neg_unrealized_loss')), raw: createCentsUsdPattern(client, _m(acc, 'unrealized_loss')), - relToMarketCap: createBpsPercentRatioPattern(client, _m(acc, 'unrealized_loss_rel_to_market_cap')), + relToMcap: createBpsPercentRatioPattern(client, _m(acc, 'unrealized_loss_rel_to_mcap')), relToOwnGross: createBpsPercentRatioPattern(client, _m(acc, 'unrealized_loss_rel_to_own_gross_pnl')), - relToOwnMarketCap: createBpsPercentRatioPattern(client, _m(acc, 'unrealized_loss_rel_to_own_market_cap')), + relToOwnMcap: createBpsPercentRatioPattern(client, _m(acc, 'unrealized_loss_rel_to_own_mcap')), sum: create_24hPattern(client, _m(acc, 'unrealized_loss_24h')), }; } @@ -2541,12 +2541,12 @@ function createNegativeRawRelSumPattern2(client, acc) { */ function createPct1Pct2Pct5Pct95Pct98Pct99Pattern(client, acc) { return { - pct1: createBpsPriceRatioPattern(client, _m(acc, 'pct1')), - pct2: createBpsPriceRatioPattern(client, _m(acc, 'pct2')), - pct5: createBpsPriceRatioPattern(client, _m(acc, 'pct5')), - pct95: createBpsPriceRatioPattern(client, _m(acc, 'pct95')), - pct98: createBpsPriceRatioPattern(client, _m(acc, 'pct98')), - pct99: createBpsPriceRatioPattern(client, _m(acc, 'pct99')), + pct1: createBpsPriceRatioPattern(client, acc), + pct2: createBpsPriceRatioPattern(client, acc), + pct5: createBpsPriceRatioPattern(client, acc), + pct95: createBpsPriceRatioPattern(client, acc), + pct98: createBpsPriceRatioPattern(client, acc), + pct99: createBpsPriceRatioPattern(client, acc), }; } @@ -2555,7 +2555,7 @@ function createPct1Pct2Pct5Pct95Pct98Pct99Pattern(client, acc) { * @property {CoindaysSentPattern} activity * @property {UnspentPattern2} outputs * @property {CapLossMvrvNetNuplPriceProfitSoprPattern} realized - * @property {DeltaHalvedInRelTotalPattern} supply + * @property {DeltaHalfInRelTotalPattern} supply * @property {InvestedInvestorLossNetProfitPattern} unrealized */ @@ -2570,7 +2570,7 @@ function createActivityOutputsRealizedSupplyUnrealizedPattern(client, acc) { activity: createCoindaysSentPattern(client, acc), outputs: createUnspentPattern2(client, _m(acc, 'utxo_count')), realized: createCapLossMvrvNetNuplPriceProfitSoprPattern(client, acc), - supply: createDeltaHalvedInRelTotalPattern(client, _m(acc, 'supply')), + supply: createDeltaHalfInRelTotalPattern(client, _m(acc, 'supply')), unrealized: createInvestedInvestorLossNetProfitPattern(client, acc), }; } @@ -2580,7 +2580,7 @@ function createActivityOutputsRealizedSupplyUnrealizedPattern(client, acc) { * @property {CoindaysSentPattern} activity * @property {UnspentPattern2} outputs * @property {CapLossMvrvNetNuplPriceProfitSoprPattern} realized - * @property {DeltaHalvedInRelTotalPattern} supply + * @property {DeltaHalfInRelTotalPattern} supply * @property {LossNetProfitPattern} unrealized */ @@ -2595,7 +2595,7 @@ function createActivityOutputsRealizedSupplyUnrealizedPattern2(client, acc) { activity: createCoindaysSentPattern(client, acc), outputs: createUnspentPattern2(client, _m(acc, 'utxo_count')), realized: createCapLossMvrvNetNuplPriceProfitSoprPattern(client, acc), - supply: createDeltaHalvedInRelTotalPattern(client, _m(acc, 'supply')), + supply: createDeltaHalfInRelTotalPattern(client, _m(acc, 'supply')), unrealized: createLossNetProfitPattern(client, acc), }; } @@ -2621,7 +2621,7 @@ function createBpsCentsRatioSatsUsdPattern(client, acc) { cents: createMetricPattern1(client, _m(acc, 'cents')), ratio: createMetricPattern1(client, _m(acc, 'ratio')), sats: createMetricPattern1(client, _m(acc, 'sats')), - usd: createMetricPattern1(client, _m(acc, 'usd')), + usd: createMetricPattern1(client, acc), }; } @@ -2644,7 +2644,7 @@ function createBtcCentsRelSatsUsdPattern(client, acc) { return { btc: createMetricPattern1(client, acc), cents: createMetricPattern1(client, _m(acc, 'cents')), - relToCirculating: createBpsPercentRatioPattern(client, _m(acc, 'rel_to_circulating_supply')), + relToCirculating: createBpsPercentRatioPattern(client, _m(acc, 'rel_to_circulating')), sats: createMetricPattern1(client, _m(acc, 'sats')), usd: createMetricPattern1(client, _m(acc, 'usd')), }; @@ -2654,7 +2654,7 @@ function createBtcCentsRelSatsUsdPattern(client, acc) { * @typedef {Object} BtcCentsRelSatsUsdPattern2 * @property {MetricPattern1} btc * @property {MetricPattern1} cents - * @property {BpsPercentRatioPattern} relToOwnSupply + * @property {BpsPercentRatioPattern} relToOwn * @property {MetricPattern1} sats * @property {MetricPattern1} usd */ @@ -2669,7 +2669,7 @@ function createBtcCentsRelSatsUsdPattern2(client, acc) { return { btc: createMetricPattern1(client, acc), cents: createMetricPattern1(client, _m(acc, 'cents')), - relToOwnSupply: createBpsPercentRatioPattern(client, _m(acc, 'rel_to_own_supply')), + relToOwn: createBpsPercentRatioPattern(client, _m(acc, 'rel_to_own')), sats: createMetricPattern1(client, _m(acc, 'sats')), usd: createMetricPattern1(client, _m(acc, 'usd')), }; @@ -2695,7 +2695,7 @@ function createCentsDeltaRawRelUsdPattern(client, acc) { cents: createMetricPattern1(client, _m(acc, 'realized_cap_cents')), delta: createChangeRatePattern4(client, _m(acc, 'realized_cap_delta')), raw: createMetricPattern18(client, _m(acc, 'cap_raw')), - relToOwnMcap: createBpsPercentRatioPattern(client, _m(acc, 'realized_cap_rel_to_own_market_cap')), + relToOwnMcap: createBpsPercentRatioPattern(client, _m(acc, 'realized_cap_rel_to_own_mcap')), usd: createMetricPattern1(client, _m(acc, 'realized_cap')), }; } @@ -2828,9 +2828,9 @@ function createPhsReboundThsPattern(client, acc) { /** * @typedef {Object} RawRelSumPattern2 * @property {CentsUsdPattern} raw - * @property {BpsPercentRatioPattern} relToMarketCap + * @property {BpsPercentRatioPattern} relToMcap * @property {BpsPercentRatioPattern} relToOwnGross - * @property {BpsPercentRatioPattern} relToOwnMarketCap + * @property {BpsPercentRatioPattern} relToOwnMcap * @property {_24hPattern} sum */ @@ -2843,9 +2843,9 @@ function createPhsReboundThsPattern(client, acc) { function createRawRelSumPattern2(client, acc) { return { raw: createCentsUsdPattern(client, acc), - relToMarketCap: createBpsPercentRatioPattern(client, _m(acc, 'rel_to_market_cap')), + relToMcap: createBpsPercentRatioPattern(client, _m(acc, 'rel_to_mcap')), relToOwnGross: createBpsPercentRatioPattern(client, _m(acc, 'rel_to_own_gross_pnl')), - relToOwnMarketCap: createBpsPercentRatioPattern(client, _m(acc, 'rel_to_own_market_cap')), + relToOwnMcap: createBpsPercentRatioPattern(client, _m(acc, 'rel_to_own_mcap')), sum: create_24hPattern(client, _m(acc, '24h')), }; } @@ -3039,25 +3039,25 @@ function create_1y2y4yAllPattern(client, acc) { } /** - * @typedef {Object} AddrOutputsRealizedSupplyPattern - * @property {BaseDeltaPattern} addrCount + * @typedef {Object} AddressOutputsRealizedSupplyPattern + * @property {DeltaRawPattern} addressCount * @property {UnspentPattern} outputs * @property {CapLossMvrvNuplPriceProfitSoprPattern} realized - * @property {HalvedTotalPattern} supply + * @property {HalfTotalPattern} supply */ /** - * Create a AddrOutputsRealizedSupplyPattern pattern node + * Create a AddressOutputsRealizedSupplyPattern pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {AddrOutputsRealizedSupplyPattern} + * @returns {AddressOutputsRealizedSupplyPattern} */ -function createAddrOutputsRealizedSupplyPattern(client, acc) { +function createAddressOutputsRealizedSupplyPattern(client, acc) { return { - addrCount: createBaseDeltaPattern(client, _m(acc, 'addr_count')), + addressCount: createDeltaRawPattern(client, _m(acc, 'address_count')), outputs: createUnspentPattern(client, _m(acc, 'utxo_count')), realized: createCapLossMvrvNuplPriceProfitSoprPattern(client, acc), - supply: createHalvedTotalPattern(client, _m(acc, 'supply')), + supply: createHalfTotalPattern(client, _m(acc, 'supply')), }; } @@ -3077,7 +3077,7 @@ function createAddrOutputsRealizedSupplyPattern(client, acc) { */ function createAdjustedRatioValuePattern(client, acc) { return { - adjusted: createRatioValuePattern2(client, _m(acc, 'adjusted')), + adjusted: createRatioValuePattern2(client, acc), ratio: create_1m1w1y24hPattern(client, _m(acc, 'sopr')), valueCreated: createRawSumPattern(client, _m(acc, 'value_created')), valueDestroyed: createRawSumPattern(client, _m(acc, 'value_destroyed')), @@ -3157,7 +3157,7 @@ function createCapLowerPriceUpperPattern(client, acc) { * @typedef {Object} CentsRelUsdPattern2 * @property {MetricPattern1} cents * @property {BpsPercentRatioPattern} relToOwnGross - * @property {BpsPercentRatioPattern} relToOwnMarketCap + * @property {BpsPercentRatioPattern} relToOwnMcap * @property {MetricPattern1} usd */ @@ -3171,7 +3171,7 @@ function createCentsRelUsdPattern2(client, acc) { return { cents: createMetricPattern1(client, _m(acc, 'cents')), relToOwnGross: createBpsPercentRatioPattern(client, _m(acc, 'rel_to_own_gross_pnl')), - relToOwnMarketCap: createBpsPercentRatioPattern(client, _m(acc, 'rel_to_own_market_cap')), + relToOwnMcap: createBpsPercentRatioPattern(client, _m(acc, 'rel_to_own_mcap')), usd: createMetricPattern1(client, acc), }; } @@ -3200,22 +3200,22 @@ function createCumulativeNegativeRawSumPattern(client, acc) { } /** - * @typedef {Object} HalvedInTotalPattern - * @property {BtcCentsSatsUsdPattern} halved + * @typedef {Object} HalfInTotalPattern + * @property {BtcCentsSatsUsdPattern} half * @property {BtcCentsSatsUsdPattern} inLoss * @property {BtcCentsSatsUsdPattern} inProfit * @property {BtcCentsSatsUsdPattern} total */ /** - * Create a HalvedInTotalPattern pattern node + * Create a HalfInTotalPattern pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {HalvedInTotalPattern} + * @returns {HalfInTotalPattern} */ -function createHalvedInTotalPattern(client, acc) { +function createHalfInTotalPattern(client, acc) { return { - halved: createBtcCentsSatsUsdPattern(client, _m(acc, 'halved')), + half: createBtcCentsSatsUsdPattern(client, _m(acc, 'half')), inLoss: createBtcCentsSatsUsdPattern(client, _m(acc, 'in_loss')), inProfit: createBtcCentsSatsUsdPattern(client, _m(acc, 'in_profit')), total: createBtcCentsSatsUsdPattern(client, acc), @@ -3272,7 +3272,7 @@ function createInRawSumPattern2(client, acc) { * @typedef {Object} OutputsRealizedSupplyUnrealizedPattern * @property {UnspentPattern} outputs * @property {CapLossMvrvNuplPriceProfitSoprPattern} realized - * @property {HalvedInTotalPattern} supply + * @property {HalfInTotalPattern} supply * @property {LossProfitPattern} unrealized */ @@ -3286,7 +3286,7 @@ function createOutputsRealizedSupplyUnrealizedPattern(client, acc) { return { outputs: createUnspentPattern(client, _m(acc, 'utxo_count')), realized: createCapLossMvrvNuplPriceProfitSoprPattern(client, acc), - supply: createHalvedInTotalPattern(client, _m(acc, 'supply')), + supply: createHalfInTotalPattern(client, _m(acc, 'supply')), unrealized: createLossProfitPattern(client, _m(acc, 'unrealized')), }; } @@ -3394,9 +3394,9 @@ function createBpsPercentRatioPattern(client, acc) { */ function createBpsPriceRatioPattern(client, acc) { return { - bps: createMetricPattern1(client, _m(acc, 'bps')), - price: createCentsSatsUsdPattern(client, acc), - ratio: createMetricPattern1(client, acc), + bps: createMetricPattern1(client, _m(acc, 'ratio_pct99_bps')), + price: createCentsSatsUsdPattern(client, _m(acc, 'pct99')), + ratio: createMetricPattern1(client, _m(acc, 'ratio_pct99')), }; } @@ -3480,7 +3480,7 @@ function createCentsSatsUsdPattern(client, acc) { return { cents: createMetricPattern1(client, _m(acc, 'cents')), sats: createMetricPattern1(client, _m(acc, 'sats')), - usd: createMetricPattern1(client, _m(acc, 'usd')), + usd: createMetricPattern1(client, acc), }; } @@ -3501,7 +3501,7 @@ function createCumulativeRawRelPattern(client, acc) { return { cumulative: createMetricPattern1(client, _m(acc, 'cumulative')), raw: createMetricPattern1(client, acc), - relToRcap: createBpsPercentRatioPattern(client, _m(acc, 'rel_to_realized_cap')), + relToRcap: createBpsPercentRatioPattern(client, _m(acc, 'rel_to_rcap')), }; } @@ -3593,7 +3593,7 @@ function createNegativeRawSumPattern(client, acc) { * @typedef {Object} OutputsRealizedSupplyPattern * @property {UnspentPattern} outputs * @property {CapLossMvrvNuplPriceProfitSoprPattern} realized - * @property {HalvedTotalPattern} supply + * @property {HalfTotalPattern} supply */ /** @@ -3606,15 +3606,15 @@ function createOutputsRealizedSupplyPattern(client, acc) { return { outputs: createUnspentPattern(client, _m(acc, 'utxo_count')), realized: createCapLossMvrvNuplPriceProfitSoprPattern(client, acc), - supply: createHalvedTotalPattern(client, _m(acc, 'supply')), + supply: createHalfTotalPattern(client, _m(acc, 'supply')), }; } /** * @typedef {Object} RatioValuePattern2 * @property {_1m1w1y24hPattern} ratio - * @property {BaseSumPattern} valueCreated - * @property {BaseSumPattern} valueDestroyed + * @property {RawSumPattern} valueCreated + * @property {RawSumPattern} valueDestroyed */ /** @@ -3625,9 +3625,9 @@ function createOutputsRealizedSupplyPattern(client, acc) { */ function createRatioValuePattern2(client, acc) { return { - ratio: create_1m1w1y24hPattern(client, _m(acc, 'sopr')), - valueCreated: createBaseSumPattern(client, _m(acc, 'value_created')), - valueDestroyed: createBaseSumPattern(client, _m(acc, 'value_destroyed')), + ratio: create_1m1w1y24hPattern(client, _m(acc, 'asopr')), + valueCreated: createRawSumPattern(client, _m(acc, 'adj_value_created')), + valueDestroyed: createRawSumPattern(client, _m(acc, 'adj_value_destroyed')), }; } @@ -3719,63 +3719,6 @@ function createCumulativeRawSumPattern(client, acc) { }; } -/** - * @typedef {Object} BaseSumPattern - * @property {MetricPattern1} base - * @property {_1m1w1y24hPattern} sum - */ - -/** - * Create a BaseSumPattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {BaseSumPattern} - */ -function createBaseSumPattern(client, acc) { - return { - base: createMetricPattern1(client, acc), - sum: create_1m1w1y24hPattern(client, acc), - }; -} - -/** - * @typedef {Object} BaseDeltaPattern2 - * @property {MetricPattern1} base - * @property {ChangeRatePattern} delta - */ - -/** - * Create a BaseDeltaPattern2 pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {BaseDeltaPattern2} - */ -function createBaseDeltaPattern2(client, acc) { - return { - base: createMetricPattern1(client, acc), - delta: createChangeRatePattern(client, _m(acc, 'delta')), - }; -} - -/** - * @typedef {Object} BaseDeltaPattern - * @property {MetricPattern1} base - * @property {ChangeRatePattern2} delta - */ - -/** - * Create a BaseDeltaPattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {BaseDeltaPattern} - */ -function createBaseDeltaPattern(client, acc) { - return { - base: createMetricPattern1(client, acc), - delta: createChangeRatePattern2(client, _m(acc, 'delta')), - }; -} - /** * @typedef {Object} BlocksDominancePattern * @property {CumulativeRawPattern} blocksMined @@ -3929,20 +3872,58 @@ function createCoindaysSentPattern(client, acc) { } /** - * @typedef {Object} HalvedTotalPattern - * @property {BtcCentsSatsUsdPattern} halved + * @typedef {Object} DeltaRawPattern2 + * @property {ChangeRatePattern} delta + * @property {MetricPattern1} raw + */ + +/** + * Create a DeltaRawPattern2 pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {DeltaRawPattern2} + */ +function createDeltaRawPattern2(client, acc) { + return { + delta: createChangeRatePattern(client, _m(acc, 'delta')), + raw: createMetricPattern1(client, acc), + }; +} + +/** + * @typedef {Object} DeltaRawPattern + * @property {ChangeRatePattern2} delta + * @property {MetricPattern1} raw + */ + +/** + * Create a DeltaRawPattern pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {DeltaRawPattern} + */ +function createDeltaRawPattern(client, acc) { + return { + delta: createChangeRatePattern2(client, _m(acc, 'delta')), + raw: createMetricPattern1(client, acc), + }; +} + +/** + * @typedef {Object} HalfTotalPattern + * @property {BtcCentsSatsUsdPattern} half * @property {BtcCentsSatsUsdPattern} total */ /** - * Create a HalvedTotalPattern pattern node + * Create a HalfTotalPattern pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {HalvedTotalPattern} + * @returns {HalfTotalPattern} */ -function createHalvedTotalPattern(client, acc) { +function createHalfTotalPattern(client, acc) { return { - halved: createBtcCentsSatsUsdPattern(client, _m(acc, 'halved')), + half: createBtcCentsSatsUsdPattern(client, _m(acc, 'half')), total: createBtcCentsSatsUsdPattern(client, acc), }; } @@ -4018,8 +3999,8 @@ function createLossProfitPattern(client, acc) { */ function createPriceValuePattern(client, acc) { return { - price: createCentsSatsUsdPattern(client, acc), - value: createMetricPattern1(client, acc), + price: createCentsSatsUsdPattern(client, _m(acc, 'p3sd_4y')), + value: createMetricPattern1(client, _m(acc, 'ratio_p3sd_4y')), }; } @@ -4113,8 +4094,8 @@ function createRealizedSupplyPattern(client, acc) { */ function createRelPattern(client, acc) { return { - relToMcap: createBpsPercentRatioPattern(client, _m(acc, 'market_cap')), - relToRcap: createBpsPercentRatioPattern(client, _m(acc, 'realized_cap')), + relToMcap: createBpsPercentRatioPattern(client, _m(acc, 'mcap')), + relToRcap: createBpsPercentRatioPattern(client, _m(acc, 'rcap')), }; } @@ -4194,7 +4175,7 @@ function createCumulativeRawPattern(client, acc) { function createRawSumPattern(client, acc) { return { raw: createMetricPattern1(client, acc), - sum: create_1m1w1y24hPattern(client, _m(acc, 'sum')), + sum: create_1m1w1y24hPattern(client, acc), }; } @@ -4289,7 +4270,7 @@ function create_24hPattern(client, acc) { /** * @typedef {Object} UnspentPattern2 - * @property {BaseDeltaPattern} unspentCount + * @property {DeltaRawPattern} unspentCount */ /** @@ -4300,13 +4281,13 @@ function create_24hPattern(client, acc) { */ function createUnspentPattern2(client, acc) { return { - unspentCount: createBaseDeltaPattern(client, acc), + unspentCount: createDeltaRawPattern(client, acc), }; } /** * @typedef {Object} UnspentPattern3 - * @property {BaseDeltaPattern2} unspentCount + * @property {DeltaRawPattern2} unspentCount */ /** @@ -4317,7 +4298,7 @@ function createUnspentPattern2(client, acc) { */ function createUnspentPattern3(client, acc) { return { - unspentCount: createBaseDeltaPattern2(client, acc), + unspentCount: createDeltaRawPattern2(client, acc), }; } @@ -4467,7 +4448,7 @@ function createRawPattern2(client, acc) { /** * @typedef {Object} MetricsTree_Blocks_Weight - * @property {MetricPattern18} base + * @property {MetricPattern18} raw * @property {MetricPattern1} cumulative * @property {_1m1w1y24hPattern} sum * @property {_1m1w1y24hPattern} average @@ -5348,8 +5329,22 @@ function createRawPattern2(client, acc) { * @property {MetricPattern1} sats * @property {MetricPattern1} bps * @property {MetricPattern1} ratio - * @property {CentsSatsUsdPattern} x24 - * @property {CentsSatsUsdPattern} x08 + * @property {MetricsTree_Market_MovingAverage_Sma_200d_X24} x24 + * @property {MetricsTree_Market_MovingAverage_Sma_200d_X08} x08 + */ + +/** + * @typedef {Object} MetricsTree_Market_MovingAverage_Sma_200d_X24 + * @property {MetricPattern1} cents + * @property {MetricPattern1} usd + * @property {MetricPattern1} sats + */ + +/** + * @typedef {Object} MetricsTree_Market_MovingAverage_Sma_200d_X08 + * @property {MetricPattern1} cents + * @property {MetricPattern1} usd + * @property {MetricPattern1} sats */ /** @@ -5359,7 +5354,14 @@ function createRawPattern2(client, acc) { * @property {MetricPattern1} sats * @property {MetricPattern1} bps * @property {MetricPattern1} ratio - * @property {CentsSatsUsdPattern} x2 + * @property {MetricsTree_Market_MovingAverage_Sma_350d_X2} x2 + */ + +/** + * @typedef {Object} MetricsTree_Market_MovingAverage_Sma_350d_X2 + * @property {MetricPattern1} cents + * @property {MetricPattern1} usd + * @property {MetricPattern1} sats */ /** @@ -5753,14 +5755,7 @@ function createRawPattern2(client, acc) { * @property {CentsSatsUsdPattern2} open * @property {CentsSatsUsdPattern2} high * @property {CentsSatsUsdPattern2} low - * @property {MetricsTree_Prices_Split_Close} close - */ - -/** - * @typedef {Object} MetricsTree_Prices_Split_Close - * @property {MetricPattern2} cents - * @property {MetricPattern2} usd - * @property {MetricPattern2} sats + * @property {CentsSatsUsdPattern2} close */ /** @@ -5832,15 +5827,69 @@ function createRawPattern2(client, acc) { /** * @typedef {Object} MetricsTree_Distribution_Addresses_New - * @property {RawSumPattern} all - * @property {RawSumPattern} p2pk65 - * @property {RawSumPattern} p2pk33 - * @property {RawSumPattern} p2pkh - * @property {RawSumPattern} p2sh - * @property {RawSumPattern} p2wpkh - * @property {RawSumPattern} p2wsh - * @property {RawSumPattern} p2tr - * @property {RawSumPattern} p2a + * @property {MetricsTree_Distribution_Addresses_New_All} all + * @property {MetricsTree_Distribution_Addresses_New_P2pk65} p2pk65 + * @property {MetricsTree_Distribution_Addresses_New_P2pk33} p2pk33 + * @property {MetricsTree_Distribution_Addresses_New_P2pkh} p2pkh + * @property {MetricsTree_Distribution_Addresses_New_P2sh} p2sh + * @property {MetricsTree_Distribution_Addresses_New_P2wpkh} p2wpkh + * @property {MetricsTree_Distribution_Addresses_New_P2wsh} p2wsh + * @property {MetricsTree_Distribution_Addresses_New_P2tr} p2tr + * @property {MetricsTree_Distribution_Addresses_New_P2a} p2a + */ + +/** + * @typedef {Object} MetricsTree_Distribution_Addresses_New_All + * @property {MetricPattern1} raw + * @property {_1m1w1y24hPattern} sum + */ + +/** + * @typedef {Object} MetricsTree_Distribution_Addresses_New_P2pk65 + * @property {MetricPattern1} raw + * @property {_1m1w1y24hPattern} sum + */ + +/** + * @typedef {Object} MetricsTree_Distribution_Addresses_New_P2pk33 + * @property {MetricPattern1} raw + * @property {_1m1w1y24hPattern} sum + */ + +/** + * @typedef {Object} MetricsTree_Distribution_Addresses_New_P2pkh + * @property {MetricPattern1} raw + * @property {_1m1w1y24hPattern} sum + */ + +/** + * @typedef {Object} MetricsTree_Distribution_Addresses_New_P2sh + * @property {MetricPattern1} raw + * @property {_1m1w1y24hPattern} sum + */ + +/** + * @typedef {Object} MetricsTree_Distribution_Addresses_New_P2wpkh + * @property {MetricPattern1} raw + * @property {_1m1w1y24hPattern} sum + */ + +/** + * @typedef {Object} MetricsTree_Distribution_Addresses_New_P2wsh + * @property {MetricPattern1} raw + * @property {_1m1w1y24hPattern} sum + */ + +/** + * @typedef {Object} MetricsTree_Distribution_Addresses_New_P2tr + * @property {MetricPattern1} raw + * @property {_1m1w1y24hPattern} sum + */ + +/** + * @typedef {Object} MetricsTree_Distribution_Addresses_New_P2a + * @property {MetricPattern1} raw + * @property {_1m1w1y24hPattern} sum */ /** @@ -5896,7 +5945,7 @@ function createRawPattern2(client, acc) { * @property {BtcCentsRelSatsUsdPattern2} inProfit * @property {BtcCentsRelSatsUsdPattern2} inLoss * @property {BtcCentsSatsUsdPattern} total - * @property {BtcCentsSatsUsdPattern} halved + * @property {BtcCentsSatsUsdPattern} half */ /** @@ -5915,7 +5964,7 @@ function createRawPattern2(client, acc) { * @property {MetricPattern1} negative * @property {CentsUsdPattern} raw * @property {_24hPattern} sum - * @property {BpsPercentRatioPattern} relToMarketCap + * @property {BpsPercentRatioPattern} relToMcap * @property {BpsPercentRatioPattern} relToOwnGross */ @@ -5930,14 +5979,14 @@ function createRawPattern2(client, acc) { * @typedef {Object} MetricsTree_Distribution_Cohorts_Utxo_All_Unrealized_Profit * @property {CentsUsdPattern} raw * @property {_24hPattern} sum - * @property {BpsPercentRatioPattern} relToMarketCap + * @property {BpsPercentRatioPattern} relToMcap * @property {BpsPercentRatioPattern} relToOwnGross */ /** * @typedef {Object} MetricsTree_Distribution_Cohorts_Utxo_Sth * @property {CapGrossInvestorLossMvrvNetNuplPeakPriceProfitSoprPattern} realized - * @property {DeltaHalvedInRelTotalPattern2} supply + * @property {DeltaHalfInRelTotalPattern2} supply * @property {UnspentPattern3} outputs * @property {CoindaysCoinyearsDormancySentVelocityPattern} activity * @property {InvestedMaxMinPercentilesSupplyPattern} costBasis @@ -5946,7 +5995,7 @@ function createRawPattern2(client, acc) { /** * @typedef {Object} MetricsTree_Distribution_Cohorts_Utxo_Lth - * @property {DeltaHalvedInRelTotalPattern2} supply + * @property {DeltaHalfInRelTotalPattern2} supply * @property {UnspentPattern3} outputs * @property {CoindaysCoinyearsDormancySentVelocityPattern} activity * @property {MetricsTree_Distribution_Cohorts_Utxo_Lth_Realized} realized @@ -5972,26 +6021,14 @@ function createRawPattern2(client, acc) { /** * @typedef {Object} MetricsTree_Distribution_Cohorts_Utxo_Lth_Realized_Sopr - * @property {MetricsTree_Distribution_Cohorts_Utxo_Lth_Realized_Sopr_ValueCreated} valueCreated - * @property {MetricsTree_Distribution_Cohorts_Utxo_Lth_Realized_Sopr_ValueDestroyed} valueDestroyed + * @property {RawSumPattern} valueCreated + * @property {RawSumPattern} valueDestroyed * @property {_1m1w1y24hPattern} ratio */ -/** - * @typedef {Object} MetricsTree_Distribution_Cohorts_Utxo_Lth_Realized_Sopr_ValueCreated - * @property {_1m1w1y24hPattern} sum - * @property {MetricPattern1} raw - */ - -/** - * @typedef {Object} MetricsTree_Distribution_Cohorts_Utxo_Lth_Realized_Sopr_ValueDestroyed - * @property {_1m1w1y24hPattern} sum - * @property {MetricPattern1} raw - */ - /** * @typedef {Object} MetricsTree_Distribution_Cohorts_Utxo_AgeRange - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} upTo1h + * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} under1h * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _1hTo1d * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _1dTo1w * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _1wTo1m @@ -6011,7 +6048,7 @@ function createRawPattern2(client, acc) { * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _8yTo10y * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _10yTo12y * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _12yTo15y - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} from15y + * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} over15y */ /** @@ -6122,7 +6159,7 @@ function createRawPattern2(client, acc) { * @property {OutputsRealizedSupplyPattern} _100btcTo1kBtc * @property {OutputsRealizedSupplyPattern} _1kBtcTo10kBtc * @property {OutputsRealizedSupplyPattern} _10kBtcTo100kBtc - * @property {OutputsRealizedSupplyPattern} _100kBtcOrMore + * @property {OutputsRealizedSupplyPattern} over100kBtc */ /** @@ -6226,7 +6263,7 @@ function createRawPattern2(client, acc) { /** * @typedef {Object} MetricsTree_Distribution_Cohorts_Utxo_Matured - * @property {BtcCentsSatsUsdPattern} upTo1h + * @property {BtcCentsSatsUsdPattern} under1h * @property {BtcCentsSatsUsdPattern} _1hTo1d * @property {BtcCentsSatsUsdPattern} _1dTo1w * @property {BtcCentsSatsUsdPattern} _1wTo1m @@ -6246,7 +6283,7 @@ function createRawPattern2(client, acc) { * @property {BtcCentsSatsUsdPattern} _8yTo10y * @property {BtcCentsSatsUsdPattern} _10yTo12y * @property {BtcCentsSatsUsdPattern} _12yTo15y - * @property {BtcCentsSatsUsdPattern} from15y + * @property {BtcCentsSatsUsdPattern} over15y */ /** @@ -6258,55 +6295,55 @@ function createRawPattern2(client, acc) { /** * @typedef {Object} MetricsTree_Distribution_Cohorts_Address_OverAmount - * @property {AddrOutputsRealizedSupplyPattern} _1sat - * @property {AddrOutputsRealizedSupplyPattern} _10sats - * @property {AddrOutputsRealizedSupplyPattern} _100sats - * @property {AddrOutputsRealizedSupplyPattern} _1kSats - * @property {AddrOutputsRealizedSupplyPattern} _10kSats - * @property {AddrOutputsRealizedSupplyPattern} _100kSats - * @property {AddrOutputsRealizedSupplyPattern} _1mSats - * @property {AddrOutputsRealizedSupplyPattern} _10mSats - * @property {AddrOutputsRealizedSupplyPattern} _1btc - * @property {AddrOutputsRealizedSupplyPattern} _10btc - * @property {AddrOutputsRealizedSupplyPattern} _100btc - * @property {AddrOutputsRealizedSupplyPattern} _1kBtc - * @property {AddrOutputsRealizedSupplyPattern} _10kBtc + * @property {AddressOutputsRealizedSupplyPattern} _1sat + * @property {AddressOutputsRealizedSupplyPattern} _10sats + * @property {AddressOutputsRealizedSupplyPattern} _100sats + * @property {AddressOutputsRealizedSupplyPattern} _1kSats + * @property {AddressOutputsRealizedSupplyPattern} _10kSats + * @property {AddressOutputsRealizedSupplyPattern} _100kSats + * @property {AddressOutputsRealizedSupplyPattern} _1mSats + * @property {AddressOutputsRealizedSupplyPattern} _10mSats + * @property {AddressOutputsRealizedSupplyPattern} _1btc + * @property {AddressOutputsRealizedSupplyPattern} _10btc + * @property {AddressOutputsRealizedSupplyPattern} _100btc + * @property {AddressOutputsRealizedSupplyPattern} _1kBtc + * @property {AddressOutputsRealizedSupplyPattern} _10kBtc */ /** * @typedef {Object} MetricsTree_Distribution_Cohorts_Address_AmountRange - * @property {AddrOutputsRealizedSupplyPattern} _0sats - * @property {AddrOutputsRealizedSupplyPattern} _1satTo10sats - * @property {AddrOutputsRealizedSupplyPattern} _10satsTo100sats - * @property {AddrOutputsRealizedSupplyPattern} _100satsTo1kSats - * @property {AddrOutputsRealizedSupplyPattern} _1kSatsTo10kSats - * @property {AddrOutputsRealizedSupplyPattern} _10kSatsTo100kSats - * @property {AddrOutputsRealizedSupplyPattern} _100kSatsTo1mSats - * @property {AddrOutputsRealizedSupplyPattern} _1mSatsTo10mSats - * @property {AddrOutputsRealizedSupplyPattern} _10mSatsTo1btc - * @property {AddrOutputsRealizedSupplyPattern} _1btcTo10btc - * @property {AddrOutputsRealizedSupplyPattern} _10btcTo100btc - * @property {AddrOutputsRealizedSupplyPattern} _100btcTo1kBtc - * @property {AddrOutputsRealizedSupplyPattern} _1kBtcTo10kBtc - * @property {AddrOutputsRealizedSupplyPattern} _10kBtcTo100kBtc - * @property {AddrOutputsRealizedSupplyPattern} _100kBtcOrMore + * @property {AddressOutputsRealizedSupplyPattern} _0sats + * @property {AddressOutputsRealizedSupplyPattern} _1satTo10sats + * @property {AddressOutputsRealizedSupplyPattern} _10satsTo100sats + * @property {AddressOutputsRealizedSupplyPattern} _100satsTo1kSats + * @property {AddressOutputsRealizedSupplyPattern} _1kSatsTo10kSats + * @property {AddressOutputsRealizedSupplyPattern} _10kSatsTo100kSats + * @property {AddressOutputsRealizedSupplyPattern} _100kSatsTo1mSats + * @property {AddressOutputsRealizedSupplyPattern} _1mSatsTo10mSats + * @property {AddressOutputsRealizedSupplyPattern} _10mSatsTo1btc + * @property {AddressOutputsRealizedSupplyPattern} _1btcTo10btc + * @property {AddressOutputsRealizedSupplyPattern} _10btcTo100btc + * @property {AddressOutputsRealizedSupplyPattern} _100btcTo1kBtc + * @property {AddressOutputsRealizedSupplyPattern} _1kBtcTo10kBtc + * @property {AddressOutputsRealizedSupplyPattern} _10kBtcTo100kBtc + * @property {AddressOutputsRealizedSupplyPattern} over100kBtc */ /** * @typedef {Object} MetricsTree_Distribution_Cohorts_Address_UnderAmount - * @property {AddrOutputsRealizedSupplyPattern} _10sats - * @property {AddrOutputsRealizedSupplyPattern} _100sats - * @property {AddrOutputsRealizedSupplyPattern} _1kSats - * @property {AddrOutputsRealizedSupplyPattern} _10kSats - * @property {AddrOutputsRealizedSupplyPattern} _100kSats - * @property {AddrOutputsRealizedSupplyPattern} _1mSats - * @property {AddrOutputsRealizedSupplyPattern} _10mSats - * @property {AddrOutputsRealizedSupplyPattern} _1btc - * @property {AddrOutputsRealizedSupplyPattern} _10btc - * @property {AddrOutputsRealizedSupplyPattern} _100btc - * @property {AddrOutputsRealizedSupplyPattern} _1kBtc - * @property {AddrOutputsRealizedSupplyPattern} _10kBtc - * @property {AddrOutputsRealizedSupplyPattern} _100kBtc + * @property {AddressOutputsRealizedSupplyPattern} _10sats + * @property {AddressOutputsRealizedSupplyPattern} _100sats + * @property {AddressOutputsRealizedSupplyPattern} _1kSats + * @property {AddressOutputsRealizedSupplyPattern} _10kSats + * @property {AddressOutputsRealizedSupplyPattern} _100kSats + * @property {AddressOutputsRealizedSupplyPattern} _1mSats + * @property {AddressOutputsRealizedSupplyPattern} _10mSats + * @property {AddressOutputsRealizedSupplyPattern} _1btc + * @property {AddressOutputsRealizedSupplyPattern} _10btc + * @property {AddressOutputsRealizedSupplyPattern} _100btc + * @property {AddressOutputsRealizedSupplyPattern} _1kBtc + * @property {AddressOutputsRealizedSupplyPattern} _10kBtc + * @property {AddressOutputsRealizedSupplyPattern} _100kBtc */ /** @@ -6741,7 +6778,7 @@ class BrkClient extends BrkClientBase { }); AGE_RANGE_NAMES = /** @type {const} */ ({ - "upTo1h": { + "under1h": { "id": "under_1h_old", "short": "<1h", "long": "Under 1 Hour Old" @@ -6841,7 +6878,7 @@ class BrkClient extends BrkClientBase { "short": "12y-15y", "long": "12 to 15 Years Old" }, - "from15y": { + "over15y": { "id": "over_15y_old", "short": "15y+", "long": "15+ Years Old" @@ -7036,77 +7073,77 @@ class BrkClient extends BrkClientBase { AMOUNT_RANGE_NAMES = /** @type {const} */ ({ "_0sats": { - "id": "with_0sats", + "id": "0sats", "short": "0 sats", "long": "0 Sats" }, "_1satTo10sats": { - "id": "above_1sat_under_10sats", + "id": "1sat_to_10sats", "short": "1-10 sats", "long": "1-10 Sats" }, "_10satsTo100sats": { - "id": "above_10sats_under_100sats", + "id": "10sats_to_100sats", "short": "10-100 sats", "long": "10-100 Sats" }, "_100satsTo1kSats": { - "id": "above_100sats_under_1k_sats", + "id": "100sats_to_1k_sats", "short": "100-1k sats", "long": "100-1K Sats" }, "_1kSatsTo10kSats": { - "id": "above_1k_sats_under_10k_sats", + "id": "1k_sats_to_10k_sats", "short": "1k-10k sats", "long": "1K-10K Sats" }, "_10kSatsTo100kSats": { - "id": "above_10k_sats_under_100k_sats", + "id": "10k_sats_to_100k_sats", "short": "10k-100k sats", "long": "10K-100K Sats" }, "_100kSatsTo1mSats": { - "id": "above_100k_sats_under_1m_sats", + "id": "100k_sats_to_1m_sats", "short": "100k-1M sats", "long": "100K-1M Sats" }, "_1mSatsTo10mSats": { - "id": "above_1m_sats_under_10m_sats", + "id": "1m_sats_to_10m_sats", "short": "1M-10M sats", "long": "1M-10M Sats" }, "_10mSatsTo1btc": { - "id": "above_10m_sats_under_1btc", + "id": "10m_sats_to_1btc", "short": "0.1-1 BTC", "long": "0.1-1 BTC" }, "_1btcTo10btc": { - "id": "above_1btc_under_10btc", + "id": "1btc_to_10btc", "short": "1-10 BTC", "long": "1-10 BTC" }, "_10btcTo100btc": { - "id": "above_10btc_under_100btc", + "id": "10btc_to_100btc", "short": "10-100 BTC", "long": "10-100 BTC" }, "_100btcTo1kBtc": { - "id": "above_100btc_under_1k_btc", + "id": "100btc_to_1k_btc", "short": "100-1k BTC", "long": "100-1K BTC" }, "_1kBtcTo10kBtc": { - "id": "above_1k_btc_under_10k_btc", + "id": "1k_btc_to_10k_btc", "short": "1k-10k BTC", "long": "1K-10K BTC" }, "_10kBtcTo100kBtc": { - "id": "above_10k_btc_under_100k_btc", + "id": "10k_btc_to_100k_btc", "short": "10k-100k BTC", "long": "10K-100K BTC" }, - "_100kBtcOrMore": { - "id": "above_100k_btc", + "over100kBtc": { + "id": "over_100k_btc", "short": "100k+ BTC", "long": "100K+ BTC" } @@ -7314,7 +7351,7 @@ class BrkClient extends BrkClientBase { pct90: create_1m1w1y24hPattern(this, 'block_size_pct90'), }, weight: { - base: createMetricPattern18(this, 'block_weight'), + raw: createMetricPattern18(this, 'block_weight'), cumulative: createMetricPattern1(this, 'block_weight_cumulative'), sum: create_1m1w1y24hPattern(this, 'block_weight_sum'), average: create_1m1w1y24hPattern(this, 'block_weight_average'), @@ -7887,20 +7924,32 @@ class BrkClient extends BrkClientBase { _144d: createBpsCentsRatioSatsUsdPattern(this, 'price_sma_144d'), _200d: { cents: createMetricPattern1(this, 'price_sma_200d_cents'), - usd: createMetricPattern1(this, 'price_sma_200d_usd'), + usd: createMetricPattern1(this, 'price_sma_200d'), sats: createMetricPattern1(this, 'price_sma_200d_sats'), bps: createMetricPattern1(this, 'price_sma_200d_ratio_bps'), ratio: createMetricPattern1(this, 'price_sma_200d_ratio'), - x24: createCentsSatsUsdPattern(this, 'price_sma_200d_x2_4'), - x08: createCentsSatsUsdPattern(this, 'price_sma_200d_x0_8'), + x24: { + cents: createMetricPattern1(this, 'price_sma_200d_x2_4_cents'), + usd: createMetricPattern1(this, 'price_sma_200d_x2_4_usd'), + sats: createMetricPattern1(this, 'price_sma_200d_x2_4_sats'), + }, + x08: { + cents: createMetricPattern1(this, 'price_sma_200d_x0_8_cents'), + usd: createMetricPattern1(this, 'price_sma_200d_x0_8_usd'), + sats: createMetricPattern1(this, 'price_sma_200d_x0_8_sats'), + }, }, _350d: { cents: createMetricPattern1(this, 'price_sma_350d_cents'), - usd: createMetricPattern1(this, 'price_sma_350d_usd'), + usd: createMetricPattern1(this, 'price_sma_350d'), sats: createMetricPattern1(this, 'price_sma_350d_sats'), bps: createMetricPattern1(this, 'price_sma_350d_ratio_bps'), ratio: createMetricPattern1(this, 'price_sma_350d_ratio'), - x2: createCentsSatsUsdPattern(this, 'price_sma_350d_x2'), + x2: { + cents: createMetricPattern1(this, 'price_sma_350d_x2_cents'), + usd: createMetricPattern1(this, 'price_sma_350d_x2_usd'), + sats: createMetricPattern1(this, 'price_sma_350d_x2_sats'), + }, }, _1y: createBpsCentsRatioSatsUsdPattern(this, 'price_sma_1y'), _2y: createBpsCentsRatioSatsUsdPattern(this, 'price_sma_2y'), @@ -8237,11 +8286,7 @@ class BrkClient extends BrkClientBase { open: createCentsSatsUsdPattern2(this, 'price_open'), high: createCentsSatsUsdPattern2(this, 'price_high'), low: createCentsSatsUsdPattern2(this, 'price_low'), - close: { - cents: createMetricPattern2(this, 'price_close_cents'), - usd: createMetricPattern2(this, 'price_close'), - sats: createMetricPattern2(this, 'price_close_sats'), - }, + close: createCentsSatsUsdPattern2(this, 'price_close'), }, ohlc: { cents: createMetricPattern2(this, 'price_ohlc_cents'), @@ -8273,8 +8318,8 @@ class BrkClient extends BrkClientBase { funded: createMetricPattern34(this, 'fundedaddressdata'), empty: createMetricPattern35(this, 'emptyaddressdata'), }, - funded: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3(this, 'addr_count'), - empty: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3(this, 'empty_addr_count'), + funded: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3(this, 'address_count'), + empty: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3(this, 'empty_address_count'), activity: { all: createBothReactivatedReceivingSendingPattern(this, 'address_activity'), p2pk65: createBothReactivatedReceivingSendingPattern(this, 'p2pk65_address_activity'), @@ -8286,28 +8331,55 @@ class BrkClient extends BrkClientBase { p2tr: createBothReactivatedReceivingSendingPattern(this, 'p2tr_address_activity'), p2a: createBothReactivatedReceivingSendingPattern(this, 'p2a_address_activity'), }, - total: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3(this, 'total_addr_count'), + total: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3(this, 'total_address_count'), new: { - all: createRawSumPattern(this, 'new_addr_count'), - p2pk65: createRawSumPattern(this, 'p2pk65_new_addr_count'), - p2pk33: createRawSumPattern(this, 'p2pk33_new_addr_count'), - p2pkh: createRawSumPattern(this, 'p2pkh_new_addr_count'), - p2sh: createRawSumPattern(this, 'p2sh_new_addr_count'), - p2wpkh: createRawSumPattern(this, 'p2wpkh_new_addr_count'), - p2wsh: createRawSumPattern(this, 'p2wsh_new_addr_count'), - p2tr: createRawSumPattern(this, 'p2tr_new_addr_count'), - p2a: createRawSumPattern(this, 'p2a_new_addr_count'), + all: { + raw: createMetricPattern1(this, 'new_address_count'), + sum: create_1m1w1y24hPattern(this, 'new_address_count_sum'), + }, + p2pk65: { + raw: createMetricPattern1(this, 'p2pk65_new_address_count'), + sum: create_1m1w1y24hPattern(this, 'p2pk65_new_address_count_sum'), + }, + p2pk33: { + raw: createMetricPattern1(this, 'p2pk33_new_address_count'), + sum: create_1m1w1y24hPattern(this, 'p2pk33_new_address_count_sum'), + }, + p2pkh: { + raw: createMetricPattern1(this, 'p2pkh_new_address_count'), + sum: create_1m1w1y24hPattern(this, 'p2pkh_new_address_count_sum'), + }, + p2sh: { + raw: createMetricPattern1(this, 'p2sh_new_address_count'), + sum: create_1m1w1y24hPattern(this, 'p2sh_new_address_count_sum'), + }, + p2wpkh: { + raw: createMetricPattern1(this, 'p2wpkh_new_address_count'), + sum: create_1m1w1y24hPattern(this, 'p2wpkh_new_address_count_sum'), + }, + p2wsh: { + raw: createMetricPattern1(this, 'p2wsh_new_address_count'), + sum: create_1m1w1y24hPattern(this, 'p2wsh_new_address_count_sum'), + }, + p2tr: { + raw: createMetricPattern1(this, 'p2tr_new_address_count'), + sum: create_1m1w1y24hPattern(this, 'p2tr_new_address_count_sum'), + }, + p2a: { + raw: createMetricPattern1(this, 'p2a_new_address_count'), + sum: create_1m1w1y24hPattern(this, 'p2a_new_address_count_sum'), + }, }, delta: { - all: createChangeRatePattern(this, 'addr_count'), - p2pk65: createChangeRatePattern(this, 'p2pk65_addr_count'), - p2pk33: createChangeRatePattern(this, 'p2pk33_addr_count'), - p2pkh: createChangeRatePattern(this, 'p2pkh_addr_count'), - p2sh: createChangeRatePattern(this, 'p2sh_addr_count'), - p2wpkh: createChangeRatePattern(this, 'p2wpkh_addr_count'), - p2wsh: createChangeRatePattern(this, 'p2wsh_addr_count'), - p2tr: createChangeRatePattern(this, 'p2tr_addr_count'), - p2a: createChangeRatePattern(this, 'p2a_addr_count'), + all: createChangeRatePattern(this, 'address_count'), + p2pk65: createChangeRatePattern(this, 'p2pk65_address_count'), + p2pk33: createChangeRatePattern(this, 'p2pk33_address_count'), + p2pkh: createChangeRatePattern(this, 'p2pkh_address_count'), + p2sh: createChangeRatePattern(this, 'p2sh_address_count'), + p2wpkh: createChangeRatePattern(this, 'p2wpkh_address_count'), + p2wsh: createChangeRatePattern(this, 'p2wsh_address_count'), + p2tr: createChangeRatePattern(this, 'p2tr_address_count'), + p2a: createChangeRatePattern(this, 'p2a_address_count'), }, }, cohorts: { @@ -8318,7 +8390,7 @@ class BrkClient extends BrkClientBase { inProfit: createBtcCentsRelSatsUsdPattern2(this, 'supply_in_profit'), inLoss: createBtcCentsRelSatsUsdPattern2(this, 'supply_in_loss'), total: createBtcCentsSatsUsdPattern(this, 'supply'), - halved: createBtcCentsSatsUsdPattern(this, 'supply_halved'), + half: createBtcCentsSatsUsdPattern(this, 'supply_half'), }, outputs: createUnspentPattern3(this, 'utxo_count'), activity: createCoindaysCoinyearsDormancySentVelocityPattern(this, ''), @@ -8333,7 +8405,7 @@ class BrkClient extends BrkClientBase { negative: createMetricPattern1(this, 'neg_unrealized_loss'), raw: createCentsUsdPattern(this, 'unrealized_loss'), sum: create_24hPattern(this, 'unrealized_loss_24h'), - relToMarketCap: createBpsPercentRatioPattern(this, 'unrealized_loss_rel_to_market_cap'), + relToMcap: createBpsPercentRatioPattern(this, 'unrealized_loss_rel_to_mcap'), relToOwnGross: createBpsPercentRatioPattern(this, 'unrealized_loss_rel_to_own_gross_pnl'), }, netPnl: { @@ -8344,21 +8416,21 @@ class BrkClient extends BrkClientBase { profit: { raw: createCentsUsdPattern(this, 'unrealized_profit'), sum: create_24hPattern(this, 'unrealized_profit_24h'), - relToMarketCap: createBpsPercentRatioPattern(this, 'unrealized_profit_rel_to_market_cap'), + relToMcap: createBpsPercentRatioPattern(this, 'unrealized_profit_rel_to_mcap'), relToOwnGross: createBpsPercentRatioPattern(this, 'unrealized_profit_rel_to_own_gross_pnl'), }, }, }, sth: { realized: createCapGrossInvestorLossMvrvNetNuplPeakPriceProfitSoprPattern(this, 'sth'), - supply: createDeltaHalvedInRelTotalPattern2(this, 'sth_supply'), + supply: createDeltaHalfInRelTotalPattern2(this, 'sth_supply'), outputs: createUnspentPattern3(this, 'sth_utxo_count'), activity: createCoindaysCoinyearsDormancySentVelocityPattern(this, 'sth'), costBasis: createInvestedMaxMinPercentilesSupplyPattern(this, 'sth'), unrealized: createGrossInvestedInvestorLossNetProfitSentimentPattern2(this, 'sth'), }, lth: { - supply: createDeltaHalvedInRelTotalPattern2(this, 'lth_supply'), + supply: createDeltaHalfInRelTotalPattern2(this, 'lth_supply'), outputs: createUnspentPattern3(this, 'lth_utxo_count'), activity: createCoindaysCoinyearsDormancySentVelocityPattern(this, 'lth'), realized: { @@ -8367,14 +8439,8 @@ class BrkClient extends BrkClientBase { grossPnl: createRawSellSumPattern(this, 'lth'), netPnl: createChangeCumulativeDeltaRawRelSumPattern(this, 'lth_net'), sopr: { - valueCreated: { - sum: create_1m1w1y24hPattern(this, 'lth_value_created'), - raw: createMetricPattern1(this, 'lth_value_created'), - }, - valueDestroyed: { - sum: create_1m1w1y24hPattern(this, 'lth_value_destroyed'), - raw: createMetricPattern1(this, 'lth_value_destroyed'), - }, + valueCreated: createRawSumPattern(this, 'lth_value_created'), + valueDestroyed: createRawSumPattern(this, 'lth_value_destroyed'), ratio: create_1m1w1y24hPattern(this, 'lth_sopr'), }, peakRegret: createCumulativeRawRelPattern(this, 'lth_realized_peak_regret'), @@ -8389,7 +8455,7 @@ class BrkClient extends BrkClientBase { unrealized: createGrossInvestedInvestorLossNetProfitSentimentPattern2(this, 'lth'), }, ageRange: { - upTo1h: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_under_1h_old'), + under1h: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_under_1h_old'), _1hTo1d: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_1h_to_1d_old'), _1dTo1w: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_1d_to_1w_old'), _1wTo1m: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_1w_to_1m_old'), @@ -8409,7 +8475,7 @@ class BrkClient extends BrkClientBase { _8yTo10y: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_8y_to_10y_old'), _10yTo12y: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_10y_to_12y_old'), _12yTo15y: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_12y_to_15y_old'), - from15y: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_over_15y_old'), + over15y: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_over_15y_old'), }, underAge: { _1w: createActivityOutputsRealizedSupplyUnrealizedPattern2(this, 'utxos_under_1w_old'), @@ -8494,21 +8560,21 @@ class BrkClient extends BrkClientBase { _10kBtc: createOutputsRealizedSupplyPattern(this, 'utxos_over_10k_btc'), }, amountRange: { - _0sats: createOutputsRealizedSupplyPattern(this, 'utxos_with_0sats'), - _1satTo10sats: createOutputsRealizedSupplyPattern(this, 'utxos_above_1sat_under_10sats'), - _10satsTo100sats: createOutputsRealizedSupplyPattern(this, 'utxos_above_10sats_under_100sats'), - _100satsTo1kSats: createOutputsRealizedSupplyPattern(this, 'utxos_above_100sats_under_1k_sats'), - _1kSatsTo10kSats: createOutputsRealizedSupplyPattern(this, 'utxos_above_1k_sats_under_10k_sats'), - _10kSatsTo100kSats: createOutputsRealizedSupplyPattern(this, 'utxos_above_10k_sats_under_100k_sats'), - _100kSatsTo1mSats: createOutputsRealizedSupplyPattern(this, 'utxos_above_100k_sats_under_1m_sats'), - _1mSatsTo10mSats: createOutputsRealizedSupplyPattern(this, 'utxos_above_1m_sats_under_10m_sats'), - _10mSatsTo1btc: createOutputsRealizedSupplyPattern(this, 'utxos_above_10m_sats_under_1btc'), - _1btcTo10btc: createOutputsRealizedSupplyPattern(this, 'utxos_above_1btc_under_10btc'), - _10btcTo100btc: createOutputsRealizedSupplyPattern(this, 'utxos_above_10btc_under_100btc'), - _100btcTo1kBtc: createOutputsRealizedSupplyPattern(this, 'utxos_above_100btc_under_1k_btc'), - _1kBtcTo10kBtc: createOutputsRealizedSupplyPattern(this, 'utxos_above_1k_btc_under_10k_btc'), - _10kBtcTo100kBtc: createOutputsRealizedSupplyPattern(this, 'utxos_above_10k_btc_under_100k_btc'), - _100kBtcOrMore: createOutputsRealizedSupplyPattern(this, 'utxos_above_100k_btc'), + _0sats: createOutputsRealizedSupplyPattern(this, 'utxos_0sats'), + _1satTo10sats: createOutputsRealizedSupplyPattern(this, 'utxos_1sat_to_10sats'), + _10satsTo100sats: createOutputsRealizedSupplyPattern(this, 'utxos_10sats_to_100sats'), + _100satsTo1kSats: createOutputsRealizedSupplyPattern(this, 'utxos_100sats_to_1k_sats'), + _1kSatsTo10kSats: createOutputsRealizedSupplyPattern(this, 'utxos_1k_sats_to_10k_sats'), + _10kSatsTo100kSats: createOutputsRealizedSupplyPattern(this, 'utxos_10k_sats_to_100k_sats'), + _100kSatsTo1mSats: createOutputsRealizedSupplyPattern(this, 'utxos_100k_sats_to_1m_sats'), + _1mSatsTo10mSats: createOutputsRealizedSupplyPattern(this, 'utxos_1m_sats_to_10m_sats'), + _10mSatsTo1btc: createOutputsRealizedSupplyPattern(this, 'utxos_10m_sats_to_1btc'), + _1btcTo10btc: createOutputsRealizedSupplyPattern(this, 'utxos_1btc_to_10btc'), + _10btcTo100btc: createOutputsRealizedSupplyPattern(this, 'utxos_10btc_to_100btc'), + _100btcTo1kBtc: createOutputsRealizedSupplyPattern(this, 'utxos_100btc_to_1k_btc'), + _1kBtcTo10kBtc: createOutputsRealizedSupplyPattern(this, 'utxos_1k_btc_to_10k_btc'), + _10kBtcTo100kBtc: createOutputsRealizedSupplyPattern(this, 'utxos_10k_btc_to_100k_btc'), + over100kBtc: createOutputsRealizedSupplyPattern(this, 'utxos_over_100k_btc'), }, underAmount: { _10sats: createOutputsRealizedSupplyPattern(this, 'utxos_under_10sats'), @@ -8595,7 +8661,7 @@ class BrkClient extends BrkClientBase { }, }, matured: { - upTo1h: createBtcCentsSatsUsdPattern(this, 'utxo_under_1h_old_matured'), + under1h: createBtcCentsSatsUsdPattern(this, 'utxo_under_1h_old_matured'), _1hTo1d: createBtcCentsSatsUsdPattern(this, 'utxo_1h_to_1d_old_matured'), _1dTo1w: createBtcCentsSatsUsdPattern(this, 'utxo_1d_to_1w_old_matured'), _1wTo1m: createBtcCentsSatsUsdPattern(this, 'utxo_1w_to_1m_old_matured'), @@ -8615,56 +8681,56 @@ class BrkClient extends BrkClientBase { _8yTo10y: createBtcCentsSatsUsdPattern(this, 'utxo_8y_to_10y_old_matured'), _10yTo12y: createBtcCentsSatsUsdPattern(this, 'utxo_10y_to_12y_old_matured'), _12yTo15y: createBtcCentsSatsUsdPattern(this, 'utxo_12y_to_15y_old_matured'), - from15y: createBtcCentsSatsUsdPattern(this, 'utxo_over_15y_old_matured'), + over15y: createBtcCentsSatsUsdPattern(this, 'utxo_over_15y_old_matured'), }, }, address: { overAmount: { - _1sat: createAddrOutputsRealizedSupplyPattern(this, 'addrs_over_1sat'), - _10sats: createAddrOutputsRealizedSupplyPattern(this, 'addrs_over_10sats'), - _100sats: createAddrOutputsRealizedSupplyPattern(this, 'addrs_over_100sats'), - _1kSats: createAddrOutputsRealizedSupplyPattern(this, 'addrs_over_1k_sats'), - _10kSats: createAddrOutputsRealizedSupplyPattern(this, 'addrs_over_10k_sats'), - _100kSats: createAddrOutputsRealizedSupplyPattern(this, 'addrs_over_100k_sats'), - _1mSats: createAddrOutputsRealizedSupplyPattern(this, 'addrs_over_1m_sats'), - _10mSats: createAddrOutputsRealizedSupplyPattern(this, 'addrs_over_10m_sats'), - _1btc: createAddrOutputsRealizedSupplyPattern(this, 'addrs_over_1btc'), - _10btc: createAddrOutputsRealizedSupplyPattern(this, 'addrs_over_10btc'), - _100btc: createAddrOutputsRealizedSupplyPattern(this, 'addrs_over_100btc'), - _1kBtc: createAddrOutputsRealizedSupplyPattern(this, 'addrs_over_1k_btc'), - _10kBtc: createAddrOutputsRealizedSupplyPattern(this, 'addrs_over_10k_btc'), + _1sat: createAddressOutputsRealizedSupplyPattern(this, 'addrs_over_1sat'), + _10sats: createAddressOutputsRealizedSupplyPattern(this, 'addrs_over_10sats'), + _100sats: createAddressOutputsRealizedSupplyPattern(this, 'addrs_over_100sats'), + _1kSats: createAddressOutputsRealizedSupplyPattern(this, 'addrs_over_1k_sats'), + _10kSats: createAddressOutputsRealizedSupplyPattern(this, 'addrs_over_10k_sats'), + _100kSats: createAddressOutputsRealizedSupplyPattern(this, 'addrs_over_100k_sats'), + _1mSats: createAddressOutputsRealizedSupplyPattern(this, 'addrs_over_1m_sats'), + _10mSats: createAddressOutputsRealizedSupplyPattern(this, 'addrs_over_10m_sats'), + _1btc: createAddressOutputsRealizedSupplyPattern(this, 'addrs_over_1btc'), + _10btc: createAddressOutputsRealizedSupplyPattern(this, 'addrs_over_10btc'), + _100btc: createAddressOutputsRealizedSupplyPattern(this, 'addrs_over_100btc'), + _1kBtc: createAddressOutputsRealizedSupplyPattern(this, 'addrs_over_1k_btc'), + _10kBtc: createAddressOutputsRealizedSupplyPattern(this, 'addrs_over_10k_btc'), }, amountRange: { - _0sats: createAddrOutputsRealizedSupplyPattern(this, 'addrs_with_0sats'), - _1satTo10sats: createAddrOutputsRealizedSupplyPattern(this, 'addrs_above_1sat_under_10sats'), - _10satsTo100sats: createAddrOutputsRealizedSupplyPattern(this, 'addrs_above_10sats_under_100sats'), - _100satsTo1kSats: createAddrOutputsRealizedSupplyPattern(this, 'addrs_above_100sats_under_1k_sats'), - _1kSatsTo10kSats: createAddrOutputsRealizedSupplyPattern(this, 'addrs_above_1k_sats_under_10k_sats'), - _10kSatsTo100kSats: createAddrOutputsRealizedSupplyPattern(this, 'addrs_above_10k_sats_under_100k_sats'), - _100kSatsTo1mSats: createAddrOutputsRealizedSupplyPattern(this, 'addrs_above_100k_sats_under_1m_sats'), - _1mSatsTo10mSats: createAddrOutputsRealizedSupplyPattern(this, 'addrs_above_1m_sats_under_10m_sats'), - _10mSatsTo1btc: createAddrOutputsRealizedSupplyPattern(this, 'addrs_above_10m_sats_under_1btc'), - _1btcTo10btc: createAddrOutputsRealizedSupplyPattern(this, 'addrs_above_1btc_under_10btc'), - _10btcTo100btc: createAddrOutputsRealizedSupplyPattern(this, 'addrs_above_10btc_under_100btc'), - _100btcTo1kBtc: createAddrOutputsRealizedSupplyPattern(this, 'addrs_above_100btc_under_1k_btc'), - _1kBtcTo10kBtc: createAddrOutputsRealizedSupplyPattern(this, 'addrs_above_1k_btc_under_10k_btc'), - _10kBtcTo100kBtc: createAddrOutputsRealizedSupplyPattern(this, 'addrs_above_10k_btc_under_100k_btc'), - _100kBtcOrMore: createAddrOutputsRealizedSupplyPattern(this, 'addrs_above_100k_btc'), + _0sats: createAddressOutputsRealizedSupplyPattern(this, 'addrs_0sats'), + _1satTo10sats: createAddressOutputsRealizedSupplyPattern(this, 'addrs_1sat_to_10sats'), + _10satsTo100sats: createAddressOutputsRealizedSupplyPattern(this, 'addrs_10sats_to_100sats'), + _100satsTo1kSats: createAddressOutputsRealizedSupplyPattern(this, 'addrs_100sats_to_1k_sats'), + _1kSatsTo10kSats: createAddressOutputsRealizedSupplyPattern(this, 'addrs_1k_sats_to_10k_sats'), + _10kSatsTo100kSats: createAddressOutputsRealizedSupplyPattern(this, 'addrs_10k_sats_to_100k_sats'), + _100kSatsTo1mSats: createAddressOutputsRealizedSupplyPattern(this, 'addrs_100k_sats_to_1m_sats'), + _1mSatsTo10mSats: createAddressOutputsRealizedSupplyPattern(this, 'addrs_1m_sats_to_10m_sats'), + _10mSatsTo1btc: createAddressOutputsRealizedSupplyPattern(this, 'addrs_10m_sats_to_1btc'), + _1btcTo10btc: createAddressOutputsRealizedSupplyPattern(this, 'addrs_1btc_to_10btc'), + _10btcTo100btc: createAddressOutputsRealizedSupplyPattern(this, 'addrs_10btc_to_100btc'), + _100btcTo1kBtc: createAddressOutputsRealizedSupplyPattern(this, 'addrs_100btc_to_1k_btc'), + _1kBtcTo10kBtc: createAddressOutputsRealizedSupplyPattern(this, 'addrs_1k_btc_to_10k_btc'), + _10kBtcTo100kBtc: createAddressOutputsRealizedSupplyPattern(this, 'addrs_10k_btc_to_100k_btc'), + over100kBtc: createAddressOutputsRealizedSupplyPattern(this, 'addrs_over_100k_btc'), }, underAmount: { - _10sats: createAddrOutputsRealizedSupplyPattern(this, 'addrs_under_10sats'), - _100sats: createAddrOutputsRealizedSupplyPattern(this, 'addrs_under_100sats'), - _1kSats: createAddrOutputsRealizedSupplyPattern(this, 'addrs_under_1k_sats'), - _10kSats: createAddrOutputsRealizedSupplyPattern(this, 'addrs_under_10k_sats'), - _100kSats: createAddrOutputsRealizedSupplyPattern(this, 'addrs_under_100k_sats'), - _1mSats: createAddrOutputsRealizedSupplyPattern(this, 'addrs_under_1m_sats'), - _10mSats: createAddrOutputsRealizedSupplyPattern(this, 'addrs_under_10m_sats'), - _1btc: createAddrOutputsRealizedSupplyPattern(this, 'addrs_under_1btc'), - _10btc: createAddrOutputsRealizedSupplyPattern(this, 'addrs_under_10btc'), - _100btc: createAddrOutputsRealizedSupplyPattern(this, 'addrs_under_100btc'), - _1kBtc: createAddrOutputsRealizedSupplyPattern(this, 'addrs_under_1k_btc'), - _10kBtc: createAddrOutputsRealizedSupplyPattern(this, 'addrs_under_10k_btc'), - _100kBtc: createAddrOutputsRealizedSupplyPattern(this, 'addrs_under_100k_btc'), + _10sats: createAddressOutputsRealizedSupplyPattern(this, 'addrs_under_10sats'), + _100sats: createAddressOutputsRealizedSupplyPattern(this, 'addrs_under_100sats'), + _1kSats: createAddressOutputsRealizedSupplyPattern(this, 'addrs_under_1k_sats'), + _10kSats: createAddressOutputsRealizedSupplyPattern(this, 'addrs_under_10k_sats'), + _100kSats: createAddressOutputsRealizedSupplyPattern(this, 'addrs_under_100k_sats'), + _1mSats: createAddressOutputsRealizedSupplyPattern(this, 'addrs_under_1m_sats'), + _10mSats: createAddressOutputsRealizedSupplyPattern(this, 'addrs_under_10m_sats'), + _1btc: createAddressOutputsRealizedSupplyPattern(this, 'addrs_under_1btc'), + _10btc: createAddressOutputsRealizedSupplyPattern(this, 'addrs_under_10btc'), + _100btc: createAddressOutputsRealizedSupplyPattern(this, 'addrs_under_100btc'), + _1kBtc: createAddressOutputsRealizedSupplyPattern(this, 'addrs_under_1k_btc'), + _10kBtc: createAddressOutputsRealizedSupplyPattern(this, 'addrs_under_10k_btc'), + _100kBtc: createAddressOutputsRealizedSupplyPattern(this, 'addrs_under_100k_btc'), }, }, }, diff --git a/packages/brk_client/brk_client/__init__.py b/packages/brk_client/brk_client/__init__.py index c621ffed7..c70dd9e94 100644 --- a/packages/brk_client/brk_client/__init__.py +++ b/packages/brk_client/brk_client/__init__.py @@ -2153,18 +2153,18 @@ class _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" self._0sd: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, '0sd_4y')) - self.m0_5sd: PriceValuePattern = PriceValuePattern(client, _m(acc, 'm0_5sd_4y')) - self.m1_5sd: PriceValuePattern = PriceValuePattern(client, _m(acc, 'm1_5sd_4y')) - self.m1sd: PriceValuePattern = PriceValuePattern(client, _m(acc, 'm1sd_4y')) - self.m2_5sd: PriceValuePattern = PriceValuePattern(client, _m(acc, 'm2_5sd_4y')) - self.m2sd: PriceValuePattern = PriceValuePattern(client, _m(acc, 'm2sd_4y')) - self.m3sd: PriceValuePattern = PriceValuePattern(client, _m(acc, 'm3sd_4y')) - self.p0_5sd: PriceValuePattern = PriceValuePattern(client, _m(acc, 'p0_5sd_4y')) - self.p1_5sd: PriceValuePattern = PriceValuePattern(client, _m(acc, 'p1_5sd_4y')) - self.p1sd: PriceValuePattern = PriceValuePattern(client, _m(acc, 'p1sd_4y')) - self.p2_5sd: PriceValuePattern = PriceValuePattern(client, _m(acc, 'p2_5sd_4y')) - self.p2sd: PriceValuePattern = PriceValuePattern(client, _m(acc, 'p2sd_4y')) - self.p3sd: PriceValuePattern = PriceValuePattern(client, _m(acc, 'p3sd_4y')) + self.m0_5sd: PriceValuePattern = PriceValuePattern(client, acc) + self.m1_5sd: PriceValuePattern = PriceValuePattern(client, acc) + self.m1sd: PriceValuePattern = PriceValuePattern(client, acc) + self.m2_5sd: PriceValuePattern = PriceValuePattern(client, acc) + self.m2sd: PriceValuePattern = PriceValuePattern(client, acc) + self.m3sd: PriceValuePattern = PriceValuePattern(client, acc) + self.p0_5sd: PriceValuePattern = PriceValuePattern(client, acc) + self.p1_5sd: PriceValuePattern = PriceValuePattern(client, acc) + self.p1sd: PriceValuePattern = PriceValuePattern(client, acc) + self.p2_5sd: PriceValuePattern = PriceValuePattern(client, acc) + self.p2sd: PriceValuePattern = PriceValuePattern(client, acc) + self.p3sd: PriceValuePattern = PriceValuePattern(client, acc) self.sd: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'sd_4y')) self.zscore: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'zscore_4y')) @@ -2338,12 +2338,12 @@ class BpsCentsPercentilesRatioSatsSmaStdUsdPattern: """Create pattern node with accumulated metric name.""" self.bps: MetricPattern1[BasisPoints32] = MetricPattern1(client, _m(acc, 'ratio_bps')) self.cents: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'cents')) - self.percentiles: Pct1Pct2Pct5Pct95Pct98Pct99Pattern = Pct1Pct2Pct5Pct95Pct98Pct99Pattern(client, _m(acc, 'ratio')) + self.percentiles: Pct1Pct2Pct5Pct95Pct98Pct99Pattern = Pct1Pct2Pct5Pct95Pct98Pct99Pattern(client, acc) self.ratio: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'ratio')) self.sats: MetricPattern1[SatsFract] = MetricPattern1(client, _m(acc, 'sats')) self.sma: _1m1w1y2y4yAllPattern = _1m1w1y2y4yAllPattern(client, _m(acc, 'ratio_sma')) self.std_dev: _1y2y4yAllPattern = _1y2y4yAllPattern(client, _m(acc, 'ratio')) - self.usd: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'usd')) + self.usd: MetricPattern1[Dollars] = MetricPattern1(client, acc) class CapLossMvrvNetNuplPriceProfitSoprPattern: """Pattern struct for repeated tree structure.""" @@ -2368,10 +2368,10 @@ class CapitulationCumulativeNegativeRawRelSumValuePattern: self.cumulative: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_loss_cumulative')) self.negative: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'neg_realized_loss')) self.raw: CentsUsdPattern = CentsUsdPattern(client, _m(acc, 'realized_loss')) - self.rel_to_rcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'realized_loss_rel_to_realized_cap')) + self.rel_to_rcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'realized_loss_rel_to_rcap')) self.sum: _1m1w1y24hPattern5 = _1m1w1y24hPattern5(client, _m(acc, 'realized_loss')) - self.value_created: BaseSumPattern = BaseSumPattern(client, _m(acc, 'loss_value_created')) - self.value_destroyed: BaseSumPattern = BaseSumPattern(client, _m(acc, 'loss_value_destroyed')) + self.value_created: RawSumPattern[Cents] = RawSumPattern(client, _m(acc, 'loss_value_created')) + self.value_destroyed: RawSumPattern[Cents] = RawSumPattern(client, _m(acc, 'loss_value_destroyed')) class AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern(Generic[T]): """Pattern struct for repeated tree structure.""" @@ -2434,10 +2434,10 @@ class CumulativeDistributionRawRelSumValuePattern: self.cumulative: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_profit_cumulative')) self.distribution_flow: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'profit_flow')) self.raw: CentsUsdPattern = CentsUsdPattern(client, _m(acc, 'realized_profit')) - self.rel_to_rcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'realized_profit_rel_to_realized_cap')) + self.rel_to_rcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'realized_profit_rel_to_rcap')) self.sum: _1m1w1y24hPattern5 = _1m1w1y24hPattern5(client, _m(acc, 'realized_profit')) - self.value_created: BaseSumPattern = BaseSumPattern(client, _m(acc, 'profit_value_created')) - self.value_destroyed: BaseSumPattern = BaseSumPattern(client, _m(acc, 'profit_value_destroyed')) + self.value_created: RawSumPattern[Cents] = RawSumPattern(client, _m(acc, 'profit_value_created')) + self.value_destroyed: RawSumPattern[Cents] = RawSumPattern(client, _m(acc, 'profit_value_destroyed')) class GrossInvestedInvestorLossNetProfitSentimentPattern2: """Pattern struct for repeated tree structure.""" @@ -2471,10 +2471,10 @@ class BpsCentsPercentilesRatioSatsUsdPattern: """Create pattern node with accumulated metric name.""" self.bps: MetricPattern1[BasisPoints32] = MetricPattern1(client, _m(acc, 'ratio_bps')) self.cents: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'cents')) - self.percentiles: Pct1Pct2Pct5Pct95Pct98Pct99Pattern = Pct1Pct2Pct5Pct95Pct98Pct99Pattern(client, _m(acc, 'ratio')) + self.percentiles: Pct1Pct2Pct5Pct95Pct98Pct99Pattern = Pct1Pct2Pct5Pct95Pct98Pct99Pattern(client, acc) self.ratio: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'ratio')) self.sats: MetricPattern1[SatsFract] = MetricPattern1(client, _m(acc, 'sats')) - self.usd: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'usd')) + self.usd: MetricPattern1[Dollars] = MetricPattern1(client, acc) class BtcCentsRelSatsUsdPattern3: """Pattern struct for repeated tree structure.""" @@ -2483,8 +2483,8 @@ class BtcCentsRelSatsUsdPattern3: """Create pattern node with accumulated metric name.""" self.btc: MetricPattern1[Bitcoin] = MetricPattern1(client, acc) self.cents: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'cents')) - self.rel_to_circulating: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'rel_to_circulating_supply')) - self.rel_to_own_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'rel_to_own_supply')) + self.rel_to_circulating: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'rel_to_circulating')) + self.rel_to_own: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'rel_to_own')) self.sats: MetricPattern1[Sats] = MetricPattern1(client, _m(acc, 'sats')) self.usd: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'usd')) @@ -2497,31 +2497,31 @@ class ChangeCumulativeDeltaRawRelSumPattern: self.cumulative: MetricPattern1[CentsSigned] = MetricPattern1(client, _m(acc, 'realized_pnl_cumulative')) self.delta: ChangeRatePattern4 = ChangeRatePattern4(client, _m(acc, 'pnl_delta')) self.raw: MetricPattern1[CentsSigned] = MetricPattern1(client, _m(acc, 'realized_pnl')) - self.rel_to_rcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'realized_pnl_rel_to_realized_cap')) + self.rel_to_rcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'realized_pnl_rel_to_rcap')) self.sum: _1m1w1y24hPattern[CentsSigned] = _1m1w1y24hPattern(client, _m(acc, 'realized_pnl')) -class DeltaHalvedInRelTotalPattern2: +class DeltaHalfInRelTotalPattern2: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" self.delta: ChangeRatePattern = ChangeRatePattern(client, _m(acc, 'delta')) - self.halved: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'halved')) + self.half: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'half')) self.in_loss: BtcCentsRelSatsUsdPattern3 = BtcCentsRelSatsUsdPattern3(client, _m(acc, 'in_loss')) self.in_profit: BtcCentsRelSatsUsdPattern3 = BtcCentsRelSatsUsdPattern3(client, _m(acc, 'in_profit')) - self.rel_to_circulating: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'rel_to_circulating_supply')) + self.rel_to_circulating: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'rel_to_circulating')) self.total: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, acc) -class DeltaHalvedInRelTotalPattern: +class DeltaHalfInRelTotalPattern: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" self.delta: ChangeRatePattern2 = ChangeRatePattern2(client, _m(acc, 'delta')) - self.halved: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'halved')) + self.half: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'half')) self.in_loss: BtcCentsRelSatsUsdPattern = BtcCentsRelSatsUsdPattern(client, _m(acc, 'in_loss')) self.in_profit: BtcCentsRelSatsUsdPattern = BtcCentsRelSatsUsdPattern(client, _m(acc, 'in_profit')) - self.rel_to_circulating: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'rel_to_circulating_supply')) + self.rel_to_circulating: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'rel_to_circulating')) self.total: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, acc) class NegativeRawRelSumPattern2: @@ -2531,9 +2531,9 @@ class NegativeRawRelSumPattern2: """Create pattern node with accumulated metric name.""" self.negative: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'neg_unrealized_loss')) self.raw: CentsUsdPattern = CentsUsdPattern(client, _m(acc, 'unrealized_loss')) - self.rel_to_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'unrealized_loss_rel_to_market_cap')) + self.rel_to_mcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'unrealized_loss_rel_to_mcap')) self.rel_to_own_gross: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'unrealized_loss_rel_to_own_gross_pnl')) - self.rel_to_own_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'unrealized_loss_rel_to_own_market_cap')) + self.rel_to_own_mcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'unrealized_loss_rel_to_own_mcap')) self.sum: _24hPattern = _24hPattern(client, _m(acc, 'unrealized_loss_24h')) class Pct1Pct2Pct5Pct95Pct98Pct99Pattern: @@ -2541,12 +2541,12 @@ class Pct1Pct2Pct5Pct95Pct98Pct99Pattern: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.pct1: BpsPriceRatioPattern = BpsPriceRatioPattern(client, _m(acc, 'pct1')) - self.pct2: BpsPriceRatioPattern = BpsPriceRatioPattern(client, _m(acc, 'pct2')) - self.pct5: BpsPriceRatioPattern = BpsPriceRatioPattern(client, _m(acc, 'pct5')) - self.pct95: BpsPriceRatioPattern = BpsPriceRatioPattern(client, _m(acc, 'pct95')) - self.pct98: BpsPriceRatioPattern = BpsPriceRatioPattern(client, _m(acc, 'pct98')) - self.pct99: BpsPriceRatioPattern = BpsPriceRatioPattern(client, _m(acc, 'pct99')) + self.pct1: BpsPriceRatioPattern = BpsPriceRatioPattern(client, acc) + self.pct2: BpsPriceRatioPattern = BpsPriceRatioPattern(client, acc) + self.pct5: BpsPriceRatioPattern = BpsPriceRatioPattern(client, acc) + self.pct95: BpsPriceRatioPattern = BpsPriceRatioPattern(client, acc) + self.pct98: BpsPriceRatioPattern = BpsPriceRatioPattern(client, acc) + self.pct99: BpsPriceRatioPattern = BpsPriceRatioPattern(client, acc) class ActivityOutputsRealizedSupplyUnrealizedPattern: """Pattern struct for repeated tree structure.""" @@ -2556,7 +2556,7 @@ class ActivityOutputsRealizedSupplyUnrealizedPattern: self.activity: CoindaysSentPattern = CoindaysSentPattern(client, acc) self.outputs: UnspentPattern2 = UnspentPattern2(client, _m(acc, 'utxo_count')) self.realized: CapLossMvrvNetNuplPriceProfitSoprPattern = CapLossMvrvNetNuplPriceProfitSoprPattern(client, acc) - self.supply: DeltaHalvedInRelTotalPattern = DeltaHalvedInRelTotalPattern(client, _m(acc, 'supply')) + self.supply: DeltaHalfInRelTotalPattern = DeltaHalfInRelTotalPattern(client, _m(acc, 'supply')) self.unrealized: InvestedInvestorLossNetProfitPattern = InvestedInvestorLossNetProfitPattern(client, acc) class ActivityOutputsRealizedSupplyUnrealizedPattern2: @@ -2567,7 +2567,7 @@ class ActivityOutputsRealizedSupplyUnrealizedPattern2: self.activity: CoindaysSentPattern = CoindaysSentPattern(client, acc) self.outputs: UnspentPattern2 = UnspentPattern2(client, _m(acc, 'utxo_count')) self.realized: CapLossMvrvNetNuplPriceProfitSoprPattern = CapLossMvrvNetNuplPriceProfitSoprPattern(client, acc) - self.supply: DeltaHalvedInRelTotalPattern = DeltaHalvedInRelTotalPattern(client, _m(acc, 'supply')) + self.supply: DeltaHalfInRelTotalPattern = DeltaHalfInRelTotalPattern(client, _m(acc, 'supply')) self.unrealized: LossNetProfitPattern = LossNetProfitPattern(client, acc) class BpsCentsRatioSatsUsdPattern: @@ -2579,7 +2579,7 @@ class BpsCentsRatioSatsUsdPattern: self.cents: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'cents')) self.ratio: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'ratio')) self.sats: MetricPattern1[SatsFract] = MetricPattern1(client, _m(acc, 'sats')) - self.usd: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'usd')) + self.usd: MetricPattern1[Dollars] = MetricPattern1(client, acc) class BtcCentsRelSatsUsdPattern: """Pattern struct for repeated tree structure.""" @@ -2588,7 +2588,7 @@ class BtcCentsRelSatsUsdPattern: """Create pattern node with accumulated metric name.""" self.btc: MetricPattern1[Bitcoin] = MetricPattern1(client, acc) self.cents: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'cents')) - self.rel_to_circulating: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'rel_to_circulating_supply')) + self.rel_to_circulating: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'rel_to_circulating')) self.sats: MetricPattern1[Sats] = MetricPattern1(client, _m(acc, 'sats')) self.usd: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'usd')) @@ -2599,7 +2599,7 @@ class BtcCentsRelSatsUsdPattern2: """Create pattern node with accumulated metric name.""" self.btc: MetricPattern1[Bitcoin] = MetricPattern1(client, acc) self.cents: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'cents')) - self.rel_to_own_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'rel_to_own_supply')) + self.rel_to_own: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'rel_to_own')) self.sats: MetricPattern1[Sats] = MetricPattern1(client, _m(acc, 'sats')) self.usd: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'usd')) @@ -2611,7 +2611,7 @@ class CentsDeltaRawRelUsdPattern: self.cents: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_cap_cents')) self.delta: ChangeRatePattern4 = ChangeRatePattern4(client, _m(acc, 'realized_cap_delta')) self.raw: MetricPattern18[CentsSats] = MetricPattern18(client, _m(acc, 'cap_raw')) - self.rel_to_own_mcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'realized_cap_rel_to_own_market_cap')) + self.rel_to_own_mcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'realized_cap_rel_to_own_mcap')) self.usd: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_cap')) class CoindaysCoinyearsDormancySentVelocityPattern: @@ -2675,9 +2675,9 @@ class RawRelSumPattern2: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" self.raw: CentsUsdPattern = CentsUsdPattern(client, acc) - self.rel_to_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'rel_to_market_cap')) + self.rel_to_mcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'rel_to_mcap')) self.rel_to_own_gross: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'rel_to_own_gross_pnl')) - self.rel_to_own_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'rel_to_own_market_cap')) + self.rel_to_own_mcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'rel_to_own_mcap')) self.sum: _24hPattern = _24hPattern(client, _m(acc, '24h')) class _1m1w1y24hHeightPattern(Generic[T]): @@ -2761,22 +2761,22 @@ class _1y2y4yAllPattern: self._4y: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern = _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern(client, acc) self.all: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern = _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern(client, acc) -class AddrOutputsRealizedSupplyPattern: +class AddressOutputsRealizedSupplyPattern: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.addr_count: BaseDeltaPattern = BaseDeltaPattern(client, _m(acc, 'addr_count')) + self.address_count: DeltaRawPattern = DeltaRawPattern(client, _m(acc, 'address_count')) self.outputs: UnspentPattern = UnspentPattern(client, _m(acc, 'utxo_count')) self.realized: CapLossMvrvNuplPriceProfitSoprPattern = CapLossMvrvNuplPriceProfitSoprPattern(client, acc) - self.supply: HalvedTotalPattern = HalvedTotalPattern(client, _m(acc, 'supply')) + self.supply: HalfTotalPattern = HalfTotalPattern(client, _m(acc, 'supply')) class AdjustedRatioValuePattern: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.adjusted: RatioValuePattern2 = RatioValuePattern2(client, _m(acc, 'adjusted')) + self.adjusted: RatioValuePattern2 = RatioValuePattern2(client, acc) self.ratio: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, _m(acc, 'sopr')) self.value_created: RawSumPattern[Cents] = RawSumPattern(client, _m(acc, 'value_created')) self.value_destroyed: RawSumPattern[Cents] = RawSumPattern(client, _m(acc, 'value_destroyed')) @@ -2818,7 +2818,7 @@ class CentsRelUsdPattern2: """Create pattern node with accumulated metric name.""" self.cents: MetricPattern1[CentsSigned] = MetricPattern1(client, _m(acc, 'cents')) self.rel_to_own_gross: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'rel_to_own_gross_pnl')) - self.rel_to_own_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'rel_to_own_market_cap')) + self.rel_to_own_mcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'rel_to_own_mcap')) self.usd: MetricPattern1[Dollars] = MetricPattern1(client, acc) class CumulativeNegativeRawSumPattern: @@ -2831,12 +2831,12 @@ class CumulativeNegativeRawSumPattern: self.raw: CentsUsdPattern = CentsUsdPattern(client, _m(acc, 'realized_loss')) self.sum: _24hPattern = _24hPattern(client, _m(acc, 'realized_loss_24h')) -class HalvedInTotalPattern: +class HalfInTotalPattern: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.halved: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'halved')) + self.half: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'half')) self.in_loss: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'in_loss')) self.in_profit: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'in_profit')) self.total: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, acc) @@ -2868,7 +2868,7 @@ class OutputsRealizedSupplyUnrealizedPattern: """Create pattern node with accumulated metric name.""" self.outputs: UnspentPattern = UnspentPattern(client, _m(acc, 'utxo_count')) self.realized: CapLossMvrvNuplPriceProfitSoprPattern = CapLossMvrvNuplPriceProfitSoprPattern(client, acc) - self.supply: HalvedInTotalPattern = HalvedInTotalPattern(client, _m(acc, 'supply')) + self.supply: HalfInTotalPattern = HalfInTotalPattern(client, _m(acc, 'supply')) self.unrealized: LossProfitPattern = LossProfitPattern(client, _m(acc, 'unrealized')) class _1m1w1y24hPattern(Generic[T]): @@ -2913,9 +2913,9 @@ class BpsPriceRatioPattern: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.bps: MetricPattern1[BasisPoints32] = MetricPattern1(client, _m(acc, 'bps')) - self.price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, acc) - self.ratio: MetricPattern1[StoredF32] = MetricPattern1(client, acc) + self.bps: MetricPattern1[BasisPoints32] = MetricPattern1(client, _m(acc, 'ratio_pct99_bps')) + self.price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'pct99')) + self.ratio: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'ratio_pct99')) class CentsSatsUsdPattern2: """Pattern struct for repeated tree structure.""" @@ -2951,7 +2951,7 @@ class CentsSatsUsdPattern: """Create pattern node with accumulated metric name.""" self.cents: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'cents')) self.sats: MetricPattern1[SatsFract] = MetricPattern1(client, _m(acc, 'sats')) - self.usd: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'usd')) + self.usd: MetricPattern1[Dollars] = MetricPattern1(client, acc) class CumulativeRawRelPattern: """Pattern struct for repeated tree structure.""" @@ -2960,7 +2960,7 @@ class CumulativeRawRelPattern: """Create pattern node with accumulated metric name.""" self.cumulative: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'cumulative')) self.raw: MetricPattern1[Cents] = MetricPattern1(client, acc) - self.rel_to_rcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'rel_to_realized_cap')) + self.rel_to_rcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'rel_to_rcap')) class CumulativeRawSumPattern2: """Pattern struct for repeated tree structure.""" @@ -3005,16 +3005,16 @@ class OutputsRealizedSupplyPattern: """Create pattern node with accumulated metric name.""" self.outputs: UnspentPattern = UnspentPattern(client, _m(acc, 'utxo_count')) self.realized: CapLossMvrvNuplPriceProfitSoprPattern = CapLossMvrvNuplPriceProfitSoprPattern(client, acc) - self.supply: HalvedTotalPattern = HalvedTotalPattern(client, _m(acc, 'supply')) + self.supply: HalfTotalPattern = HalfTotalPattern(client, _m(acc, 'supply')) class RatioValuePattern2: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.ratio: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, _m(acc, 'sopr')) - self.value_created: BaseSumPattern = BaseSumPattern(client, _m(acc, 'value_created')) - self.value_destroyed: BaseSumPattern = BaseSumPattern(client, _m(acc, 'value_destroyed')) + self.ratio: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, _m(acc, 'asopr')) + self.value_created: RawSumPattern[Cents] = RawSumPattern(client, _m(acc, 'adj_value_created')) + self.value_destroyed: RawSumPattern[Cents] = RawSumPattern(client, _m(acc, 'adj_value_destroyed')) class RatioValuePattern: """Pattern struct for repeated tree structure.""" @@ -3052,30 +3052,6 @@ class CumulativeRawSumPattern(Generic[T]): self.raw: MetricPattern1[T] = MetricPattern1(client, acc) self.sum: _1m1w1y24hPattern[T] = _1m1w1y24hPattern(client, acc) -class BaseSumPattern: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.base: MetricPattern1[Cents] = MetricPattern1(client, acc) - self.sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, acc) - -class BaseDeltaPattern2: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.base: MetricPattern1[StoredU64] = MetricPattern1(client, acc) - self.delta: ChangeRatePattern = ChangeRatePattern(client, _m(acc, 'delta')) - -class BaseDeltaPattern: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.base: MetricPattern1[StoredU64] = MetricPattern1(client, acc) - self.delta: ChangeRatePattern2 = ChangeRatePattern2(client, _m(acc, 'delta')) - class BlocksDominancePattern: """Pattern struct for repeated tree structure.""" @@ -3140,12 +3116,28 @@ class CoindaysSentPattern: self.coindays_destroyed: RawSumPattern3[StoredF64] = RawSumPattern3(client, _m(acc, 'coindays_destroyed')) self.sent: InRawSumPattern = InRawSumPattern(client, _m(acc, 'sent')) -class HalvedTotalPattern: +class DeltaRawPattern2: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.halved: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'halved')) + self.delta: ChangeRatePattern = ChangeRatePattern(client, _m(acc, 'delta')) + self.raw: MetricPattern1[StoredU64] = MetricPattern1(client, acc) + +class DeltaRawPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.delta: ChangeRatePattern2 = ChangeRatePattern2(client, _m(acc, 'delta')) + self.raw: MetricPattern1[StoredU64] = MetricPattern1(client, acc) + +class HalfTotalPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.half: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'half')) self.total: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, acc) class InPattern2: @@ -3177,8 +3169,8 @@ class PriceValuePattern: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, acc) - self.value: MetricPattern1[StoredF32] = MetricPattern1(client, acc) + self.price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'p3sd_4y')) + self.value: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'ratio_p3sd_4y')) class RawSumPattern5: """Pattern struct for repeated tree structure.""" @@ -3217,8 +3209,8 @@ class RelPattern: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.rel_to_mcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'market_cap')) - self.rel_to_rcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'realized_cap')) + self.rel_to_mcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'mcap')) + self.rel_to_rcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'rcap')) class SdSmaPattern: """Pattern struct for repeated tree structure.""" @@ -3250,7 +3242,7 @@ class RawSumPattern(Generic[T]): def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" self.raw: MetricPattern1[T] = MetricPattern1(client, acc) - self.sum: _1m1w1y24hPattern[T] = _1m1w1y24hPattern(client, _m(acc, 'sum')) + self.sum: _1m1w1y24hPattern[T] = _1m1w1y24hPattern(client, acc) class RawSumPattern3(Generic[T]): """Pattern struct for repeated tree structure.""" @@ -3293,14 +3285,14 @@ class UnspentPattern2: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.unspent_count: BaseDeltaPattern = BaseDeltaPattern(client, acc) + self.unspent_count: DeltaRawPattern = DeltaRawPattern(client, acc) class UnspentPattern3: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.unspent_count: BaseDeltaPattern2 = BaseDeltaPattern2(client, acc) + self.unspent_count: DeltaRawPattern2 = DeltaRawPattern2(client, acc) class UnspentPattern: """Pattern struct for repeated tree structure.""" @@ -3371,7 +3363,7 @@ class MetricsTree_Blocks_Weight: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.base: MetricPattern18[Weight] = MetricPattern18(client, 'block_weight') + self.raw: MetricPattern18[Weight] = MetricPattern18(client, 'block_weight') self.cumulative: MetricPattern1[Weight] = MetricPattern1(client, 'block_weight_cumulative') self.sum: _1m1w1y24hPattern[Weight] = _1m1w1y24hPattern(client, 'block_weight_sum') self.average: _1m1w1y24hPattern[Weight] = _1m1w1y24hPattern(client, 'block_weight_average') @@ -4322,28 +4314,52 @@ class MetricsTree_Market_Range: self.true_range_sum_2w: MetricPattern1[StoredF32] = MetricPattern1(client, 'price_true_range_sum_2w') self.choppiness_index_2w: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'price_choppiness_index_2w') +class MetricsTree_Market_MovingAverage_Sma_200d_X24: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.cents: MetricPattern1[Cents] = MetricPattern1(client, 'price_sma_200d_x2_4_cents') + self.usd: MetricPattern1[Dollars] = MetricPattern1(client, 'price_sma_200d_x2_4_usd') + self.sats: MetricPattern1[SatsFract] = MetricPattern1(client, 'price_sma_200d_x2_4_sats') + +class MetricsTree_Market_MovingAverage_Sma_200d_X08: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.cents: MetricPattern1[Cents] = MetricPattern1(client, 'price_sma_200d_x0_8_cents') + self.usd: MetricPattern1[Dollars] = MetricPattern1(client, 'price_sma_200d_x0_8_usd') + self.sats: MetricPattern1[SatsFract] = MetricPattern1(client, 'price_sma_200d_x0_8_sats') + class MetricsTree_Market_MovingAverage_Sma_200d: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): self.cents: MetricPattern1[Cents] = MetricPattern1(client, 'price_sma_200d_cents') - self.usd: MetricPattern1[Dollars] = MetricPattern1(client, 'price_sma_200d_usd') + self.usd: MetricPattern1[Dollars] = MetricPattern1(client, 'price_sma_200d') self.sats: MetricPattern1[SatsFract] = MetricPattern1(client, 'price_sma_200d_sats') self.bps: MetricPattern1[BasisPoints32] = MetricPattern1(client, 'price_sma_200d_ratio_bps') self.ratio: MetricPattern1[StoredF32] = MetricPattern1(client, 'price_sma_200d_ratio') - self.x2_4: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_sma_200d_x2_4') - self.x0_8: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_sma_200d_x0_8') + self.x2_4: MetricsTree_Market_MovingAverage_Sma_200d_X24 = MetricsTree_Market_MovingAverage_Sma_200d_X24(client) + self.x0_8: MetricsTree_Market_MovingAverage_Sma_200d_X08 = MetricsTree_Market_MovingAverage_Sma_200d_X08(client) + +class MetricsTree_Market_MovingAverage_Sma_350d_X2: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.cents: MetricPattern1[Cents] = MetricPattern1(client, 'price_sma_350d_x2_cents') + self.usd: MetricPattern1[Dollars] = MetricPattern1(client, 'price_sma_350d_x2_usd') + self.sats: MetricPattern1[SatsFract] = MetricPattern1(client, 'price_sma_350d_x2_sats') class MetricsTree_Market_MovingAverage_Sma_350d: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): self.cents: MetricPattern1[Cents] = MetricPattern1(client, 'price_sma_350d_cents') - self.usd: MetricPattern1[Dollars] = MetricPattern1(client, 'price_sma_350d_usd') + self.usd: MetricPattern1[Dollars] = MetricPattern1(client, 'price_sma_350d') self.sats: MetricPattern1[SatsFract] = MetricPattern1(client, 'price_sma_350d_sats') self.bps: MetricPattern1[BasisPoints32] = MetricPattern1(client, 'price_sma_350d_ratio_bps') self.ratio: MetricPattern1[StoredF32] = MetricPattern1(client, 'price_sma_350d_ratio') - self.x2: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_sma_350d_x2') + self.x2: MetricsTree_Market_MovingAverage_Sma_350d_X2 = MetricsTree_Market_MovingAverage_Sma_350d_X2(client) class MetricsTree_Market_MovingAverage_Sma: """Metrics tree node.""" @@ -4785,14 +4801,6 @@ class MetricsTree_Pools: self.major: MetricsTree_Pools_Major = MetricsTree_Pools_Major(client) self.minor: MetricsTree_Pools_Minor = MetricsTree_Pools_Minor(client) -class MetricsTree_Prices_Split_Close: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.cents: MetricPattern2[Cents] = MetricPattern2(client, 'price_close_cents') - self.usd: MetricPattern2[Dollars] = MetricPattern2(client, 'price_close') - self.sats: MetricPattern2[Sats] = MetricPattern2(client, 'price_close_sats') - class MetricsTree_Prices_Split: """Metrics tree node.""" @@ -4800,7 +4808,7 @@ class MetricsTree_Prices_Split: self.open: CentsSatsUsdPattern2 = CentsSatsUsdPattern2(client, 'price_open') self.high: CentsSatsUsdPattern2 = CentsSatsUsdPattern2(client, 'price_high') self.low: CentsSatsUsdPattern2 = CentsSatsUsdPattern2(client, 'price_low') - self.close: MetricsTree_Prices_Split_Close = MetricsTree_Prices_Split_Close(client) + self.close: CentsSatsUsdPattern2 = CentsSatsUsdPattern2(client, 'price_close') class MetricsTree_Prices_Ohlc: """Metrics tree node.""" @@ -4862,33 +4870,96 @@ class MetricsTree_Distribution_Addresses_Activity: self.p2tr: BothReactivatedReceivingSendingPattern = BothReactivatedReceivingSendingPattern(client, 'p2tr_address_activity') self.p2a: BothReactivatedReceivingSendingPattern = BothReactivatedReceivingSendingPattern(client, 'p2a_address_activity') +class MetricsTree_Distribution_Addresses_New_All: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.raw: MetricPattern1[StoredU64] = MetricPattern1(client, 'new_address_count') + self.sum: _1m1w1y24hPattern[StoredU64] = _1m1w1y24hPattern(client, 'new_address_count_sum') + +class MetricsTree_Distribution_Addresses_New_P2pk65: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.raw: MetricPattern1[StoredU64] = MetricPattern1(client, 'p2pk65_new_address_count') + self.sum: _1m1w1y24hPattern[StoredU64] = _1m1w1y24hPattern(client, 'p2pk65_new_address_count_sum') + +class MetricsTree_Distribution_Addresses_New_P2pk33: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.raw: MetricPattern1[StoredU64] = MetricPattern1(client, 'p2pk33_new_address_count') + self.sum: _1m1w1y24hPattern[StoredU64] = _1m1w1y24hPattern(client, 'p2pk33_new_address_count_sum') + +class MetricsTree_Distribution_Addresses_New_P2pkh: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.raw: MetricPattern1[StoredU64] = MetricPattern1(client, 'p2pkh_new_address_count') + self.sum: _1m1w1y24hPattern[StoredU64] = _1m1w1y24hPattern(client, 'p2pkh_new_address_count_sum') + +class MetricsTree_Distribution_Addresses_New_P2sh: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.raw: MetricPattern1[StoredU64] = MetricPattern1(client, 'p2sh_new_address_count') + self.sum: _1m1w1y24hPattern[StoredU64] = _1m1w1y24hPattern(client, 'p2sh_new_address_count_sum') + +class MetricsTree_Distribution_Addresses_New_P2wpkh: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.raw: MetricPattern1[StoredU64] = MetricPattern1(client, 'p2wpkh_new_address_count') + self.sum: _1m1w1y24hPattern[StoredU64] = _1m1w1y24hPattern(client, 'p2wpkh_new_address_count_sum') + +class MetricsTree_Distribution_Addresses_New_P2wsh: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.raw: MetricPattern1[StoredU64] = MetricPattern1(client, 'p2wsh_new_address_count') + self.sum: _1m1w1y24hPattern[StoredU64] = _1m1w1y24hPattern(client, 'p2wsh_new_address_count_sum') + +class MetricsTree_Distribution_Addresses_New_P2tr: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.raw: MetricPattern1[StoredU64] = MetricPattern1(client, 'p2tr_new_address_count') + self.sum: _1m1w1y24hPattern[StoredU64] = _1m1w1y24hPattern(client, 'p2tr_new_address_count_sum') + +class MetricsTree_Distribution_Addresses_New_P2a: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.raw: MetricPattern1[StoredU64] = MetricPattern1(client, 'p2a_new_address_count') + self.sum: _1m1w1y24hPattern[StoredU64] = _1m1w1y24hPattern(client, 'p2a_new_address_count_sum') + class MetricsTree_Distribution_Addresses_New: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.all: RawSumPattern[StoredU64] = RawSumPattern(client, 'new_addr_count') - self.p2pk65: RawSumPattern[StoredU64] = RawSumPattern(client, 'p2pk65_new_addr_count') - self.p2pk33: RawSumPattern[StoredU64] = RawSumPattern(client, 'p2pk33_new_addr_count') - self.p2pkh: RawSumPattern[StoredU64] = RawSumPattern(client, 'p2pkh_new_addr_count') - self.p2sh: RawSumPattern[StoredU64] = RawSumPattern(client, 'p2sh_new_addr_count') - self.p2wpkh: RawSumPattern[StoredU64] = RawSumPattern(client, 'p2wpkh_new_addr_count') - self.p2wsh: RawSumPattern[StoredU64] = RawSumPattern(client, 'p2wsh_new_addr_count') - self.p2tr: RawSumPattern[StoredU64] = RawSumPattern(client, 'p2tr_new_addr_count') - self.p2a: RawSumPattern[StoredU64] = RawSumPattern(client, 'p2a_new_addr_count') + self.all: MetricsTree_Distribution_Addresses_New_All = MetricsTree_Distribution_Addresses_New_All(client) + self.p2pk65: MetricsTree_Distribution_Addresses_New_P2pk65 = MetricsTree_Distribution_Addresses_New_P2pk65(client) + self.p2pk33: MetricsTree_Distribution_Addresses_New_P2pk33 = MetricsTree_Distribution_Addresses_New_P2pk33(client) + self.p2pkh: MetricsTree_Distribution_Addresses_New_P2pkh = MetricsTree_Distribution_Addresses_New_P2pkh(client) + self.p2sh: MetricsTree_Distribution_Addresses_New_P2sh = MetricsTree_Distribution_Addresses_New_P2sh(client) + self.p2wpkh: MetricsTree_Distribution_Addresses_New_P2wpkh = MetricsTree_Distribution_Addresses_New_P2wpkh(client) + self.p2wsh: MetricsTree_Distribution_Addresses_New_P2wsh = MetricsTree_Distribution_Addresses_New_P2wsh(client) + self.p2tr: MetricsTree_Distribution_Addresses_New_P2tr = MetricsTree_Distribution_Addresses_New_P2tr(client) + self.p2a: MetricsTree_Distribution_Addresses_New_P2a = MetricsTree_Distribution_Addresses_New_P2a(client) class MetricsTree_Distribution_Addresses_Delta: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.all: ChangeRatePattern = ChangeRatePattern(client, 'addr_count') - self.p2pk65: ChangeRatePattern = ChangeRatePattern(client, 'p2pk65_addr_count') - self.p2pk33: ChangeRatePattern = ChangeRatePattern(client, 'p2pk33_addr_count') - self.p2pkh: ChangeRatePattern = ChangeRatePattern(client, 'p2pkh_addr_count') - self.p2sh: ChangeRatePattern = ChangeRatePattern(client, 'p2sh_addr_count') - self.p2wpkh: ChangeRatePattern = ChangeRatePattern(client, 'p2wpkh_addr_count') - self.p2wsh: ChangeRatePattern = ChangeRatePattern(client, 'p2wsh_addr_count') - self.p2tr: ChangeRatePattern = ChangeRatePattern(client, 'p2tr_addr_count') - self.p2a: ChangeRatePattern = ChangeRatePattern(client, 'p2a_addr_count') + self.all: ChangeRatePattern = ChangeRatePattern(client, 'address_count') + self.p2pk65: ChangeRatePattern = ChangeRatePattern(client, 'p2pk65_address_count') + self.p2pk33: ChangeRatePattern = ChangeRatePattern(client, 'p2pk33_address_count') + self.p2pkh: ChangeRatePattern = ChangeRatePattern(client, 'p2pkh_address_count') + self.p2sh: ChangeRatePattern = ChangeRatePattern(client, 'p2sh_address_count') + self.p2wpkh: ChangeRatePattern = ChangeRatePattern(client, 'p2wpkh_address_count') + self.p2wsh: ChangeRatePattern = ChangeRatePattern(client, 'p2wsh_address_count') + self.p2tr: ChangeRatePattern = ChangeRatePattern(client, 'p2tr_address_count') + self.p2a: ChangeRatePattern = ChangeRatePattern(client, 'p2a_address_count') class MetricsTree_Distribution_Addresses: """Metrics tree node.""" @@ -4896,10 +4967,10 @@ class MetricsTree_Distribution_Addresses: def __init__(self, client: BrkClientBase, base_path: str = ''): self.indexes: MetricsTree_Distribution_Addresses_Indexes = MetricsTree_Distribution_Addresses_Indexes(client) self.data: MetricsTree_Distribution_Addresses_Data = MetricsTree_Distribution_Addresses_Data(client) - self.funded: AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3 = AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3(client, 'addr_count') - self.empty: AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3 = AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3(client, 'empty_addr_count') + self.funded: AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3 = AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3(client, 'address_count') + self.empty: AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3 = AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3(client, 'empty_address_count') self.activity: MetricsTree_Distribution_Addresses_Activity = MetricsTree_Distribution_Addresses_Activity(client) - self.total: AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3 = AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3(client, 'total_addr_count') + self.total: AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3 = AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3(client, 'total_address_count') self.new: MetricsTree_Distribution_Addresses_New = MetricsTree_Distribution_Addresses_New(client) self.delta: MetricsTree_Distribution_Addresses_Delta = MetricsTree_Distribution_Addresses_Delta(client) @@ -4911,7 +4982,7 @@ class MetricsTree_Distribution_Cohorts_Utxo_All_Supply: self.in_profit: BtcCentsRelSatsUsdPattern2 = BtcCentsRelSatsUsdPattern2(client, 'supply_in_profit') self.in_loss: BtcCentsRelSatsUsdPattern2 = BtcCentsRelSatsUsdPattern2(client, 'supply_in_loss') self.total: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'supply') - self.halved: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'supply_halved') + self.half: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'supply_half') class MetricsTree_Distribution_Cohorts_Utxo_All_Unrealized_Loss: """Metrics tree node.""" @@ -4920,7 +4991,7 @@ class MetricsTree_Distribution_Cohorts_Utxo_All_Unrealized_Loss: self.negative: MetricPattern1[Dollars] = MetricPattern1(client, 'neg_unrealized_loss') self.raw: CentsUsdPattern = CentsUsdPattern(client, 'unrealized_loss') self.sum: _24hPattern = _24hPattern(client, 'unrealized_loss_24h') - self.rel_to_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'unrealized_loss_rel_to_market_cap') + self.rel_to_mcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'unrealized_loss_rel_to_mcap') self.rel_to_own_gross: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'unrealized_loss_rel_to_own_gross_pnl') class MetricsTree_Distribution_Cohorts_Utxo_All_Unrealized_NetPnl: @@ -4937,7 +5008,7 @@ class MetricsTree_Distribution_Cohorts_Utxo_All_Unrealized_Profit: def __init__(self, client: BrkClientBase, base_path: str = ''): self.raw: CentsUsdPattern = CentsUsdPattern(client, 'unrealized_profit') self.sum: _24hPattern = _24hPattern(client, 'unrealized_profit_24h') - self.rel_to_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'unrealized_profit_rel_to_market_cap') + self.rel_to_mcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'unrealized_profit_rel_to_mcap') self.rel_to_own_gross: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'unrealized_profit_rel_to_own_gross_pnl') class MetricsTree_Distribution_Cohorts_Utxo_All_Unrealized: @@ -4968,32 +5039,18 @@ class MetricsTree_Distribution_Cohorts_Utxo_Sth: def __init__(self, client: BrkClientBase, base_path: str = ''): self.realized: CapGrossInvestorLossMvrvNetNuplPeakPriceProfitSoprPattern = CapGrossInvestorLossMvrvNetNuplPeakPriceProfitSoprPattern(client, 'sth') - self.supply: DeltaHalvedInRelTotalPattern2 = DeltaHalvedInRelTotalPattern2(client, 'sth_supply') + self.supply: DeltaHalfInRelTotalPattern2 = DeltaHalfInRelTotalPattern2(client, 'sth_supply') self.outputs: UnspentPattern3 = UnspentPattern3(client, 'sth_utxo_count') self.activity: CoindaysCoinyearsDormancySentVelocityPattern = CoindaysCoinyearsDormancySentVelocityPattern(client, 'sth') self.cost_basis: InvestedMaxMinPercentilesSupplyPattern = InvestedMaxMinPercentilesSupplyPattern(client, 'sth') self.unrealized: GrossInvestedInvestorLossNetProfitSentimentPattern2 = GrossInvestedInvestorLossNetProfitSentimentPattern2(client, 'sth') -class MetricsTree_Distribution_Cohorts_Utxo_Lth_Realized_Sopr_ValueCreated: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, 'lth_value_created') - self.raw: MetricPattern1[Cents] = MetricPattern1(client, 'lth_value_created') - -class MetricsTree_Distribution_Cohorts_Utxo_Lth_Realized_Sopr_ValueDestroyed: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, 'lth_value_destroyed') - self.raw: MetricPattern1[Cents] = MetricPattern1(client, 'lth_value_destroyed') - class MetricsTree_Distribution_Cohorts_Utxo_Lth_Realized_Sopr: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.value_created: MetricsTree_Distribution_Cohorts_Utxo_Lth_Realized_Sopr_ValueCreated = MetricsTree_Distribution_Cohorts_Utxo_Lth_Realized_Sopr_ValueCreated(client) - self.value_destroyed: MetricsTree_Distribution_Cohorts_Utxo_Lth_Realized_Sopr_ValueDestroyed = MetricsTree_Distribution_Cohorts_Utxo_Lth_Realized_Sopr_ValueDestroyed(client) + self.value_created: RawSumPattern[Cents] = RawSumPattern(client, 'lth_value_created') + self.value_destroyed: RawSumPattern[Cents] = RawSumPattern(client, 'lth_value_destroyed') self.ratio: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, 'lth_sopr') class MetricsTree_Distribution_Cohorts_Utxo_Lth_Realized: @@ -5017,7 +5074,7 @@ class MetricsTree_Distribution_Cohorts_Utxo_Lth: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.supply: DeltaHalvedInRelTotalPattern2 = DeltaHalvedInRelTotalPattern2(client, 'lth_supply') + self.supply: DeltaHalfInRelTotalPattern2 = DeltaHalfInRelTotalPattern2(client, 'lth_supply') self.outputs: UnspentPattern3 = UnspentPattern3(client, 'lth_utxo_count') self.activity: CoindaysCoinyearsDormancySentVelocityPattern = CoindaysCoinyearsDormancySentVelocityPattern(client, 'lth') self.realized: MetricsTree_Distribution_Cohorts_Utxo_Lth_Realized = MetricsTree_Distribution_Cohorts_Utxo_Lth_Realized(client) @@ -5028,7 +5085,7 @@ class MetricsTree_Distribution_Cohorts_Utxo_AgeRange: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.up_to_1h: ActivityOutputsRealizedSupplyUnrealizedPattern = ActivityOutputsRealizedSupplyUnrealizedPattern(client, 'utxos_under_1h_old') + self.under_1h: ActivityOutputsRealizedSupplyUnrealizedPattern = ActivityOutputsRealizedSupplyUnrealizedPattern(client, 'utxos_under_1h_old') self._1h_to_1d: ActivityOutputsRealizedSupplyUnrealizedPattern = ActivityOutputsRealizedSupplyUnrealizedPattern(client, 'utxos_1h_to_1d_old') self._1d_to_1w: ActivityOutputsRealizedSupplyUnrealizedPattern = ActivityOutputsRealizedSupplyUnrealizedPattern(client, 'utxos_1d_to_1w_old') self._1w_to_1m: ActivityOutputsRealizedSupplyUnrealizedPattern = ActivityOutputsRealizedSupplyUnrealizedPattern(client, 'utxos_1w_to_1m_old') @@ -5048,7 +5105,7 @@ class MetricsTree_Distribution_Cohorts_Utxo_AgeRange: self._8y_to_10y: ActivityOutputsRealizedSupplyUnrealizedPattern = ActivityOutputsRealizedSupplyUnrealizedPattern(client, 'utxos_8y_to_10y_old') self._10y_to_12y: ActivityOutputsRealizedSupplyUnrealizedPattern = ActivityOutputsRealizedSupplyUnrealizedPattern(client, 'utxos_10y_to_12y_old') self._12y_to_15y: ActivityOutputsRealizedSupplyUnrealizedPattern = ActivityOutputsRealizedSupplyUnrealizedPattern(client, 'utxos_12y_to_15y_old') - self.from_15y: ActivityOutputsRealizedSupplyUnrealizedPattern = ActivityOutputsRealizedSupplyUnrealizedPattern(client, 'utxos_over_15y_old') + self.over_15y: ActivityOutputsRealizedSupplyUnrealizedPattern = ActivityOutputsRealizedSupplyUnrealizedPattern(client, 'utxos_over_15y_old') class MetricsTree_Distribution_Cohorts_Utxo_UnderAge: """Metrics tree node.""" @@ -5151,21 +5208,21 @@ class MetricsTree_Distribution_Cohorts_Utxo_AmountRange: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self._0sats: OutputsRealizedSupplyPattern = OutputsRealizedSupplyPattern(client, 'utxos_with_0sats') - self._1sat_to_10sats: OutputsRealizedSupplyPattern = OutputsRealizedSupplyPattern(client, 'utxos_above_1sat_under_10sats') - self._10sats_to_100sats: OutputsRealizedSupplyPattern = OutputsRealizedSupplyPattern(client, 'utxos_above_10sats_under_100sats') - self._100sats_to_1k_sats: OutputsRealizedSupplyPattern = OutputsRealizedSupplyPattern(client, 'utxos_above_100sats_under_1k_sats') - self._1k_sats_to_10k_sats: OutputsRealizedSupplyPattern = OutputsRealizedSupplyPattern(client, 'utxos_above_1k_sats_under_10k_sats') - self._10k_sats_to_100k_sats: OutputsRealizedSupplyPattern = OutputsRealizedSupplyPattern(client, 'utxos_above_10k_sats_under_100k_sats') - self._100k_sats_to_1m_sats: OutputsRealizedSupplyPattern = OutputsRealizedSupplyPattern(client, 'utxos_above_100k_sats_under_1m_sats') - self._1m_sats_to_10m_sats: OutputsRealizedSupplyPattern = OutputsRealizedSupplyPattern(client, 'utxos_above_1m_sats_under_10m_sats') - self._10m_sats_to_1btc: OutputsRealizedSupplyPattern = OutputsRealizedSupplyPattern(client, 'utxos_above_10m_sats_under_1btc') - self._1btc_to_10btc: OutputsRealizedSupplyPattern = OutputsRealizedSupplyPattern(client, 'utxos_above_1btc_under_10btc') - self._10btc_to_100btc: OutputsRealizedSupplyPattern = OutputsRealizedSupplyPattern(client, 'utxos_above_10btc_under_100btc') - self._100btc_to_1k_btc: OutputsRealizedSupplyPattern = OutputsRealizedSupplyPattern(client, 'utxos_above_100btc_under_1k_btc') - self._1k_btc_to_10k_btc: OutputsRealizedSupplyPattern = OutputsRealizedSupplyPattern(client, 'utxos_above_1k_btc_under_10k_btc') - self._10k_btc_to_100k_btc: OutputsRealizedSupplyPattern = OutputsRealizedSupplyPattern(client, 'utxos_above_10k_btc_under_100k_btc') - self._100k_btc_or_more: OutputsRealizedSupplyPattern = OutputsRealizedSupplyPattern(client, 'utxos_above_100k_btc') + self._0sats: OutputsRealizedSupplyPattern = OutputsRealizedSupplyPattern(client, 'utxos_0sats') + self._1sat_to_10sats: OutputsRealizedSupplyPattern = OutputsRealizedSupplyPattern(client, 'utxos_1sat_to_10sats') + self._10sats_to_100sats: OutputsRealizedSupplyPattern = OutputsRealizedSupplyPattern(client, 'utxos_10sats_to_100sats') + self._100sats_to_1k_sats: OutputsRealizedSupplyPattern = OutputsRealizedSupplyPattern(client, 'utxos_100sats_to_1k_sats') + self._1k_sats_to_10k_sats: OutputsRealizedSupplyPattern = OutputsRealizedSupplyPattern(client, 'utxos_1k_sats_to_10k_sats') + self._10k_sats_to_100k_sats: OutputsRealizedSupplyPattern = OutputsRealizedSupplyPattern(client, 'utxos_10k_sats_to_100k_sats') + self._100k_sats_to_1m_sats: OutputsRealizedSupplyPattern = OutputsRealizedSupplyPattern(client, 'utxos_100k_sats_to_1m_sats') + self._1m_sats_to_10m_sats: OutputsRealizedSupplyPattern = OutputsRealizedSupplyPattern(client, 'utxos_1m_sats_to_10m_sats') + self._10m_sats_to_1btc: OutputsRealizedSupplyPattern = OutputsRealizedSupplyPattern(client, 'utxos_10m_sats_to_1btc') + self._1btc_to_10btc: OutputsRealizedSupplyPattern = OutputsRealizedSupplyPattern(client, 'utxos_1btc_to_10btc') + self._10btc_to_100btc: OutputsRealizedSupplyPattern = OutputsRealizedSupplyPattern(client, 'utxos_10btc_to_100btc') + self._100btc_to_1k_btc: OutputsRealizedSupplyPattern = OutputsRealizedSupplyPattern(client, 'utxos_100btc_to_1k_btc') + self._1k_btc_to_10k_btc: OutputsRealizedSupplyPattern = OutputsRealizedSupplyPattern(client, 'utxos_1k_btc_to_10k_btc') + self._10k_btc_to_100k_btc: OutputsRealizedSupplyPattern = OutputsRealizedSupplyPattern(client, 'utxos_10k_btc_to_100k_btc') + self.over_100k_btc: OutputsRealizedSupplyPattern = OutputsRealizedSupplyPattern(client, 'utxos_over_100k_btc') class MetricsTree_Distribution_Cohorts_Utxo_UnderAmount: """Metrics tree node.""" @@ -5276,7 +5333,7 @@ class MetricsTree_Distribution_Cohorts_Utxo_Matured: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.up_to_1h: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'utxo_under_1h_old_matured') + self.under_1h: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'utxo_under_1h_old_matured') self._1h_to_1d: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'utxo_1h_to_1d_old_matured') self._1d_to_1w: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'utxo_1d_to_1w_old_matured') self._1w_to_1m: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'utxo_1w_to_1m_old_matured') @@ -5296,7 +5353,7 @@ class MetricsTree_Distribution_Cohorts_Utxo_Matured: self._8y_to_10y: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'utxo_8y_to_10y_old_matured') self._10y_to_12y: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'utxo_10y_to_12y_old_matured') self._12y_to_15y: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'utxo_12y_to_15y_old_matured') - self.from_15y: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'utxo_over_15y_old_matured') + self.over_15y: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'utxo_over_15y_old_matured') class MetricsTree_Distribution_Cohorts_Utxo: """Metrics tree node.""" @@ -5321,57 +5378,57 @@ class MetricsTree_Distribution_Cohorts_Address_OverAmount: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self._1sat: AddrOutputsRealizedSupplyPattern = AddrOutputsRealizedSupplyPattern(client, 'addrs_over_1sat') - self._10sats: AddrOutputsRealizedSupplyPattern = AddrOutputsRealizedSupplyPattern(client, 'addrs_over_10sats') - self._100sats: AddrOutputsRealizedSupplyPattern = AddrOutputsRealizedSupplyPattern(client, 'addrs_over_100sats') - self._1k_sats: AddrOutputsRealizedSupplyPattern = AddrOutputsRealizedSupplyPattern(client, 'addrs_over_1k_sats') - self._10k_sats: AddrOutputsRealizedSupplyPattern = AddrOutputsRealizedSupplyPattern(client, 'addrs_over_10k_sats') - self._100k_sats: AddrOutputsRealizedSupplyPattern = AddrOutputsRealizedSupplyPattern(client, 'addrs_over_100k_sats') - self._1m_sats: AddrOutputsRealizedSupplyPattern = AddrOutputsRealizedSupplyPattern(client, 'addrs_over_1m_sats') - self._10m_sats: AddrOutputsRealizedSupplyPattern = AddrOutputsRealizedSupplyPattern(client, 'addrs_over_10m_sats') - self._1btc: AddrOutputsRealizedSupplyPattern = AddrOutputsRealizedSupplyPattern(client, 'addrs_over_1btc') - self._10btc: AddrOutputsRealizedSupplyPattern = AddrOutputsRealizedSupplyPattern(client, 'addrs_over_10btc') - self._100btc: AddrOutputsRealizedSupplyPattern = AddrOutputsRealizedSupplyPattern(client, 'addrs_over_100btc') - self._1k_btc: AddrOutputsRealizedSupplyPattern = AddrOutputsRealizedSupplyPattern(client, 'addrs_over_1k_btc') - self._10k_btc: AddrOutputsRealizedSupplyPattern = AddrOutputsRealizedSupplyPattern(client, 'addrs_over_10k_btc') + self._1sat: AddressOutputsRealizedSupplyPattern = AddressOutputsRealizedSupplyPattern(client, 'addrs_over_1sat') + self._10sats: AddressOutputsRealizedSupplyPattern = AddressOutputsRealizedSupplyPattern(client, 'addrs_over_10sats') + self._100sats: AddressOutputsRealizedSupplyPattern = AddressOutputsRealizedSupplyPattern(client, 'addrs_over_100sats') + self._1k_sats: AddressOutputsRealizedSupplyPattern = AddressOutputsRealizedSupplyPattern(client, 'addrs_over_1k_sats') + self._10k_sats: AddressOutputsRealizedSupplyPattern = AddressOutputsRealizedSupplyPattern(client, 'addrs_over_10k_sats') + self._100k_sats: AddressOutputsRealizedSupplyPattern = AddressOutputsRealizedSupplyPattern(client, 'addrs_over_100k_sats') + self._1m_sats: AddressOutputsRealizedSupplyPattern = AddressOutputsRealizedSupplyPattern(client, 'addrs_over_1m_sats') + self._10m_sats: AddressOutputsRealizedSupplyPattern = AddressOutputsRealizedSupplyPattern(client, 'addrs_over_10m_sats') + self._1btc: AddressOutputsRealizedSupplyPattern = AddressOutputsRealizedSupplyPattern(client, 'addrs_over_1btc') + self._10btc: AddressOutputsRealizedSupplyPattern = AddressOutputsRealizedSupplyPattern(client, 'addrs_over_10btc') + self._100btc: AddressOutputsRealizedSupplyPattern = AddressOutputsRealizedSupplyPattern(client, 'addrs_over_100btc') + self._1k_btc: AddressOutputsRealizedSupplyPattern = AddressOutputsRealizedSupplyPattern(client, 'addrs_over_1k_btc') + self._10k_btc: AddressOutputsRealizedSupplyPattern = AddressOutputsRealizedSupplyPattern(client, 'addrs_over_10k_btc') class MetricsTree_Distribution_Cohorts_Address_AmountRange: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self._0sats: AddrOutputsRealizedSupplyPattern = AddrOutputsRealizedSupplyPattern(client, 'addrs_with_0sats') - self._1sat_to_10sats: AddrOutputsRealizedSupplyPattern = AddrOutputsRealizedSupplyPattern(client, 'addrs_above_1sat_under_10sats') - self._10sats_to_100sats: AddrOutputsRealizedSupplyPattern = AddrOutputsRealizedSupplyPattern(client, 'addrs_above_10sats_under_100sats') - self._100sats_to_1k_sats: AddrOutputsRealizedSupplyPattern = AddrOutputsRealizedSupplyPattern(client, 'addrs_above_100sats_under_1k_sats') - self._1k_sats_to_10k_sats: AddrOutputsRealizedSupplyPattern = AddrOutputsRealizedSupplyPattern(client, 'addrs_above_1k_sats_under_10k_sats') - self._10k_sats_to_100k_sats: AddrOutputsRealizedSupplyPattern = AddrOutputsRealizedSupplyPattern(client, 'addrs_above_10k_sats_under_100k_sats') - self._100k_sats_to_1m_sats: AddrOutputsRealizedSupplyPattern = AddrOutputsRealizedSupplyPattern(client, 'addrs_above_100k_sats_under_1m_sats') - self._1m_sats_to_10m_sats: AddrOutputsRealizedSupplyPattern = AddrOutputsRealizedSupplyPattern(client, 'addrs_above_1m_sats_under_10m_sats') - self._10m_sats_to_1btc: AddrOutputsRealizedSupplyPattern = AddrOutputsRealizedSupplyPattern(client, 'addrs_above_10m_sats_under_1btc') - self._1btc_to_10btc: AddrOutputsRealizedSupplyPattern = AddrOutputsRealizedSupplyPattern(client, 'addrs_above_1btc_under_10btc') - self._10btc_to_100btc: AddrOutputsRealizedSupplyPattern = AddrOutputsRealizedSupplyPattern(client, 'addrs_above_10btc_under_100btc') - self._100btc_to_1k_btc: AddrOutputsRealizedSupplyPattern = AddrOutputsRealizedSupplyPattern(client, 'addrs_above_100btc_under_1k_btc') - self._1k_btc_to_10k_btc: AddrOutputsRealizedSupplyPattern = AddrOutputsRealizedSupplyPattern(client, 'addrs_above_1k_btc_under_10k_btc') - self._10k_btc_to_100k_btc: AddrOutputsRealizedSupplyPattern = AddrOutputsRealizedSupplyPattern(client, 'addrs_above_10k_btc_under_100k_btc') - self._100k_btc_or_more: AddrOutputsRealizedSupplyPattern = AddrOutputsRealizedSupplyPattern(client, 'addrs_above_100k_btc') + self._0sats: AddressOutputsRealizedSupplyPattern = AddressOutputsRealizedSupplyPattern(client, 'addrs_0sats') + self._1sat_to_10sats: AddressOutputsRealizedSupplyPattern = AddressOutputsRealizedSupplyPattern(client, 'addrs_1sat_to_10sats') + self._10sats_to_100sats: AddressOutputsRealizedSupplyPattern = AddressOutputsRealizedSupplyPattern(client, 'addrs_10sats_to_100sats') + self._100sats_to_1k_sats: AddressOutputsRealizedSupplyPattern = AddressOutputsRealizedSupplyPattern(client, 'addrs_100sats_to_1k_sats') + self._1k_sats_to_10k_sats: AddressOutputsRealizedSupplyPattern = AddressOutputsRealizedSupplyPattern(client, 'addrs_1k_sats_to_10k_sats') + self._10k_sats_to_100k_sats: AddressOutputsRealizedSupplyPattern = AddressOutputsRealizedSupplyPattern(client, 'addrs_10k_sats_to_100k_sats') + self._100k_sats_to_1m_sats: AddressOutputsRealizedSupplyPattern = AddressOutputsRealizedSupplyPattern(client, 'addrs_100k_sats_to_1m_sats') + self._1m_sats_to_10m_sats: AddressOutputsRealizedSupplyPattern = AddressOutputsRealizedSupplyPattern(client, 'addrs_1m_sats_to_10m_sats') + self._10m_sats_to_1btc: AddressOutputsRealizedSupplyPattern = AddressOutputsRealizedSupplyPattern(client, 'addrs_10m_sats_to_1btc') + self._1btc_to_10btc: AddressOutputsRealizedSupplyPattern = AddressOutputsRealizedSupplyPattern(client, 'addrs_1btc_to_10btc') + self._10btc_to_100btc: AddressOutputsRealizedSupplyPattern = AddressOutputsRealizedSupplyPattern(client, 'addrs_10btc_to_100btc') + self._100btc_to_1k_btc: AddressOutputsRealizedSupplyPattern = AddressOutputsRealizedSupplyPattern(client, 'addrs_100btc_to_1k_btc') + self._1k_btc_to_10k_btc: AddressOutputsRealizedSupplyPattern = AddressOutputsRealizedSupplyPattern(client, 'addrs_1k_btc_to_10k_btc') + self._10k_btc_to_100k_btc: AddressOutputsRealizedSupplyPattern = AddressOutputsRealizedSupplyPattern(client, 'addrs_10k_btc_to_100k_btc') + self.over_100k_btc: AddressOutputsRealizedSupplyPattern = AddressOutputsRealizedSupplyPattern(client, 'addrs_over_100k_btc') class MetricsTree_Distribution_Cohorts_Address_UnderAmount: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self._10sats: AddrOutputsRealizedSupplyPattern = AddrOutputsRealizedSupplyPattern(client, 'addrs_under_10sats') - self._100sats: AddrOutputsRealizedSupplyPattern = AddrOutputsRealizedSupplyPattern(client, 'addrs_under_100sats') - self._1k_sats: AddrOutputsRealizedSupplyPattern = AddrOutputsRealizedSupplyPattern(client, 'addrs_under_1k_sats') - self._10k_sats: AddrOutputsRealizedSupplyPattern = AddrOutputsRealizedSupplyPattern(client, 'addrs_under_10k_sats') - self._100k_sats: AddrOutputsRealizedSupplyPattern = AddrOutputsRealizedSupplyPattern(client, 'addrs_under_100k_sats') - self._1m_sats: AddrOutputsRealizedSupplyPattern = AddrOutputsRealizedSupplyPattern(client, 'addrs_under_1m_sats') - self._10m_sats: AddrOutputsRealizedSupplyPattern = AddrOutputsRealizedSupplyPattern(client, 'addrs_under_10m_sats') - self._1btc: AddrOutputsRealizedSupplyPattern = AddrOutputsRealizedSupplyPattern(client, 'addrs_under_1btc') - self._10btc: AddrOutputsRealizedSupplyPattern = AddrOutputsRealizedSupplyPattern(client, 'addrs_under_10btc') - self._100btc: AddrOutputsRealizedSupplyPattern = AddrOutputsRealizedSupplyPattern(client, 'addrs_under_100btc') - self._1k_btc: AddrOutputsRealizedSupplyPattern = AddrOutputsRealizedSupplyPattern(client, 'addrs_under_1k_btc') - self._10k_btc: AddrOutputsRealizedSupplyPattern = AddrOutputsRealizedSupplyPattern(client, 'addrs_under_10k_btc') - self._100k_btc: AddrOutputsRealizedSupplyPattern = AddrOutputsRealizedSupplyPattern(client, 'addrs_under_100k_btc') + self._10sats: AddressOutputsRealizedSupplyPattern = AddressOutputsRealizedSupplyPattern(client, 'addrs_under_10sats') + self._100sats: AddressOutputsRealizedSupplyPattern = AddressOutputsRealizedSupplyPattern(client, 'addrs_under_100sats') + self._1k_sats: AddressOutputsRealizedSupplyPattern = AddressOutputsRealizedSupplyPattern(client, 'addrs_under_1k_sats') + self._10k_sats: AddressOutputsRealizedSupplyPattern = AddressOutputsRealizedSupplyPattern(client, 'addrs_under_10k_sats') + self._100k_sats: AddressOutputsRealizedSupplyPattern = AddressOutputsRealizedSupplyPattern(client, 'addrs_under_100k_sats') + self._1m_sats: AddressOutputsRealizedSupplyPattern = AddressOutputsRealizedSupplyPattern(client, 'addrs_under_1m_sats') + self._10m_sats: AddressOutputsRealizedSupplyPattern = AddressOutputsRealizedSupplyPattern(client, 'addrs_under_10m_sats') + self._1btc: AddressOutputsRealizedSupplyPattern = AddressOutputsRealizedSupplyPattern(client, 'addrs_under_1btc') + self._10btc: AddressOutputsRealizedSupplyPattern = AddressOutputsRealizedSupplyPattern(client, 'addrs_under_10btc') + self._100btc: AddressOutputsRealizedSupplyPattern = AddressOutputsRealizedSupplyPattern(client, 'addrs_under_100btc') + self._1k_btc: AddressOutputsRealizedSupplyPattern = AddressOutputsRealizedSupplyPattern(client, 'addrs_under_1k_btc') + self._10k_btc: AddressOutputsRealizedSupplyPattern = AddressOutputsRealizedSupplyPattern(client, 'addrs_under_10k_btc') + self._100k_btc: AddressOutputsRealizedSupplyPattern = AddressOutputsRealizedSupplyPattern(client, 'addrs_under_100k_btc') class MetricsTree_Distribution_Cohorts_Address: """Metrics tree node.""" @@ -5853,7 +5910,7 @@ class BrkClient(BrkClientBase): } AGE_RANGE_NAMES = { - "up_to_1h": { + "under_1h": { "id": "under_1h_old", "short": "<1h", "long": "Under 1 Hour Old" @@ -5953,7 +6010,7 @@ class BrkClient(BrkClientBase): "short": "12y-15y", "long": "12 to 15 Years Old" }, - "from_15y": { + "over_15y": { "id": "over_15y_old", "short": "15y+", "long": "15+ Years Old" @@ -6148,77 +6205,77 @@ class BrkClient(BrkClientBase): AMOUNT_RANGE_NAMES = { "_0sats": { - "id": "with_0sats", + "id": "0sats", "short": "0 sats", "long": "0 Sats" }, "_1sat_to_10sats": { - "id": "above_1sat_under_10sats", + "id": "1sat_to_10sats", "short": "1-10 sats", "long": "1-10 Sats" }, "_10sats_to_100sats": { - "id": "above_10sats_under_100sats", + "id": "10sats_to_100sats", "short": "10-100 sats", "long": "10-100 Sats" }, "_100sats_to_1k_sats": { - "id": "above_100sats_under_1k_sats", + "id": "100sats_to_1k_sats", "short": "100-1k sats", "long": "100-1K Sats" }, "_1k_sats_to_10k_sats": { - "id": "above_1k_sats_under_10k_sats", + "id": "1k_sats_to_10k_sats", "short": "1k-10k sats", "long": "1K-10K Sats" }, "_10k_sats_to_100k_sats": { - "id": "above_10k_sats_under_100k_sats", + "id": "10k_sats_to_100k_sats", "short": "10k-100k sats", "long": "10K-100K Sats" }, "_100k_sats_to_1m_sats": { - "id": "above_100k_sats_under_1m_sats", + "id": "100k_sats_to_1m_sats", "short": "100k-1M sats", "long": "100K-1M Sats" }, "_1m_sats_to_10m_sats": { - "id": "above_1m_sats_under_10m_sats", + "id": "1m_sats_to_10m_sats", "short": "1M-10M sats", "long": "1M-10M Sats" }, "_10m_sats_to_1btc": { - "id": "above_10m_sats_under_1btc", + "id": "10m_sats_to_1btc", "short": "0.1-1 BTC", "long": "0.1-1 BTC" }, "_1btc_to_10btc": { - "id": "above_1btc_under_10btc", + "id": "1btc_to_10btc", "short": "1-10 BTC", "long": "1-10 BTC" }, "_10btc_to_100btc": { - "id": "above_10btc_under_100btc", + "id": "10btc_to_100btc", "short": "10-100 BTC", "long": "10-100 BTC" }, "_100btc_to_1k_btc": { - "id": "above_100btc_under_1k_btc", + "id": "100btc_to_1k_btc", "short": "100-1k BTC", "long": "100-1K BTC" }, "_1k_btc_to_10k_btc": { - "id": "above_1k_btc_under_10k_btc", + "id": "1k_btc_to_10k_btc", "short": "1k-10k BTC", "long": "1K-10K BTC" }, "_10k_btc_to_100k_btc": { - "id": "above_10k_btc_under_100k_btc", + "id": "10k_btc_to_100k_btc", "short": "10k-100k BTC", "long": "10K-100K BTC" }, - "_100k_btc_or_more": { - "id": "above_100k_btc", + "over_100k_btc": { + "id": "over_100k_btc", "short": "100k+ BTC", "long": "100K+ BTC" }