mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-06-10 23:13:33 -07:00
computer: fixes
This commit is contained in:
@@ -858,7 +858,7 @@ impl<T: DeserializeOwned> MetricPattern<T> for MetricPattern32<T> { fn get(&self
|
||||
// Reusable pattern structs
|
||||
|
||||
/// Pattern struct for repeated tree structure.
|
||||
pub struct AdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern {
|
||||
pub struct AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern {
|
||||
pub adjusted_sopr: MetricPattern6<StoredF64>,
|
||||
pub adjusted_sopr_30d_ema: MetricPattern6<StoredF64>,
|
||||
pub adjusted_sopr_7d_ema: MetricPattern6<StoredF64>,
|
||||
@@ -866,14 +866,13 @@ pub struct AdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRe
|
||||
pub adjusted_value_destroyed: MetricPattern1<Dollars>,
|
||||
pub cap_raw: MetricPattern11<CentsSats>,
|
||||
pub capitulation_flow: MetricPattern1<Dollars>,
|
||||
pub ceiling_price: DollarsSatsPattern,
|
||||
pub floor_price: DollarsSatsPattern,
|
||||
pub investor_cap_raw: MetricPattern11<CentsSquaredSats>,
|
||||
pub investor_price: DollarsSatsPattern,
|
||||
pub investor_price_cents: MetricPattern1<CentsUnsigned>,
|
||||
pub investor_price_extra: RatioPattern,
|
||||
pub loss_value_created: MetricPattern1<Dollars>,
|
||||
pub loss_value_destroyed: MetricPattern1<Dollars>,
|
||||
pub lower_price_band: DollarsSatsPattern,
|
||||
pub mvrv: MetricPattern4<StoredF32>,
|
||||
pub neg_realized_loss: CumulativeSumPattern2<Dollars>,
|
||||
pub net_realized_pnl: CumulativeSumPattern<Dollars>,
|
||||
@@ -912,11 +911,12 @@ pub struct AdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRe
|
||||
pub sopr_30d_ema: MetricPattern6<StoredF64>,
|
||||
pub sopr_7d_ema: MetricPattern6<StoredF64>,
|
||||
pub total_realized_pnl: MetricPattern1<Dollars>,
|
||||
pub upper_price_band: DollarsSatsPattern,
|
||||
pub value_created: MetricPattern1<Dollars>,
|
||||
pub value_destroyed: MetricPattern1<Dollars>,
|
||||
}
|
||||
|
||||
impl AdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern {
|
||||
impl AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern {
|
||||
/// Create a new pattern node with accumulated metric name.
|
||||
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
|
||||
Self {
|
||||
@@ -927,14 +927,13 @@ impl AdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealized
|
||||
adjusted_value_destroyed: MetricPattern1::new(client.clone(), _m(&acc, "adjusted_value_destroyed")),
|
||||
cap_raw: MetricPattern11::new(client.clone(), _m(&acc, "cap_raw")),
|
||||
capitulation_flow: MetricPattern1::new(client.clone(), _m(&acc, "capitulation_flow")),
|
||||
ceiling_price: DollarsSatsPattern::new(client.clone(), _m(&acc, "ceiling_price")),
|
||||
floor_price: DollarsSatsPattern::new(client.clone(), _m(&acc, "floor_price")),
|
||||
investor_cap_raw: MetricPattern11::new(client.clone(), _m(&acc, "investor_cap_raw")),
|
||||
investor_price: DollarsSatsPattern::new(client.clone(), _m(&acc, "investor_price")),
|
||||
investor_price_cents: MetricPattern1::new(client.clone(), _m(&acc, "investor_price_cents")),
|
||||
investor_price_extra: RatioPattern::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: DollarsSatsPattern::new(client.clone(), _m(&acc, "lower_price_band")),
|
||||
mvrv: MetricPattern4::new(client.clone(), _m(&acc, "mvrv")),
|
||||
neg_realized_loss: CumulativeSumPattern2::new(client.clone(), _m(&acc, "neg_realized_loss")),
|
||||
net_realized_pnl: CumulativeSumPattern::new(client.clone(), _m(&acc, "net_realized_pnl")),
|
||||
@@ -973,6 +972,7 @@ impl AdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealized
|
||||
sopr_30d_ema: MetricPattern6::new(client.clone(), _m(&acc, "sopr_30d_ema")),
|
||||
sopr_7d_ema: MetricPattern6::new(client.clone(), _m(&acc, "sopr_7d_ema")),
|
||||
total_realized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "total_realized_pnl")),
|
||||
upper_price_band: DollarsSatsPattern::new(client.clone(), _m(&acc, "upper_price_band")),
|
||||
value_created: MetricPattern1::new(client.clone(), _m(&acc, "value_created")),
|
||||
value_destroyed: MetricPattern1::new(client.clone(), _m(&acc, "value_destroyed")),
|
||||
}
|
||||
@@ -980,7 +980,7 @@ impl AdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealized
|
||||
}
|
||||
|
||||
/// Pattern struct for repeated tree structure.
|
||||
pub struct AdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern2 {
|
||||
pub struct AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern2 {
|
||||
pub adjusted_sopr: MetricPattern6<StoredF64>,
|
||||
pub adjusted_sopr_30d_ema: MetricPattern6<StoredF64>,
|
||||
pub adjusted_sopr_7d_ema: MetricPattern6<StoredF64>,
|
||||
@@ -988,14 +988,13 @@ pub struct AdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRe
|
||||
pub adjusted_value_destroyed: MetricPattern1<Dollars>,
|
||||
pub cap_raw: MetricPattern11<CentsSats>,
|
||||
pub capitulation_flow: MetricPattern1<Dollars>,
|
||||
pub ceiling_price: DollarsSatsPattern,
|
||||
pub floor_price: DollarsSatsPattern,
|
||||
pub investor_cap_raw: MetricPattern11<CentsSquaredSats>,
|
||||
pub investor_price: DollarsSatsPattern,
|
||||
pub investor_price_cents: MetricPattern1<CentsUnsigned>,
|
||||
pub investor_price_extra: RatioPattern2,
|
||||
pub loss_value_created: MetricPattern1<Dollars>,
|
||||
pub loss_value_destroyed: MetricPattern1<Dollars>,
|
||||
pub lower_price_band: DollarsSatsPattern,
|
||||
pub mvrv: MetricPattern4<StoredF32>,
|
||||
pub neg_realized_loss: CumulativeSumPattern2<Dollars>,
|
||||
pub net_realized_pnl: CumulativeSumPattern<Dollars>,
|
||||
@@ -1032,11 +1031,12 @@ pub struct AdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRe
|
||||
pub sopr_30d_ema: MetricPattern6<StoredF64>,
|
||||
pub sopr_7d_ema: MetricPattern6<StoredF64>,
|
||||
pub total_realized_pnl: MetricPattern1<Dollars>,
|
||||
pub upper_price_band: DollarsSatsPattern,
|
||||
pub value_created: MetricPattern1<Dollars>,
|
||||
pub value_destroyed: MetricPattern1<Dollars>,
|
||||
}
|
||||
|
||||
impl AdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern2 {
|
||||
impl AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern2 {
|
||||
/// Create a new pattern node with accumulated metric name.
|
||||
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
|
||||
Self {
|
||||
@@ -1047,14 +1047,13 @@ impl AdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealized
|
||||
adjusted_value_destroyed: MetricPattern1::new(client.clone(), _m(&acc, "adjusted_value_destroyed")),
|
||||
cap_raw: MetricPattern11::new(client.clone(), _m(&acc, "cap_raw")),
|
||||
capitulation_flow: MetricPattern1::new(client.clone(), _m(&acc, "capitulation_flow")),
|
||||
ceiling_price: DollarsSatsPattern::new(client.clone(), _m(&acc, "ceiling_price")),
|
||||
floor_price: DollarsSatsPattern::new(client.clone(), _m(&acc, "floor_price")),
|
||||
investor_cap_raw: MetricPattern11::new(client.clone(), _m(&acc, "investor_cap_raw")),
|
||||
investor_price: DollarsSatsPattern::new(client.clone(), _m(&acc, "investor_price")),
|
||||
investor_price_cents: MetricPattern1::new(client.clone(), _m(&acc, "investor_price_cents")),
|
||||
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: DollarsSatsPattern::new(client.clone(), _m(&acc, "lower_price_band")),
|
||||
mvrv: MetricPattern4::new(client.clone(), _m(&acc, "mvrv")),
|
||||
neg_realized_loss: CumulativeSumPattern2::new(client.clone(), _m(&acc, "neg_realized_loss")),
|
||||
net_realized_pnl: CumulativeSumPattern::new(client.clone(), _m(&acc, "net_realized_pnl")),
|
||||
@@ -1091,6 +1090,7 @@ impl AdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealized
|
||||
sopr_30d_ema: MetricPattern6::new(client.clone(), _m(&acc, "sopr_30d_ema")),
|
||||
sopr_7d_ema: MetricPattern6::new(client.clone(), _m(&acc, "sopr_7d_ema")),
|
||||
total_realized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "total_realized_pnl")),
|
||||
upper_price_band: DollarsSatsPattern::new(client.clone(), _m(&acc, "upper_price_band")),
|
||||
value_created: MetricPattern1::new(client.clone(), _m(&acc, "value_created")),
|
||||
value_destroyed: MetricPattern1::new(client.clone(), _m(&acc, "value_destroyed")),
|
||||
}
|
||||
@@ -1098,17 +1098,16 @@ impl AdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealized
|
||||
}
|
||||
|
||||
/// Pattern struct for repeated tree structure.
|
||||
pub struct CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern2 {
|
||||
pub struct CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern2 {
|
||||
pub cap_raw: MetricPattern11<CentsSats>,
|
||||
pub capitulation_flow: MetricPattern1<Dollars>,
|
||||
pub ceiling_price: DollarsSatsPattern,
|
||||
pub floor_price: DollarsSatsPattern,
|
||||
pub investor_cap_raw: MetricPattern11<CentsSquaredSats>,
|
||||
pub investor_price: DollarsSatsPattern,
|
||||
pub investor_price_cents: MetricPattern1<CentsUnsigned>,
|
||||
pub investor_price_extra: RatioPattern,
|
||||
pub loss_value_created: MetricPattern1<Dollars>,
|
||||
pub loss_value_destroyed: MetricPattern1<Dollars>,
|
||||
pub lower_price_band: DollarsSatsPattern,
|
||||
pub mvrv: MetricPattern4<StoredF32>,
|
||||
pub neg_realized_loss: CumulativeSumPattern2<Dollars>,
|
||||
pub net_realized_pnl: CumulativeSumPattern<Dollars>,
|
||||
@@ -1147,24 +1146,24 @@ pub struct CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSe
|
||||
pub sopr_30d_ema: MetricPattern6<StoredF64>,
|
||||
pub sopr_7d_ema: MetricPattern6<StoredF64>,
|
||||
pub total_realized_pnl: MetricPattern1<Dollars>,
|
||||
pub upper_price_band: DollarsSatsPattern,
|
||||
pub value_created: MetricPattern1<Dollars>,
|
||||
pub value_destroyed: MetricPattern1<Dollars>,
|
||||
}
|
||||
|
||||
impl CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern2 {
|
||||
impl CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern2 {
|
||||
/// Create a new pattern node with accumulated metric name.
|
||||
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
|
||||
Self {
|
||||
cap_raw: MetricPattern11::new(client.clone(), _m(&acc, "cap_raw")),
|
||||
capitulation_flow: MetricPattern1::new(client.clone(), _m(&acc, "capitulation_flow")),
|
||||
ceiling_price: DollarsSatsPattern::new(client.clone(), _m(&acc, "ceiling_price")),
|
||||
floor_price: DollarsSatsPattern::new(client.clone(), _m(&acc, "floor_price")),
|
||||
investor_cap_raw: MetricPattern11::new(client.clone(), _m(&acc, "investor_cap_raw")),
|
||||
investor_price: DollarsSatsPattern::new(client.clone(), _m(&acc, "investor_price")),
|
||||
investor_price_cents: MetricPattern1::new(client.clone(), _m(&acc, "investor_price_cents")),
|
||||
investor_price_extra: RatioPattern::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: DollarsSatsPattern::new(client.clone(), _m(&acc, "lower_price_band")),
|
||||
mvrv: MetricPattern4::new(client.clone(), _m(&acc, "mvrv")),
|
||||
neg_realized_loss: CumulativeSumPattern2::new(client.clone(), _m(&acc, "neg_realized_loss")),
|
||||
net_realized_pnl: CumulativeSumPattern::new(client.clone(), _m(&acc, "net_realized_pnl")),
|
||||
@@ -1203,6 +1202,7 @@ impl CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSent
|
||||
sopr_30d_ema: MetricPattern6::new(client.clone(), _m(&acc, "sopr_30d_ema")),
|
||||
sopr_7d_ema: MetricPattern6::new(client.clone(), _m(&acc, "sopr_7d_ema")),
|
||||
total_realized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "total_realized_pnl")),
|
||||
upper_price_band: DollarsSatsPattern::new(client.clone(), _m(&acc, "upper_price_band")),
|
||||
value_created: MetricPattern1::new(client.clone(), _m(&acc, "value_created")),
|
||||
value_destroyed: MetricPattern1::new(client.clone(), _m(&acc, "value_destroyed")),
|
||||
}
|
||||
@@ -1210,17 +1210,16 @@ impl CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSent
|
||||
}
|
||||
|
||||
/// Pattern struct for repeated tree structure.
|
||||
pub struct CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern {
|
||||
pub struct CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern {
|
||||
pub cap_raw: MetricPattern11<CentsSats>,
|
||||
pub capitulation_flow: MetricPattern1<Dollars>,
|
||||
pub ceiling_price: DollarsSatsPattern,
|
||||
pub floor_price: DollarsSatsPattern,
|
||||
pub investor_cap_raw: MetricPattern11<CentsSquaredSats>,
|
||||
pub investor_price: DollarsSatsPattern,
|
||||
pub investor_price_cents: MetricPattern1<CentsUnsigned>,
|
||||
pub investor_price_extra: RatioPattern2,
|
||||
pub loss_value_created: MetricPattern1<Dollars>,
|
||||
pub loss_value_destroyed: MetricPattern1<Dollars>,
|
||||
pub lower_price_band: DollarsSatsPattern,
|
||||
pub mvrv: MetricPattern4<StoredF32>,
|
||||
pub neg_realized_loss: CumulativeSumPattern2<Dollars>,
|
||||
pub net_realized_pnl: CumulativeSumPattern<Dollars>,
|
||||
@@ -1257,24 +1256,24 @@ pub struct CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSe
|
||||
pub sopr_30d_ema: MetricPattern6<StoredF64>,
|
||||
pub sopr_7d_ema: MetricPattern6<StoredF64>,
|
||||
pub total_realized_pnl: MetricPattern1<Dollars>,
|
||||
pub upper_price_band: DollarsSatsPattern,
|
||||
pub value_created: MetricPattern1<Dollars>,
|
||||
pub value_destroyed: MetricPattern1<Dollars>,
|
||||
}
|
||||
|
||||
impl CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern {
|
||||
impl CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern {
|
||||
/// Create a new pattern node with accumulated metric name.
|
||||
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
|
||||
Self {
|
||||
cap_raw: MetricPattern11::new(client.clone(), _m(&acc, "cap_raw")),
|
||||
capitulation_flow: MetricPattern1::new(client.clone(), _m(&acc, "capitulation_flow")),
|
||||
ceiling_price: DollarsSatsPattern::new(client.clone(), _m(&acc, "ceiling_price")),
|
||||
floor_price: DollarsSatsPattern::new(client.clone(), _m(&acc, "floor_price")),
|
||||
investor_cap_raw: MetricPattern11::new(client.clone(), _m(&acc, "investor_cap_raw")),
|
||||
investor_price: DollarsSatsPattern::new(client.clone(), _m(&acc, "investor_price")),
|
||||
investor_price_cents: MetricPattern1::new(client.clone(), _m(&acc, "investor_price_cents")),
|
||||
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: DollarsSatsPattern::new(client.clone(), _m(&acc, "lower_price_band")),
|
||||
mvrv: MetricPattern4::new(client.clone(), _m(&acc, "mvrv")),
|
||||
neg_realized_loss: CumulativeSumPattern2::new(client.clone(), _m(&acc, "neg_realized_loss")),
|
||||
net_realized_pnl: CumulativeSumPattern::new(client.clone(), _m(&acc, "net_realized_pnl")),
|
||||
@@ -1311,6 +1310,7 @@ impl CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSent
|
||||
sopr_30d_ema: MetricPattern6::new(client.clone(), _m(&acc, "sopr_30d_ema")),
|
||||
sopr_7d_ema: MetricPattern6::new(client.clone(), _m(&acc, "sopr_7d_ema")),
|
||||
total_realized_pnl: MetricPattern1::new(client.clone(), _m(&acc, "total_realized_pnl")),
|
||||
upper_price_band: DollarsSatsPattern::new(client.clone(), _m(&acc, "upper_price_band")),
|
||||
value_created: MetricPattern1::new(client.clone(), _m(&acc, "value_created")),
|
||||
value_destroyed: MetricPattern1::new(client.clone(), _m(&acc, "value_destroyed")),
|
||||
}
|
||||
@@ -2048,7 +2048,7 @@ pub struct ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern {
|
||||
pub addr_count_30d_change: MetricPattern4<StoredF64>,
|
||||
pub cost_basis: MaxMinPattern,
|
||||
pub outputs: UtxoPattern,
|
||||
pub realized: CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern,
|
||||
pub realized: CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern,
|
||||
pub relative: InvestedNegNetNuplSupplyUnrealizedPattern,
|
||||
pub supply: _30dHalvedTotalPattern,
|
||||
pub unrealized: GreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern,
|
||||
@@ -2063,7 +2063,7 @@ impl ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern {
|
||||
addr_count_30d_change: MetricPattern4::new(client.clone(), _m(&acc, "addr_count_30d_change")),
|
||||
cost_basis: MaxMinPattern::new(client.clone(), acc.clone()),
|
||||
outputs: UtxoPattern::new(client.clone(), _m(&acc, "utxo_count")),
|
||||
realized: CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern::new(client.clone(), acc.clone()),
|
||||
realized: CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern::new(client.clone(), acc.clone()),
|
||||
relative: InvestedNegNetNuplSupplyUnrealizedPattern::new(client.clone(), acc.clone()),
|
||||
supply: _30dHalvedTotalPattern::new(client.clone(), acc.clone()),
|
||||
unrealized: GreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern::new(client.clone(), acc.clone()),
|
||||
@@ -2192,7 +2192,7 @@ pub struct ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern {
|
||||
pub activity: CoinblocksCoindaysSatblocksSatdaysSentPattern,
|
||||
pub cost_basis: InvestedMaxMinPercentilesSpotPattern,
|
||||
pub outputs: UtxoPattern,
|
||||
pub realized: CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern2,
|
||||
pub realized: CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern2,
|
||||
pub relative: InvestedNegNetSupplyUnrealizedPattern,
|
||||
pub supply: _30dHalvedTotalPattern,
|
||||
pub unrealized: GreedInvestedInvestorNegNetPainPeakSupplyTotalUnrealizedPattern,
|
||||
@@ -2205,7 +2205,7 @@ impl ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern {
|
||||
activity: CoinblocksCoindaysSatblocksSatdaysSentPattern::new(client.clone(), acc.clone()),
|
||||
cost_basis: InvestedMaxMinPercentilesSpotPattern::new(client.clone(), acc.clone()),
|
||||
outputs: UtxoPattern::new(client.clone(), _m(&acc, "utxo_count")),
|
||||
realized: CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern2::new(client.clone(), acc.clone()),
|
||||
realized: CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern2::new(client.clone(), acc.clone()),
|
||||
relative: InvestedNegNetSupplyUnrealizedPattern::new(client.clone(), acc.clone()),
|
||||
supply: _30dHalvedTotalPattern::new(client.clone(), acc.clone()),
|
||||
unrealized: GreedInvestedInvestorNegNetPainPeakSupplyTotalUnrealizedPattern::new(client.clone(), acc.clone()),
|
||||
@@ -2218,7 +2218,7 @@ pub struct ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5 {
|
||||
pub activity: CoinblocksCoindaysSatblocksSatdaysSentPattern,
|
||||
pub cost_basis: MaxMinPattern,
|
||||
pub outputs: UtxoPattern,
|
||||
pub realized: AdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern2,
|
||||
pub realized: AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern2,
|
||||
pub relative: InvestedNegNetNuplSupplyUnrealizedPattern3,
|
||||
pub supply: _30dHalvedTotalPattern,
|
||||
pub unrealized: GreedInvestedInvestorNegNetPainPeakSupplyTotalUnrealizedPattern,
|
||||
@@ -2231,7 +2231,7 @@ impl ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5 {
|
||||
activity: CoinblocksCoindaysSatblocksSatdaysSentPattern::new(client.clone(), acc.clone()),
|
||||
cost_basis: MaxMinPattern::new(client.clone(), acc.clone()),
|
||||
outputs: UtxoPattern::new(client.clone(), _m(&acc, "utxo_count")),
|
||||
realized: AdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern2::new(client.clone(), acc.clone()),
|
||||
realized: AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern2::new(client.clone(), acc.clone()),
|
||||
relative: InvestedNegNetNuplSupplyUnrealizedPattern3::new(client.clone(), acc.clone()),
|
||||
supply: _30dHalvedTotalPattern::new(client.clone(), acc.clone()),
|
||||
unrealized: GreedInvestedInvestorNegNetPainPeakSupplyTotalUnrealizedPattern::new(client.clone(), acc.clone()),
|
||||
@@ -2244,7 +2244,7 @@ pub struct ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 {
|
||||
pub activity: CoinblocksCoindaysSatblocksSatdaysSentPattern,
|
||||
pub cost_basis: MaxMinPattern,
|
||||
pub outputs: UtxoPattern,
|
||||
pub realized: CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern,
|
||||
pub realized: CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern,
|
||||
pub relative: InvestedNegNetNuplSupplyUnrealizedPattern,
|
||||
pub supply: _30dHalvedTotalPattern,
|
||||
pub unrealized: GreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern,
|
||||
@@ -2257,7 +2257,7 @@ impl ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 {
|
||||
activity: CoinblocksCoindaysSatblocksSatdaysSentPattern::new(client.clone(), acc.clone()),
|
||||
cost_basis: MaxMinPattern::new(client.clone(), acc.clone()),
|
||||
outputs: UtxoPattern::new(client.clone(), _m(&acc, "utxo_count")),
|
||||
realized: CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern::new(client.clone(), acc.clone()),
|
||||
realized: CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern::new(client.clone(), acc.clone()),
|
||||
relative: InvestedNegNetNuplSupplyUnrealizedPattern::new(client.clone(), acc.clone()),
|
||||
supply: _30dHalvedTotalPattern::new(client.clone(), acc.clone()),
|
||||
unrealized: GreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern::new(client.clone(), acc.clone()),
|
||||
@@ -2270,7 +2270,7 @@ pub struct ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern6 {
|
||||
pub activity: CoinblocksCoindaysSatblocksSatdaysSentPattern,
|
||||
pub cost_basis: MaxMinPattern,
|
||||
pub outputs: UtxoPattern,
|
||||
pub realized: CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern,
|
||||
pub realized: CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern,
|
||||
pub relative: InvestedNegNetNuplSupplyUnrealizedPattern3,
|
||||
pub supply: _30dHalvedTotalPattern,
|
||||
pub unrealized: GreedInvestedInvestorNegNetPainPeakSupplyTotalUnrealizedPattern,
|
||||
@@ -2283,7 +2283,7 @@ impl ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern6 {
|
||||
activity: CoinblocksCoindaysSatblocksSatdaysSentPattern::new(client.clone(), acc.clone()),
|
||||
cost_basis: MaxMinPattern::new(client.clone(), acc.clone()),
|
||||
outputs: UtxoPattern::new(client.clone(), _m(&acc, "utxo_count")),
|
||||
realized: CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern::new(client.clone(), acc.clone()),
|
||||
realized: CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern::new(client.clone(), acc.clone()),
|
||||
relative: InvestedNegNetNuplSupplyUnrealizedPattern3::new(client.clone(), acc.clone()),
|
||||
supply: _30dHalvedTotalPattern::new(client.clone(), acc.clone()),
|
||||
unrealized: GreedInvestedInvestorNegNetPainPeakSupplyTotalUnrealizedPattern::new(client.clone(), acc.clone()),
|
||||
@@ -2296,7 +2296,7 @@ pub struct ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 {
|
||||
pub activity: CoinblocksCoindaysSatblocksSatdaysSentPattern,
|
||||
pub cost_basis: MaxMinPattern,
|
||||
pub outputs: UtxoPattern,
|
||||
pub realized: CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern,
|
||||
pub realized: CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern,
|
||||
pub relative: InvestedSupplyPattern,
|
||||
pub supply: _30dHalvedTotalPattern,
|
||||
pub unrealized: GreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern,
|
||||
@@ -2309,7 +2309,7 @@ impl ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 {
|
||||
activity: CoinblocksCoindaysSatblocksSatdaysSentPattern::new(client.clone(), acc.clone()),
|
||||
cost_basis: MaxMinPattern::new(client.clone(), acc.clone()),
|
||||
outputs: UtxoPattern::new(client.clone(), _m(&acc, "utxo_count")),
|
||||
realized: CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern::new(client.clone(), acc.clone()),
|
||||
realized: CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern::new(client.clone(), acc.clone()),
|
||||
relative: InvestedSupplyPattern::new(client.clone(), acc.clone()),
|
||||
supply: _30dHalvedTotalPattern::new(client.clone(), acc.clone()),
|
||||
unrealized: GreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern::new(client.clone(), acc.clone()),
|
||||
@@ -2322,7 +2322,7 @@ pub struct ActivityCostOutputsRealizedSupplyUnrealizedPattern {
|
||||
pub activity: CoinblocksCoindaysSatblocksSatdaysSentPattern,
|
||||
pub cost_basis: MaxMinPattern,
|
||||
pub outputs: UtxoPattern,
|
||||
pub realized: CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern,
|
||||
pub realized: CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern,
|
||||
pub supply: _30dHalvedTotalPattern,
|
||||
pub unrealized: GreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern,
|
||||
}
|
||||
@@ -2334,7 +2334,7 @@ impl ActivityCostOutputsRealizedSupplyUnrealizedPattern {
|
||||
activity: CoinblocksCoindaysSatblocksSatdaysSentPattern::new(client.clone(), acc.clone()),
|
||||
cost_basis: MaxMinPattern::new(client.clone(), acc.clone()),
|
||||
outputs: UtxoPattern::new(client.clone(), _m(&acc, "utxo_count")),
|
||||
realized: CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern::new(client.clone(), acc.clone()),
|
||||
realized: CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern::new(client.clone(), acc.clone()),
|
||||
supply: _30dHalvedTotalPattern::new(client.clone(), acc.clone()),
|
||||
unrealized: GreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern::new(client.clone(), acc.clone()),
|
||||
}
|
||||
@@ -5256,7 +5256,7 @@ pub struct MetricsTree_Distribution_UtxoCohorts_All {
|
||||
pub supply: _30dHalvedTotalPattern,
|
||||
pub outputs: UtxoPattern,
|
||||
pub activity: CoinblocksCoindaysSatblocksSatdaysSentPattern,
|
||||
pub realized: AdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern,
|
||||
pub realized: AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern,
|
||||
pub unrealized: GreedInvestedInvestorNegNetPainPeakSupplyTotalUnrealizedPattern,
|
||||
pub cost_basis: InvestedMaxMinPercentilesSpotPattern,
|
||||
pub relative: MetricsTree_Distribution_UtxoCohorts_All_Relative,
|
||||
@@ -5268,7 +5268,7 @@ impl MetricsTree_Distribution_UtxoCohorts_All {
|
||||
supply: _30dHalvedTotalPattern::new(client.clone(), "".to_string()),
|
||||
outputs: UtxoPattern::new(client.clone(), "utxo_count".to_string()),
|
||||
activity: CoinblocksCoindaysSatblocksSatdaysSentPattern::new(client.clone(), "".to_string()),
|
||||
realized: AdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern::new(client.clone(), "".to_string()),
|
||||
realized: AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern::new(client.clone(), "".to_string()),
|
||||
unrealized: GreedInvestedInvestorNegNetPainPeakSupplyTotalUnrealizedPattern::new(client.clone(), "".to_string()),
|
||||
cost_basis: InvestedMaxMinPercentilesSpotPattern::new(client.clone(), "".to_string()),
|
||||
relative: MetricsTree_Distribution_UtxoCohorts_All_Relative::new(client.clone(), format!("{base_path}_relative")),
|
||||
@@ -5581,7 +5581,7 @@ pub struct MetricsTree_Distribution_UtxoCohorts_Term_Short {
|
||||
pub supply: _30dHalvedTotalPattern,
|
||||
pub outputs: UtxoPattern,
|
||||
pub activity: CoinblocksCoindaysSatblocksSatdaysSentPattern,
|
||||
pub realized: AdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern,
|
||||
pub realized: AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern,
|
||||
pub unrealized: GreedInvestedInvestorNegNetPainPeakSupplyTotalUnrealizedPattern,
|
||||
pub cost_basis: InvestedMaxMinPercentilesSpotPattern,
|
||||
pub relative: InvestedNegNetNuplSupplyUnrealizedPattern4,
|
||||
@@ -5593,7 +5593,7 @@ impl MetricsTree_Distribution_UtxoCohorts_Term_Short {
|
||||
supply: _30dHalvedTotalPattern::new(client.clone(), "sth".to_string()),
|
||||
outputs: UtxoPattern::new(client.clone(), "sth_utxo_count".to_string()),
|
||||
activity: CoinblocksCoindaysSatblocksSatdaysSentPattern::new(client.clone(), "sth".to_string()),
|
||||
realized: AdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern::new(client.clone(), "sth".to_string()),
|
||||
realized: AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern::new(client.clone(), "sth".to_string()),
|
||||
unrealized: GreedInvestedInvestorNegNetPainPeakSupplyTotalUnrealizedPattern::new(client.clone(), "sth".to_string()),
|
||||
cost_basis: InvestedMaxMinPercentilesSpotPattern::new(client.clone(), "sth".to_string()),
|
||||
relative: InvestedNegNetNuplSupplyUnrealizedPattern4::new(client.clone(), "sth".to_string()),
|
||||
@@ -5606,7 +5606,7 @@ pub struct MetricsTree_Distribution_UtxoCohorts_Term_Long {
|
||||
pub supply: _30dHalvedTotalPattern,
|
||||
pub outputs: UtxoPattern,
|
||||
pub activity: CoinblocksCoindaysSatblocksSatdaysSentPattern,
|
||||
pub realized: CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern2,
|
||||
pub realized: CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern2,
|
||||
pub unrealized: GreedInvestedInvestorNegNetPainPeakSupplyTotalUnrealizedPattern,
|
||||
pub cost_basis: InvestedMaxMinPercentilesSpotPattern,
|
||||
pub relative: InvestedNegNetNuplSupplyUnrealizedPattern4,
|
||||
@@ -5618,7 +5618,7 @@ impl MetricsTree_Distribution_UtxoCohorts_Term_Long {
|
||||
supply: _30dHalvedTotalPattern::new(client.clone(), "lth".to_string()),
|
||||
outputs: UtxoPattern::new(client.clone(), "lth_utxo_count".to_string()),
|
||||
activity: CoinblocksCoindaysSatblocksSatdaysSentPattern::new(client.clone(), "lth".to_string()),
|
||||
realized: CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern2::new(client.clone(), "lth".to_string()),
|
||||
realized: CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern2::new(client.clone(), "lth".to_string()),
|
||||
unrealized: GreedInvestedInvestorNegNetPainPeakSupplyTotalUnrealizedPattern::new(client.clone(), "lth".to_string()),
|
||||
cost_basis: InvestedMaxMinPercentilesSpotPattern::new(client.clone(), "lth".to_string()),
|
||||
relative: InvestedNegNetNuplSupplyUnrealizedPattern4::new(client.clone(), "lth".to_string()),
|
||||
|
||||
@@ -45,8 +45,8 @@ pub struct RealizedMetrics {
|
||||
pub investor_price_extra: ComputedFromDateRatio,
|
||||
|
||||
// === Floor/Ceiling Price Bands (lazy: realized²/investor, investor²/realized) ===
|
||||
pub floor_price: LazyBinaryPriceFromHeight,
|
||||
pub ceiling_price: LazyBinaryPriceFromHeight,
|
||||
pub lower_price_band: LazyBinaryPriceFromHeight,
|
||||
pub upper_price_band: LazyBinaryPriceFromHeight,
|
||||
|
||||
// === Raw values for aggregation (needed to compute investor_price for aggregated cohorts) ===
|
||||
/// Raw Σ(price × sats) for realized cap aggregation
|
||||
@@ -292,24 +292,22 @@ impl RealizedMetrics {
|
||||
)?;
|
||||
|
||||
// Floor price = realized² / investor (lower band)
|
||||
let floor_price = LazyBinaryPriceFromHeight::forced_import::<DollarsSquaredDivide>(
|
||||
cfg.db,
|
||||
&cfg.name("floor_price"),
|
||||
cfg.version,
|
||||
realized_price.dollars.height.boxed_clone(),
|
||||
investor_price.dollars.height.boxed_clone(),
|
||||
cfg.indexes,
|
||||
)?;
|
||||
let lower_price_band =
|
||||
LazyBinaryPriceFromHeight::from_price_and_lazy_price::<DollarsSquaredDivide>(
|
||||
&cfg.name("lower_price_band"),
|
||||
cfg.version,
|
||||
&realized_price,
|
||||
&investor_price,
|
||||
);
|
||||
|
||||
// Ceiling price = investor² / realized (upper band)
|
||||
let ceiling_price = LazyBinaryPriceFromHeight::forced_import::<DollarsSquaredDivide>(
|
||||
cfg.db,
|
||||
&cfg.name("ceiling_price"),
|
||||
cfg.version,
|
||||
investor_price.dollars.height.boxed_clone(),
|
||||
realized_price.dollars.height.boxed_clone(),
|
||||
cfg.indexes,
|
||||
)?;
|
||||
let upper_price_band =
|
||||
LazyBinaryPriceFromHeight::from_lazy_price_and_price::<DollarsSquaredDivide>(
|
||||
&cfg.name("upper_price_band"),
|
||||
cfg.version,
|
||||
&investor_price,
|
||||
&realized_price,
|
||||
);
|
||||
|
||||
// Raw values for aggregation
|
||||
let cap_raw = BytesVec::forced_import(cfg.db, &cfg.name("cap_raw"), cfg.version)?;
|
||||
@@ -456,8 +454,8 @@ impl RealizedMetrics {
|
||||
investor_price_extra,
|
||||
|
||||
// === Floor/Ceiling Price Bands ===
|
||||
floor_price,
|
||||
ceiling_price,
|
||||
lower_price_band,
|
||||
upper_price_band,
|
||||
|
||||
cap_raw,
|
||||
investor_cap_raw,
|
||||
@@ -1178,10 +1176,6 @@ impl RealizedMetrics {
|
||||
)?;
|
||||
}
|
||||
|
||||
// Floor/ceiling price bands (derive stored dateindex from lazy height)
|
||||
self.floor_price.dollars.derive_from(indexes, starting_indexes, exit)?;
|
||||
self.ceiling_price.dollars.derive_from(indexes, starting_indexes, exit)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,11 +68,17 @@ impl CohortState {
|
||||
}
|
||||
|
||||
pub fn cost_basis_data_first_key_value(&self) -> Option<(CentsUnsigned, &Sats)> {
|
||||
self.cost_basis_data.as_ref()?.first_key_value().map(|(k, v)| (k.into(), v))
|
||||
self.cost_basis_data
|
||||
.as_ref()?
|
||||
.first_key_value()
|
||||
.map(|(k, v)| (k.into(), v))
|
||||
}
|
||||
|
||||
pub fn cost_basis_data_last_key_value(&self) -> Option<(CentsUnsigned, &Sats)> {
|
||||
self.cost_basis_data.as_ref()?.last_key_value().map(|(k, v)| (k.into(), v))
|
||||
self.cost_basis_data
|
||||
.as_ref()?
|
||||
.last_key_value()
|
||||
.map(|(k, v)| (k.into(), v))
|
||||
}
|
||||
|
||||
pub fn reset_single_iteration_values(&mut self) {
|
||||
@@ -94,11 +100,10 @@ impl CohortState {
|
||||
pub fn increment_snapshot(&mut self, s: &CostBasisSnapshot) {
|
||||
self.supply += &s.supply_state;
|
||||
|
||||
if s.supply_state.value > Sats::ZERO && self.realized.is_some() {
|
||||
self.realized
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.increment_snapshot(s.price_sats, s.investor_cap);
|
||||
if s.supply_state.value > Sats::ZERO
|
||||
&& let Some(realized) = self.realized.as_mut()
|
||||
{
|
||||
realized.increment_snapshot(s.price_sats, s.investor_cap);
|
||||
self.cost_basis_data.as_mut().unwrap().increment(
|
||||
s.realized_price,
|
||||
s.supply_state.value,
|
||||
@@ -118,11 +123,10 @@ impl CohortState {
|
||||
pub fn decrement_snapshot(&mut self, s: &CostBasisSnapshot) {
|
||||
self.supply -= &s.supply_state;
|
||||
|
||||
if s.supply_state.value > Sats::ZERO && self.realized.is_some() {
|
||||
self.realized
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.decrement_snapshot(s.price_sats, s.investor_cap);
|
||||
if s.supply_state.value > Sats::ZERO
|
||||
&& let Some(realized) = self.realized.as_mut()
|
||||
{
|
||||
realized.decrement_snapshot(s.price_sats, s.investor_cap);
|
||||
self.cost_basis_data.as_mut().unwrap().decrement(
|
||||
s.realized_price,
|
||||
s.supply_state.value,
|
||||
@@ -147,12 +151,10 @@ impl CohortState {
|
||||
|
||||
realized.receive(price, sats);
|
||||
|
||||
self.cost_basis_data.as_mut().unwrap().increment(
|
||||
price,
|
||||
sats,
|
||||
price_sats,
|
||||
investor_cap,
|
||||
);
|
||||
self.cost_basis_data
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.increment(price, sats, price_sats, investor_cap);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -298,7 +300,10 @@ impl CohortState {
|
||||
) -> (UnrealizedState, Option<UnrealizedState>) {
|
||||
match self.cost_basis_data.as_mut() {
|
||||
Some(p) => p.compute_unrealized_states(height_price, date_price),
|
||||
None => (UnrealizedState::ZERO, date_price.map(|_| UnrealizedState::ZERO)),
|
||||
None => (
|
||||
UnrealizedState::ZERO,
|
||||
date_price.map(|_| UnrealizedState::ZERO),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -310,16 +315,22 @@ impl CohortState {
|
||||
}
|
||||
|
||||
pub fn min_price(&self) -> Option<CentsUnsigned> {
|
||||
self.cost_basis_data.as_ref()?.first_key_value().map(|(k, _)| k.into())
|
||||
self.cost_basis_data
|
||||
.as_ref()?
|
||||
.first_key_value()
|
||||
.map(|(k, _)| k.into())
|
||||
}
|
||||
|
||||
pub fn max_price(&self) -> Option<CentsUnsigned> {
|
||||
self.cost_basis_data.as_ref()?.last_key_value().map(|(k, _)| k.into())
|
||||
self.cost_basis_data
|
||||
.as_ref()?
|
||||
.last_key_value()
|
||||
.map(|(k, _)| k.into())
|
||||
}
|
||||
|
||||
pub fn cost_basis_data_iter(
|
||||
&self,
|
||||
) -> Option<impl Iterator<Item = (CentsUnsigned, &Sats)>> {
|
||||
self.cost_basis_data.as_ref().map(|p| p.iter().map(|(k, v)| (k.into(), v)))
|
||||
pub fn cost_basis_data_iter(&self) -> Option<impl Iterator<Item = (CentsUnsigned, &Sats)>> {
|
||||
self.cost_basis_data
|
||||
.as_ref()
|
||||
.map(|p| p.iter().map(|(k, v)| (k.into(), v)))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -457,6 +457,88 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
/// Create from a ComputedFromHeightLast (block last with derived dates) and a LazyFromHeightLast.
|
||||
pub fn from_block_last_and_lazy_block_last<F, S2SourceT>(
|
||||
name: &str,
|
||||
version: Version,
|
||||
source1: &ComputedFromHeightLast<S1T>,
|
||||
source2: &LazyFromHeightLast<S2T, S2SourceT>,
|
||||
) -> Self
|
||||
where
|
||||
F: BinaryTransform<S1T, S2T, T>,
|
||||
S1T: NumericValue,
|
||||
S2SourceT: ComputedVecValue + JsonSchema,
|
||||
{
|
||||
let v = version + VERSION;
|
||||
|
||||
macro_rules! period {
|
||||
($p:ident) => {
|
||||
LazyBinaryTransformLast::from_vecs::<F>(
|
||||
name,
|
||||
v,
|
||||
source1.$p.boxed_clone(),
|
||||
source2.$p.boxed_clone(),
|
||||
)
|
||||
};
|
||||
}
|
||||
|
||||
Self {
|
||||
dateindex: LazyVecFrom2::transformed::<F>(
|
||||
name,
|
||||
v,
|
||||
source1.dateindex.boxed_clone(),
|
||||
source2.dateindex.boxed_clone(),
|
||||
),
|
||||
weekindex: period!(weekindex),
|
||||
monthindex: period!(monthindex),
|
||||
quarterindex: period!(quarterindex),
|
||||
semesterindex: period!(semesterindex),
|
||||
yearindex: period!(yearindex),
|
||||
decadeindex: period!(decadeindex),
|
||||
}
|
||||
}
|
||||
|
||||
/// Create from a LazyFromHeightLast and a ComputedFromHeightLast (reversed source order).
|
||||
pub fn from_lazy_block_last_and_block_last<F, S1SourceT>(
|
||||
name: &str,
|
||||
version: Version,
|
||||
source1: &LazyFromHeightLast<S1T, S1SourceT>,
|
||||
source2: &ComputedFromHeightLast<S2T>,
|
||||
) -> Self
|
||||
where
|
||||
F: BinaryTransform<S1T, S2T, T>,
|
||||
S2T: NumericValue,
|
||||
S1SourceT: ComputedVecValue + JsonSchema,
|
||||
{
|
||||
let v = version + VERSION;
|
||||
|
||||
macro_rules! period {
|
||||
($p:ident) => {
|
||||
LazyBinaryTransformLast::from_vecs::<F>(
|
||||
name,
|
||||
v,
|
||||
source1.$p.boxed_clone(),
|
||||
source2.$p.boxed_clone(),
|
||||
)
|
||||
};
|
||||
}
|
||||
|
||||
Self {
|
||||
dateindex: LazyVecFrom2::transformed::<F>(
|
||||
name,
|
||||
v,
|
||||
source1.dateindex.boxed_clone(),
|
||||
source2.dateindex.boxed_clone(),
|
||||
),
|
||||
weekindex: period!(weekindex),
|
||||
monthindex: period!(monthindex),
|
||||
quarterindex: period!(quarterindex),
|
||||
semesterindex: period!(semesterindex),
|
||||
yearindex: period!(yearindex),
|
||||
decadeindex: period!(decadeindex),
|
||||
}
|
||||
}
|
||||
|
||||
/// Create from a LazyDateDerivedLast source and a BinaryDateLast source.
|
||||
pub fn from_derived_last_and_binary_last<F, S2aT, S2bT>(
|
||||
name: &str,
|
||||
|
||||
@@ -7,7 +7,7 @@ use brk_types::{
|
||||
use schemars::JsonSchema;
|
||||
use vecdb::{IterableBoxedVec, IterableCloneableVec, UnaryTransform};
|
||||
|
||||
use crate::internal::{ComputedFromHeightLast, ComputedFromDateLast, ComputedVecValue, LazyDateDerivedLast, LazyTransformLast, NumericValue};
|
||||
use crate::internal::{ComputedFromHeightLast, ComputedFromDateLast, ComputedVecValue, LazyBinaryFromDateLast, LazyDateDerivedLast, LazyTransformLast, NumericValue};
|
||||
|
||||
const VERSION: Version = Version::ZERO;
|
||||
|
||||
@@ -84,4 +84,34 @@ where
|
||||
{
|
||||
Self::from_derived::<F>(name, version, source.dateindex.boxed_clone(), &source.dates)
|
||||
}
|
||||
|
||||
/// Create by unary-transforming a LazyBinaryFromDateLast source.
|
||||
pub fn from_binary<F, S1aT, S1bT>(
|
||||
name: &str,
|
||||
version: Version,
|
||||
source: &LazyBinaryFromDateLast<S1T, S1aT, S1bT>,
|
||||
) -> Self
|
||||
where
|
||||
F: UnaryTransform<S1T, T>,
|
||||
S1aT: ComputedVecValue + JsonSchema,
|
||||
S1bT: ComputedVecValue + JsonSchema,
|
||||
{
|
||||
let v = version + VERSION;
|
||||
|
||||
macro_rules! period {
|
||||
($p:ident) => {
|
||||
LazyTransformLast::from_boxed::<F>(name, v, source.$p.boxed_clone())
|
||||
};
|
||||
}
|
||||
|
||||
Self {
|
||||
dateindex: period!(dateindex),
|
||||
weekindex: period!(weekindex),
|
||||
monthindex: period!(monthindex),
|
||||
quarterindex: period!(quarterindex),
|
||||
semesterindex: period!(semesterindex),
|
||||
yearindex: period!(yearindex),
|
||||
decadeindex: period!(decadeindex),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
//!
|
||||
//! Both dollars and sats are computed from the same source.
|
||||
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use brk_traversable::Traversable;
|
||||
use brk_types::{Dollars, SatsFract, Version};
|
||||
use derive_more::{Deref, DerefMut};
|
||||
@@ -28,7 +30,7 @@ where
|
||||
}
|
||||
|
||||
/// Composed transform: ST -> Dollars -> SatsFract
|
||||
pub struct ComposedDollarsToSatsFract<F>(std::marker::PhantomData<F>);
|
||||
pub struct ComposedDollarsToSatsFract<F>(PhantomData<F>);
|
||||
|
||||
impl<F, ST> UnaryTransform<ST, SatsFract> for ComposedDollarsToSatsFract<F>
|
||||
where
|
||||
|
||||
@@ -80,6 +80,58 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from_block_last_and_lazy_block_last<F, S2SourceT>(
|
||||
name: &str,
|
||||
version: Version,
|
||||
source1: &ComputedFromHeightLast<S1T>,
|
||||
source2: &LazyFromHeightLast<S2T, S2SourceT>,
|
||||
) -> Self
|
||||
where
|
||||
F: BinaryTransform<S1T, S2T, T>,
|
||||
S1T: NumericValue,
|
||||
S2SourceT: ComputedVecValue + JsonSchema,
|
||||
{
|
||||
let v = version + VERSION;
|
||||
|
||||
Self {
|
||||
height: LazyVecFrom2::transformed::<F>(
|
||||
name,
|
||||
v,
|
||||
source1.height.boxed_clone(),
|
||||
source2.height.boxed_clone(),
|
||||
),
|
||||
rest: LazyBinaryHeightDerivedLast::from_block_last_and_lazy_block_last::<F, _>(
|
||||
name, v, source1, source2,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from_lazy_block_last_and_block_last<F, S1SourceT>(
|
||||
name: &str,
|
||||
version: Version,
|
||||
source1: &LazyFromHeightLast<S1T, S1SourceT>,
|
||||
source2: &ComputedFromHeightLast<S2T>,
|
||||
) -> Self
|
||||
where
|
||||
F: BinaryTransform<S1T, S2T, T>,
|
||||
S2T: NumericValue,
|
||||
S1SourceT: ComputedVecValue + JsonSchema,
|
||||
{
|
||||
let v = version + VERSION;
|
||||
|
||||
Self {
|
||||
height: LazyVecFrom2::transformed::<F>(
|
||||
name,
|
||||
v,
|
||||
source1.height.boxed_clone(),
|
||||
source2.height.boxed_clone(),
|
||||
),
|
||||
rest: LazyBinaryHeightDerivedLast::from_lazy_block_last_and_block_last::<F, _>(
|
||||
name, v, source1, source2,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from_computed_height_date_last<F: BinaryTransform<S1T, S2T, T>>(
|
||||
name: &str,
|
||||
version: Version,
|
||||
|
||||
@@ -1,63 +1,72 @@
|
||||
//! Lazy binary price wrapper with both USD and sats representations.
|
||||
//! Fully lazy binary price wrapper with both USD and sats representations.
|
||||
//!
|
||||
//! Height-level value is lazy binary: transform(source1[h], source2[h]).
|
||||
//! Sats are derived lazily from the dollars output.
|
||||
//! All levels (height, dateindex, date periods, difficultyepoch) are lazy.
|
||||
//! Derives dateindex from the two source dateindexes rather than storing it.
|
||||
|
||||
use brk_error::Result;
|
||||
use brk_traversable::Traversable;
|
||||
use brk_types::{Dollars, Height, SatsFract, Version};
|
||||
use brk_types::{CentsUnsigned, Dollars, SatsFract, Version};
|
||||
use derive_more::{Deref, DerefMut};
|
||||
use schemars::JsonSchema;
|
||||
use vecdb::{BinaryTransform, Database, IterableBoxedVec, IterableCloneableVec};
|
||||
use vecdb::BinaryTransform;
|
||||
|
||||
use super::LazyBinaryComputedFromHeightLast;
|
||||
use crate::{
|
||||
indexes,
|
||||
internal::{ComputedVecValue, DollarsToSatsFract, LazyFromHeightLast, NumericValue},
|
||||
use crate::internal::{
|
||||
DollarsToSatsFract, LazyBinaryFromHeightLast, LazyFromHeightLast, LazyPriceFromCents,
|
||||
PriceFromHeight,
|
||||
};
|
||||
|
||||
/// Lazy binary price metric with both USD and sats representations.
|
||||
/// Fully lazy binary price metric with both USD and sats representations.
|
||||
///
|
||||
/// Dollars: lazy binary transform at height, stored at dateindex.
|
||||
/// Sats: lazy unary transform of dollars (fully lazy).
|
||||
/// Dollars: lazy binary transform at all levels (height, dateindex, date periods, difficultyepoch).
|
||||
/// Sats: lazy unary transform of dollars.
|
||||
#[derive(Clone, Deref, DerefMut, Traversable)]
|
||||
#[traversable(merge)]
|
||||
pub struct LazyBinaryPriceFromHeight<S1T = Dollars, S2T = Dollars>
|
||||
where
|
||||
S1T: ComputedVecValue + JsonSchema,
|
||||
S2T: ComputedVecValue + JsonSchema,
|
||||
{
|
||||
pub struct LazyBinaryPriceFromHeight {
|
||||
#[deref]
|
||||
#[deref_mut]
|
||||
#[traversable(flatten)]
|
||||
pub dollars: LazyBinaryComputedFromHeightLast<Dollars, S1T, S2T>,
|
||||
pub dollars: LazyBinaryFromHeightLast<Dollars, Dollars, Dollars>,
|
||||
pub sats: LazyFromHeightLast<SatsFract, Dollars>,
|
||||
}
|
||||
|
||||
impl<S1T, S2T> LazyBinaryPriceFromHeight<S1T, S2T>
|
||||
where
|
||||
S1T: NumericValue + JsonSchema,
|
||||
S2T: NumericValue + JsonSchema,
|
||||
{
|
||||
pub fn forced_import<F: BinaryTransform<S1T, S2T, Dollars>>(
|
||||
db: &Database,
|
||||
impl LazyBinaryPriceFromHeight {
|
||||
/// Create from a PriceFromHeight (source1) and a LazyPriceFromCents (source2).
|
||||
pub fn from_price_and_lazy_price<F: BinaryTransform<Dollars, Dollars, Dollars>>(
|
||||
name: &str,
|
||||
version: Version,
|
||||
source1: IterableBoxedVec<Height, S1T>,
|
||||
source2: IterableBoxedVec<Height, S2T>,
|
||||
indexes: &indexes::Vecs,
|
||||
) -> Result<Self> {
|
||||
let dollars = LazyBinaryComputedFromHeightLast::forced_import::<F>(
|
||||
db, name, version, source1, source2, indexes,
|
||||
)?;
|
||||
source1: &PriceFromHeight,
|
||||
source2: &LazyPriceFromCents,
|
||||
) -> Self {
|
||||
let dollars = LazyBinaryFromHeightLast::from_block_last_and_lazy_block_last::<
|
||||
F,
|
||||
CentsUnsigned,
|
||||
>(name, version, &source1.dollars, &source2.dollars);
|
||||
|
||||
let sats = LazyFromHeightLast::from_lazy_binary_computed::<DollarsToSatsFract, S1T, S2T>(
|
||||
let sats = LazyFromHeightLast::from_binary::<DollarsToSatsFract, _, _>(
|
||||
&format!("{name}_sats"),
|
||||
version,
|
||||
dollars.height.boxed_clone(),
|
||||
&dollars,
|
||||
);
|
||||
|
||||
Ok(Self { dollars, sats })
|
||||
Self { dollars, sats }
|
||||
}
|
||||
|
||||
/// Create from a LazyPriceFromCents (source1) and a PriceFromHeight (source2).
|
||||
pub fn from_lazy_price_and_price<F: BinaryTransform<Dollars, Dollars, Dollars>>(
|
||||
name: &str,
|
||||
version: Version,
|
||||
source1: &LazyPriceFromCents,
|
||||
source2: &PriceFromHeight,
|
||||
) -> Self {
|
||||
let dollars = LazyBinaryFromHeightLast::from_lazy_block_last_and_block_last::<
|
||||
F,
|
||||
CentsUnsigned,
|
||||
>(name, version, &source1.dollars, &source2.dollars);
|
||||
|
||||
let sats = LazyFromHeightLast::from_binary::<DollarsToSatsFract, _, _>(
|
||||
&format!("{name}_sats"),
|
||||
version,
|
||||
&dollars,
|
||||
);
|
||||
|
||||
Self { dollars, sats }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,8 @@ use vecdb::{IterableBoxedVec, IterableCloneableVec, LazyVecFrom1, UnaryTransform
|
||||
|
||||
use crate::internal::{
|
||||
ComputedFromHeightAndDateLast, ComputedFromHeightLast, ComputedHeightDerivedLast,
|
||||
ComputedVecValue, LazyBinaryComputedFromHeightLast, LazyHeightDerivedLast, NumericValue,
|
||||
ComputedVecValue, LazyBinaryComputedFromHeightLast, LazyBinaryFromHeightLast,
|
||||
LazyHeightDerivedLast, NumericValue,
|
||||
};
|
||||
#[derive(Clone, Deref, DerefMut, Traversable)]
|
||||
#[traversable(merge)]
|
||||
@@ -96,4 +97,22 @@ where
|
||||
rest: LazyHeightDerivedLast::from_derived_computed::<F>(name, v, &source.rest),
|
||||
}
|
||||
}
|
||||
|
||||
/// Create by unary-transforming a LazyBinaryFromHeightLast source.
|
||||
pub fn from_binary<F, S1aT, S1bT>(
|
||||
name: &str,
|
||||
version: Version,
|
||||
source: &LazyBinaryFromHeightLast<S1T, S1aT, S1bT>,
|
||||
) -> Self
|
||||
where
|
||||
F: UnaryTransform<S1T, T>,
|
||||
S1aT: ComputedVecValue + JsonSchema,
|
||||
S1bT: ComputedVecValue + JsonSchema,
|
||||
{
|
||||
let v = version + VERSION;
|
||||
Self {
|
||||
height: LazyVecFrom1::transformed::<F>(name, v, source.height.boxed_clone()),
|
||||
rest: LazyHeightDerivedLast::from_binary::<F, _, _>(name, v, &source.rest),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,30 +5,30 @@ mod binary_sum_cum;
|
||||
mod distribution;
|
||||
mod full;
|
||||
mod last;
|
||||
mod lazy_distribution;
|
||||
mod lazy_full;
|
||||
mod lazy_transform_distribution;
|
||||
mod lazy_binary_computed_distribution;
|
||||
mod lazy_binary_computed_full;
|
||||
mod lazy_binary_computed_last;
|
||||
mod lazy_binary_price;
|
||||
mod lazy_binary_computed_sum;
|
||||
mod lazy_binary_computed_sum_cum;
|
||||
mod lazy_binary_price;
|
||||
mod lazy_computed_full;
|
||||
mod lazy_computed_sum_cum;
|
||||
mod lazy_distribution;
|
||||
mod lazy_full;
|
||||
mod lazy_last;
|
||||
mod lazy_price_from_cents;
|
||||
mod lazy_sum;
|
||||
mod price;
|
||||
mod unary_last;
|
||||
mod lazy_sum_cum;
|
||||
mod lazy_transform_distribution;
|
||||
mod lazy_value;
|
||||
mod price;
|
||||
mod sum;
|
||||
mod sum_cum;
|
||||
mod unary_last;
|
||||
mod value_binary;
|
||||
mod value_full;
|
||||
mod value_last;
|
||||
mod value_lazy_binary_last;
|
||||
mod lazy_value;
|
||||
mod value_lazy_computed_sum_cum;
|
||||
mod value_lazy_last;
|
||||
mod value_lazy_sum_cum;
|
||||
@@ -42,30 +42,30 @@ pub use binary_sum_cum::*;
|
||||
pub use distribution::*;
|
||||
pub use full::*;
|
||||
pub use last::*;
|
||||
pub use lazy_distribution::*;
|
||||
pub use lazy_full::*;
|
||||
pub use lazy_transform_distribution::*;
|
||||
pub use lazy_binary_computed_distribution::*;
|
||||
pub use lazy_binary_computed_full::*;
|
||||
pub use lazy_binary_computed_last::*;
|
||||
pub use lazy_binary_price::*;
|
||||
pub use lazy_binary_computed_sum::*;
|
||||
pub use lazy_binary_computed_sum_cum::*;
|
||||
pub use lazy_binary_price::*;
|
||||
pub use lazy_computed_full::*;
|
||||
pub use lazy_computed_sum_cum::*;
|
||||
pub use lazy_distribution::*;
|
||||
pub use lazy_full::*;
|
||||
pub use lazy_last::*;
|
||||
pub use lazy_price_from_cents::*;
|
||||
pub use lazy_sum::*;
|
||||
pub use price::*;
|
||||
pub use unary_last::*;
|
||||
pub use lazy_sum_cum::*;
|
||||
pub use lazy_transform_distribution::*;
|
||||
pub use lazy_value::*;
|
||||
pub use price::*;
|
||||
pub use sum::*;
|
||||
pub use sum_cum::*;
|
||||
pub use unary_last::*;
|
||||
pub use value_binary::*;
|
||||
pub use value_full::*;
|
||||
pub use value_last::*;
|
||||
pub use value_lazy_binary_last::*;
|
||||
pub use lazy_value::*;
|
||||
pub use value_lazy_computed_sum_cum::*;
|
||||
pub use value_lazy_last::*;
|
||||
pub use value_lazy_sum_cum::*;
|
||||
|
||||
@@ -86,6 +86,32 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from_lazy_block_last_and_block_last<F, S1SourceT>(
|
||||
name: &str,
|
||||
version: Version,
|
||||
source1: &LazyFromHeightLast<S1T, S1SourceT>,
|
||||
source2: &ComputedFromHeightLast<S2T>,
|
||||
) -> Self
|
||||
where
|
||||
F: BinaryTransform<S1T, S2T, T>,
|
||||
S2T: NumericValue,
|
||||
S1SourceT: ComputedVecValue + JsonSchema,
|
||||
{
|
||||
let v = version + VERSION;
|
||||
|
||||
Self {
|
||||
dates: LazyBinaryFromDateLast::from_lazy_block_last_and_block_last::<F, _>(
|
||||
name, v, source1, source2,
|
||||
),
|
||||
difficultyepoch: LazyBinaryTransformLast::from_vecs::<F>(
|
||||
name,
|
||||
v,
|
||||
source1.rest.difficultyepoch.boxed_clone(),
|
||||
source2.rest.difficultyepoch.boxed_clone(),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from_computed_height_date_last<F: BinaryTransform<S1T, S2T, T>>(
|
||||
name: &str,
|
||||
version: Version,
|
||||
@@ -114,6 +140,32 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from_block_last_and_lazy_block_last<F, S2SourceT>(
|
||||
name: &str,
|
||||
version: Version,
|
||||
source1: &ComputedFromHeightLast<S1T>,
|
||||
source2: &LazyFromHeightLast<S2T, S2SourceT>,
|
||||
) -> Self
|
||||
where
|
||||
F: BinaryTransform<S1T, S2T, T>,
|
||||
S1T: NumericValue,
|
||||
S2SourceT: ComputedVecValue + JsonSchema,
|
||||
{
|
||||
let v = version + VERSION;
|
||||
|
||||
Self {
|
||||
dates: LazyBinaryFromDateLast::from_block_last_and_lazy_block_last::<F, _>(
|
||||
name, v, source1, source2,
|
||||
),
|
||||
difficultyepoch: LazyBinaryTransformLast::from_vecs::<F>(
|
||||
name,
|
||||
v,
|
||||
source1.rest.difficultyepoch.boxed_clone(),
|
||||
source2.rest.difficultyepoch.boxed_clone(),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from_computed_height_date_and_block_last<F: BinaryTransform<S1T, S2T, T>>(
|
||||
name: &str,
|
||||
version: Version,
|
||||
|
||||
@@ -8,7 +8,7 @@ use vecdb::{IterableCloneableVec, UnaryTransform};
|
||||
|
||||
use crate::internal::{
|
||||
ComputedFromHeightLast, ComputedHeightDerivedLast, ComputedFromHeightAndDateLast, ComputedVecValue,
|
||||
LazyFromDateLast, LazyTransformLast, NumericValue,
|
||||
LazyBinaryHeightDerivedLast, LazyFromDateLast, LazyTransformLast, NumericValue,
|
||||
};
|
||||
|
||||
#[derive(Clone, Deref, DerefMut, Traversable)]
|
||||
@@ -81,6 +81,29 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
/// Create by unary-transforming a LazyBinaryHeightDerivedLast source.
|
||||
pub fn from_binary<F, S1aT, S1bT>(
|
||||
name: &str,
|
||||
version: Version,
|
||||
source: &LazyBinaryHeightDerivedLast<S1T, S1aT, S1bT>,
|
||||
) -> Self
|
||||
where
|
||||
F: UnaryTransform<S1T, T>,
|
||||
S1aT: ComputedVecValue + JsonSchema,
|
||||
S1bT: ComputedVecValue + JsonSchema,
|
||||
{
|
||||
let v = version + VERSION;
|
||||
|
||||
Self {
|
||||
dates: LazyFromDateLast::from_binary::<F, _, _>(name, v, &source.dates),
|
||||
difficultyepoch: LazyTransformLast::from_boxed::<F>(
|
||||
name,
|
||||
v,
|
||||
source.difficultyepoch.boxed_clone(),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from_computed_height_date<F: UnaryTransform<S1T, T>>(
|
||||
name: &str,
|
||||
version: Version,
|
||||
|
||||
@@ -3,11 +3,11 @@ mod cents_unsigned_to_sats_fract;
|
||||
mod close_price_times_sats;
|
||||
mod difference_f32;
|
||||
mod dollar_halve;
|
||||
mod dollars_squared_divide;
|
||||
mod dollar_identity;
|
||||
mod dollar_minus;
|
||||
mod dollar_plus;
|
||||
mod dollar_times_tenths;
|
||||
mod dollars_squared_divide;
|
||||
mod dollars_to_sats_fract;
|
||||
mod f32_identity;
|
||||
mod half_close_price_times_sats;
|
||||
@@ -46,11 +46,11 @@ pub use cents_unsigned_to_sats_fract::*;
|
||||
pub use close_price_times_sats::*;
|
||||
pub use difference_f32::*;
|
||||
pub use dollar_halve::*;
|
||||
pub use dollars_squared_divide::*;
|
||||
pub use dollar_identity::*;
|
||||
pub use dollar_minus::*;
|
||||
pub use dollar_plus::*;
|
||||
pub use dollar_times_tenths::*;
|
||||
pub use dollars_squared_divide::*;
|
||||
pub use dollars_to_sats_fract::*;
|
||||
pub use f32_identity::*;
|
||||
pub use half_close_price_times_sats::*;
|
||||
|
||||
@@ -180,6 +180,24 @@ impl Div<usize> for CentsSigned {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<CentsSigned> for i128 {
|
||||
#[inline]
|
||||
fn from(value: CentsSigned) -> Self {
|
||||
value.0 as i128
|
||||
}
|
||||
}
|
||||
|
||||
impl From<i128> for CentsSigned {
|
||||
#[inline]
|
||||
fn from(value: i128) -> Self {
|
||||
debug_assert!(
|
||||
value >= i64::MIN as i128 && value <= i64::MAX as i128,
|
||||
"i128 overflow to CentsSigned"
|
||||
);
|
||||
Self(value as i64)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<u128> for CentsSigned {
|
||||
#[inline]
|
||||
fn from(value: u128) -> Self {
|
||||
|
||||
@@ -6,7 +6,7 @@ use crate::CentsUnsigned;
|
||||
|
||||
/// Bucket type for cost basis aggregation.
|
||||
/// Options: raw (no aggregation), lin200/lin500/lin1000 (linear $200/$500/$1000),
|
||||
/// log10/log50/log100 (logarithmic with 10/50/100 buckets per decade).
|
||||
/// log10/log50/log100/log200 (logarithmic with 10/50/100/200 buckets per decade).
|
||||
#[derive(
|
||||
Debug, Display, Clone, Copy, Default, PartialEq, Eq, Deserialize, Serialize, JsonSchema,
|
||||
)]
|
||||
@@ -21,6 +21,7 @@ pub enum CostBasisBucket {
|
||||
Log10,
|
||||
Log50,
|
||||
Log100,
|
||||
Log200,
|
||||
}
|
||||
|
||||
impl CostBasisBucket {
|
||||
@@ -40,6 +41,7 @@ impl CostBasisBucket {
|
||||
Self::Log10 => Some(10),
|
||||
Self::Log50 => Some(50),
|
||||
Self::Log100 => Some(100),
|
||||
Self::Log200 => Some(200),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
@@ -53,7 +55,7 @@ impl CostBasisBucket {
|
||||
let size = self.linear_size_cents().unwrap();
|
||||
Some((price_cents / size) * size)
|
||||
}
|
||||
Self::Log10 | Self::Log50 | Self::Log100 => {
|
||||
Self::Log10 | Self::Log50 | Self::Log100 | Self::Log200 => {
|
||||
if price_cents == CentsUnsigned::ZERO {
|
||||
return Some(CentsUnsigned::ZERO);
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ impl CostBasisDistribution {
|
||||
let v = match value {
|
||||
CostBasisValue::Supply => f64::from(Bitcoin::from(sats)),
|
||||
CostBasisValue::Realized => f64::from(realized),
|
||||
CostBasisValue::Unrealized => f64::from(spot * sats),
|
||||
CostBasisValue::Unrealized => f64::from((spot - k) * sats),
|
||||
};
|
||||
(k, v)
|
||||
})
|
||||
|
||||
@@ -270,9 +270,9 @@ impl Mul<Sats> for Dollars {
|
||||
if self.is_nan() {
|
||||
self
|
||||
} else {
|
||||
Self::from(CentsSigned::from(
|
||||
u128::from(rhs) * u128::from(CentsSigned::from(self)) / Sats::ONE_BTC_U128,
|
||||
))
|
||||
let cents = i128::from(CentsSigned::from(self));
|
||||
let sats = rhs.as_u128() as i128;
|
||||
Self::from(CentsSigned::from(sats * cents / Sats::ONE_BTC_U128 as i128))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,24 +26,22 @@ pub async fn index_handler(
|
||||
fn serve(website: &Website, path: &str, request_headers: &HeaderMap) -> Result<Response<Body>> {
|
||||
let path = sanitize(path);
|
||||
|
||||
let is_html = path.is_empty()
|
||||
|| Path::new(&path).extension().is_none()
|
||||
|| path.ends_with(".html");
|
||||
let is_html =
|
||||
path.is_empty() || Path::new(&path).extension().is_none() || path.ends_with(".html");
|
||||
|
||||
// Etag 304 check (release mode, HTML only)
|
||||
if is_html {
|
||||
if let Some(etag) = website.index_etag() {
|
||||
if request_headers.has_etag(etag) {
|
||||
let mut response = Response::builder()
|
||||
.status(StatusCode::NOT_MODIFIED)
|
||||
.body(Body::empty())
|
||||
.unwrap();
|
||||
let headers = response.headers_mut();
|
||||
headers.insert_etag(etag);
|
||||
headers.insert_cache_control_must_revalidate();
|
||||
return Ok(response);
|
||||
}
|
||||
}
|
||||
if is_html
|
||||
&& let Some(etag) = website.index_etag()
|
||||
&& request_headers.has_etag(etag)
|
||||
{
|
||||
let mut response = Response::builder()
|
||||
.status(StatusCode::NOT_MODIFIED)
|
||||
.body(Body::empty())
|
||||
.unwrap();
|
||||
let headers = response.headers_mut();
|
||||
headers.insert_etag(etag);
|
||||
headers.insert_cache_control_must_revalidate();
|
||||
return Ok(response);
|
||||
}
|
||||
|
||||
let content = website.get_file(&path)?;
|
||||
|
||||
+54
-54
@@ -199,9 +199,9 @@
|
||||
/**
|
||||
* Bucket type for cost basis aggregation.
|
||||
* Options: raw (no aggregation), lin200/lin500/lin1000 (linear $200/$500/$1000),
|
||||
* log10/log50/log100 (logarithmic with 10/50/100 buckets per decade).
|
||||
* log10/log50/log100/log200 (logarithmic with 10/50/100/200 buckets per decade).
|
||||
*
|
||||
* @typedef {("raw"|"lin200"|"lin500"|"lin1000"|"log10"|"log50"|"log100")} CostBasisBucket
|
||||
* @typedef {("raw"|"lin200"|"lin500"|"lin1000"|"log10"|"log50"|"log100"|"log200")} CostBasisBucket
|
||||
*/
|
||||
/**
|
||||
* Path parameters for cost basis dates endpoint.
|
||||
@@ -1438,7 +1438,7 @@ function createMetricPattern32(client, name) { return _mp(client, name, _i32); }
|
||||
// Reusable structural pattern factories
|
||||
|
||||
/**
|
||||
* @typedef {Object} AdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern
|
||||
* @typedef {Object} AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern
|
||||
* @property {MetricPattern6<StoredF64>} adjustedSopr
|
||||
* @property {MetricPattern6<StoredF64>} adjustedSopr30dEma
|
||||
* @property {MetricPattern6<StoredF64>} adjustedSopr7dEma
|
||||
@@ -1446,14 +1446,13 @@ function createMetricPattern32(client, name) { return _mp(client, name, _i32); }
|
||||
* @property {MetricPattern1<Dollars>} adjustedValueDestroyed
|
||||
* @property {MetricPattern11<CentsSats>} capRaw
|
||||
* @property {MetricPattern1<Dollars>} capitulationFlow
|
||||
* @property {DollarsSatsPattern} ceilingPrice
|
||||
* @property {DollarsSatsPattern} floorPrice
|
||||
* @property {MetricPattern11<CentsSquaredSats>} investorCapRaw
|
||||
* @property {DollarsSatsPattern} investorPrice
|
||||
* @property {MetricPattern1<CentsUnsigned>} investorPriceCents
|
||||
* @property {RatioPattern} investorPriceExtra
|
||||
* @property {MetricPattern1<Dollars>} lossValueCreated
|
||||
* @property {MetricPattern1<Dollars>} lossValueDestroyed
|
||||
* @property {DollarsSatsPattern} lowerPriceBand
|
||||
* @property {MetricPattern4<StoredF32>} mvrv
|
||||
* @property {CumulativeSumPattern2<Dollars>} negRealizedLoss
|
||||
* @property {CumulativeSumPattern<Dollars>} netRealizedPnl
|
||||
@@ -1492,17 +1491,18 @@ function createMetricPattern32(client, name) { return _mp(client, name, _i32); }
|
||||
* @property {MetricPattern6<StoredF64>} sopr30dEma
|
||||
* @property {MetricPattern6<StoredF64>} sopr7dEma
|
||||
* @property {MetricPattern1<Dollars>} totalRealizedPnl
|
||||
* @property {DollarsSatsPattern} upperPriceBand
|
||||
* @property {MetricPattern1<Dollars>} valueCreated
|
||||
* @property {MetricPattern1<Dollars>} valueDestroyed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create a AdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern pattern node
|
||||
* Create a AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern pattern node
|
||||
* @param {BrkClientBase} client
|
||||
* @param {string} acc - Accumulated metric name
|
||||
* @returns {AdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern}
|
||||
* @returns {AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern}
|
||||
*/
|
||||
function createAdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern(client, acc) {
|
||||
function createAdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern(client, acc) {
|
||||
return {
|
||||
adjustedSopr: createMetricPattern6(client, _m(acc, 'adjusted_sopr')),
|
||||
adjustedSopr30dEma: createMetricPattern6(client, _m(acc, 'adjusted_sopr_30d_ema')),
|
||||
@@ -1511,14 +1511,13 @@ function createAdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProf
|
||||
adjustedValueDestroyed: createMetricPattern1(client, _m(acc, 'adjusted_value_destroyed')),
|
||||
capRaw: createMetricPattern11(client, _m(acc, 'cap_raw')),
|
||||
capitulationFlow: createMetricPattern1(client, _m(acc, 'capitulation_flow')),
|
||||
ceilingPrice: createDollarsSatsPattern(client, _m(acc, 'ceiling_price')),
|
||||
floorPrice: createDollarsSatsPattern(client, _m(acc, 'floor_price')),
|
||||
investorCapRaw: createMetricPattern11(client, _m(acc, 'investor_cap_raw')),
|
||||
investorPrice: createDollarsSatsPattern(client, _m(acc, 'investor_price')),
|
||||
investorPriceCents: createMetricPattern1(client, _m(acc, 'investor_price_cents')),
|
||||
investorPriceExtra: createRatioPattern(client, _m(acc, 'investor_price_ratio')),
|
||||
lossValueCreated: createMetricPattern1(client, _m(acc, 'loss_value_created')),
|
||||
lossValueDestroyed: createMetricPattern1(client, _m(acc, 'loss_value_destroyed')),
|
||||
lowerPriceBand: createDollarsSatsPattern(client, _m(acc, 'lower_price_band')),
|
||||
mvrv: createMetricPattern4(client, _m(acc, 'mvrv')),
|
||||
negRealizedLoss: createCumulativeSumPattern2(client, _m(acc, 'neg_realized_loss')),
|
||||
netRealizedPnl: createCumulativeSumPattern(client, _m(acc, 'net_realized_pnl')),
|
||||
@@ -1557,13 +1556,14 @@ function createAdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProf
|
||||
sopr30dEma: createMetricPattern6(client, _m(acc, 'sopr_30d_ema')),
|
||||
sopr7dEma: createMetricPattern6(client, _m(acc, 'sopr_7d_ema')),
|
||||
totalRealizedPnl: createMetricPattern1(client, _m(acc, 'total_realized_pnl')),
|
||||
upperPriceBand: createDollarsSatsPattern(client, _m(acc, 'upper_price_band')),
|
||||
valueCreated: createMetricPattern1(client, _m(acc, 'value_created')),
|
||||
valueDestroyed: createMetricPattern1(client, _m(acc, 'value_destroyed')),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {Object} AdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern2
|
||||
* @typedef {Object} AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern2
|
||||
* @property {MetricPattern6<StoredF64>} adjustedSopr
|
||||
* @property {MetricPattern6<StoredF64>} adjustedSopr30dEma
|
||||
* @property {MetricPattern6<StoredF64>} adjustedSopr7dEma
|
||||
@@ -1571,14 +1571,13 @@ function createAdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProf
|
||||
* @property {MetricPattern1<Dollars>} adjustedValueDestroyed
|
||||
* @property {MetricPattern11<CentsSats>} capRaw
|
||||
* @property {MetricPattern1<Dollars>} capitulationFlow
|
||||
* @property {DollarsSatsPattern} ceilingPrice
|
||||
* @property {DollarsSatsPattern} floorPrice
|
||||
* @property {MetricPattern11<CentsSquaredSats>} investorCapRaw
|
||||
* @property {DollarsSatsPattern} investorPrice
|
||||
* @property {MetricPattern1<CentsUnsigned>} investorPriceCents
|
||||
* @property {RatioPattern2} investorPriceExtra
|
||||
* @property {MetricPattern1<Dollars>} lossValueCreated
|
||||
* @property {MetricPattern1<Dollars>} lossValueDestroyed
|
||||
* @property {DollarsSatsPattern} lowerPriceBand
|
||||
* @property {MetricPattern4<StoredF32>} mvrv
|
||||
* @property {CumulativeSumPattern2<Dollars>} negRealizedLoss
|
||||
* @property {CumulativeSumPattern<Dollars>} netRealizedPnl
|
||||
@@ -1615,17 +1614,18 @@ function createAdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProf
|
||||
* @property {MetricPattern6<StoredF64>} sopr30dEma
|
||||
* @property {MetricPattern6<StoredF64>} sopr7dEma
|
||||
* @property {MetricPattern1<Dollars>} totalRealizedPnl
|
||||
* @property {DollarsSatsPattern} upperPriceBand
|
||||
* @property {MetricPattern1<Dollars>} valueCreated
|
||||
* @property {MetricPattern1<Dollars>} valueDestroyed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create a AdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern2 pattern node
|
||||
* Create a AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern2 pattern node
|
||||
* @param {BrkClientBase} client
|
||||
* @param {string} acc - Accumulated metric name
|
||||
* @returns {AdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern2}
|
||||
* @returns {AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern2}
|
||||
*/
|
||||
function createAdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern2(client, acc) {
|
||||
function createAdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern2(client, acc) {
|
||||
return {
|
||||
adjustedSopr: createMetricPattern6(client, _m(acc, 'adjusted_sopr')),
|
||||
adjustedSopr30dEma: createMetricPattern6(client, _m(acc, 'adjusted_sopr_30d_ema')),
|
||||
@@ -1634,14 +1634,13 @@ function createAdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProf
|
||||
adjustedValueDestroyed: createMetricPattern1(client, _m(acc, 'adjusted_value_destroyed')),
|
||||
capRaw: createMetricPattern11(client, _m(acc, 'cap_raw')),
|
||||
capitulationFlow: createMetricPattern1(client, _m(acc, 'capitulation_flow')),
|
||||
ceilingPrice: createDollarsSatsPattern(client, _m(acc, 'ceiling_price')),
|
||||
floorPrice: createDollarsSatsPattern(client, _m(acc, 'floor_price')),
|
||||
investorCapRaw: createMetricPattern11(client, _m(acc, 'investor_cap_raw')),
|
||||
investorPrice: createDollarsSatsPattern(client, _m(acc, 'investor_price')),
|
||||
investorPriceCents: createMetricPattern1(client, _m(acc, 'investor_price_cents')),
|
||||
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: createDollarsSatsPattern(client, _m(acc, 'lower_price_band')),
|
||||
mvrv: createMetricPattern4(client, _m(acc, 'mvrv')),
|
||||
negRealizedLoss: createCumulativeSumPattern2(client, _m(acc, 'neg_realized_loss')),
|
||||
netRealizedPnl: createCumulativeSumPattern(client, _m(acc, 'net_realized_pnl')),
|
||||
@@ -1678,23 +1677,23 @@ function createAdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProf
|
||||
sopr30dEma: createMetricPattern6(client, _m(acc, 'sopr_30d_ema')),
|
||||
sopr7dEma: createMetricPattern6(client, _m(acc, 'sopr_7d_ema')),
|
||||
totalRealizedPnl: createMetricPattern1(client, _m(acc, 'total_realized_pnl')),
|
||||
upperPriceBand: createDollarsSatsPattern(client, _m(acc, 'upper_price_band')),
|
||||
valueCreated: createMetricPattern1(client, _m(acc, 'value_created')),
|
||||
valueDestroyed: createMetricPattern1(client, _m(acc, 'value_destroyed')),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {Object} CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern2
|
||||
* @typedef {Object} CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern2
|
||||
* @property {MetricPattern11<CentsSats>} capRaw
|
||||
* @property {MetricPattern1<Dollars>} capitulationFlow
|
||||
* @property {DollarsSatsPattern} ceilingPrice
|
||||
* @property {DollarsSatsPattern} floorPrice
|
||||
* @property {MetricPattern11<CentsSquaredSats>} investorCapRaw
|
||||
* @property {DollarsSatsPattern} investorPrice
|
||||
* @property {MetricPattern1<CentsUnsigned>} investorPriceCents
|
||||
* @property {RatioPattern} investorPriceExtra
|
||||
* @property {MetricPattern1<Dollars>} lossValueCreated
|
||||
* @property {MetricPattern1<Dollars>} lossValueDestroyed
|
||||
* @property {DollarsSatsPattern} lowerPriceBand
|
||||
* @property {MetricPattern4<StoredF32>} mvrv
|
||||
* @property {CumulativeSumPattern2<Dollars>} negRealizedLoss
|
||||
* @property {CumulativeSumPattern<Dollars>} netRealizedPnl
|
||||
@@ -1733,28 +1732,28 @@ function createAdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProf
|
||||
* @property {MetricPattern6<StoredF64>} sopr30dEma
|
||||
* @property {MetricPattern6<StoredF64>} sopr7dEma
|
||||
* @property {MetricPattern1<Dollars>} totalRealizedPnl
|
||||
* @property {DollarsSatsPattern} upperPriceBand
|
||||
* @property {MetricPattern1<Dollars>} valueCreated
|
||||
* @property {MetricPattern1<Dollars>} valueDestroyed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create a CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern2 pattern node
|
||||
* Create a CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern2 pattern node
|
||||
* @param {BrkClientBase} client
|
||||
* @param {string} acc - Accumulated metric name
|
||||
* @returns {CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern2}
|
||||
* @returns {CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern2}
|
||||
*/
|
||||
function createCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern2(client, acc) {
|
||||
function createCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern2(client, acc) {
|
||||
return {
|
||||
capRaw: createMetricPattern11(client, _m(acc, 'cap_raw')),
|
||||
capitulationFlow: createMetricPattern1(client, _m(acc, 'capitulation_flow')),
|
||||
ceilingPrice: createDollarsSatsPattern(client, _m(acc, 'ceiling_price')),
|
||||
floorPrice: createDollarsSatsPattern(client, _m(acc, 'floor_price')),
|
||||
investorCapRaw: createMetricPattern11(client, _m(acc, 'investor_cap_raw')),
|
||||
investorPrice: createDollarsSatsPattern(client, _m(acc, 'investor_price')),
|
||||
investorPriceCents: createMetricPattern1(client, _m(acc, 'investor_price_cents')),
|
||||
investorPriceExtra: createRatioPattern(client, _m(acc, 'investor_price_ratio')),
|
||||
lossValueCreated: createMetricPattern1(client, _m(acc, 'loss_value_created')),
|
||||
lossValueDestroyed: createMetricPattern1(client, _m(acc, 'loss_value_destroyed')),
|
||||
lowerPriceBand: createDollarsSatsPattern(client, _m(acc, 'lower_price_band')),
|
||||
mvrv: createMetricPattern4(client, _m(acc, 'mvrv')),
|
||||
negRealizedLoss: createCumulativeSumPattern2(client, _m(acc, 'neg_realized_loss')),
|
||||
netRealizedPnl: createCumulativeSumPattern(client, _m(acc, 'net_realized_pnl')),
|
||||
@@ -1793,23 +1792,23 @@ function createCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealiz
|
||||
sopr30dEma: createMetricPattern6(client, _m(acc, 'sopr_30d_ema')),
|
||||
sopr7dEma: createMetricPattern6(client, _m(acc, 'sopr_7d_ema')),
|
||||
totalRealizedPnl: createMetricPattern1(client, _m(acc, 'total_realized_pnl')),
|
||||
upperPriceBand: createDollarsSatsPattern(client, _m(acc, 'upper_price_band')),
|
||||
valueCreated: createMetricPattern1(client, _m(acc, 'value_created')),
|
||||
valueDestroyed: createMetricPattern1(client, _m(acc, 'value_destroyed')),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {Object} CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern
|
||||
* @typedef {Object} CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern
|
||||
* @property {MetricPattern11<CentsSats>} capRaw
|
||||
* @property {MetricPattern1<Dollars>} capitulationFlow
|
||||
* @property {DollarsSatsPattern} ceilingPrice
|
||||
* @property {DollarsSatsPattern} floorPrice
|
||||
* @property {MetricPattern11<CentsSquaredSats>} investorCapRaw
|
||||
* @property {DollarsSatsPattern} investorPrice
|
||||
* @property {MetricPattern1<CentsUnsigned>} investorPriceCents
|
||||
* @property {RatioPattern2} investorPriceExtra
|
||||
* @property {MetricPattern1<Dollars>} lossValueCreated
|
||||
* @property {MetricPattern1<Dollars>} lossValueDestroyed
|
||||
* @property {DollarsSatsPattern} lowerPriceBand
|
||||
* @property {MetricPattern4<StoredF32>} mvrv
|
||||
* @property {CumulativeSumPattern2<Dollars>} negRealizedLoss
|
||||
* @property {CumulativeSumPattern<Dollars>} netRealizedPnl
|
||||
@@ -1846,28 +1845,28 @@ function createCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealiz
|
||||
* @property {MetricPattern6<StoredF64>} sopr30dEma
|
||||
* @property {MetricPattern6<StoredF64>} sopr7dEma
|
||||
* @property {MetricPattern1<Dollars>} totalRealizedPnl
|
||||
* @property {DollarsSatsPattern} upperPriceBand
|
||||
* @property {MetricPattern1<Dollars>} valueCreated
|
||||
* @property {MetricPattern1<Dollars>} valueDestroyed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create a CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern pattern node
|
||||
* Create a CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern pattern node
|
||||
* @param {BrkClientBase} client
|
||||
* @param {string} acc - Accumulated metric name
|
||||
* @returns {CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern}
|
||||
* @returns {CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern}
|
||||
*/
|
||||
function createCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern(client, acc) {
|
||||
function createCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern(client, acc) {
|
||||
return {
|
||||
capRaw: createMetricPattern11(client, _m(acc, 'cap_raw')),
|
||||
capitulationFlow: createMetricPattern1(client, _m(acc, 'capitulation_flow')),
|
||||
ceilingPrice: createDollarsSatsPattern(client, _m(acc, 'ceiling_price')),
|
||||
floorPrice: createDollarsSatsPattern(client, _m(acc, 'floor_price')),
|
||||
investorCapRaw: createMetricPattern11(client, _m(acc, 'investor_cap_raw')),
|
||||
investorPrice: createDollarsSatsPattern(client, _m(acc, 'investor_price')),
|
||||
investorPriceCents: createMetricPattern1(client, _m(acc, 'investor_price_cents')),
|
||||
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: createDollarsSatsPattern(client, _m(acc, 'lower_price_band')),
|
||||
mvrv: createMetricPattern4(client, _m(acc, 'mvrv')),
|
||||
negRealizedLoss: createCumulativeSumPattern2(client, _m(acc, 'neg_realized_loss')),
|
||||
netRealizedPnl: createCumulativeSumPattern(client, _m(acc, 'net_realized_pnl')),
|
||||
@@ -1904,6 +1903,7 @@ function createCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealiz
|
||||
sopr30dEma: createMetricPattern6(client, _m(acc, 'sopr_30d_ema')),
|
||||
sopr7dEma: createMetricPattern6(client, _m(acc, 'sopr_7d_ema')),
|
||||
totalRealizedPnl: createMetricPattern1(client, _m(acc, 'total_realized_pnl')),
|
||||
upperPriceBand: createDollarsSatsPattern(client, _m(acc, 'upper_price_band')),
|
||||
valueCreated: createMetricPattern1(client, _m(acc, 'value_created')),
|
||||
valueDestroyed: createMetricPattern1(client, _m(acc, 'value_destroyed')),
|
||||
};
|
||||
@@ -2699,7 +2699,7 @@ function createAverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(clie
|
||||
* @property {MetricPattern4<StoredF64>} addrCount30dChange
|
||||
* @property {MaxMinPattern} costBasis
|
||||
* @property {UtxoPattern} outputs
|
||||
* @property {CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern} realized
|
||||
* @property {CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern} realized
|
||||
* @property {InvestedNegNetNuplSupplyUnrealizedPattern} relative
|
||||
* @property {_30dHalvedTotalPattern} supply
|
||||
* @property {GreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern} unrealized
|
||||
@@ -2718,7 +2718,7 @@ function createActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(cl
|
||||
addrCount30dChange: createMetricPattern4(client, _m(acc, 'addr_count_30d_change')),
|
||||
costBasis: createMaxMinPattern(client, acc),
|
||||
outputs: createUtxoPattern(client, _m(acc, 'utxo_count')),
|
||||
realized: createCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern(client, acc),
|
||||
realized: createCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern(client, acc),
|
||||
relative: createInvestedNegNetNuplSupplyUnrealizedPattern(client, acc),
|
||||
supply: create_30dHalvedTotalPattern(client, acc),
|
||||
unrealized: createGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern(client, acc),
|
||||
@@ -2862,7 +2862,7 @@ function create_10y2y3y4y5y6y8yPattern(client, acc) {
|
||||
* @property {CoinblocksCoindaysSatblocksSatdaysSentPattern} activity
|
||||
* @property {InvestedMaxMinPercentilesSpotPattern} costBasis
|
||||
* @property {UtxoPattern} outputs
|
||||
* @property {CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern2} realized
|
||||
* @property {CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern2} realized
|
||||
* @property {InvestedNegNetSupplyUnrealizedPattern} relative
|
||||
* @property {_30dHalvedTotalPattern} supply
|
||||
* @property {GreedInvestedInvestorNegNetPainPeakSupplyTotalUnrealizedPattern} unrealized
|
||||
@@ -2879,7 +2879,7 @@ function createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(client
|
||||
activity: createCoinblocksCoindaysSatblocksSatdaysSentPattern(client, acc),
|
||||
costBasis: createInvestedMaxMinPercentilesSpotPattern(client, acc),
|
||||
outputs: createUtxoPattern(client, _m(acc, 'utxo_count')),
|
||||
realized: createCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern2(client, acc),
|
||||
realized: createCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern2(client, acc),
|
||||
relative: createInvestedNegNetSupplyUnrealizedPattern(client, acc),
|
||||
supply: create_30dHalvedTotalPattern(client, acc),
|
||||
unrealized: createGreedInvestedInvestorNegNetPainPeakSupplyTotalUnrealizedPattern(client, acc),
|
||||
@@ -2891,7 +2891,7 @@ function createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(client
|
||||
* @property {CoinblocksCoindaysSatblocksSatdaysSentPattern} activity
|
||||
* @property {MaxMinPattern} costBasis
|
||||
* @property {UtxoPattern} outputs
|
||||
* @property {AdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern2} realized
|
||||
* @property {AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern2} realized
|
||||
* @property {InvestedNegNetNuplSupplyUnrealizedPattern3} relative
|
||||
* @property {_30dHalvedTotalPattern} supply
|
||||
* @property {GreedInvestedInvestorNegNetPainPeakSupplyTotalUnrealizedPattern} unrealized
|
||||
@@ -2908,7 +2908,7 @@ function createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5(clien
|
||||
activity: createCoinblocksCoindaysSatblocksSatdaysSentPattern(client, acc),
|
||||
costBasis: createMaxMinPattern(client, acc),
|
||||
outputs: createUtxoPattern(client, _m(acc, 'utxo_count')),
|
||||
realized: createAdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern2(client, acc),
|
||||
realized: createAdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern2(client, acc),
|
||||
relative: createInvestedNegNetNuplSupplyUnrealizedPattern3(client, acc),
|
||||
supply: create_30dHalvedTotalPattern(client, acc),
|
||||
unrealized: createGreedInvestedInvestorNegNetPainPeakSupplyTotalUnrealizedPattern(client, acc),
|
||||
@@ -2920,7 +2920,7 @@ function createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5(clien
|
||||
* @property {CoinblocksCoindaysSatblocksSatdaysSentPattern} activity
|
||||
* @property {MaxMinPattern} costBasis
|
||||
* @property {UtxoPattern} outputs
|
||||
* @property {CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern} realized
|
||||
* @property {CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern} realized
|
||||
* @property {InvestedNegNetNuplSupplyUnrealizedPattern} relative
|
||||
* @property {_30dHalvedTotalPattern} supply
|
||||
* @property {GreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern} unrealized
|
||||
@@ -2937,7 +2937,7 @@ function createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(clien
|
||||
activity: createCoinblocksCoindaysSatblocksSatdaysSentPattern(client, acc),
|
||||
costBasis: createMaxMinPattern(client, acc),
|
||||
outputs: createUtxoPattern(client, _m(acc, 'utxo_count')),
|
||||
realized: createCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern(client, acc),
|
||||
realized: createCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern(client, acc),
|
||||
relative: createInvestedNegNetNuplSupplyUnrealizedPattern(client, acc),
|
||||
supply: create_30dHalvedTotalPattern(client, acc),
|
||||
unrealized: createGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern(client, acc),
|
||||
@@ -2949,7 +2949,7 @@ function createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(clien
|
||||
* @property {CoinblocksCoindaysSatblocksSatdaysSentPattern} activity
|
||||
* @property {MaxMinPattern} costBasis
|
||||
* @property {UtxoPattern} outputs
|
||||
* @property {CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern} realized
|
||||
* @property {CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern} realized
|
||||
* @property {InvestedNegNetNuplSupplyUnrealizedPattern3} relative
|
||||
* @property {_30dHalvedTotalPattern} supply
|
||||
* @property {GreedInvestedInvestorNegNetPainPeakSupplyTotalUnrealizedPattern} unrealized
|
||||
@@ -2966,7 +2966,7 @@ function createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern6(clien
|
||||
activity: createCoinblocksCoindaysSatblocksSatdaysSentPattern(client, acc),
|
||||
costBasis: createMaxMinPattern(client, acc),
|
||||
outputs: createUtxoPattern(client, _m(acc, 'utxo_count')),
|
||||
realized: createCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern(client, acc),
|
||||
realized: createCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern(client, acc),
|
||||
relative: createInvestedNegNetNuplSupplyUnrealizedPattern3(client, acc),
|
||||
supply: create_30dHalvedTotalPattern(client, acc),
|
||||
unrealized: createGreedInvestedInvestorNegNetPainPeakSupplyTotalUnrealizedPattern(client, acc),
|
||||
@@ -2978,7 +2978,7 @@ function createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern6(clien
|
||||
* @property {CoinblocksCoindaysSatblocksSatdaysSentPattern} activity
|
||||
* @property {MaxMinPattern} costBasis
|
||||
* @property {UtxoPattern} outputs
|
||||
* @property {CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern} realized
|
||||
* @property {CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern} realized
|
||||
* @property {InvestedSupplyPattern} relative
|
||||
* @property {_30dHalvedTotalPattern} supply
|
||||
* @property {GreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern} unrealized
|
||||
@@ -2995,7 +2995,7 @@ function createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(clien
|
||||
activity: createCoinblocksCoindaysSatblocksSatdaysSentPattern(client, acc),
|
||||
costBasis: createMaxMinPattern(client, acc),
|
||||
outputs: createUtxoPattern(client, _m(acc, 'utxo_count')),
|
||||
realized: createCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern(client, acc),
|
||||
realized: createCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern(client, acc),
|
||||
relative: createInvestedSupplyPattern(client, acc),
|
||||
supply: create_30dHalvedTotalPattern(client, acc),
|
||||
unrealized: createGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern(client, acc),
|
||||
@@ -3007,7 +3007,7 @@ function createActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(clien
|
||||
* @property {CoinblocksCoindaysSatblocksSatdaysSentPattern} activity
|
||||
* @property {MaxMinPattern} costBasis
|
||||
* @property {UtxoPattern} outputs
|
||||
* @property {CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern} realized
|
||||
* @property {CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern} realized
|
||||
* @property {_30dHalvedTotalPattern} supply
|
||||
* @property {GreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern} unrealized
|
||||
*/
|
||||
@@ -3023,7 +3023,7 @@ function createActivityCostOutputsRealizedSupplyUnrealizedPattern(client, acc) {
|
||||
activity: createCoinblocksCoindaysSatblocksSatdaysSentPattern(client, acc),
|
||||
costBasis: createMaxMinPattern(client, acc),
|
||||
outputs: createUtxoPattern(client, _m(acc, 'utxo_count')),
|
||||
realized: createCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern(client, acc),
|
||||
realized: createCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern(client, acc),
|
||||
supply: create_30dHalvedTotalPattern(client, acc),
|
||||
unrealized: createGreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern(client, acc),
|
||||
};
|
||||
@@ -4627,7 +4627,7 @@ function createRatioPattern2(client, acc) {
|
||||
* @property {_30dHalvedTotalPattern} supply
|
||||
* @property {UtxoPattern} outputs
|
||||
* @property {CoinblocksCoindaysSatblocksSatdaysSentPattern} activity
|
||||
* @property {AdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern} realized
|
||||
* @property {AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern} realized
|
||||
* @property {GreedInvestedInvestorNegNetPainPeakSupplyTotalUnrealizedPattern} unrealized
|
||||
* @property {InvestedMaxMinPercentilesSpotPattern} costBasis
|
||||
* @property {MetricsTree_Distribution_UtxoCohorts_All_Relative} relative
|
||||
@@ -4776,7 +4776,7 @@ function createRatioPattern2(client, acc) {
|
||||
* @property {_30dHalvedTotalPattern} supply
|
||||
* @property {UtxoPattern} outputs
|
||||
* @property {CoinblocksCoindaysSatblocksSatdaysSentPattern} activity
|
||||
* @property {AdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern} realized
|
||||
* @property {AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern} realized
|
||||
* @property {GreedInvestedInvestorNegNetPainPeakSupplyTotalUnrealizedPattern} unrealized
|
||||
* @property {InvestedMaxMinPercentilesSpotPattern} costBasis
|
||||
* @property {InvestedNegNetNuplSupplyUnrealizedPattern4} relative
|
||||
@@ -4787,7 +4787,7 @@ function createRatioPattern2(client, acc) {
|
||||
* @property {_30dHalvedTotalPattern} supply
|
||||
* @property {UtxoPattern} outputs
|
||||
* @property {CoinblocksCoindaysSatblocksSatdaysSentPattern} activity
|
||||
* @property {CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern2} realized
|
||||
* @property {CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern2} realized
|
||||
* @property {GreedInvestedInvestorNegNetPainPeakSupplyTotalUnrealizedPattern} unrealized
|
||||
* @property {InvestedMaxMinPercentilesSpotPattern} costBasis
|
||||
* @property {InvestedNegNetNuplSupplyUnrealizedPattern4} relative
|
||||
@@ -6752,7 +6752,7 @@ class BrkClient extends BrkClientBase {
|
||||
supply: create_30dHalvedTotalPattern(this, ''),
|
||||
outputs: createUtxoPattern(this, 'utxo_count'),
|
||||
activity: createCoinblocksCoindaysSatblocksSatdaysSentPattern(this, ''),
|
||||
realized: createAdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern(this, ''),
|
||||
realized: createAdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern(this, ''),
|
||||
unrealized: createGreedInvestedInvestorNegNetPainPeakSupplyTotalUnrealizedPattern(this, ''),
|
||||
costBasis: createInvestedMaxMinPercentilesSpotPattern(this, ''),
|
||||
relative: {
|
||||
@@ -6879,7 +6879,7 @@ class BrkClient extends BrkClientBase {
|
||||
supply: create_30dHalvedTotalPattern(this, 'sth'),
|
||||
outputs: createUtxoPattern(this, 'sth_utxo_count'),
|
||||
activity: createCoinblocksCoindaysSatblocksSatdaysSentPattern(this, 'sth'),
|
||||
realized: createAdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern(this, 'sth'),
|
||||
realized: createAdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern(this, 'sth'),
|
||||
unrealized: createGreedInvestedInvestorNegNetPainPeakSupplyTotalUnrealizedPattern(this, 'sth'),
|
||||
costBasis: createInvestedMaxMinPercentilesSpotPattern(this, 'sth'),
|
||||
relative: createInvestedNegNetNuplSupplyUnrealizedPattern4(this, 'sth'),
|
||||
@@ -6888,7 +6888,7 @@ class BrkClient extends BrkClientBase {
|
||||
supply: create_30dHalvedTotalPattern(this, 'lth'),
|
||||
outputs: createUtxoPattern(this, 'lth_utxo_count'),
|
||||
activity: createCoinblocksCoindaysSatblocksSatdaysSentPattern(this, 'lth'),
|
||||
realized: createCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern2(this, 'lth'),
|
||||
realized: createCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern2(this, 'lth'),
|
||||
unrealized: createGreedInvestedInvestorNegNetPainPeakSupplyTotalUnrealizedPattern(this, 'lth'),
|
||||
costBasis: createInvestedMaxMinPercentilesSpotPattern(this, 'lth'),
|
||||
relative: createInvestedNegNetNuplSupplyUnrealizedPattern4(this, 'lth'),
|
||||
|
||||
@@ -56,8 +56,8 @@ Close = CentsUnsigned
|
||||
Cohort = str
|
||||
# Bucket type for cost basis aggregation.
|
||||
# Options: raw (no aggregation), lin200/lin500/lin1000 (linear $200/$500/$1000),
|
||||
# log10/log50/log100 (logarithmic with 10/50/100 buckets per decade).
|
||||
CostBasisBucket = Literal["raw", "lin200", "lin500", "lin1000", "log10", "log50", "log100"]
|
||||
# log10/log50/log100/log200 (logarithmic with 10/50/100/200 buckets per decade).
|
||||
CostBasisBucket = Literal["raw", "lin200", "lin500", "lin1000", "log10", "log50", "log100", "log200"]
|
||||
# Value type for cost basis distribution.
|
||||
# Options: supply (BTC), realized (USD, price × supply), unrealized (USD, spot × supply).
|
||||
CostBasisValue = Literal["supply", "realized", "unrealized"]
|
||||
@@ -1862,7 +1862,7 @@ class MetricPattern32(Generic[T]):
|
||||
|
||||
# Reusable structural pattern classes
|
||||
|
||||
class AdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern:
|
||||
class AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
@@ -1874,14 +1874,13 @@ class AdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealize
|
||||
self.adjusted_value_destroyed: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'adjusted_value_destroyed'))
|
||||
self.cap_raw: MetricPattern11[CentsSats] = MetricPattern11(client, _m(acc, 'cap_raw'))
|
||||
self.capitulation_flow: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'capitulation_flow'))
|
||||
self.ceiling_price: DollarsSatsPattern = DollarsSatsPattern(client, _m(acc, 'ceiling_price'))
|
||||
self.floor_price: DollarsSatsPattern = DollarsSatsPattern(client, _m(acc, 'floor_price'))
|
||||
self.investor_cap_raw: MetricPattern11[CentsSquaredSats] = MetricPattern11(client, _m(acc, 'investor_cap_raw'))
|
||||
self.investor_price: DollarsSatsPattern = DollarsSatsPattern(client, _m(acc, 'investor_price'))
|
||||
self.investor_price_cents: MetricPattern1[CentsUnsigned] = MetricPattern1(client, _m(acc, 'investor_price_cents'))
|
||||
self.investor_price_extra: RatioPattern = RatioPattern(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: DollarsSatsPattern = DollarsSatsPattern(client, _m(acc, 'lower_price_band'))
|
||||
self.mvrv: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'mvrv'))
|
||||
self.neg_realized_loss: CumulativeSumPattern2[Dollars] = CumulativeSumPattern2(client, _m(acc, 'neg_realized_loss'))
|
||||
self.net_realized_pnl: CumulativeSumPattern[Dollars] = CumulativeSumPattern(client, _m(acc, 'net_realized_pnl'))
|
||||
@@ -1920,10 +1919,11 @@ class AdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealize
|
||||
self.sopr_30d_ema: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, 'sopr_30d_ema'))
|
||||
self.sopr_7d_ema: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, 'sopr_7d_ema'))
|
||||
self.total_realized_pnl: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'total_realized_pnl'))
|
||||
self.upper_price_band: DollarsSatsPattern = DollarsSatsPattern(client, _m(acc, 'upper_price_band'))
|
||||
self.value_created: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_created'))
|
||||
self.value_destroyed: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_destroyed'))
|
||||
|
||||
class AdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern2:
|
||||
class AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern2:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
@@ -1935,14 +1935,13 @@ class AdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealize
|
||||
self.adjusted_value_destroyed: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'adjusted_value_destroyed'))
|
||||
self.cap_raw: MetricPattern11[CentsSats] = MetricPattern11(client, _m(acc, 'cap_raw'))
|
||||
self.capitulation_flow: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'capitulation_flow'))
|
||||
self.ceiling_price: DollarsSatsPattern = DollarsSatsPattern(client, _m(acc, 'ceiling_price'))
|
||||
self.floor_price: DollarsSatsPattern = DollarsSatsPattern(client, _m(acc, 'floor_price'))
|
||||
self.investor_cap_raw: MetricPattern11[CentsSquaredSats] = MetricPattern11(client, _m(acc, 'investor_cap_raw'))
|
||||
self.investor_price: DollarsSatsPattern = DollarsSatsPattern(client, _m(acc, 'investor_price'))
|
||||
self.investor_price_cents: MetricPattern1[CentsUnsigned] = MetricPattern1(client, _m(acc, 'investor_price_cents'))
|
||||
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: DollarsSatsPattern = DollarsSatsPattern(client, _m(acc, 'lower_price_band'))
|
||||
self.mvrv: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'mvrv'))
|
||||
self.neg_realized_loss: CumulativeSumPattern2[Dollars] = CumulativeSumPattern2(client, _m(acc, 'neg_realized_loss'))
|
||||
self.net_realized_pnl: CumulativeSumPattern[Dollars] = CumulativeSumPattern(client, _m(acc, 'net_realized_pnl'))
|
||||
@@ -1979,24 +1978,24 @@ class AdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealize
|
||||
self.sopr_30d_ema: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, 'sopr_30d_ema'))
|
||||
self.sopr_7d_ema: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, 'sopr_7d_ema'))
|
||||
self.total_realized_pnl: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'total_realized_pnl'))
|
||||
self.upper_price_band: DollarsSatsPattern = DollarsSatsPattern(client, _m(acc, 'upper_price_band'))
|
||||
self.value_created: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_created'))
|
||||
self.value_destroyed: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_destroyed'))
|
||||
|
||||
class CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern2:
|
||||
class CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern2:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated metric name."""
|
||||
self.cap_raw: MetricPattern11[CentsSats] = MetricPattern11(client, _m(acc, 'cap_raw'))
|
||||
self.capitulation_flow: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'capitulation_flow'))
|
||||
self.ceiling_price: DollarsSatsPattern = DollarsSatsPattern(client, _m(acc, 'ceiling_price'))
|
||||
self.floor_price: DollarsSatsPattern = DollarsSatsPattern(client, _m(acc, 'floor_price'))
|
||||
self.investor_cap_raw: MetricPattern11[CentsSquaredSats] = MetricPattern11(client, _m(acc, 'investor_cap_raw'))
|
||||
self.investor_price: DollarsSatsPattern = DollarsSatsPattern(client, _m(acc, 'investor_price'))
|
||||
self.investor_price_cents: MetricPattern1[CentsUnsigned] = MetricPattern1(client, _m(acc, 'investor_price_cents'))
|
||||
self.investor_price_extra: RatioPattern = RatioPattern(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: DollarsSatsPattern = DollarsSatsPattern(client, _m(acc, 'lower_price_band'))
|
||||
self.mvrv: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'mvrv'))
|
||||
self.neg_realized_loss: CumulativeSumPattern2[Dollars] = CumulativeSumPattern2(client, _m(acc, 'neg_realized_loss'))
|
||||
self.net_realized_pnl: CumulativeSumPattern[Dollars] = CumulativeSumPattern(client, _m(acc, 'net_realized_pnl'))
|
||||
@@ -2035,24 +2034,24 @@ class CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSen
|
||||
self.sopr_30d_ema: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, 'sopr_30d_ema'))
|
||||
self.sopr_7d_ema: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, 'sopr_7d_ema'))
|
||||
self.total_realized_pnl: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'total_realized_pnl'))
|
||||
self.upper_price_band: DollarsSatsPattern = DollarsSatsPattern(client, _m(acc, 'upper_price_band'))
|
||||
self.value_created: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_created'))
|
||||
self.value_destroyed: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_destroyed'))
|
||||
|
||||
class CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern:
|
||||
class CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated metric name."""
|
||||
self.cap_raw: MetricPattern11[CentsSats] = MetricPattern11(client, _m(acc, 'cap_raw'))
|
||||
self.capitulation_flow: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'capitulation_flow'))
|
||||
self.ceiling_price: DollarsSatsPattern = DollarsSatsPattern(client, _m(acc, 'ceiling_price'))
|
||||
self.floor_price: DollarsSatsPattern = DollarsSatsPattern(client, _m(acc, 'floor_price'))
|
||||
self.investor_cap_raw: MetricPattern11[CentsSquaredSats] = MetricPattern11(client, _m(acc, 'investor_cap_raw'))
|
||||
self.investor_price: DollarsSatsPattern = DollarsSatsPattern(client, _m(acc, 'investor_price'))
|
||||
self.investor_price_cents: MetricPattern1[CentsUnsigned] = MetricPattern1(client, _m(acc, 'investor_price_cents'))
|
||||
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: DollarsSatsPattern = DollarsSatsPattern(client, _m(acc, 'lower_price_band'))
|
||||
self.mvrv: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'mvrv'))
|
||||
self.neg_realized_loss: CumulativeSumPattern2[Dollars] = CumulativeSumPattern2(client, _m(acc, 'neg_realized_loss'))
|
||||
self.net_realized_pnl: CumulativeSumPattern[Dollars] = CumulativeSumPattern(client, _m(acc, 'net_realized_pnl'))
|
||||
@@ -2089,6 +2088,7 @@ class CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSen
|
||||
self.sopr_30d_ema: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, 'sopr_30d_ema'))
|
||||
self.sopr_7d_ema: MetricPattern6[StoredF64] = MetricPattern6(client, _m(acc, 'sopr_7d_ema'))
|
||||
self.total_realized_pnl: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'total_realized_pnl'))
|
||||
self.upper_price_band: DollarsSatsPattern = DollarsSatsPattern(client, _m(acc, 'upper_price_band'))
|
||||
self.value_created: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_created'))
|
||||
self.value_destroyed: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'value_destroyed'))
|
||||
|
||||
@@ -2464,7 +2464,7 @@ class ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern:
|
||||
self.addr_count_30d_change: MetricPattern4[StoredF64] = MetricPattern4(client, _m(acc, 'addr_count_30d_change'))
|
||||
self.cost_basis: MaxMinPattern = MaxMinPattern(client, acc)
|
||||
self.outputs: UtxoPattern = UtxoPattern(client, _m(acc, 'utxo_count'))
|
||||
self.realized: CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern = CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern(client, acc)
|
||||
self.realized: CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern = CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern(client, acc)
|
||||
self.relative: InvestedNegNetNuplSupplyUnrealizedPattern = InvestedNegNetNuplSupplyUnrealizedPattern(client, acc)
|
||||
self.supply: _30dHalvedTotalPattern = _30dHalvedTotalPattern(client, acc)
|
||||
self.unrealized: GreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern = GreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern(client, acc)
|
||||
@@ -2535,7 +2535,7 @@ class ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern:
|
||||
self.activity: CoinblocksCoindaysSatblocksSatdaysSentPattern = CoinblocksCoindaysSatblocksSatdaysSentPattern(client, acc)
|
||||
self.cost_basis: InvestedMaxMinPercentilesSpotPattern = InvestedMaxMinPercentilesSpotPattern(client, acc)
|
||||
self.outputs: UtxoPattern = UtxoPattern(client, _m(acc, 'utxo_count'))
|
||||
self.realized: CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern2 = CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern2(client, acc)
|
||||
self.realized: CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern2 = CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern2(client, acc)
|
||||
self.relative: InvestedNegNetSupplyUnrealizedPattern = InvestedNegNetSupplyUnrealizedPattern(client, acc)
|
||||
self.supply: _30dHalvedTotalPattern = _30dHalvedTotalPattern(client, acc)
|
||||
self.unrealized: GreedInvestedInvestorNegNetPainPeakSupplyTotalUnrealizedPattern = GreedInvestedInvestorNegNetPainPeakSupplyTotalUnrealizedPattern(client, acc)
|
||||
@@ -2548,7 +2548,7 @@ class ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5:
|
||||
self.activity: CoinblocksCoindaysSatblocksSatdaysSentPattern = CoinblocksCoindaysSatblocksSatdaysSentPattern(client, acc)
|
||||
self.cost_basis: MaxMinPattern = MaxMinPattern(client, acc)
|
||||
self.outputs: UtxoPattern = UtxoPattern(client, _m(acc, 'utxo_count'))
|
||||
self.realized: AdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern2 = AdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern2(client, acc)
|
||||
self.realized: AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern2 = AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern2(client, acc)
|
||||
self.relative: InvestedNegNetNuplSupplyUnrealizedPattern3 = InvestedNegNetNuplSupplyUnrealizedPattern3(client, acc)
|
||||
self.supply: _30dHalvedTotalPattern = _30dHalvedTotalPattern(client, acc)
|
||||
self.unrealized: GreedInvestedInvestorNegNetPainPeakSupplyTotalUnrealizedPattern = GreedInvestedInvestorNegNetPainPeakSupplyTotalUnrealizedPattern(client, acc)
|
||||
@@ -2561,7 +2561,7 @@ class ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4:
|
||||
self.activity: CoinblocksCoindaysSatblocksSatdaysSentPattern = CoinblocksCoindaysSatblocksSatdaysSentPattern(client, acc)
|
||||
self.cost_basis: MaxMinPattern = MaxMinPattern(client, acc)
|
||||
self.outputs: UtxoPattern = UtxoPattern(client, _m(acc, 'utxo_count'))
|
||||
self.realized: CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern = CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern(client, acc)
|
||||
self.realized: CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern = CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern(client, acc)
|
||||
self.relative: InvestedNegNetNuplSupplyUnrealizedPattern = InvestedNegNetNuplSupplyUnrealizedPattern(client, acc)
|
||||
self.supply: _30dHalvedTotalPattern = _30dHalvedTotalPattern(client, acc)
|
||||
self.unrealized: GreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern = GreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern(client, acc)
|
||||
@@ -2574,7 +2574,7 @@ class ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern6:
|
||||
self.activity: CoinblocksCoindaysSatblocksSatdaysSentPattern = CoinblocksCoindaysSatblocksSatdaysSentPattern(client, acc)
|
||||
self.cost_basis: MaxMinPattern = MaxMinPattern(client, acc)
|
||||
self.outputs: UtxoPattern = UtxoPattern(client, _m(acc, 'utxo_count'))
|
||||
self.realized: CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern = CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern(client, acc)
|
||||
self.realized: CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern = CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern(client, acc)
|
||||
self.relative: InvestedNegNetNuplSupplyUnrealizedPattern3 = InvestedNegNetNuplSupplyUnrealizedPattern3(client, acc)
|
||||
self.supply: _30dHalvedTotalPattern = _30dHalvedTotalPattern(client, acc)
|
||||
self.unrealized: GreedInvestedInvestorNegNetPainPeakSupplyTotalUnrealizedPattern = GreedInvestedInvestorNegNetPainPeakSupplyTotalUnrealizedPattern(client, acc)
|
||||
@@ -2587,7 +2587,7 @@ class ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3:
|
||||
self.activity: CoinblocksCoindaysSatblocksSatdaysSentPattern = CoinblocksCoindaysSatblocksSatdaysSentPattern(client, acc)
|
||||
self.cost_basis: MaxMinPattern = MaxMinPattern(client, acc)
|
||||
self.outputs: UtxoPattern = UtxoPattern(client, _m(acc, 'utxo_count'))
|
||||
self.realized: CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern = CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern(client, acc)
|
||||
self.realized: CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern = CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern(client, acc)
|
||||
self.relative: InvestedSupplyPattern = InvestedSupplyPattern(client, acc)
|
||||
self.supply: _30dHalvedTotalPattern = _30dHalvedTotalPattern(client, acc)
|
||||
self.unrealized: GreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern = GreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern(client, acc)
|
||||
@@ -2600,7 +2600,7 @@ class ActivityCostOutputsRealizedSupplyUnrealizedPattern:
|
||||
self.activity: CoinblocksCoindaysSatblocksSatdaysSentPattern = CoinblocksCoindaysSatblocksSatdaysSentPattern(client, acc)
|
||||
self.cost_basis: MaxMinPattern = MaxMinPattern(client, acc)
|
||||
self.outputs: UtxoPattern = UtxoPattern(client, _m(acc, 'utxo_count'))
|
||||
self.realized: CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern = CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern(client, acc)
|
||||
self.realized: CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern = CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern(client, acc)
|
||||
self.supply: _30dHalvedTotalPattern = _30dHalvedTotalPattern(client, acc)
|
||||
self.unrealized: GreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern = GreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern(client, acc)
|
||||
|
||||
@@ -3987,7 +3987,7 @@ class MetricsTree_Distribution_UtxoCohorts_All:
|
||||
self.supply: _30dHalvedTotalPattern = _30dHalvedTotalPattern(client, '')
|
||||
self.outputs: UtxoPattern = UtxoPattern(client, 'utxo_count')
|
||||
self.activity: CoinblocksCoindaysSatblocksSatdaysSentPattern = CoinblocksCoindaysSatblocksSatdaysSentPattern(client, '')
|
||||
self.realized: AdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern = AdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern(client, '')
|
||||
self.realized: AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern = AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern(client, '')
|
||||
self.unrealized: GreedInvestedInvestorNegNetPainPeakSupplyTotalUnrealizedPattern = GreedInvestedInvestorNegNetPainPeakSupplyTotalUnrealizedPattern(client, '')
|
||||
self.cost_basis: InvestedMaxMinPercentilesSpotPattern = InvestedMaxMinPercentilesSpotPattern(client, '')
|
||||
self.relative: MetricsTree_Distribution_UtxoCohorts_All_Relative = MetricsTree_Distribution_UtxoCohorts_All_Relative(client)
|
||||
@@ -4119,7 +4119,7 @@ class MetricsTree_Distribution_UtxoCohorts_Term_Short:
|
||||
self.supply: _30dHalvedTotalPattern = _30dHalvedTotalPattern(client, 'sth')
|
||||
self.outputs: UtxoPattern = UtxoPattern(client, 'sth_utxo_count')
|
||||
self.activity: CoinblocksCoindaysSatblocksSatdaysSentPattern = CoinblocksCoindaysSatblocksSatdaysSentPattern(client, 'sth')
|
||||
self.realized: AdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern = AdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern(client, 'sth')
|
||||
self.realized: AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern = AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern(client, 'sth')
|
||||
self.unrealized: GreedInvestedInvestorNegNetPainPeakSupplyTotalUnrealizedPattern = GreedInvestedInvestorNegNetPainPeakSupplyTotalUnrealizedPattern(client, 'sth')
|
||||
self.cost_basis: InvestedMaxMinPercentilesSpotPattern = InvestedMaxMinPercentilesSpotPattern(client, 'sth')
|
||||
self.relative: InvestedNegNetNuplSupplyUnrealizedPattern4 = InvestedNegNetNuplSupplyUnrealizedPattern4(client, 'sth')
|
||||
@@ -4131,7 +4131,7 @@ class MetricsTree_Distribution_UtxoCohorts_Term_Long:
|
||||
self.supply: _30dHalvedTotalPattern = _30dHalvedTotalPattern(client, 'lth')
|
||||
self.outputs: UtxoPattern = UtxoPattern(client, 'lth_utxo_count')
|
||||
self.activity: CoinblocksCoindaysSatblocksSatdaysSentPattern = CoinblocksCoindaysSatblocksSatdaysSentPattern(client, 'lth')
|
||||
self.realized: CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern2 = CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern2(client, 'lth')
|
||||
self.realized: CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern2 = CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern2(client, 'lth')
|
||||
self.unrealized: GreedInvestedInvestorNegNetPainPeakSupplyTotalUnrealizedPattern = GreedInvestedInvestorNegNetPainPeakSupplyTotalUnrealizedPattern(client, 'lth')
|
||||
self.cost_basis: InvestedMaxMinPercentilesSpotPattern = InvestedMaxMinPercentilesSpotPattern(client, 'lth')
|
||||
self.relative: InvestedNegNetNuplSupplyUnrealizedPattern4 = InvestedNegNetNuplSupplyUnrealizedPattern4(client, 'lth')
|
||||
|
||||
@@ -115,9 +115,9 @@ export function createChart({ parent, id: chartId, brk, fitContent }) {
|
||||
let generation = 0;
|
||||
|
||||
// Shared time - fetched once per rebuild, all series register callbacks
|
||||
/** @type {number[] | null} */
|
||||
/** @type {MetricData<number> | null} */
|
||||
let sharedTimeData = null;
|
||||
/** @type {Set<(data: number[]) => void>} */
|
||||
/** @type {Set<(data: MetricData<number>) => void>} */
|
||||
let timeCallbacks = new Set();
|
||||
|
||||
// Memory cache for instant index switching
|
||||
@@ -539,9 +539,11 @@ export function createChart({ parent, id: chartId, brk, fitContent }) {
|
||||
lastTime: -Infinity,
|
||||
/** @type {string | null} */
|
||||
lastStamp: null,
|
||||
/** @type {string | null} */
|
||||
lastTimeStamp: null,
|
||||
/** @type {VoidFunction | null} */
|
||||
fetch: null,
|
||||
/** @type {((data: number[]) => void) | null} */
|
||||
/** @type {((data: MetricData<number>) => void) | null} */
|
||||
onTime: null,
|
||||
};
|
||||
|
||||
@@ -716,7 +718,7 @@ export function createChart({ parent, id: chartId, brk, fitContent }) {
|
||||
}
|
||||
|
||||
async function fetchAndProcess() {
|
||||
/** @type {number[] | null} */
|
||||
/** @type {MetricData<number> | null} */
|
||||
let timeData = null;
|
||||
/** @type {(number | null | [number, number, number, number])[] | null} */
|
||||
let valuesData = null;
|
||||
@@ -726,16 +728,17 @@ export function createChart({ parent, id: chartId, brk, fitContent }) {
|
||||
function tryProcess() {
|
||||
if (seriesGeneration !== generation) return;
|
||||
if (!timeData || !valuesData) return;
|
||||
if (valuesStamp === state.lastStamp) return;
|
||||
if (valuesStamp === state.lastStamp && timeData.stamp === state.lastTimeStamp) return;
|
||||
state.lastStamp = valuesStamp;
|
||||
if (timeData.length && valuesData.length) {
|
||||
processData(timeData, valuesData);
|
||||
state.lastTimeStamp = timeData.stamp;
|
||||
if (timeData.data.length && valuesData.length) {
|
||||
processData(timeData.data, valuesData);
|
||||
}
|
||||
}
|
||||
|
||||
// Register for shared time data (fetched once in rebuild)
|
||||
state.onTime = (data) => {
|
||||
timeData = data;
|
||||
state.onTime = (result) => {
|
||||
timeData = result;
|
||||
tryProcess();
|
||||
};
|
||||
timeCallbacks.add(state.onTime);
|
||||
@@ -1655,13 +1658,13 @@ export function createChart({ parent, id: chartId, brk, fitContent }) {
|
||||
const timeEndpoint = getTimeEndpoint(idx);
|
||||
const cached = cache.get(timeEndpoint.path);
|
||||
if (cached) {
|
||||
sharedTimeData = cached.data;
|
||||
sharedTimeData = cached;
|
||||
}
|
||||
timeEndpoint.slice(-10000).fetch((result) => {
|
||||
if (currentGen !== generation) return;
|
||||
cache.set(timeEndpoint.path, result);
|
||||
sharedTimeData = result.data;
|
||||
timeCallbacks.forEach((cb) => cb(result.data));
|
||||
sharedTimeData = result;
|
||||
timeCallbacks.forEach((cb) => cb(result));
|
||||
});
|
||||
this.rebuildPane(0);
|
||||
this.rebuildPane(1);
|
||||
|
||||
@@ -19,7 +19,7 @@ import { baseline, price } from "../series.js";
|
||||
import { Unit } from "../../utils/units.js";
|
||||
|
||||
/**
|
||||
* @param {{ realized: { realizedPrice: ActivePricePattern, investorPrice: ActivePricePattern, floorPrice: ActivePricePattern, ceilingPrice: ActivePricePattern } }} tree
|
||||
* @param {{ realized: { realizedPrice: ActivePricePattern, investorPrice: ActivePricePattern, lowerPriceBand: ActivePricePattern, upperPriceBand: ActivePricePattern } }} tree
|
||||
* @param {(metric: string) => string} title
|
||||
* @returns {PartialChartOption}
|
||||
*/
|
||||
@@ -30,8 +30,8 @@ function createCompareChart(tree, title) {
|
||||
top: [
|
||||
price({ metric: tree.realized.realizedPrice, name: "Realized", color: colors.realized }),
|
||||
price({ metric: tree.realized.investorPrice, name: "Investor", color: colors.investor }),
|
||||
price({ metric: tree.realized.ceilingPrice, name: "I²/R", color: colors.stat.max, style: 2, defaultActive: false }),
|
||||
price({ metric: tree.realized.floorPrice, name: "R²/I", color: colors.stat.min, style: 2, defaultActive: false }),
|
||||
price({ metric: tree.realized.upperPriceBand, name: "I²/R", color: colors.stat.max, style: 2, defaultActive: false }),
|
||||
price({ metric: tree.realized.lowerPriceBand, name: "R²/I", color: colors.stat.min, style: 2, defaultActive: false }),
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
@@ -89,10 +89,10 @@
|
||||
* @typedef {Brk.GreedInvestedInvestorNegNetPainPeakSupplyTotalUnrealizedPattern} UnrealizedFullPattern
|
||||
*
|
||||
* Realized patterns
|
||||
* @typedef {Brk.CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern} RealizedPattern
|
||||
* @typedef {Brk.CapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern2} RealizedPattern2
|
||||
* @typedef {Brk.AdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern} RealizedPattern3
|
||||
* @typedef {Brk.AdjustedCapCapitulationCeilingFloorInvestorLossMvrvNegNetPeakProfitRealizedSellSentSoprTotalValuePattern2} RealizedPattern4
|
||||
* @typedef {Brk.CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern} RealizedPattern
|
||||
* @typedef {Brk.CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern2} RealizedPattern2
|
||||
* @typedef {Brk.AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern} RealizedPattern3
|
||||
* @typedef {Brk.AdjustedCapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern2} RealizedPattern4
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user