mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-24 06:39:58 -07:00
global: snapshot
This commit is contained in:
@@ -14,30 +14,27 @@ impl Vecs {
|
||||
activity: &activity::Vecs,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.cointime_adj_inflation_rate
|
||||
.bps
|
||||
.height
|
||||
.compute_transform2(
|
||||
starting_indexes.height,
|
||||
&activity.liveliness.height,
|
||||
&supply.inflation_rate.bps.height,
|
||||
|(h, liveliness, inflation, ..)| {
|
||||
(
|
||||
h,
|
||||
BasisPointsSigned32::from(f64::from(liveliness) * f64::from(inflation)),
|
||||
)
|
||||
},
|
||||
exit,
|
||||
)?;
|
||||
self.adj_inflation_rate.bps.height.compute_transform2(
|
||||
starting_indexes.height,
|
||||
&activity.liveliness.height,
|
||||
&supply.inflation_rate.bps.height,
|
||||
|(h, liveliness, inflation, ..)| {
|
||||
(
|
||||
h,
|
||||
BasisPointsSigned32::from(f64::from(liveliness) * f64::from(inflation)),
|
||||
)
|
||||
},
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.cointime_adj_tx_velocity_btc.height.compute_multiply(
|
||||
self.adj_tx_velocity_btc.height.compute_multiply(
|
||||
starting_indexes.height,
|
||||
&activity.activity_to_vaultedness_ratio.height,
|
||||
&supply.velocity.btc.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.cointime_adj_tx_velocity_usd.height.compute_multiply(
|
||||
self.adj_tx_velocity_usd.height.compute_multiply(
|
||||
starting_indexes.height,
|
||||
&activity.activity_to_vaultedness_ratio.height,
|
||||
&supply.velocity.usd.height,
|
||||
|
||||
@@ -15,19 +15,19 @@ impl Vecs {
|
||||
indexes: &indexes::Vecs,
|
||||
) -> Result<Self> {
|
||||
Ok(Self {
|
||||
cointime_adj_inflation_rate: PercentPerBlock::forced_import(
|
||||
adj_inflation_rate: PercentPerBlock::forced_import(
|
||||
db,
|
||||
"cointime_adj_inflation_rate",
|
||||
version,
|
||||
indexes,
|
||||
)?,
|
||||
cointime_adj_tx_velocity_btc: ComputedPerBlock::forced_import(
|
||||
adj_tx_velocity_btc: ComputedPerBlock::forced_import(
|
||||
db,
|
||||
"cointime_adj_tx_velocity_btc",
|
||||
version,
|
||||
indexes,
|
||||
)?,
|
||||
cointime_adj_tx_velocity_usd: ComputedPerBlock::forced_import(
|
||||
adj_tx_velocity_usd: ComputedPerBlock::forced_import(
|
||||
db,
|
||||
"cointime_adj_tx_velocity_usd",
|
||||
version,
|
||||
|
||||
@@ -6,7 +6,7 @@ use crate::internal::{ComputedPerBlock, PercentPerBlock};
|
||||
|
||||
#[derive(Traversable)]
|
||||
pub struct Vecs<M: StorageMode = Rw> {
|
||||
pub cointime_adj_inflation_rate: PercentPerBlock<BasisPointsSigned32, M>,
|
||||
pub cointime_adj_tx_velocity_btc: ComputedPerBlock<StoredF64, M>,
|
||||
pub cointime_adj_tx_velocity_usd: ComputedPerBlock<StoredF64, M>,
|
||||
pub adj_inflation_rate: PercentPerBlock<BasisPointsSigned32, M>,
|
||||
pub adj_tx_velocity_btc: ComputedPerBlock<StoredF64, M>,
|
||||
pub adj_tx_velocity_usd: ComputedPerBlock<StoredF64, M>,
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ impl Vecs {
|
||||
// cointime_cap = (cointime_value_destroyed_cumulative * circulating_supply) / coinblocks_stored_cumulative
|
||||
self.cointime_cap.cents.height.compute_transform3(
|
||||
starting_indexes.height,
|
||||
&value.cointime_value_destroyed.cumulative.height,
|
||||
&value.value_destroyed.cumulative.height,
|
||||
circulating_supply,
|
||||
&activity.coinblocks_stored.cumulative.height,
|
||||
|(i, destroyed, supply, stored, ..)| {
|
||||
|
||||
@@ -23,11 +23,8 @@ impl Vecs {
|
||||
let coindays_destroyed = &all_metrics.activity.coindays_destroyed;
|
||||
let circulating_supply = &all_metrics.supply.total.btc.height;
|
||||
|
||||
self.cointime_value_destroyed.compute(
|
||||
starting_indexes.height,
|
||||
&window_starts,
|
||||
exit,
|
||||
|vec| {
|
||||
self.value_destroyed
|
||||
.compute(starting_indexes.height, &window_starts, exit, |vec| {
|
||||
vec.compute_multiply(
|
||||
starting_indexes.height,
|
||||
&prices.price.usd.height,
|
||||
@@ -35,14 +32,10 @@ impl Vecs {
|
||||
exit,
|
||||
)?;
|
||||
Ok(())
|
||||
},
|
||||
)?;
|
||||
})?;
|
||||
|
||||
self.cointime_value_created.compute(
|
||||
starting_indexes.height,
|
||||
&window_starts,
|
||||
exit,
|
||||
|vec| {
|
||||
self.value_created
|
||||
.compute(starting_indexes.height, &window_starts, exit, |vec| {
|
||||
vec.compute_multiply(
|
||||
starting_indexes.height,
|
||||
&prices.price.usd.height,
|
||||
@@ -50,14 +43,10 @@ impl Vecs {
|
||||
exit,
|
||||
)?;
|
||||
Ok(())
|
||||
},
|
||||
)?;
|
||||
})?;
|
||||
|
||||
self.cointime_value_stored.compute(
|
||||
starting_indexes.height,
|
||||
&window_starts,
|
||||
exit,
|
||||
|vec| {
|
||||
self.value_stored
|
||||
.compute(starting_indexes.height, &window_starts, exit, |vec| {
|
||||
vec.compute_multiply(
|
||||
starting_indexes.height,
|
||||
&prices.price.usd.height,
|
||||
@@ -65,8 +54,7 @@ impl Vecs {
|
||||
exit,
|
||||
)?;
|
||||
Ok(())
|
||||
},
|
||||
)?;
|
||||
})?;
|
||||
|
||||
// VOCDD: Value of Coin Days Destroyed = price × (CDD / circulating_supply)
|
||||
// Supply-adjusted to account for growing supply over time
|
||||
|
||||
@@ -12,19 +12,19 @@ impl Vecs {
|
||||
indexes: &indexes::Vecs,
|
||||
) -> Result<Self> {
|
||||
Ok(Self {
|
||||
cointime_value_destroyed: ComputedPerBlockCumulativeSum::forced_import(
|
||||
value_destroyed: ComputedPerBlockCumulativeSum::forced_import(
|
||||
db,
|
||||
"cointime_value_destroyed",
|
||||
version,
|
||||
indexes,
|
||||
)?,
|
||||
cointime_value_created: ComputedPerBlockCumulativeSum::forced_import(
|
||||
value_created: ComputedPerBlockCumulativeSum::forced_import(
|
||||
db,
|
||||
"cointime_value_created",
|
||||
version,
|
||||
indexes,
|
||||
)?,
|
||||
cointime_value_stored: ComputedPerBlockCumulativeSum::forced_import(
|
||||
value_stored: ComputedPerBlockCumulativeSum::forced_import(
|
||||
db,
|
||||
"cointime_value_stored",
|
||||
version,
|
||||
|
||||
@@ -6,8 +6,8 @@ use crate::internal::ComputedPerBlockCumulativeSum;
|
||||
|
||||
#[derive(Traversable)]
|
||||
pub struct Vecs<M: StorageMode = Rw> {
|
||||
pub cointime_value_destroyed: ComputedPerBlockCumulativeSum<StoredF64, M>,
|
||||
pub cointime_value_created: ComputedPerBlockCumulativeSum<StoredF64, M>,
|
||||
pub cointime_value_stored: ComputedPerBlockCumulativeSum<StoredF64, M>,
|
||||
pub value_destroyed: ComputedPerBlockCumulativeSum<StoredF64, M>,
|
||||
pub value_created: ComputedPerBlockCumulativeSum<StoredF64, M>,
|
||||
pub value_stored: ComputedPerBlockCumulativeSum<StoredF64, M>,
|
||||
pub vocdd: ComputedPerBlockCumulativeSum<StoredF64, M>,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user