From a0efe491e5348fd057d918828f6b45c91e563044 Mon Sep 17 00:00:00 2001 From: nym21 Date: Sat, 7 Mar 2026 21:24:04 +0100 Subject: [PATCH] global: snapshot --- crates/brk_client/src/lib.rs | 242 ++++++++-------- .../src/distribution/metrics/cohort/core.rs | 2 +- .../distribution/metrics/cohort/minimal.rs | 2 +- .../src/distribution/metrics/mod.rs | 2 +- .../src/distribution/metrics/realized/base.rs | 24 +- .../src/distribution/metrics/realized/core.rs | 3 +- .../src/distribution/metrics/realized/full.rs | 89 ++++-- .../distribution/metrics/realized/minimal.rs | 24 +- .../src/distribution/metrics/realized/mod.rs | 12 +- .../src/internal/containers/windows.rs | 4 + modules/brk-client/index.js | 264 ++++++++---------- packages/brk_client/brk_client/__init__.py | 121 ++++---- 12 files changed, 420 insertions(+), 369 deletions(-) diff --git a/crates/brk_client/src/lib.rs b/crates/brk_client/src/lib.rs index 76519ebd6..0c7fa5259 100644 --- a/crates/brk_client/src/lib.rs +++ b/crates/brk_client/src/lib.rs @@ -950,7 +950,9 @@ pub struct CapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSell pub investor_price_ratio: BpsRatioPattern, pub investor_price_ratio_percentiles: RatioPattern, pub loss_value_created: MetricPattern1, + pub loss_value_created_sum: _1m1w1y24hPattern, pub loss_value_destroyed: MetricPattern1, + pub loss_value_destroyed_sum: _1m1w1y24hPattern, pub lower_price_band: CentsSatsUsdPattern, pub mvrv: MetricPattern1, pub neg_realized_loss: MetricPattern1, @@ -958,38 +960,39 @@ pub struct CapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSell pub net_pnl_change_1m_rel_to_market_cap: BpsPercentRatioPattern, pub net_pnl_change_1m_rel_to_realized_cap: BpsPercentRatioPattern, pub net_realized_pnl: CumulativeHeightPattern, - pub net_realized_pnl_ema_1w: MetricPattern1, pub net_realized_pnl_rel_to_realized_cap: BpsPercentRatioPattern, pub peak_regret: CumulativeHeightPattern, pub peak_regret_rel_to_realized_cap: BpsPercentRatioPattern, pub profit_flow: MetricPattern1, pub profit_value_created: MetricPattern1, + pub profit_value_created_sum: _1m1w1y24hPattern, pub profit_value_destroyed: MetricPattern1, + pub profit_value_destroyed_sum: _1m1w1y24hPattern, pub realized_cap: MetricPattern1, pub realized_cap_cents: MetricPattern1, pub realized_cap_change_1m: MetricPattern1, pub realized_cap_rel_to_own_market_cap: BpsPercentRatioPattern, pub realized_loss: CumulativeHeightPattern, - pub realized_loss_ema_1w: MetricPattern1, pub realized_loss_rel_to_realized_cap: BpsPercentRatioPattern, - pub realized_loss_sum: _1m1w1y24hPattern, + pub realized_loss_sum: _24hPattern, + pub realized_loss_sum_extended: _1m1w1yPattern, pub realized_price: CentsSatsUsdPattern, pub realized_price_ratio: BpsRatioPattern, pub realized_price_ratio_percentiles: RatioPattern, pub realized_price_ratio_std_dev: RatioPattern2, pub realized_profit: CumulativeHeightPattern, - pub realized_profit_ema_1w: MetricPattern1, pub realized_profit_rel_to_realized_cap: BpsPercentRatioPattern, - pub realized_profit_sum: _1m1w1y24hPattern, + pub realized_profit_sum: _24hPattern, + pub realized_profit_sum_extended: _1m1w1yPattern, pub realized_profit_to_loss_ratio: _1m1w1y24hPattern, pub sell_side_risk_ratio: _1m1w1y24hPattern2, - pub sell_side_risk_ratio_24h_ema: _1m1wPattern2, pub sent_in_loss: MetricPattern1, - pub sent_in_loss_sum: _1m1w1y24hPattern, + pub sent_in_loss_sum: _24hPattern, + pub sent_in_loss_sum_extended: _1m1w1yPattern, pub sent_in_profit: MetricPattern1, - pub sent_in_profit_sum: _1m1w1y24hPattern, + pub sent_in_profit_sum: _24hPattern, + pub sent_in_profit_sum_extended: _1m1w1yPattern, pub sopr: _24hPattern, - pub sopr_24h_ema: _1m1wPattern, pub sopr_extended: _1m1w1yPattern, pub upper_price_band: CentsSatsUsdPattern, pub value_created: MetricPattern1, @@ -1013,7 +1016,9 @@ impl CapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSo investor_price_ratio: BpsRatioPattern::new(client.clone(), _m(&acc, "investor_price_ratio")), investor_price_ratio_percentiles: RatioPattern::new(client.clone(), _m(&acc, "investor_price_ratio")), loss_value_created: MetricPattern1::new(client.clone(), _m(&acc, "loss_value_created")), + loss_value_created_sum: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "loss_value_created")), loss_value_destroyed: MetricPattern1::new(client.clone(), _m(&acc, "loss_value_destroyed")), + loss_value_destroyed_sum: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "loss_value_destroyed")), lower_price_band: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "lower_price_band")), mvrv: MetricPattern1::new(client.clone(), _m(&acc, "mvrv")), neg_realized_loss: MetricPattern1::new(client.clone(), _m(&acc, "neg_realized_loss")), @@ -1021,38 +1026,39 @@ impl CapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSo net_pnl_change_1m_rel_to_market_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "net_pnl_change_1m_rel_to_market_cap")), net_pnl_change_1m_rel_to_realized_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "net_pnl_change_1m_rel_to_realized_cap")), net_realized_pnl: CumulativeHeightPattern::new(client.clone(), _m(&acc, "net_realized_pnl")), - net_realized_pnl_ema_1w: MetricPattern1::new(client.clone(), _m(&acc, "net_realized_pnl_ema_1w")), net_realized_pnl_rel_to_realized_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "net_realized_pnl_rel_to_realized_cap")), peak_regret: CumulativeHeightPattern::new(client.clone(), _m(&acc, "realized_peak_regret")), peak_regret_rel_to_realized_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "realized_peak_regret_rel_to_realized_cap")), profit_flow: MetricPattern1::new(client.clone(), _m(&acc, "profit_flow")), profit_value_created: MetricPattern1::new(client.clone(), _m(&acc, "profit_value_created")), + profit_value_created_sum: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "profit_value_created")), profit_value_destroyed: MetricPattern1::new(client.clone(), _m(&acc, "profit_value_destroyed")), + profit_value_destroyed_sum: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "profit_value_destroyed")), realized_cap: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap")), realized_cap_cents: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap_cents")), realized_cap_change_1m: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap_change_1m")), realized_cap_rel_to_own_market_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "realized_cap_rel_to_own_market_cap")), realized_loss: CumulativeHeightPattern::new(client.clone(), _m(&acc, "realized_loss")), - realized_loss_ema_1w: MetricPattern1::new(client.clone(), _m(&acc, "realized_loss_ema_1w")), realized_loss_rel_to_realized_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "realized_loss_rel_to_realized_cap")), - realized_loss_sum: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "realized_loss")), + realized_loss_sum: _24hPattern::new(client.clone(), _m(&acc, "realized_loss_24h")), + realized_loss_sum_extended: _1m1w1yPattern::new(client.clone(), _m(&acc, "realized_loss")), realized_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "realized_price")), realized_price_ratio: BpsRatioPattern::new(client.clone(), _m(&acc, "realized_price_ratio")), realized_price_ratio_percentiles: RatioPattern::new(client.clone(), _m(&acc, "realized_price_ratio")), realized_price_ratio_std_dev: RatioPattern2::new(client.clone(), _m(&acc, "realized_price_ratio")), realized_profit: CumulativeHeightPattern::new(client.clone(), _m(&acc, "realized_profit")), - realized_profit_ema_1w: MetricPattern1::new(client.clone(), _m(&acc, "realized_profit_ema_1w")), realized_profit_rel_to_realized_cap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "realized_profit_rel_to_realized_cap")), - realized_profit_sum: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "realized_profit")), + realized_profit_sum: _24hPattern::new(client.clone(), _m(&acc, "realized_profit_24h")), + realized_profit_sum_extended: _1m1w1yPattern::new(client.clone(), _m(&acc, "realized_profit")), realized_profit_to_loss_ratio: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "realized_profit_to_loss_ratio")), sell_side_risk_ratio: _1m1w1y24hPattern2::new(client.clone(), _m(&acc, "sell_side_risk_ratio")), - sell_side_risk_ratio_24h_ema: _1m1wPattern2::new(client.clone(), _m(&acc, "sell_side_risk_ratio_24h_ema")), sent_in_loss: MetricPattern1::new(client.clone(), _m(&acc, "sent_in_loss")), - sent_in_loss_sum: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "sent_in_loss")), + sent_in_loss_sum: _24hPattern::new(client.clone(), _m(&acc, "sent_in_loss_24h")), + sent_in_loss_sum_extended: _1m1w1yPattern::new(client.clone(), _m(&acc, "sent_in_loss")), sent_in_profit: MetricPattern1::new(client.clone(), _m(&acc, "sent_in_profit")), - sent_in_profit_sum: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "sent_in_profit")), + sent_in_profit_sum: _24hPattern::new(client.clone(), _m(&acc, "sent_in_profit_24h")), + sent_in_profit_sum_extended: _1m1w1yPattern::new(client.clone(), _m(&acc, "sent_in_profit")), sopr: _24hPattern::new(client.clone(), _m(&acc, "sopr_24h")), - sopr_24h_ema: _1m1wPattern::new(client.clone(), _m(&acc, "sopr_24h_ema")), sopr_extended: _1m1w1yPattern::new(client.clone(), _m(&acc, "sopr")), upper_price_band: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "upper_price_band")), value_created: MetricPattern1::new(client.clone(), _m(&acc, "value_created")), @@ -1133,6 +1139,60 @@ impl _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern { } } +/// Pattern struct for repeated tree structure. +pub struct MvrvNegNetRealizedSentSoprValuePattern { + pub mvrv: MetricPattern1, + pub neg_realized_loss: MetricPattern1, + pub net_realized_pnl: CumulativeHeightPattern, + pub realized_cap: MetricPattern1, + pub realized_cap_cents: MetricPattern1, + pub realized_cap_change_1m: MetricPattern1, + pub realized_loss: CumulativeHeightPattern, + pub realized_loss_sum: _24hPattern, + pub realized_price: CentsSatsUsdPattern, + pub realized_price_ratio: BpsRatioPattern, + pub realized_profit: CumulativeHeightPattern, + pub realized_profit_sum: _24hPattern, + pub sent_in_loss: MetricPattern1, + pub sent_in_loss_sum: _24hPattern, + pub sent_in_profit: MetricPattern1, + pub sent_in_profit_sum: _24hPattern, + pub sopr: _24hPattern, + pub value_created: MetricPattern1, + pub value_created_sum: _24hPattern, + pub value_destroyed: MetricPattern1, + pub value_destroyed_sum: _24hPattern, +} + +impl MvrvNegNetRealizedSentSoprValuePattern { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + mvrv: MetricPattern1::new(client.clone(), _m(&acc, "mvrv")), + neg_realized_loss: MetricPattern1::new(client.clone(), _m(&acc, "neg_realized_loss")), + net_realized_pnl: CumulativeHeightPattern::new(client.clone(), _m(&acc, "net_realized_pnl")), + realized_cap: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap")), + realized_cap_cents: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap_cents")), + realized_cap_change_1m: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap_change_1m")), + realized_loss: CumulativeHeightPattern::new(client.clone(), _m(&acc, "realized_loss")), + realized_loss_sum: _24hPattern::new(client.clone(), _m(&acc, "realized_loss_24h")), + realized_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "realized_price")), + realized_price_ratio: BpsRatioPattern::new(client.clone(), _m(&acc, "realized_price_ratio")), + realized_profit: CumulativeHeightPattern::new(client.clone(), _m(&acc, "realized_profit")), + realized_profit_sum: _24hPattern::new(client.clone(), _m(&acc, "realized_profit_24h")), + sent_in_loss: MetricPattern1::new(client.clone(), _m(&acc, "sent_in_loss")), + sent_in_loss_sum: _24hPattern::new(client.clone(), _m(&acc, "sent_in_loss_24h")), + sent_in_profit: MetricPattern1::new(client.clone(), _m(&acc, "sent_in_profit")), + sent_in_profit_sum: _24hPattern::new(client.clone(), _m(&acc, "sent_in_profit_24h")), + sopr: _24hPattern::new(client.clone(), _m(&acc, "sopr_24h")), + value_created: MetricPattern1::new(client.clone(), _m(&acc, "value_created")), + value_created_sum: _24hPattern::new(client.clone(), _m(&acc, "value_created_24h")), + value_destroyed: MetricPattern1::new(client.clone(), _m(&acc, "value_destroyed")), + value_destroyed_sum: _24hPattern::new(client.clone(), _m(&acc, "value_destroyed_24h")), + } + } +} + /// Pattern struct for repeated tree structure. pub struct Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern { pub pct05: CentsSatsUsdPattern, @@ -1184,7 +1244,7 @@ impl Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75 } /// Pattern struct for repeated tree structure. -pub struct MvrvNegNetRealizedSentSoprValuePattern { +pub struct MvrvNegNetRealizedSoprValuePattern { pub mvrv: MetricPattern1, pub neg_realized_loss: MetricPattern1, pub net_realized_pnl: CumulativeHeightPattern, @@ -1192,11 +1252,11 @@ pub struct MvrvNegNetRealizedSentSoprValuePattern { pub realized_cap_cents: MetricPattern1, pub realized_cap_change_1m: MetricPattern1, pub realized_loss: CumulativeHeightPattern, + pub realized_loss_sum: _24hPattern, pub realized_price: CentsSatsUsdPattern, pub realized_price_ratio: BpsRatioPattern, pub realized_profit: CumulativeHeightPattern, - pub sent_in_loss: MetricPattern1, - pub sent_in_profit: MetricPattern1, + pub realized_profit_sum: _24hPattern, pub sopr: _24hPattern, pub value_created: MetricPattern1, pub value_created_sum: _24hPattern, @@ -1204,7 +1264,7 @@ pub struct MvrvNegNetRealizedSentSoprValuePattern { pub value_destroyed_sum: _24hPattern, } -impl MvrvNegNetRealizedSentSoprValuePattern { +impl MvrvNegNetRealizedSoprValuePattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -1215,11 +1275,11 @@ impl MvrvNegNetRealizedSentSoprValuePattern { realized_cap_cents: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap_cents")), realized_cap_change_1m: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap_change_1m")), realized_loss: CumulativeHeightPattern::new(client.clone(), _m(&acc, "realized_loss")), + realized_loss_sum: _24hPattern::new(client.clone(), _m(&acc, "realized_loss_24h")), realized_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "realized_price")), realized_price_ratio: BpsRatioPattern::new(client.clone(), _m(&acc, "realized_price_ratio")), realized_profit: CumulativeHeightPattern::new(client.clone(), _m(&acc, "realized_profit")), - sent_in_loss: MetricPattern1::new(client.clone(), _m(&acc, "sent_in_loss")), - sent_in_profit: MetricPattern1::new(client.clone(), _m(&acc, "sent_in_profit")), + realized_profit_sum: _24hPattern::new(client.clone(), _m(&acc, "realized_profit_24h")), sopr: _24hPattern::new(client.clone(), _m(&acc, "sopr_24h")), value_created: MetricPattern1::new(client.clone(), _m(&acc, "value_created")), value_created_sum: _24hPattern::new(client.clone(), _m(&acc, "value_created_24h")), @@ -1317,48 +1377,6 @@ impl GreedGrossInvestedInvestorNegNetPainSupplyUnrealizedPattern { } } -/// Pattern struct for repeated tree structure. -pub struct MvrvNegNetRealizedSoprValuePattern { - pub mvrv: MetricPattern1, - pub neg_realized_loss: MetricPattern1, - pub net_realized_pnl: CumulativeHeightPattern, - pub realized_cap: MetricPattern1, - pub realized_cap_cents: MetricPattern1, - pub realized_cap_change_1m: MetricPattern1, - pub realized_loss: CumulativeHeightPattern, - pub realized_price: CentsSatsUsdPattern, - pub realized_price_ratio: BpsRatioPattern, - pub realized_profit: CumulativeHeightPattern, - pub sopr: _24hPattern, - pub value_created: MetricPattern1, - pub value_created_sum: _24hPattern, - pub value_destroyed: MetricPattern1, - pub value_destroyed_sum: _24hPattern, -} - -impl MvrvNegNetRealizedSoprValuePattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - mvrv: MetricPattern1::new(client.clone(), _m(&acc, "mvrv")), - neg_realized_loss: MetricPattern1::new(client.clone(), _m(&acc, "neg_realized_loss")), - net_realized_pnl: CumulativeHeightPattern::new(client.clone(), _m(&acc, "net_realized_pnl")), - realized_cap: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap")), - realized_cap_cents: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap_cents")), - realized_cap_change_1m: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap_change_1m")), - realized_loss: CumulativeHeightPattern::new(client.clone(), _m(&acc, "realized_loss")), - realized_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "realized_price")), - realized_price_ratio: BpsRatioPattern::new(client.clone(), _m(&acc, "realized_price_ratio")), - realized_profit: CumulativeHeightPattern::new(client.clone(), _m(&acc, "realized_profit")), - sopr: _24hPattern::new(client.clone(), _m(&acc, "sopr_24h")), - value_created: MetricPattern1::new(client.clone(), _m(&acc, "value_created")), - value_created_sum: _24hPattern::new(client.clone(), _m(&acc, "value_created_24h")), - value_destroyed: MetricPattern1::new(client.clone(), _m(&acc, "value_destroyed")), - value_destroyed_sum: _24hPattern::new(client.clone(), _m(&acc, "value_destroyed_24h")), - } - } -} - /// Pattern struct for repeated tree structure. pub struct NetNuplSupplyUnrealizedPattern2 { pub net_unrealized_pnl_rel_to_market_cap: BpsPercentRatioPattern, @@ -1769,6 +1787,36 @@ impl AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern { } } +/// Pattern struct for repeated tree structure. +pub struct MvrvRealizedPattern { + pub mvrv: MetricPattern1, + pub realized_cap: MetricPattern1, + pub realized_cap_cents: MetricPattern1, + pub realized_loss: CumulativeHeightPattern, + pub realized_loss_sum: _24hPattern, + pub realized_price: CentsSatsUsdPattern, + pub realized_price_ratio: BpsRatioPattern, + pub realized_profit: CumulativeHeightPattern, + pub realized_profit_sum: _24hPattern, +} + +impl MvrvRealizedPattern { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + mvrv: MetricPattern1::new(client.clone(), _m(&acc, "mvrv")), + realized_cap: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap")), + realized_cap_cents: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap_cents")), + realized_loss: CumulativeHeightPattern::new(client.clone(), _m(&acc, "realized_loss")), + realized_loss_sum: _24hPattern::new(client.clone(), _m(&acc, "realized_loss_24h")), + realized_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "realized_price")), + realized_price_ratio: BpsRatioPattern::new(client.clone(), _m(&acc, "realized_price_ratio")), + realized_profit: CumulativeHeightPattern::new(client.clone(), _m(&acc, "realized_profit")), + realized_profit_sum: _24hPattern::new(client.clone(), _m(&acc, "realized_profit_24h")), + } + } +} + /// Pattern struct for repeated tree structure. pub struct _1m1w1y24hBtcCentsSatsUsdPattern { pub _1m: BtcCentsSatsUsdPattern, @@ -1931,32 +1979,6 @@ impl ActivityAddrOutputsRealizedSupplyUnrealizedPattern { } } -/// Pattern struct for repeated tree structure. -pub struct MvrvRealizedPattern { - pub mvrv: MetricPattern1, - pub realized_cap: MetricPattern1, - pub realized_cap_cents: MetricPattern1, - pub realized_loss: CumulativeHeightPattern, - pub realized_price: CentsSatsUsdPattern, - pub realized_price_ratio: BpsRatioPattern, - pub realized_profit: CumulativeHeightPattern, -} - -impl MvrvRealizedPattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - mvrv: MetricPattern1::new(client.clone(), _m(&acc, "mvrv")), - realized_cap: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap")), - realized_cap_cents: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap_cents")), - realized_loss: CumulativeHeightPattern::new(client.clone(), _m(&acc, "realized_loss")), - realized_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "realized_price")), - realized_price_ratio: BpsRatioPattern::new(client.clone(), _m(&acc, "realized_price_ratio")), - realized_profit: CumulativeHeightPattern::new(client.clone(), _m(&acc, "realized_profit")), - } - } -} - /// Pattern struct for repeated tree structure. pub struct ActivityOutputsRealizedRelativeSupplyUnrealizedPattern { pub activity: SentPattern, @@ -2453,38 +2475,6 @@ impl CumulativeHeightSumPattern { } } -/// Pattern struct for repeated tree structure. -pub struct _1m1wPattern2 { - pub _1m: BpsPercentRatioPattern, - pub _1w: BpsPercentRatioPattern, -} - -impl _1m1wPattern2 { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - _1m: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "1m")), - _1w: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "1w")), - } - } -} - -/// Pattern struct for repeated tree structure. -pub struct _1m1wPattern { - pub _1m: MetricPattern1, - pub _1w: MetricPattern1, -} - -impl _1m1wPattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - _1m: MetricPattern1::new(client.clone(), _m(&acc, "1m")), - _1w: MetricPattern1::new(client.clone(), _m(&acc, "1w")), - } - } -} - /// Pattern struct for repeated tree structure. pub struct BaseCumulativePattern { pub base: BtcCentsSatsUsdPattern, @@ -5567,7 +5557,6 @@ pub struct MetricsTree_Distribution_UtxoCohorts_All_Adjusted { pub adjusted_value_created_sum: _1m1w1y24hPattern, pub adjusted_value_destroyed_sum: _1m1w1y24hPattern, pub adjusted_sopr: _1m1w1y24hPattern, - pub adjusted_sopr_ema: _1m1wPattern, } impl MetricsTree_Distribution_UtxoCohorts_All_Adjusted { @@ -5578,7 +5567,6 @@ impl MetricsTree_Distribution_UtxoCohorts_All_Adjusted { adjusted_value_created_sum: _1m1w1y24hPattern::new(client.clone(), "adjusted_value_created".to_string()), adjusted_value_destroyed_sum: _1m1w1y24hPattern::new(client.clone(), "adjusted_value_destroyed".to_string()), adjusted_sopr: _1m1w1y24hPattern::new(client.clone(), "adjusted_sopr".to_string()), - adjusted_sopr_ema: _1m1wPattern::new(client.clone(), "adjusted_sopr_24h_ema".to_string()), } } } @@ -5628,7 +5616,6 @@ pub struct MetricsTree_Distribution_UtxoCohorts_Sth { pub adjusted_value_created_sum: _1m1w1y24hPattern, pub adjusted_value_destroyed_sum: _1m1w1y24hPattern, pub adjusted_sopr: _1m1w1y24hPattern, - pub adjusted_sopr_ema: _1m1wPattern, } impl MetricsTree_Distribution_UtxoCohorts_Sth { @@ -5648,7 +5635,6 @@ impl MetricsTree_Distribution_UtxoCohorts_Sth { adjusted_value_created_sum: _1m1w1y24hPattern::new(client.clone(), "sth_adjusted_value_created".to_string()), adjusted_value_destroyed_sum: _1m1w1y24hPattern::new(client.clone(), "sth_adjusted_value_destroyed".to_string()), adjusted_sopr: _1m1w1y24hPattern::new(client.clone(), "sth_adjusted_sopr".to_string()), - adjusted_sopr_ema: _1m1wPattern::new(client.clone(), "sth_adjusted_sopr_24h_ema".to_string()), } } } diff --git a/crates/brk_computer/src/distribution/metrics/cohort/core.rs b/crates/brk_computer/src/distribution/metrics/cohort/core.rs index 62f4c48e3..24caa8ee0 100644 --- a/crates/brk_computer/src/distribution/metrics/cohort/core.rs +++ b/crates/brk_computer/src/distribution/metrics/cohort/core.rs @@ -115,7 +115,7 @@ impl CoreCohortMetrics { .compute_rest_part1(blocks, starting_indexes, exit)?; self.realized - .compute_rest_part1(starting_indexes, exit)?; + .compute_rest_part1(blocks, starting_indexes, exit)?; self.unrealized.compute_rest(starting_indexes, exit)?; diff --git a/crates/brk_computer/src/distribution/metrics/cohort/minimal.rs b/crates/brk_computer/src/distribution/metrics/cohort/minimal.rs index 378aff593..9e3231ea7 100644 --- a/crates/brk_computer/src/distribution/metrics/cohort/minimal.rs +++ b/crates/brk_computer/src/distribution/metrics/cohort/minimal.rs @@ -193,7 +193,7 @@ impl MinimalCohortMetrics { self.activity .compute_rest_part1(blocks, starting_indexes, exit)?; self.realized - .compute_rest_part1(starting_indexes, exit)?; + .compute_rest_part1(blocks, starting_indexes, exit)?; self.unrealized .compute_rest(prices, starting_indexes.height, exit)?; Ok(()) diff --git a/crates/brk_computer/src/distribution/metrics/mod.rs b/crates/brk_computer/src/distribution/metrics/mod.rs index 8e37760b5..17d466095 100644 --- a/crates/brk_computer/src/distribution/metrics/mod.rs +++ b/crates/brk_computer/src/distribution/metrics/mod.rs @@ -208,7 +208,7 @@ pub trait CohortMetricsBase: CohortMetricsState + Send .compute_rest_part1(blocks, starting_indexes, exit)?; self.realized_mut() - .compute_rest_part1(starting_indexes, exit)?; + .compute_rest_part1(blocks, starting_indexes, exit)?; self.unrealized_mut() .compute_rest(prices, starting_indexes, exit)?; diff --git a/crates/brk_computer/src/distribution/metrics/realized/base.rs b/crates/brk_computer/src/distribution/metrics/realized/base.rs index b3f7aa526..ed6013a90 100644 --- a/crates/brk_computer/src/distribution/metrics/realized/base.rs +++ b/crates/brk_computer/src/distribution/metrics/realized/base.rs @@ -5,8 +5,9 @@ use derive_more::{Deref, DerefMut}; use vecdb::{AnyStoredVec, AnyVec, Exit, Rw, StorageMode, WritableVec}; use crate::{ + blocks, distribution::state::RealizedOps, - internal::ComputedFromHeight, + internal::{ComputedFromHeight, RollingWindow24h}, }; use crate::distribution::metrics::ImportConfig; @@ -22,6 +23,9 @@ pub struct RealizedBase { pub sent_in_profit: ComputedFromHeight, pub sent_in_loss: ComputedFromHeight, + + pub sent_in_profit_sum: RollingWindow24h, + pub sent_in_loss_sum: RollingWindow24h, } impl RealizedBase { @@ -32,6 +36,8 @@ impl RealizedBase { core: RealizedCore::forced_import(cfg)?, sent_in_profit: cfg.import("sent_in_profit", v1)?, sent_in_loss: cfg.import("sent_in_loss", v1)?, + sent_in_profit_sum: cfg.import("sent_in_profit", v1)?, + sent_in_loss_sum: cfg.import("sent_in_loss", v1)?, }) } @@ -78,9 +84,23 @@ impl RealizedBase { pub(crate) fn compute_rest_part1( &mut self, + blocks: &blocks::Vecs, starting_indexes: &Indexes, exit: &Exit, ) -> Result<()> { - self.core.compute_rest_part1(starting_indexes, exit) + self.core.compute_rest_part1(blocks, starting_indexes, exit)?; + self.sent_in_profit_sum.compute_rolling_sum( + starting_indexes.height, + &blocks.count.height_24h_ago, + &self.sent_in_profit.height, + exit, + )?; + self.sent_in_loss_sum.compute_rolling_sum( + starting_indexes.height, + &blocks.count.height_24h_ago, + &self.sent_in_loss.height, + exit, + )?; + Ok(()) } } diff --git a/crates/brk_computer/src/distribution/metrics/realized/core.rs b/crates/brk_computer/src/distribution/metrics/realized/core.rs index ab7eaf3b3..01e100bf0 100644 --- a/crates/brk_computer/src/distribution/metrics/realized/core.rs +++ b/crates/brk_computer/src/distribution/metrics/realized/core.rs @@ -117,10 +117,11 @@ impl RealizedCore { pub(crate) fn compute_rest_part1( &mut self, + blocks: &blocks::Vecs, starting_indexes: &Indexes, exit: &Exit, ) -> Result<()> { - self.minimal.compute_rest_part1(starting_indexes, exit)?; + self.minimal.compute_rest_part1(blocks, starting_indexes, exit)?; self.net_realized_pnl .compute(starting_indexes.height, exit, |vec| { diff --git a/crates/brk_computer/src/distribution/metrics/realized/full.rs b/crates/brk_computer/src/distribution/metrics/realized/full.rs index eebbd3943..d472a1b56 100644 --- a/crates/brk_computer/src/distribution/metrics/realized/full.rs +++ b/crates/brk_computer/src/distribution/metrics/realized/full.rs @@ -46,6 +46,11 @@ pub struct RealizedFull { pub loss_value_created: ComputedFromHeight, pub loss_value_destroyed: ComputedFromHeight, + pub profit_value_created_sum: RollingWindows, + pub profit_value_destroyed_sum: RollingWindows, + pub loss_value_created_sum: RollingWindows, + pub loss_value_destroyed_sum: RollingWindows, + pub capitulation_flow: LazyFromHeight, pub profit_flow: LazyFromHeight, @@ -71,16 +76,16 @@ pub struct RealizedFull { pub realized_cap_rel_to_own_market_cap: PercentFromHeight, - pub realized_profit_sum: RollingWindows, - pub realized_loss_sum: RollingWindows, + pub realized_profit_sum_extended: RollingWindowsFrom1w, + pub realized_loss_sum_extended: RollingWindowsFrom1w, pub realized_profit_to_loss_ratio: RollingWindows, pub value_created_sum_extended: RollingWindowsFrom1w, pub value_destroyed_sum_extended: RollingWindowsFrom1w, pub sopr_extended: RollingWindowsFrom1w, - pub sent_in_profit_sum: RollingWindows, - pub sent_in_loss_sum: RollingWindows, + pub sent_in_profit_sum_extended: RollingWindowsFrom1w, + pub sent_in_loss_sum_extended: RollingWindowsFrom1w, pub realized_price_ratio_percentiles: ComputedFromHeightRatioPercentiles, pub realized_price_ratio_std_dev: ComputedFromHeightRatioStdDevBands, @@ -103,6 +108,11 @@ impl RealizedFull { let loss_value_destroyed: ComputedFromHeight = cfg.import("loss_value_destroyed", v0)?; + let profit_value_created_sum = cfg.import("profit_value_created", v1)?; + let profit_value_destroyed_sum = cfg.import("profit_value_destroyed", v1)?; + let loss_value_created_sum = cfg.import("loss_value_created", v1)?; + let loss_value_destroyed_sum = cfg.import("loss_value_destroyed", v1)?; + let capitulation_flow = LazyFromHeight::from_computed::( &cfg.name("capitulation_flow"), cfg.version, @@ -159,6 +169,10 @@ impl RealizedFull { profit_value_destroyed, loss_value_created, loss_value_destroyed, + profit_value_created_sum, + profit_value_destroyed_sum, + loss_value_created_sum, + loss_value_destroyed_sum, capitulation_flow, profit_flow, gross_pnl_sum, @@ -178,15 +192,15 @@ impl RealizedFull { peak_regret_rel_to_realized_cap, realized_cap_rel_to_own_market_cap: cfg .import("realized_cap_rel_to_own_market_cap", v1)?, - realized_profit_sum: cfg.import("realized_profit", v1)?, - realized_loss_sum: cfg.import("realized_loss", v1)?, + realized_profit_sum_extended: cfg.import("realized_profit", v1)?, + realized_loss_sum_extended: cfg.import("realized_loss", v1)?, realized_profit_to_loss_ratio: cfg .import("realized_profit_to_loss_ratio", v1)?, value_created_sum_extended, value_destroyed_sum_extended, sopr_extended, - sent_in_profit_sum: cfg.import("sent_in_profit", v1)?, - sent_in_loss_sum: cfg.import("sent_in_loss", v1)?, + sent_in_profit_sum_extended: cfg.import("sent_in_profit", v1)?, + sent_in_loss_sum_extended: cfg.import("sent_in_loss", v1)?, realized_price_ratio_percentiles: ComputedFromHeightRatioPercentiles::forced_import( cfg.db, &realized_price_name, @@ -276,10 +290,11 @@ impl RealizedFull { pub(crate) fn compute_rest_part1( &mut self, + blocks: &blocks::Vecs, starting_indexes: &Indexes, exit: &Exit, ) -> Result<()> { - self.base.compute_rest_part1(starting_indexes, exit)?; + self.base.compute_rest_part1(blocks, starting_indexes, exit)?; self.peak_regret .compute_rest(starting_indexes.height, exit)?; Ok(()) @@ -302,8 +317,9 @@ impl RealizedFull { exit, )?; - // Extended rolling windows (1w, 1m, 1y) for value_created/destroyed/sopr let window_starts = blocks.count.window_starts(); + + // Extended rolling windows (1w, 1m, 1y) for value_created/destroyed/sopr self.value_created_sum_extended.compute_rolling_sum( starting_indexes.height, &window_starts, @@ -354,21 +370,46 @@ impl RealizedFull { exit, )?; - // Sent in profit/loss rolling sums - let window_starts = blocks.count.window_starts(); - self.sent_in_profit_sum.compute_rolling_sum( + // Sent in profit/loss extended rolling sums (1w, 1m, 1y) + self.sent_in_profit_sum_extended.compute_rolling_sum( starting_indexes.height, &window_starts, &self.base.sent_in_profit.height, exit, )?; - self.sent_in_loss_sum.compute_rolling_sum( + self.sent_in_loss_sum_extended.compute_rolling_sum( starting_indexes.height, &window_starts, &self.base.sent_in_loss.height, exit, )?; + // Profit/loss value created/destroyed rolling sums + self.profit_value_created_sum.compute_rolling_sum( + starting_indexes.height, + &window_starts, + &self.profit_value_created.height, + exit, + )?; + self.profit_value_destroyed_sum.compute_rolling_sum( + starting_indexes.height, + &window_starts, + &self.profit_value_destroyed.height, + exit, + )?; + self.loss_value_created_sum.compute_rolling_sum( + starting_indexes.height, + &window_starts, + &self.loss_value_created.height, + exit, + )?; + self.loss_value_destroyed_sum.compute_rolling_sum( + starting_indexes.height, + &window_starts, + &self.loss_value_destroyed.height, + exit, + )?; + // Gross PnL self.gross_pnl.cents.height.compute_add( starting_indexes.height, @@ -377,7 +418,6 @@ impl RealizedFull { exit, )?; - let window_starts = blocks.count.window_starts(); self.gross_pnl_sum.compute_rolling_sum( starting_indexes.height, &window_starts, @@ -471,15 +511,14 @@ impl RealizedFull { )?; } - // Extended: realized profit/loss rolling sums - let window_starts = blocks.count.window_starts(); - self.realized_profit_sum.compute_rolling_sum( + // Extended: realized profit/loss rolling sums (1w, 1m, 1y) + self.realized_profit_sum_extended.compute_rolling_sum( starting_indexes.height, &window_starts, &self.base.core.minimal.realized_profit.height, exit, )?; - self.realized_loss_sum.compute_rolling_sum( + self.realized_loss_sum_extended.compute_rolling_sum( starting_indexes.height, &window_starts, &self.base.core.minimal.realized_loss.height, @@ -496,12 +535,18 @@ impl RealizedFull { )?; // Realized profit to loss ratios + self.realized_profit_to_loss_ratio._24h.compute_binary::( + starting_indexes.height, + &self.base.core.minimal.realized_profit_sum._24h.height, + &self.base.core.minimal.realized_loss_sum._24h.height, + exit, + )?; for ((ratio, profit), loss) in self .realized_profit_to_loss_ratio - .as_mut_array() + .as_mut_array_from_1w() .into_iter() - .zip(self.realized_profit_sum.as_array()) - .zip(self.realized_loss_sum.as_array()) + .zip(self.realized_profit_sum_extended.as_array()) + .zip(self.realized_loss_sum_extended.as_array()) { ratio.compute_binary::( starting_indexes.height, diff --git a/crates/brk_computer/src/distribution/metrics/realized/minimal.rs b/crates/brk_computer/src/distribution/metrics/realized/minimal.rs index 78dcb7fd1..c7cc0e3f1 100644 --- a/crates/brk_computer/src/distribution/metrics/realized/minimal.rs +++ b/crates/brk_computer/src/distribution/metrics/realized/minimal.rs @@ -6,10 +6,11 @@ use brk_types::{ use vecdb::{AnyStoredVec, AnyVec, Exit, ReadableCloneableVec, ReadableVec, Rw, StorageMode, WritableVec}; use crate::{ + blocks, distribution::state::RealizedOps, internal::{ CentsUnsignedToDollars, ComputedFromHeight, ComputedFromHeightCumulative, - ComputedFromHeightRatio, Identity, LazyFromHeight, Price, + ComputedFromHeightRatio, Identity, LazyFromHeight, Price, RollingWindow24h, }, prices, }; @@ -25,6 +26,9 @@ pub struct RealizedMinimal { pub realized_price: Price>, pub realized_price_ratio: ComputedFromHeightRatio, pub mvrv: LazyFromHeight, + + pub realized_profit_sum: RollingWindow24h, + pub realized_loss_sum: RollingWindow24h, } impl RealizedMinimal { @@ -50,6 +54,9 @@ impl RealizedMinimal { &realized_price_ratio.ratio, ); + let realized_profit_sum = cfg.import("realized_profit", Version::ONE)?; + let realized_loss_sum = cfg.import("realized_loss", Version::ONE)?; + Ok(Self { realized_cap_cents, realized_profit, @@ -58,6 +65,8 @@ impl RealizedMinimal { realized_price, realized_price_ratio, mvrv, + realized_profit_sum, + realized_loss_sum, }) } @@ -108,6 +117,7 @@ impl RealizedMinimal { pub(crate) fn compute_rest_part1( &mut self, + blocks: &blocks::Vecs, starting_indexes: &Indexes, exit: &Exit, ) -> Result<()> { @@ -115,6 +125,18 @@ impl RealizedMinimal { .compute_rest(starting_indexes.height, exit)?; self.realized_loss .compute_rest(starting_indexes.height, exit)?; + self.realized_profit_sum.compute_rolling_sum( + starting_indexes.height, + &blocks.count.height_24h_ago, + &self.realized_profit.height, + exit, + )?; + self.realized_loss_sum.compute_rolling_sum( + starting_indexes.height, + &blocks.count.height_24h_ago, + &self.realized_loss.height, + exit, + )?; Ok(()) } diff --git a/crates/brk_computer/src/distribution/metrics/realized/mod.rs b/crates/brk_computer/src/distribution/metrics/realized/mod.rs index 0e654a4f3..c76fae4b2 100644 --- a/crates/brk_computer/src/distribution/metrics/realized/mod.rs +++ b/crates/brk_computer/src/distribution/metrics/realized/mod.rs @@ -14,7 +14,7 @@ use brk_error::Result; use brk_types::{Height, Indexes}; use vecdb::Exit; -use crate::distribution::state::RealizedState; +use crate::{blocks, distribution::state::RealizedState}; /// Polymorphic dispatch for realized metric types. /// @@ -26,7 +26,7 @@ pub trait RealizedLike: Send + Sync { fn as_base_mut(&mut self) -> &mut RealizedBase; fn min_stateful_height_len(&self) -> usize; fn truncate_push(&mut self, height: Height, state: &RealizedState) -> Result<()>; - fn compute_rest_part1(&mut self, starting_indexes: &Indexes, exit: &Exit) -> Result<()>; + fn compute_rest_part1(&mut self, blocks: &blocks::Vecs, starting_indexes: &Indexes, exit: &Exit) -> Result<()>; fn compute_from_stateful( &mut self, starting_indexes: &Indexes, @@ -42,8 +42,8 @@ impl RealizedLike for RealizedBase { fn truncate_push(&mut self, height: Height, state: &RealizedState) -> Result<()> { self.truncate_push(height, state) } - fn compute_rest_part1(&mut self, starting_indexes: &Indexes, exit: &Exit) -> Result<()> { - self.compute_rest_part1(starting_indexes, exit) + fn compute_rest_part1(&mut self, blocks: &blocks::Vecs, starting_indexes: &Indexes, exit: &Exit) -> Result<()> { + self.compute_rest_part1(blocks, starting_indexes, exit) } fn compute_from_stateful(&mut self, starting_indexes: &Indexes, others: &[&RealizedBase], exit: &Exit) -> Result<()> { self.compute_from_stateful(starting_indexes, others, exit) @@ -57,8 +57,8 @@ impl RealizedLike for RealizedFull { fn truncate_push(&mut self, height: Height, state: &RealizedState) -> Result<()> { self.truncate_push(height, state) } - fn compute_rest_part1(&mut self, starting_indexes: &Indexes, exit: &Exit) -> Result<()> { - self.compute_rest_part1(starting_indexes, exit) + fn compute_rest_part1(&mut self, blocks: &blocks::Vecs, starting_indexes: &Indexes, exit: &Exit) -> Result<()> { + self.compute_rest_part1(blocks, starting_indexes, exit) } fn compute_from_stateful(&mut self, starting_indexes: &Indexes, others: &[&RealizedBase], exit: &Exit) -> Result<()> { self.compute_from_stateful(starting_indexes, others, exit) diff --git a/crates/brk_computer/src/internal/containers/windows.rs b/crates/brk_computer/src/internal/containers/windows.rs index db7da1622..9f30ca98a 100644 --- a/crates/brk_computer/src/internal/containers/windows.rs +++ b/crates/brk_computer/src/internal/containers/windows.rs @@ -33,4 +33,8 @@ impl Windows { pub fn as_mut_array(&mut self) -> [&mut A; 4] { [&mut self._24h, &mut self._1w, &mut self._1m, &mut self._1y] } + + pub fn as_mut_array_from_1w(&mut self) -> [&mut A; 3] { + [&mut self._1w, &mut self._1m, &mut self._1y] + } } diff --git a/modules/brk-client/index.js b/modules/brk-client/index.js index 4863b99ea..33e42c616 100644 --- a/modules/brk-client/index.js +++ b/modules/brk-client/index.js @@ -1585,7 +1585,9 @@ function createMetricPattern35(client, name) { return /** @type {MetricPattern35 * @property {BpsRatioPattern} investorPriceRatio * @property {RatioPattern} investorPriceRatioPercentiles * @property {MetricPattern1} lossValueCreated + * @property {_1m1w1y24hPattern} lossValueCreatedSum * @property {MetricPattern1} lossValueDestroyed + * @property {_1m1w1y24hPattern} lossValueDestroyedSum * @property {CentsSatsUsdPattern} lowerPriceBand * @property {MetricPattern1} mvrv * @property {MetricPattern1} negRealizedLoss @@ -1593,38 +1595,39 @@ function createMetricPattern35(client, name) { return /** @type {MetricPattern35 * @property {BpsPercentRatioPattern} netPnlChange1mRelToMarketCap * @property {BpsPercentRatioPattern} netPnlChange1mRelToRealizedCap * @property {CumulativeHeightPattern} netRealizedPnl - * @property {MetricPattern1} netRealizedPnlEma1w * @property {BpsPercentRatioPattern} netRealizedPnlRelToRealizedCap * @property {CumulativeHeightPattern} peakRegret * @property {BpsPercentRatioPattern} peakRegretRelToRealizedCap * @property {MetricPattern1} profitFlow * @property {MetricPattern1} profitValueCreated + * @property {_1m1w1y24hPattern} profitValueCreatedSum * @property {MetricPattern1} profitValueDestroyed + * @property {_1m1w1y24hPattern} profitValueDestroyedSum * @property {MetricPattern1} realizedCap * @property {MetricPattern1} realizedCapCents * @property {MetricPattern1} realizedCapChange1m * @property {BpsPercentRatioPattern} realizedCapRelToOwnMarketCap * @property {CumulativeHeightPattern} realizedLoss - * @property {MetricPattern1} realizedLossEma1w * @property {BpsPercentRatioPattern} realizedLossRelToRealizedCap - * @property {_1m1w1y24hPattern} realizedLossSum + * @property {_24hPattern} realizedLossSum + * @property {_1m1w1yPattern} realizedLossSumExtended * @property {CentsSatsUsdPattern} realizedPrice * @property {BpsRatioPattern} realizedPriceRatio * @property {RatioPattern} realizedPriceRatioPercentiles * @property {RatioPattern2} realizedPriceRatioStdDev * @property {CumulativeHeightPattern} realizedProfit - * @property {MetricPattern1} realizedProfitEma1w * @property {BpsPercentRatioPattern} realizedProfitRelToRealizedCap - * @property {_1m1w1y24hPattern} realizedProfitSum + * @property {_24hPattern} realizedProfitSum + * @property {_1m1w1yPattern} realizedProfitSumExtended * @property {_1m1w1y24hPattern} realizedProfitToLossRatio * @property {_1m1w1y24hPattern2} sellSideRiskRatio - * @property {_1m1wPattern2} sellSideRiskRatio24hEma * @property {MetricPattern1} sentInLoss - * @property {_1m1w1y24hPattern} sentInLossSum + * @property {_24hPattern} sentInLossSum + * @property {_1m1w1yPattern} sentInLossSumExtended * @property {MetricPattern1} sentInProfit - * @property {_1m1w1y24hPattern} sentInProfitSum + * @property {_24hPattern} sentInProfitSum + * @property {_1m1w1yPattern} sentInProfitSumExtended * @property {_24hPattern} sopr - * @property {_1m1wPattern} sopr24hEma * @property {_1m1w1yPattern} soprExtended * @property {CentsSatsUsdPattern} upperPriceBand * @property {MetricPattern1} valueCreated @@ -1652,7 +1655,9 @@ function createCapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealized investorPriceRatio: createBpsRatioPattern(client, _m(acc, 'investor_price_ratio')), investorPriceRatioPercentiles: createRatioPattern(client, _m(acc, 'investor_price_ratio')), lossValueCreated: createMetricPattern1(client, _m(acc, 'loss_value_created')), + lossValueCreatedSum: create_1m1w1y24hPattern(client, _m(acc, 'loss_value_created')), lossValueDestroyed: createMetricPattern1(client, _m(acc, 'loss_value_destroyed')), + lossValueDestroyedSum: create_1m1w1y24hPattern(client, _m(acc, 'loss_value_destroyed')), lowerPriceBand: createCentsSatsUsdPattern(client, _m(acc, 'lower_price_band')), mvrv: createMetricPattern1(client, _m(acc, 'mvrv')), negRealizedLoss: createMetricPattern1(client, _m(acc, 'neg_realized_loss')), @@ -1660,38 +1665,39 @@ function createCapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealized netPnlChange1mRelToMarketCap: createBpsPercentRatioPattern(client, _m(acc, 'net_pnl_change_1m_rel_to_market_cap')), netPnlChange1mRelToRealizedCap: createBpsPercentRatioPattern(client, _m(acc, 'net_pnl_change_1m_rel_to_realized_cap')), netRealizedPnl: createCumulativeHeightPattern(client, _m(acc, 'net_realized_pnl')), - netRealizedPnlEma1w: createMetricPattern1(client, _m(acc, 'net_realized_pnl_ema_1w')), netRealizedPnlRelToRealizedCap: createBpsPercentRatioPattern(client, _m(acc, 'net_realized_pnl_rel_to_realized_cap')), peakRegret: createCumulativeHeightPattern(client, _m(acc, 'realized_peak_regret')), peakRegretRelToRealizedCap: createBpsPercentRatioPattern(client, _m(acc, 'realized_peak_regret_rel_to_realized_cap')), profitFlow: createMetricPattern1(client, _m(acc, 'profit_flow')), profitValueCreated: createMetricPattern1(client, _m(acc, 'profit_value_created')), + profitValueCreatedSum: create_1m1w1y24hPattern(client, _m(acc, 'profit_value_created')), profitValueDestroyed: createMetricPattern1(client, _m(acc, 'profit_value_destroyed')), + profitValueDestroyedSum: create_1m1w1y24hPattern(client, _m(acc, 'profit_value_destroyed')), realizedCap: createMetricPattern1(client, _m(acc, 'realized_cap')), realizedCapCents: createMetricPattern1(client, _m(acc, 'realized_cap_cents')), realizedCapChange1m: createMetricPattern1(client, _m(acc, 'realized_cap_change_1m')), realizedCapRelToOwnMarketCap: createBpsPercentRatioPattern(client, _m(acc, 'realized_cap_rel_to_own_market_cap')), realizedLoss: createCumulativeHeightPattern(client, _m(acc, 'realized_loss')), - realizedLossEma1w: createMetricPattern1(client, _m(acc, 'realized_loss_ema_1w')), realizedLossRelToRealizedCap: createBpsPercentRatioPattern(client, _m(acc, 'realized_loss_rel_to_realized_cap')), - realizedLossSum: create_1m1w1y24hPattern(client, _m(acc, 'realized_loss')), + realizedLossSum: create_24hPattern(client, _m(acc, 'realized_loss_24h')), + realizedLossSumExtended: create_1m1w1yPattern(client, _m(acc, 'realized_loss')), realizedPrice: createCentsSatsUsdPattern(client, _m(acc, 'realized_price')), realizedPriceRatio: createBpsRatioPattern(client, _m(acc, 'realized_price_ratio')), realizedPriceRatioPercentiles: createRatioPattern(client, _m(acc, 'realized_price_ratio')), realizedPriceRatioStdDev: createRatioPattern2(client, _m(acc, 'realized_price_ratio')), realizedProfit: createCumulativeHeightPattern(client, _m(acc, 'realized_profit')), - realizedProfitEma1w: createMetricPattern1(client, _m(acc, 'realized_profit_ema_1w')), realizedProfitRelToRealizedCap: createBpsPercentRatioPattern(client, _m(acc, 'realized_profit_rel_to_realized_cap')), - realizedProfitSum: create_1m1w1y24hPattern(client, _m(acc, 'realized_profit')), + realizedProfitSum: create_24hPattern(client, _m(acc, 'realized_profit_24h')), + realizedProfitSumExtended: create_1m1w1yPattern(client, _m(acc, 'realized_profit')), realizedProfitToLossRatio: create_1m1w1y24hPattern(client, _m(acc, 'realized_profit_to_loss_ratio')), sellSideRiskRatio: create_1m1w1y24hPattern2(client, _m(acc, 'sell_side_risk_ratio')), - sellSideRiskRatio24hEma: create_1m1wPattern2(client, _m(acc, 'sell_side_risk_ratio_24h_ema')), sentInLoss: createMetricPattern1(client, _m(acc, 'sent_in_loss')), - sentInLossSum: create_1m1w1y24hPattern(client, _m(acc, 'sent_in_loss')), + sentInLossSum: create_24hPattern(client, _m(acc, 'sent_in_loss_24h')), + sentInLossSumExtended: create_1m1w1yPattern(client, _m(acc, 'sent_in_loss')), sentInProfit: createMetricPattern1(client, _m(acc, 'sent_in_profit')), - sentInProfitSum: create_1m1w1y24hPattern(client, _m(acc, 'sent_in_profit')), + sentInProfitSum: create_24hPattern(client, _m(acc, 'sent_in_profit_24h')), + sentInProfitSumExtended: create_1m1w1yPattern(client, _m(acc, 'sent_in_profit')), sopr: create_24hPattern(client, _m(acc, 'sopr_24h')), - sopr24hEma: create_1m1wPattern(client, _m(acc, 'sopr_24h_ema')), soprExtended: create_1m1w1yPattern(client, _m(acc, 'sopr')), upperPriceBand: createCentsSatsUsdPattern(client, _m(acc, 'upper_price_band')), valueCreated: createMetricPattern1(client, _m(acc, 'value_created')), @@ -1774,6 +1780,63 @@ function create_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern(client }; } +/** + * @typedef {Object} MvrvNegNetRealizedSentSoprValuePattern + * @property {MetricPattern1} mvrv + * @property {MetricPattern1} negRealizedLoss + * @property {CumulativeHeightPattern} netRealizedPnl + * @property {MetricPattern1} realizedCap + * @property {MetricPattern1} realizedCapCents + * @property {MetricPattern1} realizedCapChange1m + * @property {CumulativeHeightPattern} realizedLoss + * @property {_24hPattern} realizedLossSum + * @property {CentsSatsUsdPattern} realizedPrice + * @property {BpsRatioPattern} realizedPriceRatio + * @property {CumulativeHeightPattern} realizedProfit + * @property {_24hPattern} realizedProfitSum + * @property {MetricPattern1} sentInLoss + * @property {_24hPattern} sentInLossSum + * @property {MetricPattern1} sentInProfit + * @property {_24hPattern} sentInProfitSum + * @property {_24hPattern} sopr + * @property {MetricPattern1} valueCreated + * @property {_24hPattern} valueCreatedSum + * @property {MetricPattern1} valueDestroyed + * @property {_24hPattern} valueDestroyedSum + */ + +/** + * Create a MvrvNegNetRealizedSentSoprValuePattern pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {MvrvNegNetRealizedSentSoprValuePattern} + */ +function createMvrvNegNetRealizedSentSoprValuePattern(client, acc) { + return { + mvrv: createMetricPattern1(client, _m(acc, 'mvrv')), + negRealizedLoss: createMetricPattern1(client, _m(acc, 'neg_realized_loss')), + netRealizedPnl: createCumulativeHeightPattern(client, _m(acc, 'net_realized_pnl')), + realizedCap: createMetricPattern1(client, _m(acc, 'realized_cap')), + realizedCapCents: createMetricPattern1(client, _m(acc, 'realized_cap_cents')), + realizedCapChange1m: createMetricPattern1(client, _m(acc, 'realized_cap_change_1m')), + realizedLoss: createCumulativeHeightPattern(client, _m(acc, 'realized_loss')), + realizedLossSum: create_24hPattern(client, _m(acc, 'realized_loss_24h')), + realizedPrice: createCentsSatsUsdPattern(client, _m(acc, 'realized_price')), + realizedPriceRatio: createBpsRatioPattern(client, _m(acc, 'realized_price_ratio')), + realizedProfit: createCumulativeHeightPattern(client, _m(acc, 'realized_profit')), + realizedProfitSum: create_24hPattern(client, _m(acc, 'realized_profit_24h')), + sentInLoss: createMetricPattern1(client, _m(acc, 'sent_in_loss')), + sentInLossSum: create_24hPattern(client, _m(acc, 'sent_in_loss_24h')), + sentInProfit: createMetricPattern1(client, _m(acc, 'sent_in_profit')), + sentInProfitSum: create_24hPattern(client, _m(acc, 'sent_in_profit_24h')), + sopr: create_24hPattern(client, _m(acc, 'sopr_24h')), + valueCreated: createMetricPattern1(client, _m(acc, 'value_created')), + valueCreatedSum: create_24hPattern(client, _m(acc, 'value_created_24h')), + valueDestroyed: createMetricPattern1(client, _m(acc, 'value_destroyed')), + valueDestroyedSum: create_24hPattern(client, _m(acc, 'value_destroyed_24h')), + }; +} + /** * @typedef {Object} Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern * @property {CentsSatsUsdPattern} pct05 @@ -1828,7 +1891,7 @@ function createPct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65 } /** - * @typedef {Object} MvrvNegNetRealizedSentSoprValuePattern + * @typedef {Object} MvrvNegNetRealizedSoprValuePattern * @property {MetricPattern1} mvrv * @property {MetricPattern1} negRealizedLoss * @property {CumulativeHeightPattern} netRealizedPnl @@ -1836,11 +1899,11 @@ function createPct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65 * @property {MetricPattern1} realizedCapCents * @property {MetricPattern1} realizedCapChange1m * @property {CumulativeHeightPattern} realizedLoss + * @property {_24hPattern} realizedLossSum * @property {CentsSatsUsdPattern} realizedPrice * @property {BpsRatioPattern} realizedPriceRatio * @property {CumulativeHeightPattern} realizedProfit - * @property {MetricPattern1} sentInLoss - * @property {MetricPattern1} sentInProfit + * @property {_24hPattern} realizedProfitSum * @property {_24hPattern} sopr * @property {MetricPattern1} valueCreated * @property {_24hPattern} valueCreatedSum @@ -1849,12 +1912,12 @@ function createPct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65 */ /** - * Create a MvrvNegNetRealizedSentSoprValuePattern pattern node + * Create a MvrvNegNetRealizedSoprValuePattern pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {MvrvNegNetRealizedSentSoprValuePattern} + * @returns {MvrvNegNetRealizedSoprValuePattern} */ -function createMvrvNegNetRealizedSentSoprValuePattern(client, acc) { +function createMvrvNegNetRealizedSoprValuePattern(client, acc) { return { mvrv: createMetricPattern1(client, _m(acc, 'mvrv')), negRealizedLoss: createMetricPattern1(client, _m(acc, 'neg_realized_loss')), @@ -1863,11 +1926,11 @@ function createMvrvNegNetRealizedSentSoprValuePattern(client, acc) { realizedCapCents: createMetricPattern1(client, _m(acc, 'realized_cap_cents')), realizedCapChange1m: createMetricPattern1(client, _m(acc, 'realized_cap_change_1m')), realizedLoss: createCumulativeHeightPattern(client, _m(acc, 'realized_loss')), + realizedLossSum: create_24hPattern(client, _m(acc, 'realized_loss_24h')), realizedPrice: createCentsSatsUsdPattern(client, _m(acc, 'realized_price')), realizedPriceRatio: createBpsRatioPattern(client, _m(acc, 'realized_price_ratio')), realizedProfit: createCumulativeHeightPattern(client, _m(acc, 'realized_profit')), - sentInLoss: createMetricPattern1(client, _m(acc, 'sent_in_loss')), - sentInProfit: createMetricPattern1(client, _m(acc, 'sent_in_profit')), + realizedProfitSum: create_24hPattern(client, _m(acc, 'realized_profit_24h')), sopr: create_24hPattern(client, _m(acc, 'sopr_24h')), valueCreated: createMetricPattern1(client, _m(acc, 'value_created')), valueCreatedSum: create_24hPattern(client, _m(acc, 'value_created_24h')), @@ -1970,51 +2033,6 @@ function createGreedGrossInvestedInvestorNegNetPainSupplyUnrealizedPattern(clien }; } -/** - * @typedef {Object} MvrvNegNetRealizedSoprValuePattern - * @property {MetricPattern1} mvrv - * @property {MetricPattern1} negRealizedLoss - * @property {CumulativeHeightPattern} netRealizedPnl - * @property {MetricPattern1} realizedCap - * @property {MetricPattern1} realizedCapCents - * @property {MetricPattern1} realizedCapChange1m - * @property {CumulativeHeightPattern} realizedLoss - * @property {CentsSatsUsdPattern} realizedPrice - * @property {BpsRatioPattern} realizedPriceRatio - * @property {CumulativeHeightPattern} realizedProfit - * @property {_24hPattern} sopr - * @property {MetricPattern1} valueCreated - * @property {_24hPattern} valueCreatedSum - * @property {MetricPattern1} valueDestroyed - * @property {_24hPattern} valueDestroyedSum - */ - -/** - * Create a MvrvNegNetRealizedSoprValuePattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {MvrvNegNetRealizedSoprValuePattern} - */ -function createMvrvNegNetRealizedSoprValuePattern(client, acc) { - return { - mvrv: createMetricPattern1(client, _m(acc, 'mvrv')), - negRealizedLoss: createMetricPattern1(client, _m(acc, 'neg_realized_loss')), - netRealizedPnl: createCumulativeHeightPattern(client, _m(acc, 'net_realized_pnl')), - realizedCap: createMetricPattern1(client, _m(acc, 'realized_cap')), - realizedCapCents: createMetricPattern1(client, _m(acc, 'realized_cap_cents')), - realizedCapChange1m: createMetricPattern1(client, _m(acc, 'realized_cap_change_1m')), - realizedLoss: createCumulativeHeightPattern(client, _m(acc, 'realized_loss')), - realizedPrice: createCentsSatsUsdPattern(client, _m(acc, 'realized_price')), - realizedPriceRatio: createBpsRatioPattern(client, _m(acc, 'realized_price_ratio')), - realizedProfit: createCumulativeHeightPattern(client, _m(acc, 'realized_profit')), - sopr: create_24hPattern(client, _m(acc, 'sopr_24h')), - valueCreated: createMetricPattern1(client, _m(acc, 'value_created')), - valueCreatedSum: create_24hPattern(client, _m(acc, 'value_created_24h')), - valueDestroyed: createMetricPattern1(client, _m(acc, 'value_destroyed')), - valueDestroyedSum: create_24hPattern(client, _m(acc, 'value_destroyed_24h')), - }; -} - /** * @typedef {Object} NetNuplSupplyUnrealizedPattern2 * @property {BpsPercentRatioPattern} netUnrealizedPnlRelToMarketCap @@ -2461,6 +2479,39 @@ function createAverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern(client, acc) { }; } +/** + * @typedef {Object} MvrvRealizedPattern + * @property {MetricPattern1} mvrv + * @property {MetricPattern1} realizedCap + * @property {MetricPattern1} realizedCapCents + * @property {CumulativeHeightPattern} realizedLoss + * @property {_24hPattern} realizedLossSum + * @property {CentsSatsUsdPattern} realizedPrice + * @property {BpsRatioPattern} realizedPriceRatio + * @property {CumulativeHeightPattern} realizedProfit + * @property {_24hPattern} realizedProfitSum + */ + +/** + * Create a MvrvRealizedPattern pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {MvrvRealizedPattern} + */ +function createMvrvRealizedPattern(client, acc) { + return { + mvrv: createMetricPattern1(client, _m(acc, 'mvrv')), + realizedCap: createMetricPattern1(client, _m(acc, 'realized_cap')), + realizedCapCents: createMetricPattern1(client, _m(acc, 'realized_cap_cents')), + realizedLoss: createCumulativeHeightPattern(client, _m(acc, 'realized_loss')), + realizedLossSum: create_24hPattern(client, _m(acc, 'realized_loss_24h')), + realizedPrice: createCentsSatsUsdPattern(client, _m(acc, 'realized_price')), + realizedPriceRatio: createBpsRatioPattern(client, _m(acc, 'realized_price_ratio')), + realizedProfit: createCumulativeHeightPattern(client, _m(acc, 'realized_profit')), + realizedProfitSum: create_24hPattern(client, _m(acc, 'realized_profit_24h')), + }; +} + /** * @typedef {Object} _1m1w1y24hBtcCentsSatsUsdPattern * @property {BtcCentsSatsUsdPattern} _1m @@ -2643,35 +2694,6 @@ function createActivityAddrOutputsRealizedSupplyUnrealizedPattern(client, acc) { }; } -/** - * @typedef {Object} MvrvRealizedPattern - * @property {MetricPattern1} mvrv - * @property {MetricPattern1} realizedCap - * @property {MetricPattern1} realizedCapCents - * @property {CumulativeHeightPattern} realizedLoss - * @property {CentsSatsUsdPattern} realizedPrice - * @property {BpsRatioPattern} realizedPriceRatio - * @property {CumulativeHeightPattern} realizedProfit - */ - -/** - * Create a MvrvRealizedPattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {MvrvRealizedPattern} - */ -function createMvrvRealizedPattern(client, acc) { - return { - mvrv: createMetricPattern1(client, _m(acc, 'mvrv')), - realizedCap: createMetricPattern1(client, _m(acc, 'realized_cap')), - realizedCapCents: createMetricPattern1(client, _m(acc, 'realized_cap_cents')), - realizedLoss: createCumulativeHeightPattern(client, _m(acc, 'realized_loss')), - realizedPrice: createCentsSatsUsdPattern(client, _m(acc, 'realized_price')), - realizedPriceRatio: createBpsRatioPattern(client, _m(acc, 'realized_price_ratio')), - realizedProfit: createCumulativeHeightPattern(client, _m(acc, 'realized_profit')), - }; -} - /** * @typedef {Object} ActivityOutputsRealizedRelativeSupplyUnrealizedPattern * @property {SentPattern} activity @@ -3253,44 +3275,6 @@ function createCumulativeHeightSumPattern(client, acc) { }; } -/** - * @typedef {Object} _1m1wPattern2 - * @property {BpsPercentRatioPattern} _1m - * @property {BpsPercentRatioPattern} _1w - */ - -/** - * Create a _1m1wPattern2 pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {_1m1wPattern2} - */ -function create_1m1wPattern2(client, acc) { - return { - _1m: createBpsPercentRatioPattern(client, _m(acc, '1m')), - _1w: createBpsPercentRatioPattern(client, _m(acc, '1w')), - }; -} - -/** - * @typedef {Object} _1m1wPattern - * @property {MetricPattern1} _1m - * @property {MetricPattern1} _1w - */ - -/** - * Create a _1m1wPattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {_1m1wPattern} - */ -function create_1m1wPattern(client, acc) { - return { - _1m: createMetricPattern1(client, _m(acc, '1m')), - _1w: createMetricPattern1(client, _m(acc, '1w')), - }; -} - /** * @typedef {Object} BaseCumulativePattern * @property {BtcCentsSatsUsdPattern} base @@ -4808,7 +4792,6 @@ function create_24hPattern(client, acc) { * @property {_1m1w1y24hPattern} adjustedValueCreatedSum * @property {_1m1w1y24hPattern} adjustedValueDestroyedSum * @property {_1m1w1y24hPattern} adjustedSopr - * @property {_1m1wPattern} adjustedSoprEma */ /** @@ -4840,7 +4823,6 @@ function create_24hPattern(client, acc) { * @property {_1m1w1y24hPattern} adjustedValueCreatedSum * @property {_1m1w1y24hPattern} adjustedValueDestroyedSum * @property {_1m1w1y24hPattern} adjustedSopr - * @property {_1m1wPattern} adjustedSoprEma */ /** @@ -7021,7 +7003,6 @@ class BrkClient extends BrkClientBase { adjustedValueCreatedSum: create_1m1w1y24hPattern(this, 'adjusted_value_created'), adjustedValueDestroyedSum: create_1m1w1y24hPattern(this, 'adjusted_value_destroyed'), adjustedSopr: create_1m1w1y24hPattern(this, 'adjusted_sopr'), - adjustedSoprEma: create_1m1wPattern(this, 'adjusted_sopr_24h_ema'), }, relative: { supplyInProfitRelToOwnSupply: createBpsPercentRatioPattern(this, 'supply_in_profit_rel_to_own_supply'), @@ -7052,7 +7033,6 @@ class BrkClient extends BrkClientBase { adjustedValueCreatedSum: create_1m1w1y24hPattern(this, 'sth_adjusted_value_created'), adjustedValueDestroyedSum: create_1m1w1y24hPattern(this, 'sth_adjusted_value_destroyed'), adjustedSopr: create_1m1w1y24hPattern(this, 'sth_adjusted_sopr'), - adjustedSoprEma: create_1m1wPattern(this, 'sth_adjusted_sopr_24h_ema'), }, lth: { supply: createChangeHalvedTotalPattern(this, 'lth_supply'), diff --git a/packages/brk_client/brk_client/__init__.py b/packages/brk_client/brk_client/__init__.py index 77f0ac920..8b3574d7c 100644 --- a/packages/brk_client/brk_client/__init__.py +++ b/packages/brk_client/brk_client/__init__.py @@ -2080,7 +2080,9 @@ class CapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentS self.investor_price_ratio: BpsRatioPattern = BpsRatioPattern(client, _m(acc, 'investor_price_ratio')) self.investor_price_ratio_percentiles: RatioPattern = RatioPattern(client, _m(acc, 'investor_price_ratio')) self.loss_value_created: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'loss_value_created')) + self.loss_value_created_sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, _m(acc, 'loss_value_created')) self.loss_value_destroyed: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'loss_value_destroyed')) + self.loss_value_destroyed_sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, _m(acc, 'loss_value_destroyed')) self.lower_price_band: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'lower_price_band')) self.mvrv: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'mvrv')) self.neg_realized_loss: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'neg_realized_loss')) @@ -2088,38 +2090,39 @@ class CapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentS self.net_pnl_change_1m_rel_to_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'net_pnl_change_1m_rel_to_market_cap')) self.net_pnl_change_1m_rel_to_realized_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'net_pnl_change_1m_rel_to_realized_cap')) self.net_realized_pnl: CumulativeHeightPattern[CentsSigned] = CumulativeHeightPattern(client, _m(acc, 'net_realized_pnl')) - self.net_realized_pnl_ema_1w: MetricPattern1[CentsSigned] = MetricPattern1(client, _m(acc, 'net_realized_pnl_ema_1w')) self.net_realized_pnl_rel_to_realized_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'net_realized_pnl_rel_to_realized_cap')) self.peak_regret: CumulativeHeightPattern[Cents] = CumulativeHeightPattern(client, _m(acc, 'realized_peak_regret')) self.peak_regret_rel_to_realized_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'realized_peak_regret_rel_to_realized_cap')) self.profit_flow: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'profit_flow')) self.profit_value_created: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'profit_value_created')) + self.profit_value_created_sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, _m(acc, 'profit_value_created')) self.profit_value_destroyed: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'profit_value_destroyed')) + self.profit_value_destroyed_sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, _m(acc, 'profit_value_destroyed')) self.realized_cap: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_cap')) self.realized_cap_cents: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_cap_cents')) self.realized_cap_change_1m: MetricPattern1[CentsSigned] = MetricPattern1(client, _m(acc, 'realized_cap_change_1m')) self.realized_cap_rel_to_own_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'realized_cap_rel_to_own_market_cap')) self.realized_loss: CumulativeHeightPattern[Cents] = CumulativeHeightPattern(client, _m(acc, 'realized_loss')) - self.realized_loss_ema_1w: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_loss_ema_1w')) self.realized_loss_rel_to_realized_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'realized_loss_rel_to_realized_cap')) - self.realized_loss_sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, _m(acc, 'realized_loss')) + self.realized_loss_sum: _24hPattern[Cents] = _24hPattern(client, _m(acc, 'realized_loss_24h')) + self.realized_loss_sum_extended: _1m1w1yPattern[Cents] = _1m1w1yPattern(client, _m(acc, 'realized_loss')) self.realized_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'realized_price')) self.realized_price_ratio: BpsRatioPattern = BpsRatioPattern(client, _m(acc, 'realized_price_ratio')) self.realized_price_ratio_percentiles: RatioPattern = RatioPattern(client, _m(acc, 'realized_price_ratio')) self.realized_price_ratio_std_dev: RatioPattern2 = RatioPattern2(client, _m(acc, 'realized_price_ratio')) self.realized_profit: CumulativeHeightPattern[Cents] = CumulativeHeightPattern(client, _m(acc, 'realized_profit')) - self.realized_profit_ema_1w: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_profit_ema_1w')) self.realized_profit_rel_to_realized_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'realized_profit_rel_to_realized_cap')) - self.realized_profit_sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, _m(acc, 'realized_profit')) + self.realized_profit_sum: _24hPattern[Cents] = _24hPattern(client, _m(acc, 'realized_profit_24h')) + self.realized_profit_sum_extended: _1m1w1yPattern[Cents] = _1m1w1yPattern(client, _m(acc, 'realized_profit')) self.realized_profit_to_loss_ratio: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, _m(acc, 'realized_profit_to_loss_ratio')) self.sell_side_risk_ratio: _1m1w1y24hPattern2 = _1m1w1y24hPattern2(client, _m(acc, 'sell_side_risk_ratio')) - self.sell_side_risk_ratio_24h_ema: _1m1wPattern2 = _1m1wPattern2(client, _m(acc, 'sell_side_risk_ratio_24h_ema')) self.sent_in_loss: MetricPattern1[Sats] = MetricPattern1(client, _m(acc, 'sent_in_loss')) - self.sent_in_loss_sum: _1m1w1y24hPattern[Sats] = _1m1w1y24hPattern(client, _m(acc, 'sent_in_loss')) + self.sent_in_loss_sum: _24hPattern[Sats] = _24hPattern(client, _m(acc, 'sent_in_loss_24h')) + self.sent_in_loss_sum_extended: _1m1w1yPattern[Sats] = _1m1w1yPattern(client, _m(acc, 'sent_in_loss')) self.sent_in_profit: MetricPattern1[Sats] = MetricPattern1(client, _m(acc, 'sent_in_profit')) - self.sent_in_profit_sum: _1m1w1y24hPattern[Sats] = _1m1w1y24hPattern(client, _m(acc, 'sent_in_profit')) + self.sent_in_profit_sum: _24hPattern[Sats] = _24hPattern(client, _m(acc, 'sent_in_profit_24h')) + self.sent_in_profit_sum_extended: _1m1w1yPattern[Sats] = _1m1w1yPattern(client, _m(acc, 'sent_in_profit')) self.sopr: _24hPattern[StoredF64] = _24hPattern(client, _m(acc, 'sopr_24h')) - self.sopr_24h_ema: _1m1wPattern = _1m1wPattern(client, _m(acc, 'sopr_24h_ema')) self.sopr_extended: _1m1w1yPattern[StoredF64] = _1m1w1yPattern(client, _m(acc, 'sopr')) self.upper_price_band: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'upper_price_band')) self.value_created: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_created')) @@ -2163,6 +2166,33 @@ class _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern: self.sma: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'sma_4y')) self.zscore: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'zscore_4y')) +class MvrvNegNetRealizedSentSoprValuePattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.mvrv: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'mvrv')) + self.neg_realized_loss: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'neg_realized_loss')) + self.net_realized_pnl: CumulativeHeightPattern[CentsSigned] = CumulativeHeightPattern(client, _m(acc, 'net_realized_pnl')) + self.realized_cap: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_cap')) + self.realized_cap_cents: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_cap_cents')) + self.realized_cap_change_1m: MetricPattern1[CentsSigned] = MetricPattern1(client, _m(acc, 'realized_cap_change_1m')) + self.realized_loss: CumulativeHeightPattern[Cents] = CumulativeHeightPattern(client, _m(acc, 'realized_loss')) + self.realized_loss_sum: _24hPattern[Cents] = _24hPattern(client, _m(acc, 'realized_loss_24h')) + self.realized_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'realized_price')) + self.realized_price_ratio: BpsRatioPattern = BpsRatioPattern(client, _m(acc, 'realized_price_ratio')) + self.realized_profit: CumulativeHeightPattern[Cents] = CumulativeHeightPattern(client, _m(acc, 'realized_profit')) + self.realized_profit_sum: _24hPattern[Cents] = _24hPattern(client, _m(acc, 'realized_profit_24h')) + self.sent_in_loss: MetricPattern1[Sats] = MetricPattern1(client, _m(acc, 'sent_in_loss')) + self.sent_in_loss_sum: _24hPattern[Sats] = _24hPattern(client, _m(acc, 'sent_in_loss_24h')) + self.sent_in_profit: MetricPattern1[Sats] = MetricPattern1(client, _m(acc, 'sent_in_profit')) + self.sent_in_profit_sum: _24hPattern[Sats] = _24hPattern(client, _m(acc, 'sent_in_profit_24h')) + self.sopr: _24hPattern[StoredF64] = _24hPattern(client, _m(acc, 'sopr_24h')) + self.value_created: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_created')) + self.value_created_sum: _24hPattern[Cents] = _24hPattern(client, _m(acc, 'value_created_24h')) + self.value_destroyed: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_destroyed')) + self.value_destroyed_sum: _24hPattern[Cents] = _24hPattern(client, _m(acc, 'value_destroyed_24h')) + class Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern: """Pattern struct for repeated tree structure.""" @@ -2188,7 +2218,7 @@ class Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct7 self.pct90: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'pct90')) self.pct95: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'pct95')) -class MvrvNegNetRealizedSentSoprValuePattern: +class MvrvNegNetRealizedSoprValuePattern: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -2200,11 +2230,11 @@ class MvrvNegNetRealizedSentSoprValuePattern: self.realized_cap_cents: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_cap_cents')) self.realized_cap_change_1m: MetricPattern1[CentsSigned] = MetricPattern1(client, _m(acc, 'realized_cap_change_1m')) self.realized_loss: CumulativeHeightPattern[Cents] = CumulativeHeightPattern(client, _m(acc, 'realized_loss')) + self.realized_loss_sum: _24hPattern[Cents] = _24hPattern(client, _m(acc, 'realized_loss_24h')) self.realized_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'realized_price')) self.realized_price_ratio: BpsRatioPattern = BpsRatioPattern(client, _m(acc, 'realized_price_ratio')) self.realized_profit: CumulativeHeightPattern[Cents] = CumulativeHeightPattern(client, _m(acc, 'realized_profit')) - self.sent_in_loss: MetricPattern1[Sats] = MetricPattern1(client, _m(acc, 'sent_in_loss')) - self.sent_in_profit: MetricPattern1[Sats] = MetricPattern1(client, _m(acc, 'sent_in_profit')) + self.realized_profit_sum: _24hPattern[Cents] = _24hPattern(client, _m(acc, 'realized_profit_24h')) self.sopr: _24hPattern[StoredF64] = _24hPattern(client, _m(acc, 'sopr_24h')) self.value_created: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_created')) self.value_created_sum: _24hPattern[Cents] = _24hPattern(client, _m(acc, 'value_created_24h')) @@ -2255,27 +2285,6 @@ class GreedGrossInvestedInvestorNegNetPainSupplyUnrealizedPattern: self.unrealized_loss: CentsUsdPattern = CentsUsdPattern(client, _m(acc, 'unrealized_loss')) self.unrealized_profit: CentsUsdPattern = CentsUsdPattern(client, _m(acc, 'unrealized_profit')) -class MvrvNegNetRealizedSoprValuePattern: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.mvrv: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'mvrv')) - self.neg_realized_loss: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'neg_realized_loss')) - self.net_realized_pnl: CumulativeHeightPattern[CentsSigned] = CumulativeHeightPattern(client, _m(acc, 'net_realized_pnl')) - self.realized_cap: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_cap')) - self.realized_cap_cents: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_cap_cents')) - self.realized_cap_change_1m: MetricPattern1[CentsSigned] = MetricPattern1(client, _m(acc, 'realized_cap_change_1m')) - self.realized_loss: CumulativeHeightPattern[Cents] = CumulativeHeightPattern(client, _m(acc, 'realized_loss')) - self.realized_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'realized_price')) - self.realized_price_ratio: BpsRatioPattern = BpsRatioPattern(client, _m(acc, 'realized_price_ratio')) - self.realized_profit: CumulativeHeightPattern[Cents] = CumulativeHeightPattern(client, _m(acc, 'realized_profit')) - self.sopr: _24hPattern[StoredF64] = _24hPattern(client, _m(acc, 'sopr_24h')) - self.value_created: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_created')) - self.value_created_sum: _24hPattern[Cents] = _24hPattern(client, _m(acc, 'value_created_24h')) - self.value_destroyed: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_destroyed')) - self.value_destroyed_sum: _24hPattern[Cents] = _24hPattern(client, _m(acc, 'value_destroyed_24h')) - class NetNuplSupplyUnrealizedPattern2: """Pattern struct for repeated tree structure.""" @@ -2481,6 +2490,21 @@ class AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern: self.pct90: _1m1w1y24hPattern[StoredU64] = _1m1w1y24hPattern(client, _m(acc, 'p90')) self.sum: _1m1w1y24hPattern[StoredU64] = _1m1w1y24hPattern(client, _m(acc, 'sum')) +class MvrvRealizedPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.mvrv: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'mvrv')) + self.realized_cap: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_cap')) + self.realized_cap_cents: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_cap_cents')) + self.realized_loss: CumulativeHeightPattern[Cents] = CumulativeHeightPattern(client, _m(acc, 'realized_loss')) + self.realized_loss_sum: _24hPattern[Cents] = _24hPattern(client, _m(acc, 'realized_loss_24h')) + self.realized_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'realized_price')) + self.realized_price_ratio: BpsRatioPattern = BpsRatioPattern(client, _m(acc, 'realized_price_ratio')) + self.realized_profit: CumulativeHeightPattern[Cents] = CumulativeHeightPattern(client, _m(acc, 'realized_profit')) + self.realized_profit_sum: _24hPattern[Cents] = _24hPattern(client, _m(acc, 'realized_profit_24h')) + class _1m1w1y24hBtcCentsSatsUsdPattern: """Pattern struct for repeated tree structure.""" @@ -2562,19 +2586,6 @@ class ActivityAddrOutputsRealizedSupplyUnrealizedPattern: self.supply: ChangeHalvedTotalPattern = ChangeHalvedTotalPattern(client, _m(acc, 'supply')) self.unrealized: SupplyPattern = SupplyPattern(client, _m(acc, 'supply_in')) -class MvrvRealizedPattern: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.mvrv: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'mvrv')) - self.realized_cap: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_cap')) - self.realized_cap_cents: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_cap_cents')) - self.realized_loss: CumulativeHeightPattern[Cents] = CumulativeHeightPattern(client, _m(acc, 'realized_loss')) - self.realized_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'realized_price')) - self.realized_price_ratio: BpsRatioPattern = BpsRatioPattern(client, _m(acc, 'realized_price_ratio')) - self.realized_profit: CumulativeHeightPattern[Cents] = CumulativeHeightPattern(client, _m(acc, 'realized_profit')) - class ActivityOutputsRealizedRelativeSupplyUnrealizedPattern: """Pattern struct for repeated tree structure.""" @@ -2823,22 +2834,6 @@ class CumulativeHeightSumPattern(Generic[T]): self.height: MetricPattern18[T] = MetricPattern18(client, acc) self.sum: _1m1w1y24hPattern[T] = _1m1w1y24hPattern(client, acc) -class _1m1wPattern2: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self._1m: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, '1m')) - self._1w: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, '1w')) - -class _1m1wPattern: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self._1m: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, '1m')) - self._1w: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, '1w')) - class BaseCumulativePattern: """Pattern struct for repeated tree structure.""" @@ -4261,7 +4256,6 @@ class MetricsTree_Distribution_UtxoCohorts_All_Adjusted: self.adjusted_value_created_sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, 'adjusted_value_created') self.adjusted_value_destroyed_sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, 'adjusted_value_destroyed') self.adjusted_sopr: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, 'adjusted_sopr') - self.adjusted_sopr_ema: _1m1wPattern = _1m1wPattern(client, 'adjusted_sopr_24h_ema') class MetricsTree_Distribution_UtxoCohorts_All_Relative: """Metrics tree node.""" @@ -4310,7 +4304,6 @@ class MetricsTree_Distribution_UtxoCohorts_Sth: self.adjusted_value_created_sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, 'sth_adjusted_value_created') self.adjusted_value_destroyed_sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, 'sth_adjusted_value_destroyed') self.adjusted_sopr: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, 'sth_adjusted_sopr') - self.adjusted_sopr_ema: _1m1wPattern = _1m1wPattern(client, 'sth_adjusted_sopr_24h_ema') class MetricsTree_Distribution_UtxoCohorts_Lth: """Metrics tree node."""