global: snapshot

This commit is contained in:
nym21
2026-03-14 15:53:40 +01:00
parent f705cc04a9
commit 9d365f4bbb
18 changed files with 456 additions and 516 deletions
@@ -17,8 +17,8 @@ impl Vecs {
// velocity = rolling_1y_sum(volume) / circulating_supply
let circulating_supply = &distribution.utxo_cohorts.all.metrics.supply.total;
// BTC velocity at height level
self.btc.height.compute_rolling_ratio(
// Native velocity at height level
self.native.height.compute_rolling_ratio(
starting_indexes.height,
&blocks.lookback._1y,
&transactions.volume.sent_sum.base.sats.height,
@@ -26,8 +26,8 @@ impl Vecs {
exit,
)?;
// USD velocity at height level
self.usd.height.compute_rolling_ratio(
// Fiat velocity at height level
self.fiat.height.compute_rolling_ratio(
starting_indexes.height,
&blocks.lookback._1y,
&transactions.volume.sent_sum.base.usd.height,
@@ -12,8 +12,8 @@ impl Vecs {
indexes: &indexes::Vecs,
) -> Result<Self> {
Ok(Self {
btc: PerBlock::forced_import(db, "velocity_btc", version, indexes)?,
usd: PerBlock::forced_import(db, "velocity_usd", version, indexes)?,
native: PerBlock::forced_import(db, "velocity", version, indexes)?,
fiat: PerBlock::forced_import(db, "velocity_fiat", version, indexes)?,
})
}
}
@@ -6,6 +6,6 @@ use crate::internal::PerBlock;
#[derive(Traversable)]
pub struct Vecs<M: StorageMode = Rw> {
pub btc: PerBlock<StoredF64, M>,
pub usd: PerBlock<StoredF64, M>,
pub native: PerBlock<StoredF64, M>,
pub fiat: PerBlock<StoredF64, M>,
}