diff --git a/crates/brk_client/src/lib.rs b/crates/brk_client/src/lib.rs index 8c86311fb..a064418b2 100644 --- a/crates/brk_client/src/lib.rs +++ b/crates/brk_client/src/lib.rs @@ -950,69 +950,68 @@ pub struct AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedS pub adjusted_sopr_30d_ema: MetricPattern1, pub adjusted_sopr_7d: MetricPattern1, pub adjusted_sopr_7d_ema: MetricPattern1, - pub adjusted_value_created: MetricPattern1, - pub adjusted_value_created_1y: MetricPattern1, - pub adjusted_value_created_24h: MetricPattern1, - pub adjusted_value_created_30d: MetricPattern1, - pub adjusted_value_created_7d: MetricPattern1, - pub adjusted_value_destroyed: MetricPattern1, - pub adjusted_value_destroyed_1y: MetricPattern1, - pub adjusted_value_destroyed_24h: MetricPattern1, - pub adjusted_value_destroyed_30d: MetricPattern1, - pub adjusted_value_destroyed_7d: MetricPattern1, + pub adjusted_value_created: MetricPattern1, + pub adjusted_value_created_1y: MetricPattern1, + pub adjusted_value_created_24h: MetricPattern1, + pub adjusted_value_created_30d: MetricPattern1, + pub adjusted_value_created_7d: MetricPattern1, + pub adjusted_value_destroyed: MetricPattern1, + pub adjusted_value_destroyed_1y: MetricPattern1, + pub adjusted_value_destroyed_24h: MetricPattern1, + pub adjusted_value_destroyed_30d: MetricPattern1, + pub adjusted_value_destroyed_7d: MetricPattern1, pub cap_raw: MetricPattern18, pub capitulation_flow: MetricPattern1, pub investor_cap_raw: MetricPattern18, - pub investor_price: SatsUsdPattern, - pub investor_price_cents: MetricPattern1, + pub investor_price: CentsSatsUsdPattern, pub investor_price_extra: RatioPattern2, pub investor_price_ratio_ext: RatioPattern3, - pub loss_value_created: MetricPattern1, - pub loss_value_destroyed: MetricPattern1, - pub lower_price_band: SatsUsdPattern, + pub loss_value_created: MetricPattern1, + pub loss_value_destroyed: MetricPattern1, + pub lower_price_band: CentsSatsUsdPattern, pub mvrv: MetricPattern1, pub neg_realized_loss: MetricPattern1, - pub net_realized_pnl: CumulativeHeightPattern, - pub net_realized_pnl_7d_ema: MetricPattern1, - pub net_realized_pnl_cumulative_30d_delta: MetricPattern1, + pub net_realized_pnl: CumulativeHeightPattern, + pub net_realized_pnl_7d_ema: MetricPattern1, + pub net_realized_pnl_cumulative_30d_delta: MetricPattern1, pub net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: MetricPattern1, pub net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: MetricPattern1, pub net_realized_pnl_rel_to_realized_cap: MetricPattern1, - pub peak_regret: CumulativeHeightPattern, + pub peak_regret: CumulativeHeightPattern, pub peak_regret_rel_to_realized_cap: MetricPattern1, pub profit_flow: MetricPattern1, - pub profit_value_created: MetricPattern1, - pub profit_value_destroyed: MetricPattern1, + pub profit_value_created: MetricPattern1, + pub profit_value_destroyed: MetricPattern1, pub realized_cap: MetricPattern1, - pub realized_cap_30d_delta: MetricPattern1, + pub realized_cap_30d_delta: MetricPattern1, pub realized_cap_cents: MetricPattern1, pub realized_cap_rel_to_own_market_cap: MetricPattern1, - pub realized_loss: CumulativeHeightPattern, - pub realized_loss_1y: MetricPattern1, - pub realized_loss_24h: MetricPattern1, - pub realized_loss_30d: MetricPattern1, - pub realized_loss_7d: MetricPattern1, - pub realized_loss_7d_ema: MetricPattern1, + pub realized_loss: CumulativeHeightPattern, + pub realized_loss_1y: MetricPattern1, + pub realized_loss_24h: MetricPattern1, + pub realized_loss_30d: MetricPattern1, + pub realized_loss_7d: MetricPattern1, + pub realized_loss_7d_ema: MetricPattern1, pub realized_loss_rel_to_realized_cap: MetricPattern1, - pub realized_price: SatsUsdPattern, + pub realized_price: CentsSatsUsdPattern, pub realized_price_extra: RatioPattern2, pub realized_price_ratio_ext: RatioPattern3, - pub realized_profit: CumulativeHeightPattern, - pub realized_profit_1y: MetricPattern1, - pub realized_profit_24h: MetricPattern1, - pub realized_profit_30d: MetricPattern1, - pub realized_profit_7d: MetricPattern1, - pub realized_profit_7d_ema: MetricPattern1, + pub realized_profit: CumulativeHeightPattern, + pub realized_profit_1y: MetricPattern1, + pub realized_profit_24h: MetricPattern1, + pub realized_profit_30d: MetricPattern1, + pub realized_profit_7d: MetricPattern1, + pub realized_profit_7d_ema: MetricPattern1, pub realized_profit_rel_to_realized_cap: MetricPattern1, pub realized_profit_to_loss_ratio_1y: MetricPattern1, pub realized_profit_to_loss_ratio_24h: MetricPattern1, pub realized_profit_to_loss_ratio_30d: MetricPattern1, pub realized_profit_to_loss_ratio_7d: MetricPattern1, - pub realized_value: MetricPattern1, - pub realized_value_1y: MetricPattern1, - pub realized_value_24h: MetricPattern1, - pub realized_value_30d: MetricPattern1, - pub realized_value_7d: MetricPattern1, + pub realized_value: MetricPattern1, + pub realized_value_1y: MetricPattern1, + pub realized_value_24h: MetricPattern1, + pub realized_value_30d: MetricPattern1, + pub realized_value_7d: MetricPattern1, pub sell_side_risk_ratio: MetricPattern1, pub sell_side_risk_ratio_1y: MetricPattern1, pub sell_side_risk_ratio_24h: MetricPattern1, @@ -1023,9 +1022,9 @@ pub struct AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedS pub sell_side_risk_ratio_7d: MetricPattern1, pub sell_side_risk_ratio_7d_ema: MetricPattern1, pub sent_in_loss: BaseCumulativePattern, - pub sent_in_loss_14d_ema: BtcSatsUsdPattern, + pub sent_in_loss_14d_ema: BtcCentsSatsUsdPattern, pub sent_in_profit: BaseCumulativePattern, - pub sent_in_profit_14d_ema: BtcSatsUsdPattern, + pub sent_in_profit_14d_ema: BtcCentsSatsUsdPattern, pub sopr: MetricPattern1, pub sopr_1y: MetricPattern1, pub sopr_24h: MetricPattern1, @@ -1036,17 +1035,17 @@ pub struct AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedS pub sopr_7d: MetricPattern1, pub sopr_7d_ema: MetricPattern1, pub total_realized_pnl: MetricPattern1, - pub upper_price_band: SatsUsdPattern, - pub value_created: MetricPattern1, - pub value_created_1y: MetricPattern1, - pub value_created_24h: MetricPattern1, - pub value_created_30d: MetricPattern1, - pub value_created_7d: MetricPattern1, - pub value_destroyed: MetricPattern1, - pub value_destroyed_1y: MetricPattern1, - pub value_destroyed_24h: MetricPattern1, - pub value_destroyed_30d: MetricPattern1, - pub value_destroyed_7d: MetricPattern1, + pub upper_price_band: CentsSatsUsdPattern, + pub value_created: MetricPattern1, + pub value_created_1y: MetricPattern1, + pub value_created_24h: MetricPattern1, + pub value_created_30d: MetricPattern1, + pub value_created_7d: MetricPattern1, + pub value_destroyed: MetricPattern1, + pub value_destroyed_1y: MetricPattern1, + pub value_destroyed_24h: MetricPattern1, + pub value_destroyed_30d: MetricPattern1, + pub value_destroyed_7d: MetricPattern1, } impl AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern { @@ -1075,13 +1074,12 @@ impl AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSen cap_raw: MetricPattern18::new(client.clone(), _m(&acc, "cap_raw")), capitulation_flow: MetricPattern1::new(client.clone(), _m(&acc, "capitulation_flow")), investor_cap_raw: MetricPattern18::new(client.clone(), _m(&acc, "investor_cap_raw")), - investor_price: SatsUsdPattern::new(client.clone(), _m(&acc, "investor_price")), - investor_price_cents: MetricPattern1::new(client.clone(), _m(&acc, "investor_price_cents")), + investor_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "investor_price")), investor_price_extra: RatioPattern2::new(client.clone(), _m(&acc, "investor_price_ratio")), investor_price_ratio_ext: RatioPattern3::new(client.clone(), _m(&acc, "investor_price_ratio")), loss_value_created: MetricPattern1::new(client.clone(), _m(&acc, "loss_value_created")), loss_value_destroyed: MetricPattern1::new(client.clone(), _m(&acc, "loss_value_destroyed")), - lower_price_band: SatsUsdPattern::new(client.clone(), _m(&acc, "lower_price_band")), + lower_price_band: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "lower_price_band")), mvrv: MetricPattern1::new(client.clone(), _m(&acc, "mvrv")), neg_realized_loss: MetricPattern1::new(client.clone(), _m(&acc, "neg_realized_loss")), net_realized_pnl: CumulativeHeightPattern::new(client.clone(), _m(&acc, "net_realized_pnl")), @@ -1106,7 +1104,7 @@ impl AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSen realized_loss_7d: MetricPattern1::new(client.clone(), _m(&acc, "realized_loss_7d")), realized_loss_7d_ema: MetricPattern1::new(client.clone(), _m(&acc, "realized_loss_7d_ema")), realized_loss_rel_to_realized_cap: MetricPattern1::new(client.clone(), _m(&acc, "realized_loss_rel_to_realized_cap")), - realized_price: SatsUsdPattern::new(client.clone(), _m(&acc, "realized_price")), + realized_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "realized_price")), realized_price_extra: RatioPattern2::new(client.clone(), _m(&acc, "realized_price_ratio")), realized_price_ratio_ext: RatioPattern3::new(client.clone(), _m(&acc, "realized_price_ratio")), realized_profit: CumulativeHeightPattern::new(client.clone(), _m(&acc, "realized_profit")), @@ -1135,9 +1133,9 @@ impl AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSen sell_side_risk_ratio_7d: MetricPattern1::new(client.clone(), _m(&acc, "sell_side_risk_ratio_7d")), sell_side_risk_ratio_7d_ema: MetricPattern1::new(client.clone(), _m(&acc, "sell_side_risk_ratio_7d_ema")), sent_in_loss: BaseCumulativePattern::new(client.clone(), _m(&acc, "sent_in_loss")), - sent_in_loss_14d_ema: BtcSatsUsdPattern::new(client.clone(), _m(&acc, "sent_in_loss_14d_ema")), + sent_in_loss_14d_ema: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "sent_in_loss_14d_ema")), sent_in_profit: BaseCumulativePattern::new(client.clone(), _m(&acc, "sent_in_profit")), - sent_in_profit_14d_ema: BtcSatsUsdPattern::new(client.clone(), _m(&acc, "sent_in_profit_14d_ema")), + sent_in_profit_14d_ema: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "sent_in_profit_14d_ema")), sopr: MetricPattern1::new(client.clone(), _m(&acc, "sopr")), sopr_1y: MetricPattern1::new(client.clone(), _m(&acc, "sopr_1y")), sopr_24h: MetricPattern1::new(client.clone(), _m(&acc, "sopr_24h")), @@ -1148,7 +1146,7 @@ impl AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSen sopr_7d: MetricPattern1::new(client.clone(), _m(&acc, "sopr_7d")), sopr_7d_ema: MetricPattern1::new(client.clone(), _m(&acc, "sopr_7d_ema")), total_realized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "total_realized_pnl")), - upper_price_band: SatsUsdPattern::new(client.clone(), _m(&acc, "upper_price_band")), + upper_price_band: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "upper_price_band")), value_created: MetricPattern1::new(client.clone(), _m(&acc, "value_created")), value_created_1y: MetricPattern1::new(client.clone(), _m(&acc, "value_created_1y")), value_created_24h: MetricPattern1::new(client.clone(), _m(&acc, "value_created_24h")), @@ -1174,54 +1172,53 @@ pub struct AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedS pub adjusted_sopr_30d_ema: MetricPattern1, pub adjusted_sopr_7d: MetricPattern1, pub adjusted_sopr_7d_ema: MetricPattern1, - pub adjusted_value_created: MetricPattern1, - pub adjusted_value_created_1y: MetricPattern1, - pub adjusted_value_created_24h: MetricPattern1, - pub adjusted_value_created_30d: MetricPattern1, - pub adjusted_value_created_7d: MetricPattern1, - pub adjusted_value_destroyed: MetricPattern1, - pub adjusted_value_destroyed_1y: MetricPattern1, - pub adjusted_value_destroyed_24h: MetricPattern1, - pub adjusted_value_destroyed_30d: MetricPattern1, - pub adjusted_value_destroyed_7d: MetricPattern1, + pub adjusted_value_created: MetricPattern1, + pub adjusted_value_created_1y: MetricPattern1, + pub adjusted_value_created_24h: MetricPattern1, + pub adjusted_value_created_30d: MetricPattern1, + pub adjusted_value_created_7d: MetricPattern1, + pub adjusted_value_destroyed: MetricPattern1, + pub adjusted_value_destroyed_1y: MetricPattern1, + pub adjusted_value_destroyed_24h: MetricPattern1, + pub adjusted_value_destroyed_30d: MetricPattern1, + pub adjusted_value_destroyed_7d: MetricPattern1, pub cap_raw: MetricPattern18, pub capitulation_flow: MetricPattern1, pub investor_cap_raw: MetricPattern18, - pub investor_price: SatsUsdPattern, - pub investor_price_cents: MetricPattern1, + pub investor_price: CentsSatsUsdPattern, pub investor_price_extra: RatioPattern2, - pub loss_value_created: MetricPattern1, - pub loss_value_destroyed: MetricPattern1, - pub lower_price_band: SatsUsdPattern, + pub loss_value_created: MetricPattern1, + pub loss_value_destroyed: MetricPattern1, + pub lower_price_band: CentsSatsUsdPattern, pub mvrv: MetricPattern1, pub neg_realized_loss: MetricPattern1, - pub net_realized_pnl: CumulativeHeightPattern, - pub net_realized_pnl_7d_ema: MetricPattern1, - pub net_realized_pnl_cumulative_30d_delta: MetricPattern1, + pub net_realized_pnl: CumulativeHeightPattern, + pub net_realized_pnl_7d_ema: MetricPattern1, + pub net_realized_pnl_cumulative_30d_delta: MetricPattern1, pub net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: MetricPattern1, pub net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: MetricPattern1, pub net_realized_pnl_rel_to_realized_cap: MetricPattern1, - pub peak_regret: CumulativeHeightPattern, + pub peak_regret: CumulativeHeightPattern, pub peak_regret_rel_to_realized_cap: MetricPattern1, pub profit_flow: MetricPattern1, - pub profit_value_created: MetricPattern1, - pub profit_value_destroyed: MetricPattern1, + pub profit_value_created: MetricPattern1, + pub profit_value_destroyed: MetricPattern1, pub realized_cap: MetricPattern1, - pub realized_cap_30d_delta: MetricPattern1, + pub realized_cap_30d_delta: MetricPattern1, pub realized_cap_cents: MetricPattern1, - pub realized_loss: CumulativeHeightPattern, - pub realized_loss_7d_ema: MetricPattern1, + pub realized_loss: CumulativeHeightPattern, + pub realized_loss_7d_ema: MetricPattern1, pub realized_loss_rel_to_realized_cap: MetricPattern1, - pub realized_price: SatsUsdPattern, + pub realized_price: CentsSatsUsdPattern, pub realized_price_extra: RatioPattern2, - pub realized_profit: CumulativeHeightPattern, - pub realized_profit_7d_ema: MetricPattern1, + pub realized_profit: CumulativeHeightPattern, + pub realized_profit_7d_ema: MetricPattern1, pub realized_profit_rel_to_realized_cap: MetricPattern1, - pub realized_value: MetricPattern1, - pub realized_value_1y: MetricPattern1, - pub realized_value_24h: MetricPattern1, - pub realized_value_30d: MetricPattern1, - pub realized_value_7d: MetricPattern1, + pub realized_value: MetricPattern1, + pub realized_value_1y: MetricPattern1, + pub realized_value_24h: MetricPattern1, + pub realized_value_30d: MetricPattern1, + pub realized_value_7d: MetricPattern1, pub sell_side_risk_ratio: MetricPattern1, pub sell_side_risk_ratio_1y: MetricPattern1, pub sell_side_risk_ratio_24h: MetricPattern1, @@ -1232,9 +1229,9 @@ pub struct AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedS pub sell_side_risk_ratio_7d: MetricPattern1, pub sell_side_risk_ratio_7d_ema: MetricPattern1, pub sent_in_loss: BaseCumulativePattern, - pub sent_in_loss_14d_ema: BtcSatsUsdPattern, + pub sent_in_loss_14d_ema: BtcCentsSatsUsdPattern, pub sent_in_profit: BaseCumulativePattern, - pub sent_in_profit_14d_ema: BtcSatsUsdPattern, + pub sent_in_profit_14d_ema: BtcCentsSatsUsdPattern, pub sopr: MetricPattern1, pub sopr_1y: MetricPattern1, pub sopr_24h: MetricPattern1, @@ -1245,17 +1242,17 @@ pub struct AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedS pub sopr_7d: MetricPattern1, pub sopr_7d_ema: MetricPattern1, pub total_realized_pnl: MetricPattern1, - pub upper_price_band: SatsUsdPattern, - pub value_created: MetricPattern1, - pub value_created_1y: MetricPattern1, - pub value_created_24h: MetricPattern1, - pub value_created_30d: MetricPattern1, - pub value_created_7d: MetricPattern1, - pub value_destroyed: MetricPattern1, - pub value_destroyed_1y: MetricPattern1, - pub value_destroyed_24h: MetricPattern1, - pub value_destroyed_30d: MetricPattern1, - pub value_destroyed_7d: MetricPattern1, + pub upper_price_band: CentsSatsUsdPattern, + pub value_created: MetricPattern1, + pub value_created_1y: MetricPattern1, + pub value_created_24h: MetricPattern1, + pub value_created_30d: MetricPattern1, + pub value_created_7d: MetricPattern1, + pub value_destroyed: MetricPattern1, + pub value_destroyed_1y: MetricPattern1, + pub value_destroyed_24h: MetricPattern1, + pub value_destroyed_30d: MetricPattern1, + pub value_destroyed_7d: MetricPattern1, } impl AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern2 { @@ -1284,12 +1281,11 @@ impl AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSen cap_raw: MetricPattern18::new(client.clone(), _m(&acc, "cap_raw")), capitulation_flow: MetricPattern1::new(client.clone(), _m(&acc, "capitulation_flow")), investor_cap_raw: MetricPattern18::new(client.clone(), _m(&acc, "investor_cap_raw")), - investor_price: SatsUsdPattern::new(client.clone(), _m(&acc, "investor_price")), - investor_price_cents: MetricPattern1::new(client.clone(), _m(&acc, "investor_price_cents")), + investor_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "investor_price")), investor_price_extra: RatioPattern2::new(client.clone(), _m(&acc, "investor_price_ratio")), loss_value_created: MetricPattern1::new(client.clone(), _m(&acc, "loss_value_created")), loss_value_destroyed: MetricPattern1::new(client.clone(), _m(&acc, "loss_value_destroyed")), - lower_price_band: SatsUsdPattern::new(client.clone(), _m(&acc, "lower_price_band")), + lower_price_band: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "lower_price_band")), mvrv: MetricPattern1::new(client.clone(), _m(&acc, "mvrv")), neg_realized_loss: MetricPattern1::new(client.clone(), _m(&acc, "neg_realized_loss")), net_realized_pnl: CumulativeHeightPattern::new(client.clone(), _m(&acc, "net_realized_pnl")), @@ -1309,7 +1305,7 @@ impl AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSen realized_loss: CumulativeHeightPattern::new(client.clone(), _m(&acc, "realized_loss")), realized_loss_7d_ema: MetricPattern1::new(client.clone(), _m(&acc, "realized_loss_7d_ema")), realized_loss_rel_to_realized_cap: MetricPattern1::new(client.clone(), _m(&acc, "realized_loss_rel_to_realized_cap")), - realized_price: SatsUsdPattern::new(client.clone(), _m(&acc, "realized_price")), + realized_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "realized_price")), realized_price_extra: RatioPattern2::new(client.clone(), _m(&acc, "realized_price_ratio")), realized_profit: CumulativeHeightPattern::new(client.clone(), _m(&acc, "realized_profit")), realized_profit_7d_ema: MetricPattern1::new(client.clone(), _m(&acc, "realized_profit_7d_ema")), @@ -1329,9 +1325,9 @@ impl AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSen sell_side_risk_ratio_7d: MetricPattern1::new(client.clone(), _m(&acc, "sell_side_risk_ratio_7d")), sell_side_risk_ratio_7d_ema: MetricPattern1::new(client.clone(), _m(&acc, "sell_side_risk_ratio_7d_ema")), sent_in_loss: BaseCumulativePattern::new(client.clone(), _m(&acc, "sent_in_loss")), - sent_in_loss_14d_ema: BtcSatsUsdPattern::new(client.clone(), _m(&acc, "sent_in_loss_14d_ema")), + sent_in_loss_14d_ema: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "sent_in_loss_14d_ema")), sent_in_profit: BaseCumulativePattern::new(client.clone(), _m(&acc, "sent_in_profit")), - sent_in_profit_14d_ema: BtcSatsUsdPattern::new(client.clone(), _m(&acc, "sent_in_profit_14d_ema")), + sent_in_profit_14d_ema: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "sent_in_profit_14d_ema")), sopr: MetricPattern1::new(client.clone(), _m(&acc, "sopr")), sopr_1y: MetricPattern1::new(client.clone(), _m(&acc, "sopr_1y")), sopr_24h: MetricPattern1::new(client.clone(), _m(&acc, "sopr_24h")), @@ -1342,7 +1338,7 @@ impl AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSen sopr_7d: MetricPattern1::new(client.clone(), _m(&acc, "sopr_7d")), sopr_7d_ema: MetricPattern1::new(client.clone(), _m(&acc, "sopr_7d_ema")), total_realized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "total_realized_pnl")), - upper_price_band: SatsUsdPattern::new(client.clone(), _m(&acc, "upper_price_band")), + upper_price_band: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "upper_price_band")), value_created: MetricPattern1::new(client.clone(), _m(&acc, "value_created")), value_created_1y: MetricPattern1::new(client.clone(), _m(&acc, "value_created_1y")), value_created_24h: MetricPattern1::new(client.clone(), _m(&acc, "value_created_24h")), @@ -1362,56 +1358,55 @@ pub struct CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentS pub cap_raw: MetricPattern18, pub capitulation_flow: MetricPattern1, pub investor_cap_raw: MetricPattern18, - pub investor_price: SatsUsdPattern, - pub investor_price_cents: MetricPattern1, + pub investor_price: CentsSatsUsdPattern, pub investor_price_extra: RatioPattern2, pub investor_price_ratio_ext: RatioPattern3, - pub loss_value_created: MetricPattern1, - pub loss_value_destroyed: MetricPattern1, - pub lower_price_band: SatsUsdPattern, + pub loss_value_created: MetricPattern1, + pub loss_value_destroyed: MetricPattern1, + pub lower_price_band: CentsSatsUsdPattern, pub mvrv: MetricPattern1, pub neg_realized_loss: MetricPattern1, - pub net_realized_pnl: CumulativeHeightPattern, - pub net_realized_pnl_7d_ema: MetricPattern1, - pub net_realized_pnl_cumulative_30d_delta: MetricPattern1, + pub net_realized_pnl: CumulativeHeightPattern, + pub net_realized_pnl_7d_ema: MetricPattern1, + pub net_realized_pnl_cumulative_30d_delta: MetricPattern1, pub net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: MetricPattern1, pub net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: MetricPattern1, pub net_realized_pnl_rel_to_realized_cap: MetricPattern1, - pub peak_regret: CumulativeHeightPattern, + pub peak_regret: CumulativeHeightPattern, pub peak_regret_rel_to_realized_cap: MetricPattern1, pub profit_flow: MetricPattern1, - pub profit_value_created: MetricPattern1, - pub profit_value_destroyed: MetricPattern1, + pub profit_value_created: MetricPattern1, + pub profit_value_destroyed: MetricPattern1, pub realized_cap: MetricPattern1, - pub realized_cap_30d_delta: MetricPattern1, + pub realized_cap_30d_delta: MetricPattern1, pub realized_cap_cents: MetricPattern1, pub realized_cap_rel_to_own_market_cap: MetricPattern1, - pub realized_loss: CumulativeHeightPattern, - pub realized_loss_1y: MetricPattern1, - pub realized_loss_24h: MetricPattern1, - pub realized_loss_30d: MetricPattern1, - pub realized_loss_7d: MetricPattern1, - pub realized_loss_7d_ema: MetricPattern1, + pub realized_loss: CumulativeHeightPattern, + pub realized_loss_1y: MetricPattern1, + pub realized_loss_24h: MetricPattern1, + pub realized_loss_30d: MetricPattern1, + pub realized_loss_7d: MetricPattern1, + pub realized_loss_7d_ema: MetricPattern1, pub realized_loss_rel_to_realized_cap: MetricPattern1, - pub realized_price: SatsUsdPattern, + pub realized_price: CentsSatsUsdPattern, pub realized_price_extra: RatioPattern2, pub realized_price_ratio_ext: RatioPattern3, - pub realized_profit: CumulativeHeightPattern, - pub realized_profit_1y: MetricPattern1, - pub realized_profit_24h: MetricPattern1, - pub realized_profit_30d: MetricPattern1, - pub realized_profit_7d: MetricPattern1, - pub realized_profit_7d_ema: MetricPattern1, + pub realized_profit: CumulativeHeightPattern, + pub realized_profit_1y: MetricPattern1, + pub realized_profit_24h: MetricPattern1, + pub realized_profit_30d: MetricPattern1, + pub realized_profit_7d: MetricPattern1, + pub realized_profit_7d_ema: MetricPattern1, pub realized_profit_rel_to_realized_cap: MetricPattern1, pub realized_profit_to_loss_ratio_1y: MetricPattern1, pub realized_profit_to_loss_ratio_24h: MetricPattern1, pub realized_profit_to_loss_ratio_30d: MetricPattern1, pub realized_profit_to_loss_ratio_7d: MetricPattern1, - pub realized_value: MetricPattern1, - pub realized_value_1y: MetricPattern1, - pub realized_value_24h: MetricPattern1, - pub realized_value_30d: MetricPattern1, - pub realized_value_7d: MetricPattern1, + pub realized_value: MetricPattern1, + pub realized_value_1y: MetricPattern1, + pub realized_value_24h: MetricPattern1, + pub realized_value_30d: MetricPattern1, + pub realized_value_7d: MetricPattern1, pub sell_side_risk_ratio: MetricPattern1, pub sell_side_risk_ratio_1y: MetricPattern1, pub sell_side_risk_ratio_24h: MetricPattern1, @@ -1422,9 +1417,9 @@ pub struct CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentS pub sell_side_risk_ratio_7d: MetricPattern1, pub sell_side_risk_ratio_7d_ema: MetricPattern1, pub sent_in_loss: BaseCumulativePattern, - pub sent_in_loss_14d_ema: BtcSatsUsdPattern, + pub sent_in_loss_14d_ema: BtcCentsSatsUsdPattern, pub sent_in_profit: BaseCumulativePattern, - pub sent_in_profit_14d_ema: BtcSatsUsdPattern, + pub sent_in_profit_14d_ema: BtcCentsSatsUsdPattern, pub sopr: MetricPattern1, pub sopr_1y: MetricPattern1, pub sopr_24h: MetricPattern1, @@ -1435,17 +1430,17 @@ pub struct CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentS pub sopr_7d: MetricPattern1, pub sopr_7d_ema: MetricPattern1, pub total_realized_pnl: MetricPattern1, - pub upper_price_band: SatsUsdPattern, - pub value_created: MetricPattern1, - pub value_created_1y: MetricPattern1, - pub value_created_24h: MetricPattern1, - pub value_created_30d: MetricPattern1, - pub value_created_7d: MetricPattern1, - pub value_destroyed: MetricPattern1, - pub value_destroyed_1y: MetricPattern1, - pub value_destroyed_24h: MetricPattern1, - pub value_destroyed_30d: MetricPattern1, - pub value_destroyed_7d: MetricPattern1, + pub upper_price_band: CentsSatsUsdPattern, + pub value_created: MetricPattern1, + pub value_created_1y: MetricPattern1, + pub value_created_24h: MetricPattern1, + pub value_created_30d: MetricPattern1, + pub value_created_7d: MetricPattern1, + pub value_destroyed: MetricPattern1, + pub value_destroyed_1y: MetricPattern1, + pub value_destroyed_24h: MetricPattern1, + pub value_destroyed_30d: MetricPattern1, + pub value_destroyed_7d: MetricPattern1, } impl CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern2 { @@ -1455,13 +1450,12 @@ impl CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTot cap_raw: MetricPattern18::new(client.clone(), _m(&acc, "cap_raw")), capitulation_flow: MetricPattern1::new(client.clone(), _m(&acc, "capitulation_flow")), investor_cap_raw: MetricPattern18::new(client.clone(), _m(&acc, "investor_cap_raw")), - investor_price: SatsUsdPattern::new(client.clone(), _m(&acc, "investor_price")), - investor_price_cents: MetricPattern1::new(client.clone(), _m(&acc, "investor_price_cents")), + investor_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "investor_price")), investor_price_extra: RatioPattern2::new(client.clone(), _m(&acc, "investor_price_ratio")), investor_price_ratio_ext: RatioPattern3::new(client.clone(), _m(&acc, "investor_price_ratio")), loss_value_created: MetricPattern1::new(client.clone(), _m(&acc, "loss_value_created")), loss_value_destroyed: MetricPattern1::new(client.clone(), _m(&acc, "loss_value_destroyed")), - lower_price_band: SatsUsdPattern::new(client.clone(), _m(&acc, "lower_price_band")), + lower_price_band: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "lower_price_band")), mvrv: MetricPattern1::new(client.clone(), _m(&acc, "mvrv")), neg_realized_loss: MetricPattern1::new(client.clone(), _m(&acc, "neg_realized_loss")), net_realized_pnl: CumulativeHeightPattern::new(client.clone(), _m(&acc, "net_realized_pnl")), @@ -1486,7 +1480,7 @@ impl CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTot realized_loss_7d: MetricPattern1::new(client.clone(), _m(&acc, "realized_loss_7d")), realized_loss_7d_ema: MetricPattern1::new(client.clone(), _m(&acc, "realized_loss_7d_ema")), realized_loss_rel_to_realized_cap: MetricPattern1::new(client.clone(), _m(&acc, "realized_loss_rel_to_realized_cap")), - realized_price: SatsUsdPattern::new(client.clone(), _m(&acc, "realized_price")), + realized_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "realized_price")), realized_price_extra: RatioPattern2::new(client.clone(), _m(&acc, "realized_price_ratio")), realized_price_ratio_ext: RatioPattern3::new(client.clone(), _m(&acc, "realized_price_ratio")), realized_profit: CumulativeHeightPattern::new(client.clone(), _m(&acc, "realized_profit")), @@ -1515,9 +1509,9 @@ impl CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTot sell_side_risk_ratio_7d: MetricPattern1::new(client.clone(), _m(&acc, "sell_side_risk_ratio_7d")), sell_side_risk_ratio_7d_ema: MetricPattern1::new(client.clone(), _m(&acc, "sell_side_risk_ratio_7d_ema")), sent_in_loss: BaseCumulativePattern::new(client.clone(), _m(&acc, "sent_in_loss")), - sent_in_loss_14d_ema: BtcSatsUsdPattern::new(client.clone(), _m(&acc, "sent_in_loss_14d_ema")), + sent_in_loss_14d_ema: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "sent_in_loss_14d_ema")), sent_in_profit: BaseCumulativePattern::new(client.clone(), _m(&acc, "sent_in_profit")), - sent_in_profit_14d_ema: BtcSatsUsdPattern::new(client.clone(), _m(&acc, "sent_in_profit_14d_ema")), + sent_in_profit_14d_ema: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "sent_in_profit_14d_ema")), sopr: MetricPattern1::new(client.clone(), _m(&acc, "sopr")), sopr_1y: MetricPattern1::new(client.clone(), _m(&acc, "sopr_1y")), sopr_24h: MetricPattern1::new(client.clone(), _m(&acc, "sopr_24h")), @@ -1528,7 +1522,7 @@ impl CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTot sopr_7d: MetricPattern1::new(client.clone(), _m(&acc, "sopr_7d")), sopr_7d_ema: MetricPattern1::new(client.clone(), _m(&acc, "sopr_7d_ema")), total_realized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "total_realized_pnl")), - upper_price_band: SatsUsdPattern::new(client.clone(), _m(&acc, "upper_price_band")), + upper_price_band: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "upper_price_band")), value_created: MetricPattern1::new(client.clone(), _m(&acc, "value_created")), value_created_1y: MetricPattern1::new(client.clone(), _m(&acc, "value_created_1y")), value_created_24h: MetricPattern1::new(client.clone(), _m(&acc, "value_created_24h")), @@ -1548,41 +1542,40 @@ pub struct CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentS pub cap_raw: MetricPattern18, pub capitulation_flow: MetricPattern1, pub investor_cap_raw: MetricPattern18, - pub investor_price: SatsUsdPattern, - pub investor_price_cents: MetricPattern1, + pub investor_price: CentsSatsUsdPattern, pub investor_price_extra: RatioPattern2, - pub loss_value_created: MetricPattern1, - pub loss_value_destroyed: MetricPattern1, - pub lower_price_band: SatsUsdPattern, + pub loss_value_created: MetricPattern1, + pub loss_value_destroyed: MetricPattern1, + pub lower_price_band: CentsSatsUsdPattern, pub mvrv: MetricPattern1, pub neg_realized_loss: MetricPattern1, - pub net_realized_pnl: CumulativeHeightPattern, - pub net_realized_pnl_7d_ema: MetricPattern1, - pub net_realized_pnl_cumulative_30d_delta: MetricPattern1, + pub net_realized_pnl: CumulativeHeightPattern, + pub net_realized_pnl_7d_ema: MetricPattern1, + pub net_realized_pnl_cumulative_30d_delta: MetricPattern1, pub net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: MetricPattern1, pub net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: MetricPattern1, pub net_realized_pnl_rel_to_realized_cap: MetricPattern1, - pub peak_regret: CumulativeHeightPattern, + pub peak_regret: CumulativeHeightPattern, pub peak_regret_rel_to_realized_cap: MetricPattern1, pub profit_flow: MetricPattern1, - pub profit_value_created: MetricPattern1, - pub profit_value_destroyed: MetricPattern1, + pub profit_value_created: MetricPattern1, + pub profit_value_destroyed: MetricPattern1, pub realized_cap: MetricPattern1, - pub realized_cap_30d_delta: MetricPattern1, + pub realized_cap_30d_delta: MetricPattern1, pub realized_cap_cents: MetricPattern1, - pub realized_loss: CumulativeHeightPattern, - pub realized_loss_7d_ema: MetricPattern1, + pub realized_loss: CumulativeHeightPattern, + pub realized_loss_7d_ema: MetricPattern1, pub realized_loss_rel_to_realized_cap: MetricPattern1, - pub realized_price: SatsUsdPattern, + pub realized_price: CentsSatsUsdPattern, pub realized_price_extra: RatioPattern2, - pub realized_profit: CumulativeHeightPattern, - pub realized_profit_7d_ema: MetricPattern1, + pub realized_profit: CumulativeHeightPattern, + pub realized_profit_7d_ema: MetricPattern1, pub realized_profit_rel_to_realized_cap: MetricPattern1, - pub realized_value: MetricPattern1, - pub realized_value_1y: MetricPattern1, - pub realized_value_24h: MetricPattern1, - pub realized_value_30d: MetricPattern1, - pub realized_value_7d: MetricPattern1, + pub realized_value: MetricPattern1, + pub realized_value_1y: MetricPattern1, + pub realized_value_24h: MetricPattern1, + pub realized_value_30d: MetricPattern1, + pub realized_value_7d: MetricPattern1, pub sell_side_risk_ratio: MetricPattern1, pub sell_side_risk_ratio_1y: MetricPattern1, pub sell_side_risk_ratio_24h: MetricPattern1, @@ -1593,9 +1586,9 @@ pub struct CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentS pub sell_side_risk_ratio_7d: MetricPattern1, pub sell_side_risk_ratio_7d_ema: MetricPattern1, pub sent_in_loss: BaseCumulativePattern, - pub sent_in_loss_14d_ema: BtcSatsUsdPattern, + pub sent_in_loss_14d_ema: BtcCentsSatsUsdPattern, pub sent_in_profit: BaseCumulativePattern, - pub sent_in_profit_14d_ema: BtcSatsUsdPattern, + pub sent_in_profit_14d_ema: BtcCentsSatsUsdPattern, pub sopr: MetricPattern1, pub sopr_1y: MetricPattern1, pub sopr_24h: MetricPattern1, @@ -1606,17 +1599,17 @@ pub struct CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentS pub sopr_7d: MetricPattern1, pub sopr_7d_ema: MetricPattern1, pub total_realized_pnl: MetricPattern1, - pub upper_price_band: SatsUsdPattern, - pub value_created: MetricPattern1, - pub value_created_1y: MetricPattern1, - pub value_created_24h: MetricPattern1, - pub value_created_30d: MetricPattern1, - pub value_created_7d: MetricPattern1, - pub value_destroyed: MetricPattern1, - pub value_destroyed_1y: MetricPattern1, - pub value_destroyed_24h: MetricPattern1, - pub value_destroyed_30d: MetricPattern1, - pub value_destroyed_7d: MetricPattern1, + pub upper_price_band: CentsSatsUsdPattern, + pub value_created: MetricPattern1, + pub value_created_1y: MetricPattern1, + pub value_created_24h: MetricPattern1, + pub value_created_30d: MetricPattern1, + pub value_created_7d: MetricPattern1, + pub value_destroyed: MetricPattern1, + pub value_destroyed_1y: MetricPattern1, + pub value_destroyed_24h: MetricPattern1, + pub value_destroyed_30d: MetricPattern1, + pub value_destroyed_7d: MetricPattern1, } impl CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern { @@ -1626,12 +1619,11 @@ impl CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTot cap_raw: MetricPattern18::new(client.clone(), _m(&acc, "cap_raw")), capitulation_flow: MetricPattern1::new(client.clone(), _m(&acc, "capitulation_flow")), investor_cap_raw: MetricPattern18::new(client.clone(), _m(&acc, "investor_cap_raw")), - investor_price: SatsUsdPattern::new(client.clone(), _m(&acc, "investor_price")), - investor_price_cents: MetricPattern1::new(client.clone(), _m(&acc, "investor_price_cents")), + investor_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "investor_price")), investor_price_extra: RatioPattern2::new(client.clone(), _m(&acc, "investor_price_ratio")), loss_value_created: MetricPattern1::new(client.clone(), _m(&acc, "loss_value_created")), loss_value_destroyed: MetricPattern1::new(client.clone(), _m(&acc, "loss_value_destroyed")), - lower_price_band: SatsUsdPattern::new(client.clone(), _m(&acc, "lower_price_band")), + lower_price_band: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "lower_price_band")), mvrv: MetricPattern1::new(client.clone(), _m(&acc, "mvrv")), neg_realized_loss: MetricPattern1::new(client.clone(), _m(&acc, "neg_realized_loss")), net_realized_pnl: CumulativeHeightPattern::new(client.clone(), _m(&acc, "net_realized_pnl")), @@ -1651,7 +1643,7 @@ impl CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTot realized_loss: CumulativeHeightPattern::new(client.clone(), _m(&acc, "realized_loss")), realized_loss_7d_ema: MetricPattern1::new(client.clone(), _m(&acc, "realized_loss_7d_ema")), realized_loss_rel_to_realized_cap: MetricPattern1::new(client.clone(), _m(&acc, "realized_loss_rel_to_realized_cap")), - realized_price: SatsUsdPattern::new(client.clone(), _m(&acc, "realized_price")), + realized_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "realized_price")), realized_price_extra: RatioPattern2::new(client.clone(), _m(&acc, "realized_price_ratio")), realized_profit: CumulativeHeightPattern::new(client.clone(), _m(&acc, "realized_profit")), realized_profit_7d_ema: MetricPattern1::new(client.clone(), _m(&acc, "realized_profit_7d_ema")), @@ -1671,9 +1663,9 @@ impl CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTot sell_side_risk_ratio_7d: MetricPattern1::new(client.clone(), _m(&acc, "sell_side_risk_ratio_7d")), sell_side_risk_ratio_7d_ema: MetricPattern1::new(client.clone(), _m(&acc, "sell_side_risk_ratio_7d_ema")), sent_in_loss: BaseCumulativePattern::new(client.clone(), _m(&acc, "sent_in_loss")), - sent_in_loss_14d_ema: BtcSatsUsdPattern::new(client.clone(), _m(&acc, "sent_in_loss_14d_ema")), + sent_in_loss_14d_ema: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "sent_in_loss_14d_ema")), sent_in_profit: BaseCumulativePattern::new(client.clone(), _m(&acc, "sent_in_profit")), - sent_in_profit_14d_ema: BtcSatsUsdPattern::new(client.clone(), _m(&acc, "sent_in_profit_14d_ema")), + sent_in_profit_14d_ema: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "sent_in_profit_14d_ema")), sopr: MetricPattern1::new(client.clone(), _m(&acc, "sopr")), sopr_1y: MetricPattern1::new(client.clone(), _m(&acc, "sopr_1y")), sopr_24h: MetricPattern1::new(client.clone(), _m(&acc, "sopr_24h")), @@ -1684,7 +1676,7 @@ impl CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTot sopr_7d: MetricPattern1::new(client.clone(), _m(&acc, "sopr_7d")), sopr_7d_ema: MetricPattern1::new(client.clone(), _m(&acc, "sopr_7d_ema")), total_realized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "total_realized_pnl")), - upper_price_band: SatsUsdPattern::new(client.clone(), _m(&acc, "upper_price_band")), + upper_price_band: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "upper_price_band")), value_created: MetricPattern1::new(client.clone(), _m(&acc, "value_created")), value_created_1y: MetricPattern1::new(client.clone(), _m(&acc, "value_created_1y")), value_created_24h: MetricPattern1::new(client.clone(), _m(&acc, "value_created_24h")), @@ -1701,31 +1693,31 @@ impl CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTot /// Pattern struct for repeated tree structure. pub struct _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern { - pub _0sd_usd: SatsUsdPattern, + pub _0sd_price: CentsSatsUsdPattern, pub m0_5sd: MetricPattern1, - pub m0_5sd_usd: SatsUsdPattern, + pub m0_5sd_price: CentsSatsUsdPattern, pub m1_5sd: MetricPattern1, - pub m1_5sd_usd: SatsUsdPattern, + pub m1_5sd_price: CentsSatsUsdPattern, pub m1sd: MetricPattern1, - pub m1sd_usd: SatsUsdPattern, + pub m1sd_price: CentsSatsUsdPattern, pub m2_5sd: MetricPattern1, - pub m2_5sd_usd: SatsUsdPattern, + pub m2_5sd_price: CentsSatsUsdPattern, pub m2sd: MetricPattern1, - pub m2sd_usd: SatsUsdPattern, + pub m2sd_price: CentsSatsUsdPattern, pub m3sd: MetricPattern1, - pub m3sd_usd: SatsUsdPattern, + pub m3sd_price: CentsSatsUsdPattern, pub p0_5sd: MetricPattern1, - pub p0_5sd_usd: SatsUsdPattern, + pub p0_5sd_price: CentsSatsUsdPattern, pub p1_5sd: MetricPattern1, - pub p1_5sd_usd: SatsUsdPattern, + pub p1_5sd_price: CentsSatsUsdPattern, pub p1sd: MetricPattern1, - pub p1sd_usd: SatsUsdPattern, + pub p1sd_price: CentsSatsUsdPattern, pub p2_5sd: MetricPattern1, - pub p2_5sd_usd: SatsUsdPattern, + pub p2_5sd_price: CentsSatsUsdPattern, pub p2sd: MetricPattern1, - pub p2sd_usd: SatsUsdPattern, + pub p2sd_price: CentsSatsUsdPattern, pub p3sd: MetricPattern1, - pub p3sd_usd: SatsUsdPattern, + pub p3sd_price: CentsSatsUsdPattern, pub sd: MetricPattern1, pub sma: MetricPattern1, pub zscore: MetricPattern1, @@ -1735,31 +1727,31 @@ impl _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - _0sd_usd: SatsUsdPattern::new(client.clone(), _m(&acc, "0sd_usd")), + _0sd_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "0sd")), m0_5sd: MetricPattern1::new(client.clone(), _m(&acc, "m0_5sd")), - m0_5sd_usd: SatsUsdPattern::new(client.clone(), _m(&acc, "m0_5sd_usd")), + m0_5sd_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "m0_5sd")), m1_5sd: MetricPattern1::new(client.clone(), _m(&acc, "m1_5sd")), - m1_5sd_usd: SatsUsdPattern::new(client.clone(), _m(&acc, "m1_5sd_usd")), + m1_5sd_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "m1_5sd")), m1sd: MetricPattern1::new(client.clone(), _m(&acc, "m1sd")), - m1sd_usd: SatsUsdPattern::new(client.clone(), _m(&acc, "m1sd_usd")), + m1sd_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "m1sd")), m2_5sd: MetricPattern1::new(client.clone(), _m(&acc, "m2_5sd")), - m2_5sd_usd: SatsUsdPattern::new(client.clone(), _m(&acc, "m2_5sd_usd")), + m2_5sd_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "m2_5sd")), m2sd: MetricPattern1::new(client.clone(), _m(&acc, "m2sd")), - m2sd_usd: SatsUsdPattern::new(client.clone(), _m(&acc, "m2sd_usd")), + m2sd_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "m2sd")), m3sd: MetricPattern1::new(client.clone(), _m(&acc, "m3sd")), - m3sd_usd: SatsUsdPattern::new(client.clone(), _m(&acc, "m3sd_usd")), + m3sd_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "m3sd")), p0_5sd: MetricPattern1::new(client.clone(), _m(&acc, "p0_5sd")), - p0_5sd_usd: SatsUsdPattern::new(client.clone(), _m(&acc, "p0_5sd_usd")), + p0_5sd_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "p0_5sd")), p1_5sd: MetricPattern1::new(client.clone(), _m(&acc, "p1_5sd")), - p1_5sd_usd: SatsUsdPattern::new(client.clone(), _m(&acc, "p1_5sd_usd")), + p1_5sd_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "p1_5sd")), p1sd: MetricPattern1::new(client.clone(), _m(&acc, "p1sd")), - p1sd_usd: SatsUsdPattern::new(client.clone(), _m(&acc, "p1sd_usd")), + p1sd_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "p1sd")), p2_5sd: MetricPattern1::new(client.clone(), _m(&acc, "p2_5sd")), - p2_5sd_usd: SatsUsdPattern::new(client.clone(), _m(&acc, "p2_5sd_usd")), + p2_5sd_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "p2_5sd")), p2sd: MetricPattern1::new(client.clone(), _m(&acc, "p2sd")), - p2sd_usd: SatsUsdPattern::new(client.clone(), _m(&acc, "p2sd_usd")), + p2sd_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "p2sd")), p3sd: MetricPattern1::new(client.clone(), _m(&acc, "p3sd")), - p3sd_usd: SatsUsdPattern::new(client.clone(), _m(&acc, "p3sd_usd")), + p3sd_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "p3sd")), sd: MetricPattern1::new(client.clone(), _m(&acc, "sd")), sma: MetricPattern1::new(client.clone(), _m(&acc, "sma")), zscore: MetricPattern1::new(client.clone(), _m(&acc, "zscore")), @@ -1823,7 +1815,7 @@ impl InvestedNegNetNuplSupplyUnrealizedPattern2 { /// Pattern struct for repeated tree structure. pub struct PriceRatioPattern { - pub price: SatsUsdPattern, + pub price: CentsSatsUsdPattern, pub ratio: MetricPattern1, pub ratio_1m_sma: MetricPattern1, pub ratio_1w_sma: MetricPattern1, @@ -1831,17 +1823,17 @@ pub struct PriceRatioPattern { pub ratio_2y_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern, pub ratio_4y_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern, pub ratio_pct1: MetricPattern1, - pub ratio_pct1_usd: SatsUsdPattern, + pub ratio_pct1_price: CentsSatsUsdPattern, pub ratio_pct2: MetricPattern1, - pub ratio_pct2_usd: SatsUsdPattern, + pub ratio_pct2_price: CentsSatsUsdPattern, pub ratio_pct5: MetricPattern1, - pub ratio_pct5_usd: SatsUsdPattern, + pub ratio_pct5_price: CentsSatsUsdPattern, pub ratio_pct95: MetricPattern1, - pub ratio_pct95_usd: SatsUsdPattern, + pub ratio_pct95_price: CentsSatsUsdPattern, pub ratio_pct98: MetricPattern1, - pub ratio_pct98_usd: SatsUsdPattern, + pub ratio_pct98_price: CentsSatsUsdPattern, pub ratio_pct99: MetricPattern1, - pub ratio_pct99_usd: SatsUsdPattern, + pub ratio_pct99_price: CentsSatsUsdPattern, pub ratio_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern, } @@ -1849,7 +1841,7 @@ impl PriceRatioPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - price: SatsUsdPattern::new(client.clone(), acc.clone()), + price: CentsSatsUsdPattern::new(client.clone(), acc.clone()), ratio: MetricPattern1::new(client.clone(), _m(&acc, "ratio")), ratio_1m_sma: MetricPattern1::new(client.clone(), _m(&acc, "ratio_1m_sma")), ratio_1w_sma: MetricPattern1::new(client.clone(), _m(&acc, "ratio_1w_sma")), @@ -1857,17 +1849,17 @@ impl PriceRatioPattern { ratio_2y_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern::new(client.clone(), _m(&acc, "ratio_2y")), ratio_4y_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern::new(client.clone(), _m(&acc, "ratio_4y")), ratio_pct1: MetricPattern1::new(client.clone(), _m(&acc, "ratio_pct1")), - ratio_pct1_usd: SatsUsdPattern::new(client.clone(), _m(&acc, "ratio_pct1_usd")), + ratio_pct1_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "ratio_pct1")), ratio_pct2: MetricPattern1::new(client.clone(), _m(&acc, "ratio_pct2")), - ratio_pct2_usd: SatsUsdPattern::new(client.clone(), _m(&acc, "ratio_pct2_usd")), + ratio_pct2_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "ratio_pct2")), ratio_pct5: MetricPattern1::new(client.clone(), _m(&acc, "ratio_pct5")), - ratio_pct5_usd: SatsUsdPattern::new(client.clone(), _m(&acc, "ratio_pct5_usd")), + ratio_pct5_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "ratio_pct5")), ratio_pct95: MetricPattern1::new(client.clone(), _m(&acc, "ratio_pct95")), - ratio_pct95_usd: SatsUsdPattern::new(client.clone(), _m(&acc, "ratio_pct95_usd")), + ratio_pct95_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "ratio_pct95")), ratio_pct98: MetricPattern1::new(client.clone(), _m(&acc, "ratio_pct98")), - ratio_pct98_usd: SatsUsdPattern::new(client.clone(), _m(&acc, "ratio_pct98_usd")), + ratio_pct98_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "ratio_pct98")), ratio_pct99: MetricPattern1::new(client.clone(), _m(&acc, "ratio_pct99")), - ratio_pct99_usd: SatsUsdPattern::new(client.clone(), _m(&acc, "ratio_pct99_usd")), + ratio_pct99_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "ratio_pct99")), ratio_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern::new(client.clone(), _m(&acc, "ratio")), } } @@ -1875,50 +1867,50 @@ impl PriceRatioPattern { /// Pattern struct for repeated tree structure. pub struct Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern { - pub pct05: SatsUsdPattern, - pub pct10: SatsUsdPattern, - pub pct15: SatsUsdPattern, - pub pct20: SatsUsdPattern, - pub pct25: SatsUsdPattern, - pub pct30: SatsUsdPattern, - pub pct35: SatsUsdPattern, - pub pct40: SatsUsdPattern, - pub pct45: SatsUsdPattern, - pub pct50: SatsUsdPattern, - pub pct55: SatsUsdPattern, - pub pct60: SatsUsdPattern, - pub pct65: SatsUsdPattern, - pub pct70: SatsUsdPattern, - pub pct75: SatsUsdPattern, - pub pct80: SatsUsdPattern, - pub pct85: SatsUsdPattern, - pub pct90: SatsUsdPattern, - pub pct95: SatsUsdPattern, + pub pct05: CentsSatsUsdPattern, + pub pct10: CentsSatsUsdPattern, + pub pct15: CentsSatsUsdPattern, + pub pct20: CentsSatsUsdPattern, + pub pct25: CentsSatsUsdPattern, + pub pct30: CentsSatsUsdPattern, + pub pct35: CentsSatsUsdPattern, + pub pct40: CentsSatsUsdPattern, + pub pct45: CentsSatsUsdPattern, + pub pct50: CentsSatsUsdPattern, + pub pct55: CentsSatsUsdPattern, + pub pct60: CentsSatsUsdPattern, + pub pct65: CentsSatsUsdPattern, + pub pct70: CentsSatsUsdPattern, + pub pct75: CentsSatsUsdPattern, + pub pct80: CentsSatsUsdPattern, + pub pct85: CentsSatsUsdPattern, + pub pct90: CentsSatsUsdPattern, + pub pct95: CentsSatsUsdPattern, } impl Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - pct05: SatsUsdPattern::new(client.clone(), _m(&acc, "pct05")), - pct10: SatsUsdPattern::new(client.clone(), _m(&acc, "pct10")), - pct15: SatsUsdPattern::new(client.clone(), _m(&acc, "pct15")), - pct20: SatsUsdPattern::new(client.clone(), _m(&acc, "pct20")), - pct25: SatsUsdPattern::new(client.clone(), _m(&acc, "pct25")), - pct30: SatsUsdPattern::new(client.clone(), _m(&acc, "pct30")), - pct35: SatsUsdPattern::new(client.clone(), _m(&acc, "pct35")), - pct40: SatsUsdPattern::new(client.clone(), _m(&acc, "pct40")), - pct45: SatsUsdPattern::new(client.clone(), _m(&acc, "pct45")), - pct50: SatsUsdPattern::new(client.clone(), _m(&acc, "pct50")), - pct55: SatsUsdPattern::new(client.clone(), _m(&acc, "pct55")), - pct60: SatsUsdPattern::new(client.clone(), _m(&acc, "pct60")), - pct65: SatsUsdPattern::new(client.clone(), _m(&acc, "pct65")), - pct70: SatsUsdPattern::new(client.clone(), _m(&acc, "pct70")), - pct75: SatsUsdPattern::new(client.clone(), _m(&acc, "pct75")), - pct80: SatsUsdPattern::new(client.clone(), _m(&acc, "pct80")), - pct85: SatsUsdPattern::new(client.clone(), _m(&acc, "pct85")), - pct90: SatsUsdPattern::new(client.clone(), _m(&acc, "pct90")), - pct95: SatsUsdPattern::new(client.clone(), _m(&acc, "pct95")), + pct05: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "pct05")), + pct10: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "pct10")), + pct15: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "pct15")), + pct20: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "pct20")), + pct25: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "pct25")), + pct30: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "pct30")), + pct35: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "pct35")), + pct40: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "pct40")), + pct45: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "pct45")), + pct50: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "pct50")), + pct55: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "pct55")), + pct60: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "pct60")), + pct65: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "pct65")), + pct70: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "pct70")), + pct75: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "pct75")), + pct80: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "pct80")), + pct85: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "pct85")), + pct90: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "pct90")), + pct95: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "pct95")), } } } @@ -1932,17 +1924,17 @@ pub struct RatioPattern { pub ratio_2y_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern, pub ratio_4y_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern, pub ratio_pct1: MetricPattern1, - pub ratio_pct1_usd: SatsUsdPattern, + pub ratio_pct1_price: CentsSatsUsdPattern, pub ratio_pct2: MetricPattern1, - pub ratio_pct2_usd: SatsUsdPattern, + pub ratio_pct2_price: CentsSatsUsdPattern, pub ratio_pct5: MetricPattern1, - pub ratio_pct5_usd: SatsUsdPattern, + pub ratio_pct5_price: CentsSatsUsdPattern, pub ratio_pct95: MetricPattern1, - pub ratio_pct95_usd: SatsUsdPattern, + pub ratio_pct95_price: CentsSatsUsdPattern, pub ratio_pct98: MetricPattern1, - pub ratio_pct98_usd: SatsUsdPattern, + pub ratio_pct98_price: CentsSatsUsdPattern, pub ratio_pct99: MetricPattern1, - pub ratio_pct99_usd: SatsUsdPattern, + pub ratio_pct99_price: CentsSatsUsdPattern, pub ratio_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern, } @@ -1957,17 +1949,17 @@ impl RatioPattern { ratio_2y_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern::new(client.clone(), _m(&acc, "2y")), ratio_4y_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern::new(client.clone(), _m(&acc, "4y")), ratio_pct1: MetricPattern1::new(client.clone(), _m(&acc, "pct1")), - ratio_pct1_usd: SatsUsdPattern::new(client.clone(), _m(&acc, "pct1_usd")), + ratio_pct1_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "pct1")), ratio_pct2: MetricPattern1::new(client.clone(), _m(&acc, "pct2")), - ratio_pct2_usd: SatsUsdPattern::new(client.clone(), _m(&acc, "pct2_usd")), + ratio_pct2_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "pct2")), ratio_pct5: MetricPattern1::new(client.clone(), _m(&acc, "pct5")), - ratio_pct5_usd: SatsUsdPattern::new(client.clone(), _m(&acc, "pct5_usd")), + ratio_pct5_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "pct5")), ratio_pct95: MetricPattern1::new(client.clone(), _m(&acc, "pct95")), - ratio_pct95_usd: SatsUsdPattern::new(client.clone(), _m(&acc, "pct95_usd")), + ratio_pct95_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "pct95")), ratio_pct98: MetricPattern1::new(client.clone(), _m(&acc, "pct98")), - ratio_pct98_usd: SatsUsdPattern::new(client.clone(), _m(&acc, "pct98_usd")), + ratio_pct98_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "pct98")), ratio_pct99: MetricPattern1::new(client.clone(), _m(&acc, "pct99")), - ratio_pct99_usd: SatsUsdPattern::new(client.clone(), _m(&acc, "pct99_usd")), + ratio_pct99_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "pct99")), ratio_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern::new(client.clone(), acc.clone()), } } @@ -1981,17 +1973,17 @@ pub struct RatioPattern3 { pub ratio_2y_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern, pub ratio_4y_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern, pub ratio_pct1: MetricPattern1, - pub ratio_pct1_usd: SatsUsdPattern, + pub ratio_pct1_price: CentsSatsUsdPattern, pub ratio_pct2: MetricPattern1, - pub ratio_pct2_usd: SatsUsdPattern, + pub ratio_pct2_price: CentsSatsUsdPattern, pub ratio_pct5: MetricPattern1, - pub ratio_pct5_usd: SatsUsdPattern, + pub ratio_pct5_price: CentsSatsUsdPattern, pub ratio_pct95: MetricPattern1, - pub ratio_pct95_usd: SatsUsdPattern, + pub ratio_pct95_price: CentsSatsUsdPattern, pub ratio_pct98: MetricPattern1, - pub ratio_pct98_usd: SatsUsdPattern, + pub ratio_pct98_price: CentsSatsUsdPattern, pub ratio_pct99: MetricPattern1, - pub ratio_pct99_usd: SatsUsdPattern, + pub ratio_pct99_price: CentsSatsUsdPattern, pub ratio_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern, } @@ -2005,17 +1997,17 @@ impl RatioPattern3 { ratio_2y_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern::new(client.clone(), _m(&acc, "2y")), ratio_4y_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern::new(client.clone(), _m(&acc, "4y")), ratio_pct1: MetricPattern1::new(client.clone(), _m(&acc, "pct1")), - ratio_pct1_usd: SatsUsdPattern::new(client.clone(), _m(&acc, "pct1_usd")), + ratio_pct1_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "pct1")), ratio_pct2: MetricPattern1::new(client.clone(), _m(&acc, "pct2")), - ratio_pct2_usd: SatsUsdPattern::new(client.clone(), _m(&acc, "pct2_usd")), + ratio_pct2_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "pct2")), ratio_pct5: MetricPattern1::new(client.clone(), _m(&acc, "pct5")), - ratio_pct5_usd: SatsUsdPattern::new(client.clone(), _m(&acc, "pct5_usd")), + ratio_pct5_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "pct5")), ratio_pct95: MetricPattern1::new(client.clone(), _m(&acc, "pct95")), - ratio_pct95_usd: SatsUsdPattern::new(client.clone(), _m(&acc, "pct95_usd")), + ratio_pct95_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "pct95")), ratio_pct98: MetricPattern1::new(client.clone(), _m(&acc, "pct98")), - ratio_pct98_usd: SatsUsdPattern::new(client.clone(), _m(&acc, "pct98_usd")), + ratio_pct98_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "pct98")), ratio_pct99: MetricPattern1::new(client.clone(), _m(&acc, "pct99")), - ratio_pct99_usd: SatsUsdPattern::new(client.clone(), _m(&acc, "pct99_usd")), + ratio_pct99_price: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "pct99")), ratio_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern::new(client.clone(), acc.clone()), } } @@ -2035,8 +2027,8 @@ pub struct GreedInvestedInvestorNegNetPainPeakSupplyTotalUnrealizedPattern { pub net_unrealized_pnl: MetricPattern1, pub pain_index: MetricPattern1, pub peak_regret: MetricPattern1, - pub supply_in_loss: BtcSatsUsdPattern, - pub supply_in_profit: BtcSatsUsdPattern, + pub supply_in_loss: BtcCentsSatsUsdPattern, + pub supply_in_profit: BtcCentsSatsUsdPattern, pub total_unrealized_pnl: MetricPattern1, pub unrealized_loss: MetricPattern1, pub unrealized_profit: MetricPattern1, @@ -2058,8 +2050,8 @@ impl GreedInvestedInvestorNegNetPainPeakSupplyTotalUnrealizedPattern { net_unrealized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "net_unrealized_pnl")), pain_index: MetricPattern1::new(client.clone(), _m(&acc, "pain_index")), peak_regret: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_peak_regret")), - supply_in_loss: BtcSatsUsdPattern::new(client.clone(), _m(&acc, "supply_in_loss")), - supply_in_profit: BtcSatsUsdPattern::new(client.clone(), _m(&acc, "supply_in_profit")), + supply_in_loss: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "supply_in_loss")), + supply_in_profit: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "supply_in_profit")), total_unrealized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "total_unrealized_pnl")), unrealized_loss: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_loss")), unrealized_profit: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_profit")), @@ -2080,8 +2072,8 @@ pub struct GreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern { pub net_sentiment: MetricPattern1, pub net_unrealized_pnl: MetricPattern1, pub pain_index: MetricPattern1, - pub supply_in_loss: BtcSatsUsdPattern, - pub supply_in_profit: BtcSatsUsdPattern, + pub supply_in_loss: BtcCentsSatsUsdPattern, + pub supply_in_profit: BtcCentsSatsUsdPattern, pub total_unrealized_pnl: MetricPattern1, pub unrealized_loss: MetricPattern1, pub unrealized_profit: MetricPattern1, @@ -2102,8 +2094,8 @@ impl GreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern { net_sentiment: MetricPattern1::new(client.clone(), _m(&acc, "net_sentiment")), net_unrealized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "net_unrealized_pnl")), pain_index: MetricPattern1::new(client.clone(), _m(&acc, "pain_index")), - supply_in_loss: BtcSatsUsdPattern::new(client.clone(), _m(&acc, "supply_in_loss")), - supply_in_profit: BtcSatsUsdPattern::new(client.clone(), _m(&acc, "supply_in_profit")), + supply_in_loss: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "supply_in_loss")), + supply_in_profit: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "supply_in_profit")), total_unrealized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "total_unrealized_pnl")), unrealized_loss: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_loss")), unrealized_profit: MetricPattern1::new(client.clone(), _m(&acc, "unrealized_profit")), @@ -2193,36 +2185,36 @@ impl InvestedNegNetNuplSupplyUnrealizedPattern4 { /// Pattern struct for repeated tree structure. pub struct _10y1m1w1y2y3m3y4y5y6m6y8yPattern3 { - pub _10y: BtcSatsUsdPattern, - pub _1m: BtcSatsUsdPattern, - pub _1w: BtcSatsUsdPattern, - pub _1y: BtcSatsUsdPattern, - pub _2y: BtcSatsUsdPattern, - pub _3m: BtcSatsUsdPattern, - pub _3y: BtcSatsUsdPattern, - pub _4y: BtcSatsUsdPattern, - pub _5y: BtcSatsUsdPattern, - pub _6m: BtcSatsUsdPattern, - pub _6y: BtcSatsUsdPattern, - pub _8y: BtcSatsUsdPattern, + pub _10y: BtcCentsSatsUsdPattern, + pub _1m: BtcCentsSatsUsdPattern, + pub _1w: BtcCentsSatsUsdPattern, + pub _1y: BtcCentsSatsUsdPattern, + pub _2y: BtcCentsSatsUsdPattern, + pub _3m: BtcCentsSatsUsdPattern, + pub _3y: BtcCentsSatsUsdPattern, + pub _4y: BtcCentsSatsUsdPattern, + pub _5y: BtcCentsSatsUsdPattern, + pub _6m: BtcCentsSatsUsdPattern, + pub _6y: BtcCentsSatsUsdPattern, + pub _8y: BtcCentsSatsUsdPattern, } impl _10y1m1w1y2y3m3y4y5y6m6y8yPattern3 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - _10y: BtcSatsUsdPattern::new(client.clone(), _p("10y", &acc)), - _1m: BtcSatsUsdPattern::new(client.clone(), _p("1m", &acc)), - _1w: BtcSatsUsdPattern::new(client.clone(), _p("1w", &acc)), - _1y: BtcSatsUsdPattern::new(client.clone(), _p("1y", &acc)), - _2y: BtcSatsUsdPattern::new(client.clone(), _p("2y", &acc)), - _3m: BtcSatsUsdPattern::new(client.clone(), _p("3m", &acc)), - _3y: BtcSatsUsdPattern::new(client.clone(), _p("3y", &acc)), - _4y: BtcSatsUsdPattern::new(client.clone(), _p("4y", &acc)), - _5y: BtcSatsUsdPattern::new(client.clone(), _p("5y", &acc)), - _6m: BtcSatsUsdPattern::new(client.clone(), _p("6m", &acc)), - _6y: BtcSatsUsdPattern::new(client.clone(), _p("6y", &acc)), - _8y: BtcSatsUsdPattern::new(client.clone(), _p("8y", &acc)), + _10y: BtcCentsSatsUsdPattern::new(client.clone(), _p("10y", &acc)), + _1m: BtcCentsSatsUsdPattern::new(client.clone(), _p("1m", &acc)), + _1w: BtcCentsSatsUsdPattern::new(client.clone(), _p("1w", &acc)), + _1y: BtcCentsSatsUsdPattern::new(client.clone(), _p("1y", &acc)), + _2y: BtcCentsSatsUsdPattern::new(client.clone(), _p("2y", &acc)), + _3m: BtcCentsSatsUsdPattern::new(client.clone(), _p("3m", &acc)), + _3y: BtcCentsSatsUsdPattern::new(client.clone(), _p("3y", &acc)), + _4y: BtcCentsSatsUsdPattern::new(client.clone(), _p("4y", &acc)), + _5y: BtcCentsSatsUsdPattern::new(client.clone(), _p("5y", &acc)), + _6m: BtcCentsSatsUsdPattern::new(client.clone(), _p("6m", &acc)), + _6y: BtcCentsSatsUsdPattern::new(client.clone(), _p("6y", &acc)), + _8y: BtcCentsSatsUsdPattern::new(client.clone(), _p("8y", &acc)), } } } @@ -2497,30 +2489,30 @@ impl AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern { /// Pattern struct for repeated tree structure. pub struct AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2 { - pub average: BtcSatsUsdPattern, - pub max: BtcSatsUsdPattern, - pub median: BtcSatsUsdPattern, - pub min: BtcSatsUsdPattern, - pub pct10: BtcSatsUsdPattern, - pub pct25: BtcSatsUsdPattern, - pub pct75: BtcSatsUsdPattern, - pub pct90: BtcSatsUsdPattern, - pub sum: BtcSatsUsdPattern, + pub average: BtcCentsSatsUsdPattern, + pub max: BtcCentsSatsUsdPattern, + pub median: BtcCentsSatsUsdPattern, + pub min: BtcCentsSatsUsdPattern, + pub pct10: BtcCentsSatsUsdPattern, + pub pct25: BtcCentsSatsUsdPattern, + pub pct75: BtcCentsSatsUsdPattern, + pub pct90: BtcCentsSatsUsdPattern, + pub sum: BtcCentsSatsUsdPattern, } impl AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - average: BtcSatsUsdPattern::new(client.clone(), _m(&acc, "average")), - max: BtcSatsUsdPattern::new(client.clone(), _m(&acc, "max")), - median: BtcSatsUsdPattern::new(client.clone(), _m(&acc, "median")), - min: BtcSatsUsdPattern::new(client.clone(), _m(&acc, "min")), - pct10: BtcSatsUsdPattern::new(client.clone(), _m(&acc, "p10")), - pct25: BtcSatsUsdPattern::new(client.clone(), _m(&acc, "p25")), - pct75: BtcSatsUsdPattern::new(client.clone(), _m(&acc, "p75")), - pct90: BtcSatsUsdPattern::new(client.clone(), _m(&acc, "p90")), - sum: BtcSatsUsdPattern::new(client.clone(), _m(&acc, "sum")), + average: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "average")), + max: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "max")), + median: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "median")), + min: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "min")), + pct10: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "p10")), + pct25: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "p25")), + pct75: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "p75")), + pct90: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "p90")), + sum: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "sum")), } } } @@ -2585,6 +2577,34 @@ impl AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern, + pub cents: MetricPattern18, + pub sats: MetricPattern18, + pub usd: MetricPattern18, +} + +impl _1y24h30d7dBtcCentsSatsUsdPattern { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + _1y: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "1y")), + _24h: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "24h")), + _30d: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "30d")), + _7d: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "7d")), + btc: MetricPattern18::new(client.clone(), _m(&acc, "btc")), + cents: MetricPattern18::new(client.clone(), _m(&acc, "cents")), + sats: MetricPattern18::new(client.clone(), acc.clone()), + usd: MetricPattern18::new(client.clone(), _m(&acc, "usd")), + } + } +} + /// Pattern struct for repeated tree structure. pub struct AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern { pub average: MetricPattern18, @@ -2639,32 +2659,6 @@ impl _10y2y3y4y5y6y8yPattern { } } -/// Pattern struct for repeated tree structure. -pub struct _1y24h30d7dBtcSatsUsdPattern { - pub _1y: BtcSatsUsdPattern, - pub _24h: BtcSatsUsdPattern, - pub _30d: BtcSatsUsdPattern, - pub _7d: BtcSatsUsdPattern, - pub btc: MetricPattern18, - pub sats: MetricPattern18, - pub usd: MetricPattern18, -} - -impl _1y24h30d7dBtcSatsUsdPattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - _1y: BtcSatsUsdPattern::new(client.clone(), _m(&acc, "1y")), - _24h: BtcSatsUsdPattern::new(client.clone(), _m(&acc, "24h")), - _30d: BtcSatsUsdPattern::new(client.clone(), _m(&acc, "30d")), - _7d: BtcSatsUsdPattern::new(client.clone(), _m(&acc, "7d")), - btc: MetricPattern18::new(client.clone(), _m(&acc, "btc")), - sats: MetricPattern18::new(client.clone(), acc.clone()), - usd: MetricPattern18::new(client.clone(), _m(&acc, "usd")), - } - } -} - /// Pattern struct for repeated tree structure. pub struct ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern { pub activity: CoinblocksCoindaysSatblocksSatdaysSentPattern, @@ -2775,8 +2769,8 @@ pub struct _1y24h30d7dBaseCumulativePattern { pub _24h: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2, pub _30d: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2, pub _7d: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2, - pub base: BtcSatsUsdPattern, - pub cumulative: BtcSatsUsdPattern, + pub base: BtcCentsSatsUsdPattern, + pub cumulative: BtcCentsSatsUsdPattern, } impl _1y24h30d7dBaseCumulativePattern { @@ -2787,8 +2781,8 @@ impl _1y24h30d7dBaseCumulativePattern { _24h: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), _m(&acc, "24h")), _30d: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), _m(&acc, "30d")), _7d: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2::new(client.clone(), _m(&acc, "7d")), - base: BtcSatsUsdPattern::new(client.clone(), acc.clone()), - cumulative: BtcSatsUsdPattern::new(client.clone(), _m(&acc, "cumulative")), + base: BtcCentsSatsUsdPattern::new(client.clone(), acc.clone()), + cumulative: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "cumulative")), } } } @@ -2824,7 +2818,7 @@ pub struct CoinblocksCoindaysSatblocksSatdaysSentPattern { pub satblocks_destroyed: MetricPattern18, pub satdays_destroyed: MetricPattern18, pub sent: BaseCumulativePattern, - pub sent_14d_ema: BtcSatsUsdPattern, + pub sent_14d_ema: BtcCentsSatsUsdPattern, } impl CoinblocksCoindaysSatblocksSatdaysSentPattern { @@ -2836,7 +2830,7 @@ impl CoinblocksCoindaysSatblocksSatdaysSentPattern { satblocks_destroyed: MetricPattern18::new(client.clone(), _m(&acc, "satblocks_destroyed")), satdays_destroyed: MetricPattern18::new(client.clone(), _m(&acc, "satdays_destroyed")), sent: BaseCumulativePattern::new(client.clone(), _m(&acc, "sent")), - sent_14d_ema: BtcSatsUsdPattern::new(client.clone(), _m(&acc, "sent_14d_ema")), + sent_14d_ema: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "sent_14d_ema")), } } } @@ -2844,8 +2838,8 @@ impl CoinblocksCoindaysSatblocksSatdaysSentPattern { /// Pattern struct for repeated tree structure. pub struct InvestedMaxMinPercentilesSpotPattern { pub invested_capital: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern, - pub max: SatsUsdPattern, - pub min: SatsUsdPattern, + pub max: CentsSatsUsdPattern, + pub min: CentsSatsUsdPattern, pub percentiles: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern, pub spot_cost_basis_percentile: MetricPattern1, pub spot_invested_capital_percentile: MetricPattern1, @@ -2856,8 +2850,8 @@ impl InvestedMaxMinPercentilesSpotPattern { pub fn new(client: Arc, acc: String) -> Self { Self { invested_capital: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern::new(client.clone(), _m(&acc, "invested_capital")), - max: SatsUsdPattern::new(client.clone(), _m(&acc, "max_cost_basis")), - min: SatsUsdPattern::new(client.clone(), _m(&acc, "min_cost_basis")), + max: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "max_cost_basis")), + min: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "min_cost_basis")), percentiles: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern::new(client.clone(), _m(&acc, "cost_basis")), spot_cost_basis_percentile: MetricPattern1::new(client.clone(), _m(&acc, "spot_cost_basis_percentile")), spot_invested_capital_percentile: MetricPattern1::new(client.clone(), _m(&acc, "spot_invested_capital_percentile")), @@ -2867,20 +2861,40 @@ impl InvestedMaxMinPercentilesSpotPattern { /// Pattern struct for repeated tree structure. pub struct _1y24h30d7dPattern2 { - pub _1y: BtcSatsUsdPattern, - pub _24h: BtcSatsUsdPattern, - pub _30d: BtcSatsUsdPattern, - pub _7d: BtcSatsUsdPattern, + pub _1y: BtcCentsSatsUsdPattern, + pub _24h: BtcCentsSatsUsdPattern, + pub _30d: BtcCentsSatsUsdPattern, + pub _7d: BtcCentsSatsUsdPattern, } impl _1y24h30d7dPattern2 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - _1y: BtcSatsUsdPattern::new(client.clone(), _m(&acc, "1y")), - _24h: BtcSatsUsdPattern::new(client.clone(), _m(&acc, "24h")), - _30d: BtcSatsUsdPattern::new(client.clone(), _m(&acc, "30d")), - _7d: BtcSatsUsdPattern::new(client.clone(), _m(&acc, "7d")), + _1y: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "1y")), + _24h: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "24h")), + _30d: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "30d")), + _7d: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "7d")), + } + } +} + +/// Pattern struct for repeated tree structure. +pub struct BtcCentsSatsUsdPattern { + pub btc: MetricPattern1, + pub cents: MetricPattern1, + pub sats: MetricPattern1, + pub usd: MetricPattern1, +} + +impl BtcCentsSatsUsdPattern { + /// Create a new pattern node with accumulated metric name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + btc: MetricPattern1::new(client.clone(), _m(&acc, "btc")), + cents: MetricPattern1::new(client.clone(), _m(&acc, "cents")), + sats: MetricPattern1::new(client.clone(), acc.clone()), + usd: MetricPattern1::new(client.clone(), _m(&acc, "usd")), } } } @@ -2907,26 +2921,26 @@ impl _1y24h30d7dPattern { /// Pattern struct for repeated tree structure. pub struct _30dHalvedTotalPattern { - pub _30d_change: BtcSatsUsdPattern, + pub _30d_change: BtcCentsSatsUsdPattern, pub halved: BtcSatsUsdPattern, - pub total: BtcSatsUsdPattern, + pub total: BtcCentsSatsUsdPattern, } impl _30dHalvedTotalPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - _30d_change: BtcSatsUsdPattern::new(client.clone(), _m(&acc, "_30d_change")), + _30d_change: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "_30d_change")), halved: BtcSatsUsdPattern::new(client.clone(), _m(&acc, "supply_halved")), - total: BtcSatsUsdPattern::new(client.clone(), _m(&acc, "supply")), + total: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "supply")), } } } /// Pattern struct for repeated tree structure. pub struct BaseCumulativeSumPattern { - pub base: BtcSatsUsdPattern, - pub cumulative: BtcSatsUsdPattern, + pub base: BtcCentsSatsUsdPattern, + pub cumulative: BtcCentsSatsUsdPattern, pub sum: _1y24h30d7dPattern2, } @@ -2934,8 +2948,8 @@ impl BaseCumulativeSumPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - base: BtcSatsUsdPattern::new(client.clone(), acc.clone()), - cumulative: BtcSatsUsdPattern::new(client.clone(), _m(&acc, "cumulative")), + base: BtcCentsSatsUsdPattern::new(client.clone(), acc.clone()), + cumulative: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "cumulative")), sum: _1y24h30d7dPattern2::new(client.clone(), _m(&acc, "sum")), } } @@ -2960,13 +2974,13 @@ impl BtcSatsUsdPattern { } /// Pattern struct for repeated tree structure. -pub struct CentsSatsUsdPattern { +pub struct CentsSatsUsdPattern2 { pub cents: MetricPattern2, pub sats: MetricPattern2, pub usd: MetricPattern2, } -impl CentsSatsUsdPattern { +impl CentsSatsUsdPattern2 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -2977,6 +2991,24 @@ impl CentsSatsUsdPattern { } } +/// Pattern struct for repeated tree structure. +pub struct CentsSatsUsdPattern { + pub cents: MetricPattern1, + pub sats: MetricPattern1, + pub usd: MetricPattern1, +} + +impl CentsSatsUsdPattern { + /// 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")), + sats: MetricPattern1::new(client.clone(), _m(&acc, "sats")), + usd: MetricPattern1::new(client.clone(), _m(&acc, "usd")), + } + } +} + /// Pattern struct for repeated tree structure. pub struct HistogramLineSignalPattern { pub histogram: MetricPattern1, @@ -3049,64 +3081,32 @@ impl _30dCountPattern { /// Pattern struct for repeated tree structure. pub struct BaseCumulativePattern { - pub base: BtcSatsUsdPattern, - pub cumulative: BtcSatsUsdPattern, + pub base: BtcCentsSatsUsdPattern, + pub cumulative: BtcCentsSatsUsdPattern, } impl BaseCumulativePattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - base: BtcSatsUsdPattern::new(client.clone(), acc.clone()), - cumulative: BtcSatsUsdPattern::new(client.clone(), _m(&acc, "cumulative")), - } - } -} - -/// Pattern struct for repeated tree structure. -pub struct CumulativeHeightPattern { - pub cumulative: MetricPattern1, - pub height: MetricPattern18, -} - -impl CumulativeHeightPattern { - /// 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")), - height: MetricPattern18::new(client.clone(), acc.clone()), + base: BtcCentsSatsUsdPattern::new(client.clone(), acc.clone()), + cumulative: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "cumulative")), } } } /// Pattern struct for repeated tree structure. pub struct MaxMinPattern { - pub max: SatsUsdPattern, - pub min: SatsUsdPattern, + pub max: CentsSatsUsdPattern, + pub min: CentsSatsUsdPattern, } impl MaxMinPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - max: SatsUsdPattern::new(client.clone(), _m(&acc, "max_cost_basis")), - min: SatsUsdPattern::new(client.clone(), _m(&acc, "min_cost_basis")), - } - } -} - -/// Pattern struct for repeated tree structure. -pub struct SatsUsdPattern { - pub sats: MetricPattern1, - pub usd: MetricPattern1, -} - -impl SatsUsdPattern { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - sats: MetricPattern1::new(client.clone(), _m(&acc, "sats")), - usd: MetricPattern1::new(client.clone(), acc.clone()), + max: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "max_cost_basis")), + min: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "min_cost_basis")), } } } @@ -3143,6 +3143,22 @@ impl UtxoPattern { } } +/// Pattern struct for repeated tree structure. +pub struct CumulativeHeightPattern { + pub cumulative: MetricPattern1, + pub height: MetricPattern18, +} + +impl CumulativeHeightPattern { + /// 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")), + height: MetricPattern18::new(client.clone(), acc.clone()), + } + } +} + /// Pattern struct for repeated tree structure. pub struct RatioPattern2 { pub ratio: MetricPattern1, @@ -3544,9 +3560,9 @@ impl MetricsTree_Transactions_Versions { /// Metrics tree node. pub struct MetricsTree_Transactions_Volume { - pub sent_sum: _1y24h30d7dBtcSatsUsdPattern, - pub received_sum: _1y24h30d7dBtcSatsUsdPattern, - pub annualized_volume: BtcSatsUsdPattern, + pub sent_sum: _1y24h30d7dBtcCentsSatsUsdPattern, + pub received_sum: _1y24h30d7dBtcCentsSatsUsdPattern, + pub annualized_volume: BtcCentsSatsUsdPattern, pub tx_per_sec: MetricPattern1, pub outputs_per_sec: MetricPattern1, pub inputs_per_sec: MetricPattern1, @@ -3555,9 +3571,9 @@ pub struct MetricsTree_Transactions_Volume { impl MetricsTree_Transactions_Volume { pub fn new(client: Arc, base_path: String) -> Self { Self { - sent_sum: _1y24h30d7dBtcSatsUsdPattern::new(client.clone(), "sent_sum".to_string()), - received_sum: _1y24h30d7dBtcSatsUsdPattern::new(client.clone(), "received_sum".to_string()), - annualized_volume: BtcSatsUsdPattern::new(client.clone(), "annualized_volume".to_string()), + sent_sum: _1y24h30d7dBtcCentsSatsUsdPattern::new(client.clone(), "sent_sum".to_string()), + received_sum: _1y24h30d7dBtcCentsSatsUsdPattern::new(client.clone(), "received_sum".to_string()), + annualized_volume: BtcCentsSatsUsdPattern::new(client.clone(), "annualized_volume".to_string()), tx_per_sec: MetricPattern1::new(client.clone(), "tx_per_sec".to_string()), outputs_per_sec: MetricPattern1::new(client.clone(), "outputs_per_sec".to_string()), inputs_per_sec: MetricPattern1::new(client.clone(), "inputs_per_sec".to_string()), @@ -3963,15 +3979,15 @@ impl MetricsTree_Cointime_Activity { /// Metrics tree node. pub struct MetricsTree_Cointime_Supply { - pub vaulted_supply: BtcSatsUsdPattern, - pub active_supply: BtcSatsUsdPattern, + pub vaulted_supply: BtcCentsSatsUsdPattern, + pub active_supply: BtcCentsSatsUsdPattern, } impl MetricsTree_Cointime_Supply { pub fn new(client: Arc, base_path: String) -> Self { Self { - vaulted_supply: BtcSatsUsdPattern::new(client.clone(), "vaulted_supply".to_string()), - active_supply: BtcSatsUsdPattern::new(client.clone(), "active_supply".to_string()), + vaulted_supply: BtcCentsSatsUsdPattern::new(client.clone(), "vaulted_supply".to_string()), + active_supply: BtcCentsSatsUsdPattern::new(client.clone(), "active_supply".to_string()), } } } @@ -4018,26 +4034,26 @@ impl MetricsTree_Cointime_Cap { /// Metrics tree node. pub struct MetricsTree_Cointime_Pricing { - pub vaulted_price: SatsUsdPattern, + pub vaulted_price: CentsSatsUsdPattern, pub vaulted_price_ratio: RatioPattern, - pub active_price: SatsUsdPattern, + pub active_price: CentsSatsUsdPattern, pub active_price_ratio: RatioPattern, - pub true_market_mean: SatsUsdPattern, + pub true_market_mean: CentsSatsUsdPattern, pub true_market_mean_ratio: RatioPattern, - pub cointime_price: SatsUsdPattern, + pub cointime_price: CentsSatsUsdPattern, pub cointime_price_ratio: RatioPattern, } impl MetricsTree_Cointime_Pricing { pub fn new(client: Arc, base_path: String) -> Self { Self { - vaulted_price: SatsUsdPattern::new(client.clone(), "vaulted_price".to_string()), + vaulted_price: CentsSatsUsdPattern::new(client.clone(), "vaulted_price".to_string()), vaulted_price_ratio: RatioPattern::new(client.clone(), "vaulted_price_ratio".to_string()), - active_price: SatsUsdPattern::new(client.clone(), "active_price".to_string()), + active_price: CentsSatsUsdPattern::new(client.clone(), "active_price".to_string()), active_price_ratio: RatioPattern::new(client.clone(), "active_price_ratio".to_string()), - true_market_mean: SatsUsdPattern::new(client.clone(), "true_market_mean".to_string()), + true_market_mean: CentsSatsUsdPattern::new(client.clone(), "true_market_mean".to_string()), true_market_mean_ratio: RatioPattern::new(client.clone(), "true_market_mean_ratio".to_string()), - cointime_price: SatsUsdPattern::new(client.clone(), "cointime_price".to_string()), + cointime_price: CentsSatsUsdPattern::new(client.clone(), "cointime_price".to_string()), cointime_price_ratio: RatioPattern::new(client.clone(), "cointime_price_ratio".to_string()), } } @@ -4726,7 +4742,7 @@ impl MetricsTree_Market { /// Metrics tree node. pub struct MetricsTree_Market_Ath { - pub price_ath: SatsUsdPattern, + pub price_ath: CentsSatsUsdPattern, pub price_drawdown: MetricPattern1, pub days_since_price_ath: MetricPattern1, pub years_since_price_ath: MetricPattern2, @@ -4737,7 +4753,7 @@ pub struct MetricsTree_Market_Ath { impl MetricsTree_Market_Ath { pub fn new(client: Arc, base_path: String) -> Self { Self { - price_ath: SatsUsdPattern::new(client.clone(), "price_ath".to_string()), + price_ath: CentsSatsUsdPattern::new(client.clone(), "price_ath".to_string()), price_drawdown: MetricPattern1::new(client.clone(), "price_drawdown".to_string()), days_since_price_ath: MetricPattern1::new(client.clone(), "days_since_price_ath".to_string()), years_since_price_ath: MetricPattern2::new(client.clone(), "years_since_price_ath".to_string()), @@ -4749,37 +4765,37 @@ impl MetricsTree_Market_Ath { /// Metrics tree node. pub struct MetricsTree_Market_Lookback { - pub _24h: SatsUsdPattern, - pub _1w: SatsUsdPattern, - pub _1m: SatsUsdPattern, - pub _3m: SatsUsdPattern, - pub _6m: SatsUsdPattern, - pub _1y: SatsUsdPattern, - pub _2y: SatsUsdPattern, - pub _3y: SatsUsdPattern, - pub _4y: SatsUsdPattern, - pub _5y: SatsUsdPattern, - pub _6y: SatsUsdPattern, - pub _8y: SatsUsdPattern, - pub _10y: SatsUsdPattern, + pub _24h: CentsSatsUsdPattern, + pub _1w: CentsSatsUsdPattern, + pub _1m: CentsSatsUsdPattern, + pub _3m: CentsSatsUsdPattern, + pub _6m: CentsSatsUsdPattern, + pub _1y: CentsSatsUsdPattern, + pub _2y: CentsSatsUsdPattern, + pub _3y: CentsSatsUsdPattern, + pub _4y: CentsSatsUsdPattern, + pub _5y: CentsSatsUsdPattern, + pub _6y: CentsSatsUsdPattern, + pub _8y: CentsSatsUsdPattern, + pub _10y: CentsSatsUsdPattern, } impl MetricsTree_Market_Lookback { pub fn new(client: Arc, base_path: String) -> Self { Self { - _24h: SatsUsdPattern::new(client.clone(), "price_24h_ago".to_string()), - _1w: SatsUsdPattern::new(client.clone(), "price_1w_ago".to_string()), - _1m: SatsUsdPattern::new(client.clone(), "price_1m_ago".to_string()), - _3m: SatsUsdPattern::new(client.clone(), "price_3m_ago".to_string()), - _6m: SatsUsdPattern::new(client.clone(), "price_6m_ago".to_string()), - _1y: SatsUsdPattern::new(client.clone(), "price_1y_ago".to_string()), - _2y: SatsUsdPattern::new(client.clone(), "price_2y_ago".to_string()), - _3y: SatsUsdPattern::new(client.clone(), "price_3y_ago".to_string()), - _4y: SatsUsdPattern::new(client.clone(), "price_4y_ago".to_string()), - _5y: SatsUsdPattern::new(client.clone(), "price_5y_ago".to_string()), - _6y: SatsUsdPattern::new(client.clone(), "price_6y_ago".to_string()), - _8y: SatsUsdPattern::new(client.clone(), "price_8y_ago".to_string()), - _10y: SatsUsdPattern::new(client.clone(), "price_10y_ago".to_string()), + _24h: CentsSatsUsdPattern::new(client.clone(), "price_24h_ago".to_string()), + _1w: CentsSatsUsdPattern::new(client.clone(), "price_1w_ago".to_string()), + _1m: CentsSatsUsdPattern::new(client.clone(), "price_1m_ago".to_string()), + _3m: CentsSatsUsdPattern::new(client.clone(), "price_3m_ago".to_string()), + _6m: CentsSatsUsdPattern::new(client.clone(), "price_6m_ago".to_string()), + _1y: CentsSatsUsdPattern::new(client.clone(), "price_1y_ago".to_string()), + _2y: CentsSatsUsdPattern::new(client.clone(), "price_2y_ago".to_string()), + _3y: CentsSatsUsdPattern::new(client.clone(), "price_3y_ago".to_string()), + _4y: CentsSatsUsdPattern::new(client.clone(), "price_4y_ago".to_string()), + _5y: CentsSatsUsdPattern::new(client.clone(), "price_5y_ago".to_string()), + _6y: CentsSatsUsdPattern::new(client.clone(), "price_6y_ago".to_string()), + _8y: CentsSatsUsdPattern::new(client.clone(), "price_8y_ago".to_string()), + _10y: CentsSatsUsdPattern::new(client.clone(), "price_10y_ago".to_string()), } } } @@ -4881,14 +4897,14 @@ impl MetricsTree_Market_Volatility { /// Metrics tree node. pub struct MetricsTree_Market_Range { - pub price_1w_min: SatsUsdPattern, - pub price_1w_max: SatsUsdPattern, - pub price_2w_min: SatsUsdPattern, - pub price_2w_max: SatsUsdPattern, - pub price_1m_min: SatsUsdPattern, - pub price_1m_max: SatsUsdPattern, - pub price_1y_min: SatsUsdPattern, - pub price_1y_max: SatsUsdPattern, + pub price_1w_min: CentsSatsUsdPattern, + pub price_1w_max: CentsSatsUsdPattern, + pub price_2w_min: CentsSatsUsdPattern, + pub price_2w_max: CentsSatsUsdPattern, + pub price_1m_min: CentsSatsUsdPattern, + pub price_1m_max: CentsSatsUsdPattern, + pub price_1y_min: CentsSatsUsdPattern, + pub price_1y_max: CentsSatsUsdPattern, pub price_true_range: MetricPattern1, pub price_true_range_2w_sum: MetricPattern1, pub price_2w_choppiness_index: MetricPattern1, @@ -4897,14 +4913,14 @@ pub struct MetricsTree_Market_Range { impl MetricsTree_Market_Range { pub fn new(client: Arc, base_path: String) -> Self { Self { - price_1w_min: SatsUsdPattern::new(client.clone(), "price_1w_min".to_string()), - price_1w_max: SatsUsdPattern::new(client.clone(), "price_1w_max".to_string()), - price_2w_min: SatsUsdPattern::new(client.clone(), "price_2w_min".to_string()), - price_2w_max: SatsUsdPattern::new(client.clone(), "price_2w_max".to_string()), - price_1m_min: SatsUsdPattern::new(client.clone(), "price_1m_min".to_string()), - price_1m_max: SatsUsdPattern::new(client.clone(), "price_1m_max".to_string()), - price_1y_min: SatsUsdPattern::new(client.clone(), "price_1y_min".to_string()), - price_1y_max: SatsUsdPattern::new(client.clone(), "price_1y_max".to_string()), + price_1w_min: CentsSatsUsdPattern::new(client.clone(), "price_1w_min".to_string()), + price_1w_max: CentsSatsUsdPattern::new(client.clone(), "price_1w_max".to_string()), + price_2w_min: CentsSatsUsdPattern::new(client.clone(), "price_2w_min".to_string()), + price_2w_max: CentsSatsUsdPattern::new(client.clone(), "price_2w_max".to_string()), + price_1m_min: CentsSatsUsdPattern::new(client.clone(), "price_1m_min".to_string()), + price_1m_max: CentsSatsUsdPattern::new(client.clone(), "price_1m_max".to_string()), + price_1y_min: CentsSatsUsdPattern::new(client.clone(), "price_1y_min".to_string()), + price_1y_max: CentsSatsUsdPattern::new(client.clone(), "price_1y_max".to_string()), price_true_range: MetricPattern1::new(client.clone(), "price_true_range".to_string()), price_true_range_2w_sum: MetricPattern1::new(client.clone(), "price_true_range_2w_sum".to_string()), price_2w_choppiness_index: MetricPattern1::new(client.clone(), "price_2w_choppiness_index".to_string()), @@ -4946,9 +4962,9 @@ pub struct MetricsTree_Market_MovingAverage { pub price_2y_ema: PriceRatioPattern, pub price_200w_ema: PriceRatioPattern, pub price_4y_ema: PriceRatioPattern, - pub price_200d_sma_x2_4: SatsUsdPattern, - pub price_200d_sma_x0_8: SatsUsdPattern, - pub price_350d_sma_x2: SatsUsdPattern, + pub price_200d_sma_x2_4: CentsSatsUsdPattern, + pub price_200d_sma_x0_8: CentsSatsUsdPattern, + pub price_350d_sma_x2: CentsSatsUsdPattern, } impl MetricsTree_Market_MovingAverage { @@ -4986,9 +5002,9 @@ impl MetricsTree_Market_MovingAverage { price_2y_ema: PriceRatioPattern::new(client.clone(), "price_2y_ema".to_string()), price_200w_ema: PriceRatioPattern::new(client.clone(), "price_200w_ema".to_string()), price_4y_ema: PriceRatioPattern::new(client.clone(), "price_4y_ema".to_string()), - price_200d_sma_x2_4: SatsUsdPattern::new(client.clone(), "price_200d_sma_x2_4".to_string()), - price_200d_sma_x0_8: SatsUsdPattern::new(client.clone(), "price_200d_sma_x0_8".to_string()), - price_350d_sma_x2: SatsUsdPattern::new(client.clone(), "price_350d_sma_x2".to_string()), + price_200d_sma_x2_4: CentsSatsUsdPattern::new(client.clone(), "price_200d_sma_x2_4".to_string()), + price_200d_sma_x0_8: CentsSatsUsdPattern::new(client.clone(), "price_200d_sma_x0_8".to_string()), + price_350d_sma_x2: CentsSatsUsdPattern::new(client.clone(), "price_350d_sma_x2".to_string()), } } } @@ -5050,105 +5066,105 @@ impl MetricsTree_Market_Dca { /// Metrics tree node. pub struct MetricsTree_Market_Dca_PeriodAveragePrice { - pub _1w: SatsUsdPattern, - pub _1m: SatsUsdPattern, - pub _3m: SatsUsdPattern, - pub _6m: SatsUsdPattern, - pub _1y: SatsUsdPattern, - pub _2y: SatsUsdPattern, - pub _3y: SatsUsdPattern, - pub _4y: SatsUsdPattern, - pub _5y: SatsUsdPattern, - pub _6y: SatsUsdPattern, - pub _8y: SatsUsdPattern, - pub _10y: SatsUsdPattern, + pub _1w: CentsSatsUsdPattern, + pub _1m: CentsSatsUsdPattern, + pub _3m: CentsSatsUsdPattern, + pub _6m: CentsSatsUsdPattern, + pub _1y: CentsSatsUsdPattern, + pub _2y: CentsSatsUsdPattern, + pub _3y: CentsSatsUsdPattern, + pub _4y: CentsSatsUsdPattern, + pub _5y: CentsSatsUsdPattern, + pub _6y: CentsSatsUsdPattern, + pub _8y: CentsSatsUsdPattern, + pub _10y: CentsSatsUsdPattern, } impl MetricsTree_Market_Dca_PeriodAveragePrice { pub fn new(client: Arc, base_path: String) -> Self { Self { - _1w: SatsUsdPattern::new(client.clone(), "1w_dca_average_price".to_string()), - _1m: SatsUsdPattern::new(client.clone(), "1m_dca_average_price".to_string()), - _3m: SatsUsdPattern::new(client.clone(), "3m_dca_average_price".to_string()), - _6m: SatsUsdPattern::new(client.clone(), "6m_dca_average_price".to_string()), - _1y: SatsUsdPattern::new(client.clone(), "1y_dca_average_price".to_string()), - _2y: SatsUsdPattern::new(client.clone(), "2y_dca_average_price".to_string()), - _3y: SatsUsdPattern::new(client.clone(), "3y_dca_average_price".to_string()), - _4y: SatsUsdPattern::new(client.clone(), "4y_dca_average_price".to_string()), - _5y: SatsUsdPattern::new(client.clone(), "5y_dca_average_price".to_string()), - _6y: SatsUsdPattern::new(client.clone(), "6y_dca_average_price".to_string()), - _8y: SatsUsdPattern::new(client.clone(), "8y_dca_average_price".to_string()), - _10y: SatsUsdPattern::new(client.clone(), "10y_dca_average_price".to_string()), + _1w: CentsSatsUsdPattern::new(client.clone(), "1w_dca_average_price".to_string()), + _1m: CentsSatsUsdPattern::new(client.clone(), "1m_dca_average_price".to_string()), + _3m: CentsSatsUsdPattern::new(client.clone(), "3m_dca_average_price".to_string()), + _6m: CentsSatsUsdPattern::new(client.clone(), "6m_dca_average_price".to_string()), + _1y: CentsSatsUsdPattern::new(client.clone(), "1y_dca_average_price".to_string()), + _2y: CentsSatsUsdPattern::new(client.clone(), "2y_dca_average_price".to_string()), + _3y: CentsSatsUsdPattern::new(client.clone(), "3y_dca_average_price".to_string()), + _4y: CentsSatsUsdPattern::new(client.clone(), "4y_dca_average_price".to_string()), + _5y: CentsSatsUsdPattern::new(client.clone(), "5y_dca_average_price".to_string()), + _6y: CentsSatsUsdPattern::new(client.clone(), "6y_dca_average_price".to_string()), + _8y: CentsSatsUsdPattern::new(client.clone(), "8y_dca_average_price".to_string()), + _10y: CentsSatsUsdPattern::new(client.clone(), "10y_dca_average_price".to_string()), } } } /// Metrics tree node. pub struct MetricsTree_Market_Dca_ClassStack { - pub _2015: BtcSatsUsdPattern, - pub _2016: BtcSatsUsdPattern, - pub _2017: BtcSatsUsdPattern, - pub _2018: BtcSatsUsdPattern, - pub _2019: BtcSatsUsdPattern, - pub _2020: BtcSatsUsdPattern, - pub _2021: BtcSatsUsdPattern, - pub _2022: BtcSatsUsdPattern, - pub _2023: BtcSatsUsdPattern, - pub _2024: BtcSatsUsdPattern, - pub _2025: BtcSatsUsdPattern, - pub _2026: BtcSatsUsdPattern, + pub _2015: BtcCentsSatsUsdPattern, + pub _2016: BtcCentsSatsUsdPattern, + pub _2017: BtcCentsSatsUsdPattern, + pub _2018: BtcCentsSatsUsdPattern, + pub _2019: BtcCentsSatsUsdPattern, + pub _2020: BtcCentsSatsUsdPattern, + pub _2021: BtcCentsSatsUsdPattern, + pub _2022: BtcCentsSatsUsdPattern, + pub _2023: BtcCentsSatsUsdPattern, + pub _2024: BtcCentsSatsUsdPattern, + pub _2025: BtcCentsSatsUsdPattern, + pub _2026: BtcCentsSatsUsdPattern, } impl MetricsTree_Market_Dca_ClassStack { pub fn new(client: Arc, base_path: String) -> Self { Self { - _2015: BtcSatsUsdPattern::new(client.clone(), "dca_class_2015_stack".to_string()), - _2016: BtcSatsUsdPattern::new(client.clone(), "dca_class_2016_stack".to_string()), - _2017: BtcSatsUsdPattern::new(client.clone(), "dca_class_2017_stack".to_string()), - _2018: BtcSatsUsdPattern::new(client.clone(), "dca_class_2018_stack".to_string()), - _2019: BtcSatsUsdPattern::new(client.clone(), "dca_class_2019_stack".to_string()), - _2020: BtcSatsUsdPattern::new(client.clone(), "dca_class_2020_stack".to_string()), - _2021: BtcSatsUsdPattern::new(client.clone(), "dca_class_2021_stack".to_string()), - _2022: BtcSatsUsdPattern::new(client.clone(), "dca_class_2022_stack".to_string()), - _2023: BtcSatsUsdPattern::new(client.clone(), "dca_class_2023_stack".to_string()), - _2024: BtcSatsUsdPattern::new(client.clone(), "dca_class_2024_stack".to_string()), - _2025: BtcSatsUsdPattern::new(client.clone(), "dca_class_2025_stack".to_string()), - _2026: BtcSatsUsdPattern::new(client.clone(), "dca_class_2026_stack".to_string()), + _2015: BtcCentsSatsUsdPattern::new(client.clone(), "dca_class_2015_stack".to_string()), + _2016: BtcCentsSatsUsdPattern::new(client.clone(), "dca_class_2016_stack".to_string()), + _2017: BtcCentsSatsUsdPattern::new(client.clone(), "dca_class_2017_stack".to_string()), + _2018: BtcCentsSatsUsdPattern::new(client.clone(), "dca_class_2018_stack".to_string()), + _2019: BtcCentsSatsUsdPattern::new(client.clone(), "dca_class_2019_stack".to_string()), + _2020: BtcCentsSatsUsdPattern::new(client.clone(), "dca_class_2020_stack".to_string()), + _2021: BtcCentsSatsUsdPattern::new(client.clone(), "dca_class_2021_stack".to_string()), + _2022: BtcCentsSatsUsdPattern::new(client.clone(), "dca_class_2022_stack".to_string()), + _2023: BtcCentsSatsUsdPattern::new(client.clone(), "dca_class_2023_stack".to_string()), + _2024: BtcCentsSatsUsdPattern::new(client.clone(), "dca_class_2024_stack".to_string()), + _2025: BtcCentsSatsUsdPattern::new(client.clone(), "dca_class_2025_stack".to_string()), + _2026: BtcCentsSatsUsdPattern::new(client.clone(), "dca_class_2026_stack".to_string()), } } } /// Metrics tree node. pub struct MetricsTree_Market_Dca_ClassAveragePrice { - pub _2015: SatsUsdPattern, - pub _2016: SatsUsdPattern, - pub _2017: SatsUsdPattern, - pub _2018: SatsUsdPattern, - pub _2019: SatsUsdPattern, - pub _2020: SatsUsdPattern, - pub _2021: SatsUsdPattern, - pub _2022: SatsUsdPattern, - pub _2023: SatsUsdPattern, - pub _2024: SatsUsdPattern, - pub _2025: SatsUsdPattern, - pub _2026: SatsUsdPattern, + pub _2015: CentsSatsUsdPattern, + pub _2016: CentsSatsUsdPattern, + pub _2017: CentsSatsUsdPattern, + pub _2018: CentsSatsUsdPattern, + pub _2019: CentsSatsUsdPattern, + pub _2020: CentsSatsUsdPattern, + pub _2021: CentsSatsUsdPattern, + pub _2022: CentsSatsUsdPattern, + pub _2023: CentsSatsUsdPattern, + pub _2024: CentsSatsUsdPattern, + pub _2025: CentsSatsUsdPattern, + pub _2026: CentsSatsUsdPattern, } impl MetricsTree_Market_Dca_ClassAveragePrice { pub fn new(client: Arc, base_path: String) -> Self { Self { - _2015: SatsUsdPattern::new(client.clone(), "dca_class_2015_average_price".to_string()), - _2016: SatsUsdPattern::new(client.clone(), "dca_class_2016_average_price".to_string()), - _2017: SatsUsdPattern::new(client.clone(), "dca_class_2017_average_price".to_string()), - _2018: SatsUsdPattern::new(client.clone(), "dca_class_2018_average_price".to_string()), - _2019: SatsUsdPattern::new(client.clone(), "dca_class_2019_average_price".to_string()), - _2020: SatsUsdPattern::new(client.clone(), "dca_class_2020_average_price".to_string()), - _2021: SatsUsdPattern::new(client.clone(), "dca_class_2021_average_price".to_string()), - _2022: SatsUsdPattern::new(client.clone(), "dca_class_2022_average_price".to_string()), - _2023: SatsUsdPattern::new(client.clone(), "dca_class_2023_average_price".to_string()), - _2024: SatsUsdPattern::new(client.clone(), "dca_class_2024_average_price".to_string()), - _2025: SatsUsdPattern::new(client.clone(), "dca_class_2025_average_price".to_string()), - _2026: SatsUsdPattern::new(client.clone(), "dca_class_2026_average_price".to_string()), + _2015: CentsSatsUsdPattern::new(client.clone(), "dca_class_2015_average_price".to_string()), + _2016: CentsSatsUsdPattern::new(client.clone(), "dca_class_2016_average_price".to_string()), + _2017: CentsSatsUsdPattern::new(client.clone(), "dca_class_2017_average_price".to_string()), + _2018: CentsSatsUsdPattern::new(client.clone(), "dca_class_2018_average_price".to_string()), + _2019: CentsSatsUsdPattern::new(client.clone(), "dca_class_2019_average_price".to_string()), + _2020: CentsSatsUsdPattern::new(client.clone(), "dca_class_2020_average_price".to_string()), + _2021: CentsSatsUsdPattern::new(client.clone(), "dca_class_2021_average_price".to_string()), + _2022: CentsSatsUsdPattern::new(client.clone(), "dca_class_2022_average_price".to_string()), + _2023: CentsSatsUsdPattern::new(client.clone(), "dca_class_2023_average_price".to_string()), + _2024: CentsSatsUsdPattern::new(client.clone(), "dca_class_2024_average_price".to_string()), + _2025: CentsSatsUsdPattern::new(client.clone(), "dca_class_2025_average_price".to_string()), + _2026: CentsSatsUsdPattern::new(client.clone(), "dca_class_2026_average_price".to_string()), } } } @@ -5871,18 +5887,18 @@ impl MetricsTree_Prices { /// Metrics tree node. pub struct MetricsTree_Prices_Split { - pub open: CentsSatsUsdPattern, - pub high: CentsSatsUsdPattern, - pub low: CentsSatsUsdPattern, + pub open: CentsSatsUsdPattern2, + pub high: CentsSatsUsdPattern2, + pub low: CentsSatsUsdPattern2, pub close: MetricsTree_Prices_Split_Close, } impl MetricsTree_Prices_Split { pub fn new(client: Arc, base_path: String) -> Self { Self { - open: CentsSatsUsdPattern::new(client.clone(), "price_open".to_string()), - high: CentsSatsUsdPattern::new(client.clone(), "price_high".to_string()), - low: CentsSatsUsdPattern::new(client.clone(), "price_low".to_string()), + open: CentsSatsUsdPattern2::new(client.clone(), "price_open".to_string()), + high: CentsSatsUsdPattern2::new(client.clone(), "price_high".to_string()), + low: CentsSatsUsdPattern2::new(client.clone(), "price_low".to_string()), close: MetricsTree_Prices_Split_Close::new(client.clone(), format!("{base_path}_close")), } } diff --git a/crates/brk_computer/src/cointime/pricing/compute.rs b/crates/brk_computer/src/cointime/pricing/compute.rs index b46c15071..292f22509 100644 --- a/crates/brk_computer/src/cointime/pricing/compute.rs +++ b/crates/brk_computer/src/cointime/pricing/compute.rs @@ -1,4 +1,5 @@ use brk_error::Result; +use brk_types::Cents; use vecdb::Exit; use super::super::{activity, cap, supply}; @@ -32,13 +33,16 @@ impl Vecs { .metrics .realized .realized_price - .usd + .cents .height; - self.vaulted_price.usd.height.compute_divide( + self.vaulted_price.cents.height.compute_transform2( starting_indexes.height, realized_price, &activity.vaultedness.height, + |(i, price, vaultedness, ..)| { + (i, Cents::from(f64::from(price) / f64::from(vaultedness))) + }, exit, )?; @@ -47,13 +51,16 @@ impl Vecs { prices, starting_indexes, exit, - &self.vaulted_price.usd.height, + &self.vaulted_price.cents.height, )?; - self.active_price.usd.height.compute_multiply( + self.active_price.cents.height.compute_transform2( starting_indexes.height, realized_price, &activity.liveliness.height, + |(i, price, liveliness, ..)| { + (i, Cents::from(f64::from(price) * f64::from(liveliness))) + }, exit, )?; @@ -62,13 +69,16 @@ impl Vecs { prices, starting_indexes, exit, - &self.active_price.usd.height, + &self.active_price.cents.height, )?; - self.true_market_mean.usd.height.compute_divide( + self.true_market_mean.cents.height.compute_transform2( starting_indexes.height, &cap.investor_cap.height, &supply.active_supply.btc.height, + |(i, cap_dollars, supply_btc, ..)| { + (i, Cents::from(f64::from(Cents::from(cap_dollars)) / f64::from(supply_btc))) + }, exit, )?; @@ -77,14 +87,17 @@ impl Vecs { prices, starting_indexes, exit, - &self.true_market_mean.usd.height, + &self.true_market_mean.cents.height, )?; // cointime_price = cointime_cap / circulating_supply - self.cointime_price.usd.height.compute_divide( + self.cointime_price.cents.height.compute_transform2( starting_indexes.height, &cap.cointime_cap.height, circulating_supply, + |(i, cap_dollars, supply_btc, ..)| { + (i, Cents::from(f64::from(Cents::from(cap_dollars)) / f64::from(supply_btc))) + }, exit, )?; @@ -93,7 +106,7 @@ impl Vecs { prices, starting_indexes, exit, - &self.cointime_price.usd.height, + &self.cointime_price.cents.height, )?; Ok(()) diff --git a/crates/brk_computer/src/cointime/pricing/vecs.rs b/crates/brk_computer/src/cointime/pricing/vecs.rs index a0aeb555a..a8853ebb1 100644 --- a/crates/brk_computer/src/cointime/pricing/vecs.rs +++ b/crates/brk_computer/src/cointime/pricing/vecs.rs @@ -1,17 +1,17 @@ use brk_traversable::Traversable; -use brk_types::Dollars; +use brk_types::Cents; use vecdb::{Rw, StorageMode}; use crate::internal::{ComputedFromHeightLast, ComputedFromHeightRatioExtended, Price}; #[derive(Traversable)] pub struct Vecs { - pub vaulted_price: Price>, + pub vaulted_price: Price>, pub vaulted_price_ratio: ComputedFromHeightRatioExtended, - pub active_price: Price>, + pub active_price: Price>, pub active_price_ratio: ComputedFromHeightRatioExtended, - pub true_market_mean: Price>, + pub true_market_mean: Price>, pub true_market_mean_ratio: ComputedFromHeightRatioExtended, - pub cointime_price: Price>, + pub cointime_price: Price>, pub cointime_price_ratio: ComputedFromHeightRatioExtended, } diff --git a/crates/brk_computer/src/distribution/cohorts/utxo/groups.rs b/crates/brk_computer/src/distribution/cohorts/utxo/groups.rs index e90fb3bbc..682c7d664 100644 --- a/crates/brk_computer/src/distribution/cohorts/utxo/groups.rs +++ b/crates/brk_computer/src/distribution/cohorts/utxo/groups.rs @@ -828,7 +828,7 @@ impl UTXOCohorts { pub(crate) fn truncate_push_aggregate_percentiles( &mut self, height: Height, - spot: Dollars, + spot: Cents, day1_opt: Option, states_path: &Path, ) -> Result<()> { @@ -895,7 +895,7 @@ impl UTXOCohorts { .collect(); if total_sats == 0 { - let nan_prices = [Dollars::NAN; PERCENTILES_LEN]; + let nan_prices = [Cents::ZERO; PERCENTILES_LEN]; target .extended .percentiles @@ -928,8 +928,8 @@ impl UTXOCohorts { let sat_targets = PERCENTILES.map(|p| total_sats * u64::from(p) / 100); let usd_targets = PERCENTILES.map(|p| total_usd * u128::from(p) / 100); - let mut sat_result = [Dollars::NAN; PERCENTILES_LEN]; - let mut usd_result = [Dollars::NAN; PERCENTILES_LEN]; + let mut sat_result = [Cents::ZERO; PERCENTILES_LEN]; + let mut usd_result = [Cents::ZERO; PERCENTILES_LEN]; let mut cumsum_sats: u64 = 0; let mut cumsum_usd: u128 = 0; @@ -953,13 +953,12 @@ impl UTXOCohorts { cumsum_usd += usd; if sat_idx < PERCENTILES_LEN || usd_idx < PERCENTILES_LEN { - let dollars = price.to_dollars(); while sat_idx < PERCENTILES_LEN && cumsum_sats >= sat_targets[sat_idx] { - sat_result[sat_idx] = dollars; + sat_result[sat_idx] = price; sat_idx += 1; } while usd_idx < PERCENTILES_LEN && cumsum_usd >= usd_targets[usd_idx] { - usd_result[usd_idx] = dollars; + usd_result[usd_idx] = price; usd_idx += 1; } } diff --git a/crates/brk_computer/src/distribution/compute/block_loop.rs b/crates/brk_computer/src/distribution/compute/block_loop.rs index 73c697c73..d02bd0778 100644 --- a/crates/brk_computer/src/distribution/compute/block_loop.rs +++ b/crates/brk_computer/src/distribution/compute/block_loop.rs @@ -451,10 +451,9 @@ pub(crate) fn process_blocks( )?; // Compute and push percentiles for aggregate cohorts (all, sth, lth) - let spot = block_price.to_dollars(); vecs.utxo_cohorts.truncate_push_aggregate_percentiles( height, - spot, + block_price, day1_opt, &vecs.states_path, )?; diff --git a/crates/brk_computer/src/distribution/metrics/activity.rs b/crates/brk_computer/src/distribution/metrics/activity.rs index bc5983feb..2719056c3 100644 --- a/crates/brk_computer/src/distribution/metrics/activity.rs +++ b/crates/brk_computer/src/distribution/metrics/activity.rs @@ -170,7 +170,7 @@ impl ActivityMetrics { starting_indexes.height, &blocks.count.height_2w_ago, &self.sent.base.sats.height, - &self.sent.base.usd.height, + &self.sent.base.cents.height, exit, )?; diff --git a/crates/brk_computer/src/distribution/metrics/cohort/adjusted.rs b/crates/brk_computer/src/distribution/metrics/cohort/adjusted.rs index 33eef3e5d..2b2ce550e 100644 --- a/crates/brk_computer/src/distribution/metrics/cohort/adjusted.rs +++ b/crates/brk_computer/src/distribution/metrics/cohort/adjusted.rs @@ -99,8 +99,8 @@ impl AdjustedCohortMetrics { prices: &prices::Vecs, starting_indexes: &ComputeIndexes, height_to_market_cap: &impl ReadableVec, - up_to_1h_value_created: &impl ReadableVec, - up_to_1h_value_destroyed: &impl ReadableVec, + up_to_1h_value_created: &impl ReadableVec, + up_to_1h_value_destroyed: &impl ReadableVec, all_supply_sats: &impl ReadableVec, exit: &Exit, ) -> Result<()> { diff --git a/crates/brk_computer/src/distribution/metrics/cohort/all.rs b/crates/brk_computer/src/distribution/metrics/cohort/all.rs index bf72791c7..81ba4a874 100644 --- a/crates/brk_computer/src/distribution/metrics/cohort/all.rs +++ b/crates/brk_computer/src/distribution/metrics/cohort/all.rs @@ -87,10 +87,9 @@ impl CohortMetricsBase for AllCohortMetrics { self.unrealized .base .truncate_push(height, &height_unrealized_state)?; - let spot = height_price.to_dollars(); self.cost_basis .extended - .truncate_push_percentiles(height, state, spot)?; + .truncate_push_percentiles(height, state, height_price)?; Ok(()) } fn collect_all_vecs_mut(&mut self) -> Vec<&mut dyn AnyStoredVec> { @@ -140,8 +139,8 @@ impl AllCohortMetrics { prices: &prices::Vecs, starting_indexes: &ComputeIndexes, height_to_market_cap: &impl ReadableVec, - up_to_1h_value_created: &impl ReadableVec, - up_to_1h_value_destroyed: &impl ReadableVec, + up_to_1h_value_created: &impl ReadableVec, + up_to_1h_value_destroyed: &impl ReadableVec, exit: &Exit, ) -> Result<()> { self.realized.compute_rest_part2( diff --git a/crates/brk_computer/src/distribution/metrics/cohort/extended.rs b/crates/brk_computer/src/distribution/metrics/cohort/extended.rs index 39835ba9e..a883b28b6 100644 --- a/crates/brk_computer/src/distribution/metrics/cohort/extended.rs +++ b/crates/brk_computer/src/distribution/metrics/cohort/extended.rs @@ -56,8 +56,7 @@ impl CohortMetricsBase for ExtendedCohortMetrics { self.cost_basis.truncate_push_minmax(height, state)?; let (height_unrealized_state, _) = state.compute_unrealized_states(height_price, None); self.unrealized.base.truncate_push(height, &height_unrealized_state)?; - let spot = height_price.to_dollars(); - self.cost_basis.extended.truncate_push_percentiles(height, state, spot)?; + self.cost_basis.extended.truncate_push_percentiles(height, state, height_price)?; Ok(()) } fn collect_all_vecs_mut(&mut self) -> Vec<&mut dyn AnyStoredVec> { diff --git a/crates/brk_computer/src/distribution/metrics/cohort/extended_adjusted.rs b/crates/brk_computer/src/distribution/metrics/cohort/extended_adjusted.rs index f84bbc686..51a354e02 100644 --- a/crates/brk_computer/src/distribution/metrics/cohort/extended_adjusted.rs +++ b/crates/brk_computer/src/distribution/metrics/cohort/extended_adjusted.rs @@ -55,8 +55,7 @@ impl CohortMetricsBase for ExtendedAdjustedCohortMetrics { self.cost_basis.truncate_push_minmax(height, state)?; let (height_unrealized_state, _) = state.compute_unrealized_states(height_price, None); self.unrealized.base.truncate_push(height, &height_unrealized_state)?; - let spot = height_price.to_dollars(); - self.cost_basis.extended.truncate_push_percentiles(height, state, spot)?; + self.cost_basis.extended.truncate_push_percentiles(height, state, height_price)?; Ok(()) } fn collect_all_vecs_mut(&mut self) -> Vec<&mut dyn AnyStoredVec> { @@ -102,8 +101,8 @@ impl ExtendedAdjustedCohortMetrics { prices: &prices::Vecs, starting_indexes: &ComputeIndexes, height_to_market_cap: &impl ReadableVec, - up_to_1h_value_created: &impl ReadableVec, - up_to_1h_value_destroyed: &impl ReadableVec, + up_to_1h_value_created: &impl ReadableVec, + up_to_1h_value_destroyed: &impl ReadableVec, all_supply_sats: &impl ReadableVec, exit: &Exit, ) -> Result<()> { diff --git a/crates/brk_computer/src/distribution/metrics/cost_basis/base.rs b/crates/brk_computer/src/distribution/metrics/cost_basis/base.rs index a328e0312..d71534b79 100644 --- a/crates/brk_computer/src/distribution/metrics/cost_basis/base.rs +++ b/crates/brk_computer/src/distribution/metrics/cost_basis/base.rs @@ -1,6 +1,6 @@ use brk_error::Result; use brk_traversable::Traversable; -use brk_types::{Dollars, Height}; +use brk_types::{Cents, Height}; use vecdb::{AnyStoredVec, AnyVec, Exit, Rw, StorageMode, WritableVec}; use crate::{ @@ -15,10 +15,10 @@ use crate::distribution::metrics::ImportConfig; #[derive(Traversable)] pub struct CostBasisBase { /// Minimum cost basis for any UTXO at this height - pub min: Price>, + pub min: Price>, /// Maximum cost basis for any UTXO at this height - pub max: Price>, + pub max: Price>, } impl CostBasisBase { @@ -40,7 +40,7 @@ impl CostBasisBase { } pub(crate) fn min_stateful_height_len(&self) -> usize { - self.min.usd.height.len().min(self.max.usd.height.len()) + self.min.cents.height.len().min(self.max.cents.height.len()) } pub(crate) fn truncate_push_minmax( @@ -48,27 +48,27 @@ impl CostBasisBase { height: Height, state: &CohortState, ) -> Result<()> { - self.min.usd.height.truncate_push( + self.min.cents.height.truncate_push( height, state .cost_basis_data_first_key_value() - .map(|(cents, _)| cents.into()) - .unwrap_or(Dollars::NAN), + .map(|(cents, _)| cents) + .unwrap_or(Cents::ZERO), )?; - self.max.usd.height.truncate_push( + self.max.cents.height.truncate_push( height, state .cost_basis_data_last_key_value() - .map(|(cents, _)| cents.into()) - .unwrap_or(Dollars::NAN), + .map(|(cents, _)| cents) + .unwrap_or(Cents::ZERO), )?; Ok(()) } pub(crate) fn collect_vecs_mut(&mut self) -> Vec<&mut dyn AnyStoredVec> { vec![ - &mut self.min.usd.height as &mut dyn AnyStoredVec, - &mut self.max.usd.height, + &mut self.min.cents.height as &mut dyn AnyStoredVec, + &mut self.max.cents.height, ] } @@ -78,14 +78,14 @@ impl CostBasisBase { others: &[&Self], exit: &Exit, ) -> Result<()> { - self.min.usd.height.compute_min_of_others( + self.min.cents.height.compute_min_of_others( starting_indexes.height, - &others.iter().map(|v| &v.min.usd.height).collect::>(), + &others.iter().map(|v| &v.min.cents.height).collect::>(), exit, )?; - self.max.usd.height.compute_max_of_others( + self.max.cents.height.compute_max_of_others( starting_indexes.height, - &others.iter().map(|v| &v.max.usd.height).collect::>(), + &others.iter().map(|v| &v.max.cents.height).collect::>(), exit, )?; Ok(()) diff --git a/crates/brk_computer/src/distribution/metrics/cost_basis/extended.rs b/crates/brk_computer/src/distribution/metrics/cost_basis/extended.rs index 672cca655..e2471d2a8 100644 --- a/crates/brk_computer/src/distribution/metrics/cost_basis/extended.rs +++ b/crates/brk_computer/src/distribution/metrics/cost_basis/extended.rs @@ -1,6 +1,6 @@ use brk_error::Result; use brk_traversable::Traversable; -use brk_types::{Dollars, Height, StoredF32, Version}; +use brk_types::{Cents, Height, StoredF32, Version}; use vecdb::{AnyStoredVec, Rw, StorageMode, WritableVec}; use crate::{ @@ -62,14 +62,14 @@ impl CostBasisExtended { &mut self, height: Height, state: &mut CohortState, - spot: Dollars, + spot: Cents, ) -> Result<()> { let computed = state.compute_percentiles(); let sat_prices = computed .as_ref() - .map(|p| p.sat_weighted.map(|c| c.to_dollars())) - .unwrap_or([Dollars::NAN; PERCENTILES_LEN]); + .map(|p| p.sat_weighted) + .unwrap_or([Cents::ZERO; PERCENTILES_LEN]); self.percentiles.truncate_push(height, &sat_prices)?; let rank = compute_spot_percentile_rank(&sat_prices, spot); @@ -79,8 +79,8 @@ impl CostBasisExtended { let usd_prices = computed .as_ref() - .map(|p| p.usd_weighted.map(|c| c.to_dollars())) - .unwrap_or([Dollars::NAN; PERCENTILES_LEN]); + .map(|p| p.usd_weighted) + .unwrap_or([Cents::ZERO; PERCENTILES_LEN]); self.invested_capital.truncate_push(height, &usd_prices)?; let rank = compute_spot_percentile_rank(&usd_prices, spot); @@ -97,13 +97,13 @@ impl CostBasisExtended { self.percentiles .vecs .iter_mut() - .map(|v| &mut v.usd.height as &mut dyn AnyStoredVec), + .map(|v| &mut v.cents.height as &mut dyn AnyStoredVec), ); vecs.extend( self.invested_capital .vecs .iter_mut() - .map(|v| &mut v.usd.height as &mut dyn AnyStoredVec), + .map(|v| &mut v.cents.height as &mut dyn AnyStoredVec), ); vecs.push(&mut self.spot_cost_basis_percentile.height); vecs.push(&mut self.spot_invested_capital_percentile.height); diff --git a/crates/brk_computer/src/distribution/metrics/realized/adjusted.rs b/crates/brk_computer/src/distribution/metrics/realized/adjusted.rs index 4024db766..af439fe70 100644 --- a/crates/brk_computer/src/distribution/metrics/realized/adjusted.rs +++ b/crates/brk_computer/src/distribution/metrics/realized/adjusted.rs @@ -1,11 +1,11 @@ use brk_error::Result; use brk_traversable::Traversable; -use brk_types::{Dollars, Height, StoredF64, Version}; +use brk_types::{Cents, Height, StoredF64, Version}; use vecdb::{Exit, Ident, ReadableCloneableVec, ReadableVec, Rw, StorageMode}; use crate::{ ComputeIndexes, blocks, - internal::{ComputedFromHeightLast, LazyFromHeightLast, Ratio64}, + internal::{ComputedFromHeightLast, LazyFromHeightLast, RatioCents64}, }; use crate::distribution::metrics::ImportConfig; @@ -14,18 +14,18 @@ use crate::distribution::metrics::ImportConfig; #[derive(Traversable)] pub struct RealizedAdjusted { // === Adjusted Value (computed: cohort - up_to_1h) === - pub adjusted_value_created: ComputedFromHeightLast, - pub adjusted_value_destroyed: ComputedFromHeightLast, + pub adjusted_value_created: ComputedFromHeightLast, + pub adjusted_value_destroyed: ComputedFromHeightLast, // === Adjusted Value Created/Destroyed Rolling Sums === - pub adjusted_value_created_24h: ComputedFromHeightLast, - pub adjusted_value_created_7d: ComputedFromHeightLast, - pub adjusted_value_created_30d: ComputedFromHeightLast, - pub adjusted_value_created_1y: ComputedFromHeightLast, - pub adjusted_value_destroyed_24h: ComputedFromHeightLast, - pub adjusted_value_destroyed_7d: ComputedFromHeightLast, - pub adjusted_value_destroyed_30d: ComputedFromHeightLast, - pub adjusted_value_destroyed_1y: ComputedFromHeightLast, + pub adjusted_value_created_24h: ComputedFromHeightLast, + pub adjusted_value_created_7d: ComputedFromHeightLast, + pub adjusted_value_created_30d: ComputedFromHeightLast, + pub adjusted_value_created_1y: ComputedFromHeightLast, + pub adjusted_value_destroyed_24h: ComputedFromHeightLast, + pub adjusted_value_destroyed_7d: ComputedFromHeightLast, + pub adjusted_value_destroyed_30d: ComputedFromHeightLast, + pub adjusted_value_destroyed_1y: ComputedFromHeightLast, // === Adjusted SOPR (rolling window ratios) === pub adjusted_sopr: LazyFromHeightLast, @@ -150,10 +150,10 @@ impl RealizedAdjusted { &mut self, blocks: &blocks::Vecs, starting_indexes: &ComputeIndexes, - base_value_created: &impl ReadableVec, - base_value_destroyed: &impl ReadableVec, - up_to_1h_value_created: &impl ReadableVec, - up_to_1h_value_destroyed: &impl ReadableVec, + base_value_created: &impl ReadableVec, + base_value_destroyed: &impl ReadableVec, + up_to_1h_value_created: &impl ReadableVec, + up_to_1h_value_destroyed: &impl ReadableVec, exit: &Exit, ) -> Result<()> { // Compute adjusted_value_created = base.value_created - up_to_1h.value_created @@ -231,28 +231,28 @@ impl RealizedAdjusted { // SOPR ratios from rolling sums self.adjusted_sopr_24h - .compute_binary::( + .compute_binary::( starting_indexes.height, &self.adjusted_value_created_24h.height, &self.adjusted_value_destroyed_24h.height, exit, )?; self.adjusted_sopr_7d - .compute_binary::( + .compute_binary::( starting_indexes.height, &self.adjusted_value_created_7d.height, &self.adjusted_value_destroyed_7d.height, exit, )?; self.adjusted_sopr_30d - .compute_binary::( + .compute_binary::( starting_indexes.height, &self.adjusted_value_created_30d.height, &self.adjusted_value_destroyed_30d.height, exit, )?; self.adjusted_sopr_1y - .compute_binary::( + .compute_binary::( starting_indexes.height, &self.adjusted_value_created_1y.height, &self.adjusted_value_destroyed_1y.height, diff --git a/crates/brk_computer/src/distribution/metrics/realized/base.rs b/crates/brk_computer/src/distribution/metrics/realized/base.rs index d7f8e7446..b55739169 100644 --- a/crates/brk_computer/src/distribution/metrics/realized/base.rs +++ b/crates/brk_computer/src/distribution/metrics/realized/base.rs @@ -1,10 +1,10 @@ use brk_error::Result; use brk_traversable::Traversable; use brk_types::{ - Bitcoin, Cents, CentsSats, CentsSquaredSats, Dollars, Height, StoredF32, StoredF64, Version, + Bitcoin, Cents, CentsSats, CentsSigned, CentsSquaredSats, Dollars, Height, Sats, StoredF32, StoredF64, Version, }; use vecdb::{ - AnyStoredVec, AnyVec, BytesVec, Exit, Ident, ImportableVec, Negate, ReadableCloneableVec, + AnyStoredVec, AnyVec, BytesVec, Exit, Ident, ImportableVec, ReadableCloneableVec, ReadableVec, Rw, StorageMode, WritableVec, }; @@ -12,9 +12,9 @@ use crate::{ ComputeIndexes, blocks, distribution::state::RealizedState, internal::{ - CentsUnsignedToDollars, ComputedFromHeightCumulative, ComputedFromHeightLast, - ComputedFromHeightRatio, DollarsPlus, ValueFromHeightCumulative, LazyFromHeightLast, - PercentageDollarsF32, Price, Ratio64, + CentsPlus, CentsUnsignedToDollars, ComputedFromHeightCumulative, ComputedFromHeightLast, + ComputedFromHeightRatio, NegCentsUnsignedToDollars, ValueFromHeightCumulative, LazyFromHeightLast, + PercentageCentsF32, PercentageCentsSignedCentsF32, PercentageCentsSignedDollarsF32, Price, RatioCents64, StoredF32Identity, ValueFromHeightLast, }, prices, @@ -28,18 +28,17 @@ pub struct RealizedBase { // === Realized Cap === pub realized_cap_cents: ComputedFromHeightLast, pub realized_cap: LazyFromHeightLast, - pub realized_price: Price>, + pub realized_price: Price>, pub realized_price_extra: ComputedFromHeightRatio, - pub realized_cap_30d_delta: ComputedFromHeightLast, + pub realized_cap_30d_delta: ComputedFromHeightLast, // === Investor Price === - pub investor_price_cents: ComputedFromHeightLast, - pub investor_price: Price>, + pub investor_price: Price>, pub investor_price_extra: ComputedFromHeightRatio, // === Floor/Ceiling Price Bands === - pub lower_price_band: Price>, - pub upper_price_band: Price>, + pub lower_price_band: Price>, + pub upper_price_band: Price>, // === Raw values for aggregation === pub cap_raw: M::Stored>, @@ -49,14 +48,14 @@ pub struct RealizedBase { pub mvrv: LazyFromHeightLast, // === Realized Profit/Loss === - pub realized_profit: ComputedFromHeightCumulative, - pub realized_profit_7d_ema: ComputedFromHeightLast, - pub realized_loss: ComputedFromHeightCumulative, - pub realized_loss_7d_ema: ComputedFromHeightLast, - pub neg_realized_loss: LazyFromHeightLast, - pub net_realized_pnl: ComputedFromHeightCumulative, - pub net_realized_pnl_7d_ema: ComputedFromHeightLast, - pub realized_value: ComputedFromHeightLast, + pub realized_profit: ComputedFromHeightCumulative, + pub realized_profit_7d_ema: ComputedFromHeightLast, + pub realized_loss: ComputedFromHeightCumulative, + pub realized_loss_7d_ema: ComputedFromHeightLast, + pub neg_realized_loss: LazyFromHeightLast, + pub net_realized_pnl: ComputedFromHeightCumulative, + pub net_realized_pnl_7d_ema: ComputedFromHeightLast, + pub realized_value: ComputedFromHeightLast, // === Realized vs Realized Cap Ratios === pub realized_profit_rel_to_realized_cap: ComputedFromHeightLast, @@ -64,31 +63,31 @@ pub struct RealizedBase { pub net_realized_pnl_rel_to_realized_cap: ComputedFromHeightLast, // === Total Realized PnL === - pub total_realized_pnl: LazyFromHeightLast, + pub total_realized_pnl: LazyFromHeightLast, // === Value Created/Destroyed Splits (stored) === - pub profit_value_created: ComputedFromHeightLast, - pub profit_value_destroyed: ComputedFromHeightLast, - pub loss_value_created: ComputedFromHeightLast, - pub loss_value_destroyed: ComputedFromHeightLast, + pub profit_value_created: ComputedFromHeightLast, + pub profit_value_destroyed: ComputedFromHeightLast, + pub loss_value_created: ComputedFromHeightLast, + pub loss_value_destroyed: ComputedFromHeightLast, // === Value Created/Destroyed Totals === - pub value_created: ComputedFromHeightLast, - pub value_destroyed: ComputedFromHeightLast, + pub value_created: ComputedFromHeightLast, + pub value_destroyed: ComputedFromHeightLast, // === Capitulation/Profit Flow (lazy aliases) === - pub capitulation_flow: LazyFromHeightLast, - pub profit_flow: LazyFromHeightLast, + pub capitulation_flow: LazyFromHeightLast, + pub profit_flow: LazyFromHeightLast, // === Value Created/Destroyed Rolling Sums === - pub value_created_24h: ComputedFromHeightLast, - pub value_created_7d: ComputedFromHeightLast, - pub value_created_30d: ComputedFromHeightLast, - pub value_created_1y: ComputedFromHeightLast, - pub value_destroyed_24h: ComputedFromHeightLast, - pub value_destroyed_7d: ComputedFromHeightLast, - pub value_destroyed_30d: ComputedFromHeightLast, - pub value_destroyed_1y: ComputedFromHeightLast, + pub value_created_24h: ComputedFromHeightLast, + pub value_created_7d: ComputedFromHeightLast, + pub value_created_30d: ComputedFromHeightLast, + pub value_created_1y: ComputedFromHeightLast, + pub value_destroyed_24h: ComputedFromHeightLast, + pub value_destroyed_7d: ComputedFromHeightLast, + pub value_destroyed_30d: ComputedFromHeightLast, + pub value_destroyed_1y: ComputedFromHeightLast, // === SOPR (rolling window ratios) === pub sopr: LazyFromHeightLast, @@ -102,10 +101,10 @@ pub struct RealizedBase { pub sopr_30d_ema: LazyFromHeightLast, // === Sell Side Risk Rolling Sum Intermediates === - pub realized_value_24h: ComputedFromHeightLast, - pub realized_value_7d: ComputedFromHeightLast, - pub realized_value_30d: ComputedFromHeightLast, - pub realized_value_1y: ComputedFromHeightLast, + pub realized_value_24h: ComputedFromHeightLast, + pub realized_value_7d: ComputedFromHeightLast, + pub realized_value_30d: ComputedFromHeightLast, + pub realized_value_1y: ComputedFromHeightLast, // === Sell Side Risk (rolling window ratios) === pub sell_side_risk_ratio: LazyFromHeightLast, @@ -119,14 +118,14 @@ pub struct RealizedBase { pub sell_side_risk_ratio_30d_ema: LazyFromHeightLast, // === Net Realized PnL Deltas === - pub net_realized_pnl_cumulative_30d_delta: ComputedFromHeightLast, + pub net_realized_pnl_cumulative_30d_delta: ComputedFromHeightLast, pub net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: ComputedFromHeightLast, pub net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: ComputedFromHeightLast, // === Peak Regret === - pub peak_regret: ComputedFromHeightCumulative, + pub peak_regret: ComputedFromHeightCumulative, pub peak_regret_rel_to_realized_cap: ComputedFromHeightLast, // === Sent in Profit/Loss === @@ -185,7 +184,7 @@ impl RealizedBase { cfg.indexes, )?; - let neg_realized_loss = LazyFromHeightLast::from_height_source::( + let neg_realized_loss = LazyFromHeightLast::from_height_source::( &cfg.name("neg_realized_loss"), cfg.version + v1, realized_loss.height.read_only_boxed_clone(), @@ -220,7 +219,7 @@ impl RealizedBase { cfg.indexes, )?; - let total_realized_pnl = LazyFromHeightLast::from_computed::( + let total_realized_pnl = LazyFromHeightLast::from_computed::( &cfg.name("total_realized_pnl"), cfg.version + v1, realized_value.height.read_only_boxed_clone(), @@ -255,19 +254,13 @@ impl RealizedBase { cfg.indexes, )?; - let investor_price_cents = ComputedFromHeightLast::forced_import( + let investor_price = Price::forced_import( cfg.db, - &cfg.name("investor_price_cents"), + &cfg.name("investor_price"), cfg.version, cfg.indexes, )?; - let investor_price = Price::from_computed::( - &cfg.name("investor_price"), - cfg.version, - &investor_price_cents, - ); - let investor_price_extra = ComputedFromHeightRatio::forced_import( cfg.db, &cfg.name("investor_price"), @@ -331,13 +324,13 @@ impl RealizedBase { cfg.indexes, )?; - let capitulation_flow = LazyFromHeightLast::from_computed::( + let capitulation_flow = LazyFromHeightLast::from_computed::( &cfg.name("capitulation_flow"), cfg.version, loss_value_destroyed.height.read_only_boxed_clone(), &loss_value_destroyed, ); - let profit_flow = LazyFromHeightLast::from_computed::( + let profit_flow = LazyFromHeightLast::from_computed::( &cfg.name("profit_flow"), cfg.version, profit_value_destroyed.height.read_only_boxed_clone(), @@ -460,7 +453,6 @@ impl RealizedBase { cfg.version, cfg.indexes, )?, - investor_price_cents, investor_price, investor_price_extra, lower_price_band, @@ -574,7 +566,7 @@ impl RealizedBase { .len() .min(self.realized_profit.height.len()) .min(self.realized_loss.height.len()) - .min(self.investor_price_cents.height.len()) + .min(self.investor_price.cents.height.len()) .min(self.cap_raw.len()) .min(self.investor_cap_raw.len()) .min(self.profit_value_created.height.len()) @@ -593,11 +585,11 @@ impl RealizedBase { .truncate_push(height, state.cap())?; self.realized_profit .height - .truncate_push(height, state.profit().to_dollars())?; + .truncate_push(height, state.profit())?; self.realized_loss .height - .truncate_push(height, state.loss().to_dollars())?; - self.investor_price_cents + .truncate_push(height, state.loss())?; + self.investor_price.cents .height .truncate_push(height, state.investor_price())?; self.cap_raw.truncate_push(height, state.cap_raw())?; @@ -605,19 +597,19 @@ impl RealizedBase { .truncate_push(height, state.investor_cap_raw())?; self.profit_value_created .height - .truncate_push(height, state.profit_value_created().to_dollars())?; + .truncate_push(height, state.profit_value_created())?; self.profit_value_destroyed .height - .truncate_push(height, state.profit_value_destroyed().to_dollars())?; + .truncate_push(height, state.profit_value_destroyed())?; self.loss_value_created .height - .truncate_push(height, state.loss_value_created().to_dollars())?; + .truncate_push(height, state.loss_value_created())?; self.loss_value_destroyed .height - .truncate_push(height, state.loss_value_destroyed().to_dollars())?; + .truncate_push(height, state.loss_value_destroyed())?; self.peak_regret .height - .truncate_push(height, state.peak_regret().to_dollars())?; + .truncate_push(height, state.peak_regret())?; self.sent_in_profit .base .sats @@ -638,7 +630,7 @@ impl RealizedBase { &mut self.realized_cap_cents.height as &mut dyn AnyStoredVec, &mut self.realized_profit.height, &mut self.realized_loss.height, - &mut self.investor_price_cents.height, + &mut self.investor_price.cents.height, &mut self.cap_raw as &mut dyn AnyStoredVec, &mut self.investor_cap_raw as &mut dyn AnyStoredVec, &mut self.profit_value_created.height, @@ -686,9 +678,9 @@ impl RealizedBase { // Aggregate raw values for investor_price computation let investor_price_dep_version = others .iter() - .map(|o| o.investor_price_cents.height.version()) + .map(|o| o.investor_price.cents.height.version()) .fold(vecdb::Version::ZERO, |acc, v| acc + v); - self.investor_price_cents + self.investor_price.cents .height .validate_computed_version_or_reset(investor_price_dep_version)?; @@ -696,7 +688,7 @@ impl RealizedBase { .cap_raw .len() .min(self.investor_cap_raw.len()) - .min(self.investor_price_cents.height.len()); + .min(self.investor_price.cents.height.len()); let end = others.iter().map(|o| o.cap_raw.len()).min().unwrap_or(0); // Pre-collect all cohort data to avoid per-element BytesVec reads in nested loop @@ -730,14 +722,14 @@ impl RealizedBase { } else { Cents::new((sum_investor_cap / sum_cap.inner()) as u64) }; - self.investor_price_cents + self.investor_price.cents .height .truncate_push(height, investor_price)?; } { let _lock = exit.lock(); - self.investor_price_cents.height.write()?; + self.investor_price.cents.height.write()?; } self.profit_value_created.height.compute_sum_of_others( @@ -813,10 +805,13 @@ impl RealizedBase { self.net_realized_pnl .compute(starting_indexes.height, exit, |vec| { - vec.compute_subtract( + vec.compute_transform2( starting_indexes.height, &self.realized_profit.height, &self.realized_loss.height, + |(i, profit, loss, ..)| { + (i, CentsSigned::new(profit.inner() as i64 - loss.inner() as i64)) + }, exit, )?; Ok(()) @@ -846,47 +841,64 @@ impl RealizedBase { height_to_market_cap: &impl ReadableVec, exit: &Exit, ) -> Result<()> { - self.realized_price.usd.height.compute_divide( + self.realized_price.cents.height.compute_transform2( starting_indexes.height, - &self.realized_cap.height, + &self.realized_cap_cents.height, height_to_supply, + |(i, cap_cents, supply, ..)| { + let cap = cap_cents.as_u128(); + let supply_sats = Sats::from(supply).as_u128(); + if supply_sats == 0 { + (i, Cents::ZERO) + } else { + (i, Cents::from(cap * Sats::ONE_BTC_U128 / supply_sats)) + } + }, exit, )?; self.realized_price_extra.compute_ratio( starting_indexes, - &prices.price.usd.height, - &self.realized_price.usd.height, + &prices.price.cents.height, + &self.realized_price.cents.height, exit, )?; self.investor_price_extra.compute_ratio( starting_indexes, - &prices.price.usd.height, - &self.investor_price.usd.height, + &prices.price.cents.height, + &self.investor_price.cents.height, exit, )?; - self.lower_price_band.usd.height.compute_transform2( + self.lower_price_band.cents.height.compute_transform2( starting_indexes.height, - &self.realized_price.usd.height, - &self.investor_price.usd.height, + &self.realized_price.cents.height, + &self.investor_price.cents.height, |(i, rp, ip, ..)| { - let rp = f64::from(rp); - let ip = f64::from(ip); - (i, Dollars::from(rp * rp / ip)) + let rp = rp.as_u128(); + let ip = ip.as_u128(); + if ip == 0 { + (i, Cents::ZERO) + } else { + (i, Cents::from(rp * rp / ip)) + } }, exit, )?; - self.upper_price_band.usd.height.compute_transform2( + self.upper_price_band.cents.height.compute_transform2( starting_indexes.height, - &self.investor_price.usd.height, - &self.realized_price.usd.height, + &self.investor_price.cents.height, + &self.realized_price.cents.height, |(i, ip, rp, ..)| { - let ip = f64::from(ip); - let rp = f64::from(rp); - (i, Dollars::from(ip * ip / rp)) + let ip = ip.as_u128(); + let rp = rp.as_u128(); + if rp == 0 { + (i, Cents::ZERO) + } else { + (i, Cents::from(ip * ip / rp)) + } }, exit, )?; @@ -894,20 +906,20 @@ impl RealizedBase { self.realized_cap_30d_delta.height.compute_rolling_change( starting_indexes.height, &blocks.count.height_1m_ago, - &self.realized_cap.height, + &self.realized_cap_cents.height, exit, )?; // Compute value_created/destroyed from stored components self.value_created - .compute_binary::( + .compute_binary::( starting_indexes.height, &self.profit_value_created.height, &self.loss_value_created.height, exit, )?; self.value_destroyed - .compute_binary::( + .compute_binary::( starting_indexes.height, &self.profit_value_destroyed.height, &self.loss_value_destroyed.height, @@ -990,25 +1002,25 @@ impl RealizedBase { ); // Compute SOPR from rolling sums - self.sopr_24h.compute_binary::( + self.sopr_24h.compute_binary::( starting_indexes.height, &self.value_created_24h.height, &self.value_destroyed_24h.height, exit, )?; - self.sopr_7d.compute_binary::( + self.sopr_7d.compute_binary::( starting_indexes.height, &self.value_created_7d.height, &self.value_destroyed_7d.height, exit, )?; - self.sopr_30d.compute_binary::( + self.sopr_30d.compute_binary::( starting_indexes.height, &self.value_created_30d.height, &self.value_destroyed_30d.height, exit, )?; - self.sopr_1y.compute_binary::( + self.sopr_1y.compute_binary::( starting_indexes.height, &self.value_created_1y.height, &self.value_destroyed_1y.height, @@ -1017,31 +1029,31 @@ impl RealizedBase { // Compute sell-side risk ratios self.sell_side_risk_ratio_24h - .compute_binary::( + .compute_binary::( starting_indexes.height, &self.realized_value_24h.height, - &self.realized_cap.height, + &self.realized_cap_cents.height, exit, )?; self.sell_side_risk_ratio_7d - .compute_binary::( + .compute_binary::( starting_indexes.height, &self.realized_value_7d.height, - &self.realized_cap.height, + &self.realized_cap_cents.height, exit, )?; self.sell_side_risk_ratio_30d - .compute_binary::( + .compute_binary::( starting_indexes.height, &self.realized_value_30d.height, - &self.realized_cap.height, + &self.realized_cap_cents.height, exit, )?; self.sell_side_risk_ratio_1y - .compute_binary::( + .compute_binary::( starting_indexes.height, &self.realized_value_1y.height, - &self.realized_cap.height, + &self.realized_cap_cents.height, exit, )?; @@ -1072,14 +1084,14 @@ impl RealizedBase { starting_indexes.height, &blocks.count.height_2w_ago, &self.sent_in_profit.base.sats.height, - &self.sent_in_profit.base.usd.height, + &self.sent_in_profit.base.cents.height, exit, )?; self.sent_in_loss_14d_ema.compute_ema( starting_indexes.height, &blocks.count.height_2w_ago, &self.sent_in_loss.base.sats.height, - &self.sent_in_loss.base.usd.height, + &self.sent_in_loss.base.cents.height, exit, )?; @@ -1117,31 +1129,31 @@ impl RealizedBase { // Realized profit/loss/net relative to realized cap self.realized_profit_rel_to_realized_cap - .compute_binary::( + .compute_binary::( starting_indexes.height, &self.realized_profit.height, - &self.realized_cap.height, + &self.realized_cap_cents.height, exit, )?; self.realized_loss_rel_to_realized_cap - .compute_binary::( + .compute_binary::( starting_indexes.height, &self.realized_loss.height, - &self.realized_cap.height, + &self.realized_cap_cents.height, exit, )?; self.net_realized_pnl_rel_to_realized_cap - .compute_binary::( + .compute_binary::( starting_indexes.height, &self.net_realized_pnl.height, - &self.realized_cap.height, + &self.realized_cap_cents.height, exit, )?; self.peak_regret_rel_to_realized_cap - .compute_binary::( + .compute_binary::( starting_indexes.height, &self.peak_regret.height, - &self.realized_cap.height, + &self.realized_cap_cents.height, exit, )?; @@ -1156,17 +1168,15 @@ impl RealizedBase { )?; self.net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap - .height - .compute_percentage( + .compute_binary::( starting_indexes.height, &self.net_realized_pnl_cumulative_30d_delta.height, - &self.realized_cap.height, + &self.realized_cap_cents.height, exit, )?; self.net_realized_pnl_cumulative_30d_delta_rel_to_market_cap - .height - .compute_percentage( + .compute_binary::( starting_indexes.height, &self.net_realized_pnl_cumulative_30d_delta.height, height_to_market_cap, diff --git a/crates/brk_computer/src/distribution/metrics/realized/extended.rs b/crates/brk_computer/src/distribution/metrics/realized/extended.rs index 533278b95..3cea06104 100644 --- a/crates/brk_computer/src/distribution/metrics/realized/extended.rs +++ b/crates/brk_computer/src/distribution/metrics/realized/extended.rs @@ -1,11 +1,11 @@ use brk_error::Result; use brk_traversable::Traversable; -use brk_types::{Dollars, Height, StoredF32, StoredF64, Version}; +use brk_types::{Cents, Dollars, Height, StoredF32, StoredF64, Version}; use vecdb::{Exit, ReadableVec, Rw, StorageMode}; use crate::{ ComputeIndexes, blocks, - internal::{ComputedFromHeightLast, ComputedFromHeightRatioExtension, Ratio64}, + internal::{ComputedFromHeightLast, ComputedFromHeightRatioExtension, RatioCents64}, }; use crate::distribution::metrics::ImportConfig; @@ -18,14 +18,14 @@ pub struct RealizedExtended { pub realized_cap_rel_to_own_market_cap: ComputedFromHeightLast, // === Realized Profit/Loss Rolling Sums === - pub realized_profit_24h: ComputedFromHeightLast, - pub realized_profit_7d: ComputedFromHeightLast, - pub realized_profit_30d: ComputedFromHeightLast, - pub realized_profit_1y: ComputedFromHeightLast, - pub realized_loss_24h: ComputedFromHeightLast, - pub realized_loss_7d: ComputedFromHeightLast, - pub realized_loss_30d: ComputedFromHeightLast, - pub realized_loss_1y: ComputedFromHeightLast, + pub realized_profit_24h: ComputedFromHeightLast, + pub realized_profit_7d: ComputedFromHeightLast, + pub realized_profit_30d: ComputedFromHeightLast, + pub realized_profit_1y: ComputedFromHeightLast, + pub realized_loss_24h: ComputedFromHeightLast, + pub realized_loss_7d: ComputedFromHeightLast, + pub realized_loss_30d: ComputedFromHeightLast, + pub realized_loss_1y: ComputedFromHeightLast, // === Realized Profit to Loss Ratio (from rolling sums) === pub realized_profit_to_loss_ratio_24h: ComputedFromHeightLast, @@ -158,28 +158,28 @@ impl RealizedExtended { // Realized profit to loss ratios self.realized_profit_to_loss_ratio_24h - .compute_binary::( + .compute_binary::( starting_indexes.height, &self.realized_profit_24h.height, &self.realized_loss_24h.height, exit, )?; self.realized_profit_to_loss_ratio_7d - .compute_binary::( + .compute_binary::( starting_indexes.height, &self.realized_profit_7d.height, &self.realized_loss_7d.height, exit, )?; self.realized_profit_to_loss_ratio_30d - .compute_binary::( + .compute_binary::( starting_indexes.height, &self.realized_profit_30d.height, &self.realized_loss_30d.height, exit, )?; self.realized_profit_to_loss_ratio_1y - .compute_binary::( + .compute_binary::( starting_indexes.height, &self.realized_profit_1y.height, &self.realized_loss_1y.height, @@ -193,9 +193,9 @@ impl RealizedExtended { exit, &base.realized_price_extra.ratio.height, )?; - self.realized_price_ratio_ext.compute_usd_bands( + self.realized_price_ratio_ext.compute_cents_bands( starting_indexes, - &base.realized_price.usd.height, + &base.realized_price.cents.height, exit, )?; @@ -205,9 +205,9 @@ impl RealizedExtended { exit, &base.investor_price_extra.ratio.height, )?; - self.investor_price_ratio_ext.compute_usd_bands( + self.investor_price_ratio_ext.compute_cents_bands( starting_indexes, - &base.investor_price.usd.height, + &base.investor_price.cents.height, exit, )?; diff --git a/crates/brk_computer/src/distribution/metrics/realized/with_adjusted.rs b/crates/brk_computer/src/distribution/metrics/realized/with_adjusted.rs index 1009f40ea..0486df4ac 100644 --- a/crates/brk_computer/src/distribution/metrics/realized/with_adjusted.rs +++ b/crates/brk_computer/src/distribution/metrics/realized/with_adjusted.rs @@ -1,6 +1,6 @@ use brk_error::Result; use brk_traversable::Traversable; -use brk_types::{Bitcoin, Dollars, Height}; +use brk_types::{Bitcoin, Cents, Dollars, Height}; use derive_more::{Deref, DerefMut}; use vecdb::{Exit, ReadableVec, Rw, StorageMode}; @@ -36,8 +36,8 @@ impl RealizedWithAdjusted { starting_indexes: &ComputeIndexes, height_to_supply: &impl ReadableVec, height_to_market_cap: &impl ReadableVec, - up_to_1h_value_created: &impl ReadableVec, - up_to_1h_value_destroyed: &impl ReadableVec, + up_to_1h_value_created: &impl ReadableVec, + up_to_1h_value_destroyed: &impl ReadableVec, exit: &Exit, ) -> Result<()> { self.base.compute_rest_part2_base( diff --git a/crates/brk_computer/src/distribution/metrics/realized/with_extended_adjusted.rs b/crates/brk_computer/src/distribution/metrics/realized/with_extended_adjusted.rs index d09e491ff..0989af4ca 100644 --- a/crates/brk_computer/src/distribution/metrics/realized/with_extended_adjusted.rs +++ b/crates/brk_computer/src/distribution/metrics/realized/with_extended_adjusted.rs @@ -1,6 +1,6 @@ use brk_error::Result; use brk_traversable::Traversable; -use brk_types::{Bitcoin, Dollars, Height}; +use brk_types::{Bitcoin, Cents, Dollars, Height}; use derive_more::{Deref, DerefMut}; use vecdb::{Exit, ReadableVec, Rw, StorageMode}; @@ -43,8 +43,8 @@ impl RealizedWithExtendedAdjusted { starting_indexes: &ComputeIndexes, height_to_supply: &impl ReadableVec, height_to_market_cap: &impl ReadableVec, - up_to_1h_value_created: &impl ReadableVec, - up_to_1h_value_destroyed: &impl ReadableVec, + up_to_1h_value_created: &impl ReadableVec, + up_to_1h_value_destroyed: &impl ReadableVec, exit: &Exit, ) -> Result<()> { self.base.compute_rest_part2_base( diff --git a/crates/brk_computer/src/distribution/metrics/supply.rs b/crates/brk_computer/src/distribution/metrics/supply.rs index f2ac2b281..3887110aa 100644 --- a/crates/brk_computer/src/distribution/metrics/supply.rs +++ b/crates/brk_computer/src/distribution/metrics/supply.rs @@ -67,7 +67,7 @@ impl SupplyMetrics { pub(crate) fn par_iter_mut(&mut self) -> impl ParallelIterator { vec![ &mut self.total.base.sats.height as &mut dyn AnyStoredVec, - &mut self.total.base.usd.height as &mut dyn AnyStoredVec, + &mut self.total.base.cents.height as &mut dyn AnyStoredVec, ] .into_par_iter() } @@ -117,7 +117,7 @@ impl SupplyMetrics { starting_indexes.height, &blocks.count.height_1m_ago, &self.total.sats.height, - &self.total.usd.height, + &self.total.cents.height, exit, ) } diff --git a/crates/brk_computer/src/distribution/metrics/unrealized/base.rs b/crates/brk_computer/src/distribution/metrics/unrealized/base.rs index 9ff3a6bbe..1d9ee1611 100644 --- a/crates/brk_computer/src/distribution/metrics/unrealized/base.rs +++ b/crates/brk_computer/src/distribution/metrics/unrealized/base.rs @@ -237,9 +237,9 @@ impl UnrealizedBase { pub(crate) fn collect_vecs_mut(&mut self) -> Vec<&mut dyn AnyStoredVec> { vec![ &mut self.supply_in_profit.base.sats.height as &mut dyn AnyStoredVec, - &mut self.supply_in_profit.base.usd.height as &mut dyn AnyStoredVec, + &mut self.supply_in_profit.base.cents.height as &mut dyn AnyStoredVec, &mut self.supply_in_loss.base.sats.height as &mut dyn AnyStoredVec, - &mut self.supply_in_loss.base.usd.height as &mut dyn AnyStoredVec, + &mut self.supply_in_loss.base.cents.height as &mut dyn AnyStoredVec, &mut self.unrealized_profit.height, &mut self.unrealized_loss.height, &mut self.invested_capital_in_profit.height, diff --git a/crates/brk_computer/src/internal/from_height/by_unit/mod.rs b/crates/brk_computer/src/internal/from_height/by_unit/mod.rs index 795f30620..05f5a5662 100644 --- a/crates/brk_computer/src/internal/from_height/by_unit/mod.rs +++ b/crates/brk_computer/src/internal/from_height/by_unit/mod.rs @@ -4,12 +4,14 @@ mod windows; use brk_error::Result; use brk_traversable::Traversable; -use brk_types::{Bitcoin, Dollars, Sats, Version}; +use brk_types::{Bitcoin, Cents, Dollars, Sats, Version}; use vecdb::{Database, ReadableCloneableVec, Rw, StorageMode}; use crate::{ indexes, - internal::{ComputedFromHeightLast, LazyFromHeightLast, SatsToBitcoin}, + internal::{ + CentsUnsignedToDollars, ComputedFromHeightLast, LazyFromHeightLast, SatsToBitcoin, + }, }; pub use rolling_full::*; @@ -19,7 +21,8 @@ pub use rolling_sum::*; pub struct ByUnit { pub sats: ComputedFromHeightLast, pub btc: LazyFromHeightLast, - pub usd: ComputedFromHeightLast, + pub cents: ComputedFromHeightLast, + pub usd: LazyFromHeightLast, } impl ByUnit { @@ -38,9 +41,25 @@ impl ByUnit { &sats, ); - let usd = - ComputedFromHeightLast::forced_import(db, &format!("{name}_usd"), version, indexes)?; + let cents = ComputedFromHeightLast::forced_import( + db, + &format!("{name}_cents"), + version, + indexes, + )?; - Ok(Self { sats, btc, usd }) + let usd = LazyFromHeightLast::from_computed::( + &format!("{name}_usd"), + version, + cents.height.read_only_boxed_clone(), + ¢s, + ); + + Ok(Self { + sats, + btc, + cents, + usd, + }) } } diff --git a/crates/brk_computer/src/internal/from_height/by_unit/rolling_full.rs b/crates/brk_computer/src/internal/from_height/by_unit/rolling_full.rs index d870fc473..848f55861 100644 --- a/crates/brk_computer/src/internal/from_height/by_unit/rolling_full.rs +++ b/crates/brk_computer/src/internal/from_height/by_unit/rolling_full.rs @@ -1,6 +1,6 @@ use brk_error::Result; use brk_traversable::Traversable; -use brk_types::{Dollars, Height, Sats, Version}; +use brk_types::{Cents, Height, Sats, Version}; use derive_more::{Deref, DerefMut}; use vecdb::{Database, Exit, ReadableVec, Rw, StorageMode}; @@ -47,11 +47,11 @@ impl RollingFullSlot { max_from: Height, starts: &impl ReadableVec, sats_source: &impl ReadableVec, - usd_source: &impl ReadableVec, + cents_source: &impl ReadableVec, exit: &Exit, ) -> Result<()> { self.sum.sats.height.compute_rolling_sum(max_from, starts, sats_source, exit)?; - self.sum.usd.height.compute_rolling_sum(max_from, starts, usd_source, exit)?; + self.sum.cents.height.compute_rolling_sum(max_from, starts, cents_source, exit)?; let d = &mut self.distribution; @@ -64,11 +64,11 @@ impl RollingFullSlot { )?; compute_rolling_distribution_from_starts( - max_from, starts, usd_source, - &mut d.average.usd.height, &mut d.min.usd.height, - &mut d.max.usd.height, &mut d.pct10.usd.height, - &mut d.pct25.usd.height, &mut d.median.usd.height, - &mut d.pct75.usd.height, &mut d.pct90.usd.height, exit, + max_from, starts, cents_source, + &mut d.average.cents.height, &mut d.min.cents.height, + &mut d.max.cents.height, &mut d.pct10.cents.height, + &mut d.pct25.cents.height, &mut d.median.cents.height, + &mut d.pct75.cents.height, &mut d.pct90.cents.height, exit, )?; Ok(()) @@ -105,11 +105,11 @@ impl RollingFullByUnit { max_from: Height, windows: &WindowStarts<'_>, sats_source: &impl ReadableVec, - usd_source: &impl ReadableVec, + cents_source: &impl ReadableVec, exit: &Exit, ) -> Result<()> { for (slot, starts) in self.0.as_mut_array().into_iter().zip(windows.as_array()) { - slot.compute(max_from, starts, sats_source, usd_source, exit)?; + slot.compute(max_from, starts, sats_source, cents_source, exit)?; } Ok(()) } diff --git a/crates/brk_computer/src/internal/from_height/by_unit/rolling_sum.rs b/crates/brk_computer/src/internal/from_height/by_unit/rolling_sum.rs index 5bcd52534..01acc103a 100644 --- a/crates/brk_computer/src/internal/from_height/by_unit/rolling_sum.rs +++ b/crates/brk_computer/src/internal/from_height/by_unit/rolling_sum.rs @@ -1,6 +1,6 @@ use brk_error::Result; use brk_traversable::Traversable; -use brk_types::{Dollars, Height, Sats, Version}; +use brk_types::{Cents, Height, Sats, Version}; use derive_more::{Deref, DerefMut}; use vecdb::{Database, Exit, ReadableVec, Rw, StorageMode}; @@ -34,12 +34,12 @@ impl RollingSumByUnit { max_from: Height, windows: &WindowStarts<'_>, sats_source: &impl ReadableVec, - usd_source: &impl ReadableVec, + cents_source: &impl ReadableVec, exit: &Exit, ) -> Result<()> { for (w, starts) in self.0.as_mut_array().into_iter().zip(windows.as_array()) { w.sats.height.compute_rolling_sum(max_from, starts, sats_source, exit)?; - w.usd.height.compute_rolling_sum(max_from, starts, usd_source, exit)?; + w.cents.height.compute_rolling_sum(max_from, starts, cents_source, exit)?; } Ok(()) } diff --git a/crates/brk_computer/src/internal/from_height/percentiles.rs b/crates/brk_computer/src/internal/from_height/percentiles.rs index 2d0c6ee48..da66e223d 100644 --- a/crates/brk_computer/src/internal/from_height/percentiles.rs +++ b/crates/brk_computer/src/internal/from_height/percentiles.rs @@ -1,6 +1,6 @@ use brk_error::Result; use brk_traversable::{Traversable, TreeNode}; -use brk_types::{Dollars, Height, StoredF32, Version}; +use brk_types::{Cents, Height, StoredF32, Version}; use vecdb::{AnyExportableVec, Database, ReadOnlyClone, Ro, Rw, StorageMode, WritableVec}; use crate::indexes; @@ -14,10 +14,10 @@ pub const PERCENTILES_LEN: usize = PERCENTILES.len(); /// Compute spot percentile rank by interpolating within percentile bands. /// Returns a value between 0 and 100 indicating where spot sits in the distribution. pub(crate) fn compute_spot_percentile_rank( - percentile_prices: &[Dollars; PERCENTILES_LEN], - spot: Dollars, + percentile_prices: &[Cents; PERCENTILES_LEN], + spot: Cents, ) -> StoredF32 { - if spot.is_nan() || percentile_prices[0].is_nan() { + if spot == Cents::ZERO && percentile_prices[0] == Cents::ZERO { return StoredF32::NAN; } @@ -68,7 +68,7 @@ pub(crate) fn compute_spot_percentile_rank( } pub struct PercentilesVecs { - pub vecs: [Price>; PERCENTILES_LEN], + pub vecs: [Price>; PERCENTILES_LEN], } const VERSION: Version = Version::ONE; @@ -94,14 +94,14 @@ impl PercentilesVecs { Ok(Self { vecs }) } - /// Push percentile prices at this height. + /// Push percentile prices at this height (in cents). pub(crate) fn truncate_push( &mut self, height: Height, - percentile_prices: &[Dollars; PERCENTILES_LEN], + percentile_prices: &[Cents; PERCENTILES_LEN], ) -> Result<()> { for (i, v) in self.vecs.iter_mut().enumerate() { - v.usd.height.truncate_push(height, percentile_prices[i])?; + v.cents.height.truncate_push(height, percentile_prices[i])?; } Ok(()) } @@ -109,7 +109,7 @@ impl PercentilesVecs { /// Validate computed versions or reset if mismatched. pub(crate) fn validate_computed_version_or_reset(&mut self, version: Version) -> Result<()> { for vec in self.vecs.iter_mut() { - vec.usd.height.validate_computed_version_or_reset(version)?; + vec.cents.height.validate_computed_version_or_reset(version)?; } Ok(()) } @@ -130,7 +130,7 @@ impl ReadOnlyClone for PercentilesVecs { impl Traversable for PercentilesVecs where - Price>: Traversable, + Price>: Traversable, { fn to_tree_node(&self) -> TreeNode { TreeNode::Branch( diff --git a/crates/brk_computer/src/internal/from_height/price.rs b/crates/brk_computer/src/internal/from_height/price.rs index 2e46e76d6..c4537ae15 100644 --- a/crates/brk_computer/src/internal/from_height/price.rs +++ b/crates/brk_computer/src/internal/from_height/price.rs @@ -1,65 +1,104 @@ -//! Generic price wrapper with both USD and sats representations. +//! Generic price wrapper with cents, USD, and sats representations. //! -//! All prices use this single struct with different USD types. +//! All prices use this single struct with different cents types. +//! USD is always lazily derived from cents via CentsUnsignedToDollars. //! Sats is always lazily derived from USD via DollarsToSatsFract. use brk_error::Result; use brk_traversable::Traversable; -use brk_types::{Dollars, SatsFract, Version}; +use brk_types::{Cents, Dollars, SatsFract, Version}; use schemars::JsonSchema; use vecdb::{Database, ReadableCloneableVec, UnaryTransform}; use super::{ComputedFromHeightLast, LazyFromHeightLast}; use crate::{ indexes, - internal::{ComputedVecValue, DollarsToSatsFract, NumericValue}, + internal::{CentsUnsignedToDollars, ComputedVecValue, DollarsToSatsFract, NumericValue}, }; -/// Generic price metric with both USD and sats representations. +/// Generic price metric with cents, USD, and sats representations. #[derive(Clone, Traversable)] -pub struct Price { - pub usd: U, +pub struct Price { + pub cents: C, + pub usd: LazyFromHeightLast, pub sats: LazyFromHeightLast, } -impl Price> { +impl Price> { + /// Import from database: stored cents, lazy USD + sats. pub(crate) fn forced_import( db: &Database, name: &str, version: Version, indexes: &indexes::Vecs, ) -> Result { - let usd = ComputedFromHeightLast::forced_import(db, name, version, indexes)?; - let sats = LazyFromHeightLast::from_computed::( + let cents = ComputedFromHeightLast::forced_import( + db, + &format!("{name}_cents"), + version, + indexes, + )?; + let usd = LazyFromHeightLast::from_computed::( + &format!("{name}_usd"), + version, + cents.height.read_only_boxed_clone(), + ¢s, + ); + let sats = LazyFromHeightLast::from_lazy::( &format!("{name}_sats"), version, - usd.height.read_only_boxed_clone(), &usd, ); - Ok(Self { usd, sats }) + Ok(Self { cents, usd, sats }) + } + + /// Wrap an already-imported ComputedFromHeightLast with lazy USD + sats. + pub(crate) fn from_cents( + name: &str, + version: Version, + cents: ComputedFromHeightLast, + ) -> Self { + let usd = LazyFromHeightLast::from_computed::( + &format!("{name}_usd"), + version, + cents.height.read_only_boxed_clone(), + ¢s, + ); + let sats = LazyFromHeightLast::from_lazy::( + &format!("{name}_sats"), + version, + &usd, + ); + Self { cents, usd, sats } } } -impl Price> +impl Price> where ST: ComputedVecValue + NumericValue + JsonSchema + 'static, { - pub(crate) fn from_computed>( + /// Create from a computed source, applying a transform to produce Cents. + pub(crate) fn from_cents_source>( name: &str, version: Version, source: &ComputedFromHeightLast, ) -> Self { - let usd = LazyFromHeightLast::from_computed::( - name, + let cents = LazyFromHeightLast::from_computed::( + &format!("{name}_cents"), version, source.height.read_only_boxed_clone(), source, ); - let sats = LazyFromHeightLast::from_lazy::( + let usd = LazyFromHeightLast::from_lazy::( + &format!("{name}_usd"), + version, + ¢s, + ); + let sats = LazyFromHeightLast::from_lazy::( &format!("{name}_sats"), version, &usd, ); - Self { usd, sats } + Self { cents, usd, sats } } } diff --git a/crates/brk_computer/src/internal/from_height/ratio/extended.rs b/crates/brk_computer/src/internal/from_height/ratio/extended.rs index e0fcd8530..b7d2ccf36 100644 --- a/crates/brk_computer/src/internal/from_height/ratio/extended.rs +++ b/crates/brk_computer/src/internal/from_height/ratio/extended.rs @@ -1,6 +1,6 @@ use brk_error::Result; use brk_traversable::Traversable; -use brk_types::{Dollars, Height, Version}; +use brk_types::{Cents, Height, Version}; use derive_more::{Deref, DerefMut}; use vecdb::{Database, Exit, ReadableVec, Rw, StorageMode}; @@ -31,22 +31,22 @@ impl ComputedFromHeightRatioExtended { }) } - /// Compute ratio and all extended metrics from an externally-provided metric price. + /// Compute ratio and all extended metrics from an externally-provided metric price (in cents). pub(crate) fn compute_rest( &mut self, blocks: &blocks::Vecs, prices: &prices::Vecs, starting_indexes: &ComputeIndexes, exit: &Exit, - metric_price: &impl ReadableVec, + metric_price: &impl ReadableVec, ) -> Result<()> { - let close_price = &prices.price.usd.height; + let close_price = &prices.price.cents.height; self.base .compute_ratio(starting_indexes, close_price, metric_price, exit)?; self.extended .compute_rest(blocks, starting_indexes, exit, &self.base.ratio.height)?; self.extended - .compute_usd_bands(starting_indexes, metric_price, exit)?; + .compute_cents_bands(starting_indexes, metric_price, exit)?; Ok(()) } } diff --git a/crates/brk_computer/src/internal/from_height/ratio/extension.rs b/crates/brk_computer/src/internal/from_height/ratio/extension.rs index 74f322db6..515704e34 100644 --- a/crates/brk_computer/src/internal/from_height/ratio/extension.rs +++ b/crates/brk_computer/src/internal/from_height/ratio/extension.rs @@ -1,6 +1,6 @@ use brk_error::Result; use brk_traversable::Traversable; -use brk_types::{Dollars, Height, StoredF32, Version}; +use brk_types::{Cents, Height, StoredF32, Version}; use vecdb::{AnyStoredVec, AnyVec, Database, EagerVec, Exit, PcoVec, ReadableVec, Rw, StorageMode, VecIndex, WritableVec}; use crate::{ @@ -21,12 +21,12 @@ pub struct ComputedFromHeightRatioExtension { pub ratio_pct5: ComputedFromHeightLast, pub ratio_pct2: ComputedFromHeightLast, pub ratio_pct1: ComputedFromHeightLast, - pub ratio_pct99_usd: Price>, - pub ratio_pct98_usd: Price>, - pub ratio_pct95_usd: Price>, - pub ratio_pct5_usd: Price>, - pub ratio_pct2_usd: Price>, - pub ratio_pct1_usd: Price>, + pub ratio_pct99_price: Price>, + pub ratio_pct98_price: Price>, + pub ratio_pct95_price: Price>, + pub ratio_pct5_price: Price>, + pub ratio_pct2_price: Price>, + pub ratio_pct1_price: Price>, pub ratio_sd: ComputedFromHeightStdDevExtended, pub ratio_4y_sd: ComputedFromHeightStdDevExtended, @@ -68,7 +68,7 @@ impl ComputedFromHeightRatioExtension { }; } - macro_rules! import_usd { + macro_rules! import_price { ($suffix:expr) => { Price::forced_import(db, &format!("{name}_{}", $suffix), v, indexes)? }; @@ -87,12 +87,12 @@ impl ComputedFromHeightRatioExtension { ratio_pct5: import!("ratio_pct5"), ratio_pct2: import!("ratio_pct2"), ratio_pct1: import!("ratio_pct1"), - ratio_pct99_usd: import_usd!("ratio_pct99_usd"), - ratio_pct98_usd: import_usd!("ratio_pct98_usd"), - ratio_pct95_usd: import_usd!("ratio_pct95_usd"), - ratio_pct5_usd: import_usd!("ratio_pct5_usd"), - ratio_pct2_usd: import_usd!("ratio_pct2_usd"), - ratio_pct1_usd: import_usd!("ratio_pct1_usd"), + ratio_pct99_price: import_price!("ratio_pct99"), + ratio_pct98_price: import_price!("ratio_pct98"), + ratio_pct95_price: import_price!("ratio_pct95"), + ratio_pct5_price: import_price!("ratio_pct5"), + ratio_pct2_price: import_price!("ratio_pct2"), + ratio_pct1_price: import_price!("ratio_pct1"), }) } @@ -219,20 +219,20 @@ impl ComputedFromHeightRatioExtension { Ok(()) } - /// Compute USD ratio bands: usd_band = metric_price * ratio_percentile - pub(crate) fn compute_usd_bands( + /// Compute cents ratio bands: cents_band = metric_price_cents * ratio_percentile + pub(crate) fn compute_cents_bands( &mut self, starting_indexes: &ComputeIndexes, - metric_price: &impl ReadableVec, + metric_price: &impl ReadableVec, exit: &Exit, ) -> Result<()> { - use crate::internal::PriceTimesRatio; + use crate::internal::PriceTimesRatioCents; macro_rules! compute_band { ($usd_field:ident, $band_source:expr) => { self.$usd_field - .usd - .compute_binary::( + .cents + .compute_binary::( starting_indexes.height, metric_price, $band_source, @@ -241,22 +241,22 @@ impl ComputedFromHeightRatioExtension { }; } - compute_band!(ratio_pct99_usd, &self.ratio_pct99.height); - compute_band!(ratio_pct98_usd, &self.ratio_pct98.height); - compute_band!(ratio_pct95_usd, &self.ratio_pct95.height); - compute_band!(ratio_pct5_usd, &self.ratio_pct5.height); - compute_band!(ratio_pct2_usd, &self.ratio_pct2.height); - compute_band!(ratio_pct1_usd, &self.ratio_pct1.height); + compute_band!(ratio_pct99_price, &self.ratio_pct99.height); + compute_band!(ratio_pct98_price, &self.ratio_pct98.height); + compute_band!(ratio_pct95_price, &self.ratio_pct95.height); + compute_band!(ratio_pct5_price, &self.ratio_pct5.height); + compute_band!(ratio_pct2_price, &self.ratio_pct2.height); + compute_band!(ratio_pct1_price, &self.ratio_pct1.height); - // Stddev USD bands + // Stddev cents bands self.ratio_sd - .compute_usd_bands(starting_indexes, metric_price, exit)?; + .compute_cents_bands(starting_indexes, metric_price, exit)?; self.ratio_4y_sd - .compute_usd_bands(starting_indexes, metric_price, exit)?; + .compute_cents_bands(starting_indexes, metric_price, exit)?; self.ratio_2y_sd - .compute_usd_bands(starting_indexes, metric_price, exit)?; + .compute_cents_bands(starting_indexes, metric_price, exit)?; self.ratio_1y_sd - .compute_usd_bands(starting_indexes, metric_price, exit)?; + .compute_cents_bands(starting_indexes, metric_price, exit)?; Ok(()) } diff --git a/crates/brk_computer/src/internal/from_height/ratio/mod.rs b/crates/brk_computer/src/internal/from_height/ratio/mod.rs index c184a5e98..3c99f6274 100644 --- a/crates/brk_computer/src/internal/from_height/ratio/mod.rs +++ b/crates/brk_computer/src/internal/from_height/ratio/mod.rs @@ -8,7 +8,7 @@ pub use price_extended::*; use brk_error::Result; use brk_traversable::Traversable; -use brk_types::{Dollars, Height, StoredF32, Version}; +use brk_types::{Cents, Height, StoredF32, Version}; use vecdb::{Database, Exit, ReadableVec, Rw, StorageMode}; use crate::{ComputeIndexes, indexes}; @@ -36,12 +36,12 @@ impl ComputedFromHeightRatio { }) } - /// Compute ratio = close_price / metric_price at height level + /// Compute ratio = close_price / metric_price at height level (both in cents) pub(crate) fn compute_ratio( &mut self, starting_indexes: &ComputeIndexes, - close_price: &impl ReadableVec, - metric_price: &impl ReadableVec, + close_price: &impl ReadableVec, + metric_price: &impl ReadableVec, exit: &Exit, ) -> Result<()> { self.ratio.height.compute_transform2( @@ -49,10 +49,10 @@ impl ComputedFromHeightRatio { close_price, metric_price, |(i, close, price, ..)| { - if price == Dollars::ZERO { + if price == Cents::ZERO { (i, StoredF32::from(1.0)) } else { - (i, StoredF32::from(close / price)) + (i, StoredF32::from(f64::from(close) / f64::from(price))) } }, exit, diff --git a/crates/brk_computer/src/internal/from_height/ratio/price_extended.rs b/crates/brk_computer/src/internal/from_height/ratio/price_extended.rs index 15225738d..14f02878a 100644 --- a/crates/brk_computer/src/internal/from_height/ratio/price_extended.rs +++ b/crates/brk_computer/src/internal/from_height/ratio/price_extended.rs @@ -1,6 +1,6 @@ use brk_error::Result; use brk_traversable::Traversable; -use brk_types::{Dollars, Height, Version}; +use brk_types::{Cents, Height, Version}; use derive_more::{Deref, DerefMut}; use vecdb::{Database, EagerVec, Exit, PcoVec, Rw, StorageMode}; @@ -15,7 +15,7 @@ pub struct ComputedFromHeightPriceWithRatioExtended { #[deref_mut] #[traversable(flatten)] pub inner: ComputedFromHeightRatioExtended, - pub price: Price>, + pub price: Price>, } impl ComputedFromHeightPriceWithRatioExtended { @@ -32,7 +32,7 @@ impl ComputedFromHeightPriceWithRatioExtended { }) } - /// Compute price via closure, then compute ratio + extended metrics. + /// Compute price via closure (in cents), then compute ratio + extended metrics. pub(crate) fn compute_all( &mut self, blocks: &blocks::Vecs, @@ -42,15 +42,15 @@ impl ComputedFromHeightPriceWithRatioExtended { mut compute_price: F, ) -> Result<()> where - F: FnMut(&mut EagerVec>) -> Result<()>, + F: FnMut(&mut EagerVec>) -> Result<()>, { - compute_price(&mut self.price.usd.height)?; + compute_price(&mut self.price.cents.height)?; self.inner.compute_rest( blocks, prices, starting_indexes, exit, - &self.price.usd.height, + &self.price.cents.height, )?; Ok(()) } diff --git a/crates/brk_computer/src/internal/from_height/stddev/extended.rs b/crates/brk_computer/src/internal/from_height/stddev/extended.rs index e4286ccb2..0f97ab614 100644 --- a/crates/brk_computer/src/internal/from_height/stddev/extended.rs +++ b/crates/brk_computer/src/internal/from_height/stddev/extended.rs @@ -1,6 +1,6 @@ use brk_error::Result; use brk_traversable::Traversable; -use brk_types::{Dollars, Height, StoredF32, Version}; +use brk_types::{Cents, Height, StoredF32, Version}; use vecdb::{ AnyStoredVec, AnyVec, Database, EagerVec, Exit, PcoVec, ReadableVec, Rw, StorageMode, VecIndex, WritableVec, @@ -32,19 +32,19 @@ pub struct ComputedFromHeightStdDevExtended { pub m2_5sd: ComputedFromHeightLast, pub m3sd: ComputedFromHeightLast, - pub _0sd_usd: Price>, - pub p0_5sd_usd: Price>, - pub p1sd_usd: Price>, - pub p1_5sd_usd: Price>, - pub p2sd_usd: Price>, - pub p2_5sd_usd: Price>, - pub p3sd_usd: Price>, - pub m0_5sd_usd: Price>, - pub m1sd_usd: Price>, - pub m1_5sd_usd: Price>, - pub m2sd_usd: Price>, - pub m2_5sd_usd: Price>, - pub m3sd_usd: Price>, + pub _0sd_price: Price>, + pub p0_5sd_price: Price>, + pub p1sd_price: Price>, + pub p1_5sd_price: Price>, + pub p2sd_price: Price>, + pub p2_5sd_price: Price>, + pub p3sd_price: Price>, + pub m0_5sd_price: Price>, + pub m1sd_price: Price>, + pub m1_5sd_price: Price>, + pub m2sd_price: Price>, + pub m2_5sd_price: Price>, + pub m3sd_price: Price>, } impl ComputedFromHeightStdDevExtended { @@ -68,7 +68,7 @@ impl ComputedFromHeightStdDevExtended { }; } - macro_rules! import_usd { + macro_rules! import_price { ($suffix:expr) => { Price::forced_import(db, &format!("{name}_{}", $suffix), version, indexes)? }; @@ -89,19 +89,19 @@ impl ComputedFromHeightStdDevExtended { m2sd: import!("m2sd"), m2_5sd: import!("m2_5sd"), m3sd: import!("m3sd"), - _0sd_usd: import_usd!("0sd_usd"), - p0_5sd_usd: import_usd!("p0_5sd_usd"), - p1sd_usd: import_usd!("p1sd_usd"), - p1_5sd_usd: import_usd!("p1_5sd_usd"), - p2sd_usd: import_usd!("p2sd_usd"), - p2_5sd_usd: import_usd!("p2_5sd_usd"), - p3sd_usd: import_usd!("p3sd_usd"), - m0_5sd_usd: import_usd!("m0_5sd_usd"), - m1sd_usd: import_usd!("m1sd_usd"), - m1_5sd_usd: import_usd!("m1_5sd_usd"), - m2sd_usd: import_usd!("m2sd_usd"), - m2_5sd_usd: import_usd!("m2_5sd_usd"), - m3sd_usd: import_usd!("m3sd_usd"), + _0sd_price: import_price!("0sd"), + p0_5sd_price: import_price!("p0_5sd"), + p1sd_price: import_price!("p1sd"), + p1_5sd_price: import_price!("p1_5sd"), + p2sd_price: import_price!("p2sd"), + p2_5sd_price: import_price!("p2_5sd"), + p3sd_price: import_price!("p3sd"), + m0_5sd_price: import_price!("m0_5sd"), + m1sd_price: import_price!("m1sd"), + m1_5sd_price: import_price!("m1_5sd"), + m2sd_price: import_price!("m2sd"), + m2_5sd_price: import_price!("m2_5sd"), + m3sd_price: import_price!("m3sd"), }) } @@ -217,20 +217,20 @@ impl ComputedFromHeightStdDevExtended { Ok(()) } - /// Compute USD price bands: usd_band = metric_price * band_ratio - pub(crate) fn compute_usd_bands( + /// Compute cents price bands: cents_band = metric_price_cents * band_ratio + pub(crate) fn compute_cents_bands( &mut self, starting_indexes: &ComputeIndexes, - metric_price: &impl ReadableVec, + metric_price: &impl ReadableVec, exit: &Exit, ) -> Result<()> { - use crate::internal::PriceTimesRatio; + use crate::internal::PriceTimesRatioCents; macro_rules! compute_band { ($usd_field:ident, $band_source:expr) => { self.$usd_field - .usd - .compute_binary::( + .cents + .compute_binary::( starting_indexes.height, metric_price, $band_source, @@ -239,19 +239,19 @@ impl ComputedFromHeightStdDevExtended { }; } - compute_band!(_0sd_usd, &self.base.sma.height); - compute_band!(p0_5sd_usd, &self.p0_5sd.height); - compute_band!(p1sd_usd, &self.p1sd.height); - compute_band!(p1_5sd_usd, &self.p1_5sd.height); - compute_band!(p2sd_usd, &self.p2sd.height); - compute_band!(p2_5sd_usd, &self.p2_5sd.height); - compute_band!(p3sd_usd, &self.p3sd.height); - compute_band!(m0_5sd_usd, &self.m0_5sd.height); - compute_band!(m1sd_usd, &self.m1sd.height); - compute_band!(m1_5sd_usd, &self.m1_5sd.height); - compute_band!(m2sd_usd, &self.m2sd.height); - compute_band!(m2_5sd_usd, &self.m2_5sd.height); - compute_band!(m3sd_usd, &self.m3sd.height); + compute_band!(_0sd_price, &self.base.sma.height); + compute_band!(p0_5sd_price, &self.p0_5sd.height); + compute_band!(p1sd_price, &self.p1sd.height); + compute_band!(p1_5sd_price, &self.p1_5sd.height); + compute_band!(p2sd_price, &self.p2sd.height); + compute_band!(p2_5sd_price, &self.p2_5sd.height); + compute_band!(p3sd_price, &self.p3sd.height); + compute_band!(m0_5sd_price, &self.m0_5sd.height); + compute_band!(m1sd_price, &self.m1sd.height); + compute_band!(m1_5sd_price, &self.m1_5sd.height); + compute_band!(m2sd_price, &self.m2sd.height); + compute_band!(m2_5sd_price, &self.m2_5sd.height); + compute_band!(m3sd_price, &self.m3sd.height); Ok(()) } diff --git a/crates/brk_computer/src/internal/from_height/value_change.rs b/crates/brk_computer/src/internal/from_height/value_change.rs index 63dfba091..9e6aabfbd 100644 --- a/crates/brk_computer/src/internal/from_height/value_change.rs +++ b/crates/brk_computer/src/internal/from_height/value_change.rs @@ -2,22 +2,25 @@ use brk_error::Result; use brk_traversable::Traversable; -use brk_types::{Bitcoin, Dollars, Height, Sats, SatsSigned, Version}; +use brk_types::{Bitcoin, Cents, CentsSigned, Dollars, Height, Sats, SatsSigned, Version}; use vecdb::{Database, Exit, ReadableCloneableVec, ReadableVec, Rw, StorageMode}; use crate::{ indexes, - internal::{ComputedFromHeightLast, LazyFromHeightLast, SatsSignedToBitcoin}, + internal::{ + CentsSignedToDollars, ComputedFromHeightLast, LazyFromHeightLast, SatsSignedToBitcoin, + }, }; const VERSION: Version = Version::ZERO; -/// Change values indexed by height - sats (stored), btc (lazy), usd (stored). +/// Change values indexed by height - sats (stored), btc (lazy), cents (stored), usd (lazy). #[derive(Traversable)] pub struct ValueFromHeightChange { pub sats: ComputedFromHeightLast, pub btc: LazyFromHeightLast, - pub usd: ComputedFromHeightLast, + pub cents: ComputedFromHeightLast, + pub usd: LazyFromHeightLast, } impl ValueFromHeightChange { @@ -38,31 +41,38 @@ impl ValueFromHeightChange { &sats, ); - let usd = ComputedFromHeightLast::forced_import( + let cents = ComputedFromHeightLast::forced_import( db, - &format!("{name}_usd"), + &format!("{name}_cents"), v, indexes, )?; - Ok(Self { sats, btc, usd }) + let usd = LazyFromHeightLast::from_computed::( + &format!("{name}_usd"), + v, + cents.height.read_only_boxed_clone(), + ¢s, + ); + + Ok(Self { sats, btc, cents, usd }) } - /// Compute rolling change for both sats and dollars in one call. + /// Compute rolling change for both sats and cents in one call. pub(crate) fn compute_rolling( &mut self, starting_height: Height, window_starts: &impl ReadableVec, sats_source: &impl ReadableVec, - dollars_source: &(impl ReadableVec + Sync), + cents_source: &(impl ReadableVec + Sync), exit: &Exit, ) -> Result<()> { self.sats .height .compute_rolling_change(starting_height, window_starts, sats_source, exit)?; - self.usd + self.cents .height - .compute_rolling_change(starting_height, window_starts, dollars_source, exit)?; + .compute_rolling_change(starting_height, window_starts, cents_source, exit)?; Ok(()) } } diff --git a/crates/brk_computer/src/internal/from_height/value_cumulative.rs b/crates/brk_computer/src/internal/from_height/value_cumulative.rs index 81e278a65..446f769aa 100644 --- a/crates/brk_computer/src/internal/from_height/value_cumulative.rs +++ b/crates/brk_computer/src/internal/from_height/value_cumulative.rs @@ -1,11 +1,11 @@ use brk_error::Result; use brk_traversable::Traversable; -use brk_types::{Dollars, Height, Sats, Version}; +use brk_types::{Cents, Height, Sats, Version}; use vecdb::{Database, Exit, Rw, StorageMode}; use crate::{ indexes, - internal::{ByUnit, SatsToDollars}, + internal::{ByUnit, SatsToCents}, prices, }; @@ -44,18 +44,18 @@ impl ValueFromHeightCumulative { .compute_cumulative(max_from, &self.base.sats.height, exit)?; self.base - .usd - .compute_binary::( + .cents + .compute_binary::( max_from, &self.base.sats.height, - &prices.price.usd.height, + &prices.price.cents.height, exit, )?; self.cumulative - .usd + .cents .height - .compute_cumulative(max_from, &self.base.usd.height, exit)?; + .compute_cumulative(max_from, &self.base.cents.height, exit)?; Ok(()) } diff --git a/crates/brk_computer/src/internal/from_height/value_full.rs b/crates/brk_computer/src/internal/from_height/value_full.rs index 9824472a9..c0ce0288c 100644 --- a/crates/brk_computer/src/internal/from_height/value_full.rs +++ b/crates/brk_computer/src/internal/from_height/value_full.rs @@ -1,11 +1,11 @@ use brk_error::Result; use brk_traversable::Traversable; -use brk_types::{Dollars, Height, Sats, Version}; +use brk_types::{Cents, Height, Sats, Version}; use vecdb::{Database, EagerVec, Exit, PcoVec, Rw, StorageMode}; use crate::{ indexes, - internal::{ByUnit, RollingFullByUnit, SatsToDollars, WindowStarts}, + internal::{ByUnit, RollingFullByUnit, SatsToCents, WindowStarts}, prices, }; @@ -51,25 +51,25 @@ impl ValueFromHeightFull { .compute_cumulative(max_from, &self.base.sats.height, exit)?; self.base - .usd + .cents .height - .compute_binary::( + .compute_binary::( max_from, &self.base.sats.height, - &prices.price.usd.height, + &prices.price.cents.height, exit, )?; self.cumulative - .usd + .cents .height - .compute_cumulative(max_from, &self.base.usd.height, exit)?; + .compute_cumulative(max_from, &self.base.cents.height, exit)?; self.rolling.compute( max_from, windows, &self.base.sats.height, - &self.base.usd.height, + &self.base.cents.height, exit, )?; diff --git a/crates/brk_computer/src/internal/from_height/value_last.rs b/crates/brk_computer/src/internal/from_height/value_last.rs index 4fdc0c6ee..25541b3fe 100644 --- a/crates/brk_computer/src/internal/from_height/value_last.rs +++ b/crates/brk_computer/src/internal/from_height/value_last.rs @@ -1,12 +1,12 @@ use brk_error::Result; use brk_traversable::Traversable; -use brk_types::{Dollars, Height, Sats, Version}; +use brk_types::{Cents, Height, Sats, Version}; use derive_more::{Deref, DerefMut}; use vecdb::{Database, Exit, ReadableVec, Rw, StorageMode}; use crate::{ indexes, prices, - internal::{ByUnit, SatsToDollars}, + internal::{ByUnit, SatsToCents}, }; #[derive(Deref, DerefMut, Traversable)] @@ -38,10 +38,10 @@ impl ValueFromHeightLast { max_from: Height, exit: &Exit, ) -> Result<()> { - self.base.usd.compute_binary::( + self.base.cents.compute_binary::( max_from, &self.base.sats.height, - &prices.price.usd.height, + &prices.price.cents.height, exit, )?; Ok(()) @@ -52,7 +52,7 @@ impl ValueFromHeightLast { max_from: Height, window_starts: &impl ReadableVec, sats_source: &impl ReadableVec, - usd_source: &impl ReadableVec, + cents_source: &impl ReadableVec, exit: &Exit, ) -> Result<()> { self.base @@ -60,9 +60,9 @@ impl ValueFromHeightLast { .height .compute_rolling_sum(max_from, window_starts, sats_source, exit)?; self.base - .usd + .cents .height - .compute_rolling_sum(max_from, window_starts, usd_source, exit)?; + .compute_rolling_sum(max_from, window_starts, cents_source, exit)?; Ok(()) } @@ -71,7 +71,7 @@ impl ValueFromHeightLast { starting_height: Height, window_starts: &impl ReadableVec, sats_source: &impl ReadableVec, - dollars_source: &(impl ReadableVec + Sync), + cents_source: &(impl ReadableVec + Sync), exit: &Exit, ) -> Result<()> { self.base @@ -79,9 +79,9 @@ impl ValueFromHeightLast { .height .compute_rolling_ema(starting_height, window_starts, sats_source, exit)?; self.base - .usd + .cents .height - .compute_rolling_ema(starting_height, window_starts, dollars_source, exit)?; + .compute_rolling_ema(starting_height, window_starts, cents_source, exit)?; Ok(()) } } diff --git a/crates/brk_computer/src/internal/from_height/value_last_rolling.rs b/crates/brk_computer/src/internal/from_height/value_last_rolling.rs index cca011afb..6e4d6c967 100644 --- a/crates/brk_computer/src/internal/from_height/value_last_rolling.rs +++ b/crates/brk_computer/src/internal/from_height/value_last_rolling.rs @@ -41,7 +41,7 @@ impl ValueFromHeightLastRolling { }) } - /// Compute sats height via closure, then USD from price, then rolling windows. + /// Compute sats height via closure, then cents from price, then rolling windows. pub(crate) fn compute( &mut self, max_from: Height, @@ -51,12 +51,12 @@ impl ValueFromHeightLastRolling { compute_sats: impl FnOnce(&mut EagerVec>) -> Result<()>, ) -> Result<()> { compute_sats(&mut self.value.sats)?; - self.value.compute_usd(prices, max_from, exit)?; + self.value.compute_cents(prices, max_from, exit)?; self.rolling.compute_rolling_sum( max_from, windows, &self.value.sats, - &self.value.usd, + &self.value.cents, exit, )?; Ok(()) diff --git a/crates/brk_computer/src/internal/from_height/value_sum_cumulative.rs b/crates/brk_computer/src/internal/from_height/value_sum_cumulative.rs index d8c423ddf..6cf5b8a95 100644 --- a/crates/brk_computer/src/internal/from_height/value_sum_cumulative.rs +++ b/crates/brk_computer/src/internal/from_height/value_sum_cumulative.rs @@ -1,11 +1,11 @@ use brk_error::Result; use brk_traversable::Traversable; -use brk_types::{Dollars, Height, Sats, Version}; +use brk_types::{Cents, Height, Sats, Version}; use vecdb::{Database, EagerVec, Exit, PcoVec, Rw, StorageMode}; use crate::{ indexes, - internal::{ByUnit, RollingSumByUnit, SatsToDollars, WindowStarts}, + internal::{ByUnit, RollingSumByUnit, SatsToCents, WindowStarts}, prices, }; @@ -50,25 +50,25 @@ impl ValueFromHeightSumCumulative { .compute_cumulative(max_from, &self.base.sats.height, exit)?; self.base - .usd + .cents .height - .compute_binary::( + .compute_binary::( max_from, &self.base.sats.height, - &prices.price.usd.height, + &prices.price.cents.height, exit, )?; self.cumulative - .usd + .cents .height - .compute_cumulative(max_from, &self.base.usd.height, exit)?; + .compute_cumulative(max_from, &self.base.cents.height, exit)?; self.sum.compute_rolling_sum( max_from, windows, &self.base.sats.height, - &self.base.usd.height, + &self.base.cents.height, exit, )?; diff --git a/crates/brk_computer/src/internal/height/value.rs b/crates/brk_computer/src/internal/height/value.rs index 34fdcd95d..e92d01728 100644 --- a/crates/brk_computer/src/internal/height/value.rs +++ b/crates/brk_computer/src/internal/height/value.rs @@ -1,17 +1,17 @@ //! Value type with height-level data only (no period-derived views). //! -//! Stores sats and USD per height, plus a lazy btc transform. +//! Stores sats and cents per height, plus lazy btc and usd transforms. //! Use when period views are unnecessary (e.g., rolling windows provide windowed data). use brk_error::Result; use brk_traversable::Traversable; -use brk_types::{Bitcoin, Dollars, Height, Sats, Version}; +use brk_types::{Bitcoin, Cents, Dollars, Height, Sats, Version}; use vecdb::{ Database, EagerVec, Exit, ImportableVec, LazyVecFrom1, PcoVec, ReadableCloneableVec, Rw, StorageMode, }; -use crate::{internal::{SatsToBitcoin, SatsToDollars}, prices}; +use crate::{internal::{CentsUnsignedToDollars, SatsToBitcoin, SatsToCents}, prices}; const VERSION: Version = Version::TWO; // Match ValueFromHeightLast versioning @@ -19,7 +19,8 @@ const VERSION: Version = Version::TWO; // Match ValueFromHeightLast versioning pub struct ValueFromHeight { pub sats: M::Stored>>, pub btc: LazyVecFrom1, - pub usd: M::Stored>>, + pub cents: M::Stored>>, + pub usd: LazyVecFrom1, } impl ValueFromHeight { @@ -36,22 +37,28 @@ impl ValueFromHeight { v, sats.read_only_boxed_clone(), ); - let usd = EagerVec::forced_import(db, &format!("{name}_usd"), v)?; + let cents: EagerVec> = + EagerVec::forced_import(db, &format!("{name}_cents"), v)?; + let usd = LazyVecFrom1::transformed::( + &format!("{name}_usd"), + v, + cents.read_only_boxed_clone(), + ); - Ok(Self { sats, btc, usd }) + Ok(Self { sats, btc, cents, usd }) } - /// Eagerly compute USD height values: sats[h] * price[h]. - pub(crate) fn compute_usd( + /// Eagerly compute cents height values: sats[h] * price_cents[h] / 1e8. + pub(crate) fn compute_cents( &mut self, prices: &prices::Vecs, max_from: Height, exit: &Exit, ) -> Result<()> { - self.usd.compute_binary::( + self.cents.compute_binary::( max_from, &self.sats, - &prices.price.usd.height, + &prices.price.cents.height, exit, )?; Ok(()) diff --git a/crates/brk_computer/src/internal/height_derived/lazy_value_last.rs b/crates/brk_computer/src/internal/height_derived/lazy_value_last.rs index 7ecdf3d3c..98083d40c 100644 --- a/crates/brk_computer/src/internal/height_derived/lazy_value_last.rs +++ b/crates/brk_computer/src/internal/height_derived/lazy_value_last.rs @@ -1,7 +1,7 @@ //! Lazy value type for Last pattern across all height-derived indexes. use brk_traversable::Traversable; -use brk_types::{Bitcoin, Dollars, Sats, Version}; +use brk_types::{Bitcoin, Cents, Dollars, Sats, Version}; use vecdb::UnaryTransform; use crate::internal::{LazyHeightDerivedLast, ValueFromHeightLast}; @@ -40,7 +40,7 @@ impl LazyValueHeightDerivedLast { &source.sats.rest, ); - let usd = LazyHeightDerivedLast::from_derived_computed::( + let usd = LazyHeightDerivedLast::from_lazy::( &format!("{name}_usd"), v, &source.usd.rest, diff --git a/crates/brk_computer/src/internal/rolling/value_windows.rs b/crates/brk_computer/src/internal/rolling/value_windows.rs index 7a6c5f94b..dd8865cef 100644 --- a/crates/brk_computer/src/internal/rolling/value_windows.rs +++ b/crates/brk_computer/src/internal/rolling/value_windows.rs @@ -10,7 +10,7 @@ use brk_types::{Height, Version}; use derive_more::{Deref, DerefMut}; use vecdb::{Database, Exit, ReadableVec, Rw, StorageMode}; -use brk_types::{Dollars, Sats}; +use brk_types::{Cents, Sats}; use crate::{ indexes, @@ -69,11 +69,11 @@ impl ValueFromHeightLastWindows { max_from: Height, windows: &WindowStarts<'_>, sats_source: &impl ReadableVec, - usd_source: &impl ReadableVec, + cents_source: &impl ReadableVec, exit: &Exit, ) -> Result<()> { for (w, starts) in self.0.as_mut_array().into_iter().zip(windows.as_array()) { - w.compute_rolling_sum(max_from, starts, sats_source, usd_source, exit)?; + w.compute_rolling_sum(max_from, starts, sats_source, cents_source, exit)?; } Ok(()) } diff --git a/crates/brk_computer/src/internal/transform/cents_plus.rs b/crates/brk_computer/src/internal/transform/cents_plus.rs new file mode 100644 index 000000000..1592885cd --- /dev/null +++ b/crates/brk_computer/src/internal/transform/cents_plus.rs @@ -0,0 +1,13 @@ +use brk_types::Cents; +use vecdb::BinaryTransform; + +/// (Cents, Cents) -> Cents addition +/// Used for computing total = profit + loss +pub struct CentsPlus; + +impl BinaryTransform for CentsPlus { + #[inline(always)] + fn apply(lhs: Cents, rhs: Cents) -> Cents { + lhs + rhs + } +} diff --git a/crates/brk_computer/src/internal/transform/cents_signed_to_dollars.rs b/crates/brk_computer/src/internal/transform/cents_signed_to_dollars.rs new file mode 100644 index 000000000..151ca91d7 --- /dev/null +++ b/crates/brk_computer/src/internal/transform/cents_signed_to_dollars.rs @@ -0,0 +1,12 @@ +use brk_types::{CentsSigned, Dollars}; +use vecdb::UnaryTransform; + +/// CentsSigned -> Dollars (convert signed cents to dollars for display) +pub struct CentsSignedToDollars; + +impl UnaryTransform for CentsSignedToDollars { + #[inline(always)] + fn apply(cents: CentsSigned) -> Dollars { + cents.into() + } +} diff --git a/crates/brk_computer/src/internal/transform/cents_times_tenths.rs b/crates/brk_computer/src/internal/transform/cents_times_tenths.rs new file mode 100644 index 000000000..140be80c1 --- /dev/null +++ b/crates/brk_computer/src/internal/transform/cents_times_tenths.rs @@ -0,0 +1,13 @@ +use brk_types::Cents; +use vecdb::UnaryTransform; + +/// Cents * (V/10) -> Cents (e.g., V=8 -> * 0.8, V=24 -> * 2.4) +pub struct CentsTimesTenths; + +impl UnaryTransform for CentsTimesTenths { + #[inline(always)] + fn apply(c: Cents) -> Cents { + // Use u128 to avoid overflow: c * V / 10 + Cents::from(c.as_u128() * V as u128 / 10) + } +} diff --git a/crates/brk_computer/src/internal/transform/dollar_plus.rs b/crates/brk_computer/src/internal/transform/dollar_plus.rs deleted file mode 100644 index d2b2743b3..000000000 --- a/crates/brk_computer/src/internal/transform/dollar_plus.rs +++ /dev/null @@ -1,13 +0,0 @@ -use brk_types::Dollars; -use vecdb::BinaryTransform; - -/// (Dollars, Dollars) -> Dollars addition -/// Used for computing total = profit + loss -pub struct DollarsPlus; - -impl BinaryTransform for DollarsPlus { - #[inline(always)] - fn apply(lhs: Dollars, rhs: Dollars) -> Dollars { - lhs + rhs - } -} diff --git a/crates/brk_computer/src/internal/transform/dollar_times_tenths.rs b/crates/brk_computer/src/internal/transform/dollar_times_tenths.rs deleted file mode 100644 index c557c7947..000000000 --- a/crates/brk_computer/src/internal/transform/dollar_times_tenths.rs +++ /dev/null @@ -1,12 +0,0 @@ -use brk_types::Dollars; -use vecdb::UnaryTransform; - -/// Dollars * (V/10) -> Dollars (e.g., V=8 -> * 0.8, V=24 -> * 2.4) -pub struct DollarsTimesTenths; - -impl UnaryTransform for DollarsTimesTenths { - #[inline(always)] - fn apply(d: Dollars) -> Dollars { - d * (V as f64 / 10.0) - } -} diff --git a/crates/brk_computer/src/internal/transform/mod.rs b/crates/brk_computer/src/internal/transform/mod.rs index b891c2cae..4daf9d0ea 100644 --- a/crates/brk_computer/src/internal/transform/mod.rs +++ b/crates/brk_computer/src/internal/transform/mod.rs @@ -1,68 +1,80 @@ mod block_count_target; +mod cents_plus; +mod cents_signed_to_dollars; +mod cents_times_tenths; mod cents_to_dollars; mod cents_to_sats; mod dollar_halve; mod dollar_identity; -mod dollar_plus; -mod dollar_times_tenths; mod dollars_to_sats_fract; mod f32_identity; +mod neg_cents_to_dollars; mod ohlc_cents_to_dollars; mod ohlc_cents_to_sats; +mod percentage_cents_f32; +mod percentage_cents_signed_dollars_f32; +mod percentage_cents_signed_f32; +mod percentage_diff_close_cents; mod percentage_diff_close_dollars; mod percentage_dollars_f32; mod percentage_dollars_f32_neg; mod percentage_sats_f64; mod percentage_u32_f32; -mod price_times_ratio; +mod price_times_ratio_cents; mod ratio32; -mod ratio64; +mod ratio_cents64; mod ratio_u64_f32; mod return_f32_tenths; mod return_i8; mod return_u16; +mod sats_to_cents; mod sat_halve; mod sat_halve_to_bitcoin; mod sat_identity; mod sat_mask; mod sat_to_bitcoin; -mod sats_to_dollars; mod u16_to_years; mod volatility_sqrt30; mod volatility_sqrt365; mod volatility_sqrt7; pub use block_count_target::*; +pub use cents_plus::*; +pub use cents_signed_to_dollars::*; +pub use cents_times_tenths::*; pub use cents_to_dollars::*; pub use cents_to_sats::*; +pub use neg_cents_to_dollars::*; pub use ohlc_cents_to_dollars::*; pub use ohlc_cents_to_sats::*; +pub use percentage_cents_f32::*; +pub use percentage_cents_signed_dollars_f32::*; +pub use percentage_cents_signed_f32::*; pub use dollar_halve::*; pub use dollar_identity::*; -pub use dollar_plus::*; -pub use dollar_times_tenths::*; pub use dollars_to_sats_fract::*; pub use f32_identity::*; +pub use percentage_diff_close_cents::*; pub use percentage_diff_close_dollars::*; pub use percentage_dollars_f32::*; pub use percentage_dollars_f32_neg::*; pub use percentage_sats_f64::*; pub use percentage_u32_f32::*; -pub use price_times_ratio::*; +pub use price_times_ratio_cents::*; pub use ratio32::*; -pub use ratio64::*; +pub use ratio_cents64::*; pub use ratio_u64_f32::*; pub use return_f32_tenths::*; pub use return_i8::*; pub use return_u16::*; +pub use sats_to_cents::*; pub use sat_halve::*; pub use sat_halve_to_bitcoin::*; pub use sat_identity::*; pub use sat_mask::*; pub use sat_to_bitcoin::*; -pub use sats_to_dollars::*; pub use u16_to_years::*; pub use volatility_sqrt7::*; pub use volatility_sqrt30::*; diff --git a/crates/brk_computer/src/internal/transform/neg_cents_to_dollars.rs b/crates/brk_computer/src/internal/transform/neg_cents_to_dollars.rs new file mode 100644 index 000000000..5ef3b6d95 --- /dev/null +++ b/crates/brk_computer/src/internal/transform/neg_cents_to_dollars.rs @@ -0,0 +1,13 @@ +use brk_types::{Cents, Dollars}; +use vecdb::UnaryTransform; + +/// Cents -> -Dollars (negate after converting to dollars) +/// Avoids lazy-from-lazy by combining both transforms. +pub struct NegCentsUnsignedToDollars; + +impl UnaryTransform for NegCentsUnsignedToDollars { + #[inline(always)] + fn apply(cents: Cents) -> Dollars { + -Dollars::from(cents) + } +} diff --git a/crates/brk_computer/src/internal/transform/percentage_cents_f32.rs b/crates/brk_computer/src/internal/transform/percentage_cents_f32.rs new file mode 100644 index 000000000..35cafdcc4 --- /dev/null +++ b/crates/brk_computer/src/internal/transform/percentage_cents_f32.rs @@ -0,0 +1,16 @@ +use brk_types::{Cents, StoredF32}; +use vecdb::BinaryTransform; + +/// (Cents, Cents) -> StoredF32 percentage (a/b × 100) +pub struct PercentageCentsF32; + +impl BinaryTransform for PercentageCentsF32 { + #[inline(always)] + fn apply(numerator: Cents, denominator: Cents) -> StoredF32 { + if denominator == Cents::ZERO { + StoredF32::default() + } else { + StoredF32::from(numerator.inner() as f64 / denominator.inner() as f64 * 100.0) + } + } +} diff --git a/crates/brk_computer/src/internal/transform/percentage_cents_signed_dollars_f32.rs b/crates/brk_computer/src/internal/transform/percentage_cents_signed_dollars_f32.rs new file mode 100644 index 000000000..d7c90c2df --- /dev/null +++ b/crates/brk_computer/src/internal/transform/percentage_cents_signed_dollars_f32.rs @@ -0,0 +1,17 @@ +use brk_types::{CentsSigned, Dollars, StoredF32}; +use vecdb::BinaryTransform; + +/// (CentsSigned, Dollars) -> StoredF32 percentage (a/b × 100) +/// For cross-type percentage when numerator is CentsSigned and denominator is Dollars. +pub struct PercentageCentsSignedDollarsF32; + +impl BinaryTransform for PercentageCentsSignedDollarsF32 { + #[inline(always)] + fn apply(numerator: CentsSigned, denominator: Dollars) -> StoredF32 { + if denominator == Dollars::ZERO { + StoredF32::default() + } else { + StoredF32::from(numerator.inner() as f64 / *denominator * 100.0) + } + } +} diff --git a/crates/brk_computer/src/internal/transform/percentage_cents_signed_f32.rs b/crates/brk_computer/src/internal/transform/percentage_cents_signed_f32.rs new file mode 100644 index 000000000..8de911909 --- /dev/null +++ b/crates/brk_computer/src/internal/transform/percentage_cents_signed_f32.rs @@ -0,0 +1,17 @@ +use brk_types::{Cents, CentsSigned, StoredF32}; +use vecdb::BinaryTransform; + +/// (CentsSigned, Cents) -> StoredF32 percentage (a/b × 100) +/// For cross-type percentage when numerator is signed. +pub struct PercentageCentsSignedCentsF32; + +impl BinaryTransform for PercentageCentsSignedCentsF32 { + #[inline(always)] + fn apply(numerator: CentsSigned, denominator: Cents) -> StoredF32 { + if denominator == Cents::ZERO { + StoredF32::default() + } else { + StoredF32::from(numerator.inner() as f64 / denominator.inner() as f64 * 100.0) + } + } +} diff --git a/crates/brk_computer/src/internal/transform/percentage_diff_close_cents.rs b/crates/brk_computer/src/internal/transform/percentage_diff_close_cents.rs new file mode 100644 index 000000000..5e038eb99 --- /dev/null +++ b/crates/brk_computer/src/internal/transform/percentage_diff_close_cents.rs @@ -0,0 +1,17 @@ +use brk_types::{Cents, StoredF32}; +use vecdb::BinaryTransform; + +/// (Cents, Cents) -> StoredF32 percentage difference ((a/b - 1) * 100) +pub struct PercentageDiffCents; + +impl BinaryTransform for PercentageDiffCents { + #[inline(always)] + fn apply(close: Cents, base: Cents) -> StoredF32 { + let base_f64 = f64::from(base); + if base_f64 == 0.0 { + StoredF32::default() + } else { + StoredF32::from((f64::from(close) / base_f64 - 1.0) * 100.0) + } + } +} diff --git a/crates/brk_computer/src/internal/transform/price_times_ratio.rs b/crates/brk_computer/src/internal/transform/price_times_ratio.rs deleted file mode 100644 index 768254ba6..000000000 --- a/crates/brk_computer/src/internal/transform/price_times_ratio.rs +++ /dev/null @@ -1,12 +0,0 @@ -use brk_types::{Dollars, StoredF32}; -use vecdb::BinaryTransform; - -/// Dollars * StoredF32 -> Dollars (price × ratio) -pub struct PriceTimesRatio; - -impl BinaryTransform for PriceTimesRatio { - #[inline(always)] - fn apply(price: Dollars, ratio: StoredF32) -> Dollars { - price * ratio - } -} diff --git a/crates/brk_computer/src/internal/transform/price_times_ratio_cents.rs b/crates/brk_computer/src/internal/transform/price_times_ratio_cents.rs new file mode 100644 index 000000000..52d6c0d2c --- /dev/null +++ b/crates/brk_computer/src/internal/transform/price_times_ratio_cents.rs @@ -0,0 +1,11 @@ +use brk_types::{Cents, StoredF32}; +use vecdb::BinaryTransform; + +pub struct PriceTimesRatioCents; + +impl BinaryTransform for PriceTimesRatioCents { + #[inline(always)] + fn apply(price: Cents, ratio: StoredF32) -> Cents { + Cents::from(f64::from(price) * f64::from(ratio)) + } +} diff --git a/crates/brk_computer/src/internal/transform/ratio64.rs b/crates/brk_computer/src/internal/transform/ratio64.rs deleted file mode 100644 index f86e60e21..000000000 --- a/crates/brk_computer/src/internal/transform/ratio64.rs +++ /dev/null @@ -1,13 +0,0 @@ -use brk_types::{Dollars, StoredF64}; -use vecdb::BinaryTransform; - -/// (Dollars, Dollars) -> StoredF64 ratio -/// Used for computing ratios like SOPR where f64 precision is needed. -pub struct Ratio64; - -impl BinaryTransform for Ratio64 { - #[inline(always)] - fn apply(numerator: Dollars, denominator: Dollars) -> StoredF64 { - numerator / denominator - } -} diff --git a/crates/brk_computer/src/internal/transform/ratio_cents64.rs b/crates/brk_computer/src/internal/transform/ratio_cents64.rs new file mode 100644 index 000000000..6984ec202 --- /dev/null +++ b/crates/brk_computer/src/internal/transform/ratio_cents64.rs @@ -0,0 +1,17 @@ +use brk_types::{Cents, StoredF64}; +use vecdb::BinaryTransform; + +/// (Cents, Cents) -> StoredF64 ratio +/// Used for computing ratios like SOPR where f64 precision is needed. +pub struct RatioCents64; + +impl BinaryTransform for RatioCents64 { + #[inline(always)] + fn apply(numerator: Cents, denominator: Cents) -> StoredF64 { + if denominator == Cents::ZERO { + StoredF64::from(1.0) + } else { + StoredF64::from(numerator.inner() as f64 / denominator.inner() as f64) + } + } +} diff --git a/crates/brk_computer/src/internal/transform/sats_to_cents.rs b/crates/brk_computer/src/internal/transform/sats_to_cents.rs new file mode 100644 index 000000000..6fb7bf58a --- /dev/null +++ b/crates/brk_computer/src/internal/transform/sats_to_cents.rs @@ -0,0 +1,13 @@ +use brk_types::{Cents, Sats}; +use vecdb::BinaryTransform; + +/// Sats × Cents → Cents (sats × price_cents / 1e8) +/// Uses u128 intermediate to avoid overflow. +pub struct SatsToCents; + +impl BinaryTransform for SatsToCents { + #[inline(always)] + fn apply(sats: Sats, price_cents: Cents) -> Cents { + Cents::from(sats.as_u128() * price_cents.as_u128() / Sats::ONE_BTC_U128) + } +} diff --git a/crates/brk_computer/src/internal/transform/sats_to_dollars.rs b/crates/brk_computer/src/internal/transform/sats_to_dollars.rs deleted file mode 100644 index 30f43bd66..000000000 --- a/crates/brk_computer/src/internal/transform/sats_to_dollars.rs +++ /dev/null @@ -1,12 +0,0 @@ -use brk_types::{Dollars, Sats}; -use vecdb::BinaryTransform; - -/// Sats × Dollars → Dollars (price * sats) -pub struct SatsToDollars; - -impl BinaryTransform for SatsToDollars { - #[inline(always)] - fn apply(sats: Sats, price: Dollars) -> Dollars { - price * sats - } -} diff --git a/crates/brk_computer/src/market/ath/compute.rs b/crates/brk_computer/src/market/ath/compute.rs index 35550256d..713931542 100644 --- a/crates/brk_computer/src/market/ath/compute.rs +++ b/crates/brk_computer/src/market/ath/compute.rs @@ -12,17 +12,17 @@ impl Vecs { starting_indexes: &ComputeIndexes, exit: &Exit, ) -> Result<()> { - self.price_ath.usd.height.compute_all_time_high( + self.price_ath.cents.height.compute_all_time_high( starting_indexes.height, - &prices.price.usd.height, + &prices.price.cents.height, exit, )?; let mut prev = None; self.days_since_price_ath.height.compute_transform2( starting_indexes.height, - &self.price_ath.usd.height, - &prices.price.usd.height, + &self.price_ath.cents.height, + &prices.price.cents.height, |(i, ath, price, slf)| { if prev.is_none() { let i = i.to_usize(); @@ -32,7 +32,7 @@ impl Vecs { StoredU16::default() }); } - let days = if *price == *ath { + let days = if price == ath { StoredU16::default() } else { prev.unwrap() + StoredU16::new(1) @@ -65,8 +65,8 @@ impl Vecs { self.price_drawdown.height.compute_drawdown( starting_indexes.height, - &prices.price.usd.height, - &self.price_ath.usd.height, + &prices.price.cents.height, + &self.price_ath.cents.height, exit, )?; diff --git a/crates/brk_computer/src/market/ath/vecs.rs b/crates/brk_computer/src/market/ath/vecs.rs index b3bd8735e..845115495 100644 --- a/crates/brk_computer/src/market/ath/vecs.rs +++ b/crates/brk_computer/src/market/ath/vecs.rs @@ -1,5 +1,5 @@ use brk_traversable::Traversable; -use brk_types::{Dollars, StoredF32, StoredU16}; +use brk_types::{Cents, StoredF32, StoredU16}; use vecdb::{Rw, StorageMode}; use crate::internal::{ComputedFromHeightLast, LazyHeightDerivedLast, Price}; @@ -7,7 +7,7 @@ use crate::internal::{ComputedFromHeightLast, LazyHeightDerivedLast, Price}; /// All-time high related metrics #[derive(Traversable)] pub struct Vecs { - pub price_ath: Price>, + pub price_ath: Price>, pub price_drawdown: ComputedFromHeightLast, pub days_since_price_ath: ComputedFromHeightLast, pub years_since_price_ath: LazyHeightDerivedLast, diff --git a/crates/brk_computer/src/market/dca/compute.rs b/crates/brk_computer/src/market/dca/compute.rs index 8fae7bdcc..26c78fb0b 100644 --- a/crates/brk_computer/src/market/dca/compute.rs +++ b/crates/brk_computer/src/market/dca/compute.rs @@ -1,11 +1,11 @@ use brk_error::Result; -use brk_types::{Bitcoin, Day1, Date, Dollars, Height, Sats, StoredF32, StoredU32}; +use brk_types::{Bitcoin, Cents, Day1, Date, Dollars, Height, Sats, StoredF32, StoredU32}; use vecdb::{AnyVec, EagerVec, Exit, ReadableOptionVec, ReadableVec, PcoVec, PcoVecValue, VecIndex}; use super::{ByDcaClass, ByDcaPeriod, Vecs}; use crate::{ ComputeIndexes, blocks, indexes, - internal::{ComputedFromHeightLast, PercentageDiffDollars}, + internal::{ComputedFromHeightLast, PercentageDiffCents}, market::lookback, prices, }; @@ -69,7 +69,7 @@ impl Vecs { { let days = days as usize; let stack_data = stack.sats.height.collect_range_at(sh, stack.sats.height.len()); - average_price.usd.height.compute_transform( + average_price.cents.height.compute_transform( starting_indexes.height, h2d, |(h, di, _)| { @@ -79,9 +79,9 @@ impl Vecs { let num_days = days .min(di_usize + 1) .min(di_usize + 1 - first_price_di); - DCA_AMOUNT * num_days / Bitcoin::from(stack_sats) + Cents::from(DCA_AMOUNT * num_days / Bitcoin::from(stack_sats)) } else { - Dollars::NAN + Cents::ZERO }; (h, avg) }, @@ -95,10 +95,10 @@ impl Vecs { .iter_mut() .zip(self.period_average_price.iter_with_days()) { - returns.compute_binary::( + returns.compute_binary::( starting_indexes.height, - &prices.price.usd.height, - &average_price.usd.height, + &prices.price.cents.height, + &average_price.cents.height, exit, )?; } @@ -139,16 +139,16 @@ impl Vecs { self.period_lump_sum_stack.zip_mut_with_days(&lookback_dca) { let total_invested = DCA_AMOUNT * days as usize; - let lookback_data = lookback_price.usd.height.collect_range_at(sh, lookback_price.usd.height.len()); + let lookback_data = lookback_price.cents.height.collect_range_at(sh, lookback_price.cents.height.len()); stack.sats.height.compute_transform( starting_indexes.height, h2d, |(h, _di, _)| { let lp = lookback_data[h.to_usize() - sh]; - let sats = if lp == Dollars::ZERO { + let sats = if lp == Cents::ZERO { Sats::ZERO } else { - Sats::from(Bitcoin::from(total_invested / lp)) + Sats::from(Bitcoin::from(total_invested / Dollars::from(lp))) }; (h, sats) }, @@ -163,10 +163,10 @@ impl Vecs { .iter_mut() .zip(lookback_dca2.iter_with_days()) { - returns.compute_binary::( + returns.compute_binary::( starting_indexes.height, - &prices.price.usd.height, - &lookback_price.usd.height, + &prices.price.cents.height, + &lookback_price.cents.height, exit, )?; } @@ -242,17 +242,17 @@ impl Vecs { { let from_usize = from.to_usize(); let stack_data = stack.sats.height.collect_range_at(sh, stack.sats.height.len()); - average_price.usd.height.compute_transform( + average_price.cents.height.compute_transform( starting_indexes.height, h2d, |(h, di, _)| { let di_usize = di.to_usize(); if di_usize < from_usize { - return (h, Dollars::NAN); + return (h, Cents::ZERO); } let stack_sats = stack_data[h.to_usize() - sh]; let num_days = di_usize + 1 - from_usize; - let avg = DCA_AMOUNT * num_days / Bitcoin::from(stack_sats); + let avg = Cents::from(DCA_AMOUNT * num_days / Bitcoin::from(stack_sats)); (h, avg) }, exit, @@ -266,10 +266,10 @@ impl Vecs { .zip(self.class_average_price.iter()) { - returns.compute_binary::( + returns.compute_binary::( starting_indexes.height, - &prices.price.usd.height, - &average_price.usd.height, + &prices.price.cents.height, + &average_price.cents.height, exit, )?; } diff --git a/crates/brk_computer/src/market/dca/vecs.rs b/crates/brk_computer/src/market/dca/vecs.rs index 0e32d75f5..50919b932 100644 --- a/crates/brk_computer/src/market/dca/vecs.rs +++ b/crates/brk_computer/src/market/dca/vecs.rs @@ -1,5 +1,5 @@ use brk_traversable::Traversable; -use brk_types::{Dollars, Height, Sats, StoredF32, StoredU32}; +use brk_types::{Cents, Height, Sats, StoredF32, StoredU32}; use vecdb::{EagerVec, PcoVec, Rw, StorageMode}; use super::{ByDcaCagr, ByDcaClass, ByDcaPeriod}; @@ -16,7 +16,7 @@ pub struct Vecs { // DCA by period - KISS types pub period_stack: ByDcaPeriod>, - pub period_average_price: ByDcaPeriod>>, + pub period_average_price: ByDcaPeriod>>, pub period_returns: ByDcaPeriod>, pub period_cagr: ByDcaCagr>, @@ -38,7 +38,7 @@ pub struct Vecs { // DCA by year class - KISS types pub class_stack: ByDcaClass>, - pub class_average_price: ByDcaClass>>, + pub class_average_price: ByDcaClass>>, pub class_returns: ByDcaClass>, // DCA by year class - profitability diff --git a/crates/brk_computer/src/market/lookback/compute.rs b/crates/brk_computer/src/market/lookback/compute.rs index d8b1de659..150f759f7 100644 --- a/crates/brk_computer/src/market/lookback/compute.rs +++ b/crates/brk_computer/src/market/lookback/compute.rs @@ -1,5 +1,5 @@ use brk_error::Result; -use brk_types::Dollars; +use brk_types::Cents; use vecdb::{Exit, ReadableVec, VecIndex}; use super::Vecs; @@ -13,11 +13,11 @@ impl Vecs { starting_indexes: &ComputeIndexes, exit: &Exit, ) -> Result<()> { - let close_data: Vec = prices.price.usd.height.collect(); + let close_data: Vec = prices.price.cents.height.collect(); for (price_ago, days) in self.price_ago.iter_mut_with_days() { let window_starts = blocks.count.start_vec(days as usize); - price_ago.usd.height.compute_transform( + price_ago.cents.height.compute_transform( starting_indexes.height, window_starts, |(h, start_h, _)| { diff --git a/crates/brk_computer/src/market/lookback/vecs.rs b/crates/brk_computer/src/market/lookback/vecs.rs index e15b30eb1..4db2a476c 100644 --- a/crates/brk_computer/src/market/lookback/vecs.rs +++ b/crates/brk_computer/src/market/lookback/vecs.rs @@ -1,5 +1,5 @@ use brk_traversable::Traversable; -use brk_types::Dollars; +use brk_types::Cents; use vecdb::{Rw, StorageMode}; use super::ByLookbackPeriod; @@ -9,5 +9,5 @@ use crate::internal::{ComputedFromHeightLast, Price}; #[derive(Traversable)] pub struct Vecs { #[traversable(flatten)] - pub price_ago: ByLookbackPeriod>>, + pub price_ago: ByLookbackPeriod>>, } diff --git a/crates/brk_computer/src/market/moving_average/compute.rs b/crates/brk_computer/src/market/moving_average/compute.rs index 6abdbf6cd..8e4dbe14a 100644 --- a/crates/brk_computer/src/market/moving_average/compute.rs +++ b/crates/brk_computer/src/market/moving_average/compute.rs @@ -1,5 +1,5 @@ use brk_error::Result; -use brk_types::Dollars; +use brk_types::Cents; use vecdb::{Exit, ReadableOptionVec, VecIndex}; use super::Vecs; @@ -14,7 +14,7 @@ impl Vecs { starting_indexes: &ComputeIndexes, exit: &Exit, ) -> Result<()> { - let close = &prices.price.usd.height; + let close = &prices.price.cents.height; for (sma, period) in [ (&mut self.price_1w_sma, 7), @@ -42,7 +42,7 @@ impl Vecs { } let h2d = &indexes.height.day1; - let closes: Vec = prices.split.close.usd.day1.collect_or_default(); + let closes: Vec = prices.split.close.cents.day1.collect_or_default(); for (ema, period) in [ (&mut self.price_1w_ema, 7), @@ -71,7 +71,7 @@ impl Vecs { v.compute_transform( starting_indexes.height, h2d, - |(h, date, ..)| (h, Dollars::from(date_ema[date.to_usize()])), + |(h, date, ..)| (h, Cents::from(date_ema[date.to_usize()])), exit, )?; Ok(()) @@ -82,7 +82,7 @@ impl Vecs { } } -fn compute_date_ema(closes: &[Dollars], k: f64) -> Vec { +fn compute_date_ema(closes: &[Cents], k: f64) -> Vec { let mut date_ema: Vec = Vec::with_capacity(closes.len()); let mut ema_val = 0.0f64; for (d, close) in closes.iter().enumerate() { diff --git a/crates/brk_computer/src/market/moving_average/import.rs b/crates/brk_computer/src/market/moving_average/import.rs index b348e70b6..0a1d4e03d 100644 --- a/crates/brk_computer/src/market/moving_average/import.rs +++ b/crates/brk_computer/src/market/moving_average/import.rs @@ -5,7 +5,7 @@ use vecdb::Database; use super::Vecs; use crate::{ indexes, - internal::{ComputedFromHeightPriceWithRatioExtended, DollarsTimesTenths, Price}, + internal::{CentsTimesTenths, ComputedFromHeightPriceWithRatioExtended, Price}, }; impl Vecs { @@ -28,20 +28,20 @@ impl Vecs { let price_200d_sma = import!("price_200d_sma"); let price_350d_sma = import!("price_350d_sma"); - let price_200d_sma_source = &price_200d_sma.price.usd; - let price_200d_sma_x2_4 = Price::from_computed::>( + let price_200d_sma_source = &price_200d_sma.price.cents; + let price_200d_sma_x2_4 = Price::from_cents_source::>( "price_200d_sma_x2_4", version, price_200d_sma_source, ); - let price_200d_sma_x0_8 = Price::from_computed::>( + let price_200d_sma_x0_8 = Price::from_cents_source::>( "price_200d_sma_x0_8", version, price_200d_sma_source, ); - let price_350d_sma_source = &price_350d_sma.price.usd; - let price_350d_sma_x2 = Price::from_computed::>( + let price_350d_sma_source = &price_350d_sma.price.cents; + let price_350d_sma_x2 = Price::from_cents_source::>( "price_350d_sma_x2", version, price_350d_sma_source, diff --git a/crates/brk_computer/src/market/moving_average/vecs.rs b/crates/brk_computer/src/market/moving_average/vecs.rs index fe5be08a3..fc3e9726d 100644 --- a/crates/brk_computer/src/market/moving_average/vecs.rs +++ b/crates/brk_computer/src/market/moving_average/vecs.rs @@ -1,5 +1,5 @@ use brk_traversable::Traversable; -use brk_types::Dollars; +use brk_types::Cents; use vecdb::{Rw, StorageMode}; use crate::internal::{ComputedFromHeightPriceWithRatioExtended, LazyFromHeightLast, Price}; @@ -41,7 +41,7 @@ pub struct Vecs { pub price_200w_ema: ComputedFromHeightPriceWithRatioExtended, pub price_4y_ema: ComputedFromHeightPriceWithRatioExtended, - pub price_200d_sma_x2_4: Price>, - pub price_200d_sma_x0_8: Price>, - pub price_350d_sma_x2: Price>, + pub price_200d_sma_x2_4: Price>, + pub price_200d_sma_x0_8: Price>, + pub price_350d_sma_x2: Price>, } diff --git a/crates/brk_computer/src/market/range/compute.rs b/crates/brk_computer/src/market/range/compute.rs index 3bb8e421c..57d79d35b 100644 --- a/crates/brk_computer/src/market/range/compute.rs +++ b/crates/brk_computer/src/market/range/compute.rs @@ -16,58 +16,58 @@ impl Vecs { starting_indexes: &ComputeIndexes, exit: &Exit, ) -> Result<()> { - let price = &prices.price.usd.height; + let price = &prices.price.cents.height; - self.price_1w_min.usd.height.compute_rolling_min_from_starts( + self.price_1w_min.cents.height.compute_rolling_min_from_starts( starting_indexes.height, &blocks.count.height_1w_ago, price, exit, )?; - self.price_1w_max.usd.height.compute_rolling_max_from_starts( + self.price_1w_max.cents.height.compute_rolling_max_from_starts( starting_indexes.height, &blocks.count.height_1w_ago, price, exit, )?; - self.price_2w_min.usd.height.compute_rolling_min_from_starts( + self.price_2w_min.cents.height.compute_rolling_min_from_starts( starting_indexes.height, &blocks.count.height_2w_ago, price, exit, )?; - self.price_2w_max.usd.height.compute_rolling_max_from_starts( + self.price_2w_max.cents.height.compute_rolling_max_from_starts( starting_indexes.height, &blocks.count.height_2w_ago, price, exit, )?; - self.price_1m_min.usd.height.compute_rolling_min_from_starts( + self.price_1m_min.cents.height.compute_rolling_min_from_starts( starting_indexes.height, &blocks.count.height_1m_ago, price, exit, )?; - self.price_1m_max.usd.height.compute_rolling_max_from_starts( + self.price_1m_max.cents.height.compute_rolling_max_from_starts( starting_indexes.height, &blocks.count.height_1m_ago, price, exit, )?; - self.price_1y_min.usd.height.compute_rolling_min_from_starts( + self.price_1y_min.cents.height.compute_rolling_min_from_starts( starting_indexes.height, &blocks.count.height_1y_ago, price, exit, )?; - self.price_1y_max.usd.height.compute_rolling_max_from_starts( + self.price_1y_max.cents.height.compute_rolling_max_from_starts( starting_indexes.height, &blocks.count.height_1y_ago, price, @@ -88,7 +88,8 @@ impl Vecs { } }); prev_price = Some(current); - let tr = (*current - *prev).abs(); + let (c, p) = (f64::from(current), f64::from(prev)); + let tr = (c - p).abs(); (h, StoredF32::from(tr)) }, exit, @@ -105,11 +106,11 @@ impl Vecs { self.price_2w_choppiness_index.height.compute_transform4( starting_indexes.height, &self.price_true_range_2w_sum.height, - &self.price_2w_max.usd.height, - &self.price_2w_min.usd.height, + &self.price_2w_max.cents.height, + &self.price_2w_min.cents.height, &blocks.count.height_2w_ago, |(h, tr_sum, max, min, window_start, ..)| { - let range = *max - *min; + let range = f64::from(max) - f64::from(min); let n = (h.to_usize() - window_start.to_usize() + 1) as f32; let ci = if range > 0.0 && n > 1.0 { StoredF32::from( diff --git a/crates/brk_computer/src/market/range/vecs.rs b/crates/brk_computer/src/market/range/vecs.rs index 89271dfda..c221402f0 100644 --- a/crates/brk_computer/src/market/range/vecs.rs +++ b/crates/brk_computer/src/market/range/vecs.rs @@ -1,5 +1,5 @@ use brk_traversable::Traversable; -use brk_types::{Dollars, StoredF32}; +use brk_types::{Cents, StoredF32}; use vecdb::{Rw, StorageMode}; use crate::internal::{ComputedFromHeightLast, Price}; @@ -7,14 +7,14 @@ use crate::internal::{ComputedFromHeightLast, Price}; /// Price range and choppiness metrics #[derive(Traversable)] pub struct Vecs { - pub price_1w_min: Price>, - pub price_1w_max: Price>, - pub price_2w_min: Price>, - pub price_2w_max: Price>, - pub price_1m_min: Price>, - pub price_1m_max: Price>, - pub price_1y_min: Price>, - pub price_1y_max: Price>, + pub price_1w_min: Price>, + pub price_1w_max: Price>, + pub price_2w_min: Price>, + pub price_2w_max: Price>, + pub price_1m_min: Price>, + pub price_1m_max: Price>, + pub price_1y_min: Price>, + pub price_1y_max: Price>, pub price_true_range: ComputedFromHeightLast, pub price_true_range_2w_sum: ComputedFromHeightLast, pub price_2w_choppiness_index: ComputedFromHeightLast, diff --git a/crates/brk_computer/src/supply/import.rs b/crates/brk_computer/src/supply/import.rs index 3cd50bed8..f42b8a76d 100644 --- a/crates/brk_computer/src/supply/import.rs +++ b/crates/brk_computer/src/supply/import.rs @@ -2,7 +2,7 @@ use std::path::Path; use brk_error::Result; use brk_traversable::Traversable; -use brk_types::Version; +use brk_types::{Cents, Version}; use vecdb::{Database, ReadableCloneableVec, PAGE_SIZE}; use super::Vecs; @@ -49,10 +49,9 @@ impl Vecs { super::velocity::Vecs::forced_import(&db, version, indexes)?; // Market cap - lazy identity from distribution supply in USD - let market_cap = LazyFromHeightLast::from_computed::( + let market_cap = LazyFromHeightLast::from_lazy::( "market_cap", version, - supply_metrics.total.usd.height.read_only_boxed_clone(), &supply_metrics.total.usd, ); diff --git a/crates/brk_types/src/cents.rs b/crates/brk_types/src/cents.rs index f388243e3..f16ab2496 100644 --- a/crates/brk_types/src/cents.rs +++ b/crates/brk_types/src/cents.rs @@ -2,7 +2,7 @@ use std::ops::{Add, AddAssign, Div, Mul, Sub, SubAssign}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use vecdb::{Formattable, Pco}; +use vecdb::{CheckedSub, Formattable, Pco}; use super::{CentsSats, Dollars, Sats}; @@ -258,6 +258,12 @@ impl Div for Cents { } } +impl CheckedSub for Cents { + fn checked_sub(self, rhs: Self) -> Option { + self.0.checked_sub(rhs.0).map(Self) + } +} + impl std::fmt::Display for Cents { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let mut buf = itoa::Buffer::new(); diff --git a/crates/brk_types/src/cents_signed.rs b/crates/brk_types/src/cents_signed.rs index b36223df5..b3ad5ec05 100644 --- a/crates/brk_types/src/cents_signed.rs +++ b/crates/brk_types/src/cents_signed.rs @@ -2,7 +2,7 @@ use std::ops::{Add, AddAssign, Div, Mul, Sub, SubAssign}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use vecdb::{Formattable, Pco}; +use vecdb::{CheckedSub, Formattable, Pco}; use super::Dollars; @@ -90,6 +90,13 @@ impl From for f64 { } } +impl From for CentsSigned { + #[inline] + fn from(value: f64) -> Self { + Self(value as i64) + } +} + impl From for CentsSigned { #[inline] fn from(value: i64) -> Self { @@ -238,6 +245,12 @@ impl Mul for CentsSigned { } } +impl CheckedSub for CentsSigned { + fn checked_sub(self, rhs: Self) -> Option { + self.0.checked_sub(rhs.0).map(Self) + } +} + impl std::fmt::Display for CentsSigned { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let mut buf = itoa::Buffer::new(); diff --git a/modules/brk-client/index.js b/modules/brk-client/index.js index 77eaedb22..d4be4bc78 100644 --- a/modules/brk-client/index.js +++ b/modules/brk-client/index.js @@ -179,6 +179,12 @@ * * @typedef {number} CentsSats */ +/** + * Signed cents (i64) - for values that can be negative. + * Used for profit/loss calculations, deltas, etc. + * + * @typedef {number} CentsSigned + */ /** * Raw cents squared (u128) - stores cents² × sats without division. * Used for precise accumulation of investor cap values: Σ(price² × sats). @@ -1546,69 +1552,68 @@ function createMetricPattern35(client, name) { return /** @type {MetricPattern35 * @property {MetricPattern1} adjustedSopr30dEma * @property {MetricPattern1} adjustedSopr7d * @property {MetricPattern1} adjustedSopr7dEma - * @property {MetricPattern1} adjustedValueCreated - * @property {MetricPattern1} adjustedValueCreated1y - * @property {MetricPattern1} adjustedValueCreated24h - * @property {MetricPattern1} adjustedValueCreated30d - * @property {MetricPattern1} adjustedValueCreated7d - * @property {MetricPattern1} adjustedValueDestroyed - * @property {MetricPattern1} adjustedValueDestroyed1y - * @property {MetricPattern1} adjustedValueDestroyed24h - * @property {MetricPattern1} adjustedValueDestroyed30d - * @property {MetricPattern1} adjustedValueDestroyed7d + * @property {MetricPattern1} adjustedValueCreated + * @property {MetricPattern1} adjustedValueCreated1y + * @property {MetricPattern1} adjustedValueCreated24h + * @property {MetricPattern1} adjustedValueCreated30d + * @property {MetricPattern1} adjustedValueCreated7d + * @property {MetricPattern1} adjustedValueDestroyed + * @property {MetricPattern1} adjustedValueDestroyed1y + * @property {MetricPattern1} adjustedValueDestroyed24h + * @property {MetricPattern1} adjustedValueDestroyed30d + * @property {MetricPattern1} adjustedValueDestroyed7d * @property {MetricPattern18} capRaw * @property {MetricPattern1} capitulationFlow * @property {MetricPattern18} investorCapRaw - * @property {SatsUsdPattern} investorPrice - * @property {MetricPattern1} investorPriceCents + * @property {CentsSatsUsdPattern} investorPrice * @property {RatioPattern2} investorPriceExtra * @property {RatioPattern3} investorPriceRatioExt - * @property {MetricPattern1} lossValueCreated - * @property {MetricPattern1} lossValueDestroyed - * @property {SatsUsdPattern} lowerPriceBand + * @property {MetricPattern1} lossValueCreated + * @property {MetricPattern1} lossValueDestroyed + * @property {CentsSatsUsdPattern} lowerPriceBand * @property {MetricPattern1} mvrv * @property {MetricPattern1} negRealizedLoss - * @property {CumulativeHeightPattern} netRealizedPnl - * @property {MetricPattern1} netRealizedPnl7dEma - * @property {MetricPattern1} netRealizedPnlCumulative30dDelta + * @property {CumulativeHeightPattern} netRealizedPnl + * @property {MetricPattern1} netRealizedPnl7dEma + * @property {MetricPattern1} netRealizedPnlCumulative30dDelta * @property {MetricPattern1} netRealizedPnlCumulative30dDeltaRelToMarketCap * @property {MetricPattern1} netRealizedPnlCumulative30dDeltaRelToRealizedCap * @property {MetricPattern1} netRealizedPnlRelToRealizedCap - * @property {CumulativeHeightPattern} peakRegret + * @property {CumulativeHeightPattern} peakRegret * @property {MetricPattern1} peakRegretRelToRealizedCap * @property {MetricPattern1} profitFlow - * @property {MetricPattern1} profitValueCreated - * @property {MetricPattern1} profitValueDestroyed + * @property {MetricPattern1} profitValueCreated + * @property {MetricPattern1} profitValueDestroyed * @property {MetricPattern1} realizedCap - * @property {MetricPattern1} realizedCap30dDelta + * @property {MetricPattern1} realizedCap30dDelta * @property {MetricPattern1} realizedCapCents * @property {MetricPattern1} realizedCapRelToOwnMarketCap - * @property {CumulativeHeightPattern} realizedLoss - * @property {MetricPattern1} realizedLoss1y - * @property {MetricPattern1} realizedLoss24h - * @property {MetricPattern1} realizedLoss30d - * @property {MetricPattern1} realizedLoss7d - * @property {MetricPattern1} realizedLoss7dEma + * @property {CumulativeHeightPattern} realizedLoss + * @property {MetricPattern1} realizedLoss1y + * @property {MetricPattern1} realizedLoss24h + * @property {MetricPattern1} realizedLoss30d + * @property {MetricPattern1} realizedLoss7d + * @property {MetricPattern1} realizedLoss7dEma * @property {MetricPattern1} realizedLossRelToRealizedCap - * @property {SatsUsdPattern} realizedPrice + * @property {CentsSatsUsdPattern} realizedPrice * @property {RatioPattern2} realizedPriceExtra * @property {RatioPattern3} realizedPriceRatioExt - * @property {CumulativeHeightPattern} realizedProfit - * @property {MetricPattern1} realizedProfit1y - * @property {MetricPattern1} realizedProfit24h - * @property {MetricPattern1} realizedProfit30d - * @property {MetricPattern1} realizedProfit7d - * @property {MetricPattern1} realizedProfit7dEma + * @property {CumulativeHeightPattern} realizedProfit + * @property {MetricPattern1} realizedProfit1y + * @property {MetricPattern1} realizedProfit24h + * @property {MetricPattern1} realizedProfit30d + * @property {MetricPattern1} realizedProfit7d + * @property {MetricPattern1} realizedProfit7dEma * @property {MetricPattern1} realizedProfitRelToRealizedCap * @property {MetricPattern1} realizedProfitToLossRatio1y * @property {MetricPattern1} realizedProfitToLossRatio24h * @property {MetricPattern1} realizedProfitToLossRatio30d * @property {MetricPattern1} realizedProfitToLossRatio7d - * @property {MetricPattern1} realizedValue - * @property {MetricPattern1} realizedValue1y - * @property {MetricPattern1} realizedValue24h - * @property {MetricPattern1} realizedValue30d - * @property {MetricPattern1} realizedValue7d + * @property {MetricPattern1} realizedValue + * @property {MetricPattern1} realizedValue1y + * @property {MetricPattern1} realizedValue24h + * @property {MetricPattern1} realizedValue30d + * @property {MetricPattern1} realizedValue7d * @property {MetricPattern1} sellSideRiskRatio * @property {MetricPattern1} sellSideRiskRatio1y * @property {MetricPattern1} sellSideRiskRatio24h @@ -1619,9 +1624,9 @@ function createMetricPattern35(client, name) { return /** @type {MetricPattern35 * @property {MetricPattern1} sellSideRiskRatio7d * @property {MetricPattern1} sellSideRiskRatio7dEma * @property {BaseCumulativePattern} sentInLoss - * @property {BtcSatsUsdPattern} sentInLoss14dEma + * @property {BtcCentsSatsUsdPattern} sentInLoss14dEma * @property {BaseCumulativePattern} sentInProfit - * @property {BtcSatsUsdPattern} sentInProfit14dEma + * @property {BtcCentsSatsUsdPattern} sentInProfit14dEma * @property {MetricPattern1} sopr * @property {MetricPattern1} sopr1y * @property {MetricPattern1} sopr24h @@ -1632,17 +1637,17 @@ function createMetricPattern35(client, name) { return /** @type {MetricPattern35 * @property {MetricPattern1} sopr7d * @property {MetricPattern1} sopr7dEma * @property {MetricPattern1} totalRealizedPnl - * @property {SatsUsdPattern} upperPriceBand - * @property {MetricPattern1} valueCreated - * @property {MetricPattern1} valueCreated1y - * @property {MetricPattern1} valueCreated24h - * @property {MetricPattern1} valueCreated30d - * @property {MetricPattern1} valueCreated7d - * @property {MetricPattern1} valueDestroyed - * @property {MetricPattern1} valueDestroyed1y - * @property {MetricPattern1} valueDestroyed24h - * @property {MetricPattern1} valueDestroyed30d - * @property {MetricPattern1} valueDestroyed7d + * @property {CentsSatsUsdPattern} upperPriceBand + * @property {MetricPattern1} valueCreated + * @property {MetricPattern1} valueCreated1y + * @property {MetricPattern1} valueCreated24h + * @property {MetricPattern1} valueCreated30d + * @property {MetricPattern1} valueCreated7d + * @property {MetricPattern1} valueDestroyed + * @property {MetricPattern1} valueDestroyed1y + * @property {MetricPattern1} valueDestroyed24h + * @property {MetricPattern1} valueDestroyed30d + * @property {MetricPattern1} valueDestroyed7d */ /** @@ -1675,13 +1680,12 @@ function createAdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitReali capRaw: createMetricPattern18(client, _m(acc, 'cap_raw')), capitulationFlow: createMetricPattern1(client, _m(acc, 'capitulation_flow')), investorCapRaw: createMetricPattern18(client, _m(acc, 'investor_cap_raw')), - investorPrice: createSatsUsdPattern(client, _m(acc, 'investor_price')), - investorPriceCents: createMetricPattern1(client, _m(acc, 'investor_price_cents')), + investorPrice: createCentsSatsUsdPattern(client, _m(acc, 'investor_price')), investorPriceExtra: createRatioPattern2(client, _m(acc, 'investor_price_ratio')), investorPriceRatioExt: createRatioPattern3(client, _m(acc, 'investor_price_ratio')), lossValueCreated: createMetricPattern1(client, _m(acc, 'loss_value_created')), lossValueDestroyed: createMetricPattern1(client, _m(acc, 'loss_value_destroyed')), - lowerPriceBand: createSatsUsdPattern(client, _m(acc, 'lower_price_band')), + lowerPriceBand: createCentsSatsUsdPattern(client, _m(acc, 'lower_price_band')), mvrv: createMetricPattern1(client, _m(acc, 'mvrv')), negRealizedLoss: createMetricPattern1(client, _m(acc, 'neg_realized_loss')), netRealizedPnl: createCumulativeHeightPattern(client, _m(acc, 'net_realized_pnl')), @@ -1706,7 +1710,7 @@ function createAdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitReali realizedLoss7d: createMetricPattern1(client, _m(acc, 'realized_loss_7d')), realizedLoss7dEma: createMetricPattern1(client, _m(acc, 'realized_loss_7d_ema')), realizedLossRelToRealizedCap: createMetricPattern1(client, _m(acc, 'realized_loss_rel_to_realized_cap')), - realizedPrice: createSatsUsdPattern(client, _m(acc, 'realized_price')), + realizedPrice: createCentsSatsUsdPattern(client, _m(acc, 'realized_price')), realizedPriceExtra: createRatioPattern2(client, _m(acc, 'realized_price_ratio')), realizedPriceRatioExt: createRatioPattern3(client, _m(acc, 'realized_price_ratio')), realizedProfit: createCumulativeHeightPattern(client, _m(acc, 'realized_profit')), @@ -1735,9 +1739,9 @@ function createAdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitReali sellSideRiskRatio7d: createMetricPattern1(client, _m(acc, 'sell_side_risk_ratio_7d')), sellSideRiskRatio7dEma: createMetricPattern1(client, _m(acc, 'sell_side_risk_ratio_7d_ema')), sentInLoss: createBaseCumulativePattern(client, _m(acc, 'sent_in_loss')), - sentInLoss14dEma: createBtcSatsUsdPattern(client, _m(acc, 'sent_in_loss_14d_ema')), + sentInLoss14dEma: createBtcCentsSatsUsdPattern(client, _m(acc, 'sent_in_loss_14d_ema')), sentInProfit: createBaseCumulativePattern(client, _m(acc, 'sent_in_profit')), - sentInProfit14dEma: createBtcSatsUsdPattern(client, _m(acc, 'sent_in_profit_14d_ema')), + sentInProfit14dEma: createBtcCentsSatsUsdPattern(client, _m(acc, 'sent_in_profit_14d_ema')), sopr: createMetricPattern1(client, _m(acc, 'sopr')), sopr1y: createMetricPattern1(client, _m(acc, 'sopr_1y')), sopr24h: createMetricPattern1(client, _m(acc, 'sopr_24h')), @@ -1748,7 +1752,7 @@ function createAdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitReali sopr7d: createMetricPattern1(client, _m(acc, 'sopr_7d')), sopr7dEma: createMetricPattern1(client, _m(acc, 'sopr_7d_ema')), totalRealizedPnl: createMetricPattern1(client, _m(acc, 'total_realized_pnl')), - upperPriceBand: createSatsUsdPattern(client, _m(acc, 'upper_price_band')), + upperPriceBand: createCentsSatsUsdPattern(client, _m(acc, 'upper_price_band')), valueCreated: createMetricPattern1(client, _m(acc, 'value_created')), valueCreated1y: createMetricPattern1(client, _m(acc, 'value_created_1y')), valueCreated24h: createMetricPattern1(client, _m(acc, 'value_created_24h')), @@ -1773,54 +1777,53 @@ function createAdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitReali * @property {MetricPattern1} adjustedSopr30dEma * @property {MetricPattern1} adjustedSopr7d * @property {MetricPattern1} adjustedSopr7dEma - * @property {MetricPattern1} adjustedValueCreated - * @property {MetricPattern1} adjustedValueCreated1y - * @property {MetricPattern1} adjustedValueCreated24h - * @property {MetricPattern1} adjustedValueCreated30d - * @property {MetricPattern1} adjustedValueCreated7d - * @property {MetricPattern1} adjustedValueDestroyed - * @property {MetricPattern1} adjustedValueDestroyed1y - * @property {MetricPattern1} adjustedValueDestroyed24h - * @property {MetricPattern1} adjustedValueDestroyed30d - * @property {MetricPattern1} adjustedValueDestroyed7d + * @property {MetricPattern1} adjustedValueCreated + * @property {MetricPattern1} adjustedValueCreated1y + * @property {MetricPattern1} adjustedValueCreated24h + * @property {MetricPattern1} adjustedValueCreated30d + * @property {MetricPattern1} adjustedValueCreated7d + * @property {MetricPattern1} adjustedValueDestroyed + * @property {MetricPattern1} adjustedValueDestroyed1y + * @property {MetricPattern1} adjustedValueDestroyed24h + * @property {MetricPattern1} adjustedValueDestroyed30d + * @property {MetricPattern1} adjustedValueDestroyed7d * @property {MetricPattern18} capRaw * @property {MetricPattern1} capitulationFlow * @property {MetricPattern18} investorCapRaw - * @property {SatsUsdPattern} investorPrice - * @property {MetricPattern1} investorPriceCents + * @property {CentsSatsUsdPattern} investorPrice * @property {RatioPattern2} investorPriceExtra - * @property {MetricPattern1} lossValueCreated - * @property {MetricPattern1} lossValueDestroyed - * @property {SatsUsdPattern} lowerPriceBand + * @property {MetricPattern1} lossValueCreated + * @property {MetricPattern1} lossValueDestroyed + * @property {CentsSatsUsdPattern} lowerPriceBand * @property {MetricPattern1} mvrv * @property {MetricPattern1} negRealizedLoss - * @property {CumulativeHeightPattern} netRealizedPnl - * @property {MetricPattern1} netRealizedPnl7dEma - * @property {MetricPattern1} netRealizedPnlCumulative30dDelta + * @property {CumulativeHeightPattern} netRealizedPnl + * @property {MetricPattern1} netRealizedPnl7dEma + * @property {MetricPattern1} netRealizedPnlCumulative30dDelta * @property {MetricPattern1} netRealizedPnlCumulative30dDeltaRelToMarketCap * @property {MetricPattern1} netRealizedPnlCumulative30dDeltaRelToRealizedCap * @property {MetricPattern1} netRealizedPnlRelToRealizedCap - * @property {CumulativeHeightPattern} peakRegret + * @property {CumulativeHeightPattern} peakRegret * @property {MetricPattern1} peakRegretRelToRealizedCap * @property {MetricPattern1} profitFlow - * @property {MetricPattern1} profitValueCreated - * @property {MetricPattern1} profitValueDestroyed + * @property {MetricPattern1} profitValueCreated + * @property {MetricPattern1} profitValueDestroyed * @property {MetricPattern1} realizedCap - * @property {MetricPattern1} realizedCap30dDelta + * @property {MetricPattern1} realizedCap30dDelta * @property {MetricPattern1} realizedCapCents - * @property {CumulativeHeightPattern} realizedLoss - * @property {MetricPattern1} realizedLoss7dEma + * @property {CumulativeHeightPattern} realizedLoss + * @property {MetricPattern1} realizedLoss7dEma * @property {MetricPattern1} realizedLossRelToRealizedCap - * @property {SatsUsdPattern} realizedPrice + * @property {CentsSatsUsdPattern} realizedPrice * @property {RatioPattern2} realizedPriceExtra - * @property {CumulativeHeightPattern} realizedProfit - * @property {MetricPattern1} realizedProfit7dEma + * @property {CumulativeHeightPattern} realizedProfit + * @property {MetricPattern1} realizedProfit7dEma * @property {MetricPattern1} realizedProfitRelToRealizedCap - * @property {MetricPattern1} realizedValue - * @property {MetricPattern1} realizedValue1y - * @property {MetricPattern1} realizedValue24h - * @property {MetricPattern1} realizedValue30d - * @property {MetricPattern1} realizedValue7d + * @property {MetricPattern1} realizedValue + * @property {MetricPattern1} realizedValue1y + * @property {MetricPattern1} realizedValue24h + * @property {MetricPattern1} realizedValue30d + * @property {MetricPattern1} realizedValue7d * @property {MetricPattern1} sellSideRiskRatio * @property {MetricPattern1} sellSideRiskRatio1y * @property {MetricPattern1} sellSideRiskRatio24h @@ -1831,9 +1834,9 @@ function createAdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitReali * @property {MetricPattern1} sellSideRiskRatio7d * @property {MetricPattern1} sellSideRiskRatio7dEma * @property {BaseCumulativePattern} sentInLoss - * @property {BtcSatsUsdPattern} sentInLoss14dEma + * @property {BtcCentsSatsUsdPattern} sentInLoss14dEma * @property {BaseCumulativePattern} sentInProfit - * @property {BtcSatsUsdPattern} sentInProfit14dEma + * @property {BtcCentsSatsUsdPattern} sentInProfit14dEma * @property {MetricPattern1} sopr * @property {MetricPattern1} sopr1y * @property {MetricPattern1} sopr24h @@ -1844,17 +1847,17 @@ function createAdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitReali * @property {MetricPattern1} sopr7d * @property {MetricPattern1} sopr7dEma * @property {MetricPattern1} totalRealizedPnl - * @property {SatsUsdPattern} upperPriceBand - * @property {MetricPattern1} valueCreated - * @property {MetricPattern1} valueCreated1y - * @property {MetricPattern1} valueCreated24h - * @property {MetricPattern1} valueCreated30d - * @property {MetricPattern1} valueCreated7d - * @property {MetricPattern1} valueDestroyed - * @property {MetricPattern1} valueDestroyed1y - * @property {MetricPattern1} valueDestroyed24h - * @property {MetricPattern1} valueDestroyed30d - * @property {MetricPattern1} valueDestroyed7d + * @property {CentsSatsUsdPattern} upperPriceBand + * @property {MetricPattern1} valueCreated + * @property {MetricPattern1} valueCreated1y + * @property {MetricPattern1} valueCreated24h + * @property {MetricPattern1} valueCreated30d + * @property {MetricPattern1} valueCreated7d + * @property {MetricPattern1} valueDestroyed + * @property {MetricPattern1} valueDestroyed1y + * @property {MetricPattern1} valueDestroyed24h + * @property {MetricPattern1} valueDestroyed30d + * @property {MetricPattern1} valueDestroyed7d */ /** @@ -1887,12 +1890,11 @@ function createAdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitReali capRaw: createMetricPattern18(client, _m(acc, 'cap_raw')), capitulationFlow: createMetricPattern1(client, _m(acc, 'capitulation_flow')), investorCapRaw: createMetricPattern18(client, _m(acc, 'investor_cap_raw')), - investorPrice: createSatsUsdPattern(client, _m(acc, 'investor_price')), - investorPriceCents: createMetricPattern1(client, _m(acc, 'investor_price_cents')), + investorPrice: createCentsSatsUsdPattern(client, _m(acc, 'investor_price')), investorPriceExtra: createRatioPattern2(client, _m(acc, 'investor_price_ratio')), lossValueCreated: createMetricPattern1(client, _m(acc, 'loss_value_created')), lossValueDestroyed: createMetricPattern1(client, _m(acc, 'loss_value_destroyed')), - lowerPriceBand: createSatsUsdPattern(client, _m(acc, 'lower_price_band')), + lowerPriceBand: createCentsSatsUsdPattern(client, _m(acc, 'lower_price_band')), mvrv: createMetricPattern1(client, _m(acc, 'mvrv')), negRealizedLoss: createMetricPattern1(client, _m(acc, 'neg_realized_loss')), netRealizedPnl: createCumulativeHeightPattern(client, _m(acc, 'net_realized_pnl')), @@ -1912,7 +1914,7 @@ function createAdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitReali realizedLoss: createCumulativeHeightPattern(client, _m(acc, 'realized_loss')), realizedLoss7dEma: createMetricPattern1(client, _m(acc, 'realized_loss_7d_ema')), realizedLossRelToRealizedCap: createMetricPattern1(client, _m(acc, 'realized_loss_rel_to_realized_cap')), - realizedPrice: createSatsUsdPattern(client, _m(acc, 'realized_price')), + realizedPrice: createCentsSatsUsdPattern(client, _m(acc, 'realized_price')), realizedPriceExtra: createRatioPattern2(client, _m(acc, 'realized_price_ratio')), realizedProfit: createCumulativeHeightPattern(client, _m(acc, 'realized_profit')), realizedProfit7dEma: createMetricPattern1(client, _m(acc, 'realized_profit_7d_ema')), @@ -1932,9 +1934,9 @@ function createAdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitReali sellSideRiskRatio7d: createMetricPattern1(client, _m(acc, 'sell_side_risk_ratio_7d')), sellSideRiskRatio7dEma: createMetricPattern1(client, _m(acc, 'sell_side_risk_ratio_7d_ema')), sentInLoss: createBaseCumulativePattern(client, _m(acc, 'sent_in_loss')), - sentInLoss14dEma: createBtcSatsUsdPattern(client, _m(acc, 'sent_in_loss_14d_ema')), + sentInLoss14dEma: createBtcCentsSatsUsdPattern(client, _m(acc, 'sent_in_loss_14d_ema')), sentInProfit: createBaseCumulativePattern(client, _m(acc, 'sent_in_profit')), - sentInProfit14dEma: createBtcSatsUsdPattern(client, _m(acc, 'sent_in_profit_14d_ema')), + sentInProfit14dEma: createBtcCentsSatsUsdPattern(client, _m(acc, 'sent_in_profit_14d_ema')), sopr: createMetricPattern1(client, _m(acc, 'sopr')), sopr1y: createMetricPattern1(client, _m(acc, 'sopr_1y')), sopr24h: createMetricPattern1(client, _m(acc, 'sopr_24h')), @@ -1945,7 +1947,7 @@ function createAdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitReali sopr7d: createMetricPattern1(client, _m(acc, 'sopr_7d')), sopr7dEma: createMetricPattern1(client, _m(acc, 'sopr_7d_ema')), totalRealizedPnl: createMetricPattern1(client, _m(acc, 'total_realized_pnl')), - upperPriceBand: createSatsUsdPattern(client, _m(acc, 'upper_price_band')), + upperPriceBand: createCentsSatsUsdPattern(client, _m(acc, 'upper_price_band')), valueCreated: createMetricPattern1(client, _m(acc, 'value_created')), valueCreated1y: createMetricPattern1(client, _m(acc, 'value_created_1y')), valueCreated24h: createMetricPattern1(client, _m(acc, 'value_created_24h')), @@ -1964,56 +1966,55 @@ function createAdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitReali * @property {MetricPattern18} capRaw * @property {MetricPattern1} capitulationFlow * @property {MetricPattern18} investorCapRaw - * @property {SatsUsdPattern} investorPrice - * @property {MetricPattern1} investorPriceCents + * @property {CentsSatsUsdPattern} investorPrice * @property {RatioPattern2} investorPriceExtra * @property {RatioPattern3} investorPriceRatioExt - * @property {MetricPattern1} lossValueCreated - * @property {MetricPattern1} lossValueDestroyed - * @property {SatsUsdPattern} lowerPriceBand + * @property {MetricPattern1} lossValueCreated + * @property {MetricPattern1} lossValueDestroyed + * @property {CentsSatsUsdPattern} lowerPriceBand * @property {MetricPattern1} mvrv * @property {MetricPattern1} negRealizedLoss - * @property {CumulativeHeightPattern} netRealizedPnl - * @property {MetricPattern1} netRealizedPnl7dEma - * @property {MetricPattern1} netRealizedPnlCumulative30dDelta + * @property {CumulativeHeightPattern} netRealizedPnl + * @property {MetricPattern1} netRealizedPnl7dEma + * @property {MetricPattern1} netRealizedPnlCumulative30dDelta * @property {MetricPattern1} netRealizedPnlCumulative30dDeltaRelToMarketCap * @property {MetricPattern1} netRealizedPnlCumulative30dDeltaRelToRealizedCap * @property {MetricPattern1} netRealizedPnlRelToRealizedCap - * @property {CumulativeHeightPattern} peakRegret + * @property {CumulativeHeightPattern} peakRegret * @property {MetricPattern1} peakRegretRelToRealizedCap * @property {MetricPattern1} profitFlow - * @property {MetricPattern1} profitValueCreated - * @property {MetricPattern1} profitValueDestroyed + * @property {MetricPattern1} profitValueCreated + * @property {MetricPattern1} profitValueDestroyed * @property {MetricPattern1} realizedCap - * @property {MetricPattern1} realizedCap30dDelta + * @property {MetricPattern1} realizedCap30dDelta * @property {MetricPattern1} realizedCapCents * @property {MetricPattern1} realizedCapRelToOwnMarketCap - * @property {CumulativeHeightPattern} realizedLoss - * @property {MetricPattern1} realizedLoss1y - * @property {MetricPattern1} realizedLoss24h - * @property {MetricPattern1} realizedLoss30d - * @property {MetricPattern1} realizedLoss7d - * @property {MetricPattern1} realizedLoss7dEma + * @property {CumulativeHeightPattern} realizedLoss + * @property {MetricPattern1} realizedLoss1y + * @property {MetricPattern1} realizedLoss24h + * @property {MetricPattern1} realizedLoss30d + * @property {MetricPattern1} realizedLoss7d + * @property {MetricPattern1} realizedLoss7dEma * @property {MetricPattern1} realizedLossRelToRealizedCap - * @property {SatsUsdPattern} realizedPrice + * @property {CentsSatsUsdPattern} realizedPrice * @property {RatioPattern2} realizedPriceExtra * @property {RatioPattern3} realizedPriceRatioExt - * @property {CumulativeHeightPattern} realizedProfit - * @property {MetricPattern1} realizedProfit1y - * @property {MetricPattern1} realizedProfit24h - * @property {MetricPattern1} realizedProfit30d - * @property {MetricPattern1} realizedProfit7d - * @property {MetricPattern1} realizedProfit7dEma + * @property {CumulativeHeightPattern} realizedProfit + * @property {MetricPattern1} realizedProfit1y + * @property {MetricPattern1} realizedProfit24h + * @property {MetricPattern1} realizedProfit30d + * @property {MetricPattern1} realizedProfit7d + * @property {MetricPattern1} realizedProfit7dEma * @property {MetricPattern1} realizedProfitRelToRealizedCap * @property {MetricPattern1} realizedProfitToLossRatio1y * @property {MetricPattern1} realizedProfitToLossRatio24h * @property {MetricPattern1} realizedProfitToLossRatio30d * @property {MetricPattern1} realizedProfitToLossRatio7d - * @property {MetricPattern1} realizedValue - * @property {MetricPattern1} realizedValue1y - * @property {MetricPattern1} realizedValue24h - * @property {MetricPattern1} realizedValue30d - * @property {MetricPattern1} realizedValue7d + * @property {MetricPattern1} realizedValue + * @property {MetricPattern1} realizedValue1y + * @property {MetricPattern1} realizedValue24h + * @property {MetricPattern1} realizedValue30d + * @property {MetricPattern1} realizedValue7d * @property {MetricPattern1} sellSideRiskRatio * @property {MetricPattern1} sellSideRiskRatio1y * @property {MetricPattern1} sellSideRiskRatio24h @@ -2024,9 +2025,9 @@ function createAdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitReali * @property {MetricPattern1} sellSideRiskRatio7d * @property {MetricPattern1} sellSideRiskRatio7dEma * @property {BaseCumulativePattern} sentInLoss - * @property {BtcSatsUsdPattern} sentInLoss14dEma + * @property {BtcCentsSatsUsdPattern} sentInLoss14dEma * @property {BaseCumulativePattern} sentInProfit - * @property {BtcSatsUsdPattern} sentInProfit14dEma + * @property {BtcCentsSatsUsdPattern} sentInProfit14dEma * @property {MetricPattern1} sopr * @property {MetricPattern1} sopr1y * @property {MetricPattern1} sopr24h @@ -2037,17 +2038,17 @@ function createAdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitReali * @property {MetricPattern1} sopr7d * @property {MetricPattern1} sopr7dEma * @property {MetricPattern1} totalRealizedPnl - * @property {SatsUsdPattern} upperPriceBand - * @property {MetricPattern1} valueCreated - * @property {MetricPattern1} valueCreated1y - * @property {MetricPattern1} valueCreated24h - * @property {MetricPattern1} valueCreated30d - * @property {MetricPattern1} valueCreated7d - * @property {MetricPattern1} valueDestroyed - * @property {MetricPattern1} valueDestroyed1y - * @property {MetricPattern1} valueDestroyed24h - * @property {MetricPattern1} valueDestroyed30d - * @property {MetricPattern1} valueDestroyed7d + * @property {CentsSatsUsdPattern} upperPriceBand + * @property {MetricPattern1} valueCreated + * @property {MetricPattern1} valueCreated1y + * @property {MetricPattern1} valueCreated24h + * @property {MetricPattern1} valueCreated30d + * @property {MetricPattern1} valueCreated7d + * @property {MetricPattern1} valueDestroyed + * @property {MetricPattern1} valueDestroyed1y + * @property {MetricPattern1} valueDestroyed24h + * @property {MetricPattern1} valueDestroyed30d + * @property {MetricPattern1} valueDestroyed7d */ /** @@ -2061,13 +2062,12 @@ function createCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellS capRaw: createMetricPattern18(client, _m(acc, 'cap_raw')), capitulationFlow: createMetricPattern1(client, _m(acc, 'capitulation_flow')), investorCapRaw: createMetricPattern18(client, _m(acc, 'investor_cap_raw')), - investorPrice: createSatsUsdPattern(client, _m(acc, 'investor_price')), - investorPriceCents: createMetricPattern1(client, _m(acc, 'investor_price_cents')), + investorPrice: createCentsSatsUsdPattern(client, _m(acc, 'investor_price')), investorPriceExtra: createRatioPattern2(client, _m(acc, 'investor_price_ratio')), investorPriceRatioExt: createRatioPattern3(client, _m(acc, 'investor_price_ratio')), lossValueCreated: createMetricPattern1(client, _m(acc, 'loss_value_created')), lossValueDestroyed: createMetricPattern1(client, _m(acc, 'loss_value_destroyed')), - lowerPriceBand: createSatsUsdPattern(client, _m(acc, 'lower_price_band')), + lowerPriceBand: createCentsSatsUsdPattern(client, _m(acc, 'lower_price_band')), mvrv: createMetricPattern1(client, _m(acc, 'mvrv')), negRealizedLoss: createMetricPattern1(client, _m(acc, 'neg_realized_loss')), netRealizedPnl: createCumulativeHeightPattern(client, _m(acc, 'net_realized_pnl')), @@ -2092,7 +2092,7 @@ function createCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellS realizedLoss7d: createMetricPattern1(client, _m(acc, 'realized_loss_7d')), realizedLoss7dEma: createMetricPattern1(client, _m(acc, 'realized_loss_7d_ema')), realizedLossRelToRealizedCap: createMetricPattern1(client, _m(acc, 'realized_loss_rel_to_realized_cap')), - realizedPrice: createSatsUsdPattern(client, _m(acc, 'realized_price')), + realizedPrice: createCentsSatsUsdPattern(client, _m(acc, 'realized_price')), realizedPriceExtra: createRatioPattern2(client, _m(acc, 'realized_price_ratio')), realizedPriceRatioExt: createRatioPattern3(client, _m(acc, 'realized_price_ratio')), realizedProfit: createCumulativeHeightPattern(client, _m(acc, 'realized_profit')), @@ -2121,9 +2121,9 @@ function createCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellS sellSideRiskRatio7d: createMetricPattern1(client, _m(acc, 'sell_side_risk_ratio_7d')), sellSideRiskRatio7dEma: createMetricPattern1(client, _m(acc, 'sell_side_risk_ratio_7d_ema')), sentInLoss: createBaseCumulativePattern(client, _m(acc, 'sent_in_loss')), - sentInLoss14dEma: createBtcSatsUsdPattern(client, _m(acc, 'sent_in_loss_14d_ema')), + sentInLoss14dEma: createBtcCentsSatsUsdPattern(client, _m(acc, 'sent_in_loss_14d_ema')), sentInProfit: createBaseCumulativePattern(client, _m(acc, 'sent_in_profit')), - sentInProfit14dEma: createBtcSatsUsdPattern(client, _m(acc, 'sent_in_profit_14d_ema')), + sentInProfit14dEma: createBtcCentsSatsUsdPattern(client, _m(acc, 'sent_in_profit_14d_ema')), sopr: createMetricPattern1(client, _m(acc, 'sopr')), sopr1y: createMetricPattern1(client, _m(acc, 'sopr_1y')), sopr24h: createMetricPattern1(client, _m(acc, 'sopr_24h')), @@ -2134,7 +2134,7 @@ function createCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellS sopr7d: createMetricPattern1(client, _m(acc, 'sopr_7d')), sopr7dEma: createMetricPattern1(client, _m(acc, 'sopr_7d_ema')), totalRealizedPnl: createMetricPattern1(client, _m(acc, 'total_realized_pnl')), - upperPriceBand: createSatsUsdPattern(client, _m(acc, 'upper_price_band')), + upperPriceBand: createCentsSatsUsdPattern(client, _m(acc, 'upper_price_band')), valueCreated: createMetricPattern1(client, _m(acc, 'value_created')), valueCreated1y: createMetricPattern1(client, _m(acc, 'value_created_1y')), valueCreated24h: createMetricPattern1(client, _m(acc, 'value_created_24h')), @@ -2153,41 +2153,40 @@ function createCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellS * @property {MetricPattern18} capRaw * @property {MetricPattern1} capitulationFlow * @property {MetricPattern18} investorCapRaw - * @property {SatsUsdPattern} investorPrice - * @property {MetricPattern1} investorPriceCents + * @property {CentsSatsUsdPattern} investorPrice * @property {RatioPattern2} investorPriceExtra - * @property {MetricPattern1} lossValueCreated - * @property {MetricPattern1} lossValueDestroyed - * @property {SatsUsdPattern} lowerPriceBand + * @property {MetricPattern1} lossValueCreated + * @property {MetricPattern1} lossValueDestroyed + * @property {CentsSatsUsdPattern} lowerPriceBand * @property {MetricPattern1} mvrv * @property {MetricPattern1} negRealizedLoss - * @property {CumulativeHeightPattern} netRealizedPnl - * @property {MetricPattern1} netRealizedPnl7dEma - * @property {MetricPattern1} netRealizedPnlCumulative30dDelta + * @property {CumulativeHeightPattern} netRealizedPnl + * @property {MetricPattern1} netRealizedPnl7dEma + * @property {MetricPattern1} netRealizedPnlCumulative30dDelta * @property {MetricPattern1} netRealizedPnlCumulative30dDeltaRelToMarketCap * @property {MetricPattern1} netRealizedPnlCumulative30dDeltaRelToRealizedCap * @property {MetricPattern1} netRealizedPnlRelToRealizedCap - * @property {CumulativeHeightPattern} peakRegret + * @property {CumulativeHeightPattern} peakRegret * @property {MetricPattern1} peakRegretRelToRealizedCap * @property {MetricPattern1} profitFlow - * @property {MetricPattern1} profitValueCreated - * @property {MetricPattern1} profitValueDestroyed + * @property {MetricPattern1} profitValueCreated + * @property {MetricPattern1} profitValueDestroyed * @property {MetricPattern1} realizedCap - * @property {MetricPattern1} realizedCap30dDelta + * @property {MetricPattern1} realizedCap30dDelta * @property {MetricPattern1} realizedCapCents - * @property {CumulativeHeightPattern} realizedLoss - * @property {MetricPattern1} realizedLoss7dEma + * @property {CumulativeHeightPattern} realizedLoss + * @property {MetricPattern1} realizedLoss7dEma * @property {MetricPattern1} realizedLossRelToRealizedCap - * @property {SatsUsdPattern} realizedPrice + * @property {CentsSatsUsdPattern} realizedPrice * @property {RatioPattern2} realizedPriceExtra - * @property {CumulativeHeightPattern} realizedProfit - * @property {MetricPattern1} realizedProfit7dEma + * @property {CumulativeHeightPattern} realizedProfit + * @property {MetricPattern1} realizedProfit7dEma * @property {MetricPattern1} realizedProfitRelToRealizedCap - * @property {MetricPattern1} realizedValue - * @property {MetricPattern1} realizedValue1y - * @property {MetricPattern1} realizedValue24h - * @property {MetricPattern1} realizedValue30d - * @property {MetricPattern1} realizedValue7d + * @property {MetricPattern1} realizedValue + * @property {MetricPattern1} realizedValue1y + * @property {MetricPattern1} realizedValue24h + * @property {MetricPattern1} realizedValue30d + * @property {MetricPattern1} realizedValue7d * @property {MetricPattern1} sellSideRiskRatio * @property {MetricPattern1} sellSideRiskRatio1y * @property {MetricPattern1} sellSideRiskRatio24h @@ -2198,9 +2197,9 @@ function createCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellS * @property {MetricPattern1} sellSideRiskRatio7d * @property {MetricPattern1} sellSideRiskRatio7dEma * @property {BaseCumulativePattern} sentInLoss - * @property {BtcSatsUsdPattern} sentInLoss14dEma + * @property {BtcCentsSatsUsdPattern} sentInLoss14dEma * @property {BaseCumulativePattern} sentInProfit - * @property {BtcSatsUsdPattern} sentInProfit14dEma + * @property {BtcCentsSatsUsdPattern} sentInProfit14dEma * @property {MetricPattern1} sopr * @property {MetricPattern1} sopr1y * @property {MetricPattern1} sopr24h @@ -2211,17 +2210,17 @@ function createCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellS * @property {MetricPattern1} sopr7d * @property {MetricPattern1} sopr7dEma * @property {MetricPattern1} totalRealizedPnl - * @property {SatsUsdPattern} upperPriceBand - * @property {MetricPattern1} valueCreated - * @property {MetricPattern1} valueCreated1y - * @property {MetricPattern1} valueCreated24h - * @property {MetricPattern1} valueCreated30d - * @property {MetricPattern1} valueCreated7d - * @property {MetricPattern1} valueDestroyed - * @property {MetricPattern1} valueDestroyed1y - * @property {MetricPattern1} valueDestroyed24h - * @property {MetricPattern1} valueDestroyed30d - * @property {MetricPattern1} valueDestroyed7d + * @property {CentsSatsUsdPattern} upperPriceBand + * @property {MetricPattern1} valueCreated + * @property {MetricPattern1} valueCreated1y + * @property {MetricPattern1} valueCreated24h + * @property {MetricPattern1} valueCreated30d + * @property {MetricPattern1} valueCreated7d + * @property {MetricPattern1} valueDestroyed + * @property {MetricPattern1} valueDestroyed1y + * @property {MetricPattern1} valueDestroyed24h + * @property {MetricPattern1} valueDestroyed30d + * @property {MetricPattern1} valueDestroyed7d */ /** @@ -2235,12 +2234,11 @@ function createCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellS capRaw: createMetricPattern18(client, _m(acc, 'cap_raw')), capitulationFlow: createMetricPattern1(client, _m(acc, 'capitulation_flow')), investorCapRaw: createMetricPattern18(client, _m(acc, 'investor_cap_raw')), - investorPrice: createSatsUsdPattern(client, _m(acc, 'investor_price')), - investorPriceCents: createMetricPattern1(client, _m(acc, 'investor_price_cents')), + investorPrice: createCentsSatsUsdPattern(client, _m(acc, 'investor_price')), investorPriceExtra: createRatioPattern2(client, _m(acc, 'investor_price_ratio')), lossValueCreated: createMetricPattern1(client, _m(acc, 'loss_value_created')), lossValueDestroyed: createMetricPattern1(client, _m(acc, 'loss_value_destroyed')), - lowerPriceBand: createSatsUsdPattern(client, _m(acc, 'lower_price_band')), + lowerPriceBand: createCentsSatsUsdPattern(client, _m(acc, 'lower_price_band')), mvrv: createMetricPattern1(client, _m(acc, 'mvrv')), negRealizedLoss: createMetricPattern1(client, _m(acc, 'neg_realized_loss')), netRealizedPnl: createCumulativeHeightPattern(client, _m(acc, 'net_realized_pnl')), @@ -2260,7 +2258,7 @@ function createCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellS realizedLoss: createCumulativeHeightPattern(client, _m(acc, 'realized_loss')), realizedLoss7dEma: createMetricPattern1(client, _m(acc, 'realized_loss_7d_ema')), realizedLossRelToRealizedCap: createMetricPattern1(client, _m(acc, 'realized_loss_rel_to_realized_cap')), - realizedPrice: createSatsUsdPattern(client, _m(acc, 'realized_price')), + realizedPrice: createCentsSatsUsdPattern(client, _m(acc, 'realized_price')), realizedPriceExtra: createRatioPattern2(client, _m(acc, 'realized_price_ratio')), realizedProfit: createCumulativeHeightPattern(client, _m(acc, 'realized_profit')), realizedProfit7dEma: createMetricPattern1(client, _m(acc, 'realized_profit_7d_ema')), @@ -2280,9 +2278,9 @@ function createCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellS sellSideRiskRatio7d: createMetricPattern1(client, _m(acc, 'sell_side_risk_ratio_7d')), sellSideRiskRatio7dEma: createMetricPattern1(client, _m(acc, 'sell_side_risk_ratio_7d_ema')), sentInLoss: createBaseCumulativePattern(client, _m(acc, 'sent_in_loss')), - sentInLoss14dEma: createBtcSatsUsdPattern(client, _m(acc, 'sent_in_loss_14d_ema')), + sentInLoss14dEma: createBtcCentsSatsUsdPattern(client, _m(acc, 'sent_in_loss_14d_ema')), sentInProfit: createBaseCumulativePattern(client, _m(acc, 'sent_in_profit')), - sentInProfit14dEma: createBtcSatsUsdPattern(client, _m(acc, 'sent_in_profit_14d_ema')), + sentInProfit14dEma: createBtcCentsSatsUsdPattern(client, _m(acc, 'sent_in_profit_14d_ema')), sopr: createMetricPattern1(client, _m(acc, 'sopr')), sopr1y: createMetricPattern1(client, _m(acc, 'sopr_1y')), sopr24h: createMetricPattern1(client, _m(acc, 'sopr_24h')), @@ -2293,7 +2291,7 @@ function createCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellS sopr7d: createMetricPattern1(client, _m(acc, 'sopr_7d')), sopr7dEma: createMetricPattern1(client, _m(acc, 'sopr_7d_ema')), totalRealizedPnl: createMetricPattern1(client, _m(acc, 'total_realized_pnl')), - upperPriceBand: createSatsUsdPattern(client, _m(acc, 'upper_price_band')), + upperPriceBand: createCentsSatsUsdPattern(client, _m(acc, 'upper_price_band')), valueCreated: createMetricPattern1(client, _m(acc, 'value_created')), valueCreated1y: createMetricPattern1(client, _m(acc, 'value_created_1y')), valueCreated24h: createMetricPattern1(client, _m(acc, 'value_created_24h')), @@ -2309,31 +2307,31 @@ function createCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellS /** * @typedef {Object} _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern - * @property {SatsUsdPattern} _0sdUsd + * @property {CentsSatsUsdPattern} _0sdPrice * @property {MetricPattern1} m05sd - * @property {SatsUsdPattern} m05sdUsd + * @property {CentsSatsUsdPattern} m05sdPrice * @property {MetricPattern1} m15sd - * @property {SatsUsdPattern} m15sdUsd + * @property {CentsSatsUsdPattern} m15sdPrice * @property {MetricPattern1} m1sd - * @property {SatsUsdPattern} m1sdUsd + * @property {CentsSatsUsdPattern} m1sdPrice * @property {MetricPattern1} m25sd - * @property {SatsUsdPattern} m25sdUsd + * @property {CentsSatsUsdPattern} m25sdPrice * @property {MetricPattern1} m2sd - * @property {SatsUsdPattern} m2sdUsd + * @property {CentsSatsUsdPattern} m2sdPrice * @property {MetricPattern1} m3sd - * @property {SatsUsdPattern} m3sdUsd + * @property {CentsSatsUsdPattern} m3sdPrice * @property {MetricPattern1} p05sd - * @property {SatsUsdPattern} p05sdUsd + * @property {CentsSatsUsdPattern} p05sdPrice * @property {MetricPattern1} p15sd - * @property {SatsUsdPattern} p15sdUsd + * @property {CentsSatsUsdPattern} p15sdPrice * @property {MetricPattern1} p1sd - * @property {SatsUsdPattern} p1sdUsd + * @property {CentsSatsUsdPattern} p1sdPrice * @property {MetricPattern1} p25sd - * @property {SatsUsdPattern} p25sdUsd + * @property {CentsSatsUsdPattern} p25sdPrice * @property {MetricPattern1} p2sd - * @property {SatsUsdPattern} p2sdUsd + * @property {CentsSatsUsdPattern} p2sdPrice * @property {MetricPattern1} p3sd - * @property {SatsUsdPattern} p3sdUsd + * @property {CentsSatsUsdPattern} p3sdPrice * @property {MetricPattern1} sd * @property {MetricPattern1} sma * @property {MetricPattern1} zscore @@ -2347,31 +2345,31 @@ function createCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellS */ function create_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern(client, acc) { return { - _0sdUsd: createSatsUsdPattern(client, _m(acc, '0sd_usd')), + _0sdPrice: createCentsSatsUsdPattern(client, _m(acc, '0sd')), m05sd: createMetricPattern1(client, _m(acc, 'm0_5sd')), - m05sdUsd: createSatsUsdPattern(client, _m(acc, 'm0_5sd_usd')), + m05sdPrice: createCentsSatsUsdPattern(client, _m(acc, 'm0_5sd')), m15sd: createMetricPattern1(client, _m(acc, 'm1_5sd')), - m15sdUsd: createSatsUsdPattern(client, _m(acc, 'm1_5sd_usd')), + m15sdPrice: createCentsSatsUsdPattern(client, _m(acc, 'm1_5sd')), m1sd: createMetricPattern1(client, _m(acc, 'm1sd')), - m1sdUsd: createSatsUsdPattern(client, _m(acc, 'm1sd_usd')), + m1sdPrice: createCentsSatsUsdPattern(client, _m(acc, 'm1sd')), m25sd: createMetricPattern1(client, _m(acc, 'm2_5sd')), - m25sdUsd: createSatsUsdPattern(client, _m(acc, 'm2_5sd_usd')), + m25sdPrice: createCentsSatsUsdPattern(client, _m(acc, 'm2_5sd')), m2sd: createMetricPattern1(client, _m(acc, 'm2sd')), - m2sdUsd: createSatsUsdPattern(client, _m(acc, 'm2sd_usd')), + m2sdPrice: createCentsSatsUsdPattern(client, _m(acc, 'm2sd')), m3sd: createMetricPattern1(client, _m(acc, 'm3sd')), - m3sdUsd: createSatsUsdPattern(client, _m(acc, 'm3sd_usd')), + m3sdPrice: createCentsSatsUsdPattern(client, _m(acc, 'm3sd')), p05sd: createMetricPattern1(client, _m(acc, 'p0_5sd')), - p05sdUsd: createSatsUsdPattern(client, _m(acc, 'p0_5sd_usd')), + p05sdPrice: createCentsSatsUsdPattern(client, _m(acc, 'p0_5sd')), p15sd: createMetricPattern1(client, _m(acc, 'p1_5sd')), - p15sdUsd: createSatsUsdPattern(client, _m(acc, 'p1_5sd_usd')), + p15sdPrice: createCentsSatsUsdPattern(client, _m(acc, 'p1_5sd')), p1sd: createMetricPattern1(client, _m(acc, 'p1sd')), - p1sdUsd: createSatsUsdPattern(client, _m(acc, 'p1sd_usd')), + p1sdPrice: createCentsSatsUsdPattern(client, _m(acc, 'p1sd')), p25sd: createMetricPattern1(client, _m(acc, 'p2_5sd')), - p25sdUsd: createSatsUsdPattern(client, _m(acc, 'p2_5sd_usd')), + p25sdPrice: createCentsSatsUsdPattern(client, _m(acc, 'p2_5sd')), p2sd: createMetricPattern1(client, _m(acc, 'p2sd')), - p2sdUsd: createSatsUsdPattern(client, _m(acc, 'p2sd_usd')), + p2sdPrice: createCentsSatsUsdPattern(client, _m(acc, 'p2sd')), p3sd: createMetricPattern1(client, _m(acc, 'p3sd')), - p3sdUsd: createSatsUsdPattern(client, _m(acc, 'p3sd_usd')), + p3sdPrice: createCentsSatsUsdPattern(client, _m(acc, 'p3sd')), sd: createMetricPattern1(client, _m(acc, 'sd')), sma: createMetricPattern1(client, _m(acc, 'sma')), zscore: createMetricPattern1(client, _m(acc, 'zscore')), @@ -2437,7 +2435,7 @@ function createInvestedNegNetNuplSupplyUnrealizedPattern2(client, acc) { /** * @typedef {Object} PriceRatioPattern - * @property {SatsUsdPattern} price + * @property {CentsSatsUsdPattern} price * @property {MetricPattern1} ratio * @property {MetricPattern1} ratio1mSma * @property {MetricPattern1} ratio1wSma @@ -2445,17 +2443,17 @@ function createInvestedNegNetNuplSupplyUnrealizedPattern2(client, acc) { * @property {_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern} ratio2ySd * @property {_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern} ratio4ySd * @property {MetricPattern1} ratioPct1 - * @property {SatsUsdPattern} ratioPct1Usd + * @property {CentsSatsUsdPattern} ratioPct1Price * @property {MetricPattern1} ratioPct2 - * @property {SatsUsdPattern} ratioPct2Usd + * @property {CentsSatsUsdPattern} ratioPct2Price * @property {MetricPattern1} ratioPct5 - * @property {SatsUsdPattern} ratioPct5Usd + * @property {CentsSatsUsdPattern} ratioPct5Price * @property {MetricPattern1} ratioPct95 - * @property {SatsUsdPattern} ratioPct95Usd + * @property {CentsSatsUsdPattern} ratioPct95Price * @property {MetricPattern1} ratioPct98 - * @property {SatsUsdPattern} ratioPct98Usd + * @property {CentsSatsUsdPattern} ratioPct98Price * @property {MetricPattern1} ratioPct99 - * @property {SatsUsdPattern} ratioPct99Usd + * @property {CentsSatsUsdPattern} ratioPct99Price * @property {_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern} ratioSd */ @@ -2467,7 +2465,7 @@ function createInvestedNegNetNuplSupplyUnrealizedPattern2(client, acc) { */ function createPriceRatioPattern(client, acc) { return { - price: createSatsUsdPattern(client, acc), + price: createCentsSatsUsdPattern(client, acc), ratio: createMetricPattern1(client, _m(acc, 'ratio')), ratio1mSma: createMetricPattern1(client, _m(acc, 'ratio_1m_sma')), ratio1wSma: createMetricPattern1(client, _m(acc, 'ratio_1w_sma')), @@ -2475,42 +2473,42 @@ function createPriceRatioPattern(client, acc) { ratio2ySd: create_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern(client, _m(acc, 'ratio_2y')), ratio4ySd: create_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern(client, _m(acc, 'ratio_4y')), ratioPct1: createMetricPattern1(client, _m(acc, 'ratio_pct1')), - ratioPct1Usd: createSatsUsdPattern(client, _m(acc, 'ratio_pct1_usd')), + ratioPct1Price: createCentsSatsUsdPattern(client, _m(acc, 'ratio_pct1')), ratioPct2: createMetricPattern1(client, _m(acc, 'ratio_pct2')), - ratioPct2Usd: createSatsUsdPattern(client, _m(acc, 'ratio_pct2_usd')), + ratioPct2Price: createCentsSatsUsdPattern(client, _m(acc, 'ratio_pct2')), ratioPct5: createMetricPattern1(client, _m(acc, 'ratio_pct5')), - ratioPct5Usd: createSatsUsdPattern(client, _m(acc, 'ratio_pct5_usd')), + ratioPct5Price: createCentsSatsUsdPattern(client, _m(acc, 'ratio_pct5')), ratioPct95: createMetricPattern1(client, _m(acc, 'ratio_pct95')), - ratioPct95Usd: createSatsUsdPattern(client, _m(acc, 'ratio_pct95_usd')), + ratioPct95Price: createCentsSatsUsdPattern(client, _m(acc, 'ratio_pct95')), ratioPct98: createMetricPattern1(client, _m(acc, 'ratio_pct98')), - ratioPct98Usd: createSatsUsdPattern(client, _m(acc, 'ratio_pct98_usd')), + ratioPct98Price: createCentsSatsUsdPattern(client, _m(acc, 'ratio_pct98')), ratioPct99: createMetricPattern1(client, _m(acc, 'ratio_pct99')), - ratioPct99Usd: createSatsUsdPattern(client, _m(acc, 'ratio_pct99_usd')), + ratioPct99Price: createCentsSatsUsdPattern(client, _m(acc, 'ratio_pct99')), ratioSd: create_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern(client, _m(acc, 'ratio')), }; } /** * @typedef {Object} Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern - * @property {SatsUsdPattern} pct05 - * @property {SatsUsdPattern} pct10 - * @property {SatsUsdPattern} pct15 - * @property {SatsUsdPattern} pct20 - * @property {SatsUsdPattern} pct25 - * @property {SatsUsdPattern} pct30 - * @property {SatsUsdPattern} pct35 - * @property {SatsUsdPattern} pct40 - * @property {SatsUsdPattern} pct45 - * @property {SatsUsdPattern} pct50 - * @property {SatsUsdPattern} pct55 - * @property {SatsUsdPattern} pct60 - * @property {SatsUsdPattern} pct65 - * @property {SatsUsdPattern} pct70 - * @property {SatsUsdPattern} pct75 - * @property {SatsUsdPattern} pct80 - * @property {SatsUsdPattern} pct85 - * @property {SatsUsdPattern} pct90 - * @property {SatsUsdPattern} pct95 + * @property {CentsSatsUsdPattern} pct05 + * @property {CentsSatsUsdPattern} pct10 + * @property {CentsSatsUsdPattern} pct15 + * @property {CentsSatsUsdPattern} pct20 + * @property {CentsSatsUsdPattern} pct25 + * @property {CentsSatsUsdPattern} pct30 + * @property {CentsSatsUsdPattern} pct35 + * @property {CentsSatsUsdPattern} pct40 + * @property {CentsSatsUsdPattern} pct45 + * @property {CentsSatsUsdPattern} pct50 + * @property {CentsSatsUsdPattern} pct55 + * @property {CentsSatsUsdPattern} pct60 + * @property {CentsSatsUsdPattern} pct65 + * @property {CentsSatsUsdPattern} pct70 + * @property {CentsSatsUsdPattern} pct75 + * @property {CentsSatsUsdPattern} pct80 + * @property {CentsSatsUsdPattern} pct85 + * @property {CentsSatsUsdPattern} pct90 + * @property {CentsSatsUsdPattern} pct95 */ /** @@ -2521,25 +2519,25 @@ function createPriceRatioPattern(client, acc) { */ function createPct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern(client, acc) { return { - pct05: createSatsUsdPattern(client, _m(acc, 'pct05')), - pct10: createSatsUsdPattern(client, _m(acc, 'pct10')), - pct15: createSatsUsdPattern(client, _m(acc, 'pct15')), - pct20: createSatsUsdPattern(client, _m(acc, 'pct20')), - pct25: createSatsUsdPattern(client, _m(acc, 'pct25')), - pct30: createSatsUsdPattern(client, _m(acc, 'pct30')), - pct35: createSatsUsdPattern(client, _m(acc, 'pct35')), - pct40: createSatsUsdPattern(client, _m(acc, 'pct40')), - pct45: createSatsUsdPattern(client, _m(acc, 'pct45')), - pct50: createSatsUsdPattern(client, _m(acc, 'pct50')), - pct55: createSatsUsdPattern(client, _m(acc, 'pct55')), - pct60: createSatsUsdPattern(client, _m(acc, 'pct60')), - pct65: createSatsUsdPattern(client, _m(acc, 'pct65')), - pct70: createSatsUsdPattern(client, _m(acc, 'pct70')), - pct75: createSatsUsdPattern(client, _m(acc, 'pct75')), - pct80: createSatsUsdPattern(client, _m(acc, 'pct80')), - pct85: createSatsUsdPattern(client, _m(acc, 'pct85')), - pct90: createSatsUsdPattern(client, _m(acc, 'pct90')), - pct95: createSatsUsdPattern(client, _m(acc, 'pct95')), + pct05: createCentsSatsUsdPattern(client, _m(acc, 'pct05')), + pct10: createCentsSatsUsdPattern(client, _m(acc, 'pct10')), + pct15: createCentsSatsUsdPattern(client, _m(acc, 'pct15')), + pct20: createCentsSatsUsdPattern(client, _m(acc, 'pct20')), + pct25: createCentsSatsUsdPattern(client, _m(acc, 'pct25')), + pct30: createCentsSatsUsdPattern(client, _m(acc, 'pct30')), + pct35: createCentsSatsUsdPattern(client, _m(acc, 'pct35')), + pct40: createCentsSatsUsdPattern(client, _m(acc, 'pct40')), + pct45: createCentsSatsUsdPattern(client, _m(acc, 'pct45')), + pct50: createCentsSatsUsdPattern(client, _m(acc, 'pct50')), + pct55: createCentsSatsUsdPattern(client, _m(acc, 'pct55')), + pct60: createCentsSatsUsdPattern(client, _m(acc, 'pct60')), + pct65: createCentsSatsUsdPattern(client, _m(acc, 'pct65')), + pct70: createCentsSatsUsdPattern(client, _m(acc, 'pct70')), + pct75: createCentsSatsUsdPattern(client, _m(acc, 'pct75')), + pct80: createCentsSatsUsdPattern(client, _m(acc, 'pct80')), + pct85: createCentsSatsUsdPattern(client, _m(acc, 'pct85')), + pct90: createCentsSatsUsdPattern(client, _m(acc, 'pct90')), + pct95: createCentsSatsUsdPattern(client, _m(acc, 'pct95')), }; } @@ -2552,17 +2550,17 @@ function createPct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65 * @property {_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern} ratio2ySd * @property {_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern} ratio4ySd * @property {MetricPattern1} ratioPct1 - * @property {SatsUsdPattern} ratioPct1Usd + * @property {CentsSatsUsdPattern} ratioPct1Price * @property {MetricPattern1} ratioPct2 - * @property {SatsUsdPattern} ratioPct2Usd + * @property {CentsSatsUsdPattern} ratioPct2Price * @property {MetricPattern1} ratioPct5 - * @property {SatsUsdPattern} ratioPct5Usd + * @property {CentsSatsUsdPattern} ratioPct5Price * @property {MetricPattern1} ratioPct95 - * @property {SatsUsdPattern} ratioPct95Usd + * @property {CentsSatsUsdPattern} ratioPct95Price * @property {MetricPattern1} ratioPct98 - * @property {SatsUsdPattern} ratioPct98Usd + * @property {CentsSatsUsdPattern} ratioPct98Price * @property {MetricPattern1} ratioPct99 - * @property {SatsUsdPattern} ratioPct99Usd + * @property {CentsSatsUsdPattern} ratioPct99Price * @property {_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern} ratioSd */ @@ -2581,17 +2579,17 @@ function createRatioPattern(client, acc) { ratio2ySd: create_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern(client, _m(acc, '2y')), ratio4ySd: create_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern(client, _m(acc, '4y')), ratioPct1: createMetricPattern1(client, _m(acc, 'pct1')), - ratioPct1Usd: createSatsUsdPattern(client, _m(acc, 'pct1_usd')), + ratioPct1Price: createCentsSatsUsdPattern(client, _m(acc, 'pct1')), ratioPct2: createMetricPattern1(client, _m(acc, 'pct2')), - ratioPct2Usd: createSatsUsdPattern(client, _m(acc, 'pct2_usd')), + ratioPct2Price: createCentsSatsUsdPattern(client, _m(acc, 'pct2')), ratioPct5: createMetricPattern1(client, _m(acc, 'pct5')), - ratioPct5Usd: createSatsUsdPattern(client, _m(acc, 'pct5_usd')), + ratioPct5Price: createCentsSatsUsdPattern(client, _m(acc, 'pct5')), ratioPct95: createMetricPattern1(client, _m(acc, 'pct95')), - ratioPct95Usd: createSatsUsdPattern(client, _m(acc, 'pct95_usd')), + ratioPct95Price: createCentsSatsUsdPattern(client, _m(acc, 'pct95')), ratioPct98: createMetricPattern1(client, _m(acc, 'pct98')), - ratioPct98Usd: createSatsUsdPattern(client, _m(acc, 'pct98_usd')), + ratioPct98Price: createCentsSatsUsdPattern(client, _m(acc, 'pct98')), ratioPct99: createMetricPattern1(client, _m(acc, 'pct99')), - ratioPct99Usd: createSatsUsdPattern(client, _m(acc, 'pct99_usd')), + ratioPct99Price: createCentsSatsUsdPattern(client, _m(acc, 'pct99')), ratioSd: create_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern(client, acc), }; } @@ -2604,17 +2602,17 @@ function createRatioPattern(client, acc) { * @property {_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern} ratio2ySd * @property {_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern} ratio4ySd * @property {MetricPattern1} ratioPct1 - * @property {SatsUsdPattern} ratioPct1Usd + * @property {CentsSatsUsdPattern} ratioPct1Price * @property {MetricPattern1} ratioPct2 - * @property {SatsUsdPattern} ratioPct2Usd + * @property {CentsSatsUsdPattern} ratioPct2Price * @property {MetricPattern1} ratioPct5 - * @property {SatsUsdPattern} ratioPct5Usd + * @property {CentsSatsUsdPattern} ratioPct5Price * @property {MetricPattern1} ratioPct95 - * @property {SatsUsdPattern} ratioPct95Usd + * @property {CentsSatsUsdPattern} ratioPct95Price * @property {MetricPattern1} ratioPct98 - * @property {SatsUsdPattern} ratioPct98Usd + * @property {CentsSatsUsdPattern} ratioPct98Price * @property {MetricPattern1} ratioPct99 - * @property {SatsUsdPattern} ratioPct99Usd + * @property {CentsSatsUsdPattern} ratioPct99Price * @property {_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern} ratioSd */ @@ -2632,17 +2630,17 @@ function createRatioPattern3(client, acc) { ratio2ySd: create_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern(client, _m(acc, '2y')), ratio4ySd: create_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern(client, _m(acc, '4y')), ratioPct1: createMetricPattern1(client, _m(acc, 'pct1')), - ratioPct1Usd: createSatsUsdPattern(client, _m(acc, 'pct1_usd')), + ratioPct1Price: createCentsSatsUsdPattern(client, _m(acc, 'pct1')), ratioPct2: createMetricPattern1(client, _m(acc, 'pct2')), - ratioPct2Usd: createSatsUsdPattern(client, _m(acc, 'pct2_usd')), + ratioPct2Price: createCentsSatsUsdPattern(client, _m(acc, 'pct2')), ratioPct5: createMetricPattern1(client, _m(acc, 'pct5')), - ratioPct5Usd: createSatsUsdPattern(client, _m(acc, 'pct5_usd')), + ratioPct5Price: createCentsSatsUsdPattern(client, _m(acc, 'pct5')), ratioPct95: createMetricPattern1(client, _m(acc, 'pct95')), - ratioPct95Usd: createSatsUsdPattern(client, _m(acc, 'pct95_usd')), + ratioPct95Price: createCentsSatsUsdPattern(client, _m(acc, 'pct95')), ratioPct98: createMetricPattern1(client, _m(acc, 'pct98')), - ratioPct98Usd: createSatsUsdPattern(client, _m(acc, 'pct98_usd')), + ratioPct98Price: createCentsSatsUsdPattern(client, _m(acc, 'pct98')), ratioPct99: createMetricPattern1(client, _m(acc, 'pct99')), - ratioPct99Usd: createSatsUsdPattern(client, _m(acc, 'pct99_usd')), + ratioPct99Price: createCentsSatsUsdPattern(client, _m(acc, 'pct99')), ratioSd: create_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern(client, acc), }; } @@ -2661,8 +2659,8 @@ function createRatioPattern3(client, acc) { * @property {MetricPattern1} netUnrealizedPnl * @property {MetricPattern1} painIndex * @property {MetricPattern1} peakRegret - * @property {BtcSatsUsdPattern} supplyInLoss - * @property {BtcSatsUsdPattern} supplyInProfit + * @property {BtcCentsSatsUsdPattern} supplyInLoss + * @property {BtcCentsSatsUsdPattern} supplyInProfit * @property {MetricPattern1} totalUnrealizedPnl * @property {MetricPattern1} unrealizedLoss * @property {MetricPattern1} unrealizedProfit @@ -2688,8 +2686,8 @@ function createGreedInvestedInvestorNegNetPainPeakSupplyTotalUnrealizedPattern(c netUnrealizedPnl: createMetricPattern1(client, _m(acc, 'net_unrealized_pnl')), painIndex: createMetricPattern1(client, _m(acc, 'pain_index')), peakRegret: createMetricPattern1(client, _m(acc, 'unrealized_peak_regret')), - supplyInLoss: createBtcSatsUsdPattern(client, _m(acc, 'supply_in_loss')), - supplyInProfit: createBtcSatsUsdPattern(client, _m(acc, 'supply_in_profit')), + supplyInLoss: createBtcCentsSatsUsdPattern(client, _m(acc, 'supply_in_loss')), + supplyInProfit: createBtcCentsSatsUsdPattern(client, _m(acc, 'supply_in_profit')), totalUnrealizedPnl: createMetricPattern1(client, _m(acc, 'total_unrealized_pnl')), unrealizedLoss: createMetricPattern1(client, _m(acc, 'unrealized_loss')), unrealizedProfit: createMetricPattern1(client, _m(acc, 'unrealized_profit')), @@ -2709,8 +2707,8 @@ function createGreedInvestedInvestorNegNetPainPeakSupplyTotalUnrealizedPattern(c * @property {MetricPattern1} netSentiment * @property {MetricPattern1} netUnrealizedPnl * @property {MetricPattern1} painIndex - * @property {BtcSatsUsdPattern} supplyInLoss - * @property {BtcSatsUsdPattern} supplyInProfit + * @property {BtcCentsSatsUsdPattern} supplyInLoss + * @property {BtcCentsSatsUsdPattern} supplyInProfit * @property {MetricPattern1} totalUnrealizedPnl * @property {MetricPattern1} unrealizedLoss * @property {MetricPattern1} unrealizedProfit @@ -2735,8 +2733,8 @@ function createGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern(clien netSentiment: createMetricPattern1(client, _m(acc, 'net_sentiment')), netUnrealizedPnl: createMetricPattern1(client, _m(acc, 'net_unrealized_pnl')), painIndex: createMetricPattern1(client, _m(acc, 'pain_index')), - supplyInLoss: createBtcSatsUsdPattern(client, _m(acc, 'supply_in_loss')), - supplyInProfit: createBtcSatsUsdPattern(client, _m(acc, 'supply_in_profit')), + supplyInLoss: createBtcCentsSatsUsdPattern(client, _m(acc, 'supply_in_loss')), + supplyInProfit: createBtcCentsSatsUsdPattern(client, _m(acc, 'supply_in_profit')), totalUnrealizedPnl: createMetricPattern1(client, _m(acc, 'total_unrealized_pnl')), unrealizedLoss: createMetricPattern1(client, _m(acc, 'unrealized_loss')), unrealizedProfit: createMetricPattern1(client, _m(acc, 'unrealized_profit')), @@ -2831,18 +2829,18 @@ function createInvestedNegNetNuplSupplyUnrealizedPattern4(client, acc) { /** * @typedef {Object} _10y1m1w1y2y3m3y4y5y6m6y8yPattern3 - * @property {BtcSatsUsdPattern} _10y - * @property {BtcSatsUsdPattern} _1m - * @property {BtcSatsUsdPattern} _1w - * @property {BtcSatsUsdPattern} _1y - * @property {BtcSatsUsdPattern} _2y - * @property {BtcSatsUsdPattern} _3m - * @property {BtcSatsUsdPattern} _3y - * @property {BtcSatsUsdPattern} _4y - * @property {BtcSatsUsdPattern} _5y - * @property {BtcSatsUsdPattern} _6m - * @property {BtcSatsUsdPattern} _6y - * @property {BtcSatsUsdPattern} _8y + * @property {BtcCentsSatsUsdPattern} _10y + * @property {BtcCentsSatsUsdPattern} _1m + * @property {BtcCentsSatsUsdPattern} _1w + * @property {BtcCentsSatsUsdPattern} _1y + * @property {BtcCentsSatsUsdPattern} _2y + * @property {BtcCentsSatsUsdPattern} _3m + * @property {BtcCentsSatsUsdPattern} _3y + * @property {BtcCentsSatsUsdPattern} _4y + * @property {BtcCentsSatsUsdPattern} _5y + * @property {BtcCentsSatsUsdPattern} _6m + * @property {BtcCentsSatsUsdPattern} _6y + * @property {BtcCentsSatsUsdPattern} _8y */ /** @@ -2853,18 +2851,18 @@ function createInvestedNegNetNuplSupplyUnrealizedPattern4(client, acc) { */ function create_10y1m1w1y2y3m3y4y5y6m6y8yPattern3(client, acc) { return { - _10y: createBtcSatsUsdPattern(client, _p('10y', acc)), - _1m: createBtcSatsUsdPattern(client, _p('1m', acc)), - _1w: createBtcSatsUsdPattern(client, _p('1w', acc)), - _1y: createBtcSatsUsdPattern(client, _p('1y', acc)), - _2y: createBtcSatsUsdPattern(client, _p('2y', acc)), - _3m: createBtcSatsUsdPattern(client, _p('3m', acc)), - _3y: createBtcSatsUsdPattern(client, _p('3y', acc)), - _4y: createBtcSatsUsdPattern(client, _p('4y', acc)), - _5y: createBtcSatsUsdPattern(client, _p('5y', acc)), - _6m: createBtcSatsUsdPattern(client, _p('6m', acc)), - _6y: createBtcSatsUsdPattern(client, _p('6y', acc)), - _8y: createBtcSatsUsdPattern(client, _p('8y', acc)), + _10y: createBtcCentsSatsUsdPattern(client, _p('10y', acc)), + _1m: createBtcCentsSatsUsdPattern(client, _p('1m', acc)), + _1w: createBtcCentsSatsUsdPattern(client, _p('1w', acc)), + _1y: createBtcCentsSatsUsdPattern(client, _p('1y', acc)), + _2y: createBtcCentsSatsUsdPattern(client, _p('2y', acc)), + _3m: createBtcCentsSatsUsdPattern(client, _p('3m', acc)), + _3y: createBtcCentsSatsUsdPattern(client, _p('3y', acc)), + _4y: createBtcCentsSatsUsdPattern(client, _p('4y', acc)), + _5y: createBtcCentsSatsUsdPattern(client, _p('5y', acc)), + _6m: createBtcCentsSatsUsdPattern(client, _p('6m', acc)), + _6y: createBtcCentsSatsUsdPattern(client, _p('6y', acc)), + _8y: createBtcCentsSatsUsdPattern(client, _p('8y', acc)), }; } @@ -3166,15 +3164,15 @@ function createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern(client, acc) { /** * @typedef {Object} AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2 - * @property {BtcSatsUsdPattern} average - * @property {BtcSatsUsdPattern} max - * @property {BtcSatsUsdPattern} median - * @property {BtcSatsUsdPattern} min - * @property {BtcSatsUsdPattern} pct10 - * @property {BtcSatsUsdPattern} pct25 - * @property {BtcSatsUsdPattern} pct75 - * @property {BtcSatsUsdPattern} pct90 - * @property {BtcSatsUsdPattern} sum + * @property {BtcCentsSatsUsdPattern} average + * @property {BtcCentsSatsUsdPattern} max + * @property {BtcCentsSatsUsdPattern} median + * @property {BtcCentsSatsUsdPattern} min + * @property {BtcCentsSatsUsdPattern} pct10 + * @property {BtcCentsSatsUsdPattern} pct25 + * @property {BtcCentsSatsUsdPattern} pct75 + * @property {BtcCentsSatsUsdPattern} pct90 + * @property {BtcCentsSatsUsdPattern} sum */ /** @@ -3185,15 +3183,15 @@ function createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern(client, acc) { */ function createAverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, acc) { return { - average: createBtcSatsUsdPattern(client, _m(acc, 'average')), - max: createBtcSatsUsdPattern(client, _m(acc, 'max')), - median: createBtcSatsUsdPattern(client, _m(acc, 'median')), - min: createBtcSatsUsdPattern(client, _m(acc, 'min')), - pct10: createBtcSatsUsdPattern(client, _m(acc, 'p10')), - pct25: createBtcSatsUsdPattern(client, _m(acc, 'p25')), - pct75: createBtcSatsUsdPattern(client, _m(acc, 'p75')), - pct90: createBtcSatsUsdPattern(client, _m(acc, 'p90')), - sum: createBtcSatsUsdPattern(client, _m(acc, 'sum')), + average: createBtcCentsSatsUsdPattern(client, _m(acc, 'average')), + max: createBtcCentsSatsUsdPattern(client, _m(acc, 'max')), + median: createBtcCentsSatsUsdPattern(client, _m(acc, 'median')), + min: createBtcCentsSatsUsdPattern(client, _m(acc, 'min')), + pct10: createBtcCentsSatsUsdPattern(client, _m(acc, 'p10')), + pct25: createBtcCentsSatsUsdPattern(client, _m(acc, 'p25')), + pct75: createBtcCentsSatsUsdPattern(client, _m(acc, 'p75')), + pct90: createBtcCentsSatsUsdPattern(client, _m(acc, 'p90')), + sum: createBtcCentsSatsUsdPattern(client, _m(acc, 'sum')), }; } @@ -3265,6 +3263,37 @@ function createAverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, acc) }; } +/** + * @typedef {Object} _1y24h30d7dBtcCentsSatsUsdPattern + * @property {BtcCentsSatsUsdPattern} _1y + * @property {BtcCentsSatsUsdPattern} _24h + * @property {BtcCentsSatsUsdPattern} _30d + * @property {BtcCentsSatsUsdPattern} _7d + * @property {MetricPattern18} btc + * @property {MetricPattern18} cents + * @property {MetricPattern18} sats + * @property {MetricPattern18} usd + */ + +/** + * Create a _1y24h30d7dBtcCentsSatsUsdPattern pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {_1y24h30d7dBtcCentsSatsUsdPattern} + */ +function create_1y24h30d7dBtcCentsSatsUsdPattern(client, acc) { + return { + _1y: createBtcCentsSatsUsdPattern(client, _m(acc, '1y')), + _24h: createBtcCentsSatsUsdPattern(client, _m(acc, '24h')), + _30d: createBtcCentsSatsUsdPattern(client, _m(acc, '30d')), + _7d: createBtcCentsSatsUsdPattern(client, _m(acc, '7d')), + btc: createMetricPattern18(client, _m(acc, 'btc')), + cents: createMetricPattern18(client, _m(acc, 'cents')), + sats: createMetricPattern18(client, acc), + usd: createMetricPattern18(client, _m(acc, 'usd')), + }; +} + /** * @template T * @typedef {Object} AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern @@ -3327,35 +3356,6 @@ function create_10y2y3y4y5y6y8yPattern(client, acc) { }; } -/** - * @typedef {Object} _1y24h30d7dBtcSatsUsdPattern - * @property {BtcSatsUsdPattern} _1y - * @property {BtcSatsUsdPattern} _24h - * @property {BtcSatsUsdPattern} _30d - * @property {BtcSatsUsdPattern} _7d - * @property {MetricPattern18} btc - * @property {MetricPattern18} sats - * @property {MetricPattern18} usd - */ - -/** - * Create a _1y24h30d7dBtcSatsUsdPattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {_1y24h30d7dBtcSatsUsdPattern} - */ -function create_1y24h30d7dBtcSatsUsdPattern(client, acc) { - return { - _1y: createBtcSatsUsdPattern(client, _m(acc, '1y')), - _24h: createBtcSatsUsdPattern(client, _m(acc, '24h')), - _30d: createBtcSatsUsdPattern(client, _m(acc, '30d')), - _7d: createBtcSatsUsdPattern(client, _m(acc, '7d')), - btc: createMetricPattern18(client, _m(acc, 'btc')), - sats: createMetricPattern18(client, acc), - usd: createMetricPattern18(client, _m(acc, 'usd')), - }; -} - /** * @typedef {Object} ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern * @property {CoinblocksCoindaysSatblocksSatdaysSentPattern} activity @@ -3478,8 +3478,8 @@ function createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5(clien * @property {AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} _24h * @property {AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} _30d * @property {AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} _7d - * @property {BtcSatsUsdPattern} base - * @property {BtcSatsUsdPattern} cumulative + * @property {BtcCentsSatsUsdPattern} base + * @property {BtcCentsSatsUsdPattern} cumulative */ /** @@ -3494,8 +3494,8 @@ function create_1y24h30d7dBaseCumulativePattern(client, acc) { _24h: createAverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, _m(acc, '24h')), _30d: createAverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, _m(acc, '30d')), _7d: createAverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, _m(acc, '7d')), - base: createBtcSatsUsdPattern(client, acc), - cumulative: createBtcSatsUsdPattern(client, _m(acc, 'cumulative')), + base: createBtcCentsSatsUsdPattern(client, acc), + cumulative: createBtcCentsSatsUsdPattern(client, _m(acc, 'cumulative')), }; } @@ -3533,7 +3533,7 @@ function createBalanceBothReactivatedReceivingSendingPattern(client, acc) { * @property {MetricPattern18} satblocksDestroyed * @property {MetricPattern18} satdaysDestroyed * @property {BaseCumulativePattern} sent - * @property {BtcSatsUsdPattern} sent14dEma + * @property {BtcCentsSatsUsdPattern} sent14dEma */ /** @@ -3549,15 +3549,15 @@ function createCoinblocksCoindaysSatblocksSatdaysSentPattern(client, acc) { satblocksDestroyed: createMetricPattern18(client, _m(acc, 'satblocks_destroyed')), satdaysDestroyed: createMetricPattern18(client, _m(acc, 'satdays_destroyed')), sent: createBaseCumulativePattern(client, _m(acc, 'sent')), - sent14dEma: createBtcSatsUsdPattern(client, _m(acc, 'sent_14d_ema')), + sent14dEma: createBtcCentsSatsUsdPattern(client, _m(acc, 'sent_14d_ema')), }; } /** * @typedef {Object} InvestedMaxMinPercentilesSpotPattern * @property {Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern} investedCapital - * @property {SatsUsdPattern} max - * @property {SatsUsdPattern} min + * @property {CentsSatsUsdPattern} max + * @property {CentsSatsUsdPattern} min * @property {Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern} percentiles * @property {MetricPattern1} spotCostBasisPercentile * @property {MetricPattern1} spotInvestedCapitalPercentile @@ -3572,8 +3572,8 @@ function createCoinblocksCoindaysSatblocksSatdaysSentPattern(client, acc) { function createInvestedMaxMinPercentilesSpotPattern(client, acc) { return { investedCapital: createPct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern(client, _m(acc, 'invested_capital')), - max: createSatsUsdPattern(client, _m(acc, 'max_cost_basis')), - min: createSatsUsdPattern(client, _m(acc, 'min_cost_basis')), + max: createCentsSatsUsdPattern(client, _m(acc, 'max_cost_basis')), + min: createCentsSatsUsdPattern(client, _m(acc, 'min_cost_basis')), percentiles: createPct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern(client, _m(acc, 'cost_basis')), spotCostBasisPercentile: createMetricPattern1(client, _m(acc, 'spot_cost_basis_percentile')), spotInvestedCapitalPercentile: createMetricPattern1(client, _m(acc, 'spot_invested_capital_percentile')), @@ -3582,10 +3582,10 @@ function createInvestedMaxMinPercentilesSpotPattern(client, acc) { /** * @typedef {Object} _1y24h30d7dPattern2 - * @property {BtcSatsUsdPattern} _1y - * @property {BtcSatsUsdPattern} _24h - * @property {BtcSatsUsdPattern} _30d - * @property {BtcSatsUsdPattern} _7d + * @property {BtcCentsSatsUsdPattern} _1y + * @property {BtcCentsSatsUsdPattern} _24h + * @property {BtcCentsSatsUsdPattern} _30d + * @property {BtcCentsSatsUsdPattern} _7d */ /** @@ -3596,10 +3596,33 @@ function createInvestedMaxMinPercentilesSpotPattern(client, acc) { */ function create_1y24h30d7dPattern2(client, acc) { return { - _1y: createBtcSatsUsdPattern(client, _m(acc, '1y')), - _24h: createBtcSatsUsdPattern(client, _m(acc, '24h')), - _30d: createBtcSatsUsdPattern(client, _m(acc, '30d')), - _7d: createBtcSatsUsdPattern(client, _m(acc, '7d')), + _1y: createBtcCentsSatsUsdPattern(client, _m(acc, '1y')), + _24h: createBtcCentsSatsUsdPattern(client, _m(acc, '24h')), + _30d: createBtcCentsSatsUsdPattern(client, _m(acc, '30d')), + _7d: createBtcCentsSatsUsdPattern(client, _m(acc, '7d')), + }; +} + +/** + * @typedef {Object} BtcCentsSatsUsdPattern + * @property {MetricPattern1} btc + * @property {MetricPattern1} cents + * @property {MetricPattern1} sats + * @property {MetricPattern1} usd + */ + +/** + * Create a BtcCentsSatsUsdPattern pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {BtcCentsSatsUsdPattern} + */ +function createBtcCentsSatsUsdPattern(client, acc) { + return { + btc: createMetricPattern1(client, _m(acc, 'btc')), + cents: createMetricPattern1(client, _m(acc, 'cents')), + sats: createMetricPattern1(client, acc), + usd: createMetricPattern1(client, _m(acc, 'usd')), }; } @@ -3630,9 +3653,9 @@ function create_1y24h30d7dPattern(client, acc) { /** * @typedef {Object} _30dHalvedTotalPattern - * @property {BtcSatsUsdPattern} _30dChange + * @property {BtcCentsSatsUsdPattern} _30dChange * @property {BtcSatsUsdPattern} halved - * @property {BtcSatsUsdPattern} total + * @property {BtcCentsSatsUsdPattern} total */ /** @@ -3643,16 +3666,16 @@ function create_1y24h30d7dPattern(client, acc) { */ function create_30dHalvedTotalPattern(client, acc) { return { - _30dChange: createBtcSatsUsdPattern(client, _m(acc, '_30d_change')), + _30dChange: createBtcCentsSatsUsdPattern(client, _m(acc, '_30d_change')), halved: createBtcSatsUsdPattern(client, _m(acc, 'supply_halved')), - total: createBtcSatsUsdPattern(client, _m(acc, 'supply')), + total: createBtcCentsSatsUsdPattern(client, _m(acc, 'supply')), }; } /** * @typedef {Object} BaseCumulativeSumPattern - * @property {BtcSatsUsdPattern} base - * @property {BtcSatsUsdPattern} cumulative + * @property {BtcCentsSatsUsdPattern} base + * @property {BtcCentsSatsUsdPattern} cumulative * @property {_1y24h30d7dPattern2} sum */ @@ -3664,8 +3687,8 @@ function create_30dHalvedTotalPattern(client, acc) { */ function createBaseCumulativeSumPattern(client, acc) { return { - base: createBtcSatsUsdPattern(client, acc), - cumulative: createBtcSatsUsdPattern(client, _m(acc, 'cumulative')), + base: createBtcCentsSatsUsdPattern(client, acc), + cumulative: createBtcCentsSatsUsdPattern(client, _m(acc, 'cumulative')), sum: create_1y24h30d7dPattern2(client, _m(acc, 'sum')), }; } @@ -3692,12 +3715,33 @@ function createBtcSatsUsdPattern(client, acc) { } /** - * @typedef {Object} CentsSatsUsdPattern + * @typedef {Object} CentsSatsUsdPattern2 * @property {MetricPattern2} cents * @property {MetricPattern2} sats * @property {MetricPattern2} usd */ +/** + * Create a CentsSatsUsdPattern2 pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {CentsSatsUsdPattern2} + */ +function createCentsSatsUsdPattern2(client, acc) { + return { + cents: createMetricPattern2(client, _m(acc, 'cents')), + sats: createMetricPattern2(client, _m(acc, 'sats')), + usd: createMetricPattern2(client, acc), + }; +} + +/** + * @typedef {Object} CentsSatsUsdPattern + * @property {MetricPattern1} cents + * @property {MetricPattern1} sats + * @property {MetricPattern1} usd + */ + /** * Create a CentsSatsUsdPattern pattern node * @param {BrkClientBase} client @@ -3706,9 +3750,9 @@ function createBtcSatsUsdPattern(client, acc) { */ function createCentsSatsUsdPattern(client, acc) { return { - cents: createMetricPattern2(client, _m(acc, 'cents')), - sats: createMetricPattern2(client, _m(acc, 'sats')), - usd: createMetricPattern2(client, acc), + cents: createMetricPattern1(client, _m(acc, 'cents')), + sats: createMetricPattern1(client, _m(acc, 'sats')), + usd: createMetricPattern1(client, _m(acc, 'usd')), }; } @@ -3800,8 +3844,8 @@ function create_30dCountPattern(client, acc) { /** * @typedef {Object} BaseCumulativePattern - * @property {BtcSatsUsdPattern} base - * @property {BtcSatsUsdPattern} cumulative + * @property {BtcCentsSatsUsdPattern} base + * @property {BtcCentsSatsUsdPattern} cumulative */ /** @@ -3812,34 +3856,15 @@ function create_30dCountPattern(client, acc) { */ function createBaseCumulativePattern(client, acc) { return { - base: createBtcSatsUsdPattern(client, acc), - cumulative: createBtcSatsUsdPattern(client, _m(acc, 'cumulative')), - }; -} - -/** - * @typedef {Object} CumulativeHeightPattern - * @property {MetricPattern1} cumulative - * @property {MetricPattern18} height - */ - -/** - * Create a CumulativeHeightPattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {CumulativeHeightPattern} - */ -function createCumulativeHeightPattern(client, acc) { - return { - cumulative: createMetricPattern1(client, _m(acc, 'cumulative')), - height: createMetricPattern18(client, acc), + base: createBtcCentsSatsUsdPattern(client, acc), + cumulative: createBtcCentsSatsUsdPattern(client, _m(acc, 'cumulative')), }; } /** * @typedef {Object} MaxMinPattern - * @property {SatsUsdPattern} max - * @property {SatsUsdPattern} min + * @property {CentsSatsUsdPattern} max + * @property {CentsSatsUsdPattern} min */ /** @@ -3850,27 +3875,8 @@ function createCumulativeHeightPattern(client, acc) { */ function createMaxMinPattern(client, acc) { return { - max: createSatsUsdPattern(client, _m(acc, 'max_cost_basis')), - min: createSatsUsdPattern(client, _m(acc, 'min_cost_basis')), - }; -} - -/** - * @typedef {Object} SatsUsdPattern - * @property {MetricPattern1} sats - * @property {MetricPattern1} usd - */ - -/** - * Create a SatsUsdPattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {SatsUsdPattern} - */ -function createSatsUsdPattern(client, acc) { - return { - sats: createMetricPattern1(client, _m(acc, 'sats')), - usd: createMetricPattern1(client, acc), + max: createCentsSatsUsdPattern(client, _m(acc, 'max_cost_basis')), + min: createCentsSatsUsdPattern(client, _m(acc, 'min_cost_basis')), }; } @@ -3912,6 +3918,27 @@ function createUtxoPattern(client, acc) { }; } +/** + * @template T + * @typedef {Object} CumulativeHeightPattern + * @property {MetricPattern1} cumulative + * @property {MetricPattern18} height + */ + +/** + * Create a CumulativeHeightPattern pattern node + * @template T + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {CumulativeHeightPattern} + */ +function createCumulativeHeightPattern(client, acc) { + return { + cumulative: createMetricPattern1(client, _m(acc, 'cumulative')), + height: createMetricPattern18(client, acc), + }; +} + /** * @typedef {Object} RatioPattern2 * @property {MetricPattern1} ratio @@ -4105,9 +4132,9 @@ function createRatioPattern2(client, acc) { /** * @typedef {Object} MetricsTree_Transactions_Volume - * @property {_1y24h30d7dBtcSatsUsdPattern} sentSum - * @property {_1y24h30d7dBtcSatsUsdPattern} receivedSum - * @property {BtcSatsUsdPattern} annualizedVolume + * @property {_1y24h30d7dBtcCentsSatsUsdPattern} sentSum + * @property {_1y24h30d7dBtcCentsSatsUsdPattern} receivedSum + * @property {BtcCentsSatsUsdPattern} annualizedVolume * @property {MetricPattern1} txPerSec * @property {MetricPattern1} outputsPerSec * @property {MetricPattern1} inputsPerSec @@ -4289,8 +4316,8 @@ function createRatioPattern2(client, acc) { /** * @typedef {Object} MetricsTree_Cointime_Supply - * @property {BtcSatsUsdPattern} vaultedSupply - * @property {BtcSatsUsdPattern} activeSupply + * @property {BtcCentsSatsUsdPattern} vaultedSupply + * @property {BtcCentsSatsUsdPattern} activeSupply */ /** @@ -4312,13 +4339,13 @@ function createRatioPattern2(client, acc) { /** * @typedef {Object} MetricsTree_Cointime_Pricing - * @property {SatsUsdPattern} vaultedPrice + * @property {CentsSatsUsdPattern} vaultedPrice * @property {RatioPattern} vaultedPriceRatio - * @property {SatsUsdPattern} activePrice + * @property {CentsSatsUsdPattern} activePrice * @property {RatioPattern} activePriceRatio - * @property {SatsUsdPattern} trueMarketMean + * @property {CentsSatsUsdPattern} trueMarketMean * @property {RatioPattern} trueMarketMeanRatio - * @property {SatsUsdPattern} cointimePrice + * @property {CentsSatsUsdPattern} cointimePrice * @property {RatioPattern} cointimePriceRatio */ @@ -4609,7 +4636,7 @@ function createRatioPattern2(client, acc) { /** * @typedef {Object} MetricsTree_Market_Ath - * @property {SatsUsdPattern} priceAth + * @property {CentsSatsUsdPattern} priceAth * @property {MetricPattern1} priceDrawdown * @property {MetricPattern1} daysSincePriceAth * @property {MetricPattern2} yearsSincePriceAth @@ -4619,19 +4646,19 @@ function createRatioPattern2(client, acc) { /** * @typedef {Object} MetricsTree_Market_Lookback - * @property {SatsUsdPattern} _24h - * @property {SatsUsdPattern} _1w - * @property {SatsUsdPattern} _1m - * @property {SatsUsdPattern} _3m - * @property {SatsUsdPattern} _6m - * @property {SatsUsdPattern} _1y - * @property {SatsUsdPattern} _2y - * @property {SatsUsdPattern} _3y - * @property {SatsUsdPattern} _4y - * @property {SatsUsdPattern} _5y - * @property {SatsUsdPattern} _6y - * @property {SatsUsdPattern} _8y - * @property {SatsUsdPattern} _10y + * @property {CentsSatsUsdPattern} _24h + * @property {CentsSatsUsdPattern} _1w + * @property {CentsSatsUsdPattern} _1m + * @property {CentsSatsUsdPattern} _3m + * @property {CentsSatsUsdPattern} _6m + * @property {CentsSatsUsdPattern} _1y + * @property {CentsSatsUsdPattern} _2y + * @property {CentsSatsUsdPattern} _3y + * @property {CentsSatsUsdPattern} _4y + * @property {CentsSatsUsdPattern} _5y + * @property {CentsSatsUsdPattern} _6y + * @property {CentsSatsUsdPattern} _8y + * @property {CentsSatsUsdPattern} _10y */ /** @@ -4679,14 +4706,14 @@ function createRatioPattern2(client, acc) { /** * @typedef {Object} MetricsTree_Market_Range - * @property {SatsUsdPattern} price1wMin - * @property {SatsUsdPattern} price1wMax - * @property {SatsUsdPattern} price2wMin - * @property {SatsUsdPattern} price2wMax - * @property {SatsUsdPattern} price1mMin - * @property {SatsUsdPattern} price1mMax - * @property {SatsUsdPattern} price1yMin - * @property {SatsUsdPattern} price1yMax + * @property {CentsSatsUsdPattern} price1wMin + * @property {CentsSatsUsdPattern} price1wMax + * @property {CentsSatsUsdPattern} price2wMin + * @property {CentsSatsUsdPattern} price2wMax + * @property {CentsSatsUsdPattern} price1mMin + * @property {CentsSatsUsdPattern} price1mMax + * @property {CentsSatsUsdPattern} price1yMin + * @property {CentsSatsUsdPattern} price1yMax * @property {MetricPattern1} priceTrueRange * @property {MetricPattern1} priceTrueRange2wSum * @property {MetricPattern1} price2wChoppinessIndex @@ -4726,9 +4753,9 @@ function createRatioPattern2(client, acc) { * @property {PriceRatioPattern} price2yEma * @property {PriceRatioPattern} price200wEma * @property {PriceRatioPattern} price4yEma - * @property {SatsUsdPattern} price200dSmaX24 - * @property {SatsUsdPattern} price200dSmaX08 - * @property {SatsUsdPattern} price350dSmaX2 + * @property {CentsSatsUsdPattern} price200dSmaX24 + * @property {CentsSatsUsdPattern} price200dSmaX08 + * @property {CentsSatsUsdPattern} price350dSmaX2 */ /** @@ -4759,50 +4786,50 @@ function createRatioPattern2(client, acc) { /** * @typedef {Object} MetricsTree_Market_Dca_PeriodAveragePrice - * @property {SatsUsdPattern} _1w - * @property {SatsUsdPattern} _1m - * @property {SatsUsdPattern} _3m - * @property {SatsUsdPattern} _6m - * @property {SatsUsdPattern} _1y - * @property {SatsUsdPattern} _2y - * @property {SatsUsdPattern} _3y - * @property {SatsUsdPattern} _4y - * @property {SatsUsdPattern} _5y - * @property {SatsUsdPattern} _6y - * @property {SatsUsdPattern} _8y - * @property {SatsUsdPattern} _10y + * @property {CentsSatsUsdPattern} _1w + * @property {CentsSatsUsdPattern} _1m + * @property {CentsSatsUsdPattern} _3m + * @property {CentsSatsUsdPattern} _6m + * @property {CentsSatsUsdPattern} _1y + * @property {CentsSatsUsdPattern} _2y + * @property {CentsSatsUsdPattern} _3y + * @property {CentsSatsUsdPattern} _4y + * @property {CentsSatsUsdPattern} _5y + * @property {CentsSatsUsdPattern} _6y + * @property {CentsSatsUsdPattern} _8y + * @property {CentsSatsUsdPattern} _10y */ /** * @typedef {Object} MetricsTree_Market_Dca_ClassStack - * @property {BtcSatsUsdPattern} _2015 - * @property {BtcSatsUsdPattern} _2016 - * @property {BtcSatsUsdPattern} _2017 - * @property {BtcSatsUsdPattern} _2018 - * @property {BtcSatsUsdPattern} _2019 - * @property {BtcSatsUsdPattern} _2020 - * @property {BtcSatsUsdPattern} _2021 - * @property {BtcSatsUsdPattern} _2022 - * @property {BtcSatsUsdPattern} _2023 - * @property {BtcSatsUsdPattern} _2024 - * @property {BtcSatsUsdPattern} _2025 - * @property {BtcSatsUsdPattern} _2026 + * @property {BtcCentsSatsUsdPattern} _2015 + * @property {BtcCentsSatsUsdPattern} _2016 + * @property {BtcCentsSatsUsdPattern} _2017 + * @property {BtcCentsSatsUsdPattern} _2018 + * @property {BtcCentsSatsUsdPattern} _2019 + * @property {BtcCentsSatsUsdPattern} _2020 + * @property {BtcCentsSatsUsdPattern} _2021 + * @property {BtcCentsSatsUsdPattern} _2022 + * @property {BtcCentsSatsUsdPattern} _2023 + * @property {BtcCentsSatsUsdPattern} _2024 + * @property {BtcCentsSatsUsdPattern} _2025 + * @property {BtcCentsSatsUsdPattern} _2026 */ /** * @typedef {Object} MetricsTree_Market_Dca_ClassAveragePrice - * @property {SatsUsdPattern} _2015 - * @property {SatsUsdPattern} _2016 - * @property {SatsUsdPattern} _2017 - * @property {SatsUsdPattern} _2018 - * @property {SatsUsdPattern} _2019 - * @property {SatsUsdPattern} _2020 - * @property {SatsUsdPattern} _2021 - * @property {SatsUsdPattern} _2022 - * @property {SatsUsdPattern} _2023 - * @property {SatsUsdPattern} _2024 - * @property {SatsUsdPattern} _2025 - * @property {SatsUsdPattern} _2026 + * @property {CentsSatsUsdPattern} _2015 + * @property {CentsSatsUsdPattern} _2016 + * @property {CentsSatsUsdPattern} _2017 + * @property {CentsSatsUsdPattern} _2018 + * @property {CentsSatsUsdPattern} _2019 + * @property {CentsSatsUsdPattern} _2020 + * @property {CentsSatsUsdPattern} _2021 + * @property {CentsSatsUsdPattern} _2022 + * @property {CentsSatsUsdPattern} _2023 + * @property {CentsSatsUsdPattern} _2024 + * @property {CentsSatsUsdPattern} _2025 + * @property {CentsSatsUsdPattern} _2026 */ /** @@ -5141,9 +5168,9 @@ function createRatioPattern2(client, acc) { /** * @typedef {Object} MetricsTree_Prices_Split - * @property {CentsSatsUsdPattern} open - * @property {CentsSatsUsdPattern} high - * @property {CentsSatsUsdPattern} low + * @property {CentsSatsUsdPattern2} open + * @property {CentsSatsUsdPattern2} high + * @property {CentsSatsUsdPattern2} low * @property {MetricsTree_Prices_Split_Close} close */ @@ -6626,9 +6653,9 @@ class BrkClient extends BrkClientBase { v3: createCumulativeHeightSumPattern(this, 'tx_v3'), }, volume: { - sentSum: create_1y24h30d7dBtcSatsUsdPattern(this, 'sent_sum'), - receivedSum: create_1y24h30d7dBtcSatsUsdPattern(this, 'received_sum'), - annualizedVolume: createBtcSatsUsdPattern(this, 'annualized_volume'), + sentSum: create_1y24h30d7dBtcCentsSatsUsdPattern(this, 'sent_sum'), + receivedSum: create_1y24h30d7dBtcCentsSatsUsdPattern(this, 'received_sum'), + annualizedVolume: createBtcCentsSatsUsdPattern(this, 'annualized_volume'), txPerSec: createMetricPattern1(this, 'tx_per_sec'), outputsPerSec: createMetricPattern1(this, 'outputs_per_sec'), inputsPerSec: createMetricPattern1(this, 'inputs_per_sec'), @@ -6761,8 +6788,8 @@ class BrkClient extends BrkClientBase { activityToVaultednessRatio: createMetricPattern1(this, 'activity_to_vaultedness_ratio'), }, supply: { - vaultedSupply: createBtcSatsUsdPattern(this, 'vaulted_supply'), - activeSupply: createBtcSatsUsdPattern(this, 'active_supply'), + vaultedSupply: createBtcCentsSatsUsdPattern(this, 'vaulted_supply'), + activeSupply: createBtcCentsSatsUsdPattern(this, 'active_supply'), }, value: { cointimeValueDestroyed: createCumulativeHeightSumPattern(this, 'cointime_value_destroyed'), @@ -6778,13 +6805,13 @@ class BrkClient extends BrkClientBase { cointimeCap: createMetricPattern1(this, 'cointime_cap'), }, pricing: { - vaultedPrice: createSatsUsdPattern(this, 'vaulted_price'), + vaultedPrice: createCentsSatsUsdPattern(this, 'vaulted_price'), vaultedPriceRatio: createRatioPattern(this, 'vaulted_price_ratio'), - activePrice: createSatsUsdPattern(this, 'active_price'), + activePrice: createCentsSatsUsdPattern(this, 'active_price'), activePriceRatio: createRatioPattern(this, 'active_price_ratio'), - trueMarketMean: createSatsUsdPattern(this, 'true_market_mean'), + trueMarketMean: createCentsSatsUsdPattern(this, 'true_market_mean'), trueMarketMeanRatio: createRatioPattern(this, 'true_market_mean_ratio'), - cointimePrice: createSatsUsdPattern(this, 'cointime_price'), + cointimePrice: createCentsSatsUsdPattern(this, 'cointime_price'), cointimePriceRatio: createRatioPattern(this, 'cointime_price_ratio'), }, adjusted: { @@ -6959,7 +6986,7 @@ class BrkClient extends BrkClientBase { }, market: { ath: { - priceAth: createSatsUsdPattern(this, 'price_ath'), + priceAth: createCentsSatsUsdPattern(this, 'price_ath'), priceDrawdown: createMetricPattern1(this, 'price_drawdown'), daysSincePriceAth: createMetricPattern1(this, 'days_since_price_ath'), yearsSincePriceAth: createMetricPattern2(this, 'years_since_price_ath'), @@ -6967,19 +6994,19 @@ class BrkClient extends BrkClientBase { maxYearsBetweenPriceAths: createMetricPattern2(this, 'max_years_between_price_aths'), }, lookback: { - _24h: createSatsUsdPattern(this, 'price_24h_ago'), - _1w: createSatsUsdPattern(this, 'price_1w_ago'), - _1m: createSatsUsdPattern(this, 'price_1m_ago'), - _3m: createSatsUsdPattern(this, 'price_3m_ago'), - _6m: createSatsUsdPattern(this, 'price_6m_ago'), - _1y: createSatsUsdPattern(this, 'price_1y_ago'), - _2y: createSatsUsdPattern(this, 'price_2y_ago'), - _3y: createSatsUsdPattern(this, 'price_3y_ago'), - _4y: createSatsUsdPattern(this, 'price_4y_ago'), - _5y: createSatsUsdPattern(this, 'price_5y_ago'), - _6y: createSatsUsdPattern(this, 'price_6y_ago'), - _8y: createSatsUsdPattern(this, 'price_8y_ago'), - _10y: createSatsUsdPattern(this, 'price_10y_ago'), + _24h: createCentsSatsUsdPattern(this, 'price_24h_ago'), + _1w: createCentsSatsUsdPattern(this, 'price_1w_ago'), + _1m: createCentsSatsUsdPattern(this, 'price_1m_ago'), + _3m: createCentsSatsUsdPattern(this, 'price_3m_ago'), + _6m: createCentsSatsUsdPattern(this, 'price_6m_ago'), + _1y: createCentsSatsUsdPattern(this, 'price_1y_ago'), + _2y: createCentsSatsUsdPattern(this, 'price_2y_ago'), + _3y: createCentsSatsUsdPattern(this, 'price_3y_ago'), + _4y: createCentsSatsUsdPattern(this, 'price_4y_ago'), + _5y: createCentsSatsUsdPattern(this, 'price_5y_ago'), + _6y: createCentsSatsUsdPattern(this, 'price_6y_ago'), + _8y: createCentsSatsUsdPattern(this, 'price_8y_ago'), + _10y: createCentsSatsUsdPattern(this, 'price_10y_ago'), }, returns: { priceReturns: { @@ -7018,14 +7045,14 @@ class BrkClient extends BrkClientBase { sortino1y: createMetricPattern1(this, 'sortino_1y'), }, range: { - price1wMin: createSatsUsdPattern(this, 'price_1w_min'), - price1wMax: createSatsUsdPattern(this, 'price_1w_max'), - price2wMin: createSatsUsdPattern(this, 'price_2w_min'), - price2wMax: createSatsUsdPattern(this, 'price_2w_max'), - price1mMin: createSatsUsdPattern(this, 'price_1m_min'), - price1mMax: createSatsUsdPattern(this, 'price_1m_max'), - price1yMin: createSatsUsdPattern(this, 'price_1y_min'), - price1yMax: createSatsUsdPattern(this, 'price_1y_max'), + price1wMin: createCentsSatsUsdPattern(this, 'price_1w_min'), + price1wMax: createCentsSatsUsdPattern(this, 'price_1w_max'), + price2wMin: createCentsSatsUsdPattern(this, 'price_2w_min'), + price2wMax: createCentsSatsUsdPattern(this, 'price_2w_max'), + price1mMin: createCentsSatsUsdPattern(this, 'price_1m_min'), + price1mMax: createCentsSatsUsdPattern(this, 'price_1m_max'), + price1yMin: createCentsSatsUsdPattern(this, 'price_1y_min'), + price1yMax: createCentsSatsUsdPattern(this, 'price_1y_max'), priceTrueRange: createMetricPattern1(this, 'price_true_range'), priceTrueRange2wSum: createMetricPattern1(this, 'price_true_range_2w_sum'), price2wChoppinessIndex: createMetricPattern1(this, 'price_2w_choppiness_index'), @@ -7063,26 +7090,26 @@ class BrkClient extends BrkClientBase { price2yEma: createPriceRatioPattern(this, 'price_2y_ema'), price200wEma: createPriceRatioPattern(this, 'price_200w_ema'), price4yEma: createPriceRatioPattern(this, 'price_4y_ema'), - price200dSmaX24: createSatsUsdPattern(this, 'price_200d_sma_x2_4'), - price200dSmaX08: createSatsUsdPattern(this, 'price_200d_sma_x0_8'), - price350dSmaX2: createSatsUsdPattern(this, 'price_350d_sma_x2'), + price200dSmaX24: createCentsSatsUsdPattern(this, 'price_200d_sma_x2_4'), + price200dSmaX08: createCentsSatsUsdPattern(this, 'price_200d_sma_x0_8'), + price350dSmaX2: createCentsSatsUsdPattern(this, 'price_350d_sma_x2'), }, dca: { dcaSatsPerDay: createMetricPattern18(this, 'dca_sats_per_day'), periodStack: create_10y1m1w1y2y3m3y4y5y6m6y8yPattern3(this, 'dca_stack'), periodAveragePrice: { - _1w: createSatsUsdPattern(this, '1w_dca_average_price'), - _1m: createSatsUsdPattern(this, '1m_dca_average_price'), - _3m: createSatsUsdPattern(this, '3m_dca_average_price'), - _6m: createSatsUsdPattern(this, '6m_dca_average_price'), - _1y: createSatsUsdPattern(this, '1y_dca_average_price'), - _2y: createSatsUsdPattern(this, '2y_dca_average_price'), - _3y: createSatsUsdPattern(this, '3y_dca_average_price'), - _4y: createSatsUsdPattern(this, '4y_dca_average_price'), - _5y: createSatsUsdPattern(this, '5y_dca_average_price'), - _6y: createSatsUsdPattern(this, '6y_dca_average_price'), - _8y: createSatsUsdPattern(this, '8y_dca_average_price'), - _10y: createSatsUsdPattern(this, '10y_dca_average_price'), + _1w: createCentsSatsUsdPattern(this, '1w_dca_average_price'), + _1m: createCentsSatsUsdPattern(this, '1m_dca_average_price'), + _3m: createCentsSatsUsdPattern(this, '3m_dca_average_price'), + _6m: createCentsSatsUsdPattern(this, '6m_dca_average_price'), + _1y: createCentsSatsUsdPattern(this, '1y_dca_average_price'), + _2y: createCentsSatsUsdPattern(this, '2y_dca_average_price'), + _3y: createCentsSatsUsdPattern(this, '3y_dca_average_price'), + _4y: createCentsSatsUsdPattern(this, '4y_dca_average_price'), + _5y: createCentsSatsUsdPattern(this, '5y_dca_average_price'), + _6y: createCentsSatsUsdPattern(this, '6y_dca_average_price'), + _8y: createCentsSatsUsdPattern(this, '8y_dca_average_price'), + _10y: createCentsSatsUsdPattern(this, '10y_dca_average_price'), }, periodReturns: create_10y1m1w1y2y3m3y4y5y6m6y8yPattern2(this, 'dca_returns'), periodCagr: create_10y2y3y4y5y6y8yPattern(this, 'dca_cagr'), @@ -7097,32 +7124,32 @@ class BrkClient extends BrkClientBase { periodLumpSumMinReturn: create_10y1m1w1y2y3m3y4y5y6m6y8yPattern2(this, 'lump_sum_min_return'), periodLumpSumMaxReturn: create_10y1m1w1y2y3m3y4y5y6m6y8yPattern2(this, 'lump_sum_max_return'), classStack: { - _2015: createBtcSatsUsdPattern(this, 'dca_class_2015_stack'), - _2016: createBtcSatsUsdPattern(this, 'dca_class_2016_stack'), - _2017: createBtcSatsUsdPattern(this, 'dca_class_2017_stack'), - _2018: createBtcSatsUsdPattern(this, 'dca_class_2018_stack'), - _2019: createBtcSatsUsdPattern(this, 'dca_class_2019_stack'), - _2020: createBtcSatsUsdPattern(this, 'dca_class_2020_stack'), - _2021: createBtcSatsUsdPattern(this, 'dca_class_2021_stack'), - _2022: createBtcSatsUsdPattern(this, 'dca_class_2022_stack'), - _2023: createBtcSatsUsdPattern(this, 'dca_class_2023_stack'), - _2024: createBtcSatsUsdPattern(this, 'dca_class_2024_stack'), - _2025: createBtcSatsUsdPattern(this, 'dca_class_2025_stack'), - _2026: createBtcSatsUsdPattern(this, 'dca_class_2026_stack'), + _2015: createBtcCentsSatsUsdPattern(this, 'dca_class_2015_stack'), + _2016: createBtcCentsSatsUsdPattern(this, 'dca_class_2016_stack'), + _2017: createBtcCentsSatsUsdPattern(this, 'dca_class_2017_stack'), + _2018: createBtcCentsSatsUsdPattern(this, 'dca_class_2018_stack'), + _2019: createBtcCentsSatsUsdPattern(this, 'dca_class_2019_stack'), + _2020: createBtcCentsSatsUsdPattern(this, 'dca_class_2020_stack'), + _2021: createBtcCentsSatsUsdPattern(this, 'dca_class_2021_stack'), + _2022: createBtcCentsSatsUsdPattern(this, 'dca_class_2022_stack'), + _2023: createBtcCentsSatsUsdPattern(this, 'dca_class_2023_stack'), + _2024: createBtcCentsSatsUsdPattern(this, 'dca_class_2024_stack'), + _2025: createBtcCentsSatsUsdPattern(this, 'dca_class_2025_stack'), + _2026: createBtcCentsSatsUsdPattern(this, 'dca_class_2026_stack'), }, classAveragePrice: { - _2015: createSatsUsdPattern(this, 'dca_class_2015_average_price'), - _2016: createSatsUsdPattern(this, 'dca_class_2016_average_price'), - _2017: createSatsUsdPattern(this, 'dca_class_2017_average_price'), - _2018: createSatsUsdPattern(this, 'dca_class_2018_average_price'), - _2019: createSatsUsdPattern(this, 'dca_class_2019_average_price'), - _2020: createSatsUsdPattern(this, 'dca_class_2020_average_price'), - _2021: createSatsUsdPattern(this, 'dca_class_2021_average_price'), - _2022: createSatsUsdPattern(this, 'dca_class_2022_average_price'), - _2023: createSatsUsdPattern(this, 'dca_class_2023_average_price'), - _2024: createSatsUsdPattern(this, 'dca_class_2024_average_price'), - _2025: createSatsUsdPattern(this, 'dca_class_2025_average_price'), - _2026: createSatsUsdPattern(this, 'dca_class_2026_average_price'), + _2015: createCentsSatsUsdPattern(this, 'dca_class_2015_average_price'), + _2016: createCentsSatsUsdPattern(this, 'dca_class_2016_average_price'), + _2017: createCentsSatsUsdPattern(this, 'dca_class_2017_average_price'), + _2018: createCentsSatsUsdPattern(this, 'dca_class_2018_average_price'), + _2019: createCentsSatsUsdPattern(this, 'dca_class_2019_average_price'), + _2020: createCentsSatsUsdPattern(this, 'dca_class_2020_average_price'), + _2021: createCentsSatsUsdPattern(this, 'dca_class_2021_average_price'), + _2022: createCentsSatsUsdPattern(this, 'dca_class_2022_average_price'), + _2023: createCentsSatsUsdPattern(this, 'dca_class_2023_average_price'), + _2024: createCentsSatsUsdPattern(this, 'dca_class_2024_average_price'), + _2025: createCentsSatsUsdPattern(this, 'dca_class_2025_average_price'), + _2026: createCentsSatsUsdPattern(this, 'dca_class_2026_average_price'), }, classReturns: create_201520162017201820192020202120222023202420252026Pattern2(this, 'dca_class'), classDaysInProfit: { @@ -7417,9 +7444,9 @@ class BrkClient extends BrkClientBase { }, prices: { split: { - open: createCentsSatsUsdPattern(this, 'price_open'), - high: createCentsSatsUsdPattern(this, 'price_high'), - low: createCentsSatsUsdPattern(this, 'price_low'), + open: createCentsSatsUsdPattern2(this, 'price_open'), + high: createCentsSatsUsdPattern2(this, 'price_high'), + low: createCentsSatsUsdPattern2(this, 'price_low'), close: { cents: createMetricPattern2(this, 'price_close_cents'), usd: createMetricPattern2(this, 'price_close'), diff --git a/packages/brk_client/brk_client/__init__.py b/packages/brk_client/brk_client/__init__.py index 51326843d..737effd18 100644 --- a/packages/brk_client/brk_client/__init__.py +++ b/packages/brk_client/brk_client/__init__.py @@ -46,6 +46,9 @@ Cents = int # Cents × Sats (u128) - price in cents multiplied by amount in sats. # Uses u128 because large amounts at any price can overflow u64. CentsSats = int +# Signed cents (i64) - for values that can be negative. +# Used for profit/loss calculations, deltas, etc. +CentsSigned = int # Raw cents squared (u128) - stores cents² × sats without division. # Used for precise accumulation of investor cap values: Σ(price² × sats). # investor_price = investor_cap_raw / realized_cap_raw @@ -2059,69 +2062,68 @@ class AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSe self.adjusted_sopr_30d_ema: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'adjusted_sopr_30d_ema')) self.adjusted_sopr_7d: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'adjusted_sopr_7d')) self.adjusted_sopr_7d_ema: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'adjusted_sopr_7d_ema')) - self.adjusted_value_created: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'adjusted_value_created')) - self.adjusted_value_created_1y: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'adjusted_value_created_1y')) - self.adjusted_value_created_24h: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'adjusted_value_created_24h')) - self.adjusted_value_created_30d: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'adjusted_value_created_30d')) - self.adjusted_value_created_7d: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'adjusted_value_created_7d')) - self.adjusted_value_destroyed: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'adjusted_value_destroyed')) - self.adjusted_value_destroyed_1y: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'adjusted_value_destroyed_1y')) - self.adjusted_value_destroyed_24h: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'adjusted_value_destroyed_24h')) - self.adjusted_value_destroyed_30d: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'adjusted_value_destroyed_30d')) - self.adjusted_value_destroyed_7d: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'adjusted_value_destroyed_7d')) + self.adjusted_value_created: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'adjusted_value_created')) + self.adjusted_value_created_1y: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'adjusted_value_created_1y')) + self.adjusted_value_created_24h: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'adjusted_value_created_24h')) + self.adjusted_value_created_30d: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'adjusted_value_created_30d')) + self.adjusted_value_created_7d: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'adjusted_value_created_7d')) + self.adjusted_value_destroyed: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'adjusted_value_destroyed')) + self.adjusted_value_destroyed_1y: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'adjusted_value_destroyed_1y')) + self.adjusted_value_destroyed_24h: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'adjusted_value_destroyed_24h')) + self.adjusted_value_destroyed_30d: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'adjusted_value_destroyed_30d')) + self.adjusted_value_destroyed_7d: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'adjusted_value_destroyed_7d')) self.cap_raw: MetricPattern18[CentsSats] = MetricPattern18(client, _m(acc, 'cap_raw')) self.capitulation_flow: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'capitulation_flow')) self.investor_cap_raw: MetricPattern18[CentsSquaredSats] = MetricPattern18(client, _m(acc, 'investor_cap_raw')) - self.investor_price: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'investor_price')) - self.investor_price_cents: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'investor_price_cents')) + self.investor_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'investor_price')) self.investor_price_extra: RatioPattern2 = RatioPattern2(client, _m(acc, 'investor_price_ratio')) self.investor_price_ratio_ext: RatioPattern3 = RatioPattern3(client, _m(acc, 'investor_price_ratio')) - self.loss_value_created: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'loss_value_created')) - self.loss_value_destroyed: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'loss_value_destroyed')) - self.lower_price_band: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'lower_price_band')) + self.loss_value_created: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'loss_value_created')) + self.loss_value_destroyed: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'loss_value_destroyed')) + self.lower_price_band: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'lower_price_band')) self.mvrv: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'mvrv')) self.neg_realized_loss: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'neg_realized_loss')) - self.net_realized_pnl: CumulativeHeightPattern = CumulativeHeightPattern(client, _m(acc, 'net_realized_pnl')) - self.net_realized_pnl_7d_ema: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'net_realized_pnl_7d_ema')) - self.net_realized_pnl_cumulative_30d_delta: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta')) + self.net_realized_pnl: CumulativeHeightPattern[CentsSigned] = CumulativeHeightPattern(client, _m(acc, 'net_realized_pnl')) + self.net_realized_pnl_7d_ema: MetricPattern1[CentsSigned] = MetricPattern1(client, _m(acc, 'net_realized_pnl_7d_ema')) + self.net_realized_pnl_cumulative_30d_delta: MetricPattern1[CentsSigned] = MetricPattern1(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta')) self.net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_market_cap')) self.net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap')) self.net_realized_pnl_rel_to_realized_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'net_realized_pnl_rel_to_realized_cap')) - self.peak_regret: CumulativeHeightPattern = CumulativeHeightPattern(client, _m(acc, 'realized_peak_regret')) + self.peak_regret: CumulativeHeightPattern[Cents] = CumulativeHeightPattern(client, _m(acc, 'realized_peak_regret')) self.peak_regret_rel_to_realized_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'peak_regret_rel_to_realized_cap')) self.profit_flow: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'profit_flow')) - self.profit_value_created: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'profit_value_created')) - self.profit_value_destroyed: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'profit_value_destroyed')) + self.profit_value_created: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'profit_value_created')) + self.profit_value_destroyed: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'profit_value_destroyed')) self.realized_cap: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_cap')) - self.realized_cap_30d_delta: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_cap_30d_delta')) + self.realized_cap_30d_delta: MetricPattern1[CentsSigned] = MetricPattern1(client, _m(acc, 'realized_cap_30d_delta')) self.realized_cap_cents: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_cap_cents')) self.realized_cap_rel_to_own_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'realized_cap_rel_to_own_market_cap')) - self.realized_loss: CumulativeHeightPattern = CumulativeHeightPattern(client, _m(acc, 'realized_loss')) - self.realized_loss_1y: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_loss_1y')) - self.realized_loss_24h: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_loss_24h')) - self.realized_loss_30d: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_loss_30d')) - self.realized_loss_7d: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_loss_7d')) - self.realized_loss_7d_ema: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_loss_7d_ema')) + self.realized_loss: CumulativeHeightPattern[Cents] = CumulativeHeightPattern(client, _m(acc, 'realized_loss')) + self.realized_loss_1y: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_loss_1y')) + self.realized_loss_24h: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_loss_24h')) + self.realized_loss_30d: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_loss_30d')) + self.realized_loss_7d: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_loss_7d')) + self.realized_loss_7d_ema: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_loss_7d_ema')) self.realized_loss_rel_to_realized_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'realized_loss_rel_to_realized_cap')) - self.realized_price: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'realized_price')) + self.realized_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'realized_price')) self.realized_price_extra: RatioPattern2 = RatioPattern2(client, _m(acc, 'realized_price_ratio')) self.realized_price_ratio_ext: RatioPattern3 = RatioPattern3(client, _m(acc, 'realized_price_ratio')) - self.realized_profit: CumulativeHeightPattern = CumulativeHeightPattern(client, _m(acc, 'realized_profit')) - self.realized_profit_1y: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_profit_1y')) - self.realized_profit_24h: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_profit_24h')) - self.realized_profit_30d: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_profit_30d')) - self.realized_profit_7d: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_profit_7d')) - self.realized_profit_7d_ema: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_profit_7d_ema')) + self.realized_profit: CumulativeHeightPattern[Cents] = CumulativeHeightPattern(client, _m(acc, 'realized_profit')) + self.realized_profit_1y: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_profit_1y')) + self.realized_profit_24h: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_profit_24h')) + self.realized_profit_30d: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_profit_30d')) + self.realized_profit_7d: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_profit_7d')) + self.realized_profit_7d_ema: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_profit_7d_ema')) self.realized_profit_rel_to_realized_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'realized_profit_rel_to_realized_cap')) self.realized_profit_to_loss_ratio_1y: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'realized_profit_to_loss_ratio_1y')) self.realized_profit_to_loss_ratio_24h: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'realized_profit_to_loss_ratio_24h')) self.realized_profit_to_loss_ratio_30d: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'realized_profit_to_loss_ratio_30d')) self.realized_profit_to_loss_ratio_7d: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'realized_profit_to_loss_ratio_7d')) - self.realized_value: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_value')) - self.realized_value_1y: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_value_1y')) - self.realized_value_24h: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_value_24h')) - self.realized_value_30d: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_value_30d')) - self.realized_value_7d: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_value_7d')) + self.realized_value: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_value')) + self.realized_value_1y: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_value_1y')) + self.realized_value_24h: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_value_24h')) + self.realized_value_30d: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_value_30d')) + self.realized_value_7d: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_value_7d')) self.sell_side_risk_ratio: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'sell_side_risk_ratio')) self.sell_side_risk_ratio_1y: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'sell_side_risk_ratio_1y')) self.sell_side_risk_ratio_24h: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'sell_side_risk_ratio_24h')) @@ -2132,9 +2134,9 @@ class AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSe self.sell_side_risk_ratio_7d: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'sell_side_risk_ratio_7d')) self.sell_side_risk_ratio_7d_ema: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'sell_side_risk_ratio_7d_ema')) self.sent_in_loss: BaseCumulativePattern = BaseCumulativePattern(client, _m(acc, 'sent_in_loss')) - self.sent_in_loss_14d_ema: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _m(acc, 'sent_in_loss_14d_ema')) + self.sent_in_loss_14d_ema: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'sent_in_loss_14d_ema')) self.sent_in_profit: BaseCumulativePattern = BaseCumulativePattern(client, _m(acc, 'sent_in_profit')) - self.sent_in_profit_14d_ema: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _m(acc, 'sent_in_profit_14d_ema')) + self.sent_in_profit_14d_ema: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'sent_in_profit_14d_ema')) self.sopr: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'sopr')) self.sopr_1y: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'sopr_1y')) self.sopr_24h: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'sopr_24h')) @@ -2145,17 +2147,17 @@ class AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSe self.sopr_7d: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'sopr_7d')) self.sopr_7d_ema: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'sopr_7d_ema')) self.total_realized_pnl: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'total_realized_pnl')) - self.upper_price_band: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'upper_price_band')) - self.value_created: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_created')) - self.value_created_1y: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_created_1y')) - self.value_created_24h: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_created_24h')) - self.value_created_30d: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_created_30d')) - self.value_created_7d: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_created_7d')) - self.value_destroyed: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_destroyed')) - self.value_destroyed_1y: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_destroyed_1y')) - self.value_destroyed_24h: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_destroyed_24h')) - self.value_destroyed_30d: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_destroyed_30d')) - self.value_destroyed_7d: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_destroyed_7d')) + self.upper_price_band: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'upper_price_band')) + self.value_created: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_created')) + self.value_created_1y: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_created_1y')) + self.value_created_24h: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_created_24h')) + self.value_created_30d: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_created_30d')) + self.value_created_7d: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_created_7d')) + self.value_destroyed: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_destroyed')) + self.value_destroyed_1y: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_destroyed_1y')) + self.value_destroyed_24h: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_destroyed_24h')) + self.value_destroyed_30d: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_destroyed_30d')) + self.value_destroyed_7d: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_destroyed_7d')) class AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern2: """Pattern struct for repeated tree structure.""" @@ -2171,54 +2173,53 @@ class AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSe self.adjusted_sopr_30d_ema: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'adjusted_sopr_30d_ema')) self.adjusted_sopr_7d: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'adjusted_sopr_7d')) self.adjusted_sopr_7d_ema: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'adjusted_sopr_7d_ema')) - self.adjusted_value_created: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'adjusted_value_created')) - self.adjusted_value_created_1y: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'adjusted_value_created_1y')) - self.adjusted_value_created_24h: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'adjusted_value_created_24h')) - self.adjusted_value_created_30d: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'adjusted_value_created_30d')) - self.adjusted_value_created_7d: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'adjusted_value_created_7d')) - self.adjusted_value_destroyed: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'adjusted_value_destroyed')) - self.adjusted_value_destroyed_1y: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'adjusted_value_destroyed_1y')) - self.adjusted_value_destroyed_24h: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'adjusted_value_destroyed_24h')) - self.adjusted_value_destroyed_30d: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'adjusted_value_destroyed_30d')) - self.adjusted_value_destroyed_7d: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'adjusted_value_destroyed_7d')) + self.adjusted_value_created: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'adjusted_value_created')) + self.adjusted_value_created_1y: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'adjusted_value_created_1y')) + self.adjusted_value_created_24h: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'adjusted_value_created_24h')) + self.adjusted_value_created_30d: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'adjusted_value_created_30d')) + self.adjusted_value_created_7d: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'adjusted_value_created_7d')) + self.adjusted_value_destroyed: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'adjusted_value_destroyed')) + self.adjusted_value_destroyed_1y: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'adjusted_value_destroyed_1y')) + self.adjusted_value_destroyed_24h: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'adjusted_value_destroyed_24h')) + self.adjusted_value_destroyed_30d: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'adjusted_value_destroyed_30d')) + self.adjusted_value_destroyed_7d: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'adjusted_value_destroyed_7d')) self.cap_raw: MetricPattern18[CentsSats] = MetricPattern18(client, _m(acc, 'cap_raw')) self.capitulation_flow: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'capitulation_flow')) self.investor_cap_raw: MetricPattern18[CentsSquaredSats] = MetricPattern18(client, _m(acc, 'investor_cap_raw')) - self.investor_price: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'investor_price')) - self.investor_price_cents: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'investor_price_cents')) + self.investor_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'investor_price')) self.investor_price_extra: RatioPattern2 = RatioPattern2(client, _m(acc, 'investor_price_ratio')) - self.loss_value_created: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'loss_value_created')) - self.loss_value_destroyed: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'loss_value_destroyed')) - self.lower_price_band: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'lower_price_band')) + self.loss_value_created: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'loss_value_created')) + self.loss_value_destroyed: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'loss_value_destroyed')) + self.lower_price_band: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'lower_price_band')) self.mvrv: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'mvrv')) self.neg_realized_loss: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'neg_realized_loss')) - self.net_realized_pnl: CumulativeHeightPattern = CumulativeHeightPattern(client, _m(acc, 'net_realized_pnl')) - self.net_realized_pnl_7d_ema: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'net_realized_pnl_7d_ema')) - self.net_realized_pnl_cumulative_30d_delta: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta')) + self.net_realized_pnl: CumulativeHeightPattern[CentsSigned] = CumulativeHeightPattern(client, _m(acc, 'net_realized_pnl')) + self.net_realized_pnl_7d_ema: MetricPattern1[CentsSigned] = MetricPattern1(client, _m(acc, 'net_realized_pnl_7d_ema')) + self.net_realized_pnl_cumulative_30d_delta: MetricPattern1[CentsSigned] = MetricPattern1(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta')) self.net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_market_cap')) self.net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap')) self.net_realized_pnl_rel_to_realized_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'net_realized_pnl_rel_to_realized_cap')) - self.peak_regret: CumulativeHeightPattern = CumulativeHeightPattern(client, _m(acc, 'realized_peak_regret')) + self.peak_regret: CumulativeHeightPattern[Cents] = CumulativeHeightPattern(client, _m(acc, 'realized_peak_regret')) self.peak_regret_rel_to_realized_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'peak_regret_rel_to_realized_cap')) self.profit_flow: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'profit_flow')) - self.profit_value_created: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'profit_value_created')) - self.profit_value_destroyed: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'profit_value_destroyed')) + self.profit_value_created: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'profit_value_created')) + self.profit_value_destroyed: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'profit_value_destroyed')) self.realized_cap: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_cap')) - self.realized_cap_30d_delta: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_cap_30d_delta')) + self.realized_cap_30d_delta: MetricPattern1[CentsSigned] = MetricPattern1(client, _m(acc, 'realized_cap_30d_delta')) self.realized_cap_cents: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_cap_cents')) - self.realized_loss: CumulativeHeightPattern = CumulativeHeightPattern(client, _m(acc, 'realized_loss')) - self.realized_loss_7d_ema: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_loss_7d_ema')) + self.realized_loss: CumulativeHeightPattern[Cents] = CumulativeHeightPattern(client, _m(acc, 'realized_loss')) + self.realized_loss_7d_ema: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_loss_7d_ema')) self.realized_loss_rel_to_realized_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'realized_loss_rel_to_realized_cap')) - self.realized_price: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'realized_price')) + self.realized_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'realized_price')) self.realized_price_extra: RatioPattern2 = RatioPattern2(client, _m(acc, 'realized_price_ratio')) - self.realized_profit: CumulativeHeightPattern = CumulativeHeightPattern(client, _m(acc, 'realized_profit')) - self.realized_profit_7d_ema: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_profit_7d_ema')) + self.realized_profit: CumulativeHeightPattern[Cents] = CumulativeHeightPattern(client, _m(acc, 'realized_profit')) + self.realized_profit_7d_ema: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_profit_7d_ema')) self.realized_profit_rel_to_realized_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'realized_profit_rel_to_realized_cap')) - self.realized_value: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_value')) - self.realized_value_1y: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_value_1y')) - self.realized_value_24h: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_value_24h')) - self.realized_value_30d: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_value_30d')) - self.realized_value_7d: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_value_7d')) + self.realized_value: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_value')) + self.realized_value_1y: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_value_1y')) + self.realized_value_24h: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_value_24h')) + self.realized_value_30d: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_value_30d')) + self.realized_value_7d: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_value_7d')) self.sell_side_risk_ratio: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'sell_side_risk_ratio')) self.sell_side_risk_ratio_1y: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'sell_side_risk_ratio_1y')) self.sell_side_risk_ratio_24h: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'sell_side_risk_ratio_24h')) @@ -2229,9 +2230,9 @@ class AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSe self.sell_side_risk_ratio_7d: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'sell_side_risk_ratio_7d')) self.sell_side_risk_ratio_7d_ema: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'sell_side_risk_ratio_7d_ema')) self.sent_in_loss: BaseCumulativePattern = BaseCumulativePattern(client, _m(acc, 'sent_in_loss')) - self.sent_in_loss_14d_ema: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _m(acc, 'sent_in_loss_14d_ema')) + self.sent_in_loss_14d_ema: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'sent_in_loss_14d_ema')) self.sent_in_profit: BaseCumulativePattern = BaseCumulativePattern(client, _m(acc, 'sent_in_profit')) - self.sent_in_profit_14d_ema: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _m(acc, 'sent_in_profit_14d_ema')) + self.sent_in_profit_14d_ema: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'sent_in_profit_14d_ema')) self.sopr: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'sopr')) self.sopr_1y: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'sopr_1y')) self.sopr_24h: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'sopr_24h')) @@ -2242,17 +2243,17 @@ class AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSe self.sopr_7d: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'sopr_7d')) self.sopr_7d_ema: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'sopr_7d_ema')) self.total_realized_pnl: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'total_realized_pnl')) - self.upper_price_band: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'upper_price_band')) - self.value_created: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_created')) - self.value_created_1y: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_created_1y')) - self.value_created_24h: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_created_24h')) - self.value_created_30d: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_created_30d')) - self.value_created_7d: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_created_7d')) - self.value_destroyed: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_destroyed')) - self.value_destroyed_1y: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_destroyed_1y')) - self.value_destroyed_24h: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_destroyed_24h')) - self.value_destroyed_30d: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_destroyed_30d')) - self.value_destroyed_7d: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_destroyed_7d')) + self.upper_price_band: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'upper_price_band')) + self.value_created: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_created')) + self.value_created_1y: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_created_1y')) + self.value_created_24h: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_created_24h')) + self.value_created_30d: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_created_30d')) + self.value_created_7d: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_created_7d')) + self.value_destroyed: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_destroyed')) + self.value_destroyed_1y: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_destroyed_1y')) + self.value_destroyed_24h: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_destroyed_24h')) + self.value_destroyed_30d: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_destroyed_30d')) + self.value_destroyed_7d: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_destroyed_7d')) class CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern2: """Pattern struct for repeated tree structure.""" @@ -2262,56 +2263,55 @@ class CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTo self.cap_raw: MetricPattern18[CentsSats] = MetricPattern18(client, _m(acc, 'cap_raw')) self.capitulation_flow: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'capitulation_flow')) self.investor_cap_raw: MetricPattern18[CentsSquaredSats] = MetricPattern18(client, _m(acc, 'investor_cap_raw')) - self.investor_price: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'investor_price')) - self.investor_price_cents: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'investor_price_cents')) + self.investor_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'investor_price')) self.investor_price_extra: RatioPattern2 = RatioPattern2(client, _m(acc, 'investor_price_ratio')) self.investor_price_ratio_ext: RatioPattern3 = RatioPattern3(client, _m(acc, 'investor_price_ratio')) - self.loss_value_created: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'loss_value_created')) - self.loss_value_destroyed: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'loss_value_destroyed')) - self.lower_price_band: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'lower_price_band')) + self.loss_value_created: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'loss_value_created')) + self.loss_value_destroyed: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'loss_value_destroyed')) + self.lower_price_band: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'lower_price_band')) self.mvrv: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'mvrv')) self.neg_realized_loss: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'neg_realized_loss')) - self.net_realized_pnl: CumulativeHeightPattern = CumulativeHeightPattern(client, _m(acc, 'net_realized_pnl')) - self.net_realized_pnl_7d_ema: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'net_realized_pnl_7d_ema')) - self.net_realized_pnl_cumulative_30d_delta: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta')) + self.net_realized_pnl: CumulativeHeightPattern[CentsSigned] = CumulativeHeightPattern(client, _m(acc, 'net_realized_pnl')) + self.net_realized_pnl_7d_ema: MetricPattern1[CentsSigned] = MetricPattern1(client, _m(acc, 'net_realized_pnl_7d_ema')) + self.net_realized_pnl_cumulative_30d_delta: MetricPattern1[CentsSigned] = MetricPattern1(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta')) self.net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_market_cap')) self.net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap')) self.net_realized_pnl_rel_to_realized_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'net_realized_pnl_rel_to_realized_cap')) - self.peak_regret: CumulativeHeightPattern = CumulativeHeightPattern(client, _m(acc, 'realized_peak_regret')) + self.peak_regret: CumulativeHeightPattern[Cents] = CumulativeHeightPattern(client, _m(acc, 'realized_peak_regret')) self.peak_regret_rel_to_realized_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'peak_regret_rel_to_realized_cap')) self.profit_flow: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'profit_flow')) - self.profit_value_created: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'profit_value_created')) - self.profit_value_destroyed: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'profit_value_destroyed')) + self.profit_value_created: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'profit_value_created')) + self.profit_value_destroyed: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'profit_value_destroyed')) self.realized_cap: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_cap')) - self.realized_cap_30d_delta: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_cap_30d_delta')) + self.realized_cap_30d_delta: MetricPattern1[CentsSigned] = MetricPattern1(client, _m(acc, 'realized_cap_30d_delta')) self.realized_cap_cents: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_cap_cents')) self.realized_cap_rel_to_own_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'realized_cap_rel_to_own_market_cap')) - self.realized_loss: CumulativeHeightPattern = CumulativeHeightPattern(client, _m(acc, 'realized_loss')) - self.realized_loss_1y: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_loss_1y')) - self.realized_loss_24h: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_loss_24h')) - self.realized_loss_30d: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_loss_30d')) - self.realized_loss_7d: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_loss_7d')) - self.realized_loss_7d_ema: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_loss_7d_ema')) + self.realized_loss: CumulativeHeightPattern[Cents] = CumulativeHeightPattern(client, _m(acc, 'realized_loss')) + self.realized_loss_1y: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_loss_1y')) + self.realized_loss_24h: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_loss_24h')) + self.realized_loss_30d: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_loss_30d')) + self.realized_loss_7d: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_loss_7d')) + self.realized_loss_7d_ema: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_loss_7d_ema')) self.realized_loss_rel_to_realized_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'realized_loss_rel_to_realized_cap')) - self.realized_price: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'realized_price')) + self.realized_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'realized_price')) self.realized_price_extra: RatioPattern2 = RatioPattern2(client, _m(acc, 'realized_price_ratio')) self.realized_price_ratio_ext: RatioPattern3 = RatioPattern3(client, _m(acc, 'realized_price_ratio')) - self.realized_profit: CumulativeHeightPattern = CumulativeHeightPattern(client, _m(acc, 'realized_profit')) - self.realized_profit_1y: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_profit_1y')) - self.realized_profit_24h: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_profit_24h')) - self.realized_profit_30d: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_profit_30d')) - self.realized_profit_7d: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_profit_7d')) - self.realized_profit_7d_ema: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_profit_7d_ema')) + self.realized_profit: CumulativeHeightPattern[Cents] = CumulativeHeightPattern(client, _m(acc, 'realized_profit')) + self.realized_profit_1y: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_profit_1y')) + self.realized_profit_24h: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_profit_24h')) + self.realized_profit_30d: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_profit_30d')) + self.realized_profit_7d: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_profit_7d')) + self.realized_profit_7d_ema: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_profit_7d_ema')) self.realized_profit_rel_to_realized_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'realized_profit_rel_to_realized_cap')) self.realized_profit_to_loss_ratio_1y: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'realized_profit_to_loss_ratio_1y')) self.realized_profit_to_loss_ratio_24h: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'realized_profit_to_loss_ratio_24h')) self.realized_profit_to_loss_ratio_30d: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'realized_profit_to_loss_ratio_30d')) self.realized_profit_to_loss_ratio_7d: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'realized_profit_to_loss_ratio_7d')) - self.realized_value: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_value')) - self.realized_value_1y: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_value_1y')) - self.realized_value_24h: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_value_24h')) - self.realized_value_30d: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_value_30d')) - self.realized_value_7d: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_value_7d')) + self.realized_value: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_value')) + self.realized_value_1y: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_value_1y')) + self.realized_value_24h: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_value_24h')) + self.realized_value_30d: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_value_30d')) + self.realized_value_7d: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_value_7d')) self.sell_side_risk_ratio: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'sell_side_risk_ratio')) self.sell_side_risk_ratio_1y: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'sell_side_risk_ratio_1y')) self.sell_side_risk_ratio_24h: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'sell_side_risk_ratio_24h')) @@ -2322,9 +2322,9 @@ class CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTo self.sell_side_risk_ratio_7d: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'sell_side_risk_ratio_7d')) self.sell_side_risk_ratio_7d_ema: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'sell_side_risk_ratio_7d_ema')) self.sent_in_loss: BaseCumulativePattern = BaseCumulativePattern(client, _m(acc, 'sent_in_loss')) - self.sent_in_loss_14d_ema: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _m(acc, 'sent_in_loss_14d_ema')) + self.sent_in_loss_14d_ema: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'sent_in_loss_14d_ema')) self.sent_in_profit: BaseCumulativePattern = BaseCumulativePattern(client, _m(acc, 'sent_in_profit')) - self.sent_in_profit_14d_ema: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _m(acc, 'sent_in_profit_14d_ema')) + self.sent_in_profit_14d_ema: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'sent_in_profit_14d_ema')) self.sopr: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'sopr')) self.sopr_1y: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'sopr_1y')) self.sopr_24h: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'sopr_24h')) @@ -2335,17 +2335,17 @@ class CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTo self.sopr_7d: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'sopr_7d')) self.sopr_7d_ema: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'sopr_7d_ema')) self.total_realized_pnl: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'total_realized_pnl')) - self.upper_price_band: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'upper_price_band')) - self.value_created: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_created')) - self.value_created_1y: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_created_1y')) - self.value_created_24h: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_created_24h')) - self.value_created_30d: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_created_30d')) - self.value_created_7d: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_created_7d')) - self.value_destroyed: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_destroyed')) - self.value_destroyed_1y: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_destroyed_1y')) - self.value_destroyed_24h: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_destroyed_24h')) - self.value_destroyed_30d: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_destroyed_30d')) - self.value_destroyed_7d: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_destroyed_7d')) + self.upper_price_band: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'upper_price_band')) + self.value_created: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_created')) + self.value_created_1y: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_created_1y')) + self.value_created_24h: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_created_24h')) + self.value_created_30d: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_created_30d')) + self.value_created_7d: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_created_7d')) + self.value_destroyed: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_destroyed')) + self.value_destroyed_1y: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_destroyed_1y')) + self.value_destroyed_24h: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_destroyed_24h')) + self.value_destroyed_30d: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_destroyed_30d')) + self.value_destroyed_7d: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_destroyed_7d')) class CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern: """Pattern struct for repeated tree structure.""" @@ -2355,41 +2355,40 @@ class CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTo self.cap_raw: MetricPattern18[CentsSats] = MetricPattern18(client, _m(acc, 'cap_raw')) self.capitulation_flow: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'capitulation_flow')) self.investor_cap_raw: MetricPattern18[CentsSquaredSats] = MetricPattern18(client, _m(acc, 'investor_cap_raw')) - self.investor_price: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'investor_price')) - self.investor_price_cents: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'investor_price_cents')) + self.investor_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'investor_price')) self.investor_price_extra: RatioPattern2 = RatioPattern2(client, _m(acc, 'investor_price_ratio')) - self.loss_value_created: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'loss_value_created')) - self.loss_value_destroyed: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'loss_value_destroyed')) - self.lower_price_band: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'lower_price_band')) + self.loss_value_created: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'loss_value_created')) + self.loss_value_destroyed: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'loss_value_destroyed')) + self.lower_price_band: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'lower_price_band')) self.mvrv: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'mvrv')) self.neg_realized_loss: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'neg_realized_loss')) - self.net_realized_pnl: CumulativeHeightPattern = CumulativeHeightPattern(client, _m(acc, 'net_realized_pnl')) - self.net_realized_pnl_7d_ema: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'net_realized_pnl_7d_ema')) - self.net_realized_pnl_cumulative_30d_delta: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta')) + self.net_realized_pnl: CumulativeHeightPattern[CentsSigned] = CumulativeHeightPattern(client, _m(acc, 'net_realized_pnl')) + self.net_realized_pnl_7d_ema: MetricPattern1[CentsSigned] = MetricPattern1(client, _m(acc, 'net_realized_pnl_7d_ema')) + self.net_realized_pnl_cumulative_30d_delta: MetricPattern1[CentsSigned] = MetricPattern1(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta')) self.net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_market_cap')) self.net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap')) self.net_realized_pnl_rel_to_realized_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'net_realized_pnl_rel_to_realized_cap')) - self.peak_regret: CumulativeHeightPattern = CumulativeHeightPattern(client, _m(acc, 'realized_peak_regret')) + self.peak_regret: CumulativeHeightPattern[Cents] = CumulativeHeightPattern(client, _m(acc, 'realized_peak_regret')) self.peak_regret_rel_to_realized_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'peak_regret_rel_to_realized_cap')) self.profit_flow: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'profit_flow')) - self.profit_value_created: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'profit_value_created')) - self.profit_value_destroyed: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'profit_value_destroyed')) + self.profit_value_created: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'profit_value_created')) + self.profit_value_destroyed: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'profit_value_destroyed')) self.realized_cap: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_cap')) - self.realized_cap_30d_delta: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_cap_30d_delta')) + self.realized_cap_30d_delta: MetricPattern1[CentsSigned] = MetricPattern1(client, _m(acc, 'realized_cap_30d_delta')) self.realized_cap_cents: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_cap_cents')) - self.realized_loss: CumulativeHeightPattern = CumulativeHeightPattern(client, _m(acc, 'realized_loss')) - self.realized_loss_7d_ema: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_loss_7d_ema')) + self.realized_loss: CumulativeHeightPattern[Cents] = CumulativeHeightPattern(client, _m(acc, 'realized_loss')) + self.realized_loss_7d_ema: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_loss_7d_ema')) self.realized_loss_rel_to_realized_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'realized_loss_rel_to_realized_cap')) - self.realized_price: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'realized_price')) + self.realized_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'realized_price')) self.realized_price_extra: RatioPattern2 = RatioPattern2(client, _m(acc, 'realized_price_ratio')) - self.realized_profit: CumulativeHeightPattern = CumulativeHeightPattern(client, _m(acc, 'realized_profit')) - self.realized_profit_7d_ema: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_profit_7d_ema')) + self.realized_profit: CumulativeHeightPattern[Cents] = CumulativeHeightPattern(client, _m(acc, 'realized_profit')) + self.realized_profit_7d_ema: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_profit_7d_ema')) self.realized_profit_rel_to_realized_cap: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'realized_profit_rel_to_realized_cap')) - self.realized_value: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_value')) - self.realized_value_1y: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_value_1y')) - self.realized_value_24h: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_value_24h')) - self.realized_value_30d: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_value_30d')) - self.realized_value_7d: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_value_7d')) + self.realized_value: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_value')) + self.realized_value_1y: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_value_1y')) + self.realized_value_24h: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_value_24h')) + self.realized_value_30d: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_value_30d')) + self.realized_value_7d: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_value_7d')) self.sell_side_risk_ratio: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'sell_side_risk_ratio')) self.sell_side_risk_ratio_1y: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'sell_side_risk_ratio_1y')) self.sell_side_risk_ratio_24h: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'sell_side_risk_ratio_24h')) @@ -2400,9 +2399,9 @@ class CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTo self.sell_side_risk_ratio_7d: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'sell_side_risk_ratio_7d')) self.sell_side_risk_ratio_7d_ema: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'sell_side_risk_ratio_7d_ema')) self.sent_in_loss: BaseCumulativePattern = BaseCumulativePattern(client, _m(acc, 'sent_in_loss')) - self.sent_in_loss_14d_ema: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _m(acc, 'sent_in_loss_14d_ema')) + self.sent_in_loss_14d_ema: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'sent_in_loss_14d_ema')) self.sent_in_profit: BaseCumulativePattern = BaseCumulativePattern(client, _m(acc, 'sent_in_profit')) - self.sent_in_profit_14d_ema: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _m(acc, 'sent_in_profit_14d_ema')) + self.sent_in_profit_14d_ema: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'sent_in_profit_14d_ema')) self.sopr: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'sopr')) self.sopr_1y: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'sopr_1y')) self.sopr_24h: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'sopr_24h')) @@ -2413,48 +2412,48 @@ class CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTo self.sopr_7d: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'sopr_7d')) self.sopr_7d_ema: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'sopr_7d_ema')) self.total_realized_pnl: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'total_realized_pnl')) - self.upper_price_band: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'upper_price_band')) - self.value_created: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_created')) - self.value_created_1y: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_created_1y')) - self.value_created_24h: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_created_24h')) - self.value_created_30d: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_created_30d')) - self.value_created_7d: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_created_7d')) - self.value_destroyed: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_destroyed')) - self.value_destroyed_1y: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_destroyed_1y')) - self.value_destroyed_24h: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_destroyed_24h')) - self.value_destroyed_30d: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_destroyed_30d')) - self.value_destroyed_7d: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_destroyed_7d')) + self.upper_price_band: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'upper_price_band')) + self.value_created: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_created')) + self.value_created_1y: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_created_1y')) + self.value_created_24h: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_created_24h')) + self.value_created_30d: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_created_30d')) + self.value_created_7d: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_created_7d')) + self.value_destroyed: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_destroyed')) + self.value_destroyed_1y: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_destroyed_1y')) + self.value_destroyed_24h: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_destroyed_24h')) + self.value_destroyed_30d: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_destroyed_30d')) + self.value_destroyed_7d: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_destroyed_7d')) class _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self._0sd_usd: SatsUsdPattern = SatsUsdPattern(client, _m(acc, '0sd_usd')) + self._0sd_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, '0sd')) self.m0_5sd: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'm0_5sd')) - self.m0_5sd_usd: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'm0_5sd_usd')) + self.m0_5sd_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'm0_5sd')) self.m1_5sd: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'm1_5sd')) - self.m1_5sd_usd: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'm1_5sd_usd')) + self.m1_5sd_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'm1_5sd')) self.m1sd: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'm1sd')) - self.m1sd_usd: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'm1sd_usd')) + self.m1sd_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'm1sd')) self.m2_5sd: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'm2_5sd')) - self.m2_5sd_usd: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'm2_5sd_usd')) + self.m2_5sd_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'm2_5sd')) self.m2sd: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'm2sd')) - self.m2sd_usd: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'm2sd_usd')) + self.m2sd_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'm2sd')) self.m3sd: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'm3sd')) - self.m3sd_usd: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'm3sd_usd')) + self.m3sd_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'm3sd')) self.p0_5sd: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'p0_5sd')) - self.p0_5sd_usd: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'p0_5sd_usd')) + self.p0_5sd_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'p0_5sd')) self.p1_5sd: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'p1_5sd')) - self.p1_5sd_usd: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'p1_5sd_usd')) + self.p1_5sd_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'p1_5sd')) self.p1sd: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'p1sd')) - self.p1sd_usd: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'p1sd_usd')) + self.p1sd_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'p1sd')) self.p2_5sd: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'p2_5sd')) - self.p2_5sd_usd: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'p2_5sd_usd')) + self.p2_5sd_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'p2_5sd')) self.p2sd: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'p2sd')) - self.p2sd_usd: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'p2sd_usd')) + self.p2sd_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'p2sd')) self.p3sd: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'p3sd')) - self.p3sd_usd: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'p3sd_usd')) + self.p3sd_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'p3sd')) self.sd: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'sd')) self.sma: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'sma')) self.zscore: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'zscore')) @@ -2491,7 +2490,7 @@ class PriceRatioPattern: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.price: SatsUsdPattern = SatsUsdPattern(client, acc) + self.price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, acc) self.ratio: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'ratio')) self.ratio_1m_sma: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'ratio_1m_sma')) self.ratio_1w_sma: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'ratio_1w_sma')) @@ -2499,17 +2498,17 @@ class PriceRatioPattern: self.ratio_2y_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern = _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern(client, _m(acc, 'ratio_2y')) self.ratio_4y_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern = _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern(client, _m(acc, 'ratio_4y')) self.ratio_pct1: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'ratio_pct1')) - self.ratio_pct1_usd: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'ratio_pct1_usd')) + self.ratio_pct1_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'ratio_pct1')) self.ratio_pct2: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'ratio_pct2')) - self.ratio_pct2_usd: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'ratio_pct2_usd')) + self.ratio_pct2_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'ratio_pct2')) self.ratio_pct5: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'ratio_pct5')) - self.ratio_pct5_usd: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'ratio_pct5_usd')) + self.ratio_pct5_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'ratio_pct5')) self.ratio_pct95: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'ratio_pct95')) - self.ratio_pct95_usd: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'ratio_pct95_usd')) + self.ratio_pct95_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'ratio_pct95')) self.ratio_pct98: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'ratio_pct98')) - self.ratio_pct98_usd: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'ratio_pct98_usd')) + self.ratio_pct98_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'ratio_pct98')) self.ratio_pct99: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'ratio_pct99')) - self.ratio_pct99_usd: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'ratio_pct99_usd')) + self.ratio_pct99_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'ratio_pct99')) self.ratio_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern = _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern(client, _m(acc, 'ratio')) class Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern: @@ -2517,25 +2516,25 @@ class Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct7 def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.pct05: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'pct05')) - self.pct10: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'pct10')) - self.pct15: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'pct15')) - self.pct20: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'pct20')) - self.pct25: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'pct25')) - self.pct30: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'pct30')) - self.pct35: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'pct35')) - self.pct40: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'pct40')) - self.pct45: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'pct45')) - self.pct50: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'pct50')) - self.pct55: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'pct55')) - self.pct60: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'pct60')) - self.pct65: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'pct65')) - self.pct70: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'pct70')) - self.pct75: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'pct75')) - self.pct80: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'pct80')) - self.pct85: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'pct85')) - self.pct90: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'pct90')) - self.pct95: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'pct95')) + self.pct05: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'pct05')) + self.pct10: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'pct10')) + self.pct15: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'pct15')) + self.pct20: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'pct20')) + self.pct25: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'pct25')) + self.pct30: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'pct30')) + self.pct35: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'pct35')) + self.pct40: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'pct40')) + self.pct45: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'pct45')) + self.pct50: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'pct50')) + self.pct55: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'pct55')) + self.pct60: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'pct60')) + self.pct65: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'pct65')) + self.pct70: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'pct70')) + self.pct75: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'pct75')) + self.pct80: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'pct80')) + self.pct85: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'pct85')) + self.pct90: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'pct90')) + self.pct95: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'pct95')) class RatioPattern: """Pattern struct for repeated tree structure.""" @@ -2549,17 +2548,17 @@ class RatioPattern: self.ratio_2y_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern = _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern(client, _m(acc, '2y')) self.ratio_4y_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern = _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern(client, _m(acc, '4y')) self.ratio_pct1: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'pct1')) - self.ratio_pct1_usd: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'pct1_usd')) + self.ratio_pct1_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'pct1')) self.ratio_pct2: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'pct2')) - self.ratio_pct2_usd: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'pct2_usd')) + self.ratio_pct2_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'pct2')) self.ratio_pct5: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'pct5')) - self.ratio_pct5_usd: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'pct5_usd')) + self.ratio_pct5_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'pct5')) self.ratio_pct95: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'pct95')) - self.ratio_pct95_usd: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'pct95_usd')) + self.ratio_pct95_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'pct95')) self.ratio_pct98: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'pct98')) - self.ratio_pct98_usd: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'pct98_usd')) + self.ratio_pct98_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'pct98')) self.ratio_pct99: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'pct99')) - self.ratio_pct99_usd: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'pct99_usd')) + self.ratio_pct99_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'pct99')) self.ratio_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern = _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern(client, acc) class RatioPattern3: @@ -2573,17 +2572,17 @@ class RatioPattern3: self.ratio_2y_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern = _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern(client, _m(acc, '2y')) self.ratio_4y_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern = _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern(client, _m(acc, '4y')) self.ratio_pct1: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'pct1')) - self.ratio_pct1_usd: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'pct1_usd')) + self.ratio_pct1_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'pct1')) self.ratio_pct2: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'pct2')) - self.ratio_pct2_usd: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'pct2_usd')) + self.ratio_pct2_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'pct2')) self.ratio_pct5: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'pct5')) - self.ratio_pct5_usd: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'pct5_usd')) + self.ratio_pct5_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'pct5')) self.ratio_pct95: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'pct95')) - self.ratio_pct95_usd: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'pct95_usd')) + self.ratio_pct95_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'pct95')) self.ratio_pct98: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'pct98')) - self.ratio_pct98_usd: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'pct98_usd')) + self.ratio_pct98_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'pct98')) self.ratio_pct99: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'pct99')) - self.ratio_pct99_usd: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'pct99_usd')) + self.ratio_pct99_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'pct99')) self.ratio_sd: _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern = _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern(client, acc) class GreedInvestedInvestorNegNetPainPeakSupplyTotalUnrealizedPattern: @@ -2603,8 +2602,8 @@ class GreedInvestedInvestorNegNetPainPeakSupplyTotalUnrealizedPattern: self.net_unrealized_pnl: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'net_unrealized_pnl')) self.pain_index: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'pain_index')) self.peak_regret: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'unrealized_peak_regret')) - self.supply_in_loss: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _m(acc, 'supply_in_loss')) - self.supply_in_profit: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _m(acc, 'supply_in_profit')) + self.supply_in_loss: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'supply_in_loss')) + self.supply_in_profit: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'supply_in_profit')) self.total_unrealized_pnl: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'total_unrealized_pnl')) self.unrealized_loss: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'unrealized_loss')) self.unrealized_profit: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'unrealized_profit')) @@ -2625,8 +2624,8 @@ class GreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern: self.net_sentiment: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'net_sentiment')) self.net_unrealized_pnl: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'net_unrealized_pnl')) self.pain_index: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'pain_index')) - self.supply_in_loss: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _m(acc, 'supply_in_loss')) - self.supply_in_profit: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _m(acc, 'supply_in_profit')) + self.supply_in_loss: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'supply_in_loss')) + self.supply_in_profit: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'supply_in_profit')) self.total_unrealized_pnl: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'total_unrealized_pnl')) self.unrealized_loss: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'unrealized_loss')) self.unrealized_profit: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'unrealized_profit')) @@ -2676,18 +2675,18 @@ class _10y1m1w1y2y3m3y4y5y6m6y8yPattern3: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self._10y: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _p('10y', acc)) - self._1m: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _p('1m', acc)) - self._1w: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _p('1w', acc)) - self._1y: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _p('1y', acc)) - self._2y: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _p('2y', acc)) - self._3m: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _p('3m', acc)) - self._3y: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _p('3y', acc)) - self._4y: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _p('4y', acc)) - self._5y: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _p('5y', acc)) - self._6m: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _p('6m', acc)) - self._6y: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _p('6y', acc)) - self._8y: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _p('8y', acc)) + self._10y: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _p('10y', acc)) + self._1m: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _p('1m', acc)) + self._1w: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _p('1w', acc)) + self._1y: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _p('1y', acc)) + self._2y: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _p('2y', acc)) + self._3m: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _p('3m', acc)) + self._3y: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _p('3y', acc)) + self._4y: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _p('4y', acc)) + self._5y: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _p('5y', acc)) + self._6m: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _p('6m', acc)) + self._6y: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _p('6y', acc)) + self._8y: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _p('8y', acc)) class InvestedNegNetNuplSupplyUnrealizedPattern: """Pattern struct for repeated tree structure.""" @@ -2828,15 +2827,15 @@ class AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.average: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _m(acc, 'average')) - self.max: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _m(acc, 'max')) - self.median: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _m(acc, 'median')) - self.min: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _m(acc, 'min')) - self.pct10: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _m(acc, 'p10')) - self.pct25: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _m(acc, 'p25')) - self.pct75: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _m(acc, 'p75')) - self.pct90: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _m(acc, 'p90')) - self.sum: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _m(acc, 'sum')) + self.average: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'average')) + self.max: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'max')) + self.median: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'median')) + self.min: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'min')) + self.pct10: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'p10')) + self.pct25: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'p25')) + self.pct75: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'p75')) + self.pct90: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'p90')) + self.sum: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'sum')) class AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern: """Pattern struct for repeated tree structure.""" @@ -2868,6 +2867,20 @@ class AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern(Generic[T]): self.pct75: _1y24h30d7dPattern[T] = _1y24h30d7dPattern(client, _m(acc, 'p75')) self.pct90: _1y24h30d7dPattern[T] = _1y24h30d7dPattern(client, _m(acc, 'p90')) +class _1y24h30d7dBtcCentsSatsUsdPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self._1y: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, '1y')) + self._24h: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, '24h')) + self._30d: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, '30d')) + self._7d: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, '7d')) + self.btc: MetricPattern18[Bitcoin] = MetricPattern18(client, _m(acc, 'btc')) + self.cents: MetricPattern18[Cents] = MetricPattern18(client, _m(acc, 'cents')) + self.sats: MetricPattern18[Sats] = MetricPattern18(client, acc) + self.usd: MetricPattern18[Dollars] = MetricPattern18(client, _m(acc, 'usd')) + class AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern(Generic[T]): """Pattern struct for repeated tree structure.""" @@ -2895,19 +2908,6 @@ class _10y2y3y4y5y6y8yPattern: self._6y: MetricPattern1[StoredF32] = MetricPattern1(client, _p('6y', acc)) self._8y: MetricPattern1[StoredF32] = MetricPattern1(client, _p('8y', acc)) -class _1y24h30d7dBtcSatsUsdPattern: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self._1y: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _m(acc, '1y')) - self._24h: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _m(acc, '24h')) - self._30d: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _m(acc, '30d')) - self._7d: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _m(acc, '7d')) - self.btc: MetricPattern18[Bitcoin] = MetricPattern18(client, _m(acc, 'btc')) - self.sats: MetricPattern18[Sats] = MetricPattern18(client, acc) - self.usd: MetricPattern18[Dollars] = MetricPattern18(client, _m(acc, 'usd')) - class ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern: """Pattern struct for repeated tree structure.""" @@ -2969,8 +2969,8 @@ class _1y24h30d7dBaseCumulativePattern: self._24h: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2 = AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, _m(acc, '24h')) self._30d: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2 = AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, _m(acc, '30d')) self._7d: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2 = AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, _m(acc, '7d')) - self.base: BtcSatsUsdPattern = BtcSatsUsdPattern(client, acc) - self.cumulative: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _m(acc, 'cumulative')) + self.base: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, acc) + self.cumulative: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'cumulative')) class BalanceBothReactivatedReceivingSendingPattern: """Pattern struct for repeated tree structure.""" @@ -2994,7 +2994,7 @@ class CoinblocksCoindaysSatblocksSatdaysSentPattern: self.satblocks_destroyed: MetricPattern18[Sats] = MetricPattern18(client, _m(acc, 'satblocks_destroyed')) self.satdays_destroyed: MetricPattern18[Sats] = MetricPattern18(client, _m(acc, 'satdays_destroyed')) self.sent: BaseCumulativePattern = BaseCumulativePattern(client, _m(acc, 'sent')) - self.sent_14d_ema: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _m(acc, 'sent_14d_ema')) + self.sent_14d_ema: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'sent_14d_ema')) class InvestedMaxMinPercentilesSpotPattern: """Pattern struct for repeated tree structure.""" @@ -3002,8 +3002,8 @@ class InvestedMaxMinPercentilesSpotPattern: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" self.invested_capital: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern = Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern(client, _m(acc, 'invested_capital')) - self.max: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'max_cost_basis')) - self.min: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'min_cost_basis')) + self.max: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'max_cost_basis')) + self.min: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'min_cost_basis')) self.percentiles: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern = Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern(client, _m(acc, 'cost_basis')) self.spot_cost_basis_percentile: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'spot_cost_basis_percentile')) self.spot_invested_capital_percentile: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'spot_invested_capital_percentile')) @@ -3013,10 +3013,20 @@ class _1y24h30d7dPattern2: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self._1y: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _m(acc, '1y')) - self._24h: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _m(acc, '24h')) - self._30d: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _m(acc, '30d')) - self._7d: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _m(acc, '7d')) + self._1y: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, '1y')) + self._24h: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, '24h')) + self._30d: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, '30d')) + self._7d: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, '7d')) + +class BtcCentsSatsUsdPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.btc: MetricPattern1[Bitcoin] = MetricPattern1(client, _m(acc, 'btc')) + self.cents: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'cents')) + self.sats: MetricPattern1[Sats] = MetricPattern1(client, acc) + self.usd: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'usd')) class _1y24h30d7dPattern(Generic[T]): """Pattern struct for repeated tree structure.""" @@ -3033,17 +3043,17 @@ class _30dHalvedTotalPattern: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self._30d_change: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _m(acc, '_30d_change')) + self._30d_change: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, '_30d_change')) self.halved: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _m(acc, 'supply_halved')) - self.total: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _m(acc, 'supply')) + self.total: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'supply')) class BaseCumulativeSumPattern: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.base: BtcSatsUsdPattern = BtcSatsUsdPattern(client, acc) - self.cumulative: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _m(acc, 'cumulative')) + self.base: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, acc) + self.cumulative: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'cumulative')) self.sum: _1y24h30d7dPattern2 = _1y24h30d7dPattern2(client, _m(acc, 'sum')) class BtcSatsUsdPattern: @@ -3055,7 +3065,7 @@ class BtcSatsUsdPattern: self.sats: MetricPattern1[Sats] = MetricPattern1(client, acc) self.usd: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'usd')) -class CentsSatsUsdPattern: +class CentsSatsUsdPattern2: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -3064,6 +3074,15 @@ class CentsSatsUsdPattern: self.sats: MetricPattern2[Sats] = MetricPattern2(client, _m(acc, 'sats')) self.usd: MetricPattern2[Dollars] = MetricPattern2(client, acc) +class CentsSatsUsdPattern: + """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.sats: MetricPattern1[SatsFract] = MetricPattern1(client, _m(acc, 'sats')) + self.usd: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'usd')) + class HistogramLineSignalPattern: """Pattern struct for repeated tree structure.""" @@ -3104,32 +3123,16 @@ class BaseCumulativePattern: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.base: BtcSatsUsdPattern = BtcSatsUsdPattern(client, acc) - self.cumulative: BtcSatsUsdPattern = BtcSatsUsdPattern(client, _m(acc, 'cumulative')) - -class CumulativeHeightPattern: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.cumulative: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'cumulative')) - self.height: MetricPattern18[Dollars] = MetricPattern18(client, acc) + self.base: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, acc) + self.cumulative: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'cumulative')) class MaxMinPattern: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.max: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'max_cost_basis')) - self.min: SatsUsdPattern = SatsUsdPattern(client, _m(acc, 'min_cost_basis')) - -class SatsUsdPattern: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.sats: MetricPattern1[SatsFract] = MetricPattern1(client, _m(acc, 'sats')) - self.usd: MetricPattern1[Dollars] = MetricPattern1(client, acc) + self.max: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'max_cost_basis')) + self.min: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'min_cost_basis')) class SdSmaPattern: """Pattern struct for repeated tree structure.""" @@ -3147,6 +3150,14 @@ class UtxoPattern: self.utxo_count: MetricPattern1[StoredU64] = MetricPattern1(client, acc) self.utxo_count_30d_change: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, '30d_change')) +class CumulativeHeightPattern(Generic[T]): + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated metric name.""" + self.cumulative: MetricPattern1[T] = MetricPattern1(client, _m(acc, 'cumulative')) + self.height: MetricPattern18[T] = MetricPattern18(client, acc) + class RatioPattern2: """Pattern struct for repeated tree structure.""" @@ -3304,9 +3315,9 @@ class MetricsTree_Transactions_Volume: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.sent_sum: _1y24h30d7dBtcSatsUsdPattern = _1y24h30d7dBtcSatsUsdPattern(client, 'sent_sum') - self.received_sum: _1y24h30d7dBtcSatsUsdPattern = _1y24h30d7dBtcSatsUsdPattern(client, 'received_sum') - self.annualized_volume: BtcSatsUsdPattern = BtcSatsUsdPattern(client, 'annualized_volume') + self.sent_sum: _1y24h30d7dBtcCentsSatsUsdPattern = _1y24h30d7dBtcCentsSatsUsdPattern(client, 'sent_sum') + self.received_sum: _1y24h30d7dBtcCentsSatsUsdPattern = _1y24h30d7dBtcCentsSatsUsdPattern(client, 'received_sum') + self.annualized_volume: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'annualized_volume') self.tx_per_sec: MetricPattern1[StoredF32] = MetricPattern1(client, 'tx_per_sec') self.outputs_per_sec: MetricPattern1[StoredF32] = MetricPattern1(client, 'outputs_per_sec') self.inputs_per_sec: MetricPattern1[StoredF32] = MetricPattern1(client, 'inputs_per_sec') @@ -3513,8 +3524,8 @@ class MetricsTree_Cointime_Supply: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.vaulted_supply: BtcSatsUsdPattern = BtcSatsUsdPattern(client, 'vaulted_supply') - self.active_supply: BtcSatsUsdPattern = BtcSatsUsdPattern(client, 'active_supply') + self.vaulted_supply: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'vaulted_supply') + self.active_supply: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'active_supply') class MetricsTree_Cointime_Value: """Metrics tree node.""" @@ -3539,13 +3550,13 @@ class MetricsTree_Cointime_Pricing: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.vaulted_price: SatsUsdPattern = SatsUsdPattern(client, 'vaulted_price') + self.vaulted_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'vaulted_price') self.vaulted_price_ratio: RatioPattern = RatioPattern(client, 'vaulted_price_ratio') - self.active_price: SatsUsdPattern = SatsUsdPattern(client, 'active_price') + self.active_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'active_price') self.active_price_ratio: RatioPattern = RatioPattern(client, 'active_price_ratio') - self.true_market_mean: SatsUsdPattern = SatsUsdPattern(client, 'true_market_mean') + self.true_market_mean: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'true_market_mean') self.true_market_mean_ratio: RatioPattern = RatioPattern(client, 'true_market_mean_ratio') - self.cointime_price: SatsUsdPattern = SatsUsdPattern(client, 'cointime_price') + self.cointime_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'cointime_price') self.cointime_price_ratio: RatioPattern = RatioPattern(client, 'cointime_price_ratio') class MetricsTree_Cointime_Adjusted: @@ -3873,7 +3884,7 @@ class MetricsTree_Market_Ath: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.price_ath: SatsUsdPattern = SatsUsdPattern(client, 'price_ath') + self.price_ath: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_ath') self.price_drawdown: MetricPattern1[StoredF32] = MetricPattern1(client, 'price_drawdown') self.days_since_price_ath: MetricPattern1[StoredU16] = MetricPattern1(client, 'days_since_price_ath') self.years_since_price_ath: MetricPattern2[StoredF32] = MetricPattern2(client, 'years_since_price_ath') @@ -3884,19 +3895,19 @@ class MetricsTree_Market_Lookback: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self._24h: SatsUsdPattern = SatsUsdPattern(client, 'price_24h_ago') - self._1w: SatsUsdPattern = SatsUsdPattern(client, 'price_1w_ago') - self._1m: SatsUsdPattern = SatsUsdPattern(client, 'price_1m_ago') - self._3m: SatsUsdPattern = SatsUsdPattern(client, 'price_3m_ago') - self._6m: SatsUsdPattern = SatsUsdPattern(client, 'price_6m_ago') - self._1y: SatsUsdPattern = SatsUsdPattern(client, 'price_1y_ago') - self._2y: SatsUsdPattern = SatsUsdPattern(client, 'price_2y_ago') - self._3y: SatsUsdPattern = SatsUsdPattern(client, 'price_3y_ago') - self._4y: SatsUsdPattern = SatsUsdPattern(client, 'price_4y_ago') - self._5y: SatsUsdPattern = SatsUsdPattern(client, 'price_5y_ago') - self._6y: SatsUsdPattern = SatsUsdPattern(client, 'price_6y_ago') - self._8y: SatsUsdPattern = SatsUsdPattern(client, 'price_8y_ago') - self._10y: SatsUsdPattern = SatsUsdPattern(client, 'price_10y_ago') + self._24h: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_24h_ago') + self._1w: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_1w_ago') + self._1m: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_1m_ago') + self._3m: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_3m_ago') + self._6m: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_6m_ago') + self._1y: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_1y_ago') + self._2y: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_2y_ago') + self._3y: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_3y_ago') + self._4y: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_4y_ago') + self._5y: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_5y_ago') + self._6y: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_6y_ago') + self._8y: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_8y_ago') + self._10y: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_10y_ago') class MetricsTree_Market_Returns_PriceReturns: """Metrics tree node.""" @@ -3948,14 +3959,14 @@ class MetricsTree_Market_Range: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.price_1w_min: SatsUsdPattern = SatsUsdPattern(client, 'price_1w_min') - self.price_1w_max: SatsUsdPattern = SatsUsdPattern(client, 'price_1w_max') - self.price_2w_min: SatsUsdPattern = SatsUsdPattern(client, 'price_2w_min') - self.price_2w_max: SatsUsdPattern = SatsUsdPattern(client, 'price_2w_max') - self.price_1m_min: SatsUsdPattern = SatsUsdPattern(client, 'price_1m_min') - self.price_1m_max: SatsUsdPattern = SatsUsdPattern(client, 'price_1m_max') - self.price_1y_min: SatsUsdPattern = SatsUsdPattern(client, 'price_1y_min') - self.price_1y_max: SatsUsdPattern = SatsUsdPattern(client, 'price_1y_max') + self.price_1w_min: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_1w_min') + self.price_1w_max: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_1w_max') + self.price_2w_min: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_2w_min') + self.price_2w_max: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_2w_max') + self.price_1m_min: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_1m_min') + self.price_1m_max: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_1m_max') + self.price_1y_min: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_1y_min') + self.price_1y_max: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_1y_max') self.price_true_range: MetricPattern1[StoredF32] = MetricPattern1(client, 'price_true_range') self.price_true_range_2w_sum: MetricPattern1[StoredF32] = MetricPattern1(client, 'price_true_range_2w_sum') self.price_2w_choppiness_index: MetricPattern1[StoredF32] = MetricPattern1(client, 'price_2w_choppiness_index') @@ -3996,60 +4007,60 @@ class MetricsTree_Market_MovingAverage: self.price_2y_ema: PriceRatioPattern = PriceRatioPattern(client, 'price_2y_ema') self.price_200w_ema: PriceRatioPattern = PriceRatioPattern(client, 'price_200w_ema') self.price_4y_ema: PriceRatioPattern = PriceRatioPattern(client, 'price_4y_ema') - self.price_200d_sma_x2_4: SatsUsdPattern = SatsUsdPattern(client, 'price_200d_sma_x2_4') - self.price_200d_sma_x0_8: SatsUsdPattern = SatsUsdPattern(client, 'price_200d_sma_x0_8') - self.price_350d_sma_x2: SatsUsdPattern = SatsUsdPattern(client, 'price_350d_sma_x2') + self.price_200d_sma_x2_4: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_200d_sma_x2_4') + self.price_200d_sma_x0_8: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_200d_sma_x0_8') + self.price_350d_sma_x2: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_350d_sma_x2') class MetricsTree_Market_Dca_PeriodAveragePrice: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self._1w: SatsUsdPattern = SatsUsdPattern(client, '1w_dca_average_price') - self._1m: SatsUsdPattern = SatsUsdPattern(client, '1m_dca_average_price') - self._3m: SatsUsdPattern = SatsUsdPattern(client, '3m_dca_average_price') - self._6m: SatsUsdPattern = SatsUsdPattern(client, '6m_dca_average_price') - self._1y: SatsUsdPattern = SatsUsdPattern(client, '1y_dca_average_price') - self._2y: SatsUsdPattern = SatsUsdPattern(client, '2y_dca_average_price') - self._3y: SatsUsdPattern = SatsUsdPattern(client, '3y_dca_average_price') - self._4y: SatsUsdPattern = SatsUsdPattern(client, '4y_dca_average_price') - self._5y: SatsUsdPattern = SatsUsdPattern(client, '5y_dca_average_price') - self._6y: SatsUsdPattern = SatsUsdPattern(client, '6y_dca_average_price') - self._8y: SatsUsdPattern = SatsUsdPattern(client, '8y_dca_average_price') - self._10y: SatsUsdPattern = SatsUsdPattern(client, '10y_dca_average_price') + self._1w: CentsSatsUsdPattern = CentsSatsUsdPattern(client, '1w_dca_average_price') + self._1m: CentsSatsUsdPattern = CentsSatsUsdPattern(client, '1m_dca_average_price') + self._3m: CentsSatsUsdPattern = CentsSatsUsdPattern(client, '3m_dca_average_price') + self._6m: CentsSatsUsdPattern = CentsSatsUsdPattern(client, '6m_dca_average_price') + self._1y: CentsSatsUsdPattern = CentsSatsUsdPattern(client, '1y_dca_average_price') + self._2y: CentsSatsUsdPattern = CentsSatsUsdPattern(client, '2y_dca_average_price') + self._3y: CentsSatsUsdPattern = CentsSatsUsdPattern(client, '3y_dca_average_price') + self._4y: CentsSatsUsdPattern = CentsSatsUsdPattern(client, '4y_dca_average_price') + self._5y: CentsSatsUsdPattern = CentsSatsUsdPattern(client, '5y_dca_average_price') + self._6y: CentsSatsUsdPattern = CentsSatsUsdPattern(client, '6y_dca_average_price') + self._8y: CentsSatsUsdPattern = CentsSatsUsdPattern(client, '8y_dca_average_price') + self._10y: CentsSatsUsdPattern = CentsSatsUsdPattern(client, '10y_dca_average_price') class MetricsTree_Market_Dca_ClassStack: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self._2015: BtcSatsUsdPattern = BtcSatsUsdPattern(client, 'dca_class_2015_stack') - self._2016: BtcSatsUsdPattern = BtcSatsUsdPattern(client, 'dca_class_2016_stack') - self._2017: BtcSatsUsdPattern = BtcSatsUsdPattern(client, 'dca_class_2017_stack') - self._2018: BtcSatsUsdPattern = BtcSatsUsdPattern(client, 'dca_class_2018_stack') - self._2019: BtcSatsUsdPattern = BtcSatsUsdPattern(client, 'dca_class_2019_stack') - self._2020: BtcSatsUsdPattern = BtcSatsUsdPattern(client, 'dca_class_2020_stack') - self._2021: BtcSatsUsdPattern = BtcSatsUsdPattern(client, 'dca_class_2021_stack') - self._2022: BtcSatsUsdPattern = BtcSatsUsdPattern(client, 'dca_class_2022_stack') - self._2023: BtcSatsUsdPattern = BtcSatsUsdPattern(client, 'dca_class_2023_stack') - self._2024: BtcSatsUsdPattern = BtcSatsUsdPattern(client, 'dca_class_2024_stack') - self._2025: BtcSatsUsdPattern = BtcSatsUsdPattern(client, 'dca_class_2025_stack') - self._2026: BtcSatsUsdPattern = BtcSatsUsdPattern(client, 'dca_class_2026_stack') + self._2015: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'dca_class_2015_stack') + self._2016: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'dca_class_2016_stack') + self._2017: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'dca_class_2017_stack') + self._2018: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'dca_class_2018_stack') + self._2019: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'dca_class_2019_stack') + self._2020: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'dca_class_2020_stack') + self._2021: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'dca_class_2021_stack') + self._2022: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'dca_class_2022_stack') + self._2023: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'dca_class_2023_stack') + self._2024: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'dca_class_2024_stack') + self._2025: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'dca_class_2025_stack') + self._2026: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'dca_class_2026_stack') class MetricsTree_Market_Dca_ClassAveragePrice: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self._2015: SatsUsdPattern = SatsUsdPattern(client, 'dca_class_2015_average_price') - self._2016: SatsUsdPattern = SatsUsdPattern(client, 'dca_class_2016_average_price') - self._2017: SatsUsdPattern = SatsUsdPattern(client, 'dca_class_2017_average_price') - self._2018: SatsUsdPattern = SatsUsdPattern(client, 'dca_class_2018_average_price') - self._2019: SatsUsdPattern = SatsUsdPattern(client, 'dca_class_2019_average_price') - self._2020: SatsUsdPattern = SatsUsdPattern(client, 'dca_class_2020_average_price') - self._2021: SatsUsdPattern = SatsUsdPattern(client, 'dca_class_2021_average_price') - self._2022: SatsUsdPattern = SatsUsdPattern(client, 'dca_class_2022_average_price') - self._2023: SatsUsdPattern = SatsUsdPattern(client, 'dca_class_2023_average_price') - self._2024: SatsUsdPattern = SatsUsdPattern(client, 'dca_class_2024_average_price') - self._2025: SatsUsdPattern = SatsUsdPattern(client, 'dca_class_2025_average_price') - self._2026: SatsUsdPattern = SatsUsdPattern(client, 'dca_class_2026_average_price') + self._2015: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'dca_class_2015_average_price') + self._2016: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'dca_class_2016_average_price') + self._2017: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'dca_class_2017_average_price') + self._2018: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'dca_class_2018_average_price') + self._2019: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'dca_class_2019_average_price') + self._2020: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'dca_class_2020_average_price') + self._2021: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'dca_class_2021_average_price') + self._2022: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'dca_class_2022_average_price') + self._2023: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'dca_class_2023_average_price') + self._2024: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'dca_class_2024_average_price') + self._2025: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'dca_class_2025_average_price') + self._2026: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'dca_class_2026_average_price') class MetricsTree_Market_Dca_ClassDaysInProfit: """Metrics tree node.""" @@ -4445,9 +4456,9 @@ class MetricsTree_Prices_Split: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.open: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_open') - self.high: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_high') - self.low: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_low') + self.open: CentsSatsUsdPattern2 = CentsSatsUsdPattern2(client, 'price_open') + self.high: CentsSatsUsdPattern2 = CentsSatsUsdPattern2(client, 'price_high') + self.low: CentsSatsUsdPattern2 = CentsSatsUsdPattern2(client, 'price_low') self.close: MetricsTree_Prices_Split_Close = MetricsTree_Prices_Split_Close(client) class MetricsTree_Prices_Ohlc: