diff --git a/crates/brk_client/src/lib.rs b/crates/brk_client/src/lib.rs index 28a64b756..e40e94609 100644 --- a/crates/brk_client/src/lib.rs +++ b/crates/brk_client/src/lib.rs @@ -1072,7 +1072,7 @@ impl _10y1m1w1y2y3m3y4y5y6m6y8yPattern3 { /// Pattern struct for repeated tree structure. pub struct CapGrossInvestorLossMvrvNetPeakPriceProfitSellSoprPattern { pub cap: CentsDeltaToUsdPattern, - pub gross_pnl: BaseCumulativeSumPattern4, + pub gross_pnl: BaseCumulativeSumPattern, pub investor: PricePattern, pub loss: BaseCumulativeNegativeSumToPattern, pub mvrv: SeriesPattern1, @@ -1227,31 +1227,16 @@ impl AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern { } /// Pattern struct for repeated tree structure. -pub struct AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern2 { - pub average: SeriesPattern18, - pub max: SeriesPattern18, - pub median: SeriesPattern18, - pub min: SeriesPattern18, - pub pct10: SeriesPattern18, - pub pct25: SeriesPattern18, - pub pct75: SeriesPattern18, - pub pct90: SeriesPattern18, -} - -impl AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern2 { - /// Create a new pattern node with accumulated series name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - average: SeriesPattern18::new(client.clone(), _m(&acc, "average")), - max: SeriesPattern18::new(client.clone(), _m(&acc, "max")), - median: SeriesPattern18::new(client.clone(), _m(&acc, "median")), - min: SeriesPattern18::new(client.clone(), _m(&acc, "min")), - pct10: SeriesPattern18::new(client.clone(), _m(&acc, "pct10")), - pct25: SeriesPattern18::new(client.clone(), _m(&acc, "pct25")), - pct75: SeriesPattern18::new(client.clone(), _m(&acc, "pct75")), - pct90: SeriesPattern18::new(client.clone(), _m(&acc, "pct90")), - } - } +pub struct GrossInvestedInvestorLossNetNuplProfitSentimentPattern2 { + pub gross_pnl: CentsUsdPattern2, + pub invested_capital: InPattern, + pub investor_cap_in_loss_raw: SeriesPattern18, + pub investor_cap_in_profit_raw: SeriesPattern18, + pub loss: CentsNegativeToUsdPattern2, + pub net_pnl: CentsToUsdPattern3, + pub nupl: BpsRatioPattern, + pub profit: CentsToUsdPattern4, + pub sentiment: GreedNetPainPattern, } /// Pattern struct for repeated tree structure. @@ -1266,34 +1251,6 @@ pub struct BpsCentsPercentilesRatioSatsSmaStdUsdPattern { pub usd: SeriesPattern1, } -/// Pattern struct for repeated tree structure. -pub struct AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern { - pub average: SeriesPattern1, - pub max: SeriesPattern1, - pub median: SeriesPattern1, - pub min: SeriesPattern1, - pub pct10: SeriesPattern1, - pub pct25: SeriesPattern1, - pub pct75: SeriesPattern1, - pub pct90: SeriesPattern1, -} - -impl AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern { - /// Create a new pattern node with accumulated series name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - average: SeriesPattern1::new(client.clone(), _m(&acc, "average")), - max: SeriesPattern1::new(client.clone(), _m(&acc, "max")), - median: SeriesPattern1::new(client.clone(), _m(&acc, "median")), - min: SeriesPattern1::new(client.clone(), _m(&acc, "min")), - pct10: SeriesPattern1::new(client.clone(), _m(&acc, "pct10")), - pct25: SeriesPattern1::new(client.clone(), _m(&acc, "pct25")), - pct75: SeriesPattern1::new(client.clone(), _m(&acc, "pct75")), - pct90: SeriesPattern1::new(client.clone(), _m(&acc, "pct90")), - } - } -} - /// Pattern struct for repeated tree structure. pub struct _10y2y3y4y5y6y8yPattern { pub _10y: BpsPercentRatioPattern, @@ -1353,7 +1310,7 @@ pub struct CapLossMvrvNetPriceProfitSoprPattern { pub mvrv: SeriesPattern1, pub net_pnl: BaseCumulativeDeltaSumPattern, pub price: BpsCentsRatioSatsUsdPattern, - pub profit: BaseCumulativeSumPattern4, + pub profit: BaseCumulativeSumPattern, pub sopr: RatioValuePattern, } @@ -1366,21 +1323,73 @@ impl CapLossMvrvNetPriceProfitSoprPattern { mvrv: SeriesPattern1::new(client.clone(), _m(&acc, "mvrv")), net_pnl: BaseCumulativeDeltaSumPattern::new(client.clone(), _m(&acc, "net_realized_pnl")), price: BpsCentsRatioSatsUsdPattern::new(client.clone(), _m(&acc, "realized_price")), - profit: BaseCumulativeSumPattern4::new(client.clone(), _m(&acc, "realized_profit")), + profit: BaseCumulativeSumPattern::new(client.clone(), _m(&acc, "realized_profit")), sopr: RatioValuePattern::new(client.clone(), acc.clone()), } } } /// Pattern struct for repeated tree structure. -pub struct GrossInvestedLossNetNuplProfitSentimentPattern2 { - pub gross_pnl: CentsUsdPattern2, - pub invested_capital: InPattern, - pub loss: CentsNegativeToUsdPattern2, - pub net_pnl: CentsToUsdPattern3, - pub nupl: BpsRatioPattern, - pub profit: CentsToUsdPattern4, - pub sentiment: GreedNetPainPattern, +pub struct InInvestedMaxMinPercentilesSupplyPattern { + pub in_loss: PerPattern, + pub in_profit: PerPattern, + pub invested_capital: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern, + pub max: CentsSatsUsdPattern, + pub min: CentsSatsUsdPattern, + pub percentiles: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern, + pub supply_density: BpsPercentRatioPattern3, +} + +/// Pattern struct for repeated tree structure. +pub struct MaxMedianMinPct10Pct25Pct75Pct90Pattern2 { + pub max: SeriesPattern18, + pub median: SeriesPattern18, + pub min: SeriesPattern18, + pub pct10: SeriesPattern18, + pub pct25: SeriesPattern18, + pub pct75: SeriesPattern18, + pub pct90: SeriesPattern18, +} + +impl MaxMedianMinPct10Pct25Pct75Pct90Pattern2 { + /// Create a new pattern node with accumulated series name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + max: SeriesPattern18::new(client.clone(), _m(&acc, "max")), + median: SeriesPattern18::new(client.clone(), _m(&acc, "median")), + min: SeriesPattern18::new(client.clone(), _m(&acc, "min")), + pct10: SeriesPattern18::new(client.clone(), _m(&acc, "pct10")), + pct25: SeriesPattern18::new(client.clone(), _m(&acc, "pct25")), + pct75: SeriesPattern18::new(client.clone(), _m(&acc, "pct75")), + pct90: SeriesPattern18::new(client.clone(), _m(&acc, "pct90")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct MaxMedianMinPct10Pct25Pct75Pct90Pattern { + pub max: SeriesPattern1, + pub median: SeriesPattern1, + pub min: SeriesPattern1, + pub pct10: SeriesPattern1, + pub pct25: SeriesPattern1, + pub pct75: SeriesPattern1, + pub pct90: SeriesPattern1, +} + +impl MaxMedianMinPct10Pct25Pct75Pct90Pattern { + /// Create a new pattern node with accumulated series name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + max: SeriesPattern1::new(client.clone(), _m(&acc, "max")), + median: SeriesPattern1::new(client.clone(), _m(&acc, "median")), + min: SeriesPattern1::new(client.clone(), _m(&acc, "min")), + pct10: SeriesPattern1::new(client.clone(), _m(&acc, "pct10")), + pct25: SeriesPattern1::new(client.clone(), _m(&acc, "pct25")), + pct75: SeriesPattern1::new(client.clone(), _m(&acc, "pct75")), + pct90: SeriesPattern1::new(client.clone(), _m(&acc, "pct90")), + } + } } /// Pattern struct for repeated tree structure. @@ -1431,6 +1440,30 @@ impl ActivityAddrOutputsRealizedSupplyUnrealizedPattern { } } +/// Pattern struct for repeated tree structure. +pub struct AverageBaseCumulativeInSumPattern { + pub average: _1m1w1y24hPattern3, + pub base: BtcCentsSatsUsdPattern, + pub cumulative: BtcCentsSatsUsdPattern, + pub in_loss: AverageBaseCumulativeSumPattern3, + pub in_profit: AverageBaseCumulativeSumPattern3, + pub sum: _1m1w1y24hPattern3, +} + +impl AverageBaseCumulativeInSumPattern { + /// Create a new pattern node with accumulated series name. + 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")), + 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")), + } + } +} + /// Pattern struct for repeated tree structure. pub struct BaseChangeCumulativeDeltaSumToPattern { pub base: CentsUsdPattern, @@ -1665,28 +1698,6 @@ impl ActivityOutputsRealizedSupplyUnrealizedPattern2 { } } -/// Pattern struct for repeated tree structure. -pub struct BaseCumulativeInSumPattern { - pub base: BtcCentsSatsUsdPattern, - pub cumulative: BtcCentsSatsUsdPattern, - pub in_loss: BaseCumulativeSumPattern3, - pub in_profit: BaseCumulativeSumPattern3, - pub sum: _1m1w1y24hPattern3, -} - -impl BaseCumulativeInSumPattern { - /// Create a new pattern node with accumulated series name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - base: BtcCentsSatsUsdPattern::new(client.clone(), acc.clone()), - cumulative: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "cumulative")), - in_loss: BaseCumulativeSumPattern3::new(client.clone(), _m(&acc, "in_loss")), - in_profit: BaseCumulativeSumPattern3::new(client.clone(), _m(&acc, "in_profit")), - sum: _1m1w1y24hPattern3::new(client.clone(), _m(&acc, "sum")), - } - } -} - /// Pattern struct for repeated tree structure. pub struct BaseCumulativeNegativeSumToPattern { pub base: CentsUsdPattern2, @@ -1787,10 +1798,10 @@ impl BtcCentsSatsToUsdPattern2 { /// Pattern struct for repeated tree structure. pub struct CapLossMvrvPriceProfitPattern { pub cap: CentsDeltaUsdPattern, - pub loss: BaseCumulativeSumPattern4, + pub loss: BaseCumulativeSumPattern, pub mvrv: SeriesPattern1, pub price: BpsCentsRatioSatsUsdPattern, - pub profit: BaseCumulativeSumPattern4, + pub profit: BaseCumulativeSumPattern, } impl CapLossMvrvPriceProfitPattern { @@ -1798,10 +1809,10 @@ impl CapLossMvrvPriceProfitPattern { pub fn new(client: Arc, acc: String) -> Self { Self { cap: CentsDeltaUsdPattern::new(client.clone(), _m(&acc, "realized_cap")), - loss: BaseCumulativeSumPattern4::new(client.clone(), _m(&acc, "realized_loss")), + loss: BaseCumulativeSumPattern::new(client.clone(), _m(&acc, "realized_loss")), mvrv: SeriesPattern1::new(client.clone(), _m(&acc, "mvrv")), price: BpsCentsRatioSatsUsdPattern::new(client.clone(), _m(&acc, "realized_price")), - profit: BaseCumulativeSumPattern4::new(client.clone(), _m(&acc, "realized_profit")), + profit: BaseCumulativeSumPattern::new(client.clone(), _m(&acc, "realized_profit")), } } } @@ -1859,15 +1870,6 @@ pub struct EmaHistogramLineSignalPattern { pub signal: SeriesPattern1, } -/// Pattern struct for repeated tree structure. -pub struct InvestedMaxMinPercentilesSupplyPattern { - pub invested_capital: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern, - pub max: CentsSatsUsdPattern, - pub min: CentsSatsUsdPattern, - pub percentiles: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern, - pub supply_density: BpsPercentRatioPattern3, -} - /// Pattern struct for repeated tree structure. pub struct PhsReboundThsPattern { pub phs: SeriesPattern1, @@ -2040,6 +2042,46 @@ pub struct _1y2y4yAllPattern { pub all: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern, } +/// Pattern struct for repeated tree structure. +pub struct AverageBaseCumulativeSumPattern2 { + pub average: _1m1w1y24hPattern, + pub base: SeriesPattern1, + pub cumulative: SeriesPattern1, + pub sum: _1m1w1y24hPattern, +} + +impl AverageBaseCumulativeSumPattern2 { + /// Create a new pattern node with accumulated series name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + average: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "average")), + base: SeriesPattern1::new(client.clone(), acc.clone()), + cumulative: SeriesPattern1::new(client.clone(), _m(&acc, "cumulative")), + sum: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "sum")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct AverageBaseCumulativeSumPattern3 { + pub average: _1m1w1y24hPattern3, + pub base: BtcCentsSatsUsdPattern, + pub cumulative: BtcCentsSatsUsdPattern, + pub sum: _1m1w1y24hPattern3, +} + +impl AverageBaseCumulativeSumPattern3 { + /// Create a new pattern node with accumulated series name. + 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")), + } + } +} + /// Pattern struct for repeated tree structure. pub struct BaseCumulativeDeltaSumPattern { pub base: CentsUsdPattern, @@ -2182,10 +2224,10 @@ impl CentsToUsdPattern3 { /// Pattern struct for repeated tree structure. pub struct CoindaysCoinyearsDormancyTransferPattern { - pub coindays_destroyed: BaseCumulativeSumPattern, + pub coindays_destroyed: AverageBaseCumulativeSumPattern, pub coinyears_destroyed: SeriesPattern1, pub dormancy: _1m1w1y24hPattern, - pub transfer_volume: BaseCumulativeInSumPattern, + pub transfer_volume: AverageBaseCumulativeInSumPattern, } /// Pattern struct for repeated tree structure. @@ -2229,38 +2271,40 @@ impl _1m1w1y24hPattern { } /// Pattern struct for repeated tree structure. -pub struct AdjustedRatioValuePattern { - pub adjusted: RatioTransferValuePattern, - pub ratio: _1m1w1y24hPattern, - pub value_destroyed: BaseCumulativeSumPattern, +pub struct AverageBaseCumulativeSumPattern { + pub average: _1m1w1y24hPattern, + pub base: SeriesPattern1, + pub cumulative: SeriesPattern1, + pub sum: _1m1w1y24hPattern, } -/// Pattern struct for repeated tree structure. -pub struct BaseCumulativeSumPattern3 { - pub base: BtcCentsSatsUsdPattern, - pub cumulative: BtcCentsSatsUsdPattern, - pub sum: _1m1w1y24hPattern3, -} - -impl BaseCumulativeSumPattern3 { +impl AverageBaseCumulativeSumPattern { /// Create a new pattern node with accumulated series name. pub fn new(client: Arc, acc: String) -> Self { Self { - base: BtcCentsSatsUsdPattern::new(client.clone(), acc.clone()), - cumulative: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "cumulative")), - sum: _1m1w1y24hPattern3::new(client.clone(), _m(&acc, "sum")), + average: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "average")), + base: SeriesPattern1::new(client.clone(), acc.clone()), + cumulative: SeriesPattern1::new(client.clone(), _m(&acc, "cumulative")), + sum: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "sum")), } } } /// Pattern struct for repeated tree structure. -pub struct BaseCumulativeSumPattern4 { +pub struct AdjustedRatioValuePattern { + pub adjusted: RatioTransferValuePattern, + pub ratio: _1m1w1y24hPattern, + pub value_destroyed: AverageBaseCumulativeSumPattern, +} + +/// Pattern struct for repeated tree structure. +pub struct BaseCumulativeSumPattern { pub base: CentsUsdPattern2, pub cumulative: CentsUsdPattern2, pub sum: _1m1w1y24hPattern5, } -impl BaseCumulativeSumPattern4 { +impl BaseCumulativeSumPattern { /// Create a new pattern node with accumulated series name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -2271,38 +2315,20 @@ impl BaseCumulativeSumPattern4 { } } -/// Pattern struct for repeated tree structure. -pub struct BaseCumulativeSumPattern2 { - pub base: SeriesPattern1, - pub cumulative: SeriesPattern1, - pub sum: _1m1w1y24hPattern, -} - -impl BaseCumulativeSumPattern2 { - /// Create a new pattern node with accumulated series name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - base: SeriesPattern1::new(client.clone(), acc.clone()), - cumulative: SeriesPattern1::new(client.clone(), _m(&acc, "cumulative")), - sum: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "sum")), - } - } -} - /// Pattern struct for repeated tree structure. pub struct BlocksDominanceRewardsPattern { - pub blocks_mined: BaseCumulativeSumPattern2, + pub blocks_mined: AverageBaseCumulativeSumPattern2, pub dominance: _1m1w1y24hBpsPercentRatioPattern, - pub rewards: BaseCumulativeSumPattern3, + pub rewards: AverageBaseCumulativeSumPattern3, } impl BlocksDominanceRewardsPattern { /// Create a new pattern node with accumulated series name. pub fn new(client: Arc, acc: String) -> Self { Self { - blocks_mined: BaseCumulativeSumPattern2::new(client.clone(), _m(&acc, "blocks_mined")), + blocks_mined: AverageBaseCumulativeSumPattern2::new(client.clone(), _m(&acc, "blocks_mined")), dominance: _1m1w1y24hBpsPercentRatioPattern::new(client.clone(), _m(&acc, "dominance")), - rewards: BaseCumulativeSumPattern3::new(client.clone(), _m(&acc, "rewards")), + rewards: AverageBaseCumulativeSumPattern3::new(client.clone(), _m(&acc, "rewards")), } } } @@ -2551,14 +2577,14 @@ impl NuplRealizedSupplyPattern { /// Pattern struct for repeated tree structure. pub struct RatioTransferValuePattern { pub ratio: _1m1w1y24hPattern, - pub transfer_volume: BaseCumulativeSumPattern, - pub value_destroyed: BaseCumulativeSumPattern, + pub transfer_volume: AverageBaseCumulativeSumPattern, + pub value_destroyed: AverageBaseCumulativeSumPattern, } /// Pattern struct for repeated tree structure. pub struct _6bBlockTxPattern { - pub _6b: AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern, - pub block: AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern, + pub _6b: MaxMedianMinPct10Pct25Pct75Pct90Pattern, + pub block: MaxMedianMinPct10Pct25Pct75Pct90Pattern, pub tx_index: SeriesPattern19, } @@ -2566,31 +2592,13 @@ impl _6bBlockTxPattern { /// Create a new pattern node with accumulated series name. pub fn new(client: Arc, acc: String) -> Self { Self { - _6b: AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern::new(client.clone(), _m(&acc, "6b")), - block: AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern::new(client.clone(), acc.clone()), + _6b: MaxMedianMinPct10Pct25Pct75Pct90Pattern::new(client.clone(), _m(&acc, "6b")), + block: MaxMedianMinPct10Pct25Pct75Pct90Pattern::new(client.clone(), acc.clone()), tx_index: SeriesPattern19::new(client.clone(), acc.clone()), } } } -/// Pattern struct for repeated tree structure. -pub struct BaseCumulativeSumPattern { - pub base: SeriesPattern1, - pub cumulative: SeriesPattern1, - pub sum: _1m1w1y24hPattern, -} - -impl BaseCumulativeSumPattern { - /// Create a new pattern node with accumulated series name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - base: SeriesPattern1::new(client.clone(), acc.clone()), - cumulative: SeriesPattern1::new(client.clone(), _m(&acc, "cumulative")), - sum: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "sum")), - } - } -} - /// Pattern struct for repeated tree structure. pub struct AbsoluteRatePattern { pub absolute: _1m1w1y24hPattern, @@ -2689,7 +2697,7 @@ impl BaseDeltaPattern { /// Pattern struct for repeated tree structure. pub struct BlocksDominancePattern { - pub blocks_mined: BaseCumulativeSumPattern2, + pub blocks_mined: AverageBaseCumulativeSumPattern2, pub dominance: BpsPercentRatioPattern3, } @@ -2697,7 +2705,7 @@ impl BlocksDominancePattern { /// Create a new pattern node with accumulated series name. pub fn new(client: Arc, acc: String) -> Self { Self { - blocks_mined: BaseCumulativeSumPattern2::new(client.clone(), _m(&acc, "blocks_mined")), + blocks_mined: AverageBaseCumulativeSumPattern2::new(client.clone(), _m(&acc, "blocks_mined")), dominance: BpsPercentRatioPattern3::new(client.clone(), _m(&acc, "dominance")), } } @@ -2769,16 +2777,16 @@ impl CentsUsdPattern { /// Pattern struct for repeated tree structure. pub struct CoindaysTransferPattern { - pub coindays_destroyed: BaseCumulativeSumPattern, - pub transfer_volume: BaseCumulativeInSumPattern, + pub coindays_destroyed: AverageBaseCumulativeSumPattern, + pub transfer_volume: AverageBaseCumulativeInSumPattern, } impl CoindaysTransferPattern { /// Create a new pattern node with accumulated series name. pub fn new(client: Arc, acc: String) -> Self { Self { - coindays_destroyed: BaseCumulativeSumPattern::new(client.clone(), _m(&acc, "coindays_destroyed")), - transfer_volume: BaseCumulativeInSumPattern::new(client.clone(), _m(&acc, "transfer_volume")), + coindays_destroyed: AverageBaseCumulativeSumPattern::new(client.clone(), _m(&acc, "coindays_destroyed")), + transfer_volume: AverageBaseCumulativeInSumPattern::new(client.clone(), _m(&acc, "transfer_volume")), } } } @@ -2799,6 +2807,22 @@ impl InPattern { } } +/// Pattern struct for repeated tree structure. +pub struct PerPattern { + pub per_coin: CentsSatsUsdPattern, + pub per_dollar: CentsSatsUsdPattern, +} + +impl PerPattern { + /// Create a new pattern node with accumulated series name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + per_coin: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "coin")), + per_dollar: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "dollar")), + } + } +} + /// Pattern struct for repeated tree structure. pub struct PriceRatioPattern { pub price: CentsSatsUsdPattern, @@ -2818,7 +2842,7 @@ impl PriceRatioPattern { /// Pattern struct for repeated tree structure. pub struct RatioValuePattern { pub ratio: _24hPattern, - pub value_destroyed: BaseCumulativeSumPattern, + pub value_destroyed: AverageBaseCumulativeSumPattern, } impl RatioValuePattern { @@ -2826,7 +2850,7 @@ impl RatioValuePattern { pub fn new(client: Arc, acc: String) -> Self { Self { ratio: _24hPattern::new(client.clone(), _m(&acc, "sopr_24h")), - value_destroyed: BaseCumulativeSumPattern::new(client.clone(), _m(&acc, "value_destroyed")), + value_destroyed: AverageBaseCumulativeSumPattern::new(client.clone(), _m(&acc, "value_destroyed")), } } } @@ -2897,14 +2921,14 @@ impl PricePattern { /// Pattern struct for repeated tree structure. pub struct TransferPattern { - pub transfer_volume: BaseCumulativeSumPattern3, + pub transfer_volume: AverageBaseCumulativeSumPattern3, } impl TransferPattern { /// Create a new pattern node with accumulated series name. pub fn new(client: Arc, acc: String) -> Self { Self { - transfer_volume: BaseCumulativeSumPattern3::new(client.clone(), acc.clone()), + transfer_volume: AverageBaseCumulativeSumPattern3::new(client.clone(), acc.clone()), } } } @@ -3112,14 +3136,14 @@ impl SeriesTree_Blocks_Weight { /// Series tree node. pub struct SeriesTree_Blocks_Count { pub target: _1m1w1y24hPattern, - pub total: BaseCumulativeSumPattern2, + pub total: AverageBaseCumulativeSumPattern2, } impl SeriesTree_Blocks_Count { pub fn new(client: Arc, base_path: String) -> Self { Self { target: _1m1w1y24hPattern::new(client.clone(), "block_count_target".to_string()), - total: BaseCumulativeSumPattern2::new(client.clone(), "block_count".to_string()), + total: AverageBaseCumulativeSumPattern2::new(client.clone(), "block_count".to_string()), } } } @@ -3342,16 +3366,16 @@ impl SeriesTree_Transactions_Size { /// Series tree node. pub struct SeriesTree_Transactions_Size_Weight { pub tx_index: SeriesPattern19, - pub block: AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern2, - pub _6b: AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern2, + pub block: MaxMedianMinPct10Pct25Pct75Pct90Pattern2, + pub _6b: MaxMedianMinPct10Pct25Pct75Pct90Pattern2, } impl SeriesTree_Transactions_Size_Weight { pub fn new(client: Arc, base_path: String) -> Self { Self { tx_index: SeriesPattern19::new(client.clone(), "tx_weight".to_string()), - block: AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern2::new(client.clone(), "tx_weight".to_string()), - _6b: AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern2::new(client.clone(), "tx_weight_6b".to_string()), + block: MaxMedianMinPct10Pct25Pct75Pct90Pattern2::new(client.clone(), "tx_weight".to_string()), + _6b: MaxMedianMinPct10Pct25Pct75Pct90Pattern2::new(client.clone(), "tx_weight_6b".to_string()), } } } @@ -3377,24 +3401,24 @@ impl SeriesTree_Transactions_Fees { /// Series tree node. pub struct SeriesTree_Transactions_Versions { - pub v1: BaseCumulativeSumPattern, - pub v2: BaseCumulativeSumPattern, - pub v3: BaseCumulativeSumPattern, + pub v1: AverageBaseCumulativeSumPattern, + pub v2: AverageBaseCumulativeSumPattern, + pub v3: AverageBaseCumulativeSumPattern, } impl SeriesTree_Transactions_Versions { pub fn new(client: Arc, base_path: String) -> Self { Self { - v1: BaseCumulativeSumPattern::new(client.clone(), "tx_v1".to_string()), - v2: BaseCumulativeSumPattern::new(client.clone(), "tx_v2".to_string()), - v3: BaseCumulativeSumPattern::new(client.clone(), "tx_v3".to_string()), + v1: AverageBaseCumulativeSumPattern::new(client.clone(), "tx_v1".to_string()), + v2: AverageBaseCumulativeSumPattern::new(client.clone(), "tx_v2".to_string()), + v3: AverageBaseCumulativeSumPattern::new(client.clone(), "tx_v3".to_string()), } } } /// Series tree node. pub struct SeriesTree_Transactions_Volume { - pub transfer_volume: BaseCumulativeSumPattern3, + pub transfer_volume: AverageBaseCumulativeSumPattern3, pub tx_per_sec: _1m1w1y24hPattern, pub outputs_per_sec: _1m1w1y24hPattern, pub inputs_per_sec: _1m1w1y24hPattern, @@ -3403,7 +3427,7 @@ pub struct SeriesTree_Transactions_Volume { impl SeriesTree_Transactions_Volume { pub fn new(client: Arc, base_path: String) -> Self { Self { - transfer_volume: BaseCumulativeSumPattern3::new(client.clone(), "transfer_volume_bis".to_string()), + transfer_volume: AverageBaseCumulativeSumPattern3::new(client.clone(), "transfer_volume_bis".to_string()), tx_per_sec: _1m1w1y24hPattern::new(client.clone(), "tx_per_sec".to_string()), outputs_per_sec: _1m1w1y24hPattern::new(client.clone(), "outputs_per_sec".to_string()), inputs_per_sec: _1m1w1y24hPattern::new(client.clone(), "inputs_per_sec".to_string()), @@ -3783,29 +3807,29 @@ impl SeriesTree_Addrs_Activity { /// Series tree node. pub struct SeriesTree_Addrs_New { - pub all: BaseCumulativeSumPattern, - pub p2pk65: BaseCumulativeSumPattern, - pub p2pk33: BaseCumulativeSumPattern, - pub p2pkh: BaseCumulativeSumPattern, - pub p2sh: BaseCumulativeSumPattern, - pub p2wpkh: BaseCumulativeSumPattern, - pub p2wsh: BaseCumulativeSumPattern, - pub p2tr: BaseCumulativeSumPattern, - pub p2a: BaseCumulativeSumPattern, + pub all: AverageBaseCumulativeSumPattern, + pub p2pk65: AverageBaseCumulativeSumPattern, + pub p2pk33: AverageBaseCumulativeSumPattern, + pub p2pkh: AverageBaseCumulativeSumPattern, + pub p2sh: AverageBaseCumulativeSumPattern, + pub p2wpkh: AverageBaseCumulativeSumPattern, + pub p2wsh: AverageBaseCumulativeSumPattern, + pub p2tr: AverageBaseCumulativeSumPattern, + pub p2a: AverageBaseCumulativeSumPattern, } impl SeriesTree_Addrs_New { pub fn new(client: Arc, base_path: String) -> Self { Self { - all: BaseCumulativeSumPattern::new(client.clone(), "new_addr_count".to_string()), - p2pk65: BaseCumulativeSumPattern::new(client.clone(), "p2pk65_new_addr_count".to_string()), - p2pk33: BaseCumulativeSumPattern::new(client.clone(), "p2pk33_new_addr_count".to_string()), - p2pkh: BaseCumulativeSumPattern::new(client.clone(), "p2pkh_new_addr_count".to_string()), - p2sh: BaseCumulativeSumPattern::new(client.clone(), "p2sh_new_addr_count".to_string()), - p2wpkh: BaseCumulativeSumPattern::new(client.clone(), "p2wpkh_new_addr_count".to_string()), - p2wsh: BaseCumulativeSumPattern::new(client.clone(), "p2wsh_new_addr_count".to_string()), - p2tr: BaseCumulativeSumPattern::new(client.clone(), "p2tr_new_addr_count".to_string()), - p2a: BaseCumulativeSumPattern::new(client.clone(), "p2a_new_addr_count".to_string()), + all: AverageBaseCumulativeSumPattern::new(client.clone(), "new_addr_count".to_string()), + p2pk65: AverageBaseCumulativeSumPattern::new(client.clone(), "p2pk65_new_addr_count".to_string()), + p2pk33: AverageBaseCumulativeSumPattern::new(client.clone(), "p2pk33_new_addr_count".to_string()), + p2pkh: AverageBaseCumulativeSumPattern::new(client.clone(), "p2pkh_new_addr_count".to_string()), + p2sh: AverageBaseCumulativeSumPattern::new(client.clone(), "p2sh_new_addr_count".to_string()), + p2wpkh: AverageBaseCumulativeSumPattern::new(client.clone(), "p2wpkh_new_addr_count".to_string()), + p2wsh: AverageBaseCumulativeSumPattern::new(client.clone(), "p2wsh_new_addr_count".to_string()), + p2tr: AverageBaseCumulativeSumPattern::new(client.clone(), "p2tr_new_addr_count".to_string()), + p2a: AverageBaseCumulativeSumPattern::new(client.clone(), "p2a_new_addr_count".to_string()), } } } @@ -3937,48 +3961,48 @@ impl SeriesTree_Scripts_Raw_Unknown { /// Series tree node. pub struct SeriesTree_Scripts_Count { - pub p2a: BaseCumulativeSumPattern, - pub p2ms: BaseCumulativeSumPattern, - pub p2pk33: BaseCumulativeSumPattern, - pub p2pk65: BaseCumulativeSumPattern, - pub p2pkh: BaseCumulativeSumPattern, - pub p2sh: BaseCumulativeSumPattern, - pub p2tr: BaseCumulativeSumPattern, - pub p2wpkh: BaseCumulativeSumPattern, - pub p2wsh: BaseCumulativeSumPattern, - pub op_return: BaseCumulativeSumPattern, - pub empty_output: BaseCumulativeSumPattern, - pub unknown_output: BaseCumulativeSumPattern, + pub p2a: AverageBaseCumulativeSumPattern, + pub p2ms: AverageBaseCumulativeSumPattern, + pub p2pk33: AverageBaseCumulativeSumPattern, + pub p2pk65: AverageBaseCumulativeSumPattern, + pub p2pkh: AverageBaseCumulativeSumPattern, + pub p2sh: AverageBaseCumulativeSumPattern, + pub p2tr: AverageBaseCumulativeSumPattern, + pub p2wpkh: AverageBaseCumulativeSumPattern, + pub p2wsh: AverageBaseCumulativeSumPattern, + pub op_return: AverageBaseCumulativeSumPattern, + pub empty_output: AverageBaseCumulativeSumPattern, + pub unknown_output: AverageBaseCumulativeSumPattern, } impl SeriesTree_Scripts_Count { pub fn new(client: Arc, base_path: String) -> Self { Self { - p2a: BaseCumulativeSumPattern::new(client.clone(), "p2a_count".to_string()), - p2ms: BaseCumulativeSumPattern::new(client.clone(), "p2ms_count".to_string()), - p2pk33: BaseCumulativeSumPattern::new(client.clone(), "p2pk33_count".to_string()), - p2pk65: BaseCumulativeSumPattern::new(client.clone(), "p2pk65_count".to_string()), - p2pkh: BaseCumulativeSumPattern::new(client.clone(), "p2pkh_count".to_string()), - p2sh: BaseCumulativeSumPattern::new(client.clone(), "p2sh_count".to_string()), - p2tr: BaseCumulativeSumPattern::new(client.clone(), "p2tr_count".to_string()), - p2wpkh: BaseCumulativeSumPattern::new(client.clone(), "p2wpkh_count".to_string()), - p2wsh: BaseCumulativeSumPattern::new(client.clone(), "p2wsh_count".to_string()), - op_return: BaseCumulativeSumPattern::new(client.clone(), "op_return_count".to_string()), - empty_output: BaseCumulativeSumPattern::new(client.clone(), "empty_output_count".to_string()), - unknown_output: BaseCumulativeSumPattern::new(client.clone(), "unknown_output_count".to_string()), + p2a: AverageBaseCumulativeSumPattern::new(client.clone(), "p2a_count".to_string()), + p2ms: AverageBaseCumulativeSumPattern::new(client.clone(), "p2ms_count".to_string()), + p2pk33: AverageBaseCumulativeSumPattern::new(client.clone(), "p2pk33_count".to_string()), + p2pk65: AverageBaseCumulativeSumPattern::new(client.clone(), "p2pk65_count".to_string()), + p2pkh: AverageBaseCumulativeSumPattern::new(client.clone(), "p2pkh_count".to_string()), + p2sh: AverageBaseCumulativeSumPattern::new(client.clone(), "p2sh_count".to_string()), + p2tr: AverageBaseCumulativeSumPattern::new(client.clone(), "p2tr_count".to_string()), + p2wpkh: AverageBaseCumulativeSumPattern::new(client.clone(), "p2wpkh_count".to_string()), + p2wsh: AverageBaseCumulativeSumPattern::new(client.clone(), "p2wsh_count".to_string()), + op_return: AverageBaseCumulativeSumPattern::new(client.clone(), "op_return_count".to_string()), + empty_output: AverageBaseCumulativeSumPattern::new(client.clone(), "empty_output_count".to_string()), + unknown_output: AverageBaseCumulativeSumPattern::new(client.clone(), "unknown_output_count".to_string()), } } } /// Series tree node. pub struct SeriesTree_Scripts_Value { - pub op_return: BaseCumulativeSumPattern3, + pub op_return: AverageBaseCumulativeSumPattern3, } impl SeriesTree_Scripts_Value { pub fn new(client: Arc, base_path: String) -> Self { Self { - op_return: BaseCumulativeSumPattern3::new(client.clone(), "op_return_value".to_string()), + op_return: AverageBaseCumulativeSumPattern3::new(client.clone(), "op_return_value".to_string()), } } } @@ -4000,7 +4024,7 @@ impl SeriesTree_Mining { /// Series tree node. pub struct SeriesTree_Mining_Rewards { - pub coinbase: BaseCumulativeSumPattern3, + pub coinbase: AverageBaseCumulativeSumPattern3, pub subsidy: SeriesTree_Mining_Rewards_Subsidy, pub fees: SeriesTree_Mining_Rewards_Fees, pub unclaimed: SeriesTree_Mining_Rewards_Unclaimed, @@ -4009,7 +4033,7 @@ pub struct SeriesTree_Mining_Rewards { impl SeriesTree_Mining_Rewards { pub fn new(client: Arc, base_path: String) -> Self { Self { - coinbase: BaseCumulativeSumPattern3::new(client.clone(), "coinbase".to_string()), + coinbase: AverageBaseCumulativeSumPattern3::new(client.clone(), "coinbase".to_string()), subsidy: SeriesTree_Mining_Rewards_Subsidy::new(client.clone(), format!("{base_path}_subsidy")), fees: SeriesTree_Mining_Rewards_Fees::new(client.clone(), format!("{base_path}_fees")), unclaimed: SeriesTree_Mining_Rewards_Unclaimed::new(client.clone(), format!("{base_path}_unclaimed")), @@ -4204,23 +4228,23 @@ impl SeriesTree_Cointime { /// Series tree node. pub struct SeriesTree_Cointime_Activity { - pub coinblocks_created: BaseCumulativeSumPattern, - pub coinblocks_stored: BaseCumulativeSumPattern, + pub coinblocks_created: AverageBaseCumulativeSumPattern, + pub coinblocks_stored: AverageBaseCumulativeSumPattern, pub liveliness: SeriesPattern1, pub vaultedness: SeriesPattern1, pub ratio: SeriesPattern1, - pub coinblocks_destroyed: BaseCumulativeSumPattern, + pub coinblocks_destroyed: AverageBaseCumulativeSumPattern, } impl SeriesTree_Cointime_Activity { pub fn new(client: Arc, base_path: String) -> Self { Self { - coinblocks_created: BaseCumulativeSumPattern::new(client.clone(), "coinblocks_created".to_string()), - coinblocks_stored: BaseCumulativeSumPattern::new(client.clone(), "coinblocks_stored".to_string()), + coinblocks_created: AverageBaseCumulativeSumPattern::new(client.clone(), "coinblocks_created".to_string()), + coinblocks_stored: AverageBaseCumulativeSumPattern::new(client.clone(), "coinblocks_stored".to_string()), liveliness: SeriesPattern1::new(client.clone(), "liveliness".to_string()), vaultedness: SeriesPattern1::new(client.clone(), "vaultedness".to_string()), ratio: SeriesPattern1::new(client.clone(), "activity_to_vaultedness".to_string()), - coinblocks_destroyed: BaseCumulativeSumPattern::new(client.clone(), "coinblocks_destroyed".to_string()), + coinblocks_destroyed: AverageBaseCumulativeSumPattern::new(client.clone(), "coinblocks_destroyed".to_string()), } } } @@ -4242,19 +4266,19 @@ impl SeriesTree_Cointime_Supply { /// Series tree node. pub struct SeriesTree_Cointime_Value { - pub destroyed: BaseCumulativeSumPattern, - pub created: BaseCumulativeSumPattern, - pub stored: BaseCumulativeSumPattern, - pub vocdd: BaseCumulativeSumPattern, + pub destroyed: AverageBaseCumulativeSumPattern, + pub created: AverageBaseCumulativeSumPattern, + pub stored: AverageBaseCumulativeSumPattern, + pub vocdd: AverageBaseCumulativeSumPattern, } impl SeriesTree_Cointime_Value { pub fn new(client: Arc, base_path: String) -> Self { Self { - destroyed: BaseCumulativeSumPattern::new(client.clone(), "cointime_value_destroyed".to_string()), - created: BaseCumulativeSumPattern::new(client.clone(), "cointime_value_created".to_string()), - stored: BaseCumulativeSumPattern::new(client.clone(), "cointime_value_stored".to_string()), - vocdd: BaseCumulativeSumPattern::new(client.clone(), "vocdd".to_string()), + destroyed: AverageBaseCumulativeSumPattern::new(client.clone(), "cointime_value_destroyed".to_string()), + created: AverageBaseCumulativeSumPattern::new(client.clone(), "cointime_value_created".to_string()), + stored: AverageBaseCumulativeSumPattern::new(client.clone(), "cointime_value_stored".to_string()), + vocdd: AverageBaseCumulativeSumPattern::new(client.clone(), "vocdd".to_string()), } } } @@ -6159,7 +6183,7 @@ impl SeriesTree_Prices_Spot { pub struct SeriesTree_Supply { pub state: SeriesPattern18, pub circulating: BtcCentsSatsUsdPattern, - pub burned: BaseCumulativeSumPattern3, + pub burned: AverageBaseCumulativeSumPattern3, pub inflation_rate: BpsPercentRatioPattern, pub velocity: SeriesTree_Supply_Velocity, pub market_cap: CentsDeltaUsdPattern, @@ -6172,7 +6196,7 @@ impl SeriesTree_Supply { Self { state: SeriesPattern18::new(client.clone(), "supply_state".to_string()), circulating: BtcCentsSatsUsdPattern::new(client.clone(), "circulating_supply".to_string()), - burned: BaseCumulativeSumPattern3::new(client.clone(), "unspendable_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()), @@ -6297,8 +6321,8 @@ impl SeriesTree_Cohorts_Utxo_All_Supply { /// Series tree node. pub struct SeriesTree_Cohorts_Utxo_All_Activity { - pub transfer_volume: BaseCumulativeInSumPattern, - pub coindays_destroyed: BaseCumulativeSumPattern, + pub transfer_volume: AverageBaseCumulativeInSumPattern, + pub coindays_destroyed: AverageBaseCumulativeSumPattern, pub coinyears_destroyed: SeriesPattern1, pub dormancy: _1m1w1y24hPattern, } @@ -6306,8 +6330,8 @@ pub struct SeriesTree_Cohorts_Utxo_All_Activity { impl SeriesTree_Cohorts_Utxo_All_Activity { pub fn new(client: Arc, base_path: String) -> Self { Self { - transfer_volume: BaseCumulativeInSumPattern::new(client.clone(), "transfer_volume".to_string()), - coindays_destroyed: BaseCumulativeSumPattern::new(client.clone(), "coindays_destroyed".to_string()), + transfer_volume: AverageBaseCumulativeInSumPattern::new(client.clone(), "transfer_volume".to_string()), + coindays_destroyed: AverageBaseCumulativeSumPattern::new(client.clone(), "coindays_destroyed".to_string()), coinyears_destroyed: SeriesPattern1::new(client.clone(), "coinyears_destroyed".to_string()), dormancy: _1m1w1y24hPattern::new(client.clone(), "dormancy".to_string()), } @@ -6323,7 +6347,7 @@ pub struct SeriesTree_Cohorts_Utxo_All_Realized { pub mvrv: SeriesPattern1, pub net_pnl: BaseChangeCumulativeDeltaSumToPattern, pub sopr: SeriesTree_Cohorts_Utxo_All_Realized_Sopr, - pub gross_pnl: BaseCumulativeSumPattern4, + pub gross_pnl: BaseCumulativeSumPattern, pub sell_side_risk_ratio: _1m1w1y24hPattern6, pub peak_regret: BaseCumulativeSumToPattern, pub investor: PricePattern, @@ -6340,7 +6364,7 @@ impl SeriesTree_Cohorts_Utxo_All_Realized { mvrv: SeriesPattern1::new(client.clone(), "mvrv".to_string()), 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: BaseCumulativeSumPattern4::new(client.clone(), "realized_gross_pnl".to_string()), + 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()), peak_regret: BaseCumulativeSumToPattern::new(client.clone(), "realized_peak_regret".to_string()), investor: PricePattern::new(client.clone(), "investor_price".to_string()), @@ -6582,7 +6606,7 @@ impl SeriesTree_Cohorts_Utxo_All_Realized_Price_StdDev_1y { /// Series tree node. pub struct SeriesTree_Cohorts_Utxo_All_Realized_Sopr { - pub value_destroyed: BaseCumulativeSumPattern, + pub value_destroyed: AverageBaseCumulativeSumPattern, pub ratio: _1m1w1y24hPattern, pub adjusted: SeriesTree_Cohorts_Utxo_All_Realized_Sopr_Adjusted, } @@ -6590,7 +6614,7 @@ pub struct SeriesTree_Cohorts_Utxo_All_Realized_Sopr { impl SeriesTree_Cohorts_Utxo_All_Realized_Sopr { pub fn new(client: Arc, base_path: String) -> Self { Self { - value_destroyed: BaseCumulativeSumPattern::new(client.clone(), "value_destroyed".to_string()), + value_destroyed: AverageBaseCumulativeSumPattern::new(client.clone(), "value_destroyed".to_string()), ratio: _1m1w1y24hPattern::new(client.clone(), "sopr".to_string()), adjusted: SeriesTree_Cohorts_Utxo_All_Realized_Sopr_Adjusted::new(client.clone(), format!("{base_path}_adjusted")), } @@ -6600,22 +6624,24 @@ impl SeriesTree_Cohorts_Utxo_All_Realized_Sopr { /// Series tree node. pub struct SeriesTree_Cohorts_Utxo_All_Realized_Sopr_Adjusted { pub ratio: _1m1w1y24hPattern, - pub transfer_volume: BaseCumulativeSumPattern, - pub value_destroyed: BaseCumulativeSumPattern, + pub transfer_volume: AverageBaseCumulativeSumPattern, + pub value_destroyed: AverageBaseCumulativeSumPattern, } impl SeriesTree_Cohorts_Utxo_All_Realized_Sopr_Adjusted { pub fn new(client: Arc, base_path: String) -> Self { Self { ratio: _1m1w1y24hPattern::new(client.clone(), "asopr".to_string()), - transfer_volume: BaseCumulativeSumPattern::new(client.clone(), "adj_value_created".to_string()), - value_destroyed: BaseCumulativeSumPattern::new(client.clone(), "adj_value_destroyed".to_string()), + transfer_volume: AverageBaseCumulativeSumPattern::new(client.clone(), "adj_value_created".to_string()), + value_destroyed: AverageBaseCumulativeSumPattern::new(client.clone(), "adj_value_destroyed".to_string()), } } } /// Series tree node. pub struct SeriesTree_Cohorts_Utxo_All_CostBasis { + pub in_profit: PerPattern, + pub in_loss: PerPattern, pub min: CentsSatsUsdPattern, pub max: CentsSatsUsdPattern, pub percentiles: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern, @@ -6626,6 +6652,8 @@ pub struct SeriesTree_Cohorts_Utxo_All_CostBasis { impl SeriesTree_Cohorts_Utxo_All_CostBasis { pub fn new(client: Arc, base_path: String) -> Self { Self { + in_profit: PerPattern::new(client.clone(), "cost_basis_in_profit_per".to_string()), + in_loss: PerPattern::new(client.clone(), "cost_basis_in_loss_per".to_string()), min: CentsSatsUsdPattern::new(client.clone(), "cost_basis_min".to_string()), max: CentsSatsUsdPattern::new(client.clone(), "cost_basis_max".to_string()), percentiles: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern::new(client.clone(), "cost_basis".to_string()), @@ -6643,6 +6671,8 @@ pub struct SeriesTree_Cohorts_Utxo_All_Unrealized { pub net_pnl: SeriesTree_Cohorts_Utxo_All_Unrealized_NetPnl, pub gross_pnl: CentsUsdPattern2, pub invested_capital: InPattern, + pub investor_cap_in_profit_raw: SeriesPattern18, + pub investor_cap_in_loss_raw: SeriesPattern18, pub sentiment: SeriesTree_Cohorts_Utxo_All_Unrealized_Sentiment, } @@ -6655,6 +6685,8 @@ impl SeriesTree_Cohorts_Utxo_All_Unrealized { net_pnl: SeriesTree_Cohorts_Utxo_All_Unrealized_NetPnl::new(client.clone(), format!("{base_path}_net_pnl")), gross_pnl: CentsUsdPattern2::new(client.clone(), "unrealized_gross_pnl".to_string()), invested_capital: InPattern::new(client.clone(), "invested_capital_in".to_string()), + investor_cap_in_profit_raw: SeriesPattern18::new(client.clone(), "investor_cap_in_profit_raw".to_string()), + investor_cap_in_loss_raw: SeriesPattern18::new(client.clone(), "investor_cap_in_loss_raw".to_string()), sentiment: SeriesTree_Cohorts_Utxo_All_Unrealized_Sentiment::new(client.clone(), format!("{base_path}_sentiment")), } } @@ -6759,8 +6791,8 @@ impl SeriesTree_Cohorts_Utxo_Sth { /// Series tree node. pub struct SeriesTree_Cohorts_Utxo_Sth_Activity { - pub transfer_volume: BaseCumulativeInSumPattern, - pub coindays_destroyed: BaseCumulativeSumPattern, + pub transfer_volume: AverageBaseCumulativeInSumPattern, + pub coindays_destroyed: AverageBaseCumulativeSumPattern, pub coinyears_destroyed: SeriesPattern1, pub dormancy: _1m1w1y24hPattern, } @@ -6768,8 +6800,8 @@ pub struct SeriesTree_Cohorts_Utxo_Sth_Activity { impl SeriesTree_Cohorts_Utxo_Sth_Activity { pub fn new(client: Arc, base_path: String) -> Self { Self { - transfer_volume: BaseCumulativeInSumPattern::new(client.clone(), "sth_transfer_volume".to_string()), - coindays_destroyed: BaseCumulativeSumPattern::new(client.clone(), "sth_coindays_destroyed".to_string()), + transfer_volume: AverageBaseCumulativeInSumPattern::new(client.clone(), "sth_transfer_volume".to_string()), + coindays_destroyed: AverageBaseCumulativeSumPattern::new(client.clone(), "sth_coindays_destroyed".to_string()), coinyears_destroyed: SeriesPattern1::new(client.clone(), "sth_coinyears_destroyed".to_string()), dormancy: _1m1w1y24hPattern::new(client.clone(), "sth_dormancy".to_string()), } @@ -6785,7 +6817,7 @@ pub struct SeriesTree_Cohorts_Utxo_Sth_Realized { pub mvrv: SeriesPattern1, pub net_pnl: BaseChangeCumulativeDeltaSumToPattern, pub sopr: SeriesTree_Cohorts_Utxo_Sth_Realized_Sopr, - pub gross_pnl: BaseCumulativeSumPattern4, + pub gross_pnl: BaseCumulativeSumPattern, pub sell_side_risk_ratio: _1m1w1y24hPattern6, pub peak_regret: BaseCumulativeSumToPattern, pub investor: PricePattern, @@ -6802,7 +6834,7 @@ impl SeriesTree_Cohorts_Utxo_Sth_Realized { mvrv: SeriesPattern1::new(client.clone(), "sth_mvrv".to_string()), 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: BaseCumulativeSumPattern4::new(client.clone(), "sth_realized_gross_pnl".to_string()), + 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()), peak_regret: BaseCumulativeSumToPattern::new(client.clone(), "sth_realized_peak_regret".to_string()), investor: PricePattern::new(client.clone(), "sth_investor_price".to_string()), @@ -7044,7 +7076,7 @@ impl SeriesTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_1y { /// Series tree node. pub struct SeriesTree_Cohorts_Utxo_Sth_Realized_Sopr { - pub value_destroyed: BaseCumulativeSumPattern, + pub value_destroyed: AverageBaseCumulativeSumPattern, pub ratio: _1m1w1y24hPattern, pub adjusted: SeriesTree_Cohorts_Utxo_Sth_Realized_Sopr_Adjusted, } @@ -7052,7 +7084,7 @@ pub struct SeriesTree_Cohorts_Utxo_Sth_Realized_Sopr { impl SeriesTree_Cohorts_Utxo_Sth_Realized_Sopr { pub fn new(client: Arc, base_path: String) -> Self { Self { - value_destroyed: BaseCumulativeSumPattern::new(client.clone(), "sth_value_destroyed".to_string()), + value_destroyed: AverageBaseCumulativeSumPattern::new(client.clone(), "sth_value_destroyed".to_string()), ratio: _1m1w1y24hPattern::new(client.clone(), "sth_sopr".to_string()), adjusted: SeriesTree_Cohorts_Utxo_Sth_Realized_Sopr_Adjusted::new(client.clone(), format!("{base_path}_adjusted")), } @@ -7062,22 +7094,24 @@ impl SeriesTree_Cohorts_Utxo_Sth_Realized_Sopr { /// Series tree node. pub struct SeriesTree_Cohorts_Utxo_Sth_Realized_Sopr_Adjusted { pub ratio: _1m1w1y24hPattern, - pub transfer_volume: BaseCumulativeSumPattern, - pub value_destroyed: BaseCumulativeSumPattern, + pub transfer_volume: AverageBaseCumulativeSumPattern, + pub value_destroyed: AverageBaseCumulativeSumPattern, } impl SeriesTree_Cohorts_Utxo_Sth_Realized_Sopr_Adjusted { pub fn new(client: Arc, base_path: String) -> Self { Self { ratio: _1m1w1y24hPattern::new(client.clone(), "sth_asopr".to_string()), - transfer_volume: BaseCumulativeSumPattern::new(client.clone(), "sth_adj_value_created".to_string()), - value_destroyed: BaseCumulativeSumPattern::new(client.clone(), "sth_adj_value_destroyed".to_string()), + transfer_volume: AverageBaseCumulativeSumPattern::new(client.clone(), "sth_adj_value_created".to_string()), + value_destroyed: AverageBaseCumulativeSumPattern::new(client.clone(), "sth_adj_value_destroyed".to_string()), } } } /// Series tree node. pub struct SeriesTree_Cohorts_Utxo_Sth_CostBasis { + pub in_profit: PerPattern, + pub in_loss: PerPattern, pub min: CentsSatsUsdPattern, pub max: CentsSatsUsdPattern, pub percentiles: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern, @@ -7088,6 +7122,8 @@ pub struct SeriesTree_Cohorts_Utxo_Sth_CostBasis { impl SeriesTree_Cohorts_Utxo_Sth_CostBasis { pub fn new(client: Arc, base_path: String) -> Self { Self { + in_profit: PerPattern::new(client.clone(), "sth_cost_basis_in_profit_per".to_string()), + in_loss: PerPattern::new(client.clone(), "sth_cost_basis_in_loss_per".to_string()), min: CentsSatsUsdPattern::new(client.clone(), "sth_cost_basis_min".to_string()), max: CentsSatsUsdPattern::new(client.clone(), "sth_cost_basis_max".to_string()), percentiles: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern::new(client.clone(), "sth_cost_basis".to_string()), @@ -7105,6 +7141,8 @@ pub struct SeriesTree_Cohorts_Utxo_Sth_Unrealized { pub net_pnl: CentsToUsdPattern3, pub gross_pnl: CentsUsdPattern2, pub invested_capital: InPattern, + pub investor_cap_in_profit_raw: SeriesPattern18, + pub investor_cap_in_loss_raw: SeriesPattern18, pub sentiment: SeriesTree_Cohorts_Utxo_Sth_Unrealized_Sentiment, } @@ -7117,6 +7155,8 @@ impl SeriesTree_Cohorts_Utxo_Sth_Unrealized { net_pnl: CentsToUsdPattern3::new(client.clone(), "sth_net_unrealized_pnl".to_string()), gross_pnl: CentsUsdPattern2::new(client.clone(), "sth_unrealized_gross_pnl".to_string()), invested_capital: InPattern::new(client.clone(), "sth_invested_capital_in".to_string()), + investor_cap_in_profit_raw: SeriesPattern18::new(client.clone(), "sth_investor_cap_in_profit_raw".to_string()), + investor_cap_in_loss_raw: SeriesPattern18::new(client.clone(), "sth_investor_cap_in_loss_raw".to_string()), sentiment: SeriesTree_Cohorts_Utxo_Sth_Unrealized_Sentiment::new(client.clone(), format!("{base_path}_sentiment")), } } @@ -7164,8 +7204,8 @@ impl SeriesTree_Cohorts_Utxo_Lth { /// Series tree node. pub struct SeriesTree_Cohorts_Utxo_Lth_Activity { - pub transfer_volume: BaseCumulativeInSumPattern, - pub coindays_destroyed: BaseCumulativeSumPattern, + pub transfer_volume: AverageBaseCumulativeInSumPattern, + pub coindays_destroyed: AverageBaseCumulativeSumPattern, pub coinyears_destroyed: SeriesPattern1, pub dormancy: _1m1w1y24hPattern, } @@ -7173,8 +7213,8 @@ pub struct SeriesTree_Cohorts_Utxo_Lth_Activity { impl SeriesTree_Cohorts_Utxo_Lth_Activity { pub fn new(client: Arc, base_path: String) -> Self { Self { - transfer_volume: BaseCumulativeInSumPattern::new(client.clone(), "lth_transfer_volume".to_string()), - coindays_destroyed: BaseCumulativeSumPattern::new(client.clone(), "lth_coindays_destroyed".to_string()), + transfer_volume: AverageBaseCumulativeInSumPattern::new(client.clone(), "lth_transfer_volume".to_string()), + coindays_destroyed: AverageBaseCumulativeSumPattern::new(client.clone(), "lth_coindays_destroyed".to_string()), coinyears_destroyed: SeriesPattern1::new(client.clone(), "lth_coinyears_destroyed".to_string()), dormancy: _1m1w1y24hPattern::new(client.clone(), "lth_dormancy".to_string()), } @@ -7190,7 +7230,7 @@ pub struct SeriesTree_Cohorts_Utxo_Lth_Realized { pub mvrv: SeriesPattern1, pub net_pnl: BaseChangeCumulativeDeltaSumToPattern, pub sopr: SeriesTree_Cohorts_Utxo_Lth_Realized_Sopr, - pub gross_pnl: BaseCumulativeSumPattern4, + pub gross_pnl: BaseCumulativeSumPattern, pub sell_side_risk_ratio: _1m1w1y24hPattern6, pub peak_regret: BaseCumulativeSumToPattern, pub investor: PricePattern, @@ -7207,7 +7247,7 @@ impl SeriesTree_Cohorts_Utxo_Lth_Realized { mvrv: SeriesPattern1::new(client.clone(), "lth_mvrv".to_string()), 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: BaseCumulativeSumPattern4::new(client.clone(), "lth_realized_gross_pnl".to_string()), + 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()), peak_regret: BaseCumulativeSumToPattern::new(client.clone(), "lth_realized_peak_regret".to_string()), investor: PricePattern::new(client.clone(), "lth_investor_price".to_string()), @@ -7449,14 +7489,14 @@ impl SeriesTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_1y { /// Series tree node. pub struct SeriesTree_Cohorts_Utxo_Lth_Realized_Sopr { - pub value_destroyed: BaseCumulativeSumPattern, + pub value_destroyed: AverageBaseCumulativeSumPattern, pub ratio: _1m1w1y24hPattern, } impl SeriesTree_Cohorts_Utxo_Lth_Realized_Sopr { pub fn new(client: Arc, base_path: String) -> Self { Self { - value_destroyed: BaseCumulativeSumPattern::new(client.clone(), "lth_value_destroyed".to_string()), + value_destroyed: AverageBaseCumulativeSumPattern::new(client.clone(), "lth_value_destroyed".to_string()), ratio: _1m1w1y24hPattern::new(client.clone(), "lth_sopr".to_string()), } } @@ -7464,6 +7504,8 @@ impl SeriesTree_Cohorts_Utxo_Lth_Realized_Sopr { /// Series tree node. pub struct SeriesTree_Cohorts_Utxo_Lth_CostBasis { + pub in_profit: PerPattern, + pub in_loss: PerPattern, pub min: CentsSatsUsdPattern, pub max: CentsSatsUsdPattern, pub percentiles: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern, @@ -7474,6 +7516,8 @@ pub struct SeriesTree_Cohorts_Utxo_Lth_CostBasis { impl SeriesTree_Cohorts_Utxo_Lth_CostBasis { pub fn new(client: Arc, base_path: String) -> Self { Self { + in_profit: PerPattern::new(client.clone(), "lth_cost_basis_in_profit_per".to_string()), + in_loss: PerPattern::new(client.clone(), "lth_cost_basis_in_loss_per".to_string()), min: CentsSatsUsdPattern::new(client.clone(), "lth_cost_basis_min".to_string()), max: CentsSatsUsdPattern::new(client.clone(), "lth_cost_basis_max".to_string()), percentiles: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern::new(client.clone(), "lth_cost_basis".to_string()), @@ -7491,6 +7535,8 @@ pub struct SeriesTree_Cohorts_Utxo_Lth_Unrealized { pub net_pnl: CentsToUsdPattern3, pub gross_pnl: CentsUsdPattern2, pub invested_capital: InPattern, + pub investor_cap_in_profit_raw: SeriesPattern18, + pub investor_cap_in_loss_raw: SeriesPattern18, pub sentiment: SeriesTree_Cohorts_Utxo_Lth_Unrealized_Sentiment, } @@ -7503,6 +7549,8 @@ impl SeriesTree_Cohorts_Utxo_Lth_Unrealized { net_pnl: CentsToUsdPattern3::new(client.clone(), "lth_net_unrealized_pnl".to_string()), gross_pnl: CentsUsdPattern2::new(client.clone(), "lth_unrealized_gross_pnl".to_string()), invested_capital: InPattern::new(client.clone(), "lth_invested_capital_in".to_string()), + investor_cap_in_profit_raw: SeriesPattern18::new(client.clone(), "lth_investor_cap_in_profit_raw".to_string()), + investor_cap_in_loss_raw: SeriesPattern18::new(client.clone(), "lth_investor_cap_in_loss_raw".to_string()), sentiment: SeriesTree_Cohorts_Utxo_Lth_Unrealized_Sentiment::new(client.clone(), format!("{base_path}_sentiment")), } } @@ -8036,53 +8084,53 @@ impl SeriesTree_Cohorts_Utxo_Profitability_Loss { /// Series tree node. pub struct SeriesTree_Cohorts_Utxo_Matured { - pub under_1h: BaseCumulativeSumPattern3, - pub _1h_to_1d: BaseCumulativeSumPattern3, - pub _1d_to_1w: BaseCumulativeSumPattern3, - pub _1w_to_1m: BaseCumulativeSumPattern3, - pub _1m_to_2m: BaseCumulativeSumPattern3, - pub _2m_to_3m: BaseCumulativeSumPattern3, - pub _3m_to_4m: BaseCumulativeSumPattern3, - pub _4m_to_5m: BaseCumulativeSumPattern3, - pub _5m_to_6m: BaseCumulativeSumPattern3, - pub _6m_to_1y: BaseCumulativeSumPattern3, - pub _1y_to_2y: BaseCumulativeSumPattern3, - pub _2y_to_3y: BaseCumulativeSumPattern3, - pub _3y_to_4y: BaseCumulativeSumPattern3, - pub _4y_to_5y: BaseCumulativeSumPattern3, - pub _5y_to_6y: BaseCumulativeSumPattern3, - pub _6y_to_7y: BaseCumulativeSumPattern3, - pub _7y_to_8y: BaseCumulativeSumPattern3, - pub _8y_to_10y: BaseCumulativeSumPattern3, - pub _10y_to_12y: BaseCumulativeSumPattern3, - pub _12y_to_15y: BaseCumulativeSumPattern3, - pub over_15y: BaseCumulativeSumPattern3, + pub under_1h: AverageBaseCumulativeSumPattern3, + pub _1h_to_1d: AverageBaseCumulativeSumPattern3, + pub _1d_to_1w: AverageBaseCumulativeSumPattern3, + pub _1w_to_1m: AverageBaseCumulativeSumPattern3, + pub _1m_to_2m: AverageBaseCumulativeSumPattern3, + pub _2m_to_3m: AverageBaseCumulativeSumPattern3, + pub _3m_to_4m: AverageBaseCumulativeSumPattern3, + pub _4m_to_5m: AverageBaseCumulativeSumPattern3, + pub _5m_to_6m: AverageBaseCumulativeSumPattern3, + pub _6m_to_1y: AverageBaseCumulativeSumPattern3, + pub _1y_to_2y: AverageBaseCumulativeSumPattern3, + pub _2y_to_3y: AverageBaseCumulativeSumPattern3, + pub _3y_to_4y: AverageBaseCumulativeSumPattern3, + pub _4y_to_5y: AverageBaseCumulativeSumPattern3, + pub _5y_to_6y: AverageBaseCumulativeSumPattern3, + pub _6y_to_7y: AverageBaseCumulativeSumPattern3, + pub _7y_to_8y: AverageBaseCumulativeSumPattern3, + pub _8y_to_10y: AverageBaseCumulativeSumPattern3, + pub _10y_to_12y: AverageBaseCumulativeSumPattern3, + pub _12y_to_15y: AverageBaseCumulativeSumPattern3, + pub over_15y: AverageBaseCumulativeSumPattern3, } impl SeriesTree_Cohorts_Utxo_Matured { pub fn new(client: Arc, base_path: String) -> Self { Self { - under_1h: BaseCumulativeSumPattern3::new(client.clone(), "utxos_under_1h_old_matured_supply".to_string()), - _1h_to_1d: BaseCumulativeSumPattern3::new(client.clone(), "utxos_1h_to_1d_old_matured_supply".to_string()), - _1d_to_1w: BaseCumulativeSumPattern3::new(client.clone(), "utxos_1d_to_1w_old_matured_supply".to_string()), - _1w_to_1m: BaseCumulativeSumPattern3::new(client.clone(), "utxos_1w_to_1m_old_matured_supply".to_string()), - _1m_to_2m: BaseCumulativeSumPattern3::new(client.clone(), "utxos_1m_to_2m_old_matured_supply".to_string()), - _2m_to_3m: BaseCumulativeSumPattern3::new(client.clone(), "utxos_2m_to_3m_old_matured_supply".to_string()), - _3m_to_4m: BaseCumulativeSumPattern3::new(client.clone(), "utxos_3m_to_4m_old_matured_supply".to_string()), - _4m_to_5m: BaseCumulativeSumPattern3::new(client.clone(), "utxos_4m_to_5m_old_matured_supply".to_string()), - _5m_to_6m: BaseCumulativeSumPattern3::new(client.clone(), "utxos_5m_to_6m_old_matured_supply".to_string()), - _6m_to_1y: BaseCumulativeSumPattern3::new(client.clone(), "utxos_6m_to_1y_old_matured_supply".to_string()), - _1y_to_2y: BaseCumulativeSumPattern3::new(client.clone(), "utxos_1y_to_2y_old_matured_supply".to_string()), - _2y_to_3y: BaseCumulativeSumPattern3::new(client.clone(), "utxos_2y_to_3y_old_matured_supply".to_string()), - _3y_to_4y: BaseCumulativeSumPattern3::new(client.clone(), "utxos_3y_to_4y_old_matured_supply".to_string()), - _4y_to_5y: BaseCumulativeSumPattern3::new(client.clone(), "utxos_4y_to_5y_old_matured_supply".to_string()), - _5y_to_6y: BaseCumulativeSumPattern3::new(client.clone(), "utxos_5y_to_6y_old_matured_supply".to_string()), - _6y_to_7y: BaseCumulativeSumPattern3::new(client.clone(), "utxos_6y_to_7y_old_matured_supply".to_string()), - _7y_to_8y: BaseCumulativeSumPattern3::new(client.clone(), "utxos_7y_to_8y_old_matured_supply".to_string()), - _8y_to_10y: BaseCumulativeSumPattern3::new(client.clone(), "utxos_8y_to_10y_old_matured_supply".to_string()), - _10y_to_12y: BaseCumulativeSumPattern3::new(client.clone(), "utxos_10y_to_12y_old_matured_supply".to_string()), - _12y_to_15y: BaseCumulativeSumPattern3::new(client.clone(), "utxos_12y_to_15y_old_matured_supply".to_string()), - over_15y: BaseCumulativeSumPattern3::new(client.clone(), "utxos_over_15y_old_matured_supply".to_string()), + under_1h: AverageBaseCumulativeSumPattern3::new(client.clone(), "utxos_under_1h_old_matured_supply".to_string()), + _1h_to_1d: AverageBaseCumulativeSumPattern3::new(client.clone(), "utxos_1h_to_1d_old_matured_supply".to_string()), + _1d_to_1w: AverageBaseCumulativeSumPattern3::new(client.clone(), "utxos_1d_to_1w_old_matured_supply".to_string()), + _1w_to_1m: AverageBaseCumulativeSumPattern3::new(client.clone(), "utxos_1w_to_1m_old_matured_supply".to_string()), + _1m_to_2m: AverageBaseCumulativeSumPattern3::new(client.clone(), "utxos_1m_to_2m_old_matured_supply".to_string()), + _2m_to_3m: AverageBaseCumulativeSumPattern3::new(client.clone(), "utxos_2m_to_3m_old_matured_supply".to_string()), + _3m_to_4m: AverageBaseCumulativeSumPattern3::new(client.clone(), "utxos_3m_to_4m_old_matured_supply".to_string()), + _4m_to_5m: AverageBaseCumulativeSumPattern3::new(client.clone(), "utxos_4m_to_5m_old_matured_supply".to_string()), + _5m_to_6m: AverageBaseCumulativeSumPattern3::new(client.clone(), "utxos_5m_to_6m_old_matured_supply".to_string()), + _6m_to_1y: AverageBaseCumulativeSumPattern3::new(client.clone(), "utxos_6m_to_1y_old_matured_supply".to_string()), + _1y_to_2y: AverageBaseCumulativeSumPattern3::new(client.clone(), "utxos_1y_to_2y_old_matured_supply".to_string()), + _2y_to_3y: AverageBaseCumulativeSumPattern3::new(client.clone(), "utxos_2y_to_3y_old_matured_supply".to_string()), + _3y_to_4y: AverageBaseCumulativeSumPattern3::new(client.clone(), "utxos_3y_to_4y_old_matured_supply".to_string()), + _4y_to_5y: AverageBaseCumulativeSumPattern3::new(client.clone(), "utxos_4y_to_5y_old_matured_supply".to_string()), + _5y_to_6y: AverageBaseCumulativeSumPattern3::new(client.clone(), "utxos_5y_to_6y_old_matured_supply".to_string()), + _6y_to_7y: AverageBaseCumulativeSumPattern3::new(client.clone(), "utxos_6y_to_7y_old_matured_supply".to_string()), + _7y_to_8y: AverageBaseCumulativeSumPattern3::new(client.clone(), "utxos_7y_to_8y_old_matured_supply".to_string()), + _8y_to_10y: AverageBaseCumulativeSumPattern3::new(client.clone(), "utxos_8y_to_10y_old_matured_supply".to_string()), + _10y_to_12y: AverageBaseCumulativeSumPattern3::new(client.clone(), "utxos_10y_to_12y_old_matured_supply".to_string()), + _12y_to_15y: AverageBaseCumulativeSumPattern3::new(client.clone(), "utxos_12y_to_15y_old_matured_supply".to_string()), + over_15y: AverageBaseCumulativeSumPattern3::new(client.clone(), "utxos_over_15y_old_matured_supply".to_string()), } } } diff --git a/crates/brk_computer/src/distribution/cohorts/utxo/groups.rs b/crates/brk_computer/src/distribution/cohorts/utxo/groups.rs index e45a4e103..b9f7fb146 100644 --- a/crates/brk_computer/src/distribution/cohorts/utxo/groups.rs +++ b/crates/brk_computer/src/distribution/cohorts/utxo/groups.rs @@ -6,7 +6,7 @@ use brk_cohort::{ }; use brk_error::Result; use brk_traversable::Traversable; -use brk_types::{Dollars, Height, Indexes, Sats, Version}; +use brk_types::{Cents, CentsSquaredSats, Dollars, Height, Indexes, Sats, Version}; use rayon::prelude::*; use vecdb::{ AnyStoredVec, Database, Exit, ReadOnlyClone, ReadableVec, Rw, StorageMode, WritableVec, @@ -738,15 +738,9 @@ impl UTXOCohorts { .min() .unwrap_or_default() .min(Height::from(self.profitability.min_stateful_len())) - .min(Height::from( - self.all.metrics.realized.min_stateful_len(), - )) - .min(Height::from( - self.sth.metrics.realized.min_stateful_len(), - )) - .min(Height::from( - self.lth.metrics.realized.min_stateful_len(), - )) + .min(Height::from(self.all.min_stateful_len())) + .min(Height::from(self.sth.min_stateful_len())) + .min(Height::from(self.lth.min_stateful_len())) } /// Import state for all separate cohorts at or before given height. @@ -790,7 +784,7 @@ impl UTXOCohorts { /// Aggregate RealizedFull fields from age_range states and push to all/sth/lth. /// Called during the block loop after separate cohorts' push_state but before reset. - pub(crate) fn push_overlapping_realized_full(&mut self) { + pub(crate) fn push_overlapping(&mut self, height_price: Cents) { let Self { all, sth, @@ -805,14 +799,26 @@ impl UTXOCohorts { let mut sth_acc = RealizedFullAccum::default(); let mut lth_acc = RealizedFullAccum::default(); - for ar in age_range.iter() { - if let Some(state) = ar.state.as_ref() { - let r = &state.realized; - all_acc.add(r); + let mut all_icap = (0u128, 0u128); + let mut sth_icap = (0u128, 0u128); + let mut lth_icap = (0u128, 0u128); + + for ar in age_range.iter_mut() { + if let Some(state) = ar.state.as_mut() { + all_acc.add(&state.realized); + + let u = state.compute_unrealized_state(height_price); + all_icap.0 += u.investor_cap_in_profit_raw; + all_icap.1 += u.investor_cap_in_loss_raw; + if sth_filter.includes(&ar.metrics.filter) { - sth_acc.add(r); + sth_acc.add(&state.realized); + sth_icap.0 += u.investor_cap_in_profit_raw; + sth_icap.1 += u.investor_cap_in_loss_raw; } else { - lth_acc.add(r); + lth_acc.add(&state.realized); + lth_icap.0 += u.investor_cap_in_profit_raw; + lth_icap.1 += u.investor_cap_in_loss_raw; } } } @@ -820,6 +826,13 @@ impl UTXOCohorts { all.metrics.realized.push_accum(&all_acc); sth.metrics.realized.push_accum(&sth_acc); lth.metrics.realized.push_accum(<h_acc); + + all.metrics.unrealized.investor_cap_in_profit_raw.push(CentsSquaredSats::new(all_icap.0)); + all.metrics.unrealized.investor_cap_in_loss_raw.push(CentsSquaredSats::new(all_icap.1)); + sth.metrics.unrealized.investor_cap_in_profit_raw.push(CentsSquaredSats::new(sth_icap.0)); + sth.metrics.unrealized.investor_cap_in_loss_raw.push(CentsSquaredSats::new(sth_icap.1)); + lth.metrics.unrealized.investor_cap_in_profit_raw.push(CentsSquaredSats::new(lth_icap.0)); + lth.metrics.unrealized.investor_cap_in_loss_raw.push(CentsSquaredSats::new(lth_icap.1)); } } diff --git a/crates/brk_computer/src/distribution/compute/block_loop.rs b/crates/brk_computer/src/distribution/compute/block_loop.rs index 7d63cc70c..957d46fe4 100644 --- a/crates/brk_computer/src/distribution/compute/block_loop.rs +++ b/crates/brk_computer/src/distribution/compute/block_loop.rs @@ -551,8 +551,8 @@ fn push_cohort_states( }, ); - // Phase 2: aggregate age_range realized states → push to overlapping cohorts' RealizedFull - utxo_cohorts.push_overlapping_realized_full(); + // Phase 2: aggregate age_range states → push to overlapping cohorts + utxo_cohorts.push_overlapping(height_price); // Phase 3: reset per-block values utxo_cohorts diff --git a/crates/brk_computer/src/distribution/metrics/cohort/all.rs b/crates/brk_computer/src/distribution/metrics/cohort/all.rs index 0eb7b2187..e78a98b8d 100644 --- a/crates/brk_computer/src/distribution/metrics/cohort/all.rs +++ b/crates/brk_computer/src/distribution/metrics/cohort/all.rs @@ -50,11 +50,10 @@ impl CohortMetricsBase for AllCohortMetrics { } fn min_stateful_len(&self) -> usize { - self.supply - .min_len() - .min(self.outputs.min_len()) - .min(self.activity.min_len()) - .min(self.realized.min_stateful_len()) + // Only check per-block pushed vecs, not aggregated ones (supply, outputs, + // activity, realized core, unrealized core are summed from age_range). + self.realized + .min_stateful_len() .min(self.unrealized.min_stateful_len()) .min(self.cost_basis.min_stateful_len()) } @@ -138,6 +137,7 @@ impl AllCohortMetrics { self.cost_basis.compute_prices( starting_indexes, + &prices.spot.cents.height, &self.unrealized.invested_capital.in_profit.cents.height, &self.unrealized.invested_capital.in_loss.cents.height, &self.supply.in_profit.sats.height, diff --git a/crates/brk_computer/src/distribution/metrics/cohort/extended.rs b/crates/brk_computer/src/distribution/metrics/cohort/extended.rs index 74e2cbf9a..c3770d8aa 100644 --- a/crates/brk_computer/src/distribution/metrics/cohort/extended.rs +++ b/crates/brk_computer/src/distribution/metrics/cohort/extended.rs @@ -47,11 +47,10 @@ impl CohortMetricsBase for ExtendedCohortMetrics { } fn min_stateful_len(&self) -> usize { - self.supply - .min_len() - .min(self.outputs.min_len()) - .min(self.activity.min_len()) - .min(self.realized.min_stateful_len()) + // Only check per-block pushed vecs, not aggregated ones (supply, outputs, + // activity, realized core, unrealized core are summed from age_range). + self.realized + .min_stateful_len() .min(self.unrealized.min_stateful_len()) .min(self.cost_basis.min_stateful_len()) } @@ -116,6 +115,7 @@ impl ExtendedCohortMetrics { self.cost_basis.compute_prices( starting_indexes, + &prices.spot.cents.height, &self.unrealized.invested_capital.in_profit.cents.height, &self.unrealized.invested_capital.in_loss.cents.height, &self.supply.in_profit.sats.height, diff --git a/crates/brk_computer/src/distribution/metrics/cost_basis/mod.rs b/crates/brk_computer/src/distribution/metrics/cost_basis/mod.rs index 0e4635844..ecb6a779a 100644 --- a/crates/brk_computer/src/distribution/metrics/cost_basis/mod.rs +++ b/crates/brk_computer/src/distribution/metrics/cost_basis/mod.rs @@ -1,17 +1,19 @@ use brk_error::Result; use brk_traversable::Traversable; -use brk_types::{BasisPoints16, Cents, Height, Indexes, Sats, Version}; use brk_types::CentsSquaredSats; +use brk_types::{BasisPoints16, Cents, Height, Indexes, Sats, Version}; use vecdb::{AnyStoredVec, AnyVec, Exit, ReadableVec, Rw, StorageMode, WritableVec}; -use crate::internal::{FiatPerBlock, PerBlock, PercentPerBlock, PercentilesVecs, Price, PERCENTILES_LEN}; +use crate::internal::{ + PERCENTILES_LEN, PerBlock, PercentPerBlock, PercentilesVecs, Price, +}; use super::ImportConfig; #[derive(Traversable)] pub struct CostBasisSide { - pub per_coin: FiatPerBlock, - pub per_dollar: FiatPerBlock, + pub per_coin: Price>, + pub per_dollar: Price>, } /// Cost basis metrics: min/max + profit/loss splits + percentiles + supply density. @@ -31,12 +33,12 @@ impl CostBasis { pub(crate) fn forced_import(cfg: &ImportConfig) -> Result { Ok(Self { in_profit: CostBasisSide { - per_coin: cfg.import("cost_basis_in_profit_per_coin", Version::ZERO)?, - per_dollar: cfg.import("cost_basis_in_profit_per_dollar", Version::ZERO)?, + per_coin: Price::forced_import(cfg.db, &cfg.name("cost_basis_in_profit_per_coin"), cfg.version + Version::ONE, cfg.indexes)?, + per_dollar: Price::forced_import(cfg.db, &cfg.name("cost_basis_in_profit_per_dollar"), cfg.version + Version::ONE, cfg.indexes)?, }, in_loss: CostBasisSide { - per_coin: cfg.import("cost_basis_in_loss_per_coin", Version::ZERO)?, - per_dollar: cfg.import("cost_basis_in_loss_per_dollar", Version::ZERO)?, + per_coin: Price::forced_import(cfg.db, &cfg.name("cost_basis_in_loss_per_coin"), cfg.version + Version::ONE, cfg.indexes)?, + per_dollar: Price::forced_import(cfg.db, &cfg.name("cost_basis_in_loss_per_dollar"), cfg.version + Version::ONE, cfg.indexes)?, }, min: cfg.import("cost_basis_min", Version::ZERO)?, max: cfg.import("cost_basis_max", Version::ZERO)?, @@ -124,9 +126,11 @@ impl CostBasis { vecs } + #[allow(clippy::too_many_arguments)] pub(crate) fn compute_prices( &mut self, starting_indexes: &Indexes, + spot: &impl ReadableVec, invested_cap_in_profit: &impl ReadableVec, invested_cap_in_loss: &impl ReadableVec, supply_in_profit_sats: &impl ReadableVec, @@ -135,46 +139,64 @@ impl CostBasis { investor_cap_in_loss_raw: &impl ReadableVec, exit: &Exit, ) -> Result<()> { - self.in_profit.per_coin.cents.height.compute_transform2( + self.in_profit.per_coin.cents.height.compute_transform3( starting_indexes.height, invested_cap_in_profit, supply_in_profit_sats, - |(h, invested_cents, supply_sats, ..)| { + spot, + |(h, invested_cents, supply_sats, spot, ..)| { let supply = supply_sats.as_u128(); - if supply == 0 { return (h, Cents::ZERO); } - (h, Cents::new((invested_cents.as_u128() * Sats::ONE_BTC_U128 / supply) as u64)) + if supply == 0 { + return (h, spot); + } + ( + h, + Cents::new((invested_cents.as_u128() * Sats::ONE_BTC_U128 / supply) as u64), + ) }, exit, )?; - self.in_loss.per_coin.cents.height.compute_transform2( + self.in_loss.per_coin.cents.height.compute_transform3( starting_indexes.height, invested_cap_in_loss, supply_in_loss_sats, - |(h, invested_cents, supply_sats, ..)| { + spot, + |(h, invested_cents, supply_sats, spot, ..)| { let supply = supply_sats.as_u128(); - if supply == 0 { return (h, Cents::ZERO); } - (h, Cents::new((invested_cents.as_u128() * Sats::ONE_BTC_U128 / supply) as u64)) + if supply == 0 { + return (h, spot); + } + ( + h, + Cents::new((invested_cents.as_u128() * Sats::ONE_BTC_U128 / supply) as u64), + ) }, exit, )?; - self.in_profit.per_dollar.cents.height.compute_transform2( + self.in_profit.per_dollar.cents.height.compute_transform3( starting_indexes.height, investor_cap_in_profit_raw, invested_cap_in_profit, - |(h, investor_cap, invested_cents, ..)| { + spot, + |(h, investor_cap, invested_cents, spot, ..)| { let invested_raw = invested_cents.as_u128() * Sats::ONE_BTC_U128; - if invested_raw == 0 { return (h, Cents::ZERO); } + if invested_raw == 0 { + return (h, spot); + } (h, Cents::new((investor_cap.inner() / invested_raw) as u64)) }, exit, )?; - self.in_loss.per_dollar.cents.height.compute_transform2( + self.in_loss.per_dollar.cents.height.compute_transform3( starting_indexes.height, investor_cap_in_loss_raw, invested_cap_in_loss, - |(h, investor_cap, invested_cents, ..)| { + spot, + |(h, investor_cap, invested_cents, spot, ..)| { let invested_raw = invested_cents.as_u128() * Sats::ONE_BTC_U128; - if invested_raw == 0 { return (h, Cents::ZERO); } + if invested_raw == 0 { + return (h, spot); + } (h, Cents::new((investor_cap.inner() / invested_raw) as u64)) }, exit, diff --git a/crates/brk_computer/src/distribution/metrics/realized/full.rs b/crates/brk_computer/src/distribution/metrics/realized/full.rs index 3073f6d35..c9b571903 100644 --- a/crates/brk_computer/src/distribution/metrics/realized/full.rs +++ b/crates/brk_computer/src/distribution/metrics/realized/full.rs @@ -127,7 +127,7 @@ impl RealizedFull { // Peak regret let peak_regret = RealizedPeakRegret { - value: cfg.import("realized_peak_regret", Version::new(2))?, + value: cfg.import("realized_peak_regret", Version::new(3))?, to_rcap: cfg.import("realized_peak_regret_to_rcap", Version::new(2))?, }; diff --git a/crates/brk_computer/src/distribution/metrics/unrealized/full.rs b/crates/brk_computer/src/distribution/metrics/unrealized/full.rs index c5929d749..e5c276821 100644 --- a/crates/brk_computer/src/distribution/metrics/unrealized/full.rs +++ b/crates/brk_computer/src/distribution/metrics/unrealized/full.rs @@ -33,9 +33,7 @@ pub struct UnrealizedFull { pub gross_pnl: FiatPerBlock, pub invested_capital: UnrealizedInvestedCapital, - #[traversable(hidden)] pub investor_cap_in_profit_raw: M::Stored>, - #[traversable(hidden)] pub investor_cap_in_loss_raw: M::Stored>, pub sentiment: UnrealizedSentiment, @@ -48,18 +46,20 @@ impl UnrealizedFull { let gross_pnl = cfg.import("unrealized_gross_pnl", v0)?; + let v1 = Version::ONE; + let invested_capital = UnrealizedInvestedCapital { - in_profit: cfg.import("invested_capital_in_profit", v0)?, - in_loss: cfg.import("invested_capital_in_loss", v0)?, + in_profit: cfg.import("invested_capital_in_profit", v1)?, + in_loss: cfg.import("invested_capital_in_loss", v1)?, }; let investor_cap_in_profit_raw = cfg.import("investor_cap_in_profit_raw", v0)?; let investor_cap_in_loss_raw = cfg.import("investor_cap_in_loss_raw", v0)?; let sentiment = UnrealizedSentiment { - pain_index: cfg.import("pain_index", v0)?, - greed_index: cfg.import("greed_index", v0)?, - net: cfg.import("net_sentiment", Version::ONE)?, + pain_index: cfg.import("pain_index", v1)?, + greed_index: cfg.import("greed_index", v1)?, + net: cfg.import("net_sentiment", Version::new(2))?, }; Ok(Self { @@ -73,9 +73,10 @@ impl UnrealizedFull { } pub(crate) fn min_stateful_len(&self) -> usize { - self.inner - .min_stateful_len() - .min(self.investor_cap_in_profit_raw.len()) + // Only check per-block pushed vecs (investor_cap_raw). + // Core-level vecs (profit/loss) are aggregated from age_range, not stateful. + self.investor_cap_in_profit_raw + .len() .min(self.investor_cap_in_loss_raw.len()) } @@ -90,14 +91,8 @@ impl UnrealizedFull { pub(crate) fn collect_vecs_mut(&mut self) -> Vec<&mut dyn AnyStoredVec> { let mut vecs = self.inner.collect_vecs_mut(); - vecs.push(&mut self.gross_pnl.cents.height as &mut dyn AnyStoredVec); - vecs.push(&mut self.invested_capital.in_profit.cents.height as &mut dyn AnyStoredVec); - vecs.push(&mut self.invested_capital.in_loss.cents.height as &mut dyn AnyStoredVec); vecs.push(&mut self.investor_cap_in_profit_raw as &mut dyn AnyStoredVec); vecs.push(&mut self.investor_cap_in_loss_raw as &mut dyn AnyStoredVec); - vecs.push(&mut self.sentiment.pain_index.cents.height as &mut dyn AnyStoredVec); - vecs.push(&mut self.sentiment.greed_index.cents.height as &mut dyn AnyStoredVec); - vecs.push(&mut self.sentiment.net.cents.height as &mut dyn AnyStoredVec); vecs } @@ -120,30 +115,41 @@ impl UnrealizedFull { )?; // invested_capital_in_profit = supply_profit_sats × spot / ONE_BTC - unrealized_profit - self.invested_capital.in_profit.cents.height.compute_transform3( - starting_indexes.height, - supply_in_profit_sats, - &prices.spot.cents.height, - &self.inner.basic.profit.cents.height, - |(h, supply_sats, spot, profit, ..): (_, Sats, Cents, Cents, _)| { - let market_value = supply_sats.as_u128() * spot.as_u128() / Sats::ONE_BTC_U128; - (h, Cents::new(market_value.saturating_sub(profit.as_u128()) as u64)) - }, - exit, - )?; + self.invested_capital + .in_profit + .cents + .height + .compute_transform3( + starting_indexes.height, + supply_in_profit_sats, + &prices.spot.cents.height, + &self.inner.basic.profit.cents.height, + |(h, supply_sats, spot, profit, ..): (_, Sats, Cents, Cents, _)| { + let market_value = supply_sats.as_u128() * spot.as_u128() / Sats::ONE_BTC_U128; + ( + h, + Cents::new(market_value.saturating_sub(profit.as_u128()) as u64), + ) + }, + exit, + )?; // invested_capital_in_loss = supply_loss_sats × spot / ONE_BTC + unrealized_loss - self.invested_capital.in_loss.cents.height.compute_transform3( - starting_indexes.height, - supply_in_loss_sats, - &prices.spot.cents.height, - &self.inner.basic.loss.cents.height, - |(h, supply_sats, spot, loss, ..): (_, Sats, Cents, Cents, _)| { - let market_value = supply_sats.as_u128() * spot.as_u128() / Sats::ONE_BTC_U128; - (h, Cents::new((market_value + loss.as_u128()) as u64)) - }, - exit, - )?; + self.invested_capital + .in_loss + .cents + .height + .compute_transform3( + starting_indexes.height, + supply_in_loss_sats, + &prices.spot.cents.height, + &self.inner.basic.loss.cents.height, + |(h, supply_sats, spot, loss, ..): (_, Sats, Cents, Cents, _)| { + let market_value = supply_sats.as_u128() * spot.as_u128() / Sats::ONE_BTC_U128; + (h, Cents::new((market_value + loss.as_u128()) as u64)) + }, + exit, + )?; Ok(()) } @@ -171,7 +177,10 @@ impl UnrealizedFull { } let investor_price = investor_cap.inner() / invested_cap_raw; let spot_u128 = spot.as_u128(); - (h, Cents::new(spot_u128.saturating_sub(investor_price) as u64)) + ( + h, + Cents::new(spot_u128.saturating_sub(investor_price) as u64), + ) }, exit, )?; @@ -189,7 +198,10 @@ impl UnrealizedFull { } let investor_price = investor_cap.inner() / invested_cap_raw; let spot_u128 = spot.as_u128(); - (h, Cents::new(investor_price.saturating_sub(spot_u128) as u64)) + ( + h, + Cents::new(investor_price.saturating_sub(spot_u128) as u64), + ) }, exit, )?; diff --git a/crates/brk_computer/src/distribution/metrics/unrealized/mod.rs b/crates/brk_computer/src/distribution/metrics/unrealized/mod.rs index a3e850006..3b1764d75 100644 --- a/crates/brk_computer/src/distribution/metrics/unrealized/mod.rs +++ b/crates/brk_computer/src/distribution/metrics/unrealized/mod.rs @@ -63,7 +63,7 @@ impl UnrealizedLike for UnrealizedFull { &mut self.inner } fn min_stateful_len(&self) -> usize { - self.inner.min_stateful_len() + UnrealizedFull::min_stateful_len(self) } #[inline(always)] fn push_state(&mut self, state: &UnrealizedState) { diff --git a/crates/brk_computer/src/internal/per_block/amount/cumulative_sum.rs b/crates/brk_computer/src/internal/per_block/amount/cumulative_sum.rs index c3a6356c0..ed0e7a43d 100644 --- a/crates/brk_computer/src/internal/per_block/amount/cumulative_sum.rs +++ b/crates/brk_computer/src/internal/per_block/amount/cumulative_sum.rs @@ -5,7 +5,10 @@ use vecdb::{Database, EagerVec, Exit, PcoVec, Rw, StorageMode}; use crate::{ indexes, - internal::{AmountPerBlock, CachedWindowStarts, LazyRollingSumsAmountFromHeight, SatsToCents}, + internal::{ + AmountPerBlock, CachedWindowStarts, LazyRollingAvgsAmountFromHeight, + LazyRollingSumsAmountFromHeight, SatsToCents, + }, prices, }; @@ -14,6 +17,7 @@ pub struct AmountPerBlockCumulativeWithSums { pub base: AmountPerBlock, pub cumulative: AmountPerBlock, pub sum: LazyRollingSumsAmountFromHeight, + pub average: LazyRollingAvgsAmountFromHeight, } const VERSION: Version = Version::TWO; @@ -39,11 +43,20 @@ impl AmountPerBlockCumulativeWithSums { cached_starts, indexes, ); + let average = LazyRollingAvgsAmountFromHeight::new( + &format!("{name}_average"), + v, + &cumulative.sats.height, + &cumulative.cents.height, + cached_starts, + indexes, + ); Ok(Self { base, cumulative, sum, + average, }) } diff --git a/crates/brk_computer/src/internal/per_block/amount/full.rs b/crates/brk_computer/src/internal/per_block/amount/full.rs index 62201b126..ce31676df 100644 --- a/crates/brk_computer/src/internal/per_block/amount/full.rs +++ b/crates/brk_computer/src/internal/per_block/amount/full.rs @@ -6,8 +6,9 @@ use vecdb::{Database, EagerVec, Exit, PcoVec, Rw, StorageMode}; use crate::{ indexes, internal::{ - AmountPerBlock, CachedWindowStarts, LazyRollingSumsAmountFromHeight, - RollingDistributionAmountPerBlock, SatsToCents, WindowStarts, + AmountPerBlock, CachedWindowStarts, LazyRollingAvgsAmountFromHeight, + LazyRollingSumsAmountFromHeight, RollingDistributionAmountPerBlock, SatsToCents, + WindowStarts, }, prices, }; @@ -17,8 +18,9 @@ pub struct AmountPerBlockFull { pub base: AmountPerBlock, pub cumulative: AmountPerBlock, pub sum: LazyRollingSumsAmountFromHeight, + pub average: LazyRollingAvgsAmountFromHeight, #[traversable(flatten)] - pub rolling: RollingDistributionAmountPerBlock, + pub distribution: RollingDistributionAmountPerBlock, } const VERSION: Version = Version::TWO; @@ -34,12 +36,8 @@ impl AmountPerBlockFull { let v = version + VERSION; let base = AmountPerBlock::forced_import(db, name, v, indexes)?; - let cumulative = AmountPerBlock::forced_import( - db, - &format!("{name}_cumulative"), - v, - indexes, - )?; + let cumulative = + AmountPerBlock::forced_import(db, &format!("{name}_cumulative"), v, indexes)?; let sum = LazyRollingSumsAmountFromHeight::new( &format!("{name}_sum"), v, @@ -48,14 +46,22 @@ impl AmountPerBlockFull { cached_starts, indexes, ); - let rolling = - RollingDistributionAmountPerBlock::forced_import(db, name, v, indexes)?; + let average = LazyRollingAvgsAmountFromHeight::new( + &format!("{name}_average"), + v, + &cumulative.sats.height, + &cumulative.cents.height, + cached_starts, + indexes, + ); + let rolling = RollingDistributionAmountPerBlock::forced_import(db, name, v, indexes)?; Ok(Self { base, cumulative, sum, - rolling, + average, + distribution: rolling, }) } @@ -89,7 +95,7 @@ impl AmountPerBlockFull { .height .compute_cumulative(max_from, &self.base.cents.height, exit)?; - self.rolling.compute( + self.distribution.compute( max_from, windows, &self.base.sats.height, 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 new file mode 100644 index 000000000..4c5960169 --- /dev/null +++ b/crates/brk_computer/src/internal/per_block/amount/lazy_rolling_avg.rs @@ -0,0 +1,124 @@ +use brk_traversable::Traversable; +use brk_types::{Bitcoin, Cents, Dollars, Height, Sats, Version}; +use derive_more::{Deref, DerefMut}; +use vecdb::{DeltaAvg, LazyDeltaVec, LazyVecFrom1, ReadableCloneableVec}; + +use crate::{ + indexes, + internal::{ + CachedWindowStarts, CentsUnsignedToDollars, DerivedResolutions, LazyPerBlock, + LazyRollingAvgFromHeight, Resolutions, SatsToBitcoin, Windows, + }, +}; + +/// Single window slot: lazy rolling average for Amount (sats + btc + cents + usd). +#[derive(Clone, Traversable)] +pub struct LazyRollingAvgAmountFromHeight { + pub btc: LazyPerBlock, + pub sats: LazyRollingAvgFromHeight, + pub usd: LazyPerBlock, + pub cents: LazyRollingAvgFromHeight, +} + +/// Lazy rolling averages for all 4 windows, for Amount (sats + btc + cents + usd). +#[derive(Clone, Deref, DerefMut, Traversable)] +#[traversable(transparent)] +pub struct LazyRollingAvgsAmountFromHeight(pub Windows); + +impl LazyRollingAvgsAmountFromHeight { + pub fn new( + name: &str, + version: Version, + cumulative_sats: &(impl ReadableCloneableVec + 'static), + cumulative_cents: &(impl ReadableCloneableVec + 'static), + cached_starts: &CachedWindowStarts, + indexes: &indexes::Vecs, + ) -> Self { + let cum_sats = cumulative_sats.read_only_boxed_clone(); + let cum_cents = cumulative_cents.read_only_boxed_clone(); + + let make_slot = |suffix: &str, cached_start: &vecdb::CachedVec| { + let full_name = format!("{name}_{suffix}"); + let cached = cached_start.clone(); + let starts_version = cached.version(); + + // Sats lazy rolling avg + let sats_avg = LazyDeltaVec::::new( + &format!("{full_name}_sats"), + version, + cum_sats.clone(), + starts_version, + { + let cached = cached.clone(); + move || cached.get() + }, + ); + let sats_resolutions = Resolutions::forced_import( + &format!("{full_name}_sats"), + sats_avg.read_only_boxed_clone(), + version, + indexes, + ); + let sats = LazyRollingAvgFromHeight { + height: sats_avg, + resolutions: Box::new(sats_resolutions), + }; + + // Btc lazy from sats + let btc = LazyPerBlock { + height: LazyVecFrom1::transformed::( + &full_name, + version, + sats.height.read_only_boxed_clone(), + ), + resolutions: Box::new(DerivedResolutions::from_derived_computed::( + &full_name, + version, + &sats.resolutions, + )), + }; + + // Cents rolling avg + let cents_avg = LazyDeltaVec::::new( + &format!("{full_name}_cents"), + version, + cum_cents.clone(), + starts_version, + move || cached.get(), + ); + let cents_resolutions = Resolutions::forced_import( + &format!("{full_name}_cents"), + cents_avg.read_only_boxed_clone(), + version, + indexes, + ); + let cents = LazyRollingAvgFromHeight { + height: cents_avg, + resolutions: Box::new(cents_resolutions), + }; + + // Usd lazy from cents + let usd = LazyPerBlock { + 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 + )), + }; + + LazyRollingAvgAmountFromHeight { + btc, + sats, + usd, + cents, + } + }; + + Self(cached_starts.0.map_with_suffix(make_slot)) + } +} diff --git a/crates/brk_computer/src/internal/per_block/amount/mod.rs b/crates/brk_computer/src/internal/per_block/amount/mod.rs index 227e2fabf..d163d1f5c 100644 --- a/crates/brk_computer/src/internal/per_block/amount/mod.rs +++ b/crates/brk_computer/src/internal/per_block/amount/mod.rs @@ -4,6 +4,7 @@ mod cumulative_sum; mod full; mod lazy; mod lazy_derived_resolutions; +mod lazy_rolling_avg; mod lazy_rolling_sum; mod rolling_distribution; mod with_deltas; @@ -14,6 +15,7 @@ pub use cumulative_sum::*; pub use full::*; pub use lazy::*; pub use lazy_derived_resolutions::*; +pub use lazy_rolling_avg::*; pub use lazy_rolling_sum::*; pub use rolling_distribution::*; pub use with_deltas::*; diff --git a/crates/brk_computer/src/internal/per_block/computed/aggregated.rs b/crates/brk_computer/src/internal/per_block/computed/aggregated.rs index 0f504be05..42bb81948 100644 --- a/crates/brk_computer/src/internal/per_block/computed/aggregated.rs +++ b/crates/brk_computer/src/internal/per_block/computed/aggregated.rs @@ -9,9 +9,7 @@ use vecdb::{ use crate::{ indexes, - internal::{ - CachedWindowStarts, NumericValue, PerBlock, RollingComplete, WindowStarts, - }, + internal::{CachedWindowStarts, NumericValue, PerBlock, RollingComplete, WindowStarts}, }; #[derive(Traversable)] @@ -70,8 +68,7 @@ where f64: From, A: VecIndex + VecValue + brk_types::CheckedSub, { - let combined_version = - source.version() + first_indexes.version() + count_indexes.version(); + let combined_version = source.version() + first_indexes.version() + count_indexes.version(); let mut index = max_from; index = { @@ -121,7 +118,7 @@ where ); self.sum.height.push(sum_val); - cumulative_val = cumulative_val + sum_val; + cumulative_val += sum_val; self.cumulative.height.push(cumulative_val); Ok(()) diff --git a/crates/brk_computer/src/internal/per_block/computed/cumulative_sum.rs b/crates/brk_computer/src/internal/per_block/computed/cumulative_sum.rs index c60466bed..73e84fa6e 100644 --- a/crates/brk_computer/src/internal/per_block/computed/cumulative_sum.rs +++ b/crates/brk_computer/src/internal/per_block/computed/cumulative_sum.rs @@ -17,7 +17,10 @@ use vecdb::{Database, EagerVec, Exit, PcoVec, Rw, StorageMode}; use crate::{ indexes, - internal::{CachedWindowStarts, PerBlock, LazyRollingSumsFromHeight, NumericValue}, + internal::{ + CachedWindowStarts, LazyRollingAvgsFromHeight, LazyRollingSumsFromHeight, NumericValue, + PerBlock, + }, }; #[derive(Traversable)] @@ -29,6 +32,7 @@ where pub base: PerBlock, pub cumulative: PerBlock, pub sum: LazyRollingSumsFromHeight, + pub average: LazyRollingAvgsFromHeight, } impl PerBlockCumulativeWithSums @@ -53,11 +57,19 @@ where cached_starts, indexes, ); + let average = LazyRollingAvgsFromHeight::new( + &format!("{name}_average"), + version, + &cumulative.height, + cached_starts, + indexes, + ); Ok(Self { base, cumulative, sum, + average, }) } diff --git a/crates/brk_computer/src/internal/per_block/computed/rolling_average.rs b/crates/brk_computer/src/internal/per_block/computed/rolling_average.rs index 48b4140a0..6c62c73fb 100644 --- a/crates/brk_computer/src/internal/per_block/computed/rolling_average.rs +++ b/crates/brk_computer/src/internal/per_block/computed/rolling_average.rs @@ -21,7 +21,7 @@ where { pub base: M::Stored>>, #[traversable(hidden)] - pub cumulative: M::Stored>>, + pub cumulative: M::Stored>>, #[traversable(flatten)] pub average: LazyRollingAvgsFromHeight, } @@ -38,8 +38,8 @@ where cached_starts: &CachedWindowStarts, ) -> Result { let base: EagerVec> = EagerVec::forced_import(db, name, version)?; - let cumulative: EagerVec> = - EagerVec::forced_import(db, &format!("{name}_cumulative"), version)?; + let cumulative: EagerVec> = + EagerVec::forced_import(db, &format!("{name}_cumulative"), version + Version::ONE)?; let average = LazyRollingAvgsFromHeight::new( &format!("{name}_average"), version + Version::ONE, 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 56111e0a0..e256cf3e6 100644 --- a/crates/brk_computer/src/internal/per_block/rolling/avg.rs +++ b/crates/brk_computer/src/internal/per_block/rolling/avg.rs @@ -12,7 +12,7 @@ pub struct LazyRollingAvgFromHeight where T: NumericValue + JsonSchema, { - pub height: LazyDeltaVec, + pub height: LazyDeltaVec, #[traversable(flatten)] 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 4551671ce..77ddbcc96 100644 --- a/crates/brk_computer/src/internal/per_block/rolling/avgs.rs +++ b/crates/brk_computer/src/internal/per_block/rolling/avgs.rs @@ -12,10 +12,11 @@ use crate::{ use super::LazyRollingAvgFromHeight; /// Lazy rolling averages for all 4 window durations (24h, 1w, 1m, 1y), -/// derived from an f64 cumulative vec + cached window starts. +/// 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)`. +/// `LazyDeltaVec`: `(cum[h] - cum[start-1]) / (h - start + 1)`. +/// T is converted to f64 internally for division, then back to T. #[derive(Clone, Deref, DerefMut, Traversable)] #[traversable(transparent)] pub struct LazyRollingAvgsFromHeight(pub Windows>) @@ -29,7 +30,7 @@ where pub fn new( name: &str, version: Version, - cumulative: &(impl ReadableCloneableVec + 'static), + cumulative: &(impl ReadableCloneableVec + 'static), cached_starts: &CachedWindowStarts, indexes: &indexes::Vecs, ) -> Self { @@ -39,7 +40,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/per_block/rolling/complete.rs b/crates/brk_computer/src/internal/per_block/rolling/complete.rs index 9a6f8f7f4..25d82b7d9 100644 --- a/crates/brk_computer/src/internal/per_block/rolling/complete.rs +++ b/crates/brk_computer/src/internal/per_block/rolling/complete.rs @@ -10,18 +10,19 @@ use vecdb::{Database, Exit, ReadableCloneableVec, ReadableVec, Rw, StorageMode}; use crate::{ indexes, internal::{ - CachedWindowStarts, NumericValue, LazyRollingSumsFromHeight, RollingDistribution, - WindowStarts, + CachedWindowStarts, NumericValue, LazyRollingAvgsFromHeight, LazyRollingSumsFromHeight, + RollingDistribution, WindowStarts, }, }; -/// Lazy rolling sums + stored rolling distribution (8 stats × 4 windows). +/// Lazy rolling sums + lazy rolling averages + stored rolling distribution (7 stats × 4 windows). #[derive(Traversable)] pub struct RollingComplete where T: NumericValue + JsonSchema, { pub sum: LazyRollingSumsFromHeight, + pub average: LazyRollingAvgsFromHeight, #[traversable(flatten)] pub distribution: RollingDistribution, } @@ -45,9 +46,20 @@ where cached_starts, indexes, ); + let average = LazyRollingAvgsFromHeight::new( + &format!("{name}_average"), + version, + cumulative, + cached_starts, + indexes, + ); let distribution = RollingDistribution::forced_import(db, name, version, indexes)?; - Ok(Self { sum, distribution }) + Ok(Self { + sum, + average, + distribution, + }) } /// Compute rolling distribution stats across all 4 windows. diff --git a/crates/brk_computer/src/internal/per_block/rolling/lazy_complete.rs b/crates/brk_computer/src/internal/per_block/rolling/lazy_complete.rs index 8903b0d69..f7e6b11a7 100644 --- a/crates/brk_computer/src/internal/per_block/rolling/lazy_complete.rs +++ b/crates/brk_computer/src/internal/per_block/rolling/lazy_complete.rs @@ -6,12 +6,12 @@ use vecdb::{ReadableCloneableVec, UnaryTransform}; use crate::{ indexes, internal::{ - CachedWindowStarts, ComputedVecValue, LazyRollingDistribution, LazyRollingSumsFromHeight, - NumericValue, RollingComplete, + CachedWindowStarts, ComputedVecValue, LazyRollingAvgsFromHeight, + LazyRollingDistribution, LazyRollingSumsFromHeight, NumericValue, RollingComplete, }, }; -/// Lazy analog of `RollingComplete`: lazy rolling sums + lazy rolling distribution. +/// Lazy analog of `RollingComplete`: lazy rolling sums + lazy rolling averages + lazy rolling distribution. /// Zero stored vecs. #[derive(Clone, Traversable)] pub struct LazyRollingComplete @@ -20,6 +20,7 @@ where S1T: ComputedVecValue + JsonSchema, { pub sum: LazyRollingSumsFromHeight, + pub average: LazyRollingAvgsFromHeight, #[traversable(flatten)] pub distribution: LazyRollingDistribution, } @@ -44,11 +45,22 @@ where cached_starts, indexes, ); + let average = LazyRollingAvgsFromHeight::new( + &format!("{name}_average"), + version, + cumulative, + cached_starts, + indexes, + ); let distribution = LazyRollingDistribution::from_rolling_distribution::( name, version, &source.distribution, ); - Self { sum, distribution } + Self { + sum, + average, + distribution, + } } } diff --git a/crates/brk_computer/src/internal/transform/arithmetic.rs b/crates/brk_computer/src/internal/transform/arithmetic.rs index fdada424e..78cc31f6e 100644 --- a/crates/brk_computer/src/internal/transform/arithmetic.rs +++ b/crates/brk_computer/src/internal/transform/arithmetic.rs @@ -12,6 +12,7 @@ impl UnaryTransform for Identity { } } + pub struct HalveSats; impl UnaryTransform for HalveSats { diff --git a/crates/brk_computer/src/mining/rewards/compute.rs b/crates/brk_computer/src/mining/rewards/compute.rs index ebd12e352..9ed59fc69 100644 --- a/crates/brk_computer/src/mining/rewards/compute.rs +++ b/crates/brk_computer/src/mining/rewards/compute.rs @@ -95,7 +95,7 @@ impl Vecs { }, exit, )?; - self.subsidy.compute(prices, starting_indexes.height, exit)?; + self.subsidy.compute_rest(starting_indexes.height, prices, exit)?; self.unclaimed.base.sats.height.compute_transform( starting_indexes.height, diff --git a/crates/brk_computer/src/mining/rewards/import.rs b/crates/brk_computer/src/mining/rewards/import.rs index 207bc427d..f261f8d56 100644 --- a/crates/brk_computer/src/mining/rewards/import.rs +++ b/crates/brk_computer/src/mining/rewards/import.rs @@ -36,7 +36,9 @@ impl Vecs { coinbase: AmountPerBlockCumulativeWithSums::forced_import( db, "coinbase", version, indexes, cached_starts, )?, - subsidy: AmountPerBlockCumulative::forced_import(db, "subsidy", version, indexes)?, + subsidy: AmountPerBlockCumulativeWithSums::forced_import( + db, "subsidy", version, indexes, cached_starts, + )?, fees: AmountPerBlockFull::forced_import(db, "fees", version, indexes, cached_starts)?, unclaimed: AmountPerBlockCumulative::forced_import( db, diff --git a/crates/brk_computer/src/mining/rewards/vecs.rs b/crates/brk_computer/src/mining/rewards/vecs.rs index 5f544098b..9efc90008 100644 --- a/crates/brk_computer/src/mining/rewards/vecs.rs +++ b/crates/brk_computer/src/mining/rewards/vecs.rs @@ -11,7 +11,7 @@ use crate::internal::{ #[derive(Traversable)] pub struct Vecs { pub coinbase: AmountPerBlockCumulativeWithSums, - pub subsidy: AmountPerBlockCumulative, + pub subsidy: AmountPerBlockCumulativeWithSums, pub fees: AmountPerBlockFull, pub unclaimed: AmountPerBlockCumulative, #[traversable(wrap = "fees", rename = "dominance")] diff --git a/modules/brk-client/index.js b/modules/brk-client/index.js index 1e19a3ea4..85eca1b8e 100644 --- a/modules/brk-client/index.js +++ b/modules/brk-client/index.js @@ -1786,7 +1786,7 @@ function create_10y1m1w1y2y3m3y4y5y6m6y8yPattern3(client, acc) { /** * @typedef {Object} CapGrossInvestorLossMvrvNetPeakPriceProfitSellSoprPattern * @property {CentsDeltaToUsdPattern} cap - * @property {BaseCumulativeSumPattern4} grossPnl + * @property {BaseCumulativeSumPattern} grossPnl * @property {PricePattern} investor * @property {BaseCumulativeNegativeSumToPattern} loss * @property {SeriesPattern1} mvrv @@ -1955,36 +1955,18 @@ function createAverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern(client, acc) { } /** - * @typedef {Object} AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern2 - * @property {SeriesPattern18} average - * @property {SeriesPattern18} max - * @property {SeriesPattern18} median - * @property {SeriesPattern18} min - * @property {SeriesPattern18} pct10 - * @property {SeriesPattern18} pct25 - * @property {SeriesPattern18} pct75 - * @property {SeriesPattern18} pct90 + * @typedef {Object} GrossInvestedInvestorLossNetNuplProfitSentimentPattern2 + * @property {CentsUsdPattern2} grossPnl + * @property {InPattern} investedCapital + * @property {SeriesPattern18} investorCapInLossRaw + * @property {SeriesPattern18} investorCapInProfitRaw + * @property {CentsNegativeToUsdPattern2} loss + * @property {CentsToUsdPattern3} netPnl + * @property {BpsRatioPattern} nupl + * @property {CentsToUsdPattern4} profit + * @property {GreedNetPainPattern} sentiment */ -/** - * Create a AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern2 pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated series name - * @returns {AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern2} - */ -function createAverageMaxMedianMinPct10Pct25Pct75Pct90Pattern2(client, acc) { - return { - average: createSeriesPattern18(client, _m(acc, 'average')), - max: createSeriesPattern18(client, _m(acc, 'max')), - median: createSeriesPattern18(client, _m(acc, 'median')), - min: createSeriesPattern18(client, _m(acc, 'min')), - pct10: createSeriesPattern18(client, _m(acc, 'pct10')), - pct25: createSeriesPattern18(client, _m(acc, 'pct25')), - pct75: createSeriesPattern18(client, _m(acc, 'pct75')), - pct90: createSeriesPattern18(client, _m(acc, 'pct90')), - }; -} - /** * @typedef {Object} BpsCentsPercentilesRatioSatsSmaStdUsdPattern * @property {SeriesPattern1} bps @@ -1997,39 +1979,6 @@ function createAverageMaxMedianMinPct10Pct25Pct75Pct90Pattern2(client, acc) { * @property {SeriesPattern1} usd */ -/** - * @template T - * @typedef {Object} AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern - * @property {SeriesPattern1} average - * @property {SeriesPattern1} max - * @property {SeriesPattern1} median - * @property {SeriesPattern1} min - * @property {SeriesPattern1} pct10 - * @property {SeriesPattern1} pct25 - * @property {SeriesPattern1} pct75 - * @property {SeriesPattern1} pct90 - */ - -/** - * Create a AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern pattern node - * @template T - * @param {BrkClientBase} client - * @param {string} acc - Accumulated series name - * @returns {AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern} - */ -function createAverageMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, acc) { - return { - average: createSeriesPattern1(client, _m(acc, 'average')), - max: createSeriesPattern1(client, _m(acc, 'max')), - median: createSeriesPattern1(client, _m(acc, 'median')), - min: createSeriesPattern1(client, _m(acc, 'min')), - pct10: createSeriesPattern1(client, _m(acc, 'pct10')), - pct25: createSeriesPattern1(client, _m(acc, 'pct25')), - pct75: createSeriesPattern1(client, _m(acc, 'pct75')), - pct90: createSeriesPattern1(client, _m(acc, 'pct90')), - }; -} - /** * @typedef {Object} _10y2y3y4y5y6y8yPattern * @property {BpsPercentRatioPattern} _10y @@ -2095,7 +2044,7 @@ function create_1m1w1y24hBpsPercentRatioPattern(client, acc) { * @property {SeriesPattern1} mvrv * @property {BaseCumulativeDeltaSumPattern} netPnl * @property {BpsCentsRatioSatsUsdPattern} price - * @property {BaseCumulativeSumPattern4} profit + * @property {BaseCumulativeSumPattern} profit * @property {RatioValuePattern} sopr */ @@ -2112,22 +2061,82 @@ function createCapLossMvrvNetPriceProfitSoprPattern(client, acc) { mvrv: createSeriesPattern1(client, _m(acc, 'mvrv')), netPnl: createBaseCumulativeDeltaSumPattern(client, _m(acc, 'net_realized_pnl')), price: createBpsCentsRatioSatsUsdPattern(client, _m(acc, 'realized_price')), - profit: createBaseCumulativeSumPattern4(client, _m(acc, 'realized_profit')), + profit: createBaseCumulativeSumPattern(client, _m(acc, 'realized_profit')), sopr: createRatioValuePattern(client, acc), }; } /** - * @typedef {Object} GrossInvestedLossNetNuplProfitSentimentPattern2 - * @property {CentsUsdPattern2} grossPnl - * @property {InPattern} investedCapital - * @property {CentsNegativeToUsdPattern2} loss - * @property {CentsToUsdPattern3} netPnl - * @property {BpsRatioPattern} nupl - * @property {CentsToUsdPattern4} profit - * @property {GreedNetPainPattern} sentiment + * @typedef {Object} InInvestedMaxMinPercentilesSupplyPattern + * @property {PerPattern} inLoss + * @property {PerPattern} inProfit + * @property {Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern} investedCapital + * @property {CentsSatsUsdPattern} max + * @property {CentsSatsUsdPattern} min + * @property {Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern} percentiles + * @property {BpsPercentRatioPattern3} supplyDensity */ +/** + * @typedef {Object} MaxMedianMinPct10Pct25Pct75Pct90Pattern2 + * @property {SeriesPattern18} max + * @property {SeriesPattern18} median + * @property {SeriesPattern18} min + * @property {SeriesPattern18} pct10 + * @property {SeriesPattern18} pct25 + * @property {SeriesPattern18} pct75 + * @property {SeriesPattern18} pct90 + */ + +/** + * Create a MaxMedianMinPct10Pct25Pct75Pct90Pattern2 pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated series name + * @returns {MaxMedianMinPct10Pct25Pct75Pct90Pattern2} + */ +function createMaxMedianMinPct10Pct25Pct75Pct90Pattern2(client, acc) { + return { + max: createSeriesPattern18(client, _m(acc, 'max')), + median: createSeriesPattern18(client, _m(acc, 'median')), + min: createSeriesPattern18(client, _m(acc, 'min')), + pct10: createSeriesPattern18(client, _m(acc, 'pct10')), + pct25: createSeriesPattern18(client, _m(acc, 'pct25')), + pct75: createSeriesPattern18(client, _m(acc, 'pct75')), + pct90: createSeriesPattern18(client, _m(acc, 'pct90')), + }; +} + +/** + * @template T + * @typedef {Object} MaxMedianMinPct10Pct25Pct75Pct90Pattern + * @property {SeriesPattern1} max + * @property {SeriesPattern1} median + * @property {SeriesPattern1} min + * @property {SeriesPattern1} pct10 + * @property {SeriesPattern1} pct25 + * @property {SeriesPattern1} pct75 + * @property {SeriesPattern1} pct90 + */ + +/** + * Create a MaxMedianMinPct10Pct25Pct75Pct90Pattern pattern node + * @template T + * @param {BrkClientBase} client + * @param {string} acc - Accumulated series name + * @returns {MaxMedianMinPct10Pct25Pct75Pct90Pattern} + */ +function createMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, acc) { + return { + max: createSeriesPattern1(client, _m(acc, 'max')), + median: createSeriesPattern1(client, _m(acc, 'median')), + min: createSeriesPattern1(client, _m(acc, 'min')), + pct10: createSeriesPattern1(client, _m(acc, 'pct10')), + pct25: createSeriesPattern1(client, _m(acc, 'pct25')), + pct75: createSeriesPattern1(client, _m(acc, 'pct75')), + pct90: createSeriesPattern1(client, _m(acc, 'pct90')), + }; +} + /** * @typedef {Object} _1m1w1y2y4yAllPattern * @property {BpsRatioPattern2} _1m @@ -2182,6 +2191,33 @@ function createActivityAddrOutputsRealizedSupplyUnrealizedPattern(client, acc) { }; } +/** + * @typedef {Object} AverageBaseCumulativeInSumPattern + * @property {_1m1w1y24hPattern3} average + * @property {BtcCentsSatsUsdPattern} base + * @property {BtcCentsSatsUsdPattern} cumulative + * @property {AverageBaseCumulativeSumPattern3} inLoss + * @property {AverageBaseCumulativeSumPattern3} inProfit + * @property {_1m1w1y24hPattern3} sum + */ + +/** + * Create a AverageBaseCumulativeInSumPattern pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated series name + * @returns {AverageBaseCumulativeInSumPattern} + */ +function createAverageBaseCumulativeInSumPattern(client, acc) { + return { + average: create_1m1w1y24hPattern3(client, _m(acc, 'average')), + base: createBtcCentsSatsUsdPattern(client, acc), + cumulative: createBtcCentsSatsUsdPattern(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')), + }; +} + /** * @typedef {Object} BaseChangeCumulativeDeltaSumToPattern * @property {CentsUsdPattern} base @@ -2446,31 +2482,6 @@ function createActivityOutputsRealizedSupplyUnrealizedPattern2(client, acc) { }; } -/** - * @typedef {Object} BaseCumulativeInSumPattern - * @property {BtcCentsSatsUsdPattern} base - * @property {BtcCentsSatsUsdPattern} cumulative - * @property {BaseCumulativeSumPattern3} inLoss - * @property {BaseCumulativeSumPattern3} inProfit - * @property {_1m1w1y24hPattern3} sum - */ - -/** - * Create a BaseCumulativeInSumPattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated series name - * @returns {BaseCumulativeInSumPattern} - */ -function createBaseCumulativeInSumPattern(client, acc) { - return { - base: createBtcCentsSatsUsdPattern(client, acc), - cumulative: createBtcCentsSatsUsdPattern(client, _m(acc, 'cumulative')), - inLoss: createBaseCumulativeSumPattern3(client, _m(acc, 'in_loss')), - inProfit: createBaseCumulativeSumPattern3(client, _m(acc, 'in_profit')), - sum: create_1m1w1y24hPattern3(client, _m(acc, 'sum')), - }; -} - /** * @typedef {Object} BaseCumulativeNegativeSumToPattern * @property {CentsUsdPattern2} base @@ -2583,10 +2594,10 @@ function createBtcCentsSatsToUsdPattern2(client, acc) { /** * @typedef {Object} CapLossMvrvPriceProfitPattern * @property {CentsDeltaUsdPattern} cap - * @property {BaseCumulativeSumPattern4} loss + * @property {BaseCumulativeSumPattern} loss * @property {SeriesPattern1} mvrv * @property {BpsCentsRatioSatsUsdPattern} price - * @property {BaseCumulativeSumPattern4} profit + * @property {BaseCumulativeSumPattern} profit */ /** @@ -2598,10 +2609,10 @@ function createBtcCentsSatsToUsdPattern2(client, acc) { function createCapLossMvrvPriceProfitPattern(client, acc) { return { cap: createCentsDeltaUsdPattern(client, _m(acc, 'realized_cap')), - loss: createBaseCumulativeSumPattern4(client, _m(acc, 'realized_loss')), + loss: createBaseCumulativeSumPattern(client, _m(acc, 'realized_loss')), mvrv: createSeriesPattern1(client, _m(acc, 'mvrv')), price: createBpsCentsRatioSatsUsdPattern(client, _m(acc, 'realized_price')), - profit: createBaseCumulativeSumPattern4(client, _m(acc, 'realized_profit')), + profit: createBaseCumulativeSumPattern(client, _m(acc, 'realized_profit')), }; } @@ -2664,15 +2675,6 @@ function createDeltaHalfInTotalPattern2(client, acc) { * @property {SeriesPattern1} signal */ -/** - * @typedef {Object} InvestedMaxMinPercentilesSupplyPattern - * @property {Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern} investedCapital - * @property {CentsSatsUsdPattern} max - * @property {CentsSatsUsdPattern} min - * @property {Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern} percentiles - * @property {BpsPercentRatioPattern3} supplyDensity - */ - /** * @typedef {Object} PhsReboundThsPattern * @property {SeriesPattern1} phs @@ -2871,6 +2873,52 @@ function create_1m1w1y24hPattern5(client, acc) { * @property {_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern} all */ +/** + * @typedef {Object} AverageBaseCumulativeSumPattern2 + * @property {_1m1w1y24hPattern} average + * @property {SeriesPattern1} base + * @property {SeriesPattern1} cumulative + * @property {_1m1w1y24hPattern} sum + */ + +/** + * Create a AverageBaseCumulativeSumPattern2 pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated series name + * @returns {AverageBaseCumulativeSumPattern2} + */ +function createAverageBaseCumulativeSumPattern2(client, acc) { + return { + average: create_1m1w1y24hPattern(client, _m(acc, 'average')), + base: createSeriesPattern1(client, acc), + cumulative: createSeriesPattern1(client, _m(acc, 'cumulative')), + sum: create_1m1w1y24hPattern(client, _m(acc, 'sum')), + }; +} + +/** + * @typedef {Object} AverageBaseCumulativeSumPattern3 + * @property {_1m1w1y24hPattern3} average + * @property {BtcCentsSatsUsdPattern} base + * @property {BtcCentsSatsUsdPattern} cumulative + * @property {_1m1w1y24hPattern3} sum + */ + +/** + * Create a AverageBaseCumulativeSumPattern3 pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated series name + * @returns {AverageBaseCumulativeSumPattern3} + */ +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')), + }; +} + /** * @typedef {Object} BaseCumulativeDeltaSumPattern * @property {CentsUsdPattern} base @@ -3034,10 +3082,10 @@ function createCentsToUsdPattern3(client, acc) { /** * @typedef {Object} CoindaysCoinyearsDormancyTransferPattern - * @property {BaseCumulativeSumPattern} coindaysDestroyed + * @property {AverageBaseCumulativeSumPattern} coindaysDestroyed * @property {SeriesPattern1} coinyearsDestroyed * @property {_1m1w1y24hPattern} dormancy - * @property {BaseCumulativeInSumPattern} transferVolume + * @property {AverageBaseCumulativeInSumPattern} transferVolume */ /** @@ -3089,47 +3137,51 @@ function create_1m1w1y24hPattern(client, acc) { } /** - * @typedef {Object} AdjustedRatioValuePattern - * @property {RatioTransferValuePattern} adjusted - * @property {_1m1w1y24hPattern} ratio - * @property {BaseCumulativeSumPattern} valueDestroyed + * @template T + * @typedef {Object} AverageBaseCumulativeSumPattern + * @property {_1m1w1y24hPattern} average + * @property {SeriesPattern1} base + * @property {SeriesPattern1} cumulative + * @property {_1m1w1y24hPattern} sum */ /** - * @typedef {Object} BaseCumulativeSumPattern3 - * @property {BtcCentsSatsUsdPattern} base - * @property {BtcCentsSatsUsdPattern} cumulative - * @property {_1m1w1y24hPattern3} sum - */ - -/** - * Create a BaseCumulativeSumPattern3 pattern node + * Create a AverageBaseCumulativeSumPattern pattern node + * @template T * @param {BrkClientBase} client * @param {string} acc - Accumulated series name - * @returns {BaseCumulativeSumPattern3} + * @returns {AverageBaseCumulativeSumPattern} */ -function createBaseCumulativeSumPattern3(client, acc) { +function createAverageBaseCumulativeSumPattern(client, acc) { return { - base: createBtcCentsSatsUsdPattern(client, acc), - cumulative: createBtcCentsSatsUsdPattern(client, _m(acc, 'cumulative')), - sum: create_1m1w1y24hPattern3(client, _m(acc, 'sum')), + average: create_1m1w1y24hPattern(client, _m(acc, 'average')), + base: createSeriesPattern1(client, acc), + cumulative: createSeriesPattern1(client, _m(acc, 'cumulative')), + sum: create_1m1w1y24hPattern(client, _m(acc, 'sum')), }; } /** - * @typedef {Object} BaseCumulativeSumPattern4 + * @typedef {Object} AdjustedRatioValuePattern + * @property {RatioTransferValuePattern} adjusted + * @property {_1m1w1y24hPattern} ratio + * @property {AverageBaseCumulativeSumPattern} valueDestroyed + */ + +/** + * @typedef {Object} BaseCumulativeSumPattern * @property {CentsUsdPattern2} base * @property {CentsUsdPattern2} cumulative * @property {_1m1w1y24hPattern5} sum */ /** - * Create a BaseCumulativeSumPattern4 pattern node + * Create a BaseCumulativeSumPattern pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated series name - * @returns {BaseCumulativeSumPattern4} + * @returns {BaseCumulativeSumPattern} */ -function createBaseCumulativeSumPattern4(client, acc) { +function createBaseCumulativeSumPattern(client, acc) { return { base: createCentsUsdPattern2(client, acc), cumulative: createCentsUsdPattern2(client, _m(acc, 'cumulative')), @@ -3137,32 +3189,11 @@ function createBaseCumulativeSumPattern4(client, acc) { }; } -/** - * @typedef {Object} BaseCumulativeSumPattern2 - * @property {SeriesPattern1} base - * @property {SeriesPattern1} cumulative - * @property {_1m1w1y24hPattern} sum - */ - -/** - * Create a BaseCumulativeSumPattern2 pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated series name - * @returns {BaseCumulativeSumPattern2} - */ -function createBaseCumulativeSumPattern2(client, acc) { - return { - base: createSeriesPattern1(client, acc), - cumulative: createSeriesPattern1(client, _m(acc, 'cumulative')), - sum: create_1m1w1y24hPattern(client, _m(acc, 'sum')), - }; -} - /** * @typedef {Object} BlocksDominanceRewardsPattern - * @property {BaseCumulativeSumPattern2} blocksMined + * @property {AverageBaseCumulativeSumPattern2} blocksMined * @property {_1m1w1y24hBpsPercentRatioPattern} dominance - * @property {BaseCumulativeSumPattern3} rewards + * @property {AverageBaseCumulativeSumPattern3} rewards */ /** @@ -3173,9 +3204,9 @@ function createBaseCumulativeSumPattern2(client, acc) { */ function createBlocksDominanceRewardsPattern(client, acc) { return { - blocksMined: createBaseCumulativeSumPattern2(client, _m(acc, 'blocks_mined')), + blocksMined: createAverageBaseCumulativeSumPattern2(client, _m(acc, 'blocks_mined')), dominance: create_1m1w1y24hBpsPercentRatioPattern(client, _m(acc, 'dominance')), - rewards: createBaseCumulativeSumPattern3(client, _m(acc, 'rewards')), + rewards: createAverageBaseCumulativeSumPattern3(client, _m(acc, 'rewards')), }; } @@ -3463,15 +3494,15 @@ function createNuplRealizedSupplyPattern(client, acc) { /** * @typedef {Object} RatioTransferValuePattern * @property {_1m1w1y24hPattern} ratio - * @property {BaseCumulativeSumPattern} transferVolume - * @property {BaseCumulativeSumPattern} valueDestroyed + * @property {AverageBaseCumulativeSumPattern} transferVolume + * @property {AverageBaseCumulativeSumPattern} valueDestroyed */ /** * @template T * @typedef {Object} _6bBlockTxPattern - * @property {AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern} _6b - * @property {AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern} block + * @property {MaxMedianMinPct10Pct25Pct75Pct90Pattern} _6b + * @property {MaxMedianMinPct10Pct25Pct75Pct90Pattern} block * @property {SeriesPattern19} txIndex */ @@ -3484,35 +3515,12 @@ function createNuplRealizedSupplyPattern(client, acc) { */ function create_6bBlockTxPattern(client, acc) { return { - _6b: createAverageMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, _m(acc, '6b')), - block: createAverageMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, acc), + _6b: createMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, _m(acc, '6b')), + block: createMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, acc), txIndex: createSeriesPattern19(client, acc), }; } -/** - * @template T - * @typedef {Object} BaseCumulativeSumPattern - * @property {SeriesPattern1} base - * @property {SeriesPattern1} cumulative - * @property {_1m1w1y24hPattern} sum - */ - -/** - * Create a BaseCumulativeSumPattern pattern node - * @template T - * @param {BrkClientBase} client - * @param {string} acc - Accumulated series name - * @returns {BaseCumulativeSumPattern} - */ -function createBaseCumulativeSumPattern(client, acc) { - return { - base: createSeriesPattern1(client, acc), - cumulative: createSeriesPattern1(client, _m(acc, 'cumulative')), - sum: create_1m1w1y24hPattern(client, _m(acc, 'sum')), - }; -} - /** * @typedef {Object} AbsoluteRatePattern * @property {_1m1w1y24hPattern} absolute @@ -3629,7 +3637,7 @@ function createBaseDeltaPattern(client, acc) { /** * @typedef {Object} BlocksDominancePattern - * @property {BaseCumulativeSumPattern2} blocksMined + * @property {AverageBaseCumulativeSumPattern2} blocksMined * @property {BpsPercentRatioPattern3} dominance */ @@ -3641,7 +3649,7 @@ function createBaseDeltaPattern(client, acc) { */ function createBlocksDominancePattern(client, acc) { return { - blocksMined: createBaseCumulativeSumPattern2(client, _m(acc, 'blocks_mined')), + blocksMined: createAverageBaseCumulativeSumPattern2(client, _m(acc, 'blocks_mined')), dominance: createBpsPercentRatioPattern3(client, _m(acc, 'dominance')), }; } @@ -3724,8 +3732,8 @@ function createCentsUsdPattern(client, acc) { /** * @typedef {Object} CoindaysTransferPattern - * @property {BaseCumulativeSumPattern} coindaysDestroyed - * @property {BaseCumulativeInSumPattern} transferVolume + * @property {AverageBaseCumulativeSumPattern} coindaysDestroyed + * @property {AverageBaseCumulativeInSumPattern} transferVolume */ /** @@ -3736,8 +3744,8 @@ function createCentsUsdPattern(client, acc) { */ function createCoindaysTransferPattern(client, acc) { return { - coindaysDestroyed: createBaseCumulativeSumPattern(client, _m(acc, 'coindays_destroyed')), - transferVolume: createBaseCumulativeInSumPattern(client, _m(acc, 'transfer_volume')), + coindaysDestroyed: createAverageBaseCumulativeSumPattern(client, _m(acc, 'coindays_destroyed')), + transferVolume: createAverageBaseCumulativeInSumPattern(client, _m(acc, 'transfer_volume')), }; } @@ -3760,6 +3768,25 @@ function createInPattern(client, acc) { }; } +/** + * @typedef {Object} PerPattern + * @property {CentsSatsUsdPattern} perCoin + * @property {CentsSatsUsdPattern} perDollar + */ + +/** + * Create a PerPattern pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated series name + * @returns {PerPattern} + */ +function createPerPattern(client, acc) { + return { + perCoin: createCentsSatsUsdPattern(client, _m(acc, 'coin')), + perDollar: createCentsSatsUsdPattern(client, _m(acc, 'dollar')), + }; +} + /** * @typedef {Object} PriceRatioPattern * @property {CentsSatsUsdPattern} price @@ -3783,7 +3810,7 @@ function createPriceRatioPattern(client, acc, disc) { /** * @typedef {Object} RatioValuePattern * @property {_24hPattern} ratio - * @property {BaseCumulativeSumPattern} valueDestroyed + * @property {AverageBaseCumulativeSumPattern} valueDestroyed */ /** @@ -3795,7 +3822,7 @@ function createPriceRatioPattern(client, acc, disc) { function createRatioValuePattern(client, acc) { return { ratio: create_24hPattern(client, _m(acc, 'sopr_24h')), - valueDestroyed: createBaseCumulativeSumPattern(client, _m(acc, 'value_destroyed')), + valueDestroyed: createAverageBaseCumulativeSumPattern(client, _m(acc, 'value_destroyed')), }; } @@ -3877,7 +3904,7 @@ function createPricePattern(client, acc) { /** * @typedef {Object} TransferPattern - * @property {BaseCumulativeSumPattern3} transferVolume + * @property {AverageBaseCumulativeSumPattern3} transferVolume */ /** @@ -3888,7 +3915,7 @@ function createPricePattern(client, acc) { */ function createTransferPattern(client, acc) { return { - transferVolume: createBaseCumulativeSumPattern3(client, acc), + transferVolume: createAverageBaseCumulativeSumPattern3(client, acc), }; } @@ -3997,7 +4024,7 @@ function createUnspentPattern(client, acc) { /** * @typedef {Object} SeriesTree_Blocks_Count * @property {_1m1w1y24hPattern} target - * @property {BaseCumulativeSumPattern2} total + * @property {AverageBaseCumulativeSumPattern2} total */ /** @@ -4100,8 +4127,8 @@ function createUnspentPattern(client, acc) { /** * @typedef {Object} SeriesTree_Transactions_Size_Weight * @property {SeriesPattern19} txIndex - * @property {AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern2} block - * @property {AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern2} _6b + * @property {MaxMedianMinPct10Pct25Pct75Pct90Pattern2} block + * @property {MaxMedianMinPct10Pct25Pct75Pct90Pattern2} _6b */ /** @@ -4114,14 +4141,14 @@ function createUnspentPattern(client, acc) { /** * @typedef {Object} SeriesTree_Transactions_Versions - * @property {BaseCumulativeSumPattern} v1 - * @property {BaseCumulativeSumPattern} v2 - * @property {BaseCumulativeSumPattern} v3 + * @property {AverageBaseCumulativeSumPattern} v1 + * @property {AverageBaseCumulativeSumPattern} v2 + * @property {AverageBaseCumulativeSumPattern} v3 */ /** * @typedef {Object} SeriesTree_Transactions_Volume - * @property {BaseCumulativeSumPattern3} transferVolume + * @property {AverageBaseCumulativeSumPattern3} transferVolume * @property {_1m1w1y24hPattern} txPerSec * @property {_1m1w1y24hPattern} outputsPerSec * @property {_1m1w1y24hPattern} inputsPerSec @@ -4284,15 +4311,15 @@ function createUnspentPattern(client, acc) { /** * @typedef {Object} SeriesTree_Addrs_New - * @property {BaseCumulativeSumPattern} all - * @property {BaseCumulativeSumPattern} p2pk65 - * @property {BaseCumulativeSumPattern} p2pk33 - * @property {BaseCumulativeSumPattern} p2pkh - * @property {BaseCumulativeSumPattern} p2sh - * @property {BaseCumulativeSumPattern} p2wpkh - * @property {BaseCumulativeSumPattern} p2wsh - * @property {BaseCumulativeSumPattern} p2tr - * @property {BaseCumulativeSumPattern} p2a + * @property {AverageBaseCumulativeSumPattern} all + * @property {AverageBaseCumulativeSumPattern} p2pk65 + * @property {AverageBaseCumulativeSumPattern} p2pk33 + * @property {AverageBaseCumulativeSumPattern} p2pkh + * @property {AverageBaseCumulativeSumPattern} p2sh + * @property {AverageBaseCumulativeSumPattern} p2wpkh + * @property {AverageBaseCumulativeSumPattern} p2wsh + * @property {AverageBaseCumulativeSumPattern} p2tr + * @property {AverageBaseCumulativeSumPattern} p2a */ /** @@ -4349,23 +4376,23 @@ function createUnspentPattern(client, acc) { /** * @typedef {Object} SeriesTree_Scripts_Count - * @property {BaseCumulativeSumPattern} p2a - * @property {BaseCumulativeSumPattern} p2ms - * @property {BaseCumulativeSumPattern} p2pk33 - * @property {BaseCumulativeSumPattern} p2pk65 - * @property {BaseCumulativeSumPattern} p2pkh - * @property {BaseCumulativeSumPattern} p2sh - * @property {BaseCumulativeSumPattern} p2tr - * @property {BaseCumulativeSumPattern} p2wpkh - * @property {BaseCumulativeSumPattern} p2wsh - * @property {BaseCumulativeSumPattern} opReturn - * @property {BaseCumulativeSumPattern} emptyOutput - * @property {BaseCumulativeSumPattern} unknownOutput + * @property {AverageBaseCumulativeSumPattern} p2a + * @property {AverageBaseCumulativeSumPattern} p2ms + * @property {AverageBaseCumulativeSumPattern} p2pk33 + * @property {AverageBaseCumulativeSumPattern} p2pk65 + * @property {AverageBaseCumulativeSumPattern} p2pkh + * @property {AverageBaseCumulativeSumPattern} p2sh + * @property {AverageBaseCumulativeSumPattern} p2tr + * @property {AverageBaseCumulativeSumPattern} p2wpkh + * @property {AverageBaseCumulativeSumPattern} p2wsh + * @property {AverageBaseCumulativeSumPattern} opReturn + * @property {AverageBaseCumulativeSumPattern} emptyOutput + * @property {AverageBaseCumulativeSumPattern} unknownOutput */ /** * @typedef {Object} SeriesTree_Scripts_Value - * @property {BaseCumulativeSumPattern3} opReturn + * @property {AverageBaseCumulativeSumPattern3} opReturn */ /** @@ -4376,7 +4403,7 @@ function createUnspentPattern(client, acc) { /** * @typedef {Object} SeriesTree_Mining_Rewards - * @property {BaseCumulativeSumPattern3} coinbase + * @property {AverageBaseCumulativeSumPattern3} coinbase * @property {SeriesTree_Mining_Rewards_Subsidy} subsidy * @property {SeriesTree_Mining_Rewards_Fees} fees * @property {SeriesTree_Mining_Rewards_Unclaimed} unclaimed @@ -4463,12 +4490,12 @@ function createUnspentPattern(client, acc) { /** * @typedef {Object} SeriesTree_Cointime_Activity - * @property {BaseCumulativeSumPattern} coinblocksCreated - * @property {BaseCumulativeSumPattern} coinblocksStored + * @property {AverageBaseCumulativeSumPattern} coinblocksCreated + * @property {AverageBaseCumulativeSumPattern} coinblocksStored * @property {SeriesPattern1} liveliness * @property {SeriesPattern1} vaultedness * @property {SeriesPattern1} ratio - * @property {BaseCumulativeSumPattern} coinblocksDestroyed + * @property {AverageBaseCumulativeSumPattern} coinblocksDestroyed */ /** @@ -4479,10 +4506,10 @@ function createUnspentPattern(client, acc) { /** * @typedef {Object} SeriesTree_Cointime_Value - * @property {BaseCumulativeSumPattern} destroyed - * @property {BaseCumulativeSumPattern} created - * @property {BaseCumulativeSumPattern} stored - * @property {BaseCumulativeSumPattern} vocdd + * @property {AverageBaseCumulativeSumPattern} destroyed + * @property {AverageBaseCumulativeSumPattern} created + * @property {AverageBaseCumulativeSumPattern} stored + * @property {AverageBaseCumulativeSumPattern} vocdd */ /** @@ -5323,7 +5350,7 @@ function createUnspentPattern(client, acc) { * @typedef {Object} SeriesTree_Supply * @property {SeriesPattern18} state * @property {BtcCentsSatsUsdPattern} circulating - * @property {BaseCumulativeSumPattern3} burned + * @property {AverageBaseCumulativeSumPattern3} burned * @property {BpsPercentRatioPattern} inflationRate * @property {SeriesTree_Supply_Velocity} velocity * @property {CentsDeltaUsdPattern} marketCap @@ -5382,8 +5409,8 @@ function createUnspentPattern(client, acc) { /** * @typedef {Object} SeriesTree_Cohorts_Utxo_All_Activity - * @property {BaseCumulativeInSumPattern} transferVolume - * @property {BaseCumulativeSumPattern} coindaysDestroyed + * @property {AverageBaseCumulativeInSumPattern} transferVolume + * @property {AverageBaseCumulativeSumPattern} coindaysDestroyed * @property {SeriesPattern1} coinyearsDestroyed * @property {_1m1w1y24hPattern} dormancy */ @@ -5397,7 +5424,7 @@ function createUnspentPattern(client, acc) { * @property {SeriesPattern1} mvrv * @property {BaseChangeCumulativeDeltaSumToPattern} netPnl * @property {SeriesTree_Cohorts_Utxo_All_Realized_Sopr} sopr - * @property {BaseCumulativeSumPattern4} grossPnl + * @property {BaseCumulativeSumPattern} grossPnl * @property {_1m1w1y24hPattern6} sellSideRiskRatio * @property {BaseCumulativeSumToPattern} peakRegret * @property {PricePattern} investor @@ -5511,7 +5538,7 @@ function createUnspentPattern(client, acc) { /** * @typedef {Object} SeriesTree_Cohorts_Utxo_All_Realized_Sopr - * @property {BaseCumulativeSumPattern} valueDestroyed + * @property {AverageBaseCumulativeSumPattern} valueDestroyed * @property {_1m1w1y24hPattern} ratio * @property {SeriesTree_Cohorts_Utxo_All_Realized_Sopr_Adjusted} adjusted */ @@ -5519,12 +5546,14 @@ function createUnspentPattern(client, acc) { /** * @typedef {Object} SeriesTree_Cohorts_Utxo_All_Realized_Sopr_Adjusted * @property {_1m1w1y24hPattern} ratio - * @property {BaseCumulativeSumPattern} transferVolume - * @property {BaseCumulativeSumPattern} valueDestroyed + * @property {AverageBaseCumulativeSumPattern} transferVolume + * @property {AverageBaseCumulativeSumPattern} valueDestroyed */ /** * @typedef {Object} SeriesTree_Cohorts_Utxo_All_CostBasis + * @property {PerPattern} inProfit + * @property {PerPattern} inLoss * @property {CentsSatsUsdPattern} min * @property {CentsSatsUsdPattern} max * @property {Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern} percentiles @@ -5540,6 +5569,8 @@ function createUnspentPattern(client, acc) { * @property {SeriesTree_Cohorts_Utxo_All_Unrealized_NetPnl} netPnl * @property {CentsUsdPattern2} grossPnl * @property {InPattern} investedCapital + * @property {SeriesPattern18} investorCapInProfitRaw + * @property {SeriesPattern18} investorCapInLossRaw * @property {SeriesTree_Cohorts_Utxo_All_Unrealized_Sentiment} sentiment */ @@ -5586,8 +5617,8 @@ function createUnspentPattern(client, acc) { /** * @typedef {Object} SeriesTree_Cohorts_Utxo_Sth_Activity - * @property {BaseCumulativeInSumPattern} transferVolume - * @property {BaseCumulativeSumPattern} coindaysDestroyed + * @property {AverageBaseCumulativeInSumPattern} transferVolume + * @property {AverageBaseCumulativeSumPattern} coindaysDestroyed * @property {SeriesPattern1} coinyearsDestroyed * @property {_1m1w1y24hPattern} dormancy */ @@ -5601,7 +5632,7 @@ function createUnspentPattern(client, acc) { * @property {SeriesPattern1} mvrv * @property {BaseChangeCumulativeDeltaSumToPattern} netPnl * @property {SeriesTree_Cohorts_Utxo_Sth_Realized_Sopr} sopr - * @property {BaseCumulativeSumPattern4} grossPnl + * @property {BaseCumulativeSumPattern} grossPnl * @property {_1m1w1y24hPattern6} sellSideRiskRatio * @property {BaseCumulativeSumToPattern} peakRegret * @property {PricePattern} investor @@ -5715,7 +5746,7 @@ function createUnspentPattern(client, acc) { /** * @typedef {Object} SeriesTree_Cohorts_Utxo_Sth_Realized_Sopr - * @property {BaseCumulativeSumPattern} valueDestroyed + * @property {AverageBaseCumulativeSumPattern} valueDestroyed * @property {_1m1w1y24hPattern} ratio * @property {SeriesTree_Cohorts_Utxo_Sth_Realized_Sopr_Adjusted} adjusted */ @@ -5723,12 +5754,14 @@ function createUnspentPattern(client, acc) { /** * @typedef {Object} SeriesTree_Cohorts_Utxo_Sth_Realized_Sopr_Adjusted * @property {_1m1w1y24hPattern} ratio - * @property {BaseCumulativeSumPattern} transferVolume - * @property {BaseCumulativeSumPattern} valueDestroyed + * @property {AverageBaseCumulativeSumPattern} transferVolume + * @property {AverageBaseCumulativeSumPattern} valueDestroyed */ /** * @typedef {Object} SeriesTree_Cohorts_Utxo_Sth_CostBasis + * @property {PerPattern} inProfit + * @property {PerPattern} inLoss * @property {CentsSatsUsdPattern} min * @property {CentsSatsUsdPattern} max * @property {Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern} percentiles @@ -5744,6 +5777,8 @@ function createUnspentPattern(client, acc) { * @property {CentsToUsdPattern3} netPnl * @property {CentsUsdPattern2} grossPnl * @property {InPattern} investedCapital + * @property {SeriesPattern18} investorCapInProfitRaw + * @property {SeriesPattern18} investorCapInLossRaw * @property {SeriesTree_Cohorts_Utxo_Sth_Unrealized_Sentiment} sentiment */ @@ -5766,8 +5801,8 @@ function createUnspentPattern(client, acc) { /** * @typedef {Object} SeriesTree_Cohorts_Utxo_Lth_Activity - * @property {BaseCumulativeInSumPattern} transferVolume - * @property {BaseCumulativeSumPattern} coindaysDestroyed + * @property {AverageBaseCumulativeInSumPattern} transferVolume + * @property {AverageBaseCumulativeSumPattern} coindaysDestroyed * @property {SeriesPattern1} coinyearsDestroyed * @property {_1m1w1y24hPattern} dormancy */ @@ -5781,7 +5816,7 @@ function createUnspentPattern(client, acc) { * @property {SeriesPattern1} mvrv * @property {BaseChangeCumulativeDeltaSumToPattern} netPnl * @property {SeriesTree_Cohorts_Utxo_Lth_Realized_Sopr} sopr - * @property {BaseCumulativeSumPattern4} grossPnl + * @property {BaseCumulativeSumPattern} grossPnl * @property {_1m1w1y24hPattern6} sellSideRiskRatio * @property {BaseCumulativeSumToPattern} peakRegret * @property {PricePattern} investor @@ -5895,12 +5930,14 @@ function createUnspentPattern(client, acc) { /** * @typedef {Object} SeriesTree_Cohorts_Utxo_Lth_Realized_Sopr - * @property {BaseCumulativeSumPattern} valueDestroyed + * @property {AverageBaseCumulativeSumPattern} valueDestroyed * @property {_1m1w1y24hPattern} ratio */ /** * @typedef {Object} SeriesTree_Cohorts_Utxo_Lth_CostBasis + * @property {PerPattern} inProfit + * @property {PerPattern} inLoss * @property {CentsSatsUsdPattern} min * @property {CentsSatsUsdPattern} max * @property {Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern} percentiles @@ -5916,6 +5953,8 @@ function createUnspentPattern(client, acc) { * @property {CentsToUsdPattern3} netPnl * @property {CentsUsdPattern2} grossPnl * @property {InPattern} investedCapital + * @property {SeriesPattern18} investorCapInProfitRaw + * @property {SeriesPattern18} investorCapInLossRaw * @property {SeriesTree_Cohorts_Utxo_Lth_Unrealized_Sentiment} sentiment */ @@ -6163,27 +6202,27 @@ function createUnspentPattern(client, acc) { /** * @typedef {Object} SeriesTree_Cohorts_Utxo_Matured - * @property {BaseCumulativeSumPattern3} under1h - * @property {BaseCumulativeSumPattern3} _1hTo1d - * @property {BaseCumulativeSumPattern3} _1dTo1w - * @property {BaseCumulativeSumPattern3} _1wTo1m - * @property {BaseCumulativeSumPattern3} _1mTo2m - * @property {BaseCumulativeSumPattern3} _2mTo3m - * @property {BaseCumulativeSumPattern3} _3mTo4m - * @property {BaseCumulativeSumPattern3} _4mTo5m - * @property {BaseCumulativeSumPattern3} _5mTo6m - * @property {BaseCumulativeSumPattern3} _6mTo1y - * @property {BaseCumulativeSumPattern3} _1yTo2y - * @property {BaseCumulativeSumPattern3} _2yTo3y - * @property {BaseCumulativeSumPattern3} _3yTo4y - * @property {BaseCumulativeSumPattern3} _4yTo5y - * @property {BaseCumulativeSumPattern3} _5yTo6y - * @property {BaseCumulativeSumPattern3} _6yTo7y - * @property {BaseCumulativeSumPattern3} _7yTo8y - * @property {BaseCumulativeSumPattern3} _8yTo10y - * @property {BaseCumulativeSumPattern3} _10yTo12y - * @property {BaseCumulativeSumPattern3} _12yTo15y - * @property {BaseCumulativeSumPattern3} over15y + * @property {AverageBaseCumulativeSumPattern3} under1h + * @property {AverageBaseCumulativeSumPattern3} _1hTo1d + * @property {AverageBaseCumulativeSumPattern3} _1dTo1w + * @property {AverageBaseCumulativeSumPattern3} _1wTo1m + * @property {AverageBaseCumulativeSumPattern3} _1mTo2m + * @property {AverageBaseCumulativeSumPattern3} _2mTo3m + * @property {AverageBaseCumulativeSumPattern3} _3mTo4m + * @property {AverageBaseCumulativeSumPattern3} _4mTo5m + * @property {AverageBaseCumulativeSumPattern3} _5mTo6m + * @property {AverageBaseCumulativeSumPattern3} _6mTo1y + * @property {AverageBaseCumulativeSumPattern3} _1yTo2y + * @property {AverageBaseCumulativeSumPattern3} _2yTo3y + * @property {AverageBaseCumulativeSumPattern3} _3yTo4y + * @property {AverageBaseCumulativeSumPattern3} _4yTo5y + * @property {AverageBaseCumulativeSumPattern3} _5yTo6y + * @property {AverageBaseCumulativeSumPattern3} _6yTo7y + * @property {AverageBaseCumulativeSumPattern3} _7yTo8y + * @property {AverageBaseCumulativeSumPattern3} _8yTo10y + * @property {AverageBaseCumulativeSumPattern3} _10yTo12y + * @property {AverageBaseCumulativeSumPattern3} _12yTo15y + * @property {AverageBaseCumulativeSumPattern3} over15y */ /** @@ -7483,7 +7522,7 @@ class BrkClient extends BrkClientBase { }, count: { target: create_1m1w1y24hPattern(this, 'block_count_target'), - total: createBaseCumulativeSumPattern2(this, 'block_count'), + total: createAverageBaseCumulativeSumPattern2(this, 'block_count'), }, lookback: { _1h: createSeriesPattern18(this, 'height_1h_ago'), @@ -7564,8 +7603,8 @@ class BrkClient extends BrkClientBase { vsize: create_6bBlockTxPattern(this, 'tx_vsize'), weight: { txIndex: createSeriesPattern19(this, 'tx_weight'), - block: createAverageMaxMedianMinPct10Pct25Pct75Pct90Pattern2(this, 'tx_weight'), - _6b: createAverageMaxMedianMinPct10Pct25Pct75Pct90Pattern2(this, 'tx_weight_6b'), + block: createMaxMedianMinPct10Pct25Pct75Pct90Pattern2(this, 'tx_weight'), + _6b: createMaxMedianMinPct10Pct25Pct75Pct90Pattern2(this, 'tx_weight_6b'), }, }, fees: { @@ -7575,12 +7614,12 @@ class BrkClient extends BrkClientBase { feeRate: create_6bBlockTxPattern(this, 'fee_rate'), }, versions: { - v1: createBaseCumulativeSumPattern(this, 'tx_v1'), - v2: createBaseCumulativeSumPattern(this, 'tx_v2'), - v3: createBaseCumulativeSumPattern(this, 'tx_v3'), + v1: createAverageBaseCumulativeSumPattern(this, 'tx_v1'), + v2: createAverageBaseCumulativeSumPattern(this, 'tx_v2'), + v3: createAverageBaseCumulativeSumPattern(this, 'tx_v3'), }, volume: { - transferVolume: createBaseCumulativeSumPattern3(this, 'transfer_volume_bis'), + transferVolume: createAverageBaseCumulativeSumPattern3(this, 'transfer_volume_bis'), txPerSec: create_1m1w1y24hPattern(this, 'tx_per_sec'), outputsPerSec: create_1m1w1y24hPattern(this, 'outputs_per_sec'), inputsPerSec: create_1m1w1y24hPattern(this, 'inputs_per_sec'), @@ -7682,15 +7721,15 @@ class BrkClient extends BrkClientBase { }, total: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3(this, 'total_addr_count'), new: { - all: createBaseCumulativeSumPattern(this, 'new_addr_count'), - p2pk65: createBaseCumulativeSumPattern(this, 'p2pk65_new_addr_count'), - p2pk33: createBaseCumulativeSumPattern(this, 'p2pk33_new_addr_count'), - p2pkh: createBaseCumulativeSumPattern(this, 'p2pkh_new_addr_count'), - p2sh: createBaseCumulativeSumPattern(this, 'p2sh_new_addr_count'), - p2wpkh: createBaseCumulativeSumPattern(this, 'p2wpkh_new_addr_count'), - p2wsh: createBaseCumulativeSumPattern(this, 'p2wsh_new_addr_count'), - p2tr: createBaseCumulativeSumPattern(this, 'p2tr_new_addr_count'), - p2a: createBaseCumulativeSumPattern(this, 'p2a_new_addr_count'), + all: createAverageBaseCumulativeSumPattern(this, 'new_addr_count'), + p2pk65: createAverageBaseCumulativeSumPattern(this, 'p2pk65_new_addr_count'), + p2pk33: createAverageBaseCumulativeSumPattern(this, 'p2pk33_new_addr_count'), + p2pkh: createAverageBaseCumulativeSumPattern(this, 'p2pkh_new_addr_count'), + p2sh: createAverageBaseCumulativeSumPattern(this, 'p2sh_new_addr_count'), + p2wpkh: createAverageBaseCumulativeSumPattern(this, 'p2wpkh_new_addr_count'), + p2wsh: createAverageBaseCumulativeSumPattern(this, 'p2wsh_new_addr_count'), + p2tr: createAverageBaseCumulativeSumPattern(this, 'p2tr_new_addr_count'), + p2a: createAverageBaseCumulativeSumPattern(this, 'p2a_new_addr_count'), }, delta: { all: createAbsoluteRatePattern(this, 'addr_count'), @@ -7724,26 +7763,26 @@ class BrkClient extends BrkClientBase { }, }, count: { - p2a: createBaseCumulativeSumPattern(this, 'p2a_count'), - p2ms: createBaseCumulativeSumPattern(this, 'p2ms_count'), - p2pk33: createBaseCumulativeSumPattern(this, 'p2pk33_count'), - p2pk65: createBaseCumulativeSumPattern(this, 'p2pk65_count'), - p2pkh: createBaseCumulativeSumPattern(this, 'p2pkh_count'), - p2sh: createBaseCumulativeSumPattern(this, 'p2sh_count'), - p2tr: createBaseCumulativeSumPattern(this, 'p2tr_count'), - p2wpkh: createBaseCumulativeSumPattern(this, 'p2wpkh_count'), - p2wsh: createBaseCumulativeSumPattern(this, 'p2wsh_count'), - opReturn: createBaseCumulativeSumPattern(this, 'op_return_count'), - emptyOutput: createBaseCumulativeSumPattern(this, 'empty_output_count'), - unknownOutput: createBaseCumulativeSumPattern(this, 'unknown_output_count'), + p2a: createAverageBaseCumulativeSumPattern(this, 'p2a_count'), + p2ms: createAverageBaseCumulativeSumPattern(this, 'p2ms_count'), + p2pk33: createAverageBaseCumulativeSumPattern(this, 'p2pk33_count'), + p2pk65: createAverageBaseCumulativeSumPattern(this, 'p2pk65_count'), + p2pkh: createAverageBaseCumulativeSumPattern(this, 'p2pkh_count'), + p2sh: createAverageBaseCumulativeSumPattern(this, 'p2sh_count'), + p2tr: createAverageBaseCumulativeSumPattern(this, 'p2tr_count'), + p2wpkh: createAverageBaseCumulativeSumPattern(this, 'p2wpkh_count'), + p2wsh: createAverageBaseCumulativeSumPattern(this, 'p2wsh_count'), + opReturn: createAverageBaseCumulativeSumPattern(this, 'op_return_count'), + emptyOutput: createAverageBaseCumulativeSumPattern(this, 'empty_output_count'), + unknownOutput: createAverageBaseCumulativeSumPattern(this, 'unknown_output_count'), }, value: { - opReturn: createBaseCumulativeSumPattern3(this, 'op_return_value'), + opReturn: createAverageBaseCumulativeSumPattern3(this, 'op_return_value'), }, }, mining: { rewards: { - coinbase: createBaseCumulativeSumPattern3(this, 'coinbase'), + coinbase: createAverageBaseCumulativeSumPattern3(this, 'coinbase'), subsidy: { base: createBtcCentsSatsUsdPattern(this, 'subsidy'), cumulative: createBtcCentsSatsUsdPattern(this, 'subsidy_cumulative'), @@ -7797,22 +7836,22 @@ class BrkClient extends BrkClientBase { }, cointime: { activity: { - coinblocksCreated: createBaseCumulativeSumPattern(this, 'coinblocks_created'), - coinblocksStored: createBaseCumulativeSumPattern(this, 'coinblocks_stored'), + coinblocksCreated: createAverageBaseCumulativeSumPattern(this, 'coinblocks_created'), + coinblocksStored: createAverageBaseCumulativeSumPattern(this, 'coinblocks_stored'), liveliness: createSeriesPattern1(this, 'liveliness'), vaultedness: createSeriesPattern1(this, 'vaultedness'), ratio: createSeriesPattern1(this, 'activity_to_vaultedness'), - coinblocksDestroyed: createBaseCumulativeSumPattern(this, 'coinblocks_destroyed'), + coinblocksDestroyed: createAverageBaseCumulativeSumPattern(this, 'coinblocks_destroyed'), }, supply: { vaulted: createBtcCentsSatsUsdPattern(this, 'vaulted_supply'), active: createBtcCentsSatsUsdPattern(this, 'active_supply'), }, value: { - destroyed: createBaseCumulativeSumPattern(this, 'cointime_value_destroyed'), - created: createBaseCumulativeSumPattern(this, 'cointime_value_created'), - stored: createBaseCumulativeSumPattern(this, 'cointime_value_stored'), - vocdd: createBaseCumulativeSumPattern(this, 'vocdd'), + destroyed: createAverageBaseCumulativeSumPattern(this, 'cointime_value_destroyed'), + created: createAverageBaseCumulativeSumPattern(this, 'cointime_value_created'), + stored: createAverageBaseCumulativeSumPattern(this, 'cointime_value_stored'), + vocdd: createAverageBaseCumulativeSumPattern(this, 'vocdd'), }, cap: { thermo: createCentsUsdPattern2(this, 'thermo_cap'), @@ -8434,7 +8473,7 @@ class BrkClient extends BrkClientBase { supply: { state: createSeriesPattern18(this, 'supply_state'), circulating: createBtcCentsSatsUsdPattern(this, 'circulating_supply'), - burned: createBaseCumulativeSumPattern3(this, 'unspendable_supply'), + burned: createAverageBaseCumulativeSumPattern3(this, 'unspendable_supply'), inflationRate: createBpsPercentRatioPattern(this, 'inflation_rate'), velocity: { native: createSeriesPattern1(this, 'velocity'), @@ -8456,8 +8495,8 @@ class BrkClient extends BrkClientBase { }, outputs: createUnspentPattern(this, 'utxo_count'), activity: { - transferVolume: createBaseCumulativeInSumPattern(this, 'transfer_volume'), - coindaysDestroyed: createBaseCumulativeSumPattern(this, 'coindays_destroyed'), + transferVolume: createAverageBaseCumulativeInSumPattern(this, 'transfer_volume'), + coindaysDestroyed: createAverageBaseCumulativeSumPattern(this, 'coindays_destroyed'), coinyearsDestroyed: createSeriesPattern1(this, 'coinyears_destroyed'), dormancy: create_1m1w1y24hPattern(this, 'dormancy'), }, @@ -8553,21 +8592,23 @@ class BrkClient extends BrkClientBase { mvrv: createSeriesPattern1(this, 'mvrv'), netPnl: createBaseChangeCumulativeDeltaSumToPattern(this, 'net'), sopr: { - valueDestroyed: createBaseCumulativeSumPattern(this, 'value_destroyed'), + valueDestroyed: createAverageBaseCumulativeSumPattern(this, 'value_destroyed'), ratio: create_1m1w1y24hPattern(this, 'sopr'), adjusted: { ratio: create_1m1w1y24hPattern(this, 'asopr'), - transferVolume: createBaseCumulativeSumPattern(this, 'adj_value_created'), - valueDestroyed: createBaseCumulativeSumPattern(this, 'adj_value_destroyed'), + transferVolume: createAverageBaseCumulativeSumPattern(this, 'adj_value_created'), + valueDestroyed: createAverageBaseCumulativeSumPattern(this, 'adj_value_destroyed'), }, }, - grossPnl: createBaseCumulativeSumPattern4(this, 'realized_gross_pnl'), + grossPnl: createBaseCumulativeSumPattern(this, 'realized_gross_pnl'), sellSideRiskRatio: create_1m1w1y24hPattern6(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'), }, costBasis: { + inProfit: createPerPattern(this, 'cost_basis_in_profit_per'), + inLoss: createPerPattern(this, 'cost_basis_in_loss_per'), min: createCentsSatsUsdPattern(this, 'cost_basis_min'), max: createCentsSatsUsdPattern(this, 'cost_basis_max'), percentiles: createPct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern(this, 'cost_basis'), @@ -8596,6 +8637,8 @@ class BrkClient extends BrkClientBase { }, grossPnl: createCentsUsdPattern2(this, 'unrealized_gross_pnl'), investedCapital: createInPattern(this, 'invested_capital_in'), + investorCapInProfitRaw: createSeriesPattern18(this, 'investor_cap_in_profit_raw'), + investorCapInLossRaw: createSeriesPattern18(this, 'investor_cap_in_loss_raw'), sentiment: { painIndex: createCentsUsdPattern2(this, 'pain_index'), greedIndex: createCentsUsdPattern2(this, 'greed_index'), @@ -8607,8 +8650,8 @@ class BrkClient extends BrkClientBase { supply: createDeltaHalfInToTotalPattern2(this, 'sth_supply'), outputs: createUnspentPattern(this, 'sth_utxo_count'), activity: { - transferVolume: createBaseCumulativeInSumPattern(this, 'sth_transfer_volume'), - coindaysDestroyed: createBaseCumulativeSumPattern(this, 'sth_coindays_destroyed'), + transferVolume: createAverageBaseCumulativeInSumPattern(this, 'sth_transfer_volume'), + coindaysDestroyed: createAverageBaseCumulativeSumPattern(this, 'sth_coindays_destroyed'), coinyearsDestroyed: createSeriesPattern1(this, 'sth_coinyears_destroyed'), dormancy: create_1m1w1y24hPattern(this, 'sth_dormancy'), }, @@ -8704,21 +8747,23 @@ class BrkClient extends BrkClientBase { mvrv: createSeriesPattern1(this, 'sth_mvrv'), netPnl: createBaseChangeCumulativeDeltaSumToPattern(this, 'sth_net'), sopr: { - valueDestroyed: createBaseCumulativeSumPattern(this, 'sth_value_destroyed'), + valueDestroyed: createAverageBaseCumulativeSumPattern(this, 'sth_value_destroyed'), ratio: create_1m1w1y24hPattern(this, 'sth_sopr'), adjusted: { ratio: create_1m1w1y24hPattern(this, 'sth_asopr'), - transferVolume: createBaseCumulativeSumPattern(this, 'sth_adj_value_created'), - valueDestroyed: createBaseCumulativeSumPattern(this, 'sth_adj_value_destroyed'), + transferVolume: createAverageBaseCumulativeSumPattern(this, 'sth_adj_value_created'), + valueDestroyed: createAverageBaseCumulativeSumPattern(this, 'sth_adj_value_destroyed'), }, }, - grossPnl: createBaseCumulativeSumPattern4(this, 'sth_realized_gross_pnl'), + grossPnl: createBaseCumulativeSumPattern(this, 'sth_realized_gross_pnl'), sellSideRiskRatio: create_1m1w1y24hPattern6(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'), }, costBasis: { + inProfit: createPerPattern(this, 'sth_cost_basis_in_profit_per'), + inLoss: createPerPattern(this, 'sth_cost_basis_in_loss_per'), min: createCentsSatsUsdPattern(this, 'sth_cost_basis_min'), max: createCentsSatsUsdPattern(this, 'sth_cost_basis_max'), percentiles: createPct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern(this, 'sth_cost_basis'), @@ -8732,6 +8777,8 @@ class BrkClient extends BrkClientBase { netPnl: createCentsToUsdPattern3(this, 'sth_net_unrealized_pnl'), grossPnl: createCentsUsdPattern2(this, 'sth_unrealized_gross_pnl'), investedCapital: createInPattern(this, 'sth_invested_capital_in'), + investorCapInProfitRaw: createSeriesPattern18(this, 'sth_investor_cap_in_profit_raw'), + investorCapInLossRaw: createSeriesPattern18(this, 'sth_investor_cap_in_loss_raw'), sentiment: { painIndex: createCentsUsdPattern2(this, 'sth_pain_index'), greedIndex: createCentsUsdPattern2(this, 'sth_greed_index'), @@ -8743,8 +8790,8 @@ class BrkClient extends BrkClientBase { supply: createDeltaHalfInToTotalPattern2(this, 'lth_supply'), outputs: createUnspentPattern(this, 'lth_utxo_count'), activity: { - transferVolume: createBaseCumulativeInSumPattern(this, 'lth_transfer_volume'), - coindaysDestroyed: createBaseCumulativeSumPattern(this, 'lth_coindays_destroyed'), + transferVolume: createAverageBaseCumulativeInSumPattern(this, 'lth_transfer_volume'), + coindaysDestroyed: createAverageBaseCumulativeSumPattern(this, 'lth_coindays_destroyed'), coinyearsDestroyed: createSeriesPattern1(this, 'lth_coinyears_destroyed'), dormancy: create_1m1w1y24hPattern(this, 'lth_dormancy'), }, @@ -8840,16 +8887,18 @@ class BrkClient extends BrkClientBase { mvrv: createSeriesPattern1(this, 'lth_mvrv'), netPnl: createBaseChangeCumulativeDeltaSumToPattern(this, 'lth_net'), sopr: { - valueDestroyed: createBaseCumulativeSumPattern(this, 'lth_value_destroyed'), + valueDestroyed: createAverageBaseCumulativeSumPattern(this, 'lth_value_destroyed'), ratio: create_1m1w1y24hPattern(this, 'lth_sopr'), }, - grossPnl: createBaseCumulativeSumPattern4(this, 'lth_realized_gross_pnl'), + grossPnl: createBaseCumulativeSumPattern(this, 'lth_realized_gross_pnl'), sellSideRiskRatio: create_1m1w1y24hPattern6(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'), }, costBasis: { + inProfit: createPerPattern(this, 'lth_cost_basis_in_profit_per'), + inLoss: createPerPattern(this, 'lth_cost_basis_in_loss_per'), min: createCentsSatsUsdPattern(this, 'lth_cost_basis_min'), max: createCentsSatsUsdPattern(this, 'lth_cost_basis_max'), percentiles: createPct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern(this, 'lth_cost_basis'), @@ -8863,6 +8912,8 @@ class BrkClient extends BrkClientBase { netPnl: createCentsToUsdPattern3(this, 'lth_net_unrealized_pnl'), grossPnl: createCentsUsdPattern2(this, 'lth_unrealized_gross_pnl'), investedCapital: createInPattern(this, 'lth_invested_capital_in'), + investorCapInProfitRaw: createSeriesPattern18(this, 'lth_investor_cap_in_profit_raw'), + investorCapInLossRaw: createSeriesPattern18(this, 'lth_investor_cap_in_loss_raw'), sentiment: { painIndex: createCentsUsdPattern2(this, 'lth_pain_index'), greedIndex: createCentsUsdPattern2(this, 'lth_greed_index'), @@ -9077,27 +9128,27 @@ class BrkClient extends BrkClientBase { }, }, matured: { - under1h: createBaseCumulativeSumPattern3(this, 'utxos_under_1h_old_matured_supply'), - _1hTo1d: createBaseCumulativeSumPattern3(this, 'utxos_1h_to_1d_old_matured_supply'), - _1dTo1w: createBaseCumulativeSumPattern3(this, 'utxos_1d_to_1w_old_matured_supply'), - _1wTo1m: createBaseCumulativeSumPattern3(this, 'utxos_1w_to_1m_old_matured_supply'), - _1mTo2m: createBaseCumulativeSumPattern3(this, 'utxos_1m_to_2m_old_matured_supply'), - _2mTo3m: createBaseCumulativeSumPattern3(this, 'utxos_2m_to_3m_old_matured_supply'), - _3mTo4m: createBaseCumulativeSumPattern3(this, 'utxos_3m_to_4m_old_matured_supply'), - _4mTo5m: createBaseCumulativeSumPattern3(this, 'utxos_4m_to_5m_old_matured_supply'), - _5mTo6m: createBaseCumulativeSumPattern3(this, 'utxos_5m_to_6m_old_matured_supply'), - _6mTo1y: createBaseCumulativeSumPattern3(this, 'utxos_6m_to_1y_old_matured_supply'), - _1yTo2y: createBaseCumulativeSumPattern3(this, 'utxos_1y_to_2y_old_matured_supply'), - _2yTo3y: createBaseCumulativeSumPattern3(this, 'utxos_2y_to_3y_old_matured_supply'), - _3yTo4y: createBaseCumulativeSumPattern3(this, 'utxos_3y_to_4y_old_matured_supply'), - _4yTo5y: createBaseCumulativeSumPattern3(this, 'utxos_4y_to_5y_old_matured_supply'), - _5yTo6y: createBaseCumulativeSumPattern3(this, 'utxos_5y_to_6y_old_matured_supply'), - _6yTo7y: createBaseCumulativeSumPattern3(this, 'utxos_6y_to_7y_old_matured_supply'), - _7yTo8y: createBaseCumulativeSumPattern3(this, 'utxos_7y_to_8y_old_matured_supply'), - _8yTo10y: createBaseCumulativeSumPattern3(this, 'utxos_8y_to_10y_old_matured_supply'), - _10yTo12y: createBaseCumulativeSumPattern3(this, 'utxos_10y_to_12y_old_matured_supply'), - _12yTo15y: createBaseCumulativeSumPattern3(this, 'utxos_12y_to_15y_old_matured_supply'), - over15y: createBaseCumulativeSumPattern3(this, 'utxos_over_15y_old_matured_supply'), + under1h: createAverageBaseCumulativeSumPattern3(this, 'utxos_under_1h_old_matured_supply'), + _1hTo1d: createAverageBaseCumulativeSumPattern3(this, 'utxos_1h_to_1d_old_matured_supply'), + _1dTo1w: createAverageBaseCumulativeSumPattern3(this, 'utxos_1d_to_1w_old_matured_supply'), + _1wTo1m: createAverageBaseCumulativeSumPattern3(this, 'utxos_1w_to_1m_old_matured_supply'), + _1mTo2m: createAverageBaseCumulativeSumPattern3(this, 'utxos_1m_to_2m_old_matured_supply'), + _2mTo3m: createAverageBaseCumulativeSumPattern3(this, 'utxos_2m_to_3m_old_matured_supply'), + _3mTo4m: createAverageBaseCumulativeSumPattern3(this, 'utxos_3m_to_4m_old_matured_supply'), + _4mTo5m: createAverageBaseCumulativeSumPattern3(this, 'utxos_4m_to_5m_old_matured_supply'), + _5mTo6m: createAverageBaseCumulativeSumPattern3(this, 'utxos_5m_to_6m_old_matured_supply'), + _6mTo1y: createAverageBaseCumulativeSumPattern3(this, 'utxos_6m_to_1y_old_matured_supply'), + _1yTo2y: createAverageBaseCumulativeSumPattern3(this, 'utxos_1y_to_2y_old_matured_supply'), + _2yTo3y: createAverageBaseCumulativeSumPattern3(this, 'utxos_2y_to_3y_old_matured_supply'), + _3yTo4y: createAverageBaseCumulativeSumPattern3(this, 'utxos_3y_to_4y_old_matured_supply'), + _4yTo5y: createAverageBaseCumulativeSumPattern3(this, 'utxos_4y_to_5y_old_matured_supply'), + _5yTo6y: createAverageBaseCumulativeSumPattern3(this, 'utxos_5y_to_6y_old_matured_supply'), + _6yTo7y: createAverageBaseCumulativeSumPattern3(this, 'utxos_6y_to_7y_old_matured_supply'), + _7yTo8y: createAverageBaseCumulativeSumPattern3(this, 'utxos_7y_to_8y_old_matured_supply'), + _8yTo10y: createAverageBaseCumulativeSumPattern3(this, 'utxos_8y_to_10y_old_matured_supply'), + _10yTo12y: createAverageBaseCumulativeSumPattern3(this, 'utxos_10y_to_12y_old_matured_supply'), + _12yTo15y: createAverageBaseCumulativeSumPattern3(this, 'utxos_12y_to_15y_old_matured_supply'), + over15y: createAverageBaseCumulativeSumPattern3(this, 'utxos_over_15y_old_matured_supply'), }, }, addr: { diff --git a/packages/brk_client/brk_client/__init__.py b/packages/brk_client/brk_client/__init__.py index 5ef40691c..68a113291 100644 --- a/packages/brk_client/brk_client/__init__.py +++ b/packages/brk_client/brk_client/__init__.py @@ -2292,38 +2292,14 @@ class AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern: self.pct90: _1m1w1y24hPattern[StoredU64] = _1m1w1y24hPattern(client, _m(acc, 'pct90')) self.sum: _1m1w1y24hPattern[StoredU64] = _1m1w1y24hPattern(client, _m(acc, 'sum')) -class AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern2: +class GrossInvestedInvestorLossNetNuplProfitSentimentPattern2: """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated series name.""" - self.average: SeriesPattern18[Weight] = SeriesPattern18(client, _m(acc, 'average')) - self.max: SeriesPattern18[Weight] = SeriesPattern18(client, _m(acc, 'max')) - self.median: SeriesPattern18[Weight] = SeriesPattern18(client, _m(acc, 'median')) - self.min: SeriesPattern18[Weight] = SeriesPattern18(client, _m(acc, 'min')) - self.pct10: SeriesPattern18[Weight] = SeriesPattern18(client, _m(acc, 'pct10')) - self.pct25: SeriesPattern18[Weight] = SeriesPattern18(client, _m(acc, 'pct25')) - self.pct75: SeriesPattern18[Weight] = SeriesPattern18(client, _m(acc, 'pct75')) - self.pct90: SeriesPattern18[Weight] = SeriesPattern18(client, _m(acc, 'pct90')) + pass class BpsCentsPercentilesRatioSatsSmaStdUsdPattern: """Pattern struct for repeated tree structure.""" pass -class AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern(Generic[T]): - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated series name.""" - self.average: SeriesPattern1[T] = SeriesPattern1(client, _m(acc, 'average')) - self.max: SeriesPattern1[T] = SeriesPattern1(client, _m(acc, 'max')) - self.median: SeriesPattern1[T] = SeriesPattern1(client, _m(acc, 'median')) - self.min: SeriesPattern1[T] = SeriesPattern1(client, _m(acc, 'min')) - self.pct10: SeriesPattern1[T] = SeriesPattern1(client, _m(acc, 'pct10')) - self.pct25: SeriesPattern1[T] = SeriesPattern1(client, _m(acc, 'pct25')) - self.pct75: SeriesPattern1[T] = SeriesPattern1(client, _m(acc, 'pct75')) - self.pct90: SeriesPattern1[T] = SeriesPattern1(client, _m(acc, 'pct90')) - class _10y2y3y4y5y6y8yPattern: """Pattern struct for repeated tree structure.""" @@ -2360,13 +2336,39 @@ class CapLossMvrvNetPriceProfitSoprPattern: self.mvrv: SeriesPattern1[StoredF32] = SeriesPattern1(client, _m(acc, 'mvrv')) self.net_pnl: BaseCumulativeDeltaSumPattern = BaseCumulativeDeltaSumPattern(client, _m(acc, 'net_realized_pnl')) self.price: BpsCentsRatioSatsUsdPattern = BpsCentsRatioSatsUsdPattern(client, _m(acc, 'realized_price')) - self.profit: BaseCumulativeSumPattern4 = BaseCumulativeSumPattern4(client, _m(acc, 'realized_profit')) + self.profit: BaseCumulativeSumPattern = BaseCumulativeSumPattern(client, _m(acc, 'realized_profit')) self.sopr: RatioValuePattern = RatioValuePattern(client, acc) -class GrossInvestedLossNetNuplProfitSentimentPattern2: +class InInvestedMaxMinPercentilesSupplyPattern: """Pattern struct for repeated tree structure.""" pass +class MaxMedianMinPct10Pct25Pct75Pct90Pattern2: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated series name.""" + self.max: SeriesPattern18[Weight] = SeriesPattern18(client, _m(acc, 'max')) + self.median: SeriesPattern18[Weight] = SeriesPattern18(client, _m(acc, 'median')) + self.min: SeriesPattern18[Weight] = SeriesPattern18(client, _m(acc, 'min')) + self.pct10: SeriesPattern18[Weight] = SeriesPattern18(client, _m(acc, 'pct10')) + self.pct25: SeriesPattern18[Weight] = SeriesPattern18(client, _m(acc, 'pct25')) + self.pct75: SeriesPattern18[Weight] = SeriesPattern18(client, _m(acc, 'pct75')) + self.pct90: SeriesPattern18[Weight] = SeriesPattern18(client, _m(acc, 'pct90')) + +class MaxMedianMinPct10Pct25Pct75Pct90Pattern(Generic[T]): + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated series name.""" + self.max: SeriesPattern1[T] = SeriesPattern1(client, _m(acc, 'max')) + self.median: SeriesPattern1[T] = SeriesPattern1(client, _m(acc, 'median')) + self.min: SeriesPattern1[T] = SeriesPattern1(client, _m(acc, 'min')) + self.pct10: SeriesPattern1[T] = SeriesPattern1(client, _m(acc, 'pct10')) + self.pct25: SeriesPattern1[T] = SeriesPattern1(client, _m(acc, 'pct25')) + self.pct75: SeriesPattern1[T] = SeriesPattern1(client, _m(acc, 'pct75')) + self.pct90: SeriesPattern1[T] = SeriesPattern1(client, _m(acc, 'pct90')) + class _1m1w1y2y4yAllPattern: """Pattern struct for repeated tree structure.""" @@ -2391,6 +2393,18 @@ class ActivityAddrOutputsRealizedSupplyUnrealizedPattern: self.supply: DeltaHalfTotalPattern = DeltaHalfTotalPattern(client, _m(acc, 'supply')) self.unrealized: NuplPattern = NuplPattern(client, _m(acc, 'nupl')) +class AverageBaseCumulativeInSumPattern: + """Pattern struct for repeated tree structure.""" + + 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.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')) + class BaseChangeCumulativeDeltaSumToPattern: """Pattern struct for repeated tree structure.""" @@ -2508,17 +2522,6 @@ class ActivityOutputsRealizedSupplyUnrealizedPattern2: self.supply: DeltaHalfTotalPattern = DeltaHalfTotalPattern(client, _m(acc, 'supply')) self.unrealized: NuplPattern = NuplPattern(client, _m(acc, 'nupl')) -class BaseCumulativeInSumPattern: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated series name.""" - self.base: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, acc) - self.cumulative: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'cumulative')) - self.in_loss: BaseCumulativeSumPattern3 = BaseCumulativeSumPattern3(client, _m(acc, 'in_loss')) - self.in_profit: BaseCumulativeSumPattern3 = BaseCumulativeSumPattern3(client, _m(acc, 'in_profit')) - self.sum: _1m1w1y24hPattern3 = _1m1w1y24hPattern3(client, _m(acc, 'sum')) - class BaseCumulativeNegativeSumToPattern: """Pattern struct for repeated tree structure.""" pass @@ -2573,10 +2576,10 @@ class CapLossMvrvPriceProfitPattern: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated series name.""" self.cap: CentsDeltaUsdPattern = CentsDeltaUsdPattern(client, _m(acc, 'realized_cap')) - self.loss: BaseCumulativeSumPattern4 = BaseCumulativeSumPattern4(client, _m(acc, 'realized_loss')) + self.loss: BaseCumulativeSumPattern = BaseCumulativeSumPattern(client, _m(acc, 'realized_loss')) self.mvrv: SeriesPattern1[StoredF32] = SeriesPattern1(client, _m(acc, 'mvrv')) self.price: BpsCentsRatioSatsUsdPattern = BpsCentsRatioSatsUsdPattern(client, _m(acc, 'realized_price')) - self.profit: BaseCumulativeSumPattern4 = BaseCumulativeSumPattern4(client, _m(acc, 'realized_profit')) + self.profit: BaseCumulativeSumPattern = BaseCumulativeSumPattern(client, _m(acc, 'realized_profit')) class CentsToUsdPattern4: """Pattern struct for repeated tree structure.""" @@ -2604,10 +2607,6 @@ class EmaHistogramLineSignalPattern: """Pattern struct for repeated tree structure.""" pass -class InvestedMaxMinPercentilesSupplyPattern: - """Pattern struct for repeated tree structure.""" - pass - class PhsReboundThsPattern: """Pattern struct for repeated tree structure.""" @@ -2694,6 +2693,26 @@ class _1y2y4yAllPattern: """Pattern struct for repeated tree structure.""" pass +class AverageBaseCumulativeSumPattern2: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated series name.""" + self.average: _1m1w1y24hPattern[StoredU64] = _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')) + +class AverageBaseCumulativeSumPattern3: + """Pattern struct for repeated tree structure.""" + + 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')) + class BaseCumulativeDeltaSumPattern: """Pattern struct for repeated tree structure.""" @@ -2788,20 +2807,21 @@ class _1m1w1y24hPattern(Generic[T]): self._1y: SeriesPattern1[T] = SeriesPattern1(client, _m(acc, '1y')) self._24h: SeriesPattern1[T] = SeriesPattern1(client, _m(acc, '24h')) -class AdjustedRatioValuePattern: - """Pattern struct for repeated tree structure.""" - pass - -class BaseCumulativeSumPattern3: +class AverageBaseCumulativeSumPattern(Generic[T]): """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated series name.""" - self.base: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, acc) - self.cumulative: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'cumulative')) - self.sum: _1m1w1y24hPattern3 = _1m1w1y24hPattern3(client, _m(acc, 'sum')) + self.average: _1m1w1y24hPattern[T] = _1m1w1y24hPattern(client, _m(acc, 'average')) + self.base: SeriesPattern1[T] = SeriesPattern1(client, acc) + self.cumulative: SeriesPattern1[T] = SeriesPattern1(client, _m(acc, 'cumulative')) + self.sum: _1m1w1y24hPattern[T] = _1m1w1y24hPattern(client, _m(acc, 'sum')) -class BaseCumulativeSumPattern4: +class AdjustedRatioValuePattern: + """Pattern struct for repeated tree structure.""" + pass + +class BaseCumulativeSumPattern: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -2810,23 +2830,14 @@ class BaseCumulativeSumPattern4: self.cumulative: CentsUsdPattern2 = CentsUsdPattern2(client, _m(acc, 'cumulative')) self.sum: _1m1w1y24hPattern5 = _1m1w1y24hPattern5(client, _m(acc, 'sum')) -class BaseCumulativeSumPattern2: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated series name.""" - 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')) - class BlocksDominanceRewardsPattern: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated series name.""" - self.blocks_mined: BaseCumulativeSumPattern2 = BaseCumulativeSumPattern2(client, _m(acc, 'blocks_mined')) + self.blocks_mined: AverageBaseCumulativeSumPattern2 = AverageBaseCumulativeSumPattern2(client, _m(acc, 'blocks_mined')) self.dominance: _1m1w1y24hBpsPercentRatioPattern = _1m1w1y24hBpsPercentRatioPattern(client, _m(acc, 'dominance')) - self.rewards: BaseCumulativeSumPattern3 = BaseCumulativeSumPattern3(client, _m(acc, 'rewards')) + self.rewards: AverageBaseCumulativeSumPattern3 = AverageBaseCumulativeSumPattern3(client, _m(acc, 'rewards')) class BpsPercentRatioPattern3: """Pattern struct for repeated tree structure.""" @@ -2958,19 +2969,10 @@ class _6bBlockTxPattern(Generic[T]): def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated series name.""" - self._6b: AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern[T] = AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, _m(acc, '6b')) - self.block: AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern[T] = AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, acc) + self._6b: MaxMedianMinPct10Pct25Pct75Pct90Pattern[T] = MaxMedianMinPct10Pct25Pct75Pct90Pattern(client, _m(acc, '6b')) + self.block: MaxMedianMinPct10Pct25Pct75Pct90Pattern[T] = MaxMedianMinPct10Pct25Pct75Pct90Pattern(client, acc) self.tx_index: SeriesPattern19[T] = SeriesPattern19(client, acc) -class BaseCumulativeSumPattern(Generic[T]): - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated series name.""" - self.base: SeriesPattern1[T] = SeriesPattern1(client, acc) - self.cumulative: SeriesPattern1[T] = SeriesPattern1(client, _m(acc, 'cumulative')) - self.sum: _1m1w1y24hPattern[T] = _1m1w1y24hPattern(client, _m(acc, 'sum')) - class AbsoluteRatePattern: """Pattern struct for repeated tree structure.""" @@ -3024,7 +3026,7 @@ class BlocksDominancePattern: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated series name.""" - self.blocks_mined: BaseCumulativeSumPattern2 = BaseCumulativeSumPattern2(client, _m(acc, 'blocks_mined')) + self.blocks_mined: AverageBaseCumulativeSumPattern2 = AverageBaseCumulativeSumPattern2(client, _m(acc, 'blocks_mined')) self.dominance: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, 'dominance')) class BpsRatioPattern2: @@ -3064,8 +3066,8 @@ class CoindaysTransferPattern: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated series name.""" - self.coindays_destroyed: BaseCumulativeSumPattern[StoredF64] = BaseCumulativeSumPattern(client, _m(acc, 'coindays_destroyed')) - self.transfer_volume: BaseCumulativeInSumPattern = BaseCumulativeInSumPattern(client, _m(acc, 'transfer_volume')) + self.coindays_destroyed: AverageBaseCumulativeSumPattern[StoredF64] = AverageBaseCumulativeSumPattern(client, _m(acc, 'coindays_destroyed')) + self.transfer_volume: AverageBaseCumulativeInSumPattern = AverageBaseCumulativeInSumPattern(client, _m(acc, 'transfer_volume')) class InPattern: """Pattern struct for repeated tree structure.""" @@ -3075,6 +3077,14 @@ class InPattern: self.in_loss: CentsUsdPattern2 = CentsUsdPattern2(client, _m(acc, 'loss')) self.in_profit: CentsUsdPattern2 = CentsUsdPattern2(client, _m(acc, 'profit')) +class PerPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated series name.""" + self.per_coin: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'coin')) + self.per_dollar: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'dollar')) + class PriceRatioPattern: """Pattern struct for repeated tree structure.""" @@ -3089,7 +3099,7 @@ class RatioValuePattern: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated series name.""" self.ratio: _24hPattern = _24hPattern(client, _m(acc, 'sopr_24h')) - self.value_destroyed: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, _m(acc, 'value_destroyed')) + self.value_destroyed: AverageBaseCumulativeSumPattern[Cents] = AverageBaseCumulativeSumPattern(client, _m(acc, 'value_destroyed')) class SdSmaPattern: """Pattern struct for repeated tree structure.""" @@ -3129,7 +3139,7 @@ class TransferPattern: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated series name.""" - self.transfer_volume: BaseCumulativeSumPattern3 = BaseCumulativeSumPattern3(client, acc) + self.transfer_volume: AverageBaseCumulativeSumPattern3 = AverageBaseCumulativeSumPattern3(client, acc) class UnspentPattern: """Pattern struct for repeated tree structure.""" @@ -3196,7 +3206,7 @@ class SeriesTree_Blocks_Count: def __init__(self, client: BrkClientBase, base_path: str = ''): self.target: _1m1w1y24hPattern[StoredU64] = _1m1w1y24hPattern(client, 'block_count_target') - self.total: BaseCumulativeSumPattern2 = BaseCumulativeSumPattern2(client, 'block_count') + self.total: AverageBaseCumulativeSumPattern2 = AverageBaseCumulativeSumPattern2(client, 'block_count') class SeriesTree_Blocks_Lookback: """Series tree node.""" @@ -3305,8 +3315,8 @@ class SeriesTree_Transactions_Size_Weight: def __init__(self, client: BrkClientBase, base_path: str = ''): self.tx_index: SeriesPattern19[Weight] = SeriesPattern19(client, 'tx_weight') - self.block: AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern2 = AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern2(client, 'tx_weight') - self._6b: AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern2 = AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern2(client, 'tx_weight_6b') + self.block: MaxMedianMinPct10Pct25Pct75Pct90Pattern2 = MaxMedianMinPct10Pct25Pct75Pct90Pattern2(client, 'tx_weight') + self._6b: MaxMedianMinPct10Pct25Pct75Pct90Pattern2 = MaxMedianMinPct10Pct25Pct75Pct90Pattern2(client, 'tx_weight_6b') class SeriesTree_Transactions_Size: """Series tree node.""" @@ -3328,15 +3338,15 @@ class SeriesTree_Transactions_Versions: """Series tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.v1: BaseCumulativeSumPattern[StoredU64] = BaseCumulativeSumPattern(client, 'tx_v1') - self.v2: BaseCumulativeSumPattern[StoredU64] = BaseCumulativeSumPattern(client, 'tx_v2') - self.v3: BaseCumulativeSumPattern[StoredU64] = BaseCumulativeSumPattern(client, 'tx_v3') + self.v1: AverageBaseCumulativeSumPattern[StoredU64] = AverageBaseCumulativeSumPattern(client, 'tx_v1') + self.v2: AverageBaseCumulativeSumPattern[StoredU64] = AverageBaseCumulativeSumPattern(client, 'tx_v2') + self.v3: AverageBaseCumulativeSumPattern[StoredU64] = AverageBaseCumulativeSumPattern(client, 'tx_v3') class SeriesTree_Transactions_Volume: """Series tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.transfer_volume: BaseCumulativeSumPattern3 = BaseCumulativeSumPattern3(client, 'transfer_volume_bis') + self.transfer_volume: AverageBaseCumulativeSumPattern3 = AverageBaseCumulativeSumPattern3(client, 'transfer_volume_bis') self.tx_per_sec: _1m1w1y24hPattern[StoredF32] = _1m1w1y24hPattern(client, 'tx_per_sec') self.outputs_per_sec: _1m1w1y24hPattern[StoredF32] = _1m1w1y24hPattern(client, 'outputs_per_sec') self.inputs_per_sec: _1m1w1y24hPattern[StoredF32] = _1m1w1y24hPattern(client, 'inputs_per_sec') @@ -3517,15 +3527,15 @@ class SeriesTree_Addrs_New: """Series tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.all: BaseCumulativeSumPattern[StoredU64] = BaseCumulativeSumPattern(client, 'new_addr_count') - self.p2pk65: BaseCumulativeSumPattern[StoredU64] = BaseCumulativeSumPattern(client, 'p2pk65_new_addr_count') - self.p2pk33: BaseCumulativeSumPattern[StoredU64] = BaseCumulativeSumPattern(client, 'p2pk33_new_addr_count') - self.p2pkh: BaseCumulativeSumPattern[StoredU64] = BaseCumulativeSumPattern(client, 'p2pkh_new_addr_count') - self.p2sh: BaseCumulativeSumPattern[StoredU64] = BaseCumulativeSumPattern(client, 'p2sh_new_addr_count') - self.p2wpkh: BaseCumulativeSumPattern[StoredU64] = BaseCumulativeSumPattern(client, 'p2wpkh_new_addr_count') - self.p2wsh: BaseCumulativeSumPattern[StoredU64] = BaseCumulativeSumPattern(client, 'p2wsh_new_addr_count') - self.p2tr: BaseCumulativeSumPattern[StoredU64] = BaseCumulativeSumPattern(client, 'p2tr_new_addr_count') - self.p2a: BaseCumulativeSumPattern[StoredU64] = BaseCumulativeSumPattern(client, 'p2a_new_addr_count') + self.all: AverageBaseCumulativeSumPattern[StoredU64] = AverageBaseCumulativeSumPattern(client, 'new_addr_count') + self.p2pk65: AverageBaseCumulativeSumPattern[StoredU64] = AverageBaseCumulativeSumPattern(client, 'p2pk65_new_addr_count') + self.p2pk33: AverageBaseCumulativeSumPattern[StoredU64] = AverageBaseCumulativeSumPattern(client, 'p2pk33_new_addr_count') + self.p2pkh: AverageBaseCumulativeSumPattern[StoredU64] = AverageBaseCumulativeSumPattern(client, 'p2pkh_new_addr_count') + self.p2sh: AverageBaseCumulativeSumPattern[StoredU64] = AverageBaseCumulativeSumPattern(client, 'p2sh_new_addr_count') + self.p2wpkh: AverageBaseCumulativeSumPattern[StoredU64] = AverageBaseCumulativeSumPattern(client, 'p2wpkh_new_addr_count') + self.p2wsh: AverageBaseCumulativeSumPattern[StoredU64] = AverageBaseCumulativeSumPattern(client, 'p2wsh_new_addr_count') + self.p2tr: AverageBaseCumulativeSumPattern[StoredU64] = AverageBaseCumulativeSumPattern(client, 'p2tr_new_addr_count') + self.p2a: AverageBaseCumulativeSumPattern[StoredU64] = AverageBaseCumulativeSumPattern(client, 'p2a_new_addr_count') class SeriesTree_Addrs_Delta: """Series tree node.""" @@ -3596,24 +3606,24 @@ class SeriesTree_Scripts_Count: """Series tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.p2a: BaseCumulativeSumPattern[StoredU64] = BaseCumulativeSumPattern(client, 'p2a_count') - self.p2ms: BaseCumulativeSumPattern[StoredU64] = BaseCumulativeSumPattern(client, 'p2ms_count') - self.p2pk33: BaseCumulativeSumPattern[StoredU64] = BaseCumulativeSumPattern(client, 'p2pk33_count') - self.p2pk65: BaseCumulativeSumPattern[StoredU64] = BaseCumulativeSumPattern(client, 'p2pk65_count') - self.p2pkh: BaseCumulativeSumPattern[StoredU64] = BaseCumulativeSumPattern(client, 'p2pkh_count') - self.p2sh: BaseCumulativeSumPattern[StoredU64] = BaseCumulativeSumPattern(client, 'p2sh_count') - self.p2tr: BaseCumulativeSumPattern[StoredU64] = BaseCumulativeSumPattern(client, 'p2tr_count') - self.p2wpkh: BaseCumulativeSumPattern[StoredU64] = BaseCumulativeSumPattern(client, 'p2wpkh_count') - self.p2wsh: BaseCumulativeSumPattern[StoredU64] = BaseCumulativeSumPattern(client, 'p2wsh_count') - self.op_return: BaseCumulativeSumPattern[StoredU64] = BaseCumulativeSumPattern(client, 'op_return_count') - self.empty_output: BaseCumulativeSumPattern[StoredU64] = BaseCumulativeSumPattern(client, 'empty_output_count') - self.unknown_output: BaseCumulativeSumPattern[StoredU64] = BaseCumulativeSumPattern(client, 'unknown_output_count') + self.p2a: AverageBaseCumulativeSumPattern[StoredU64] = AverageBaseCumulativeSumPattern(client, 'p2a_count') + self.p2ms: AverageBaseCumulativeSumPattern[StoredU64] = AverageBaseCumulativeSumPattern(client, 'p2ms_count') + self.p2pk33: AverageBaseCumulativeSumPattern[StoredU64] = AverageBaseCumulativeSumPattern(client, 'p2pk33_count') + self.p2pk65: AverageBaseCumulativeSumPattern[StoredU64] = AverageBaseCumulativeSumPattern(client, 'p2pk65_count') + self.p2pkh: AverageBaseCumulativeSumPattern[StoredU64] = AverageBaseCumulativeSumPattern(client, 'p2pkh_count') + self.p2sh: AverageBaseCumulativeSumPattern[StoredU64] = AverageBaseCumulativeSumPattern(client, 'p2sh_count') + self.p2tr: AverageBaseCumulativeSumPattern[StoredU64] = AverageBaseCumulativeSumPattern(client, 'p2tr_count') + self.p2wpkh: AverageBaseCumulativeSumPattern[StoredU64] = AverageBaseCumulativeSumPattern(client, 'p2wpkh_count') + self.p2wsh: AverageBaseCumulativeSumPattern[StoredU64] = AverageBaseCumulativeSumPattern(client, 'p2wsh_count') + self.op_return: AverageBaseCumulativeSumPattern[StoredU64] = AverageBaseCumulativeSumPattern(client, 'op_return_count') + self.empty_output: AverageBaseCumulativeSumPattern[StoredU64] = AverageBaseCumulativeSumPattern(client, 'empty_output_count') + self.unknown_output: AverageBaseCumulativeSumPattern[StoredU64] = AverageBaseCumulativeSumPattern(client, 'unknown_output_count') class SeriesTree_Scripts_Value: """Series tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.op_return: BaseCumulativeSumPattern3 = BaseCumulativeSumPattern3(client, 'op_return_value') + self.op_return: AverageBaseCumulativeSumPattern3 = AverageBaseCumulativeSumPattern3(client, 'op_return_value') class SeriesTree_Scripts: """Series tree node.""" @@ -3670,7 +3680,7 @@ class SeriesTree_Mining_Rewards: """Series tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.coinbase: BaseCumulativeSumPattern3 = BaseCumulativeSumPattern3(client, 'coinbase') + self.coinbase: AverageBaseCumulativeSumPattern3 = AverageBaseCumulativeSumPattern3(client, 'coinbase') self.subsidy: SeriesTree_Mining_Rewards_Subsidy = SeriesTree_Mining_Rewards_Subsidy(client) self.fees: SeriesTree_Mining_Rewards_Fees = SeriesTree_Mining_Rewards_Fees(client) self.unclaimed: SeriesTree_Mining_Rewards_Unclaimed = SeriesTree_Mining_Rewards_Unclaimed(client) @@ -3719,12 +3729,12 @@ class SeriesTree_Cointime_Activity: """Series tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.coinblocks_created: BaseCumulativeSumPattern[StoredF64] = BaseCumulativeSumPattern(client, 'coinblocks_created') - self.coinblocks_stored: BaseCumulativeSumPattern[StoredF64] = BaseCumulativeSumPattern(client, 'coinblocks_stored') + self.coinblocks_created: AverageBaseCumulativeSumPattern[StoredF64] = AverageBaseCumulativeSumPattern(client, 'coinblocks_created') + self.coinblocks_stored: AverageBaseCumulativeSumPattern[StoredF64] = AverageBaseCumulativeSumPattern(client, 'coinblocks_stored') self.liveliness: SeriesPattern1[StoredF64] = SeriesPattern1(client, 'liveliness') self.vaultedness: SeriesPattern1[StoredF64] = SeriesPattern1(client, 'vaultedness') self.ratio: SeriesPattern1[StoredF64] = SeriesPattern1(client, 'activity_to_vaultedness') - self.coinblocks_destroyed: BaseCumulativeSumPattern[StoredF64] = BaseCumulativeSumPattern(client, 'coinblocks_destroyed') + self.coinblocks_destroyed: AverageBaseCumulativeSumPattern[StoredF64] = AverageBaseCumulativeSumPattern(client, 'coinblocks_destroyed') class SeriesTree_Cointime_Supply: """Series tree node.""" @@ -3737,10 +3747,10 @@ class SeriesTree_Cointime_Value: """Series tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.destroyed: BaseCumulativeSumPattern[StoredF64] = BaseCumulativeSumPattern(client, 'cointime_value_destroyed') - self.created: BaseCumulativeSumPattern[StoredF64] = BaseCumulativeSumPattern(client, 'cointime_value_created') - self.stored: BaseCumulativeSumPattern[StoredF64] = BaseCumulativeSumPattern(client, 'cointime_value_stored') - self.vocdd: BaseCumulativeSumPattern[StoredF64] = BaseCumulativeSumPattern(client, 'vocdd') + self.destroyed: AverageBaseCumulativeSumPattern[StoredF64] = AverageBaseCumulativeSumPattern(client, 'cointime_value_destroyed') + self.created: AverageBaseCumulativeSumPattern[StoredF64] = AverageBaseCumulativeSumPattern(client, 'cointime_value_created') + self.stored: AverageBaseCumulativeSumPattern[StoredF64] = AverageBaseCumulativeSumPattern(client, 'cointime_value_stored') + self.vocdd: AverageBaseCumulativeSumPattern[StoredF64] = AverageBaseCumulativeSumPattern(client, 'vocdd') class SeriesTree_Cointime_Cap: """Series tree node.""" @@ -4677,7 +4687,7 @@ 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.burned: BaseCumulativeSumPattern3 = BaseCumulativeSumPattern3(client, 'unspendable_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') @@ -4698,8 +4708,8 @@ class SeriesTree_Cohorts_Utxo_All_Activity: """Series tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.transfer_volume: BaseCumulativeInSumPattern = BaseCumulativeInSumPattern(client, 'transfer_volume') - self.coindays_destroyed: BaseCumulativeSumPattern[StoredF64] = BaseCumulativeSumPattern(client, 'coindays_destroyed') + self.transfer_volume: AverageBaseCumulativeInSumPattern = AverageBaseCumulativeInSumPattern(client, 'transfer_volume') + self.coindays_destroyed: AverageBaseCumulativeSumPattern[StoredF64] = AverageBaseCumulativeSumPattern(client, 'coindays_destroyed') self.coinyears_destroyed: SeriesPattern1[StoredF64] = SeriesPattern1(client, 'coinyears_destroyed') self.dormancy: _1m1w1y24hPattern[StoredF32] = _1m1w1y24hPattern(client, 'dormancy') @@ -4820,14 +4830,14 @@ class SeriesTree_Cohorts_Utxo_All_Realized_Sopr_Adjusted: def __init__(self, client: BrkClientBase, base_path: str = ''): self.ratio: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, 'asopr') - self.transfer_volume: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, 'adj_value_created') - self.value_destroyed: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, 'adj_value_destroyed') + self.transfer_volume: AverageBaseCumulativeSumPattern[Cents] = AverageBaseCumulativeSumPattern(client, 'adj_value_created') + self.value_destroyed: AverageBaseCumulativeSumPattern[Cents] = AverageBaseCumulativeSumPattern(client, 'adj_value_destroyed') class SeriesTree_Cohorts_Utxo_All_Realized_Sopr: """Series tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.value_destroyed: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, 'value_destroyed') + self.value_destroyed: AverageBaseCumulativeSumPattern[Cents] = AverageBaseCumulativeSumPattern(client, 'value_destroyed') self.ratio: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, 'sopr') self.adjusted: SeriesTree_Cohorts_Utxo_All_Realized_Sopr_Adjusted = SeriesTree_Cohorts_Utxo_All_Realized_Sopr_Adjusted(client) @@ -4842,7 +4852,7 @@ class SeriesTree_Cohorts_Utxo_All_Realized: self.mvrv: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'mvrv') 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: BaseCumulativeSumPattern4 = BaseCumulativeSumPattern4(client, 'realized_gross_pnl') + self.gross_pnl: BaseCumulativeSumPattern = BaseCumulativeSumPattern(client, 'realized_gross_pnl') self.sell_side_risk_ratio: _1m1w1y24hPattern6 = _1m1w1y24hPattern6(client, 'sell_side_risk_ratio') self.peak_regret: BaseCumulativeSumToPattern = BaseCumulativeSumToPattern(client, 'realized_peak_regret') self.investor: PricePattern = PricePattern(client, 'investor_price') @@ -4852,6 +4862,8 @@ class SeriesTree_Cohorts_Utxo_All_CostBasis: """Series tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): + self.in_profit: PerPattern = PerPattern(client, 'cost_basis_in_profit_per') + self.in_loss: PerPattern = PerPattern(client, 'cost_basis_in_loss_per') self.min: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'cost_basis_min') self.max: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'cost_basis_max') self.percentiles: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern = Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern(client, 'cost_basis') @@ -4903,6 +4915,8 @@ class SeriesTree_Cohorts_Utxo_All_Unrealized: self.net_pnl: SeriesTree_Cohorts_Utxo_All_Unrealized_NetPnl = SeriesTree_Cohorts_Utxo_All_Unrealized_NetPnl(client) self.gross_pnl: CentsUsdPattern2 = CentsUsdPattern2(client, 'unrealized_gross_pnl') self.invested_capital: InPattern = InPattern(client, 'invested_capital_in') + self.investor_cap_in_profit_raw: SeriesPattern18[CentsSquaredSats] = SeriesPattern18(client, 'investor_cap_in_profit_raw') + self.investor_cap_in_loss_raw: SeriesPattern18[CentsSquaredSats] = SeriesPattern18(client, 'investor_cap_in_loss_raw') self.sentiment: SeriesTree_Cohorts_Utxo_All_Unrealized_Sentiment = SeriesTree_Cohorts_Utxo_All_Unrealized_Sentiment(client) class SeriesTree_Cohorts_Utxo_All: @@ -4920,8 +4934,8 @@ class SeriesTree_Cohorts_Utxo_Sth_Activity: """Series tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.transfer_volume: BaseCumulativeInSumPattern = BaseCumulativeInSumPattern(client, 'sth_transfer_volume') - self.coindays_destroyed: BaseCumulativeSumPattern[StoredF64] = BaseCumulativeSumPattern(client, 'sth_coindays_destroyed') + self.transfer_volume: AverageBaseCumulativeInSumPattern = AverageBaseCumulativeInSumPattern(client, 'sth_transfer_volume') + self.coindays_destroyed: AverageBaseCumulativeSumPattern[StoredF64] = AverageBaseCumulativeSumPattern(client, 'sth_coindays_destroyed') self.coinyears_destroyed: SeriesPattern1[StoredF64] = SeriesPattern1(client, 'sth_coinyears_destroyed') self.dormancy: _1m1w1y24hPattern[StoredF32] = _1m1w1y24hPattern(client, 'sth_dormancy') @@ -5042,14 +5056,14 @@ class SeriesTree_Cohorts_Utxo_Sth_Realized_Sopr_Adjusted: def __init__(self, client: BrkClientBase, base_path: str = ''): self.ratio: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, 'sth_asopr') - self.transfer_volume: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, 'sth_adj_value_created') - self.value_destroyed: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, 'sth_adj_value_destroyed') + self.transfer_volume: AverageBaseCumulativeSumPattern[Cents] = AverageBaseCumulativeSumPattern(client, 'sth_adj_value_created') + self.value_destroyed: AverageBaseCumulativeSumPattern[Cents] = AverageBaseCumulativeSumPattern(client, 'sth_adj_value_destroyed') class SeriesTree_Cohorts_Utxo_Sth_Realized_Sopr: """Series tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.value_destroyed: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, 'sth_value_destroyed') + self.value_destroyed: AverageBaseCumulativeSumPattern[Cents] = AverageBaseCumulativeSumPattern(client, 'sth_value_destroyed') self.ratio: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, 'sth_sopr') self.adjusted: SeriesTree_Cohorts_Utxo_Sth_Realized_Sopr_Adjusted = SeriesTree_Cohorts_Utxo_Sth_Realized_Sopr_Adjusted(client) @@ -5064,7 +5078,7 @@ class SeriesTree_Cohorts_Utxo_Sth_Realized: self.mvrv: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'sth_mvrv') 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: BaseCumulativeSumPattern4 = BaseCumulativeSumPattern4(client, 'sth_realized_gross_pnl') + self.gross_pnl: BaseCumulativeSumPattern = BaseCumulativeSumPattern(client, 'sth_realized_gross_pnl') self.sell_side_risk_ratio: _1m1w1y24hPattern6 = _1m1w1y24hPattern6(client, 'sth_sell_side_risk_ratio') self.peak_regret: BaseCumulativeSumToPattern = BaseCumulativeSumToPattern(client, 'sth_realized_peak_regret') self.investor: PricePattern = PricePattern(client, 'sth_investor_price') @@ -5074,6 +5088,8 @@ class SeriesTree_Cohorts_Utxo_Sth_CostBasis: """Series tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): + self.in_profit: PerPattern = PerPattern(client, 'sth_cost_basis_in_profit_per') + self.in_loss: PerPattern = PerPattern(client, 'sth_cost_basis_in_loss_per') self.min: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'sth_cost_basis_min') self.max: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'sth_cost_basis_max') self.percentiles: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern = Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern(client, 'sth_cost_basis') @@ -5098,6 +5114,8 @@ class SeriesTree_Cohorts_Utxo_Sth_Unrealized: self.net_pnl: CentsToUsdPattern3 = CentsToUsdPattern3(client, 'sth_net_unrealized_pnl') self.gross_pnl: CentsUsdPattern2 = CentsUsdPattern2(client, 'sth_unrealized_gross_pnl') self.invested_capital: InPattern = InPattern(client, 'sth_invested_capital_in') + self.investor_cap_in_profit_raw: SeriesPattern18[CentsSquaredSats] = SeriesPattern18(client, 'sth_investor_cap_in_profit_raw') + self.investor_cap_in_loss_raw: SeriesPattern18[CentsSquaredSats] = SeriesPattern18(client, 'sth_investor_cap_in_loss_raw') self.sentiment: SeriesTree_Cohorts_Utxo_Sth_Unrealized_Sentiment = SeriesTree_Cohorts_Utxo_Sth_Unrealized_Sentiment(client) class SeriesTree_Cohorts_Utxo_Sth: @@ -5115,8 +5133,8 @@ class SeriesTree_Cohorts_Utxo_Lth_Activity: """Series tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.transfer_volume: BaseCumulativeInSumPattern = BaseCumulativeInSumPattern(client, 'lth_transfer_volume') - self.coindays_destroyed: BaseCumulativeSumPattern[StoredF64] = BaseCumulativeSumPattern(client, 'lth_coindays_destroyed') + self.transfer_volume: AverageBaseCumulativeInSumPattern = AverageBaseCumulativeInSumPattern(client, 'lth_transfer_volume') + self.coindays_destroyed: AverageBaseCumulativeSumPattern[StoredF64] = AverageBaseCumulativeSumPattern(client, 'lth_coindays_destroyed') self.coinyears_destroyed: SeriesPattern1[StoredF64] = SeriesPattern1(client, 'lth_coinyears_destroyed') self.dormancy: _1m1w1y24hPattern[StoredF32] = _1m1w1y24hPattern(client, 'lth_dormancy') @@ -5236,7 +5254,7 @@ class SeriesTree_Cohorts_Utxo_Lth_Realized_Sopr: """Series tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.value_destroyed: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, 'lth_value_destroyed') + self.value_destroyed: AverageBaseCumulativeSumPattern[Cents] = AverageBaseCumulativeSumPattern(client, 'lth_value_destroyed') self.ratio: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, 'lth_sopr') class SeriesTree_Cohorts_Utxo_Lth_Realized: @@ -5250,7 +5268,7 @@ class SeriesTree_Cohorts_Utxo_Lth_Realized: self.mvrv: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'lth_mvrv') 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: BaseCumulativeSumPattern4 = BaseCumulativeSumPattern4(client, 'lth_realized_gross_pnl') + self.gross_pnl: BaseCumulativeSumPattern = BaseCumulativeSumPattern(client, 'lth_realized_gross_pnl') self.sell_side_risk_ratio: _1m1w1y24hPattern6 = _1m1w1y24hPattern6(client, 'lth_sell_side_risk_ratio') self.peak_regret: BaseCumulativeSumToPattern = BaseCumulativeSumToPattern(client, 'lth_realized_peak_regret') self.investor: PricePattern = PricePattern(client, 'lth_investor_price') @@ -5260,6 +5278,8 @@ class SeriesTree_Cohorts_Utxo_Lth_CostBasis: """Series tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): + self.in_profit: PerPattern = PerPattern(client, 'lth_cost_basis_in_profit_per') + self.in_loss: PerPattern = PerPattern(client, 'lth_cost_basis_in_loss_per') self.min: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'lth_cost_basis_min') self.max: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'lth_cost_basis_max') self.percentiles: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern = Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern(client, 'lth_cost_basis') @@ -5284,6 +5304,8 @@ class SeriesTree_Cohorts_Utxo_Lth_Unrealized: self.net_pnl: CentsToUsdPattern3 = CentsToUsdPattern3(client, 'lth_net_unrealized_pnl') self.gross_pnl: CentsUsdPattern2 = CentsUsdPattern2(client, 'lth_unrealized_gross_pnl') self.invested_capital: InPattern = InPattern(client, 'lth_invested_capital_in') + self.investor_cap_in_profit_raw: SeriesPattern18[CentsSquaredSats] = SeriesPattern18(client, 'lth_investor_cap_in_profit_raw') + self.investor_cap_in_loss_raw: SeriesPattern18[CentsSquaredSats] = SeriesPattern18(client, 'lth_investor_cap_in_loss_raw') self.sentiment: SeriesTree_Cohorts_Utxo_Lth_Unrealized_Sentiment = SeriesTree_Cohorts_Utxo_Lth_Unrealized_Sentiment(client) class SeriesTree_Cohorts_Utxo_Lth: @@ -5549,27 +5571,27 @@ class SeriesTree_Cohorts_Utxo_Matured: """Series tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.under_1h: BaseCumulativeSumPattern3 = BaseCumulativeSumPattern3(client, 'utxos_under_1h_old_matured_supply') - self._1h_to_1d: BaseCumulativeSumPattern3 = BaseCumulativeSumPattern3(client, 'utxos_1h_to_1d_old_matured_supply') - self._1d_to_1w: BaseCumulativeSumPattern3 = BaseCumulativeSumPattern3(client, 'utxos_1d_to_1w_old_matured_supply') - self._1w_to_1m: BaseCumulativeSumPattern3 = BaseCumulativeSumPattern3(client, 'utxos_1w_to_1m_old_matured_supply') - self._1m_to_2m: BaseCumulativeSumPattern3 = BaseCumulativeSumPattern3(client, 'utxos_1m_to_2m_old_matured_supply') - self._2m_to_3m: BaseCumulativeSumPattern3 = BaseCumulativeSumPattern3(client, 'utxos_2m_to_3m_old_matured_supply') - self._3m_to_4m: BaseCumulativeSumPattern3 = BaseCumulativeSumPattern3(client, 'utxos_3m_to_4m_old_matured_supply') - self._4m_to_5m: BaseCumulativeSumPattern3 = BaseCumulativeSumPattern3(client, 'utxos_4m_to_5m_old_matured_supply') - self._5m_to_6m: BaseCumulativeSumPattern3 = BaseCumulativeSumPattern3(client, 'utxos_5m_to_6m_old_matured_supply') - self._6m_to_1y: BaseCumulativeSumPattern3 = BaseCumulativeSumPattern3(client, 'utxos_6m_to_1y_old_matured_supply') - self._1y_to_2y: BaseCumulativeSumPattern3 = BaseCumulativeSumPattern3(client, 'utxos_1y_to_2y_old_matured_supply') - self._2y_to_3y: BaseCumulativeSumPattern3 = BaseCumulativeSumPattern3(client, 'utxos_2y_to_3y_old_matured_supply') - self._3y_to_4y: BaseCumulativeSumPattern3 = BaseCumulativeSumPattern3(client, 'utxos_3y_to_4y_old_matured_supply') - self._4y_to_5y: BaseCumulativeSumPattern3 = BaseCumulativeSumPattern3(client, 'utxos_4y_to_5y_old_matured_supply') - self._5y_to_6y: BaseCumulativeSumPattern3 = BaseCumulativeSumPattern3(client, 'utxos_5y_to_6y_old_matured_supply') - self._6y_to_7y: BaseCumulativeSumPattern3 = BaseCumulativeSumPattern3(client, 'utxos_6y_to_7y_old_matured_supply') - self._7y_to_8y: BaseCumulativeSumPattern3 = BaseCumulativeSumPattern3(client, 'utxos_7y_to_8y_old_matured_supply') - self._8y_to_10y: BaseCumulativeSumPattern3 = BaseCumulativeSumPattern3(client, 'utxos_8y_to_10y_old_matured_supply') - self._10y_to_12y: BaseCumulativeSumPattern3 = BaseCumulativeSumPattern3(client, 'utxos_10y_to_12y_old_matured_supply') - self._12y_to_15y: BaseCumulativeSumPattern3 = BaseCumulativeSumPattern3(client, 'utxos_12y_to_15y_old_matured_supply') - self.over_15y: BaseCumulativeSumPattern3 = BaseCumulativeSumPattern3(client, 'utxos_over_15y_old_matured_supply') + self.under_1h: AverageBaseCumulativeSumPattern3 = AverageBaseCumulativeSumPattern3(client, 'utxos_under_1h_old_matured_supply') + self._1h_to_1d: AverageBaseCumulativeSumPattern3 = AverageBaseCumulativeSumPattern3(client, 'utxos_1h_to_1d_old_matured_supply') + self._1d_to_1w: AverageBaseCumulativeSumPattern3 = AverageBaseCumulativeSumPattern3(client, 'utxos_1d_to_1w_old_matured_supply') + self._1w_to_1m: AverageBaseCumulativeSumPattern3 = AverageBaseCumulativeSumPattern3(client, 'utxos_1w_to_1m_old_matured_supply') + self._1m_to_2m: AverageBaseCumulativeSumPattern3 = AverageBaseCumulativeSumPattern3(client, 'utxos_1m_to_2m_old_matured_supply') + self._2m_to_3m: AverageBaseCumulativeSumPattern3 = AverageBaseCumulativeSumPattern3(client, 'utxos_2m_to_3m_old_matured_supply') + self._3m_to_4m: AverageBaseCumulativeSumPattern3 = AverageBaseCumulativeSumPattern3(client, 'utxos_3m_to_4m_old_matured_supply') + self._4m_to_5m: AverageBaseCumulativeSumPattern3 = AverageBaseCumulativeSumPattern3(client, 'utxos_4m_to_5m_old_matured_supply') + self._5m_to_6m: AverageBaseCumulativeSumPattern3 = AverageBaseCumulativeSumPattern3(client, 'utxos_5m_to_6m_old_matured_supply') + self._6m_to_1y: AverageBaseCumulativeSumPattern3 = AverageBaseCumulativeSumPattern3(client, 'utxos_6m_to_1y_old_matured_supply') + self._1y_to_2y: AverageBaseCumulativeSumPattern3 = AverageBaseCumulativeSumPattern3(client, 'utxos_1y_to_2y_old_matured_supply') + self._2y_to_3y: AverageBaseCumulativeSumPattern3 = AverageBaseCumulativeSumPattern3(client, 'utxos_2y_to_3y_old_matured_supply') + self._3y_to_4y: AverageBaseCumulativeSumPattern3 = AverageBaseCumulativeSumPattern3(client, 'utxos_3y_to_4y_old_matured_supply') + self._4y_to_5y: AverageBaseCumulativeSumPattern3 = AverageBaseCumulativeSumPattern3(client, 'utxos_4y_to_5y_old_matured_supply') + self._5y_to_6y: AverageBaseCumulativeSumPattern3 = AverageBaseCumulativeSumPattern3(client, 'utxos_5y_to_6y_old_matured_supply') + self._6y_to_7y: AverageBaseCumulativeSumPattern3 = AverageBaseCumulativeSumPattern3(client, 'utxos_6y_to_7y_old_matured_supply') + self._7y_to_8y: AverageBaseCumulativeSumPattern3 = AverageBaseCumulativeSumPattern3(client, 'utxos_7y_to_8y_old_matured_supply') + self._8y_to_10y: AverageBaseCumulativeSumPattern3 = AverageBaseCumulativeSumPattern3(client, 'utxos_8y_to_10y_old_matured_supply') + self._10y_to_12y: AverageBaseCumulativeSumPattern3 = AverageBaseCumulativeSumPattern3(client, 'utxos_10y_to_12y_old_matured_supply') + self._12y_to_15y: AverageBaseCumulativeSumPattern3 = AverageBaseCumulativeSumPattern3(client, 'utxos_12y_to_15y_old_matured_supply') + self.over_15y: AverageBaseCumulativeSumPattern3 = AverageBaseCumulativeSumPattern3(client, 'utxos_over_15y_old_matured_supply') class SeriesTree_Cohorts_Utxo: """Series tree node.""" diff --git a/website/scripts/options/cointime.js b/website/scripts/options/cointime.js index e97ece715..c45d9bfda 100644 --- a/website/scripts/options/cointime.js +++ b/website/scripts/options/cointime.js @@ -284,6 +284,7 @@ export function createCointimeSection() { name, color, base: pattern.base, + average: pattern.average, rolling: pattern.sum, cumulative: pattern.cumulative, })), @@ -335,6 +336,7 @@ export function createCointimeSection() { name, color, base: pattern.base, + average: pattern.average, rolling: pattern.sum, cumulative: pattern.cumulative, })), @@ -342,6 +344,7 @@ export function createCointimeSection() { name: vocdd.name, color: vocdd.color, base: vocdd.pattern.base, + average: vocdd.pattern.average, rolling: vocdd.pattern.sum, cumulative: vocdd.pattern.cumulative, }, diff --git a/website/scripts/options/distribution/cost-basis.js b/website/scripts/options/distribution/cost-basis.js index ac575223a..71434eb27 100644 --- a/website/scripts/options/distribution/cost-basis.js +++ b/website/scripts/options/distribution/cost-basis.js @@ -2,18 +2,16 @@ * Cost Basis section builders * * Structure: - * - Summary: Key stats (avg + median active, quartiles/extremes available) - * - By Coin: BTC-weighted percentiles (IQR active: p25, p50, p75) - * - By Capital: USD-weighted percentiles (IQR active: p25, p50, p75) - * - Supply Density: Cost basis supply density percentage + * - Per Coin: sats-weighted (profitability + distribution) + * - Per Dollar: value-weighted (profitability + distribution) + * - Profitability: cross-cutting (per coin + per dollar on same chart) + * - Supply Density: cost basis supply density percentage * * Only for cohorts WITH costBasis (All, STH, LTH) */ import { colors } from "../../utils/colors.js"; import { entries } from "../../utils/array.js"; -import { Unit } from "../../utils/units.js"; -import { priceLines } from "../constants.js"; import { price, percentRatio } from "../series.js"; import { mapCohortsWithAll, flatMapCohortsWithAll } from "../shared.js"; @@ -24,7 +22,7 @@ const ACTIVE_PCTS = new Set(["pct75", "pct50", "pct25"]); * @param {(name: string) => string} [n] * @returns {FetchedPriceSeriesBlueprint[]} */ -function createCorePercentileSeries(p, n = (x) => x) { +function percentileSeries(p, n = (x) => x) { return entries(p) .reverse() .map(([key, s], i, arr) => @@ -37,104 +35,46 @@ function createCorePercentileSeries(p, n = (x) => x) { ); } -/** - * @param {CohortAll | CohortFull | CohortLongTerm} cohort - * @returns {FetchedPriceSeriesBlueprint[]} - */ -function createSingleSummarySeries(cohort) { - const { color, tree } = cohort; - const p = tree.costBasis.percentiles; - return [ - price({ series: tree.realized.price, name: "Average", color }), - price({ - series: tree.costBasis.max, - name: "Max (p100)", - color: colors.stat.max, - defaultActive: false, - }), - price({ - series: p.pct75, - name: "Q3 (p75)", - color: colors.stat.pct75, - defaultActive: false, - }), - price({ series: p.pct50, name: "Median (p50)", color: colors.stat.median }), - price({ - series: p.pct25, - name: "Q1 (p25)", - color: colors.stat.pct25, - defaultActive: false, - }), - price({ - series: tree.costBasis.min, - name: "Min (p0)", - color: colors.stat.min, - defaultActive: false, - }), - ]; -} +// ============================================================================ +// Single cohort helpers +// ============================================================================ /** - * @param {readonly (CohortAll | CohortFull | CohortLongTerm)[]} list - * @param {CohortAll} all - * @returns {FetchedPriceSeriesBlueprint[]} + * Per Coin or Per Dollar folder for a single cohort + * @param {Object} args + * @param {AnyPricePattern} args.avgPrice - realized price (per coin) or investor price (per dollar) + * @param {string} args.avgName + * @param {AnyPricePattern} args.inProfit + * @param {AnyPricePattern} args.inLoss + * @param {PercentilesPattern} args.percentiles + * @param {Color} args.color + * @param {string} args.weightLabel + * @param {(name: string) => string} args.title + * @param {AnyPricePattern} [args.min] + * @param {AnyPricePattern} [args.max] + * @returns {PartialOptionsTree} */ -function createGroupedSummarySeries(list, all) { - return mapCohortsWithAll(list, all, ({ name, color, tree }) => - price({ series: tree.realized.price, name, color }), - ); -} - -/** - * @param {CohortAll | CohortFull | CohortLongTerm} cohort - * @returns {FetchedPriceSeriesBlueprint[]} - */ -function createSingleByCoinSeries(cohort) { - const { color, tree } = cohort; - const cb = tree.costBasis; +function singleWeightFolder({ avgPrice, avgName, inProfit, inLoss, percentiles, color, weightLabel, title, min, max }) { return [ - price({ series: tree.realized.price, name: "Average", color }), - price({ - series: cb.max, - name: "p100", - color: colors.stat.max, - defaultActive: false, - }), - ...createCorePercentileSeries(cb.percentiles), - price({ - series: cb.min, - name: "p0", - color: colors.stat.min, - defaultActive: false, - }), - ]; -} - -/** - * @param {CohortAll | CohortFull | CohortLongTerm} cohort - * @returns {FetchedPriceSeriesBlueprint[]} - */ -function createSingleByCapitalSeries(cohort) { - const { color, tree } = cohort; - return [ - price({ series: tree.realized.investor.price, name: "Average", color }), - ...createCorePercentileSeries(tree.costBasis.investedCapital), - ]; -} - -/** - * @param {CohortAll | CohortFull | CohortLongTerm} cohort - * @returns {AnyFetchedSeriesBlueprint[]} - */ -function createSingleSupplyDensitySeries(cohort) { - const { tree } = cohort; - return [ - ...percentRatio({ - pattern: tree.costBasis.supplyDensity, - name: "Supply Density", - color: colors.bitcoin, - }), - ...priceLines({ numbers: [100, 50, 0], unit: Unit.percentage }), + { + name: "Profitability", + title: title(`Cost Basis Profitability (${weightLabel})`), + top: [ + price({ series: inProfit, name: "In Profit", color: colors.profit }), + price({ series: avgPrice, name: avgName, color }), + price({ series: inLoss, name: "In Loss", color: colors.loss }), + ], + }, + { + name: "Distribution", + title: title(`Cost Basis Distribution (${weightLabel})`), + top: [ + price({ series: avgPrice, name: avgName, color }), + ...(max ? [price({ series: max, name: "p100", color: colors.stat.max, defaultActive: false })] : []), + ...percentileSeries(percentiles), + ...(min ? [price({ series: min, name: "p0", color: colors.stat.min, defaultActive: false })] : []), + ], + }, ]; } @@ -143,125 +83,171 @@ function createSingleSupplyDensitySeries(cohort) { * @returns {PartialOptionsGroup} */ export function createCostBasisSectionWithPercentiles({ cohort, title }) { + const { tree, color } = cohort; + const cb = tree.costBasis; return { name: "Cost Basis", tree: [ { - name: "Summary", - title: title("Cost Basis Summary"), - top: createSingleSummarySeries(cohort), + name: "Per Coin", + tree: singleWeightFolder({ + avgPrice: tree.realized.price, avgName: "Average", + inProfit: cb.inProfit.perCoin, inLoss: cb.inLoss.perCoin, + percentiles: cb.percentiles, color, weightLabel: "BTC-weighted", title, + min: cb.min, max: cb.max, + }), }, { - name: "By Coin", - title: title("Cost Basis Distribution (BTC-weighted)"), - top: createSingleByCoinSeries(cohort), + name: "Per Dollar", + tree: singleWeightFolder({ + avgPrice: tree.realized.investor.price, avgName: "Average", + inProfit: cb.inProfit.perDollar, inLoss: cb.inLoss.perDollar, + percentiles: cb.investedCapital, color, weightLabel: "USD-weighted", title, + }), }, { - name: "By Capital", - title: title("Cost Basis Distribution (USD-weighted)"), - top: createSingleByCapitalSeries(cohort), + name: "Profitability", + tree: [ + { + name: "In Profit", + title: title("Cost Basis In Profit"), + top: [ + price({ series: cb.inProfit.perCoin, name: "Per Coin", color: colors.realized }), + price({ series: cb.inProfit.perDollar, name: "Per Dollar", color: colors.investor }), + ], + }, + { + name: "In Loss", + title: title("Cost Basis In Loss"), + top: [ + price({ series: cb.inLoss.perCoin, name: "Per Coin", color: colors.realized }), + price({ series: cb.inLoss.perDollar, name: "Per Dollar", color: colors.investor }), + ], + }, + ], }, { name: "Supply Density", title: title("Cost Basis Supply Density"), - bottom: createSingleSupplyDensitySeries(cohort), + bottom: percentRatio({ pattern: cb.supplyDensity, name: "Supply Density", color: colors.bitcoin }), }, ], }; } +// ============================================================================ +// Grouped cohort helpers +// ============================================================================ + +/** + * Per Coin or Per Dollar folder for grouped cohorts + * @param {Object} args + * @param {readonly (CohortAll | CohortFull | CohortLongTerm)[]} args.list + * @param {CohortAll} args.all + * @param {(c: CohortAll | CohortFull | CohortLongTerm) => AnyPricePattern} args.getAvgPrice + * @param {(c: CohortAll | CohortFull | CohortLongTerm) => AnyPricePattern} args.getInProfit + * @param {(c: CohortAll | CohortFull | CohortLongTerm) => AnyPricePattern} args.getInLoss + * @param {(c: CohortAll | CohortFull | CohortLongTerm) => PercentilesPattern} args.getPercentiles + * @param {string} args.avgTitle + * @param {string} args.weightLabel + * @param {(name: string) => string} args.title + * @returns {PartialOptionsTree} + */ +function groupedWeightFolder({ list, all, getAvgPrice, getInProfit, getInLoss, getPercentiles, avgTitle, weightLabel, title }) { + return [ + { + name: "Profitability", + tree: [ + { + name: "In Profit", + title: title(`Cost Basis In Profit (${weightLabel})`), + top: mapCohortsWithAll(list, all, (c) => + price({ series: getInProfit(c), name: c.name, color: c.color }), + ), + }, + { + name: "In Loss", + title: title(`Cost Basis In Loss (${weightLabel})`), + top: mapCohortsWithAll(list, all, (c) => + price({ series: getInLoss(c), name: c.name, color: c.color }), + ), + }, + ], + }, + { + name: "Distribution", + tree: [ + { + name: "Average", + title: title(`${avgTitle} Comparison`), + top: mapCohortsWithAll(list, all, (c) => + price({ series: getAvgPrice(c), name: c.name, color: c.color }), + ), + }, + ...(/** @type {const} */ ([ + ["pct50", "Median"], + ["pct75", "Q3"], + ["pct25", "Q1"], + ])).map(([pct, label]) => ({ + name: label, + title: title(`Cost Basis ${label} (${weightLabel})`), + top: mapCohortsWithAll(list, all, (c) => + price({ series: getPercentiles(c)[pct], name: c.name, color: c.color }), + ), + })), + ], + }, + ]; +} + /** * @param {{ list: readonly (CohortAll | CohortFull | CohortLongTerm)[], all: CohortAll, title: (name: string) => string }} args * @returns {PartialOptionsGroup} */ -export function createGroupedCostBasisSectionWithPercentiles({ - list, - all, - title, -}) { +export function createGroupedCostBasisSectionWithPercentiles({ list, all, title }) { return { name: "Cost Basis", tree: [ { - name: "Summary", - title: title("Cost Basis Summary"), - top: createGroupedSummarySeries(list, all), + name: "Per Coin", + tree: groupedWeightFolder({ + list, all, title, + getAvgPrice: (c) => c.tree.realized.price, + getInProfit: (c) => c.tree.costBasis.inProfit.perCoin, + getInLoss: (c) => c.tree.costBasis.inLoss.perCoin, + getPercentiles: (c) => c.tree.costBasis.percentiles, + avgTitle: "Average", weightLabel: "BTC-weighted", + }), }, { - name: "By Coin", - tree: [ - { - name: "Average", - title: title("Realized Price Comparison"), - top: mapCohortsWithAll(list, all, ({ name, color, tree }) => - price({ series: tree.realized.price, name, color }), - ), - }, - { - name: "Median", - title: title("Cost Basis Median (BTC-weighted)"), - top: mapCohortsWithAll(list, all, ({ name, color, tree }) => - price({ series: tree.costBasis.percentiles.pct50, name, color }), - ), - }, - { - name: "Q3", - title: title("Cost Basis Q3 (BTC-weighted)"), - top: mapCohortsWithAll(list, all, ({ name, color, tree }) => - price({ series: tree.costBasis.percentiles.pct75, name, color }), - ), - }, - { - name: "Q1", - title: title("Cost Basis Q1 (BTC-weighted)"), - top: mapCohortsWithAll(list, all, ({ name, color, tree }) => - price({ series: tree.costBasis.percentiles.pct25, name, color }), - ), - }, - ], + name: "Per Dollar", + tree: groupedWeightFolder({ + list, all, title, + getAvgPrice: (c) => c.tree.realized.investor.price, + getInProfit: (c) => c.tree.costBasis.inProfit.perDollar, + getInLoss: (c) => c.tree.costBasis.inLoss.perDollar, + getPercentiles: (c) => c.tree.costBasis.investedCapital, + avgTitle: "Average", weightLabel: "USD-weighted", + }), }, { - name: "By Capital", + name: "Profitability", tree: [ { - name: "Average", - title: title("Investor Price Comparison"), - top: mapCohortsWithAll(list, all, ({ name, color, tree }) => - price({ series: tree.realized.investor.price, name, color }), - ), + name: "In Profit", + title: title("Cost Basis In Profit"), + top: flatMapCohortsWithAll(list, all, ({ name, color, tree }) => [ + price({ series: tree.costBasis.inProfit.perCoin, name: `${name} (coin)`, color }), + price({ series: tree.costBasis.inProfit.perDollar, name: `${name} (dollar)`, color }), + ]), }, { - name: "Median", - title: title("Cost Basis Median (USD-weighted)"), - top: mapCohortsWithAll(list, all, ({ name, color, tree }) => - price({ - series: tree.costBasis.investedCapital.pct50, - name, - color, - }), - ), - }, - { - name: "Q3", - title: title("Cost Basis Q3 (USD-weighted)"), - top: mapCohortsWithAll(list, all, ({ name, color, tree }) => - price({ - series: tree.costBasis.investedCapital.pct75, - name, - color, - }), - ), - }, - { - name: "Q1", - title: title("Cost Basis Q1 (USD-weighted)"), - top: mapCohortsWithAll(list, all, ({ name, color, tree }) => - price({ - series: tree.costBasis.investedCapital.pct25, - name, - color, - }), - ), + name: "In Loss", + title: title("Cost Basis In Loss"), + top: flatMapCohortsWithAll(list, all, ({ name, color, tree }) => [ + price({ series: tree.costBasis.inLoss.perCoin, name: `${name} (coin)`, color }), + price({ series: tree.costBasis.inLoss.perDollar, name: `${name} (dollar)`, color }), + ]), }, ], }, @@ -269,11 +255,7 @@ export function createGroupedCostBasisSectionWithPercentiles({ name: "Supply Density", title: title("Cost Basis Supply Density"), bottom: flatMapCohortsWithAll(list, all, ({ name, color, tree }) => - percentRatio({ - pattern: tree.costBasis.supplyDensity, - name, - color, - }), + percentRatio({ pattern: tree.costBasis.supplyDensity, name, color }), ), }, ], diff --git a/website/scripts/options/network.js b/website/scripts/options/network.js index 310ecff15..0ff84e227 100644 --- a/website/scripts/options/network.js +++ b/website/scripts/options/network.js @@ -510,6 +510,7 @@ export function createNetworkSection() { name: "Created", color: colors.entity.output, base: outputs.count.total.sum, + average: outputs.count.total.rolling.average, rolling: outputs.count.total.rolling.sum, cumulative: outputs.count.total.cumulative, }, @@ -517,6 +518,7 @@ export function createNetworkSection() { name: "Spent", color: colors.entity.input, base: inputs.count.sum, + average: inputs.count.rolling.average, rolling: inputs.count.rolling.sum, cumulative: inputs.count.cumulative, }, diff --git a/website/scripts/options/series.js b/website/scripts/options/series.js index 3132687e7..67c7bba1f 100644 --- a/website/scripts/options/series.js +++ b/website/scripts/options/series.js @@ -84,12 +84,13 @@ export function price({ /** * Create percentile series (max/min/median/pct75/pct25/pct90/pct10) from any stats pattern - * @param {DistributionStats} pattern - * @param {Unit} unit - * @param {string} title + * @param {Object} args + * @param {DistributionStats} args.pattern + * @param {Unit} args.unit + * @param {string} [args.title] * @returns {AnyFetchedSeriesBlueprint[]} */ -function percentileSeries(pattern, unit, title) { +function percentileSeries({ pattern, unit, title = "" }) { const { stat } = colors; return [ dots({ @@ -418,9 +419,7 @@ export function fromBaseStatsPattern({ unit, title = "", baseColor, - avgActive = true, }) { - const { stat } = colors; const stats = statsAtWindow(pattern, window); return [ dots({ @@ -429,46 +428,17 @@ export function fromBaseStatsPattern({ color: baseColor, unit, }), - dots({ - series: stats.average, - name: `${title} avg`.trim(), - color: stat.avg, - unit, - defaultActive: avgActive, - }), - ...percentileSeries(stats, unit, title), + ...percentileSeries({ pattern: stats, unit, title }), ]; } /** - * Create series from a flat stats pattern (average + pct percentiles as single series) - * Use statsAtWindow() to extract from patterns with _1y24h30d7dPattern stats - * @param {Object} args - * @param {{ average: AnySeriesPattern, median: AnySeriesPattern, max: AnySeriesPattern, min: AnySeriesPattern, pct75: AnySeriesPattern, pct25: AnySeriesPattern, pct90: AnySeriesPattern, pct10: AnySeriesPattern }} args.pattern - * @param {Unit} args.unit - * @param {string} [args.title] - * @returns {AnyFetchedSeriesBlueprint[]} - */ -export function fromStatsPattern({ pattern, unit, title = "" }) { - return [ - { - type: "Dots", - series: pattern.average, - title: `${title} avg`.trim(), - unit, - }, - ...percentileSeries(pattern, unit, title), - ]; -} - -/** - * Extract stats at a specific rolling window from patterns with _1y24h30d7dPattern stats - * @param {Record} pattern - Pattern with pct10/pct25/pct75/pct90 and average/median/max/min as _1y24h30d7dPattern + * Extract stats at a specific rolling window + * @param {Record} pattern - Pattern with pct10/pct25/pct75/pct90 and median/max/min as _1y24h30d7dPattern * @param {string} window */ export function statsAtWindow(pattern, window) { return { - average: pattern.average[window], median: pattern.median[window], max: pattern.max[window], min: pattern.min[window], @@ -601,10 +571,10 @@ export function distributionWindowsTree({ pattern, base, title, unit }) { tree: [ { name: "Compare", - title: `${title} Average`, + title: `${title} Median`, bottom: ROLLING_WINDOWS.map((w) => line({ - series: pattern.average[w.key], + series: pattern.median[w.key], name: w.name, color: w.color, unit, @@ -616,10 +586,7 @@ export function distributionWindowsTree({ pattern, base, title, unit }) { title: `${title} Distribution (${w.title})`, bottom: [ ...(base ? [line({ series: base, name: "base", unit })] : []), - ...fromStatsPattern({ - pattern: statsAtWindow(pattern, w.key), - unit, - }), + ...percentileSeries({ pattern: statsAtWindow(pattern, w.key), unit }), ], })), ], @@ -628,12 +595,11 @@ export function distributionWindowsTree({ pattern, base, title, unit }) { /** * Map a rolling window slot's stats to a specific unit, producing a stats-compatible pattern - * @param {{ average: Record, median: Record, max: Record, min: Record, pct75: Record, pct25: Record, pct90: Record, pct10: Record }} slot - Rolling window slot with multi-currency stats + * @param {{ median: Record, max: Record, min: Record, pct75: Record, pct25: Record, pct90: Record, pct10: Record }} slot - Rolling window slot with multi-currency stats * @param {BtcSatsUsdKey} unitKey */ function rollingSlotForUnit(slot, unitKey) { return { - average: slot.average[unitKey], median: slot.median[unitKey], max: slot.max[unitKey], min: slot.min[unitKey], @@ -646,19 +612,19 @@ function rollingSlotForUnit(slot, unitKey) { /** * Create distribution series for btc/sats/usd from a rolling window slot - * @param {{ average: Record, median: Record, max: Record, min: Record, pct75: Record, pct25: Record, pct90: Record, pct10: Record }} slot - Rolling window slot with multi-currency stats + * @param {{ median: Record, max: Record, min: Record, pct75: Record, pct25: Record, pct90: Record, pct10: Record }} slot - Rolling window slot with multi-currency stats * @returns {AnyFetchedSeriesBlueprint[]} */ export const distributionBtcSatsUsd = (slot) => [ - ...fromStatsPattern({ + ...percentileSeries({ pattern: rollingSlotForUnit(slot, "btc"), unit: Unit.btc, }), - ...fromStatsPattern({ + ...percentileSeries({ pattern: rollingSlotForUnit(slot, "sats"), unit: Unit.sats, }), - ...fromStatsPattern({ + ...percentileSeries({ pattern: rollingSlotForUnit(slot, "usd"), unit: Unit.usd, }), @@ -907,11 +873,7 @@ export function chartsFromFull({ ? `${title} ${distributionSuffix}` : title; return [ - { - name: "Per Block", - title, - bottom: [{ series: pattern.base, title: "base", unit }], - }, + averagesTree({ windows: pattern.average, title, unit }), sumsTree({ windows: pattern.sum, title, unit }), distributionWindowsTree({ pattern, title: distTitle, unit }), { @@ -948,16 +910,11 @@ export function chartsFromAggregated({ unit, distributionSuffix = "", }) { - const { stat } = colors; const distTitle = distributionSuffix ? `${title} ${distributionSuffix}` : title; return [ - { - name: "Per Block", - title, - bottom: [{ series: pattern.sum, title: "base", color: stat.sum, unit }], - }, + averagesTree({ windows: pattern.rolling.average, title, unit }), sumsTree({ windows: pattern.rolling.sum, title, unit }), distributionWindowsTree({ pattern: pattern.rolling, @@ -996,12 +953,12 @@ export function chartsFromBlockAnd6b({ pattern, title, unit }) { { name: "Block", title: `${title} (Block)`, - bottom: fromStatsPattern({ pattern: pattern.block, unit }), + bottom: percentileSeries({ pattern: pattern.block, unit }), }, { name: "Hourly", title: `${title} (Hourly)`, - bottom: fromStatsPattern({ pattern: pattern._6b, unit }), + bottom: percentileSeries({ pattern: pattern._6b, unit }), }, ]; } @@ -1037,11 +994,7 @@ export function chartsFromSumsCumulative({ pattern, title, unit, color }) { */ export function chartsFromCount({ pattern, title, unit, color }) { return [ - { - name: "Per Block", - title, - bottom: [{ series: pattern.base, title: "base", color, unit }], - }, + averagesTree({ windows: pattern.average, title, unit }), ...chartsFromSumsCumulative({ pattern, title, unit, color }), ]; } @@ -1060,6 +1013,7 @@ export function chartsFromCountEntries({ entries, title, unit }) { name, color: colors.at(i, arr.length), base: data.base, + average: data.average, rolling: data.sum, cumulative: data.cumulative, })), @@ -1071,7 +1025,7 @@ export function chartsFromCountEntries({ entries, title, unit }) { /** * Per Block + Sums + Cumulative tree for multiple named series shown side-by-side * @param {Object} args - * @param {Array<{ name: string, color: Color, base: AnySeriesPattern, rolling: { _24h: AnySeriesPattern, _1w: AnySeriesPattern, _1m: AnySeriesPattern, _1y: AnySeriesPattern }, cumulative: AnySeriesPattern }>} args.entries + * @param {Array<{ name: string, color: Color, base: AnySeriesPattern, average: { _24h: AnySeriesPattern, _1w: AnySeriesPattern, _1m: AnySeriesPattern, _1y: AnySeriesPattern }, rolling: { _24h: AnySeriesPattern, _1w: AnySeriesPattern, _1m: AnySeriesPattern, _1y: AnySeriesPattern }, cumulative: AnySeriesPattern }>} args.entries * @param {string} args.title * @param {Unit} args.unit * @returns {PartialOptionsTree} @@ -1079,10 +1033,17 @@ export function chartsFromCountEntries({ entries, title, unit }) { export function multiSeriesTree({ entries, title, unit }) { return [ { - name: "Per Block", - title, - bottom: entries.map((e) => - line({ series: e.base, name: e.name, color: e.color, unit }), + name: "Compare", + title: `${title} Average`, + bottom: ROLLING_WINDOWS.flatMap((w) => + entries.map((e) => + line({ + series: e.average[w.key], + name: `${e.name} ${w.name}`, + color: e.color, + unit, + }), + ), ), }, ...ROLLING_WINDOWS.map((w) => ({ diff --git a/website/scripts/options/shared.js b/website/scripts/options/shared.js index 171b2fe34..7872f2ef1 100644 --- a/website/scripts/options/shared.js +++ b/website/scripts/options/shared.js @@ -224,21 +224,35 @@ export function satsBtcUsdRolling({ pattern, name, color, defaultActive }) { * @param {Color} [args.color] * @returns {PartialOptionsTree} */ -export function satsBtcUsdFullTree({ pattern, name, title, color }) { +export function satsBtcUsdFullTree({ pattern, title, color }) { return [ { - name: "Per Block", - title, - bottom: satsBtcUsd({ pattern: pattern.base, name, color }), + 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} Sum`, - bottom: satsBtcUsd({ - pattern: pattern.sum[w.key], - name: w.name, - color: w.color, - }), + 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", diff --git a/website/scripts/types.js b/website/scripts/types.js index f9cb1c255..9801cb117 100644 --- a/website/scripts/types.js +++ b/website/scripts/types.js @@ -58,10 +58,10 @@ * @typedef {Brk.BpsCentsPercentilesRatioSatsUsdPattern} PriceRatioPercentilesPattern * AnyRatioPattern: full ratio pattern with percentiles, SMAs, and std dev bands * @typedef {Brk.BpsCentsPercentilesRatioSatsSmaStdUsdPattern} AnyRatioPattern - * FullValuePattern: base + cumulative + rolling windows (sats/btc/cents/usd) - * @typedef {Brk.BaseCumulativeSumPattern3} FullValuePattern - * RollingWindowSlot: a single rolling window with stats (average, pct10, pct25, median, pct75, pct90, max, min) per unit - * @typedef {Brk.AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern} RollingWindowSlot + * FullValuePattern: base + cumulative + sum + average rolling windows (sats/btc/cents/usd) + * @typedef {Brk.AverageBaseCumulativeSumPattern3} FullValuePattern + * RollingWindowSlot: a single rolling window with stats (pct10, pct25, median, pct75, pct90, max, min) per unit + * @typedef {Brk.MaxMedianMinPct10Pct25Pct75Pct90Pattern} RollingWindowSlot * @typedef {Brk.AnySeriesPattern} AnySeriesPattern * @typedef {Brk.CentsSatsUsdPattern} ActivePricePattern * @typedef {Brk.AnySeriesEndpoint} AnySeriesEndpoint @@ -73,9 +73,9 @@ * - FullRelativePattern: has BOTH RelToMarketCap AND RelToOwnMarketCap * @typedef {Brk.LossNetNuplProfitPattern} BasicRelativePattern * @typedef {Brk.LossNetNuplProfitPattern} GlobalRelativePattern - * @typedef {Brk.GrossInvestedLossNetNuplProfitSentimentPattern2} OwnRelativePattern - * @typedef {Brk.GrossInvestedLossNetNuplProfitSentimentPattern2} FullRelativePattern - * @typedef {Brk.GrossInvestedLossNetNuplProfitSentimentPattern2} UnrealizedPattern + * @typedef {Brk.GrossInvestedInvestorLossNetNuplProfitSentimentPattern2} OwnRelativePattern + * @typedef {Brk.GrossInvestedInvestorLossNetNuplProfitSentimentPattern2} FullRelativePattern + * @typedef {Brk.GrossInvestedInvestorLossNetNuplProfitSentimentPattern2} UnrealizedPattern * * Profitability bucket pattern (supply + realized_cap + nupl) * @typedef {Brk.NuplRealizedSupplyPattern} RealizedSupplyPattern @@ -87,10 +87,10 @@ * @typedef {Brk.CapGrossInvestorLossMvrvNetPeakPriceProfitSellSoprPattern} RealizedPattern4 * * Transfer volume pattern (base + cumulative + inProfit/inLoss + sum windows) - * @typedef {Brk.BaseCumulativeInSumPattern} TransferVolumePattern + * @typedef {Brk.AverageBaseCumulativeInSumPattern} TransferVolumePattern * * Realized profit/loss pattern (base + cumulative + sum windows, cents/usd) - * @typedef {Brk.BaseCumulativeSumPattern4} RealizedProfitLossPattern + * @typedef {Brk.BaseCumulativeSumPattern} RealizedProfitLossPattern * * Full activity pattern (coindays, coinyears, dormancy, transfer volume) * @typedef {Brk.CoindaysCoinyearsDormancyTransferPattern} FullActivityPattern @@ -136,11 +136,11 @@ */ /** * Stats pattern: average, min, max, percentiles (height-only indexes, NO base) - * @typedef {Brk.AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern} StatsPattern + * @typedef {Brk.MaxMedianMinPct10Pct25Pct75Pct90Pattern} StatsPattern */ /** * Base stats pattern: average, min, max, percentiles - * @typedef {Brk.AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern} BaseStatsPattern + * @typedef {Brk.MaxMedianMinPct10Pct25Pct75Pct90Pattern} BaseStatsPattern */ /** * Full stats pattern: cumulative, sum, average, min, max, percentiles + rolling @@ -161,7 +161,7 @@ /** * Count pattern: height, cumulative, and rolling sum windows * @template T - * @typedef {Brk.BaseCumulativeSumPattern} CountPattern + * @typedef {Brk.AverageBaseCumulativeSumPattern} CountPattern */ /** * Full per-block pattern: height, cumulative, sum, and distribution stats (all flat) @@ -172,8 +172,8 @@ * @typedef {FullStatsPattern | BtcFullStatsPattern} AnyStatsPattern */ /** - * Distribution stats: 8 series fields (average, min, max, median, pct10/25/75/90) - * @typedef {{ average: AnySeriesPattern, min: AnySeriesPattern, max: AnySeriesPattern, median: AnySeriesPattern, pct10: AnySeriesPattern, pct25: AnySeriesPattern, pct75: AnySeriesPattern, pct90: AnySeriesPattern }} DistributionStats + * Distribution stats: min, max, median, pct10/25/75/90 + * @typedef {{ min: AnySeriesPattern, max: AnySeriesPattern, median: AnySeriesPattern, pct10: AnySeriesPattern, pct25: AnySeriesPattern, pct75: AnySeriesPattern, pct90: AnySeriesPattern }} DistributionStats */ /**