diff --git a/crates/brk_client/src/lib.rs b/crates/brk_client/src/lib.rs index cc010a53d..3e815dc71 100644 --- a/crates/brk_client/src/lib.rs +++ b/crates/brk_client/src/lib.rs @@ -1685,7 +1685,7 @@ pub struct ActivityAddrOutputsRealizedSupplyUnrealizedPattern { pub addr_count: BaseDeltaPattern, pub outputs: SpendingSpentUnspentPattern, pub realized: CapLossMvrvPriceProfitPattern, - pub supply: DeltaTotalPattern, + pub supply: DeltaDominanceTotalPattern, pub unrealized: NuplPattern, } @@ -1697,7 +1697,7 @@ impl ActivityAddrOutputsRealizedSupplyUnrealizedPattern { addr_count: BaseDeltaPattern::new(client.clone(), _m(&acc, "addr_count")), outputs: SpendingSpentUnspentPattern::new(client.clone(), acc.clone()), realized: CapLossMvrvPriceProfitPattern::new(client.clone(), acc.clone()), - supply: DeltaTotalPattern::new(client.clone(), _m(&acc, "supply")), + supply: DeltaDominanceTotalPattern::new(client.clone(), _m(&acc, "supply")), unrealized: NuplPattern::new(client.clone(), _m(&acc, "nupl")), } } @@ -1751,30 +1751,6 @@ impl BpsCentsPercentilesRatioSatsUsdPattern { } } -/// Pattern struct for repeated tree structure. -pub struct BtcCentsSatsToUsdPattern3 { - pub btc: SeriesPattern1, - pub cents: SeriesPattern1, - pub sats: SeriesPattern1, - pub to_circulating: BpsPercentRatioPattern2, - pub to_own: BpsPercentRatioPattern2, - pub usd: SeriesPattern1, -} - -impl BtcCentsSatsToUsdPattern3 { - /// Create a new pattern node with accumulated series name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - btc: SeriesPattern1::new(client.clone(), acc.clone()), - cents: SeriesPattern1::new(client.clone(), _m(&acc, "cents")), - sats: SeriesPattern1::new(client.clone(), _m(&acc, "sats")), - to_circulating: BpsPercentRatioPattern2::new(client.clone(), _m(&acc, "to_circulating")), - to_own: BpsPercentRatioPattern2::new(client.clone(), _m(&acc, "to_own")), - usd: SeriesPattern1::new(client.clone(), _m(&acc, "usd")), - } - } -} - /// Pattern struct for repeated tree structure. pub struct CentsNegativeToUsdPattern2 { pub cents: SeriesPattern1, @@ -1800,48 +1776,48 @@ impl CentsNegativeToUsdPattern2 { } /// Pattern struct for repeated tree structure. -pub struct DeltaHalfInToTotalPattern { +pub struct DeltaDominanceHalfInTotalPattern2 { pub delta: AbsoluteRatePattern, + pub dominance: BpsPercentRatioPattern2, pub half: BtcCentsSatsUsdPattern, - pub in_loss: BtcCentsSatsToUsdPattern, - pub in_profit: BtcCentsSatsToUsdPattern, - pub to_circulating: BpsPercentRatioPattern2, + pub in_loss: BtcCentsSatsShareUsdPattern, + pub in_profit: BtcCentsSatsShareUsdPattern, pub total: BtcCentsSatsUsdPattern, } -impl DeltaHalfInToTotalPattern { +impl DeltaDominanceHalfInTotalPattern2 { /// Create a new pattern node with accumulated series name. pub fn new(client: Arc, acc: String) -> Self { Self { delta: AbsoluteRatePattern::new(client.clone(), _m(&acc, "delta")), + dominance: BpsPercentRatioPattern2::new(client.clone(), _m(&acc, "dominance")), half: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "half")), - in_loss: BtcCentsSatsToUsdPattern::new(client.clone(), _m(&acc, "in_loss")), - in_profit: BtcCentsSatsToUsdPattern::new(client.clone(), _m(&acc, "in_profit")), - to_circulating: BpsPercentRatioPattern2::new(client.clone(), _m(&acc, "to_circulating")), + in_loss: BtcCentsSatsShareUsdPattern::new(client.clone(), _m(&acc, "in_loss")), + in_profit: BtcCentsSatsShareUsdPattern::new(client.clone(), _m(&acc, "in_profit")), total: BtcCentsSatsUsdPattern::new(client.clone(), acc.clone()), } } } /// Pattern struct for repeated tree structure. -pub struct DeltaHalfInToTotalPattern2 { +pub struct DeltaDominanceHalfInTotalPattern { pub delta: AbsoluteRatePattern, + pub dominance: BpsPercentRatioPattern2, pub half: BtcCentsSatsUsdPattern, - pub in_loss: BtcCentsSatsToUsdPattern3, - pub in_profit: BtcCentsSatsToUsdPattern3, - pub to_circulating: BpsPercentRatioPattern2, + pub in_loss: BtcCentsSatsUsdPattern, + pub in_profit: BtcCentsSatsUsdPattern, pub total: BtcCentsSatsUsdPattern, } -impl DeltaHalfInToTotalPattern2 { +impl DeltaDominanceHalfInTotalPattern { /// Create a new pattern node with accumulated series name. pub fn new(client: Arc, acc: String) -> Self { Self { delta: AbsoluteRatePattern::new(client.clone(), _m(&acc, "delta")), + dominance: BpsPercentRatioPattern2::new(client.clone(), _m(&acc, "dominance")), half: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "half")), - in_loss: BtcCentsSatsToUsdPattern3::new(client.clone(), _m(&acc, "in_loss")), - in_profit: BtcCentsSatsToUsdPattern3::new(client.clone(), _m(&acc, "in_profit")), - to_circulating: BpsPercentRatioPattern2::new(client.clone(), _m(&acc, "to_circulating")), + in_loss: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "in_loss")), + in_profit: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "in_profit")), total: BtcCentsSatsUsdPattern::new(client.clone(), acc.clone()), } } @@ -1896,7 +1872,7 @@ pub struct ActivityOutputsRealizedSupplyUnrealizedPattern { pub activity: CoindaysTransferPattern, pub outputs: SpendingSpentUnspentPattern, pub realized: CapLossMvrvNetPriceProfitSoprPattern, - pub supply: DeltaHalfInToTotalPattern, + pub supply: DeltaDominanceHalfInTotalPattern, pub unrealized: LossNetNuplProfitPattern, } @@ -1907,7 +1883,7 @@ impl ActivityOutputsRealizedSupplyUnrealizedPattern { activity: CoindaysTransferPattern::new(client.clone(), acc.clone()), outputs: SpendingSpentUnspentPattern::new(client.clone(), acc.clone()), realized: CapLossMvrvNetPriceProfitSoprPattern::new(client.clone(), acc.clone()), - supply: DeltaHalfInToTotalPattern::new(client.clone(), _m(&acc, "supply")), + supply: DeltaDominanceHalfInTotalPattern::new(client.clone(), _m(&acc, "supply")), unrealized: LossNetNuplProfitPattern::new(client.clone(), acc.clone()), } } @@ -1918,7 +1894,7 @@ pub struct ActivityOutputsRealizedSupplyUnrealizedPattern3 { pub activity: TransferPattern, pub outputs: SpendingSpentUnspentPattern, pub realized: CapLossMvrvPriceProfitPattern, - pub supply: DeltaHalfInTotalPattern2, + pub supply: DeltaDominanceHalfInTotalPattern, pub unrealized: LossNuplProfitPattern, } @@ -1929,7 +1905,7 @@ impl ActivityOutputsRealizedSupplyUnrealizedPattern3 { activity: TransferPattern::new(client.clone(), _m(&acc, "transfer_volume")), outputs: SpendingSpentUnspentPattern::new(client.clone(), acc.clone()), realized: CapLossMvrvPriceProfitPattern::new(client.clone(), acc.clone()), - supply: DeltaHalfInTotalPattern2::new(client.clone(), _m(&acc, "supply")), + supply: DeltaDominanceHalfInTotalPattern::new(client.clone(), _m(&acc, "supply")), unrealized: LossNuplProfitPattern::new(client.clone(), acc.clone()), } } @@ -1940,7 +1916,7 @@ pub struct ActivityOutputsRealizedSupplyUnrealizedPattern2 { pub activity: TransferPattern, pub outputs: SpendingSpentUnspentPattern, pub realized: CapLossMvrvPriceProfitPattern, - pub supply: DeltaTotalPattern, + pub supply: DeltaDominanceTotalPattern, pub unrealized: NuplPattern, } @@ -1951,7 +1927,7 @@ impl ActivityOutputsRealizedSupplyUnrealizedPattern2 { activity: TransferPattern::new(client.clone(), _m(&acc, "transfer_volume")), outputs: SpendingSpentUnspentPattern::new(client.clone(), acc.clone()), realized: CapLossMvrvPriceProfitPattern::new(client.clone(), acc.clone()), - supply: DeltaTotalPattern::new(client.clone(), _m(&acc, "supply")), + supply: DeltaDominanceTotalPattern::new(client.clone(), _m(&acc, "supply")), unrealized: NuplPattern::new(client.clone(), _m(&acc, "nupl")), } } @@ -2024,44 +2000,22 @@ impl BtcCentsDeltaSatsUsdPattern { } /// Pattern struct for repeated tree structure. -pub struct BtcCentsSatsToUsdPattern { +pub struct BtcCentsSatsShareUsdPattern { pub btc: SeriesPattern1, pub cents: SeriesPattern1, pub sats: SeriesPattern1, - pub to_circulating: BpsPercentRatioPattern2, + pub share: BpsPercentRatioPattern2, pub usd: SeriesPattern1, } -impl BtcCentsSatsToUsdPattern { +impl BtcCentsSatsShareUsdPattern { /// Create a new pattern node with accumulated series name. pub fn new(client: Arc, acc: String) -> Self { Self { btc: SeriesPattern1::new(client.clone(), acc.clone()), cents: SeriesPattern1::new(client.clone(), _m(&acc, "cents")), sats: SeriesPattern1::new(client.clone(), _m(&acc, "sats")), - to_circulating: BpsPercentRatioPattern2::new(client.clone(), _m(&acc, "to_circulating")), - usd: SeriesPattern1::new(client.clone(), _m(&acc, "usd")), - } - } -} - -/// Pattern struct for repeated tree structure. -pub struct BtcCentsSatsToUsdPattern2 { - pub btc: SeriesPattern1, - pub cents: SeriesPattern1, - pub sats: SeriesPattern1, - pub to_own: BpsPercentRatioPattern2, - pub usd: SeriesPattern1, -} - -impl BtcCentsSatsToUsdPattern2 { - /// Create a new pattern node with accumulated series name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - btc: SeriesPattern1::new(client.clone(), acc.clone()), - cents: SeriesPattern1::new(client.clone(), _m(&acc, "cents")), - sats: SeriesPattern1::new(client.clone(), _m(&acc, "sats")), - to_own: BpsPercentRatioPattern2::new(client.clone(), _m(&acc, "to_own")), + share: BpsPercentRatioPattern2::new(client.clone(), _m(&acc, "share")), usd: SeriesPattern1::new(client.clone(), _m(&acc, "usd")), } } @@ -2111,28 +2065,6 @@ impl CentsToUsdPattern4 { } } -/// Pattern struct for repeated tree structure. -pub struct DeltaHalfInTotalPattern2 { - pub delta: AbsoluteRatePattern, - pub half: BtcCentsSatsUsdPattern, - pub in_loss: BtcCentsSatsUsdPattern, - pub in_profit: BtcCentsSatsUsdPattern, - pub total: BtcCentsSatsUsdPattern, -} - -impl DeltaHalfInTotalPattern2 { - /// Create a new pattern node with accumulated series name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - delta: AbsoluteRatePattern::new(client.clone(), _m(&acc, "delta")), - half: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "half")), - in_loss: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "in_loss")), - in_profit: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "in_profit")), - total: BtcCentsSatsUsdPattern::new(client.clone(), acc.clone()), - } - } -} - /// Pattern struct for repeated tree structure. pub struct EmaHistogramLineSignalPattern { pub ema_fast: SeriesPattern1, @@ -2826,6 +2758,24 @@ impl CumulativeRollingSumPattern { } } +/// Pattern struct for repeated tree structure. +pub struct DeltaDominanceTotalPattern { + pub delta: AbsoluteRatePattern, + pub dominance: BpsPercentRatioPattern2, + pub total: BtcCentsSatsUsdPattern, +} + +impl DeltaDominanceTotalPattern { + /// Create a new pattern node with accumulated series name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + delta: AbsoluteRatePattern::new(client.clone(), _m(&acc, "delta")), + dominance: BpsPercentRatioPattern2::new(client.clone(), _m(&acc, "dominance")), + total: BtcCentsSatsUsdPattern::new(client.clone(), acc.clone()), + } + } +} + /// Pattern struct for repeated tree structure. pub struct GreedNetPainPattern { pub greed_index: CentsUsdPattern3, @@ -3190,22 +3140,6 @@ impl CoindaysTransferPattern { } } -/// Pattern struct for repeated tree structure. -pub struct DeltaTotalPattern { - pub delta: AbsoluteRatePattern, - pub total: BtcCentsSatsUsdPattern, -} - -impl DeltaTotalPattern { - /// Create a new pattern node with accumulated series name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - delta: AbsoluteRatePattern::new(client.clone(), _m(&acc, "delta")), - total: BtcCentsSatsUsdPattern::new(client.clone(), acc.clone()), - } - } -} - /// Pattern struct for repeated tree structure. pub struct FundedTotalPattern { pub funded: AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern4, @@ -7046,7 +6980,7 @@ impl SeriesTree_Cohorts_Utxo { /// Series tree node. pub struct SeriesTree_Cohorts_Utxo_All { - pub supply: SeriesTree_Cohorts_Utxo_All_Supply, + pub supply: DeltaDominanceHalfInTotalPattern2, pub outputs: SeriesTree_Cohorts_Utxo_All_Outputs, pub activity: SeriesTree_Cohorts_Utxo_All_Activity, pub realized: SeriesTree_Cohorts_Utxo_All_Realized, @@ -7058,7 +6992,7 @@ pub struct SeriesTree_Cohorts_Utxo_All { impl SeriesTree_Cohorts_Utxo_All { pub fn new(client: Arc, base_path: String) -> Self { Self { - supply: SeriesTree_Cohorts_Utxo_All_Supply::new(client.clone(), format!("{base_path}_supply")), + supply: DeltaDominanceHalfInTotalPattern2::new(client.clone(), "supply".to_string()), outputs: SeriesTree_Cohorts_Utxo_All_Outputs::new(client.clone(), format!("{base_path}_outputs")), activity: SeriesTree_Cohorts_Utxo_All_Activity::new(client.clone(), format!("{base_path}_activity")), realized: SeriesTree_Cohorts_Utxo_All_Realized::new(client.clone(), format!("{base_path}_realized")), @@ -7069,27 +7003,6 @@ impl SeriesTree_Cohorts_Utxo_All { } } -/// Series tree node. -pub struct SeriesTree_Cohorts_Utxo_All_Supply { - pub total: BtcCentsSatsUsdPattern, - pub delta: AbsoluteRatePattern, - pub half: BtcCentsSatsUsdPattern, - pub in_profit: BtcCentsSatsToUsdPattern2, - pub in_loss: BtcCentsSatsToUsdPattern2, -} - -impl SeriesTree_Cohorts_Utxo_All_Supply { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - total: BtcCentsSatsUsdPattern::new(client.clone(), "supply".to_string()), - delta: AbsoluteRatePattern::new(client.clone(), "supply_delta".to_string()), - half: BtcCentsSatsUsdPattern::new(client.clone(), "supply_half".to_string()), - in_profit: BtcCentsSatsToUsdPattern2::new(client.clone(), "supply_in_profit".to_string()), - in_loss: BtcCentsSatsToUsdPattern2::new(client.clone(), "supply_in_loss".to_string()), - } - } -} - /// Series tree node. pub struct SeriesTree_Cohorts_Utxo_All_Outputs { pub unspent_count: BaseDeltaPattern, @@ -7535,7 +7448,7 @@ impl SeriesTree_Cohorts_Utxo_All_Unrealized_Sentiment { /// Series tree node. pub struct SeriesTree_Cohorts_Utxo_Sth { - pub supply: DeltaHalfInToTotalPattern2, + pub supply: DeltaDominanceHalfInTotalPattern2, pub outputs: SpendingSpentUnspentPattern, pub activity: CoindaysCoinyearsDormancyTransferPattern, pub realized: SeriesTree_Cohorts_Utxo_Sth_Realized, @@ -7547,7 +7460,7 @@ pub struct SeriesTree_Cohorts_Utxo_Sth { impl SeriesTree_Cohorts_Utxo_Sth { pub fn new(client: Arc, base_path: String) -> Self { Self { - supply: DeltaHalfInToTotalPattern2::new(client.clone(), "sth_supply".to_string()), + supply: DeltaDominanceHalfInTotalPattern2::new(client.clone(), "sth_supply".to_string()), outputs: SpendingSpentUnspentPattern::new(client.clone(), "sth".to_string()), activity: CoindaysCoinyearsDormancyTransferPattern::new(client.clone(), "sth".to_string()), realized: SeriesTree_Cohorts_Utxo_Sth_Realized::new(client.clone(), format!("{base_path}_realized")), @@ -7805,7 +7718,7 @@ impl SeriesTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_1y { /// Series tree node. pub struct SeriesTree_Cohorts_Utxo_Lth { - pub supply: DeltaHalfInToTotalPattern2, + pub supply: DeltaDominanceHalfInTotalPattern2, pub outputs: SpendingSpentUnspentPattern, pub activity: CoindaysCoinyearsDormancyTransferPattern, pub realized: SeriesTree_Cohorts_Utxo_Lth_Realized, @@ -7817,7 +7730,7 @@ pub struct SeriesTree_Cohorts_Utxo_Lth { impl SeriesTree_Cohorts_Utxo_Lth { pub fn new(client: Arc, base_path: String) -> Self { Self { - supply: DeltaHalfInToTotalPattern2::new(client.clone(), "lth_supply".to_string()), + supply: DeltaDominanceHalfInTotalPattern2::new(client.clone(), "lth_supply".to_string()), outputs: SpendingSpentUnspentPattern::new(client.clone(), "lth".to_string()), activity: CoindaysCoinyearsDormancyTransferPattern::new(client.clone(), "lth".to_string()), realized: SeriesTree_Cohorts_Utxo_Lth_Realized::new(client.clone(), format!("{base_path}_realized")), diff --git a/crates/brk_computer/src/distribution/cohorts/addr/groups.rs b/crates/brk_computer/src/distribution/cohorts/addr/groups.rs index 1b6bf0c14..7b3ccd44e 100644 --- a/crates/brk_computer/src/distribution/cohorts/addr/groups.rs +++ b/crates/brk_computer/src/distribution/cohorts/addr/groups.rs @@ -3,7 +3,7 @@ use std::path::Path; use brk_cohort::{AddrGroups, AmountRange, Filter, Filtered, OverAmount, UnderAmount}; use brk_error::Result; use brk_traversable::Traversable; -use brk_types::{Height, Indexes, StoredU64, Version}; +use brk_types::{Height, Indexes, Sats, StoredU64, Version}; use derive_more::{Deref, DerefMut}; use rayon::prelude::*; use vecdb::{AnyStoredVec, Database, Exit, ReadableVec, Rw, StorageMode}; @@ -109,12 +109,19 @@ impl AddrCohorts { &mut self, prices: &prices::Vecs, starting_indexes: &Indexes, + all_supply_sats: &impl ReadableVec, all_utxo_count: &impl ReadableVec, exit: &Exit, ) -> Result<()> { - self.0 - .par_iter_mut() - .try_for_each(|v| v.compute_rest_part2(prices, starting_indexes, all_utxo_count, exit)) + self.0.par_iter_mut().try_for_each(|v| { + v.compute_rest_part2( + prices, + starting_indexes, + all_supply_sats, + all_utxo_count, + exit, + ) + }) } /// Returns a parallel iterator over all vecs for parallel writing. diff --git a/crates/brk_computer/src/distribution/cohorts/addr/vecs.rs b/crates/brk_computer/src/distribution/cohorts/addr/vecs.rs index 2aaa798c0..a141bbd61 100644 --- a/crates/brk_computer/src/distribution/cohorts/addr/vecs.rs +++ b/crates/brk_computer/src/distribution/cohorts/addr/vecs.rs @@ -3,7 +3,7 @@ use std::path::Path; use brk_cohort::{CohortContext, Filter, Filtered}; use brk_error::Result; use brk_traversable::Traversable; -use brk_types::{BasisPointsSigned32, Cents, Height, Indexes, StoredI64, StoredU64, Version}; +use brk_types::{BasisPointsSigned32, Cents, Height, Indexes, Sats, StoredI64, StoredU64, Version}; use rayon::prelude::*; use vecdb::{AnyStoredVec, AnyVec, Database, Exit, ReadableVec, Rw, StorageMode, WritableVec}; @@ -230,10 +230,16 @@ impl CohortVecs for AddrCohortVecs { &mut self, prices: &prices::Vecs, starting_indexes: &Indexes, + all_supply_sats: &impl ReadableVec, all_utxo_count: &impl ReadableVec, exit: &Exit, ) -> Result<()> { - self.metrics - .compute_rest_part2(prices, starting_indexes, all_utxo_count, exit) + self.metrics.compute_rest_part2( + prices, + starting_indexes, + all_supply_sats, + all_utxo_count, + exit, + ) } } diff --git a/crates/brk_computer/src/distribution/cohorts/traits.rs b/crates/brk_computer/src/distribution/cohorts/traits.rs index 7306177dd..67d4118d5 100644 --- a/crates/brk_computer/src/distribution/cohorts/traits.rs +++ b/crates/brk_computer/src/distribution/cohorts/traits.rs @@ -1,5 +1,5 @@ use brk_error::Result; -use brk_types::{Cents, Height, Indexes, StoredU64, Version}; +use brk_types::{Cents, Height, Indexes, Sats, StoredU64, Version}; use vecdb::{Exit, ReadableVec}; use crate::prices; @@ -62,6 +62,7 @@ pub trait CohortVecs: DynCohortVecs { &mut self, prices: &prices::Vecs, starting_indexes: &Indexes, + all_supply_sats: &impl ReadableVec, all_utxo_count: &impl ReadableVec, exit: &Exit, ) -> Result<()>; diff --git a/crates/brk_computer/src/distribution/cohorts/utxo/groups.rs b/crates/brk_computer/src/distribution/cohorts/utxo/groups.rs index c42e19e59..6449bdf94 100644 --- a/crates/brk_computer/src/distribution/cohorts/utxo/groups.rs +++ b/crates/brk_computer/src/distribution/cohorts/utxo/groups.rs @@ -660,7 +660,7 @@ impl UTXOCohorts { Box::new(|| { over_amount.par_iter_mut().try_for_each(|v| { v.metrics - .compute_rest_part2(prices, starting_indexes, au, exit) + .compute_rest_part2(prices, starting_indexes, ss, au, exit) }) }), Box::new(|| { @@ -678,19 +678,19 @@ impl UTXOCohorts { Box::new(|| { amount_range.par_iter_mut().try_for_each(|v| { v.metrics - .compute_rest_part2(prices, starting_indexes, au, exit) + .compute_rest_part2(prices, starting_indexes, ss, au, exit) }) }), Box::new(|| { under_amount.par_iter_mut().try_for_each(|v| { v.metrics - .compute_rest_part2(prices, starting_indexes, au, exit) + .compute_rest_part2(prices, starting_indexes, ss, au, exit) }) }), Box::new(|| { type_.par_iter_mut().try_for_each(|v| { v.metrics - .compute_rest_part2(prices, starting_indexes, au, exit) + .compute_rest_part2(prices, starting_indexes, ss, au, exit) }) }), ]; diff --git a/crates/brk_computer/src/distribution/metrics/cohort/all.rs b/crates/brk_computer/src/distribution/metrics/cohort/all.rs index fa6e1adf2..6c7dcbb98 100644 --- a/crates/brk_computer/src/distribution/metrics/cohort/all.rs +++ b/crates/brk_computer/src/distribution/metrics/cohort/all.rs @@ -2,8 +2,7 @@ use brk_cohort::Filter; use brk_error::Result; use brk_traversable::Traversable; use brk_types::{Cents, Dollars, Height, Indexes, Version}; -use vecdb::AnyStoredVec; -use vecdb::{Exit, ReadOnlyClone, ReadableVec, Rw, StorageMode}; +use vecdb::{AnyStoredVec, Exit, ReadOnlyClone, ReadableVec, Rw, StorageMode}; use crate::{ blocks, @@ -152,6 +151,10 @@ impl AllCohortMetrics { self.unrealized .compute_sentiment(starting_indexes, &prices.spot.cents.height, exit)?; + let own_supply_sats = self.supply.total.sats.height.read_only_clone(); + self.supply + .compute_dominance(starting_indexes.height, &own_supply_sats, exit)?; + self.relative.compute( starting_indexes.height, &self.supply, diff --git a/crates/brk_computer/src/distribution/metrics/cohort/basic.rs b/crates/brk_computer/src/distribution/metrics/cohort/basic.rs index c16245ba1..84c6bab57 100644 --- a/crates/brk_computer/src/distribution/metrics/cohort/basic.rs +++ b/crates/brk_computer/src/distribution/metrics/cohort/basic.rs @@ -6,14 +6,13 @@ use vecdb::{AnyStoredVec, Exit, ReadableVec, Rw, StorageMode}; use crate::{ distribution::metrics::{ - ActivityCore, CohortMetricsBase, ImportConfig, OutputsBase, RealizedCore, RelativeToAll, - SupplyCore, UnrealizedCore, + ActivityCore, CohortMetricsBase, ImportConfig, OutputsBase, RealizedCore, SupplyCore, + UnrealizedCore, }, prices, }; -/// Basic cohort metrics: no extensions, with relative (rel_to_all). -/// Used by: age_range cohorts. +/// Basic cohort metrics: no extensions, used by age_range cohorts. #[derive(Traversable)] pub struct BasicCohortMetrics { #[traversable(skip)] @@ -23,8 +22,6 @@ pub struct BasicCohortMetrics { pub activity: Box>, pub realized: Box>, pub unrealized: Box>, - #[traversable(flatten)] - pub relative: Box>, } impl CohortMetricsBase for BasicCohortMetrics { @@ -51,8 +48,6 @@ impl BasicCohortMetrics { let unrealized = UnrealizedCore::forced_import(cfg)?; let realized = RealizedCore::forced_import(cfg)?; - let relative = RelativeToAll::forced_import(cfg)?; - Ok(Self { filter: cfg.filter.clone(), supply: Box::new(supply), @@ -60,7 +55,6 @@ impl BasicCohortMetrics { activity: Box::new(ActivityCore::forced_import(cfg)?), realized: Box::new(realized), unrealized: Box::new(unrealized), - relative: Box::new(relative), }) } @@ -87,8 +81,8 @@ impl BasicCohortMetrics { exit, )?; - self.relative - .compute(starting_indexes.height, &self.supply, all_supply_sats, exit)?; + self.supply + .compute_dominance(starting_indexes.height, all_supply_sats, exit)?; self.outputs .compute_part2(starting_indexes.height, all_utxo_count, exit)?; diff --git a/crates/brk_computer/src/distribution/metrics/cohort/core.rs b/crates/brk_computer/src/distribution/metrics/cohort/core.rs index de14a707a..d215bdb88 100644 --- a/crates/brk_computer/src/distribution/metrics/cohort/core.rs +++ b/crates/brk_computer/src/distribution/metrics/cohort/core.rs @@ -6,8 +6,8 @@ use vecdb::{AnyStoredVec, Exit, ReadableVec, Rw, StorageMode}; use crate::{ distribution::metrics::{ - ActivityCore, CohortMetricsBase, ImportConfig, OutputsBase, RealizedCore, RelativeToAll, - SupplyCore, UnrealizedCore, + ActivityCore, CohortMetricsBase, ImportConfig, OutputsBase, RealizedCore, SupplyCore, + UnrealizedCore, }, prices, }; @@ -21,8 +21,6 @@ pub struct CoreCohortMetrics { pub activity: Box>, pub realized: Box>, pub unrealized: Box>, - #[traversable(flatten)] - pub relative: Box>, } impl CoreCohortMetrics { @@ -34,7 +32,6 @@ impl CoreCohortMetrics { activity: Box::new(ActivityCore::forced_import(cfg)?), realized: Box::new(RealizedCore::forced_import(cfg)?), unrealized: Box::new(UnrealizedCore::forced_import(cfg)?), - relative: Box::new(RelativeToAll::forced_import(cfg)?), }) } @@ -145,8 +142,8 @@ impl CoreCohortMetrics { exit, )?; - self.relative - .compute(starting_indexes.height, &self.supply, all_supply_sats, exit)?; + self.supply + .compute_dominance(starting_indexes.height, all_supply_sats, exit)?; self.outputs .compute_part2(starting_indexes.height, all_utxo_count, exit)?; diff --git a/crates/brk_computer/src/distribution/metrics/cohort/extended.rs b/crates/brk_computer/src/distribution/metrics/cohort/extended.rs index 7e312074c..8f708ac7b 100644 --- a/crates/brk_computer/src/distribution/metrics/cohort/extended.rs +++ b/crates/brk_computer/src/distribution/metrics/cohort/extended.rs @@ -128,13 +128,15 @@ impl ExtendedCohortMetrics { self.unrealized .compute_sentiment(starting_indexes, &prices.spot.cents.height, exit)?; + self.supply + .compute_dominance(starting_indexes.height, all_supply_sats, exit)?; + self.relative.compute( starting_indexes.height, &self.supply, &self.unrealized, &self.realized, height_to_market_cap, - all_supply_sats, &self.supply.total.usd.height, exit, )?; diff --git a/crates/brk_computer/src/distribution/metrics/cohort/minimal.rs b/crates/brk_computer/src/distribution/metrics/cohort/minimal.rs index 834aed0db..c4cc9c84a 100644 --- a/crates/brk_computer/src/distribution/metrics/cohort/minimal.rs +++ b/crates/brk_computer/src/distribution/metrics/cohort/minimal.rs @@ -1,7 +1,7 @@ use brk_cohort::Filter; use brk_error::Result; use brk_traversable::Traversable; -use brk_types::{Height, Indexes, StoredU64}; +use brk_types::{Height, Indexes, Sats, StoredU64}; use vecdb::{AnyStoredVec, Exit, ReadableVec, Rw, StorageMode}; use crate::{ @@ -112,6 +112,7 @@ impl MinimalCohortMetrics { &mut self, prices: &prices::Vecs, starting_indexes: &Indexes, + all_supply_sats: &impl ReadableVec, all_utxo_count: &impl ReadableVec, exit: &Exit, ) -> Result<()> { @@ -129,6 +130,9 @@ impl MinimalCohortMetrics { exit, )?; + self.supply + .compute_dominance(starting_indexes.height, all_supply_sats, exit)?; + self.outputs .compute_part2(starting_indexes.height, all_utxo_count, exit)?; diff --git a/crates/brk_computer/src/distribution/metrics/cohort/type.rs b/crates/brk_computer/src/distribution/metrics/cohort/type.rs index b0870b1bb..cbd2c67d8 100644 --- a/crates/brk_computer/src/distribution/metrics/cohort/type.rs +++ b/crates/brk_computer/src/distribution/metrics/cohort/type.rs @@ -1,7 +1,7 @@ use brk_cohort::Filter; use brk_error::Result; use brk_traversable::Traversable; -use brk_types::{Height, Indexes, StoredU64}; +use brk_types::{Height, Indexes, Sats, StoredU64}; use vecdb::{AnyStoredVec, Exit, ReadableVec, Rw, StorageMode}; use crate::{ @@ -74,6 +74,7 @@ impl TypeCohortMetrics { &mut self, prices: &prices::Vecs, starting_indexes: &Indexes, + all_supply_sats: &impl ReadableVec, all_utxo_count: &impl ReadableVec, exit: &Exit, ) -> Result<()> { @@ -91,6 +92,9 @@ impl TypeCohortMetrics { exit, )?; + self.supply + .compute_dominance(starting_indexes.height, all_supply_sats, exit)?; + self.outputs .compute_part2(starting_indexes.height, all_utxo_count, exit)?; diff --git a/crates/brk_computer/src/distribution/metrics/mod.rs b/crates/brk_computer/src/distribution/metrics/mod.rs index b3f0799f5..dcbee2e70 100644 --- a/crates/brk_computer/src/distribution/metrics/mod.rs +++ b/crates/brk_computer/src/distribution/metrics/mod.rs @@ -132,7 +132,7 @@ pub use profitability::ProfitabilityMetrics; pub use realized::{ AdjustedSopr, RealizedCore, RealizedFull, RealizedFullAccum, RealizedLike, RealizedMinimal, }; -pub use relative::{RelativeForAll, RelativeToAll, RelativeWithExtended}; +pub use relative::{RelativeForAll, RelativeWithExtended}; pub use supply::{AvgAmountMetrics, SupplyBase, SupplyCore}; pub use unrealized::{ UnrealizedBasic, UnrealizedCore, UnrealizedFull, UnrealizedLike, UnrealizedMinimal, diff --git a/crates/brk_computer/src/distribution/metrics/relative/full.rs b/crates/brk_computer/src/distribution/metrics/relative/full.rs index 826081f18..bdd7862dd 100644 --- a/crates/brk_computer/src/distribution/metrics/relative/full.rs +++ b/crates/brk_computer/src/distribution/metrics/relative/full.rs @@ -11,10 +11,10 @@ use crate::{ /// Full relative metrics (sth/lth/all tier). #[derive(Traversable)] pub struct RelativeFull { - #[traversable(wrap = "supply/in_profit", rename = "to_own")] - pub supply_in_profit_to_own: PercentPerBlock, - #[traversable(wrap = "supply/in_loss", rename = "to_own")] - pub supply_in_loss_to_own: PercentPerBlock, + #[traversable(wrap = "supply/in_profit", rename = "share")] + pub supply_in_profit_share: PercentPerBlock, + #[traversable(wrap = "supply/in_loss", rename = "share")] + pub supply_in_loss_share: PercentPerBlock, #[traversable(wrap = "unrealized/profit", rename = "to_mcap")] pub unrealized_profit_to_mcap: PercentPerBlock, @@ -28,8 +28,8 @@ impl RelativeFull { let v2 = Version::new(2); Ok(Self { - supply_in_profit_to_own: cfg.import("supply_in_profit_to_own", v1)?, - supply_in_loss_to_own: cfg.import("supply_in_loss_to_own", v1)?, + supply_in_profit_share: cfg.import("supply_in_profit_share", v1)?, + supply_in_loss_share: cfg.import("supply_in_loss_share", v1)?, unrealized_profit_to_mcap: cfg.import("unrealized_profit_to_mcap", v2)?, unrealized_loss_to_mcap: cfg.import("unrealized_loss_to_mcap", v2)?, }) @@ -43,14 +43,14 @@ impl RelativeFull { market_cap: &impl ReadableVec, exit: &Exit, ) -> Result<()> { - self.supply_in_profit_to_own + self.supply_in_profit_share .compute_binary::( max_from, &supply.in_profit.sats.height, &supply.total.sats.height, exit, )?; - self.supply_in_loss_to_own + self.supply_in_loss_share .compute_binary::( max_from, &supply.in_loss.sats.height, diff --git a/crates/brk_computer/src/distribution/metrics/relative/invested_capital.rs b/crates/brk_computer/src/distribution/metrics/relative/invested_capital.rs index c69070d65..9c16c3b1b 100644 --- a/crates/brk_computer/src/distribution/metrics/relative/invested_capital.rs +++ b/crates/brk_computer/src/distribution/metrics/relative/invested_capital.rs @@ -11,18 +11,18 @@ use crate::distribution::metrics::{ImportConfig, RealizedFull, UnrealizedFull}; /// Present for cohorts with `UnrealizedFull` (all, sth, lth). #[derive(Traversable)] pub struct RelativeInvestedCapital { - #[traversable(wrap = "invested_capital/in_profit", rename = "to_own")] - pub in_profit_to_own: PercentPerBlock, - #[traversable(wrap = "invested_capital/in_loss", rename = "to_own")] - pub in_loss_to_own: PercentPerBlock, + #[traversable(wrap = "invested_capital/in_profit", rename = "share")] + pub in_profit_share: PercentPerBlock, + #[traversable(wrap = "invested_capital/in_loss", rename = "share")] + pub in_loss_share: PercentPerBlock, } impl RelativeInvestedCapital { pub(crate) fn forced_import(cfg: &ImportConfig) -> Result { let v0 = Version::ZERO; Ok(Self { - in_profit_to_own: cfg.import("invested_capital_in_profit_to_own", v0)?, - in_loss_to_own: cfg.import("invested_capital_in_loss_to_own", v0)?, + in_profit_share: cfg.import("invested_capital_in_profit_share", v0)?, + in_loss_share: cfg.import("invested_capital_in_loss_share", v0)?, }) } @@ -34,14 +34,14 @@ impl RelativeInvestedCapital { exit: &Exit, ) -> Result<()> { let realized_cap = &realized.core.minimal.cap.cents.height; - self.in_profit_to_own + self.in_profit_share .compute_binary::( max_from, &unrealized.invested_capital.in_profit.cents.height, realized_cap, exit, )?; - self.in_loss_to_own + self.in_loss_share .compute_binary::( max_from, &unrealized.invested_capital.in_loss.cents.height, diff --git a/crates/brk_computer/src/distribution/metrics/relative/mod.rs b/crates/brk_computer/src/distribution/metrics/relative/mod.rs index 9f338eeaf..de9669ce6 100644 --- a/crates/brk_computer/src/distribution/metrics/relative/mod.rs +++ b/crates/brk_computer/src/distribution/metrics/relative/mod.rs @@ -3,7 +3,6 @@ mod extended_own_pnl; mod for_all; mod full; mod invested_capital; -mod to_all; mod with_extended; pub use extended_own_market_cap::RelativeExtendedOwnMarketCap; @@ -11,5 +10,4 @@ pub use extended_own_pnl::RelativeExtendedOwnPnl; pub use for_all::RelativeForAll; pub use full::RelativeFull; pub use invested_capital::RelativeInvestedCapital; -pub use to_all::RelativeToAll; pub use with_extended::RelativeWithExtended; diff --git a/crates/brk_computer/src/distribution/metrics/relative/to_all.rs b/crates/brk_computer/src/distribution/metrics/relative/to_all.rs deleted file mode 100644 index 2146432eb..000000000 --- a/crates/brk_computer/src/distribution/metrics/relative/to_all.rs +++ /dev/null @@ -1,62 +0,0 @@ -use brk_error::Result; -use brk_traversable::Traversable; -use brk_types::{BasisPoints16, Height, Sats, Version}; -use vecdb::{Exit, ReadableVec, Rw, StorageMode}; - -use crate::internal::{PercentPerBlock, RatioSatsBp16}; - -use crate::distribution::metrics::{ImportConfig, SupplyCore}; - -/// Relative-to-all metrics (not present for the "all" cohort itself). -#[derive(Traversable)] -pub struct RelativeToAll { - #[traversable(wrap = "supply", rename = "to_circulating")] - pub supply_to_circulating: PercentPerBlock, - #[traversable(wrap = "supply/in_profit", rename = "to_circulating")] - pub supply_in_profit_to_circulating: PercentPerBlock, - #[traversable(wrap = "supply/in_loss", rename = "to_circulating")] - pub supply_in_loss_to_circulating: PercentPerBlock, -} - -impl RelativeToAll { - pub(crate) fn forced_import(cfg: &ImportConfig) -> Result { - Ok(Self { - supply_to_circulating: cfg.import("supply_to_circulating", Version::ONE)?, - supply_in_profit_to_circulating: cfg - .import("supply_in_profit_to_circulating", Version::ONE)?, - supply_in_loss_to_circulating: cfg - .import("supply_in_loss_to_circulating", Version::ONE)?, - }) - } - - pub(crate) fn compute( - &mut self, - max_from: Height, - supply: &SupplyCore, - all_supply_sats: &impl ReadableVec, - exit: &Exit, - ) -> Result<()> { - self.supply_to_circulating - .compute_binary::( - max_from, - &supply.total.sats.height, - all_supply_sats, - exit, - )?; - self.supply_in_profit_to_circulating - .compute_binary::( - max_from, - &supply.in_profit.sats.height, - all_supply_sats, - exit, - )?; - self.supply_in_loss_to_circulating - .compute_binary::( - max_from, - &supply.in_loss.sats.height, - all_supply_sats, - exit, - )?; - Ok(()) - } -} diff --git a/crates/brk_computer/src/distribution/metrics/relative/with_extended.rs b/crates/brk_computer/src/distribution/metrics/relative/with_extended.rs index 8a74e85b4..b71a141b9 100644 --- a/crates/brk_computer/src/distribution/metrics/relative/with_extended.rs +++ b/crates/brk_computer/src/distribution/metrics/relative/with_extended.rs @@ -1,6 +1,6 @@ use brk_error::Result; use brk_traversable::Traversable; -use brk_types::{Dollars, Height, Sats}; +use brk_types::{Dollars, Height}; use derive_more::{Deref, DerefMut}; use vecdb::{Exit, ReadableVec, Rw, StorageMode}; @@ -8,10 +8,9 @@ use crate::distribution::metrics::{ImportConfig, RealizedFull, SupplyCore, Unrea use super::{ RelativeExtendedOwnMarketCap, RelativeExtendedOwnPnl, RelativeFull, RelativeInvestedCapital, - RelativeToAll, }; -/// Full extended relative metrics (base + rel_to_all + own_market_cap + own_pnl). +/// Full extended relative metrics (base + own_market_cap + own_pnl + invested_capital). /// Used by: sth, lth cohorts. #[derive(Deref, DerefMut, Traversable)] pub struct RelativeWithExtended { @@ -20,8 +19,6 @@ pub struct RelativeWithExtended { #[traversable(flatten)] pub base: RelativeFull, #[traversable(flatten)] - pub rel_to_all: RelativeToAll, - #[traversable(flatten)] pub extended_own_market_cap: RelativeExtendedOwnMarketCap, #[traversable(flatten)] pub extended_own_pnl: RelativeExtendedOwnPnl, @@ -33,7 +30,6 @@ impl RelativeWithExtended { pub(crate) fn forced_import(cfg: &ImportConfig) -> Result { Ok(Self { base: RelativeFull::forced_import(cfg)?, - rel_to_all: RelativeToAll::forced_import(cfg)?, extended_own_market_cap: RelativeExtendedOwnMarketCap::forced_import(cfg)?, extended_own_pnl: RelativeExtendedOwnPnl::forced_import(cfg)?, invested_capital: RelativeInvestedCapital::forced_import(cfg)?, @@ -48,14 +44,11 @@ impl RelativeWithExtended { unrealized: &UnrealizedFull, realized: &RealizedFull, market_cap: &impl ReadableVec, - all_supply_sats: &impl ReadableVec, own_market_cap: &impl ReadableVec, exit: &Exit, ) -> Result<()> { self.base .compute(max_from, supply, &unrealized.inner.basic, market_cap, exit)?; - self.rel_to_all - .compute(max_from, supply, all_supply_sats, exit)?; self.extended_own_market_cap .compute(max_from, &unrealized.inner, own_market_cap, exit)?; self.extended_own_pnl.compute( diff --git a/crates/brk_computer/src/distribution/metrics/supply/base.rs b/crates/brk_computer/src/distribution/metrics/supply/base.rs index 5726b8739..2afa5fe14 100644 --- a/crates/brk_computer/src/distribution/metrics/supply/base.rs +++ b/crates/brk_computer/src/distribution/metrics/supply/base.rs @@ -1,22 +1,26 @@ use brk_error::Result; use brk_traversable::Traversable; -use brk_types::{BasisPointsSigned32, Height, Indexes, Sats, SatsSigned, Version}; -use vecdb::{AnyStoredVec, AnyVec, Exit, Rw, StorageMode, WritableVec}; +use brk_types::{BasisPoints16, BasisPointsSigned32, Height, Indexes, Sats, SatsSigned, Version}; +use vecdb::{AnyStoredVec, AnyVec, Exit, ReadableVec, Rw, StorageMode, WritableVec}; use crate::{ distribution::state::{CohortState, CostBasisOps, RealizedOps}, prices, }; -use crate::internal::{AmountPerBlock, LazyRollingDeltasFromHeight}; +use crate::internal::{ + AmountPerBlock, LazyRollingDeltasFromHeight, PercentPerBlock, RatioSatsBp16, +}; use crate::distribution::metrics::ImportConfig; -/// Base supply metrics: total supply only (2 stored vecs). +/// Base supply metrics: total supply + dominance (share of circulating). #[derive(Traversable)] pub struct SupplyBase { pub total: AmountPerBlock, pub delta: LazyRollingDeltasFromHeight, + #[traversable(rename = "dominance")] + pub dominance: PercentPerBlock, } impl SupplyBase { @@ -31,9 +35,12 @@ impl SupplyBase { cfg.indexes, ); + let dominance = cfg.import("supply_dominance", Version::ZERO)?; + Ok(Self { total: supply, delta, + dominance, }) } @@ -50,6 +57,7 @@ impl SupplyBase { vec![ &mut self.total.sats.height as &mut dyn AnyStoredVec, &mut self.total.cents.height, + &mut self.dominance.bps.height, ] } @@ -62,6 +70,21 @@ impl SupplyBase { self.total.compute(prices, max_from, exit) } + pub(crate) fn compute_dominance( + &mut self, + max_from: Height, + all_supply_sats: &impl ReadableVec, + exit: &Exit, + ) -> Result<()> { + self.dominance + .compute_binary::( + max_from, + &self.total.sats.height, + all_supply_sats, + exit, + ) + } + pub(crate) fn compute_from_stateful( &mut self, starting_indexes: &Indexes, diff --git a/crates/brk_computer/src/distribution/vecs.rs b/crates/brk_computer/src/distribution/vecs.rs index 1a6894cb9..a9ad42fca 100644 --- a/crates/brk_computer/src/distribution/vecs.rs +++ b/crates/brk_computer/src/distribution/vecs.rs @@ -560,6 +560,15 @@ impl Vecs { exit, )?; + let all_supply_sats = self + .utxo_cohorts + .all + .metrics + .supply + .total + .sats + .height + .read_only_clone(); let all_utxo_count = self .utxo_cohorts .all @@ -568,8 +577,13 @@ impl Vecs { .unspent_count .height .read_only_clone(); - self.addr_cohorts - .compute_rest_part2(prices, starting_indexes, &all_utxo_count, exit)?; + self.addr_cohorts.compute_rest_part2( + prices, + starting_indexes, + &all_supply_sats, + &all_utxo_count, + exit, + )?; let exit = exit.clone(); self.db.run_bg(move |db| { diff --git a/modules/brk-client/index.js b/modules/brk-client/index.js index cedb08acd..9716827d8 100644 --- a/modules/brk-client/index.js +++ b/modules/brk-client/index.js @@ -2717,7 +2717,7 @@ function create_1m1w1y2y4yAllPattern(client, acc) { * @property {BaseDeltaPattern} addrCount * @property {SpendingSpentUnspentPattern} outputs * @property {CapLossMvrvPriceProfitPattern} realized - * @property {DeltaTotalPattern} supply + * @property {DeltaDominanceTotalPattern} supply * @property {NuplPattern} unrealized */ @@ -2733,7 +2733,7 @@ function createActivityAddrOutputsRealizedSupplyUnrealizedPattern(client, acc) { addrCount: createBaseDeltaPattern(client, _m(acc, 'addr_count')), outputs: createSpendingSpentUnspentPattern(client, acc), realized: createCapLossMvrvPriceProfitPattern(client, acc), - supply: createDeltaTotalPattern(client, _m(acc, 'supply')), + supply: createDeltaDominanceTotalPattern(client, _m(acc, 'supply')), unrealized: createNuplPattern(client, _m(acc, 'nupl')), }; } @@ -2792,33 +2792,6 @@ function createBpsCentsPercentilesRatioSatsUsdPattern(client, acc) { }; } -/** - * @typedef {Object} BtcCentsSatsToUsdPattern3 - * @property {SeriesPattern1} btc - * @property {SeriesPattern1} cents - * @property {SeriesPattern1} sats - * @property {BpsPercentRatioPattern2} toCirculating - * @property {BpsPercentRatioPattern2} toOwn - * @property {SeriesPattern1} usd - */ - -/** - * Create a BtcCentsSatsToUsdPattern3 pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated series name - * @returns {BtcCentsSatsToUsdPattern3} - */ -function createBtcCentsSatsToUsdPattern3(client, acc) { - return { - btc: createSeriesPattern1(client, acc), - cents: createSeriesPattern1(client, _m(acc, 'cents')), - sats: createSeriesPattern1(client, _m(acc, 'sats')), - toCirculating: createBpsPercentRatioPattern2(client, _m(acc, 'to_circulating')), - toOwn: createBpsPercentRatioPattern2(client, _m(acc, 'to_own')), - usd: createSeriesPattern1(client, _m(acc, 'usd')), - }; -} - /** * @typedef {Object} CentsNegativeToUsdPattern2 * @property {SeriesPattern1} cents @@ -2847,55 +2820,55 @@ function createCentsNegativeToUsdPattern2(client, acc) { } /** - * @typedef {Object} DeltaHalfInToTotalPattern + * @typedef {Object} DeltaDominanceHalfInTotalPattern2 * @property {AbsoluteRatePattern} delta + * @property {BpsPercentRatioPattern2} dominance * @property {BtcCentsSatsUsdPattern} half - * @property {BtcCentsSatsToUsdPattern} inLoss - * @property {BtcCentsSatsToUsdPattern} inProfit - * @property {BpsPercentRatioPattern2} toCirculating + * @property {BtcCentsSatsShareUsdPattern} inLoss + * @property {BtcCentsSatsShareUsdPattern} inProfit * @property {BtcCentsSatsUsdPattern} total */ /** - * Create a DeltaHalfInToTotalPattern pattern node + * Create a DeltaDominanceHalfInTotalPattern2 pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated series name - * @returns {DeltaHalfInToTotalPattern} + * @returns {DeltaDominanceHalfInTotalPattern2} */ -function createDeltaHalfInToTotalPattern(client, acc) { +function createDeltaDominanceHalfInTotalPattern2(client, acc) { return { delta: createAbsoluteRatePattern(client, _m(acc, 'delta')), + dominance: createBpsPercentRatioPattern2(client, _m(acc, 'dominance')), half: createBtcCentsSatsUsdPattern(client, _m(acc, 'half')), - inLoss: createBtcCentsSatsToUsdPattern(client, _m(acc, 'in_loss')), - inProfit: createBtcCentsSatsToUsdPattern(client, _m(acc, 'in_profit')), - toCirculating: createBpsPercentRatioPattern2(client, _m(acc, 'to_circulating')), + inLoss: createBtcCentsSatsShareUsdPattern(client, _m(acc, 'in_loss')), + inProfit: createBtcCentsSatsShareUsdPattern(client, _m(acc, 'in_profit')), total: createBtcCentsSatsUsdPattern(client, acc), }; } /** - * @typedef {Object} DeltaHalfInToTotalPattern2 + * @typedef {Object} DeltaDominanceHalfInTotalPattern * @property {AbsoluteRatePattern} delta + * @property {BpsPercentRatioPattern2} dominance * @property {BtcCentsSatsUsdPattern} half - * @property {BtcCentsSatsToUsdPattern3} inLoss - * @property {BtcCentsSatsToUsdPattern3} inProfit - * @property {BpsPercentRatioPattern2} toCirculating + * @property {BtcCentsSatsUsdPattern} inLoss + * @property {BtcCentsSatsUsdPattern} inProfit * @property {BtcCentsSatsUsdPattern} total */ /** - * Create a DeltaHalfInToTotalPattern2 pattern node + * Create a DeltaDominanceHalfInTotalPattern pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated series name - * @returns {DeltaHalfInToTotalPattern2} + * @returns {DeltaDominanceHalfInTotalPattern} */ -function createDeltaHalfInToTotalPattern2(client, acc) { +function createDeltaDominanceHalfInTotalPattern(client, acc) { return { delta: createAbsoluteRatePattern(client, _m(acc, 'delta')), + dominance: createBpsPercentRatioPattern2(client, _m(acc, 'dominance')), half: createBtcCentsSatsUsdPattern(client, _m(acc, 'half')), - inLoss: createBtcCentsSatsToUsdPattern3(client, _m(acc, 'in_loss')), - inProfit: createBtcCentsSatsToUsdPattern3(client, _m(acc, 'in_profit')), - toCirculating: createBpsPercentRatioPattern2(client, _m(acc, 'to_circulating')), + inLoss: createBtcCentsSatsUsdPattern(client, _m(acc, 'in_loss')), + inProfit: createBtcCentsSatsUsdPattern(client, _m(acc, 'in_profit')), total: createBtcCentsSatsUsdPattern(client, acc), }; } @@ -2955,7 +2928,7 @@ function createActiveBidirectionalReactivatedReceivingSendingPattern(client, acc * @property {CoindaysTransferPattern} activity * @property {SpendingSpentUnspentPattern} outputs * @property {CapLossMvrvNetPriceProfitSoprPattern} realized - * @property {DeltaHalfInToTotalPattern} supply + * @property {DeltaDominanceHalfInTotalPattern} supply * @property {LossNetNuplProfitPattern} unrealized */ @@ -2970,7 +2943,7 @@ function createActivityOutputsRealizedSupplyUnrealizedPattern(client, acc) { activity: createCoindaysTransferPattern(client, acc), outputs: createSpendingSpentUnspentPattern(client, acc), realized: createCapLossMvrvNetPriceProfitSoprPattern(client, acc), - supply: createDeltaHalfInToTotalPattern(client, _m(acc, 'supply')), + supply: createDeltaDominanceHalfInTotalPattern(client, _m(acc, 'supply')), unrealized: createLossNetNuplProfitPattern(client, acc), }; } @@ -2980,7 +2953,7 @@ function createActivityOutputsRealizedSupplyUnrealizedPattern(client, acc) { * @property {TransferPattern} activity * @property {SpendingSpentUnspentPattern} outputs * @property {CapLossMvrvPriceProfitPattern} realized - * @property {DeltaHalfInTotalPattern2} supply + * @property {DeltaDominanceHalfInTotalPattern} supply * @property {LossNuplProfitPattern} unrealized */ @@ -2995,7 +2968,7 @@ function createActivityOutputsRealizedSupplyUnrealizedPattern3(client, acc) { activity: createTransferPattern(client, _m(acc, 'transfer_volume')), outputs: createSpendingSpentUnspentPattern(client, acc), realized: createCapLossMvrvPriceProfitPattern(client, acc), - supply: createDeltaHalfInTotalPattern2(client, _m(acc, 'supply')), + supply: createDeltaDominanceHalfInTotalPattern(client, _m(acc, 'supply')), unrealized: createLossNuplProfitPattern(client, acc), }; } @@ -3005,7 +2978,7 @@ function createActivityOutputsRealizedSupplyUnrealizedPattern3(client, acc) { * @property {TransferPattern} activity * @property {SpendingSpentUnspentPattern} outputs * @property {CapLossMvrvPriceProfitPattern} realized - * @property {DeltaTotalPattern} supply + * @property {DeltaDominanceTotalPattern} supply * @property {NuplPattern} unrealized */ @@ -3020,7 +2993,7 @@ function createActivityOutputsRealizedSupplyUnrealizedPattern2(client, acc) { activity: createTransferPattern(client, _m(acc, 'transfer_volume')), outputs: createSpendingSpentUnspentPattern(client, acc), realized: createCapLossMvrvPriceProfitPattern(client, acc), - supply: createDeltaTotalPattern(client, _m(acc, 'supply')), + supply: createDeltaDominanceTotalPattern(client, _m(acc, 'supply')), unrealized: createNuplPattern(client, _m(acc, 'nupl')), }; } @@ -3101,51 +3074,26 @@ function createBtcCentsDeltaSatsUsdPattern(client, acc) { } /** - * @typedef {Object} BtcCentsSatsToUsdPattern + * @typedef {Object} BtcCentsSatsShareUsdPattern * @property {SeriesPattern1} btc * @property {SeriesPattern1} cents * @property {SeriesPattern1} sats - * @property {BpsPercentRatioPattern2} toCirculating + * @property {BpsPercentRatioPattern2} share * @property {SeriesPattern1} usd */ /** - * Create a BtcCentsSatsToUsdPattern pattern node + * Create a BtcCentsSatsShareUsdPattern pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated series name - * @returns {BtcCentsSatsToUsdPattern} + * @returns {BtcCentsSatsShareUsdPattern} */ -function createBtcCentsSatsToUsdPattern(client, acc) { +function createBtcCentsSatsShareUsdPattern(client, acc) { return { btc: createSeriesPattern1(client, acc), cents: createSeriesPattern1(client, _m(acc, 'cents')), sats: createSeriesPattern1(client, _m(acc, 'sats')), - toCirculating: createBpsPercentRatioPattern2(client, _m(acc, 'to_circulating')), - usd: createSeriesPattern1(client, _m(acc, 'usd')), - }; -} - -/** - * @typedef {Object} BtcCentsSatsToUsdPattern2 - * @property {SeriesPattern1} btc - * @property {SeriesPattern1} cents - * @property {SeriesPattern1} sats - * @property {BpsPercentRatioPattern2} toOwn - * @property {SeriesPattern1} usd - */ - -/** - * Create a BtcCentsSatsToUsdPattern2 pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated series name - * @returns {BtcCentsSatsToUsdPattern2} - */ -function createBtcCentsSatsToUsdPattern2(client, acc) { - return { - btc: createSeriesPattern1(client, acc), - cents: createSeriesPattern1(client, _m(acc, 'cents')), - sats: createSeriesPattern1(client, _m(acc, 'sats')), - toOwn: createBpsPercentRatioPattern2(client, _m(acc, 'to_own')), + share: createBpsPercentRatioPattern2(client, _m(acc, 'share')), usd: createSeriesPattern1(client, _m(acc, 'usd')), }; } @@ -3200,31 +3148,6 @@ function createCentsToUsdPattern4(client, acc) { }; } -/** - * @typedef {Object} DeltaHalfInTotalPattern2 - * @property {AbsoluteRatePattern} delta - * @property {BtcCentsSatsUsdPattern} half - * @property {BtcCentsSatsUsdPattern} inLoss - * @property {BtcCentsSatsUsdPattern} inProfit - * @property {BtcCentsSatsUsdPattern} total - */ - -/** - * Create a DeltaHalfInTotalPattern2 pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated series name - * @returns {DeltaHalfInTotalPattern2} - */ -function createDeltaHalfInTotalPattern2(client, acc) { - return { - delta: createAbsoluteRatePattern(client, _m(acc, 'delta')), - half: createBtcCentsSatsUsdPattern(client, _m(acc, 'half')), - inLoss: createBtcCentsSatsUsdPattern(client, _m(acc, 'in_loss')), - inProfit: createBtcCentsSatsUsdPattern(client, _m(acc, 'in_profit')), - total: createBtcCentsSatsUsdPattern(client, acc), - }; -} - /** * @typedef {Object} EmaHistogramLineSignalPattern * @property {SeriesPattern1} emaFast @@ -4028,6 +3951,27 @@ function createCumulativeRollingSumPattern(client, acc) { }; } +/** + * @typedef {Object} DeltaDominanceTotalPattern + * @property {AbsoluteRatePattern} delta + * @property {BpsPercentRatioPattern2} dominance + * @property {BtcCentsSatsUsdPattern} total + */ + +/** + * Create a DeltaDominanceTotalPattern pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated series name + * @returns {DeltaDominanceTotalPattern} + */ +function createDeltaDominanceTotalPattern(client, acc) { + return { + delta: createAbsoluteRatePattern(client, _m(acc, 'delta')), + dominance: createBpsPercentRatioPattern2(client, _m(acc, 'dominance')), + total: createBtcCentsSatsUsdPattern(client, acc), + }; +} + /** * @typedef {Object} GreedNetPainPattern * @property {CentsUsdPattern3} greedIndex @@ -4462,25 +4406,6 @@ function createCoindaysTransferPattern(client, acc) { }; } -/** - * @typedef {Object} DeltaTotalPattern - * @property {AbsoluteRatePattern} delta - * @property {BtcCentsSatsUsdPattern} total - */ - -/** - * Create a DeltaTotalPattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated series name - * @returns {DeltaTotalPattern} - */ -function createDeltaTotalPattern(client, acc) { - return { - delta: createAbsoluteRatePattern(client, _m(acc, 'delta')), - total: createBtcCentsSatsUsdPattern(client, acc), - }; -} - /** * @typedef {Object} FundedTotalPattern * @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern4} funded @@ -6300,7 +6225,7 @@ function createTransferPattern(client, acc) { /** * @typedef {Object} SeriesTree_Cohorts_Utxo_All - * @property {SeriesTree_Cohorts_Utxo_All_Supply} supply + * @property {DeltaDominanceHalfInTotalPattern2} supply * @property {SeriesTree_Cohorts_Utxo_All_Outputs} outputs * @property {SeriesTree_Cohorts_Utxo_All_Activity} activity * @property {SeriesTree_Cohorts_Utxo_All_Realized} realized @@ -6309,15 +6234,6 @@ function createTransferPattern(client, acc) { * @property {InPattern} investedCapital */ -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_All_Supply - * @property {BtcCentsSatsUsdPattern} total - * @property {AbsoluteRatePattern} delta - * @property {BtcCentsSatsUsdPattern} half - * @property {BtcCentsSatsToUsdPattern2} inProfit - * @property {BtcCentsSatsToUsdPattern2} inLoss - */ - /** * @typedef {Object} SeriesTree_Cohorts_Utxo_All_Outputs * @property {BaseDeltaPattern} unspentCount @@ -6516,7 +6432,7 @@ function createTransferPattern(client, acc) { /** * @typedef {Object} SeriesTree_Cohorts_Utxo_Sth - * @property {DeltaHalfInToTotalPattern2} supply + * @property {DeltaDominanceHalfInTotalPattern2} supply * @property {SpendingSpentUnspentPattern} outputs * @property {CoindaysCoinyearsDormancyTransferPattern} activity * @property {SeriesTree_Cohorts_Utxo_Sth_Realized} realized @@ -6639,7 +6555,7 @@ function createTransferPattern(client, acc) { /** * @typedef {Object} SeriesTree_Cohorts_Utxo_Lth - * @property {DeltaHalfInToTotalPattern2} supply + * @property {DeltaDominanceHalfInTotalPattern2} supply * @property {SpendingSpentUnspentPattern} outputs * @property {CoindaysCoinyearsDormancyTransferPattern} activity * @property {SeriesTree_Cohorts_Utxo_Lth_Realized} realized @@ -9387,13 +9303,7 @@ class BrkClient extends BrkClientBase { cohorts: { utxo: { all: { - supply: { - total: createBtcCentsSatsUsdPattern(this, 'supply'), - delta: createAbsoluteRatePattern(this, 'supply_delta'), - half: createBtcCentsSatsUsdPattern(this, 'supply_half'), - inProfit: createBtcCentsSatsToUsdPattern2(this, 'supply_in_profit'), - inLoss: createBtcCentsSatsToUsdPattern2(this, 'supply_in_loss'), - }, + supply: createDeltaDominanceHalfInTotalPattern2(this, 'supply'), outputs: { unspentCount: createBaseDeltaPattern(this, 'utxo_count'), spentCount: createAverageBlockCumulativeSumPattern2(this, 'spent_utxo_count'), @@ -9547,7 +9457,7 @@ class BrkClient extends BrkClientBase { investedCapital: createInPattern(this, 'invested_capital_in'), }, sth: { - supply: createDeltaHalfInToTotalPattern2(this, 'sth_supply'), + supply: createDeltaDominanceHalfInTotalPattern2(this, 'sth_supply'), outputs: createSpendingSpentUnspentPattern(this, 'sth'), activity: createCoindaysCoinyearsDormancyTransferPattern(this, 'sth'), realized: { @@ -9647,7 +9557,7 @@ class BrkClient extends BrkClientBase { investedCapital: createInPattern(this, 'sth_invested_capital_in'), }, lth: { - supply: createDeltaHalfInToTotalPattern2(this, 'lth_supply'), + supply: createDeltaDominanceHalfInTotalPattern2(this, 'lth_supply'), outputs: createSpendingSpentUnspentPattern(this, 'lth'), activity: createCoindaysCoinyearsDormancyTransferPattern(this, 'lth'), realized: { diff --git a/packages/brk_client/brk_client/__init__.py b/packages/brk_client/brk_client/__init__.py index 955069f19..fc6880024 100644 --- a/packages/brk_client/brk_client/__init__.py +++ b/packages/brk_client/brk_client/__init__.py @@ -2930,7 +2930,7 @@ class ActivityAddrOutputsRealizedSupplyUnrealizedPattern: self.addr_count: BaseDeltaPattern = BaseDeltaPattern(client, _m(acc, 'addr_count')) self.outputs: SpendingSpentUnspentPattern = SpendingSpentUnspentPattern(client, acc) self.realized: CapLossMvrvPriceProfitPattern = CapLossMvrvPriceProfitPattern(client, acc) - self.supply: DeltaTotalPattern = DeltaTotalPattern(client, _m(acc, 'supply')) + self.supply: DeltaDominanceTotalPattern = DeltaDominanceTotalPattern(client, _m(acc, 'supply')) self.unrealized: NuplPattern = NuplPattern(client, _m(acc, 'nupl')) class AverageBlockCumulativeInSumPattern: @@ -2957,18 +2957,6 @@ class BpsCentsPercentilesRatioSatsUsdPattern: self.sats: SeriesPattern1[SatsFract] = SeriesPattern1(client, _m(acc, 'sats')) self.usd: SeriesPattern1[Dollars] = SeriesPattern1(client, acc) -class BtcCentsSatsToUsdPattern3: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated series name.""" - self.btc: SeriesPattern1[Bitcoin] = SeriesPattern1(client, acc) - self.cents: SeriesPattern1[Cents] = SeriesPattern1(client, _m(acc, 'cents')) - self.sats: SeriesPattern1[Sats] = SeriesPattern1(client, _m(acc, 'sats')) - self.to_circulating: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, _m(acc, 'to_circulating')) - self.to_own: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, _m(acc, 'to_own')) - self.usd: SeriesPattern1[Dollars] = SeriesPattern1(client, _m(acc, 'usd')) - class CentsNegativeToUsdPattern2: """Pattern struct for repeated tree structure.""" @@ -2981,28 +2969,28 @@ class CentsNegativeToUsdPattern2: self.to_own_mcap: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, _m(acc, 'to_own_mcap')) self.usd: SeriesPattern1[Dollars] = SeriesPattern1(client, acc) -class DeltaHalfInToTotalPattern: +class DeltaDominanceHalfInTotalPattern2: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated series name.""" self.delta: AbsoluteRatePattern = AbsoluteRatePattern(client, _m(acc, 'delta')) + self.dominance: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, _m(acc, 'dominance')) self.half: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'half')) - self.in_loss: BtcCentsSatsToUsdPattern = BtcCentsSatsToUsdPattern(client, _m(acc, 'in_loss')) - self.in_profit: BtcCentsSatsToUsdPattern = BtcCentsSatsToUsdPattern(client, _m(acc, 'in_profit')) - self.to_circulating: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, _m(acc, 'to_circulating')) + self.in_loss: BtcCentsSatsShareUsdPattern = BtcCentsSatsShareUsdPattern(client, _m(acc, 'in_loss')) + self.in_profit: BtcCentsSatsShareUsdPattern = BtcCentsSatsShareUsdPattern(client, _m(acc, 'in_profit')) self.total: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, acc) -class DeltaHalfInToTotalPattern2: +class DeltaDominanceHalfInTotalPattern: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated series name.""" self.delta: AbsoluteRatePattern = AbsoluteRatePattern(client, _m(acc, 'delta')) + self.dominance: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, _m(acc, 'dominance')) self.half: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'half')) - self.in_loss: BtcCentsSatsToUsdPattern3 = BtcCentsSatsToUsdPattern3(client, _m(acc, 'in_loss')) - self.in_profit: BtcCentsSatsToUsdPattern3 = BtcCentsSatsToUsdPattern3(client, _m(acc, 'in_profit')) - self.to_circulating: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, _m(acc, 'to_circulating')) + self.in_loss: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'in_loss')) + self.in_profit: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'in_profit')) self.total: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, acc) class _1m1w1y24hBlockPattern: @@ -3035,7 +3023,7 @@ class ActivityOutputsRealizedSupplyUnrealizedPattern: self.activity: CoindaysTransferPattern = CoindaysTransferPattern(client, acc) self.outputs: SpendingSpentUnspentPattern = SpendingSpentUnspentPattern(client, acc) self.realized: CapLossMvrvNetPriceProfitSoprPattern = CapLossMvrvNetPriceProfitSoprPattern(client, acc) - self.supply: DeltaHalfInToTotalPattern = DeltaHalfInToTotalPattern(client, _m(acc, 'supply')) + self.supply: DeltaDominanceHalfInTotalPattern = DeltaDominanceHalfInTotalPattern(client, _m(acc, 'supply')) self.unrealized: LossNetNuplProfitPattern = LossNetNuplProfitPattern(client, acc) class ActivityOutputsRealizedSupplyUnrealizedPattern3: @@ -3046,7 +3034,7 @@ class ActivityOutputsRealizedSupplyUnrealizedPattern3: self.activity: TransferPattern = TransferPattern(client, _m(acc, 'transfer_volume')) self.outputs: SpendingSpentUnspentPattern = SpendingSpentUnspentPattern(client, acc) self.realized: CapLossMvrvPriceProfitPattern = CapLossMvrvPriceProfitPattern(client, acc) - self.supply: DeltaHalfInTotalPattern2 = DeltaHalfInTotalPattern2(client, _m(acc, 'supply')) + self.supply: DeltaDominanceHalfInTotalPattern = DeltaDominanceHalfInTotalPattern(client, _m(acc, 'supply')) self.unrealized: LossNuplProfitPattern = LossNuplProfitPattern(client, acc) class ActivityOutputsRealizedSupplyUnrealizedPattern2: @@ -3057,7 +3045,7 @@ class ActivityOutputsRealizedSupplyUnrealizedPattern2: self.activity: TransferPattern = TransferPattern(client, _m(acc, 'transfer_volume')) self.outputs: SpendingSpentUnspentPattern = SpendingSpentUnspentPattern(client, acc) self.realized: CapLossMvrvPriceProfitPattern = CapLossMvrvPriceProfitPattern(client, acc) - self.supply: DeltaTotalPattern = DeltaTotalPattern(client, _m(acc, 'supply')) + self.supply: DeltaDominanceTotalPattern = DeltaDominanceTotalPattern(client, _m(acc, 'supply')) self.unrealized: NuplPattern = NuplPattern(client, _m(acc, 'nupl')) class BlockChangeCumulativeDeltaSumPattern: @@ -3093,7 +3081,7 @@ class BtcCentsDeltaSatsUsdPattern: self.sats: SeriesPattern1[Sats] = SeriesPattern1(client, _m(acc, 'sats')) self.usd: SeriesPattern1[Dollars] = SeriesPattern1(client, _m(acc, 'usd')) -class BtcCentsSatsToUsdPattern: +class BtcCentsSatsShareUsdPattern: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -3101,18 +3089,7 @@ class BtcCentsSatsToUsdPattern: self.btc: SeriesPattern1[Bitcoin] = SeriesPattern1(client, acc) self.cents: SeriesPattern1[Cents] = SeriesPattern1(client, _m(acc, 'cents')) self.sats: SeriesPattern1[Sats] = SeriesPattern1(client, _m(acc, 'sats')) - self.to_circulating: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, _m(acc, 'to_circulating')) - self.usd: SeriesPattern1[Dollars] = SeriesPattern1(client, _m(acc, 'usd')) - -class BtcCentsSatsToUsdPattern2: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated series name.""" - self.btc: SeriesPattern1[Bitcoin] = SeriesPattern1(client, acc) - self.cents: SeriesPattern1[Cents] = SeriesPattern1(client, _m(acc, 'cents')) - self.sats: SeriesPattern1[Sats] = SeriesPattern1(client, _m(acc, 'sats')) - self.to_own: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, _m(acc, 'to_own')) + self.share: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, _m(acc, 'share')) self.usd: SeriesPattern1[Dollars] = SeriesPattern1(client, _m(acc, 'usd')) class CapLossMvrvPriceProfitPattern: @@ -3137,17 +3114,6 @@ class CentsToUsdPattern4: self.to_own_mcap: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, _m(acc, 'to_own_mcap')) self.usd: SeriesPattern1[Dollars] = SeriesPattern1(client, acc) -class DeltaHalfInTotalPattern2: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated series name.""" - self.delta: AbsoluteRatePattern = AbsoluteRatePattern(client, _m(acc, 'delta')) - self.half: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'half')) - self.in_loss: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'in_loss')) - self.in_profit: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'in_profit')) - self.total: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, acc) - class EmaHistogramLineSignalPattern: """Pattern struct for repeated tree structure.""" pass @@ -3494,6 +3460,15 @@ class CumulativeRollingSumPattern: self.rolling: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern = AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern(client, acc) self.sum: SeriesPattern18[StoredU64] = SeriesPattern18(client, _m(acc, 'sum')) +class DeltaDominanceTotalPattern: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClientBase, acc: str): + """Create pattern node with accumulated series name.""" + self.delta: AbsoluteRatePattern = AbsoluteRatePattern(client, _m(acc, 'delta')) + self.dominance: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, _m(acc, 'dominance')) + self.total: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, acc) + class GreedNetPainPattern: """Pattern struct for repeated tree structure.""" @@ -3676,14 +3651,6 @@ class CoindaysTransferPattern: self.coindays_destroyed: AverageBlockCumulativeSumPattern[StoredF64] = AverageBlockCumulativeSumPattern(client, _m(acc, 'coindays_destroyed')) self.transfer_volume: AverageBlockCumulativeInSumPattern = AverageBlockCumulativeInSumPattern(client, _m(acc, 'transfer_volume')) -class DeltaTotalPattern: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated series name.""" - self.delta: AbsoluteRatePattern = AbsoluteRatePattern(client, _m(acc, 'delta')) - self.total: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, acc) - class FundedTotalPattern: """Pattern struct for repeated tree structure.""" @@ -5479,16 +5446,6 @@ class SeriesTree_Supply: self.market_minus_realized_cap_growth_rate: _1m1w1y24hPattern[BasisPointsSigned32] = _1m1w1y24hPattern(client, 'market_minus_realized_cap_growth_rate') self.hodled_or_lost: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'hodled_or_lost_supply') -class SeriesTree_Cohorts_Utxo_All_Supply: - """Series tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.total: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'supply') - self.delta: AbsoluteRatePattern = AbsoluteRatePattern(client, 'supply_delta') - self.half: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'supply_half') - self.in_profit: BtcCentsSatsToUsdPattern2 = BtcCentsSatsToUsdPattern2(client, 'supply_in_profit') - self.in_loss: BtcCentsSatsToUsdPattern2 = BtcCentsSatsToUsdPattern2(client, 'supply_in_loss') - class SeriesTree_Cohorts_Utxo_All_Outputs: """Series tree node.""" @@ -5706,7 +5663,7 @@ class SeriesTree_Cohorts_Utxo_All: """Series tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.supply: SeriesTree_Cohorts_Utxo_All_Supply = SeriesTree_Cohorts_Utxo_All_Supply(client) + self.supply: DeltaDominanceHalfInTotalPattern2 = DeltaDominanceHalfInTotalPattern2(client, 'supply') self.outputs: SeriesTree_Cohorts_Utxo_All_Outputs = SeriesTree_Cohorts_Utxo_All_Outputs(client) self.activity: SeriesTree_Cohorts_Utxo_All_Activity = SeriesTree_Cohorts_Utxo_All_Activity(client) self.realized: SeriesTree_Cohorts_Utxo_All_Realized = SeriesTree_Cohorts_Utxo_All_Realized(client) @@ -5837,7 +5794,7 @@ class SeriesTree_Cohorts_Utxo_Sth: """Series tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.supply: DeltaHalfInToTotalPattern2 = DeltaHalfInToTotalPattern2(client, 'sth_supply') + self.supply: DeltaDominanceHalfInTotalPattern2 = DeltaDominanceHalfInTotalPattern2(client, 'sth_supply') self.outputs: SpendingSpentUnspentPattern = SpendingSpentUnspentPattern(client, 'sth') self.activity: CoindaysCoinyearsDormancyTransferPattern = CoindaysCoinyearsDormancyTransferPattern(client, 'sth') self.realized: SeriesTree_Cohorts_Utxo_Sth_Realized = SeriesTree_Cohorts_Utxo_Sth_Realized(client) @@ -5975,7 +5932,7 @@ class SeriesTree_Cohorts_Utxo_Lth: """Series tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.supply: DeltaHalfInToTotalPattern2 = DeltaHalfInToTotalPattern2(client, 'lth_supply') + self.supply: DeltaDominanceHalfInTotalPattern2 = DeltaDominanceHalfInTotalPattern2(client, 'lth_supply') self.outputs: SpendingSpentUnspentPattern = SpendingSpentUnspentPattern(client, 'lth') self.activity: CoindaysCoinyearsDormancyTransferPattern = CoindaysCoinyearsDormancyTransferPattern(client, 'lth') self.realized: SeriesTree_Cohorts_Utxo_Lth_Realized = SeriesTree_Cohorts_Utxo_Lth_Realized(client) diff --git a/website/assets/logo/.gitignore b/website/assets/logo/.gitignore new file mode 100644 index 000000000..23376a961 --- /dev/null +++ b/website/assets/logo/.gitignore @@ -0,0 +1 @@ +3d.html diff --git a/website/assets/logo/demo-svg.html b/website/assets/logo/demo-svg.html index 7ff697ab3..5ee7a2b7b 100644 --- a/website/assets/logo/demo-svg.html +++ b/website/assets/logo/demo-svg.html @@ -4,25 +4,28 @@ bitview logo (svg)
-
- SVG cube — blur via SVG feGaussianBlur with BackgroundImage. -
- - + @@ -196,53 +216,110 @@
+
+
+
+
+
+
diff --git a/website/assets/logo/demo.html b/website/assets/logo/demo.html index d315bff32..dc87c5f20 100644 --- a/website/assets/logo/demo.html +++ b/website/assets/logo/demo.html @@ -4,22 +4,11 @@ bitview logo