mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-24 06:39:58 -07:00
global: snapshot
This commit is contained in:
@@ -1240,7 +1240,7 @@ impl AverageGainsLossesRsiStochPattern {
|
||||
}
|
||||
|
||||
/// Pattern struct for repeated tree structure.
|
||||
pub struct AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern {
|
||||
pub struct AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3 {
|
||||
pub all: MetricPattern1<StoredU64>,
|
||||
pub p2a: MetricPattern1<StoredU64>,
|
||||
pub p2pk33: MetricPattern1<StoredU64>,
|
||||
@@ -1252,7 +1252,7 @@ pub struct AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern {
|
||||
pub p2wsh: MetricPattern1<StoredU64>,
|
||||
}
|
||||
|
||||
impl AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern {
|
||||
impl AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3 {
|
||||
/// Create a new pattern node with accumulated metric name.
|
||||
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
|
||||
Self {
|
||||
@@ -1794,7 +1794,7 @@ impl Pct1Pct2Pct5Pct95Pct98Pct99Pattern {
|
||||
/// Pattern struct for repeated tree structure.
|
||||
pub struct ActivityOutputsRealizedSupplyUnrealizedPattern {
|
||||
pub activity: CoindaysSentPattern,
|
||||
pub outputs: UtxoPattern2,
|
||||
pub outputs: UnspentPattern2,
|
||||
pub realized: CapLossMvrvNetNuplPriceProfitSoprPattern,
|
||||
pub supply: DeltaHalvedInRelTotalPattern,
|
||||
pub unrealized: InvestedInvestorLossNetProfitPattern,
|
||||
@@ -1805,7 +1805,7 @@ impl ActivityOutputsRealizedSupplyUnrealizedPattern {
|
||||
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
|
||||
Self {
|
||||
activity: CoindaysSentPattern::new(client.clone(), acc.clone()),
|
||||
outputs: UtxoPattern2::new(client.clone(), _m(&acc, "utxo_count")),
|
||||
outputs: UnspentPattern2::new(client.clone(), _m(&acc, "utxo_count")),
|
||||
realized: CapLossMvrvNetNuplPriceProfitSoprPattern::new(client.clone(), acc.clone()),
|
||||
supply: DeltaHalvedInRelTotalPattern::new(client.clone(), _m(&acc, "supply")),
|
||||
unrealized: InvestedInvestorLossNetProfitPattern::new(client.clone(), acc.clone()),
|
||||
@@ -1816,7 +1816,7 @@ impl ActivityOutputsRealizedSupplyUnrealizedPattern {
|
||||
/// Pattern struct for repeated tree structure.
|
||||
pub struct ActivityOutputsRealizedSupplyUnrealizedPattern2 {
|
||||
pub activity: CoindaysSentPattern,
|
||||
pub outputs: UtxoPattern2,
|
||||
pub outputs: UnspentPattern2,
|
||||
pub realized: CapLossMvrvNetNuplPriceProfitSoprPattern,
|
||||
pub supply: DeltaHalvedInRelTotalPattern,
|
||||
pub unrealized: LossNetProfitPattern,
|
||||
@@ -1827,7 +1827,7 @@ impl ActivityOutputsRealizedSupplyUnrealizedPattern2 {
|
||||
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
|
||||
Self {
|
||||
activity: CoindaysSentPattern::new(client.clone(), acc.clone()),
|
||||
outputs: UtxoPattern2::new(client.clone(), _m(&acc, "utxo_count")),
|
||||
outputs: UnspentPattern2::new(client.clone(), _m(&acc, "utxo_count")),
|
||||
realized: CapLossMvrvNetNuplPriceProfitSoprPattern::new(client.clone(), acc.clone()),
|
||||
supply: DeltaHalvedInRelTotalPattern::new(client.clone(), _m(&acc, "supply")),
|
||||
unrealized: LossNetProfitPattern::new(client.clone(), acc.clone()),
|
||||
@@ -2220,7 +2220,7 @@ impl _1y2y4yAllPattern {
|
||||
/// Pattern struct for repeated tree structure.
|
||||
pub struct AddrOutputsRealizedSupplyPattern {
|
||||
pub addr_count: BaseDeltaPattern,
|
||||
pub outputs: UtxoPattern,
|
||||
pub outputs: UnspentPattern,
|
||||
pub realized: CapLossMvrvNuplPriceProfitSoprPattern,
|
||||
pub supply: HalvedTotalPattern,
|
||||
}
|
||||
@@ -2230,7 +2230,7 @@ impl AddrOutputsRealizedSupplyPattern {
|
||||
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
|
||||
Self {
|
||||
addr_count: BaseDeltaPattern::new(client.clone(), _m(&acc, "addr_count")),
|
||||
outputs: UtxoPattern::new(client.clone(), _m(&acc, "utxo_count")),
|
||||
outputs: UnspentPattern::new(client.clone(), _m(&acc, "utxo_count")),
|
||||
realized: CapLossMvrvNuplPriceProfitSoprPattern::new(client.clone(), acc.clone()),
|
||||
supply: HalvedTotalPattern::new(client.clone(), _m(&acc, "supply")),
|
||||
}
|
||||
@@ -2419,7 +2419,7 @@ impl InRawSumPattern2 {
|
||||
|
||||
/// Pattern struct for repeated tree structure.
|
||||
pub struct OutputsRealizedSupplyUnrealizedPattern {
|
||||
pub outputs: UtxoPattern,
|
||||
pub outputs: UnspentPattern,
|
||||
pub realized: CapLossMvrvNuplPriceProfitSoprPattern,
|
||||
pub supply: HalvedInTotalPattern,
|
||||
pub unrealized: LossProfitPattern2,
|
||||
@@ -2429,7 +2429,7 @@ impl OutputsRealizedSupplyUnrealizedPattern {
|
||||
/// Create a new pattern node with accumulated metric name.
|
||||
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
|
||||
Self {
|
||||
outputs: UtxoPattern::new(client.clone(), _m(&acc, "utxo_count")),
|
||||
outputs: UnspentPattern::new(client.clone(), _m(&acc, "utxo_count")),
|
||||
realized: CapLossMvrvNuplPriceProfitSoprPattern::new(client.clone(), acc.clone()),
|
||||
supply: HalvedInTotalPattern::new(client.clone(), _m(&acc, "supply")),
|
||||
unrealized: LossProfitPattern2::new(client.clone(), _m(&acc, "unrealized")),
|
||||
@@ -2693,7 +2693,7 @@ impl NegativeRawSumPattern {
|
||||
|
||||
/// Pattern struct for repeated tree structure.
|
||||
pub struct OutputsRealizedSupplyPattern {
|
||||
pub outputs: UtxoPattern,
|
||||
pub outputs: UnspentPattern,
|
||||
pub realized: CapLossMvrvNuplPriceProfitSoprPattern,
|
||||
pub supply: HalvedTotalPattern,
|
||||
}
|
||||
@@ -2702,7 +2702,7 @@ impl OutputsRealizedSupplyPattern {
|
||||
/// Create a new pattern node with accumulated metric name.
|
||||
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
|
||||
Self {
|
||||
outputs: UtxoPattern::new(client.clone(), _m(&acc, "utxo_count")),
|
||||
outputs: UnspentPattern::new(client.clone(), _m(&acc, "utxo_count")),
|
||||
realized: CapLossMvrvNuplPriceProfitSoprPattern::new(client.clone(), acc.clone()),
|
||||
supply: HalvedTotalPattern::new(client.clone(), _m(&acc, "supply")),
|
||||
}
|
||||
@@ -3288,43 +3288,43 @@ impl _24hPattern {
|
||||
}
|
||||
|
||||
/// Pattern struct for repeated tree structure.
|
||||
pub struct UtxoPattern2 {
|
||||
pub utxo_count: BaseDeltaPattern,
|
||||
pub struct UnspentPattern2 {
|
||||
pub unspent_count: BaseDeltaPattern,
|
||||
}
|
||||
|
||||
impl UtxoPattern2 {
|
||||
impl UnspentPattern2 {
|
||||
/// Create a new pattern node with accumulated metric name.
|
||||
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
|
||||
Self {
|
||||
utxo_count: BaseDeltaPattern::new(client.clone(), acc.clone()),
|
||||
unspent_count: BaseDeltaPattern::new(client.clone(), acc.clone()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Pattern struct for repeated tree structure.
|
||||
pub struct UtxoPattern3 {
|
||||
pub utxo_count: BaseDeltaPattern2,
|
||||
pub struct UnspentPattern3 {
|
||||
pub unspent_count: BaseDeltaPattern2,
|
||||
}
|
||||
|
||||
impl UtxoPattern3 {
|
||||
impl UnspentPattern3 {
|
||||
/// Create a new pattern node with accumulated metric name.
|
||||
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
|
||||
Self {
|
||||
utxo_count: BaseDeltaPattern2::new(client.clone(), acc.clone()),
|
||||
unspent_count: BaseDeltaPattern2::new(client.clone(), acc.clone()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Pattern struct for repeated tree structure.
|
||||
pub struct UtxoPattern {
|
||||
pub utxo_count: MetricPattern1<StoredU64>,
|
||||
pub struct UnspentPattern {
|
||||
pub unspent_count: MetricPattern1<StoredU64>,
|
||||
}
|
||||
|
||||
impl UtxoPattern {
|
||||
impl UnspentPattern {
|
||||
/// Create a new pattern node with accumulated metric name.
|
||||
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
|
||||
Self {
|
||||
utxo_count: MetricPattern1::new(client.clone(), acc.clone()),
|
||||
unspent_count: MetricPattern1::new(client.clone(), acc.clone()),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3493,7 +3493,7 @@ impl MetricsTree_Blocks_Time {
|
||||
|
||||
/// Metrics tree node.
|
||||
pub struct MetricsTree_Blocks_Size {
|
||||
pub total_size: MetricPattern18<StoredU64>,
|
||||
pub total: MetricPattern18<StoredU64>,
|
||||
pub cumulative: MetricPattern1<StoredU64>,
|
||||
pub sum: _1m1w1y24hPattern<StoredU64>,
|
||||
pub average: _1m1w1y24hPattern<StoredU64>,
|
||||
@@ -3509,7 +3509,7 @@ pub struct MetricsTree_Blocks_Size {
|
||||
impl MetricsTree_Blocks_Size {
|
||||
pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self {
|
||||
Self {
|
||||
total_size: MetricPattern18::new(client.clone(), "total_size".to_string()),
|
||||
total: MetricPattern18::new(client.clone(), "total_size".to_string()),
|
||||
cumulative: MetricPattern1::new(client.clone(), "block_size_cumulative".to_string()),
|
||||
sum: _1m1w1y24hPattern::new(client.clone(), "block_size_sum".to_string()),
|
||||
average: _1m1w1y24hPattern::new(client.clone(), "block_size_average".to_string()),
|
||||
@@ -3559,15 +3559,15 @@ impl MetricsTree_Blocks_Weight {
|
||||
|
||||
/// Metrics tree node.
|
||||
pub struct MetricsTree_Blocks_Count {
|
||||
pub block_count_target: MetricPattern1<StoredU64>,
|
||||
pub block_count: CumulativeRawSumPattern<StoredU32>,
|
||||
pub target: MetricPattern1<StoredU64>,
|
||||
pub total: CumulativeRawSumPattern<StoredU32>,
|
||||
}
|
||||
|
||||
impl MetricsTree_Blocks_Count {
|
||||
pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self {
|
||||
Self {
|
||||
block_count_target: MetricPattern1::new(client.clone(), "block_count_target".to_string()),
|
||||
block_count: CumulativeRawSumPattern::new(client.clone(), "block_count".to_string()),
|
||||
target: MetricPattern1::new(client.clone(), "block_count_target".to_string()),
|
||||
total: CumulativeRawSumPattern::new(client.clone(), "block_count".to_string()),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3746,14 +3746,14 @@ impl MetricsTree_Transactions {
|
||||
|
||||
/// Metrics tree node.
|
||||
pub struct MetricsTree_Transactions_Count {
|
||||
pub tx_count: AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90RawSumPattern,
|
||||
pub total: AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90RawSumPattern,
|
||||
pub is_coinbase: MetricPattern19<StoredBool>,
|
||||
}
|
||||
|
||||
impl MetricsTree_Transactions_Count {
|
||||
pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self {
|
||||
Self {
|
||||
tx_count: AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90RawSumPattern::new(client.clone(), "tx_count".to_string()),
|
||||
total: AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90RawSumPattern::new(client.clone(), "tx_count".to_string()),
|
||||
is_coinbase: MetricPattern19::new(client.clone(), "is_coinbase".to_string()),
|
||||
}
|
||||
}
|
||||
@@ -3913,14 +3913,14 @@ impl MetricsTree_Outputs_Spent {
|
||||
|
||||
/// Metrics tree node.
|
||||
pub struct MetricsTree_Outputs_Count {
|
||||
pub total_count: AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90RollingSumPattern,
|
||||
pub total: AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90RollingSumPattern,
|
||||
pub utxo_count: MetricPattern1<StoredU64>,
|
||||
}
|
||||
|
||||
impl MetricsTree_Outputs_Count {
|
||||
pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self {
|
||||
Self {
|
||||
total_count: AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90RollingSumPattern::new(client.clone(), "output_count".to_string()),
|
||||
total: AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90RollingSumPattern::new(client.clone(), "output_count".to_string()),
|
||||
utxo_count: MetricPattern1::new(client.clone(), "exact_utxo_count".to_string()),
|
||||
}
|
||||
}
|
||||
@@ -4153,36 +4153,49 @@ impl MetricsTree_Mining_Rewards_FeeRatioMultiple {
|
||||
|
||||
/// Metrics tree node.
|
||||
pub struct MetricsTree_Mining_Hashrate {
|
||||
pub hash_rate: MetricPattern1<StoredF64>,
|
||||
pub hash_rate_sma: MetricsTree_Mining_Hashrate_HashRateSma,
|
||||
pub hash_rate_ath: MetricPattern1<StoredF64>,
|
||||
pub hash_rate_drawdown: BpsPercentRatioPattern,
|
||||
pub hash_price: PhsReboundThsPattern,
|
||||
pub hash_value: PhsReboundThsPattern,
|
||||
pub rate: MetricsTree_Mining_Hashrate_Rate,
|
||||
pub price: PhsReboundThsPattern,
|
||||
pub value: PhsReboundThsPattern,
|
||||
}
|
||||
|
||||
impl MetricsTree_Mining_Hashrate {
|
||||
pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self {
|
||||
Self {
|
||||
hash_rate: MetricPattern1::new(client.clone(), "hash_rate".to_string()),
|
||||
hash_rate_sma: MetricsTree_Mining_Hashrate_HashRateSma::new(client.clone(), format!("{base_path}_hash_rate_sma")),
|
||||
hash_rate_ath: MetricPattern1::new(client.clone(), "hash_rate_ath".to_string()),
|
||||
hash_rate_drawdown: BpsPercentRatioPattern::new(client.clone(), "hash_rate_drawdown".to_string()),
|
||||
hash_price: PhsReboundThsPattern::new(client.clone(), "hash_price".to_string()),
|
||||
hash_value: PhsReboundThsPattern::new(client.clone(), "hash_value".to_string()),
|
||||
rate: MetricsTree_Mining_Hashrate_Rate::new(client.clone(), format!("{base_path}_rate")),
|
||||
price: PhsReboundThsPattern::new(client.clone(), "hash_price".to_string()),
|
||||
value: PhsReboundThsPattern::new(client.clone(), "hash_value".to_string()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Metrics tree node.
|
||||
pub struct MetricsTree_Mining_Hashrate_HashRateSma {
|
||||
pub struct MetricsTree_Mining_Hashrate_Rate {
|
||||
pub raw: MetricPattern1<StoredF64>,
|
||||
pub sma: MetricsTree_Mining_Hashrate_Rate_Sma,
|
||||
pub ath: MetricPattern1<StoredF64>,
|
||||
pub drawdown: BpsPercentRatioPattern,
|
||||
}
|
||||
|
||||
impl MetricsTree_Mining_Hashrate_Rate {
|
||||
pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self {
|
||||
Self {
|
||||
raw: MetricPattern1::new(client.clone(), "hash_rate".to_string()),
|
||||
sma: MetricsTree_Mining_Hashrate_Rate_Sma::new(client.clone(), format!("{base_path}_sma")),
|
||||
ath: MetricPattern1::new(client.clone(), "hash_rate_ath".to_string()),
|
||||
drawdown: BpsPercentRatioPattern::new(client.clone(), "hash_rate_drawdown".to_string()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Metrics tree node.
|
||||
pub struct MetricsTree_Mining_Hashrate_Rate_Sma {
|
||||
pub _1w: MetricPattern1<StoredF64>,
|
||||
pub _1m: MetricPattern1<StoredF64>,
|
||||
pub _2m: MetricPattern1<StoredF64>,
|
||||
pub _1y: MetricPattern1<StoredF64>,
|
||||
}
|
||||
|
||||
impl MetricsTree_Mining_Hashrate_HashRateSma {
|
||||
impl MetricsTree_Mining_Hashrate_Rate_Sma {
|
||||
pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self {
|
||||
Self {
|
||||
_1w: MetricPattern1::new(client.clone(), "hash_rate_sma_1w".to_string()),
|
||||
@@ -4214,7 +4227,7 @@ pub struct MetricsTree_Cointime {
|
||||
pub supply: MetricsTree_Cointime_Supply,
|
||||
pub value: MetricsTree_Cointime_Value,
|
||||
pub cap: MetricsTree_Cointime_Cap,
|
||||
pub pricing: MetricsTree_Cointime_Pricing,
|
||||
pub prices: MetricsTree_Cointime_Prices,
|
||||
pub adjusted: MetricsTree_Cointime_Adjusted,
|
||||
pub reserve_risk: MetricsTree_Cointime_ReserveRisk,
|
||||
}
|
||||
@@ -4226,7 +4239,7 @@ impl MetricsTree_Cointime {
|
||||
supply: MetricsTree_Cointime_Supply::new(client.clone(), format!("{base_path}_supply")),
|
||||
value: MetricsTree_Cointime_Value::new(client.clone(), format!("{base_path}_value")),
|
||||
cap: MetricsTree_Cointime_Cap::new(client.clone(), format!("{base_path}_cap")),
|
||||
pricing: MetricsTree_Cointime_Pricing::new(client.clone(), format!("{base_path}_pricing")),
|
||||
prices: MetricsTree_Cointime_Prices::new(client.clone(), format!("{base_path}_prices")),
|
||||
adjusted: MetricsTree_Cointime_Adjusted::new(client.clone(), format!("{base_path}_adjusted")),
|
||||
reserve_risk: MetricsTree_Cointime_ReserveRisk::new(client.clone(), format!("{base_path}_reserve_risk")),
|
||||
}
|
||||
@@ -4239,7 +4252,7 @@ pub struct MetricsTree_Cointime_Activity {
|
||||
pub coinblocks_stored: CumulativeRawSumPattern<StoredF64>,
|
||||
pub liveliness: MetricPattern1<StoredF64>,
|
||||
pub vaultedness: MetricPattern1<StoredF64>,
|
||||
pub activity_to_vaultedness_ratio: MetricPattern1<StoredF64>,
|
||||
pub ratio: MetricPattern1<StoredF64>,
|
||||
}
|
||||
|
||||
impl MetricsTree_Cointime_Activity {
|
||||
@@ -4249,40 +4262,40 @@ impl MetricsTree_Cointime_Activity {
|
||||
coinblocks_stored: CumulativeRawSumPattern::new(client.clone(), "coinblocks_stored".to_string()),
|
||||
liveliness: MetricPattern1::new(client.clone(), "liveliness".to_string()),
|
||||
vaultedness: MetricPattern1::new(client.clone(), "vaultedness".to_string()),
|
||||
activity_to_vaultedness_ratio: MetricPattern1::new(client.clone(), "activity_to_vaultedness_ratio".to_string()),
|
||||
ratio: MetricPattern1::new(client.clone(), "activity_to_vaultedness_ratio".to_string()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Metrics tree node.
|
||||
pub struct MetricsTree_Cointime_Supply {
|
||||
pub vaulted_supply: BtcCentsSatsUsdPattern,
|
||||
pub active_supply: BtcCentsSatsUsdPattern,
|
||||
pub vaulted: BtcCentsSatsUsdPattern,
|
||||
pub active: BtcCentsSatsUsdPattern,
|
||||
}
|
||||
|
||||
impl MetricsTree_Cointime_Supply {
|
||||
pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self {
|
||||
Self {
|
||||
vaulted_supply: BtcCentsSatsUsdPattern::new(client.clone(), "vaulted_supply".to_string()),
|
||||
active_supply: BtcCentsSatsUsdPattern::new(client.clone(), "active_supply".to_string()),
|
||||
vaulted: BtcCentsSatsUsdPattern::new(client.clone(), "vaulted_supply".to_string()),
|
||||
active: BtcCentsSatsUsdPattern::new(client.clone(), "active_supply".to_string()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Metrics tree node.
|
||||
pub struct MetricsTree_Cointime_Value {
|
||||
pub value_destroyed: CumulativeRawSumPattern<StoredF64>,
|
||||
pub value_created: CumulativeRawSumPattern<StoredF64>,
|
||||
pub value_stored: CumulativeRawSumPattern<StoredF64>,
|
||||
pub destroyed: CumulativeRawSumPattern<StoredF64>,
|
||||
pub created: CumulativeRawSumPattern<StoredF64>,
|
||||
pub stored: CumulativeRawSumPattern<StoredF64>,
|
||||
pub vocdd: CumulativeRawSumPattern<StoredF64>,
|
||||
}
|
||||
|
||||
impl MetricsTree_Cointime_Value {
|
||||
pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self {
|
||||
Self {
|
||||
value_destroyed: CumulativeRawSumPattern::new(client.clone(), "cointime_value_destroyed".to_string()),
|
||||
value_created: CumulativeRawSumPattern::new(client.clone(), "cointime_value_created".to_string()),
|
||||
value_stored: CumulativeRawSumPattern::new(client.clone(), "cointime_value_stored".to_string()),
|
||||
destroyed: CumulativeRawSumPattern::new(client.clone(), "cointime_value_destroyed".to_string()),
|
||||
created: CumulativeRawSumPattern::new(client.clone(), "cointime_value_created".to_string()),
|
||||
stored: CumulativeRawSumPattern::new(client.clone(), "cointime_value_stored".to_string()),
|
||||
vocdd: CumulativeRawSumPattern::new(client.clone(), "vocdd".to_string()),
|
||||
}
|
||||
}
|
||||
@@ -4290,51 +4303,51 @@ impl MetricsTree_Cointime_Value {
|
||||
|
||||
/// Metrics tree node.
|
||||
pub struct MetricsTree_Cointime_Cap {
|
||||
pub thermo_cap: CentsUsdPattern,
|
||||
pub investor_cap: CentsUsdPattern,
|
||||
pub vaulted_cap: CentsUsdPattern,
|
||||
pub active_cap: CentsUsdPattern,
|
||||
pub cointime_cap: CentsUsdPattern,
|
||||
pub thermo: CentsUsdPattern,
|
||||
pub investor: CentsUsdPattern,
|
||||
pub vaulted: CentsUsdPattern,
|
||||
pub active: CentsUsdPattern,
|
||||
pub cointime: CentsUsdPattern,
|
||||
pub aviv: BpsRatioPattern,
|
||||
}
|
||||
|
||||
impl MetricsTree_Cointime_Cap {
|
||||
pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self {
|
||||
Self {
|
||||
thermo_cap: CentsUsdPattern::new(client.clone(), "thermo_cap".to_string()),
|
||||
investor_cap: CentsUsdPattern::new(client.clone(), "investor_cap".to_string()),
|
||||
vaulted_cap: CentsUsdPattern::new(client.clone(), "vaulted_cap".to_string()),
|
||||
active_cap: CentsUsdPattern::new(client.clone(), "active_cap".to_string()),
|
||||
cointime_cap: CentsUsdPattern::new(client.clone(), "cointime_cap".to_string()),
|
||||
thermo: CentsUsdPattern::new(client.clone(), "thermo_cap".to_string()),
|
||||
investor: CentsUsdPattern::new(client.clone(), "investor_cap".to_string()),
|
||||
vaulted: CentsUsdPattern::new(client.clone(), "vaulted_cap".to_string()),
|
||||
active: CentsUsdPattern::new(client.clone(), "active_cap".to_string()),
|
||||
cointime: CentsUsdPattern::new(client.clone(), "cointime_cap".to_string()),
|
||||
aviv: BpsRatioPattern::new(client.clone(), "aviv_ratio".to_string()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Metrics tree node.
|
||||
pub struct MetricsTree_Cointime_Pricing {
|
||||
pub vaulted_price: BpsCentsPercentilesRatioSatsUsdPattern,
|
||||
pub active_price: BpsCentsPercentilesRatioSatsUsdPattern,
|
||||
pub struct MetricsTree_Cointime_Prices {
|
||||
pub vaulted: BpsCentsPercentilesRatioSatsUsdPattern,
|
||||
pub active: BpsCentsPercentilesRatioSatsUsdPattern,
|
||||
pub true_market_mean: BpsCentsPercentilesRatioSatsUsdPattern,
|
||||
pub cointime_price: BpsCentsPercentilesRatioSatsUsdPattern,
|
||||
pub transfer_price: BpsCentsPercentilesRatioSatsUsdPattern,
|
||||
pub balanced_price: BpsCentsPercentilesRatioSatsUsdPattern,
|
||||
pub terminal_price: BpsCentsPercentilesRatioSatsUsdPattern,
|
||||
pub delta_price: BpsCentsPercentilesRatioSatsUsdPattern,
|
||||
pub cointime: BpsCentsPercentilesRatioSatsUsdPattern,
|
||||
pub transfer: BpsCentsPercentilesRatioSatsUsdPattern,
|
||||
pub balanced: BpsCentsPercentilesRatioSatsUsdPattern,
|
||||
pub terminal: BpsCentsPercentilesRatioSatsUsdPattern,
|
||||
pub delta: BpsCentsPercentilesRatioSatsUsdPattern,
|
||||
pub cumulative_market_cap: MetricPattern1<Dollars>,
|
||||
}
|
||||
|
||||
impl MetricsTree_Cointime_Pricing {
|
||||
impl MetricsTree_Cointime_Prices {
|
||||
pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self {
|
||||
Self {
|
||||
vaulted_price: BpsCentsPercentilesRatioSatsUsdPattern::new(client.clone(), "vaulted_price".to_string()),
|
||||
active_price: BpsCentsPercentilesRatioSatsUsdPattern::new(client.clone(), "active_price".to_string()),
|
||||
vaulted: BpsCentsPercentilesRatioSatsUsdPattern::new(client.clone(), "vaulted_price".to_string()),
|
||||
active: BpsCentsPercentilesRatioSatsUsdPattern::new(client.clone(), "active_price".to_string()),
|
||||
true_market_mean: BpsCentsPercentilesRatioSatsUsdPattern::new(client.clone(), "true_market_mean".to_string()),
|
||||
cointime_price: BpsCentsPercentilesRatioSatsUsdPattern::new(client.clone(), "cointime_price".to_string()),
|
||||
transfer_price: BpsCentsPercentilesRatioSatsUsdPattern::new(client.clone(), "transfer_price".to_string()),
|
||||
balanced_price: BpsCentsPercentilesRatioSatsUsdPattern::new(client.clone(), "balanced_price".to_string()),
|
||||
terminal_price: BpsCentsPercentilesRatioSatsUsdPattern::new(client.clone(), "terminal_price".to_string()),
|
||||
delta_price: BpsCentsPercentilesRatioSatsUsdPattern::new(client.clone(), "delta_price".to_string()),
|
||||
cointime: BpsCentsPercentilesRatioSatsUsdPattern::new(client.clone(), "cointime_price".to_string()),
|
||||
transfer: BpsCentsPercentilesRatioSatsUsdPattern::new(client.clone(), "transfer_price".to_string()),
|
||||
balanced: BpsCentsPercentilesRatioSatsUsdPattern::new(client.clone(), "balanced_price".to_string()),
|
||||
terminal: BpsCentsPercentilesRatioSatsUsdPattern::new(client.clone(), "terminal_price".to_string()),
|
||||
delta: BpsCentsPercentilesRatioSatsUsdPattern::new(client.clone(), "delta_price".to_string()),
|
||||
cumulative_market_cap: MetricPattern1::new(client.clone(), "cumulative_market_cap".to_string()),
|
||||
}
|
||||
}
|
||||
@@ -5003,9 +5016,8 @@ pub struct MetricsTree_Indicators {
|
||||
pub thermocap_multiple: BpsRatioPattern,
|
||||
pub coindays_destroyed_supply_adjusted: MetricPattern1<StoredF32>,
|
||||
pub coinyears_destroyed_supply_adjusted: MetricPattern1<StoredF32>,
|
||||
pub dormancy_supply_adjusted: MetricPattern1<StoredF32>,
|
||||
pub dormancy: MetricsTree_Indicators_Dormancy,
|
||||
pub stock_to_flow: MetricPattern1<StoredF32>,
|
||||
pub dormancy_flow: MetricPattern1<StoredF32>,
|
||||
pub seller_exhaustion_constant: MetricPattern1<StoredF32>,
|
||||
}
|
||||
|
||||
@@ -5019,14 +5031,28 @@ impl MetricsTree_Indicators {
|
||||
thermocap_multiple: BpsRatioPattern::new(client.clone(), "thermocap_multiple".to_string()),
|
||||
coindays_destroyed_supply_adjusted: MetricPattern1::new(client.clone(), "coindays_destroyed_supply_adjusted".to_string()),
|
||||
coinyears_destroyed_supply_adjusted: MetricPattern1::new(client.clone(), "coinyears_destroyed_supply_adjusted".to_string()),
|
||||
dormancy_supply_adjusted: MetricPattern1::new(client.clone(), "dormancy_supply_adjusted".to_string()),
|
||||
dormancy: MetricsTree_Indicators_Dormancy::new(client.clone(), format!("{base_path}_dormancy")),
|
||||
stock_to_flow: MetricPattern1::new(client.clone(), "stock_to_flow".to_string()),
|
||||
dormancy_flow: MetricPattern1::new(client.clone(), "dormancy_flow".to_string()),
|
||||
seller_exhaustion_constant: MetricPattern1::new(client.clone(), "seller_exhaustion_constant".to_string()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Metrics tree node.
|
||||
pub struct MetricsTree_Indicators_Dormancy {
|
||||
pub supply_adjusted: MetricPattern1<StoredF32>,
|
||||
pub flow: MetricPattern1<StoredF32>,
|
||||
}
|
||||
|
||||
impl MetricsTree_Indicators_Dormancy {
|
||||
pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self {
|
||||
Self {
|
||||
supply_adjusted: MetricPattern1::new(client.clone(), "dormancy_supply_adjusted".to_string()),
|
||||
flow: MetricPattern1::new(client.clone(), "dormancy_flow".to_string()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Metrics tree node.
|
||||
pub struct MetricsTree_Market {
|
||||
pub ath: MetricsTree_Market_Ath,
|
||||
@@ -5116,23 +5142,23 @@ impl MetricsTree_Market_Lookback {
|
||||
|
||||
/// Metrics tree node.
|
||||
pub struct MetricsTree_Market_Returns {
|
||||
pub price_return: MetricsTree_Market_Returns_PriceReturn,
|
||||
pub price_cagr: _10y2y3y4y5y6y8yPattern,
|
||||
pub price_return_24h_sd: MetricsTree_Market_Returns_PriceReturn24hSd,
|
||||
pub periods: MetricsTree_Market_Returns_Periods,
|
||||
pub cagr: _10y2y3y4y5y6y8yPattern,
|
||||
pub sd_24h: MetricsTree_Market_Returns_Sd24h,
|
||||
}
|
||||
|
||||
impl MetricsTree_Market_Returns {
|
||||
pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self {
|
||||
Self {
|
||||
price_return: MetricsTree_Market_Returns_PriceReturn::new(client.clone(), format!("{base_path}_price_return")),
|
||||
price_cagr: _10y2y3y4y5y6y8yPattern::new(client.clone(), "price_cagr".to_string()),
|
||||
price_return_24h_sd: MetricsTree_Market_Returns_PriceReturn24hSd::new(client.clone(), format!("{base_path}_price_return_24h_sd")),
|
||||
periods: MetricsTree_Market_Returns_Periods::new(client.clone(), format!("{base_path}_periods")),
|
||||
cagr: _10y2y3y4y5y6y8yPattern::new(client.clone(), "price_cagr".to_string()),
|
||||
sd_24h: MetricsTree_Market_Returns_Sd24h::new(client.clone(), format!("{base_path}_sd_24h")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Metrics tree node.
|
||||
pub struct MetricsTree_Market_Returns_PriceReturn {
|
||||
pub struct MetricsTree_Market_Returns_Periods {
|
||||
pub _24h: BpsPercentRatioPattern,
|
||||
pub _1w: BpsPercentRatioPattern,
|
||||
pub _1m: BpsPercentRatioPattern,
|
||||
@@ -5148,7 +5174,7 @@ pub struct MetricsTree_Market_Returns_PriceReturn {
|
||||
pub _10y: BpsPercentRatioPattern,
|
||||
}
|
||||
|
||||
impl MetricsTree_Market_Returns_PriceReturn {
|
||||
impl MetricsTree_Market_Returns_Periods {
|
||||
pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self {
|
||||
Self {
|
||||
_24h: BpsPercentRatioPattern::new(client.clone(), "price_return_24h".to_string()),
|
||||
@@ -5169,29 +5195,29 @@ impl MetricsTree_Market_Returns_PriceReturn {
|
||||
}
|
||||
|
||||
/// Metrics tree node.
|
||||
pub struct MetricsTree_Market_Returns_PriceReturn24hSd {
|
||||
pub _1w: MetricsTree_Market_Returns_PriceReturn24hSd_1w,
|
||||
pub _1m: MetricsTree_Market_Returns_PriceReturn24hSd_1m,
|
||||
pub struct MetricsTree_Market_Returns_Sd24h {
|
||||
pub _1w: MetricsTree_Market_Returns_Sd24h_1w,
|
||||
pub _1m: MetricsTree_Market_Returns_Sd24h_1m,
|
||||
pub _1y: SdSmaPattern,
|
||||
}
|
||||
|
||||
impl MetricsTree_Market_Returns_PriceReturn24hSd {
|
||||
impl MetricsTree_Market_Returns_Sd24h {
|
||||
pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self {
|
||||
Self {
|
||||
_1w: MetricsTree_Market_Returns_PriceReturn24hSd_1w::new(client.clone(), format!("{base_path}_1w")),
|
||||
_1m: MetricsTree_Market_Returns_PriceReturn24hSd_1m::new(client.clone(), format!("{base_path}_1m")),
|
||||
_1w: MetricsTree_Market_Returns_Sd24h_1w::new(client.clone(), format!("{base_path}_1w")),
|
||||
_1m: MetricsTree_Market_Returns_Sd24h_1m::new(client.clone(), format!("{base_path}_1m")),
|
||||
_1y: SdSmaPattern::new(client.clone(), "price_return_24h".to_string()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Metrics tree node.
|
||||
pub struct MetricsTree_Market_Returns_PriceReturn24hSd_1w {
|
||||
pub struct MetricsTree_Market_Returns_Sd24h_1w {
|
||||
pub sma: MetricPattern1<StoredF32>,
|
||||
pub sd: MetricPattern1<StoredF32>,
|
||||
}
|
||||
|
||||
impl MetricsTree_Market_Returns_PriceReturn24hSd_1w {
|
||||
impl MetricsTree_Market_Returns_Sd24h_1w {
|
||||
pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self {
|
||||
Self {
|
||||
sma: MetricPattern1::new(client.clone(), "price_return_24h_sma_1w".to_string()),
|
||||
@@ -5201,12 +5227,12 @@ impl MetricsTree_Market_Returns_PriceReturn24hSd_1w {
|
||||
}
|
||||
|
||||
/// Metrics tree node.
|
||||
pub struct MetricsTree_Market_Returns_PriceReturn24hSd_1m {
|
||||
pub struct MetricsTree_Market_Returns_Sd24h_1m {
|
||||
pub sma: MetricPattern1<StoredF32>,
|
||||
pub sd: MetricPattern1<StoredF32>,
|
||||
}
|
||||
|
||||
impl MetricsTree_Market_Returns_PriceReturn24hSd_1m {
|
||||
impl MetricsTree_Market_Returns_Sd24h_1m {
|
||||
pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self {
|
||||
Self {
|
||||
sma: MetricPattern1::new(client.clone(), "price_return_24h_sma_1m".to_string()),
|
||||
@@ -6272,14 +6298,7 @@ pub struct MetricsTree_Distribution {
|
||||
pub utxo_cohorts: MetricsTree_Distribution_UtxoCohorts,
|
||||
pub address_cohorts: MetricsTree_Distribution_AddressCohorts,
|
||||
pub coinblocks_destroyed: CumulativeRawPattern<StoredF64>,
|
||||
pub addr_count: AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern,
|
||||
pub empty_addr_count: AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern,
|
||||
pub address_activity: MetricsTree_Distribution_AddressActivity,
|
||||
pub total_addr_count: AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern,
|
||||
pub new_addr_count: MetricsTree_Distribution_NewAddrCount,
|
||||
pub delta: MetricsTree_Distribution_Delta,
|
||||
pub funded_address_index: MetricPattern34<FundedAddressIndex>,
|
||||
pub empty_address_index: MetricPattern35<EmptyAddressIndex>,
|
||||
pub addresses: MetricsTree_Distribution_Addresses,
|
||||
}
|
||||
|
||||
impl MetricsTree_Distribution {
|
||||
@@ -6291,14 +6310,7 @@ impl MetricsTree_Distribution {
|
||||
utxo_cohorts: MetricsTree_Distribution_UtxoCohorts::new(client.clone(), format!("{base_path}_utxo_cohorts")),
|
||||
address_cohorts: MetricsTree_Distribution_AddressCohorts::new(client.clone(), format!("{base_path}_address_cohorts")),
|
||||
coinblocks_destroyed: CumulativeRawPattern::new(client.clone(), "coinblocks_destroyed".to_string()),
|
||||
addr_count: AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern::new(client.clone(), "addr_count".to_string()),
|
||||
empty_addr_count: AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern::new(client.clone(), "empty_addr_count".to_string()),
|
||||
address_activity: MetricsTree_Distribution_AddressActivity::new(client.clone(), format!("{base_path}_address_activity")),
|
||||
total_addr_count: AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern::new(client.clone(), "total_addr_count".to_string()),
|
||||
new_addr_count: MetricsTree_Distribution_NewAddrCount::new(client.clone(), format!("{base_path}_new_addr_count")),
|
||||
delta: MetricsTree_Distribution_Delta::new(client.clone(), format!("{base_path}_delta")),
|
||||
funded_address_index: MetricPattern34::new(client.clone(), "funded_address_index".to_string()),
|
||||
empty_address_index: MetricPattern35::new(client.clone(), "empty_address_index".to_string()),
|
||||
addresses: MetricsTree_Distribution_Addresses::new(client.clone(), format!("{base_path}_addresses")),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6387,7 +6399,7 @@ impl MetricsTree_Distribution_UtxoCohorts {
|
||||
/// Metrics tree node.
|
||||
pub struct MetricsTree_Distribution_UtxoCohorts_All {
|
||||
pub supply: MetricsTree_Distribution_UtxoCohorts_All_Supply,
|
||||
pub outputs: UtxoPattern3,
|
||||
pub outputs: UnspentPattern3,
|
||||
pub activity: CoindaysCoinyearsDormancySentVelocityPattern,
|
||||
pub realized: CapGrossInvestorLossMvrvNetNuplPeakPriceProfitSoprPattern,
|
||||
pub cost_basis: InvestedMaxMinPercentilesSupplyPattern,
|
||||
@@ -6398,7 +6410,7 @@ impl MetricsTree_Distribution_UtxoCohorts_All {
|
||||
pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self {
|
||||
Self {
|
||||
supply: MetricsTree_Distribution_UtxoCohorts_All_Supply::new(client.clone(), format!("{base_path}_supply")),
|
||||
outputs: UtxoPattern3::new(client.clone(), "utxo_count".to_string()),
|
||||
outputs: UnspentPattern3::new(client.clone(), "utxo_count".to_string()),
|
||||
activity: CoindaysCoinyearsDormancySentVelocityPattern::new(client.clone(), "".to_string()),
|
||||
realized: CapGrossInvestorLossMvrvNetNuplPeakPriceProfitSoprPattern::new(client.clone(), "".to_string()),
|
||||
cost_basis: InvestedMaxMinPercentilesSupplyPattern::new(client.clone(), "".to_string()),
|
||||
@@ -6514,7 +6526,7 @@ impl MetricsTree_Distribution_UtxoCohorts_All_Unrealized_Profit {
|
||||
pub struct MetricsTree_Distribution_UtxoCohorts_Sth {
|
||||
pub realized: CapGrossInvestorLossMvrvNetNuplPeakPriceProfitSoprPattern,
|
||||
pub supply: DeltaHalvedInRelTotalPattern2,
|
||||
pub outputs: UtxoPattern3,
|
||||
pub outputs: UnspentPattern3,
|
||||
pub activity: CoindaysCoinyearsDormancySentVelocityPattern,
|
||||
pub cost_basis: InvestedMaxMinPercentilesSupplyPattern,
|
||||
pub unrealized: GrossInvestedInvestorLossNetProfitSentimentPattern2,
|
||||
@@ -6525,7 +6537,7 @@ impl MetricsTree_Distribution_UtxoCohorts_Sth {
|
||||
Self {
|
||||
realized: CapGrossInvestorLossMvrvNetNuplPeakPriceProfitSoprPattern::new(client.clone(), "sth".to_string()),
|
||||
supply: DeltaHalvedInRelTotalPattern2::new(client.clone(), "sth_supply".to_string()),
|
||||
outputs: UtxoPattern3::new(client.clone(), "sth_utxo_count".to_string()),
|
||||
outputs: UnspentPattern3::new(client.clone(), "sth_utxo_count".to_string()),
|
||||
activity: CoindaysCoinyearsDormancySentVelocityPattern::new(client.clone(), "sth".to_string()),
|
||||
cost_basis: InvestedMaxMinPercentilesSupplyPattern::new(client.clone(), "sth".to_string()),
|
||||
unrealized: GrossInvestedInvestorLossNetProfitSentimentPattern2::new(client.clone(), "sth".to_string()),
|
||||
@@ -6536,7 +6548,7 @@ impl MetricsTree_Distribution_UtxoCohorts_Sth {
|
||||
/// Metrics tree node.
|
||||
pub struct MetricsTree_Distribution_UtxoCohorts_Lth {
|
||||
pub supply: DeltaHalvedInRelTotalPattern2,
|
||||
pub outputs: UtxoPattern3,
|
||||
pub outputs: UnspentPattern3,
|
||||
pub activity: CoindaysCoinyearsDormancySentVelocityPattern,
|
||||
pub realized: MetricsTree_Distribution_UtxoCohorts_Lth_Realized,
|
||||
pub cost_basis: InvestedMaxMinPercentilesSupplyPattern,
|
||||
@@ -6547,7 +6559,7 @@ impl MetricsTree_Distribution_UtxoCohorts_Lth {
|
||||
pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self {
|
||||
Self {
|
||||
supply: DeltaHalvedInRelTotalPattern2::new(client.clone(), "lth_supply".to_string()),
|
||||
outputs: UtxoPattern3::new(client.clone(), "lth_utxo_count".to_string()),
|
||||
outputs: UnspentPattern3::new(client.clone(), "lth_utxo_count".to_string()),
|
||||
activity: CoindaysCoinyearsDormancySentVelocityPattern::new(client.clone(), "lth".to_string()),
|
||||
realized: MetricsTree_Distribution_UtxoCohorts_Lth_Realized::new(client.clone(), format!("{base_path}_realized")),
|
||||
cost_basis: InvestedMaxMinPercentilesSupplyPattern::new(client.clone(), "lth".to_string()),
|
||||
@@ -7337,7 +7349,34 @@ impl MetricsTree_Distribution_AddressCohorts_LtAmount {
|
||||
}
|
||||
|
||||
/// Metrics tree node.
|
||||
pub struct MetricsTree_Distribution_AddressActivity {
|
||||
pub struct MetricsTree_Distribution_Addresses {
|
||||
pub funded: AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3,
|
||||
pub empty: AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3,
|
||||
pub activity: MetricsTree_Distribution_Addresses_Activity,
|
||||
pub total: AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3,
|
||||
pub new: MetricsTree_Distribution_Addresses_New,
|
||||
pub delta: MetricsTree_Distribution_Addresses_Delta,
|
||||
pub funded_index: MetricPattern34<FundedAddressIndex>,
|
||||
pub empty_index: MetricPattern35<EmptyAddressIndex>,
|
||||
}
|
||||
|
||||
impl MetricsTree_Distribution_Addresses {
|
||||
pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self {
|
||||
Self {
|
||||
funded: AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3::new(client.clone(), "addr_count".to_string()),
|
||||
empty: AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3::new(client.clone(), "empty_addr_count".to_string()),
|
||||
activity: MetricsTree_Distribution_Addresses_Activity::new(client.clone(), format!("{base_path}_activity")),
|
||||
total: AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3::new(client.clone(), "total_addr_count".to_string()),
|
||||
new: MetricsTree_Distribution_Addresses_New::new(client.clone(), format!("{base_path}_new")),
|
||||
delta: MetricsTree_Distribution_Addresses_Delta::new(client.clone(), format!("{base_path}_delta")),
|
||||
funded_index: MetricPattern34::new(client.clone(), "funded_address_index".to_string()),
|
||||
empty_index: MetricPattern35::new(client.clone(), "empty_address_index".to_string()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Metrics tree node.
|
||||
pub struct MetricsTree_Distribution_Addresses_Activity {
|
||||
pub all: BothReactivatedReceivingSendingPattern,
|
||||
pub p2pk65: BothReactivatedReceivingSendingPattern,
|
||||
pub p2pk33: BothReactivatedReceivingSendingPattern,
|
||||
@@ -7349,7 +7388,7 @@ pub struct MetricsTree_Distribution_AddressActivity {
|
||||
pub p2a: BothReactivatedReceivingSendingPattern,
|
||||
}
|
||||
|
||||
impl MetricsTree_Distribution_AddressActivity {
|
||||
impl MetricsTree_Distribution_Addresses_Activity {
|
||||
pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self {
|
||||
Self {
|
||||
all: BothReactivatedReceivingSendingPattern::new(client.clone(), "address_activity".to_string()),
|
||||
@@ -7366,7 +7405,7 @@ impl MetricsTree_Distribution_AddressActivity {
|
||||
}
|
||||
|
||||
/// Metrics tree node.
|
||||
pub struct MetricsTree_Distribution_NewAddrCount {
|
||||
pub struct MetricsTree_Distribution_Addresses_New {
|
||||
pub all: RawSumPattern3<StoredU64>,
|
||||
pub p2pk65: RawSumPattern3<StoredU64>,
|
||||
pub p2pk33: RawSumPattern3<StoredU64>,
|
||||
@@ -7378,7 +7417,7 @@ pub struct MetricsTree_Distribution_NewAddrCount {
|
||||
pub p2a: RawSumPattern3<StoredU64>,
|
||||
}
|
||||
|
||||
impl MetricsTree_Distribution_NewAddrCount {
|
||||
impl MetricsTree_Distribution_Addresses_New {
|
||||
pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self {
|
||||
Self {
|
||||
all: RawSumPattern3::new(client.clone(), "new_addr_count".to_string()),
|
||||
@@ -7395,7 +7434,7 @@ impl MetricsTree_Distribution_NewAddrCount {
|
||||
}
|
||||
|
||||
/// Metrics tree node.
|
||||
pub struct MetricsTree_Distribution_Delta {
|
||||
pub struct MetricsTree_Distribution_Addresses_Delta {
|
||||
pub all: ChangeRatePattern2,
|
||||
pub p2pk65: ChangeRatePattern2,
|
||||
pub p2pk33: ChangeRatePattern2,
|
||||
@@ -7407,7 +7446,7 @@ pub struct MetricsTree_Distribution_Delta {
|
||||
pub p2a: ChangeRatePattern2,
|
||||
}
|
||||
|
||||
impl MetricsTree_Distribution_Delta {
|
||||
impl MetricsTree_Distribution_Addresses_Delta {
|
||||
pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self {
|
||||
Self {
|
||||
all: ChangeRatePattern2::new(client.clone(), "addr_count".to_string()),
|
||||
@@ -7431,7 +7470,7 @@ pub struct MetricsTree_Supply {
|
||||
pub velocity: MetricsTree_Supply_Velocity,
|
||||
pub market_cap: MetricsTree_Supply_MarketCap,
|
||||
pub market_minus_realized_cap_growth_rate: _1m1w1y24hPattern<BasisPointsSigned32>,
|
||||
pub hodled_or_lost_coins: BtcCentsSatsUsdPattern,
|
||||
pub hodled_or_lost: BtcCentsSatsUsdPattern,
|
||||
}
|
||||
|
||||
impl MetricsTree_Supply {
|
||||
@@ -7443,7 +7482,7 @@ impl MetricsTree_Supply {
|
||||
velocity: MetricsTree_Supply_Velocity::new(client.clone(), format!("{base_path}_velocity")),
|
||||
market_cap: MetricsTree_Supply_MarketCap::new(client.clone(), format!("{base_path}_market_cap")),
|
||||
market_minus_realized_cap_growth_rate: _1m1w1y24hPattern::new(client.clone(), "market_minus_realized_cap_growth_rate".to_string()),
|
||||
hodled_or_lost_coins: BtcCentsSatsUsdPattern::new(client.clone(), "hodled_or_lost_coins".to_string()),
|
||||
hodled_or_lost: BtcCentsSatsUsdPattern::new(client.clone(), "hodled_or_lost_coins".to_string()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ pub fn main() -> Result<()> {
|
||||
println!("Time for BytesVec write_json: {:?}", start.elapsed());
|
||||
|
||||
// Test emptyaddressindex (LazyVecFrom1 wrapper) - computed access
|
||||
let empty_index = &computer.distribution.empty_address_index;
|
||||
let empty_index = &computer.distribution.addresses.empty_index;
|
||||
println!(
|
||||
"\nemptyaddressindex (LazyVecFrom1) len: {}",
|
||||
empty_index.len()
|
||||
|
||||
@@ -16,24 +16,24 @@ impl Vecs {
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
// Block count raw + cumulative
|
||||
self.block_count.raw.height.compute_range(
|
||||
self.total.raw.height.compute_range(
|
||||
starting_indexes.height,
|
||||
&indexer.vecs.blocks.weight,
|
||||
|h| (h, StoredU32::from(1_u32)),
|
||||
exit,
|
||||
)?;
|
||||
self.block_count.cumulative.height.compute_cumulative(
|
||||
self.total.cumulative.height.compute_cumulative(
|
||||
starting_indexes.height,
|
||||
&self.block_count.raw.height,
|
||||
&self.total.raw.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
// Rolling window block counts
|
||||
let ws = lookback.window_starts();
|
||||
self.block_count.sum.compute_rolling_sum(
|
||||
self.total.sum.compute_rolling_sum(
|
||||
starting_indexes.height,
|
||||
&ws,
|
||||
&self.block_count.raw.height,
|
||||
&self.total.raw.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
|
||||
@@ -15,12 +15,12 @@ impl Vecs {
|
||||
indexes: &indexes::Vecs,
|
||||
) -> Result<Self> {
|
||||
Ok(Self {
|
||||
block_count_target: ConstantVecs::new::<BlockCountTarget>(
|
||||
target: ConstantVecs::new::<BlockCountTarget>(
|
||||
"block_count_target",
|
||||
version,
|
||||
indexes,
|
||||
),
|
||||
block_count: ComputedPerBlockCumulativeSum::forced_import(
|
||||
total: ComputedPerBlockCumulativeSum::forced_import(
|
||||
db,
|
||||
"block_count",
|
||||
version,
|
||||
|
||||
@@ -6,6 +6,6 @@ use crate::internal::{ComputedPerBlockCumulativeSum, ConstantVecs};
|
||||
|
||||
#[derive(Traversable)]
|
||||
pub struct Vecs<M: StorageMode = Rw> {
|
||||
pub block_count_target: ConstantVecs<StoredU64>,
|
||||
pub block_count: ComputedPerBlockCumulativeSum<StoredU32, M>,
|
||||
pub target: ConstantVecs<StoredU64>,
|
||||
pub total: ComputedPerBlockCumulativeSum<StoredU32, M>,
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ impl Vecs {
|
||||
self.size.compute(
|
||||
starting_indexes.height,
|
||||
&window_starts,
|
||||
&indexer.vecs.blocks.total_size,
|
||||
&indexer.vecs.blocks.total,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ impl Vecs {
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.activity_to_vaultedness_ratio.height.compute_divide(
|
||||
self.ratio.height.compute_divide(
|
||||
starting_indexes.height,
|
||||
&self.liveliness.height,
|
||||
&self.vaultedness.height,
|
||||
|
||||
@@ -29,7 +29,7 @@ impl Vecs {
|
||||
)?,
|
||||
liveliness: ComputedPerBlock::forced_import(db, "liveliness", version, indexes)?,
|
||||
vaultedness: ComputedPerBlock::forced_import(db, "vaultedness", version, indexes)?,
|
||||
activity_to_vaultedness_ratio: ComputedPerBlock::forced_import(
|
||||
ratio: ComputedPerBlock::forced_import(
|
||||
db,
|
||||
"activity_to_vaultedness_ratio",
|
||||
version,
|
||||
|
||||
@@ -10,5 +10,5 @@ pub struct Vecs<M: StorageMode = Rw> {
|
||||
pub coinblocks_stored: ComputedPerBlockCumulativeSum<StoredF64, M>,
|
||||
pub liveliness: ComputedPerBlock<StoredF64, M>,
|
||||
pub vaultedness: ComputedPerBlock<StoredF64, M>,
|
||||
pub activity_to_vaultedness_ratio: ComputedPerBlock<StoredF64, M>,
|
||||
pub ratio: ComputedPerBlock<StoredF64, M>,
|
||||
}
|
||||
|
||||
@@ -29,14 +29,14 @@ impl Vecs {
|
||||
|
||||
self.tx_velocity_btc.height.compute_multiply(
|
||||
starting_indexes.height,
|
||||
&activity.activity_to_vaultedness_ratio.height,
|
||||
&activity.ratio.height,
|
||||
&supply.velocity.btc.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.tx_velocity_usd.height.compute_multiply(
|
||||
starting_indexes.height,
|
||||
&activity.activity_to_vaultedness_ratio.height,
|
||||
&activity.ratio.height,
|
||||
&supply.velocity.usd.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
@@ -21,28 +21,28 @@ impl Vecs {
|
||||
let realized_cap_cents = &all_metrics.realized.cap.cents.height;
|
||||
let circulating_supply = &all_metrics.supply.total.btc.height;
|
||||
|
||||
self.thermo_cap.cents.height.compute_transform(
|
||||
self.thermo.cents.height.compute_transform(
|
||||
starting_indexes.height,
|
||||
&mining.rewards.subsidy.cumulative.cents.height,
|
||||
|(i, v, ..)| (i, v),
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.investor_cap.cents.height.compute_subtract(
|
||||
self.investor.cents.height.compute_subtract(
|
||||
starting_indexes.height,
|
||||
realized_cap_cents,
|
||||
&self.thermo_cap.cents.height,
|
||||
&self.thermo.cents.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.vaulted_cap.cents.height.compute_multiply(
|
||||
self.vaulted.cents.height.compute_multiply(
|
||||
starting_indexes.height,
|
||||
realized_cap_cents,
|
||||
&activity.vaultedness.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.active_cap.cents.height.compute_multiply(
|
||||
self.active.cents.height.compute_multiply(
|
||||
starting_indexes.height,
|
||||
realized_cap_cents,
|
||||
&activity.liveliness.height,
|
||||
@@ -50,9 +50,9 @@ impl Vecs {
|
||||
)?;
|
||||
|
||||
// cointime_cap = (cointime_value_destroyed_cumulative * circulating_supply) / coinblocks_stored_cumulative
|
||||
self.cointime_cap.cents.height.compute_transform3(
|
||||
self.cointime.cents.height.compute_transform3(
|
||||
starting_indexes.height,
|
||||
&value.value_destroyed.cumulative.height,
|
||||
&value.destroyed.cumulative.height,
|
||||
circulating_supply,
|
||||
&activity.coinblocks_stored.cumulative.height,
|
||||
|(i, destroyed, supply, stored, ..)| {
|
||||
@@ -67,8 +67,8 @@ impl Vecs {
|
||||
// AVIV = active_cap / investor_cap
|
||||
self.aviv.compute_ratio(
|
||||
starting_indexes,
|
||||
&self.active_cap.cents.height,
|
||||
&self.investor_cap.cents.height,
|
||||
&self.active.cents.height,
|
||||
&self.investor.cents.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
|
||||
@@ -12,11 +12,11 @@ impl Vecs {
|
||||
indexes: &indexes::Vecs,
|
||||
) -> Result<Self> {
|
||||
Ok(Self {
|
||||
thermo_cap: FiatPerBlock::forced_import(db, "thermo_cap", version, indexes)?,
|
||||
investor_cap: FiatPerBlock::forced_import(db, "investor_cap", version, indexes)?,
|
||||
vaulted_cap: FiatPerBlock::forced_import(db, "vaulted_cap", version, indexes)?,
|
||||
active_cap: FiatPerBlock::forced_import(db, "active_cap", version, indexes)?,
|
||||
cointime_cap: FiatPerBlock::forced_import(db, "cointime_cap", version, indexes)?,
|
||||
thermo: FiatPerBlock::forced_import(db, "thermo_cap", version, indexes)?,
|
||||
investor: FiatPerBlock::forced_import(db, "investor_cap", version, indexes)?,
|
||||
vaulted: FiatPerBlock::forced_import(db, "vaulted_cap", version, indexes)?,
|
||||
active: FiatPerBlock::forced_import(db, "active_cap", version, indexes)?,
|
||||
cointime: FiatPerBlock::forced_import(db, "cointime_cap", version, indexes)?,
|
||||
aviv: RatioPerBlock::forced_import(db, "aviv", version, indexes)?,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -6,10 +6,10 @@ use crate::internal::{FiatPerBlock, RatioPerBlock};
|
||||
|
||||
#[derive(Traversable)]
|
||||
pub struct Vecs<M: StorageMode = Rw> {
|
||||
pub thermo_cap: FiatPerBlock<Cents, M>,
|
||||
pub investor_cap: FiatPerBlock<Cents, M>,
|
||||
pub vaulted_cap: FiatPerBlock<Cents, M>,
|
||||
pub active_cap: FiatPerBlock<Cents, M>,
|
||||
pub cointime_cap: FiatPerBlock<Cents, M>,
|
||||
pub thermo: FiatPerBlock<Cents, M>,
|
||||
pub investor: FiatPerBlock<Cents, M>,
|
||||
pub vaulted: FiatPerBlock<Cents, M>,
|
||||
pub active: FiatPerBlock<Cents, M>,
|
||||
pub cointime: FiatPerBlock<Cents, M>,
|
||||
pub aviv: RatioPerBlock<BasisPoints32, M>,
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ impl Vecs {
|
||||
// Phase 4: pricing and reserve_risk are independent
|
||||
let (r3, r4) = rayon::join(
|
||||
|| {
|
||||
self.pricing.compute(
|
||||
self.prices.compute(
|
||||
starting_indexes,
|
||||
prices,
|
||||
distribution,
|
||||
|
||||
@@ -9,7 +9,7 @@ use crate::{
|
||||
};
|
||||
|
||||
use super::{
|
||||
ActivityVecs, AdjustedVecs, CapVecs, DB_NAME, PricingVecs, ReserveRiskVecs, SupplyVecs,
|
||||
ActivityVecs, AdjustedVecs, CapVecs, DB_NAME, PricesVecs, ReserveRiskVecs, SupplyVecs,
|
||||
ValueVecs, Vecs,
|
||||
};
|
||||
|
||||
@@ -26,7 +26,7 @@ impl Vecs {
|
||||
let supply = SupplyVecs::forced_import(&db, v1, indexes)?;
|
||||
let value = ValueVecs::forced_import(&db, v1, indexes)?;
|
||||
let cap = CapVecs::forced_import(&db, v1, indexes)?;
|
||||
let pricing = PricingVecs::forced_import(&db, version, indexes)?;
|
||||
let prices = PricesVecs::forced_import(&db, version, indexes)?;
|
||||
let adjusted = AdjustedVecs::forced_import(&db, version, indexes)?;
|
||||
let reserve_risk = ReserveRiskVecs::forced_import(&db, v1, indexes)?;
|
||||
|
||||
@@ -36,7 +36,7 @@ impl Vecs {
|
||||
supply,
|
||||
value,
|
||||
cap,
|
||||
pricing,
|
||||
prices,
|
||||
adjusted,
|
||||
reserve_risk,
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
pub mod activity;
|
||||
pub mod adjusted;
|
||||
pub mod cap;
|
||||
pub mod pricing;
|
||||
pub mod prices;
|
||||
pub mod reserve_risk;
|
||||
pub mod supply;
|
||||
pub mod value;
|
||||
@@ -15,7 +15,7 @@ use vecdb::{Database, Rw, StorageMode};
|
||||
pub use activity::Vecs as ActivityVecs;
|
||||
pub use adjusted::Vecs as AdjustedVecs;
|
||||
pub use cap::Vecs as CapVecs;
|
||||
pub use pricing::Vecs as PricingVecs;
|
||||
pub use prices::Vecs as PricesVecs;
|
||||
pub use reserve_risk::Vecs as ReserveRiskVecs;
|
||||
pub use supply::Vecs as SupplyVecs;
|
||||
pub use value::Vecs as ValueVecs;
|
||||
@@ -31,7 +31,7 @@ pub struct Vecs<M: StorageMode = Rw> {
|
||||
pub supply: SupplyVecs<M>,
|
||||
pub value: ValueVecs<M>,
|
||||
pub cap: CapVecs<M>,
|
||||
pub pricing: PricingVecs<M>,
|
||||
pub prices: PricesVecs<M>,
|
||||
pub adjusted: AdjustedVecs<M>,
|
||||
pub reserve_risk: ReserveRiskVecs<M>,
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ impl Vecs {
|
||||
let realized_price = &all_metrics.realized.price.cents.height;
|
||||
let realized_cap = &all_metrics.realized.cap.cents.height;
|
||||
|
||||
self.vaulted_price.compute_all(
|
||||
self.vaulted.compute_all(
|
||||
prices,
|
||||
starting_indexes,
|
||||
exit,
|
||||
@@ -40,7 +40,7 @@ impl Vecs {
|
||||
},
|
||||
)?;
|
||||
|
||||
self.active_price.compute_all(
|
||||
self.active.compute_all(
|
||||
prices,
|
||||
starting_indexes,
|
||||
exit,
|
||||
@@ -61,8 +61,8 @@ impl Vecs {
|
||||
|v| {
|
||||
Ok(v.compute_transform2(
|
||||
starting_indexes.height,
|
||||
&cap.investor_cap.cents.height,
|
||||
&supply.active_supply.btc.height,
|
||||
&cap.investor.cents.height,
|
||||
&supply.active.btc.height,
|
||||
|(i, cap_cents, supply_btc, ..)| {
|
||||
(i, Cents::from(f64::from(cap_cents) / f64::from(supply_btc)))
|
||||
},
|
||||
@@ -72,14 +72,14 @@ impl Vecs {
|
||||
)?;
|
||||
|
||||
// cointime_price = cointime_cap / circulating_supply
|
||||
self.cointime_price.compute_all(
|
||||
self.cointime.compute_all(
|
||||
prices,
|
||||
starting_indexes,
|
||||
exit,
|
||||
|v| {
|
||||
Ok(v.compute_transform2(
|
||||
starting_indexes.height,
|
||||
&cap.cointime_cap.cents.height,
|
||||
&cap.cointime.cents.height,
|
||||
circulating_supply,
|
||||
|(i, cap_cents, supply_btc, ..)| {
|
||||
(i, Cents::from(f64::from(cap_cents) / f64::from(supply_btc)))
|
||||
@@ -90,29 +90,29 @@ impl Vecs {
|
||||
)?;
|
||||
|
||||
// transfer_price = cointime_price - vaulted_price
|
||||
self.transfer_price.cents.height.compute_transform2(
|
||||
self.transfer.cents.height.compute_transform2(
|
||||
starting_indexes.height,
|
||||
&self.cointime_price.cents.height,
|
||||
&self.vaulted_price.cents.height,
|
||||
&self.cointime.cents.height,
|
||||
&self.vaulted.cents.height,
|
||||
|(i, cointime, vaulted, ..)| (i, cointime.saturating_sub(vaulted)),
|
||||
exit,
|
||||
)?;
|
||||
self.transfer_price.compute_rest(prices, starting_indexes, exit)?;
|
||||
self.transfer.compute_rest(prices, starting_indexes, exit)?;
|
||||
|
||||
// balanced_price = (realized_price + transfer_price) / 2
|
||||
self.balanced_price.cents.height.compute_transform2(
|
||||
self.balanced.cents.height.compute_transform2(
|
||||
starting_indexes.height,
|
||||
realized_price,
|
||||
&self.transfer_price.cents.height,
|
||||
&self.transfer.cents.height,
|
||||
|(i, realized, transfer, ..)| (i, (realized + transfer) / 2u64),
|
||||
exit,
|
||||
)?;
|
||||
self.balanced_price.compute_rest(prices, starting_indexes, exit)?;
|
||||
self.balanced.compute_rest(prices, starting_indexes, exit)?;
|
||||
|
||||
// terminal_price = 21M × transfer_price / circulating_supply_btc
|
||||
self.terminal_price.cents.height.compute_transform2(
|
||||
self.terminal.cents.height.compute_transform2(
|
||||
starting_indexes.height,
|
||||
&self.transfer_price.cents.height,
|
||||
&self.transfer.cents.height,
|
||||
circulating_supply,
|
||||
|(i, transfer, supply_btc, ..)| {
|
||||
let supply = f64::from(supply_btc);
|
||||
@@ -124,7 +124,7 @@ impl Vecs {
|
||||
},
|
||||
exit,
|
||||
)?;
|
||||
self.terminal_price.compute_rest(prices, starting_indexes, exit)?;
|
||||
self.terminal.compute_rest(prices, starting_indexes, exit)?;
|
||||
|
||||
// cumulative_market_cap = Σ(market_cap) in dollars
|
||||
self.cumulative_market_cap
|
||||
@@ -137,7 +137,7 @@ impl Vecs {
|
||||
|
||||
// delta_price = (realized_cap - average_cap) / circulating_supply
|
||||
// average_cap = cumulative_market_cap / (height + 1)
|
||||
self.delta_price.cents.height.compute_transform3(
|
||||
self.delta.cents.height.compute_transform3(
|
||||
starting_indexes.height,
|
||||
realized_cap,
|
||||
&self.cumulative_market_cap.height,
|
||||
@@ -153,7 +153,7 @@ impl Vecs {
|
||||
},
|
||||
exit,
|
||||
)?;
|
||||
self.delta_price.compute_rest(prices, starting_indexes, exit)?;
|
||||
self.delta.compute_rest(prices, starting_indexes, exit)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -21,14 +21,14 @@ impl Vecs {
|
||||
}
|
||||
|
||||
Ok(Self {
|
||||
vaulted_price: import!("vaulted_price"),
|
||||
active_price: import!("active_price"),
|
||||
vaulted: import!("vaulted_price"),
|
||||
active: import!("active_price"),
|
||||
true_market_mean: import!("true_market_mean"),
|
||||
cointime_price: import!("cointime_price"),
|
||||
transfer_price: import!("transfer_price"),
|
||||
balanced_price: import!("balanced_price"),
|
||||
terminal_price: import!("terminal_price"),
|
||||
delta_price: import!("delta_price"),
|
||||
cointime: import!("cointime_price"),
|
||||
transfer: import!("transfer_price"),
|
||||
balanced: import!("balanced_price"),
|
||||
terminal: import!("terminal_price"),
|
||||
delta: import!("delta_price"),
|
||||
cumulative_market_cap: ComputedPerBlock::forced_import(
|
||||
db,
|
||||
"cumulative_market_cap",
|
||||
19
crates/brk_computer/src/cointime/prices/vecs.rs
Normal file
19
crates/brk_computer/src/cointime/prices/vecs.rs
Normal file
@@ -0,0 +1,19 @@
|
||||
use brk_traversable::Traversable;
|
||||
use brk_types::Dollars;
|
||||
use vecdb::{Rw, StorageMode};
|
||||
|
||||
use crate::internal::{ComputedPerBlock, PriceWithRatioExtendedPerBlock};
|
||||
|
||||
#[derive(Traversable)]
|
||||
pub struct Vecs<M: StorageMode = Rw> {
|
||||
pub vaulted: PriceWithRatioExtendedPerBlock<M>,
|
||||
pub active: PriceWithRatioExtendedPerBlock<M>,
|
||||
pub true_market_mean: PriceWithRatioExtendedPerBlock<M>,
|
||||
pub cointime: PriceWithRatioExtendedPerBlock<M>,
|
||||
pub transfer: PriceWithRatioExtendedPerBlock<M>,
|
||||
pub balanced: PriceWithRatioExtendedPerBlock<M>,
|
||||
pub terminal: PriceWithRatioExtendedPerBlock<M>,
|
||||
pub delta: PriceWithRatioExtendedPerBlock<M>,
|
||||
|
||||
pub cumulative_market_cap: ComputedPerBlock<Dollars, M>,
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
use brk_traversable::Traversable;
|
||||
use brk_types::Dollars;
|
||||
use vecdb::{Rw, StorageMode};
|
||||
|
||||
use crate::internal::{ComputedPerBlock, PriceWithRatioExtendedPerBlock};
|
||||
|
||||
#[derive(Traversable)]
|
||||
pub struct Vecs<M: StorageMode = Rw> {
|
||||
pub vaulted_price: PriceWithRatioExtendedPerBlock<M>,
|
||||
pub active_price: PriceWithRatioExtendedPerBlock<M>,
|
||||
pub true_market_mean: PriceWithRatioExtendedPerBlock<M>,
|
||||
pub cointime_price: PriceWithRatioExtendedPerBlock<M>,
|
||||
pub transfer_price: PriceWithRatioExtendedPerBlock<M>,
|
||||
pub balanced_price: PriceWithRatioExtendedPerBlock<M>,
|
||||
pub terminal_price: PriceWithRatioExtendedPerBlock<M>,
|
||||
pub delta_price: PriceWithRatioExtendedPerBlock<M>,
|
||||
|
||||
pub cumulative_market_cap: ComputedPerBlock<Dollars, M>,
|
||||
}
|
||||
@@ -23,14 +23,14 @@ impl Vecs {
|
||||
.sats
|
||||
.height;
|
||||
|
||||
self.vaulted_supply.sats.height.compute_multiply(
|
||||
self.vaulted.sats.height.compute_multiply(
|
||||
starting_indexes.height,
|
||||
circulating_supply,
|
||||
&activity.vaultedness.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.active_supply.sats.height.compute_multiply(
|
||||
self.active.sats.height.compute_multiply(
|
||||
starting_indexes.height,
|
||||
circulating_supply,
|
||||
&activity.liveliness.height,
|
||||
|
||||
@@ -12,13 +12,13 @@ impl Vecs {
|
||||
indexes: &indexes::Vecs,
|
||||
) -> Result<Self> {
|
||||
Ok(Self {
|
||||
vaulted_supply: AmountPerBlock::forced_import(
|
||||
vaulted: AmountPerBlock::forced_import(
|
||||
db,
|
||||
"vaulted_supply",
|
||||
version,
|
||||
indexes,
|
||||
)?,
|
||||
active_supply: AmountPerBlock::forced_import(db, "active_supply", version, indexes)?,
|
||||
active: AmountPerBlock::forced_import(db, "active_supply", version, indexes)?,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,6 @@ use crate::internal::AmountPerBlock;
|
||||
|
||||
#[derive(Traversable)]
|
||||
pub struct Vecs<M: StorageMode = Rw> {
|
||||
pub vaulted_supply: AmountPerBlock<M>,
|
||||
pub active_supply: AmountPerBlock<M>,
|
||||
pub vaulted: AmountPerBlock<M>,
|
||||
pub active: AmountPerBlock<M>,
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ impl Vecs {
|
||||
let coindays_destroyed = &all_metrics.activity.coindays_destroyed;
|
||||
let circulating_supply = &all_metrics.supply.total.btc.height;
|
||||
|
||||
self.value_destroyed
|
||||
self.destroyed
|
||||
.compute(starting_indexes.height, &window_starts, exit, |vec| {
|
||||
vec.compute_multiply(
|
||||
starting_indexes.height,
|
||||
@@ -34,7 +34,7 @@ impl Vecs {
|
||||
Ok(())
|
||||
})?;
|
||||
|
||||
self.value_created
|
||||
self.created
|
||||
.compute(starting_indexes.height, &window_starts, exit, |vec| {
|
||||
vec.compute_multiply(
|
||||
starting_indexes.height,
|
||||
@@ -45,7 +45,7 @@ impl Vecs {
|
||||
Ok(())
|
||||
})?;
|
||||
|
||||
self.value_stored
|
||||
self.stored
|
||||
.compute(starting_indexes.height, &window_starts, exit, |vec| {
|
||||
vec.compute_multiply(
|
||||
starting_indexes.height,
|
||||
|
||||
@@ -12,19 +12,19 @@ impl Vecs {
|
||||
indexes: &indexes::Vecs,
|
||||
) -> Result<Self> {
|
||||
Ok(Self {
|
||||
value_destroyed: ComputedPerBlockCumulativeSum::forced_import(
|
||||
destroyed: ComputedPerBlockCumulativeSum::forced_import(
|
||||
db,
|
||||
"cointime_value_destroyed",
|
||||
version,
|
||||
indexes,
|
||||
)?,
|
||||
value_created: ComputedPerBlockCumulativeSum::forced_import(
|
||||
created: ComputedPerBlockCumulativeSum::forced_import(
|
||||
db,
|
||||
"cointime_value_created",
|
||||
version,
|
||||
indexes,
|
||||
)?,
|
||||
value_stored: ComputedPerBlockCumulativeSum::forced_import(
|
||||
stored: ComputedPerBlockCumulativeSum::forced_import(
|
||||
db,
|
||||
"cointime_value_stored",
|
||||
version,
|
||||
|
||||
@@ -6,8 +6,8 @@ use crate::internal::ComputedPerBlockCumulativeSum;
|
||||
|
||||
#[derive(Traversable)]
|
||||
pub struct Vecs<M: StorageMode = Rw> {
|
||||
pub value_destroyed: ComputedPerBlockCumulativeSum<StoredF64, M>,
|
||||
pub value_created: ComputedPerBlockCumulativeSum<StoredF64, M>,
|
||||
pub value_stored: ComputedPerBlockCumulativeSum<StoredF64, M>,
|
||||
pub destroyed: ComputedPerBlockCumulativeSum<StoredF64, M>,
|
||||
pub created: ComputedPerBlockCumulativeSum<StoredF64, M>,
|
||||
pub stored: ComputedPerBlockCumulativeSum<StoredF64, M>,
|
||||
pub vocdd: ComputedPerBlockCumulativeSum<StoredF64, M>,
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ pub struct AddressesDataVecs<M: StorageMode = Rw> {
|
||||
|
||||
impl AddressesDataVecs {
|
||||
/// Get minimum stamped height across funded and empty data.
|
||||
pub(crate) fn min_stamped_height(&self) -> Height {
|
||||
pub(crate) fn min_stamped_len(&self) -> Height {
|
||||
Height::from(self.funded.stamp())
|
||||
.incremented()
|
||||
.min(Height::from(self.empty.stamp()).incremented())
|
||||
|
||||
@@ -39,7 +39,7 @@ macro_rules! define_any_address_indexes_vecs {
|
||||
}
|
||||
|
||||
/// Get minimum stamped height across all address types.
|
||||
pub(crate) fn min_stamped_height(&self) -> Height {
|
||||
pub(crate) fn min_stamped_len(&self) -> Height {
|
||||
[$(Height::from(self.$field.stamp()).incremented()),*]
|
||||
.into_iter()
|
||||
.min()
|
||||
|
||||
@@ -132,7 +132,7 @@ impl DynCohortVecs for AddressCohortVecs {
|
||||
state.inner.supply.utxo_count = *self
|
||||
.metrics
|
||||
.outputs
|
||||
.utxo_count
|
||||
.unspent_count
|
||||
.height
|
||||
.collect_one(prev_height)
|
||||
.unwrap();
|
||||
|
||||
@@ -16,7 +16,7 @@ macro_rules! impl_import_state {
|
||||
state.supply.utxo_count = *self
|
||||
.metrics
|
||||
.outputs
|
||||
.utxo_count
|
||||
.unspent_count
|
||||
.height
|
||||
.collect_one(prev_height)
|
||||
.unwrap();
|
||||
@@ -140,7 +140,7 @@ impl<M: CohortMetricsBase + Traversable> DynCohortVecs for UTXOCohortVecs<M> {
|
||||
state.supply.utxo_count = *self
|
||||
.metrics
|
||||
.outputs()
|
||||
.utxo_count
|
||||
.unspent_count
|
||||
.height
|
||||
.collect_one(prev_height)
|
||||
.unwrap();
|
||||
|
||||
@@ -66,8 +66,8 @@ pub(crate) fn process_blocks(
|
||||
let height_to_first_txindex = &indexer.vecs.transactions.first_txindex;
|
||||
let height_to_first_txoutindex = &indexer.vecs.outputs.first_txoutindex;
|
||||
let height_to_first_txinindex = &indexer.vecs.inputs.first_txinindex;
|
||||
let height_to_tx_count = &transactions.count.tx_count.raw.height;
|
||||
let height_to_output_count = &outputs.count.total_count.full.sum;
|
||||
let height_to_tx_count = &transactions.count.total.raw.height;
|
||||
let height_to_output_count = &outputs.count.total.full.sum;
|
||||
let height_to_input_count = &inputs.count.full.sum;
|
||||
let txindex_to_output_count = &indexes.txindex.output_count;
|
||||
let txindex_to_input_count = &indexes.txindex.input_count;
|
||||
@@ -186,9 +186,9 @@ pub(crate) fn process_blocks(
|
||||
debug!("recovering addr_counts from height {}", starting_height);
|
||||
let (mut addr_counts, mut empty_addr_counts) = if starting_height > Height::ZERO {
|
||||
let addr_counts =
|
||||
AddressTypeToAddressCount::from((&vecs.addr_count.by_addresstype, starting_height));
|
||||
AddressTypeToAddressCount::from((&vecs.addresses.funded.by_addresstype, starting_height));
|
||||
let empty_addr_counts = AddressTypeToAddressCount::from((
|
||||
&vecs.empty_addr_count.by_addresstype,
|
||||
&vecs.addresses.empty.by_addresstype,
|
||||
starting_height,
|
||||
));
|
||||
(addr_counts, empty_addr_counts)
|
||||
@@ -436,14 +436,14 @@ pub(crate) fn process_blocks(
|
||||
vecs.utxo_cohorts.update_fenwick_from_pending();
|
||||
|
||||
// Push to height-indexed vectors
|
||||
vecs.addr_count
|
||||
vecs.addresses.funded
|
||||
.truncate_push_height(height, addr_counts.sum(), &addr_counts)?;
|
||||
vecs.empty_addr_count.truncate_push_height(
|
||||
vecs.addresses.empty.truncate_push_height(
|
||||
height,
|
||||
empty_addr_counts.sum(),
|
||||
&empty_addr_counts,
|
||||
)?;
|
||||
vecs.address_activity
|
||||
vecs.addresses.activity
|
||||
.truncate_push_height(height, &activity_counts)?;
|
||||
|
||||
let is_last_of_day = is_last_of_day[offset];
|
||||
|
||||
@@ -76,9 +76,9 @@ pub(crate) fn write(
|
||||
vecs.any_address_indexes
|
||||
.par_iter_mut()
|
||||
.chain(vecs.addresses_data.par_iter_mut())
|
||||
.chain(vecs.addr_count.par_iter_height_mut())
|
||||
.chain(vecs.empty_addr_count.par_iter_height_mut())
|
||||
.chain(vecs.address_activity.par_iter_height_mut())
|
||||
.chain(vecs.addresses.funded.par_iter_height_mut())
|
||||
.chain(vecs.addresses.empty.par_iter_height_mut())
|
||||
.chain(vecs.addresses.activity.par_iter_height_mut())
|
||||
.chain(
|
||||
[
|
||||
&mut vecs.supply_state as &mut dyn AnyStoredVec,
|
||||
|
||||
@@ -37,8 +37,8 @@ pub struct AllCohortMetrics<M: StorageMode = Rw> {
|
||||
|
||||
#[traversable(wrap = "supply", rename = "delta")]
|
||||
pub supply_delta_extended: RollingDeltaExcept1m<Sats, SatsSigned, M>,
|
||||
#[traversable(wrap = "outputs/utxo_count", rename = "delta")]
|
||||
pub utxo_count_delta_extended: RollingDeltaExcept1m<StoredU64, StoredI64, M>,
|
||||
#[traversable(wrap = "outputs/unspent_count", rename = "delta")]
|
||||
pub unspent_count_delta_extended: RollingDeltaExcept1m<StoredU64, StoredI64, M>,
|
||||
}
|
||||
|
||||
impl CohortMetricsBase for AllCohortMetrics {
|
||||
@@ -103,7 +103,7 @@ impl AllCohortMetrics {
|
||||
asopr: Box::new(asopr),
|
||||
relative: Box::new(relative),
|
||||
supply_delta_extended: cfg.import("supply_delta", Version::ONE)?,
|
||||
utxo_count_delta_extended: cfg.import("utxo_count_delta", Version::ONE)?,
|
||||
unspent_count_delta_extended: cfg.import("utxo_count_delta", Version::ONE)?,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -152,10 +152,10 @@ impl AllCohortMetrics {
|
||||
&self.supply.total.sats.height,
|
||||
exit,
|
||||
)?;
|
||||
self.utxo_count_delta_extended.compute(
|
||||
self.unspent_count_delta_extended.compute(
|
||||
starting_indexes.height,
|
||||
&window_starts,
|
||||
&self.outputs.utxo_count.height,
|
||||
&self.outputs.unspent_count.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
|
||||
@@ -33,8 +33,8 @@ pub struct ExtendedCohortMetrics<M: StorageMode = Rw> {
|
||||
|
||||
#[traversable(wrap = "supply", rename = "delta")]
|
||||
pub supply_delta_extended: RollingDeltaExcept1m<Sats, SatsSigned, M>,
|
||||
#[traversable(wrap = "outputs/utxo_count", rename = "delta")]
|
||||
pub utxo_count_delta_extended: RollingDeltaExcept1m<StoredU64, StoredI64, M>,
|
||||
#[traversable(wrap = "outputs/unspent_count", rename = "delta")]
|
||||
pub unspent_count_delta_extended: RollingDeltaExcept1m<StoredU64, StoredI64, M>,
|
||||
}
|
||||
|
||||
impl CohortMetricsBase for ExtendedCohortMetrics {
|
||||
@@ -91,7 +91,7 @@ impl ExtendedCohortMetrics {
|
||||
unrealized: Box::new(unrealized),
|
||||
relative: Box::new(relative),
|
||||
supply_delta_extended: cfg.import("supply_delta", Version::ONE)?,
|
||||
utxo_count_delta_extended: cfg.import("utxo_count_delta", Version::ONE)?,
|
||||
unspent_count_delta_extended: cfg.import("utxo_count_delta", Version::ONE)?,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -130,10 +130,10 @@ impl ExtendedCohortMetrics {
|
||||
&self.supply.total.sats.height,
|
||||
exit,
|
||||
)?;
|
||||
self.utxo_count_delta_extended.compute(
|
||||
self.unspent_count_delta_extended.compute(
|
||||
starting_indexes.height,
|
||||
&window_starts,
|
||||
&self.outputs.utxo_count.height,
|
||||
&self.outputs.unspent_count.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
|
||||
@@ -10,29 +10,29 @@ use crate::distribution::metrics::ImportConfig;
|
||||
/// Base output metrics: utxo_count only (1 stored vec).
|
||||
#[derive(Traversable)]
|
||||
pub struct OutputsBase<M: StorageMode = Rw> {
|
||||
pub utxo_count: ComputedPerBlock<StoredU64, M>,
|
||||
pub unspent_count: ComputedPerBlock<StoredU64, M>,
|
||||
}
|
||||
|
||||
impl OutputsBase {
|
||||
pub(crate) fn forced_import(cfg: &ImportConfig) -> Result<Self> {
|
||||
Ok(Self {
|
||||
utxo_count: cfg.import("utxo_count", Version::ZERO)?,
|
||||
unspent_count: cfg.import("utxo_count", Version::ZERO)?,
|
||||
})
|
||||
}
|
||||
|
||||
pub(crate) fn min_len(&self) -> usize {
|
||||
self.utxo_count.height.len()
|
||||
self.unspent_count.height.len()
|
||||
}
|
||||
|
||||
pub(crate) fn truncate_push(&mut self, height: Height, state: &CohortState<impl RealizedOps, impl CostBasisOps>) -> Result<()> {
|
||||
self.utxo_count
|
||||
self.unspent_count
|
||||
.height
|
||||
.truncate_push(height, StoredU64::from(state.supply.utxo_count))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn collect_vecs_mut(&mut self) -> Vec<&mut dyn AnyStoredVec> {
|
||||
vec![&mut self.utxo_count.height as &mut dyn AnyStoredVec]
|
||||
vec![&mut self.unspent_count.height as &mut dyn AnyStoredVec]
|
||||
}
|
||||
|
||||
pub(crate) fn compute_from_stateful(
|
||||
@@ -41,11 +41,11 @@ impl OutputsBase {
|
||||
others: &[&Self],
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.utxo_count.height.compute_sum_of_others(
|
||||
self.unspent_count.height.compute_sum_of_others(
|
||||
starting_indexes.height,
|
||||
&others
|
||||
.iter()
|
||||
.map(|v| &v.utxo_count.height)
|
||||
.map(|v| &v.unspent_count.height)
|
||||
.collect::<Vec<_>>(),
|
||||
exit,
|
||||
)?;
|
||||
|
||||
@@ -18,18 +18,18 @@ pub struct OutputsFull<M: StorageMode = Rw> {
|
||||
#[traversable(flatten)]
|
||||
pub base: OutputsBase<M>,
|
||||
|
||||
#[traversable(wrap = "utxo_count", rename = "delta")]
|
||||
pub utxo_count_delta: RollingDelta1m<StoredU64, StoredI64, M>,
|
||||
#[traversable(wrap = "unspent_count", rename = "delta")]
|
||||
pub unspent_count_delta: RollingDelta1m<StoredU64, StoredI64, M>,
|
||||
}
|
||||
|
||||
impl OutputsFull {
|
||||
pub(crate) fn forced_import(cfg: &ImportConfig) -> Result<Self> {
|
||||
let base = OutputsBase::forced_import(cfg)?;
|
||||
let utxo_count_delta = cfg.import("utxo_count_delta", Version::ONE)?;
|
||||
let unspent_count_delta = cfg.import("utxo_count_delta", Version::ONE)?;
|
||||
|
||||
Ok(Self {
|
||||
base,
|
||||
utxo_count_delta,
|
||||
unspent_count_delta,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -53,10 +53,10 @@ impl OutputsFull {
|
||||
starting_indexes: &Indexes,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.utxo_count_delta.compute(
|
||||
self.unspent_count_delta.compute(
|
||||
starting_indexes.height,
|
||||
&blocks.lookback._1m,
|
||||
&self.base.utxo_count.height,
|
||||
&self.base.unspent_count.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
|
||||
@@ -36,6 +36,21 @@ use super::{
|
||||
};
|
||||
|
||||
const VERSION: Version = Version::new(22);
|
||||
|
||||
#[derive(Traversable)]
|
||||
pub struct AddressMetricsVecs<M: StorageMode = Rw> {
|
||||
pub funded: AddrCountsVecs<M>,
|
||||
pub empty: AddrCountsVecs<M>,
|
||||
pub activity: AddressActivityVecs<M>,
|
||||
pub total: TotalAddrCountVecs<M>,
|
||||
pub new: NewAddrCountVecs<M>,
|
||||
pub delta: DeltaVecs<M>,
|
||||
pub funded_index:
|
||||
LazyVecFrom1<FundedAddressIndex, FundedAddressIndex, FundedAddressIndex, FundedAddressData>,
|
||||
pub empty_index:
|
||||
LazyVecFrom1<EmptyAddressIndex, EmptyAddressIndex, EmptyAddressIndex, EmptyAddressData>,
|
||||
}
|
||||
|
||||
#[derive(Traversable)]
|
||||
pub struct Vecs<M: StorageMode = Rw> {
|
||||
#[traversable(skip)]
|
||||
@@ -48,24 +63,8 @@ pub struct Vecs<M: StorageMode = Rw> {
|
||||
pub addresses_data: AddressesDataVecs<M>,
|
||||
pub utxo_cohorts: UTXOCohorts<M>,
|
||||
pub address_cohorts: AddressCohorts<M>,
|
||||
|
||||
pub coinblocks_destroyed: ComputedPerBlockCumulative<StoredF64, M>,
|
||||
|
||||
pub addr_count: AddrCountsVecs<M>,
|
||||
pub empty_addr_count: AddrCountsVecs<M>,
|
||||
pub address_activity: AddressActivityVecs<M>,
|
||||
|
||||
/// Total addresses ever seen (addr_count + empty_addr_count) - stored, global + per-type
|
||||
pub total_addr_count: TotalAddrCountVecs<M>,
|
||||
/// New addresses per block (delta of total) - stored height + cumulative + rolling, global + per-type
|
||||
pub new_addr_count: NewAddrCountVecs<M>,
|
||||
/// Windowed change + growth rate for addr_count, global + per-type
|
||||
pub delta: DeltaVecs<M>,
|
||||
|
||||
pub funded_address_index:
|
||||
LazyVecFrom1<FundedAddressIndex, FundedAddressIndex, FundedAddressIndex, FundedAddressData>,
|
||||
pub empty_address_index:
|
||||
LazyVecFrom1<EmptyAddressIndex, EmptyAddressIndex, EmptyAddressIndex, EmptyAddressData>,
|
||||
pub addresses: AddressMetricsVecs<M>,
|
||||
|
||||
/// In-memory block state for UTXO processing. Persisted via supply_state.
|
||||
/// Kept across compute() calls to avoid O(n) rebuild on resume.
|
||||
@@ -151,12 +150,16 @@ impl Vecs {
|
||||
.with_saved_stamped_changes(SAVED_STAMPED_CHANGES),
|
||||
)?,
|
||||
|
||||
addr_count,
|
||||
empty_addr_count,
|
||||
address_activity,
|
||||
total_addr_count,
|
||||
new_addr_count,
|
||||
delta,
|
||||
addresses: AddressMetricsVecs {
|
||||
funded: addr_count,
|
||||
empty: empty_addr_count,
|
||||
activity: address_activity,
|
||||
total: total_addr_count,
|
||||
new: new_addr_count,
|
||||
delta,
|
||||
funded_index: funded_address_index,
|
||||
empty_index: empty_address_index,
|
||||
},
|
||||
|
||||
utxo_cohorts,
|
||||
address_cohorts,
|
||||
@@ -173,9 +176,6 @@ impl Vecs {
|
||||
funded: fundedaddressindex_to_fundedaddressdata,
|
||||
empty: emptyaddressindex_to_emptyaddressdata,
|
||||
},
|
||||
funded_address_index,
|
||||
empty_address_index,
|
||||
|
||||
chain_state: Vec::new(),
|
||||
txindex_to_height: RangeMap::default(),
|
||||
|
||||
@@ -292,9 +292,9 @@ impl Vecs {
|
||||
// Recover or reuse chain_state
|
||||
let starting_height = if recovered_height.is_zero() {
|
||||
self.supply_state.reset()?;
|
||||
self.addr_count.reset_height()?;
|
||||
self.empty_addr_count.reset_height()?;
|
||||
self.address_activity.reset_height()?;
|
||||
self.addresses.funded.reset_height()?;
|
||||
self.addresses.empty.reset_height()?;
|
||||
self.addresses.activity.reset_height()?;
|
||||
reset_state(
|
||||
&mut self.any_address_indexes,
|
||||
&mut self.addresses_data,
|
||||
@@ -414,32 +414,33 @@ impl Vecs {
|
||||
)?;
|
||||
|
||||
// 6b. Compute address count sum (by addresstype → all)
|
||||
self.addr_count.compute_rest(starting_indexes, exit)?;
|
||||
self.empty_addr_count.compute_rest(starting_indexes, exit)?;
|
||||
self.addresses.funded.compute_rest(starting_indexes, exit)?;
|
||||
self.addresses.empty.compute_rest(starting_indexes, exit)?;
|
||||
|
||||
// 6c. Compute total_addr_count = addr_count + empty_addr_count
|
||||
self.total_addr_count.compute(
|
||||
self.addresses.total.compute(
|
||||
starting_indexes.height,
|
||||
&self.addr_count,
|
||||
&self.empty_addr_count,
|
||||
&self.addresses.funded,
|
||||
&self.addresses.empty,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
let window_starts = blocks.lookback.window_starts();
|
||||
|
||||
self.address_activity
|
||||
self.addresses
|
||||
.activity
|
||||
.compute_rest(starting_indexes.height, &window_starts, exit)?;
|
||||
self.new_addr_count.compute(
|
||||
self.addresses.new.compute(
|
||||
starting_indexes.height,
|
||||
&window_starts,
|
||||
&self.total_addr_count,
|
||||
&self.addresses.total,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.delta.compute(
|
||||
self.addresses.delta.compute(
|
||||
starting_indexes.height,
|
||||
&window_starts,
|
||||
&self.addr_count,
|
||||
&self.addresses.funded,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
@@ -474,48 +475,16 @@ impl Vecs {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Get minimum length across all height-indexed stateful vectors.
|
||||
fn min_stateful_len(&self) -> Height {
|
||||
debug!("supply_state.len={}", self.supply_state.len());
|
||||
debug!(
|
||||
"utxo_cohorts.min={}",
|
||||
self.utxo_cohorts.min_stateful_len()
|
||||
);
|
||||
debug!(
|
||||
"address_cohorts.min={}",
|
||||
self.address_cohorts.min_stateful_len()
|
||||
);
|
||||
debug!(
|
||||
"address_indexes.min={}",
|
||||
self.any_address_indexes.min_stamped_height()
|
||||
);
|
||||
debug!(
|
||||
"addresses_data.min={}",
|
||||
self.addresses_data.min_stamped_height()
|
||||
);
|
||||
debug!("addr_count.min={}", self.addr_count.min_stateful_len());
|
||||
debug!(
|
||||
"empty_addr_count.min={}",
|
||||
self.empty_addr_count.min_stateful_len()
|
||||
);
|
||||
debug!(
|
||||
"address_activity.min={}",
|
||||
self.address_activity.min_stateful_len()
|
||||
);
|
||||
debug!(
|
||||
"coinblocks_destroyed.raw.height.len={}",
|
||||
self.coinblocks_destroyed.raw.height.len()
|
||||
);
|
||||
|
||||
self.utxo_cohorts
|
||||
.min_stateful_len()
|
||||
.min(self.address_cohorts.min_stateful_len())
|
||||
.min(Height::from(self.supply_state.len()))
|
||||
.min(self.any_address_indexes.min_stamped_height())
|
||||
.min(self.addresses_data.min_stamped_height())
|
||||
.min(Height::from(self.addr_count.min_stateful_len()))
|
||||
.min(Height::from(self.empty_addr_count.min_stateful_len()))
|
||||
.min(Height::from(self.address_activity.min_stateful_len()))
|
||||
.min(self.any_address_indexes.min_stamped_len())
|
||||
.min(self.addresses_data.min_stamped_len())
|
||||
.min(Height::from(self.addresses.funded.min_stateful_len()))
|
||||
.min(Height::from(self.addresses.empty.min_stateful_len()))
|
||||
.min(Height::from(self.addresses.activity.min_stateful_len()))
|
||||
.min(Height::from(self.coinblocks_destroyed.raw.height.len()))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ impl Vecs {
|
||||
)?;
|
||||
|
||||
// Supply-Adjusted Dormancy = dormancy / circulating_supply_btc
|
||||
self.dormancy_supply_adjusted
|
||||
self.dormancy.supply_adjusted
|
||||
.height
|
||||
.compute_transform2(
|
||||
starting_indexes.height,
|
||||
@@ -161,7 +161,7 @@ impl Vecs {
|
||||
)?;
|
||||
|
||||
// Dormancy Flow: supply_btc / dormancy
|
||||
self.dormancy_flow.height.compute_transform2(
|
||||
self.dormancy.flow.height.compute_transform2(
|
||||
starting_indexes.height,
|
||||
supply_total_sats,
|
||||
&all_activity.dormancy.height,
|
||||
|
||||
@@ -18,7 +18,7 @@ pub(super) fn compute(
|
||||
.collect();
|
||||
let count_vecs: Vec<&_> = amount_range
|
||||
.iter()
|
||||
.map(|c| &c.metrics.outputs.utxo_count.height)
|
||||
.map(|c| &c.metrics.outputs.unspent_count.height)
|
||||
.collect();
|
||||
|
||||
if supply_vecs.is_empty() || supply_vecs.len() != count_vecs.len() {
|
||||
|
||||
@@ -30,10 +30,11 @@ impl Vecs {
|
||||
ComputedPerBlock::forced_import(&db, "coindays_destroyed_supply_adjusted", v, indexes)?;
|
||||
let coinyears_destroyed_supply_adjusted =
|
||||
ComputedPerBlock::forced_import(&db, "coinyears_destroyed_supply_adjusted", v, indexes)?;
|
||||
let dormancy_supply_adjusted =
|
||||
ComputedPerBlock::forced_import(&db, "dormancy_supply_adjusted", v, indexes)?;
|
||||
let dormancy = super::vecs::DormancyVecs {
|
||||
supply_adjusted: ComputedPerBlock::forced_import(&db, "dormancy_supply_adjusted", v, indexes)?,
|
||||
flow: ComputedPerBlock::forced_import(&db, "dormancy_flow", v, indexes)?,
|
||||
};
|
||||
let stock_to_flow = ComputedPerBlock::forced_import(&db, "stock_to_flow", v, indexes)?;
|
||||
let dormancy_flow = ComputedPerBlock::forced_import(&db, "dormancy_flow", v, indexes)?;
|
||||
let seller_exhaustion_constant =
|
||||
ComputedPerBlock::forced_import(&db, "seller_exhaustion_constant", v, indexes)?;
|
||||
|
||||
@@ -46,9 +47,8 @@ impl Vecs {
|
||||
thermocap_multiple,
|
||||
coindays_destroyed_supply_adjusted,
|
||||
coinyears_destroyed_supply_adjusted,
|
||||
dormancy_supply_adjusted,
|
||||
dormancy,
|
||||
stock_to_flow,
|
||||
dormancy_flow,
|
||||
seller_exhaustion_constant,
|
||||
};
|
||||
finalize_db(&this.db, &this)?;
|
||||
|
||||
@@ -4,6 +4,12 @@ use vecdb::{Database, Rw, StorageMode};
|
||||
|
||||
use crate::internal::{ComputedPerBlock, PercentPerBlock, RatioPerBlock};
|
||||
|
||||
#[derive(Traversable)]
|
||||
pub struct DormancyVecs<M: StorageMode = Rw> {
|
||||
pub supply_adjusted: ComputedPerBlock<StoredF32, M>,
|
||||
pub flow: ComputedPerBlock<StoredF32, M>,
|
||||
}
|
||||
|
||||
#[derive(Traversable)]
|
||||
pub struct Vecs<M: StorageMode = Rw> {
|
||||
#[traversable(skip)]
|
||||
@@ -15,8 +21,7 @@ pub struct Vecs<M: StorageMode = Rw> {
|
||||
pub thermocap_multiple: RatioPerBlock<BasisPoints32, M>,
|
||||
pub coindays_destroyed_supply_adjusted: ComputedPerBlock<StoredF32, M>,
|
||||
pub coinyears_destroyed_supply_adjusted: ComputedPerBlock<StoredF32, M>,
|
||||
pub dormancy_supply_adjusted: ComputedPerBlock<StoredF32, M>,
|
||||
pub dormancy: DormancyVecs<M>,
|
||||
pub stock_to_flow: ComputedPerBlock<StoredF32, M>,
|
||||
pub dormancy_flow: ComputedPerBlock<StoredF32, M>,
|
||||
pub seller_exhaustion_constant: ComputedPerBlock<StoredF32, M>,
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ impl Vecs {
|
||||
) -> Result<()> {
|
||||
// Compute price returns at height level
|
||||
for ((returns, _), (lookback_price, _)) in self
|
||||
.price_return
|
||||
.periods
|
||||
.iter_mut_with_days()
|
||||
.zip(lookback.price_lookback.iter_with_days())
|
||||
{
|
||||
@@ -29,8 +29,8 @@ impl Vecs {
|
||||
}
|
||||
|
||||
// CAGR computed from returns at height level (2y+ periods only)
|
||||
let price_return_dca = self.price_return.as_dca_period();
|
||||
for (cagr, returns, days) in self.price_cagr.zip_mut_with_period(&price_return_dca) {
|
||||
let price_return_dca = self.periods.as_dca_period();
|
||||
for (cagr, returns, days) in self.cagr.zip_mut_with_period(&price_return_dca) {
|
||||
let years = days as f64 / 365.0;
|
||||
cagr.bps.height.compute_transform(
|
||||
starting_indexes.height,
|
||||
@@ -44,12 +44,12 @@ impl Vecs {
|
||||
)?;
|
||||
}
|
||||
|
||||
let _24h_price_return_ratio = &self.price_return._24h.ratio.height;
|
||||
let _24h_price_return_ratio = &self.periods._24h.ratio.height;
|
||||
|
||||
for sd in [
|
||||
&mut self.price_return_24h_sd._1w,
|
||||
&mut self.price_return_24h_sd._1m,
|
||||
&mut self.price_return_24h_sd._1y,
|
||||
&mut self.sd_24h._1w,
|
||||
&mut self.sd_24h._1m,
|
||||
&mut self.sd_24h._1y,
|
||||
] {
|
||||
sd.compute_all(blocks, starting_indexes, exit, _24h_price_return_ratio)?;
|
||||
}
|
||||
|
||||
@@ -55,9 +55,9 @@ impl Vecs {
|
||||
};
|
||||
|
||||
Ok(Self {
|
||||
price_return,
|
||||
price_cagr,
|
||||
price_return_24h_sd,
|
||||
periods: price_return,
|
||||
cagr: price_cagr,
|
||||
sd_24h: price_return_24h_sd,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ pub struct PriceReturn24hSdVecs<M: StorageMode = Rw> {
|
||||
|
||||
#[derive(Traversable)]
|
||||
pub struct Vecs<M: StorageMode = Rw> {
|
||||
pub price_return: ByLookbackPeriod<PercentPerBlock<BasisPointsSigned32, M>>,
|
||||
pub price_cagr: ByDcaCagr<PercentPerBlock<BasisPointsSigned32, M>>,
|
||||
pub price_return_24h_sd: PriceReturn24hSdVecs<M>,
|
||||
pub periods: ByLookbackPeriod<PercentPerBlock<BasisPointsSigned32, M>>,
|
||||
pub cagr: ByDcaCagr<PercentPerBlock<BasisPointsSigned32, M>>,
|
||||
pub sd_24h: PriceReturn24hSdVecs<M>,
|
||||
}
|
||||
|
||||
@@ -52,10 +52,10 @@ impl Vecs {
|
||||
|
||||
// RSI per timeframe
|
||||
let return_sources = [
|
||||
&returns.price_return._24h.ratio.height,
|
||||
&returns.price_return._1w.ratio.height,
|
||||
&returns.price_return._1m.ratio.height,
|
||||
&returns.price_return._1y.ratio.height,
|
||||
&returns.periods._24h.ratio.height,
|
||||
&returns.periods._1w.ratio.height,
|
||||
&returns.periods._1m.ratio.height,
|
||||
&returns.periods._1y.ratio.height,
|
||||
];
|
||||
for ((rsi_chain, ret), &m) in self
|
||||
.rsi
|
||||
|
||||
@@ -14,36 +14,36 @@ impl Vecs {
|
||||
"price_volatility_1w",
|
||||
version + v2,
|
||||
returns
|
||||
.price_return_24h_sd
|
||||
.sd_24h
|
||||
._1w
|
||||
.sd
|
||||
.height
|
||||
.read_only_boxed_clone(),
|
||||
&returns.price_return_24h_sd._1w.sd,
|
||||
&returns.sd_24h._1w.sd,
|
||||
);
|
||||
|
||||
let _1m = LazyPerBlock::from_computed::<TimesSqrt<Days30>>(
|
||||
"price_volatility_1m",
|
||||
version + v2,
|
||||
returns
|
||||
.price_return_24h_sd
|
||||
.sd_24h
|
||||
._1m
|
||||
.sd
|
||||
.height
|
||||
.read_only_boxed_clone(),
|
||||
&returns.price_return_24h_sd._1m.sd,
|
||||
&returns.sd_24h._1m.sd,
|
||||
);
|
||||
|
||||
let _1y = LazyPerBlock::from_computed::<TimesSqrt<Days365>>(
|
||||
"price_volatility_1y",
|
||||
version + v2,
|
||||
returns
|
||||
.price_return_24h_sd
|
||||
.sd_24h
|
||||
._1y
|
||||
.sd
|
||||
.height
|
||||
.read_only_boxed_clone(),
|
||||
&returns.price_return_24h_sd._1y.sd,
|
||||
&returns.sd_24h._1y.sd,
|
||||
);
|
||||
|
||||
Ok(Self { _1w, _1m, _1y })
|
||||
|
||||
@@ -20,9 +20,9 @@ impl Vecs {
|
||||
starting_indexes: &Indexes,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.hash_rate.height.compute_transform2(
|
||||
self.rate.raw.height.compute_transform2(
|
||||
starting_indexes.height,
|
||||
&count_vecs.block_count.sum._24h.height,
|
||||
&count_vecs.total.sum._24h.height,
|
||||
&difficulty_vecs.as_hash.height,
|
||||
|(i, block_count_sum, difficulty_as_hash, ..)| {
|
||||
(
|
||||
@@ -36,33 +36,33 @@ impl Vecs {
|
||||
exit,
|
||||
)?;
|
||||
|
||||
let hash_rate = &self.hash_rate.height;
|
||||
let hash_rate = &self.rate.raw.height;
|
||||
for (sma, window) in [
|
||||
(&mut self.hash_rate_sma._1w.height, &lookback._1w),
|
||||
(&mut self.hash_rate_sma._1m.height, &lookback._1m),
|
||||
(&mut self.hash_rate_sma._2m.height, &lookback._2m),
|
||||
(&mut self.hash_rate_sma._1y.height, &lookback._1y),
|
||||
(&mut self.rate.sma._1w.height, &lookback._1w),
|
||||
(&mut self.rate.sma._1m.height, &lookback._1m),
|
||||
(&mut self.rate.sma._2m.height, &lookback._2m),
|
||||
(&mut self.rate.sma._1y.height, &lookback._1y),
|
||||
] {
|
||||
sma.compute_rolling_average(starting_indexes.height, window, hash_rate, exit)?;
|
||||
}
|
||||
|
||||
self.hash_rate_ath.height.compute_all_time_high(
|
||||
self.rate.ath.height.compute_all_time_high(
|
||||
starting_indexes.height,
|
||||
&self.hash_rate.height,
|
||||
&self.rate.raw.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.hash_rate_drawdown.compute_drawdown(
|
||||
self.rate.drawdown.compute_drawdown(
|
||||
starting_indexes.height,
|
||||
&self.hash_rate.height,
|
||||
&self.hash_rate_ath.height,
|
||||
&self.rate.raw.height,
|
||||
&self.rate.ath.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.hash_price.ths.height.compute_transform2(
|
||||
self.price.ths.height.compute_transform2(
|
||||
starting_indexes.height,
|
||||
coinbase_usd_24h_sum,
|
||||
&self.hash_rate.height,
|
||||
&self.rate.raw.height,
|
||||
|(i, coinbase_sum, hashrate, ..)| {
|
||||
let hashrate_ths = *hashrate / ONE_TERA_HASH;
|
||||
let price = if hashrate_ths == 0.0 {
|
||||
@@ -75,17 +75,17 @@ impl Vecs {
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.hash_price.phs.height.compute_transform(
|
||||
self.price.phs.height.compute_transform(
|
||||
starting_indexes.height,
|
||||
&self.hash_price.ths.height,
|
||||
&self.price.ths.height,
|
||||
|(i, price, ..)| (i, (*price * 1000.0).into()),
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.hash_value.ths.height.compute_transform2(
|
||||
self.value.ths.height.compute_transform2(
|
||||
starting_indexes.height,
|
||||
coinbase_sats_24h_sum,
|
||||
&self.hash_rate.height,
|
||||
&self.rate.raw.height,
|
||||
|(i, coinbase_sum, hashrate, ..)| {
|
||||
let hashrate_ths = *hashrate / ONE_TERA_HASH;
|
||||
let value = if hashrate_ths == 0.0 {
|
||||
@@ -98,49 +98,49 @@ impl Vecs {
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.hash_value.phs.height.compute_transform(
|
||||
self.value.phs.height.compute_transform(
|
||||
starting_indexes.height,
|
||||
&self.hash_value.ths.height,
|
||||
&self.value.ths.height,
|
||||
|(i, value, ..)| (i, (*value * 1000.0).into()),
|
||||
exit,
|
||||
)?;
|
||||
|
||||
for (min_vec, src_vec) in [
|
||||
(
|
||||
&mut self.hash_price.ths_min.height,
|
||||
&self.hash_price.ths.height,
|
||||
&mut self.price.ths_min.height,
|
||||
&self.price.ths.height,
|
||||
),
|
||||
(
|
||||
&mut self.hash_price.phs_min.height,
|
||||
&self.hash_price.phs.height,
|
||||
&mut self.price.phs_min.height,
|
||||
&self.price.phs.height,
|
||||
),
|
||||
(
|
||||
&mut self.hash_value.ths_min.height,
|
||||
&self.hash_value.ths.height,
|
||||
&mut self.value.ths_min.height,
|
||||
&self.value.ths.height,
|
||||
),
|
||||
(
|
||||
&mut self.hash_value.phs_min.height,
|
||||
&self.hash_value.phs.height,
|
||||
&mut self.value.phs_min.height,
|
||||
&self.value.phs.height,
|
||||
),
|
||||
] {
|
||||
min_vec.compute_all_time_low_(starting_indexes.height, src_vec, exit, true)?;
|
||||
}
|
||||
|
||||
self.hash_price
|
||||
self.price
|
||||
.rebound
|
||||
.compute_binary::<StoredF32, StoredF32, RatioDiffF32Bps32>(
|
||||
starting_indexes.height,
|
||||
&self.hash_price.phs.height,
|
||||
&self.hash_price.phs_min.height,
|
||||
&self.price.phs.height,
|
||||
&self.price.phs_min.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.hash_value
|
||||
self.value
|
||||
.rebound
|
||||
.compute_binary::<StoredF32, StoredF32, RatioDiffF32Bps32>(
|
||||
starting_indexes.height,
|
||||
&self.hash_value.phs.height,
|
||||
&self.hash_value.phs_min.height,
|
||||
&self.value.phs.height,
|
||||
&self.value.phs_min.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ use brk_types::Version;
|
||||
use vecdb::Database;
|
||||
|
||||
use super::{
|
||||
vecs::{HashPriceValueVecs, HashRateSmaVecs},
|
||||
vecs::{HashPriceValueVecs, HashRateSmaVecs, RateVecs},
|
||||
Vecs,
|
||||
};
|
||||
use crate::{
|
||||
@@ -21,46 +21,48 @@ impl Vecs {
|
||||
let v5 = Version::new(5);
|
||||
|
||||
Ok(Self {
|
||||
hash_rate: ComputedPerBlock::forced_import(db, "hash_rate", version + v5, indexes)?,
|
||||
hash_rate_sma: HashRateSmaVecs {
|
||||
_1w: ComputedPerBlock::forced_import(
|
||||
rate: RateVecs {
|
||||
raw: ComputedPerBlock::forced_import(db, "hash_rate", version + v5, indexes)?,
|
||||
sma: HashRateSmaVecs {
|
||||
_1w: ComputedPerBlock::forced_import(
|
||||
db,
|
||||
"hash_rate_sma_1w",
|
||||
version,
|
||||
indexes,
|
||||
)?,
|
||||
_1m: ComputedPerBlock::forced_import(
|
||||
db,
|
||||
"hash_rate_sma_1m",
|
||||
version,
|
||||
indexes,
|
||||
)?,
|
||||
_2m: ComputedPerBlock::forced_import(
|
||||
db,
|
||||
"hash_rate_sma_2m",
|
||||
version,
|
||||
indexes,
|
||||
)?,
|
||||
_1y: ComputedPerBlock::forced_import(
|
||||
db,
|
||||
"hash_rate_sma_1y",
|
||||
version,
|
||||
indexes,
|
||||
)?,
|
||||
},
|
||||
ath: ComputedPerBlock::forced_import(
|
||||
db,
|
||||
"hash_rate_sma_1w",
|
||||
"hash_rate_ath",
|
||||
version,
|
||||
indexes,
|
||||
)?,
|
||||
_1m: ComputedPerBlock::forced_import(
|
||||
drawdown: PercentPerBlock::forced_import(
|
||||
db,
|
||||
"hash_rate_sma_1m",
|
||||
version,
|
||||
indexes,
|
||||
)?,
|
||||
_2m: ComputedPerBlock::forced_import(
|
||||
db,
|
||||
"hash_rate_sma_2m",
|
||||
version,
|
||||
indexes,
|
||||
)?,
|
||||
_1y: ComputedPerBlock::forced_import(
|
||||
db,
|
||||
"hash_rate_sma_1y",
|
||||
"hash_rate_drawdown",
|
||||
version,
|
||||
indexes,
|
||||
)?,
|
||||
},
|
||||
hash_rate_ath: ComputedPerBlock::forced_import(
|
||||
db,
|
||||
"hash_rate_ath",
|
||||
version,
|
||||
indexes,
|
||||
)?,
|
||||
hash_rate_drawdown: PercentPerBlock::forced_import(
|
||||
db,
|
||||
"hash_rate_drawdown",
|
||||
version,
|
||||
indexes,
|
||||
)?,
|
||||
hash_price: HashPriceValueVecs {
|
||||
price: HashPriceValueVecs {
|
||||
ths: ComputedPerBlock::forced_import(
|
||||
db,
|
||||
"hash_price_ths",
|
||||
@@ -92,7 +94,7 @@ impl Vecs {
|
||||
indexes,
|
||||
)?,
|
||||
},
|
||||
hash_value: HashPriceValueVecs {
|
||||
value: HashPriceValueVecs {
|
||||
ths: ComputedPerBlock::forced_import(
|
||||
db,
|
||||
"hash_value_ths",
|
||||
|
||||
@@ -22,11 +22,16 @@ pub struct HashPriceValueVecs<M: StorageMode = Rw> {
|
||||
}
|
||||
|
||||
#[derive(Traversable)]
|
||||
pub struct Vecs<M: StorageMode = Rw> {
|
||||
pub hash_rate: ComputedPerBlock<StoredF64, M>,
|
||||
pub hash_rate_sma: HashRateSmaVecs<M>,
|
||||
pub hash_rate_ath: ComputedPerBlock<StoredF64, M>,
|
||||
pub hash_rate_drawdown: PercentPerBlock<BasisPointsSigned16, M>,
|
||||
pub hash_price: HashPriceValueVecs<M>,
|
||||
pub hash_value: HashPriceValueVecs<M>,
|
||||
pub struct RateVecs<M: StorageMode = Rw> {
|
||||
pub raw: ComputedPerBlock<StoredF64, M>,
|
||||
pub sma: HashRateSmaVecs<M>,
|
||||
pub ath: ComputedPerBlock<StoredF64, M>,
|
||||
pub drawdown: PercentPerBlock<BasisPointsSigned16, M>,
|
||||
}
|
||||
|
||||
#[derive(Traversable)]
|
||||
pub struct Vecs<M: StorageMode = Rw> {
|
||||
pub rate: RateVecs<M>,
|
||||
pub price: HashPriceValueVecs<M>,
|
||||
pub value: HashPriceValueVecs<M>,
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ impl Vecs {
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
let window_starts = blocks.lookback.window_starts();
|
||||
self.total_count
|
||||
self.total
|
||||
.compute(starting_indexes.height, &window_starts, exit, |full| {
|
||||
full.compute_with_skip(
|
||||
starting_indexes.height,
|
||||
@@ -33,7 +33,7 @@ impl Vecs {
|
||||
|
||||
self.utxo_count.height.compute_transform3(
|
||||
starting_indexes.height,
|
||||
&self.total_count.full.cumulative,
|
||||
&self.total.full.cumulative,
|
||||
&inputs_count.full.cumulative,
|
||||
&scripts_count.opreturn.cumulative.height,
|
||||
|(h, output_count, input_count, opreturn_count, ..)| {
|
||||
|
||||
@@ -15,7 +15,7 @@ impl Vecs {
|
||||
indexes: &indexes::Vecs,
|
||||
) -> Result<Self> {
|
||||
Ok(Self {
|
||||
total_count: ComputedPerBlockAggregated::forced_import(
|
||||
total: ComputedPerBlockAggregated::forced_import(
|
||||
db,
|
||||
"output_count",
|
||||
version,
|
||||
|
||||
@@ -6,6 +6,6 @@ use crate::internal::{ComputedPerBlock, ComputedPerBlockAggregated};
|
||||
|
||||
#[derive(Traversable)]
|
||||
pub struct Vecs<M: StorageMode = Rw> {
|
||||
pub total_count: ComputedPerBlockAggregated<StoredU64, M>,
|
||||
pub total: ComputedPerBlockAggregated<StoredU64, M>,
|
||||
pub utxo_count: ComputedPerBlock<StoredU64, M>,
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ impl Vecs {
|
||||
self.blocks_mined_sum
|
||||
.as_array()
|
||||
.into_iter()
|
||||
.zip(blocks.count.block_count.sum.as_array()),
|
||||
.zip(blocks.count.total.sum.as_array()),
|
||||
) {
|
||||
dom.compute_binary::<StoredU32, StoredU32, RatioU32Bp16>(
|
||||
starting_indexes.height,
|
||||
|
||||
@@ -76,7 +76,7 @@ impl Vecs {
|
||||
.compute_binary::<StoredU32, StoredU32, RatioU32Bp16>(
|
||||
starting_indexes.height,
|
||||
&self.blocks_mined.cumulative.height,
|
||||
&blocks.count.block_count.cumulative.height,
|
||||
&blocks.count.total.cumulative.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
|
||||
@@ -21,19 +21,19 @@ impl Vecs {
|
||||
self.compute_prices(indexer, starting_indexes, exit)?;
|
||||
self.split.open.cents.compute_first(
|
||||
starting_indexes,
|
||||
&self.price.cents.height,
|
||||
&self.spot.cents.height,
|
||||
indexes,
|
||||
exit,
|
||||
)?;
|
||||
self.split.high.cents.compute_max(
|
||||
starting_indexes,
|
||||
&self.price.cents.height,
|
||||
&self.spot.cents.height,
|
||||
indexes,
|
||||
exit,
|
||||
)?;
|
||||
self.split.low.cents.compute_min(
|
||||
starting_indexes,
|
||||
&self.price.cents.height,
|
||||
&self.spot.cents.height,
|
||||
indexes,
|
||||
exit,
|
||||
)?;
|
||||
@@ -60,7 +60,7 @@ impl Vecs {
|
||||
) -> Result<()> {
|
||||
let source_version =
|
||||
indexer.vecs.outputs.value.version() + indexer.vecs.outputs.outputtype.version();
|
||||
self.price
|
||||
self.spot
|
||||
.cents
|
||||
.height
|
||||
.validate_computed_version_or_reset(source_version)?;
|
||||
@@ -78,28 +78,28 @@ impl Vecs {
|
||||
.height
|
||||
.len()
|
||||
.min(starting_indexes.height.to_usize());
|
||||
self.price.cents.height.truncate_if_needed_at(truncate_to)?;
|
||||
self.spot.cents.height.truncate_if_needed_at(truncate_to)?;
|
||||
|
||||
if self.price.cents.height.len() < START_HEIGHT {
|
||||
if self.spot.cents.height.len() < START_HEIGHT {
|
||||
for line in brk_oracle::PRICES
|
||||
.lines()
|
||||
.skip(self.price.cents.height.len())
|
||||
.skip(self.spot.cents.height.len())
|
||||
{
|
||||
if self.price.cents.height.len() >= START_HEIGHT {
|
||||
if self.spot.cents.height.len() >= START_HEIGHT {
|
||||
break;
|
||||
}
|
||||
let dollars: f64 = line.parse().unwrap_or(0.0);
|
||||
let cents = (dollars * 100.0).round() as u64;
|
||||
self.price.cents.height.push(Cents::new(cents));
|
||||
self.spot.cents.height.push(Cents::new(cents));
|
||||
}
|
||||
}
|
||||
|
||||
if self.price.cents.height.len() >= total_heights {
|
||||
if self.spot.cents.height.len() >= total_heights {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let config = Config::default();
|
||||
let committed = self.price.cents.height.len();
|
||||
let committed = self.spot.cents.height.len();
|
||||
let prev_cents = self
|
||||
.price
|
||||
.cents
|
||||
@@ -121,7 +121,7 @@ impl Vecs {
|
||||
let ref_bins = Self::feed_blocks(&mut oracle, indexer, committed..total_heights);
|
||||
|
||||
for (i, ref_bin) in ref_bins.into_iter().enumerate() {
|
||||
self.price
|
||||
self.spot
|
||||
.cents
|
||||
.height
|
||||
.push(Cents::new(bin_to_cents(ref_bin)));
|
||||
@@ -134,12 +134,12 @@ impl Vecs {
|
||||
|
||||
{
|
||||
let _lock = exit.lock();
|
||||
self.price.cents.height.write()?;
|
||||
self.spot.cents.height.write()?;
|
||||
}
|
||||
|
||||
info!(
|
||||
"Oracle prices complete: {} committed",
|
||||
self.price.cents.height.len()
|
||||
self.spot.cents.height.len()
|
||||
);
|
||||
|
||||
Ok(())
|
||||
@@ -237,7 +237,7 @@ impl<M: StorageMode> Vecs<M> {
|
||||
.price
|
||||
.cents
|
||||
.height
|
||||
.collect_one_at(self.price.cents.height.len() - 1)
|
||||
.collect_one_at(self.spot.cents.height.len() - 1)
|
||||
.unwrap();
|
||||
let seed_bin = cents_to_bin(last_cents.inner() as f64);
|
||||
let window_size = config.window_size;
|
||||
|
||||
@@ -29,7 +29,7 @@ pub struct Vecs<M: StorageMode = Rw> {
|
||||
|
||||
pub split: SplitByUnit<M>,
|
||||
pub ohlc: OhlcByUnit<M>,
|
||||
pub price: PriceByUnit<M>,
|
||||
pub spot: PriceByUnit<M>,
|
||||
}
|
||||
|
||||
impl Vecs {
|
||||
@@ -169,7 +169,7 @@ impl Vecs {
|
||||
sats: ohlc_sats,
|
||||
};
|
||||
|
||||
let price = PriceByUnit {
|
||||
let spot = PriceByUnit {
|
||||
cents: price_cents,
|
||||
usd: price_usd,
|
||||
sats: price_sats,
|
||||
@@ -179,7 +179,7 @@ impl Vecs {
|
||||
db: db.clone(),
|
||||
split,
|
||||
ohlc,
|
||||
price,
|
||||
spot,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -39,14 +39,14 @@ impl Vecs {
|
||||
self.taproot.compute_binary::<_, _, RatioU64Bp16>(
|
||||
starting_indexes.height,
|
||||
&count.p2tr.raw.height,
|
||||
&outputs_count.total_count.full.sum,
|
||||
&outputs_count.total.full.sum,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.segwit.compute_binary::<_, _, RatioU64Bp16>(
|
||||
starting_indexes.height,
|
||||
&count.segwit.raw.height,
|
||||
&outputs_count.total_count.full.sum,
|
||||
&outputs_count.total.full.sum,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
|
||||
@@ -61,9 +61,9 @@ impl Vecs {
|
||||
indexes,
|
||||
)?;
|
||||
|
||||
let hodled_or_lost_coins = LazyAmountPerBlock::identity(
|
||||
let hodled_or_lost = LazyAmountPerBlock::identity(
|
||||
"hodled_or_lost_coins",
|
||||
&cointime.supply.vaulted_supply,
|
||||
&cointime.supply.vaulted,
|
||||
version,
|
||||
);
|
||||
|
||||
@@ -76,7 +76,7 @@ impl Vecs {
|
||||
market_cap,
|
||||
market_cap_delta,
|
||||
market_minus_realized_cap_growth_rate,
|
||||
hodled_or_lost_coins,
|
||||
hodled_or_lost,
|
||||
};
|
||||
finalize_db(&this.db, &this)?;
|
||||
Ok(this)
|
||||
|
||||
@@ -20,5 +20,5 @@ pub struct Vecs<M: StorageMode = Rw> {
|
||||
#[traversable(wrap = "market_cap", rename = "delta")]
|
||||
pub market_cap_delta: FiatRollingDelta<Cents, CentsSigned, M>,
|
||||
pub market_minus_realized_cap_growth_rate: RollingWindows<BasisPointsSigned32, M>,
|
||||
pub hodled_or_lost_coins: LazyAmountPerBlock,
|
||||
pub hodled_or_lost: LazyAmountPerBlock,
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ impl Vecs {
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
let window_starts = lookback.window_starts();
|
||||
self.tx_count
|
||||
self.total
|
||||
.compute(starting_indexes.height, &window_starts, exit, |height| {
|
||||
Ok(height.compute_count_from_indexes(
|
||||
starting_indexes.height,
|
||||
|
||||
@@ -26,7 +26,7 @@ impl Vecs {
|
||||
);
|
||||
|
||||
Ok(Self {
|
||||
tx_count: ComputedPerBlockFull::forced_import(db, "tx_count", version, indexes)?,
|
||||
total: ComputedPerBlockFull::forced_import(db, "tx_count", version, indexes)?,
|
||||
is_coinbase: txindex_to_is_coinbase,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -6,6 +6,6 @@ use crate::internal::ComputedPerBlockFull;
|
||||
|
||||
#[derive(Traversable)]
|
||||
pub struct Vecs<M: StorageMode = Rw> {
|
||||
pub tx_count: ComputedPerBlockFull<StoredU64, M>,
|
||||
pub total: ComputedPerBlockFull<StoredU64, M>,
|
||||
pub is_coinbase: LazyVecFrom2<TxIndex, StoredBool, TxIndex, Height, Height, TxIndex>,
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ impl Vecs {
|
||||
.height
|
||||
.compute_binary::<_, Timestamp, PerSec>(
|
||||
starting_indexes.height,
|
||||
&count_vecs.tx_count.raw.height,
|
||||
&count_vecs.total.raw.height,
|
||||
&blocks.interval.height,
|
||||
exit,
|
||||
)?;
|
||||
@@ -87,7 +87,7 @@ impl Vecs {
|
||||
.height
|
||||
.compute_binary::<_, Timestamp, PerSec>(
|
||||
starting_indexes.height,
|
||||
&outputs_count.total_count.full.sum,
|
||||
&outputs_count.total.full.sum,
|
||||
&blocks.interval.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
@@ -62,7 +62,7 @@ impl BlockProcessor<'_> {
|
||||
}
|
||||
self.vecs
|
||||
.blocks
|
||||
.total_size
|
||||
.total
|
||||
.checked_push(self.height, total_size.into())?;
|
||||
self.vecs
|
||||
.blocks
|
||||
|
||||
@@ -17,13 +17,13 @@ pub struct BlocksVecs<M: StorageMode = Rw> {
|
||||
#[traversable(wrap = "time")]
|
||||
pub timestamp: M::Stored<PcoVec<Height, Timestamp>>,
|
||||
#[traversable(wrap = "size")]
|
||||
pub total_size: M::Stored<PcoVec<Height, StoredU64>>,
|
||||
pub total: M::Stored<PcoVec<Height, StoredU64>>,
|
||||
pub weight: M::Stored<PcoVec<Height, Weight>>,
|
||||
}
|
||||
|
||||
impl BlocksVecs {
|
||||
pub fn forced_import(db: &Database, version: Version) -> Result<Self> {
|
||||
let (blockhash, difficulty, timestamp, total_size, weight) = parallel_import! {
|
||||
let (blockhash, difficulty, timestamp, total, weight) = parallel_import! {
|
||||
blockhash = BytesVec::forced_import(db, "blockhash", version),
|
||||
difficulty = PcoVec::forced_import(db, "difficulty", version),
|
||||
timestamp = PcoVec::forced_import(db, "timestamp", version),
|
||||
@@ -34,7 +34,7 @@ impl BlocksVecs {
|
||||
blockhash,
|
||||
difficulty,
|
||||
timestamp,
|
||||
total_size,
|
||||
total,
|
||||
weight,
|
||||
})
|
||||
}
|
||||
@@ -46,7 +46,7 @@ impl BlocksVecs {
|
||||
.truncate_if_needed_with_stamp(height, stamp)?;
|
||||
self.timestamp
|
||||
.truncate_if_needed_with_stamp(height, stamp)?;
|
||||
self.total_size
|
||||
self.total
|
||||
.truncate_if_needed_with_stamp(height, stamp)?;
|
||||
self.weight.truncate_if_needed_with_stamp(height, stamp)?;
|
||||
Ok(())
|
||||
@@ -57,7 +57,7 @@ impl BlocksVecs {
|
||||
&mut self.blockhash as &mut dyn AnyStoredVec,
|
||||
&mut self.difficulty,
|
||||
&mut self.timestamp,
|
||||
&mut self.total_size,
|
||||
&mut self.total,
|
||||
&mut self.weight,
|
||||
]
|
||||
.into_par_iter()
|
||||
|
||||
@@ -23,7 +23,7 @@ impl Query {
|
||||
let blockhash = indexer.vecs.blocks.blockhash.read_once(height)?;
|
||||
let difficulty = indexer.vecs.blocks.difficulty.collect_one(height).unwrap();
|
||||
let timestamp = indexer.vecs.blocks.timestamp.collect_one(height).unwrap();
|
||||
let size = indexer.vecs.blocks.total_size.collect_one(height).unwrap();
|
||||
let size = indexer.vecs.blocks.total.collect_one(height).unwrap();
|
||||
let weight = indexer.vecs.blocks.weight.collect_one(height).unwrap();
|
||||
let tx_count = self.tx_count_at_height(height, max_height)?;
|
||||
|
||||
@@ -61,7 +61,7 @@ impl Query {
|
||||
|
||||
let difficulties = indexer.vecs.blocks.difficulty.collect_range_at(begin, end);
|
||||
let timestamps = indexer.vecs.blocks.timestamp.collect_range_at(begin, end);
|
||||
let sizes = indexer.vecs.blocks.total_size.collect_range_at(begin, end);
|
||||
let sizes = indexer.vecs.blocks.total.collect_range_at(begin, end);
|
||||
let weights = indexer.vecs.blocks.weight.collect_range_at(begin, end);
|
||||
|
||||
// Batch-read first_txindex for tx_count computation (need one extra for next boundary)
|
||||
|
||||
@@ -21,7 +21,7 @@ impl Query {
|
||||
}
|
||||
|
||||
let position = computer.positions.block.collect_one(height).unwrap();
|
||||
let size = indexer.vecs.blocks.total_size.collect_one(height).unwrap();
|
||||
let size = indexer.vecs.blocks.total.collect_one(height).unwrap();
|
||||
|
||||
reader.read_raw_bytes(position, *size as usize)
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ impl Query {
|
||||
let current_hashrate = *computer
|
||||
.mining
|
||||
.hashrate
|
||||
.hash_rate
|
||||
.rate.raw
|
||||
.day1
|
||||
.collect_one_flat(current_day1)
|
||||
.unwrap_or_default() as u128;
|
||||
@@ -55,7 +55,7 @@ impl Query {
|
||||
let total_days = end_day1.to_usize().saturating_sub(start_day1.to_usize()) + 1;
|
||||
let step = (total_days / 200).max(1); // Max ~200 data points
|
||||
|
||||
let hashrate_vec = &computer.mining.hashrate.hash_rate.day1;
|
||||
let hashrate_vec = &computer.mining.hashrate.rate.raw.day1;
|
||||
let timestamp_vec = &computer.blocks.time.timestamp.day1;
|
||||
|
||||
let mut hashrates = Vec::with_capacity(total_days / step + 1);
|
||||
|
||||
@@ -14,7 +14,7 @@ impl Query {
|
||||
|
||||
let coinbase_vec = &computer.mining.rewards.coinbase.base.sats.height;
|
||||
let fee_vec = &computer.mining.rewards.fees.base.sats.height;
|
||||
let tx_count_vec = &computer.transactions.count.tx_count.raw.height;
|
||||
let tx_count_vec = &computer.transactions.count.total.raw.height;
|
||||
|
||||
let start = start_block.to_usize();
|
||||
let end = end_block.to_usize() + 1;
|
||||
|
||||
@@ -1,32 +1,18 @@
|
||||
use schemars::JsonSchema;
|
||||
use serde::Deserialize;
|
||||
|
||||
use crate::{Limit, de_unquote_i64, de_unquote_limit};
|
||||
use crate::{Limit, RangeIndex, de_unquote_limit};
|
||||
|
||||
/// Range parameters for slicing data
|
||||
#[derive(Default, Debug, Deserialize, JsonSchema)]
|
||||
pub struct DataRange {
|
||||
/// Inclusive starting index, if negative counts from end. Aliases: `from`, `f`, `s`
|
||||
#[serde(
|
||||
default,
|
||||
alias = "s",
|
||||
alias = "from",
|
||||
alias = "f",
|
||||
deserialize_with = "de_unquote_i64"
|
||||
)]
|
||||
#[schemars(example = 0, example = -1, example = -10, example = -1000)]
|
||||
start: Option<i64>,
|
||||
/// Inclusive start: integer index, date (YYYY-MM-DD), or timestamp (ISO 8601). Negative integers count from end. Aliases: `from`, `f`, `s`
|
||||
#[serde(default, alias = "s", alias = "from", alias = "f")]
|
||||
start: Option<RangeIndex>,
|
||||
|
||||
/// Exclusive ending index, if negative counts from end. Aliases: `to`, `t`, `e`
|
||||
#[serde(
|
||||
default,
|
||||
alias = "e",
|
||||
alias = "to",
|
||||
alias = "t",
|
||||
deserialize_with = "de_unquote_i64"
|
||||
)]
|
||||
#[schemars(example = 1000)]
|
||||
end: Option<i64>,
|
||||
/// Exclusive end: integer index, date (YYYY-MM-DD), or timestamp (ISO 8601). Negative integers count from end. Aliases: `to`, `t`, `e`
|
||||
#[serde(default, alias = "e", alias = "to", alias = "t")]
|
||||
end: Option<RangeIndex>,
|
||||
|
||||
/// Maximum number of values to return (ignored if `end` is set). Aliases: `count`, `c`, `l`
|
||||
#[serde(
|
||||
@@ -41,12 +27,12 @@ pub struct DataRange {
|
||||
|
||||
impl DataRange {
|
||||
pub fn set_start(mut self, start: i64) -> Self {
|
||||
self.start.replace(start);
|
||||
self.start.replace(RangeIndex::Int(start));
|
||||
self
|
||||
}
|
||||
|
||||
pub fn set_end(mut self, end: i64) -> Self {
|
||||
self.end.replace(end);
|
||||
self.end.replace(RangeIndex::Int(end));
|
||||
self
|
||||
}
|
||||
|
||||
@@ -55,29 +41,15 @@ impl DataRange {
|
||||
self
|
||||
}
|
||||
|
||||
/// Get the raw `start` value
|
||||
pub fn start(&self) -> Option<i64> {
|
||||
pub fn start(&self) -> Option<RangeIndex> {
|
||||
self.start
|
||||
}
|
||||
|
||||
/// Get `end` value, computing it from `start + limit` if `end` is unset but `limit` is set.
|
||||
/// Requires the vec length to resolve negative `start` indices before adding limit.
|
||||
pub fn end_for_len(&self, len: usize) -> Option<i64> {
|
||||
if self.end.is_some() {
|
||||
return self.end;
|
||||
}
|
||||
|
||||
self.limit.map(|limit| {
|
||||
let resolved_start = self.resolve_index(self.start, len, 0);
|
||||
(resolved_start + *limit).min(len) as i64
|
||||
})
|
||||
pub fn end(&self) -> Option<RangeIndex> {
|
||||
self.end
|
||||
}
|
||||
|
||||
fn resolve_index(&self, idx: Option<i64>, len: usize, default: usize) -> usize {
|
||||
match idx {
|
||||
None => default,
|
||||
Some(i) if i >= 0 => (i as usize).min(len),
|
||||
Some(i) => len.saturating_sub((-i) as usize),
|
||||
}
|
||||
pub fn limit(&self) -> Option<Limit> {
|
||||
self.limit
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,6 +141,7 @@ mod poolslugparam;
|
||||
mod poolssummary;
|
||||
mod poolstats;
|
||||
mod port;
|
||||
mod rangeindex;
|
||||
mod rawlocktime;
|
||||
mod recommendedfees;
|
||||
mod rewardstats;
|
||||
@@ -333,6 +334,7 @@ pub use poolslugparam::*;
|
||||
pub use poolssummary::*;
|
||||
pub use poolstats::*;
|
||||
pub use port::*;
|
||||
pub use rangeindex::*;
|
||||
pub use rawlocktime::*;
|
||||
pub use recommendedfees::*;
|
||||
pub use rewardstats::*;
|
||||
|
||||
49
crates/brk_types/src/rangeindex.rs
Normal file
49
crates/brk_types/src/rangeindex.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
use schemars::JsonSchema;
|
||||
use serde::{Deserialize, Deserializer};
|
||||
|
||||
use crate::{Date, Timestamp};
|
||||
|
||||
/// A range boundary: integer index, date, or timestamp.
|
||||
#[derive(Debug, Clone, Copy, JsonSchema)]
|
||||
#[serde(untagged)]
|
||||
pub enum RangeIndex {
|
||||
Int(i64),
|
||||
Date(Date),
|
||||
Timestamp(Timestamp),
|
||||
}
|
||||
|
||||
impl<'de> Deserialize<'de> for RangeIndex {
|
||||
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
||||
let s = String::deserialize(deserializer)?;
|
||||
let s = s.trim().trim_matches('"');
|
||||
if s.is_empty() {
|
||||
return Err(serde::de::Error::custom("empty range index"));
|
||||
}
|
||||
if let Ok(i) = s.parse::<i64>() {
|
||||
return Ok(Self::Int(i));
|
||||
}
|
||||
if let Some(date) = parse_date(s) {
|
||||
return Ok(Self::Date(date));
|
||||
}
|
||||
if let Ok(ts) = s.parse::<jiff::Timestamp>() {
|
||||
return Ok(Self::Timestamp(Timestamp::new(ts.as_second() as u32)));
|
||||
}
|
||||
Err(serde::de::Error::custom(format!(
|
||||
"expected integer, YYYY-MM-DD, or ISO 8601 timestamp: {s}"
|
||||
)))
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_date(s: &str) -> Option<Date> {
|
||||
if s.len() != 10 {
|
||||
return None;
|
||||
}
|
||||
let b = s.as_bytes();
|
||||
if b[4] != b'-' || b[7] != b'-' {
|
||||
return None;
|
||||
}
|
||||
let year = s[0..4].parse().ok()?;
|
||||
let month = s[5..7].parse().ok()?;
|
||||
let day = s[8..10].parse().ok()?;
|
||||
Some(Date::new(year, month, day))
|
||||
}
|
||||
@@ -1918,7 +1918,7 @@ function createAverageGainsLossesRsiStochPattern(client, acc) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {Object} AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern
|
||||
* @typedef {Object} AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3
|
||||
* @property {MetricPattern1<StoredU64>} all
|
||||
* @property {MetricPattern1<StoredU64>} p2a
|
||||
* @property {MetricPattern1<StoredU64>} p2pk33
|
||||
@@ -1931,12 +1931,12 @@ function createAverageGainsLossesRsiStochPattern(client, acc) {
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create a AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern pattern node
|
||||
* Create a AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3 pattern node
|
||||
* @param {BrkClientBase} client
|
||||
* @param {string} acc - Accumulated metric name
|
||||
* @returns {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern}
|
||||
* @returns {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3}
|
||||
*/
|
||||
function createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern(client, acc) {
|
||||
function createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3(client, acc) {
|
||||
return {
|
||||
all: createMetricPattern1(client, acc),
|
||||
p2a: createMetricPattern1(client, _p('p2a', acc)),
|
||||
@@ -2537,7 +2537,7 @@ function createPct1Pct2Pct5Pct95Pct98Pct99Pattern(client, acc) {
|
||||
/**
|
||||
* @typedef {Object} ActivityOutputsRealizedSupplyUnrealizedPattern
|
||||
* @property {CoindaysSentPattern} activity
|
||||
* @property {UtxoPattern2} outputs
|
||||
* @property {UnspentPattern2} outputs
|
||||
* @property {CapLossMvrvNetNuplPriceProfitSoprPattern} realized
|
||||
* @property {DeltaHalvedInRelTotalPattern} supply
|
||||
* @property {InvestedInvestorLossNetProfitPattern} unrealized
|
||||
@@ -2552,7 +2552,7 @@ function createPct1Pct2Pct5Pct95Pct98Pct99Pattern(client, acc) {
|
||||
function createActivityOutputsRealizedSupplyUnrealizedPattern(client, acc) {
|
||||
return {
|
||||
activity: createCoindaysSentPattern(client, acc),
|
||||
outputs: createUtxoPattern2(client, _m(acc, 'utxo_count')),
|
||||
outputs: createUnspentPattern2(client, _m(acc, 'utxo_count')),
|
||||
realized: createCapLossMvrvNetNuplPriceProfitSoprPattern(client, acc),
|
||||
supply: createDeltaHalvedInRelTotalPattern(client, _m(acc, 'supply')),
|
||||
unrealized: createInvestedInvestorLossNetProfitPattern(client, acc),
|
||||
@@ -2562,7 +2562,7 @@ function createActivityOutputsRealizedSupplyUnrealizedPattern(client, acc) {
|
||||
/**
|
||||
* @typedef {Object} ActivityOutputsRealizedSupplyUnrealizedPattern2
|
||||
* @property {CoindaysSentPattern} activity
|
||||
* @property {UtxoPattern2} outputs
|
||||
* @property {UnspentPattern2} outputs
|
||||
* @property {CapLossMvrvNetNuplPriceProfitSoprPattern} realized
|
||||
* @property {DeltaHalvedInRelTotalPattern} supply
|
||||
* @property {LossNetProfitPattern} unrealized
|
||||
@@ -2577,7 +2577,7 @@ function createActivityOutputsRealizedSupplyUnrealizedPattern(client, acc) {
|
||||
function createActivityOutputsRealizedSupplyUnrealizedPattern2(client, acc) {
|
||||
return {
|
||||
activity: createCoindaysSentPattern(client, acc),
|
||||
outputs: createUtxoPattern2(client, _m(acc, 'utxo_count')),
|
||||
outputs: createUnspentPattern2(client, _m(acc, 'utxo_count')),
|
||||
realized: createCapLossMvrvNetNuplPriceProfitSoprPattern(client, acc),
|
||||
supply: createDeltaHalvedInRelTotalPattern(client, _m(acc, 'supply')),
|
||||
unrealized: createLossNetProfitPattern(client, acc),
|
||||
@@ -3025,7 +3025,7 @@ function create_1y2y4yAllPattern(client, acc) {
|
||||
/**
|
||||
* @typedef {Object} AddrOutputsRealizedSupplyPattern
|
||||
* @property {BaseDeltaPattern} addrCount
|
||||
* @property {UtxoPattern} outputs
|
||||
* @property {UnspentPattern} outputs
|
||||
* @property {CapLossMvrvNuplPriceProfitSoprPattern} realized
|
||||
* @property {HalvedTotalPattern} supply
|
||||
*/
|
||||
@@ -3039,7 +3039,7 @@ function create_1y2y4yAllPattern(client, acc) {
|
||||
function createAddrOutputsRealizedSupplyPattern(client, acc) {
|
||||
return {
|
||||
addrCount: createBaseDeltaPattern(client, _m(acc, 'addr_count')),
|
||||
outputs: createUtxoPattern(client, _m(acc, 'utxo_count')),
|
||||
outputs: createUnspentPattern(client, _m(acc, 'utxo_count')),
|
||||
realized: createCapLossMvrvNuplPriceProfitSoprPattern(client, acc),
|
||||
supply: createHalvedTotalPattern(client, _m(acc, 'supply')),
|
||||
};
|
||||
@@ -3254,7 +3254,7 @@ function createInRawSumPattern2(client, acc) {
|
||||
|
||||
/**
|
||||
* @typedef {Object} OutputsRealizedSupplyUnrealizedPattern
|
||||
* @property {UtxoPattern} outputs
|
||||
* @property {UnspentPattern} outputs
|
||||
* @property {CapLossMvrvNuplPriceProfitSoprPattern} realized
|
||||
* @property {HalvedInTotalPattern} supply
|
||||
* @property {LossProfitPattern2} unrealized
|
||||
@@ -3268,7 +3268,7 @@ function createInRawSumPattern2(client, acc) {
|
||||
*/
|
||||
function createOutputsRealizedSupplyUnrealizedPattern(client, acc) {
|
||||
return {
|
||||
outputs: createUtxoPattern(client, _m(acc, 'utxo_count')),
|
||||
outputs: createUnspentPattern(client, _m(acc, 'utxo_count')),
|
||||
realized: createCapLossMvrvNuplPriceProfitSoprPattern(client, acc),
|
||||
supply: createHalvedInTotalPattern(client, _m(acc, 'supply')),
|
||||
unrealized: createLossProfitPattern2(client, _m(acc, 'unrealized')),
|
||||
@@ -3575,7 +3575,7 @@ function createNegativeRawSumPattern(client, acc) {
|
||||
|
||||
/**
|
||||
* @typedef {Object} OutputsRealizedSupplyPattern
|
||||
* @property {UtxoPattern} outputs
|
||||
* @property {UnspentPattern} outputs
|
||||
* @property {CapLossMvrvNuplPriceProfitSoprPattern} realized
|
||||
* @property {HalvedTotalPattern} supply
|
||||
*/
|
||||
@@ -3588,7 +3588,7 @@ function createNegativeRawSumPattern(client, acc) {
|
||||
*/
|
||||
function createOutputsRealizedSupplyPattern(client, acc) {
|
||||
return {
|
||||
outputs: createUtxoPattern(client, _m(acc, 'utxo_count')),
|
||||
outputs: createUnspentPattern(client, _m(acc, 'utxo_count')),
|
||||
realized: createCapLossMvrvNuplPriceProfitSoprPattern(client, acc),
|
||||
supply: createHalvedTotalPattern(client, _m(acc, 'supply')),
|
||||
};
|
||||
@@ -4291,53 +4291,53 @@ function create_24hPattern(client, acc) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {Object} UtxoPattern2
|
||||
* @property {BaseDeltaPattern} utxoCount
|
||||
* @typedef {Object} UnspentPattern2
|
||||
* @property {BaseDeltaPattern} unspentCount
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create a UtxoPattern2 pattern node
|
||||
* Create a UnspentPattern2 pattern node
|
||||
* @param {BrkClientBase} client
|
||||
* @param {string} acc - Accumulated metric name
|
||||
* @returns {UtxoPattern2}
|
||||
* @returns {UnspentPattern2}
|
||||
*/
|
||||
function createUtxoPattern2(client, acc) {
|
||||
function createUnspentPattern2(client, acc) {
|
||||
return {
|
||||
utxoCount: createBaseDeltaPattern(client, acc),
|
||||
unspentCount: createBaseDeltaPattern(client, acc),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {Object} UtxoPattern3
|
||||
* @property {BaseDeltaPattern2} utxoCount
|
||||
* @typedef {Object} UnspentPattern3
|
||||
* @property {BaseDeltaPattern2} unspentCount
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create a UtxoPattern3 pattern node
|
||||
* Create a UnspentPattern3 pattern node
|
||||
* @param {BrkClientBase} client
|
||||
* @param {string} acc - Accumulated metric name
|
||||
* @returns {UtxoPattern3}
|
||||
* @returns {UnspentPattern3}
|
||||
*/
|
||||
function createUtxoPattern3(client, acc) {
|
||||
function createUnspentPattern3(client, acc) {
|
||||
return {
|
||||
utxoCount: createBaseDeltaPattern2(client, acc),
|
||||
unspentCount: createBaseDeltaPattern2(client, acc),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {Object} UtxoPattern
|
||||
* @property {MetricPattern1<StoredU64>} utxoCount
|
||||
* @typedef {Object} UnspentPattern
|
||||
* @property {MetricPattern1<StoredU64>} unspentCount
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create a UtxoPattern pattern node
|
||||
* Create a UnspentPattern pattern node
|
||||
* @param {BrkClientBase} client
|
||||
* @param {string} acc - Accumulated metric name
|
||||
* @returns {UtxoPattern}
|
||||
* @returns {UnspentPattern}
|
||||
*/
|
||||
function createUtxoPattern(client, acc) {
|
||||
function createUnspentPattern(client, acc) {
|
||||
return {
|
||||
utxoCount: createMetricPattern1(client, acc),
|
||||
unspentCount: createMetricPattern1(client, acc),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4455,7 +4455,7 @@ function createRawPattern(client, acc) {
|
||||
|
||||
/**
|
||||
* @typedef {Object} MetricsTree_Blocks_Size
|
||||
* @property {MetricPattern18<StoredU64>} totalSize
|
||||
* @property {MetricPattern18<StoredU64>} total
|
||||
* @property {MetricPattern1<StoredU64>} cumulative
|
||||
* @property {_1m1w1y24hPattern<StoredU64>} sum
|
||||
* @property {_1m1w1y24hPattern<StoredU64>} average
|
||||
@@ -4485,8 +4485,8 @@ function createRawPattern(client, acc) {
|
||||
|
||||
/**
|
||||
* @typedef {Object} MetricsTree_Blocks_Count
|
||||
* @property {MetricPattern1<StoredU64>} blockCountTarget
|
||||
* @property {CumulativeRawSumPattern<StoredU32>} blockCount
|
||||
* @property {MetricPattern1<StoredU64>} target
|
||||
* @property {CumulativeRawSumPattern<StoredU32>} total
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -4571,7 +4571,7 @@ function createRawPattern(client, acc) {
|
||||
|
||||
/**
|
||||
* @typedef {Object} MetricsTree_Transactions_Count
|
||||
* @property {AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90RawSumPattern} txCount
|
||||
* @property {AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90RawSumPattern} total
|
||||
* @property {MetricPattern19<StoredBool>} isCoinbase
|
||||
*/
|
||||
|
||||
@@ -4641,7 +4641,7 @@ function createRawPattern(client, acc) {
|
||||
|
||||
/**
|
||||
* @typedef {Object} MetricsTree_Outputs_Count
|
||||
* @property {AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90RollingSumPattern} totalCount
|
||||
* @property {AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90RollingSumPattern} total
|
||||
* @property {MetricPattern1<StoredU64>} utxoCount
|
||||
*/
|
||||
|
||||
@@ -4746,16 +4746,21 @@ function createRawPattern(client, acc) {
|
||||
|
||||
/**
|
||||
* @typedef {Object} MetricsTree_Mining_Hashrate
|
||||
* @property {MetricPattern1<StoredF64>} hashRate
|
||||
* @property {MetricsTree_Mining_Hashrate_HashRateSma} hashRateSma
|
||||
* @property {MetricPattern1<StoredF64>} hashRateAth
|
||||
* @property {BpsPercentRatioPattern} hashRateDrawdown
|
||||
* @property {PhsReboundThsPattern} hashPrice
|
||||
* @property {PhsReboundThsPattern} hashValue
|
||||
* @property {MetricsTree_Mining_Hashrate_Rate} rate
|
||||
* @property {PhsReboundThsPattern} price
|
||||
* @property {PhsReboundThsPattern} value
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} MetricsTree_Mining_Hashrate_HashRateSma
|
||||
* @typedef {Object} MetricsTree_Mining_Hashrate_Rate
|
||||
* @property {MetricPattern1<StoredF64>} raw
|
||||
* @property {MetricsTree_Mining_Hashrate_Rate_Sma} sma
|
||||
* @property {MetricPattern1<StoredF64>} ath
|
||||
* @property {BpsPercentRatioPattern} drawdown
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} MetricsTree_Mining_Hashrate_Rate_Sma
|
||||
* @property {MetricPattern1<StoredF64>} _1w
|
||||
* @property {MetricPattern1<StoredF64>} _1m
|
||||
* @property {MetricPattern1<StoredF64>} _2m
|
||||
@@ -4774,7 +4779,7 @@ function createRawPattern(client, acc) {
|
||||
* @property {MetricsTree_Cointime_Supply} supply
|
||||
* @property {MetricsTree_Cointime_Value} value
|
||||
* @property {MetricsTree_Cointime_Cap} cap
|
||||
* @property {MetricsTree_Cointime_Pricing} pricing
|
||||
* @property {MetricsTree_Cointime_Prices} prices
|
||||
* @property {MetricsTree_Cointime_Adjusted} adjusted
|
||||
* @property {MetricsTree_Cointime_ReserveRisk} reserveRisk
|
||||
*/
|
||||
@@ -4785,43 +4790,43 @@ function createRawPattern(client, acc) {
|
||||
* @property {CumulativeRawSumPattern<StoredF64>} coinblocksStored
|
||||
* @property {MetricPattern1<StoredF64>} liveliness
|
||||
* @property {MetricPattern1<StoredF64>} vaultedness
|
||||
* @property {MetricPattern1<StoredF64>} activityToVaultednessRatio
|
||||
* @property {MetricPattern1<StoredF64>} ratio
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} MetricsTree_Cointime_Supply
|
||||
* @property {BtcCentsSatsUsdPattern} vaultedSupply
|
||||
* @property {BtcCentsSatsUsdPattern} activeSupply
|
||||
* @property {BtcCentsSatsUsdPattern} vaulted
|
||||
* @property {BtcCentsSatsUsdPattern} active
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} MetricsTree_Cointime_Value
|
||||
* @property {CumulativeRawSumPattern<StoredF64>} valueDestroyed
|
||||
* @property {CumulativeRawSumPattern<StoredF64>} valueCreated
|
||||
* @property {CumulativeRawSumPattern<StoredF64>} valueStored
|
||||
* @property {CumulativeRawSumPattern<StoredF64>} destroyed
|
||||
* @property {CumulativeRawSumPattern<StoredF64>} created
|
||||
* @property {CumulativeRawSumPattern<StoredF64>} stored
|
||||
* @property {CumulativeRawSumPattern<StoredF64>} vocdd
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} MetricsTree_Cointime_Cap
|
||||
* @property {CentsUsdPattern} thermoCap
|
||||
* @property {CentsUsdPattern} investorCap
|
||||
* @property {CentsUsdPattern} vaultedCap
|
||||
* @property {CentsUsdPattern} activeCap
|
||||
* @property {CentsUsdPattern} cointimeCap
|
||||
* @property {CentsUsdPattern} thermo
|
||||
* @property {CentsUsdPattern} investor
|
||||
* @property {CentsUsdPattern} vaulted
|
||||
* @property {CentsUsdPattern} active
|
||||
* @property {CentsUsdPattern} cointime
|
||||
* @property {BpsRatioPattern} aviv
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} MetricsTree_Cointime_Pricing
|
||||
* @property {BpsCentsPercentilesRatioSatsUsdPattern} vaultedPrice
|
||||
* @property {BpsCentsPercentilesRatioSatsUsdPattern} activePrice
|
||||
* @typedef {Object} MetricsTree_Cointime_Prices
|
||||
* @property {BpsCentsPercentilesRatioSatsUsdPattern} vaulted
|
||||
* @property {BpsCentsPercentilesRatioSatsUsdPattern} active
|
||||
* @property {BpsCentsPercentilesRatioSatsUsdPattern} trueMarketMean
|
||||
* @property {BpsCentsPercentilesRatioSatsUsdPattern} cointimePrice
|
||||
* @property {BpsCentsPercentilesRatioSatsUsdPattern} transferPrice
|
||||
* @property {BpsCentsPercentilesRatioSatsUsdPattern} balancedPrice
|
||||
* @property {BpsCentsPercentilesRatioSatsUsdPattern} terminalPrice
|
||||
* @property {BpsCentsPercentilesRatioSatsUsdPattern} deltaPrice
|
||||
* @property {BpsCentsPercentilesRatioSatsUsdPattern} cointime
|
||||
* @property {BpsCentsPercentilesRatioSatsUsdPattern} transfer
|
||||
* @property {BpsCentsPercentilesRatioSatsUsdPattern} balanced
|
||||
* @property {BpsCentsPercentilesRatioSatsUsdPattern} terminal
|
||||
* @property {BpsCentsPercentilesRatioSatsUsdPattern} delta
|
||||
* @property {MetricPattern1<Dollars>} cumulativeMarketCap
|
||||
*/
|
||||
|
||||
@@ -5107,12 +5112,17 @@ function createRawPattern(client, acc) {
|
||||
* @property {BpsRatioPattern} thermocapMultiple
|
||||
* @property {MetricPattern1<StoredF32>} coindaysDestroyedSupplyAdjusted
|
||||
* @property {MetricPattern1<StoredF32>} coinyearsDestroyedSupplyAdjusted
|
||||
* @property {MetricPattern1<StoredF32>} dormancySupplyAdjusted
|
||||
* @property {MetricsTree_Indicators_Dormancy} dormancy
|
||||
* @property {MetricPattern1<StoredF32>} stockToFlow
|
||||
* @property {MetricPattern1<StoredF32>} dormancyFlow
|
||||
* @property {MetricPattern1<StoredF32>} sellerExhaustionConstant
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} MetricsTree_Indicators_Dormancy
|
||||
* @property {MetricPattern1<StoredF32>} supplyAdjusted
|
||||
* @property {MetricPattern1<StoredF32>} flow
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} MetricsTree_Market
|
||||
* @property {MetricsTree_Market_Ath} ath
|
||||
@@ -5154,13 +5164,13 @@ function createRawPattern(client, acc) {
|
||||
|
||||
/**
|
||||
* @typedef {Object} MetricsTree_Market_Returns
|
||||
* @property {MetricsTree_Market_Returns_PriceReturn} priceReturn
|
||||
* @property {_10y2y3y4y5y6y8yPattern} priceCagr
|
||||
* @property {MetricsTree_Market_Returns_PriceReturn24hSd} priceReturn24hSd
|
||||
* @property {MetricsTree_Market_Returns_Periods} periods
|
||||
* @property {_10y2y3y4y5y6y8yPattern} cagr
|
||||
* @property {MetricsTree_Market_Returns_Sd24h} sd24h
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} MetricsTree_Market_Returns_PriceReturn
|
||||
* @typedef {Object} MetricsTree_Market_Returns_Periods
|
||||
* @property {BpsPercentRatioPattern} _24h
|
||||
* @property {BpsPercentRatioPattern} _1w
|
||||
* @property {BpsPercentRatioPattern} _1m
|
||||
@@ -5177,20 +5187,20 @@ function createRawPattern(client, acc) {
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} MetricsTree_Market_Returns_PriceReturn24hSd
|
||||
* @property {MetricsTree_Market_Returns_PriceReturn24hSd_1w} _1w
|
||||
* @property {MetricsTree_Market_Returns_PriceReturn24hSd_1m} _1m
|
||||
* @typedef {Object} MetricsTree_Market_Returns_Sd24h
|
||||
* @property {MetricsTree_Market_Returns_Sd24h_1w} _1w
|
||||
* @property {MetricsTree_Market_Returns_Sd24h_1m} _1m
|
||||
* @property {SdSmaPattern} _1y
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} MetricsTree_Market_Returns_PriceReturn24hSd_1w
|
||||
* @typedef {Object} MetricsTree_Market_Returns_Sd24h_1w
|
||||
* @property {MetricPattern1<StoredF32>} sma
|
||||
* @property {MetricPattern1<StoredF32>} sd
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} MetricsTree_Market_Returns_PriceReturn24hSd_1m
|
||||
* @typedef {Object} MetricsTree_Market_Returns_Sd24h_1m
|
||||
* @property {MetricPattern1<StoredF32>} sma
|
||||
* @property {MetricPattern1<StoredF32>} sd
|
||||
*/
|
||||
@@ -5681,14 +5691,7 @@ function createRawPattern(client, acc) {
|
||||
* @property {MetricsTree_Distribution_UtxoCohorts} utxoCohorts
|
||||
* @property {MetricsTree_Distribution_AddressCohorts} addressCohorts
|
||||
* @property {CumulativeRawPattern<StoredF64>} coinblocksDestroyed
|
||||
* @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern} addrCount
|
||||
* @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern} emptyAddrCount
|
||||
* @property {MetricsTree_Distribution_AddressActivity} addressActivity
|
||||
* @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern} totalAddrCount
|
||||
* @property {MetricsTree_Distribution_NewAddrCount} newAddrCount
|
||||
* @property {MetricsTree_Distribution_Delta} delta
|
||||
* @property {MetricPattern34<FundedAddressIndex>} fundedAddressIndex
|
||||
* @property {MetricPattern35<EmptyAddressIndex>} emptyAddressIndex
|
||||
* @property {MetricsTree_Distribution_Addresses} addresses
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -5730,7 +5733,7 @@ function createRawPattern(client, acc) {
|
||||
/**
|
||||
* @typedef {Object} MetricsTree_Distribution_UtxoCohorts_All
|
||||
* @property {MetricsTree_Distribution_UtxoCohorts_All_Supply} supply
|
||||
* @property {UtxoPattern3} outputs
|
||||
* @property {UnspentPattern3} outputs
|
||||
* @property {CoindaysCoinyearsDormancySentVelocityPattern} activity
|
||||
* @property {CapGrossInvestorLossMvrvNetNuplPeakPriceProfitSoprPattern} realized
|
||||
* @property {InvestedMaxMinPercentilesSupplyPattern} costBasis
|
||||
@@ -5785,7 +5788,7 @@ function createRawPattern(client, acc) {
|
||||
* @typedef {Object} MetricsTree_Distribution_UtxoCohorts_Sth
|
||||
* @property {CapGrossInvestorLossMvrvNetNuplPeakPriceProfitSoprPattern} realized
|
||||
* @property {DeltaHalvedInRelTotalPattern2} supply
|
||||
* @property {UtxoPattern3} outputs
|
||||
* @property {UnspentPattern3} outputs
|
||||
* @property {CoindaysCoinyearsDormancySentVelocityPattern} activity
|
||||
* @property {InvestedMaxMinPercentilesSupplyPattern} costBasis
|
||||
* @property {GrossInvestedInvestorLossNetProfitSentimentPattern2} unrealized
|
||||
@@ -5794,7 +5797,7 @@ function createRawPattern(client, acc) {
|
||||
/**
|
||||
* @typedef {Object} MetricsTree_Distribution_UtxoCohorts_Lth
|
||||
* @property {DeltaHalvedInRelTotalPattern2} supply
|
||||
* @property {UtxoPattern3} outputs
|
||||
* @property {UnspentPattern3} outputs
|
||||
* @property {CoindaysCoinyearsDormancySentVelocityPattern} activity
|
||||
* @property {MetricsTree_Distribution_UtxoCohorts_Lth_Realized} realized
|
||||
* @property {InvestedMaxMinPercentilesSupplyPattern} costBasis
|
||||
@@ -6159,7 +6162,19 @@ function createRawPattern(client, acc) {
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} MetricsTree_Distribution_AddressActivity
|
||||
* @typedef {Object} MetricsTree_Distribution_Addresses
|
||||
* @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3} funded
|
||||
* @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3} empty
|
||||
* @property {MetricsTree_Distribution_Addresses_Activity} activity
|
||||
* @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3} total
|
||||
* @property {MetricsTree_Distribution_Addresses_New} new
|
||||
* @property {MetricsTree_Distribution_Addresses_Delta} delta
|
||||
* @property {MetricPattern34<FundedAddressIndex>} fundedIndex
|
||||
* @property {MetricPattern35<EmptyAddressIndex>} emptyIndex
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} MetricsTree_Distribution_Addresses_Activity
|
||||
* @property {BothReactivatedReceivingSendingPattern} all
|
||||
* @property {BothReactivatedReceivingSendingPattern} p2pk65
|
||||
* @property {BothReactivatedReceivingSendingPattern} p2pk33
|
||||
@@ -6172,7 +6187,7 @@ function createRawPattern(client, acc) {
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} MetricsTree_Distribution_NewAddrCount
|
||||
* @typedef {Object} MetricsTree_Distribution_Addresses_New
|
||||
* @property {RawSumPattern3<StoredU64>} all
|
||||
* @property {RawSumPattern3<StoredU64>} p2pk65
|
||||
* @property {RawSumPattern3<StoredU64>} p2pk33
|
||||
@@ -6185,7 +6200,7 @@ function createRawPattern(client, acc) {
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} MetricsTree_Distribution_Delta
|
||||
* @typedef {Object} MetricsTree_Distribution_Addresses_Delta
|
||||
* @property {ChangeRatePattern2} all
|
||||
* @property {ChangeRatePattern2} p2pk65
|
||||
* @property {ChangeRatePattern2} p2pk33
|
||||
@@ -6205,7 +6220,7 @@ function createRawPattern(client, acc) {
|
||||
* @property {MetricsTree_Supply_Velocity} velocity
|
||||
* @property {MetricsTree_Supply_MarketCap} marketCap
|
||||
* @property {_1m1w1y24hPattern<BasisPointsSigned32>} marketMinusRealizedCapGrowthRate
|
||||
* @property {BtcCentsSatsUsdPattern} hodledOrLostCoins
|
||||
* @property {BtcCentsSatsUsdPattern} hodledOrLost
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -7189,7 +7204,7 @@ class BrkClient extends BrkClientBase {
|
||||
timestampMonotonic: createMetricPattern18(this, 'timestamp_monotonic'),
|
||||
},
|
||||
size: {
|
||||
totalSize: createMetricPattern18(this, 'total_size'),
|
||||
total: createMetricPattern18(this, 'total_size'),
|
||||
cumulative: createMetricPattern1(this, 'block_size_cumulative'),
|
||||
sum: create_1m1w1y24hPattern(this, 'block_size_sum'),
|
||||
average: create_1m1w1y24hPattern(this, 'block_size_average'),
|
||||
@@ -7215,8 +7230,8 @@ class BrkClient extends BrkClientBase {
|
||||
pct90: create_1m1w1y24hPattern(this, 'block_weight_pct90'),
|
||||
},
|
||||
count: {
|
||||
blockCountTarget: createMetricPattern1(this, 'block_count_target'),
|
||||
blockCount: createCumulativeRawSumPattern(this, 'block_count'),
|
||||
target: createMetricPattern1(this, 'block_count_target'),
|
||||
total: createCumulativeRawSumPattern(this, 'block_count'),
|
||||
},
|
||||
lookback: {
|
||||
_1h: createMetricPattern18(this, 'height_1h_ago'),
|
||||
@@ -7288,7 +7303,7 @@ class BrkClient extends BrkClientBase {
|
||||
firstTxinindex: createMetricPattern19(this, 'first_txinindex'),
|
||||
firstTxoutindex: createMetricPattern19(this, 'first_txoutindex'),
|
||||
count: {
|
||||
txCount: createAverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90RawSumPattern(this, 'tx_count'),
|
||||
total: createAverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90RawSumPattern(this, 'tx_count'),
|
||||
isCoinbase: createMetricPattern19(this, 'is_coinbase'),
|
||||
},
|
||||
size: {
|
||||
@@ -7337,7 +7352,7 @@ class BrkClient extends BrkClientBase {
|
||||
txinindex: createMetricPattern21(this, 'txinindex'),
|
||||
},
|
||||
count: {
|
||||
totalCount: createAverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90RollingSumPattern(this, 'output_count'),
|
||||
total: createAverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90RollingSumPattern(this, 'output_count'),
|
||||
utxoCount: createMetricPattern1(this, 'exact_utxo_count'),
|
||||
},
|
||||
},
|
||||
@@ -7415,17 +7430,19 @@ class BrkClient extends BrkClientBase {
|
||||
},
|
||||
},
|
||||
hashrate: {
|
||||
hashRate: createMetricPattern1(this, 'hash_rate'),
|
||||
hashRateSma: {
|
||||
_1w: createMetricPattern1(this, 'hash_rate_sma_1w'),
|
||||
_1m: createMetricPattern1(this, 'hash_rate_sma_1m'),
|
||||
_2m: createMetricPattern1(this, 'hash_rate_sma_2m'),
|
||||
_1y: createMetricPattern1(this, 'hash_rate_sma_1y'),
|
||||
rate: {
|
||||
raw: createMetricPattern1(this, 'hash_rate'),
|
||||
sma: {
|
||||
_1w: createMetricPattern1(this, 'hash_rate_sma_1w'),
|
||||
_1m: createMetricPattern1(this, 'hash_rate_sma_1m'),
|
||||
_2m: createMetricPattern1(this, 'hash_rate_sma_2m'),
|
||||
_1y: createMetricPattern1(this, 'hash_rate_sma_1y'),
|
||||
},
|
||||
ath: createMetricPattern1(this, 'hash_rate_ath'),
|
||||
drawdown: createBpsPercentRatioPattern(this, 'hash_rate_drawdown'),
|
||||
},
|
||||
hashRateAth: createMetricPattern1(this, 'hash_rate_ath'),
|
||||
hashRateDrawdown: createBpsPercentRatioPattern(this, 'hash_rate_drawdown'),
|
||||
hashPrice: createPhsReboundThsPattern(this, 'hash_price'),
|
||||
hashValue: createPhsReboundThsPattern(this, 'hash_value'),
|
||||
price: createPhsReboundThsPattern(this, 'hash_price'),
|
||||
value: createPhsReboundThsPattern(this, 'hash_value'),
|
||||
},
|
||||
},
|
||||
positions: {
|
||||
@@ -7438,35 +7455,35 @@ class BrkClient extends BrkClientBase {
|
||||
coinblocksStored: createCumulativeRawSumPattern(this, 'coinblocks_stored'),
|
||||
liveliness: createMetricPattern1(this, 'liveliness'),
|
||||
vaultedness: createMetricPattern1(this, 'vaultedness'),
|
||||
activityToVaultednessRatio: createMetricPattern1(this, 'activity_to_vaultedness_ratio'),
|
||||
ratio: createMetricPattern1(this, 'activity_to_vaultedness_ratio'),
|
||||
},
|
||||
supply: {
|
||||
vaultedSupply: createBtcCentsSatsUsdPattern(this, 'vaulted_supply'),
|
||||
activeSupply: createBtcCentsSatsUsdPattern(this, 'active_supply'),
|
||||
vaulted: createBtcCentsSatsUsdPattern(this, 'vaulted_supply'),
|
||||
active: createBtcCentsSatsUsdPattern(this, 'active_supply'),
|
||||
},
|
||||
value: {
|
||||
valueDestroyed: createCumulativeRawSumPattern(this, 'cointime_value_destroyed'),
|
||||
valueCreated: createCumulativeRawSumPattern(this, 'cointime_value_created'),
|
||||
valueStored: createCumulativeRawSumPattern(this, 'cointime_value_stored'),
|
||||
destroyed: createCumulativeRawSumPattern(this, 'cointime_value_destroyed'),
|
||||
created: createCumulativeRawSumPattern(this, 'cointime_value_created'),
|
||||
stored: createCumulativeRawSumPattern(this, 'cointime_value_stored'),
|
||||
vocdd: createCumulativeRawSumPattern(this, 'vocdd'),
|
||||
},
|
||||
cap: {
|
||||
thermoCap: createCentsUsdPattern(this, 'thermo_cap'),
|
||||
investorCap: createCentsUsdPattern(this, 'investor_cap'),
|
||||
vaultedCap: createCentsUsdPattern(this, 'vaulted_cap'),
|
||||
activeCap: createCentsUsdPattern(this, 'active_cap'),
|
||||
cointimeCap: createCentsUsdPattern(this, 'cointime_cap'),
|
||||
thermo: createCentsUsdPattern(this, 'thermo_cap'),
|
||||
investor: createCentsUsdPattern(this, 'investor_cap'),
|
||||
vaulted: createCentsUsdPattern(this, 'vaulted_cap'),
|
||||
active: createCentsUsdPattern(this, 'active_cap'),
|
||||
cointime: createCentsUsdPattern(this, 'cointime_cap'),
|
||||
aviv: createBpsRatioPattern(this, 'aviv_ratio'),
|
||||
},
|
||||
pricing: {
|
||||
vaultedPrice: createBpsCentsPercentilesRatioSatsUsdPattern(this, 'vaulted_price'),
|
||||
activePrice: createBpsCentsPercentilesRatioSatsUsdPattern(this, 'active_price'),
|
||||
prices: {
|
||||
vaulted: createBpsCentsPercentilesRatioSatsUsdPattern(this, 'vaulted_price'),
|
||||
active: createBpsCentsPercentilesRatioSatsUsdPattern(this, 'active_price'),
|
||||
trueMarketMean: createBpsCentsPercentilesRatioSatsUsdPattern(this, 'true_market_mean'),
|
||||
cointimePrice: createBpsCentsPercentilesRatioSatsUsdPattern(this, 'cointime_price'),
|
||||
transferPrice: createBpsCentsPercentilesRatioSatsUsdPattern(this, 'transfer_price'),
|
||||
balancedPrice: createBpsCentsPercentilesRatioSatsUsdPattern(this, 'balanced_price'),
|
||||
terminalPrice: createBpsCentsPercentilesRatioSatsUsdPattern(this, 'terminal_price'),
|
||||
deltaPrice: createBpsCentsPercentilesRatioSatsUsdPattern(this, 'delta_price'),
|
||||
cointime: createBpsCentsPercentilesRatioSatsUsdPattern(this, 'cointime_price'),
|
||||
transfer: createBpsCentsPercentilesRatioSatsUsdPattern(this, 'transfer_price'),
|
||||
balanced: createBpsCentsPercentilesRatioSatsUsdPattern(this, 'balanced_price'),
|
||||
terminal: createBpsCentsPercentilesRatioSatsUsdPattern(this, 'terminal_price'),
|
||||
delta: createBpsCentsPercentilesRatioSatsUsdPattern(this, 'delta_price'),
|
||||
cumulativeMarketCap: createMetricPattern1(this, 'cumulative_market_cap'),
|
||||
},
|
||||
adjusted: {
|
||||
@@ -7647,9 +7664,11 @@ class BrkClient extends BrkClientBase {
|
||||
thermocapMultiple: createBpsRatioPattern(this, 'thermocap_multiple'),
|
||||
coindaysDestroyedSupplyAdjusted: createMetricPattern1(this, 'coindays_destroyed_supply_adjusted'),
|
||||
coinyearsDestroyedSupplyAdjusted: createMetricPattern1(this, 'coinyears_destroyed_supply_adjusted'),
|
||||
dormancySupplyAdjusted: createMetricPattern1(this, 'dormancy_supply_adjusted'),
|
||||
dormancy: {
|
||||
supplyAdjusted: createMetricPattern1(this, 'dormancy_supply_adjusted'),
|
||||
flow: createMetricPattern1(this, 'dormancy_flow'),
|
||||
},
|
||||
stockToFlow: createMetricPattern1(this, 'stock_to_flow'),
|
||||
dormancyFlow: createMetricPattern1(this, 'dormancy_flow'),
|
||||
sellerExhaustionConstant: createMetricPattern1(this, 'seller_exhaustion_constant'),
|
||||
},
|
||||
market: {
|
||||
@@ -7677,7 +7696,7 @@ class BrkClient extends BrkClientBase {
|
||||
_10y: createCentsSatsUsdPattern(this, 'price_lookback_10y'),
|
||||
},
|
||||
returns: {
|
||||
priceReturn: {
|
||||
periods: {
|
||||
_24h: createBpsPercentRatioPattern(this, 'price_return_24h'),
|
||||
_1w: createBpsPercentRatioPattern(this, 'price_return_1w'),
|
||||
_1m: createBpsPercentRatioPattern(this, 'price_return_1m'),
|
||||
@@ -7692,8 +7711,8 @@ class BrkClient extends BrkClientBase {
|
||||
_8y: createBpsPercentRatioPattern(this, 'price_return_8y'),
|
||||
_10y: createBpsPercentRatioPattern(this, 'price_return_10y'),
|
||||
},
|
||||
priceCagr: create_10y2y3y4y5y6y8yPattern(this, 'price_cagr'),
|
||||
priceReturn24hSd: {
|
||||
cagr: create_10y2y3y4y5y6y8yPattern(this, 'price_cagr'),
|
||||
sd24h: {
|
||||
_1w: {
|
||||
sma: createMetricPattern1(this, 'price_return_24h_sma_1w'),
|
||||
sd: createMetricPattern1(this, 'price_return_24h_sd_1w'),
|
||||
@@ -8123,7 +8142,7 @@ class BrkClient extends BrkClientBase {
|
||||
total: createBtcCentsSatsUsdPattern(this, 'supply'),
|
||||
halved: createBtcCentsSatsUsdPattern(this, 'supply_halved'),
|
||||
},
|
||||
outputs: createUtxoPattern3(this, 'utxo_count'),
|
||||
outputs: createUnspentPattern3(this, 'utxo_count'),
|
||||
activity: createCoindaysCoinyearsDormancySentVelocityPattern(this, ''),
|
||||
realized: createCapGrossInvestorLossMvrvNetNuplPeakPriceProfitSoprPattern(this, ''),
|
||||
costBasis: createInvestedMaxMinPercentilesSupplyPattern(this, ''),
|
||||
@@ -8155,14 +8174,14 @@ class BrkClient extends BrkClientBase {
|
||||
sth: {
|
||||
realized: createCapGrossInvestorLossMvrvNetNuplPeakPriceProfitSoprPattern(this, 'sth'),
|
||||
supply: createDeltaHalvedInRelTotalPattern2(this, 'sth_supply'),
|
||||
outputs: createUtxoPattern3(this, 'sth_utxo_count'),
|
||||
outputs: createUnspentPattern3(this, 'sth_utxo_count'),
|
||||
activity: createCoindaysCoinyearsDormancySentVelocityPattern(this, 'sth'),
|
||||
costBasis: createInvestedMaxMinPercentilesSupplyPattern(this, 'sth'),
|
||||
unrealized: createGrossInvestedInvestorLossNetProfitSentimentPattern2(this, 'sth'),
|
||||
},
|
||||
lth: {
|
||||
supply: createDeltaHalvedInRelTotalPattern2(this, 'lth_supply'),
|
||||
outputs: createUtxoPattern3(this, 'lth_utxo_count'),
|
||||
outputs: createUnspentPattern3(this, 'lth_utxo_count'),
|
||||
activity: createCoindaysCoinyearsDormancySentVelocityPattern(this, 'lth'),
|
||||
realized: {
|
||||
profit: createCumulativeDistributionRawRelSumValuePattern(this, 'lth'),
|
||||
@@ -8473,44 +8492,46 @@ class BrkClient extends BrkClientBase {
|
||||
},
|
||||
},
|
||||
coinblocksDestroyed: createCumulativeRawPattern(this, 'coinblocks_destroyed'),
|
||||
addrCount: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern(this, 'addr_count'),
|
||||
emptyAddrCount: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern(this, 'empty_addr_count'),
|
||||
addressActivity: {
|
||||
all: createBothReactivatedReceivingSendingPattern(this, 'address_activity'),
|
||||
p2pk65: createBothReactivatedReceivingSendingPattern(this, 'p2pk65_address_activity'),
|
||||
p2pk33: createBothReactivatedReceivingSendingPattern(this, 'p2pk33_address_activity'),
|
||||
p2pkh: createBothReactivatedReceivingSendingPattern(this, 'p2pkh_address_activity'),
|
||||
p2sh: createBothReactivatedReceivingSendingPattern(this, 'p2sh_address_activity'),
|
||||
p2wpkh: createBothReactivatedReceivingSendingPattern(this, 'p2wpkh_address_activity'),
|
||||
p2wsh: createBothReactivatedReceivingSendingPattern(this, 'p2wsh_address_activity'),
|
||||
p2tr: createBothReactivatedReceivingSendingPattern(this, 'p2tr_address_activity'),
|
||||
p2a: createBothReactivatedReceivingSendingPattern(this, 'p2a_address_activity'),
|
||||
addresses: {
|
||||
funded: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3(this, 'addr_count'),
|
||||
empty: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3(this, 'empty_addr_count'),
|
||||
activity: {
|
||||
all: createBothReactivatedReceivingSendingPattern(this, 'address_activity'),
|
||||
p2pk65: createBothReactivatedReceivingSendingPattern(this, 'p2pk65_address_activity'),
|
||||
p2pk33: createBothReactivatedReceivingSendingPattern(this, 'p2pk33_address_activity'),
|
||||
p2pkh: createBothReactivatedReceivingSendingPattern(this, 'p2pkh_address_activity'),
|
||||
p2sh: createBothReactivatedReceivingSendingPattern(this, 'p2sh_address_activity'),
|
||||
p2wpkh: createBothReactivatedReceivingSendingPattern(this, 'p2wpkh_address_activity'),
|
||||
p2wsh: createBothReactivatedReceivingSendingPattern(this, 'p2wsh_address_activity'),
|
||||
p2tr: createBothReactivatedReceivingSendingPattern(this, 'p2tr_address_activity'),
|
||||
p2a: createBothReactivatedReceivingSendingPattern(this, 'p2a_address_activity'),
|
||||
},
|
||||
total: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3(this, 'total_addr_count'),
|
||||
new: {
|
||||
all: createRawSumPattern3(this, 'new_addr_count'),
|
||||
p2pk65: createRawSumPattern3(this, 'p2pk65_new_addr_count'),
|
||||
p2pk33: createRawSumPattern3(this, 'p2pk33_new_addr_count'),
|
||||
p2pkh: createRawSumPattern3(this, 'p2pkh_new_addr_count'),
|
||||
p2sh: createRawSumPattern3(this, 'p2sh_new_addr_count'),
|
||||
p2wpkh: createRawSumPattern3(this, 'p2wpkh_new_addr_count'),
|
||||
p2wsh: createRawSumPattern3(this, 'p2wsh_new_addr_count'),
|
||||
p2tr: createRawSumPattern3(this, 'p2tr_new_addr_count'),
|
||||
p2a: createRawSumPattern3(this, 'p2a_new_addr_count'),
|
||||
},
|
||||
delta: {
|
||||
all: createChangeRatePattern2(this, 'addr_count'),
|
||||
p2pk65: createChangeRatePattern2(this, 'p2pk65_addr_count'),
|
||||
p2pk33: createChangeRatePattern2(this, 'p2pk33_addr_count'),
|
||||
p2pkh: createChangeRatePattern2(this, 'p2pkh_addr_count'),
|
||||
p2sh: createChangeRatePattern2(this, 'p2sh_addr_count'),
|
||||
p2wpkh: createChangeRatePattern2(this, 'p2wpkh_addr_count'),
|
||||
p2wsh: createChangeRatePattern2(this, 'p2wsh_addr_count'),
|
||||
p2tr: createChangeRatePattern2(this, 'p2tr_addr_count'),
|
||||
p2a: createChangeRatePattern2(this, 'p2a_addr_count'),
|
||||
},
|
||||
fundedIndex: createMetricPattern34(this, 'funded_address_index'),
|
||||
emptyIndex: createMetricPattern35(this, 'empty_address_index'),
|
||||
},
|
||||
totalAddrCount: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern(this, 'total_addr_count'),
|
||||
newAddrCount: {
|
||||
all: createRawSumPattern3(this, 'new_addr_count'),
|
||||
p2pk65: createRawSumPattern3(this, 'p2pk65_new_addr_count'),
|
||||
p2pk33: createRawSumPattern3(this, 'p2pk33_new_addr_count'),
|
||||
p2pkh: createRawSumPattern3(this, 'p2pkh_new_addr_count'),
|
||||
p2sh: createRawSumPattern3(this, 'p2sh_new_addr_count'),
|
||||
p2wpkh: createRawSumPattern3(this, 'p2wpkh_new_addr_count'),
|
||||
p2wsh: createRawSumPattern3(this, 'p2wsh_new_addr_count'),
|
||||
p2tr: createRawSumPattern3(this, 'p2tr_new_addr_count'),
|
||||
p2a: createRawSumPattern3(this, 'p2a_new_addr_count'),
|
||||
},
|
||||
delta: {
|
||||
all: createChangeRatePattern2(this, 'addr_count'),
|
||||
p2pk65: createChangeRatePattern2(this, 'p2pk65_addr_count'),
|
||||
p2pk33: createChangeRatePattern2(this, 'p2pk33_addr_count'),
|
||||
p2pkh: createChangeRatePattern2(this, 'p2pkh_addr_count'),
|
||||
p2sh: createChangeRatePattern2(this, 'p2sh_addr_count'),
|
||||
p2wpkh: createChangeRatePattern2(this, 'p2wpkh_addr_count'),
|
||||
p2wsh: createChangeRatePattern2(this, 'p2wsh_addr_count'),
|
||||
p2tr: createChangeRatePattern2(this, 'p2tr_addr_count'),
|
||||
p2a: createChangeRatePattern2(this, 'p2a_addr_count'),
|
||||
},
|
||||
fundedAddressIndex: createMetricPattern34(this, 'funded_address_index'),
|
||||
emptyAddressIndex: createMetricPattern35(this, 'empty_address_index'),
|
||||
},
|
||||
supply: {
|
||||
circulating: createBtcCentsSatsUsdPattern(this, 'circulating_supply'),
|
||||
@@ -8529,7 +8550,7 @@ class BrkClient extends BrkClientBase {
|
||||
delta: createChangeRatePattern4(this, 'market_cap_delta'),
|
||||
},
|
||||
marketMinusRealizedCapGrowthRate: create_1m1w1y24hPattern(this, 'market_minus_realized_cap_growth_rate'),
|
||||
hodledOrLostCoins: createBtcCentsSatsUsdPattern(this, 'hodled_or_lost_coins'),
|
||||
hodledOrLost: createBtcCentsSatsUsdPattern(this, 'hodled_or_lost_coins'),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2247,7 +2247,7 @@ class AverageGainsLossesRsiStochPattern:
|
||||
self.stoch_rsi_d: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'stoch_d_24h'))
|
||||
self.stoch_rsi_k: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'stoch_k_24h'))
|
||||
|
||||
class AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern:
|
||||
class AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
@@ -2529,7 +2529,7 @@ class ActivityOutputsRealizedSupplyUnrealizedPattern:
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated metric name."""
|
||||
self.activity: CoindaysSentPattern = CoindaysSentPattern(client, acc)
|
||||
self.outputs: UtxoPattern2 = UtxoPattern2(client, _m(acc, 'utxo_count'))
|
||||
self.outputs: UnspentPattern2 = UnspentPattern2(client, _m(acc, 'utxo_count'))
|
||||
self.realized: CapLossMvrvNetNuplPriceProfitSoprPattern = CapLossMvrvNetNuplPriceProfitSoprPattern(client, acc)
|
||||
self.supply: DeltaHalvedInRelTotalPattern = DeltaHalvedInRelTotalPattern(client, _m(acc, 'supply'))
|
||||
self.unrealized: InvestedInvestorLossNetProfitPattern = InvestedInvestorLossNetProfitPattern(client, acc)
|
||||
@@ -2540,7 +2540,7 @@ class ActivityOutputsRealizedSupplyUnrealizedPattern2:
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated metric name."""
|
||||
self.activity: CoindaysSentPattern = CoindaysSentPattern(client, acc)
|
||||
self.outputs: UtxoPattern2 = UtxoPattern2(client, _m(acc, 'utxo_count'))
|
||||
self.outputs: UnspentPattern2 = UnspentPattern2(client, _m(acc, 'utxo_count'))
|
||||
self.realized: CapLossMvrvNetNuplPriceProfitSoprPattern = CapLossMvrvNetNuplPriceProfitSoprPattern(client, acc)
|
||||
self.supply: DeltaHalvedInRelTotalPattern = DeltaHalvedInRelTotalPattern(client, _m(acc, 'supply'))
|
||||
self.unrealized: LossNetProfitPattern = LossNetProfitPattern(client, acc)
|
||||
@@ -2742,7 +2742,7 @@ class AddrOutputsRealizedSupplyPattern:
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated metric name."""
|
||||
self.addr_count: BaseDeltaPattern = BaseDeltaPattern(client, _m(acc, 'addr_count'))
|
||||
self.outputs: UtxoPattern = UtxoPattern(client, _m(acc, 'utxo_count'))
|
||||
self.outputs: UnspentPattern = UnspentPattern(client, _m(acc, 'utxo_count'))
|
||||
self.realized: CapLossMvrvNuplPriceProfitSoprPattern = CapLossMvrvNuplPriceProfitSoprPattern(client, acc)
|
||||
self.supply: HalvedTotalPattern = HalvedTotalPattern(client, _m(acc, 'supply'))
|
||||
|
||||
@@ -2841,7 +2841,7 @@ class OutputsRealizedSupplyUnrealizedPattern:
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated metric name."""
|
||||
self.outputs: UtxoPattern = UtxoPattern(client, _m(acc, 'utxo_count'))
|
||||
self.outputs: UnspentPattern = UnspentPattern(client, _m(acc, 'utxo_count'))
|
||||
self.realized: CapLossMvrvNuplPriceProfitSoprPattern = CapLossMvrvNuplPriceProfitSoprPattern(client, acc)
|
||||
self.supply: HalvedInTotalPattern = HalvedInTotalPattern(client, _m(acc, 'supply'))
|
||||
self.unrealized: LossProfitPattern2 = LossProfitPattern2(client, _m(acc, 'unrealized'))
|
||||
@@ -2978,7 +2978,7 @@ class OutputsRealizedSupplyPattern:
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated metric name."""
|
||||
self.outputs: UtxoPattern = UtxoPattern(client, _m(acc, 'utxo_count'))
|
||||
self.outputs: UnspentPattern = UnspentPattern(client, _m(acc, 'utxo_count'))
|
||||
self.realized: CapLossMvrvNuplPriceProfitSoprPattern = CapLossMvrvNuplPriceProfitSoprPattern(client, acc)
|
||||
self.supply: HalvedTotalPattern = HalvedTotalPattern(client, _m(acc, 'supply'))
|
||||
|
||||
@@ -3271,26 +3271,26 @@ class _24hPattern:
|
||||
"""Create pattern node with accumulated metric name."""
|
||||
self._24h: CentsUsdPattern = CentsUsdPattern(client, acc)
|
||||
|
||||
class UtxoPattern2:
|
||||
class UnspentPattern2:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated metric name."""
|
||||
self.utxo_count: BaseDeltaPattern = BaseDeltaPattern(client, acc)
|
||||
self.unspent_count: BaseDeltaPattern = BaseDeltaPattern(client, acc)
|
||||
|
||||
class UtxoPattern3:
|
||||
class UnspentPattern3:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated metric name."""
|
||||
self.utxo_count: BaseDeltaPattern2 = BaseDeltaPattern2(client, acc)
|
||||
self.unspent_count: BaseDeltaPattern2 = BaseDeltaPattern2(client, acc)
|
||||
|
||||
class UtxoPattern:
|
||||
class UnspentPattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated metric name."""
|
||||
self.utxo_count: MetricPattern1[StoredU64] = MetricPattern1(client, acc)
|
||||
self.unspent_count: MetricPattern1[StoredU64] = MetricPattern1(client, acc)
|
||||
|
||||
class _1mPattern(Generic[T]):
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
@@ -3338,7 +3338,7 @@ class MetricsTree_Blocks_Size:
|
||||
"""Metrics tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.total_size: MetricPattern18[StoredU64] = MetricPattern18(client, 'total_size')
|
||||
self.total: MetricPattern18[StoredU64] = MetricPattern18(client, 'total_size')
|
||||
self.cumulative: MetricPattern1[StoredU64] = MetricPattern1(client, 'block_size_cumulative')
|
||||
self.sum: _1m1w1y24hPattern[StoredU64] = _1m1w1y24hPattern(client, 'block_size_sum')
|
||||
self.average: _1m1w1y24hPattern[StoredU64] = _1m1w1y24hPattern(client, 'block_size_average')
|
||||
@@ -3370,8 +3370,8 @@ class MetricsTree_Blocks_Count:
|
||||
"""Metrics tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.block_count_target: MetricPattern1[StoredU64] = MetricPattern1(client, 'block_count_target')
|
||||
self.block_count: CumulativeRawSumPattern[StoredU32] = CumulativeRawSumPattern(client, 'block_count')
|
||||
self.target: MetricPattern1[StoredU64] = MetricPattern1(client, 'block_count_target')
|
||||
self.total: CumulativeRawSumPattern[StoredU32] = CumulativeRawSumPattern(client, 'block_count')
|
||||
|
||||
class MetricsTree_Blocks_Lookback:
|
||||
"""Metrics tree node."""
|
||||
@@ -3457,7 +3457,7 @@ class MetricsTree_Transactions_Count:
|
||||
"""Metrics tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.tx_count: AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90RawSumPattern = AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90RawSumPattern(client, 'tx_count')
|
||||
self.total: AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90RawSumPattern = AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90RawSumPattern(client, 'tx_count')
|
||||
self.is_coinbase: MetricPattern19[StoredBool] = MetricPattern19(client, 'is_coinbase')
|
||||
|
||||
class MetricsTree_Transactions_Size:
|
||||
@@ -3544,7 +3544,7 @@ class MetricsTree_Outputs_Count:
|
||||
"""Metrics tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.total_count: AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90RollingSumPattern = AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90RollingSumPattern(client, 'output_count')
|
||||
self.total: AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90RollingSumPattern = AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90RollingSumPattern(client, 'output_count')
|
||||
self.utxo_count: MetricPattern1[StoredU64] = MetricPattern1(client, 'exact_utxo_count')
|
||||
|
||||
class MetricsTree_Outputs:
|
||||
@@ -3660,7 +3660,7 @@ class MetricsTree_Mining_Rewards:
|
||||
self.subsidy_sma_1y: CentsUsdPattern = CentsUsdPattern(client, 'subsidy_sma_1y')
|
||||
self.fee_ratio_multiple: MetricsTree_Mining_Rewards_FeeRatioMultiple = MetricsTree_Mining_Rewards_FeeRatioMultiple(client)
|
||||
|
||||
class MetricsTree_Mining_Hashrate_HashRateSma:
|
||||
class MetricsTree_Mining_Hashrate_Rate_Sma:
|
||||
"""Metrics tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
@@ -3669,16 +3669,22 @@ class MetricsTree_Mining_Hashrate_HashRateSma:
|
||||
self._2m: MetricPattern1[StoredF64] = MetricPattern1(client, 'hash_rate_sma_2m')
|
||||
self._1y: MetricPattern1[StoredF64] = MetricPattern1(client, 'hash_rate_sma_1y')
|
||||
|
||||
class MetricsTree_Mining_Hashrate_Rate:
|
||||
"""Metrics tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.raw: MetricPattern1[StoredF64] = MetricPattern1(client, 'hash_rate')
|
||||
self.sma: MetricsTree_Mining_Hashrate_Rate_Sma = MetricsTree_Mining_Hashrate_Rate_Sma(client)
|
||||
self.ath: MetricPattern1[StoredF64] = MetricPattern1(client, 'hash_rate_ath')
|
||||
self.drawdown: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'hash_rate_drawdown')
|
||||
|
||||
class MetricsTree_Mining_Hashrate:
|
||||
"""Metrics tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.hash_rate: MetricPattern1[StoredF64] = MetricPattern1(client, 'hash_rate')
|
||||
self.hash_rate_sma: MetricsTree_Mining_Hashrate_HashRateSma = MetricsTree_Mining_Hashrate_HashRateSma(client)
|
||||
self.hash_rate_ath: MetricPattern1[StoredF64] = MetricPattern1(client, 'hash_rate_ath')
|
||||
self.hash_rate_drawdown: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'hash_rate_drawdown')
|
||||
self.hash_price: PhsReboundThsPattern = PhsReboundThsPattern(client, 'hash_price')
|
||||
self.hash_value: PhsReboundThsPattern = PhsReboundThsPattern(client, 'hash_value')
|
||||
self.rate: MetricsTree_Mining_Hashrate_Rate = MetricsTree_Mining_Hashrate_Rate(client)
|
||||
self.price: PhsReboundThsPattern = PhsReboundThsPattern(client, 'hash_price')
|
||||
self.value: PhsReboundThsPattern = PhsReboundThsPattern(client, 'hash_value')
|
||||
|
||||
class MetricsTree_Mining:
|
||||
"""Metrics tree node."""
|
||||
@@ -3702,47 +3708,47 @@ class MetricsTree_Cointime_Activity:
|
||||
self.coinblocks_stored: CumulativeRawSumPattern[StoredF64] = CumulativeRawSumPattern(client, 'coinblocks_stored')
|
||||
self.liveliness: MetricPattern1[StoredF64] = MetricPattern1(client, 'liveliness')
|
||||
self.vaultedness: MetricPattern1[StoredF64] = MetricPattern1(client, 'vaultedness')
|
||||
self.activity_to_vaultedness_ratio: MetricPattern1[StoredF64] = MetricPattern1(client, 'activity_to_vaultedness_ratio')
|
||||
self.ratio: MetricPattern1[StoredF64] = MetricPattern1(client, 'activity_to_vaultedness_ratio')
|
||||
|
||||
class MetricsTree_Cointime_Supply:
|
||||
"""Metrics tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.vaulted_supply: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'vaulted_supply')
|
||||
self.active_supply: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'active_supply')
|
||||
self.vaulted: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'vaulted_supply')
|
||||
self.active: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'active_supply')
|
||||
|
||||
class MetricsTree_Cointime_Value:
|
||||
"""Metrics tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.value_destroyed: CumulativeRawSumPattern[StoredF64] = CumulativeRawSumPattern(client, 'cointime_value_destroyed')
|
||||
self.value_created: CumulativeRawSumPattern[StoredF64] = CumulativeRawSumPattern(client, 'cointime_value_created')
|
||||
self.value_stored: CumulativeRawSumPattern[StoredF64] = CumulativeRawSumPattern(client, 'cointime_value_stored')
|
||||
self.destroyed: CumulativeRawSumPattern[StoredF64] = CumulativeRawSumPattern(client, 'cointime_value_destroyed')
|
||||
self.created: CumulativeRawSumPattern[StoredF64] = CumulativeRawSumPattern(client, 'cointime_value_created')
|
||||
self.stored: CumulativeRawSumPattern[StoredF64] = CumulativeRawSumPattern(client, 'cointime_value_stored')
|
||||
self.vocdd: CumulativeRawSumPattern[StoredF64] = CumulativeRawSumPattern(client, 'vocdd')
|
||||
|
||||
class MetricsTree_Cointime_Cap:
|
||||
"""Metrics tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.thermo_cap: CentsUsdPattern = CentsUsdPattern(client, 'thermo_cap')
|
||||
self.investor_cap: CentsUsdPattern = CentsUsdPattern(client, 'investor_cap')
|
||||
self.vaulted_cap: CentsUsdPattern = CentsUsdPattern(client, 'vaulted_cap')
|
||||
self.active_cap: CentsUsdPattern = CentsUsdPattern(client, 'active_cap')
|
||||
self.cointime_cap: CentsUsdPattern = CentsUsdPattern(client, 'cointime_cap')
|
||||
self.thermo: CentsUsdPattern = CentsUsdPattern(client, 'thermo_cap')
|
||||
self.investor: CentsUsdPattern = CentsUsdPattern(client, 'investor_cap')
|
||||
self.vaulted: CentsUsdPattern = CentsUsdPattern(client, 'vaulted_cap')
|
||||
self.active: CentsUsdPattern = CentsUsdPattern(client, 'active_cap')
|
||||
self.cointime: CentsUsdPattern = CentsUsdPattern(client, 'cointime_cap')
|
||||
self.aviv: BpsRatioPattern = BpsRatioPattern(client, 'aviv_ratio')
|
||||
|
||||
class MetricsTree_Cointime_Pricing:
|
||||
class MetricsTree_Cointime_Prices:
|
||||
"""Metrics tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.vaulted_price: BpsCentsPercentilesRatioSatsUsdPattern = BpsCentsPercentilesRatioSatsUsdPattern(client, 'vaulted_price')
|
||||
self.active_price: BpsCentsPercentilesRatioSatsUsdPattern = BpsCentsPercentilesRatioSatsUsdPattern(client, 'active_price')
|
||||
self.vaulted: BpsCentsPercentilesRatioSatsUsdPattern = BpsCentsPercentilesRatioSatsUsdPattern(client, 'vaulted_price')
|
||||
self.active: BpsCentsPercentilesRatioSatsUsdPattern = BpsCentsPercentilesRatioSatsUsdPattern(client, 'active_price')
|
||||
self.true_market_mean: BpsCentsPercentilesRatioSatsUsdPattern = BpsCentsPercentilesRatioSatsUsdPattern(client, 'true_market_mean')
|
||||
self.cointime_price: BpsCentsPercentilesRatioSatsUsdPattern = BpsCentsPercentilesRatioSatsUsdPattern(client, 'cointime_price')
|
||||
self.transfer_price: BpsCentsPercentilesRatioSatsUsdPattern = BpsCentsPercentilesRatioSatsUsdPattern(client, 'transfer_price')
|
||||
self.balanced_price: BpsCentsPercentilesRatioSatsUsdPattern = BpsCentsPercentilesRatioSatsUsdPattern(client, 'balanced_price')
|
||||
self.terminal_price: BpsCentsPercentilesRatioSatsUsdPattern = BpsCentsPercentilesRatioSatsUsdPattern(client, 'terminal_price')
|
||||
self.delta_price: BpsCentsPercentilesRatioSatsUsdPattern = BpsCentsPercentilesRatioSatsUsdPattern(client, 'delta_price')
|
||||
self.cointime: BpsCentsPercentilesRatioSatsUsdPattern = BpsCentsPercentilesRatioSatsUsdPattern(client, 'cointime_price')
|
||||
self.transfer: BpsCentsPercentilesRatioSatsUsdPattern = BpsCentsPercentilesRatioSatsUsdPattern(client, 'transfer_price')
|
||||
self.balanced: BpsCentsPercentilesRatioSatsUsdPattern = BpsCentsPercentilesRatioSatsUsdPattern(client, 'balanced_price')
|
||||
self.terminal: BpsCentsPercentilesRatioSatsUsdPattern = BpsCentsPercentilesRatioSatsUsdPattern(client, 'terminal_price')
|
||||
self.delta: BpsCentsPercentilesRatioSatsUsdPattern = BpsCentsPercentilesRatioSatsUsdPattern(client, 'delta_price')
|
||||
self.cumulative_market_cap: MetricPattern1[Dollars] = MetricPattern1(client, 'cumulative_market_cap')
|
||||
|
||||
class MetricsTree_Cointime_Adjusted:
|
||||
@@ -3769,7 +3775,7 @@ class MetricsTree_Cointime:
|
||||
self.supply: MetricsTree_Cointime_Supply = MetricsTree_Cointime_Supply(client)
|
||||
self.value: MetricsTree_Cointime_Value = MetricsTree_Cointime_Value(client)
|
||||
self.cap: MetricsTree_Cointime_Cap = MetricsTree_Cointime_Cap(client)
|
||||
self.pricing: MetricsTree_Cointime_Pricing = MetricsTree_Cointime_Pricing(client)
|
||||
self.prices: MetricsTree_Cointime_Prices = MetricsTree_Cointime_Prices(client)
|
||||
self.adjusted: MetricsTree_Cointime_Adjusted = MetricsTree_Cointime_Adjusted(client)
|
||||
self.reserve_risk: MetricsTree_Cointime_ReserveRisk = MetricsTree_Cointime_ReserveRisk(client)
|
||||
|
||||
@@ -4066,6 +4072,13 @@ class MetricsTree_Indexes:
|
||||
self.txinindex: MetricsTree_Indexes_Txinindex = MetricsTree_Indexes_Txinindex(client)
|
||||
self.txoutindex: MetricsTree_Indexes_Txoutindex = MetricsTree_Indexes_Txoutindex(client)
|
||||
|
||||
class MetricsTree_Indicators_Dormancy:
|
||||
"""Metrics tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.supply_adjusted: MetricPattern1[StoredF32] = MetricPattern1(client, 'dormancy_supply_adjusted')
|
||||
self.flow: MetricPattern1[StoredF32] = MetricPattern1(client, 'dormancy_flow')
|
||||
|
||||
class MetricsTree_Indicators:
|
||||
"""Metrics tree node."""
|
||||
|
||||
@@ -4077,9 +4090,8 @@ class MetricsTree_Indicators:
|
||||
self.thermocap_multiple: BpsRatioPattern = BpsRatioPattern(client, 'thermocap_multiple')
|
||||
self.coindays_destroyed_supply_adjusted: MetricPattern1[StoredF32] = MetricPattern1(client, 'coindays_destroyed_supply_adjusted')
|
||||
self.coinyears_destroyed_supply_adjusted: MetricPattern1[StoredF32] = MetricPattern1(client, 'coinyears_destroyed_supply_adjusted')
|
||||
self.dormancy_supply_adjusted: MetricPattern1[StoredF32] = MetricPattern1(client, 'dormancy_supply_adjusted')
|
||||
self.dormancy: MetricsTree_Indicators_Dormancy = MetricsTree_Indicators_Dormancy(client)
|
||||
self.stock_to_flow: MetricPattern1[StoredF32] = MetricPattern1(client, 'stock_to_flow')
|
||||
self.dormancy_flow: MetricPattern1[StoredF32] = MetricPattern1(client, 'dormancy_flow')
|
||||
self.seller_exhaustion_constant: MetricPattern1[StoredF32] = MetricPattern1(client, 'seller_exhaustion_constant')
|
||||
|
||||
class MetricsTree_Market_Ath:
|
||||
@@ -4111,7 +4123,7 @@ class MetricsTree_Market_Lookback:
|
||||
self._8y: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_lookback_8y')
|
||||
self._10y: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_lookback_10y')
|
||||
|
||||
class MetricsTree_Market_Returns_PriceReturn:
|
||||
class MetricsTree_Market_Returns_Periods:
|
||||
"""Metrics tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
@@ -4129,35 +4141,35 @@ class MetricsTree_Market_Returns_PriceReturn:
|
||||
self._8y: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'price_return_8y')
|
||||
self._10y: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'price_return_10y')
|
||||
|
||||
class MetricsTree_Market_Returns_PriceReturn24hSd_1w:
|
||||
class MetricsTree_Market_Returns_Sd24h_1w:
|
||||
"""Metrics tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.sma: MetricPattern1[StoredF32] = MetricPattern1(client, 'price_return_24h_sma_1w')
|
||||
self.sd: MetricPattern1[StoredF32] = MetricPattern1(client, 'price_return_24h_sd_1w')
|
||||
|
||||
class MetricsTree_Market_Returns_PriceReturn24hSd_1m:
|
||||
class MetricsTree_Market_Returns_Sd24h_1m:
|
||||
"""Metrics tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.sma: MetricPattern1[StoredF32] = MetricPattern1(client, 'price_return_24h_sma_1m')
|
||||
self.sd: MetricPattern1[StoredF32] = MetricPattern1(client, 'price_return_24h_sd_1m')
|
||||
|
||||
class MetricsTree_Market_Returns_PriceReturn24hSd:
|
||||
class MetricsTree_Market_Returns_Sd24h:
|
||||
"""Metrics tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self._1w: MetricsTree_Market_Returns_PriceReturn24hSd_1w = MetricsTree_Market_Returns_PriceReturn24hSd_1w(client)
|
||||
self._1m: MetricsTree_Market_Returns_PriceReturn24hSd_1m = MetricsTree_Market_Returns_PriceReturn24hSd_1m(client)
|
||||
self._1w: MetricsTree_Market_Returns_Sd24h_1w = MetricsTree_Market_Returns_Sd24h_1w(client)
|
||||
self._1m: MetricsTree_Market_Returns_Sd24h_1m = MetricsTree_Market_Returns_Sd24h_1m(client)
|
||||
self._1y: SdSmaPattern = SdSmaPattern(client, 'price_return_24h')
|
||||
|
||||
class MetricsTree_Market_Returns:
|
||||
"""Metrics tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.price_return: MetricsTree_Market_Returns_PriceReturn = MetricsTree_Market_Returns_PriceReturn(client)
|
||||
self.price_cagr: _10y2y3y4y5y6y8yPattern = _10y2y3y4y5y6y8yPattern(client, 'price_cagr')
|
||||
self.price_return_24h_sd: MetricsTree_Market_Returns_PriceReturn24hSd = MetricsTree_Market_Returns_PriceReturn24hSd(client)
|
||||
self.periods: MetricsTree_Market_Returns_Periods = MetricsTree_Market_Returns_Periods(client)
|
||||
self.cagr: _10y2y3y4y5y6y8yPattern = _10y2y3y4y5y6y8yPattern(client, 'price_cagr')
|
||||
self.sd_24h: MetricsTree_Market_Returns_Sd24h = MetricsTree_Market_Returns_Sd24h(client)
|
||||
|
||||
class MetricsTree_Market_Volatility:
|
||||
"""Metrics tree node."""
|
||||
@@ -4755,7 +4767,7 @@ class MetricsTree_Distribution_UtxoCohorts_All:
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.supply: MetricsTree_Distribution_UtxoCohorts_All_Supply = MetricsTree_Distribution_UtxoCohorts_All_Supply(client)
|
||||
self.outputs: UtxoPattern3 = UtxoPattern3(client, 'utxo_count')
|
||||
self.outputs: UnspentPattern3 = UnspentPattern3(client, 'utxo_count')
|
||||
self.activity: CoindaysCoinyearsDormancySentVelocityPattern = CoindaysCoinyearsDormancySentVelocityPattern(client, '')
|
||||
self.realized: CapGrossInvestorLossMvrvNetNuplPeakPriceProfitSoprPattern = CapGrossInvestorLossMvrvNetNuplPeakPriceProfitSoprPattern(client, '')
|
||||
self.cost_basis: InvestedMaxMinPercentilesSupplyPattern = InvestedMaxMinPercentilesSupplyPattern(client, '')
|
||||
@@ -4767,7 +4779,7 @@ class MetricsTree_Distribution_UtxoCohorts_Sth:
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.realized: CapGrossInvestorLossMvrvNetNuplPeakPriceProfitSoprPattern = CapGrossInvestorLossMvrvNetNuplPeakPriceProfitSoprPattern(client, 'sth')
|
||||
self.supply: DeltaHalvedInRelTotalPattern2 = DeltaHalvedInRelTotalPattern2(client, 'sth_supply')
|
||||
self.outputs: UtxoPattern3 = UtxoPattern3(client, 'sth_utxo_count')
|
||||
self.outputs: UnspentPattern3 = UnspentPattern3(client, 'sth_utxo_count')
|
||||
self.activity: CoindaysCoinyearsDormancySentVelocityPattern = CoindaysCoinyearsDormancySentVelocityPattern(client, 'sth')
|
||||
self.cost_basis: InvestedMaxMinPercentilesSupplyPattern = InvestedMaxMinPercentilesSupplyPattern(client, 'sth')
|
||||
self.unrealized: GrossInvestedInvestorLossNetProfitSentimentPattern2 = GrossInvestedInvestorLossNetProfitSentimentPattern2(client, 'sth')
|
||||
@@ -4816,7 +4828,7 @@ class MetricsTree_Distribution_UtxoCohorts_Lth:
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.supply: DeltaHalvedInRelTotalPattern2 = DeltaHalvedInRelTotalPattern2(client, 'lth_supply')
|
||||
self.outputs: UtxoPattern3 = UtxoPattern3(client, 'lth_utxo_count')
|
||||
self.outputs: UnspentPattern3 = UnspentPattern3(client, 'lth_utxo_count')
|
||||
self.activity: CoindaysCoinyearsDormancySentVelocityPattern = CoindaysCoinyearsDormancySentVelocityPattern(client, 'lth')
|
||||
self.realized: MetricsTree_Distribution_UtxoCohorts_Lth_Realized = MetricsTree_Distribution_UtxoCohorts_Lth_Realized(client)
|
||||
self.cost_basis: InvestedMaxMinPercentilesSupplyPattern = InvestedMaxMinPercentilesSupplyPattern(client, 'lth')
|
||||
@@ -5181,7 +5193,7 @@ class MetricsTree_Distribution_AddressCohorts:
|
||||
self.amount_range: MetricsTree_Distribution_AddressCohorts_AmountRange = MetricsTree_Distribution_AddressCohorts_AmountRange(client)
|
||||
self.lt_amount: MetricsTree_Distribution_AddressCohorts_LtAmount = MetricsTree_Distribution_AddressCohorts_LtAmount(client)
|
||||
|
||||
class MetricsTree_Distribution_AddressActivity:
|
||||
class MetricsTree_Distribution_Addresses_Activity:
|
||||
"""Metrics tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
@@ -5195,7 +5207,7 @@ class MetricsTree_Distribution_AddressActivity:
|
||||
self.p2tr: BothReactivatedReceivingSendingPattern = BothReactivatedReceivingSendingPattern(client, 'p2tr_address_activity')
|
||||
self.p2a: BothReactivatedReceivingSendingPattern = BothReactivatedReceivingSendingPattern(client, 'p2a_address_activity')
|
||||
|
||||
class MetricsTree_Distribution_NewAddrCount:
|
||||
class MetricsTree_Distribution_Addresses_New:
|
||||
"""Metrics tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
@@ -5209,7 +5221,7 @@ class MetricsTree_Distribution_NewAddrCount:
|
||||
self.p2tr: RawSumPattern3[StoredU64] = RawSumPattern3(client, 'p2tr_new_addr_count')
|
||||
self.p2a: RawSumPattern3[StoredU64] = RawSumPattern3(client, 'p2a_new_addr_count')
|
||||
|
||||
class MetricsTree_Distribution_Delta:
|
||||
class MetricsTree_Distribution_Addresses_Delta:
|
||||
"""Metrics tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
@@ -5223,6 +5235,19 @@ class MetricsTree_Distribution_Delta:
|
||||
self.p2tr: ChangeRatePattern2 = ChangeRatePattern2(client, 'p2tr_addr_count')
|
||||
self.p2a: ChangeRatePattern2 = ChangeRatePattern2(client, 'p2a_addr_count')
|
||||
|
||||
class MetricsTree_Distribution_Addresses:
|
||||
"""Metrics tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.funded: AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3 = AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3(client, 'addr_count')
|
||||
self.empty: AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3 = AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3(client, 'empty_addr_count')
|
||||
self.activity: MetricsTree_Distribution_Addresses_Activity = MetricsTree_Distribution_Addresses_Activity(client)
|
||||
self.total: AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3 = AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3(client, 'total_addr_count')
|
||||
self.new: MetricsTree_Distribution_Addresses_New = MetricsTree_Distribution_Addresses_New(client)
|
||||
self.delta: MetricsTree_Distribution_Addresses_Delta = MetricsTree_Distribution_Addresses_Delta(client)
|
||||
self.funded_index: MetricPattern34[FundedAddressIndex] = MetricPattern34(client, 'funded_address_index')
|
||||
self.empty_index: MetricPattern35[EmptyAddressIndex] = MetricPattern35(client, 'empty_address_index')
|
||||
|
||||
class MetricsTree_Distribution:
|
||||
"""Metrics tree node."""
|
||||
|
||||
@@ -5233,14 +5258,7 @@ class MetricsTree_Distribution:
|
||||
self.utxo_cohorts: MetricsTree_Distribution_UtxoCohorts = MetricsTree_Distribution_UtxoCohorts(client)
|
||||
self.address_cohorts: MetricsTree_Distribution_AddressCohorts = MetricsTree_Distribution_AddressCohorts(client)
|
||||
self.coinblocks_destroyed: CumulativeRawPattern[StoredF64] = CumulativeRawPattern(client, 'coinblocks_destroyed')
|
||||
self.addr_count: AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern = AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern(client, 'addr_count')
|
||||
self.empty_addr_count: AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern = AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern(client, 'empty_addr_count')
|
||||
self.address_activity: MetricsTree_Distribution_AddressActivity = MetricsTree_Distribution_AddressActivity(client)
|
||||
self.total_addr_count: AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern = AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern(client, 'total_addr_count')
|
||||
self.new_addr_count: MetricsTree_Distribution_NewAddrCount = MetricsTree_Distribution_NewAddrCount(client)
|
||||
self.delta: MetricsTree_Distribution_Delta = MetricsTree_Distribution_Delta(client)
|
||||
self.funded_address_index: MetricPattern34[FundedAddressIndex] = MetricPattern34(client, 'funded_address_index')
|
||||
self.empty_address_index: MetricPattern35[EmptyAddressIndex] = MetricPattern35(client, 'empty_address_index')
|
||||
self.addresses: MetricsTree_Distribution_Addresses = MetricsTree_Distribution_Addresses(client)
|
||||
|
||||
class MetricsTree_Supply_Burned:
|
||||
"""Metrics tree node."""
|
||||
@@ -5274,7 +5292,7 @@ class MetricsTree_Supply:
|
||||
self.velocity: MetricsTree_Supply_Velocity = MetricsTree_Supply_Velocity(client)
|
||||
self.market_cap: MetricsTree_Supply_MarketCap = MetricsTree_Supply_MarketCap(client)
|
||||
self.market_minus_realized_cap_growth_rate: _1m1w1y24hPattern[BasisPointsSigned32] = _1m1w1y24hPattern(client, 'market_minus_realized_cap_growth_rate')
|
||||
self.hodled_or_lost_coins: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'hodled_or_lost_coins')
|
||||
self.hodled_or_lost: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'hodled_or_lost_coins')
|
||||
|
||||
class MetricsTree:
|
||||
"""Metrics tree node."""
|
||||
|
||||
Reference in New Issue
Block a user