diff --git a/crates/brk_client/src/lib.rs b/crates/brk_client/src/lib.rs index b836b557b..1a677491b 100644 --- a/crates/brk_client/src/lib.rs +++ b/crates/brk_client/src/lib.rs @@ -1036,16 +1036,16 @@ impl _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern { /// Pattern struct for repeated tree structure. pub struct CapGrossInvestorLossMvrvNetNuplPeakPriceProfitSentSoprPattern { pub cap: CentsDeltaRawRelUsdPattern, - pub gross_pnl: CentsSellSumUsdPattern, + pub gross_pnl: RawSellSumPattern, pub investor: CapLowerPriceUpperPattern, - pub loss: CapitulationCentsCumulativeNegRelSumUsdValuePattern, + pub loss: CapitulationCumulativeNegativeRawRelSumValuePattern, pub mvrv: MetricPattern1, pub net_pnl: ChangeCumulativeDeltaRawRelSumPattern, pub nupl: BpsRatioPattern, pub peak_regret: CumulativeHeightRelPattern, pub price: CentsSatsUsdPattern, pub price_ratio: BpsPercentilesRatioStdPattern, - pub profit: CentsCumulativeFlowRelSumUsdValuePattern, + pub profit: CumulativeDistributionRawRelSumValuePattern, pub profit_to_loss_ratio: _1m1w1y24hPattern, pub sent: InPattern3, pub sopr: AdjustedRatioValuePattern, @@ -1056,16 +1056,16 @@ impl CapGrossInvestorLossMvrvNetNuplPeakPriceProfitSentSoprPattern { pub fn new(client: Arc, acc: String) -> Self { Self { cap: CentsDeltaRawRelUsdPattern::new(client.clone(), acc.clone()), - gross_pnl: CentsSellSumUsdPattern::new(client.clone(), acc.clone()), + gross_pnl: RawSellSumPattern::new(client.clone(), acc.clone()), investor: CapLowerPriceUpperPattern::new(client.clone(), acc.clone()), - loss: CapitulationCentsCumulativeNegRelSumUsdValuePattern::new(client.clone(), acc.clone()), + loss: CapitulationCumulativeNegativeRawRelSumValuePattern::new(client.clone(), acc.clone()), mvrv: MetricPattern1::new(client.clone(), _m(&acc, "mvrv")), net_pnl: ChangeCumulativeDeltaRawRelSumPattern::new(client.clone(), _m(&acc, "net")), nupl: BpsRatioPattern::new(client.clone(), _m(&acc, "nupl_ratio")), peak_regret: CumulativeHeightRelPattern::new(client.clone(), _m(&acc, "realized_peak_regret")), price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "realized_price")), price_ratio: BpsPercentilesRatioStdPattern::new(client.clone(), _m(&acc, "realized_price_ratio")), - profit: CentsCumulativeFlowRelSumUsdValuePattern::new(client.clone(), acc.clone()), + profit: CumulativeDistributionRawRelSumValuePattern::new(client.clone(), acc.clone()), profit_to_loss_ratio: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "realized_profit_to_loss_ratio")), sent: InPattern3::new(client.clone(), _m(&acc, "sent_in")), sopr: AdjustedRatioValuePattern::new(client.clone(), acc.clone()), @@ -1213,40 +1213,6 @@ impl AverageCumulativeHeightMaxMedianMinPct10Pct25Pct75Pct90SumPattern { } } -/// Pattern struct for repeated tree structure. -pub struct CapitulationCentsCumulativeNegRelSumUsdValuePattern { - pub capitulation_flow: MetricPattern1, - pub cents: MetricPattern1, - pub cumulative: MetricPattern1, - pub neg: MetricPattern1, - pub rel_to_rcap: BpsPercentRatioPattern, - pub sum: _1m1w1y24hPattern3, - pub usd: MetricPattern1, - pub value_created: MetricPattern1, - pub value_created_sum: _1m1w1y24hPattern, - pub value_destroyed: MetricPattern1, - pub value_destroyed_sum: _1m1w1y24hPattern, -} - -impl CapitulationCentsCumulativeNegRelSumUsdValuePattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - capitulation_flow: MetricPattern1::new(client.clone(), _m(&acc, "capitulation_flow")), - cents: MetricPattern1::new(client.clone(), _m(&acc, "realized_loss_cents")), - cumulative: MetricPattern1::new(client.clone(), _m(&acc, "realized_loss_cumulative")), - neg: MetricPattern1::new(client.clone(), _m(&acc, "neg_realized_loss")), - rel_to_rcap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "realized_loss_rel_to_realized_cap")), - sum: _1m1w1y24hPattern3::new(client.clone(), _m(&acc, "realized_loss")), - usd: MetricPattern1::new(client.clone(), _m(&acc, "realized_loss")), - value_created: MetricPattern1::new(client.clone(), _m(&acc, "loss_value_created")), - value_created_sum: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "loss_value_created")), - value_destroyed: MetricPattern1::new(client.clone(), _m(&acc, "loss_value_destroyed")), - value_destroyed_sum: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "loss_value_destroyed")), - } - } -} - /// Pattern struct for repeated tree structure. pub struct AverageGainsLossesRsiStochPattern { pub average_gain: MetricPattern1, @@ -1314,13 +1280,13 @@ impl BpsPct1Pct2Pct5Pct95Pct98Pct99RatioSmaPattern { /// Pattern struct for repeated tree structure. pub struct CapLossMvrvNetNuplPriceProfitSentSoprPattern { pub cap: CentsDeltaUsdPattern, - pub loss: CentsCumulativeNegSumUsdPattern, + pub loss: CumulativeNegativeRawSumPattern, pub mvrv: MetricPattern1, - pub net_pnl: RawSumPattern, + pub net_pnl: RawSumPattern2, pub nupl: BpsRatioPattern, pub price: CentsSatsUsdPattern, pub price_ratio: BpsRatioPattern, - pub profit: CentsCumulativeSumUsdPattern, + pub profit: CumulativeRawSumPattern, pub sent: InPattern, pub sopr: RatioValuePattern, } @@ -1330,51 +1296,19 @@ impl CapLossMvrvNetNuplPriceProfitSentSoprPattern { pub fn new(client: Arc, acc: String) -> Self { Self { cap: CentsDeltaUsdPattern::new(client.clone(), _m(&acc, "realized_cap")), - loss: CentsCumulativeNegSumUsdPattern::new(client.clone(), acc.clone()), + loss: CumulativeNegativeRawSumPattern::new(client.clone(), acc.clone()), mvrv: MetricPattern1::new(client.clone(), _m(&acc, "mvrv")), - net_pnl: RawSumPattern::new(client.clone(), _m(&acc, "net_realized_pnl")), + net_pnl: RawSumPattern2::new(client.clone(), _m(&acc, "net_realized_pnl")), nupl: BpsRatioPattern::new(client.clone(), _m(&acc, "nupl_ratio")), price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "realized_price")), price_ratio: BpsRatioPattern::new(client.clone(), _m(&acc, "realized_price_ratio")), - profit: CentsCumulativeSumUsdPattern::new(client.clone(), _m(&acc, "realized_profit")), + profit: CumulativeRawSumPattern::new(client.clone(), _m(&acc, "realized_profit")), sent: InPattern::new(client.clone(), _m(&acc, "sent_in")), sopr: RatioValuePattern::new(client.clone(), acc.clone()), } } } -/// Pattern struct for repeated tree structure. -pub struct CentsCumulativeFlowRelSumUsdValuePattern { - pub cents: MetricPattern1, - pub cumulative: MetricPattern1, - pub flow: MetricPattern1, - pub rel_to_rcap: BpsPercentRatioPattern, - pub sum: _1m1w1y24hPattern3, - pub usd: MetricPattern1, - pub value_created: MetricPattern1, - pub value_created_sum: _1m1w1y24hPattern, - pub value_destroyed: MetricPattern1, - pub value_destroyed_sum: _1m1w1y24hPattern, -} - -impl CentsCumulativeFlowRelSumUsdValuePattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - cents: MetricPattern1::new(client.clone(), _m(&acc, "realized_profit_cents")), - cumulative: MetricPattern1::new(client.clone(), _m(&acc, "realized_profit_cumulative")), - flow: MetricPattern1::new(client.clone(), _m(&acc, "profit_flow")), - rel_to_rcap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "realized_profit_rel_to_realized_cap")), - sum: _1m1w1y24hPattern3::new(client.clone(), _m(&acc, "realized_profit")), - usd: MetricPattern1::new(client.clone(), _m(&acc, "realized_profit")), - value_created: MetricPattern1::new(client.clone(), _m(&acc, "profit_value_created")), - value_created_sum: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "profit_value_created")), - value_destroyed: MetricPattern1::new(client.clone(), _m(&acc, "profit_value_destroyed")), - value_destroyed_sum: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "profit_value_destroyed")), - } - } -} - /// Pattern struct for repeated tree structure. pub struct AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern { pub all: MetricPattern1, @@ -1496,12 +1430,12 @@ impl _1m1w1y24hBtcCentsSatsUsdPattern { /// Pattern struct for repeated tree structure. pub struct CapLossMvrvNuplPriceProfitSoprPattern { pub cap: CentsUsdPattern, - pub loss: CentsSumUsdPattern, + pub loss: RawSumPattern, pub mvrv: MetricPattern1, pub nupl: BpsRatioPattern, pub price: CentsSatsUsdPattern, pub price_ratio: BpsRatioPattern, - pub profit: CentsSumUsdPattern, + pub profit: RawSumPattern, pub sopr: ValuePattern, } @@ -1510,17 +1444,45 @@ impl CapLossMvrvNuplPriceProfitSoprPattern { pub fn new(client: Arc, acc: String) -> Self { Self { cap: CentsUsdPattern::new(client.clone(), _m(&acc, "realized_cap")), - loss: CentsSumUsdPattern::new(client.clone(), _m(&acc, "realized_loss")), + loss: RawSumPattern::new(client.clone(), _m(&acc, "realized_loss")), mvrv: MetricPattern1::new(client.clone(), _m(&acc, "mvrv")), nupl: BpsRatioPattern::new(client.clone(), _m(&acc, "nupl_ratio")), price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "realized_price")), price_ratio: BpsRatioPattern::new(client.clone(), _m(&acc, "realized_price_ratio")), - profit: CentsSumUsdPattern::new(client.clone(), _m(&acc, "realized_profit")), + profit: RawSumPattern::new(client.clone(), _m(&acc, "realized_profit")), sopr: ValuePattern::new(client.clone(), _m(&acc, "value")), } } } +/// Pattern struct for repeated tree structure. +pub struct CapitulationCumulativeNegativeRawRelSumValuePattern { + pub capitulation_flow: MetricPattern1, + pub cumulative: MetricPattern1, + pub negative: MetricPattern1, + pub raw: CentsUsdPattern, + pub rel_to_rcap: BpsPercentRatioPattern, + pub sum: _1m1w1y24hPattern4, + pub value_created: BaseSumPattern, + pub value_destroyed: BaseSumPattern, +} + +impl CapitulationCumulativeNegativeRawRelSumValuePattern { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + capitulation_flow: MetricPattern1::new(client.clone(), _m(&acc, "capitulation_flow")), + cumulative: MetricPattern1::new(client.clone(), _m(&acc, "realized_loss_cumulative")), + negative: MetricPattern1::new(client.clone(), _m(&acc, "neg_realized_loss")), + raw: CentsUsdPattern::new(client.clone(), _m(&acc, "realized_loss")), + rel_to_rcap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "realized_loss_rel_to_realized_cap")), + sum: _1m1w1y24hPattern4::new(client.clone(), _m(&acc, "realized_loss")), + value_created: BaseSumPattern::new(client.clone(), _m(&acc, "loss_value_created")), + value_destroyed: BaseSumPattern::new(client.clone(), _m(&acc, "loss_value_destroyed")), + } + } +} + /// Pattern struct for repeated tree structure. pub struct Pct1Pct2Pct5Pct95Pct98Pct99SmaPattern { pub pct1: BpsPriceRatioPattern, @@ -1630,53 +1592,27 @@ impl _1m1w1y24hBpsPercentRatioPattern { } /// Pattern struct for repeated tree structure. -pub struct _24hChangeRatePattern { - pub _24h: BpsCentsPercentRatioUsdPattern, - pub change: _1mPattern3, - pub change_1w: CentsUsdPattern, - pub change_1y: CentsUsdPattern, - pub rate: _1mPattern2, - pub rate_1w: BpsPercentRatioPattern, - pub rate_1y: BpsPercentRatioPattern, -} - -impl _24hChangeRatePattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - _24h: BpsCentsPercentRatioUsdPattern::new(client.clone(), acc.clone()), - change: _1mPattern3::new(client.clone(), _m(&acc, "change_1m")), - change_1w: CentsUsdPattern::new(client.clone(), _m(&acc, "change_1w")), - change_1y: CentsUsdPattern::new(client.clone(), _m(&acc, "change_1y")), - rate: _1mPattern2::new(client.clone(), _m(&acc, "rate_1m")), - rate_1w: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "rate_1w")), - rate_1y: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "rate_1y")), - } - } -} - -/// Pattern struct for repeated tree structure. -pub struct ChangeCumulativeDeltaRawRelSumPattern { - pub change_1m_rel_to_mcap: BpsPercentRatioPattern, - pub change_1m_rel_to_rcap: BpsPercentRatioPattern, - pub cumulative: MetricPattern1, - pub delta: _24hChangeRatePattern, - pub raw: MetricPattern1, +pub struct CumulativeDistributionRawRelSumValuePattern { + pub cumulative: MetricPattern1, + pub distribution_flow: MetricPattern1, + pub raw: CentsUsdPattern, pub rel_to_rcap: BpsPercentRatioPattern, - pub sum: _1m1w1y24hPattern, + pub sum: _1m1w1y24hPattern4, + pub value_created: BaseSumPattern, + pub value_destroyed: BaseSumPattern, } -impl ChangeCumulativeDeltaRawRelSumPattern { +impl CumulativeDistributionRawRelSumValuePattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - change_1m_rel_to_mcap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "pnl_change_1m_rel_to_market_cap")), - change_1m_rel_to_rcap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "pnl_change_1m_rel_to_realized_cap")), - cumulative: MetricPattern1::new(client.clone(), _m(&acc, "realized_pnl_cumulative")), - delta: _24hChangeRatePattern::new(client.clone(), _m(&acc, "pnl_delta")), - raw: MetricPattern1::new(client.clone(), _m(&acc, "realized_pnl")), - rel_to_rcap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "realized_pnl_rel_to_realized_cap")), - sum: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "realized_pnl")), + cumulative: MetricPattern1::new(client.clone(), _m(&acc, "realized_profit_cumulative")), + distribution_flow: MetricPattern1::new(client.clone(), _m(&acc, "profit_flow")), + raw: CentsUsdPattern::new(client.clone(), _m(&acc, "realized_profit")), + rel_to_rcap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "realized_profit_rel_to_realized_cap")), + sum: _1m1w1y24hPattern4::new(client.clone(), _m(&acc, "realized_profit")), + value_created: BaseSumPattern::new(client.clone(), _m(&acc, "profit_value_created")), + value_destroyed: BaseSumPattern::new(client.clone(), _m(&acc, "profit_value_destroyed")), } } } @@ -1686,9 +1622,9 @@ pub struct GrossInvestedInvestorLossNetProfitSentimentPattern { pub gross_pnl: CentsUsdPattern, pub invested_capital: InPattern5, pub investor_cap: InPattern2, - pub loss: CentsNegSumSupplyUsdPattern, + pub loss: NegativeRawSumSupplyPattern, pub net_pnl: CentsUsdPattern, - pub profit: CentsSumSupplyUsdPattern, + pub profit: RawSumSupplyPattern, pub sentiment: GreedNetPainPattern, } @@ -1699,9 +1635,9 @@ impl GrossInvestedInvestorLossNetProfitSentimentPattern { gross_pnl: CentsUsdPattern::new(client.clone(), _m(&acc, "unrealized_gross_pnl")), invested_capital: InPattern5::new(client.clone(), _m(&acc, "invested_capital_in")), investor_cap: InPattern2::new(client.clone(), _m(&acc, "investor_cap_in")), - loss: CentsNegSumSupplyUsdPattern::new(client.clone(), acc.clone()), + loss: NegativeRawSumSupplyPattern::new(client.clone(), acc.clone()), net_pnl: CentsUsdPattern::new(client.clone(), _m(&acc, "net_unrealized_pnl")), - profit: CentsSumSupplyUsdPattern::new(client.clone(), acc.clone()), + profit: RawSumSupplyPattern::new(client.clone(), acc.clone()), sentiment: GreedNetPainPattern::new(client.clone(), acc.clone()), } } @@ -1755,33 +1691,9 @@ impl ActivityOutputsRealizedRelativeSupplyUnrealizedPattern2 { } } -/// Pattern struct for repeated tree structure. -pub struct AdjustedRatioValuePattern { - pub adjusted: RatioValuePattern2, - pub ratio: _1m1w1y24hPattern, - pub value_created: RawSumPattern, - pub value_created_sum: _1m1w1yPattern, - pub value_destroyed: RawSumPattern, - pub value_destroyed_sum: _1m1w1yPattern, -} - -impl AdjustedRatioValuePattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - adjusted: RatioValuePattern2::new(client.clone(), _m(&acc, "adjusted")), - ratio: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "sopr")), - value_created: RawSumPattern::new(client.clone(), _m(&acc, "value_created")), - value_created_sum: _1m1w1yPattern::new(client.clone(), _m(&acc, "value_created")), - value_destroyed: RawSumPattern::new(client.clone(), _m(&acc, "value_destroyed")), - value_destroyed_sum: _1m1w1yPattern::new(client.clone(), _m(&acc, "value_destroyed")), - } - } -} - /// Pattern struct for repeated tree structure. pub struct CapLowerPriceUpperPattern { - pub cap_raw: MetricPattern18, + pub cap: RawPattern, pub lower_price_band: CentsSatsUsdPattern, pub price: CentsSatsUsdPattern, pub price_ratio: BpsRatioPattern, @@ -1793,7 +1705,7 @@ impl CapLowerPriceUpperPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - cap_raw: MetricPattern18::new(client.clone(), _m(&acc, "investor_cap_raw")), + cap: RawPattern::new(client.clone(), _m(&acc, "investor_cap_raw")), lower_price_band: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "lower_price_band")), price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "investor_price")), price_ratio: BpsRatioPattern::new(client.clone(), _m(&acc, "investor_price_ratio")), @@ -1803,6 +1715,30 @@ impl CapLowerPriceUpperPattern { } } +/// Pattern struct for repeated tree structure. +pub struct ChangeCumulativeDeltaRawRelSumPattern { + pub change_1m: RelPattern2, + pub cumulative: MetricPattern1, + pub delta: ChangeRatePattern4, + pub raw: MetricPattern1, + pub rel_to_rcap: BpsPercentRatioPattern, + pub sum: _1m1w1y24hPattern, +} + +impl ChangeCumulativeDeltaRawRelSumPattern { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + change_1m: RelPattern2::new(client.clone(), _m(&acc, "pnl_change_1m_rel_to")), + cumulative: MetricPattern1::new(client.clone(), _m(&acc, "realized_pnl_cumulative")), + delta: ChangeRatePattern4::new(client.clone(), _m(&acc, "pnl_delta")), + raw: MetricPattern1::new(client.clone(), _m(&acc, "realized_pnl")), + rel_to_rcap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "realized_pnl_rel_to_realized_cap")), + sum: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "realized_pnl")), + } + } +} + /// Pattern struct for repeated tree structure. pub struct AddrOutputsRealizedSupplyPattern { pub addr_count: MetricPattern1, @@ -1825,34 +1761,12 @@ impl AddrOutputsRealizedSupplyPattern { } } -/// Pattern struct for repeated tree structure. -pub struct BpsCentsPercentRatioUsdPattern { - pub bps: MetricPattern1, - pub cents: MetricPattern1, - pub percent: MetricPattern1, - pub ratio: MetricPattern1, - pub usd: MetricPattern1, -} - -impl BpsCentsPercentRatioUsdPattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - bps: MetricPattern1::new(client.clone(), _m(&acc, "rate_24h_bps")), - cents: MetricPattern1::new(client.clone(), _m(&acc, "change_24h_cents")), - percent: MetricPattern1::new(client.clone(), _m(&acc, "rate_24h")), - ratio: MetricPattern1::new(client.clone(), _m(&acc, "rate_24h_ratio")), - usd: MetricPattern1::new(client.clone(), _m(&acc, "change_24h")), - } - } -} - /// Pattern struct for repeated tree structure. pub struct BtcCentsSatsSumUsdPattern2 { pub btc: MetricPattern1, pub cents: MetricPattern1, pub sats: MetricPattern1, - pub sum: _1m1w1y24hPattern4, + pub sum: _1m1w1y24hPattern5, pub usd: MetricPattern1, } @@ -1863,7 +1777,7 @@ impl BtcCentsSatsSumUsdPattern2 { btc: MetricPattern1::new(client.clone(), acc.clone()), cents: MetricPattern1::new(client.clone(), _m(&acc, "cents")), sats: MetricPattern1::new(client.clone(), _m(&acc, "sats")), - sum: _1m1w1y24hPattern4::new(client.clone(), acc.clone()), + sum: _1m1w1y24hPattern5::new(client.clone(), acc.clone()), usd: MetricPattern1::new(client.clone(), _m(&acc, "usd")), } } @@ -1891,32 +1805,10 @@ impl BtcCentsSatsSumUsdPattern { } } -/// Pattern struct for repeated tree structure. -pub struct CentsCumulativeNegSumUsdPattern { - pub cents: MetricPattern1, - pub cumulative: MetricPattern1, - pub neg: MetricPattern1, - pub sum: _24hPattern, - pub usd: MetricPattern1, -} - -impl CentsCumulativeNegSumUsdPattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - cents: MetricPattern1::new(client.clone(), _m(&acc, "realized_loss_cents")), - cumulative: MetricPattern1::new(client.clone(), _m(&acc, "realized_loss_cumulative")), - neg: MetricPattern1::new(client.clone(), _m(&acc, "neg_realized_loss")), - sum: _24hPattern::new(client.clone(), _m(&acc, "realized_loss_24h")), - usd: MetricPattern1::new(client.clone(), _m(&acc, "realized_loss")), - } - } -} - /// Pattern struct for repeated tree structure. pub struct CentsDeltaRawRelUsdPattern { pub cents: MetricPattern1, - pub delta: _24hChangeRatePattern, + pub delta: ChangeRatePattern4, pub raw: MetricPattern18, pub rel_to_own_mcap: BpsPercentRatioPattern, pub usd: MetricPattern1, @@ -1927,7 +1819,7 @@ impl CentsDeltaRawRelUsdPattern { pub fn new(client: Arc, acc: String) -> Self { Self { cents: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap_cents")), - delta: _24hChangeRatePattern::new(client.clone(), _m(&acc, "realized_cap_delta")), + delta: ChangeRatePattern4::new(client.clone(), _m(&acc, "realized_cap_delta")), raw: MetricPattern18::new(client.clone(), _m(&acc, "cap_raw")), rel_to_own_mcap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "realized_cap_rel_to_own_market_cap")), usd: MetricPattern1::new(client.clone(), _m(&acc, "realized_cap")), @@ -1935,34 +1827,12 @@ impl CentsDeltaRawRelUsdPattern { } } -/// Pattern struct for repeated tree structure. -pub struct CentsNegSumSupplyUsdPattern { - pub cents: MetricPattern1, - pub neg: MetricPattern1, - pub sum: _24hPattern, - pub supply: BtcCentsSatsUsdPattern, - pub usd: MetricPattern1, -} - -impl CentsNegSumSupplyUsdPattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - cents: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_loss_cents")), - neg: MetricPattern1::new(client.clone(), _m(&acc, "neg_unrealized_loss")), - sum: _24hPattern::new(client.clone(), _m(&acc, "unrealized_loss_24h")), - supply: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "supply_in_loss")), - usd: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_loss")), - } - } -} - /// Pattern struct for repeated tree structure. pub struct CoinblocksCoindaysDormancySentVelocityPattern { pub coinblocks_destroyed: CumulativeRawPattern, - pub coindays_destroyed: CumulativeRawSumPattern, + pub coindays_destroyed: CumulativeRawSumPattern2, pub dormancy: MetricPattern1, - pub sent: RawSumPattern2, + pub sent: RawSumPattern3, pub velocity: MetricPattern1, } @@ -1971,9 +1841,9 @@ impl CoinblocksCoindaysDormancySentVelocityPattern { pub fn new(client: Arc, acc: String) -> Self { Self { coinblocks_destroyed: CumulativeRawPattern::new(client.clone(), _m(&acc, "coinblocks_destroyed")), - coindays_destroyed: CumulativeRawSumPattern::new(client.clone(), _m(&acc, "coindays_destroyed")), + coindays_destroyed: CumulativeRawSumPattern2::new(client.clone(), _m(&acc, "coindays_destroyed")), dormancy: MetricPattern1::new(client.clone(), _m(&acc, "dormancy")), - sent: RawSumPattern2::new(client.clone(), _m(&acc, "sent")), + sent: RawSumPattern3::new(client.clone(), _m(&acc, "sent")), velocity: MetricPattern1::new(client.clone(), _m(&acc, "velocity")), } } @@ -2005,9 +1875,9 @@ impl EmaHistogramLineSignalPattern { pub struct InvestedInvestorLossNetProfitPattern { pub invested_capital: InPattern2, pub investor_cap: InPattern2, - pub loss: CentsNegSumSupplyUsdPattern, + pub loss: NegativeRawSumSupplyPattern, pub net_pnl: CentsUsdPattern, - pub profit: CentsSumSupplyUsdPattern, + pub profit: RawSumSupplyPattern, } impl InvestedInvestorLossNetProfitPattern { @@ -2016,9 +1886,9 @@ impl InvestedInvestorLossNetProfitPattern { Self { invested_capital: InPattern2::new(client.clone(), _m(&acc, "invested_capital_in")), investor_cap: InPattern2::new(client.clone(), _m(&acc, "investor_cap_in")), - loss: CentsNegSumSupplyUsdPattern::new(client.clone(), acc.clone()), + loss: NegativeRawSumSupplyPattern::new(client.clone(), acc.clone()), net_pnl: CentsUsdPattern::new(client.clone(), _m(&acc, "net_unrealized_pnl")), - profit: CentsSumSupplyUsdPattern::new(client.clone(), acc.clone()), + profit: RawSumSupplyPattern::new(client.clone(), acc.clone()), } } } @@ -2110,14 +1980,14 @@ impl _1m1w1y24hPattern2 { } /// Pattern struct for repeated tree structure. -pub struct _1m1w1y24hPattern7 { +pub struct _1m1w1y24hPattern8 { pub _1m: BtcCentsSatsUsdPattern, pub _1w: BtcCentsSatsUsdPattern, pub _1y: BtcCentsSatsUsdPattern, pub _24h: BtcCentsSatsUsdPattern, } -impl _1m1w1y24hPattern7 { +impl _1m1w1y24hPattern8 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -2130,14 +2000,14 @@ impl _1m1w1y24hPattern7 { } /// Pattern struct for repeated tree structure. -pub struct _1m1w1y24hPattern3 { +pub struct _1m1w1y24hPattern4 { pub _1m: MetricPattern1, pub _1w: MetricPattern1, pub _1y: MetricPattern1, pub _24h: CentsUsdPattern, } -impl _1m1w1y24hPattern3 { +impl _1m1w1y24hPattern4 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -2170,14 +2040,34 @@ impl _1m1w1y2wPattern { } /// Pattern struct for repeated tree structure. -pub struct _1m1w1y24hPattern4 { +pub struct _1m1w1y24hPattern3 { + pub _1m: CentsUsdPattern, + pub _1w: CentsUsdPattern, + pub _1y: CentsUsdPattern, + pub _24h: CentsUsdPattern, +} + +impl _1m1w1y24hPattern3 { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + _1m: CentsUsdPattern::new(client.clone(), _m(&acc, "1m")), + _1w: CentsUsdPattern::new(client.clone(), _m(&acc, "1w")), + _1y: CentsUsdPattern::new(client.clone(), _m(&acc, "1y")), + _24h: CentsUsdPattern::new(client.clone(), _m(&acc, "24h")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct _1m1w1y24hPattern5 { pub _1m: MetricPattern1, pub _1w: MetricPattern1, pub _1y: MetricPattern1, pub _24h: BtcCentsSatsUsdPattern, } -impl _1m1w1y24hPattern4 { +impl _1m1w1y24hPattern5 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -2209,6 +2099,26 @@ impl _1y2y4yAllPattern { } } +/// Pattern struct for repeated tree structure. +pub struct AdjustedRatioValuePattern { + pub adjusted: RatioValuePattern2, + pub ratio: _1m1w1y24hPattern, + pub value_created: RawSumPattern3, + pub value_destroyed: RawSumPattern3, +} + +impl AdjustedRatioValuePattern { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + adjusted: RatioValuePattern2::new(client.clone(), _m(&acc, "adjusted")), + ratio: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "sopr")), + value_created: RawSumPattern3::new(client.clone(), _m(&acc, "value_created")), + value_destroyed: RawSumPattern3::new(client.clone(), _m(&acc, "value_destroyed")), + } + } +} + /// Pattern struct for repeated tree structure. pub struct BothReactivatedReceivingSendingPattern { pub both: _1m1w1y24hHeightPattern, @@ -2270,61 +2180,21 @@ impl BtcCentsSatsUsdPattern { } /// Pattern struct for repeated tree structure. -pub struct CentsCumulativeSumUsdPattern { - pub cents: MetricPattern1, +pub struct CumulativeNegativeRawSumPattern { pub cumulative: MetricPattern1, + pub negative: MetricPattern1, + pub raw: CentsUsdPattern, pub sum: _24hPattern, - pub usd: MetricPattern1, } -impl CentsCumulativeSumUsdPattern { +impl CumulativeNegativeRawSumPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - cents: MetricPattern1::new(client.clone(), _m(&acc, "cents")), - cumulative: MetricPattern1::new(client.clone(), _m(&acc, "cumulative")), - sum: _24hPattern::new(client.clone(), _m(&acc, "24h")), - usd: MetricPattern1::new(client.clone(), acc.clone()), - } - } -} - -/// Pattern struct for repeated tree structure. -pub struct CentsSellSumUsdPattern { - pub cents: MetricPattern1, - pub sell_side_risk_ratio: _1m1w1y24hPattern2, - pub sum: _1m1w1y24hPattern, - pub usd: MetricPattern1, -} - -impl CentsSellSumUsdPattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - cents: MetricPattern1::new(client.clone(), _m(&acc, "realized_gross_pnl_cents")), - sell_side_risk_ratio: _1m1w1y24hPattern2::new(client.clone(), _m(&acc, "sell_side_risk_ratio")), - sum: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "gross_pnl_sum")), - usd: MetricPattern1::new(client.clone(), _m(&acc, "realized_gross_pnl")), - } - } -} - -/// Pattern struct for repeated tree structure. -pub struct CentsSumSupplyUsdPattern { - pub cents: MetricPattern1, - pub sum: _24hPattern, - pub supply: BtcCentsSatsUsdPattern, - pub usd: MetricPattern1, -} - -impl CentsSumSupplyUsdPattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - cents: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_profit_cents")), - sum: _24hPattern::new(client.clone(), _m(&acc, "unrealized_profit_24h")), - supply: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "supply_in_profit")), - usd: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_profit")), + cumulative: MetricPattern1::new(client.clone(), _m(&acc, "realized_loss_cumulative")), + negative: MetricPattern1::new(client.clone(), _m(&acc, "neg_realized_loss")), + raw: CentsUsdPattern::new(client.clone(), _m(&acc, "realized_loss")), + sum: _24hPattern::new(client.clone(), _m(&acc, "realized_loss_24h")), } } } @@ -2349,6 +2219,26 @@ impl InvestedMaxMinPercentilesPattern { } } +/// Pattern struct for repeated tree structure. +pub struct NegativeRawSumSupplyPattern { + pub negative: MetricPattern1, + pub raw: CentsUsdPattern, + pub sum: _24hPattern, + pub supply: BtcCentsSatsUsdPattern, +} + +impl NegativeRawSumSupplyPattern { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + negative: MetricPattern1::new(client.clone(), _m(&acc, "neg_unrealized_loss")), + raw: CentsUsdPattern::new(client.clone(), _m(&acc, "unrealized_loss")), + sum: _24hPattern::new(client.clone(), _m(&acc, "unrealized_loss_24h")), + supply: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "supply_in_loss")), + } + } +} + /// Pattern struct for repeated tree structure. pub struct OutputsRealizedSupplyUnrealizedPattern { pub outputs: UtxoPattern, @@ -2393,7 +2283,7 @@ impl _1m1w1y24hPattern { pub struct BaseCumulativeSumPattern { pub base: BtcCentsSatsUsdPattern, pub cumulative: BtcCentsSatsUsdPattern, - pub sum: _1m1w1y24hPattern7, + pub sum: _1m1w1y24hPattern8, } impl BaseCumulativeSumPattern { @@ -2402,7 +2292,7 @@ impl BaseCumulativeSumPattern { Self { base: BtcCentsSatsUsdPattern::new(client.clone(), acc.clone()), cumulative: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "cumulative")), - sum: _1m1w1y24hPattern7::new(client.clone(), _m(&acc, "sum")), + sum: _1m1w1y24hPattern8::new(client.clone(), _m(&acc, "sum")), } } } @@ -2533,24 +2423,6 @@ impl CentsSatsUsdPattern { } } -/// Pattern struct for repeated tree structure. -pub struct CentsSumUsdPattern { - pub cents: MetricPattern1, - pub sum: _24hPattern, - pub usd: MetricPattern1, -} - -impl CentsSumUsdPattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - cents: MetricPattern1::new(client.clone(), _m(&acc, "cents")), - sum: _24hPattern::new(client.clone(), _m(&acc, "24h")), - usd: MetricPattern1::new(client.clone(), acc.clone()), - } - } -} - /// Pattern struct for repeated tree structure. pub struct CumulativeHeightRelPattern { pub cumulative: MetricPattern1, @@ -2571,12 +2443,30 @@ impl CumulativeHeightRelPattern { /// Pattern struct for repeated tree structure. pub struct CumulativeRawSumPattern { + pub cumulative: MetricPattern1, + pub raw: CentsUsdPattern, + pub sum: _24hPattern, +} + +impl CumulativeRawSumPattern { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + cumulative: MetricPattern1::new(client.clone(), _m(&acc, "cumulative")), + raw: CentsUsdPattern::new(client.clone(), acc.clone()), + sum: _24hPattern::new(client.clone(), _m(&acc, "24h")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct CumulativeRawSumPattern2 { pub cumulative: MetricPattern1, pub raw: MetricPattern1, pub sum: _1m1w1y24hPattern, } -impl CumulativeRawSumPattern { +impl CumulativeRawSumPattern2 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -2661,8 +2551,8 @@ impl InRelPattern { /// Pattern struct for repeated tree structure. pub struct InRelPattern2 { - pub in_loss: RelPattern5, - pub in_profit: RelPattern5, + pub in_loss: RelPattern6, + pub in_profit: RelPattern6, pub rel_to_circulating_supply: BpsPercentRatioPattern, } @@ -2670,8 +2560,8 @@ impl InRelPattern2 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - in_loss: RelPattern5::new(client.clone(), _m(&acc, "in_loss_rel_to")), - in_profit: RelPattern5::new(client.clone(), _m(&acc, "in_profit_rel_to")), + in_loss: RelPattern6::new(client.clone(), _m(&acc, "in_loss_rel_to")), + in_profit: RelPattern6::new(client.clone(), _m(&acc, "in_profit_rel_to")), rel_to_circulating_supply: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "rel_to_circulating_supply")), } } @@ -2679,36 +2569,36 @@ impl InRelPattern2 { /// Pattern struct for repeated tree structure. pub struct LossNetProfitPattern2 { - pub loss: CentsNegSumSupplyUsdPattern, + pub loss: NegativeRawSumSupplyPattern, pub net_pnl: CentsUsdPattern, - pub profit: CentsSumSupplyUsdPattern, + pub profit: RawSumSupplyPattern, } impl LossNetProfitPattern2 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - loss: CentsNegSumSupplyUsdPattern::new(client.clone(), acc.clone()), + loss: NegativeRawSumSupplyPattern::new(client.clone(), acc.clone()), net_pnl: CentsUsdPattern::new(client.clone(), _m(&acc, "net_unrealized_pnl")), - profit: CentsSumSupplyUsdPattern::new(client.clone(), acc.clone()), + profit: RawSumSupplyPattern::new(client.clone(), acc.clone()), } } } /// Pattern struct for repeated tree structure. pub struct LossNetProfitPattern3 { - pub loss: RelPattern6, - pub net_pnl: RelPattern7, - pub profit: RelPattern6, + pub loss: RelPattern7, + pub net_pnl: RelPattern8, + pub profit: RelPattern7, } impl LossNetProfitPattern3 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - loss: RelPattern6::new(client.clone(), _m(&acc, "unrealized_loss_rel_to")), - net_pnl: RelPattern7::new(client.clone(), _m(&acc, "net_unrealized_pnl_rel_to_own")), - profit: RelPattern6::new(client.clone(), _m(&acc, "unrealized_profit_rel_to")), + loss: RelPattern7::new(client.clone(), _m(&acc, "unrealized_loss_rel_to")), + net_pnl: RelPattern8::new(client.clone(), _m(&acc, "net_unrealized_pnl_rel_to_own")), + profit: RelPattern7::new(client.clone(), _m(&acc, "unrealized_profit_rel_to")), } } } @@ -2734,8 +2624,8 @@ impl OutputsRealizedSupplyPattern { /// Pattern struct for repeated tree structure. pub struct RatioValuePattern { pub ratio: _24hPattern2, - pub value_created: RawSumPattern, - pub value_destroyed: RawSumPattern, + pub value_created: RawSumPattern2, + pub value_destroyed: RawSumPattern2, } impl RatioValuePattern { @@ -2743,20 +2633,56 @@ impl RatioValuePattern { pub fn new(client: Arc, acc: String) -> Self { Self { ratio: _24hPattern2::new(client.clone(), _m(&acc, "sopr_24h")), - value_created: RawSumPattern::new(client.clone(), _m(&acc, "value_created")), - value_destroyed: RawSumPattern::new(client.clone(), _m(&acc, "value_destroyed")), + value_created: RawSumPattern2::new(client.clone(), _m(&acc, "value_created")), + value_destroyed: RawSumPattern2::new(client.clone(), _m(&acc, "value_destroyed")), } } } /// Pattern struct for repeated tree structure. -pub struct RelPattern6 { +pub struct RawSellSumPattern { + pub raw: CentsUsdPattern, + pub sell_side_risk_ratio: _1m1w1y24hPattern2, + pub sum: _1m1w1y24hPattern, +} + +impl RawSellSumPattern { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + raw: CentsUsdPattern::new(client.clone(), _m(&acc, "realized_gross_pnl")), + sell_side_risk_ratio: _1m1w1y24hPattern2::new(client.clone(), _m(&acc, "sell_side_risk_ratio")), + sum: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "gross_pnl_sum")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct RawSumSupplyPattern { + pub raw: CentsUsdPattern, + pub sum: _24hPattern, + pub supply: BtcCentsSatsUsdPattern, +} + +impl RawSumSupplyPattern { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + raw: CentsUsdPattern::new(client.clone(), _m(&acc, "unrealized_profit")), + sum: _24hPattern::new(client.clone(), _m(&acc, "unrealized_profit_24h")), + supply: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "supply_in_profit")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct RelPattern7 { pub rel_to_market_cap: BpsPercentRatioPattern, pub rel_to_own_gross_pnl: BpsPercentRatioPattern, pub rel_to_own_market_cap: BpsPercentRatioPattern, } -impl RelPattern6 { +impl RelPattern7 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -2767,24 +2693,6 @@ impl RelPattern6 { } } -/// Pattern struct for repeated tree structure. -pub struct _1m1w1yPattern { - pub _1m: MetricPattern1, - pub _1w: MetricPattern1, - pub _1y: MetricPattern1, -} - -impl _1m1w1yPattern { - /// 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")), - _1y: MetricPattern1::new(client.clone(), _m(&acc, "1y")), - } - } -} - /// Pattern struct for repeated tree structure. pub struct _6bBlockTxindexPattern { pub _6b: AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern, @@ -2837,6 +2745,22 @@ impl BaseCumulativePattern { } } +/// Pattern struct for repeated tree structure. +pub struct BaseSumPattern { + pub base: MetricPattern1, + pub sum: _1m1w1y24hPattern, +} + +impl BaseSumPattern { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + base: MetricPattern1::new(client.clone(), acc.clone()), + sum: _1m1w1y24hPattern::new(client.clone(), acc.clone()), + } + } +} + /// Pattern struct for repeated tree structure. pub struct BlocksDominancePattern { pub blocks_mined: CumulativeHeightPattern, @@ -2901,6 +2825,22 @@ impl ChangeRatePattern2 { } } +/// Pattern struct for repeated tree structure. +pub struct ChangeRatePattern4 { + pub change: _1m1w1y24hPattern3, + pub rate: _1m1w1y24hPattern2, +} + +impl ChangeRatePattern4 { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + change: _1m1w1y24hPattern3::new(client.clone(), _m(&acc, "change")), + rate: _1m1w1y24hPattern2::new(client.clone(), _m(&acc, "rate")), + } + } +} + /// Pattern struct for repeated tree structure. pub struct ChangeRatePattern { pub change: _1mPattern, @@ -2935,16 +2875,16 @@ impl ChangeRatePattern3 { /// Pattern struct for repeated tree structure. pub struct CoindaysSentPattern { - pub coindays_destroyed: RawSumPattern, - pub sent: RawSumPattern, + pub coindays_destroyed: RawSumPattern2, + pub sent: RawSumPattern2, } impl CoindaysSentPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - coindays_destroyed: RawSumPattern::new(client.clone(), _m(&acc, "coindays_destroyed")), - sent: RawSumPattern::new(client.clone(), _m(&acc, "sent")), + coindays_destroyed: RawSumPattern2::new(client.clone(), _m(&acc, "coindays_destroyed")), + sent: RawSumPattern2::new(client.clone(), _m(&acc, "sent")), } } } @@ -3079,16 +3019,16 @@ impl InPattern2 { /// Pattern struct for repeated tree structure. pub struct LossProfitPattern2 { - pub loss: CentsSumSupplyUsdPattern, - pub profit: CentsSumSupplyUsdPattern, + pub loss: RawSumSupplyPattern, + pub profit: RawSumSupplyPattern, } impl LossProfitPattern2 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - loss: CentsSumSupplyUsdPattern::new(client.clone(), acc.clone()), - profit: CentsSumSupplyUsdPattern::new(client.clone(), acc.clone()), + loss: RawSumSupplyPattern::new(client.clone(), acc.clone()), + profit: RawSumSupplyPattern::new(client.clone(), acc.clone()), } } } @@ -3110,17 +3050,17 @@ impl PriceValuePattern { } /// Pattern struct for repeated tree structure. -pub struct RawSumPattern2 { - pub raw: MetricPattern1, - pub sum: _1m1w1y24hPattern, +pub struct RawSumPattern { + pub raw: CentsUsdPattern, + pub sum: _24hPattern, } -impl RawSumPattern2 { +impl RawSumPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - raw: MetricPattern1::new(client.clone(), acc.clone()), - sum: _1m1w1y24hPattern::new(client.clone(), acc.clone()), + raw: CentsUsdPattern::new(client.clone(), acc.clone()), + sum: _24hPattern::new(client.clone(), _m(&acc, "24h")), } } } @@ -3142,12 +3082,12 @@ impl RealizedSupplyPattern { } /// Pattern struct for repeated tree structure. -pub struct RelPattern5 { +pub struct RelPattern6 { pub rel_to_circulating_supply: BpsPercentRatioPattern, pub rel_to_own_supply: BpsPercentRatioPattern, } -impl RelPattern5 { +impl RelPattern6 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -3158,12 +3098,12 @@ impl RelPattern5 { } /// Pattern struct for repeated tree structure. -pub struct RelPattern3 { +pub struct RelPattern4 { pub rel_to_market_cap: BpsPercentRatioPattern, pub rel_to_own_gross_pnl: BpsPercentRatioPattern, } -impl RelPattern3 { +impl RelPattern4 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -3174,12 +3114,28 @@ impl RelPattern3 { } /// Pattern struct for repeated tree structure. -pub struct RelPattern7 { +pub struct RelPattern2 { + pub rel_to_mcap: BpsPercentRatioPattern, + pub rel_to_rcap: BpsPercentRatioPattern, +} + +impl RelPattern2 { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + rel_to_mcap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "market_cap")), + rel_to_rcap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "realized_cap")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct RelPattern8 { pub rel_to_own_gross_pnl: BpsPercentRatioPattern, pub rel_to_own_market_cap: BpsPercentRatioPattern, } -impl RelPattern7 { +impl RelPattern8 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -3255,27 +3211,43 @@ impl UtxoPattern3 { /// Pattern struct for repeated tree structure. pub struct ValuePattern { - pub value_created: RawSumPattern, - pub value_destroyed: RawSumPattern, + pub value_created: RawSumPattern2, + pub value_destroyed: RawSumPattern2, } impl ValuePattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - value_created: RawSumPattern::new(client.clone(), _m(&acc, "created")), - value_destroyed: RawSumPattern::new(client.clone(), _m(&acc, "destroyed")), + value_created: RawSumPattern2::new(client.clone(), _m(&acc, "created")), + value_destroyed: RawSumPattern2::new(client.clone(), _m(&acc, "destroyed")), } } } /// Pattern struct for repeated tree structure. -pub struct RawSumPattern { +pub struct RawSumPattern3 { + pub raw: MetricPattern1, + pub sum: _1m1w1y24hPattern, +} + +impl RawSumPattern3 { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + raw: MetricPattern1::new(client.clone(), acc.clone()), + sum: _1m1w1y24hPattern::new(client.clone(), acc.clone()), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct RawSumPattern2 { pub raw: MetricPattern1, pub sum: _24hPattern2, } -impl RawSumPattern { +impl RawSumPattern2 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -3356,11 +3328,11 @@ impl RelPattern { } /// Pattern struct for repeated tree structure. -pub struct RelPattern2 { +pub struct RelPattern3 { pub rel_to_own_supply: BpsPercentRatioPattern, } -impl RelPattern2 { +impl RelPattern3 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -5040,7 +5012,7 @@ pub struct MetricsTree_Market { pub ath: MetricsTree_Market_Ath, pub lookback: MetricsTree_Market_Lookback, pub returns: MetricsTree_Market_Returns, - pub volatility: _1m1w1yPattern, + pub volatility: MetricsTree_Market_Volatility, pub range: MetricsTree_Market_Range, pub moving_average: MetricsTree_Market_MovingAverage, pub dca: MetricsTree_Market_Dca, @@ -5053,7 +5025,7 @@ impl MetricsTree_Market { ath: MetricsTree_Market_Ath::new(client.clone(), format!("{base_path}_ath")), lookback: MetricsTree_Market_Lookback::new(client.clone(), format!("{base_path}_lookback")), returns: MetricsTree_Market_Returns::new(client.clone(), format!("{base_path}_returns")), - volatility: _1m1w1yPattern::new(client.clone(), "price_volatility".to_string()), + volatility: MetricsTree_Market_Volatility::new(client.clone(), format!("{base_path}_volatility")), range: MetricsTree_Market_Range::new(client.clone(), format!("{base_path}_range")), moving_average: MetricsTree_Market_MovingAverage::new(client.clone(), format!("{base_path}_moving_average")), dca: MetricsTree_Market_Dca::new(client.clone(), format!("{base_path}_dca")), @@ -5223,6 +5195,23 @@ impl MetricsTree_Market_Returns_PriceReturn24hSd_1m { } } +/// Metrics tree node. +pub struct MetricsTree_Market_Volatility { + pub _1w: MetricPattern1, + pub _1m: MetricPattern1, + pub _1y: MetricPattern1, +} + +impl MetricsTree_Market_Volatility { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + _1w: MetricPattern1::new(client.clone(), "price_volatility_1w".to_string()), + _1m: MetricPattern1::new(client.clone(), "price_volatility_1m".to_string()), + _1y: MetricPattern1::new(client.clone(), "price_volatility_1y".to_string()), + } + } +} + /// Metrics tree node. pub struct MetricsTree_Market_Range { pub min: _1m1w1y2wPattern, @@ -6897,31 +6886,31 @@ impl MetricsTree_Distribution_UtxoCohorts_All_Relative { /// Metrics tree node. pub struct MetricsTree_Distribution_UtxoCohorts_All_Relative_Supply { - pub in_profit: RelPattern2, - pub in_loss: RelPattern2, + pub in_profit: RelPattern3, + pub in_loss: RelPattern3, } impl MetricsTree_Distribution_UtxoCohorts_All_Relative_Supply { pub fn new(client: Arc, base_path: String) -> Self { Self { - in_profit: RelPattern2::new(client.clone(), "supply_in_profit_rel_to_own_supply".to_string()), - in_loss: RelPattern2::new(client.clone(), "supply_in_loss_rel_to_own_supply".to_string()), + in_profit: RelPattern3::new(client.clone(), "supply_in_profit_rel_to_own_supply".to_string()), + in_loss: RelPattern3::new(client.clone(), "supply_in_loss_rel_to_own_supply".to_string()), } } } /// Metrics tree node. pub struct MetricsTree_Distribution_UtxoCohorts_All_Relative_Unrealized { - pub profit: RelPattern3, - pub loss: RelPattern3, + pub profit: RelPattern4, + pub loss: RelPattern4, pub net_pnl: MetricsTree_Distribution_UtxoCohorts_All_Relative_Unrealized_NetPnl, } impl MetricsTree_Distribution_UtxoCohorts_All_Relative_Unrealized { pub fn new(client: Arc, base_path: String) -> Self { Self { - profit: RelPattern3::new(client.clone(), "unrealized_profit_rel_to".to_string()), - loss: RelPattern3::new(client.clone(), "unrealized_loss_rel_to".to_string()), + profit: RelPattern4::new(client.clone(), "unrealized_profit_rel_to".to_string()), + loss: RelPattern4::new(client.clone(), "unrealized_loss_rel_to".to_string()), net_pnl: MetricsTree_Distribution_UtxoCohorts_All_Relative_Unrealized_NetPnl::new(client.clone(), format!("{base_path}_net_pnl")), } } @@ -6992,9 +6981,9 @@ impl MetricsTree_Distribution_UtxoCohorts_Lth { /// Metrics tree node. pub struct MetricsTree_Distribution_UtxoCohorts_Lth_Realized { - pub profit: CentsCumulativeFlowRelSumUsdValuePattern, - pub loss: CapitulationCentsCumulativeNegRelSumUsdValuePattern, - pub gross_pnl: CentsSellSumUsdPattern, + pub profit: CumulativeDistributionRawRelSumValuePattern, + pub loss: CapitulationCumulativeNegativeRawRelSumValuePattern, + pub gross_pnl: RawSellSumPattern, pub net_pnl: ChangeCumulativeDeltaRawRelSumPattern, pub sopr: MetricsTree_Distribution_UtxoCohorts_Lth_Realized_Sopr, pub sent: InPattern3, @@ -7011,9 +7000,9 @@ pub struct MetricsTree_Distribution_UtxoCohorts_Lth_Realized { impl MetricsTree_Distribution_UtxoCohorts_Lth_Realized { pub fn new(client: Arc, base_path: String) -> Self { Self { - profit: CentsCumulativeFlowRelSumUsdValuePattern::new(client.clone(), "lth".to_string()), - loss: CapitulationCentsCumulativeNegRelSumUsdValuePattern::new(client.clone(), "lth".to_string()), - gross_pnl: CentsSellSumUsdPattern::new(client.clone(), "lth".to_string()), + profit: CumulativeDistributionRawRelSumValuePattern::new(client.clone(), "lth".to_string()), + loss: CapitulationCumulativeNegativeRawRelSumValuePattern::new(client.clone(), "lth".to_string()), + gross_pnl: RawSellSumPattern::new(client.clone(), "lth".to_string()), net_pnl: ChangeCumulativeDeltaRawRelSumPattern::new(client.clone(), "lth_net".to_string()), sopr: MetricsTree_Distribution_UtxoCohorts_Lth_Realized_Sopr::new(client.clone(), format!("{base_path}_sopr")), sent: InPattern3::new(client.clone(), "lth_sent_in".to_string()), @@ -7031,21 +7020,17 @@ impl MetricsTree_Distribution_UtxoCohorts_Lth_Realized { /// Metrics tree node. pub struct MetricsTree_Distribution_UtxoCohorts_Lth_Realized_Sopr { - pub value_created_sum: _1m1w1yPattern, - pub value_destroyed_sum: _1m1w1yPattern, + pub value_created: RawSumPattern3, + pub value_destroyed: RawSumPattern3, pub ratio: _1m1w1y24hPattern, - pub value_created: RawSumPattern, - pub value_destroyed: RawSumPattern, } impl MetricsTree_Distribution_UtxoCohorts_Lth_Realized_Sopr { pub fn new(client: Arc, base_path: String) -> Self { Self { - value_created_sum: _1m1w1yPattern::new(client.clone(), "lth_value_created".to_string()), - value_destroyed_sum: _1m1w1yPattern::new(client.clone(), "lth_value_destroyed".to_string()), + value_created: RawSumPattern3::new(client.clone(), "lth_value_created".to_string()), + value_destroyed: RawSumPattern3::new(client.clone(), "lth_value_destroyed".to_string()), ratio: _1m1w1y24hPattern::new(client.clone(), "lth_sopr".to_string()), - value_created: RawSumPattern::new(client.clone(), "lth_value_created".to_string()), - value_destroyed: RawSumPattern::new(client.clone(), "lth_value_destroyed".to_string()), } } } @@ -7842,7 +7827,7 @@ pub struct MetricsTree_Supply { pub inflation_rate: BpsPercentRatioPattern, pub velocity: MetricsTree_Supply_Velocity, pub market_cap: CentsUsdPattern, - pub market_cap_delta: MetricsTree_Supply_MarketCapDelta, + pub market_cap_delta: ChangeRatePattern4, pub market_minus_realized_cap_growth_rate: _1m1w1y24hPattern, } @@ -7854,7 +7839,7 @@ impl MetricsTree_Supply { inflation_rate: BpsPercentRatioPattern::new(client.clone(), "inflation_rate".to_string()), velocity: MetricsTree_Supply_Velocity::new(client.clone(), format!("{base_path}_velocity")), market_cap: CentsUsdPattern::new(client.clone(), "market_cap".to_string()), - market_cap_delta: MetricsTree_Supply_MarketCapDelta::new(client.clone(), format!("{base_path}_market_cap_delta")), + market_cap_delta: ChangeRatePattern4::new(client.clone(), "market_cap_delta".to_string()), market_minus_realized_cap_growth_rate: _1m1w1y24hPattern::new(client.clone(), "market_minus_realized_cap_growth_rate".to_string()), } } @@ -7890,27 +7875,6 @@ impl MetricsTree_Supply_Velocity { } } -/// Metrics tree node. -pub struct MetricsTree_Supply_MarketCapDelta { - pub change_24h: CentsUsdPattern, - pub change_1w: CentsUsdPattern, - pub change_1m: CentsUsdPattern, - pub change_1y: CentsUsdPattern, - pub rate: _1m1w1y24hPattern2, -} - -impl MetricsTree_Supply_MarketCapDelta { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - change_24h: CentsUsdPattern::new(client.clone(), "market_cap_delta_change_24h".to_string()), - change_1w: CentsUsdPattern::new(client.clone(), "market_cap_delta_change_1w".to_string()), - change_1m: CentsUsdPattern::new(client.clone(), "market_cap_delta_change_1m".to_string()), - change_1y: CentsUsdPattern::new(client.clone(), "market_cap_delta_change_1y".to_string()), - rate: _1m1w1y24hPattern2::new(client.clone(), "market_cap_delta_rate".to_string()), - } - } -} - /// Main BRK client with metrics tree and API methods. pub struct BrkClient { base: Arc, diff --git a/crates/brk_computer/src/cointime/adjusted/compute.rs b/crates/brk_computer/src/cointime/adjusted/compute.rs index 3fd2088b5..45563c183 100644 --- a/crates/brk_computer/src/cointime/adjusted/compute.rs +++ b/crates/brk_computer/src/cointime/adjusted/compute.rs @@ -14,7 +14,7 @@ impl Vecs { activity: &activity::Vecs, exit: &Exit, ) -> Result<()> { - self.adj_inflation_rate.bps.height.compute_transform2( + self.inflation_rate.bps.height.compute_transform2( starting_indexes.height, &activity.liveliness.height, &supply.inflation_rate.bps.height, @@ -27,14 +27,14 @@ impl Vecs { exit, )?; - self.adj_tx_velocity_btc.height.compute_multiply( + self.tx_velocity_btc.height.compute_multiply( starting_indexes.height, &activity.activity_to_vaultedness_ratio.height, &supply.velocity.btc.height, exit, )?; - self.adj_tx_velocity_usd.height.compute_multiply( + self.tx_velocity_usd.height.compute_multiply( starting_indexes.height, &activity.activity_to_vaultedness_ratio.height, &supply.velocity.usd.height, diff --git a/crates/brk_computer/src/cointime/adjusted/import.rs b/crates/brk_computer/src/cointime/adjusted/import.rs index 3c50eeb25..8a2cdc7ea 100644 --- a/crates/brk_computer/src/cointime/adjusted/import.rs +++ b/crates/brk_computer/src/cointime/adjusted/import.rs @@ -15,19 +15,19 @@ impl Vecs { indexes: &indexes::Vecs, ) -> Result { Ok(Self { - adj_inflation_rate: PercentPerBlock::forced_import( + inflation_rate: PercentPerBlock::forced_import( db, "cointime_adj_inflation_rate", version, indexes, )?, - adj_tx_velocity_btc: ComputedPerBlock::forced_import( + tx_velocity_btc: ComputedPerBlock::forced_import( db, "cointime_adj_tx_velocity_btc", version, indexes, )?, - adj_tx_velocity_usd: ComputedPerBlock::forced_import( + tx_velocity_usd: ComputedPerBlock::forced_import( db, "cointime_adj_tx_velocity_usd", version, diff --git a/crates/brk_computer/src/cointime/adjusted/vecs.rs b/crates/brk_computer/src/cointime/adjusted/vecs.rs index 647b3d96c..3818f3e6e 100644 --- a/crates/brk_computer/src/cointime/adjusted/vecs.rs +++ b/crates/brk_computer/src/cointime/adjusted/vecs.rs @@ -6,7 +6,7 @@ use crate::internal::{ComputedPerBlock, PercentPerBlock}; #[derive(Traversable)] pub struct Vecs { - pub adj_inflation_rate: PercentPerBlock, - pub adj_tx_velocity_btc: ComputedPerBlock, - pub adj_tx_velocity_usd: ComputedPerBlock, + pub inflation_rate: PercentPerBlock, + pub tx_velocity_btc: ComputedPerBlock, + pub tx_velocity_usd: ComputedPerBlock, } diff --git a/crates/brk_computer/src/cointime/reserve_risk/compute.rs b/crates/brk_computer/src/cointime/reserve_risk/compute.rs index 334304c11..1da180884 100644 --- a/crates/brk_computer/src/cointime/reserve_risk/compute.rs +++ b/crates/brk_computer/src/cointime/reserve_risk/compute.rs @@ -29,7 +29,7 @@ impl Vecs { exit, )?; - self.reserve_risk.height.compute_divide( + self.value.height.compute_divide( starting_indexes.height, &prices.price.usd.height, &self.hodl_bank, diff --git a/crates/brk_computer/src/cointime/reserve_risk/import.rs b/crates/brk_computer/src/cointime/reserve_risk/import.rs index 0dab20284..46eb88892 100644 --- a/crates/brk_computer/src/cointime/reserve_risk/import.rs +++ b/crates/brk_computer/src/cointime/reserve_risk/import.rs @@ -15,7 +15,7 @@ impl Vecs { Ok(Self { vocdd_median_1y: EagerVec::forced_import(db, "vocdd_median_1y", v1)?, hodl_bank: EagerVec::forced_import(db, "hodl_bank", v1)?, - reserve_risk: ComputedPerBlock::forced_import(db, "reserve_risk", v1, indexes)?, + value: ComputedPerBlock::forced_import(db, "reserve_risk", v1, indexes)?, }) } } diff --git a/crates/brk_computer/src/cointime/reserve_risk/vecs.rs b/crates/brk_computer/src/cointime/reserve_risk/vecs.rs index 1a3f08193..973e18afd 100644 --- a/crates/brk_computer/src/cointime/reserve_risk/vecs.rs +++ b/crates/brk_computer/src/cointime/reserve_risk/vecs.rs @@ -6,7 +6,7 @@ use crate::internal::ComputedPerBlock; #[derive(Traversable)] pub struct Vecs { + pub value: ComputedPerBlock, pub vocdd_median_1y: M::Stored>>, pub hodl_bank: M::Stored>>, - pub reserve_risk: ComputedPerBlock, } diff --git a/crates/brk_computer/src/distribution/metrics/cohort/all.rs b/crates/brk_computer/src/distribution/metrics/cohort/all.rs index ccf3776c5..e7564d37f 100644 --- a/crates/brk_computer/src/distribution/metrics/cohort/all.rs +++ b/crates/brk_computer/src/distribution/metrics/cohort/all.rs @@ -32,6 +32,7 @@ pub struct AllCohortMetrics { pub unrealized: Box>, #[traversable(wrap = "realized/sopr", rename = "adjusted")] pub asopr: Box>, + #[traversable(flatten)] pub relative: Box>, #[traversable(wrap = "supply", rename = "delta")] diff --git a/crates/brk_computer/src/distribution/metrics/cohort/basic.rs b/crates/brk_computer/src/distribution/metrics/cohort/basic.rs index c15725d7c..8eaaf1d3f 100644 --- a/crates/brk_computer/src/distribution/metrics/cohort/basic.rs +++ b/crates/brk_computer/src/distribution/metrics/cohort/basic.rs @@ -22,6 +22,7 @@ pub struct BasicCohortMetrics { pub activity: Box>, pub realized: Box>, pub unrealized: Box>, + #[traversable(flatten)] pub relative: Box>, } diff --git a/crates/brk_computer/src/distribution/metrics/cohort/core.rs b/crates/brk_computer/src/distribution/metrics/cohort/core.rs index 334fa3111..11d35bdd3 100644 --- a/crates/brk_computer/src/distribution/metrics/cohort/core.rs +++ b/crates/brk_computer/src/distribution/metrics/cohort/core.rs @@ -20,6 +20,7 @@ pub struct CoreCohortMetrics { pub activity: Box>, pub realized: Box>, pub unrealized: Box>, + #[traversable(flatten)] pub relative: Box>, } diff --git a/crates/brk_computer/src/distribution/metrics/cohort/extended.rs b/crates/brk_computer/src/distribution/metrics/cohort/extended.rs index f76c75244..a9b3117f8 100644 --- a/crates/brk_computer/src/distribution/metrics/cohort/extended.rs +++ b/crates/brk_computer/src/distribution/metrics/cohort/extended.rs @@ -28,6 +28,7 @@ pub struct ExtendedCohortMetrics { pub realized: Box>, pub cost_basis: Box>, pub unrealized: Box>, + #[traversable(flatten)] pub relative: Box>, #[traversable(wrap = "supply", rename = "delta")] diff --git a/crates/brk_computer/src/distribution/metrics/realized/adjusted.rs b/crates/brk_computer/src/distribution/metrics/realized/adjusted.rs index ae36c2ad1..35042eb9b 100644 --- a/crates/brk_computer/src/distribution/metrics/realized/adjusted.rs +++ b/crates/brk_computer/src/distribution/metrics/realized/adjusted.rs @@ -14,7 +14,9 @@ use crate::distribution::metrics::ImportConfig; pub struct AdjustedSopr { pub value_created: ComputedPerBlock, pub value_destroyed: ComputedPerBlock, + #[traversable(wrap = "value_created", rename = "sum")] pub value_created_sum: RollingWindows, + #[traversable(wrap = "value_destroyed", rename = "sum")] pub value_destroyed_sum: RollingWindows, pub ratio: RollingWindows, } diff --git a/crates/brk_computer/src/distribution/metrics/realized/core.rs b/crates/brk_computer/src/distribution/metrics/realized/core.rs index d87e964ff..3f0c15e93 100644 --- a/crates/brk_computer/src/distribution/metrics/realized/core.rs +++ b/crates/brk_computer/src/distribution/metrics/realized/core.rs @@ -47,7 +47,7 @@ pub struct RealizedCore { #[traversable(wrap = "cap", rename = "delta")] pub cap_delta: FiatRollingDelta1m, - #[traversable(wrap = "loss", rename = "neg")] + #[traversable(wrap = "loss", rename = "negative")] pub neg_loss: LazyPerBlock, pub net_pnl: PerBlockWithSum24h, pub sopr: RealizedSoprCore, diff --git a/crates/brk_computer/src/distribution/metrics/realized/full.rs b/crates/brk_computer/src/distribution/metrics/realized/full.rs index f8333c932..c06a9c716 100644 --- a/crates/brk_computer/src/distribution/metrics/realized/full.rs +++ b/crates/brk_computer/src/distribution/metrics/realized/full.rs @@ -32,9 +32,11 @@ pub struct RealizedProfit { pub rel_to_rcap: PercentPerBlock, pub value_created: ComputedPerBlock, pub value_destroyed: ComputedPerBlock, + #[traversable(wrap = "value_created", rename = "sum")] pub value_created_sum: RollingWindows, + #[traversable(wrap = "value_destroyed", rename = "sum")] pub value_destroyed_sum: RollingWindows, - pub flow: LazyPerBlock, + pub distribution_flow: LazyPerBlock, #[traversable(rename = "sum")] pub sum_extended: RollingWindowsFrom1w, } @@ -44,7 +46,9 @@ pub struct RealizedLoss { pub rel_to_rcap: PercentPerBlock, pub value_created: ComputedPerBlock, pub value_destroyed: ComputedPerBlock, + #[traversable(wrap = "value_created", rename = "sum")] pub value_created_sum: RollingWindows, + #[traversable(wrap = "value_destroyed", rename = "sum")] pub value_destroyed_sum: RollingWindows, pub capitulation_flow: LazyPerBlock, #[traversable(rename = "sum")] @@ -53,8 +57,7 @@ pub struct RealizedLoss { #[derive(Traversable)] pub struct RealizedGrossPnl { - #[traversable(flatten)] - pub value: FiatPerBlock, + pub raw: FiatPerBlock, pub sum: RollingWindows, pub sell_side_risk_ratio: PercentRollingWindows, } @@ -68,15 +71,17 @@ pub struct RealizedNetPnl { pub delta: FiatRollingDelta1m, #[traversable(rename = "delta")] pub delta_extended: FiatRollingDeltaExcept1m, + #[traversable(wrap = "change_1m", rename = "rel_to_rcap")] pub change_1m_rel_to_rcap: PercentPerBlock, + #[traversable(wrap = "change_1m", rename = "rel_to_mcap")] pub change_1m_rel_to_mcap: PercentPerBlock, } #[derive(Traversable)] pub struct RealizedSopr { - #[traversable(rename = "value_created_sum")] + #[traversable(wrap = "value_created", rename = "sum")] pub value_created_sum_extended: RollingWindowsFrom1w, - #[traversable(rename = "value_destroyed_sum")] + #[traversable(wrap = "value_destroyed", rename = "sum")] pub value_destroyed_sum_extended: RollingWindowsFrom1w, #[traversable(rename = "ratio")] pub ratio_extended: RollingWindowsFrom1w, @@ -103,6 +108,7 @@ pub struct RealizedInvestor { pub price_ratio: RatioPerBlock, pub lower_price_band: Price>, pub upper_price_band: Price>, + #[traversable(wrap = "cap", rename = "raw")] pub cap_raw: M::Stored>, pub price_ratio_percentiles: RatioPerBlockPercentiles, } @@ -161,7 +167,7 @@ impl RealizedFull { value_destroyed: profit_value_destroyed, value_created_sum: cfg.import("profit_value_created", v1)?, value_destroyed_sum: cfg.import("profit_value_destroyed", v1)?, - flow: profit_flow, + distribution_flow: profit_flow, sum_extended: cfg.import("realized_profit", v1)?, }; @@ -186,7 +192,7 @@ impl RealizedFull { // Gross PnL let gross_pnl = RealizedGrossPnl { - value: cfg.import("realized_gross_pnl", v0)?, + raw: cfg.import("realized_gross_pnl", v0)?, sum: cfg.import("gross_pnl_sum", v1)?, sell_side_risk_ratio: cfg.import("sell_side_risk_ratio", Version::new(2))?, }; @@ -546,7 +552,7 @@ impl RealizedFull { )?; // Gross PnL - self.gross_pnl.value.cents.height.compute_add( + self.gross_pnl.raw.cents.height.compute_add( starting_indexes.height, &self.core.minimal.profit.raw.cents.height, &self.core.minimal.loss.raw.cents.height, @@ -556,7 +562,7 @@ impl RealizedFull { self.gross_pnl.sum.compute_rolling_sum( starting_indexes.height, &window_starts, - &self.gross_pnl.value.cents.height, + &self.gross_pnl.raw.cents.height, exit, )?; diff --git a/crates/brk_computer/src/distribution/metrics/relative/extended_own_pnl.rs b/crates/brk_computer/src/distribution/metrics/relative/extended_own_pnl.rs index 5d4c75867..cc5182187 100644 --- a/crates/brk_computer/src/distribution/metrics/relative/extended_own_pnl.rs +++ b/crates/brk_computer/src/distribution/metrics/relative/extended_own_pnl.rs @@ -16,6 +16,7 @@ pub struct RelativeExtendedOwnPnl { pub unrealized_loss_rel_to_own_gross_pnl: PercentPerBlock, #[traversable(wrap = "unrealized/net_pnl", rename = "rel_to_own_gross_pnl")] pub net_unrealized_pnl_rel_to_own_gross_pnl: PercentPerBlock, + } impl RelativeExtendedOwnPnl { diff --git a/crates/brk_computer/src/distribution/metrics/relative/full.rs b/crates/brk_computer/src/distribution/metrics/relative/full.rs index b52253fc0..2a4baddbe 100644 --- a/crates/brk_computer/src/distribution/metrics/relative/full.rs +++ b/crates/brk_computer/src/distribution/metrics/relative/full.rs @@ -11,9 +11,9 @@ use crate::{ /// Full relative metrics (sth/lth/all tier). #[derive(Traversable)] pub struct RelativeFull { - #[traversable(wrap = "supply/in_profit", rename = "rel_to_own_supply")] + #[traversable(wrap = "unrealized/profit/supply", rename = "rel_to_own_supply")] pub supply_in_profit_rel_to_own_supply: PercentPerBlock, - #[traversable(wrap = "supply/in_loss", rename = "rel_to_own_supply")] + #[traversable(wrap = "unrealized/loss/supply", rename = "rel_to_own_supply")] pub supply_in_loss_rel_to_own_supply: PercentPerBlock, #[traversable(wrap = "unrealized/profit", rename = "rel_to_market_cap")] diff --git a/crates/brk_computer/src/distribution/metrics/relative/to_all.rs b/crates/brk_computer/src/distribution/metrics/relative/to_all.rs index 423860f65..544ccb631 100644 --- a/crates/brk_computer/src/distribution/metrics/relative/to_all.rs +++ b/crates/brk_computer/src/distribution/metrics/relative/to_all.rs @@ -12,9 +12,9 @@ use crate::distribution::metrics::ImportConfig; pub struct RelativeToAll { #[traversable(wrap = "supply", rename = "rel_to_circulating_supply")] pub supply_rel_to_circulating_supply: PercentPerBlock, - #[traversable(wrap = "supply/in_profit", rename = "rel_to_circulating_supply")] + #[traversable(wrap = "unrealized/profit/supply", rename = "rel_to_circulating_supply")] pub supply_in_profit_rel_to_circulating_supply: PercentPerBlock, - #[traversable(wrap = "supply/in_loss", rename = "rel_to_circulating_supply")] + #[traversable(wrap = "unrealized/loss/supply", rename = "rel_to_circulating_supply")] pub supply_in_loss_rel_to_circulating_supply: PercentPerBlock, } diff --git a/crates/brk_computer/src/distribution/metrics/unrealized/core.rs b/crates/brk_computer/src/distribution/metrics/unrealized/core.rs index d7a380e34..dfdd69bac 100644 --- a/crates/brk_computer/src/distribution/metrics/unrealized/core.rs +++ b/crates/brk_computer/src/distribution/metrics/unrealized/core.rs @@ -25,7 +25,7 @@ pub struct UnrealizedCore { #[traversable(flatten)] pub basic: UnrealizedBasic, - #[traversable(wrap = "loss", rename = "neg")] + #[traversable(wrap = "loss", rename = "negative")] pub neg_loss: LazyPerBlock, pub net_pnl: FiatPerBlock, } diff --git a/crates/brk_computer/src/internal/per_block/amount/with_sum_24h.rs b/crates/brk_computer/src/internal/per_block/amount/with_sum_24h.rs index 9dab07f06..c149725fe 100644 --- a/crates/brk_computer/src/internal/per_block/amount/with_sum_24h.rs +++ b/crates/brk_computer/src/internal/per_block/amount/with_sum_24h.rs @@ -8,7 +8,6 @@ use crate::internal::{AmountPerBlock, RollingWindow24hAmountPerBlock}; /// Amount per-block value (sats + cents) with 24h rolling sum (also amount). #[derive(Traversable)] pub struct AmountPerBlockWithSum24h { - #[traversable(flatten)] pub raw: AmountPerBlock, pub sum: RollingWindow24hAmountPerBlock, } diff --git a/crates/brk_computer/src/internal/per_block/fiat/with_sum_24h.rs b/crates/brk_computer/src/internal/per_block/fiat/with_sum_24h.rs index 6c356ac71..9b9627ea3 100644 --- a/crates/brk_computer/src/internal/per_block/fiat/with_sum_24h.rs +++ b/crates/brk_computer/src/internal/per_block/fiat/with_sum_24h.rs @@ -53,7 +53,6 @@ impl RollingWindow24hFiatPerBlock { /// Fiat per-block value (cents + usd) with 24h rolling sum (also fiat). #[derive(Traversable)] pub struct FiatPerBlockWithSum24h { - #[traversable(flatten)] pub raw: FiatPerBlock, pub sum: RollingWindow24hFiatPerBlock, } diff --git a/crates/brk_computer/src/market/indicators/compute.rs b/crates/brk_computer/src/market/indicators/compute.rs index 584a88968..faa7c0b2a 100644 --- a/crates/brk_computer/src/market/indicators/compute.rs +++ b/crates/brk_computer/src/market/indicators/compute.rs @@ -104,6 +104,32 @@ impl Vecs { // Gini (per height) gini::compute(&mut self.gini, distribution, starting_indexes, exit)?; + // RHODL Ratio: 1d-1w realized cap / 1y-2y realized cap + self.rhodl_ratio + .bps + .compute_binary::( + starting_indexes.height, + &distribution + .utxo_cohorts + .age_range + ._1d_to_1w + .metrics + .realized + .cap + .usd + .height, + &distribution + .utxo_cohorts + .age_range + ._1y_to_2y + .metrics + .realized + .cap + .usd + .height, + exit, + )?; + // NVT: market_cap / tx_volume_24h let market_cap = &distribution .utxo_cohorts diff --git a/crates/brk_computer/src/market/indicators/import.rs b/crates/brk_computer/src/market/indicators/import.rs index c2fba3cd9..0565943f6 100644 --- a/crates/brk_computer/src/market/indicators/import.rs +++ b/crates/brk_computer/src/market/indicators/import.rs @@ -8,7 +8,7 @@ use crate::{ internal::{ComputedPerBlock, RatioPerBlock, PercentPerBlock, Windows}, }; -const VERSION: Version = Version::ONE; +const VERSION: Version = Version::new(2); impl RsiChain { fn forced_import( @@ -117,6 +117,8 @@ impl Vecs { let pi_cycle = RatioPerBlock::forced_import_raw(db, "pi_cycle", v, indexes)?; + let rhodl_ratio = RatioPerBlock::forced_import_raw(db, "rhodl_ratio", v, indexes)?; + Ok(Self { puell_multiple: RatioPerBlock::forced_import_raw( db, @@ -131,6 +133,7 @@ impl Vecs { pi_cycle, macd, gini, + rhodl_ratio, }) } } diff --git a/crates/brk_computer/src/market/indicators/vecs.rs b/crates/brk_computer/src/market/indicators/vecs.rs index a0a5726a1..6bd40a884 100644 --- a/crates/brk_computer/src/market/indicators/vecs.rs +++ b/crates/brk_computer/src/market/indicators/vecs.rs @@ -42,4 +42,6 @@ pub struct Vecs { pub macd: Windows>, pub gini: PercentPerBlock, + + pub rhodl_ratio: RatioPerBlock, } diff --git a/modules/brk-client/index.js b/modules/brk-client/index.js index d559e794b..bc05f5233 100644 --- a/modules/brk-client/index.js +++ b/modules/brk-client/index.js @@ -1696,16 +1696,16 @@ function create_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern(client /** * @typedef {Object} CapGrossInvestorLossMvrvNetNuplPeakPriceProfitSentSoprPattern * @property {CentsDeltaRawRelUsdPattern} cap - * @property {CentsSellSumUsdPattern} grossPnl + * @property {RawSellSumPattern} grossPnl * @property {CapLowerPriceUpperPattern} investor - * @property {CapitulationCentsCumulativeNegRelSumUsdValuePattern} loss + * @property {CapitulationCumulativeNegativeRawRelSumValuePattern} loss * @property {MetricPattern1} mvrv * @property {ChangeCumulativeDeltaRawRelSumPattern} netPnl * @property {BpsRatioPattern} nupl * @property {CumulativeHeightRelPattern} peakRegret * @property {CentsSatsUsdPattern} price * @property {BpsPercentilesRatioStdPattern} priceRatio - * @property {CentsCumulativeFlowRelSumUsdValuePattern} profit + * @property {CumulativeDistributionRawRelSumValuePattern} profit * @property {_1m1w1y24hPattern} profitToLossRatio * @property {InPattern3} sent * @property {AdjustedRatioValuePattern} sopr @@ -1720,16 +1720,16 @@ function create_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern(client function createCapGrossInvestorLossMvrvNetNuplPeakPriceProfitSentSoprPattern(client, acc) { return { cap: createCentsDeltaRawRelUsdPattern(client, acc), - grossPnl: createCentsSellSumUsdPattern(client, acc), + grossPnl: createRawSellSumPattern(client, acc), investor: createCapLowerPriceUpperPattern(client, acc), - loss: createCapitulationCentsCumulativeNegRelSumUsdValuePattern(client, acc), + loss: createCapitulationCumulativeNegativeRawRelSumValuePattern(client, acc), mvrv: createMetricPattern1(client, _m(acc, 'mvrv')), netPnl: createChangeCumulativeDeltaRawRelSumPattern(client, _m(acc, 'net')), nupl: createBpsRatioPattern(client, _m(acc, 'nupl_ratio')), peakRegret: createCumulativeHeightRelPattern(client, _m(acc, 'realized_peak_regret')), price: createCentsSatsUsdPattern(client, _m(acc, 'realized_price')), priceRatio: createBpsPercentilesRatioStdPattern(client, _m(acc, 'realized_price_ratio')), - profit: createCentsCumulativeFlowRelSumUsdValuePattern(client, acc), + profit: createCumulativeDistributionRawRelSumValuePattern(client, acc), profitToLossRatio: create_1m1w1y24hPattern(client, _m(acc, 'realized_profit_to_loss_ratio')), sent: createInPattern3(client, _m(acc, 'sent_in')), sopr: createAdjustedRatioValuePattern(client, acc), @@ -1888,43 +1888,6 @@ function createAverageCumulativeHeightMaxMedianMinPct10Pct25Pct75Pct90SumPattern }; } -/** - * @typedef {Object} CapitulationCentsCumulativeNegRelSumUsdValuePattern - * @property {MetricPattern1} capitulationFlow - * @property {MetricPattern1} cents - * @property {MetricPattern1} cumulative - * @property {MetricPattern1} neg - * @property {BpsPercentRatioPattern} relToRcap - * @property {_1m1w1y24hPattern3} sum - * @property {MetricPattern1} usd - * @property {MetricPattern1} valueCreated - * @property {_1m1w1y24hPattern} valueCreatedSum - * @property {MetricPattern1} valueDestroyed - * @property {_1m1w1y24hPattern} valueDestroyedSum - */ - -/** - * Create a CapitulationCentsCumulativeNegRelSumUsdValuePattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {CapitulationCentsCumulativeNegRelSumUsdValuePattern} - */ -function createCapitulationCentsCumulativeNegRelSumUsdValuePattern(client, acc) { - return { - capitulationFlow: createMetricPattern1(client, _m(acc, 'capitulation_flow')), - cents: createMetricPattern1(client, _m(acc, 'realized_loss_cents')), - cumulative: createMetricPattern1(client, _m(acc, 'realized_loss_cumulative')), - neg: createMetricPattern1(client, _m(acc, 'neg_realized_loss')), - relToRcap: createBpsPercentRatioPattern(client, _m(acc, 'realized_loss_rel_to_realized_cap')), - sum: create_1m1w1y24hPattern3(client, _m(acc, 'realized_loss')), - usd: createMetricPattern1(client, _m(acc, 'realized_loss')), - valueCreated: createMetricPattern1(client, _m(acc, 'loss_value_created')), - valueCreatedSum: create_1m1w1y24hPattern(client, _m(acc, 'loss_value_created')), - valueDestroyed: createMetricPattern1(client, _m(acc, 'loss_value_destroyed')), - valueDestroyedSum: create_1m1w1y24hPattern(client, _m(acc, 'loss_value_destroyed')), - }; -} - /** * @typedef {Object} AverageGainsLossesRsiStochPattern * @property {MetricPattern1} averageGain @@ -1998,13 +1961,13 @@ function createBpsPct1Pct2Pct5Pct95Pct98Pct99RatioSmaPattern(client, acc) { /** * @typedef {Object} CapLossMvrvNetNuplPriceProfitSentSoprPattern * @property {CentsDeltaUsdPattern} cap - * @property {CentsCumulativeNegSumUsdPattern} loss + * @property {CumulativeNegativeRawSumPattern} loss * @property {MetricPattern1} mvrv - * @property {RawSumPattern} netPnl + * @property {RawSumPattern2} netPnl * @property {BpsRatioPattern} nupl * @property {CentsSatsUsdPattern} price * @property {BpsRatioPattern} priceRatio - * @property {CentsCumulativeSumUsdPattern} profit + * @property {CumulativeRawSumPattern} profit * @property {InPattern} sent * @property {RatioValuePattern} sopr */ @@ -2018,53 +1981,18 @@ function createBpsPct1Pct2Pct5Pct95Pct98Pct99RatioSmaPattern(client, acc) { function createCapLossMvrvNetNuplPriceProfitSentSoprPattern(client, acc) { return { cap: createCentsDeltaUsdPattern(client, _m(acc, 'realized_cap')), - loss: createCentsCumulativeNegSumUsdPattern(client, acc), + loss: createCumulativeNegativeRawSumPattern(client, acc), mvrv: createMetricPattern1(client, _m(acc, 'mvrv')), - netPnl: createRawSumPattern(client, _m(acc, 'net_realized_pnl')), + netPnl: createRawSumPattern2(client, _m(acc, 'net_realized_pnl')), nupl: createBpsRatioPattern(client, _m(acc, 'nupl_ratio')), price: createCentsSatsUsdPattern(client, _m(acc, 'realized_price')), priceRatio: createBpsRatioPattern(client, _m(acc, 'realized_price_ratio')), - profit: createCentsCumulativeSumUsdPattern(client, _m(acc, 'realized_profit')), + profit: createCumulativeRawSumPattern(client, _m(acc, 'realized_profit')), sent: createInPattern(client, _m(acc, 'sent_in')), sopr: createRatioValuePattern(client, acc), }; } -/** - * @typedef {Object} CentsCumulativeFlowRelSumUsdValuePattern - * @property {MetricPattern1} cents - * @property {MetricPattern1} cumulative - * @property {MetricPattern1} flow - * @property {BpsPercentRatioPattern} relToRcap - * @property {_1m1w1y24hPattern3} sum - * @property {MetricPattern1} usd - * @property {MetricPattern1} valueCreated - * @property {_1m1w1y24hPattern} valueCreatedSum - * @property {MetricPattern1} valueDestroyed - * @property {_1m1w1y24hPattern} valueDestroyedSum - */ - -/** - * Create a CentsCumulativeFlowRelSumUsdValuePattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {CentsCumulativeFlowRelSumUsdValuePattern} - */ -function createCentsCumulativeFlowRelSumUsdValuePattern(client, acc) { - return { - cents: createMetricPattern1(client, _m(acc, 'realized_profit_cents')), - cumulative: createMetricPattern1(client, _m(acc, 'realized_profit_cumulative')), - flow: createMetricPattern1(client, _m(acc, 'profit_flow')), - relToRcap: createBpsPercentRatioPattern(client, _m(acc, 'realized_profit_rel_to_realized_cap')), - sum: create_1m1w1y24hPattern3(client, _m(acc, 'realized_profit')), - usd: createMetricPattern1(client, _m(acc, 'realized_profit')), - valueCreated: createMetricPattern1(client, _m(acc, 'profit_value_created')), - valueCreatedSum: create_1m1w1y24hPattern(client, _m(acc, 'profit_value_created')), - valueDestroyed: createMetricPattern1(client, _m(acc, 'profit_value_destroyed')), - valueDestroyedSum: create_1m1w1y24hPattern(client, _m(acc, 'profit_value_destroyed')), - }; -} - /** * @typedef {Object} AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern * @property {MetricPattern1} all @@ -2198,12 +2126,12 @@ function create_1m1w1y24hBtcCentsSatsUsdPattern(client, acc) { /** * @typedef {Object} CapLossMvrvNuplPriceProfitSoprPattern * @property {CentsUsdPattern} cap - * @property {CentsSumUsdPattern} loss + * @property {RawSumPattern} loss * @property {MetricPattern1} mvrv * @property {BpsRatioPattern} nupl * @property {CentsSatsUsdPattern} price * @property {BpsRatioPattern} priceRatio - * @property {CentsSumUsdPattern} profit + * @property {RawSumPattern} profit * @property {ValuePattern} sopr */ @@ -2216,16 +2144,47 @@ function create_1m1w1y24hBtcCentsSatsUsdPattern(client, acc) { function createCapLossMvrvNuplPriceProfitSoprPattern(client, acc) { return { cap: createCentsUsdPattern(client, _m(acc, 'realized_cap')), - loss: createCentsSumUsdPattern(client, _m(acc, 'realized_loss')), + loss: createRawSumPattern(client, _m(acc, 'realized_loss')), mvrv: createMetricPattern1(client, _m(acc, 'mvrv')), nupl: createBpsRatioPattern(client, _m(acc, 'nupl_ratio')), price: createCentsSatsUsdPattern(client, _m(acc, 'realized_price')), priceRatio: createBpsRatioPattern(client, _m(acc, 'realized_price_ratio')), - profit: createCentsSumUsdPattern(client, _m(acc, 'realized_profit')), + profit: createRawSumPattern(client, _m(acc, 'realized_profit')), sopr: createValuePattern(client, _m(acc, 'value')), }; } +/** + * @typedef {Object} CapitulationCumulativeNegativeRawRelSumValuePattern + * @property {MetricPattern1} capitulationFlow + * @property {MetricPattern1} cumulative + * @property {MetricPattern1} negative + * @property {CentsUsdPattern} raw + * @property {BpsPercentRatioPattern} relToRcap + * @property {_1m1w1y24hPattern4} sum + * @property {BaseSumPattern} valueCreated + * @property {BaseSumPattern} valueDestroyed + */ + +/** + * Create a CapitulationCumulativeNegativeRawRelSumValuePattern pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {CapitulationCumulativeNegativeRawRelSumValuePattern} + */ +function createCapitulationCumulativeNegativeRawRelSumValuePattern(client, acc) { + return { + capitulationFlow: createMetricPattern1(client, _m(acc, 'capitulation_flow')), + cumulative: createMetricPattern1(client, _m(acc, 'realized_loss_cumulative')), + negative: createMetricPattern1(client, _m(acc, 'neg_realized_loss')), + raw: createCentsUsdPattern(client, _m(acc, 'realized_loss')), + relToRcap: createBpsPercentRatioPattern(client, _m(acc, 'realized_loss_rel_to_realized_cap')), + sum: create_1m1w1y24hPattern4(client, _m(acc, 'realized_loss')), + valueCreated: createBaseSumPattern(client, _m(acc, 'loss_value_created')), + valueDestroyed: createBaseSumPattern(client, _m(acc, 'loss_value_destroyed')), + }; +} + /** * @typedef {Object} Pct1Pct2Pct5Pct95Pct98Pct99SmaPattern * @property {BpsPriceRatioPattern} pct1 @@ -2349,60 +2308,31 @@ function create_1m1w1y24hBpsPercentRatioPattern(client, acc) { } /** - * @typedef {Object} _24hChangeRatePattern - * @property {BpsCentsPercentRatioUsdPattern} _24h - * @property {_1mPattern3} change - * @property {CentsUsdPattern} change1w - * @property {CentsUsdPattern} change1y - * @property {_1mPattern2} rate - * @property {BpsPercentRatioPattern} rate1w - * @property {BpsPercentRatioPattern} rate1y - */ - -/** - * Create a _24hChangeRatePattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {_24hChangeRatePattern} - */ -function create_24hChangeRatePattern(client, acc) { - return { - _24h: createBpsCentsPercentRatioUsdPattern(client, acc), - change: create_1mPattern3(client, _m(acc, 'change_1m')), - change1w: createCentsUsdPattern(client, _m(acc, 'change_1w')), - change1y: createCentsUsdPattern(client, _m(acc, 'change_1y')), - rate: create_1mPattern2(client, _m(acc, 'rate_1m')), - rate1w: createBpsPercentRatioPattern(client, _m(acc, 'rate_1w')), - rate1y: createBpsPercentRatioPattern(client, _m(acc, 'rate_1y')), - }; -} - -/** - * @typedef {Object} ChangeCumulativeDeltaRawRelSumPattern - * @property {BpsPercentRatioPattern} change1mRelToMcap - * @property {BpsPercentRatioPattern} change1mRelToRcap - * @property {MetricPattern1} cumulative - * @property {_24hChangeRatePattern} delta - * @property {MetricPattern1} raw + * @typedef {Object} CumulativeDistributionRawRelSumValuePattern + * @property {MetricPattern1} cumulative + * @property {MetricPattern1} distributionFlow + * @property {CentsUsdPattern} raw * @property {BpsPercentRatioPattern} relToRcap - * @property {_1m1w1y24hPattern} sum + * @property {_1m1w1y24hPattern4} sum + * @property {BaseSumPattern} valueCreated + * @property {BaseSumPattern} valueDestroyed */ /** - * Create a ChangeCumulativeDeltaRawRelSumPattern pattern node + * Create a CumulativeDistributionRawRelSumValuePattern pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {ChangeCumulativeDeltaRawRelSumPattern} + * @returns {CumulativeDistributionRawRelSumValuePattern} */ -function createChangeCumulativeDeltaRawRelSumPattern(client, acc) { +function createCumulativeDistributionRawRelSumValuePattern(client, acc) { return { - change1mRelToMcap: createBpsPercentRatioPattern(client, _m(acc, 'pnl_change_1m_rel_to_market_cap')), - change1mRelToRcap: createBpsPercentRatioPattern(client, _m(acc, 'pnl_change_1m_rel_to_realized_cap')), - cumulative: createMetricPattern1(client, _m(acc, 'realized_pnl_cumulative')), - delta: create_24hChangeRatePattern(client, _m(acc, 'pnl_delta')), - raw: createMetricPattern1(client, _m(acc, 'realized_pnl')), - relToRcap: createBpsPercentRatioPattern(client, _m(acc, 'realized_pnl_rel_to_realized_cap')), - sum: create_1m1w1y24hPattern(client, _m(acc, 'realized_pnl')), + cumulative: createMetricPattern1(client, _m(acc, 'realized_profit_cumulative')), + distributionFlow: createMetricPattern1(client, _m(acc, 'profit_flow')), + raw: createCentsUsdPattern(client, _m(acc, 'realized_profit')), + relToRcap: createBpsPercentRatioPattern(client, _m(acc, 'realized_profit_rel_to_realized_cap')), + sum: create_1m1w1y24hPattern4(client, _m(acc, 'realized_profit')), + valueCreated: createBaseSumPattern(client, _m(acc, 'profit_value_created')), + valueDestroyed: createBaseSumPattern(client, _m(acc, 'profit_value_destroyed')), }; } @@ -2411,9 +2341,9 @@ function createChangeCumulativeDeltaRawRelSumPattern(client, acc) { * @property {CentsUsdPattern} grossPnl * @property {InPattern5} investedCapital * @property {InPattern2} investorCap - * @property {CentsNegSumSupplyUsdPattern} loss + * @property {NegativeRawSumSupplyPattern} loss * @property {CentsUsdPattern} netPnl - * @property {CentsSumSupplyUsdPattern} profit + * @property {RawSumSupplyPattern} profit * @property {GreedNetPainPattern} sentiment */ @@ -2428,9 +2358,9 @@ function createGrossInvestedInvestorLossNetProfitSentimentPattern(client, acc) { grossPnl: createCentsUsdPattern(client, _m(acc, 'unrealized_gross_pnl')), investedCapital: createInPattern5(client, _m(acc, 'invested_capital_in')), investorCap: createInPattern2(client, _m(acc, 'investor_cap_in')), - loss: createCentsNegSumSupplyUsdPattern(client, acc), + loss: createNegativeRawSumSupplyPattern(client, acc), netPnl: createCentsUsdPattern(client, _m(acc, 'net_unrealized_pnl')), - profit: createCentsSumSupplyUsdPattern(client, acc), + profit: createRawSumSupplyPattern(client, acc), sentiment: createGreedNetPainPattern(client, acc), }; } @@ -2489,36 +2419,9 @@ function createActivityOutputsRealizedRelativeSupplyUnrealizedPattern2(client, a }; } -/** - * @typedef {Object} AdjustedRatioValuePattern - * @property {RatioValuePattern2} adjusted - * @property {_1m1w1y24hPattern} ratio - * @property {RawSumPattern} valueCreated - * @property {_1m1w1yPattern} valueCreatedSum - * @property {RawSumPattern} valueDestroyed - * @property {_1m1w1yPattern} valueDestroyedSum - */ - -/** - * Create a AdjustedRatioValuePattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {AdjustedRatioValuePattern} - */ -function createAdjustedRatioValuePattern(client, acc) { - return { - adjusted: createRatioValuePattern2(client, _m(acc, 'adjusted')), - ratio: create_1m1w1y24hPattern(client, _m(acc, 'sopr')), - valueCreated: createRawSumPattern(client, _m(acc, 'value_created')), - valueCreatedSum: create_1m1w1yPattern(client, _m(acc, 'value_created')), - valueDestroyed: createRawSumPattern(client, _m(acc, 'value_destroyed')), - valueDestroyedSum: create_1m1w1yPattern(client, _m(acc, 'value_destroyed')), - }; -} - /** * @typedef {Object} CapLowerPriceUpperPattern - * @property {MetricPattern18} capRaw + * @property {RawPattern} cap * @property {CentsSatsUsdPattern} lowerPriceBand * @property {CentsSatsUsdPattern} price * @property {BpsRatioPattern} priceRatio @@ -2534,7 +2437,7 @@ function createAdjustedRatioValuePattern(client, acc) { */ function createCapLowerPriceUpperPattern(client, acc) { return { - capRaw: createMetricPattern18(client, _m(acc, 'investor_cap_raw')), + cap: createRawPattern(client, _m(acc, 'investor_cap_raw')), lowerPriceBand: createCentsSatsUsdPattern(client, _m(acc, 'lower_price_band')), price: createCentsSatsUsdPattern(client, _m(acc, 'investor_price')), priceRatio: createBpsRatioPattern(client, _m(acc, 'investor_price_ratio')), @@ -2543,6 +2446,33 @@ function createCapLowerPriceUpperPattern(client, acc) { }; } +/** + * @typedef {Object} ChangeCumulativeDeltaRawRelSumPattern + * @property {RelPattern2} change1m + * @property {MetricPattern1} cumulative + * @property {ChangeRatePattern4} delta + * @property {MetricPattern1} raw + * @property {BpsPercentRatioPattern} relToRcap + * @property {_1m1w1y24hPattern} sum + */ + +/** + * Create a ChangeCumulativeDeltaRawRelSumPattern pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {ChangeCumulativeDeltaRawRelSumPattern} + */ +function createChangeCumulativeDeltaRawRelSumPattern(client, acc) { + return { + change1m: createRelPattern2(client, _m(acc, 'pnl_change_1m_rel_to')), + cumulative: createMetricPattern1(client, _m(acc, 'realized_pnl_cumulative')), + delta: createChangeRatePattern4(client, _m(acc, 'pnl_delta')), + raw: createMetricPattern1(client, _m(acc, 'realized_pnl')), + relToRcap: createBpsPercentRatioPattern(client, _m(acc, 'realized_pnl_rel_to_realized_cap')), + sum: create_1m1w1y24hPattern(client, _m(acc, 'realized_pnl')), + }; +} + /** * @typedef {Object} AddrOutputsRealizedSupplyPattern * @property {MetricPattern1} addrCount @@ -2568,37 +2498,12 @@ function createAddrOutputsRealizedSupplyPattern(client, acc) { }; } -/** - * @typedef {Object} BpsCentsPercentRatioUsdPattern - * @property {MetricPattern1} bps - * @property {MetricPattern1} cents - * @property {MetricPattern1} percent - * @property {MetricPattern1} ratio - * @property {MetricPattern1} usd - */ - -/** - * Create a BpsCentsPercentRatioUsdPattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {BpsCentsPercentRatioUsdPattern} - */ -function createBpsCentsPercentRatioUsdPattern(client, acc) { - return { - bps: createMetricPattern1(client, _m(acc, 'rate_24h_bps')), - cents: createMetricPattern1(client, _m(acc, 'change_24h_cents')), - percent: createMetricPattern1(client, _m(acc, 'rate_24h')), - ratio: createMetricPattern1(client, _m(acc, 'rate_24h_ratio')), - usd: createMetricPattern1(client, _m(acc, 'change_24h')), - }; -} - /** * @typedef {Object} BtcCentsSatsSumUsdPattern2 * @property {MetricPattern1} btc * @property {MetricPattern1} cents * @property {MetricPattern1} sats - * @property {_1m1w1y24hPattern4} sum + * @property {_1m1w1y24hPattern5} sum * @property {MetricPattern1} usd */ @@ -2613,7 +2518,7 @@ function createBtcCentsSatsSumUsdPattern2(client, acc) { btc: createMetricPattern1(client, acc), cents: createMetricPattern1(client, _m(acc, 'cents')), sats: createMetricPattern1(client, _m(acc, 'sats')), - sum: create_1m1w1y24hPattern4(client, acc), + sum: create_1m1w1y24hPattern5(client, acc), usd: createMetricPattern1(client, _m(acc, 'usd')), }; } @@ -2643,35 +2548,10 @@ function createBtcCentsSatsSumUsdPattern(client, acc) { }; } -/** - * @typedef {Object} CentsCumulativeNegSumUsdPattern - * @property {MetricPattern1} cents - * @property {MetricPattern1} cumulative - * @property {MetricPattern1} neg - * @property {_24hPattern} sum - * @property {MetricPattern1} usd - */ - -/** - * Create a CentsCumulativeNegSumUsdPattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {CentsCumulativeNegSumUsdPattern} - */ -function createCentsCumulativeNegSumUsdPattern(client, acc) { - return { - cents: createMetricPattern1(client, _m(acc, 'realized_loss_cents')), - cumulative: createMetricPattern1(client, _m(acc, 'realized_loss_cumulative')), - neg: createMetricPattern1(client, _m(acc, 'neg_realized_loss')), - sum: create_24hPattern(client, _m(acc, 'realized_loss_24h')), - usd: createMetricPattern1(client, _m(acc, 'realized_loss')), - }; -} - /** * @typedef {Object} CentsDeltaRawRelUsdPattern * @property {MetricPattern1} cents - * @property {_24hChangeRatePattern} delta + * @property {ChangeRatePattern4} delta * @property {MetricPattern18} raw * @property {BpsPercentRatioPattern} relToOwnMcap * @property {MetricPattern1} usd @@ -2686,44 +2566,19 @@ function createCentsCumulativeNegSumUsdPattern(client, acc) { function createCentsDeltaRawRelUsdPattern(client, acc) { return { cents: createMetricPattern1(client, _m(acc, 'realized_cap_cents')), - delta: create_24hChangeRatePattern(client, _m(acc, 'realized_cap_delta')), + delta: createChangeRatePattern4(client, _m(acc, 'realized_cap_delta')), raw: createMetricPattern18(client, _m(acc, 'cap_raw')), relToOwnMcap: createBpsPercentRatioPattern(client, _m(acc, 'realized_cap_rel_to_own_market_cap')), usd: createMetricPattern1(client, _m(acc, 'realized_cap')), }; } -/** - * @typedef {Object} CentsNegSumSupplyUsdPattern - * @property {MetricPattern1} cents - * @property {MetricPattern1} neg - * @property {_24hPattern} sum - * @property {BtcCentsSatsUsdPattern} supply - * @property {MetricPattern1} usd - */ - -/** - * Create a CentsNegSumSupplyUsdPattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {CentsNegSumSupplyUsdPattern} - */ -function createCentsNegSumSupplyUsdPattern(client, acc) { - return { - cents: createMetricPattern1(client, _m(acc, 'unrealized_loss_cents')), - neg: createMetricPattern1(client, _m(acc, 'neg_unrealized_loss')), - sum: create_24hPattern(client, _m(acc, 'unrealized_loss_24h')), - supply: createBtcCentsSatsUsdPattern(client, _m(acc, 'supply_in_loss')), - usd: createMetricPattern1(client, _m(acc, 'unrealized_loss')), - }; -} - /** * @typedef {Object} CoinblocksCoindaysDormancySentVelocityPattern * @property {CumulativeRawPattern} coinblocksDestroyed - * @property {CumulativeRawSumPattern} coindaysDestroyed + * @property {CumulativeRawSumPattern2} coindaysDestroyed * @property {MetricPattern1} dormancy - * @property {RawSumPattern2} sent + * @property {RawSumPattern3} sent * @property {MetricPattern1} velocity */ @@ -2736,9 +2591,9 @@ function createCentsNegSumSupplyUsdPattern(client, acc) { function createCoinblocksCoindaysDormancySentVelocityPattern(client, acc) { return { coinblocksDestroyed: createCumulativeRawPattern(client, _m(acc, 'coinblocks_destroyed')), - coindaysDestroyed: createCumulativeRawSumPattern(client, _m(acc, 'coindays_destroyed')), + coindaysDestroyed: createCumulativeRawSumPattern2(client, _m(acc, 'coindays_destroyed')), dormancy: createMetricPattern1(client, _m(acc, 'dormancy')), - sent: createRawSumPattern2(client, _m(acc, 'sent')), + sent: createRawSumPattern3(client, _m(acc, 'sent')), velocity: createMetricPattern1(client, _m(acc, 'velocity')), }; } @@ -2772,9 +2627,9 @@ function createEmaHistogramLineSignalPattern(client, acc) { * @typedef {Object} InvestedInvestorLossNetProfitPattern * @property {InPattern2} investedCapital * @property {InPattern2} investorCap - * @property {CentsNegSumSupplyUsdPattern} loss + * @property {NegativeRawSumSupplyPattern} loss * @property {CentsUsdPattern} netPnl - * @property {CentsSumSupplyUsdPattern} profit + * @property {RawSumSupplyPattern} profit */ /** @@ -2787,9 +2642,9 @@ function createInvestedInvestorLossNetProfitPattern(client, acc) { return { investedCapital: createInPattern2(client, _m(acc, 'invested_capital_in')), investorCap: createInPattern2(client, _m(acc, 'investor_cap_in')), - loss: createCentsNegSumSupplyUsdPattern(client, acc), + loss: createNegativeRawSumSupplyPattern(client, acc), netPnl: createCentsUsdPattern(client, _m(acc, 'net_unrealized_pnl')), - profit: createCentsSumSupplyUsdPattern(client, acc), + profit: createRawSumSupplyPattern(client, acc), }; } @@ -2894,7 +2749,7 @@ function create_1m1w1y24hPattern2(client, acc) { } /** - * @typedef {Object} _1m1w1y24hPattern7 + * @typedef {Object} _1m1w1y24hPattern8 * @property {BtcCentsSatsUsdPattern} _1m * @property {BtcCentsSatsUsdPattern} _1w * @property {BtcCentsSatsUsdPattern} _1y @@ -2902,12 +2757,12 @@ function create_1m1w1y24hPattern2(client, acc) { */ /** - * Create a _1m1w1y24hPattern7 pattern node + * Create a _1m1w1y24hPattern8 pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {_1m1w1y24hPattern7} + * @returns {_1m1w1y24hPattern8} */ -function create_1m1w1y24hPattern7(client, acc) { +function create_1m1w1y24hPattern8(client, acc) { return { _1m: createBtcCentsSatsUsdPattern(client, _m(acc, '1m')), _1w: createBtcCentsSatsUsdPattern(client, _m(acc, '1w')), @@ -2917,7 +2772,7 @@ function create_1m1w1y24hPattern7(client, acc) { } /** - * @typedef {Object} _1m1w1y24hPattern3 + * @typedef {Object} _1m1w1y24hPattern4 * @property {MetricPattern1} _1m * @property {MetricPattern1} _1w * @property {MetricPattern1} _1y @@ -2925,12 +2780,12 @@ function create_1m1w1y24hPattern7(client, acc) { */ /** - * Create a _1m1w1y24hPattern3 pattern node + * Create a _1m1w1y24hPattern4 pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {_1m1w1y24hPattern3} + * @returns {_1m1w1y24hPattern4} */ -function create_1m1w1y24hPattern3(client, acc) { +function create_1m1w1y24hPattern4(client, acc) { return { _1m: createMetricPattern1(client, _m(acc, '1m')), _1w: createMetricPattern1(client, _m(acc, '1w')), @@ -2963,7 +2818,30 @@ function create_1m1w1y2wPattern(client, acc) { } /** - * @typedef {Object} _1m1w1y24hPattern4 + * @typedef {Object} _1m1w1y24hPattern3 + * @property {CentsUsdPattern} _1m + * @property {CentsUsdPattern} _1w + * @property {CentsUsdPattern} _1y + * @property {CentsUsdPattern} _24h + */ + +/** + * Create a _1m1w1y24hPattern3 pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {_1m1w1y24hPattern3} + */ +function create_1m1w1y24hPattern3(client, acc) { + return { + _1m: createCentsUsdPattern(client, _m(acc, '1m')), + _1w: createCentsUsdPattern(client, _m(acc, '1w')), + _1y: createCentsUsdPattern(client, _m(acc, '1y')), + _24h: createCentsUsdPattern(client, _m(acc, '24h')), + }; +} + +/** + * @typedef {Object} _1m1w1y24hPattern5 * @property {MetricPattern1} _1m * @property {MetricPattern1} _1w * @property {MetricPattern1} _1y @@ -2971,12 +2849,12 @@ function create_1m1w1y2wPattern(client, acc) { */ /** - * Create a _1m1w1y24hPattern4 pattern node + * Create a _1m1w1y24hPattern5 pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {_1m1w1y24hPattern4} + * @returns {_1m1w1y24hPattern5} */ -function create_1m1w1y24hPattern4(client, acc) { +function create_1m1w1y24hPattern5(client, acc) { return { _1m: createMetricPattern1(client, _m(acc, '1m')), _1w: createMetricPattern1(client, _m(acc, '1w')), @@ -3008,6 +2886,29 @@ function create_1y2y4yAllPattern(client, acc) { }; } +/** + * @typedef {Object} AdjustedRatioValuePattern + * @property {RatioValuePattern2} adjusted + * @property {_1m1w1y24hPattern} ratio + * @property {RawSumPattern3} valueCreated + * @property {RawSumPattern3} valueDestroyed + */ + +/** + * Create a AdjustedRatioValuePattern pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {AdjustedRatioValuePattern} + */ +function createAdjustedRatioValuePattern(client, acc) { + return { + adjusted: createRatioValuePattern2(client, _m(acc, 'adjusted')), + ratio: create_1m1w1y24hPattern(client, _m(acc, 'sopr')), + valueCreated: createRawSumPattern3(client, _m(acc, 'value_created')), + valueDestroyed: createRawSumPattern3(client, _m(acc, 'value_destroyed')), + }; +} + /** * @typedef {Object} BothReactivatedReceivingSendingPattern * @property {_1m1w1y24hHeightPattern} both @@ -3078,71 +2979,25 @@ function createBtcCentsSatsUsdPattern(client, acc) { } /** - * @typedef {Object} CentsCumulativeSumUsdPattern - * @property {MetricPattern1} cents + * @typedef {Object} CumulativeNegativeRawSumPattern * @property {MetricPattern1} cumulative + * @property {MetricPattern1} negative + * @property {CentsUsdPattern} raw * @property {_24hPattern} sum - * @property {MetricPattern1} usd */ /** - * Create a CentsCumulativeSumUsdPattern pattern node + * Create a CumulativeNegativeRawSumPattern pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {CentsCumulativeSumUsdPattern} + * @returns {CumulativeNegativeRawSumPattern} */ -function createCentsCumulativeSumUsdPattern(client, acc) { +function createCumulativeNegativeRawSumPattern(client, acc) { return { - cents: createMetricPattern1(client, _m(acc, 'cents')), - cumulative: createMetricPattern1(client, _m(acc, 'cumulative')), - sum: create_24hPattern(client, _m(acc, '24h')), - usd: createMetricPattern1(client, acc), - }; -} - -/** - * @typedef {Object} CentsSellSumUsdPattern - * @property {MetricPattern1} cents - * @property {_1m1w1y24hPattern2} sellSideRiskRatio - * @property {_1m1w1y24hPattern} sum - * @property {MetricPattern1} usd - */ - -/** - * Create a CentsSellSumUsdPattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {CentsSellSumUsdPattern} - */ -function createCentsSellSumUsdPattern(client, acc) { - return { - cents: createMetricPattern1(client, _m(acc, 'realized_gross_pnl_cents')), - sellSideRiskRatio: create_1m1w1y24hPattern2(client, _m(acc, 'sell_side_risk_ratio')), - sum: create_1m1w1y24hPattern(client, _m(acc, 'gross_pnl_sum')), - usd: createMetricPattern1(client, _m(acc, 'realized_gross_pnl')), - }; -} - -/** - * @typedef {Object} CentsSumSupplyUsdPattern - * @property {MetricPattern1} cents - * @property {_24hPattern} sum - * @property {BtcCentsSatsUsdPattern} supply - * @property {MetricPattern1} usd - */ - -/** - * Create a CentsSumSupplyUsdPattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {CentsSumSupplyUsdPattern} - */ -function createCentsSumSupplyUsdPattern(client, acc) { - return { - cents: createMetricPattern1(client, _m(acc, 'unrealized_profit_cents')), - sum: create_24hPattern(client, _m(acc, 'unrealized_profit_24h')), - supply: createBtcCentsSatsUsdPattern(client, _m(acc, 'supply_in_profit')), - usd: createMetricPattern1(client, _m(acc, 'unrealized_profit')), + cumulative: createMetricPattern1(client, _m(acc, 'realized_loss_cumulative')), + negative: createMetricPattern1(client, _m(acc, 'neg_realized_loss')), + raw: createCentsUsdPattern(client, _m(acc, 'realized_loss')), + sum: create_24hPattern(client, _m(acc, 'realized_loss_24h')), }; } @@ -3169,6 +3024,29 @@ function createInvestedMaxMinPercentilesPattern(client, acc) { }; } +/** + * @typedef {Object} NegativeRawSumSupplyPattern + * @property {MetricPattern1} negative + * @property {CentsUsdPattern} raw + * @property {_24hPattern} sum + * @property {BtcCentsSatsUsdPattern} supply + */ + +/** + * Create a NegativeRawSumSupplyPattern pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {NegativeRawSumSupplyPattern} + */ +function createNegativeRawSumSupplyPattern(client, acc) { + return { + negative: createMetricPattern1(client, _m(acc, 'neg_unrealized_loss')), + raw: createCentsUsdPattern(client, _m(acc, 'unrealized_loss')), + sum: create_24hPattern(client, _m(acc, 'unrealized_loss_24h')), + supply: createBtcCentsSatsUsdPattern(client, _m(acc, 'supply_in_loss')), + }; +} + /** * @typedef {Object} OutputsRealizedSupplyUnrealizedPattern * @property {UtxoPattern} outputs @@ -3221,7 +3099,7 @@ function create_1m1w1y24hPattern(client, acc) { * @typedef {Object} BaseCumulativeSumPattern * @property {BtcCentsSatsUsdPattern} base * @property {BtcCentsSatsUsdPattern} cumulative - * @property {_1m1w1y24hPattern7} sum + * @property {_1m1w1y24hPattern8} sum */ /** @@ -3234,7 +3112,7 @@ function createBaseCumulativeSumPattern(client, acc) { return { base: createBtcCentsSatsUsdPattern(client, acc), cumulative: createBtcCentsSatsUsdPattern(client, _m(acc, 'cumulative')), - sum: create_1m1w1y24hPattern7(client, _m(acc, 'sum')), + sum: create_1m1w1y24hPattern8(client, _m(acc, 'sum')), }; } @@ -3385,27 +3263,6 @@ function createCentsSatsUsdPattern(client, acc) { }; } -/** - * @typedef {Object} CentsSumUsdPattern - * @property {MetricPattern1} cents - * @property {_24hPattern} sum - * @property {MetricPattern1} usd - */ - -/** - * Create a CentsSumUsdPattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {CentsSumUsdPattern} - */ -function createCentsSumUsdPattern(client, acc) { - return { - cents: createMetricPattern1(client, _m(acc, 'cents')), - sum: create_24hPattern(client, _m(acc, '24h')), - usd: createMetricPattern1(client, acc), - }; -} - /** * @typedef {Object} CumulativeHeightRelPattern * @property {MetricPattern1} cumulative @@ -3429,9 +3286,9 @@ function createCumulativeHeightRelPattern(client, acc) { /** * @typedef {Object} CumulativeRawSumPattern - * @property {MetricPattern1} cumulative - * @property {MetricPattern1} raw - * @property {_1m1w1y24hPattern} sum + * @property {MetricPattern1} cumulative + * @property {CentsUsdPattern} raw + * @property {_24hPattern} sum */ /** @@ -3441,6 +3298,27 @@ function createCumulativeHeightRelPattern(client, acc) { * @returns {CumulativeRawSumPattern} */ function createCumulativeRawSumPattern(client, acc) { + return { + cumulative: createMetricPattern1(client, _m(acc, 'cumulative')), + raw: createCentsUsdPattern(client, acc), + sum: create_24hPattern(client, _m(acc, '24h')), + }; +} + +/** + * @typedef {Object} CumulativeRawSumPattern2 + * @property {MetricPattern1} cumulative + * @property {MetricPattern1} raw + * @property {_1m1w1y24hPattern} sum + */ + +/** + * Create a CumulativeRawSumPattern2 pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {CumulativeRawSumPattern2} + */ +function createCumulativeRawSumPattern2(client, acc) { return { cumulative: createMetricPattern1(client, _m(acc, 'cumulative')), raw: createMetricPattern1(client, acc), @@ -3534,8 +3412,8 @@ function createInRelPattern(client, acc) { /** * @typedef {Object} InRelPattern2 - * @property {RelPattern5} inLoss - * @property {RelPattern5} inProfit + * @property {RelPattern6} inLoss + * @property {RelPattern6} inProfit * @property {BpsPercentRatioPattern} relToCirculatingSupply */ @@ -3547,17 +3425,17 @@ function createInRelPattern(client, acc) { */ function createInRelPattern2(client, acc) { return { - inLoss: createRelPattern5(client, _m(acc, 'in_loss_rel_to')), - inProfit: createRelPattern5(client, _m(acc, 'in_profit_rel_to')), + inLoss: createRelPattern6(client, _m(acc, 'in_loss_rel_to')), + inProfit: createRelPattern6(client, _m(acc, 'in_profit_rel_to')), relToCirculatingSupply: createBpsPercentRatioPattern(client, _m(acc, 'rel_to_circulating_supply')), }; } /** * @typedef {Object} LossNetProfitPattern2 - * @property {CentsNegSumSupplyUsdPattern} loss + * @property {NegativeRawSumSupplyPattern} loss * @property {CentsUsdPattern} netPnl - * @property {CentsSumSupplyUsdPattern} profit + * @property {RawSumSupplyPattern} profit */ /** @@ -3568,17 +3446,17 @@ function createInRelPattern2(client, acc) { */ function createLossNetProfitPattern2(client, acc) { return { - loss: createCentsNegSumSupplyUsdPattern(client, acc), + loss: createNegativeRawSumSupplyPattern(client, acc), netPnl: createCentsUsdPattern(client, _m(acc, 'net_unrealized_pnl')), - profit: createCentsSumSupplyUsdPattern(client, acc), + profit: createRawSumSupplyPattern(client, acc), }; } /** * @typedef {Object} LossNetProfitPattern3 - * @property {RelPattern6} loss - * @property {RelPattern7} netPnl - * @property {RelPattern6} profit + * @property {RelPattern7} loss + * @property {RelPattern8} netPnl + * @property {RelPattern7} profit */ /** @@ -3589,9 +3467,9 @@ function createLossNetProfitPattern2(client, acc) { */ function createLossNetProfitPattern3(client, acc) { return { - loss: createRelPattern6(client, _m(acc, 'unrealized_loss_rel_to')), - netPnl: createRelPattern7(client, _m(acc, 'net_unrealized_pnl_rel_to_own')), - profit: createRelPattern6(client, _m(acc, 'unrealized_profit_rel_to')), + loss: createRelPattern7(client, _m(acc, 'unrealized_loss_rel_to')), + netPnl: createRelPattern8(client, _m(acc, 'net_unrealized_pnl_rel_to_own')), + profit: createRelPattern7(client, _m(acc, 'unrealized_profit_rel_to')), }; } @@ -3619,8 +3497,8 @@ function createOutputsRealizedSupplyPattern(client, acc) { /** * @typedef {Object} RatioValuePattern * @property {_24hPattern2} ratio - * @property {RawSumPattern} valueCreated - * @property {RawSumPattern} valueDestroyed + * @property {RawSumPattern2} valueCreated + * @property {RawSumPattern2} valueDestroyed */ /** @@ -3632,25 +3510,67 @@ function createOutputsRealizedSupplyPattern(client, acc) { function createRatioValuePattern(client, acc) { return { ratio: create_24hPattern2(client, _m(acc, 'sopr_24h')), - valueCreated: createRawSumPattern(client, _m(acc, 'value_created')), - valueDestroyed: createRawSumPattern(client, _m(acc, 'value_destroyed')), + valueCreated: createRawSumPattern2(client, _m(acc, 'value_created')), + valueDestroyed: createRawSumPattern2(client, _m(acc, 'value_destroyed')), }; } /** - * @typedef {Object} RelPattern6 + * @typedef {Object} RawSellSumPattern + * @property {CentsUsdPattern} raw + * @property {_1m1w1y24hPattern2} sellSideRiskRatio + * @property {_1m1w1y24hPattern} sum + */ + +/** + * Create a RawSellSumPattern pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {RawSellSumPattern} + */ +function createRawSellSumPattern(client, acc) { + return { + raw: createCentsUsdPattern(client, _m(acc, 'realized_gross_pnl')), + sellSideRiskRatio: create_1m1w1y24hPattern2(client, _m(acc, 'sell_side_risk_ratio')), + sum: create_1m1w1y24hPattern(client, _m(acc, 'gross_pnl_sum')), + }; +} + +/** + * @typedef {Object} RawSumSupplyPattern + * @property {CentsUsdPattern} raw + * @property {_24hPattern} sum + * @property {BtcCentsSatsUsdPattern} supply + */ + +/** + * Create a RawSumSupplyPattern pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {RawSumSupplyPattern} + */ +function createRawSumSupplyPattern(client, acc) { + return { + raw: createCentsUsdPattern(client, _m(acc, 'unrealized_profit')), + sum: create_24hPattern(client, _m(acc, 'unrealized_profit_24h')), + supply: createBtcCentsSatsUsdPattern(client, _m(acc, 'supply_in_profit')), + }; +} + +/** + * @typedef {Object} RelPattern7 * @property {BpsPercentRatioPattern} relToMarketCap * @property {BpsPercentRatioPattern} relToOwnGrossPnl * @property {BpsPercentRatioPattern} relToOwnMarketCap */ /** - * Create a RelPattern6 pattern node + * Create a RelPattern7 pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {RelPattern6} + * @returns {RelPattern7} */ -function createRelPattern6(client, acc) { +function createRelPattern7(client, acc) { return { relToMarketCap: createBpsPercentRatioPattern(client, _m(acc, 'market_cap')), relToOwnGrossPnl: createBpsPercentRatioPattern(client, _m(acc, 'own_gross_pnl')), @@ -3658,29 +3578,6 @@ function createRelPattern6(client, acc) { }; } -/** - * @template T - * @typedef {Object} _1m1w1yPattern - * @property {MetricPattern1} _1m - * @property {MetricPattern1} _1w - * @property {MetricPattern1} _1y - */ - -/** - * Create a _1m1w1yPattern pattern node - * @template T - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {_1m1w1yPattern} - */ -function create_1m1w1yPattern(client, acc) { - return { - _1m: createMetricPattern1(client, _m(acc, '1m')), - _1w: createMetricPattern1(client, _m(acc, '1w')), - _1y: createMetricPattern1(client, _m(acc, '1y')), - }; -} - /** * @template T * @typedef {Object} _6bBlockTxindexPattern @@ -3746,6 +3643,25 @@ function createBaseCumulativePattern(client, acc) { }; } +/** + * @typedef {Object} BaseSumPattern + * @property {MetricPattern1} base + * @property {_1m1w1y24hPattern} sum + */ + +/** + * Create a BaseSumPattern pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {BaseSumPattern} + */ +function createBaseSumPattern(client, acc) { + return { + base: createMetricPattern1(client, acc), + sum: create_1m1w1y24hPattern(client, acc), + }; +} + /** * @typedef {Object} BlocksDominancePattern * @property {CumulativeHeightPattern} blocksMined @@ -3822,6 +3738,25 @@ function createChangeRatePattern2(client, acc) { }; } +/** + * @typedef {Object} ChangeRatePattern4 + * @property {_1m1w1y24hPattern3} change + * @property {_1m1w1y24hPattern2} rate + */ + +/** + * Create a ChangeRatePattern4 pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {ChangeRatePattern4} + */ +function createChangeRatePattern4(client, acc) { + return { + change: create_1m1w1y24hPattern3(client, _m(acc, 'change')), + rate: create_1m1w1y24hPattern2(client, _m(acc, 'rate')), + }; +} + /** * @typedef {Object} ChangeRatePattern * @property {_1mPattern} change @@ -3862,8 +3797,8 @@ function createChangeRatePattern3(client, acc) { /** * @typedef {Object} CoindaysSentPattern - * @property {RawSumPattern} coindaysDestroyed - * @property {RawSumPattern} sent + * @property {RawSumPattern2} coindaysDestroyed + * @property {RawSumPattern2} sent */ /** @@ -3874,8 +3809,8 @@ function createChangeRatePattern3(client, acc) { */ function createCoindaysSentPattern(client, acc) { return { - coindaysDestroyed: createRawSumPattern(client, _m(acc, 'coindays_destroyed')), - sent: createRawSumPattern(client, _m(acc, 'sent')), + coindaysDestroyed: createRawSumPattern2(client, _m(acc, 'coindays_destroyed')), + sent: createRawSumPattern2(client, _m(acc, 'sent')), }; } @@ -4033,8 +3968,8 @@ function createInPattern2(client, acc) { /** * @typedef {Object} LossProfitPattern2 - * @property {CentsSumSupplyUsdPattern} loss - * @property {CentsSumSupplyUsdPattern} profit + * @property {RawSumSupplyPattern} loss + * @property {RawSumSupplyPattern} profit */ /** @@ -4045,8 +3980,8 @@ function createInPattern2(client, acc) { */ function createLossProfitPattern2(client, acc) { return { - loss: createCentsSumSupplyUsdPattern(client, acc), - profit: createCentsSumSupplyUsdPattern(client, acc), + loss: createRawSumSupplyPattern(client, acc), + profit: createRawSumSupplyPattern(client, acc), }; } @@ -4070,21 +4005,21 @@ function createPriceValuePattern(client, acc) { } /** - * @typedef {Object} RawSumPattern2 - * @property {MetricPattern1} raw - * @property {_1m1w1y24hPattern} sum + * @typedef {Object} RawSumPattern + * @property {CentsUsdPattern} raw + * @property {_24hPattern} sum */ /** - * Create a RawSumPattern2 pattern node + * Create a RawSumPattern pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {RawSumPattern2} + * @returns {RawSumPattern} */ -function createRawSumPattern2(client, acc) { +function createRawSumPattern(client, acc) { return { - raw: createMetricPattern1(client, acc), - sum: create_1m1w1y24hPattern(client, acc), + raw: createCentsUsdPattern(client, acc), + sum: create_24hPattern(client, _m(acc, '24h')), }; } @@ -4108,18 +4043,18 @@ function createRealizedSupplyPattern(client, acc) { } /** - * @typedef {Object} RelPattern5 + * @typedef {Object} RelPattern6 * @property {BpsPercentRatioPattern} relToCirculatingSupply * @property {BpsPercentRatioPattern} relToOwnSupply */ /** - * Create a RelPattern5 pattern node + * Create a RelPattern6 pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {RelPattern5} + * @returns {RelPattern6} */ -function createRelPattern5(client, acc) { +function createRelPattern6(client, acc) { return { relToCirculatingSupply: createBpsPercentRatioPattern(client, _m(acc, 'circulating_supply')), relToOwnSupply: createBpsPercentRatioPattern(client, _m(acc, 'own_supply')), @@ -4127,18 +4062,18 @@ function createRelPattern5(client, acc) { } /** - * @typedef {Object} RelPattern3 + * @typedef {Object} RelPattern4 * @property {BpsPercentRatioPattern} relToMarketCap * @property {BpsPercentRatioPattern} relToOwnGrossPnl */ /** - * Create a RelPattern3 pattern node + * Create a RelPattern4 pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {RelPattern3} + * @returns {RelPattern4} */ -function createRelPattern3(client, acc) { +function createRelPattern4(client, acc) { return { relToMarketCap: createBpsPercentRatioPattern(client, _m(acc, 'market_cap')), relToOwnGrossPnl: createBpsPercentRatioPattern(client, _m(acc, 'own_gross_pnl')), @@ -4146,18 +4081,37 @@ function createRelPattern3(client, acc) { } /** - * @typedef {Object} RelPattern7 + * @typedef {Object} RelPattern2 + * @property {BpsPercentRatioPattern} relToMcap + * @property {BpsPercentRatioPattern} relToRcap + */ + +/** + * Create a RelPattern2 pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {RelPattern2} + */ +function createRelPattern2(client, acc) { + return { + relToMcap: createBpsPercentRatioPattern(client, _m(acc, 'market_cap')), + relToRcap: createBpsPercentRatioPattern(client, _m(acc, 'realized_cap')), + }; +} + +/** + * @typedef {Object} RelPattern8 * @property {BpsPercentRatioPattern} relToOwnGrossPnl * @property {BpsPercentRatioPattern} relToOwnMarketCap */ /** - * Create a RelPattern7 pattern node + * Create a RelPattern8 pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {RelPattern7} + * @returns {RelPattern8} */ -function createRelPattern7(client, acc) { +function createRelPattern8(client, acc) { return { relToOwnGrossPnl: createBpsPercentRatioPattern(client, _m(acc, 'gross_pnl')), relToOwnMarketCap: createBpsPercentRatioPattern(client, _m(acc, 'market_cap')), @@ -4242,8 +4196,8 @@ function createUtxoPattern3(client, acc) { /** * @typedef {Object} ValuePattern - * @property {RawSumPattern} valueCreated - * @property {RawSumPattern} valueDestroyed + * @property {RawSumPattern2} valueCreated + * @property {RawSumPattern2} valueDestroyed */ /** @@ -4254,26 +4208,47 @@ function createUtxoPattern3(client, acc) { */ function createValuePattern(client, acc) { return { - valueCreated: createRawSumPattern(client, _m(acc, 'created')), - valueDestroyed: createRawSumPattern(client, _m(acc, 'destroyed')), + valueCreated: createRawSumPattern2(client, _m(acc, 'created')), + valueDestroyed: createRawSumPattern2(client, _m(acc, 'destroyed')), }; } /** * @template T - * @typedef {Object} RawSumPattern + * @typedef {Object} RawSumPattern3 + * @property {MetricPattern1} raw + * @property {_1m1w1y24hPattern} sum + */ + +/** + * Create a RawSumPattern3 pattern node + * @template T + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {RawSumPattern3} + */ +function createRawSumPattern3(client, acc) { + return { + raw: createMetricPattern1(client, acc), + sum: create_1m1w1y24hPattern(client, acc), + }; +} + +/** + * @template T + * @typedef {Object} RawSumPattern2 * @property {MetricPattern1} raw * @property {_24hPattern2} sum */ /** - * Create a RawSumPattern pattern node + * Create a RawSumPattern2 pattern node * @template T * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {RawSumPattern} + * @returns {RawSumPattern2} */ -function createRawSumPattern(client, acc) { +function createRawSumPattern2(client, acc) { return { raw: createMetricPattern1(client, acc), sum: create_24hPattern2(client, _m(acc, '24h')), @@ -4366,17 +4341,17 @@ function createRelPattern(client, acc) { } /** - * @typedef {Object} RelPattern2 + * @typedef {Object} RelPattern3 * @property {BpsPercentRatioPattern} relToOwnSupply */ /** - * Create a RelPattern2 pattern node + * Create a RelPattern3 pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {RelPattern2} + * @returns {RelPattern3} */ -function createRelPattern2(client, acc) { +function createRelPattern3(client, acc) { return { relToOwnSupply: createBpsPercentRatioPattern(client, acc), }; @@ -5166,7 +5141,7 @@ function createRawPattern(client, acc) { * @property {MetricsTree_Market_Ath} ath * @property {MetricsTree_Market_Lookback} lookback * @property {MetricsTree_Market_Returns} returns - * @property {_1m1w1yPattern} volatility + * @property {MetricsTree_Market_Volatility} volatility * @property {MetricsTree_Market_Range} range * @property {MetricsTree_Market_MovingAverage} movingAverage * @property {MetricsTree_Market_Dca} dca @@ -5243,6 +5218,13 @@ function createRawPattern(client, acc) { * @property {MetricPattern1} sd */ +/** + * @typedef {Object} MetricsTree_Market_Volatility + * @property {MetricPattern1} _1w + * @property {MetricPattern1} _1m + * @property {MetricPattern1} _1y + */ + /** * @typedef {Object} MetricsTree_Market_Range * @property {_1m1w1y2wPattern} min @@ -5985,14 +5967,14 @@ function createRawPattern(client, acc) { /** * @typedef {Object} MetricsTree_Distribution_UtxoCohorts_All_Relative_Supply - * @property {RelPattern2} inProfit - * @property {RelPattern2} inLoss + * @property {RelPattern3} inProfit + * @property {RelPattern3} inLoss */ /** * @typedef {Object} MetricsTree_Distribution_UtxoCohorts_All_Relative_Unrealized - * @property {RelPattern3} profit - * @property {RelPattern3} loss + * @property {RelPattern4} profit + * @property {RelPattern4} loss * @property {MetricsTree_Distribution_UtxoCohorts_All_Relative_Unrealized_NetPnl} netPnl */ @@ -6025,9 +6007,9 @@ function createRawPattern(client, acc) { /** * @typedef {Object} MetricsTree_Distribution_UtxoCohorts_Lth_Realized - * @property {CentsCumulativeFlowRelSumUsdValuePattern} profit - * @property {CapitulationCentsCumulativeNegRelSumUsdValuePattern} loss - * @property {CentsSellSumUsdPattern} grossPnl + * @property {CumulativeDistributionRawRelSumValuePattern} profit + * @property {CapitulationCumulativeNegativeRawRelSumValuePattern} loss + * @property {RawSellSumPattern} grossPnl * @property {ChangeCumulativeDeltaRawRelSumPattern} netPnl * @property {MetricsTree_Distribution_UtxoCohorts_Lth_Realized_Sopr} sopr * @property {InPattern3} sent @@ -6043,11 +6025,9 @@ function createRawPattern(client, acc) { /** * @typedef {Object} MetricsTree_Distribution_UtxoCohorts_Lth_Realized_Sopr - * @property {_1m1w1yPattern} valueCreatedSum - * @property {_1m1w1yPattern} valueDestroyedSum + * @property {RawSumPattern3} valueCreated + * @property {RawSumPattern3} valueDestroyed * @property {_1m1w1y24hPattern} ratio - * @property {RawSumPattern} valueCreated - * @property {RawSumPattern} valueDestroyed */ /** @@ -6418,7 +6398,7 @@ function createRawPattern(client, acc) { * @property {BpsPercentRatioPattern} inflationRate * @property {MetricsTree_Supply_Velocity} velocity * @property {CentsUsdPattern} marketCap - * @property {MetricsTree_Supply_MarketCapDelta} marketCapDelta + * @property {ChangeRatePattern4} marketCapDelta * @property {_1m1w1y24hPattern} marketMinusRealizedCapGrowthRate */ @@ -6434,15 +6414,6 @@ function createRawPattern(client, acc) { * @property {MetricPattern1} usd */ -/** - * @typedef {Object} MetricsTree_Supply_MarketCapDelta - * @property {CentsUsdPattern} change24h - * @property {CentsUsdPattern} change1w - * @property {CentsUsdPattern} change1m - * @property {CentsUsdPattern} change1y - * @property {_1m1w1y24hPattern2} rate - */ - /** * Main BRK client with metrics tree and API methods * @extends BrkClientBase @@ -7900,7 +7871,11 @@ class BrkClient extends BrkClientBase { _1y: createSdSmaPattern(this, 'price_return_24h'), }, }, - volatility: create_1m1w1yPattern(this, 'price_volatility'), + volatility: { + _1w: createMetricPattern1(this, 'price_volatility_1w'), + _1m: createMetricPattern1(this, 'price_volatility_1m'), + _1y: createMetricPattern1(this, 'price_volatility_1y'), + }, range: { min: create_1m1w1y2wPattern(this, 'price_min'), max: create_1m1w1y2wPattern(this, 'price_max'), @@ -8430,12 +8405,12 @@ class BrkClient extends BrkClientBase { unrealized: createGrossInvestedInvestorLossNetProfitSentimentPattern(this, ''), relative: { supply: { - inProfit: createRelPattern2(this, 'supply_in_profit_rel_to_own_supply'), - inLoss: createRelPattern2(this, 'supply_in_loss_rel_to_own_supply'), + inProfit: createRelPattern3(this, 'supply_in_profit_rel_to_own_supply'), + inLoss: createRelPattern3(this, 'supply_in_loss_rel_to_own_supply'), }, unrealized: { - profit: createRelPattern3(this, 'unrealized_profit_rel_to'), - loss: createRelPattern3(this, 'unrealized_loss_rel_to'), + profit: createRelPattern4(this, 'unrealized_profit_rel_to'), + loss: createRelPattern4(this, 'unrealized_loss_rel_to'), netPnl: { relToOwnGrossPnl: createBpsPercentRatioPattern(this, 'net_unrealized_pnl_rel_to_own_gross_pnl'), }, @@ -8456,16 +8431,14 @@ class BrkClient extends BrkClientBase { outputs: createUtxoPattern3(this, 'lth_utxo_count'), activity: createCoinblocksCoindaysDormancySentVelocityPattern(this, 'lth'), realized: { - profit: createCentsCumulativeFlowRelSumUsdValuePattern(this, 'lth'), - loss: createCapitulationCentsCumulativeNegRelSumUsdValuePattern(this, 'lth'), - grossPnl: createCentsSellSumUsdPattern(this, 'lth'), + profit: createCumulativeDistributionRawRelSumValuePattern(this, 'lth'), + loss: createCapitulationCumulativeNegativeRawRelSumValuePattern(this, 'lth'), + grossPnl: createRawSellSumPattern(this, 'lth'), netPnl: createChangeCumulativeDeltaRawRelSumPattern(this, 'lth_net'), sopr: { - valueCreatedSum: create_1m1w1yPattern(this, 'lth_value_created'), - valueDestroyedSum: create_1m1w1yPattern(this, 'lth_value_destroyed'), + valueCreated: createRawSumPattern3(this, 'lth_value_created'), + valueDestroyed: createRawSumPattern3(this, 'lth_value_destroyed'), ratio: create_1m1w1y24hPattern(this, 'lth_sopr'), - valueCreated: createRawSumPattern(this, 'lth_value_created'), - valueDestroyed: createRawSumPattern(this, 'lth_value_destroyed'), }, sent: createInPattern3(this, 'lth_sent_in'), peakRegret: createCumulativeHeightRelPattern(this, 'lth_realized_peak_regret'), @@ -8813,13 +8786,7 @@ class BrkClient extends BrkClientBase { usd: createMetricPattern1(this, 'velocity_usd'), }, marketCap: createCentsUsdPattern(this, 'market_cap'), - marketCapDelta: { - change24h: createCentsUsdPattern(this, 'market_cap_delta_change_24h'), - change1w: createCentsUsdPattern(this, 'market_cap_delta_change_1w'), - change1m: createCentsUsdPattern(this, 'market_cap_delta_change_1m'), - change1y: createCentsUsdPattern(this, 'market_cap_delta_change_1y'), - rate: create_1m1w1y24hPattern2(this, 'market_cap_delta_rate'), - }, + marketCapDelta: createChangeRatePattern4(this, 'market_cap_delta'), marketMinusRealizedCapGrowthRate: create_1m1w1y24hPattern(this, 'market_minus_realized_cap_growth_rate'), }, }; diff --git a/packages/brk_client/brk_client/__init__.py b/packages/brk_client/brk_client/__init__.py index e430c8c52..57d09dcb2 100644 --- a/packages/brk_client/brk_client/__init__.py +++ b/packages/brk_client/brk_client/__init__.py @@ -2150,16 +2150,16 @@ class CapGrossInvestorLossMvrvNetNuplPeakPriceProfitSentSoprPattern: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" self.cap: CentsDeltaRawRelUsdPattern = CentsDeltaRawRelUsdPattern(client, acc) - self.gross_pnl: CentsSellSumUsdPattern = CentsSellSumUsdPattern(client, acc) + self.gross_pnl: RawSellSumPattern = RawSellSumPattern(client, acc) self.investor: CapLowerPriceUpperPattern = CapLowerPriceUpperPattern(client, acc) - self.loss: CapitulationCentsCumulativeNegRelSumUsdValuePattern = CapitulationCentsCumulativeNegRelSumUsdValuePattern(client, acc) + self.loss: CapitulationCumulativeNegativeRawRelSumValuePattern = CapitulationCumulativeNegativeRawRelSumValuePattern(client, acc) self.mvrv: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'mvrv')) self.net_pnl: ChangeCumulativeDeltaRawRelSumPattern = ChangeCumulativeDeltaRawRelSumPattern(client, _m(acc, 'net')) self.nupl: BpsRatioPattern = BpsRatioPattern(client, _m(acc, 'nupl_ratio')) self.peak_regret: CumulativeHeightRelPattern = CumulativeHeightRelPattern(client, _m(acc, 'realized_peak_regret')) self.price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'realized_price')) self.price_ratio: BpsPercentilesRatioStdPattern = BpsPercentilesRatioStdPattern(client, _m(acc, 'realized_price_ratio')) - self.profit: CentsCumulativeFlowRelSumUsdValuePattern = CentsCumulativeFlowRelSumUsdValuePattern(client, acc) + self.profit: CumulativeDistributionRawRelSumValuePattern = CumulativeDistributionRawRelSumValuePattern(client, acc) self.profit_to_loss_ratio: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, _m(acc, 'realized_profit_to_loss_ratio')) self.sent: InPattern3 = InPattern3(client, _m(acc, 'sent_in')) self.sopr: AdjustedRatioValuePattern = AdjustedRatioValuePattern(client, acc) @@ -2234,23 +2234,6 @@ class AverageCumulativeHeightMaxMedianMinPct10Pct25Pct75Pct90SumPattern: self.pct90: _1m1w1y24hPattern[StoredU64] = _1m1w1y24hPattern(client, _m(acc, 'pct90')) self.sum: _1m1w1y24hPattern[StoredU64] = _1m1w1y24hPattern(client, _m(acc, 'sum')) -class CapitulationCentsCumulativeNegRelSumUsdValuePattern: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.capitulation_flow: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'capitulation_flow')) - self.cents: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_loss_cents')) - self.cumulative: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_loss_cumulative')) - self.neg: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'neg_realized_loss')) - self.rel_to_rcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'realized_loss_rel_to_realized_cap')) - self.sum: _1m1w1y24hPattern3 = _1m1w1y24hPattern3(client, _m(acc, 'realized_loss')) - self.usd: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_loss')) - self.value_created: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'loss_value_created')) - self.value_created_sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, _m(acc, 'loss_value_created')) - self.value_destroyed: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'loss_value_destroyed')) - self.value_destroyed_sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, _m(acc, 'loss_value_destroyed')) - class AverageGainsLossesRsiStochPattern: """Pattern struct for repeated tree structure.""" @@ -2289,32 +2272,16 @@ class CapLossMvrvNetNuplPriceProfitSentSoprPattern: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" self.cap: CentsDeltaUsdPattern = CentsDeltaUsdPattern(client, _m(acc, 'realized_cap')) - self.loss: CentsCumulativeNegSumUsdPattern = CentsCumulativeNegSumUsdPattern(client, acc) + self.loss: CumulativeNegativeRawSumPattern = CumulativeNegativeRawSumPattern(client, acc) self.mvrv: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'mvrv')) - self.net_pnl: RawSumPattern[CentsSigned] = RawSumPattern(client, _m(acc, 'net_realized_pnl')) + self.net_pnl: RawSumPattern2[CentsSigned] = RawSumPattern2(client, _m(acc, 'net_realized_pnl')) self.nupl: BpsRatioPattern = BpsRatioPattern(client, _m(acc, 'nupl_ratio')) self.price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'realized_price')) self.price_ratio: BpsRatioPattern = BpsRatioPattern(client, _m(acc, 'realized_price_ratio')) - self.profit: CentsCumulativeSumUsdPattern = CentsCumulativeSumUsdPattern(client, _m(acc, 'realized_profit')) + self.profit: CumulativeRawSumPattern = CumulativeRawSumPattern(client, _m(acc, 'realized_profit')) self.sent: InPattern = InPattern(client, _m(acc, 'sent_in')) self.sopr: RatioValuePattern = RatioValuePattern(client, acc) -class CentsCumulativeFlowRelSumUsdValuePattern: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.cents: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_profit_cents')) - self.cumulative: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_profit_cumulative')) - self.flow: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'profit_flow')) - self.rel_to_rcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'realized_profit_rel_to_realized_cap')) - self.sum: _1m1w1y24hPattern3 = _1m1w1y24hPattern3(client, _m(acc, 'realized_profit')) - self.usd: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_profit')) - self.value_created: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'profit_value_created')) - self.value_created_sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, _m(acc, 'profit_value_created')) - self.value_destroyed: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'profit_value_destroyed')) - self.value_destroyed_sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, _m(acc, 'profit_value_destroyed')) - class AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern: """Pattern struct for repeated tree structure.""" @@ -2380,14 +2347,28 @@ class CapLossMvrvNuplPriceProfitSoprPattern: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" self.cap: CentsUsdPattern = CentsUsdPattern(client, _m(acc, 'realized_cap')) - self.loss: CentsSumUsdPattern = CentsSumUsdPattern(client, _m(acc, 'realized_loss')) + self.loss: RawSumPattern = RawSumPattern(client, _m(acc, 'realized_loss')) self.mvrv: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'mvrv')) self.nupl: BpsRatioPattern = BpsRatioPattern(client, _m(acc, 'nupl_ratio')) self.price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'realized_price')) self.price_ratio: BpsRatioPattern = BpsRatioPattern(client, _m(acc, 'realized_price_ratio')) - self.profit: CentsSumUsdPattern = CentsSumUsdPattern(client, _m(acc, 'realized_profit')) + self.profit: RawSumPattern = RawSumPattern(client, _m(acc, 'realized_profit')) self.sopr: ValuePattern = ValuePattern(client, _m(acc, 'value')) +class CapitulationCumulativeNegativeRawRelSumValuePattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.capitulation_flow: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'capitulation_flow')) + self.cumulative: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_loss_cumulative')) + self.negative: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'neg_realized_loss')) + self.raw: CentsUsdPattern = CentsUsdPattern(client, _m(acc, 'realized_loss')) + self.rel_to_rcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'realized_loss_rel_to_realized_cap')) + self.sum: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, _m(acc, 'realized_loss')) + self.value_created: BaseSumPattern = BaseSumPattern(client, _m(acc, 'loss_value_created')) + self.value_destroyed: BaseSumPattern = BaseSumPattern(client, _m(acc, 'loss_value_destroyed')) + class Pct1Pct2Pct5Pct95Pct98Pct99SmaPattern: """Pattern struct for repeated tree structure.""" @@ -2442,31 +2423,18 @@ class _1m1w1y24hBpsPercentRatioPattern: self.percent: MetricPattern1[StoredF32] = MetricPattern1(client, acc) self.ratio: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'ratio')) -class _24hChangeRatePattern: +class CumulativeDistributionRawRelSumValuePattern: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self._24h: BpsCentsPercentRatioUsdPattern = BpsCentsPercentRatioUsdPattern(client, acc) - self.change: _1mPattern3 = _1mPattern3(client, _m(acc, 'change_1m')) - self.change_1w: CentsUsdPattern = CentsUsdPattern(client, _m(acc, 'change_1w')) - self.change_1y: CentsUsdPattern = CentsUsdPattern(client, _m(acc, 'change_1y')) - self.rate: _1mPattern2 = _1mPattern2(client, _m(acc, 'rate_1m')) - self.rate_1w: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'rate_1w')) - self.rate_1y: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'rate_1y')) - -class ChangeCumulativeDeltaRawRelSumPattern: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.change_1m_rel_to_mcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'pnl_change_1m_rel_to_market_cap')) - self.change_1m_rel_to_rcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'pnl_change_1m_rel_to_realized_cap')) - self.cumulative: MetricPattern1[CentsSigned] = MetricPattern1(client, _m(acc, 'realized_pnl_cumulative')) - self.delta: _24hChangeRatePattern = _24hChangeRatePattern(client, _m(acc, 'pnl_delta')) - self.raw: MetricPattern1[CentsSigned] = MetricPattern1(client, _m(acc, 'realized_pnl')) - self.rel_to_rcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'realized_pnl_rel_to_realized_cap')) - self.sum: _1m1w1y24hPattern[CentsSigned] = _1m1w1y24hPattern(client, _m(acc, 'realized_pnl')) + self.cumulative: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_profit_cumulative')) + self.distribution_flow: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'profit_flow')) + self.raw: CentsUsdPattern = CentsUsdPattern(client, _m(acc, 'realized_profit')) + self.rel_to_rcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'realized_profit_rel_to_realized_cap')) + self.sum: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, _m(acc, 'realized_profit')) + self.value_created: BaseSumPattern = BaseSumPattern(client, _m(acc, 'profit_value_created')) + self.value_destroyed: BaseSumPattern = BaseSumPattern(client, _m(acc, 'profit_value_destroyed')) class GrossInvestedInvestorLossNetProfitSentimentPattern: """Pattern struct for repeated tree structure.""" @@ -2476,9 +2444,9 @@ class GrossInvestedInvestorLossNetProfitSentimentPattern: self.gross_pnl: CentsUsdPattern = CentsUsdPattern(client, _m(acc, 'unrealized_gross_pnl')) self.invested_capital: InPattern5 = InPattern5(client, _m(acc, 'invested_capital_in')) self.investor_cap: InPattern2 = InPattern2(client, _m(acc, 'investor_cap_in')) - self.loss: CentsNegSumSupplyUsdPattern = CentsNegSumSupplyUsdPattern(client, acc) + self.loss: NegativeRawSumSupplyPattern = NegativeRawSumSupplyPattern(client, acc) self.net_pnl: CentsUsdPattern = CentsUsdPattern(client, _m(acc, 'net_unrealized_pnl')) - self.profit: CentsSumSupplyUsdPattern = CentsSumSupplyUsdPattern(client, acc) + self.profit: RawSumSupplyPattern = RawSumSupplyPattern(client, acc) self.sentiment: GreedNetPainPattern = GreedNetPainPattern(client, acc) class ActivityOutputsRealizedRelativeSupplyUnrealizedPattern: @@ -2505,30 +2473,30 @@ class ActivityOutputsRealizedRelativeSupplyUnrealizedPattern2: self.supply: DeltaHalvedTotalPattern = DeltaHalvedTotalPattern(client, _m(acc, 'supply')) self.unrealized: LossNetProfitPattern2 = LossNetProfitPattern2(client, acc) -class AdjustedRatioValuePattern: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.adjusted: RatioValuePattern2 = RatioValuePattern2(client, _m(acc, 'adjusted')) - self.ratio: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, _m(acc, 'sopr')) - self.value_created: RawSumPattern[Cents] = RawSumPattern(client, _m(acc, 'value_created')) - self.value_created_sum: _1m1w1yPattern[Cents] = _1m1w1yPattern(client, _m(acc, 'value_created')) - self.value_destroyed: RawSumPattern[Cents] = RawSumPattern(client, _m(acc, 'value_destroyed')) - self.value_destroyed_sum: _1m1w1yPattern[Cents] = _1m1w1yPattern(client, _m(acc, 'value_destroyed')) - class CapLowerPriceUpperPattern: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.cap_raw: MetricPattern18[CentsSquaredSats] = MetricPattern18(client, _m(acc, 'investor_cap_raw')) + self.cap: RawPattern[CentsSquaredSats] = RawPattern(client, _m(acc, 'investor_cap_raw')) self.lower_price_band: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'lower_price_band')) self.price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'investor_price')) self.price_ratio: BpsRatioPattern = BpsRatioPattern(client, _m(acc, 'investor_price_ratio')) self.price_ratio_percentiles: Pct1Pct2Pct5Pct95Pct98Pct99SmaPattern = Pct1Pct2Pct5Pct95Pct98Pct99SmaPattern(client, _m(acc, 'investor_price_ratio')) self.upper_price_band: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'upper_price_band')) +class ChangeCumulativeDeltaRawRelSumPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.change_1m: RelPattern2 = RelPattern2(client, _m(acc, 'pnl_change_1m_rel_to')) + self.cumulative: MetricPattern1[CentsSigned] = MetricPattern1(client, _m(acc, 'realized_pnl_cumulative')) + self.delta: ChangeRatePattern4 = ChangeRatePattern4(client, _m(acc, 'pnl_delta')) + self.raw: MetricPattern1[CentsSigned] = MetricPattern1(client, _m(acc, 'realized_pnl')) + self.rel_to_rcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'realized_pnl_rel_to_realized_cap')) + self.sum: _1m1w1y24hPattern[CentsSigned] = _1m1w1y24hPattern(client, _m(acc, 'realized_pnl')) + class AddrOutputsRealizedSupplyPattern: """Pattern struct for repeated tree structure.""" @@ -2540,17 +2508,6 @@ class AddrOutputsRealizedSupplyPattern: self.realized: CapLossMvrvNuplPriceProfitSoprPattern = CapLossMvrvNuplPriceProfitSoprPattern(client, acc) self.supply: HalvedTotalPattern = HalvedTotalPattern(client, _m(acc, 'supply')) -class BpsCentsPercentRatioUsdPattern: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.bps: MetricPattern1[BasisPointsSigned32] = MetricPattern1(client, _m(acc, 'rate_24h_bps')) - self.cents: MetricPattern1[CentsSigned] = MetricPattern1(client, _m(acc, 'change_24h_cents')) - self.percent: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'rate_24h')) - self.ratio: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'rate_24h_ratio')) - self.usd: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'change_24h')) - class BtcCentsSatsSumUsdPattern2: """Pattern struct for repeated tree structure.""" @@ -2559,7 +2516,7 @@ class BtcCentsSatsSumUsdPattern2: self.btc: MetricPattern1[Bitcoin] = MetricPattern1(client, acc) self.cents: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'cents')) self.sats: MetricPattern1[Sats] = MetricPattern1(client, _m(acc, 'sats')) - self.sum: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, acc) + self.sum: _1m1w1y24hPattern5 = _1m1w1y24hPattern5(client, acc) self.usd: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'usd')) class BtcCentsSatsSumUsdPattern: @@ -2573,48 +2530,26 @@ class BtcCentsSatsSumUsdPattern: self.sum: _24hPattern3 = _24hPattern3(client, _m(acc, '24h')) self.usd: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'usd')) -class CentsCumulativeNegSumUsdPattern: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.cents: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_loss_cents')) - self.cumulative: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_loss_cumulative')) - self.neg: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'neg_realized_loss')) - self.sum: _24hPattern = _24hPattern(client, _m(acc, 'realized_loss_24h')) - self.usd: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_loss')) - class CentsDeltaRawRelUsdPattern: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" self.cents: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_cap_cents')) - self.delta: _24hChangeRatePattern = _24hChangeRatePattern(client, _m(acc, 'realized_cap_delta')) + self.delta: ChangeRatePattern4 = ChangeRatePattern4(client, _m(acc, 'realized_cap_delta')) self.raw: MetricPattern18[CentsSats] = MetricPattern18(client, _m(acc, 'cap_raw')) self.rel_to_own_mcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'realized_cap_rel_to_own_market_cap')) self.usd: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_cap')) -class CentsNegSumSupplyUsdPattern: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.cents: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'unrealized_loss_cents')) - self.neg: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'neg_unrealized_loss')) - self.sum: _24hPattern = _24hPattern(client, _m(acc, 'unrealized_loss_24h')) - self.supply: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'supply_in_loss')) - self.usd: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'unrealized_loss')) - class CoinblocksCoindaysDormancySentVelocityPattern: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" self.coinblocks_destroyed: CumulativeRawPattern = CumulativeRawPattern(client, _m(acc, 'coinblocks_destroyed')) - self.coindays_destroyed: CumulativeRawSumPattern = CumulativeRawSumPattern(client, _m(acc, 'coindays_destroyed')) + self.coindays_destroyed: CumulativeRawSumPattern2 = CumulativeRawSumPattern2(client, _m(acc, 'coindays_destroyed')) self.dormancy: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'dormancy')) - self.sent: RawSumPattern2 = RawSumPattern2(client, _m(acc, 'sent')) + self.sent: RawSumPattern3[Sats] = RawSumPattern3(client, _m(acc, 'sent')) self.velocity: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'velocity')) class EmaHistogramLineSignalPattern: @@ -2635,9 +2570,9 @@ class InvestedInvestorLossNetProfitPattern: """Create pattern node with accumulated metric name.""" self.invested_capital: InPattern2 = InPattern2(client, _m(acc, 'invested_capital_in')) self.investor_cap: InPattern2 = InPattern2(client, _m(acc, 'investor_cap_in')) - self.loss: CentsNegSumSupplyUsdPattern = CentsNegSumSupplyUsdPattern(client, acc) + self.loss: NegativeRawSumSupplyPattern = NegativeRawSumSupplyPattern(client, acc) self.net_pnl: CentsUsdPattern = CentsUsdPattern(client, _m(acc, 'net_unrealized_pnl')) - self.profit: CentsSumSupplyUsdPattern = CentsSumSupplyUsdPattern(client, acc) + self.profit: RawSumSupplyPattern = RawSumSupplyPattern(client, acc) class PhsReboundThsPattern: """Pattern struct for repeated tree structure.""" @@ -2682,7 +2617,7 @@ class _1m1w1y24hPattern2: self._1y: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, '1y')) self._24h: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, '24h')) -class _1m1w1y24hPattern7: +class _1m1w1y24hPattern8: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -2692,7 +2627,7 @@ class _1m1w1y24hPattern7: self._1y: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, '1y')) self._24h: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, '24h')) -class _1m1w1y24hPattern3: +class _1m1w1y24hPattern4: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -2712,7 +2647,17 @@ class _1m1w1y2wPattern: self._1y: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, '1y')) self._2w: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, '2w')) -class _1m1w1y24hPattern4: +class _1m1w1y24hPattern3: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self._1m: CentsUsdPattern = CentsUsdPattern(client, _m(acc, '1m')) + self._1w: CentsUsdPattern = CentsUsdPattern(client, _m(acc, '1w')) + self._1y: CentsUsdPattern = CentsUsdPattern(client, _m(acc, '1y')) + self._24h: CentsUsdPattern = CentsUsdPattern(client, _m(acc, '24h')) + +class _1m1w1y24hPattern5: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -2732,6 +2677,16 @@ class _1y2y4yAllPattern: self._4y: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern = _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern(client, acc) self.all: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern = _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern(client, acc) +class AdjustedRatioValuePattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.adjusted: RatioValuePattern2 = RatioValuePattern2(client, _m(acc, 'adjusted')) + self.ratio: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, _m(acc, 'sopr')) + self.value_created: RawSumPattern3[Cents] = RawSumPattern3(client, _m(acc, 'value_created')) + self.value_destroyed: RawSumPattern3[Cents] = RawSumPattern3(client, _m(acc, 'value_destroyed')) + class BothReactivatedReceivingSendingPattern: """Pattern struct for repeated tree structure.""" @@ -2762,35 +2717,15 @@ class BtcCentsSatsUsdPattern: self.sats: MetricPattern1[Sats] = MetricPattern1(client, _m(acc, 'sats')) self.usd: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'usd')) -class CentsCumulativeSumUsdPattern: +class CumulativeNegativeRawSumPattern: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.cents: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'cents')) - self.cumulative: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'cumulative')) - self.sum: _24hPattern = _24hPattern(client, _m(acc, '24h')) - self.usd: MetricPattern1[Dollars] = MetricPattern1(client, acc) - -class CentsSellSumUsdPattern: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.cents: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_gross_pnl_cents')) - self.sell_side_risk_ratio: _1m1w1y24hPattern2 = _1m1w1y24hPattern2(client, _m(acc, 'sell_side_risk_ratio')) - self.sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, _m(acc, 'gross_pnl_sum')) - self.usd: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_gross_pnl')) - -class CentsSumSupplyUsdPattern: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.cents: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'unrealized_profit_cents')) - self.sum: _24hPattern = _24hPattern(client, _m(acc, 'unrealized_profit_24h')) - self.supply: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'supply_in_profit')) - self.usd: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'unrealized_profit')) + self.cumulative: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_loss_cumulative')) + self.negative: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'neg_realized_loss')) + self.raw: CentsUsdPattern = CentsUsdPattern(client, _m(acc, 'realized_loss')) + self.sum: _24hPattern = _24hPattern(client, _m(acc, 'realized_loss_24h')) class InvestedMaxMinPercentilesPattern: """Pattern struct for repeated tree structure.""" @@ -2802,6 +2737,16 @@ class InvestedMaxMinPercentilesPattern: self.min: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'cost_basis_min')) self.percentiles: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern = Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern(client, _m(acc, 'cost_basis')) +class NegativeRawSumSupplyPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.negative: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'neg_unrealized_loss')) + self.raw: CentsUsdPattern = CentsUsdPattern(client, _m(acc, 'unrealized_loss')) + self.sum: _24hPattern = _24hPattern(client, _m(acc, 'unrealized_loss_24h')) + self.supply: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'supply_in_loss')) + class OutputsRealizedSupplyUnrealizedPattern: """Pattern struct for repeated tree structure.""" @@ -2829,7 +2774,7 @@ class BaseCumulativeSumPattern: """Create pattern node with accumulated metric name.""" self.base: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, acc) self.cumulative: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'cumulative')) - self.sum: _1m1w1y24hPattern7 = _1m1w1y24hPattern7(client, _m(acc, 'sum')) + self.sum: _1m1w1y24hPattern8 = _1m1w1y24hPattern8(client, _m(acc, 'sum')) class BlocksDominanceRewardsPattern: """Pattern struct for repeated tree structure.""" @@ -2894,15 +2839,6 @@ class CentsSatsUsdPattern: self.sats: MetricPattern1[SatsFract] = MetricPattern1(client, _m(acc, 'sats')) self.usd: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'usd')) -class CentsSumUsdPattern: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.cents: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'cents')) - self.sum: _24hPattern = _24hPattern(client, _m(acc, '24h')) - self.usd: MetricPattern1[Dollars] = MetricPattern1(client, acc) - class CumulativeHeightRelPattern: """Pattern struct for repeated tree structure.""" @@ -2915,6 +2851,15 @@ class CumulativeHeightRelPattern: class CumulativeRawSumPattern: """Pattern struct for repeated tree structure.""" + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.cumulative: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'cumulative')) + self.raw: CentsUsdPattern = CentsUsdPattern(client, acc) + self.sum: _24hPattern = _24hPattern(client, _m(acc, '24h')) + +class CumulativeRawSumPattern2: + """Pattern struct for repeated tree structure.""" + def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" self.cumulative: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'cumulative')) @@ -2962,8 +2907,8 @@ class InRelPattern2: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.in_loss: RelPattern5 = RelPattern5(client, _m(acc, 'in_loss_rel_to')) - self.in_profit: RelPattern5 = RelPattern5(client, _m(acc, 'in_profit_rel_to')) + self.in_loss: RelPattern6 = RelPattern6(client, _m(acc, 'in_loss_rel_to')) + self.in_profit: RelPattern6 = RelPattern6(client, _m(acc, 'in_profit_rel_to')) self.rel_to_circulating_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'rel_to_circulating_supply')) class LossNetProfitPattern2: @@ -2971,18 +2916,18 @@ class LossNetProfitPattern2: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.loss: CentsNegSumSupplyUsdPattern = CentsNegSumSupplyUsdPattern(client, acc) + self.loss: NegativeRawSumSupplyPattern = NegativeRawSumSupplyPattern(client, acc) self.net_pnl: CentsUsdPattern = CentsUsdPattern(client, _m(acc, 'net_unrealized_pnl')) - self.profit: CentsSumSupplyUsdPattern = CentsSumSupplyUsdPattern(client, acc) + self.profit: RawSumSupplyPattern = RawSumSupplyPattern(client, acc) class LossNetProfitPattern3: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.loss: RelPattern6 = RelPattern6(client, _m(acc, 'unrealized_loss_rel_to')) - self.net_pnl: RelPattern7 = RelPattern7(client, _m(acc, 'net_unrealized_pnl_rel_to_own')) - self.profit: RelPattern6 = RelPattern6(client, _m(acc, 'unrealized_profit_rel_to')) + self.loss: RelPattern7 = RelPattern7(client, _m(acc, 'unrealized_loss_rel_to')) + self.net_pnl: RelPattern8 = RelPattern8(client, _m(acc, 'net_unrealized_pnl_rel_to_own')) + self.profit: RelPattern7 = RelPattern7(client, _m(acc, 'unrealized_profit_rel_to')) class OutputsRealizedSupplyPattern: """Pattern struct for repeated tree structure.""" @@ -2999,10 +2944,28 @@ class RatioValuePattern: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" self.ratio: _24hPattern2[StoredF64] = _24hPattern2(client, _m(acc, 'sopr_24h')) - self.value_created: RawSumPattern[Cents] = RawSumPattern(client, _m(acc, 'value_created')) - self.value_destroyed: RawSumPattern[Cents] = RawSumPattern(client, _m(acc, 'value_destroyed')) + self.value_created: RawSumPattern2[Cents] = RawSumPattern2(client, _m(acc, 'value_created')) + self.value_destroyed: RawSumPattern2[Cents] = RawSumPattern2(client, _m(acc, 'value_destroyed')) -class RelPattern6: +class RawSellSumPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.raw: CentsUsdPattern = CentsUsdPattern(client, _m(acc, 'realized_gross_pnl')) + self.sell_side_risk_ratio: _1m1w1y24hPattern2 = _1m1w1y24hPattern2(client, _m(acc, 'sell_side_risk_ratio')) + self.sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, _m(acc, 'gross_pnl_sum')) + +class RawSumSupplyPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.raw: CentsUsdPattern = CentsUsdPattern(client, _m(acc, 'unrealized_profit')) + self.sum: _24hPattern = _24hPattern(client, _m(acc, 'unrealized_profit_24h')) + self.supply: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'supply_in_profit')) + +class RelPattern7: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -3011,15 +2974,6 @@ class RelPattern6: self.rel_to_own_gross_pnl: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'own_gross_pnl')) self.rel_to_own_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'own_market_cap')) -class _1m1w1yPattern(Generic[T]): - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self._1m: MetricPattern1[T] = MetricPattern1(client, _m(acc, '1m')) - self._1w: MetricPattern1[T] = MetricPattern1(client, _m(acc, '1w')) - self._1y: MetricPattern1[T] = MetricPattern1(client, _m(acc, '1y')) - class _6bBlockTxindexPattern(Generic[T]): """Pattern struct for repeated tree structure.""" @@ -3046,6 +3000,14 @@ class BaseCumulativePattern: self.base: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, acc) self.cumulative: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'cumulative')) +class BaseSumPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.base: MetricPattern1[Cents] = MetricPattern1(client, acc) + self.sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, acc) + class BlocksDominancePattern: """Pattern struct for repeated tree structure.""" @@ -3078,6 +3040,14 @@ class ChangeRatePattern2: self.change: _1m1w1y24hPattern[StoredI64] = _1m1w1y24hPattern(client, _m(acc, 'change')) self.rate: _1m1w1y24hPattern2 = _1m1w1y24hPattern2(client, _m(acc, 'rate')) +class ChangeRatePattern4: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.change: _1m1w1y24hPattern3 = _1m1w1y24hPattern3(client, _m(acc, 'change')) + self.rate: _1m1w1y24hPattern2 = _1m1w1y24hPattern2(client, _m(acc, 'rate')) + class ChangeRatePattern: """Pattern struct for repeated tree structure.""" @@ -3099,8 +3069,8 @@ class CoindaysSentPattern: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.coindays_destroyed: RawSumPattern[StoredF64] = RawSumPattern(client, _m(acc, 'coindays_destroyed')) - self.sent: RawSumPattern[Sats] = RawSumPattern(client, _m(acc, 'sent')) + self.coindays_destroyed: RawSumPattern2[StoredF64] = RawSumPattern2(client, _m(acc, 'coindays_destroyed')) + self.sent: RawSumPattern2[Sats] = RawSumPattern2(client, _m(acc, 'sent')) class CumulativeRawPattern: """Pattern struct for repeated tree structure.""" @@ -3171,8 +3141,8 @@ class LossProfitPattern2: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.loss: CentsSumSupplyUsdPattern = CentsSumSupplyUsdPattern(client, acc) - self.profit: CentsSumSupplyUsdPattern = CentsSumSupplyUsdPattern(client, acc) + self.loss: RawSumSupplyPattern = RawSumSupplyPattern(client, acc) + self.profit: RawSumSupplyPattern = RawSumSupplyPattern(client, acc) class PriceValuePattern: """Pattern struct for repeated tree structure.""" @@ -3182,13 +3152,13 @@ class PriceValuePattern: self.price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, acc) self.value: MetricPattern1[StoredF32] = MetricPattern1(client, acc) -class RawSumPattern2: +class RawSumPattern: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.raw: MetricPattern1[Sats] = MetricPattern1(client, acc) - self.sum: _1m1w1y24hPattern[Sats] = _1m1w1y24hPattern(client, acc) + self.raw: CentsUsdPattern = CentsUsdPattern(client, acc) + self.sum: _24hPattern = _24hPattern(client, _m(acc, '24h')) class RealizedSupplyPattern: """Pattern struct for repeated tree structure.""" @@ -3198,7 +3168,7 @@ class RealizedSupplyPattern: self.realized_cap: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_cap')) self.supply: MetricPattern1[Sats] = MetricPattern1(client, _m(acc, 'supply')) -class RelPattern5: +class RelPattern6: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -3206,7 +3176,7 @@ class RelPattern5: self.rel_to_circulating_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'circulating_supply')) self.rel_to_own_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'own_supply')) -class RelPattern3: +class RelPattern4: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -3214,7 +3184,15 @@ class RelPattern3: self.rel_to_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'market_cap')) self.rel_to_own_gross_pnl: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'own_gross_pnl')) -class RelPattern7: +class RelPattern2: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.rel_to_mcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'market_cap')) + self.rel_to_rcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'realized_cap')) + +class RelPattern8: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -3259,10 +3237,18 @@ class ValuePattern: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.value_created: RawSumPattern[Cents] = RawSumPattern(client, _m(acc, 'created')) - self.value_destroyed: RawSumPattern[Cents] = RawSumPattern(client, _m(acc, 'destroyed')) + self.value_created: RawSumPattern2[Cents] = RawSumPattern2(client, _m(acc, 'created')) + self.value_destroyed: RawSumPattern2[Cents] = RawSumPattern2(client, _m(acc, 'destroyed')) -class RawSumPattern(Generic[T]): +class RawSumPattern3(Generic[T]): + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.raw: MetricPattern1[T] = MetricPattern1(client, acc) + self.sum: _1m1w1y24hPattern[T] = _1m1w1y24hPattern(client, acc) + +class RawSumPattern2(Generic[T]): """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -3305,7 +3291,7 @@ class RelPattern: """Create pattern node with accumulated metric name.""" self.rel_to_circulating_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, acc) -class RelPattern2: +class RelPattern3: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -4165,6 +4151,14 @@ class MetricsTree_Market_Returns: self.price_cagr: _10y2y3y4y5y6y8yPattern = _10y2y3y4y5y6y8yPattern(client, 'price_cagr') self.price_return_24h_sd: MetricsTree_Market_Returns_PriceReturn24hSd = MetricsTree_Market_Returns_PriceReturn24hSd(client) +class MetricsTree_Market_Volatility: + """Metrics tree node.""" + + def __init__(self, client: BrkClientBase, base_path: str = ''): + self._1w: MetricPattern1[StoredF32] = MetricPattern1(client, 'price_volatility_1w') + self._1m: MetricPattern1[StoredF32] = MetricPattern1(client, 'price_volatility_1m') + self._1y: MetricPattern1[StoredF32] = MetricPattern1(client, 'price_volatility_1y') + class MetricsTree_Market_Range: """Metrics tree node.""" @@ -4679,7 +4673,7 @@ class MetricsTree_Market: self.ath: MetricsTree_Market_Ath = MetricsTree_Market_Ath(client) self.lookback: MetricsTree_Market_Lookback = MetricsTree_Market_Lookback(client) self.returns: MetricsTree_Market_Returns = MetricsTree_Market_Returns(client) - self.volatility: _1m1w1yPattern[StoredF32] = _1m1w1yPattern(client, 'price_volatility') + self.volatility: MetricsTree_Market_Volatility = MetricsTree_Market_Volatility(client) self.range: MetricsTree_Market_Range = MetricsTree_Market_Range(client) self.moving_average: MetricsTree_Market_MovingAverage = MetricsTree_Market_MovingAverage(client) self.dca: MetricsTree_Market_Dca = MetricsTree_Market_Dca(client) @@ -4930,8 +4924,8 @@ class MetricsTree_Distribution_UtxoCohorts_All_Relative_Supply: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.in_profit: RelPattern2 = RelPattern2(client, 'supply_in_profit_rel_to_own_supply') - self.in_loss: RelPattern2 = RelPattern2(client, 'supply_in_loss_rel_to_own_supply') + self.in_profit: RelPattern3 = RelPattern3(client, 'supply_in_profit_rel_to_own_supply') + self.in_loss: RelPattern3 = RelPattern3(client, 'supply_in_loss_rel_to_own_supply') class MetricsTree_Distribution_UtxoCohorts_All_Relative_Unrealized_NetPnl: """Metrics tree node.""" @@ -4943,8 +4937,8 @@ class MetricsTree_Distribution_UtxoCohorts_All_Relative_Unrealized: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.profit: RelPattern3 = RelPattern3(client, 'unrealized_profit_rel_to') - self.loss: RelPattern3 = RelPattern3(client, 'unrealized_loss_rel_to') + self.profit: RelPattern4 = RelPattern4(client, 'unrealized_profit_rel_to') + self.loss: RelPattern4 = RelPattern4(client, 'unrealized_loss_rel_to') self.net_pnl: MetricsTree_Distribution_UtxoCohorts_All_Relative_Unrealized_NetPnl = MetricsTree_Distribution_UtxoCohorts_All_Relative_Unrealized_NetPnl(client) class MetricsTree_Distribution_UtxoCohorts_All_Relative: @@ -4982,19 +4976,17 @@ class MetricsTree_Distribution_UtxoCohorts_Lth_Realized_Sopr: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.value_created_sum: _1m1w1yPattern[Cents] = _1m1w1yPattern(client, 'lth_value_created') - self.value_destroyed_sum: _1m1w1yPattern[Cents] = _1m1w1yPattern(client, 'lth_value_destroyed') + self.value_created: RawSumPattern3[Cents] = RawSumPattern3(client, 'lth_value_created') + self.value_destroyed: RawSumPattern3[Cents] = RawSumPattern3(client, 'lth_value_destroyed') self.ratio: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, 'lth_sopr') - self.value_created: RawSumPattern[Cents] = RawSumPattern(client, 'lth_value_created') - self.value_destroyed: RawSumPattern[Cents] = RawSumPattern(client, 'lth_value_destroyed') class MetricsTree_Distribution_UtxoCohorts_Lth_Realized: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.profit: CentsCumulativeFlowRelSumUsdValuePattern = CentsCumulativeFlowRelSumUsdValuePattern(client, 'lth') - self.loss: CapitulationCentsCumulativeNegRelSumUsdValuePattern = CapitulationCentsCumulativeNegRelSumUsdValuePattern(client, 'lth') - self.gross_pnl: CentsSellSumUsdPattern = CentsSellSumUsdPattern(client, 'lth') + self.profit: CumulativeDistributionRawRelSumValuePattern = CumulativeDistributionRawRelSumValuePattern(client, 'lth') + self.loss: CapitulationCumulativeNegativeRawRelSumValuePattern = CapitulationCumulativeNegativeRawRelSumValuePattern(client, 'lth') + self.gross_pnl: RawSellSumPattern = RawSellSumPattern(client, 'lth') self.net_pnl: ChangeCumulativeDeltaRawRelSumPattern = ChangeCumulativeDeltaRawRelSumPattern(client, 'lth_net') self.sopr: MetricsTree_Distribution_UtxoCohorts_Lth_Realized_Sopr = MetricsTree_Distribution_UtxoCohorts_Lth_Realized_Sopr(client) self.sent: InPattern3 = InPattern3(client, 'lth_sent_in') @@ -5452,16 +5444,6 @@ class MetricsTree_Supply_Velocity: self.btc: MetricPattern1[StoredF64] = MetricPattern1(client, 'velocity_btc') self.usd: MetricPattern1[StoredF64] = MetricPattern1(client, 'velocity_usd') -class MetricsTree_Supply_MarketCapDelta: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.change_24h: CentsUsdPattern = CentsUsdPattern(client, 'market_cap_delta_change_24h') - self.change_1w: CentsUsdPattern = CentsUsdPattern(client, 'market_cap_delta_change_1w') - self.change_1m: CentsUsdPattern = CentsUsdPattern(client, 'market_cap_delta_change_1m') - self.change_1y: CentsUsdPattern = CentsUsdPattern(client, 'market_cap_delta_change_1y') - self.rate: _1m1w1y24hPattern2 = _1m1w1y24hPattern2(client, 'market_cap_delta_rate') - class MetricsTree_Supply: """Metrics tree node.""" @@ -5471,7 +5453,7 @@ class MetricsTree_Supply: self.inflation_rate: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'inflation_rate') self.velocity: MetricsTree_Supply_Velocity = MetricsTree_Supply_Velocity(client) self.market_cap: CentsUsdPattern = CentsUsdPattern(client, 'market_cap') - self.market_cap_delta: MetricsTree_Supply_MarketCapDelta = MetricsTree_Supply_MarketCapDelta(client) + self.market_cap_delta: ChangeRatePattern4 = ChangeRatePattern4(client, 'market_cap_delta') self.market_minus_realized_cap_growth_rate: _1m1w1y24hPattern[BasisPointsSigned32] = _1m1w1y24hPattern(client, 'market_minus_realized_cap_growth_rate') class MetricsTree: