From 17106f887a5d3395fad4e7bdac0d1638df87851d Mon Sep 17 00:00:00 2001 From: nym21 Date: Fri, 20 Mar 2026 16:51:03 +0100 Subject: [PATCH] global: snapshot part 5 --- crates/brk_client/src/lib.rs | 441 +++++++++------- .../per_block/amount/lazy_rolling_avg.rs | 40 +- .../src/internal/per_block/rolling/avg.rs | 7 +- .../src/internal/per_block/rolling/avgs.rs | 7 +- .../src/internal/transform/currency.rs | 20 +- .../src/internal/transform/mod.rs | 3 +- modules/brk-client/index.js | 493 ++++++++++-------- packages/brk_client/brk_client/__init__.py | 228 ++++---- .../scripts/options/distribution/activity.js | 2 +- website/scripts/options/network.js | 59 +-- website/scripts/options/series.js | 161 +++--- website/scripts/options/shared.js | 50 +- 12 files changed, 830 insertions(+), 681 deletions(-) diff --git a/crates/brk_client/src/lib.rs b/crates/brk_client/src/lib.rs index 49c729caa..e650da440 100644 --- a/crates/brk_client/src/lib.rs +++ b/crates/brk_client/src/lib.rs @@ -1035,36 +1035,36 @@ impl _10y1m1w1y2y3m3y4y5y6m6y8yPattern2 { /// Pattern struct for repeated tree structure. pub struct _10y1m1w1y2y3m3y4y5y6m6y8yPattern3 { - pub _10y: BtcCentsSatsUsdPattern, - pub _1m: BtcCentsSatsUsdPattern, - pub _1w: BtcCentsSatsUsdPattern, - pub _1y: BtcCentsSatsUsdPattern, - pub _2y: BtcCentsSatsUsdPattern, - pub _3m: BtcCentsSatsUsdPattern, - pub _3y: BtcCentsSatsUsdPattern, - pub _4y: BtcCentsSatsUsdPattern, - pub _5y: BtcCentsSatsUsdPattern, - pub _6m: BtcCentsSatsUsdPattern, - pub _6y: BtcCentsSatsUsdPattern, - pub _8y: BtcCentsSatsUsdPattern, + pub _10y: BtcCentsSatsUsdPattern2, + pub _1m: BtcCentsSatsUsdPattern2, + pub _1w: BtcCentsSatsUsdPattern2, + pub _1y: BtcCentsSatsUsdPattern2, + pub _2y: BtcCentsSatsUsdPattern2, + pub _3m: BtcCentsSatsUsdPattern2, + pub _3y: BtcCentsSatsUsdPattern2, + pub _4y: BtcCentsSatsUsdPattern2, + pub _5y: BtcCentsSatsUsdPattern2, + pub _6m: BtcCentsSatsUsdPattern2, + pub _6y: BtcCentsSatsUsdPattern2, + pub _8y: BtcCentsSatsUsdPattern2, } impl _10y1m1w1y2y3m3y4y5y6m6y8yPattern3 { /// Create a new pattern node with accumulated series name. pub fn new(client: Arc, acc: String) -> Self { Self { - _10y: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "10y")), - _1m: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "1m")), - _1w: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "1w")), - _1y: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "1y")), - _2y: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "2y")), - _3m: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "3m")), - _3y: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "3y")), - _4y: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "4y")), - _5y: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "5y")), - _6m: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "6m")), - _6y: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "6y")), - _8y: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "8y")), + _10y: BtcCentsSatsUsdPattern2::new(client.clone(), _m(&acc, "10y")), + _1m: BtcCentsSatsUsdPattern2::new(client.clone(), _m(&acc, "1m")), + _1w: BtcCentsSatsUsdPattern2::new(client.clone(), _m(&acc, "1w")), + _1y: BtcCentsSatsUsdPattern2::new(client.clone(), _m(&acc, "1y")), + _2y: BtcCentsSatsUsdPattern2::new(client.clone(), _m(&acc, "2y")), + _3m: BtcCentsSatsUsdPattern2::new(client.clone(), _m(&acc, "3m")), + _3y: BtcCentsSatsUsdPattern2::new(client.clone(), _m(&acc, "3y")), + _4y: BtcCentsSatsUsdPattern2::new(client.clone(), _m(&acc, "4y")), + _5y: BtcCentsSatsUsdPattern2::new(client.clone(), _m(&acc, "5y")), + _6m: BtcCentsSatsUsdPattern2::new(client.clone(), _m(&acc, "6m")), + _6y: BtcCentsSatsUsdPattern2::new(client.clone(), _m(&acc, "6y")), + _8y: BtcCentsSatsUsdPattern2::new(client.clone(), _m(&acc, "8y")), } } } @@ -1081,13 +1081,13 @@ pub struct CapGrossInvestorLossMvrvNetPeakPriceProfitSellSoprPattern { pub price: BpsCentsPercentilesRatioSatsSmaStdUsdPattern, pub profit: BaseCumulativeSumToPattern, pub profit_to_loss_ratio: _1m1w1y24hPattern, - pub sell_side_risk_ratio: _1m1w1y24hPattern6, + pub sell_side_risk_ratio: _1m1w1y24hPattern7, pub sopr: AdjustedRatioValuePattern, } /// Pattern struct for repeated tree structure. pub struct AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2 { - pub average: _1m1w1y24hPattern, + pub average: _1m1w1y24hPattern, pub base: SeriesPattern1, pub cumulative: SeriesPattern1, pub max: _1m1w1y24hPattern, @@ -1198,7 +1198,7 @@ impl AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3 { /// Pattern struct for repeated tree structure. pub struct AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern { - pub average: _1m1w1y24hPattern, + pub average: _1m1w1y24hPattern, pub max: _1m1w1y24hPattern, pub median: _1m1w1y24hPattern, pub min: _1m1w1y24hPattern, @@ -1443,11 +1443,11 @@ impl ActivityAddrOutputsRealizedSupplyUnrealizedPattern { /// Pattern struct for repeated tree structure. pub struct AverageBaseCumulativeInSumPattern { pub average: _1m1w1y24hPattern3, - pub base: BtcCentsSatsUsdPattern, - pub cumulative: BtcCentsSatsUsdPattern, + pub base: BtcCentsSatsUsdPattern2, + pub cumulative: BtcCentsSatsUsdPattern2, pub in_loss: AverageBaseCumulativeSumPattern3, pub in_profit: AverageBaseCumulativeSumPattern3, - pub sum: _1m1w1y24hPattern3, + pub sum: _1m1w1y24hPattern4, } impl AverageBaseCumulativeInSumPattern { @@ -1455,11 +1455,11 @@ impl AverageBaseCumulativeInSumPattern { pub fn new(client: Arc, acc: String) -> Self { Self { average: _1m1w1y24hPattern3::new(client.clone(), _m(&acc, "average")), - base: BtcCentsSatsUsdPattern::new(client.clone(), acc.clone()), - cumulative: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "cumulative")), + base: BtcCentsSatsUsdPattern2::new(client.clone(), acc.clone()), + cumulative: BtcCentsSatsUsdPattern2::new(client.clone(), _m(&acc, "cumulative")), in_loss: AverageBaseCumulativeSumPattern3::new(client.clone(), _m(&acc, "in_loss")), in_profit: AverageBaseCumulativeSumPattern3::new(client.clone(), _m(&acc, "in_profit")), - sum: _1m1w1y24hPattern3::new(client.clone(), _m(&acc, "sum")), + sum: _1m1w1y24hPattern4::new(client.clone(), _m(&acc, "sum")), } } } @@ -1470,7 +1470,7 @@ pub struct BaseChangeCumulativeDeltaSumToPattern { pub change_1m: ToPattern, pub cumulative: CentsUsdPattern, pub delta: AbsoluteRatePattern2, - pub sum: _1m1w1y24hPattern4, + pub sum: _1m1w1y24hPattern5, pub to_rcap: BpsPercentRatioPattern, } @@ -1482,7 +1482,7 @@ impl BaseChangeCumulativeDeltaSumToPattern { change_1m: ToPattern::new(client.clone(), _m(&acc, "pnl_change_1m_to")), cumulative: CentsUsdPattern::new(client.clone(), _m(&acc, "realized_pnl_cumulative")), delta: AbsoluteRatePattern2::new(client.clone(), _m(&acc, "realized_pnl_delta")), - sum: _1m1w1y24hPattern4::new(client.clone(), _m(&acc, "realized_pnl_sum")), + sum: _1m1w1y24hPattern5::new(client.clone(), _m(&acc, "realized_pnl_sum")), to_rcap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "realized_pnl_to_rcap")), } } @@ -1563,11 +1563,11 @@ impl CentsNegativeToUsdPattern2 { /// Pattern struct for repeated tree structure. pub struct DeltaHalfInToTotalPattern { pub delta: AbsoluteRatePattern, - pub half: BtcCentsSatsUsdPattern, + pub half: BtcCentsSatsUsdPattern2, pub in_loss: BtcCentsSatsToUsdPattern, pub in_profit: BtcCentsSatsToUsdPattern, pub to_circulating: BpsPercentRatioPattern3, - pub total: BtcCentsSatsUsdPattern, + pub total: BtcCentsSatsUsdPattern2, } impl DeltaHalfInToTotalPattern { @@ -1575,11 +1575,11 @@ impl DeltaHalfInToTotalPattern { pub fn new(client: Arc, acc: String) -> Self { Self { delta: AbsoluteRatePattern::new(client.clone(), _m(&acc, "delta")), - half: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "half")), + half: BtcCentsSatsUsdPattern2::new(client.clone(), _m(&acc, "half")), in_loss: BtcCentsSatsToUsdPattern::new(client.clone(), _m(&acc, "in_loss")), in_profit: BtcCentsSatsToUsdPattern::new(client.clone(), _m(&acc, "in_profit")), to_circulating: BpsPercentRatioPattern3::new(client.clone(), _m(&acc, "to_circulating")), - total: BtcCentsSatsUsdPattern::new(client.clone(), acc.clone()), + total: BtcCentsSatsUsdPattern2::new(client.clone(), acc.clone()), } } } @@ -1587,11 +1587,11 @@ impl DeltaHalfInToTotalPattern { /// Pattern struct for repeated tree structure. pub struct DeltaHalfInToTotalPattern2 { pub delta: AbsoluteRatePattern, - pub half: BtcCentsSatsUsdPattern, + pub half: BtcCentsSatsUsdPattern2, pub in_loss: BtcCentsSatsToUsdPattern3, pub in_profit: BtcCentsSatsToUsdPattern3, pub to_circulating: BpsPercentRatioPattern3, - pub total: BtcCentsSatsUsdPattern, + pub total: BtcCentsSatsUsdPattern2, } impl DeltaHalfInToTotalPattern2 { @@ -1599,11 +1599,11 @@ impl DeltaHalfInToTotalPattern2 { pub fn new(client: Arc, acc: String) -> Self { Self { delta: AbsoluteRatePattern::new(client.clone(), _m(&acc, "delta")), - half: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "half")), + half: BtcCentsSatsUsdPattern2::new(client.clone(), _m(&acc, "half")), in_loss: BtcCentsSatsToUsdPattern3::new(client.clone(), _m(&acc, "in_loss")), in_profit: BtcCentsSatsToUsdPattern3::new(client.clone(), _m(&acc, "in_profit")), to_circulating: BpsPercentRatioPattern3::new(client.clone(), _m(&acc, "to_circulating")), - total: BtcCentsSatsUsdPattern::new(client.clone(), acc.clone()), + total: BtcCentsSatsUsdPattern2::new(client.clone(), acc.clone()), } } } @@ -1632,6 +1632,28 @@ impl Pct1Pct2Pct5Pct95Pct98Pct99Pattern { } } +/// Pattern struct for repeated tree structure. +pub struct _1m1w1y24hBasePattern { + pub _1m: SeriesPattern1, + pub _1w: SeriesPattern1, + pub _1y: SeriesPattern1, + pub _24h: SeriesPattern1, + pub base: SeriesPattern18, +} + +impl _1m1w1y24hBasePattern { + /// Create a new pattern node with accumulated series name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + _1m: SeriesPattern1::new(client.clone(), _m(&acc, "average_1m")), + _1w: SeriesPattern1::new(client.clone(), _m(&acc, "average_1w")), + _1y: SeriesPattern1::new(client.clone(), _m(&acc, "average_1y")), + _24h: SeriesPattern1::new(client.clone(), _m(&acc, "average_24h")), + base: SeriesPattern18::new(client.clone(), acc.clone()), + } + } +} + /// Pattern struct for repeated tree structure. pub struct ActivityOutputsRealizedSupplyUnrealizedPattern { pub activity: CoindaysTransferPattern, @@ -1703,7 +1725,7 @@ pub struct BaseCumulativeNegativeSumToPattern { pub base: CentsUsdPattern2, pub cumulative: CentsUsdPattern2, pub negative: BaseSumPattern, - pub sum: _1m1w1y24hPattern5, + pub sum: _1m1w1y24hPattern6, pub to_rcap: BpsPercentRatioPattern4, } @@ -1842,10 +1864,10 @@ impl CentsToUsdPattern4 { /// Pattern struct for repeated tree structure. pub struct DeltaHalfInTotalPattern2 { pub delta: AbsoluteRatePattern, - pub half: BtcCentsSatsUsdPattern, - pub in_loss: BtcCentsSatsUsdPattern, - pub in_profit: BtcCentsSatsUsdPattern, - pub total: BtcCentsSatsUsdPattern, + pub half: BtcCentsSatsUsdPattern2, + pub in_loss: BtcCentsSatsUsdPattern2, + pub in_profit: BtcCentsSatsUsdPattern2, + pub total: BtcCentsSatsUsdPattern2, } impl DeltaHalfInTotalPattern2 { @@ -1853,10 +1875,10 @@ impl DeltaHalfInTotalPattern2 { pub fn new(client: Arc, acc: String) -> Self { Self { delta: AbsoluteRatePattern::new(client.clone(), _m(&acc, "delta")), - 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()), + half: BtcCentsSatsUsdPattern2::new(client.clone(), _m(&acc, "half")), + in_loss: BtcCentsSatsUsdPattern2::new(client.clone(), _m(&acc, "in_loss")), + in_profit: BtcCentsSatsUsdPattern2::new(client.clone(), _m(&acc, "in_profit")), + total: BtcCentsSatsUsdPattern2::new(client.clone(), acc.clone()), } } } @@ -1892,28 +1914,6 @@ impl PhsReboundThsPattern { } } -/// Pattern struct for repeated tree structure. -pub struct _1m1w1y24hBasePattern { - pub _1m: SeriesPattern1, - pub _1w: SeriesPattern1, - pub _1y: SeriesPattern1, - pub _24h: SeriesPattern1, - pub base: SeriesPattern18, -} - -impl _1m1w1y24hBasePattern { - /// Create a new pattern node with accumulated series name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - _1m: SeriesPattern1::new(client.clone(), _m(&acc, "average_1m")), - _1w: SeriesPattern1::new(client.clone(), _m(&acc, "average_1w")), - _1y: SeriesPattern1::new(client.clone(), _m(&acc, "average_1y")), - _24h: SeriesPattern1::new(client.clone(), _m(&acc, "average_24h")), - base: SeriesPattern18::new(client.clone(), acc.clone()), - } - } -} - /// Pattern struct for repeated tree structure. pub struct _1m1w1y24hPattern2 { pub _1m: BpsPercentRatioPattern, @@ -1935,14 +1935,14 @@ impl _1m1w1y24hPattern2 { } /// Pattern struct for repeated tree structure. -pub struct _1m1w1y24hPattern6 { +pub struct _1m1w1y24hPattern7 { pub _1m: BpsPercentRatioPattern4, pub _1w: BpsPercentRatioPattern4, pub _1y: BpsPercentRatioPattern4, pub _24h: BpsPercentRatioPattern4, } -impl _1m1w1y24hPattern6 { +impl _1m1w1y24hPattern7 { /// Create a new pattern node with accumulated series name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -1974,6 +1974,26 @@ impl _1m1w1y24hPattern3 { } } +/// Pattern struct for repeated tree structure. +pub struct _1m1w1y24hPattern4 { + pub _1m: BtcCentsSatsUsdPattern2, + pub _1w: BtcCentsSatsUsdPattern2, + pub _1y: BtcCentsSatsUsdPattern2, + pub _24h: BtcCentsSatsUsdPattern2, +} + +impl _1m1w1y24hPattern4 { + /// Create a new pattern node with accumulated series name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + _1m: BtcCentsSatsUsdPattern2::new(client.clone(), _m(&acc, "1m")), + _1w: BtcCentsSatsUsdPattern2::new(client.clone(), _m(&acc, "1w")), + _1y: BtcCentsSatsUsdPattern2::new(client.clone(), _m(&acc, "1y")), + _24h: BtcCentsSatsUsdPattern2::new(client.clone(), _m(&acc, "24h")), + } + } +} + /// Pattern struct for repeated tree structure. pub struct _1m1w1y2wPattern { pub _1m: CentsSatsUsdPattern, @@ -1995,14 +2015,14 @@ impl _1m1w1y2wPattern { } /// Pattern struct for repeated tree structure. -pub struct _1m1w1y24hPattern4 { +pub struct _1m1w1y24hPattern5 { pub _1m: CentsUsdPattern, pub _1w: CentsUsdPattern, pub _1y: CentsUsdPattern, pub _24h: CentsUsdPattern, } -impl _1m1w1y24hPattern4 { +impl _1m1w1y24hPattern5 { /// Create a new pattern node with accumulated series name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -2015,14 +2035,14 @@ impl _1m1w1y24hPattern4 { } /// Pattern struct for repeated tree structure. -pub struct _1m1w1y24hPattern5 { +pub struct _1m1w1y24hPattern6 { pub _1m: CentsUsdPattern2, pub _1w: CentsUsdPattern2, pub _1y: CentsUsdPattern2, pub _24h: CentsUsdPattern2, } -impl _1m1w1y24hPattern5 { +impl _1m1w1y24hPattern6 { /// Create a new pattern node with accumulated series name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -2044,7 +2064,7 @@ pub struct _1y2y4yAllPattern { /// Pattern struct for repeated tree structure. pub struct AverageBaseCumulativeSumPattern2 { - pub average: _1m1w1y24hPattern, + pub average: _1m1w1y24hPattern, pub base: SeriesPattern1, pub cumulative: SeriesPattern1, pub sum: _1m1w1y24hPattern, @@ -2065,9 +2085,9 @@ impl AverageBaseCumulativeSumPattern2 { /// Pattern struct for repeated tree structure. pub struct AverageBaseCumulativeSumPattern3 { pub average: _1m1w1y24hPattern3, - pub base: BtcCentsSatsUsdPattern, - pub cumulative: BtcCentsSatsUsdPattern, - pub sum: _1m1w1y24hPattern3, + pub base: BtcCentsSatsUsdPattern2, + pub cumulative: BtcCentsSatsUsdPattern2, + pub sum: _1m1w1y24hPattern4, } impl AverageBaseCumulativeSumPattern3 { @@ -2075,9 +2095,9 @@ impl AverageBaseCumulativeSumPattern3 { pub fn new(client: Arc, acc: String) -> Self { Self { average: _1m1w1y24hPattern3::new(client.clone(), _m(&acc, "average")), - base: BtcCentsSatsUsdPattern::new(client.clone(), acc.clone()), - cumulative: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "cumulative")), - sum: _1m1w1y24hPattern3::new(client.clone(), _m(&acc, "sum")), + base: BtcCentsSatsUsdPattern2::new(client.clone(), acc.clone()), + cumulative: BtcCentsSatsUsdPattern2::new(client.clone(), _m(&acc, "cumulative")), + sum: _1m1w1y24hPattern4::new(client.clone(), _m(&acc, "sum")), } } } @@ -2087,7 +2107,7 @@ pub struct BaseCumulativeDeltaSumPattern { pub base: CentsUsdPattern, pub cumulative: CentsUsdPattern, pub delta: AbsoluteRatePattern2, - pub sum: _1m1w1y24hPattern4, + pub sum: _1m1w1y24hPattern5, } impl BaseCumulativeDeltaSumPattern { @@ -2097,7 +2117,7 @@ impl BaseCumulativeDeltaSumPattern { base: CentsUsdPattern::new(client.clone(), acc.clone()), cumulative: CentsUsdPattern::new(client.clone(), _m(&acc, "cumulative")), delta: AbsoluteRatePattern2::new(client.clone(), _m(&acc, "delta")), - sum: _1m1w1y24hPattern4::new(client.clone(), _m(&acc, "sum")), + sum: _1m1w1y24hPattern5::new(client.clone(), _m(&acc, "sum")), } } } @@ -2107,7 +2127,7 @@ pub struct BaseCumulativeNegativeSumPattern { pub base: CentsUsdPattern2, pub cumulative: CentsUsdPattern2, pub negative: BaseSumPattern, - pub sum: _1m1w1y24hPattern5, + pub sum: _1m1w1y24hPattern6, } impl BaseCumulativeNegativeSumPattern { @@ -2117,7 +2137,7 @@ impl BaseCumulativeNegativeSumPattern { base: CentsUsdPattern2::new(client.clone(), _m(&acc, "realized_loss")), cumulative: CentsUsdPattern2::new(client.clone(), _m(&acc, "realized_loss_cumulative")), negative: BaseSumPattern::new(client.clone(), _m(&acc, "neg_realized_loss")), - sum: _1m1w1y24hPattern5::new(client.clone(), _m(&acc, "realized_loss_sum")), + sum: _1m1w1y24hPattern6::new(client.clone(), _m(&acc, "realized_loss_sum")), } } } @@ -2126,7 +2146,7 @@ impl BaseCumulativeNegativeSumPattern { pub struct BaseCumulativeSumToPattern { pub base: CentsUsdPattern2, pub cumulative: CentsUsdPattern2, - pub sum: _1m1w1y24hPattern5, + pub sum: _1m1w1y24hPattern6, pub to_rcap: BpsPercentRatioPattern4, } @@ -2136,7 +2156,7 @@ impl BaseCumulativeSumToPattern { Self { base: CentsUsdPattern2::new(client.clone(), acc.clone()), cumulative: CentsUsdPattern2::new(client.clone(), _m(&acc, "cumulative")), - sum: _1m1w1y24hPattern5::new(client.clone(), _m(&acc, "sum")), + sum: _1m1w1y24hPattern6::new(client.clone(), _m(&acc, "sum")), to_rcap: BpsPercentRatioPattern4::new(client.clone(), _m(&acc, "to_rcap")), } } @@ -2144,10 +2164,10 @@ impl BaseCumulativeSumToPattern { /// Pattern struct for repeated tree structure. pub struct BothReactivatedReceivingSendingPattern { - pub both: _1m1w1y24hBasePattern, - pub reactivated: _1m1w1y24hBasePattern, - pub receiving: _1m1w1y24hBasePattern, - pub sending: _1m1w1y24hBasePattern, + pub both: _1m1w1y24hBasePattern, + pub reactivated: _1m1w1y24hBasePattern, + pub receiving: _1m1w1y24hBasePattern, + pub sending: _1m1w1y24hBasePattern, } impl BothReactivatedReceivingSendingPattern { @@ -2163,13 +2183,33 @@ impl BothReactivatedReceivingSendingPattern { } /// Pattern struct for repeated tree structure. -pub struct BtcCentsSatsUsdPattern { +pub struct BtcCentsSatsUsdPattern2 { pub btc: SeriesPattern1, pub cents: SeriesPattern1, pub sats: SeriesPattern1, pub usd: SeriesPattern1, } +impl BtcCentsSatsUsdPattern2 { + /// Create a new pattern node with accumulated series name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + btc: SeriesPattern1::new(client.clone(), acc.clone()), + cents: SeriesPattern1::new(client.clone(), _m(&acc, "cents")), + sats: SeriesPattern1::new(client.clone(), _m(&acc, "sats")), + usd: SeriesPattern1::new(client.clone(), _m(&acc, "usd")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct BtcCentsSatsUsdPattern { + pub btc: SeriesPattern1, + pub cents: SeriesPattern1, + pub sats: SeriesPattern1, + pub usd: SeriesPattern1, +} + impl BtcCentsSatsUsdPattern { /// Create a new pattern node with accumulated series name. pub fn new(client: Arc, acc: String) -> Self { @@ -2301,7 +2341,7 @@ pub struct AdjustedRatioValuePattern { pub struct BaseCumulativeSumPattern { pub base: CentsUsdPattern2, pub cumulative: CentsUsdPattern2, - pub sum: _1m1w1y24hPattern5, + pub sum: _1m1w1y24hPattern6, } impl BaseCumulativeSumPattern { @@ -2310,7 +2350,7 @@ impl BaseCumulativeSumPattern { Self { base: CentsUsdPattern2::new(client.clone(), acc.clone()), cumulative: CentsUsdPattern2::new(client.clone(), _m(&acc, "cumulative")), - sum: _1m1w1y24hPattern5::new(client.clone(), _m(&acc, "sum")), + sum: _1m1w1y24hPattern6::new(client.clone(), _m(&acc, "sum")), } } } @@ -2516,8 +2556,8 @@ impl CumulativeRollingSumPattern { /// Pattern struct for repeated tree structure. pub struct DeltaHalfTotalPattern { pub delta: AbsoluteRatePattern, - pub half: BtcCentsSatsUsdPattern, - pub total: BtcCentsSatsUsdPattern, + pub half: BtcCentsSatsUsdPattern2, + pub total: BtcCentsSatsUsdPattern2, } impl DeltaHalfTotalPattern { @@ -2525,8 +2565,8 @@ impl DeltaHalfTotalPattern { pub fn new(client: Arc, acc: String) -> Self { Self { delta: AbsoluteRatePattern::new(client.clone(), _m(&acc, "delta")), - half: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "half")), - total: BtcCentsSatsUsdPattern::new(client.clone(), acc.clone()), + half: BtcCentsSatsUsdPattern2::new(client.clone(), _m(&acc, "half")), + total: BtcCentsSatsUsdPattern2::new(client.clone(), acc.clone()), } } } @@ -2617,7 +2657,7 @@ impl AbsoluteRatePattern { /// Pattern struct for repeated tree structure. pub struct AbsoluteRatePattern2 { - pub absolute: _1m1w1y24hPattern4, + pub absolute: _1m1w1y24hPattern5, pub rate: _1m1w1y24hPattern2, } @@ -2625,7 +2665,7 @@ impl AbsoluteRatePattern2 { /// Create a new pattern node with accumulated series name. pub fn new(client: Arc, acc: String) -> Self { Self { - absolute: _1m1w1y24hPattern4::new(client.clone(), acc.clone()), + absolute: _1m1w1y24hPattern5::new(client.clone(), acc.clone()), rate: _1m1w1y24hPattern2::new(client.clone(), acc.clone()), } } @@ -2634,7 +2674,7 @@ impl AbsoluteRatePattern2 { /// Pattern struct for repeated tree structure. pub struct AllSthPattern2 { pub all: BtcCentsDeltaSatsUsdPattern, - pub sth: BtcCentsSatsUsdPattern, + pub sth: BtcCentsSatsUsdPattern2, } impl AllSthPattern2 { @@ -2642,7 +2682,7 @@ impl AllSthPattern2 { pub fn new(client: Arc, acc: String) -> Self { Self { all: BtcCentsDeltaSatsUsdPattern::new(client.clone(), _m(&acc, "supply")), - sth: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "sth_supply")), + sth: BtcCentsSatsUsdPattern2::new(client.clone(), _m(&acc, "sth_supply")), } } } @@ -3003,7 +3043,7 @@ pub struct SeriesTree_Blocks { pub weight: SeriesTree_Blocks_Weight, pub count: SeriesTree_Blocks_Count, pub lookback: SeriesTree_Blocks_Lookback, - pub interval: _1m1w1y24hBasePattern, + pub interval: SeriesTree_Blocks_Interval, pub vbytes: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2, pub fullness: SeriesTree_Blocks_Fullness, pub halving: SeriesTree_Blocks_Halving, @@ -3019,7 +3059,7 @@ impl SeriesTree_Blocks { weight: SeriesTree_Blocks_Weight::new(client.clone(), format!("{base_path}_weight")), count: SeriesTree_Blocks_Count::new(client.clone(), format!("{base_path}_count")), lookback: SeriesTree_Blocks_Lookback::new(client.clone(), format!("{base_path}_lookback")), - interval: _1m1w1y24hBasePattern::new(client.clone(), "block_interval".to_string()), + interval: SeriesTree_Blocks_Interval::new(client.clone(), format!("{base_path}_interval")), vbytes: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), "block_vbytes".to_string()), fullness: SeriesTree_Blocks_Fullness::new(client.clone(), format!("{base_path}_fullness")), halving: SeriesTree_Blocks_Halving::new(client.clone(), format!("{base_path}_halving")), @@ -3072,7 +3112,7 @@ pub struct SeriesTree_Blocks_Size { pub base: SeriesPattern18, pub cumulative: SeriesPattern1, pub sum: _1m1w1y24hPattern, - pub average: _1m1w1y24hPattern, + pub average: _1m1w1y24hPattern, pub min: _1m1w1y24hPattern, pub max: _1m1w1y24hPattern, pub pct10: _1m1w1y24hPattern, @@ -3105,7 +3145,7 @@ pub struct SeriesTree_Blocks_Weight { pub base: SeriesPattern18, pub cumulative: SeriesPattern1, pub sum: _1m1w1y24hPattern, - pub average: _1m1w1y24hPattern, + pub average: _1m1w1y24hPattern, pub min: _1m1w1y24hPattern, pub max: _1m1w1y24hPattern, pub pct10: _1m1w1y24hPattern, @@ -3245,6 +3285,27 @@ impl SeriesTree_Blocks_Lookback { } } +/// Series tree node. +pub struct SeriesTree_Blocks_Interval { + pub base: SeriesPattern18, + pub _24h: SeriesPattern1, + pub _1w: SeriesPattern1, + pub _1m: SeriesPattern1, + pub _1y: SeriesPattern1, +} + +impl SeriesTree_Blocks_Interval { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + base: SeriesPattern18::new(client.clone(), "block_interval".to_string()), + _24h: SeriesPattern1::new(client.clone(), "block_interval_average_24h".to_string()), + _1w: SeriesPattern1::new(client.clone(), "block_interval_average_1w".to_string()), + _1m: SeriesPattern1::new(client.clone(), "block_interval_average_1m".to_string()), + _1y: SeriesPattern1::new(client.clone(), "block_interval_average_1y".to_string()), + } + } +} + /// Series tree node. pub struct SeriesTree_Blocks_Fullness { pub bps: SeriesPattern18, @@ -4043,9 +4104,9 @@ impl SeriesTree_Mining_Rewards { /// Series tree node. pub struct SeriesTree_Mining_Rewards_Subsidy { - pub base: BtcCentsSatsUsdPattern, - pub cumulative: BtcCentsSatsUsdPattern, - pub sum: _1m1w1y24hPattern3, + pub base: BtcCentsSatsUsdPattern2, + pub cumulative: BtcCentsSatsUsdPattern2, + pub sum: _1m1w1y24hPattern4, pub average: _1m1w1y24hPattern3, pub dominance: _1m1w1y24hBpsPercentRatioPattern, pub sma_1y: CentsUsdPattern2, @@ -4054,9 +4115,9 @@ pub struct SeriesTree_Mining_Rewards_Subsidy { impl SeriesTree_Mining_Rewards_Subsidy { pub fn new(client: Arc, base_path: String) -> Self { Self { - base: BtcCentsSatsUsdPattern::new(client.clone(), "subsidy".to_string()), - cumulative: BtcCentsSatsUsdPattern::new(client.clone(), "subsidy_cumulative".to_string()), - sum: _1m1w1y24hPattern3::new(client.clone(), "subsidy_sum".to_string()), + base: BtcCentsSatsUsdPattern2::new(client.clone(), "subsidy".to_string()), + cumulative: BtcCentsSatsUsdPattern2::new(client.clone(), "subsidy_cumulative".to_string()), + sum: _1m1w1y24hPattern4::new(client.clone(), "subsidy_sum".to_string()), average: _1m1w1y24hPattern3::new(client.clone(), "subsidy_average".to_string()), dominance: _1m1w1y24hBpsPercentRatioPattern::new(client.clone(), "subsidy_dominance".to_string()), sma_1y: CentsUsdPattern2::new(client.clone(), "subsidy_sma_1y".to_string()), @@ -4066,17 +4127,17 @@ impl SeriesTree_Mining_Rewards_Subsidy { /// Series tree node. pub struct SeriesTree_Mining_Rewards_Fees { - pub base: BtcCentsSatsUsdPattern, - pub cumulative: BtcCentsSatsUsdPattern, - pub sum: _1m1w1y24hPattern3, + pub base: BtcCentsSatsUsdPattern2, + pub cumulative: BtcCentsSatsUsdPattern2, + pub sum: _1m1w1y24hPattern4, pub average: _1m1w1y24hPattern3, - pub min: _1m1w1y24hPattern3, - pub max: _1m1w1y24hPattern3, - pub pct10: _1m1w1y24hPattern3, - pub pct25: _1m1w1y24hPattern3, - pub median: _1m1w1y24hPattern3, - pub pct75: _1m1w1y24hPattern3, - pub pct90: _1m1w1y24hPattern3, + pub min: _1m1w1y24hPattern4, + pub max: _1m1w1y24hPattern4, + pub pct10: _1m1w1y24hPattern4, + pub pct25: _1m1w1y24hPattern4, + pub median: _1m1w1y24hPattern4, + pub pct75: _1m1w1y24hPattern4, + pub pct90: _1m1w1y24hPattern4, pub dominance: _1m1w1y24hBpsPercentRatioPattern, pub to_subsidy_ratio: SeriesTree_Mining_Rewards_Fees_ToSubsidyRatio, } @@ -4084,17 +4145,17 @@ pub struct SeriesTree_Mining_Rewards_Fees { impl SeriesTree_Mining_Rewards_Fees { pub fn new(client: Arc, base_path: String) -> Self { Self { - base: BtcCentsSatsUsdPattern::new(client.clone(), "fees".to_string()), - cumulative: BtcCentsSatsUsdPattern::new(client.clone(), "fees_cumulative".to_string()), - sum: _1m1w1y24hPattern3::new(client.clone(), "fees_sum".to_string()), + base: BtcCentsSatsUsdPattern2::new(client.clone(), "fees".to_string()), + cumulative: BtcCentsSatsUsdPattern2::new(client.clone(), "fees_cumulative".to_string()), + sum: _1m1w1y24hPattern4::new(client.clone(), "fees_sum".to_string()), average: _1m1w1y24hPattern3::new(client.clone(), "fees_average".to_string()), - min: _1m1w1y24hPattern3::new(client.clone(), "fees_min".to_string()), - max: _1m1w1y24hPattern3::new(client.clone(), "fees_max".to_string()), - pct10: _1m1w1y24hPattern3::new(client.clone(), "fees_pct10".to_string()), - pct25: _1m1w1y24hPattern3::new(client.clone(), "fees_pct25".to_string()), - median: _1m1w1y24hPattern3::new(client.clone(), "fees_median".to_string()), - pct75: _1m1w1y24hPattern3::new(client.clone(), "fees_pct75".to_string()), - pct90: _1m1w1y24hPattern3::new(client.clone(), "fees_pct90".to_string()), + min: _1m1w1y24hPattern4::new(client.clone(), "fees_min".to_string()), + max: _1m1w1y24hPattern4::new(client.clone(), "fees_max".to_string()), + pct10: _1m1w1y24hPattern4::new(client.clone(), "fees_pct10".to_string()), + pct25: _1m1w1y24hPattern4::new(client.clone(), "fees_pct25".to_string()), + median: _1m1w1y24hPattern4::new(client.clone(), "fees_median".to_string()), + pct75: _1m1w1y24hPattern4::new(client.clone(), "fees_pct75".to_string()), + pct90: _1m1w1y24hPattern4::new(client.clone(), "fees_pct90".to_string()), dominance: _1m1w1y24hBpsPercentRatioPattern::new(client.clone(), "fee_dominance".to_string()), to_subsidy_ratio: SeriesTree_Mining_Rewards_Fees_ToSubsidyRatio::new(client.clone(), format!("{base_path}_to_subsidy_ratio")), } @@ -4122,15 +4183,15 @@ impl SeriesTree_Mining_Rewards_Fees_ToSubsidyRatio { /// Series tree node. pub struct SeriesTree_Mining_Rewards_Unclaimed { - pub base: BtcCentsSatsUsdPattern, - pub cumulative: BtcCentsSatsUsdPattern, + pub base: BtcCentsSatsUsdPattern2, + pub cumulative: BtcCentsSatsUsdPattern2, } impl SeriesTree_Mining_Rewards_Unclaimed { pub fn new(client: Arc, base_path: String) -> Self { Self { - base: BtcCentsSatsUsdPattern::new(client.clone(), "unclaimed_rewards".to_string()), - cumulative: BtcCentsSatsUsdPattern::new(client.clone(), "unclaimed_rewards_cumulative".to_string()), + base: BtcCentsSatsUsdPattern2::new(client.clone(), "unclaimed_rewards".to_string()), + cumulative: BtcCentsSatsUsdPattern2::new(client.clone(), "unclaimed_rewards_cumulative".to_string()), } } } @@ -4255,15 +4316,15 @@ impl SeriesTree_Cointime_Activity { /// Series tree node. pub struct SeriesTree_Cointime_Supply { - pub vaulted: BtcCentsSatsUsdPattern, - pub active: BtcCentsSatsUsdPattern, + pub vaulted: BtcCentsSatsUsdPattern2, + pub active: BtcCentsSatsUsdPattern2, } impl SeriesTree_Cointime_Supply { pub fn new(client: Arc, base_path: String) -> Self { Self { - vaulted: BtcCentsSatsUsdPattern::new(client.clone(), "vaulted_supply".to_string()), - active: BtcCentsSatsUsdPattern::new(client.clone(), "active_supply".to_string()), + vaulted: BtcCentsSatsUsdPattern2::new(client.clone(), "vaulted_supply".to_string()), + active: BtcCentsSatsUsdPattern2::new(client.clone(), "active_supply".to_string()), } } } @@ -5529,35 +5590,35 @@ impl SeriesTree_Market_Dca_Class { /// Series tree node. pub struct SeriesTree_Market_Dca_Class_Stack { - pub from_2015: BtcCentsSatsUsdPattern, - pub from_2016: BtcCentsSatsUsdPattern, - pub from_2017: BtcCentsSatsUsdPattern, - pub from_2018: BtcCentsSatsUsdPattern, - pub from_2019: BtcCentsSatsUsdPattern, - pub from_2020: BtcCentsSatsUsdPattern, - pub from_2021: BtcCentsSatsUsdPattern, - pub from_2022: BtcCentsSatsUsdPattern, - pub from_2023: BtcCentsSatsUsdPattern, - pub from_2024: BtcCentsSatsUsdPattern, - pub from_2025: BtcCentsSatsUsdPattern, - pub from_2026: BtcCentsSatsUsdPattern, + pub from_2015: BtcCentsSatsUsdPattern2, + pub from_2016: BtcCentsSatsUsdPattern2, + pub from_2017: BtcCentsSatsUsdPattern2, + pub from_2018: BtcCentsSatsUsdPattern2, + pub from_2019: BtcCentsSatsUsdPattern2, + pub from_2020: BtcCentsSatsUsdPattern2, + pub from_2021: BtcCentsSatsUsdPattern2, + pub from_2022: BtcCentsSatsUsdPattern2, + pub from_2023: BtcCentsSatsUsdPattern2, + pub from_2024: BtcCentsSatsUsdPattern2, + pub from_2025: BtcCentsSatsUsdPattern2, + pub from_2026: BtcCentsSatsUsdPattern2, } impl SeriesTree_Market_Dca_Class_Stack { pub fn new(client: Arc, base_path: String) -> Self { Self { - from_2015: BtcCentsSatsUsdPattern::new(client.clone(), "dca_stack_from_2015".to_string()), - from_2016: BtcCentsSatsUsdPattern::new(client.clone(), "dca_stack_from_2016".to_string()), - from_2017: BtcCentsSatsUsdPattern::new(client.clone(), "dca_stack_from_2017".to_string()), - from_2018: BtcCentsSatsUsdPattern::new(client.clone(), "dca_stack_from_2018".to_string()), - from_2019: BtcCentsSatsUsdPattern::new(client.clone(), "dca_stack_from_2019".to_string()), - from_2020: BtcCentsSatsUsdPattern::new(client.clone(), "dca_stack_from_2020".to_string()), - from_2021: BtcCentsSatsUsdPattern::new(client.clone(), "dca_stack_from_2021".to_string()), - from_2022: BtcCentsSatsUsdPattern::new(client.clone(), "dca_stack_from_2022".to_string()), - from_2023: BtcCentsSatsUsdPattern::new(client.clone(), "dca_stack_from_2023".to_string()), - from_2024: BtcCentsSatsUsdPattern::new(client.clone(), "dca_stack_from_2024".to_string()), - from_2025: BtcCentsSatsUsdPattern::new(client.clone(), "dca_stack_from_2025".to_string()), - from_2026: BtcCentsSatsUsdPattern::new(client.clone(), "dca_stack_from_2026".to_string()), + from_2015: BtcCentsSatsUsdPattern2::new(client.clone(), "dca_stack_from_2015".to_string()), + from_2016: BtcCentsSatsUsdPattern2::new(client.clone(), "dca_stack_from_2016".to_string()), + from_2017: BtcCentsSatsUsdPattern2::new(client.clone(), "dca_stack_from_2017".to_string()), + from_2018: BtcCentsSatsUsdPattern2::new(client.clone(), "dca_stack_from_2018".to_string()), + from_2019: BtcCentsSatsUsdPattern2::new(client.clone(), "dca_stack_from_2019".to_string()), + from_2020: BtcCentsSatsUsdPattern2::new(client.clone(), "dca_stack_from_2020".to_string()), + from_2021: BtcCentsSatsUsdPattern2::new(client.clone(), "dca_stack_from_2021".to_string()), + from_2022: BtcCentsSatsUsdPattern2::new(client.clone(), "dca_stack_from_2022".to_string()), + from_2023: BtcCentsSatsUsdPattern2::new(client.clone(), "dca_stack_from_2023".to_string()), + from_2024: BtcCentsSatsUsdPattern2::new(client.clone(), "dca_stack_from_2024".to_string()), + from_2025: BtcCentsSatsUsdPattern2::new(client.clone(), "dca_stack_from_2025".to_string()), + from_2026: BtcCentsSatsUsdPattern2::new(client.clone(), "dca_stack_from_2026".to_string()), } } } @@ -6186,26 +6247,26 @@ impl SeriesTree_Prices_Spot { /// Series tree node. pub struct SeriesTree_Supply { pub state: SeriesPattern18, - pub circulating: BtcCentsSatsUsdPattern, + pub circulating: BtcCentsSatsUsdPattern2, pub burned: AverageBaseCumulativeSumPattern3, pub inflation_rate: BpsPercentRatioPattern, pub velocity: SeriesTree_Supply_Velocity, pub market_cap: CentsDeltaUsdPattern, pub market_minus_realized_cap_growth_rate: _1m1w1y24hPattern, - pub hodled_or_lost: BtcCentsSatsUsdPattern, + pub hodled_or_lost: BtcCentsSatsUsdPattern2, } impl SeriesTree_Supply { pub fn new(client: Arc, base_path: String) -> Self { Self { state: SeriesPattern18::new(client.clone(), "supply_state".to_string()), - circulating: BtcCentsSatsUsdPattern::new(client.clone(), "circulating_supply".to_string()), + circulating: BtcCentsSatsUsdPattern2::new(client.clone(), "circulating_supply".to_string()), burned: AverageBaseCumulativeSumPattern3::new(client.clone(), "unspendable_supply".to_string()), inflation_rate: BpsPercentRatioPattern::new(client.clone(), "inflation_rate".to_string()), velocity: SeriesTree_Supply_Velocity::new(client.clone(), format!("{base_path}_velocity")), market_cap: CentsDeltaUsdPattern::new(client.clone(), "market_cap".to_string()), market_minus_realized_cap_growth_rate: _1m1w1y24hPattern::new(client.clone(), "market_minus_realized_cap_growth_rate".to_string()), - hodled_or_lost: BtcCentsSatsUsdPattern::new(client.clone(), "hodled_or_lost_supply".to_string()), + hodled_or_lost: BtcCentsSatsUsdPattern2::new(client.clone(), "hodled_or_lost_supply".to_string()), } } } @@ -6304,8 +6365,8 @@ impl SeriesTree_Cohorts_Utxo_All { /// Series tree node. pub struct SeriesTree_Cohorts_Utxo_All_Supply { - pub total: BtcCentsSatsUsdPattern, - pub half: BtcCentsSatsUsdPattern, + pub total: BtcCentsSatsUsdPattern2, + pub half: BtcCentsSatsUsdPattern2, pub delta: AbsoluteRatePattern, pub in_profit: BtcCentsSatsToUsdPattern2, pub in_loss: BtcCentsSatsToUsdPattern2, @@ -6314,8 +6375,8 @@ pub struct SeriesTree_Cohorts_Utxo_All_Supply { impl SeriesTree_Cohorts_Utxo_All_Supply { pub fn new(client: Arc, base_path: String) -> Self { Self { - total: BtcCentsSatsUsdPattern::new(client.clone(), "supply".to_string()), - half: BtcCentsSatsUsdPattern::new(client.clone(), "supply_half".to_string()), + total: BtcCentsSatsUsdPattern2::new(client.clone(), "supply".to_string()), + half: BtcCentsSatsUsdPattern2::new(client.clone(), "supply_half".to_string()), delta: AbsoluteRatePattern::new(client.clone(), "supply_delta".to_string()), in_profit: BtcCentsSatsToUsdPattern2::new(client.clone(), "supply_in_profit".to_string()), in_loss: BtcCentsSatsToUsdPattern2::new(client.clone(), "supply_in_loss".to_string()), @@ -6352,7 +6413,7 @@ pub struct SeriesTree_Cohorts_Utxo_All_Realized { pub net_pnl: BaseChangeCumulativeDeltaSumToPattern, pub sopr: SeriesTree_Cohorts_Utxo_All_Realized_Sopr, pub gross_pnl: BaseCumulativeSumPattern, - pub sell_side_risk_ratio: _1m1w1y24hPattern6, + pub sell_side_risk_ratio: _1m1w1y24hPattern7, pub peak_regret: BaseCumulativeSumToPattern, pub investor: PricePattern, pub profit_to_loss_ratio: _1m1w1y24hPattern, @@ -6369,7 +6430,7 @@ impl SeriesTree_Cohorts_Utxo_All_Realized { net_pnl: BaseChangeCumulativeDeltaSumToPattern::new(client.clone(), "net".to_string()), sopr: SeriesTree_Cohorts_Utxo_All_Realized_Sopr::new(client.clone(), format!("{base_path}_sopr")), gross_pnl: BaseCumulativeSumPattern::new(client.clone(), "realized_gross_pnl".to_string()), - sell_side_risk_ratio: _1m1w1y24hPattern6::new(client.clone(), "sell_side_risk_ratio".to_string()), + sell_side_risk_ratio: _1m1w1y24hPattern7::new(client.clone(), "sell_side_risk_ratio".to_string()), peak_regret: BaseCumulativeSumToPattern::new(client.clone(), "realized_peak_regret".to_string()), investor: PricePattern::new(client.clone(), "investor_price".to_string()), profit_to_loss_ratio: _1m1w1y24hPattern::new(client.clone(), "realized_profit_to_loss_ratio".to_string()), @@ -6381,7 +6442,7 @@ impl SeriesTree_Cohorts_Utxo_All_Realized { pub struct SeriesTree_Cohorts_Utxo_All_Realized_Loss { pub base: CentsUsdPattern2, pub cumulative: CentsUsdPattern2, - pub sum: _1m1w1y24hPattern5, + pub sum: _1m1w1y24hPattern6, pub negative: BaseSumPattern, pub to_rcap: BpsPercentRatioPattern4, } @@ -6391,7 +6452,7 @@ impl SeriesTree_Cohorts_Utxo_All_Realized_Loss { Self { base: CentsUsdPattern2::new(client.clone(), "realized_loss".to_string()), cumulative: CentsUsdPattern2::new(client.clone(), "realized_loss_cumulative".to_string()), - sum: _1m1w1y24hPattern5::new(client.clone(), "realized_loss_sum".to_string()), + sum: _1m1w1y24hPattern6::new(client.clone(), "realized_loss_sum".to_string()), negative: BaseSumPattern::new(client.clone(), "neg_realized_loss".to_string()), to_rcap: BpsPercentRatioPattern4::new(client.clone(), "realized_loss_to_rcap".to_string()), } @@ -6822,7 +6883,7 @@ pub struct SeriesTree_Cohorts_Utxo_Sth_Realized { pub net_pnl: BaseChangeCumulativeDeltaSumToPattern, pub sopr: SeriesTree_Cohorts_Utxo_Sth_Realized_Sopr, pub gross_pnl: BaseCumulativeSumPattern, - pub sell_side_risk_ratio: _1m1w1y24hPattern6, + pub sell_side_risk_ratio: _1m1w1y24hPattern7, pub peak_regret: BaseCumulativeSumToPattern, pub investor: PricePattern, pub profit_to_loss_ratio: _1m1w1y24hPattern, @@ -6839,7 +6900,7 @@ impl SeriesTree_Cohorts_Utxo_Sth_Realized { net_pnl: BaseChangeCumulativeDeltaSumToPattern::new(client.clone(), "sth_net".to_string()), sopr: SeriesTree_Cohorts_Utxo_Sth_Realized_Sopr::new(client.clone(), format!("{base_path}_sopr")), gross_pnl: BaseCumulativeSumPattern::new(client.clone(), "sth_realized_gross_pnl".to_string()), - sell_side_risk_ratio: _1m1w1y24hPattern6::new(client.clone(), "sth_sell_side_risk_ratio".to_string()), + sell_side_risk_ratio: _1m1w1y24hPattern7::new(client.clone(), "sth_sell_side_risk_ratio".to_string()), peak_regret: BaseCumulativeSumToPattern::new(client.clone(), "sth_realized_peak_regret".to_string()), investor: PricePattern::new(client.clone(), "sth_investor_price".to_string()), profit_to_loss_ratio: _1m1w1y24hPattern::new(client.clone(), "sth_realized_profit_to_loss_ratio".to_string()), @@ -6851,7 +6912,7 @@ impl SeriesTree_Cohorts_Utxo_Sth_Realized { pub struct SeriesTree_Cohorts_Utxo_Sth_Realized_Loss { pub base: CentsUsdPattern2, pub cumulative: CentsUsdPattern2, - pub sum: _1m1w1y24hPattern5, + pub sum: _1m1w1y24hPattern6, pub negative: BaseSumPattern, pub to_rcap: BpsPercentRatioPattern4, } @@ -6861,7 +6922,7 @@ impl SeriesTree_Cohorts_Utxo_Sth_Realized_Loss { Self { base: CentsUsdPattern2::new(client.clone(), "sth_realized_loss".to_string()), cumulative: CentsUsdPattern2::new(client.clone(), "sth_realized_loss_cumulative".to_string()), - sum: _1m1w1y24hPattern5::new(client.clone(), "sth_realized_loss_sum".to_string()), + sum: _1m1w1y24hPattern6::new(client.clone(), "sth_realized_loss_sum".to_string()), negative: BaseSumPattern::new(client.clone(), "sth_neg_realized_loss".to_string()), to_rcap: BpsPercentRatioPattern4::new(client.clone(), "sth_realized_loss_to_rcap".to_string()), } @@ -7235,7 +7296,7 @@ pub struct SeriesTree_Cohorts_Utxo_Lth_Realized { pub net_pnl: BaseChangeCumulativeDeltaSumToPattern, pub sopr: SeriesTree_Cohorts_Utxo_Lth_Realized_Sopr, pub gross_pnl: BaseCumulativeSumPattern, - pub sell_side_risk_ratio: _1m1w1y24hPattern6, + pub sell_side_risk_ratio: _1m1w1y24hPattern7, pub peak_regret: BaseCumulativeSumToPattern, pub investor: PricePattern, pub profit_to_loss_ratio: _1m1w1y24hPattern, @@ -7252,7 +7313,7 @@ impl SeriesTree_Cohorts_Utxo_Lth_Realized { net_pnl: BaseChangeCumulativeDeltaSumToPattern::new(client.clone(), "lth_net".to_string()), sopr: SeriesTree_Cohorts_Utxo_Lth_Realized_Sopr::new(client.clone(), format!("{base_path}_sopr")), gross_pnl: BaseCumulativeSumPattern::new(client.clone(), "lth_realized_gross_pnl".to_string()), - sell_side_risk_ratio: _1m1w1y24hPattern6::new(client.clone(), "lth_sell_side_risk_ratio".to_string()), + sell_side_risk_ratio: _1m1w1y24hPattern7::new(client.clone(), "lth_sell_side_risk_ratio".to_string()), peak_regret: BaseCumulativeSumToPattern::new(client.clone(), "lth_realized_peak_regret".to_string()), investor: PricePattern::new(client.clone(), "lth_investor_price".to_string()), profit_to_loss_ratio: _1m1w1y24hPattern::new(client.clone(), "lth_realized_profit_to_loss_ratio".to_string()), @@ -7264,7 +7325,7 @@ impl SeriesTree_Cohorts_Utxo_Lth_Realized { pub struct SeriesTree_Cohorts_Utxo_Lth_Realized_Loss { pub base: CentsUsdPattern2, pub cumulative: CentsUsdPattern2, - pub sum: _1m1w1y24hPattern5, + pub sum: _1m1w1y24hPattern6, pub negative: BaseSumPattern, pub to_rcap: BpsPercentRatioPattern4, } @@ -7274,7 +7335,7 @@ impl SeriesTree_Cohorts_Utxo_Lth_Realized_Loss { Self { base: CentsUsdPattern2::new(client.clone(), "lth_realized_loss".to_string()), cumulative: CentsUsdPattern2::new(client.clone(), "lth_realized_loss_cumulative".to_string()), - sum: _1m1w1y24hPattern5::new(client.clone(), "lth_realized_loss_sum".to_string()), + sum: _1m1w1y24hPattern6::new(client.clone(), "lth_realized_loss_sum".to_string()), negative: BaseSumPattern::new(client.clone(), "lth_neg_realized_loss".to_string()), to_rcap: BpsPercentRatioPattern4::new(client.clone(), "lth_realized_loss_to_rcap".to_string()), } diff --git a/crates/brk_computer/src/internal/per_block/amount/lazy_rolling_avg.rs b/crates/brk_computer/src/internal/per_block/amount/lazy_rolling_avg.rs index 4c5960169..801037aeb 100644 --- a/crates/brk_computer/src/internal/per_block/amount/lazy_rolling_avg.rs +++ b/crates/brk_computer/src/internal/per_block/amount/lazy_rolling_avg.rs @@ -1,26 +1,26 @@ use brk_traversable::Traversable; -use brk_types::{Bitcoin, Cents, Dollars, Height, Sats, Version}; +use brk_types::{Bitcoin, Cents, Dollars, Height, Sats, StoredF32, Version}; use derive_more::{Deref, DerefMut}; use vecdb::{DeltaAvg, LazyDeltaVec, LazyVecFrom1, ReadableCloneableVec}; use crate::{ indexes, internal::{ - CachedWindowStarts, CentsUnsignedToDollars, DerivedResolutions, LazyPerBlock, - LazyRollingAvgFromHeight, Resolutions, SatsToBitcoin, Windows, + CachedWindowStarts, DerivedResolutions, AvgCentsToUsd, AvgSatsToBtc, LazyPerBlock, + LazyRollingAvgFromHeight, Resolutions, Windows, }, }; -/// Single window slot: lazy rolling average for Amount (sats + btc + cents + usd). +/// Single window slot: lazy rolling average for Amount (sats + btc + cents + usd), all as f64. #[derive(Clone, Traversable)] pub struct LazyRollingAvgAmountFromHeight { - pub btc: LazyPerBlock, + pub btc: LazyPerBlock, pub sats: LazyRollingAvgFromHeight, - pub usd: LazyPerBlock, + pub usd: LazyPerBlock, pub cents: LazyRollingAvgFromHeight, } -/// Lazy rolling averages for all 4 windows, for Amount (sats + btc + cents + usd). +/// Lazy rolling averages for all 4 windows, for Amount (sats + btc + cents + usd), all as f64. #[derive(Clone, Deref, DerefMut, Traversable)] #[traversable(transparent)] pub struct LazyRollingAvgsAmountFromHeight(pub Windows); @@ -42,8 +42,8 @@ impl LazyRollingAvgsAmountFromHeight { let cached = cached_start.clone(); let starts_version = cached.version(); - // Sats lazy rolling avg - let sats_avg = LazyDeltaVec::::new( + // Sats lazy rolling avg → f64 + let sats_avg = LazyDeltaVec::::new( &format!("{full_name}_sats"), version, cum_sats.clone(), @@ -64,22 +64,22 @@ impl LazyRollingAvgsAmountFromHeight { resolutions: Box::new(sats_resolutions), }; - // Btc lazy from sats + // Btc: f64 sats avg / 1e8 let btc = LazyPerBlock { - height: LazyVecFrom1::transformed::( + height: LazyVecFrom1::transformed::( &full_name, version, sats.height.read_only_boxed_clone(), ), - resolutions: Box::new(DerivedResolutions::from_derived_computed::( + resolutions: Box::new(DerivedResolutions::from_derived_computed::( &full_name, version, &sats.resolutions, )), }; - // Cents rolling avg - let cents_avg = LazyDeltaVec::::new( + // Cents lazy rolling avg → f64 + let cents_avg = LazyDeltaVec::::new( &format!("{full_name}_cents"), version, cum_cents.clone(), @@ -97,17 +97,17 @@ impl LazyRollingAvgsAmountFromHeight { resolutions: Box::new(cents_resolutions), }; - // Usd lazy from cents + // Usd: f64 cents avg / 100 let usd = LazyPerBlock { - height: LazyVecFrom1::transformed::( + height: LazyVecFrom1::transformed::( &format!("{full_name}_usd"), version, cents.height.read_only_boxed_clone(), ), - resolutions: Box::new(DerivedResolutions::from_derived_computed::< - CentsUnsignedToDollars, - >( - &format!("{full_name}_usd"), version, ¢s.resolutions + resolutions: Box::new(DerivedResolutions::from_derived_computed::( + &format!("{full_name}_usd"), + version, + ¢s.resolutions, )), }; diff --git a/crates/brk_computer/src/internal/per_block/rolling/avg.rs b/crates/brk_computer/src/internal/per_block/rolling/avg.rs index e256cf3e6..fda4453d7 100644 --- a/crates/brk_computer/src/internal/per_block/rolling/avg.rs +++ b/crates/brk_computer/src/internal/per_block/rolling/avg.rs @@ -1,18 +1,19 @@ use brk_traversable::Traversable; -use brk_types::Height; +use brk_types::{Height, StoredF32}; use schemars::JsonSchema; use vecdb::{DeltaAvg, LazyDeltaVec}; use crate::internal::{NumericValue, Resolutions}; /// A single lazy rolling-average slot from height: the lazy delta vec + its resolution views. +/// Output is always StoredF32 regardless of input type T. #[derive(Clone, Traversable)] #[traversable(merge)] pub struct LazyRollingAvgFromHeight where T: NumericValue + JsonSchema, { - pub height: LazyDeltaVec, + pub height: LazyDeltaVec, #[traversable(flatten)] - pub resolutions: Box>, + pub resolutions: Box>, } diff --git a/crates/brk_computer/src/internal/per_block/rolling/avgs.rs b/crates/brk_computer/src/internal/per_block/rolling/avgs.rs index 77ddbcc96..a687c497c 100644 --- a/crates/brk_computer/src/internal/per_block/rolling/avgs.rs +++ b/crates/brk_computer/src/internal/per_block/rolling/avgs.rs @@ -1,5 +1,5 @@ use brk_traversable::Traversable; -use brk_types::{Height, Version}; +use brk_types::{Height, StoredF32, Version}; use derive_more::{Deref, DerefMut}; use schemars::JsonSchema; use vecdb::{DeltaAvg, LazyDeltaVec, ReadableCloneableVec}; @@ -15,8 +15,7 @@ use super::LazyRollingAvgFromHeight; /// derived from a cumulative vec + cached window starts. /// /// Nothing is stored on disk — all values are computed on-the-fly via -/// `LazyDeltaVec`: `(cum[h] - cum[start-1]) / (h - start + 1)`. -/// T is converted to f64 internally for division, then back to T. +/// `LazyDeltaVec`: `(cum[h] - cum[start-1]) / (h - start + 1)`. #[derive(Clone, Deref, DerefMut, Traversable)] #[traversable(transparent)] pub struct LazyRollingAvgsFromHeight(pub Windows>) @@ -40,7 +39,7 @@ where let full_name = format!("{name}_{suffix}"); let cached = cached_start.clone(); let starts_version = cached.version(); - let avg = LazyDeltaVec::::new( + let avg = LazyDeltaVec::::new( &full_name, version, cum_source.clone(), diff --git a/crates/brk_computer/src/internal/transform/currency.rs b/crates/brk_computer/src/internal/transform/currency.rs index 07e4a75ee..6c8b625ef 100644 --- a/crates/brk_computer/src/internal/transform/currency.rs +++ b/crates/brk_computer/src/internal/transform/currency.rs @@ -1,4 +1,4 @@ -use brk_types::{Bitcoin, Cents, CentsSigned, Dollars, Sats, SatsFract}; +use brk_types::{Bitcoin, Cents, CentsSigned, Dollars, Sats, SatsFract, StoredF32}; use vecdb::{BinaryTransform, UnaryTransform}; pub struct SatsToBitcoin; @@ -10,6 +10,24 @@ impl UnaryTransform for SatsToBitcoin { } } +pub struct AvgSatsToBtc; + +impl UnaryTransform for AvgSatsToBtc { + #[inline(always)] + fn apply(sats: StoredF32) -> Bitcoin { + Bitcoin::from(f64::from(sats) / Sats::ONE_BTC_U128 as f64) + } +} + +pub struct AvgCentsToUsd; + +impl UnaryTransform for AvgCentsToUsd { + #[inline(always)] + fn apply(cents: StoredF32) -> Dollars { + Dollars::from(f64::from(cents) / 100.0) + } +} + pub struct SatsToCents; impl BinaryTransform for SatsToCents { diff --git a/crates/brk_computer/src/internal/transform/mod.rs b/crates/brk_computer/src/internal/transform/mod.rs index 853f09b8b..327b37be7 100644 --- a/crates/brk_computer/src/internal/transform/mod.rs +++ b/crates/brk_computer/src/internal/transform/mod.rs @@ -16,7 +16,8 @@ pub use bps::{ }; pub use currency::{ CentsSignedToDollars, CentsSubtractToCentsSigned, CentsTimesTenths, CentsUnsignedToDollars, - CentsUnsignedToSats, DollarsToSatsFract, NegCentsUnsignedToDollars, SatsToBitcoin, SatsToCents, + CentsUnsignedToSats, DollarsToSatsFract, AvgCentsToUsd, AvgSatsToBtc, + NegCentsUnsignedToDollars, SatsToBitcoin, SatsToCents, }; pub use derived::{ Days1, Days7, Days30, Days365, DaysToYears, PriceTimesRatioBp32Cents, PriceTimesRatioCents, diff --git a/modules/brk-client/index.js b/modules/brk-client/index.js index 678a0aeba..56088b327 100644 --- a/modules/brk-client/index.js +++ b/modules/brk-client/index.js @@ -1746,18 +1746,18 @@ function create_10y1m1w1y2y3m3y4y5y6m6y8yPattern2(client, acc) { /** * @typedef {Object} _10y1m1w1y2y3m3y4y5y6m6y8yPattern3 - * @property {BtcCentsSatsUsdPattern} _10y - * @property {BtcCentsSatsUsdPattern} _1m - * @property {BtcCentsSatsUsdPattern} _1w - * @property {BtcCentsSatsUsdPattern} _1y - * @property {BtcCentsSatsUsdPattern} _2y - * @property {BtcCentsSatsUsdPattern} _3m - * @property {BtcCentsSatsUsdPattern} _3y - * @property {BtcCentsSatsUsdPattern} _4y - * @property {BtcCentsSatsUsdPattern} _5y - * @property {BtcCentsSatsUsdPattern} _6m - * @property {BtcCentsSatsUsdPattern} _6y - * @property {BtcCentsSatsUsdPattern} _8y + * @property {BtcCentsSatsUsdPattern2} _10y + * @property {BtcCentsSatsUsdPattern2} _1m + * @property {BtcCentsSatsUsdPattern2} _1w + * @property {BtcCentsSatsUsdPattern2} _1y + * @property {BtcCentsSatsUsdPattern2} _2y + * @property {BtcCentsSatsUsdPattern2} _3m + * @property {BtcCentsSatsUsdPattern2} _3y + * @property {BtcCentsSatsUsdPattern2} _4y + * @property {BtcCentsSatsUsdPattern2} _5y + * @property {BtcCentsSatsUsdPattern2} _6m + * @property {BtcCentsSatsUsdPattern2} _6y + * @property {BtcCentsSatsUsdPattern2} _8y */ /** @@ -1768,18 +1768,18 @@ function create_10y1m1w1y2y3m3y4y5y6m6y8yPattern2(client, acc) { */ function create_10y1m1w1y2y3m3y4y5y6m6y8yPattern3(client, acc) { return { - _10y: createBtcCentsSatsUsdPattern(client, _m(acc, '10y')), - _1m: createBtcCentsSatsUsdPattern(client, _m(acc, '1m')), - _1w: createBtcCentsSatsUsdPattern(client, _m(acc, '1w')), - _1y: createBtcCentsSatsUsdPattern(client, _m(acc, '1y')), - _2y: createBtcCentsSatsUsdPattern(client, _m(acc, '2y')), - _3m: createBtcCentsSatsUsdPattern(client, _m(acc, '3m')), - _3y: createBtcCentsSatsUsdPattern(client, _m(acc, '3y')), - _4y: createBtcCentsSatsUsdPattern(client, _m(acc, '4y')), - _5y: createBtcCentsSatsUsdPattern(client, _m(acc, '5y')), - _6m: createBtcCentsSatsUsdPattern(client, _m(acc, '6m')), - _6y: createBtcCentsSatsUsdPattern(client, _m(acc, '6y')), - _8y: createBtcCentsSatsUsdPattern(client, _m(acc, '8y')), + _10y: createBtcCentsSatsUsdPattern2(client, _m(acc, '10y')), + _1m: createBtcCentsSatsUsdPattern2(client, _m(acc, '1m')), + _1w: createBtcCentsSatsUsdPattern2(client, _m(acc, '1w')), + _1y: createBtcCentsSatsUsdPattern2(client, _m(acc, '1y')), + _2y: createBtcCentsSatsUsdPattern2(client, _m(acc, '2y')), + _3m: createBtcCentsSatsUsdPattern2(client, _m(acc, '3m')), + _3y: createBtcCentsSatsUsdPattern2(client, _m(acc, '3y')), + _4y: createBtcCentsSatsUsdPattern2(client, _m(acc, '4y')), + _5y: createBtcCentsSatsUsdPattern2(client, _m(acc, '5y')), + _6m: createBtcCentsSatsUsdPattern2(client, _m(acc, '6m')), + _6y: createBtcCentsSatsUsdPattern2(client, _m(acc, '6y')), + _8y: createBtcCentsSatsUsdPattern2(client, _m(acc, '8y')), }; } @@ -1795,13 +1795,13 @@ function create_10y1m1w1y2y3m3y4y5y6m6y8yPattern3(client, acc) { * @property {BpsCentsPercentilesRatioSatsSmaStdUsdPattern} price * @property {BaseCumulativeSumToPattern} profit * @property {_1m1w1y24hPattern} profitToLossRatio - * @property {_1m1w1y24hPattern6} sellSideRiskRatio + * @property {_1m1w1y24hPattern7} sellSideRiskRatio * @property {AdjustedRatioValuePattern} sopr */ /** * @typedef {Object} AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2 - * @property {_1m1w1y24hPattern} average + * @property {_1m1w1y24hPattern} average * @property {SeriesPattern1} base * @property {SeriesPattern1} cumulative * @property {_1m1w1y24hPattern} max @@ -1923,7 +1923,7 @@ function createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3(client, acc) { /** * @typedef {Object} AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern - * @property {_1m1w1y24hPattern} average + * @property {_1m1w1y24hPattern} average * @property {_1m1w1y24hPattern} max * @property {_1m1w1y24hPattern} median * @property {_1m1w1y24hPattern} min @@ -2194,11 +2194,11 @@ function createActivityAddrOutputsRealizedSupplyUnrealizedPattern(client, acc) { /** * @typedef {Object} AverageBaseCumulativeInSumPattern * @property {_1m1w1y24hPattern3} average - * @property {BtcCentsSatsUsdPattern} base - * @property {BtcCentsSatsUsdPattern} cumulative + * @property {BtcCentsSatsUsdPattern2} base + * @property {BtcCentsSatsUsdPattern2} cumulative * @property {AverageBaseCumulativeSumPattern3} inLoss * @property {AverageBaseCumulativeSumPattern3} inProfit - * @property {_1m1w1y24hPattern3} sum + * @property {_1m1w1y24hPattern4} sum */ /** @@ -2210,11 +2210,11 @@ function createActivityAddrOutputsRealizedSupplyUnrealizedPattern(client, acc) { function createAverageBaseCumulativeInSumPattern(client, acc) { return { average: create_1m1w1y24hPattern3(client, _m(acc, 'average')), - base: createBtcCentsSatsUsdPattern(client, acc), - cumulative: createBtcCentsSatsUsdPattern(client, _m(acc, 'cumulative')), + base: createBtcCentsSatsUsdPattern2(client, acc), + cumulative: createBtcCentsSatsUsdPattern2(client, _m(acc, 'cumulative')), inLoss: createAverageBaseCumulativeSumPattern3(client, _m(acc, 'in_loss')), inProfit: createAverageBaseCumulativeSumPattern3(client, _m(acc, 'in_profit')), - sum: create_1m1w1y24hPattern3(client, _m(acc, 'sum')), + sum: create_1m1w1y24hPattern4(client, _m(acc, 'sum')), }; } @@ -2224,7 +2224,7 @@ function createAverageBaseCumulativeInSumPattern(client, acc) { * @property {ToPattern} change1m * @property {CentsUsdPattern} cumulative * @property {AbsoluteRatePattern2} delta - * @property {_1m1w1y24hPattern4} sum + * @property {_1m1w1y24hPattern5} sum * @property {BpsPercentRatioPattern} toRcap */ @@ -2240,7 +2240,7 @@ function createBaseChangeCumulativeDeltaSumToPattern(client, acc) { change1m: createToPattern(client, _m(acc, 'pnl_change_1m_to')), cumulative: createCentsUsdPattern(client, _m(acc, 'realized_pnl_cumulative')), delta: createAbsoluteRatePattern2(client, _m(acc, 'realized_pnl_delta')), - sum: create_1m1w1y24hPattern4(client, _m(acc, 'realized_pnl_sum')), + sum: create_1m1w1y24hPattern5(client, _m(acc, 'realized_pnl_sum')), toRcap: createBpsPercentRatioPattern(client, _m(acc, 'realized_pnl_to_rcap')), }; } @@ -2329,11 +2329,11 @@ function createCentsNegativeToUsdPattern2(client, acc) { /** * @typedef {Object} DeltaHalfInToTotalPattern * @property {AbsoluteRatePattern} delta - * @property {BtcCentsSatsUsdPattern} half + * @property {BtcCentsSatsUsdPattern2} half * @property {BtcCentsSatsToUsdPattern} inLoss * @property {BtcCentsSatsToUsdPattern} inProfit * @property {BpsPercentRatioPattern3} toCirculating - * @property {BtcCentsSatsUsdPattern} total + * @property {BtcCentsSatsUsdPattern2} total */ /** @@ -2345,22 +2345,22 @@ function createCentsNegativeToUsdPattern2(client, acc) { function createDeltaHalfInToTotalPattern(client, acc) { return { delta: createAbsoluteRatePattern(client, _m(acc, 'delta')), - half: createBtcCentsSatsUsdPattern(client, _m(acc, 'half')), + half: createBtcCentsSatsUsdPattern2(client, _m(acc, 'half')), inLoss: createBtcCentsSatsToUsdPattern(client, _m(acc, 'in_loss')), inProfit: createBtcCentsSatsToUsdPattern(client, _m(acc, 'in_profit')), toCirculating: createBpsPercentRatioPattern3(client, _m(acc, 'to_circulating')), - total: createBtcCentsSatsUsdPattern(client, acc), + total: createBtcCentsSatsUsdPattern2(client, acc), }; } /** * @typedef {Object} DeltaHalfInToTotalPattern2 * @property {AbsoluteRatePattern} delta - * @property {BtcCentsSatsUsdPattern} half + * @property {BtcCentsSatsUsdPattern2} half * @property {BtcCentsSatsToUsdPattern3} inLoss * @property {BtcCentsSatsToUsdPattern3} inProfit * @property {BpsPercentRatioPattern3} toCirculating - * @property {BtcCentsSatsUsdPattern} total + * @property {BtcCentsSatsUsdPattern2} total */ /** @@ -2372,11 +2372,11 @@ function createDeltaHalfInToTotalPattern(client, acc) { function createDeltaHalfInToTotalPattern2(client, acc) { return { delta: createAbsoluteRatePattern(client, _m(acc, 'delta')), - half: createBtcCentsSatsUsdPattern(client, _m(acc, 'half')), + half: createBtcCentsSatsUsdPattern2(client, _m(acc, 'half')), inLoss: createBtcCentsSatsToUsdPattern3(client, _m(acc, 'in_loss')), inProfit: createBtcCentsSatsToUsdPattern3(client, _m(acc, 'in_profit')), toCirculating: createBpsPercentRatioPattern3(client, _m(acc, 'to_circulating')), - total: createBtcCentsSatsUsdPattern(client, acc), + total: createBtcCentsSatsUsdPattern2(client, acc), }; } @@ -2407,6 +2407,31 @@ function createPct1Pct2Pct5Pct95Pct98Pct99Pattern(client, acc) { }; } +/** + * @typedef {Object} _1m1w1y24hBasePattern + * @property {SeriesPattern1} _1m + * @property {SeriesPattern1} _1w + * @property {SeriesPattern1} _1y + * @property {SeriesPattern1} _24h + * @property {SeriesPattern18} base + */ + +/** + * Create a _1m1w1y24hBasePattern pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated series name + * @returns {_1m1w1y24hBasePattern} + */ +function create_1m1w1y24hBasePattern(client, acc) { + return { + _1m: createSeriesPattern1(client, _m(acc, 'average_1m')), + _1w: createSeriesPattern1(client, _m(acc, 'average_1w')), + _1y: createSeriesPattern1(client, _m(acc, 'average_1y')), + _24h: createSeriesPattern1(client, _m(acc, 'average_24h')), + base: createSeriesPattern18(client, acc), + }; +} + /** * @typedef {Object} ActivityOutputsRealizedSupplyUnrealizedPattern * @property {CoindaysTransferPattern} activity @@ -2487,7 +2512,7 @@ function createActivityOutputsRealizedSupplyUnrealizedPattern2(client, acc) { * @property {CentsUsdPattern2} base * @property {CentsUsdPattern2} cumulative * @property {BaseSumPattern} negative - * @property {_1m1w1y24hPattern5} sum + * @property {_1m1w1y24hPattern6} sum * @property {BpsPercentRatioPattern4} toRcap */ @@ -2644,10 +2669,10 @@ function createCentsToUsdPattern4(client, acc) { /** * @typedef {Object} DeltaHalfInTotalPattern2 * @property {AbsoluteRatePattern} delta - * @property {BtcCentsSatsUsdPattern} half - * @property {BtcCentsSatsUsdPattern} inLoss - * @property {BtcCentsSatsUsdPattern} inProfit - * @property {BtcCentsSatsUsdPattern} total + * @property {BtcCentsSatsUsdPattern2} half + * @property {BtcCentsSatsUsdPattern2} inLoss + * @property {BtcCentsSatsUsdPattern2} inProfit + * @property {BtcCentsSatsUsdPattern2} total */ /** @@ -2659,10 +2684,10 @@ function createCentsToUsdPattern4(client, acc) { function createDeltaHalfInTotalPattern2(client, acc) { return { delta: createAbsoluteRatePattern(client, _m(acc, 'delta')), - half: createBtcCentsSatsUsdPattern(client, _m(acc, 'half')), - inLoss: createBtcCentsSatsUsdPattern(client, _m(acc, 'in_loss')), - inProfit: createBtcCentsSatsUsdPattern(client, _m(acc, 'in_profit')), - total: createBtcCentsSatsUsdPattern(client, acc), + half: createBtcCentsSatsUsdPattern2(client, _m(acc, 'half')), + inLoss: createBtcCentsSatsUsdPattern2(client, _m(acc, 'in_loss')), + inProfit: createBtcCentsSatsUsdPattern2(client, _m(acc, 'in_profit')), + total: createBtcCentsSatsUsdPattern2(client, acc), }; } @@ -2700,33 +2725,6 @@ function createPhsReboundThsPattern(client, acc) { }; } -/** - * @template T - * @typedef {Object} _1m1w1y24hBasePattern - * @property {SeriesPattern1} _1m - * @property {SeriesPattern1} _1w - * @property {SeriesPattern1} _1y - * @property {SeriesPattern1} _24h - * @property {SeriesPattern18} base - */ - -/** - * Create a _1m1w1y24hBasePattern pattern node - * @template T - * @param {BrkClientBase} client - * @param {string} acc - Accumulated series name - * @returns {_1m1w1y24hBasePattern} - */ -function create_1m1w1y24hBasePattern(client, acc) { - return { - _1m: createSeriesPattern1(client, _m(acc, 'average_1m')), - _1w: createSeriesPattern1(client, _m(acc, 'average_1w')), - _1y: createSeriesPattern1(client, _m(acc, 'average_1y')), - _24h: createSeriesPattern1(client, _m(acc, 'average_24h')), - base: createSeriesPattern18(client, acc), - }; -} - /** * @typedef {Object} _1m1w1y24hPattern2 * @property {BpsPercentRatioPattern} _1m @@ -2751,7 +2749,7 @@ function create_1m1w1y24hPattern2(client, acc) { } /** - * @typedef {Object} _1m1w1y24hPattern6 + * @typedef {Object} _1m1w1y24hPattern7 * @property {BpsPercentRatioPattern4} _1m * @property {BpsPercentRatioPattern4} _1w * @property {BpsPercentRatioPattern4} _1y @@ -2759,12 +2757,12 @@ function create_1m1w1y24hPattern2(client, acc) { */ /** - * Create a _1m1w1y24hPattern6 pattern node + * Create a _1m1w1y24hPattern7 pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated series name - * @returns {_1m1w1y24hPattern6} + * @returns {_1m1w1y24hPattern7} */ -function create_1m1w1y24hPattern6(client, acc) { +function create_1m1w1y24hPattern7(client, acc) { return { _1m: createBpsPercentRatioPattern4(client, _m(acc, '1m')), _1w: createBpsPercentRatioPattern4(client, _m(acc, '1w')), @@ -2796,6 +2794,29 @@ function create_1m1w1y24hPattern3(client, acc) { }; } +/** + * @typedef {Object} _1m1w1y24hPattern4 + * @property {BtcCentsSatsUsdPattern2} _1m + * @property {BtcCentsSatsUsdPattern2} _1w + * @property {BtcCentsSatsUsdPattern2} _1y + * @property {BtcCentsSatsUsdPattern2} _24h + */ + +/** + * Create a _1m1w1y24hPattern4 pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated series name + * @returns {_1m1w1y24hPattern4} + */ +function create_1m1w1y24hPattern4(client, acc) { + return { + _1m: createBtcCentsSatsUsdPattern2(client, _m(acc, '1m')), + _1w: createBtcCentsSatsUsdPattern2(client, _m(acc, '1w')), + _1y: createBtcCentsSatsUsdPattern2(client, _m(acc, '1y')), + _24h: createBtcCentsSatsUsdPattern2(client, _m(acc, '24h')), + }; +} + /** * @typedef {Object} _1m1w1y2wPattern * @property {CentsSatsUsdPattern} _1m @@ -2820,36 +2841,13 @@ function create_1m1w1y2wPattern(client, acc) { } /** - * @typedef {Object} _1m1w1y24hPattern4 + * @typedef {Object} _1m1w1y24hPattern5 * @property {CentsUsdPattern} _1m * @property {CentsUsdPattern} _1w * @property {CentsUsdPattern} _1y * @property {CentsUsdPattern} _24h */ -/** - * Create a _1m1w1y24hPattern4 pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated series name - * @returns {_1m1w1y24hPattern4} - */ -function create_1m1w1y24hPattern4(client, acc) { - return { - _1m: createCentsUsdPattern(client, _m(acc, '1m')), - _1w: createCentsUsdPattern(client, _m(acc, '1w')), - _1y: createCentsUsdPattern(client, _m(acc, '1y')), - _24h: createCentsUsdPattern(client, _m(acc, '24h')), - }; -} - -/** - * @typedef {Object} _1m1w1y24hPattern5 - * @property {CentsUsdPattern2} _1m - * @property {CentsUsdPattern2} _1w - * @property {CentsUsdPattern2} _1y - * @property {CentsUsdPattern2} _24h - */ - /** * Create a _1m1w1y24hPattern5 pattern node * @param {BrkClientBase} client @@ -2857,6 +2855,29 @@ function create_1m1w1y24hPattern4(client, acc) { * @returns {_1m1w1y24hPattern5} */ function create_1m1w1y24hPattern5(client, acc) { + return { + _1m: createCentsUsdPattern(client, _m(acc, '1m')), + _1w: createCentsUsdPattern(client, _m(acc, '1w')), + _1y: createCentsUsdPattern(client, _m(acc, '1y')), + _24h: createCentsUsdPattern(client, _m(acc, '24h')), + }; +} + +/** + * @typedef {Object} _1m1w1y24hPattern6 + * @property {CentsUsdPattern2} _1m + * @property {CentsUsdPattern2} _1w + * @property {CentsUsdPattern2} _1y + * @property {CentsUsdPattern2} _24h + */ + +/** + * Create a _1m1w1y24hPattern6 pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated series name + * @returns {_1m1w1y24hPattern6} + */ +function create_1m1w1y24hPattern6(client, acc) { return { _1m: createCentsUsdPattern2(client, _m(acc, '1m')), _1w: createCentsUsdPattern2(client, _m(acc, '1w')), @@ -2875,7 +2896,7 @@ function create_1m1w1y24hPattern5(client, acc) { /** * @typedef {Object} AverageBaseCumulativeSumPattern2 - * @property {_1m1w1y24hPattern} average + * @property {_1m1w1y24hPattern} average * @property {SeriesPattern1} base * @property {SeriesPattern1} cumulative * @property {_1m1w1y24hPattern} sum @@ -2899,9 +2920,9 @@ function createAverageBaseCumulativeSumPattern2(client, acc) { /** * @typedef {Object} AverageBaseCumulativeSumPattern3 * @property {_1m1w1y24hPattern3} average - * @property {BtcCentsSatsUsdPattern} base - * @property {BtcCentsSatsUsdPattern} cumulative - * @property {_1m1w1y24hPattern3} sum + * @property {BtcCentsSatsUsdPattern2} base + * @property {BtcCentsSatsUsdPattern2} cumulative + * @property {_1m1w1y24hPattern4} sum */ /** @@ -2913,9 +2934,9 @@ function createAverageBaseCumulativeSumPattern2(client, acc) { function createAverageBaseCumulativeSumPattern3(client, acc) { return { average: create_1m1w1y24hPattern3(client, _m(acc, 'average')), - base: createBtcCentsSatsUsdPattern(client, acc), - cumulative: createBtcCentsSatsUsdPattern(client, _m(acc, 'cumulative')), - sum: create_1m1w1y24hPattern3(client, _m(acc, 'sum')), + base: createBtcCentsSatsUsdPattern2(client, acc), + cumulative: createBtcCentsSatsUsdPattern2(client, _m(acc, 'cumulative')), + sum: create_1m1w1y24hPattern4(client, _m(acc, 'sum')), }; } @@ -2924,7 +2945,7 @@ function createAverageBaseCumulativeSumPattern3(client, acc) { * @property {CentsUsdPattern} base * @property {CentsUsdPattern} cumulative * @property {AbsoluteRatePattern2} delta - * @property {_1m1w1y24hPattern4} sum + * @property {_1m1w1y24hPattern5} sum */ /** @@ -2938,7 +2959,7 @@ function createBaseCumulativeDeltaSumPattern(client, acc) { base: createCentsUsdPattern(client, acc), cumulative: createCentsUsdPattern(client, _m(acc, 'cumulative')), delta: createAbsoluteRatePattern2(client, _m(acc, 'delta')), - sum: create_1m1w1y24hPattern4(client, _m(acc, 'sum')), + sum: create_1m1w1y24hPattern5(client, _m(acc, 'sum')), }; } @@ -2947,7 +2968,7 @@ function createBaseCumulativeDeltaSumPattern(client, acc) { * @property {CentsUsdPattern2} base * @property {CentsUsdPattern2} cumulative * @property {BaseSumPattern} negative - * @property {_1m1w1y24hPattern5} sum + * @property {_1m1w1y24hPattern6} sum */ /** @@ -2961,7 +2982,7 @@ function createBaseCumulativeNegativeSumPattern(client, acc) { base: createCentsUsdPattern2(client, _m(acc, 'realized_loss')), cumulative: createCentsUsdPattern2(client, _m(acc, 'realized_loss_cumulative')), negative: createBaseSumPattern(client, _m(acc, 'neg_realized_loss')), - sum: create_1m1w1y24hPattern5(client, _m(acc, 'realized_loss_sum')), + sum: create_1m1w1y24hPattern6(client, _m(acc, 'realized_loss_sum')), }; } @@ -2969,7 +2990,7 @@ function createBaseCumulativeNegativeSumPattern(client, acc) { * @typedef {Object} BaseCumulativeSumToPattern * @property {CentsUsdPattern2} base * @property {CentsUsdPattern2} cumulative - * @property {_1m1w1y24hPattern5} sum + * @property {_1m1w1y24hPattern6} sum * @property {BpsPercentRatioPattern4} toRcap */ @@ -2983,17 +3004,17 @@ function createBaseCumulativeSumToPattern(client, acc) { return { base: createCentsUsdPattern2(client, acc), cumulative: createCentsUsdPattern2(client, _m(acc, 'cumulative')), - sum: create_1m1w1y24hPattern5(client, _m(acc, 'sum')), + sum: create_1m1w1y24hPattern6(client, _m(acc, 'sum')), toRcap: createBpsPercentRatioPattern4(client, _m(acc, 'to_rcap')), }; } /** * @typedef {Object} BothReactivatedReceivingSendingPattern - * @property {_1m1w1y24hBasePattern} both - * @property {_1m1w1y24hBasePattern} reactivated - * @property {_1m1w1y24hBasePattern} receiving - * @property {_1m1w1y24hBasePattern} sending + * @property {_1m1w1y24hBasePattern} both + * @property {_1m1w1y24hBasePattern} reactivated + * @property {_1m1w1y24hBasePattern} receiving + * @property {_1m1w1y24hBasePattern} sending */ /** @@ -3012,13 +3033,36 @@ function createBothReactivatedReceivingSendingPattern(client, acc) { } /** - * @typedef {Object} BtcCentsSatsUsdPattern + * @typedef {Object} BtcCentsSatsUsdPattern2 * @property {SeriesPattern1} btc * @property {SeriesPattern1} cents * @property {SeriesPattern1} sats * @property {SeriesPattern1} usd */ +/** + * Create a BtcCentsSatsUsdPattern2 pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated series name + * @returns {BtcCentsSatsUsdPattern2} + */ +function createBtcCentsSatsUsdPattern2(client, acc) { + return { + btc: createSeriesPattern1(client, acc), + cents: createSeriesPattern1(client, _m(acc, 'cents')), + sats: createSeriesPattern1(client, _m(acc, 'sats')), + usd: createSeriesPattern1(client, _m(acc, 'usd')), + }; +} + +/** + * @typedef {Object} BtcCentsSatsUsdPattern + * @property {SeriesPattern1} btc + * @property {SeriesPattern1} cents + * @property {SeriesPattern1} sats + * @property {SeriesPattern1} usd + */ + /** * Create a BtcCentsSatsUsdPattern pattern node * @param {BrkClientBase} client @@ -3172,7 +3216,7 @@ function createAverageBaseCumulativeSumPattern(client, acc) { * @typedef {Object} BaseCumulativeSumPattern * @property {CentsUsdPattern2} base * @property {CentsUsdPattern2} cumulative - * @property {_1m1w1y24hPattern5} sum + * @property {_1m1w1y24hPattern6} sum */ /** @@ -3185,7 +3229,7 @@ function createBaseCumulativeSumPattern(client, acc) { return { base: createCentsUsdPattern2(client, acc), cumulative: createCentsUsdPattern2(client, _m(acc, 'cumulative')), - sum: create_1m1w1y24hPattern5(client, _m(acc, 'sum')), + sum: create_1m1w1y24hPattern6(client, _m(acc, 'sum')), }; } @@ -3424,8 +3468,8 @@ function createCumulativeRollingSumPattern(client, acc) { /** * @typedef {Object} DeltaHalfTotalPattern * @property {AbsoluteRatePattern} delta - * @property {BtcCentsSatsUsdPattern} half - * @property {BtcCentsSatsUsdPattern} total + * @property {BtcCentsSatsUsdPattern2} half + * @property {BtcCentsSatsUsdPattern2} total */ /** @@ -3437,8 +3481,8 @@ function createCumulativeRollingSumPattern(client, acc) { function createDeltaHalfTotalPattern(client, acc) { return { delta: createAbsoluteRatePattern(client, _m(acc, 'delta')), - half: createBtcCentsSatsUsdPattern(client, _m(acc, 'half')), - total: createBtcCentsSatsUsdPattern(client, acc), + half: createBtcCentsSatsUsdPattern2(client, _m(acc, 'half')), + total: createBtcCentsSatsUsdPattern2(client, acc), }; } @@ -3542,7 +3586,7 @@ function createAbsoluteRatePattern(client, acc) { /** * @typedef {Object} AbsoluteRatePattern2 - * @property {_1m1w1y24hPattern4} absolute + * @property {_1m1w1y24hPattern5} absolute * @property {_1m1w1y24hPattern2} rate */ @@ -3554,7 +3598,7 @@ function createAbsoluteRatePattern(client, acc) { */ function createAbsoluteRatePattern2(client, acc) { return { - absolute: create_1m1w1y24hPattern4(client, acc), + absolute: create_1m1w1y24hPattern5(client, acc), rate: create_1m1w1y24hPattern2(client, acc), }; } @@ -3562,7 +3606,7 @@ function createAbsoluteRatePattern2(client, acc) { /** * @typedef {Object} AllSthPattern2 * @property {BtcCentsDeltaSatsUsdPattern} all - * @property {BtcCentsSatsUsdPattern} sth + * @property {BtcCentsSatsUsdPattern2} sth */ /** @@ -3574,7 +3618,7 @@ function createAbsoluteRatePattern2(client, acc) { function createAllSthPattern2(client, acc) { return { all: createBtcCentsDeltaSatsUsdPattern(client, _m(acc, 'supply')), - sth: createBtcCentsSatsUsdPattern(client, _m(acc, 'sth_supply')), + sth: createBtcCentsSatsUsdPattern2(client, _m(acc, 'sth_supply')), }; } @@ -3968,7 +4012,7 @@ function createUnspentPattern(client, acc) { * @property {SeriesTree_Blocks_Weight} weight * @property {SeriesTree_Blocks_Count} count * @property {SeriesTree_Blocks_Lookback} lookback - * @property {_1m1w1y24hBasePattern} interval + * @property {SeriesTree_Blocks_Interval} interval * @property {AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} vbytes * @property {SeriesTree_Blocks_Fullness} fullness * @property {SeriesTree_Blocks_Halving} halving @@ -3996,7 +4040,7 @@ function createUnspentPattern(client, acc) { * @property {SeriesPattern18} base * @property {SeriesPattern1} cumulative * @property {_1m1w1y24hPattern} sum - * @property {_1m1w1y24hPattern} average + * @property {_1m1w1y24hPattern} average * @property {_1m1w1y24hPattern} min * @property {_1m1w1y24hPattern} max * @property {_1m1w1y24hPattern} pct10 @@ -4011,7 +4055,7 @@ function createUnspentPattern(client, acc) { * @property {SeriesPattern18} base * @property {SeriesPattern1} cumulative * @property {_1m1w1y24hPattern} sum - * @property {_1m1w1y24hPattern} average + * @property {_1m1w1y24hPattern} average * @property {_1m1w1y24hPattern} min * @property {_1m1w1y24hPattern} max * @property {_1m1w1y24hPattern} pct10 @@ -4074,6 +4118,15 @@ function createUnspentPattern(client, acc) { * @property {SeriesPattern18} _26y */ +/** + * @typedef {Object} SeriesTree_Blocks_Interval + * @property {SeriesPattern18} base + * @property {SeriesPattern1} _24h + * @property {SeriesPattern1} _1w + * @property {SeriesPattern1} _1m + * @property {SeriesPattern1} _1y + */ + /** * @typedef {Object} SeriesTree_Blocks_Fullness * @property {SeriesPattern18} bps @@ -4411,9 +4464,9 @@ function createUnspentPattern(client, acc) { /** * @typedef {Object} SeriesTree_Mining_Rewards_Subsidy - * @property {BtcCentsSatsUsdPattern} base - * @property {BtcCentsSatsUsdPattern} cumulative - * @property {_1m1w1y24hPattern3} sum + * @property {BtcCentsSatsUsdPattern2} base + * @property {BtcCentsSatsUsdPattern2} cumulative + * @property {_1m1w1y24hPattern4} sum * @property {_1m1w1y24hPattern3} average * @property {_1m1w1y24hBpsPercentRatioPattern} dominance * @property {CentsUsdPattern2} sma1y @@ -4421,17 +4474,17 @@ function createUnspentPattern(client, acc) { /** * @typedef {Object} SeriesTree_Mining_Rewards_Fees - * @property {BtcCentsSatsUsdPattern} base - * @property {BtcCentsSatsUsdPattern} cumulative - * @property {_1m1w1y24hPattern3} sum + * @property {BtcCentsSatsUsdPattern2} base + * @property {BtcCentsSatsUsdPattern2} cumulative + * @property {_1m1w1y24hPattern4} sum * @property {_1m1w1y24hPattern3} average - * @property {_1m1w1y24hPattern3} min - * @property {_1m1w1y24hPattern3} max - * @property {_1m1w1y24hPattern3} pct10 - * @property {_1m1w1y24hPattern3} pct25 - * @property {_1m1w1y24hPattern3} median - * @property {_1m1w1y24hPattern3} pct75 - * @property {_1m1w1y24hPattern3} pct90 + * @property {_1m1w1y24hPattern4} min + * @property {_1m1w1y24hPattern4} max + * @property {_1m1w1y24hPattern4} pct10 + * @property {_1m1w1y24hPattern4} pct25 + * @property {_1m1w1y24hPattern4} median + * @property {_1m1w1y24hPattern4} pct75 + * @property {_1m1w1y24hPattern4} pct90 * @property {_1m1w1y24hBpsPercentRatioPattern} dominance * @property {SeriesTree_Mining_Rewards_Fees_ToSubsidyRatio} toSubsidyRatio */ @@ -4446,8 +4499,8 @@ function createUnspentPattern(client, acc) { /** * @typedef {Object} SeriesTree_Mining_Rewards_Unclaimed - * @property {BtcCentsSatsUsdPattern} base - * @property {BtcCentsSatsUsdPattern} cumulative + * @property {BtcCentsSatsUsdPattern2} base + * @property {BtcCentsSatsUsdPattern2} cumulative */ /** @@ -4502,8 +4555,8 @@ function createUnspentPattern(client, acc) { /** * @typedef {Object} SeriesTree_Cointime_Supply - * @property {BtcCentsSatsUsdPattern} vaulted - * @property {BtcCentsSatsUsdPattern} active + * @property {BtcCentsSatsUsdPattern2} vaulted + * @property {BtcCentsSatsUsdPattern2} active */ /** @@ -5046,18 +5099,18 @@ function createUnspentPattern(client, acc) { /** * @typedef {Object} SeriesTree_Market_Dca_Class_Stack - * @property {BtcCentsSatsUsdPattern} from2015 - * @property {BtcCentsSatsUsdPattern} from2016 - * @property {BtcCentsSatsUsdPattern} from2017 - * @property {BtcCentsSatsUsdPattern} from2018 - * @property {BtcCentsSatsUsdPattern} from2019 - * @property {BtcCentsSatsUsdPattern} from2020 - * @property {BtcCentsSatsUsdPattern} from2021 - * @property {BtcCentsSatsUsdPattern} from2022 - * @property {BtcCentsSatsUsdPattern} from2023 - * @property {BtcCentsSatsUsdPattern} from2024 - * @property {BtcCentsSatsUsdPattern} from2025 - * @property {BtcCentsSatsUsdPattern} from2026 + * @property {BtcCentsSatsUsdPattern2} from2015 + * @property {BtcCentsSatsUsdPattern2} from2016 + * @property {BtcCentsSatsUsdPattern2} from2017 + * @property {BtcCentsSatsUsdPattern2} from2018 + * @property {BtcCentsSatsUsdPattern2} from2019 + * @property {BtcCentsSatsUsdPattern2} from2020 + * @property {BtcCentsSatsUsdPattern2} from2021 + * @property {BtcCentsSatsUsdPattern2} from2022 + * @property {BtcCentsSatsUsdPattern2} from2023 + * @property {BtcCentsSatsUsdPattern2} from2024 + * @property {BtcCentsSatsUsdPattern2} from2025 + * @property {BtcCentsSatsUsdPattern2} from2026 */ /** @@ -5351,13 +5404,13 @@ function createUnspentPattern(client, acc) { /** * @typedef {Object} SeriesTree_Supply * @property {SeriesPattern18} state - * @property {BtcCentsSatsUsdPattern} circulating + * @property {BtcCentsSatsUsdPattern2} circulating * @property {AverageBaseCumulativeSumPattern3} burned * @property {BpsPercentRatioPattern} inflationRate * @property {SeriesTree_Supply_Velocity} velocity * @property {CentsDeltaUsdPattern} marketCap * @property {_1m1w1y24hPattern} marketMinusRealizedCapGrowthRate - * @property {BtcCentsSatsUsdPattern} hodledOrLost + * @property {BtcCentsSatsUsdPattern2} hodledOrLost */ /** @@ -5402,8 +5455,8 @@ function createUnspentPattern(client, acc) { /** * @typedef {Object} SeriesTree_Cohorts_Utxo_All_Supply - * @property {BtcCentsSatsUsdPattern} total - * @property {BtcCentsSatsUsdPattern} half + * @property {BtcCentsSatsUsdPattern2} total + * @property {BtcCentsSatsUsdPattern2} half * @property {AbsoluteRatePattern} delta * @property {BtcCentsSatsToUsdPattern2} inProfit * @property {BtcCentsSatsToUsdPattern2} inLoss @@ -5427,7 +5480,7 @@ function createUnspentPattern(client, acc) { * @property {BaseChangeCumulativeDeltaSumToPattern} netPnl * @property {SeriesTree_Cohorts_Utxo_All_Realized_Sopr} sopr * @property {BaseCumulativeSumPattern} grossPnl - * @property {_1m1w1y24hPattern6} sellSideRiskRatio + * @property {_1m1w1y24hPattern7} sellSideRiskRatio * @property {BaseCumulativeSumToPattern} peakRegret * @property {PricePattern} investor * @property {_1m1w1y24hPattern} profitToLossRatio @@ -5437,7 +5490,7 @@ function createUnspentPattern(client, acc) { * @typedef {Object} SeriesTree_Cohorts_Utxo_All_Realized_Loss * @property {CentsUsdPattern2} base * @property {CentsUsdPattern2} cumulative - * @property {_1m1w1y24hPattern5} sum + * @property {_1m1w1y24hPattern6} sum * @property {BaseSumPattern} negative * @property {BpsPercentRatioPattern4} toRcap */ @@ -5635,7 +5688,7 @@ function createUnspentPattern(client, acc) { * @property {BaseChangeCumulativeDeltaSumToPattern} netPnl * @property {SeriesTree_Cohorts_Utxo_Sth_Realized_Sopr} sopr * @property {BaseCumulativeSumPattern} grossPnl - * @property {_1m1w1y24hPattern6} sellSideRiskRatio + * @property {_1m1w1y24hPattern7} sellSideRiskRatio * @property {BaseCumulativeSumToPattern} peakRegret * @property {PricePattern} investor * @property {_1m1w1y24hPattern} profitToLossRatio @@ -5645,7 +5698,7 @@ function createUnspentPattern(client, acc) { * @typedef {Object} SeriesTree_Cohorts_Utxo_Sth_Realized_Loss * @property {CentsUsdPattern2} base * @property {CentsUsdPattern2} cumulative - * @property {_1m1w1y24hPattern5} sum + * @property {_1m1w1y24hPattern6} sum * @property {BaseSumPattern} negative * @property {BpsPercentRatioPattern4} toRcap */ @@ -5819,7 +5872,7 @@ function createUnspentPattern(client, acc) { * @property {BaseChangeCumulativeDeltaSumToPattern} netPnl * @property {SeriesTree_Cohorts_Utxo_Lth_Realized_Sopr} sopr * @property {BaseCumulativeSumPattern} grossPnl - * @property {_1m1w1y24hPattern6} sellSideRiskRatio + * @property {_1m1w1y24hPattern7} sellSideRiskRatio * @property {BaseCumulativeSumToPattern} peakRegret * @property {PricePattern} investor * @property {_1m1w1y24hPattern} profitToLossRatio @@ -5829,7 +5882,7 @@ function createUnspentPattern(client, acc) { * @typedef {Object} SeriesTree_Cohorts_Utxo_Lth_Realized_Loss * @property {CentsUsdPattern2} base * @property {CentsUsdPattern2} cumulative - * @property {_1m1w1y24hPattern5} sum + * @property {_1m1w1y24hPattern6} sum * @property {BaseSumPattern} negative * @property {BpsPercentRatioPattern4} toRcap */ @@ -7571,7 +7624,13 @@ class BrkClient extends BrkClientBase { _14y: createSeriesPattern18(this, 'height_14y_ago'), _26y: createSeriesPattern18(this, 'height_26y_ago'), }, - interval: create_1m1w1y24hBasePattern(this, 'block_interval'), + interval: { + base: createSeriesPattern18(this, 'block_interval'), + _24h: createSeriesPattern1(this, 'block_interval_average_24h'), + _1w: createSeriesPattern1(this, 'block_interval_average_1w'), + _1m: createSeriesPattern1(this, 'block_interval_average_1m'), + _1y: createSeriesPattern1(this, 'block_interval_average_1y'), + }, vbytes: createAverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(this, 'block_vbytes'), fullness: { bps: createSeriesPattern18(this, 'block_fullness_bps'), @@ -7786,25 +7845,25 @@ class BrkClient extends BrkClientBase { rewards: { coinbase: createAverageBaseCumulativeSumPattern3(this, 'coinbase'), subsidy: { - base: createBtcCentsSatsUsdPattern(this, 'subsidy'), - cumulative: createBtcCentsSatsUsdPattern(this, 'subsidy_cumulative'), - sum: create_1m1w1y24hPattern3(this, 'subsidy_sum'), + base: createBtcCentsSatsUsdPattern2(this, 'subsidy'), + cumulative: createBtcCentsSatsUsdPattern2(this, 'subsidy_cumulative'), + sum: create_1m1w1y24hPattern4(this, 'subsidy_sum'), average: create_1m1w1y24hPattern3(this, 'subsidy_average'), dominance: create_1m1w1y24hBpsPercentRatioPattern(this, 'subsidy_dominance'), sma1y: createCentsUsdPattern2(this, 'subsidy_sma_1y'), }, fees: { - base: createBtcCentsSatsUsdPattern(this, 'fees'), - cumulative: createBtcCentsSatsUsdPattern(this, 'fees_cumulative'), - sum: create_1m1w1y24hPattern3(this, 'fees_sum'), + base: createBtcCentsSatsUsdPattern2(this, 'fees'), + cumulative: createBtcCentsSatsUsdPattern2(this, 'fees_cumulative'), + sum: create_1m1w1y24hPattern4(this, 'fees_sum'), average: create_1m1w1y24hPattern3(this, 'fees_average'), - min: create_1m1w1y24hPattern3(this, 'fees_min'), - max: create_1m1w1y24hPattern3(this, 'fees_max'), - pct10: create_1m1w1y24hPattern3(this, 'fees_pct10'), - pct25: create_1m1w1y24hPattern3(this, 'fees_pct25'), - median: create_1m1w1y24hPattern3(this, 'fees_median'), - pct75: create_1m1w1y24hPattern3(this, 'fees_pct75'), - pct90: create_1m1w1y24hPattern3(this, 'fees_pct90'), + min: create_1m1w1y24hPattern4(this, 'fees_min'), + max: create_1m1w1y24hPattern4(this, 'fees_max'), + pct10: create_1m1w1y24hPattern4(this, 'fees_pct10'), + pct25: create_1m1w1y24hPattern4(this, 'fees_pct25'), + median: create_1m1w1y24hPattern4(this, 'fees_median'), + pct75: create_1m1w1y24hPattern4(this, 'fees_pct75'), + pct90: create_1m1w1y24hPattern4(this, 'fees_pct90'), dominance: create_1m1w1y24hBpsPercentRatioPattern(this, 'fee_dominance'), toSubsidyRatio: { _24h: createBpsRatioPattern2(this, 'fee_to_subsidy_ratio_24h'), @@ -7814,8 +7873,8 @@ class BrkClient extends BrkClientBase { }, }, unclaimed: { - base: createBtcCentsSatsUsdPattern(this, 'unclaimed_rewards'), - cumulative: createBtcCentsSatsUsdPattern(this, 'unclaimed_rewards_cumulative'), + base: createBtcCentsSatsUsdPattern2(this, 'unclaimed_rewards'), + cumulative: createBtcCentsSatsUsdPattern2(this, 'unclaimed_rewards_cumulative'), }, }, hashrate: { @@ -7848,8 +7907,8 @@ class BrkClient extends BrkClientBase { coinblocksDestroyed: createAverageBaseCumulativeSumPattern(this, 'coinblocks_destroyed'), }, supply: { - vaulted: createBtcCentsSatsUsdPattern(this, 'vaulted_supply'), - active: createBtcCentsSatsUsdPattern(this, 'active_supply'), + vaulted: createBtcCentsSatsUsdPattern2(this, 'vaulted_supply'), + active: createBtcCentsSatsUsdPattern2(this, 'active_supply'), }, value: { destroyed: createAverageBaseCumulativeSumPattern(this, 'cointime_value_destroyed'), @@ -8210,18 +8269,18 @@ class BrkClient extends BrkClientBase { }, class: { stack: { - from2015: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2015'), - from2016: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2016'), - from2017: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2017'), - from2018: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2018'), - from2019: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2019'), - from2020: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2020'), - from2021: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2021'), - from2022: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2022'), - from2023: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2023'), - from2024: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2024'), - from2025: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2025'), - from2026: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2026'), + from2015: createBtcCentsSatsUsdPattern2(this, 'dca_stack_from_2015'), + from2016: createBtcCentsSatsUsdPattern2(this, 'dca_stack_from_2016'), + from2017: createBtcCentsSatsUsdPattern2(this, 'dca_stack_from_2017'), + from2018: createBtcCentsSatsUsdPattern2(this, 'dca_stack_from_2018'), + from2019: createBtcCentsSatsUsdPattern2(this, 'dca_stack_from_2019'), + from2020: createBtcCentsSatsUsdPattern2(this, 'dca_stack_from_2020'), + from2021: createBtcCentsSatsUsdPattern2(this, 'dca_stack_from_2021'), + from2022: createBtcCentsSatsUsdPattern2(this, 'dca_stack_from_2022'), + from2023: createBtcCentsSatsUsdPattern2(this, 'dca_stack_from_2023'), + from2024: createBtcCentsSatsUsdPattern2(this, 'dca_stack_from_2024'), + from2025: createBtcCentsSatsUsdPattern2(this, 'dca_stack_from_2025'), + from2026: createBtcCentsSatsUsdPattern2(this, 'dca_stack_from_2026'), }, costBasis: { from2015: createCentsSatsUsdPattern(this, 'dca_cost_basis_from_2015'), @@ -8476,7 +8535,7 @@ class BrkClient extends BrkClientBase { }, supply: { state: createSeriesPattern18(this, 'supply_state'), - circulating: createBtcCentsSatsUsdPattern(this, 'circulating_supply'), + circulating: createBtcCentsSatsUsdPattern2(this, 'circulating_supply'), burned: createAverageBaseCumulativeSumPattern3(this, 'unspendable_supply'), inflationRate: createBpsPercentRatioPattern(this, 'inflation_rate'), velocity: { @@ -8485,14 +8544,14 @@ class BrkClient extends BrkClientBase { }, marketCap: createCentsDeltaUsdPattern(this, 'market_cap'), marketMinusRealizedCapGrowthRate: create_1m1w1y24hPattern(this, 'market_minus_realized_cap_growth_rate'), - hodledOrLost: createBtcCentsSatsUsdPattern(this, 'hodled_or_lost_supply'), + hodledOrLost: createBtcCentsSatsUsdPattern2(this, 'hodled_or_lost_supply'), }, cohorts: { utxo: { all: { supply: { - total: createBtcCentsSatsUsdPattern(this, 'supply'), - half: createBtcCentsSatsUsdPattern(this, 'supply_half'), + total: createBtcCentsSatsUsdPattern2(this, 'supply'), + half: createBtcCentsSatsUsdPattern2(this, 'supply_half'), delta: createAbsoluteRatePattern(this, 'supply_delta'), inProfit: createBtcCentsSatsToUsdPattern2(this, 'supply_in_profit'), inLoss: createBtcCentsSatsToUsdPattern2(this, 'supply_in_loss'), @@ -8510,7 +8569,7 @@ class BrkClient extends BrkClientBase { loss: { base: createCentsUsdPattern2(this, 'realized_loss'), cumulative: createCentsUsdPattern2(this, 'realized_loss_cumulative'), - sum: create_1m1w1y24hPattern5(this, 'realized_loss_sum'), + sum: create_1m1w1y24hPattern6(this, 'realized_loss_sum'), negative: createBaseSumPattern(this, 'neg_realized_loss'), toRcap: createBpsPercentRatioPattern4(this, 'realized_loss_to_rcap'), }, @@ -8605,7 +8664,7 @@ class BrkClient extends BrkClientBase { }, }, grossPnl: createBaseCumulativeSumPattern(this, 'realized_gross_pnl'), - sellSideRiskRatio: create_1m1w1y24hPattern6(this, 'sell_side_risk_ratio'), + sellSideRiskRatio: create_1m1w1y24hPattern7(this, 'sell_side_risk_ratio'), peakRegret: createBaseCumulativeSumToPattern(this, 'realized_peak_regret'), investor: createPricePattern(this, 'investor_price'), profitToLossRatio: create_1m1w1y24hPattern(this, 'realized_profit_to_loss_ratio'), @@ -8665,7 +8724,7 @@ class BrkClient extends BrkClientBase { loss: { base: createCentsUsdPattern2(this, 'sth_realized_loss'), cumulative: createCentsUsdPattern2(this, 'sth_realized_loss_cumulative'), - sum: create_1m1w1y24hPattern5(this, 'sth_realized_loss_sum'), + sum: create_1m1w1y24hPattern6(this, 'sth_realized_loss_sum'), negative: createBaseSumPattern(this, 'sth_neg_realized_loss'), toRcap: createBpsPercentRatioPattern4(this, 'sth_realized_loss_to_rcap'), }, @@ -8760,7 +8819,7 @@ class BrkClient extends BrkClientBase { }, }, grossPnl: createBaseCumulativeSumPattern(this, 'sth_realized_gross_pnl'), - sellSideRiskRatio: create_1m1w1y24hPattern6(this, 'sth_sell_side_risk_ratio'), + sellSideRiskRatio: create_1m1w1y24hPattern7(this, 'sth_sell_side_risk_ratio'), peakRegret: createBaseCumulativeSumToPattern(this, 'sth_realized_peak_regret'), investor: createPricePattern(this, 'sth_investor_price'), profitToLossRatio: create_1m1w1y24hPattern(this, 'sth_realized_profit_to_loss_ratio'), @@ -8805,7 +8864,7 @@ class BrkClient extends BrkClientBase { loss: { base: createCentsUsdPattern2(this, 'lth_realized_loss'), cumulative: createCentsUsdPattern2(this, 'lth_realized_loss_cumulative'), - sum: create_1m1w1y24hPattern5(this, 'lth_realized_loss_sum'), + sum: create_1m1w1y24hPattern6(this, 'lth_realized_loss_sum'), negative: createBaseSumPattern(this, 'lth_neg_realized_loss'), toRcap: createBpsPercentRatioPattern4(this, 'lth_realized_loss_to_rcap'), }, @@ -8895,7 +8954,7 @@ class BrkClient extends BrkClientBase { ratio: create_1m1w1y24hPattern(this, 'lth_sopr'), }, grossPnl: createBaseCumulativeSumPattern(this, 'lth_realized_gross_pnl'), - sellSideRiskRatio: create_1m1w1y24hPattern6(this, 'lth_sell_side_risk_ratio'), + sellSideRiskRatio: create_1m1w1y24hPattern7(this, 'lth_sell_side_risk_ratio'), peakRegret: createBaseCumulativeSumToPattern(this, 'lth_realized_peak_regret'), investor: createPricePattern(this, 'lth_investor_price'), profitToLossRatio: create_1m1w1y24hPattern(this, 'lth_realized_profit_to_loss_ratio'), diff --git a/packages/brk_client/brk_client/__init__.py b/packages/brk_client/brk_client/__init__.py index 64c54822f..94773dbfc 100644 --- a/packages/brk_client/brk_client/__init__.py +++ b/packages/brk_client/brk_client/__init__.py @@ -2208,18 +2208,18 @@ class _10y1m1w1y2y3m3y4y5y6m6y8yPattern3: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated series name.""" - self._10y: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, '10y')) - self._1m: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, '1m')) - self._1w: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, '1w')) - self._1y: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, '1y')) - self._2y: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, '2y')) - self._3m: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, '3m')) - self._3y: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, '3y')) - self._4y: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, '4y')) - self._5y: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, '5y')) - self._6m: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, '6m')) - self._6y: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, '6y')) - self._8y: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, '8y')) + self._10y: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, _m(acc, '10y')) + self._1m: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, _m(acc, '1m')) + self._1w: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, _m(acc, '1w')) + self._1y: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, _m(acc, '1y')) + self._2y: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, _m(acc, '2y')) + self._3m: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, _m(acc, '3m')) + self._3y: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, _m(acc, '3y')) + self._4y: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, _m(acc, '4y')) + self._5y: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, _m(acc, '5y')) + self._6m: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, _m(acc, '6m')) + self._6y: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, _m(acc, '6y')) + self._8y: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, _m(acc, '8y')) class CapGrossInvestorLossMvrvNetPeakPriceProfitSellSoprPattern: """Pattern struct for repeated tree structure.""" @@ -2230,7 +2230,7 @@ class AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated series name.""" - self.average: _1m1w1y24hPattern[StoredU64] = _1m1w1y24hPattern(client, _m(acc, 'average')) + self.average: _1m1w1y24hPattern[StoredF32] = _1m1w1y24hPattern(client, _m(acc, 'average')) self.base: SeriesPattern1[StoredU64] = SeriesPattern1(client, acc) self.cumulative: SeriesPattern1[StoredU64] = SeriesPattern1(client, _m(acc, 'cumulative')) self.max: _1m1w1y24hPattern[StoredU64] = _1m1w1y24hPattern(client, _m(acc, 'max')) @@ -2282,7 +2282,7 @@ class AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated series name.""" - self.average: _1m1w1y24hPattern[StoredU64] = _1m1w1y24hPattern(client, _m(acc, 'average')) + self.average: _1m1w1y24hPattern[StoredF32] = _1m1w1y24hPattern(client, _m(acc, 'average')) self.max: _1m1w1y24hPattern[StoredU64] = _1m1w1y24hPattern(client, _m(acc, 'max')) self.median: _1m1w1y24hPattern[StoredU64] = _1m1w1y24hPattern(client, _m(acc, 'median')) self.min: _1m1w1y24hPattern[StoredU64] = _1m1w1y24hPattern(client, _m(acc, 'min')) @@ -2399,11 +2399,11 @@ class AverageBaseCumulativeInSumPattern: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated series name.""" self.average: _1m1w1y24hPattern3 = _1m1w1y24hPattern3(client, _m(acc, 'average')) - self.base: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, acc) - self.cumulative: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'cumulative')) + self.base: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, acc) + self.cumulative: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, _m(acc, 'cumulative')) self.in_loss: AverageBaseCumulativeSumPattern3 = AverageBaseCumulativeSumPattern3(client, _m(acc, 'in_loss')) self.in_profit: AverageBaseCumulativeSumPattern3 = AverageBaseCumulativeSumPattern3(client, _m(acc, 'in_profit')) - self.sum: _1m1w1y24hPattern3 = _1m1w1y24hPattern3(client, _m(acc, 'sum')) + self.sum: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, _m(acc, 'sum')) class BaseChangeCumulativeDeltaSumToPattern: """Pattern struct for repeated tree structure.""" @@ -2414,7 +2414,7 @@ class BaseChangeCumulativeDeltaSumToPattern: self.change_1m: ToPattern = ToPattern(client, _m(acc, 'pnl_change_1m_to')) self.cumulative: CentsUsdPattern = CentsUsdPattern(client, _m(acc, 'realized_pnl_cumulative')) self.delta: AbsoluteRatePattern2 = AbsoluteRatePattern2(client, _m(acc, 'realized_pnl_delta')) - self.sum: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, _m(acc, 'realized_pnl_sum')) + self.sum: _1m1w1y24hPattern5 = _1m1w1y24hPattern5(client, _m(acc, 'realized_pnl_sum')) self.to_rcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'realized_pnl_to_rcap')) class BpsCentsPercentilesRatioSatsUsdPattern: @@ -2459,11 +2459,11 @@ class DeltaHalfInToTotalPattern: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated series name.""" self.delta: AbsoluteRatePattern = AbsoluteRatePattern(client, _m(acc, 'delta')) - self.half: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'half')) + self.half: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, _m(acc, 'half')) self.in_loss: BtcCentsSatsToUsdPattern = BtcCentsSatsToUsdPattern(client, _m(acc, 'in_loss')) self.in_profit: BtcCentsSatsToUsdPattern = BtcCentsSatsToUsdPattern(client, _m(acc, 'in_profit')) self.to_circulating: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, 'to_circulating')) - self.total: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, acc) + self.total: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, acc) class DeltaHalfInToTotalPattern2: """Pattern struct for repeated tree structure.""" @@ -2471,11 +2471,11 @@ class DeltaHalfInToTotalPattern2: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated series name.""" self.delta: AbsoluteRatePattern = AbsoluteRatePattern(client, _m(acc, 'delta')) - self.half: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'half')) + self.half: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, _m(acc, 'half')) self.in_loss: BtcCentsSatsToUsdPattern3 = BtcCentsSatsToUsdPattern3(client, _m(acc, 'in_loss')) self.in_profit: BtcCentsSatsToUsdPattern3 = BtcCentsSatsToUsdPattern3(client, _m(acc, 'in_profit')) self.to_circulating: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, 'to_circulating')) - self.total: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, acc) + self.total: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, acc) class Pct1Pct2Pct5Pct95Pct98Pct99Pattern: """Pattern struct for repeated tree structure.""" @@ -2489,6 +2489,17 @@ class Pct1Pct2Pct5Pct95Pct98Pct99Pattern: self.pct98: BpsPriceRatioPattern = BpsPriceRatioPattern(client, acc, 'pct98') self.pct99: BpsPriceRatioPattern = BpsPriceRatioPattern(client, acc, 'pct99') +class _1m1w1y24hBasePattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated series name.""" + self._1m: SeriesPattern1[StoredF32] = SeriesPattern1(client, _m(acc, 'average_1m')) + self._1w: SeriesPattern1[StoredF32] = SeriesPattern1(client, _m(acc, 'average_1w')) + self._1y: SeriesPattern1[StoredF32] = SeriesPattern1(client, _m(acc, 'average_1y')) + self._24h: SeriesPattern1[StoredF32] = SeriesPattern1(client, _m(acc, 'average_24h')) + self.base: SeriesPattern18[StoredU32] = SeriesPattern18(client, acc) + class ActivityOutputsRealizedSupplyUnrealizedPattern: """Pattern struct for repeated tree structure.""" @@ -2598,10 +2609,10 @@ class DeltaHalfInTotalPattern2: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated series name.""" self.delta: AbsoluteRatePattern = AbsoluteRatePattern(client, _m(acc, 'delta')) - 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) + self.half: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, _m(acc, 'half')) + self.in_loss: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, _m(acc, 'in_loss')) + self.in_profit: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, _m(acc, 'in_profit')) + self.total: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, acc) class EmaHistogramLineSignalPattern: """Pattern struct for repeated tree structure.""" @@ -2618,17 +2629,6 @@ class PhsReboundThsPattern: self.ths: SeriesPattern1[StoredF32] = SeriesPattern1(client, _m(acc, 'ths')) self.ths_min: SeriesPattern1[StoredF32] = SeriesPattern1(client, _m(acc, 'ths_min')) -class _1m1w1y24hBasePattern(Generic[T]): - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated series name.""" - self._1m: SeriesPattern1[T] = SeriesPattern1(client, _m(acc, 'average_1m')) - self._1w: SeriesPattern1[T] = SeriesPattern1(client, _m(acc, 'average_1w')) - self._1y: SeriesPattern1[T] = SeriesPattern1(client, _m(acc, 'average_1y')) - self._24h: SeriesPattern1[T] = SeriesPattern1(client, _m(acc, 'average_24h')) - self.base: SeriesPattern18[T] = SeriesPattern18(client, acc) - class _1m1w1y24hPattern2: """Pattern struct for repeated tree structure.""" @@ -2639,7 +2639,7 @@ class _1m1w1y24hPattern2: self._1y: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, '1y_rate')) self._24h: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, '24h_rate')) -class _1m1w1y24hPattern6: +class _1m1w1y24hPattern7: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -2659,6 +2659,16 @@ class _1m1w1y24hPattern3: self._1y: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, '1y')) self._24h: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, '24h')) +class _1m1w1y24hPattern4: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated series name.""" + self._1m: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, _m(acc, '1m')) + self._1w: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, _m(acc, '1w')) + self._1y: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, _m(acc, '1y')) + self._24h: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, _m(acc, '24h')) + class _1m1w1y2wPattern: """Pattern struct for repeated tree structure.""" @@ -2669,7 +2679,7 @@ class _1m1w1y2wPattern: self._1y: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, '1y')) self._2w: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, '2w')) -class _1m1w1y24hPattern4: +class _1m1w1y24hPattern5: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -2679,7 +2689,7 @@ class _1m1w1y24hPattern4: self._1y: CentsUsdPattern = CentsUsdPattern(client, _m(acc, '1y')) self._24h: CentsUsdPattern = CentsUsdPattern(client, _m(acc, '24h')) -class _1m1w1y24hPattern5: +class _1m1w1y24hPattern6: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -2698,7 +2708,7 @@ class AverageBaseCumulativeSumPattern2: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated series name.""" - self.average: _1m1w1y24hPattern[StoredU64] = _1m1w1y24hPattern(client, _m(acc, 'average')) + self.average: _1m1w1y24hPattern[StoredF32] = _1m1w1y24hPattern(client, _m(acc, 'average')) self.base: SeriesPattern1[StoredU32] = SeriesPattern1(client, acc) self.cumulative: SeriesPattern1[StoredU64] = SeriesPattern1(client, _m(acc, 'cumulative')) self.sum: _1m1w1y24hPattern[StoredU64] = _1m1w1y24hPattern(client, _m(acc, 'sum')) @@ -2709,9 +2719,9 @@ class AverageBaseCumulativeSumPattern3: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated series name.""" self.average: _1m1w1y24hPattern3 = _1m1w1y24hPattern3(client, _m(acc, 'average')) - self.base: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, acc) - self.cumulative: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'cumulative')) - self.sum: _1m1w1y24hPattern3 = _1m1w1y24hPattern3(client, _m(acc, 'sum')) + self.base: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, acc) + self.cumulative: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, _m(acc, 'cumulative')) + self.sum: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, _m(acc, 'sum')) class BaseCumulativeDeltaSumPattern: """Pattern struct for repeated tree structure.""" @@ -2721,7 +2731,7 @@ class BaseCumulativeDeltaSumPattern: self.base: CentsUsdPattern = CentsUsdPattern(client, acc) self.cumulative: CentsUsdPattern = CentsUsdPattern(client, _m(acc, 'cumulative')) self.delta: AbsoluteRatePattern2 = AbsoluteRatePattern2(client, _m(acc, 'delta')) - self.sum: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, _m(acc, 'sum')) + self.sum: _1m1w1y24hPattern5 = _1m1w1y24hPattern5(client, _m(acc, 'sum')) class BaseCumulativeNegativeSumPattern: """Pattern struct for repeated tree structure.""" @@ -2731,7 +2741,7 @@ class BaseCumulativeNegativeSumPattern: self.base: CentsUsdPattern2 = CentsUsdPattern2(client, _m(acc, 'realized_loss')) self.cumulative: CentsUsdPattern2 = CentsUsdPattern2(client, _m(acc, 'realized_loss_cumulative')) self.negative: BaseSumPattern = BaseSumPattern(client, _m(acc, 'neg_realized_loss')) - self.sum: _1m1w1y24hPattern5 = _1m1w1y24hPattern5(client, _m(acc, 'realized_loss_sum')) + self.sum: _1m1w1y24hPattern6 = _1m1w1y24hPattern6(client, _m(acc, 'realized_loss_sum')) class BaseCumulativeSumToPattern: """Pattern struct for repeated tree structure.""" @@ -2740,7 +2750,7 @@ class BaseCumulativeSumToPattern: """Create pattern node with accumulated series name.""" self.base: CentsUsdPattern2 = CentsUsdPattern2(client, acc) self.cumulative: CentsUsdPattern2 = CentsUsdPattern2(client, _m(acc, 'cumulative')) - self.sum: _1m1w1y24hPattern5 = _1m1w1y24hPattern5(client, _m(acc, 'sum')) + self.sum: _1m1w1y24hPattern6 = _1m1w1y24hPattern6(client, _m(acc, 'sum')) self.to_rcap: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, _m(acc, 'to_rcap')) class BothReactivatedReceivingSendingPattern: @@ -2748,12 +2758,12 @@ class BothReactivatedReceivingSendingPattern: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated series name.""" - self.both: _1m1w1y24hBasePattern[StoredU32] = _1m1w1y24hBasePattern(client, _m(acc, 'both')) - self.reactivated: _1m1w1y24hBasePattern[StoredU32] = _1m1w1y24hBasePattern(client, _m(acc, 'reactivated')) - self.receiving: _1m1w1y24hBasePattern[StoredU32] = _1m1w1y24hBasePattern(client, _m(acc, 'receiving')) - self.sending: _1m1w1y24hBasePattern[StoredU32] = _1m1w1y24hBasePattern(client, _m(acc, 'sending')) + self.both: _1m1w1y24hBasePattern = _1m1w1y24hBasePattern(client, _m(acc, 'both')) + self.reactivated: _1m1w1y24hBasePattern = _1m1w1y24hBasePattern(client, _m(acc, 'reactivated')) + self.receiving: _1m1w1y24hBasePattern = _1m1w1y24hBasePattern(client, _m(acc, 'receiving')) + self.sending: _1m1w1y24hBasePattern = _1m1w1y24hBasePattern(client, _m(acc, 'sending')) -class BtcCentsSatsUsdPattern: +class BtcCentsSatsUsdPattern2: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -2763,6 +2773,16 @@ class BtcCentsSatsUsdPattern: self.sats: SeriesPattern1[Sats] = SeriesPattern1(client, _m(acc, 'sats')) self.usd: SeriesPattern1[Dollars] = SeriesPattern1(client, _m(acc, 'usd')) +class BtcCentsSatsUsdPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated series name.""" + self.btc: SeriesPattern1[Bitcoin] = SeriesPattern1(client, acc) + self.cents: SeriesPattern1[StoredF32] = SeriesPattern1(client, _m(acc, 'cents')) + self.sats: SeriesPattern1[StoredF32] = SeriesPattern1(client, _m(acc, 'sats')) + self.usd: SeriesPattern1[Dollars] = SeriesPattern1(client, _m(acc, 'usd')) + class CentsDeltaToUsdPattern: """Pattern struct for repeated tree structure.""" @@ -2828,7 +2848,7 @@ class BaseCumulativeSumPattern: """Create pattern node with accumulated series name.""" self.base: CentsUsdPattern2 = CentsUsdPattern2(client, acc) self.cumulative: CentsUsdPattern2 = CentsUsdPattern2(client, _m(acc, 'cumulative')) - self.sum: _1m1w1y24hPattern5 = _1m1w1y24hPattern5(client, _m(acc, 'sum')) + self.sum: _1m1w1y24hPattern6 = _1m1w1y24hPattern6(client, _m(acc, 'sum')) class BlocksDominanceRewardsPattern: """Pattern struct for repeated tree structure.""" @@ -2935,8 +2955,8 @@ class DeltaHalfTotalPattern: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated series name.""" self.delta: AbsoluteRatePattern = AbsoluteRatePattern(client, _m(acc, 'delta')) - self.half: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'half')) - self.total: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, acc) + self.half: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, _m(acc, 'half')) + self.total: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, acc) class GreedNetPainPattern: """Pattern struct for repeated tree structure.""" @@ -2986,7 +3006,7 @@ class AbsoluteRatePattern2: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated series name.""" - self.absolute: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, acc) + self.absolute: _1m1w1y24hPattern5 = _1m1w1y24hPattern5(client, acc) self.rate: _1m1w1y24hPattern2 = _1m1w1y24hPattern2(client, acc) class AllSthPattern2: @@ -2995,7 +3015,7 @@ class AllSthPattern2: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated series name.""" self.all: BtcCentsDeltaSatsUsdPattern = BtcCentsDeltaSatsUsdPattern(client, _m(acc, 'supply')) - self.sth: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'sth_supply')) + self.sth: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, _m(acc, 'sth_supply')) class AllSthPattern: """Pattern struct for repeated tree structure.""" @@ -3176,7 +3196,7 @@ class SeriesTree_Blocks_Size: self.base: SeriesPattern18[StoredU64] = SeriesPattern18(client, 'total_size') self.cumulative: SeriesPattern1[StoredU64] = SeriesPattern1(client, 'block_size_cumulative') self.sum: _1m1w1y24hPattern[StoredU64] = _1m1w1y24hPattern(client, 'block_size_sum') - self.average: _1m1w1y24hPattern[StoredU64] = _1m1w1y24hPattern(client, 'block_size_average') + self.average: _1m1w1y24hPattern[StoredF32] = _1m1w1y24hPattern(client, 'block_size_average') self.min: _1m1w1y24hPattern[StoredU64] = _1m1w1y24hPattern(client, 'block_size_min') self.max: _1m1w1y24hPattern[StoredU64] = _1m1w1y24hPattern(client, 'block_size_max') self.pct10: _1m1w1y24hPattern[StoredU64] = _1m1w1y24hPattern(client, 'block_size_pct10') @@ -3192,7 +3212,7 @@ class SeriesTree_Blocks_Weight: self.base: SeriesPattern18[Weight] = SeriesPattern18(client, 'block_weight') self.cumulative: SeriesPattern1[Weight] = SeriesPattern1(client, 'block_weight_cumulative') self.sum: _1m1w1y24hPattern[Weight] = _1m1w1y24hPattern(client, 'block_weight_sum') - self.average: _1m1w1y24hPattern[Weight] = _1m1w1y24hPattern(client, 'block_weight_average') + self.average: _1m1w1y24hPattern[StoredF32] = _1m1w1y24hPattern(client, 'block_weight_average') self.min: _1m1w1y24hPattern[Weight] = _1m1w1y24hPattern(client, 'block_weight_min') self.max: _1m1w1y24hPattern[Weight] = _1m1w1y24hPattern(client, 'block_weight_max') self.pct10: _1m1w1y24hPattern[Weight] = _1m1w1y24hPattern(client, 'block_weight_pct10') @@ -3256,6 +3276,16 @@ class SeriesTree_Blocks_Lookback: self._14y: SeriesPattern18[Height] = SeriesPattern18(client, 'height_14y_ago') self._26y: SeriesPattern18[Height] = SeriesPattern18(client, 'height_26y_ago') +class SeriesTree_Blocks_Interval: + """Series tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self.base: SeriesPattern18[Timestamp] = SeriesPattern18(client, 'block_interval') + self._24h: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'block_interval_average_24h') + self._1w: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'block_interval_average_1w') + self._1m: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'block_interval_average_1m') + self._1y: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'block_interval_average_1y') + class SeriesTree_Blocks_Fullness: """Series tree node.""" @@ -3283,7 +3313,7 @@ class SeriesTree_Blocks: self.weight: SeriesTree_Blocks_Weight = SeriesTree_Blocks_Weight(client) self.count: SeriesTree_Blocks_Count = SeriesTree_Blocks_Count(client) self.lookback: SeriesTree_Blocks_Lookback = SeriesTree_Blocks_Lookback(client) - self.interval: _1m1w1y24hBasePattern[Timestamp] = _1m1w1y24hBasePattern(client, 'block_interval') + self.interval: SeriesTree_Blocks_Interval = SeriesTree_Blocks_Interval(client) self.vbytes: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2 = AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, 'block_vbytes') self.fullness: SeriesTree_Blocks_Fullness = SeriesTree_Blocks_Fullness(client) self.halving: SeriesTree_Blocks_Halving = SeriesTree_Blocks_Halving(client) @@ -3637,9 +3667,9 @@ class SeriesTree_Mining_Rewards_Subsidy: """Series tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.base: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'subsidy') - self.cumulative: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'subsidy_cumulative') - self.sum: _1m1w1y24hPattern3 = _1m1w1y24hPattern3(client, 'subsidy_sum') + self.base: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, 'subsidy') + self.cumulative: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, 'subsidy_cumulative') + self.sum: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, 'subsidy_sum') self.average: _1m1w1y24hPattern3 = _1m1w1y24hPattern3(client, 'subsidy_average') self.dominance: _1m1w1y24hBpsPercentRatioPattern = _1m1w1y24hBpsPercentRatioPattern(client, 'subsidy_dominance') self.sma_1y: CentsUsdPattern2 = CentsUsdPattern2(client, 'subsidy_sma_1y') @@ -3657,17 +3687,17 @@ class SeriesTree_Mining_Rewards_Fees: """Series tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.base: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'fees') - self.cumulative: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'fees_cumulative') - self.sum: _1m1w1y24hPattern3 = _1m1w1y24hPattern3(client, 'fees_sum') + self.base: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, 'fees') + self.cumulative: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, 'fees_cumulative') + self.sum: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, 'fees_sum') self.average: _1m1w1y24hPattern3 = _1m1w1y24hPattern3(client, 'fees_average') - self.min: _1m1w1y24hPattern3 = _1m1w1y24hPattern3(client, 'fees_min') - self.max: _1m1w1y24hPattern3 = _1m1w1y24hPattern3(client, 'fees_max') - self.pct10: _1m1w1y24hPattern3 = _1m1w1y24hPattern3(client, 'fees_pct10') - self.pct25: _1m1w1y24hPattern3 = _1m1w1y24hPattern3(client, 'fees_pct25') - self.median: _1m1w1y24hPattern3 = _1m1w1y24hPattern3(client, 'fees_median') - self.pct75: _1m1w1y24hPattern3 = _1m1w1y24hPattern3(client, 'fees_pct75') - self.pct90: _1m1w1y24hPattern3 = _1m1w1y24hPattern3(client, 'fees_pct90') + self.min: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, 'fees_min') + self.max: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, 'fees_max') + self.pct10: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, 'fees_pct10') + self.pct25: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, 'fees_pct25') + self.median: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, 'fees_median') + self.pct75: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, 'fees_pct75') + self.pct90: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, 'fees_pct90') self.dominance: _1m1w1y24hBpsPercentRatioPattern = _1m1w1y24hBpsPercentRatioPattern(client, 'fee_dominance') self.to_subsidy_ratio: SeriesTree_Mining_Rewards_Fees_ToSubsidyRatio = SeriesTree_Mining_Rewards_Fees_ToSubsidyRatio(client) @@ -3675,8 +3705,8 @@ class SeriesTree_Mining_Rewards_Unclaimed: """Series tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.base: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'unclaimed_rewards') - self.cumulative: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'unclaimed_rewards_cumulative') + self.base: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, 'unclaimed_rewards') + self.cumulative: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, 'unclaimed_rewards_cumulative') class SeriesTree_Mining_Rewards: """Series tree node.""" @@ -3742,8 +3772,8 @@ class SeriesTree_Cointime_Supply: """Series tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.vaulted: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'vaulted_supply') - self.active: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'active_supply') + self.vaulted: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, 'vaulted_supply') + self.active: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, 'active_supply') class SeriesTree_Cointime_Value: """Series tree node.""" @@ -4331,18 +4361,18 @@ class SeriesTree_Market_Dca_Class_Stack: """Series tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.from_2015: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'dca_stack_from_2015') - self.from_2016: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'dca_stack_from_2016') - self.from_2017: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'dca_stack_from_2017') - self.from_2018: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'dca_stack_from_2018') - self.from_2019: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'dca_stack_from_2019') - self.from_2020: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'dca_stack_from_2020') - self.from_2021: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'dca_stack_from_2021') - self.from_2022: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'dca_stack_from_2022') - self.from_2023: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'dca_stack_from_2023') - self.from_2024: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'dca_stack_from_2024') - self.from_2025: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'dca_stack_from_2025') - self.from_2026: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'dca_stack_from_2026') + self.from_2015: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, 'dca_stack_from_2015') + self.from_2016: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, 'dca_stack_from_2016') + self.from_2017: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, 'dca_stack_from_2017') + self.from_2018: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, 'dca_stack_from_2018') + self.from_2019: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, 'dca_stack_from_2019') + self.from_2020: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, 'dca_stack_from_2020') + self.from_2021: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, 'dca_stack_from_2021') + self.from_2022: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, 'dca_stack_from_2022') + self.from_2023: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, 'dca_stack_from_2023') + self.from_2024: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, 'dca_stack_from_2024') + self.from_2025: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, 'dca_stack_from_2025') + self.from_2026: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, 'dca_stack_from_2026') class SeriesTree_Market_Dca_Class_CostBasis: """Series tree node.""" @@ -4688,20 +4718,20 @@ class SeriesTree_Supply: def __init__(self, client: BrkClientBase, base_path: str = ''): self.state: SeriesPattern18[SupplyState] = SeriesPattern18(client, 'supply_state') - self.circulating: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'circulating_supply') + self.circulating: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, 'circulating_supply') self.burned: AverageBaseCumulativeSumPattern3 = AverageBaseCumulativeSumPattern3(client, 'unspendable_supply') self.inflation_rate: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'inflation_rate') self.velocity: SeriesTree_Supply_Velocity = SeriesTree_Supply_Velocity(client) self.market_cap: CentsDeltaUsdPattern = CentsDeltaUsdPattern(client, 'market_cap') self.market_minus_realized_cap_growth_rate: _1m1w1y24hPattern[BasisPointsSigned32] = _1m1w1y24hPattern(client, 'market_minus_realized_cap_growth_rate') - self.hodled_or_lost: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'hodled_or_lost_supply') + self.hodled_or_lost: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, 'hodled_or_lost_supply') class SeriesTree_Cohorts_Utxo_All_Supply: """Series tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.total: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'supply') - self.half: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'supply_half') + self.total: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, 'supply') + self.half: BtcCentsSatsUsdPattern2 = BtcCentsSatsUsdPattern2(client, 'supply_half') self.delta: AbsoluteRatePattern = AbsoluteRatePattern(client, 'supply_delta') self.in_profit: BtcCentsSatsToUsdPattern2 = BtcCentsSatsToUsdPattern2(client, 'supply_in_profit') self.in_loss: BtcCentsSatsToUsdPattern2 = BtcCentsSatsToUsdPattern2(client, 'supply_in_loss') @@ -4721,7 +4751,7 @@ class SeriesTree_Cohorts_Utxo_All_Realized_Loss: def __init__(self, client: BrkClientBase, base_path: str = ''): self.base: CentsUsdPattern2 = CentsUsdPattern2(client, 'realized_loss') self.cumulative: CentsUsdPattern2 = CentsUsdPattern2(client, 'realized_loss_cumulative') - self.sum: _1m1w1y24hPattern5 = _1m1w1y24hPattern5(client, 'realized_loss_sum') + self.sum: _1m1w1y24hPattern6 = _1m1w1y24hPattern6(client, 'realized_loss_sum') self.negative: BaseSumPattern = BaseSumPattern(client, 'neg_realized_loss') self.to_rcap: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'realized_loss_to_rcap') @@ -4855,7 +4885,7 @@ class SeriesTree_Cohorts_Utxo_All_Realized: self.net_pnl: BaseChangeCumulativeDeltaSumToPattern = BaseChangeCumulativeDeltaSumToPattern(client, 'net') self.sopr: SeriesTree_Cohorts_Utxo_All_Realized_Sopr = SeriesTree_Cohorts_Utxo_All_Realized_Sopr(client) self.gross_pnl: BaseCumulativeSumPattern = BaseCumulativeSumPattern(client, 'realized_gross_pnl') - self.sell_side_risk_ratio: _1m1w1y24hPattern6 = _1m1w1y24hPattern6(client, 'sell_side_risk_ratio') + self.sell_side_risk_ratio: _1m1w1y24hPattern7 = _1m1w1y24hPattern7(client, 'sell_side_risk_ratio') self.peak_regret: BaseCumulativeSumToPattern = BaseCumulativeSumToPattern(client, 'realized_peak_regret') self.investor: PricePattern = PricePattern(client, 'investor_price') self.profit_to_loss_ratio: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, 'realized_profit_to_loss_ratio') @@ -4947,7 +4977,7 @@ class SeriesTree_Cohorts_Utxo_Sth_Realized_Loss: def __init__(self, client: BrkClientBase, base_path: str = ''): self.base: CentsUsdPattern2 = CentsUsdPattern2(client, 'sth_realized_loss') self.cumulative: CentsUsdPattern2 = CentsUsdPattern2(client, 'sth_realized_loss_cumulative') - self.sum: _1m1w1y24hPattern5 = _1m1w1y24hPattern5(client, 'sth_realized_loss_sum') + self.sum: _1m1w1y24hPattern6 = _1m1w1y24hPattern6(client, 'sth_realized_loss_sum') self.negative: BaseSumPattern = BaseSumPattern(client, 'sth_neg_realized_loss') self.to_rcap: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'sth_realized_loss_to_rcap') @@ -5081,7 +5111,7 @@ class SeriesTree_Cohorts_Utxo_Sth_Realized: self.net_pnl: BaseChangeCumulativeDeltaSumToPattern = BaseChangeCumulativeDeltaSumToPattern(client, 'sth_net') self.sopr: SeriesTree_Cohorts_Utxo_Sth_Realized_Sopr = SeriesTree_Cohorts_Utxo_Sth_Realized_Sopr(client) self.gross_pnl: BaseCumulativeSumPattern = BaseCumulativeSumPattern(client, 'sth_realized_gross_pnl') - self.sell_side_risk_ratio: _1m1w1y24hPattern6 = _1m1w1y24hPattern6(client, 'sth_sell_side_risk_ratio') + self.sell_side_risk_ratio: _1m1w1y24hPattern7 = _1m1w1y24hPattern7(client, 'sth_sell_side_risk_ratio') self.peak_regret: BaseCumulativeSumToPattern = BaseCumulativeSumToPattern(client, 'sth_realized_peak_regret') self.investor: PricePattern = PricePattern(client, 'sth_investor_price') self.profit_to_loss_ratio: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, 'sth_realized_profit_to_loss_ratio') @@ -5146,7 +5176,7 @@ class SeriesTree_Cohorts_Utxo_Lth_Realized_Loss: def __init__(self, client: BrkClientBase, base_path: str = ''): self.base: CentsUsdPattern2 = CentsUsdPattern2(client, 'lth_realized_loss') self.cumulative: CentsUsdPattern2 = CentsUsdPattern2(client, 'lth_realized_loss_cumulative') - self.sum: _1m1w1y24hPattern5 = _1m1w1y24hPattern5(client, 'lth_realized_loss_sum') + self.sum: _1m1w1y24hPattern6 = _1m1w1y24hPattern6(client, 'lth_realized_loss_sum') self.negative: BaseSumPattern = BaseSumPattern(client, 'lth_neg_realized_loss') self.to_rcap: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'lth_realized_loss_to_rcap') @@ -5271,7 +5301,7 @@ class SeriesTree_Cohorts_Utxo_Lth_Realized: self.net_pnl: BaseChangeCumulativeDeltaSumToPattern = BaseChangeCumulativeDeltaSumToPattern(client, 'lth_net') self.sopr: SeriesTree_Cohorts_Utxo_Lth_Realized_Sopr = SeriesTree_Cohorts_Utxo_Lth_Realized_Sopr(client) self.gross_pnl: BaseCumulativeSumPattern = BaseCumulativeSumPattern(client, 'lth_realized_gross_pnl') - self.sell_side_risk_ratio: _1m1w1y24hPattern6 = _1m1w1y24hPattern6(client, 'lth_sell_side_risk_ratio') + self.sell_side_risk_ratio: _1m1w1y24hPattern7 = _1m1w1y24hPattern7(client, 'lth_sell_side_risk_ratio') self.peak_regret: BaseCumulativeSumToPattern = BaseCumulativeSumToPattern(client, 'lth_realized_peak_regret') self.investor: PricePattern = PricePattern(client, 'lth_investor_price') self.profit_to_loss_ratio: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, 'lth_realized_profit_to_loss_ratio') diff --git a/website/scripts/options/distribution/activity.js b/website/scripts/options/distribution/activity.js index d899aa35c..540c9202e 100644 --- a/website/scripts/options/distribution/activity.js +++ b/website/scripts/options/distribution/activity.js @@ -171,7 +171,7 @@ function singleSellSideRiskTree(sellSideRisk, title) { ...ROLLING_WINDOWS.map((w) => ({ name: w.name, title: title(`Sell Side Risk (${w.title})`), - bottom: percentRatio({ pattern: sellSideRisk[w.key], name: "Risk" }), + bottom: percentRatio({ pattern: sellSideRisk[w.key], name: "Risk", color: w.color }), })), ]; } diff --git a/website/scripts/options/network.js b/website/scripts/options/network.js index a222b00fa..b0274e955 100644 --- a/website/scripts/options/network.js +++ b/website/scripts/options/network.js @@ -377,40 +377,35 @@ export function createNetworkSection() { name: "Count", tree: [ { - name: "Sums", - tree: [ - { - name: "Compare", - title: "Block Count", - bottom: ROLLING_WINDOWS.map((w) => - line({ - series: blocks.count.total.sum[w.key], - name: w.name, - color: w.color, - unit: Unit.count, - }), - ), - }, - ...ROLLING_WINDOWS.map((w) => ({ + name: "Compare", + title: "Block Count", + bottom: ROLLING_WINDOWS.map((w) => + line({ + series: blocks.count.total.sum[w.key], name: w.name, - title: `Block Count ${w.title} Sum`, - bottom: [ - line({ - series: blocks.count.total.sum[w.key], - name: "Actual", - unit: Unit.count, - }), - line({ - series: blocks.count.target[w.key], - name: "Target", - color: colors.gray, - unit: Unit.count, - options: { lineStyle: 4 }, - }), - ], - })), - ], + color: w.color, + unit: Unit.count, + }), + ), }, + ...ROLLING_WINDOWS.map((w) => ({ + name: w.name, + title: `Block Count ${w.title}`, + bottom: [ + line({ + series: blocks.count.total.sum[w.key], + name: "Actual", + unit: Unit.count, + }), + line({ + series: blocks.count.target[w.key], + name: "Target", + color: colors.gray, + unit: Unit.count, + options: { lineStyle: 4 }, + }), + ], + })), { name: "Cumulative", title: "Block Count (Total)", diff --git a/website/scripts/options/series.js b/website/scripts/options/series.js index 16cbb82ec..9a8faf3cc 100644 --- a/website/scripts/options/series.js +++ b/website/scripts/options/series.js @@ -93,55 +93,13 @@ export function price({ function percentileSeries({ pattern, unit, title = "" }) { const { stat } = colors; return [ - dots({ - series: pattern.max, - name: `${title} max`.trim(), - color: stat.max, - unit, - defaultActive: false, - }), - dots({ - series: pattern.min, - name: `${title} min`.trim(), - color: stat.min, - unit, - defaultActive: false, - }), - dots({ - series: pattern.median, - name: `${title} median`.trim(), - color: stat.median, - unit, - defaultActive: false, - }), - dots({ - series: pattern.pct75, - name: `${title} pct75`.trim(), - color: stat.pct75, - unit, - defaultActive: false, - }), - dots({ - series: pattern.pct25, - name: `${title} pct25`.trim(), - color: stat.pct25, - unit, - defaultActive: false, - }), - dots({ - series: pattern.pct90, - name: `${title} pct90`.trim(), - color: stat.pct90, - unit, - defaultActive: false, - }), - dots({ - series: pattern.pct10, - name: `${title} pct10`.trim(), - color: stat.pct10, - unit, - defaultActive: false, - }), + line({ series: pattern.max, name: `${title} max`.trim(), color: stat.max, unit }), + line({ series: pattern.pct90, name: `${title} pct90`.trim(), color: stat.pct90, unit }), + line({ series: pattern.pct75, name: `${title} pct75`.trim(), color: stat.pct75, unit }), + line({ series: pattern.median, name: `${title} median`.trim(), color: stat.median, unit }), + line({ series: pattern.pct25, name: `${title} pct25`.trim(), color: stat.pct25, unit }), + line({ series: pattern.pct10, name: `${title} pct10`.trim(), color: stat.pct10, unit }), + line({ series: pattern.min, name: `${title} min`.trim(), color: stat.min, unit }), ]; } @@ -517,6 +475,59 @@ export function sumsArray({ windows, title, unit }) { })); } +/** + * Generic helper: compare + per-window sum+avg + cumulative. + * @template P + * @param {Object} args + * @param {{ _24h: P, _1w: P, _1m: P, _1y: P }} args.sum + * @param {{ _24h: P, _1w: P, _1m: P, _1y: P }} args.average + * @param {P} args.cumulative + * @param {string} args.title + * @param {Color} [args.color] + * @param {(args: { pattern: P, name: string, color?: Color, defaultActive?: boolean }) => AnyFetchedSeriesBlueprint[]} args.series + * @returns {PartialChartOption[]} + */ +export function sumsAndAveragesCumulativeWith({ + sum, + average, + cumulative, + title, + color, + series, +}) { + return [ + { + name: "Compare", + title: `${title} Averages`, + bottom: ROLLING_WINDOWS.flatMap((w) => + series({ + pattern: average[w.key], + name: w.name, + color: w.color, + }), + ), + }, + ...ROLLING_WINDOWS.map((w) => ({ + name: w.name, + title: `${title} ${w.title}`, + bottom: [ + ...series({ pattern: sum[w.key], name: "Sum", color: w.color }), + ...series({ + pattern: average[w.key], + name: "Avg", + color: w.color, + defaultActive: false, + }), + ], + })), + { + name: "Cumulative", + title: `${title} (Total)`, + bottom: series({ pattern: cumulative, name: "all-time", color }), + }, + ]; +} + /** * Flat array of per-window charts with both sum (active) and average (off by default) * @param {Object} args @@ -544,7 +555,7 @@ export function sumsAndAveragesArray({ sum, average, title, unit }) { } /** - * Windowed sum+avg charts + cumulative + * Compare + windowed sum+avg + cumulative (single unit) * @param {Object} args * @param {{ _24h: AnySeriesPattern, _1w: AnySeriesPattern, _1m: AnySeriesPattern, _1y: AnySeriesPattern }} args.sum * @param {{ _24h: AnySeriesPattern, _1w: AnySeriesPattern, _1m: AnySeriesPattern, _1y: AnySeriesPattern }} args.average @@ -555,21 +566,16 @@ export function sumsAndAveragesArray({ sum, average, title, unit }) { * @returns {PartialChartOption[]} */ export function sumsAndAveragesCumulative({ sum, average, cumulative, title, unit, color }) { - return [ - { - name: "Compare", - title: `${title} Averages`, - bottom: ROLLING_WINDOWS.map((w) => - line({ series: average[w.key], name: w.name, color: w.color, unit }), - ), - }, - ...sumsAndAveragesArray({ sum, average, title, unit }), - { - name: "Cumulative", - title: `${title} (Total)`, - bottom: [{ series: cumulative, title: "all-time", color, unit }], - }, - ]; + return sumsAndAveragesCumulativeWith({ + sum, + average, + cumulative, + title, + color, + series: ({ pattern, name, color, defaultActive }) => [ + line({ series: pattern, name, color, unit, defaultActive }), + ], + }); } /** @@ -601,13 +607,22 @@ export function sumsTree({ windows, title, unit, series }) { * @returns {PartialChartOption[]} */ export function averagesArray({ windows, title, unit }) { - return ROLLING_WINDOWS.map((w) => ({ - name: w.name, - title: `${title} ${w.title} Average`, - bottom: [ - line({ series: windows[w.key], name: w.name, color: w.color, unit }), - ], - })); + return [ + { + name: "Compare", + title: `${title} Averages`, + bottom: ROLLING_WINDOWS.map((w) => + line({ series: windows[w.key], name: w.name, color: w.color, unit }), + ), + }, + ...ROLLING_WINDOWS.map((w) => ({ + name: w.name, + title: `${title} ${w.title} Average`, + bottom: [ + line({ series: windows[w.key], name: w.name, color: w.color, unit }), + ], + })), + ]; } /** @@ -621,7 +636,7 @@ export function averagesArray({ windows, title, unit }) { */ export function distributionWindowsTree({ pattern, base, title, unit }) { return { - name: "Distributions", + name: "Distribution", tree: [ { name: "Compare", diff --git a/website/scripts/options/shared.js b/website/scripts/options/shared.js index b87d2bd31..f34f0f775 100644 --- a/website/scripts/options/shared.js +++ b/website/scripts/options/shared.js @@ -1,7 +1,7 @@ /** Shared helpers for options */ import { Unit } from "../utils/units.js"; -import { line, baseline, price, ROLLING_WINDOWS } from "./series.js"; +import { line, baseline, price, sumsAndAveragesCumulativeWith } from "./series.js"; import { priceLine, priceLines } from "./constants.js"; import { colors } from "../utils/colors.js"; @@ -224,45 +224,15 @@ export function satsBtcUsdRolling({ pattern, name, color, defaultActive }) { * @returns {PartialOptionsTree} */ export function satsBtcUsdFullTree({ pattern, title, color }) { - return [ - { - name: "Compare", - title: `${title} Average`, - bottom: ROLLING_WINDOWS.flatMap((w) => - satsBtcUsd({ - pattern: pattern.average[w.key], - name: w.name, - color: w.color, - }), - ), - }, - ...ROLLING_WINDOWS.map((w) => ({ - name: w.name, - title: `${title} ${w.title}`, - bottom: [ - ...satsBtcUsd({ - pattern: pattern.sum[w.key], - name: "Sum", - color: w.color, - }), - ...satsBtcUsd({ - pattern: pattern.average[w.key], - name: "Avg", - color: w.color, - defaultActive: false, - }), - ], - })), - { - name: "Cumulative", - title: `${title} (Total)`, - bottom: satsBtcUsd({ - pattern: pattern.cumulative, - name: "all-time", - color, - }), - }, - ]; + return sumsAndAveragesCumulativeWith({ + sum: pattern.sum, + average: pattern.average, + cumulative: pattern.cumulative, + title, + color, + series: ({ pattern, name, color, defaultActive }) => + satsBtcUsd({ pattern, name, color, defaultActive }), + }); } /**