global: snapshot

This commit is contained in:
nym21
2026-03-10 19:33:50 +01:00
parent 3e29328949
commit 6a728a3357
48 changed files with 889 additions and 710 deletions

View File

@@ -3574,97 +3574,97 @@ impl MetricsTree_Blocks_Count {
/// Metrics tree node. /// Metrics tree node.
pub struct MetricsTree_Blocks_Lookback { pub struct MetricsTree_Blocks_Lookback {
pub height_1h_ago: MetricPattern18<Height>, pub _1h: MetricPattern18<Height>,
pub height_24h_ago: MetricPattern18<Height>, pub _24h: MetricPattern18<Height>,
pub height_3d_ago: MetricPattern18<Height>, pub _3d: MetricPattern18<Height>,
pub height_1w_ago: MetricPattern18<Height>, pub _1w: MetricPattern18<Height>,
pub height_8d_ago: MetricPattern18<Height>, pub _8d: MetricPattern18<Height>,
pub height_9d_ago: MetricPattern18<Height>, pub _9d: MetricPattern18<Height>,
pub height_12d_ago: MetricPattern18<Height>, pub _12d: MetricPattern18<Height>,
pub height_13d_ago: MetricPattern18<Height>, pub _13d: MetricPattern18<Height>,
pub height_2w_ago: MetricPattern18<Height>, pub _2w: MetricPattern18<Height>,
pub height_21d_ago: MetricPattern18<Height>, pub _21d: MetricPattern18<Height>,
pub height_26d_ago: MetricPattern18<Height>, pub _26d: MetricPattern18<Height>,
pub height_1m_ago: MetricPattern18<Height>, pub _1m: MetricPattern18<Height>,
pub height_34d_ago: MetricPattern18<Height>, pub _34d: MetricPattern18<Height>,
pub height_55d_ago: MetricPattern18<Height>, pub _55d: MetricPattern18<Height>,
pub height_2m_ago: MetricPattern18<Height>, pub _2m: MetricPattern18<Height>,
pub height_9w_ago: MetricPattern18<Height>, pub _9w: MetricPattern18<Height>,
pub height_12w_ago: MetricPattern18<Height>, pub _12w: MetricPattern18<Height>,
pub height_89d_ago: MetricPattern18<Height>, pub _89d: MetricPattern18<Height>,
pub height_3m_ago: MetricPattern18<Height>, pub _3m: MetricPattern18<Height>,
pub height_14w_ago: MetricPattern18<Height>, pub _14w: MetricPattern18<Height>,
pub height_111d_ago: MetricPattern18<Height>, pub _111d: MetricPattern18<Height>,
pub height_144d_ago: MetricPattern18<Height>, pub _144d: MetricPattern18<Height>,
pub height_6m_ago: MetricPattern18<Height>, pub _6m: MetricPattern18<Height>,
pub height_26w_ago: MetricPattern18<Height>, pub _26w: MetricPattern18<Height>,
pub height_200d_ago: MetricPattern18<Height>, pub _200d: MetricPattern18<Height>,
pub height_9m_ago: MetricPattern18<Height>, pub _9m: MetricPattern18<Height>,
pub height_350d_ago: MetricPattern18<Height>, pub _350d: MetricPattern18<Height>,
pub height_12m_ago: MetricPattern18<Height>, pub _12m: MetricPattern18<Height>,
pub height_1y_ago: MetricPattern18<Height>, pub _1y: MetricPattern18<Height>,
pub height_14m_ago: MetricPattern18<Height>, pub _14m: MetricPattern18<Height>,
pub height_2y_ago: MetricPattern18<Height>, pub _2y: MetricPattern18<Height>,
pub height_26m_ago: MetricPattern18<Height>, pub _26m: MetricPattern18<Height>,
pub height_3y_ago: MetricPattern18<Height>, pub _3y: MetricPattern18<Height>,
pub height_200w_ago: MetricPattern18<Height>, pub _200w: MetricPattern18<Height>,
pub height_4y_ago: MetricPattern18<Height>, pub _4y: MetricPattern18<Height>,
pub height_5y_ago: MetricPattern18<Height>, pub _5y: MetricPattern18<Height>,
pub height_6y_ago: MetricPattern18<Height>, pub _6y: MetricPattern18<Height>,
pub height_8y_ago: MetricPattern18<Height>, pub _8y: MetricPattern18<Height>,
pub height_9y_ago: MetricPattern18<Height>, pub _9y: MetricPattern18<Height>,
pub height_10y_ago: MetricPattern18<Height>, pub _10y: MetricPattern18<Height>,
pub height_12y_ago: MetricPattern18<Height>, pub _12y: MetricPattern18<Height>,
pub height_14y_ago: MetricPattern18<Height>, pub _14y: MetricPattern18<Height>,
pub height_26y_ago: MetricPattern18<Height>, pub _26y: MetricPattern18<Height>,
} }
impl MetricsTree_Blocks_Lookback { impl MetricsTree_Blocks_Lookback {
pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self { pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self {
Self { Self {
height_1h_ago: MetricPattern18::new(client.clone(), "height_1h_ago".to_string()), _1h: MetricPattern18::new(client.clone(), "height_1h_ago".to_string()),
height_24h_ago: MetricPattern18::new(client.clone(), "height_24h_ago".to_string()), _24h: MetricPattern18::new(client.clone(), "height_24h_ago".to_string()),
height_3d_ago: MetricPattern18::new(client.clone(), "height_3d_ago".to_string()), _3d: MetricPattern18::new(client.clone(), "height_3d_ago".to_string()),
height_1w_ago: MetricPattern18::new(client.clone(), "height_1w_ago".to_string()), _1w: MetricPattern18::new(client.clone(), "height_1w_ago".to_string()),
height_8d_ago: MetricPattern18::new(client.clone(), "height_8d_ago".to_string()), _8d: MetricPattern18::new(client.clone(), "height_8d_ago".to_string()),
height_9d_ago: MetricPattern18::new(client.clone(), "height_9d_ago".to_string()), _9d: MetricPattern18::new(client.clone(), "height_9d_ago".to_string()),
height_12d_ago: MetricPattern18::new(client.clone(), "height_12d_ago".to_string()), _12d: MetricPattern18::new(client.clone(), "height_12d_ago".to_string()),
height_13d_ago: MetricPattern18::new(client.clone(), "height_13d_ago".to_string()), _13d: MetricPattern18::new(client.clone(), "height_13d_ago".to_string()),
height_2w_ago: MetricPattern18::new(client.clone(), "height_2w_ago".to_string()), _2w: MetricPattern18::new(client.clone(), "height_2w_ago".to_string()),
height_21d_ago: MetricPattern18::new(client.clone(), "height_21d_ago".to_string()), _21d: MetricPattern18::new(client.clone(), "height_21d_ago".to_string()),
height_26d_ago: MetricPattern18::new(client.clone(), "height_26d_ago".to_string()), _26d: MetricPattern18::new(client.clone(), "height_26d_ago".to_string()),
height_1m_ago: MetricPattern18::new(client.clone(), "height_1m_ago".to_string()), _1m: MetricPattern18::new(client.clone(), "height_1m_ago".to_string()),
height_34d_ago: MetricPattern18::new(client.clone(), "height_34d_ago".to_string()), _34d: MetricPattern18::new(client.clone(), "height_34d_ago".to_string()),
height_55d_ago: MetricPattern18::new(client.clone(), "height_55d_ago".to_string()), _55d: MetricPattern18::new(client.clone(), "height_55d_ago".to_string()),
height_2m_ago: MetricPattern18::new(client.clone(), "height_2m_ago".to_string()), _2m: MetricPattern18::new(client.clone(), "height_2m_ago".to_string()),
height_9w_ago: MetricPattern18::new(client.clone(), "height_9w_ago".to_string()), _9w: MetricPattern18::new(client.clone(), "height_9w_ago".to_string()),
height_12w_ago: MetricPattern18::new(client.clone(), "height_12w_ago".to_string()), _12w: MetricPattern18::new(client.clone(), "height_12w_ago".to_string()),
height_89d_ago: MetricPattern18::new(client.clone(), "height_89d_ago".to_string()), _89d: MetricPattern18::new(client.clone(), "height_89d_ago".to_string()),
height_3m_ago: MetricPattern18::new(client.clone(), "height_3m_ago".to_string()), _3m: MetricPattern18::new(client.clone(), "height_3m_ago".to_string()),
height_14w_ago: MetricPattern18::new(client.clone(), "height_14w_ago".to_string()), _14w: MetricPattern18::new(client.clone(), "height_14w_ago".to_string()),
height_111d_ago: MetricPattern18::new(client.clone(), "height_111d_ago".to_string()), _111d: MetricPattern18::new(client.clone(), "height_111d_ago".to_string()),
height_144d_ago: MetricPattern18::new(client.clone(), "height_144d_ago".to_string()), _144d: MetricPattern18::new(client.clone(), "height_144d_ago".to_string()),
height_6m_ago: MetricPattern18::new(client.clone(), "height_6m_ago".to_string()), _6m: MetricPattern18::new(client.clone(), "height_6m_ago".to_string()),
height_26w_ago: MetricPattern18::new(client.clone(), "height_26w_ago".to_string()), _26w: MetricPattern18::new(client.clone(), "height_26w_ago".to_string()),
height_200d_ago: MetricPattern18::new(client.clone(), "height_200d_ago".to_string()), _200d: MetricPattern18::new(client.clone(), "height_200d_ago".to_string()),
height_9m_ago: MetricPattern18::new(client.clone(), "height_9m_ago".to_string()), _9m: MetricPattern18::new(client.clone(), "height_9m_ago".to_string()),
height_350d_ago: MetricPattern18::new(client.clone(), "height_350d_ago".to_string()), _350d: MetricPattern18::new(client.clone(), "height_350d_ago".to_string()),
height_12m_ago: MetricPattern18::new(client.clone(), "height_12m_ago".to_string()), _12m: MetricPattern18::new(client.clone(), "height_12m_ago".to_string()),
height_1y_ago: MetricPattern18::new(client.clone(), "height_1y_ago".to_string()), _1y: MetricPattern18::new(client.clone(), "height_1y_ago".to_string()),
height_14m_ago: MetricPattern18::new(client.clone(), "height_14m_ago".to_string()), _14m: MetricPattern18::new(client.clone(), "height_14m_ago".to_string()),
height_2y_ago: MetricPattern18::new(client.clone(), "height_2y_ago".to_string()), _2y: MetricPattern18::new(client.clone(), "height_2y_ago".to_string()),
height_26m_ago: MetricPattern18::new(client.clone(), "height_26m_ago".to_string()), _26m: MetricPattern18::new(client.clone(), "height_26m_ago".to_string()),
height_3y_ago: MetricPattern18::new(client.clone(), "height_3y_ago".to_string()), _3y: MetricPattern18::new(client.clone(), "height_3y_ago".to_string()),
height_200w_ago: MetricPattern18::new(client.clone(), "height_200w_ago".to_string()), _200w: MetricPattern18::new(client.clone(), "height_200w_ago".to_string()),
height_4y_ago: MetricPattern18::new(client.clone(), "height_4y_ago".to_string()), _4y: MetricPattern18::new(client.clone(), "height_4y_ago".to_string()),
height_5y_ago: MetricPattern18::new(client.clone(), "height_5y_ago".to_string()), _5y: MetricPattern18::new(client.clone(), "height_5y_ago".to_string()),
height_6y_ago: MetricPattern18::new(client.clone(), "height_6y_ago".to_string()), _6y: MetricPattern18::new(client.clone(), "height_6y_ago".to_string()),
height_8y_ago: MetricPattern18::new(client.clone(), "height_8y_ago".to_string()), _8y: MetricPattern18::new(client.clone(), "height_8y_ago".to_string()),
height_9y_ago: MetricPattern18::new(client.clone(), "height_9y_ago".to_string()), _9y: MetricPattern18::new(client.clone(), "height_9y_ago".to_string()),
height_10y_ago: MetricPattern18::new(client.clone(), "height_10y_ago".to_string()), _10y: MetricPattern18::new(client.clone(), "height_10y_ago".to_string()),
height_12y_ago: MetricPattern18::new(client.clone(), "height_12y_ago".to_string()), _12y: MetricPattern18::new(client.clone(), "height_12y_ago".to_string()),
height_14y_ago: MetricPattern18::new(client.clone(), "height_14y_ago".to_string()), _14y: MetricPattern18::new(client.clone(), "height_14y_ago".to_string()),
height_26y_ago: MetricPattern18::new(client.clone(), "height_26y_ago".to_string()), _26y: MetricPattern18::new(client.clone(), "height_26y_ago".to_string()),
} }
} }
} }
@@ -5280,15 +5280,12 @@ pub struct MetricsTree_Market_MovingAverage_Sma {
pub _89d: BpsCentsRatioSatsUsdPattern, pub _89d: BpsCentsRatioSatsUsdPattern,
pub _111d: BpsCentsRatioSatsUsdPattern, pub _111d: BpsCentsRatioSatsUsdPattern,
pub _144d: BpsCentsRatioSatsUsdPattern, pub _144d: BpsCentsRatioSatsUsdPattern,
pub _200d: BpsCentsRatioSatsUsdPattern, pub _200d: MetricsTree_Market_MovingAverage_Sma_200d,
pub _350d: BpsCentsRatioSatsUsdPattern, pub _350d: MetricsTree_Market_MovingAverage_Sma_350d,
pub _1y: BpsCentsRatioSatsUsdPattern, pub _1y: BpsCentsRatioSatsUsdPattern,
pub _2y: BpsCentsRatioSatsUsdPattern, pub _2y: BpsCentsRatioSatsUsdPattern,
pub _200w: BpsCentsRatioSatsUsdPattern, pub _200w: BpsCentsRatioSatsUsdPattern,
pub _4y: BpsCentsRatioSatsUsdPattern, pub _4y: BpsCentsRatioSatsUsdPattern,
pub _200d_x2_4: CentsSatsUsdPattern,
pub _200d_x0_8: CentsSatsUsdPattern,
pub _350d_x2: CentsSatsUsdPattern,
} }
impl MetricsTree_Market_MovingAverage_Sma { impl MetricsTree_Market_MovingAverage_Sma {
@@ -5304,15 +5301,60 @@ impl MetricsTree_Market_MovingAverage_Sma {
_89d: BpsCentsRatioSatsUsdPattern::new(client.clone(), "price_sma_89d".to_string()), _89d: BpsCentsRatioSatsUsdPattern::new(client.clone(), "price_sma_89d".to_string()),
_111d: BpsCentsRatioSatsUsdPattern::new(client.clone(), "price_sma_111d".to_string()), _111d: BpsCentsRatioSatsUsdPattern::new(client.clone(), "price_sma_111d".to_string()),
_144d: BpsCentsRatioSatsUsdPattern::new(client.clone(), "price_sma_144d".to_string()), _144d: BpsCentsRatioSatsUsdPattern::new(client.clone(), "price_sma_144d".to_string()),
_200d: BpsCentsRatioSatsUsdPattern::new(client.clone(), "price_sma_200d".to_string()), _200d: MetricsTree_Market_MovingAverage_Sma_200d::new(client.clone(), format!("{base_path}_200d")),
_350d: BpsCentsRatioSatsUsdPattern::new(client.clone(), "price_sma_350d".to_string()), _350d: MetricsTree_Market_MovingAverage_Sma_350d::new(client.clone(), format!("{base_path}_350d")),
_1y: BpsCentsRatioSatsUsdPattern::new(client.clone(), "price_sma_1y".to_string()), _1y: BpsCentsRatioSatsUsdPattern::new(client.clone(), "price_sma_1y".to_string()),
_2y: BpsCentsRatioSatsUsdPattern::new(client.clone(), "price_sma_2y".to_string()), _2y: BpsCentsRatioSatsUsdPattern::new(client.clone(), "price_sma_2y".to_string()),
_200w: BpsCentsRatioSatsUsdPattern::new(client.clone(), "price_sma_200w".to_string()), _200w: BpsCentsRatioSatsUsdPattern::new(client.clone(), "price_sma_200w".to_string()),
_4y: BpsCentsRatioSatsUsdPattern::new(client.clone(), "price_sma_4y".to_string()), _4y: BpsCentsRatioSatsUsdPattern::new(client.clone(), "price_sma_4y".to_string()),
_200d_x2_4: CentsSatsUsdPattern::new(client.clone(), "price_sma_200d_x2_4".to_string()), }
_200d_x0_8: CentsSatsUsdPattern::new(client.clone(), "price_sma_200d_x0_8".to_string()), }
_350d_x2: CentsSatsUsdPattern::new(client.clone(), "price_sma_350d_x2".to_string()), }
/// Metrics tree node.
pub struct MetricsTree_Market_MovingAverage_Sma_200d {
pub cents: MetricPattern1<Cents>,
pub usd: MetricPattern1<Dollars>,
pub sats: MetricPattern1<SatsFract>,
pub bps: MetricPattern1<BasisPoints32>,
pub ratio: MetricPattern1<StoredF32>,
pub x2_4: CentsSatsUsdPattern,
pub x0_8: CentsSatsUsdPattern,
}
impl MetricsTree_Market_MovingAverage_Sma_200d {
pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self {
Self {
cents: MetricPattern1::new(client.clone(), "price_sma_200d_cents".to_string()),
usd: MetricPattern1::new(client.clone(), "price_sma_200d_usd".to_string()),
sats: MetricPattern1::new(client.clone(), "price_sma_200d_sats".to_string()),
bps: MetricPattern1::new(client.clone(), "price_sma_200d_ratio_bps".to_string()),
ratio: MetricPattern1::new(client.clone(), "price_sma_200d_ratio".to_string()),
x2_4: CentsSatsUsdPattern::new(client.clone(), "price_sma_200d_x2_4".to_string()),
x0_8: CentsSatsUsdPattern::new(client.clone(), "price_sma_200d_x0_8".to_string()),
}
}
}
/// Metrics tree node.
pub struct MetricsTree_Market_MovingAverage_Sma_350d {
pub cents: MetricPattern1<Cents>,
pub usd: MetricPattern1<Dollars>,
pub sats: MetricPattern1<SatsFract>,
pub bps: MetricPattern1<BasisPoints32>,
pub ratio: MetricPattern1<StoredF32>,
pub x2: CentsSatsUsdPattern,
}
impl MetricsTree_Market_MovingAverage_Sma_350d {
pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self {
Self {
cents: MetricPattern1::new(client.clone(), "price_sma_350d_cents".to_string()),
usd: MetricPattern1::new(client.clone(), "price_sma_350d_usd".to_string()),
sats: MetricPattern1::new(client.clone(), "price_sma_350d_sats".to_string()),
bps: MetricPattern1::new(client.clone(), "price_sma_350d_ratio_bps".to_string()),
ratio: MetricPattern1::new(client.clone(), "price_sma_350d_ratio".to_string()),
x2: CentsSatsUsdPattern::new(client.clone(), "price_sma_350d_x2".to_string()),
} }
} }
} }
@@ -5362,37 +5404,46 @@ impl MetricsTree_Market_MovingAverage_Ema {
/// Metrics tree node. /// Metrics tree node.
pub struct MetricsTree_Market_Dca { pub struct MetricsTree_Market_Dca {
pub dca_sats_per_day: MetricPattern18<Sats>, pub sats_per_day: MetricPattern18<Sats>,
pub period_stack: _10y1m1w1y2y3m3y4y5y6m6y8yPattern3, pub period: MetricsTree_Market_Dca_Period,
pub period_cost_basis: MetricsTree_Market_Dca_PeriodCostBasis, pub class: MetricsTree_Market_Dca_Class,
pub period_return: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2,
pub period_cagr: _10y2y3y4y5y6y8yPattern,
pub period_lump_sum_stack: _10y1m1w1y2y3m3y4y5y6m6y8yPattern3,
pub period_lump_sum_return: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2,
pub class_stack: MetricsTree_Market_Dca_ClassStack,
pub class_cost_basis: MetricsTree_Market_Dca_ClassCostBasis,
pub class_return: MetricsTree_Market_Dca_ClassReturn,
} }
impl MetricsTree_Market_Dca { impl MetricsTree_Market_Dca {
pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self { pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self {
Self { Self {
dca_sats_per_day: MetricPattern18::new(client.clone(), "dca_sats_per_day".to_string()), sats_per_day: MetricPattern18::new(client.clone(), "dca_sats_per_day".to_string()),
period_stack: _10y1m1w1y2y3m3y4y5y6m6y8yPattern3::new(client.clone(), "dca_stack".to_string()), period: MetricsTree_Market_Dca_Period::new(client.clone(), format!("{base_path}_period")),
period_cost_basis: MetricsTree_Market_Dca_PeriodCostBasis::new(client.clone(), format!("{base_path}_period_cost_basis")), class: MetricsTree_Market_Dca_Class::new(client.clone(), format!("{base_path}_class")),
period_return: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2::new(client.clone(), "dca_return".to_string()),
period_cagr: _10y2y3y4y5y6y8yPattern::new(client.clone(), "dca_cagr".to_string()),
period_lump_sum_stack: _10y1m1w1y2y3m3y4y5y6m6y8yPattern3::new(client.clone(), "lump_sum_stack".to_string()),
period_lump_sum_return: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2::new(client.clone(), "lump_sum_return".to_string()),
class_stack: MetricsTree_Market_Dca_ClassStack::new(client.clone(), format!("{base_path}_class_stack")),
class_cost_basis: MetricsTree_Market_Dca_ClassCostBasis::new(client.clone(), format!("{base_path}_class_cost_basis")),
class_return: MetricsTree_Market_Dca_ClassReturn::new(client.clone(), format!("{base_path}_class_return")),
} }
} }
} }
/// Metrics tree node. /// Metrics tree node.
pub struct MetricsTree_Market_Dca_PeriodCostBasis { pub struct MetricsTree_Market_Dca_Period {
pub stack: _10y1m1w1y2y3m3y4y5y6m6y8yPattern3,
pub cost_basis: MetricsTree_Market_Dca_Period_CostBasis,
pub r#return: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2,
pub cagr: _10y2y3y4y5y6y8yPattern,
pub lump_sum_stack: _10y1m1w1y2y3m3y4y5y6m6y8yPattern3,
pub lump_sum_return: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2,
}
impl MetricsTree_Market_Dca_Period {
pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self {
Self {
stack: _10y1m1w1y2y3m3y4y5y6m6y8yPattern3::new(client.clone(), "dca_stack".to_string()),
cost_basis: MetricsTree_Market_Dca_Period_CostBasis::new(client.clone(), format!("{base_path}_cost_basis")),
r#return: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2::new(client.clone(), "dca_return".to_string()),
cagr: _10y2y3y4y5y6y8yPattern::new(client.clone(), "dca_cagr".to_string()),
lump_sum_stack: _10y1m1w1y2y3m3y4y5y6m6y8yPattern3::new(client.clone(), "lump_sum_stack".to_string()),
lump_sum_return: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2::new(client.clone(), "lump_sum_return".to_string()),
}
}
}
/// Metrics tree node.
pub struct MetricsTree_Market_Dca_Period_CostBasis {
pub _1w: CentsSatsUsdPattern, pub _1w: CentsSatsUsdPattern,
pub _1m: CentsSatsUsdPattern, pub _1m: CentsSatsUsdPattern,
pub _3m: CentsSatsUsdPattern, pub _3m: CentsSatsUsdPattern,
@@ -5407,7 +5458,7 @@ pub struct MetricsTree_Market_Dca_PeriodCostBasis {
pub _10y: CentsSatsUsdPattern, pub _10y: CentsSatsUsdPattern,
} }
impl MetricsTree_Market_Dca_PeriodCostBasis { impl MetricsTree_Market_Dca_Period_CostBasis {
pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self { pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self {
Self { Self {
_1w: CentsSatsUsdPattern::new(client.clone(), "dca_cost_basis_1w".to_string()), _1w: CentsSatsUsdPattern::new(client.clone(), "dca_cost_basis_1w".to_string()),
@@ -5427,7 +5478,24 @@ impl MetricsTree_Market_Dca_PeriodCostBasis {
} }
/// Metrics tree node. /// Metrics tree node.
pub struct MetricsTree_Market_Dca_ClassStack { pub struct MetricsTree_Market_Dca_Class {
pub stack: MetricsTree_Market_Dca_Class_Stack,
pub cost_basis: MetricsTree_Market_Dca_Class_CostBasis,
pub r#return: MetricsTree_Market_Dca_Class_R#return,
}
impl MetricsTree_Market_Dca_Class {
pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self {
Self {
stack: MetricsTree_Market_Dca_Class_Stack::new(client.clone(), format!("{base_path}_stack")),
cost_basis: MetricsTree_Market_Dca_Class_CostBasis::new(client.clone(), format!("{base_path}_cost_basis")),
r#return: MetricsTree_Market_Dca_Class_R#return::new(client.clone(), format!("{base_path}_r#return")),
}
}
}
/// Metrics tree node.
pub struct MetricsTree_Market_Dca_Class_Stack {
pub from_2015: BtcCentsSatsUsdPattern, pub from_2015: BtcCentsSatsUsdPattern,
pub from_2016: BtcCentsSatsUsdPattern, pub from_2016: BtcCentsSatsUsdPattern,
pub from_2017: BtcCentsSatsUsdPattern, pub from_2017: BtcCentsSatsUsdPattern,
@@ -5442,7 +5510,7 @@ pub struct MetricsTree_Market_Dca_ClassStack {
pub from_2026: BtcCentsSatsUsdPattern, pub from_2026: BtcCentsSatsUsdPattern,
} }
impl MetricsTree_Market_Dca_ClassStack { impl MetricsTree_Market_Dca_Class_Stack {
pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self { pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self {
Self { Self {
from_2015: BtcCentsSatsUsdPattern::new(client.clone(), "dca_stack_from_2015".to_string()), from_2015: BtcCentsSatsUsdPattern::new(client.clone(), "dca_stack_from_2015".to_string()),
@@ -5462,7 +5530,7 @@ impl MetricsTree_Market_Dca_ClassStack {
} }
/// Metrics tree node. /// Metrics tree node.
pub struct MetricsTree_Market_Dca_ClassCostBasis { pub struct MetricsTree_Market_Dca_Class_CostBasis {
pub from_2015: CentsSatsUsdPattern, pub from_2015: CentsSatsUsdPattern,
pub from_2016: CentsSatsUsdPattern, pub from_2016: CentsSatsUsdPattern,
pub from_2017: CentsSatsUsdPattern, pub from_2017: CentsSatsUsdPattern,
@@ -5477,7 +5545,7 @@ pub struct MetricsTree_Market_Dca_ClassCostBasis {
pub from_2026: CentsSatsUsdPattern, pub from_2026: CentsSatsUsdPattern,
} }
impl MetricsTree_Market_Dca_ClassCostBasis { impl MetricsTree_Market_Dca_Class_CostBasis {
pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self { pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self {
Self { Self {
from_2015: CentsSatsUsdPattern::new(client.clone(), "dca_cost_basis_from_2015".to_string()), from_2015: CentsSatsUsdPattern::new(client.clone(), "dca_cost_basis_from_2015".to_string()),
@@ -5497,7 +5565,7 @@ impl MetricsTree_Market_Dca_ClassCostBasis {
} }
/// Metrics tree node. /// Metrics tree node.
pub struct MetricsTree_Market_Dca_ClassReturn { pub struct MetricsTree_Market_Dca_Class_R#return {
pub from_2015: BpsPercentRatioPattern, pub from_2015: BpsPercentRatioPattern,
pub from_2016: BpsPercentRatioPattern, pub from_2016: BpsPercentRatioPattern,
pub from_2017: BpsPercentRatioPattern, pub from_2017: BpsPercentRatioPattern,
@@ -5512,7 +5580,7 @@ pub struct MetricsTree_Market_Dca_ClassReturn {
pub from_2026: BpsPercentRatioPattern, pub from_2026: BpsPercentRatioPattern,
} }
impl MetricsTree_Market_Dca_ClassReturn { impl MetricsTree_Market_Dca_Class_R#return {
pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self { pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self {
Self { Self {
from_2015: BpsPercentRatioPattern::new(client.clone(), "dca_return_from_2015".to_string()), from_2015: BpsPercentRatioPattern::new(client.clone(), "dca_return_from_2015".to_string()),

View File

@@ -9,153 +9,153 @@ use super::time;
#[derive(Traversable)] #[derive(Traversable)]
pub struct Vecs<M: StorageMode = Rw> { pub struct Vecs<M: StorageMode = Rw> {
pub height_1h_ago: M::Stored<EagerVec<PcoVec<Height, Height>>>, pub _1h: M::Stored<EagerVec<PcoVec<Height, Height>>>,
pub height_24h_ago: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 1d pub _24h: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 1d
pub height_3d_ago: M::Stored<EagerVec<PcoVec<Height, Height>>>, pub _3d: M::Stored<EagerVec<PcoVec<Height, Height>>>,
pub height_1w_ago: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 7d pub _1w: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 7d
pub height_8d_ago: M::Stored<EagerVec<PcoVec<Height, Height>>>, pub _8d: M::Stored<EagerVec<PcoVec<Height, Height>>>,
pub height_9d_ago: M::Stored<EagerVec<PcoVec<Height, Height>>>, pub _9d: M::Stored<EagerVec<PcoVec<Height, Height>>>,
pub height_12d_ago: M::Stored<EagerVec<PcoVec<Height, Height>>>, pub _12d: M::Stored<EagerVec<PcoVec<Height, Height>>>,
pub height_13d_ago: M::Stored<EagerVec<PcoVec<Height, Height>>>, pub _13d: M::Stored<EagerVec<PcoVec<Height, Height>>>,
pub height_2w_ago: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 14d pub _2w: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 14d
pub height_21d_ago: M::Stored<EagerVec<PcoVec<Height, Height>>>, pub _21d: M::Stored<EagerVec<PcoVec<Height, Height>>>,
pub height_26d_ago: M::Stored<EagerVec<PcoVec<Height, Height>>>, pub _26d: M::Stored<EagerVec<PcoVec<Height, Height>>>,
pub height_1m_ago: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 30d pub _1m: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 30d
pub height_34d_ago: M::Stored<EagerVec<PcoVec<Height, Height>>>, pub _34d: M::Stored<EagerVec<PcoVec<Height, Height>>>,
pub height_55d_ago: M::Stored<EagerVec<PcoVec<Height, Height>>>, pub _55d: M::Stored<EagerVec<PcoVec<Height, Height>>>,
pub height_2m_ago: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 60d pub _2m: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 60d
pub height_9w_ago: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 63d pub _9w: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 63d
pub height_12w_ago: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 84d pub _12w: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 84d
pub height_89d_ago: M::Stored<EagerVec<PcoVec<Height, Height>>>, pub _89d: M::Stored<EagerVec<PcoVec<Height, Height>>>,
pub height_3m_ago: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 90d pub _3m: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 90d
pub height_14w_ago: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 98d pub _14w: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 98d
pub height_111d_ago: M::Stored<EagerVec<PcoVec<Height, Height>>>, pub _111d: M::Stored<EagerVec<PcoVec<Height, Height>>>,
pub height_144d_ago: M::Stored<EagerVec<PcoVec<Height, Height>>>, pub _144d: M::Stored<EagerVec<PcoVec<Height, Height>>>,
pub height_6m_ago: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 180d pub _6m: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 180d
pub height_26w_ago: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 182d pub _26w: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 182d
pub height_200d_ago: M::Stored<EagerVec<PcoVec<Height, Height>>>, pub _200d: M::Stored<EagerVec<PcoVec<Height, Height>>>,
pub height_9m_ago: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 270d pub _9m: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 270d
pub height_350d_ago: M::Stored<EagerVec<PcoVec<Height, Height>>>, pub _350d: M::Stored<EagerVec<PcoVec<Height, Height>>>,
pub height_12m_ago: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 360d pub _12m: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 360d
pub height_1y_ago: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 365d pub _1y: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 365d
pub height_14m_ago: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 420d pub _14m: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 420d
pub height_2y_ago: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 730d pub _2y: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 730d
pub height_26m_ago: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 780d pub _26m: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 780d
pub height_3y_ago: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 1095d pub _3y: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 1095d
pub height_200w_ago: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 1400d pub _200w: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 1400d
pub height_4y_ago: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 1460d pub _4y: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 1460d
pub height_5y_ago: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 1825d pub _5y: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 1825d
pub height_6y_ago: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 2190d pub _6y: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 2190d
pub height_8y_ago: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 2920d pub _8y: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 2920d
pub height_9y_ago: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 3285d pub _9y: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 3285d
pub height_10y_ago: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 3650d pub _10y: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 3650d
pub height_12y_ago: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 4380d pub _12y: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 4380d
pub height_14y_ago: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 5110d pub _14y: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 5110d
pub height_26y_ago: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 9490d pub _26y: M::Stored<EagerVec<PcoVec<Height, Height>>>, // 9490d
} }
impl Vecs { impl Vecs {
pub(crate) fn forced_import(db: &Database, version: Version) -> Result<Self> { pub(crate) fn forced_import(db: &Database, version: Version) -> Result<Self> {
Ok(Self { Ok(Self {
height_1h_ago: ImportableVec::forced_import(db, "height_1h_ago", version)?, _1h: ImportableVec::forced_import(db, "height_1h_ago", version)?,
height_24h_ago: ImportableVec::forced_import(db, "height_24h_ago", version)?, _24h: ImportableVec::forced_import(db, "height_24h_ago", version)?,
height_3d_ago: ImportableVec::forced_import(db, "height_3d_ago", version)?, _3d: ImportableVec::forced_import(db, "height_3d_ago", version)?,
height_1w_ago: ImportableVec::forced_import(db, "height_1w_ago", version)?, _1w: ImportableVec::forced_import(db, "height_1w_ago", version)?,
height_8d_ago: ImportableVec::forced_import(db, "height_8d_ago", version)?, _8d: ImportableVec::forced_import(db, "height_8d_ago", version)?,
height_9d_ago: ImportableVec::forced_import(db, "height_9d_ago", version)?, _9d: ImportableVec::forced_import(db, "height_9d_ago", version)?,
height_12d_ago: ImportableVec::forced_import(db, "height_12d_ago", version)?, _12d: ImportableVec::forced_import(db, "height_12d_ago", version)?,
height_13d_ago: ImportableVec::forced_import(db, "height_13d_ago", version)?, _13d: ImportableVec::forced_import(db, "height_13d_ago", version)?,
height_2w_ago: ImportableVec::forced_import(db, "height_2w_ago", version)?, _2w: ImportableVec::forced_import(db, "height_2w_ago", version)?,
height_21d_ago: ImportableVec::forced_import(db, "height_21d_ago", version)?, _21d: ImportableVec::forced_import(db, "height_21d_ago", version)?,
height_26d_ago: ImportableVec::forced_import(db, "height_26d_ago", version)?, _26d: ImportableVec::forced_import(db, "height_26d_ago", version)?,
height_1m_ago: ImportableVec::forced_import(db, "height_1m_ago", version)?, _1m: ImportableVec::forced_import(db, "height_1m_ago", version)?,
height_34d_ago: ImportableVec::forced_import(db, "height_34d_ago", version)?, _34d: ImportableVec::forced_import(db, "height_34d_ago", version)?,
height_55d_ago: ImportableVec::forced_import(db, "height_55d_ago", version)?, _55d: ImportableVec::forced_import(db, "height_55d_ago", version)?,
height_2m_ago: ImportableVec::forced_import(db, "height_2m_ago", version)?, _2m: ImportableVec::forced_import(db, "height_2m_ago", version)?,
height_9w_ago: ImportableVec::forced_import(db, "height_9w_ago", version)?, _9w: ImportableVec::forced_import(db, "height_9w_ago", version)?,
height_12w_ago: ImportableVec::forced_import(db, "height_12w_ago", version)?, _12w: ImportableVec::forced_import(db, "height_12w_ago", version)?,
height_89d_ago: ImportableVec::forced_import(db, "height_89d_ago", version)?, _89d: ImportableVec::forced_import(db, "height_89d_ago", version)?,
height_3m_ago: ImportableVec::forced_import(db, "height_3m_ago", version)?, _3m: ImportableVec::forced_import(db, "height_3m_ago", version)?,
height_14w_ago: ImportableVec::forced_import(db, "height_14w_ago", version)?, _14w: ImportableVec::forced_import(db, "height_14w_ago", version)?,
height_111d_ago: ImportableVec::forced_import(db, "height_111d_ago", version)?, _111d: ImportableVec::forced_import(db, "height_111d_ago", version)?,
height_144d_ago: ImportableVec::forced_import(db, "height_144d_ago", version)?, _144d: ImportableVec::forced_import(db, "height_144d_ago", version)?,
height_6m_ago: ImportableVec::forced_import(db, "height_6m_ago", version)?, _6m: ImportableVec::forced_import(db, "height_6m_ago", version)?,
height_26w_ago: ImportableVec::forced_import(db, "height_26w_ago", version)?, _26w: ImportableVec::forced_import(db, "height_26w_ago", version)?,
height_200d_ago: ImportableVec::forced_import(db, "height_200d_ago", version)?, _200d: ImportableVec::forced_import(db, "height_200d_ago", version)?,
height_9m_ago: ImportableVec::forced_import(db, "height_9m_ago", version)?, _9m: ImportableVec::forced_import(db, "height_9m_ago", version)?,
height_350d_ago: ImportableVec::forced_import(db, "height_350d_ago", version)?, _350d: ImportableVec::forced_import(db, "height_350d_ago", version)?,
height_12m_ago: ImportableVec::forced_import(db, "height_12m_ago", version)?, _12m: ImportableVec::forced_import(db, "height_12m_ago", version)?,
height_1y_ago: ImportableVec::forced_import(db, "height_1y_ago", version)?, _1y: ImportableVec::forced_import(db, "height_1y_ago", version)?,
height_14m_ago: ImportableVec::forced_import(db, "height_14m_ago", version)?, _14m: ImportableVec::forced_import(db, "height_14m_ago", version)?,
height_2y_ago: ImportableVec::forced_import(db, "height_2y_ago", version)?, _2y: ImportableVec::forced_import(db, "height_2y_ago", version)?,
height_26m_ago: ImportableVec::forced_import(db, "height_26m_ago", version)?, _26m: ImportableVec::forced_import(db, "height_26m_ago", version)?,
height_3y_ago: ImportableVec::forced_import(db, "height_3y_ago", version)?, _3y: ImportableVec::forced_import(db, "height_3y_ago", version)?,
height_200w_ago: ImportableVec::forced_import(db, "height_200w_ago", version)?, _200w: ImportableVec::forced_import(db, "height_200w_ago", version)?,
height_4y_ago: ImportableVec::forced_import(db, "height_4y_ago", version)?, _4y: ImportableVec::forced_import(db, "height_4y_ago", version)?,
height_5y_ago: ImportableVec::forced_import(db, "height_5y_ago", version)?, _5y: ImportableVec::forced_import(db, "height_5y_ago", version)?,
height_6y_ago: ImportableVec::forced_import(db, "height_6y_ago", version)?, _6y: ImportableVec::forced_import(db, "height_6y_ago", version)?,
height_8y_ago: ImportableVec::forced_import(db, "height_8y_ago", version)?, _8y: ImportableVec::forced_import(db, "height_8y_ago", version)?,
height_9y_ago: ImportableVec::forced_import(db, "height_9y_ago", version)?, _9y: ImportableVec::forced_import(db, "height_9y_ago", version)?,
height_10y_ago: ImportableVec::forced_import(db, "height_10y_ago", version)?, _10y: ImportableVec::forced_import(db, "height_10y_ago", version)?,
height_12y_ago: ImportableVec::forced_import(db, "height_12y_ago", version)?, _12y: ImportableVec::forced_import(db, "height_12y_ago", version)?,
height_14y_ago: ImportableVec::forced_import(db, "height_14y_ago", version)?, _14y: ImportableVec::forced_import(db, "height_14y_ago", version)?,
height_26y_ago: ImportableVec::forced_import(db, "height_26y_ago", version)?, _26y: ImportableVec::forced_import(db, "height_26y_ago", version)?,
}) })
} }
pub fn window_starts(&self) -> WindowStarts<'_> { pub fn window_starts(&self) -> WindowStarts<'_> {
WindowStarts { WindowStarts {
_24h: &self.height_24h_ago, _24h: &self._24h,
_1w: &self.height_1w_ago, _1w: &self._1w,
_1m: &self.height_1m_ago, _1m: &self._1m,
_1y: &self.height_1y_ago, _1y: &self._1y,
} }
} }
pub fn start_vec(&self, days: usize) -> &EagerVec<PcoVec<Height, Height>> { pub fn start_vec(&self, days: usize) -> &EagerVec<PcoVec<Height, Height>> {
match days { match days {
1 => &self.height_24h_ago, 1 => &self._24h,
3 => &self.height_3d_ago, 3 => &self._3d,
7 => &self.height_1w_ago, 7 => &self._1w,
8 => &self.height_8d_ago, 8 => &self._8d,
9 => &self.height_9d_ago, 9 => &self._9d,
12 => &self.height_12d_ago, 12 => &self._12d,
13 => &self.height_13d_ago, 13 => &self._13d,
14 => &self.height_2w_ago, 14 => &self._2w,
21 => &self.height_21d_ago, 21 => &self._21d,
26 => &self.height_26d_ago, 26 => &self._26d,
30 => &self.height_1m_ago, 30 => &self._1m,
34 => &self.height_34d_ago, 34 => &self._34d,
55 => &self.height_55d_ago, 55 => &self._55d,
60 => &self.height_2m_ago, 60 => &self._2m,
63 => &self.height_9w_ago, 63 => &self._9w,
84 => &self.height_12w_ago, 84 => &self._12w,
89 => &self.height_89d_ago, 89 => &self._89d,
90 => &self.height_3m_ago, 90 => &self._3m,
98 => &self.height_14w_ago, 98 => &self._14w,
111 => &self.height_111d_ago, 111 => &self._111d,
144 => &self.height_144d_ago, 144 => &self._144d,
180 => &self.height_6m_ago, 180 => &self._6m,
182 => &self.height_26w_ago, 182 => &self._26w,
200 => &self.height_200d_ago, 200 => &self._200d,
270 => &self.height_9m_ago, 270 => &self._9m,
350 => &self.height_350d_ago, 350 => &self._350d,
360 => &self.height_12m_ago, 360 => &self._12m,
365 => &self.height_1y_ago, 365 => &self._1y,
420 => &self.height_14m_ago, 420 => &self._14m,
730 => &self.height_2y_ago, 730 => &self._2y,
780 => &self.height_26m_ago, 780 => &self._26m,
1095 => &self.height_3y_ago, 1095 => &self._3y,
1400 => &self.height_200w_ago, 1400 => &self._200w,
1460 => &self.height_4y_ago, 1460 => &self._4y,
1825 => &self.height_5y_ago, 1825 => &self._5y,
2190 => &self.height_6y_ago, 2190 => &self._6y,
2920 => &self.height_8y_ago, 2920 => &self._8y,
3285 => &self.height_9y_ago, 3285 => &self._9y,
3650 => &self.height_10y_ago, 3650 => &self._10y,
4380 => &self.height_12y_ago, 4380 => &self._12y,
5110 => &self.height_14y_ago, 5110 => &self._14y,
9490 => &self.height_26y_ago, 9490 => &self._26y,
_ => panic!("No start vec for {days} days"), _ => panic!("No start vec for {days} days"),
} }
} }
@@ -167,67 +167,67 @@ impl Vecs {
exit: &Exit, exit: &Exit,
) -> Result<()> { ) -> Result<()> {
self.compute_rolling_start_hours(time, starting_indexes, exit, 1, |s| { self.compute_rolling_start_hours(time, starting_indexes, exit, 1, |s| {
&mut s.height_1h_ago &mut s._1h
})?; })?;
self.compute_rolling_start(time, starting_indexes, exit, 1, |s| &mut s.height_24h_ago)?; self.compute_rolling_start(time, starting_indexes, exit, 1, |s| &mut s._24h)?;
self.compute_rolling_start(time, starting_indexes, exit, 3, |s| &mut s.height_3d_ago)?; self.compute_rolling_start(time, starting_indexes, exit, 3, |s| &mut s._3d)?;
self.compute_rolling_start(time, starting_indexes, exit, 7, |s| &mut s.height_1w_ago)?; self.compute_rolling_start(time, starting_indexes, exit, 7, |s| &mut s._1w)?;
self.compute_rolling_start(time, starting_indexes, exit, 8, |s| &mut s.height_8d_ago)?; self.compute_rolling_start(time, starting_indexes, exit, 8, |s| &mut s._8d)?;
self.compute_rolling_start(time, starting_indexes, exit, 9, |s| &mut s.height_9d_ago)?; self.compute_rolling_start(time, starting_indexes, exit, 9, |s| &mut s._9d)?;
self.compute_rolling_start(time, starting_indexes, exit, 12, |s| &mut s.height_12d_ago)?; self.compute_rolling_start(time, starting_indexes, exit, 12, |s| &mut s._12d)?;
self.compute_rolling_start(time, starting_indexes, exit, 13, |s| &mut s.height_13d_ago)?; self.compute_rolling_start(time, starting_indexes, exit, 13, |s| &mut s._13d)?;
self.compute_rolling_start(time, starting_indexes, exit, 14, |s| &mut s.height_2w_ago)?; self.compute_rolling_start(time, starting_indexes, exit, 14, |s| &mut s._2w)?;
self.compute_rolling_start(time, starting_indexes, exit, 21, |s| &mut s.height_21d_ago)?; self.compute_rolling_start(time, starting_indexes, exit, 21, |s| &mut s._21d)?;
self.compute_rolling_start(time, starting_indexes, exit, 26, |s| &mut s.height_26d_ago)?; self.compute_rolling_start(time, starting_indexes, exit, 26, |s| &mut s._26d)?;
self.compute_rolling_start(time, starting_indexes, exit, 30, |s| &mut s.height_1m_ago)?; self.compute_rolling_start(time, starting_indexes, exit, 30, |s| &mut s._1m)?;
self.compute_rolling_start(time, starting_indexes, exit, 34, |s| &mut s.height_34d_ago)?; self.compute_rolling_start(time, starting_indexes, exit, 34, |s| &mut s._34d)?;
self.compute_rolling_start(time, starting_indexes, exit, 55, |s| &mut s.height_55d_ago)?; self.compute_rolling_start(time, starting_indexes, exit, 55, |s| &mut s._55d)?;
self.compute_rolling_start(time, starting_indexes, exit, 60, |s| &mut s.height_2m_ago)?; self.compute_rolling_start(time, starting_indexes, exit, 60, |s| &mut s._2m)?;
self.compute_rolling_start(time, starting_indexes, exit, 63, |s| &mut s.height_9w_ago)?; self.compute_rolling_start(time, starting_indexes, exit, 63, |s| &mut s._9w)?;
self.compute_rolling_start(time, starting_indexes, exit, 84, |s| &mut s.height_12w_ago)?; self.compute_rolling_start(time, starting_indexes, exit, 84, |s| &mut s._12w)?;
self.compute_rolling_start(time, starting_indexes, exit, 89, |s| &mut s.height_89d_ago)?; self.compute_rolling_start(time, starting_indexes, exit, 89, |s| &mut s._89d)?;
self.compute_rolling_start(time, starting_indexes, exit, 90, |s| &mut s.height_3m_ago)?; self.compute_rolling_start(time, starting_indexes, exit, 90, |s| &mut s._3m)?;
self.compute_rolling_start(time, starting_indexes, exit, 98, |s| &mut s.height_14w_ago)?; self.compute_rolling_start(time, starting_indexes, exit, 98, |s| &mut s._14w)?;
self.compute_rolling_start(time, starting_indexes, exit, 111, |s| { self.compute_rolling_start(time, starting_indexes, exit, 111, |s| {
&mut s.height_111d_ago &mut s._111d
})?; })?;
self.compute_rolling_start(time, starting_indexes, exit, 144, |s| { self.compute_rolling_start(time, starting_indexes, exit, 144, |s| {
&mut s.height_144d_ago &mut s._144d
})?; })?;
self.compute_rolling_start(time, starting_indexes, exit, 180, |s| &mut s.height_6m_ago)?; self.compute_rolling_start(time, starting_indexes, exit, 180, |s| &mut s._6m)?;
self.compute_rolling_start(time, starting_indexes, exit, 182, |s| &mut s.height_26w_ago)?; self.compute_rolling_start(time, starting_indexes, exit, 182, |s| &mut s._26w)?;
self.compute_rolling_start(time, starting_indexes, exit, 200, |s| { self.compute_rolling_start(time, starting_indexes, exit, 200, |s| {
&mut s.height_200d_ago &mut s._200d
})?; })?;
self.compute_rolling_start(time, starting_indexes, exit, 270, |s| &mut s.height_9m_ago)?; self.compute_rolling_start(time, starting_indexes, exit, 270, |s| &mut s._9m)?;
self.compute_rolling_start(time, starting_indexes, exit, 350, |s| { self.compute_rolling_start(time, starting_indexes, exit, 350, |s| {
&mut s.height_350d_ago &mut s._350d
})?; })?;
self.compute_rolling_start(time, starting_indexes, exit, 360, |s| &mut s.height_12m_ago)?; self.compute_rolling_start(time, starting_indexes, exit, 360, |s| &mut s._12m)?;
self.compute_rolling_start(time, starting_indexes, exit, 365, |s| &mut s.height_1y_ago)?; self.compute_rolling_start(time, starting_indexes, exit, 365, |s| &mut s._1y)?;
self.compute_rolling_start(time, starting_indexes, exit, 420, |s| &mut s.height_14m_ago)?; self.compute_rolling_start(time, starting_indexes, exit, 420, |s| &mut s._14m)?;
self.compute_rolling_start(time, starting_indexes, exit, 730, |s| &mut s.height_2y_ago)?; self.compute_rolling_start(time, starting_indexes, exit, 730, |s| &mut s._2y)?;
self.compute_rolling_start(time, starting_indexes, exit, 780, |s| &mut s.height_26m_ago)?; self.compute_rolling_start(time, starting_indexes, exit, 780, |s| &mut s._26m)?;
self.compute_rolling_start(time, starting_indexes, exit, 1095, |s| &mut s.height_3y_ago)?; self.compute_rolling_start(time, starting_indexes, exit, 1095, |s| &mut s._3y)?;
self.compute_rolling_start(time, starting_indexes, exit, 1400, |s| { self.compute_rolling_start(time, starting_indexes, exit, 1400, |s| {
&mut s.height_200w_ago &mut s._200w
})?; })?;
self.compute_rolling_start(time, starting_indexes, exit, 1460, |s| &mut s.height_4y_ago)?; self.compute_rolling_start(time, starting_indexes, exit, 1460, |s| &mut s._4y)?;
self.compute_rolling_start(time, starting_indexes, exit, 1825, |s| &mut s.height_5y_ago)?; self.compute_rolling_start(time, starting_indexes, exit, 1825, |s| &mut s._5y)?;
self.compute_rolling_start(time, starting_indexes, exit, 2190, |s| &mut s.height_6y_ago)?; self.compute_rolling_start(time, starting_indexes, exit, 2190, |s| &mut s._6y)?;
self.compute_rolling_start(time, starting_indexes, exit, 2920, |s| &mut s.height_8y_ago)?; self.compute_rolling_start(time, starting_indexes, exit, 2920, |s| &mut s._8y)?;
self.compute_rolling_start(time, starting_indexes, exit, 3285, |s| &mut s.height_9y_ago)?; self.compute_rolling_start(time, starting_indexes, exit, 3285, |s| &mut s._9y)?;
self.compute_rolling_start(time, starting_indexes, exit, 3650, |s| { self.compute_rolling_start(time, starting_indexes, exit, 3650, |s| {
&mut s.height_10y_ago &mut s._10y
})?; })?;
self.compute_rolling_start(time, starting_indexes, exit, 4380, |s| { self.compute_rolling_start(time, starting_indexes, exit, 4380, |s| {
&mut s.height_12y_ago &mut s._12y
})?; })?;
self.compute_rolling_start(time, starting_indexes, exit, 5110, |s| { self.compute_rolling_start(time, starting_indexes, exit, 5110, |s| {
&mut s.height_14y_ago &mut s._14y
})?; })?;
self.compute_rolling_start(time, starting_indexes, exit, 9490, |s| { self.compute_rolling_start(time, starting_indexes, exit, 9490, |s| {
&mut s.height_26y_ago &mut s._26y
})?; })?;
Ok(()) Ok(())

View File

@@ -16,7 +16,7 @@ impl Vecs {
) -> Result<()> { ) -> Result<()> {
self.vocdd_median_1y.compute_rolling_median_from_starts( self.vocdd_median_1y.compute_rolling_median_from_starts(
starting_indexes.height, starting_indexes.height,
&blocks.lookback.height_1y_ago, &blocks.lookback._1y,
&value.vocdd.raw.height, &value.vocdd.raw.height,
exit, exit,
)?; )?;

View File

@@ -106,7 +106,7 @@ impl ActivityCountVecs {
}) })
} }
pub(crate) fn min_stateful_height(&self) -> usize { pub(crate) fn min_stateful_len(&self) -> usize {
self.reactivated self.reactivated
.height .height
.len() .len()
@@ -197,10 +197,10 @@ impl AddressTypeToActivityCountVecs {
)) ))
} }
pub(crate) fn min_stateful_height(&self) -> usize { pub(crate) fn min_stateful_len(&self) -> usize {
self.0 self.0
.values() .values()
.map(|v| v.min_stateful_height()) .map(|v| v.min_stateful_len())
.min() .min()
.unwrap_or(0) .unwrap_or(0)
} }
@@ -272,10 +272,10 @@ impl AddressActivityVecs {
}) })
} }
pub(crate) fn min_stateful_height(&self) -> usize { pub(crate) fn min_stateful_len(&self) -> usize {
self.all self.all
.min_stateful_height() .min_stateful_len()
.min(self.by_addresstype.min_stateful_height()) .min(self.by_addresstype.min_stateful_len())
} }
pub(crate) fn par_iter_height_mut( pub(crate) fn par_iter_height_mut(

View File

@@ -125,7 +125,7 @@ impl AddressTypeToAddrCountVecs {
)?)) )?))
} }
pub(crate) fn min_stateful_height(&self) -> usize { pub(crate) fn min_stateful_len(&self) -> usize {
self.0.values().map(|v| v.height.len()).min().unwrap() self.0.values().map(|v| v.height.len()).min().unwrap()
} }
@@ -181,8 +181,8 @@ impl AddrCountsVecs {
}) })
} }
pub(crate) fn min_stateful_height(&self) -> usize { pub(crate) fn min_stateful_len(&self) -> usize {
self.all.height.len().min(self.by_addresstype.min_stateful_height()) self.all.height.len().min(self.by_addresstype.min_stateful_len())
} }
pub(crate) fn par_iter_height_mut( pub(crate) fn par_iter_height_mut(

View File

@@ -98,7 +98,7 @@ impl AddressCohorts {
self.par_iter_mut().try_for_each(|v| { self.par_iter_mut().try_for_each(|v| {
v.addr_count_delta.compute( v.addr_count_delta.compute(
starting_indexes.height, starting_indexes.height,
&blocks.lookback.height_1m_ago, &blocks.lookback._1m,
&v.addr_count.height, &v.addr_count.height,
exit, exit,
) )
@@ -141,9 +141,9 @@ impl AddressCohorts {
} }
/// Get minimum height from all separate cohorts' height-indexed vectors. /// Get minimum height from all separate cohorts' height-indexed vectors.
pub(crate) fn min_separate_stateful_height_len(&self) -> Height { pub(crate) fn min_stateful_len(&self) -> Height {
self.iter_separate() self.iter_separate()
.map(|v| Height::from(v.min_stateful_height_len())) .map(|v| Height::from(v.min_stateful_len()))
.min() .min()
.unwrap_or_default() .unwrap_or_default()
} }

View File

@@ -102,11 +102,11 @@ impl Filtered for AddressCohortVecs {
} }
impl DynCohortVecs for AddressCohortVecs { impl DynCohortVecs for AddressCohortVecs {
fn min_stateful_height_len(&self) -> usize { fn min_stateful_len(&self) -> usize {
self.addr_count self.addr_count
.height .height
.len() .len()
.min(self.metrics.min_stateful_height_len()) .min(self.metrics.min_stateful_len())
} }
fn reset_state_starting_height(&mut self) { fn reset_state_starting_height(&mut self) {

View File

@@ -9,7 +9,7 @@ use crate::{blocks, prices};
/// This trait enables heterogeneous cohort processing via trait objects. /// This trait enables heterogeneous cohort processing via trait objects.
pub trait DynCohortVecs: Send + Sync { pub trait DynCohortVecs: Send + Sync {
/// Get minimum length across height-indexed vectors written in block loop. /// Get minimum length across height-indexed vectors written in block loop.
fn min_stateful_height_len(&self) -> usize; fn min_stateful_len(&self) -> usize;
/// Reset the starting height for state tracking. /// Reset the starting height for state tracking.
fn reset_state_starting_height(&mut self); fn reset_state_starting_height(&mut self);

View File

@@ -712,10 +712,9 @@ impl UTXOCohorts<Rw> {
.try_for_each(|v| v.write_state(height, cleanup)) .try_for_each(|v| v.write_state(height, cleanup))
} }
/// Get minimum height from all separate cohorts' + profitability + overlapping realized height-indexed vectors. pub(crate) fn min_stateful_len(&self) -> Height {
pub(crate) fn min_separate_stateful_height_len(&self) -> Height {
self.iter_separate() self.iter_separate()
.map(|v| Height::from(v.min_stateful_height_len())) .map(|v| Height::from(v.min_stateful_len()))
.chain( .chain(
self.matured self.matured
.iter() .iter()
@@ -723,15 +722,15 @@ impl UTXOCohorts<Rw> {
) )
.min() .min()
.unwrap_or_default() .unwrap_or_default()
.min(Height::from(self.profitability.min_stateful_height_len())) .min(Height::from(self.profitability.min_stateful_len()))
.min(Height::from( .min(Height::from(
self.all.metrics.realized.min_stateful_height_len(), self.all.metrics.realized.min_stateful_len(),
)) ))
.min(Height::from( .min(Height::from(
self.sth.metrics.realized.min_stateful_height_len(), self.sth.metrics.realized.min_stateful_len(),
)) ))
.min(Height::from( .min(Height::from(
self.lth.metrics.realized.min_stateful_height_len(), self.lth.metrics.realized.min_stateful_len(),
)) ))
} }

View File

@@ -14,8 +14,8 @@ impl Filtered for UTXOCohortVecs<CoreCohortMetrics> {
} }
impl DynCohortVecs for UTXOCohortVecs<CoreCohortMetrics> { impl DynCohortVecs for UTXOCohortVecs<CoreCohortMetrics> {
fn min_stateful_height_len(&self) -> usize { fn min_stateful_len(&self) -> usize {
self.metrics.min_stateful_height_len() self.metrics.min_stateful_len()
} }
fn reset_state_starting_height(&mut self) { fn reset_state_starting_height(&mut self) {

View File

@@ -18,8 +18,8 @@ impl Filtered for UTXOCohortVecs<MinimalCohortMetrics> {
} }
impl DynCohortVecs for UTXOCohortVecs<MinimalCohortMetrics> { impl DynCohortVecs for UTXOCohortVecs<MinimalCohortMetrics> {
fn min_stateful_height_len(&self) -> usize { fn min_stateful_len(&self) -> usize {
self.metrics.min_stateful_height_len() self.metrics.min_stateful_len()
} }
fn reset_state_starting_height(&mut self) { fn reset_state_starting_height(&mut self) {

View File

@@ -116,8 +116,8 @@ impl<M: CohortMetricsBase + Traversable> Filtered for UTXOCohortVecs<M> {
} }
impl<M: CohortMetricsBase + Traversable> DynCohortVecs for UTXOCohortVecs<M> { impl<M: CohortMetricsBase + Traversable> DynCohortVecs for UTXOCohortVecs<M> {
fn min_stateful_height_len(&self) -> usize { fn min_stateful_len(&self) -> usize {
self.metrics.min_stateful_height_len() self.metrics.min_stateful_len()
} }
fn reset_state_starting_height(&mut self) { fn reset_state_starting_height(&mut self) {

View File

@@ -14,8 +14,8 @@ impl Filtered for UTXOCohortVecs<TypeCohortMetrics> {
} }
impl DynCohortVecs for UTXOCohortVecs<TypeCohortMetrics> { impl DynCohortVecs for UTXOCohortVecs<TypeCohortMetrics> {
fn min_stateful_height_len(&self) -> usize { fn min_stateful_len(&self) -> usize {
self.metrics.min_stateful_height_len() self.metrics.min_stateful_len()
} }
fn reset_state_starting_height(&mut self) { fn reset_state_starting_height(&mut self) {

View File

@@ -111,13 +111,13 @@ impl ActivityCore {
) -> Result<()> { ) -> Result<()> {
self.sent.sum.compute_rolling_sum( self.sent.sum.compute_rolling_sum(
starting_indexes.height, starting_indexes.height,
&blocks.lookback.height_24h_ago, &blocks.lookback._24h,
&self.sent.raw.height, &self.sent.raw.height,
exit, exit,
)?; )?;
self.coindays_destroyed.sum.compute_rolling_sum( self.coindays_destroyed.sum.compute_rolling_sum(
starting_indexes.height, starting_indexes.height,
&blocks.lookback.height_24h_ago, &blocks.lookback._24h,
&self.coindays_destroyed.raw.height, &self.coindays_destroyed.raw.height,
exit, exit,
)?; )?;
@@ -140,14 +140,14 @@ impl ActivityCore {
self.sent_in_profit.sum.compute_rolling_sum( self.sent_in_profit.sum.compute_rolling_sum(
starting_indexes.height, starting_indexes.height,
&blocks.lookback.height_24h_ago, &blocks.lookback._24h,
&self.sent_in_profit.raw.sats.height, &self.sent_in_profit.raw.sats.height,
&self.sent_in_profit.raw.cents.height, &self.sent_in_profit.raw.cents.height,
exit, exit,
)?; )?;
self.sent_in_loss.sum.compute_rolling_sum( self.sent_in_loss.sum.compute_rolling_sum(
starting_indexes.height, starting_indexes.height,
&blocks.lookback.height_24h_ago, &blocks.lookback._24h,
&self.sent_in_loss.raw.sats.height, &self.sent_in_loss.raw.sats.height,
&self.sent_in_loss.raw.cents.height, &self.sent_in_loss.raw.cents.height,
exit, exit,

View File

@@ -55,14 +55,14 @@ impl CohortMetricsBase for AllCohortMetrics {
Ok(()) Ok(())
} }
fn min_stateful_height_len(&self) -> usize { fn min_stateful_len(&self) -> usize {
self.supply self.supply
.min_len() .min_len()
.min(self.outputs.min_len()) .min(self.outputs.min_len())
.min(self.activity.min_len()) .min(self.activity.min_len())
.min(self.realized.min_stateful_height_len()) .min(self.realized.min_stateful_len())
.min(self.unrealized.min_stateful_height_len()) .min(self.unrealized.min_stateful_len())
.min(self.cost_basis.min_stateful_height_len()) .min(self.cost_basis.min_stateful_len())
} }
fn collect_all_vecs_mut(&mut self) -> Vec<&mut dyn AnyStoredVec> { fn collect_all_vecs_mut(&mut self) -> Vec<&mut dyn AnyStoredVec> {

View File

@@ -37,13 +37,13 @@ impl CoreCohortMetrics {
}) })
} }
pub(crate) fn min_stateful_height_len(&self) -> usize { pub(crate) fn min_stateful_len(&self) -> usize {
self.supply self.supply
.min_len() .min_len()
.min(self.outputs.min_len()) .min(self.outputs.min_len())
.min(self.activity.min_len()) .min(self.activity.min_len())
.min(self.realized.min_stateful_height_len()) .min(self.realized.min_stateful_len())
.min(self.unrealized.min_stateful_height_len()) .min(self.unrealized.min_stateful_len())
} }
pub(crate) fn validate_computed_versions(&mut self, base_version: Version) -> Result<()> { pub(crate) fn validate_computed_versions(&mut self, base_version: Version) -> Result<()> {

View File

@@ -51,14 +51,14 @@ impl CohortMetricsBase for ExtendedCohortMetrics {
Ok(()) Ok(())
} }
fn min_stateful_height_len(&self) -> usize { fn min_stateful_len(&self) -> usize {
self.supply self.supply
.min_len() .min_len()
.min(self.outputs.min_len()) .min(self.outputs.min_len())
.min(self.activity.min_len()) .min(self.activity.min_len())
.min(self.realized.min_stateful_height_len()) .min(self.realized.min_stateful_len())
.min(self.unrealized.min_stateful_height_len()) .min(self.unrealized.min_stateful_len())
.min(self.cost_basis.min_stateful_height_len()) .min(self.cost_basis.min_stateful_len())
} }
fn collect_all_vecs_mut(&mut self) -> Vec<&mut dyn AnyStoredVec> { fn collect_all_vecs_mut(&mut self) -> Vec<&mut dyn AnyStoredVec> {

View File

@@ -37,8 +37,8 @@ impl CohortMetricsBase for ExtendedAdjustedCohortMetrics {
self.inner.validate_computed_versions(base_version) self.inner.validate_computed_versions(base_version)
} }
fn min_stateful_height_len(&self) -> usize { fn min_stateful_len(&self) -> usize {
self.inner.min_stateful_height_len() self.inner.min_stateful_len()
} }
fn collect_all_vecs_mut(&mut self) -> Vec<&mut dyn AnyStoredVec> { fn collect_all_vecs_mut(&mut self) -> Vec<&mut dyn AnyStoredVec> {

View File

@@ -33,11 +33,11 @@ impl MinimalCohortMetrics {
}) })
} }
pub(crate) fn min_stateful_height_len(&self) -> usize { pub(crate) fn min_stateful_len(&self) -> usize {
self.supply self.supply
.min_len() .min_len()
.min(self.outputs.min_len()) .min(self.outputs.min_len())
.min(self.realized.min_stateful_height_len()) .min(self.realized.min_stateful_len())
} }
pub(crate) fn collect_all_vecs_mut(&mut self) -> Vec<&mut dyn AnyStoredVec> { pub(crate) fn collect_all_vecs_mut(&mut self) -> Vec<&mut dyn AnyStoredVec> {

View File

@@ -34,12 +34,12 @@ impl TypeCohortMetrics {
}) })
} }
pub(crate) fn min_stateful_height_len(&self) -> usize { pub(crate) fn min_stateful_len(&self) -> usize {
self.supply self.supply
.min_len() .min_len()
.min(self.outputs.min_len()) .min(self.outputs.min_len())
.min(self.realized.min_stateful_height_len()) .min(self.realized.min_stateful_len())
.min(self.unrealized.min_stateful_height_len()) .min(self.unrealized.min_stateful_len())
} }
pub(crate) fn collect_all_vecs_mut(&mut self) -> Vec<&mut dyn AnyStoredVec> { pub(crate) fn collect_all_vecs_mut(&mut self) -> Vec<&mut dyn AnyStoredVec> {

View File

@@ -44,7 +44,7 @@ impl CostBasis {
}) })
} }
pub(crate) fn min_stateful_height_len(&self) -> usize { pub(crate) fn min_stateful_len(&self) -> usize {
self.min self.min
.cents .cents
.height .height

View File

@@ -155,13 +155,13 @@ pub trait CohortMetricsBase: CohortMetricsState<Realized = RealizedState, CostBa
fn collect_all_vecs_mut(&mut self) -> Vec<&mut dyn AnyStoredVec>; fn collect_all_vecs_mut(&mut self) -> Vec<&mut dyn AnyStoredVec>;
fn min_stateful_height_len(&self) -> usize { fn min_stateful_len(&self) -> usize {
self.supply() self.supply()
.min_len() .min_len()
.min(self.outputs().min_len()) .min(self.outputs().min_len())
.min(self.activity().min_len()) .min(self.activity().min_len())
.min(self.realized().min_stateful_height_len()) .min(self.realized().min_stateful_len())
.min(self.unrealized().min_stateful_height_len()) .min(self.unrealized().min_stateful_len())
} }
fn truncate_push(&mut self, height: Height, state: &CohortState<RealizedState, CostBasisData<WithCapital>>) -> Result<()> { fn truncate_push(&mut self, height: Height, state: &CohortState<RealizedState, CostBasisData<WithCapital>>) -> Result<()> {

View File

@@ -55,7 +55,7 @@ impl OutputsFull {
) -> Result<()> { ) -> Result<()> {
self.utxo_count_delta.compute( self.utxo_count_delta.compute(
starting_indexes.height, starting_indexes.height,
&blocks.lookback.height_1m_ago, &blocks.lookback._1m,
&self.base.utxo_count.height, &self.base.utxo_count.height,
exit, exit,
)?; )?;

View File

@@ -72,7 +72,7 @@ pub struct ProfitabilityMetrics<M: StorageMode = Rw> {
} }
impl<M: StorageMode> ProfitabilityMetrics<M> { impl<M: StorageMode> ProfitabilityMetrics<M> {
pub(crate) fn min_stateful_height_len(&self) -> usize { pub(crate) fn min_stateful_len(&self) -> usize {
self.range.iter() self.range.iter()
.chain(self.profit.iter()) .chain(self.profit.iter())
.chain(self.loss.iter()) .chain(self.loss.iter())

View File

@@ -74,8 +74,8 @@ impl RealizedCore {
}) })
} }
pub(crate) fn min_stateful_height_len(&self) -> usize { pub(crate) fn min_stateful_len(&self) -> usize {
self.minimal.min_stateful_height_len() self.minimal.min_stateful_len()
} }
pub(crate) fn truncate_push(&mut self, height: Height, state: &CohortState<impl RealizedOps, impl CostBasisOps>) -> Result<()> { pub(crate) fn truncate_push(&mut self, height: Height, state: &CohortState<impl RealizedOps, impl CostBasisOps>) -> Result<()> {
@@ -149,14 +149,14 @@ impl RealizedCore {
self.cap_delta.compute( self.cap_delta.compute(
starting_indexes.height, starting_indexes.height,
&blocks.lookback.height_1m_ago, &blocks.lookback._1m,
&self.minimal.cap.cents.height, &self.minimal.cap.cents.height,
exit, exit,
)?; )?;
self.net_pnl.sum.compute_rolling_sum( self.net_pnl.sum.compute_rolling_sum(
starting_indexes.height, starting_indexes.height,
&blocks.lookback.height_24h_ago, &blocks.lookback._24h,
&self.net_pnl.raw.height, &self.net_pnl.raw.height,
exit, exit,
)?; )?;

View File

@@ -263,10 +263,11 @@ impl RealizedFull {
}) })
} }
pub(crate) fn min_stateful_height_len(&self) -> usize { pub(crate) fn min_stateful_len(&self) -> usize {
self.core self.profit
.min_stateful_height_len() .value_created
.min(self.profit.value_created.height.len()) .height
.len()
.min(self.profit.value_destroyed.height.len()) .min(self.profit.value_destroyed.height.len())
.min(self.loss.value_created.height.len()) .min(self.loss.value_created.height.len())
.min(self.loss.value_destroyed.height.len()) .min(self.loss.value_destroyed.height.len())
@@ -541,7 +542,7 @@ impl RealizedFull {
// Net PnL delta (1m base + 24h/1w/1y extended) // Net PnL delta (1m base + 24h/1w/1y extended)
self.net_pnl.delta.compute( self.net_pnl.delta.compute(
starting_indexes.height, starting_indexes.height,
&blocks.lookback.height_1m_ago, &blocks.lookback._1m,
&self.net_pnl.cumulative.height, &self.net_pnl.cumulative.height,
exit, exit,
)?; )?;

View File

@@ -69,7 +69,7 @@ impl RealizedMinimal {
}) })
} }
pub(crate) fn min_stateful_height_len(&self) -> usize { pub(crate) fn min_stateful_len(&self) -> usize {
self.cap self.cap
.cents .cents
.height .height
@@ -129,25 +129,25 @@ impl RealizedMinimal {
) -> Result<()> { ) -> Result<()> {
self.profit.sum.compute_rolling_sum( self.profit.sum.compute_rolling_sum(
starting_indexes.height, starting_indexes.height,
&blocks.lookback.height_24h_ago, &blocks.lookback._24h,
&self.profit.raw.cents.height, &self.profit.raw.cents.height,
exit, exit,
)?; )?;
self.loss.sum.compute_rolling_sum( self.loss.sum.compute_rolling_sum(
starting_indexes.height, starting_indexes.height,
&blocks.lookback.height_24h_ago, &blocks.lookback._24h,
&self.loss.raw.cents.height, &self.loss.raw.cents.height,
exit, exit,
)?; )?;
self.sopr.value_created.sum.compute_rolling_sum( self.sopr.value_created.sum.compute_rolling_sum(
starting_indexes.height, starting_indexes.height,
&blocks.lookback.height_24h_ago, &blocks.lookback._24h,
&self.sopr.value_created.raw.height, &self.sopr.value_created.raw.height,
exit, exit,
)?; )?;
self.sopr.value_destroyed.sum.compute_rolling_sum( self.sopr.value_destroyed.sum.compute_rolling_sum(
starting_indexes.height, starting_indexes.height,
&blocks.lookback.height_24h_ago, &blocks.lookback._24h,
&self.sopr.value_destroyed.raw.height, &self.sopr.value_destroyed.raw.height,
exit, exit,
)?; )?;

View File

@@ -22,7 +22,7 @@ use crate::{blocks, distribution::state::{WithCapital, CohortState, CostBasisDat
pub trait RealizedLike: Send + Sync { pub trait RealizedLike: Send + Sync {
fn as_core(&self) -> &RealizedCore; fn as_core(&self) -> &RealizedCore;
fn as_core_mut(&mut self) -> &mut RealizedCore; fn as_core_mut(&mut self) -> &mut RealizedCore;
fn min_stateful_height_len(&self) -> usize; fn min_stateful_len(&self) -> usize;
fn truncate_push(&mut self, height: Height, state: &CohortState<RealizedState, CostBasisData<WithCapital>>) -> Result<()>; fn truncate_push(&mut self, height: Height, state: &CohortState<RealizedState, CostBasisData<WithCapital>>) -> Result<()>;
fn compute_rest_part1(&mut self, blocks: &blocks::Vecs, starting_indexes: &Indexes, exit: &Exit) -> Result<()>; fn compute_rest_part1(&mut self, blocks: &blocks::Vecs, starting_indexes: &Indexes, exit: &Exit) -> Result<()>;
fn compute_from_stateful( fn compute_from_stateful(
@@ -36,7 +36,7 @@ pub trait RealizedLike: Send + Sync {
impl RealizedLike for RealizedCore { impl RealizedLike for RealizedCore {
fn as_core(&self) -> &RealizedCore { self } fn as_core(&self) -> &RealizedCore { self }
fn as_core_mut(&mut self) -> &mut RealizedCore { self } fn as_core_mut(&mut self) -> &mut RealizedCore { self }
fn min_stateful_height_len(&self) -> usize { self.min_stateful_height_len() } fn min_stateful_len(&self) -> usize { self.min_stateful_len() }
fn truncate_push(&mut self, height: Height, state: &CohortState<RealizedState, CostBasisData<WithCapital>>) -> Result<()> { fn truncate_push(&mut self, height: Height, state: &CohortState<RealizedState, CostBasisData<WithCapital>>) -> Result<()> {
self.truncate_push(height, state) self.truncate_push(height, state)
} }
@@ -51,7 +51,7 @@ impl RealizedLike for RealizedCore {
impl RealizedLike for RealizedFull { impl RealizedLike for RealizedFull {
fn as_core(&self) -> &RealizedCore { &self.core } fn as_core(&self) -> &RealizedCore { &self.core }
fn as_core_mut(&mut self) -> &mut RealizedCore { &mut self.core } fn as_core_mut(&mut self) -> &mut RealizedCore { &mut self.core }
fn min_stateful_height_len(&self) -> usize { self.min_stateful_height_len() } fn min_stateful_len(&self) -> usize { self.min_stateful_len() }
fn truncate_push(&mut self, height: Height, state: &CohortState<RealizedState, CostBasisData<WithCapital>>) -> Result<()> { fn truncate_push(&mut self, height: Height, state: &CohortState<RealizedState, CostBasisData<WithCapital>>) -> Result<()> {
self.truncate_push(height, state) self.truncate_push(height, state)
} }

View File

@@ -56,7 +56,7 @@ impl SupplyFull {
) -> Result<()> { ) -> Result<()> {
self.delta.compute( self.delta.compute(
starting_indexes.height, starting_indexes.height,
&blocks.lookback.height_1m_ago, &blocks.lookback._1m,
&self.core.total.sats.height, &self.core.total.sats.height,
exit, exit,
) )

View File

@@ -46,9 +46,9 @@ impl UnrealizedBase {
}) })
} }
pub(crate) fn min_stateful_height_len(&self) -> usize { pub(crate) fn min_stateful_len(&self) -> usize {
self.core self.core
.min_stateful_height_len() .min_stateful_len()
.min(self.invested_capital_in_profit_raw.len()) .min(self.invested_capital_in_profit_raw.len())
.min(self.invested_capital_in_loss_raw.len()) .min(self.invested_capital_in_loss_raw.len())
.min(self.investor_cap_in_profit_raw.len()) .min(self.investor_cap_in_profit_raw.len())

View File

@@ -26,7 +26,7 @@ impl UnrealizedBasic {
}) })
} }
pub(crate) fn min_stateful_height_len(&self) -> usize { pub(crate) fn min_stateful_len(&self) -> usize {
self.profit self.profit
.raw .raw
.cents .cents
@@ -75,13 +75,13 @@ impl UnrealizedBasic {
) -> Result<()> { ) -> Result<()> {
self.profit.sum.compute_rolling_sum( self.profit.sum.compute_rolling_sum(
max_from, max_from,
&blocks.lookback.height_24h_ago, &blocks.lookback._24h,
&self.profit.raw.cents.height, &self.profit.raw.cents.height,
exit, exit,
)?; )?;
self.loss.sum.compute_rolling_sum( self.loss.sum.compute_rolling_sum(
max_from, max_from,
&blocks.lookback.height_24h_ago, &blocks.lookback._24h,
&self.loss.raw.cents.height, &self.loss.raw.cents.height,
exit, exit,
)?; )?;

View File

@@ -49,8 +49,8 @@ impl UnrealizedCore {
}) })
} }
pub(crate) fn min_stateful_height_len(&self) -> usize { pub(crate) fn min_stateful_len(&self) -> usize {
self.basic.min_stateful_height_len() self.basic.min_stateful_len()
} }
pub(crate) fn truncate_push( pub(crate) fn truncate_push(

View File

@@ -17,7 +17,7 @@ use crate::{blocks, distribution::state::UnrealizedState, prices};
pub trait UnrealizedLike: Send + Sync { pub trait UnrealizedLike: Send + Sync {
fn as_base(&self) -> &UnrealizedBase; fn as_base(&self) -> &UnrealizedBase;
fn as_base_mut(&mut self) -> &mut UnrealizedBase; fn as_base_mut(&mut self) -> &mut UnrealizedBase;
fn min_stateful_height_len(&self) -> usize; fn min_stateful_len(&self) -> usize;
fn truncate_push(&mut self, height: Height, state: &UnrealizedState) -> Result<()>; fn truncate_push(&mut self, height: Height, state: &UnrealizedState) -> Result<()>;
fn compute_rest( fn compute_rest(
&mut self, &mut self,
@@ -40,8 +40,8 @@ impl UnrealizedLike for UnrealizedBase {
fn as_base_mut(&mut self) -> &mut UnrealizedBase { fn as_base_mut(&mut self) -> &mut UnrealizedBase {
self self
} }
fn min_stateful_height_len(&self) -> usize { fn min_stateful_len(&self) -> usize {
self.min_stateful_height_len() self.min_stateful_len()
} }
fn truncate_push(&mut self, height: Height, state: &UnrealizedState) -> Result<()> { fn truncate_push(&mut self, height: Height, state: &UnrealizedState) -> Result<()> {
self.truncate_push(height, state) self.truncate_push(height, state)
@@ -71,8 +71,8 @@ impl UnrealizedLike for UnrealizedFull {
fn as_base_mut(&mut self) -> &mut UnrealizedBase { fn as_base_mut(&mut self) -> &mut UnrealizedBase {
&mut self.inner &mut self.inner
} }
fn min_stateful_height_len(&self) -> usize { fn min_stateful_len(&self) -> usize {
self.inner.min_stateful_height_len() self.inner.min_stateful_len()
} }
fn truncate_push(&mut self, height: Height, state: &UnrealizedState) -> Result<()> { fn truncate_push(&mut self, height: Height, state: &UnrealizedState) -> Result<()> {
self.truncate_push_all(height, state) self.truncate_push_all(height, state)

View File

@@ -23,7 +23,7 @@ use crate::{
state::BlockState, state::BlockState,
}, },
indexes, inputs, indexes, inputs,
internal::{finalize_db, open_db, ComputedPerBlockCumulative}, internal::{ComputedPerBlockCumulative, finalize_db, open_db},
outputs, prices, transactions, outputs, prices, transactions,
}; };
@@ -240,16 +240,7 @@ impl Vecs {
// 1. Find minimum height we have data for across stateful vecs // 1. Find minimum height we have data for across stateful vecs
let current_height = Height::from(self.supply_state.len()); let current_height = Height::from(self.supply_state.len());
debug!("supply_state.len={}", self.supply_state.len()); let min_stateful = self.min_stateful_len();
debug!("utxo_cohorts.min={}", self.utxo_cohorts.min_separate_stateful_height_len());
debug!("address_cohorts.min={}", self.address_cohorts.min_separate_stateful_height_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_height());
debug!("empty_addr_count.min={}", self.empty_addr_count.min_stateful_height());
debug!("address_activity.min={}", self.address_activity.min_stateful_height());
debug!("coinblocks_destroyed.raw.height.len={}", self.coinblocks_destroyed.raw.height.len());
let min_stateful = self.min_stateful_height_len();
// 2. Determine start mode and recover/reset state // 2. Determine start mode and recover/reset state
// Clamp to starting_indexes.height to handle reorg (indexer may require earlier start) // Clamp to starting_indexes.height to handle reorg (indexer may require earlier start)
@@ -423,10 +414,8 @@ impl Vecs {
)?; )?;
// 6b. Compute address count sum (by addresstype → all) // 6b. Compute address count sum (by addresstype → all)
self.addr_count self.addr_count.compute_rest(starting_indexes, exit)?;
.compute_rest(starting_indexes, exit)?; self.empty_addr_count.compute_rest(starting_indexes, exit)?;
self.empty_addr_count
.compute_rest(starting_indexes, exit)?;
// 6c. Compute total_addr_count = addr_count + empty_addr_count // 6c. Compute total_addr_count = addr_count + empty_addr_count
self.total_addr_count.compute( self.total_addr_count.compute(
@@ -486,16 +475,47 @@ impl Vecs {
} }
/// Get minimum length across all height-indexed stateful vectors. /// Get minimum length across all height-indexed stateful vectors.
fn min_stateful_height_len(&self) -> Height { 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 self.utxo_cohorts
.min_separate_stateful_height_len() .min_stateful_len()
.min(self.address_cohorts.min_separate_stateful_height_len()) .min(self.address_cohorts.min_stateful_len())
.min(Height::from(self.supply_state.len())) .min(Height::from(self.supply_state.len()))
.min(self.any_address_indexes.min_stamped_height()) .min(self.any_address_indexes.min_stamped_height())
.min(self.addresses_data.min_stamped_height()) .min(self.addresses_data.min_stamped_height())
.min(Height::from(self.addr_count.min_stateful_height())) .min(Height::from(self.addr_count.min_stateful_len()))
.min(Height::from(self.empty_addr_count.min_stateful_height())) .min(Height::from(self.empty_addr_count.min_stateful_len()))
.min(Height::from(self.address_activity.min_stateful_height())) .min(Height::from(self.address_activity.min_stateful_len()))
.min(Height::from(self.coinblocks_destroyed.raw.height.len())) .min(Height::from(self.coinblocks_destroyed.raw.height.len()))
} }
} }

View File

@@ -67,11 +67,11 @@ impl RatioSma {
// Rolling SMAs // Rolling SMAs
for (sma, lookback) in [ for (sma, lookback) in [
(&mut self._1w, &blocks.lookback.height_1w_ago), (&mut self._1w, &blocks.lookback._1w),
(&mut self._1m, &blocks.lookback.height_1m_ago), (&mut self._1m, &blocks.lookback._1m),
(&mut self._1y, &blocks.lookback.height_1y_ago), (&mut self._1y, &blocks.lookback._1y),
(&mut self._2y, &blocks.lookback.height_2y_ago), (&mut self._2y, &blocks.lookback._2y),
(&mut self._4y, &blocks.lookback.height_4y_ago), (&mut self._4y, &blocks.lookback._4y),
] { ] {
sma.bps.height.compute_rolling_average( sma.bps.height.compute_rolling_average(
starting_indexes.height, starting_indexes.height,

View File

@@ -26,7 +26,7 @@ impl Vecs {
// Value = sats_from_dca(close_price) on day-boundary blocks, Sats::ZERO otherwise. // Value = sats_from_dca(close_price) on day-boundary blocks, Sats::ZERO otherwise.
{ {
let mut last_di: Option<Day1> = None; let mut last_di: Option<Day1> = None;
self.dca_sats_per_day.compute_transform( self.sats_per_day.compute_transform(
starting_indexes.height, starting_indexes.height,
h2d, h2d,
|(h, di, _)| { |(h, di, _)| {
@@ -50,12 +50,12 @@ impl Vecs {
} }
// DCA by period - stack (rolling sum via _start vecs) // DCA by period - stack (rolling sum via _start vecs)
for (stack, days) in self.period_stack.iter_mut_with_days() { for (stack, days) in self.period.stack.iter_mut_with_days() {
let window_starts = blocks.lookback.start_vec(days as usize); let window_starts = blocks.lookback.start_vec(days as usize);
stack.sats.height.compute_rolling_sum( stack.sats.height.compute_rolling_sum(
starting_indexes.height, starting_indexes.height,
window_starts, window_starts,
&self.dca_sats_per_day, &self.sats_per_day,
exit, exit,
)?; )?;
} }
@@ -63,7 +63,7 @@ impl Vecs {
// DCA by period - average price (derived from stack) // DCA by period - average price (derived from stack)
let starting_height = starting_indexes.height.to_usize(); let starting_height = starting_indexes.height.to_usize();
for (average_price, stack, days) in for (average_price, stack, days) in
self.period_cost_basis.zip_mut_with_days(&self.period_stack) self.period.cost_basis.zip_mut_with_days(&self.period.stack)
{ {
let days = days as usize; let days = days as usize;
let start = average_price.cents.height.len().min(starting_height); let start = average_price.cents.height.len().min(starting_height);
@@ -91,9 +91,10 @@ impl Vecs {
// DCA by period - returns (compute from average price) // DCA by period - returns (compute from average price)
for (returns, (average_price, _)) in self for (returns, (average_price, _)) in self
.period_return .period
.r#return
.iter_mut() .iter_mut()
.zip(self.period_cost_basis.iter_with_days()) .zip(self.period.cost_basis.iter_with_days())
{ {
returns.compute_binary::<Cents, Cents, RatioDiffCentsBps32>( returns.compute_binary::<Cents, Cents, RatioDiffCentsBps32>(
starting_indexes.height, starting_indexes.height,
@@ -104,7 +105,7 @@ impl Vecs {
} }
// DCA by period - CAGR (computed from returns at height level) // DCA by period - CAGR (computed from returns at height level)
for (cagr, returns, days) in self.period_cagr.zip_mut_with_period(&self.period_return) { for (cagr, returns, days) in self.period.cagr.zip_mut_with_period(&self.period.r#return) {
let years = days as f64 / 365.0; let years = days as f64 / 365.0;
cagr.bps.height.compute_transform( cagr.bps.height.compute_transform(
starting_indexes.height, starting_indexes.height,
@@ -121,7 +122,7 @@ impl Vecs {
// Lump sum by period - stack // Lump sum by period - stack
let lookback_dca = lookback.price_lookback.as_dca_period(); let lookback_dca = lookback.price_lookback.as_dca_period();
for (stack, lookback_price, days) in for (stack, lookback_price, days) in
self.period_lump_sum_stack.zip_mut_with_days(&lookback_dca) self.period.lump_sum_stack.zip_mut_with_days(&lookback_dca)
{ {
let total_invested = DCA_AMOUNT * days as usize; let total_invested = DCA_AMOUNT * days as usize;
let ls_start = stack.sats.height.len().min(starting_height); let ls_start = stack.sats.height.len().min(starting_height);
@@ -147,7 +148,8 @@ impl Vecs {
// Lump sum by period - returns (compute from lookback price) // Lump sum by period - returns (compute from lookback price)
for (returns, (lookback_price, _)) in self for (returns, (lookback_price, _)) in self
.period_lump_sum_return .period
.lump_sum_return
.iter_mut() .iter_mut()
.zip(lookback_dca.iter_with_days()) .zip(lookback_dca.iter_with_days())
{ {
@@ -161,7 +163,7 @@ impl Vecs {
// DCA by year class - stack (cumulative sum from class start date) // DCA by year class - stack (cumulative sum from class start date)
let start_days = super::ByDcaClass::<()>::start_days(); let start_days = super::ByDcaClass::<()>::start_days();
for (stack, day1) in self.class_stack.iter_mut().zip(start_days) { for (stack, day1) in self.class.stack.iter_mut().zip(start_days) {
let mut last_di: Option<Day1> = None; let mut last_di: Option<Day1> = None;
let mut prev_value = if starting_height > 0 { let mut prev_value = if starting_height > 0 {
stack.sats.height.collect_one_at(starting_height - 1).unwrap_or_default() stack.sats.height.collect_one_at(starting_height - 1).unwrap_or_default()
@@ -213,9 +215,10 @@ impl Vecs {
// DCA by year class - average price (derived from stack) // DCA by year class - average price (derived from stack)
let start_days = super::ByDcaClass::<()>::start_days(); let start_days = super::ByDcaClass::<()>::start_days();
for ((average_price, stack), from) in self for ((average_price, stack), from) in self
.class_cost_basis .class
.cost_basis
.iter_mut() .iter_mut()
.zip(self.class_stack.iter()) .zip(self.class.stack.iter())
.zip(start_days) .zip(start_days)
{ {
let from_usize = from.to_usize(); let from_usize = from.to_usize();
@@ -243,9 +246,10 @@ impl Vecs {
// DCA by year class - returns (compute from average price) // DCA by year class - returns (compute from average price)
for (returns, average_price) in self for (returns, average_price) in self
.class_return .class
.r#return
.iter_mut() .iter_mut()
.zip(self.class_cost_basis.iter()) .zip(self.class.cost_basis.iter())
{ {
returns.compute_binary::<Cents, Cents, RatioDiffCentsBps32>( returns.compute_binary::<Cents, Cents, RatioDiffCentsBps32>(
starting_indexes.height, starting_indexes.height,

View File

@@ -3,6 +3,7 @@ use brk_types::Version;
use vecdb::{Database, ImportableVec}; use vecdb::{Database, ImportableVec};
use super::{ByDcaCagr, ByDcaClass, ByDcaPeriod, Vecs}; use super::{ByDcaCagr, ByDcaClass, ByDcaPeriod, Vecs};
use super::vecs::{ClassVecs, PeriodVecs};
use crate::{ use crate::{
indexes, indexes,
internal::{AmountPerBlock, PercentPerBlock, Price}, internal::{AmountPerBlock, PercentPerBlock, Price},
@@ -14,27 +15,27 @@ impl Vecs {
version: Version, version: Version,
indexes: &indexes::Vecs, indexes: &indexes::Vecs,
) -> Result<Self> { ) -> Result<Self> {
let period_stack = ByDcaPeriod::try_new(|name, _days| { let stack = ByDcaPeriod::try_new(|name, _days| {
AmountPerBlock::forced_import(db, &format!("dca_stack_{name}"), version, indexes) AmountPerBlock::forced_import(db, &format!("dca_stack_{name}"), version, indexes)
})?; })?;
let period_cost_basis = ByDcaPeriod::try_new(|name, _days| { let cost_basis = ByDcaPeriod::try_new(|name, _days| {
Price::forced_import(db, &format!("dca_cost_basis_{name}"), version, indexes) Price::forced_import(db, &format!("dca_cost_basis_{name}"), version, indexes)
})?; })?;
let period_return = ByDcaPeriod::try_new(|name, _days| { let r#return = ByDcaPeriod::try_new(|name, _days| {
PercentPerBlock::forced_import(db, &format!("dca_return_{name}"), version, indexes) PercentPerBlock::forced_import(db, &format!("dca_return_{name}"), version, indexes)
})?; })?;
let period_cagr = ByDcaCagr::try_new(|name, _days| { let cagr = ByDcaCagr::try_new(|name, _days| {
PercentPerBlock::forced_import(db, &format!("dca_cagr_{name}"), version, indexes) PercentPerBlock::forced_import(db, &format!("dca_cagr_{name}"), version, indexes)
})?; })?;
let period_lump_sum_stack = ByDcaPeriod::try_new(|name, _days| { let lump_sum_stack = ByDcaPeriod::try_new(|name, _days| {
AmountPerBlock::forced_import(db, &format!("lump_sum_stack_{name}"), version, indexes) AmountPerBlock::forced_import(db, &format!("lump_sum_stack_{name}"), version, indexes)
})?; })?;
let period_lump_sum_return = ByDcaPeriod::try_new(|name, _days| { let lump_sum_return = ByDcaPeriod::try_new(|name, _days| {
PercentPerBlock::forced_import( PercentPerBlock::forced_import(
db, db,
&format!("lump_sum_return_{name}"), &format!("lump_sum_return_{name}"),
@@ -56,16 +57,20 @@ impl Vecs {
})?; })?;
Ok(Self { Ok(Self {
dca_sats_per_day: ImportableVec::forced_import(db, "dca_sats_per_day", version)?, sats_per_day: ImportableVec::forced_import(db, "dca_sats_per_day", version)?,
period_stack, period: PeriodVecs {
period_cost_basis, stack,
period_return, cost_basis,
period_cagr, r#return,
period_lump_sum_stack, cagr,
period_lump_sum_return, lump_sum_stack,
class_stack, lump_sum_return,
class_cost_basis, },
class_return, class: ClassVecs {
stack: class_stack,
cost_basis: class_cost_basis,
r#return: class_return,
},
}) })
} }
} }

View File

@@ -4,24 +4,27 @@ use vecdb::{EagerVec, PcoVec, Rw, StorageMode};
use super::{ByDcaCagr, ByDcaClass, ByDcaPeriod}; use super::{ByDcaCagr, ByDcaClass, ByDcaPeriod};
use crate::internal::{AmountPerBlock, ComputedPerBlock, PercentPerBlock, Price}; use crate::internal::{AmountPerBlock, ComputedPerBlock, PercentPerBlock, Price};
#[derive(Traversable)]
pub struct PeriodVecs<M: StorageMode = Rw> {
pub stack: ByDcaPeriod<AmountPerBlock<M>>,
pub cost_basis: ByDcaPeriod<Price<ComputedPerBlock<Cents, M>>>,
pub r#return: ByDcaPeriod<PercentPerBlock<BasisPointsSigned32, M>>,
pub cagr: ByDcaCagr<PercentPerBlock<BasisPointsSigned32, M>>,
pub lump_sum_stack: ByDcaPeriod<AmountPerBlock<M>>,
pub lump_sum_return: ByDcaPeriod<PercentPerBlock<BasisPointsSigned32, M>>,
}
#[derive(Traversable)]
pub struct ClassVecs<M: StorageMode = Rw> {
pub stack: ByDcaClass<AmountPerBlock<M>>,
pub cost_basis: ByDcaClass<Price<ComputedPerBlock<Cents, M>>>,
pub r#return: ByDcaClass<PercentPerBlock<BasisPointsSigned32, M>>,
}
#[derive(Traversable)] #[derive(Traversable)]
pub struct Vecs<M: StorageMode = Rw> { pub struct Vecs<M: StorageMode = Rw> {
/// Per-height DCA sats contribution: sats_from_dca(close) on day boundaries, 0 otherwise. pub sats_per_day: M::Stored<EagerVec<PcoVec<Height, Sats>>>,
/// Computed once, reused by all period rolling sums. pub period: PeriodVecs<M>,
pub dca_sats_per_day: M::Stored<EagerVec<PcoVec<Height, Sats>>>, pub class: ClassVecs<M>,
// DCA by period
pub period_stack: ByDcaPeriod<AmountPerBlock<M>>,
pub period_cost_basis: ByDcaPeriod<Price<ComputedPerBlock<Cents, M>>>,
pub period_return: ByDcaPeriod<PercentPerBlock<BasisPointsSigned32, M>>,
pub period_cagr: ByDcaCagr<PercentPerBlock<BasisPointsSigned32, M>>,
// Lump sum by period (for comparison with DCA)
pub period_lump_sum_stack: ByDcaPeriod<AmountPerBlock<M>>,
pub period_lump_sum_return: ByDcaPeriod<PercentPerBlock<BasisPointsSigned32, M>>,
// DCA by year class
pub class_stack: ByDcaClass<AmountPerBlock<M>>,
pub class_cost_basis: ByDcaClass<Price<ComputedPerBlock<Cents, M>>>,
pub class_return: ByDcaClass<PercentPerBlock<BasisPointsSigned32, M>>,
} }

View File

@@ -22,8 +22,11 @@ pub struct SmaVecs<M: StorageMode = Rw> {
pub _2y: PriceWithRatioPerBlock<M>, pub _2y: PriceWithRatioPerBlock<M>,
pub _200w: PriceWithRatioPerBlock<M>, pub _200w: PriceWithRatioPerBlock<M>,
pub _4y: PriceWithRatioPerBlock<M>, pub _4y: PriceWithRatioPerBlock<M>,
#[traversable(wrap = "200d", rename = "x2_4")]
pub _200d_x2_4: Price<LazyPerBlock<Cents, Cents>>, pub _200d_x2_4: Price<LazyPerBlock<Cents, Cents>>,
#[traversable(wrap = "200d", rename = "x0_8")]
pub _200d_x0_8: Price<LazyPerBlock<Cents, Cents>>, pub _200d_x0_8: Price<LazyPerBlock<Cents, Cents>>,
#[traversable(wrap = "350d", rename = "x2")]
pub _350d_x2: Price<LazyPerBlock<Cents, Cents>>, pub _350d_x2: Price<LazyPerBlock<Cents, Cents>>,
} }

View File

@@ -19,22 +19,22 @@ impl Vecs {
( (
&mut self.min._1w.cents.height, &mut self.min._1w.cents.height,
&mut self.max._1w.cents.height, &mut self.max._1w.cents.height,
&blocks.lookback.height_1w_ago, &blocks.lookback._1w,
), ),
( (
&mut self.min._2w.cents.height, &mut self.min._2w.cents.height,
&mut self.max._2w.cents.height, &mut self.max._2w.cents.height,
&blocks.lookback.height_2w_ago, &blocks.lookback._2w,
), ),
( (
&mut self.min._1m.cents.height, &mut self.min._1m.cents.height,
&mut self.max._1m.cents.height, &mut self.max._1m.cents.height,
&blocks.lookback.height_1m_ago, &blocks.lookback._1m,
), ),
( (
&mut self.min._1y.cents.height, &mut self.min._1y.cents.height,
&mut self.max._1y.cents.height, &mut self.max._1y.cents.height,
&blocks.lookback.height_1y_ago, &blocks.lookback._1y,
), ),
] { ] {
min_vec.compute_rolling_min_from_starts( min_vec.compute_rolling_min_from_starts(
@@ -75,7 +75,7 @@ impl Vecs {
// 2w rolling sum of true range // 2w rolling sum of true range
self.true_range_sum_2w.height.compute_rolling_sum( self.true_range_sum_2w.height.compute_rolling_sum(
starting_indexes.height, starting_indexes.height,
&blocks.lookback.height_2w_ago, &blocks.lookback._2w,
&self.true_range.height, &self.true_range.height,
exit, exit,
)?; )?;
@@ -88,7 +88,7 @@ impl Vecs {
&self.true_range_sum_2w.height, &self.true_range_sum_2w.height,
&self.max._2w.cents.height, &self.max._2w.cents.height,
&self.min._2w.cents.height, &self.min._2w.cents.height,
&blocks.lookback.height_2w_ago, &blocks.lookback._2w,
|(h, tr_sum, max, min, window_start, ..)| { |(h, tr_sum, max, min, window_start, ..)| {
let range = f64::from(max) - f64::from(min); let range = f64::from(max) - f64::from(min);
let n = (h.to_usize() - window_start.to_usize() + 1) as f32; let n = (h.to_usize() - window_start.to_usize() + 1) as f32;

View File

@@ -44,7 +44,7 @@ impl Vecs {
self.stoch_d.bps.height.compute_rolling_average( self.stoch_d.bps.height.compute_rolling_average(
starting_indexes.height, starting_indexes.height,
&blocks.lookback.height_3d_ago, &blocks.lookback._3d,
&self.stoch_k.bps.height, &self.stoch_k.bps.height,
exit, exit,
)?; )?;

View File

@@ -38,10 +38,10 @@ impl Vecs {
let hash_rate = &self.hash_rate.height; let hash_rate = &self.hash_rate.height;
for (sma, window) in [ for (sma, window) in [
(&mut self.hash_rate_sma._1w.height, &lookback.height_1w_ago), (&mut self.hash_rate_sma._1w.height, &lookback._1w),
(&mut self.hash_rate_sma._1m.height, &lookback.height_1m_ago), (&mut self.hash_rate_sma._1m.height, &lookback._1m),
(&mut self.hash_rate_sma._2m.height, &lookback.height_2m_ago), (&mut self.hash_rate_sma._2m.height, &lookback._2m),
(&mut self.hash_rate_sma._1y.height, &lookback.height_1y_ago), (&mut self.hash_rate_sma._1y.height, &lookback._1y),
] { ] {
sma.compute_rolling_average(starting_indexes.height, window, hash_rate, exit)?; sma.compute_rolling_average(starting_indexes.height, window, hash_rate, exit)?;
} }

View File

@@ -156,7 +156,7 @@ impl Vecs {
self.subsidy_sma_1y.cents.height.compute_rolling_average( self.subsidy_sma_1y.cents.height.compute_rolling_average(
starting_indexes.height, starting_indexes.height,
&lookback.height_1y_ago, &lookback._1y,
&self.subsidy.base.cents.height, &self.subsidy.base.cents.height,
exit, exit,
)?; )?;

View File

@@ -35,7 +35,7 @@ impl Vecs {
.height .height
.compute_rolling_ratio_change( .compute_rolling_ratio_change(
starting_indexes.height, starting_indexes.height,
&blocks.lookback.height_1y_ago, &blocks.lookback._1y,
&circulating_supply.height, &circulating_supply.height,
exit, exit,
)?; )?;

View File

@@ -20,7 +20,7 @@ impl Vecs {
// BTC velocity at height level // BTC velocity at height level
self.btc.height.compute_rolling_ratio( self.btc.height.compute_rolling_ratio(
starting_indexes.height, starting_indexes.height,
&blocks.lookback.height_1y_ago, &blocks.lookback._1y,
&transactions.volume.sent_sum.sats, &transactions.volume.sent_sum.sats,
&circulating_supply.sats.height, &circulating_supply.sats.height,
exit, exit,
@@ -29,7 +29,7 @@ impl Vecs {
// USD velocity at height level // USD velocity at height level
self.usd.height.compute_rolling_ratio( self.usd.height.compute_rolling_ratio(
starting_indexes.height, starting_indexes.height,
&blocks.lookback.height_1y_ago, &blocks.lookback._1y,
&transactions.volume.sent_sum.usd, &transactions.volume.sent_sum.usd,
&circulating_supply.usd.height, &circulating_supply.usd.height,
exit, exit,

View File

@@ -60,7 +60,7 @@ impl Vecs {
// Annualized volume: rolling 1y sum of per-block sent volume // Annualized volume: rolling 1y sum of per-block sent volume
self.annualized_volume.sats.height.compute_rolling_sum( self.annualized_volume.sats.height.compute_rolling_sum(
starting_indexes.height, starting_indexes.height,
&blocks.lookback.height_1y_ago, &blocks.lookback._1y,
&self.sent_sum.sats, &self.sent_sum.sats,
exit, exit,
)?; )?;

View File

@@ -4491,49 +4491,49 @@ function createRawPattern(client, acc) {
/** /**
* @typedef {Object} MetricsTree_Blocks_Lookback * @typedef {Object} MetricsTree_Blocks_Lookback
* @property {MetricPattern18<Height>} height1hAgo * @property {MetricPattern18<Height>} _1h
* @property {MetricPattern18<Height>} height24hAgo * @property {MetricPattern18<Height>} _24h
* @property {MetricPattern18<Height>} height3dAgo * @property {MetricPattern18<Height>} _3d
* @property {MetricPattern18<Height>} height1wAgo * @property {MetricPattern18<Height>} _1w
* @property {MetricPattern18<Height>} height8dAgo * @property {MetricPattern18<Height>} _8d
* @property {MetricPattern18<Height>} height9dAgo * @property {MetricPattern18<Height>} _9d
* @property {MetricPattern18<Height>} height12dAgo * @property {MetricPattern18<Height>} _12d
* @property {MetricPattern18<Height>} height13dAgo * @property {MetricPattern18<Height>} _13d
* @property {MetricPattern18<Height>} height2wAgo * @property {MetricPattern18<Height>} _2w
* @property {MetricPattern18<Height>} height21dAgo * @property {MetricPattern18<Height>} _21d
* @property {MetricPattern18<Height>} height26dAgo * @property {MetricPattern18<Height>} _26d
* @property {MetricPattern18<Height>} height1mAgo * @property {MetricPattern18<Height>} _1m
* @property {MetricPattern18<Height>} height34dAgo * @property {MetricPattern18<Height>} _34d
* @property {MetricPattern18<Height>} height55dAgo * @property {MetricPattern18<Height>} _55d
* @property {MetricPattern18<Height>} height2mAgo * @property {MetricPattern18<Height>} _2m
* @property {MetricPattern18<Height>} height9wAgo * @property {MetricPattern18<Height>} _9w
* @property {MetricPattern18<Height>} height12wAgo * @property {MetricPattern18<Height>} _12w
* @property {MetricPattern18<Height>} height89dAgo * @property {MetricPattern18<Height>} _89d
* @property {MetricPattern18<Height>} height3mAgo * @property {MetricPattern18<Height>} _3m
* @property {MetricPattern18<Height>} height14wAgo * @property {MetricPattern18<Height>} _14w
* @property {MetricPattern18<Height>} height111dAgo * @property {MetricPattern18<Height>} _111d
* @property {MetricPattern18<Height>} height144dAgo * @property {MetricPattern18<Height>} _144d
* @property {MetricPattern18<Height>} height6mAgo * @property {MetricPattern18<Height>} _6m
* @property {MetricPattern18<Height>} height26wAgo * @property {MetricPattern18<Height>} _26w
* @property {MetricPattern18<Height>} height200dAgo * @property {MetricPattern18<Height>} _200d
* @property {MetricPattern18<Height>} height9mAgo * @property {MetricPattern18<Height>} _9m
* @property {MetricPattern18<Height>} height350dAgo * @property {MetricPattern18<Height>} _350d
* @property {MetricPattern18<Height>} height12mAgo * @property {MetricPattern18<Height>} _12m
* @property {MetricPattern18<Height>} height1yAgo * @property {MetricPattern18<Height>} _1y
* @property {MetricPattern18<Height>} height14mAgo * @property {MetricPattern18<Height>} _14m
* @property {MetricPattern18<Height>} height2yAgo * @property {MetricPattern18<Height>} _2y
* @property {MetricPattern18<Height>} height26mAgo * @property {MetricPattern18<Height>} _26m
* @property {MetricPattern18<Height>} height3yAgo * @property {MetricPattern18<Height>} _3y
* @property {MetricPattern18<Height>} height200wAgo * @property {MetricPattern18<Height>} _200w
* @property {MetricPattern18<Height>} height4yAgo * @property {MetricPattern18<Height>} _4y
* @property {MetricPattern18<Height>} height5yAgo * @property {MetricPattern18<Height>} _5y
* @property {MetricPattern18<Height>} height6yAgo * @property {MetricPattern18<Height>} _6y
* @property {MetricPattern18<Height>} height8yAgo * @property {MetricPattern18<Height>} _8y
* @property {MetricPattern18<Height>} height9yAgo * @property {MetricPattern18<Height>} _9y
* @property {MetricPattern18<Height>} height10yAgo * @property {MetricPattern18<Height>} _10y
* @property {MetricPattern18<Height>} height12yAgo * @property {MetricPattern18<Height>} _12y
* @property {MetricPattern18<Height>} height14yAgo * @property {MetricPattern18<Height>} _14y
* @property {MetricPattern18<Height>} height26yAgo * @property {MetricPattern18<Height>} _26y
*/ */
/** /**
@@ -5229,15 +5229,33 @@ function createRawPattern(client, acc) {
* @property {BpsCentsRatioSatsUsdPattern} _89d * @property {BpsCentsRatioSatsUsdPattern} _89d
* @property {BpsCentsRatioSatsUsdPattern} _111d * @property {BpsCentsRatioSatsUsdPattern} _111d
* @property {BpsCentsRatioSatsUsdPattern} _144d * @property {BpsCentsRatioSatsUsdPattern} _144d
* @property {BpsCentsRatioSatsUsdPattern} _200d * @property {MetricsTree_Market_MovingAverage_Sma_200d} _200d
* @property {BpsCentsRatioSatsUsdPattern} _350d * @property {MetricsTree_Market_MovingAverage_Sma_350d} _350d
* @property {BpsCentsRatioSatsUsdPattern} _1y * @property {BpsCentsRatioSatsUsdPattern} _1y
* @property {BpsCentsRatioSatsUsdPattern} _2y * @property {BpsCentsRatioSatsUsdPattern} _2y
* @property {BpsCentsRatioSatsUsdPattern} _200w * @property {BpsCentsRatioSatsUsdPattern} _200w
* @property {BpsCentsRatioSatsUsdPattern} _4y * @property {BpsCentsRatioSatsUsdPattern} _4y
* @property {CentsSatsUsdPattern} _200dX24 */
* @property {CentsSatsUsdPattern} _200dX08
* @property {CentsSatsUsdPattern} _350dX2 /**
* @typedef {Object} MetricsTree_Market_MovingAverage_Sma_200d
* @property {MetricPattern1<Cents>} cents
* @property {MetricPattern1<Dollars>} usd
* @property {MetricPattern1<SatsFract>} sats
* @property {MetricPattern1<BasisPoints32>} bps
* @property {MetricPattern1<StoredF32>} ratio
* @property {CentsSatsUsdPattern} x24
* @property {CentsSatsUsdPattern} x08
*/
/**
* @typedef {Object} MetricsTree_Market_MovingAverage_Sma_350d
* @property {MetricPattern1<Cents>} cents
* @property {MetricPattern1<Dollars>} usd
* @property {MetricPattern1<SatsFract>} sats
* @property {MetricPattern1<BasisPoints32>} bps
* @property {MetricPattern1<StoredF32>} ratio
* @property {CentsSatsUsdPattern} x2
*/ */
/** /**
@@ -5262,20 +5280,23 @@ function createRawPattern(client, acc) {
/** /**
* @typedef {Object} MetricsTree_Market_Dca * @typedef {Object} MetricsTree_Market_Dca
* @property {MetricPattern18<Sats>} dcaSatsPerDay * @property {MetricPattern18<Sats>} satsPerDay
* @property {_10y1m1w1y2y3m3y4y5y6m6y8yPattern3} periodStack * @property {MetricsTree_Market_Dca_Period} period
* @property {MetricsTree_Market_Dca_PeriodCostBasis} periodCostBasis * @property {MetricsTree_Market_Dca_Class} class
* @property {_10y1m1w1y2y3m3y4y5y6m6y8yPattern2} periodReturn
* @property {_10y2y3y4y5y6y8yPattern} periodCagr
* @property {_10y1m1w1y2y3m3y4y5y6m6y8yPattern3} periodLumpSumStack
* @property {_10y1m1w1y2y3m3y4y5y6m6y8yPattern2} periodLumpSumReturn
* @property {MetricsTree_Market_Dca_ClassStack} classStack
* @property {MetricsTree_Market_Dca_ClassCostBasis} classCostBasis
* @property {MetricsTree_Market_Dca_ClassReturn} classReturn
*/ */
/** /**
* @typedef {Object} MetricsTree_Market_Dca_PeriodCostBasis * @typedef {Object} MetricsTree_Market_Dca_Period
* @property {_10y1m1w1y2y3m3y4y5y6m6y8yPattern3} stack
* @property {MetricsTree_Market_Dca_Period_CostBasis} costBasis
* @property {_10y1m1w1y2y3m3y4y5y6m6y8yPattern2} r#return
* @property {_10y2y3y4y5y6y8yPattern} cagr
* @property {_10y1m1w1y2y3m3y4y5y6m6y8yPattern3} lumpSumStack
* @property {_10y1m1w1y2y3m3y4y5y6m6y8yPattern2} lumpSumReturn
*/
/**
* @typedef {Object} MetricsTree_Market_Dca_Period_CostBasis
* @property {CentsSatsUsdPattern} _1w * @property {CentsSatsUsdPattern} _1w
* @property {CentsSatsUsdPattern} _1m * @property {CentsSatsUsdPattern} _1m
* @property {CentsSatsUsdPattern} _3m * @property {CentsSatsUsdPattern} _3m
@@ -5291,7 +5312,14 @@ function createRawPattern(client, acc) {
*/ */
/** /**
* @typedef {Object} MetricsTree_Market_Dca_ClassStack * @typedef {Object} MetricsTree_Market_Dca_Class
* @property {MetricsTree_Market_Dca_Class_Stack} stack
* @property {MetricsTree_Market_Dca_Class_CostBasis} costBasis
* @property {MetricsTree_Market_Dca_Class_R#return} r#return
*/
/**
* @typedef {Object} MetricsTree_Market_Dca_Class_Stack
* @property {BtcCentsSatsUsdPattern} from2015 * @property {BtcCentsSatsUsdPattern} from2015
* @property {BtcCentsSatsUsdPattern} from2016 * @property {BtcCentsSatsUsdPattern} from2016
* @property {BtcCentsSatsUsdPattern} from2017 * @property {BtcCentsSatsUsdPattern} from2017
@@ -5307,7 +5335,7 @@ function createRawPattern(client, acc) {
*/ */
/** /**
* @typedef {Object} MetricsTree_Market_Dca_ClassCostBasis * @typedef {Object} MetricsTree_Market_Dca_Class_CostBasis
* @property {CentsSatsUsdPattern} from2015 * @property {CentsSatsUsdPattern} from2015
* @property {CentsSatsUsdPattern} from2016 * @property {CentsSatsUsdPattern} from2016
* @property {CentsSatsUsdPattern} from2017 * @property {CentsSatsUsdPattern} from2017
@@ -5323,7 +5351,7 @@ function createRawPattern(client, acc) {
*/ */
/** /**
* @typedef {Object} MetricsTree_Market_Dca_ClassReturn * @typedef {Object} MetricsTree_Market_Dca_Class_R#return
* @property {BpsPercentRatioPattern} from2015 * @property {BpsPercentRatioPattern} from2015
* @property {BpsPercentRatioPattern} from2016 * @property {BpsPercentRatioPattern} from2016
* @property {BpsPercentRatioPattern} from2017 * @property {BpsPercentRatioPattern} from2017
@@ -7191,49 +7219,49 @@ class BrkClient extends BrkClientBase {
blockCount: createCumulativeRawSumPattern(this, 'block_count'), blockCount: createCumulativeRawSumPattern(this, 'block_count'),
}, },
lookback: { lookback: {
height1hAgo: createMetricPattern18(this, 'height_1h_ago'), _1h: createMetricPattern18(this, 'height_1h_ago'),
height24hAgo: createMetricPattern18(this, 'height_24h_ago'), _24h: createMetricPattern18(this, 'height_24h_ago'),
height3dAgo: createMetricPattern18(this, 'height_3d_ago'), _3d: createMetricPattern18(this, 'height_3d_ago'),
height1wAgo: createMetricPattern18(this, 'height_1w_ago'), _1w: createMetricPattern18(this, 'height_1w_ago'),
height8dAgo: createMetricPattern18(this, 'height_8d_ago'), _8d: createMetricPattern18(this, 'height_8d_ago'),
height9dAgo: createMetricPattern18(this, 'height_9d_ago'), _9d: createMetricPattern18(this, 'height_9d_ago'),
height12dAgo: createMetricPattern18(this, 'height_12d_ago'), _12d: createMetricPattern18(this, 'height_12d_ago'),
height13dAgo: createMetricPattern18(this, 'height_13d_ago'), _13d: createMetricPattern18(this, 'height_13d_ago'),
height2wAgo: createMetricPattern18(this, 'height_2w_ago'), _2w: createMetricPattern18(this, 'height_2w_ago'),
height21dAgo: createMetricPattern18(this, 'height_21d_ago'), _21d: createMetricPattern18(this, 'height_21d_ago'),
height26dAgo: createMetricPattern18(this, 'height_26d_ago'), _26d: createMetricPattern18(this, 'height_26d_ago'),
height1mAgo: createMetricPattern18(this, 'height_1m_ago'), _1m: createMetricPattern18(this, 'height_1m_ago'),
height34dAgo: createMetricPattern18(this, 'height_34d_ago'), _34d: createMetricPattern18(this, 'height_34d_ago'),
height55dAgo: createMetricPattern18(this, 'height_55d_ago'), _55d: createMetricPattern18(this, 'height_55d_ago'),
height2mAgo: createMetricPattern18(this, 'height_2m_ago'), _2m: createMetricPattern18(this, 'height_2m_ago'),
height9wAgo: createMetricPattern18(this, 'height_9w_ago'), _9w: createMetricPattern18(this, 'height_9w_ago'),
height12wAgo: createMetricPattern18(this, 'height_12w_ago'), _12w: createMetricPattern18(this, 'height_12w_ago'),
height89dAgo: createMetricPattern18(this, 'height_89d_ago'), _89d: createMetricPattern18(this, 'height_89d_ago'),
height3mAgo: createMetricPattern18(this, 'height_3m_ago'), _3m: createMetricPattern18(this, 'height_3m_ago'),
height14wAgo: createMetricPattern18(this, 'height_14w_ago'), _14w: createMetricPattern18(this, 'height_14w_ago'),
height111dAgo: createMetricPattern18(this, 'height_111d_ago'), _111d: createMetricPattern18(this, 'height_111d_ago'),
height144dAgo: createMetricPattern18(this, 'height_144d_ago'), _144d: createMetricPattern18(this, 'height_144d_ago'),
height6mAgo: createMetricPattern18(this, 'height_6m_ago'), _6m: createMetricPattern18(this, 'height_6m_ago'),
height26wAgo: createMetricPattern18(this, 'height_26w_ago'), _26w: createMetricPattern18(this, 'height_26w_ago'),
height200dAgo: createMetricPattern18(this, 'height_200d_ago'), _200d: createMetricPattern18(this, 'height_200d_ago'),
height9mAgo: createMetricPattern18(this, 'height_9m_ago'), _9m: createMetricPattern18(this, 'height_9m_ago'),
height350dAgo: createMetricPattern18(this, 'height_350d_ago'), _350d: createMetricPattern18(this, 'height_350d_ago'),
height12mAgo: createMetricPattern18(this, 'height_12m_ago'), _12m: createMetricPattern18(this, 'height_12m_ago'),
height1yAgo: createMetricPattern18(this, 'height_1y_ago'), _1y: createMetricPattern18(this, 'height_1y_ago'),
height14mAgo: createMetricPattern18(this, 'height_14m_ago'), _14m: createMetricPattern18(this, 'height_14m_ago'),
height2yAgo: createMetricPattern18(this, 'height_2y_ago'), _2y: createMetricPattern18(this, 'height_2y_ago'),
height26mAgo: createMetricPattern18(this, 'height_26m_ago'), _26m: createMetricPattern18(this, 'height_26m_ago'),
height3yAgo: createMetricPattern18(this, 'height_3y_ago'), _3y: createMetricPattern18(this, 'height_3y_ago'),
height200wAgo: createMetricPattern18(this, 'height_200w_ago'), _200w: createMetricPattern18(this, 'height_200w_ago'),
height4yAgo: createMetricPattern18(this, 'height_4y_ago'), _4y: createMetricPattern18(this, 'height_4y_ago'),
height5yAgo: createMetricPattern18(this, 'height_5y_ago'), _5y: createMetricPattern18(this, 'height_5y_ago'),
height6yAgo: createMetricPattern18(this, 'height_6y_ago'), _6y: createMetricPattern18(this, 'height_6y_ago'),
height8yAgo: createMetricPattern18(this, 'height_8y_ago'), _8y: createMetricPattern18(this, 'height_8y_ago'),
height9yAgo: createMetricPattern18(this, 'height_9y_ago'), _9y: createMetricPattern18(this, 'height_9y_ago'),
height10yAgo: createMetricPattern18(this, 'height_10y_ago'), _10y: createMetricPattern18(this, 'height_10y_ago'),
height12yAgo: createMetricPattern18(this, 'height_12y_ago'), _12y: createMetricPattern18(this, 'height_12y_ago'),
height14yAgo: createMetricPattern18(this, 'height_14y_ago'), _14y: createMetricPattern18(this, 'height_14y_ago'),
height26yAgo: createMetricPattern18(this, 'height_26y_ago'), _26y: createMetricPattern18(this, 'height_26y_ago'),
}, },
interval: create_1m1w1y24hHeightPattern(this, 'block_interval'), interval: create_1m1w1y24hHeightPattern(this, 'block_interval'),
halving: { halving: {
@@ -7701,15 +7729,27 @@ class BrkClient extends BrkClientBase {
_89d: createBpsCentsRatioSatsUsdPattern(this, 'price_sma_89d'), _89d: createBpsCentsRatioSatsUsdPattern(this, 'price_sma_89d'),
_111d: createBpsCentsRatioSatsUsdPattern(this, 'price_sma_111d'), _111d: createBpsCentsRatioSatsUsdPattern(this, 'price_sma_111d'),
_144d: createBpsCentsRatioSatsUsdPattern(this, 'price_sma_144d'), _144d: createBpsCentsRatioSatsUsdPattern(this, 'price_sma_144d'),
_200d: createBpsCentsRatioSatsUsdPattern(this, 'price_sma_200d'), _200d: {
_350d: createBpsCentsRatioSatsUsdPattern(this, 'price_sma_350d'), cents: createMetricPattern1(this, 'price_sma_200d_cents'),
usd: createMetricPattern1(this, 'price_sma_200d_usd'),
sats: createMetricPattern1(this, 'price_sma_200d_sats'),
bps: createMetricPattern1(this, 'price_sma_200d_ratio_bps'),
ratio: createMetricPattern1(this, 'price_sma_200d_ratio'),
x24: createCentsSatsUsdPattern(this, 'price_sma_200d_x2_4'),
x08: createCentsSatsUsdPattern(this, 'price_sma_200d_x0_8'),
},
_350d: {
cents: createMetricPattern1(this, 'price_sma_350d_cents'),
usd: createMetricPattern1(this, 'price_sma_350d_usd'),
sats: createMetricPattern1(this, 'price_sma_350d_sats'),
bps: createMetricPattern1(this, 'price_sma_350d_ratio_bps'),
ratio: createMetricPattern1(this, 'price_sma_350d_ratio'),
x2: createCentsSatsUsdPattern(this, 'price_sma_350d_x2'),
},
_1y: createBpsCentsRatioSatsUsdPattern(this, 'price_sma_1y'), _1y: createBpsCentsRatioSatsUsdPattern(this, 'price_sma_1y'),
_2y: createBpsCentsRatioSatsUsdPattern(this, 'price_sma_2y'), _2y: createBpsCentsRatioSatsUsdPattern(this, 'price_sma_2y'),
_200w: createBpsCentsRatioSatsUsdPattern(this, 'price_sma_200w'), _200w: createBpsCentsRatioSatsUsdPattern(this, 'price_sma_200w'),
_4y: createBpsCentsRatioSatsUsdPattern(this, 'price_sma_4y'), _4y: createBpsCentsRatioSatsUsdPattern(this, 'price_sma_4y'),
_200dX24: createCentsSatsUsdPattern(this, 'price_sma_200d_x2_4'),
_200dX08: createCentsSatsUsdPattern(this, 'price_sma_200d_x0_8'),
_350dX2: createCentsSatsUsdPattern(this, 'price_sma_350d_x2'),
}, },
ema: { ema: {
_1w: createBpsCentsRatioSatsUsdPattern(this, 'price_ema_1w'), _1w: createBpsCentsRatioSatsUsdPattern(this, 'price_ema_1w'),
@@ -7731,67 +7771,71 @@ class BrkClient extends BrkClientBase {
}, },
}, },
dca: { dca: {
dcaSatsPerDay: createMetricPattern18(this, 'dca_sats_per_day'), satsPerDay: createMetricPattern18(this, 'dca_sats_per_day'),
periodStack: create_10y1m1w1y2y3m3y4y5y6m6y8yPattern3(this, 'dca_stack'), period: {
periodCostBasis: { stack: create_10y1m1w1y2y3m3y4y5y6m6y8yPattern3(this, 'dca_stack'),
_1w: createCentsSatsUsdPattern(this, 'dca_cost_basis_1w'), costBasis: {
_1m: createCentsSatsUsdPattern(this, 'dca_cost_basis_1m'), _1w: createCentsSatsUsdPattern(this, 'dca_cost_basis_1w'),
_3m: createCentsSatsUsdPattern(this, 'dca_cost_basis_3m'), _1m: createCentsSatsUsdPattern(this, 'dca_cost_basis_1m'),
_6m: createCentsSatsUsdPattern(this, 'dca_cost_basis_6m'), _3m: createCentsSatsUsdPattern(this, 'dca_cost_basis_3m'),
_1y: createCentsSatsUsdPattern(this, 'dca_cost_basis_1y'), _6m: createCentsSatsUsdPattern(this, 'dca_cost_basis_6m'),
_2y: createCentsSatsUsdPattern(this, 'dca_cost_basis_2y'), _1y: createCentsSatsUsdPattern(this, 'dca_cost_basis_1y'),
_3y: createCentsSatsUsdPattern(this, 'dca_cost_basis_3y'), _2y: createCentsSatsUsdPattern(this, 'dca_cost_basis_2y'),
_4y: createCentsSatsUsdPattern(this, 'dca_cost_basis_4y'), _3y: createCentsSatsUsdPattern(this, 'dca_cost_basis_3y'),
_5y: createCentsSatsUsdPattern(this, 'dca_cost_basis_5y'), _4y: createCentsSatsUsdPattern(this, 'dca_cost_basis_4y'),
_6y: createCentsSatsUsdPattern(this, 'dca_cost_basis_6y'), _5y: createCentsSatsUsdPattern(this, 'dca_cost_basis_5y'),
_8y: createCentsSatsUsdPattern(this, 'dca_cost_basis_8y'), _6y: createCentsSatsUsdPattern(this, 'dca_cost_basis_6y'),
_10y: createCentsSatsUsdPattern(this, 'dca_cost_basis_10y'), _8y: createCentsSatsUsdPattern(this, 'dca_cost_basis_8y'),
_10y: createCentsSatsUsdPattern(this, 'dca_cost_basis_10y'),
},
r#return: create_10y1m1w1y2y3m3y4y5y6m6y8yPattern2(this, 'dca_return'),
cagr: create_10y2y3y4y5y6y8yPattern(this, 'dca_cagr'),
lumpSumStack: create_10y1m1w1y2y3m3y4y5y6m6y8yPattern3(this, 'lump_sum_stack'),
lumpSumReturn: create_10y1m1w1y2y3m3y4y5y6m6y8yPattern2(this, 'lump_sum_return'),
}, },
periodReturn: create_10y1m1w1y2y3m3y4y5y6m6y8yPattern2(this, 'dca_return'), class: {
periodCagr: create_10y2y3y4y5y6y8yPattern(this, 'dca_cagr'), stack: {
periodLumpSumStack: create_10y1m1w1y2y3m3y4y5y6m6y8yPattern3(this, 'lump_sum_stack'), from2015: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2015'),
periodLumpSumReturn: create_10y1m1w1y2y3m3y4y5y6m6y8yPattern2(this, 'lump_sum_return'), from2016: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2016'),
classStack: { from2017: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2017'),
from2015: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2015'), from2018: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2018'),
from2016: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2016'), from2019: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2019'),
from2017: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2017'), from2020: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2020'),
from2018: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2018'), from2021: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2021'),
from2019: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2019'), from2022: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2022'),
from2020: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2020'), from2023: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2023'),
from2021: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2021'), from2024: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2024'),
from2022: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2022'), from2025: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2025'),
from2023: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2023'), from2026: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2026'),
from2024: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2024'), },
from2025: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2025'), costBasis: {
from2026: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2026'), from2015: createCentsSatsUsdPattern(this, 'dca_cost_basis_from_2015'),
}, from2016: createCentsSatsUsdPattern(this, 'dca_cost_basis_from_2016'),
classCostBasis: { from2017: createCentsSatsUsdPattern(this, 'dca_cost_basis_from_2017'),
from2015: createCentsSatsUsdPattern(this, 'dca_cost_basis_from_2015'), from2018: createCentsSatsUsdPattern(this, 'dca_cost_basis_from_2018'),
from2016: createCentsSatsUsdPattern(this, 'dca_cost_basis_from_2016'), from2019: createCentsSatsUsdPattern(this, 'dca_cost_basis_from_2019'),
from2017: createCentsSatsUsdPattern(this, 'dca_cost_basis_from_2017'), from2020: createCentsSatsUsdPattern(this, 'dca_cost_basis_from_2020'),
from2018: createCentsSatsUsdPattern(this, 'dca_cost_basis_from_2018'), from2021: createCentsSatsUsdPattern(this, 'dca_cost_basis_from_2021'),
from2019: createCentsSatsUsdPattern(this, 'dca_cost_basis_from_2019'), from2022: createCentsSatsUsdPattern(this, 'dca_cost_basis_from_2022'),
from2020: createCentsSatsUsdPattern(this, 'dca_cost_basis_from_2020'), from2023: createCentsSatsUsdPattern(this, 'dca_cost_basis_from_2023'),
from2021: createCentsSatsUsdPattern(this, 'dca_cost_basis_from_2021'), from2024: createCentsSatsUsdPattern(this, 'dca_cost_basis_from_2024'),
from2022: createCentsSatsUsdPattern(this, 'dca_cost_basis_from_2022'), from2025: createCentsSatsUsdPattern(this, 'dca_cost_basis_from_2025'),
from2023: createCentsSatsUsdPattern(this, 'dca_cost_basis_from_2023'), from2026: createCentsSatsUsdPattern(this, 'dca_cost_basis_from_2026'),
from2024: createCentsSatsUsdPattern(this, 'dca_cost_basis_from_2024'), },
from2025: createCentsSatsUsdPattern(this, 'dca_cost_basis_from_2025'), r#return: {
from2026: createCentsSatsUsdPattern(this, 'dca_cost_basis_from_2026'), from2015: createBpsPercentRatioPattern(this, 'dca_return_from_2015'),
}, from2016: createBpsPercentRatioPattern(this, 'dca_return_from_2016'),
classReturn: { from2017: createBpsPercentRatioPattern(this, 'dca_return_from_2017'),
from2015: createBpsPercentRatioPattern(this, 'dca_return_from_2015'), from2018: createBpsPercentRatioPattern(this, 'dca_return_from_2018'),
from2016: createBpsPercentRatioPattern(this, 'dca_return_from_2016'), from2019: createBpsPercentRatioPattern(this, 'dca_return_from_2019'),
from2017: createBpsPercentRatioPattern(this, 'dca_return_from_2017'), from2020: createBpsPercentRatioPattern(this, 'dca_return_from_2020'),
from2018: createBpsPercentRatioPattern(this, 'dca_return_from_2018'), from2021: createBpsPercentRatioPattern(this, 'dca_return_from_2021'),
from2019: createBpsPercentRatioPattern(this, 'dca_return_from_2019'), from2022: createBpsPercentRatioPattern(this, 'dca_return_from_2022'),
from2020: createBpsPercentRatioPattern(this, 'dca_return_from_2020'), from2023: createBpsPercentRatioPattern(this, 'dca_return_from_2023'),
from2021: createBpsPercentRatioPattern(this, 'dca_return_from_2021'), from2024: createBpsPercentRatioPattern(this, 'dca_return_from_2024'),
from2022: createBpsPercentRatioPattern(this, 'dca_return_from_2022'), from2025: createBpsPercentRatioPattern(this, 'dca_return_from_2025'),
from2023: createBpsPercentRatioPattern(this, 'dca_return_from_2023'), from2026: createBpsPercentRatioPattern(this, 'dca_return_from_2026'),
from2024: createBpsPercentRatioPattern(this, 'dca_return_from_2024'), },
from2025: createBpsPercentRatioPattern(this, 'dca_return_from_2025'),
from2026: createBpsPercentRatioPattern(this, 'dca_return_from_2026'),
}, },
}, },
technical: { technical: {

View File

@@ -3377,49 +3377,49 @@ class MetricsTree_Blocks_Lookback:
"""Metrics tree node.""" """Metrics tree node."""
def __init__(self, client: BrkClientBase, base_path: str = ''): def __init__(self, client: BrkClientBase, base_path: str = ''):
self.height_1h_ago: MetricPattern18[Height] = MetricPattern18(client, 'height_1h_ago') self._1h: MetricPattern18[Height] = MetricPattern18(client, 'height_1h_ago')
self.height_24h_ago: MetricPattern18[Height] = MetricPattern18(client, 'height_24h_ago') self._24h: MetricPattern18[Height] = MetricPattern18(client, 'height_24h_ago')
self.height_3d_ago: MetricPattern18[Height] = MetricPattern18(client, 'height_3d_ago') self._3d: MetricPattern18[Height] = MetricPattern18(client, 'height_3d_ago')
self.height_1w_ago: MetricPattern18[Height] = MetricPattern18(client, 'height_1w_ago') self._1w: MetricPattern18[Height] = MetricPattern18(client, 'height_1w_ago')
self.height_8d_ago: MetricPattern18[Height] = MetricPattern18(client, 'height_8d_ago') self._8d: MetricPattern18[Height] = MetricPattern18(client, 'height_8d_ago')
self.height_9d_ago: MetricPattern18[Height] = MetricPattern18(client, 'height_9d_ago') self._9d: MetricPattern18[Height] = MetricPattern18(client, 'height_9d_ago')
self.height_12d_ago: MetricPattern18[Height] = MetricPattern18(client, 'height_12d_ago') self._12d: MetricPattern18[Height] = MetricPattern18(client, 'height_12d_ago')
self.height_13d_ago: MetricPattern18[Height] = MetricPattern18(client, 'height_13d_ago') self._13d: MetricPattern18[Height] = MetricPattern18(client, 'height_13d_ago')
self.height_2w_ago: MetricPattern18[Height] = MetricPattern18(client, 'height_2w_ago') self._2w: MetricPattern18[Height] = MetricPattern18(client, 'height_2w_ago')
self.height_21d_ago: MetricPattern18[Height] = MetricPattern18(client, 'height_21d_ago') self._21d: MetricPattern18[Height] = MetricPattern18(client, 'height_21d_ago')
self.height_26d_ago: MetricPattern18[Height] = MetricPattern18(client, 'height_26d_ago') self._26d: MetricPattern18[Height] = MetricPattern18(client, 'height_26d_ago')
self.height_1m_ago: MetricPattern18[Height] = MetricPattern18(client, 'height_1m_ago') self._1m: MetricPattern18[Height] = MetricPattern18(client, 'height_1m_ago')
self.height_34d_ago: MetricPattern18[Height] = MetricPattern18(client, 'height_34d_ago') self._34d: MetricPattern18[Height] = MetricPattern18(client, 'height_34d_ago')
self.height_55d_ago: MetricPattern18[Height] = MetricPattern18(client, 'height_55d_ago') self._55d: MetricPattern18[Height] = MetricPattern18(client, 'height_55d_ago')
self.height_2m_ago: MetricPattern18[Height] = MetricPattern18(client, 'height_2m_ago') self._2m: MetricPattern18[Height] = MetricPattern18(client, 'height_2m_ago')
self.height_9w_ago: MetricPattern18[Height] = MetricPattern18(client, 'height_9w_ago') self._9w: MetricPattern18[Height] = MetricPattern18(client, 'height_9w_ago')
self.height_12w_ago: MetricPattern18[Height] = MetricPattern18(client, 'height_12w_ago') self._12w: MetricPattern18[Height] = MetricPattern18(client, 'height_12w_ago')
self.height_89d_ago: MetricPattern18[Height] = MetricPattern18(client, 'height_89d_ago') self._89d: MetricPattern18[Height] = MetricPattern18(client, 'height_89d_ago')
self.height_3m_ago: MetricPattern18[Height] = MetricPattern18(client, 'height_3m_ago') self._3m: MetricPattern18[Height] = MetricPattern18(client, 'height_3m_ago')
self.height_14w_ago: MetricPattern18[Height] = MetricPattern18(client, 'height_14w_ago') self._14w: MetricPattern18[Height] = MetricPattern18(client, 'height_14w_ago')
self.height_111d_ago: MetricPattern18[Height] = MetricPattern18(client, 'height_111d_ago') self._111d: MetricPattern18[Height] = MetricPattern18(client, 'height_111d_ago')
self.height_144d_ago: MetricPattern18[Height] = MetricPattern18(client, 'height_144d_ago') self._144d: MetricPattern18[Height] = MetricPattern18(client, 'height_144d_ago')
self.height_6m_ago: MetricPattern18[Height] = MetricPattern18(client, 'height_6m_ago') self._6m: MetricPattern18[Height] = MetricPattern18(client, 'height_6m_ago')
self.height_26w_ago: MetricPattern18[Height] = MetricPattern18(client, 'height_26w_ago') self._26w: MetricPattern18[Height] = MetricPattern18(client, 'height_26w_ago')
self.height_200d_ago: MetricPattern18[Height] = MetricPattern18(client, 'height_200d_ago') self._200d: MetricPattern18[Height] = MetricPattern18(client, 'height_200d_ago')
self.height_9m_ago: MetricPattern18[Height] = MetricPattern18(client, 'height_9m_ago') self._9m: MetricPattern18[Height] = MetricPattern18(client, 'height_9m_ago')
self.height_350d_ago: MetricPattern18[Height] = MetricPattern18(client, 'height_350d_ago') self._350d: MetricPattern18[Height] = MetricPattern18(client, 'height_350d_ago')
self.height_12m_ago: MetricPattern18[Height] = MetricPattern18(client, 'height_12m_ago') self._12m: MetricPattern18[Height] = MetricPattern18(client, 'height_12m_ago')
self.height_1y_ago: MetricPattern18[Height] = MetricPattern18(client, 'height_1y_ago') self._1y: MetricPattern18[Height] = MetricPattern18(client, 'height_1y_ago')
self.height_14m_ago: MetricPattern18[Height] = MetricPattern18(client, 'height_14m_ago') self._14m: MetricPattern18[Height] = MetricPattern18(client, 'height_14m_ago')
self.height_2y_ago: MetricPattern18[Height] = MetricPattern18(client, 'height_2y_ago') self._2y: MetricPattern18[Height] = MetricPattern18(client, 'height_2y_ago')
self.height_26m_ago: MetricPattern18[Height] = MetricPattern18(client, 'height_26m_ago') self._26m: MetricPattern18[Height] = MetricPattern18(client, 'height_26m_ago')
self.height_3y_ago: MetricPattern18[Height] = MetricPattern18(client, 'height_3y_ago') self._3y: MetricPattern18[Height] = MetricPattern18(client, 'height_3y_ago')
self.height_200w_ago: MetricPattern18[Height] = MetricPattern18(client, 'height_200w_ago') self._200w: MetricPattern18[Height] = MetricPattern18(client, 'height_200w_ago')
self.height_4y_ago: MetricPattern18[Height] = MetricPattern18(client, 'height_4y_ago') self._4y: MetricPattern18[Height] = MetricPattern18(client, 'height_4y_ago')
self.height_5y_ago: MetricPattern18[Height] = MetricPattern18(client, 'height_5y_ago') self._5y: MetricPattern18[Height] = MetricPattern18(client, 'height_5y_ago')
self.height_6y_ago: MetricPattern18[Height] = MetricPattern18(client, 'height_6y_ago') self._6y: MetricPattern18[Height] = MetricPattern18(client, 'height_6y_ago')
self.height_8y_ago: MetricPattern18[Height] = MetricPattern18(client, 'height_8y_ago') self._8y: MetricPattern18[Height] = MetricPattern18(client, 'height_8y_ago')
self.height_9y_ago: MetricPattern18[Height] = MetricPattern18(client, 'height_9y_ago') self._9y: MetricPattern18[Height] = MetricPattern18(client, 'height_9y_ago')
self.height_10y_ago: MetricPattern18[Height] = MetricPattern18(client, 'height_10y_ago') self._10y: MetricPattern18[Height] = MetricPattern18(client, 'height_10y_ago')
self.height_12y_ago: MetricPattern18[Height] = MetricPattern18(client, 'height_12y_ago') self._12y: MetricPattern18[Height] = MetricPattern18(client, 'height_12y_ago')
self.height_14y_ago: MetricPattern18[Height] = MetricPattern18(client, 'height_14y_ago') self._14y: MetricPattern18[Height] = MetricPattern18(client, 'height_14y_ago')
self.height_26y_ago: MetricPattern18[Height] = MetricPattern18(client, 'height_26y_ago') self._26y: MetricPattern18[Height] = MetricPattern18(client, 'height_26y_ago')
class MetricsTree_Blocks_Halving: class MetricsTree_Blocks_Halving:
"""Metrics tree node.""" """Metrics tree node."""
@@ -4177,6 +4177,29 @@ class MetricsTree_Market_Range:
self.true_range_sum_2w: MetricPattern1[StoredF32] = MetricPattern1(client, 'price_true_range_sum_2w') self.true_range_sum_2w: MetricPattern1[StoredF32] = MetricPattern1(client, 'price_true_range_sum_2w')
self.choppiness_index_2w: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'price_choppiness_index_2w') self.choppiness_index_2w: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'price_choppiness_index_2w')
class MetricsTree_Market_MovingAverage_Sma_200d:
"""Metrics tree node."""
def __init__(self, client: BrkClientBase, base_path: str = ''):
self.cents: MetricPattern1[Cents] = MetricPattern1(client, 'price_sma_200d_cents')
self.usd: MetricPattern1[Dollars] = MetricPattern1(client, 'price_sma_200d_usd')
self.sats: MetricPattern1[SatsFract] = MetricPattern1(client, 'price_sma_200d_sats')
self.bps: MetricPattern1[BasisPoints32] = MetricPattern1(client, 'price_sma_200d_ratio_bps')
self.ratio: MetricPattern1[StoredF32] = MetricPattern1(client, 'price_sma_200d_ratio')
self.x2_4: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_sma_200d_x2_4')
self.x0_8: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_sma_200d_x0_8')
class MetricsTree_Market_MovingAverage_Sma_350d:
"""Metrics tree node."""
def __init__(self, client: BrkClientBase, base_path: str = ''):
self.cents: MetricPattern1[Cents] = MetricPattern1(client, 'price_sma_350d_cents')
self.usd: MetricPattern1[Dollars] = MetricPattern1(client, 'price_sma_350d_usd')
self.sats: MetricPattern1[SatsFract] = MetricPattern1(client, 'price_sma_350d_sats')
self.bps: MetricPattern1[BasisPoints32] = MetricPattern1(client, 'price_sma_350d_ratio_bps')
self.ratio: MetricPattern1[StoredF32] = MetricPattern1(client, 'price_sma_350d_ratio')
self.x2: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_sma_350d_x2')
class MetricsTree_Market_MovingAverage_Sma: class MetricsTree_Market_MovingAverage_Sma:
"""Metrics tree node.""" """Metrics tree node."""
@@ -4191,15 +4214,12 @@ class MetricsTree_Market_MovingAverage_Sma:
self._89d: BpsCentsRatioSatsUsdPattern = BpsCentsRatioSatsUsdPattern(client, 'price_sma_89d') self._89d: BpsCentsRatioSatsUsdPattern = BpsCentsRatioSatsUsdPattern(client, 'price_sma_89d')
self._111d: BpsCentsRatioSatsUsdPattern = BpsCentsRatioSatsUsdPattern(client, 'price_sma_111d') self._111d: BpsCentsRatioSatsUsdPattern = BpsCentsRatioSatsUsdPattern(client, 'price_sma_111d')
self._144d: BpsCentsRatioSatsUsdPattern = BpsCentsRatioSatsUsdPattern(client, 'price_sma_144d') self._144d: BpsCentsRatioSatsUsdPattern = BpsCentsRatioSatsUsdPattern(client, 'price_sma_144d')
self._200d: BpsCentsRatioSatsUsdPattern = BpsCentsRatioSatsUsdPattern(client, 'price_sma_200d') self._200d: MetricsTree_Market_MovingAverage_Sma_200d = MetricsTree_Market_MovingAverage_Sma_200d(client)
self._350d: BpsCentsRatioSatsUsdPattern = BpsCentsRatioSatsUsdPattern(client, 'price_sma_350d') self._350d: MetricsTree_Market_MovingAverage_Sma_350d = MetricsTree_Market_MovingAverage_Sma_350d(client)
self._1y: BpsCentsRatioSatsUsdPattern = BpsCentsRatioSatsUsdPattern(client, 'price_sma_1y') self._1y: BpsCentsRatioSatsUsdPattern = BpsCentsRatioSatsUsdPattern(client, 'price_sma_1y')
self._2y: BpsCentsRatioSatsUsdPattern = BpsCentsRatioSatsUsdPattern(client, 'price_sma_2y') self._2y: BpsCentsRatioSatsUsdPattern = BpsCentsRatioSatsUsdPattern(client, 'price_sma_2y')
self._200w: BpsCentsRatioSatsUsdPattern = BpsCentsRatioSatsUsdPattern(client, 'price_sma_200w') self._200w: BpsCentsRatioSatsUsdPattern = BpsCentsRatioSatsUsdPattern(client, 'price_sma_200w')
self._4y: BpsCentsRatioSatsUsdPattern = BpsCentsRatioSatsUsdPattern(client, 'price_sma_4y') self._4y: BpsCentsRatioSatsUsdPattern = BpsCentsRatioSatsUsdPattern(client, 'price_sma_4y')
self._200d_x2_4: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_sma_200d_x2_4')
self._200d_x0_8: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_sma_200d_x0_8')
self._350d_x2: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_sma_350d_x2')
class MetricsTree_Market_MovingAverage_Ema: class MetricsTree_Market_MovingAverage_Ema:
"""Metrics tree node.""" """Metrics tree node."""
@@ -4229,7 +4249,7 @@ class MetricsTree_Market_MovingAverage:
self.sma: MetricsTree_Market_MovingAverage_Sma = MetricsTree_Market_MovingAverage_Sma(client) self.sma: MetricsTree_Market_MovingAverage_Sma = MetricsTree_Market_MovingAverage_Sma(client)
self.ema: MetricsTree_Market_MovingAverage_Ema = MetricsTree_Market_MovingAverage_Ema(client) self.ema: MetricsTree_Market_MovingAverage_Ema = MetricsTree_Market_MovingAverage_Ema(client)
class MetricsTree_Market_Dca_PeriodCostBasis: class MetricsTree_Market_Dca_Period_CostBasis:
"""Metrics tree node.""" """Metrics tree node."""
def __init__(self, client: BrkClientBase, base_path: str = ''): def __init__(self, client: BrkClientBase, base_path: str = ''):
@@ -4246,7 +4266,18 @@ class MetricsTree_Market_Dca_PeriodCostBasis:
self._8y: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'dca_cost_basis_8y') self._8y: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'dca_cost_basis_8y')
self._10y: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'dca_cost_basis_10y') self._10y: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'dca_cost_basis_10y')
class MetricsTree_Market_Dca_ClassStack: class MetricsTree_Market_Dca_Period:
"""Metrics tree node."""
def __init__(self, client: BrkClientBase, base_path: str = ''):
self.stack: _10y1m1w1y2y3m3y4y5y6m6y8yPattern3 = _10y1m1w1y2y3m3y4y5y6m6y8yPattern3(client, 'dca_stack')
self.cost_basis: MetricsTree_Market_Dca_Period_CostBasis = MetricsTree_Market_Dca_Period_CostBasis(client)
self.r#return: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2 = _10y1m1w1y2y3m3y4y5y6m6y8yPattern2(client, 'dca_return')
self.cagr: _10y2y3y4y5y6y8yPattern = _10y2y3y4y5y6y8yPattern(client, 'dca_cagr')
self.lump_sum_stack: _10y1m1w1y2y3m3y4y5y6m6y8yPattern3 = _10y1m1w1y2y3m3y4y5y6m6y8yPattern3(client, 'lump_sum_stack')
self.lump_sum_return: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2 = _10y1m1w1y2y3m3y4y5y6m6y8yPattern2(client, 'lump_sum_return')
class MetricsTree_Market_Dca_Class_Stack:
"""Metrics tree node.""" """Metrics tree node."""
def __init__(self, client: BrkClientBase, base_path: str = ''): def __init__(self, client: BrkClientBase, base_path: str = ''):
@@ -4263,7 +4294,7 @@ class MetricsTree_Market_Dca_ClassStack:
self.from_2025: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'dca_stack_from_2025') self.from_2025: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'dca_stack_from_2025')
self.from_2026: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'dca_stack_from_2026') self.from_2026: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'dca_stack_from_2026')
class MetricsTree_Market_Dca_ClassCostBasis: class MetricsTree_Market_Dca_Class_CostBasis:
"""Metrics tree node.""" """Metrics tree node."""
def __init__(self, client: BrkClientBase, base_path: str = ''): def __init__(self, client: BrkClientBase, base_path: str = ''):
@@ -4280,7 +4311,7 @@ class MetricsTree_Market_Dca_ClassCostBasis:
self.from_2025: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'dca_cost_basis_from_2025') self.from_2025: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'dca_cost_basis_from_2025')
self.from_2026: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'dca_cost_basis_from_2026') self.from_2026: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'dca_cost_basis_from_2026')
class MetricsTree_Market_Dca_ClassReturn: class MetricsTree_Market_Dca_Class_R#return:
"""Metrics tree node.""" """Metrics tree node."""
def __init__(self, client: BrkClientBase, base_path: str = ''): def __init__(self, client: BrkClientBase, base_path: str = ''):
@@ -4297,20 +4328,21 @@ class MetricsTree_Market_Dca_ClassReturn:
self.from_2025: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'dca_return_from_2025') self.from_2025: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'dca_return_from_2025')
self.from_2026: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'dca_return_from_2026') self.from_2026: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'dca_return_from_2026')
class MetricsTree_Market_Dca_Class:
"""Metrics tree node."""
def __init__(self, client: BrkClientBase, base_path: str = ''):
self.stack: MetricsTree_Market_Dca_Class_Stack = MetricsTree_Market_Dca_Class_Stack(client)
self.cost_basis: MetricsTree_Market_Dca_Class_CostBasis = MetricsTree_Market_Dca_Class_CostBasis(client)
self.r#return: MetricsTree_Market_Dca_Class_R#return = MetricsTree_Market_Dca_Class_R#return(client)
class MetricsTree_Market_Dca: class MetricsTree_Market_Dca:
"""Metrics tree node.""" """Metrics tree node."""
def __init__(self, client: BrkClientBase, base_path: str = ''): def __init__(self, client: BrkClientBase, base_path: str = ''):
self.dca_sats_per_day: MetricPattern18[Sats] = MetricPattern18(client, 'dca_sats_per_day') self.sats_per_day: MetricPattern18[Sats] = MetricPattern18(client, 'dca_sats_per_day')
self.period_stack: _10y1m1w1y2y3m3y4y5y6m6y8yPattern3 = _10y1m1w1y2y3m3y4y5y6m6y8yPattern3(client, 'dca_stack') self.period: MetricsTree_Market_Dca_Period = MetricsTree_Market_Dca_Period(client)
self.period_cost_basis: MetricsTree_Market_Dca_PeriodCostBasis = MetricsTree_Market_Dca_PeriodCostBasis(client) self.class: MetricsTree_Market_Dca_Class = MetricsTree_Market_Dca_Class(client)
self.period_return: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2 = _10y1m1w1y2y3m3y4y5y6m6y8yPattern2(client, 'dca_return')
self.period_cagr: _10y2y3y4y5y6y8yPattern = _10y2y3y4y5y6y8yPattern(client, 'dca_cagr')
self.period_lump_sum_stack: _10y1m1w1y2y3m3y4y5y6m6y8yPattern3 = _10y1m1w1y2y3m3y4y5y6m6y8yPattern3(client, 'lump_sum_stack')
self.period_lump_sum_return: _10y1m1w1y2y3m3y4y5y6m6y8yPattern2 = _10y1m1w1y2y3m3y4y5y6m6y8yPattern2(client, 'lump_sum_return')
self.class_stack: MetricsTree_Market_Dca_ClassStack = MetricsTree_Market_Dca_ClassStack(client)
self.class_cost_basis: MetricsTree_Market_Dca_ClassCostBasis = MetricsTree_Market_Dca_ClassCostBasis(client)
self.class_return: MetricsTree_Market_Dca_ClassReturn = MetricsTree_Market_Dca_ClassReturn(client)
class MetricsTree_Market_Technical_Rsi_1w: class MetricsTree_Market_Technical_Rsi_1w:
"""Metrics tree node.""" """Metrics tree node."""