mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-24 14:49:58 -07:00
global: snapshot
This commit is contained in:
@@ -5,7 +5,7 @@ use vecdb::Database;
|
||||
use super::Vecs;
|
||||
use crate::{
|
||||
indexes,
|
||||
internal::{ComputedFromHeightCumulativeSum, ComputedFromHeightLast},
|
||||
internal::{ComputedFromHeightCumulativeSum, ComputedFromHeight},
|
||||
};
|
||||
|
||||
impl Vecs {
|
||||
@@ -23,9 +23,9 @@ impl Vecs {
|
||||
version,
|
||||
indexes,
|
||||
)?,
|
||||
liveliness: ComputedFromHeightLast::forced_import(db, "liveliness", version, indexes)?,
|
||||
vaultedness: ComputedFromHeightLast::forced_import(db, "vaultedness", version, indexes)?,
|
||||
activity_to_vaultedness_ratio: ComputedFromHeightLast::forced_import(
|
||||
liveliness: ComputedFromHeight::forced_import(db, "liveliness", version, indexes)?,
|
||||
vaultedness: ComputedFromHeight::forced_import(db, "vaultedness", version, indexes)?,
|
||||
activity_to_vaultedness_ratio: ComputedFromHeight::forced_import(
|
||||
db,
|
||||
"activity_to_vaultedness_ratio",
|
||||
version,
|
||||
|
||||
@@ -2,13 +2,13 @@ use brk_traversable::Traversable;
|
||||
use brk_types::StoredF64;
|
||||
use vecdb::{Rw, StorageMode};
|
||||
|
||||
use crate::internal::{ComputedFromHeightCumulativeSum, ComputedFromHeightLast};
|
||||
use crate::internal::{ComputedFromHeightCumulativeSum, ComputedFromHeight};
|
||||
|
||||
#[derive(Traversable)]
|
||||
pub struct Vecs<M: StorageMode = Rw> {
|
||||
pub coinblocks_created: ComputedFromHeightCumulativeSum<StoredF64, M>,
|
||||
pub coinblocks_stored: ComputedFromHeightCumulativeSum<StoredF64, M>,
|
||||
pub liveliness: ComputedFromHeightLast<StoredF64, M>,
|
||||
pub vaultedness: ComputedFromHeightLast<StoredF64, M>,
|
||||
pub activity_to_vaultedness_ratio: ComputedFromHeightLast<StoredF64, M>,
|
||||
pub liveliness: ComputedFromHeight<StoredF64, M>,
|
||||
pub vaultedness: ComputedFromHeight<StoredF64, M>,
|
||||
pub activity_to_vaultedness_ratio: ComputedFromHeight<StoredF64, M>,
|
||||
}
|
||||
|
||||
@@ -3,24 +3,24 @@ use brk_types::Version;
|
||||
use vecdb::Database;
|
||||
|
||||
use super::Vecs;
|
||||
use crate::{indexes, internal::ComputedFromHeightLast};
|
||||
use crate::{indexes, internal::ComputedFromHeight};
|
||||
|
||||
impl Vecs {
|
||||
pub(crate) fn forced_import(db: &Database, version: Version, indexes: &indexes::Vecs) -> Result<Self> {
|
||||
Ok(Self {
|
||||
cointime_adj_inflation_rate: ComputedFromHeightLast::forced_import(
|
||||
cointime_adj_inflation_rate: ComputedFromHeight::forced_import(
|
||||
db,
|
||||
"cointime_adj_inflation_rate",
|
||||
version,
|
||||
indexes,
|
||||
)?,
|
||||
cointime_adj_tx_btc_velocity: ComputedFromHeightLast::forced_import(
|
||||
cointime_adj_tx_btc_velocity: ComputedFromHeight::forced_import(
|
||||
db,
|
||||
"cointime_adj_tx_btc_velocity",
|
||||
version,
|
||||
indexes,
|
||||
)?,
|
||||
cointime_adj_tx_usd_velocity: ComputedFromHeightLast::forced_import(
|
||||
cointime_adj_tx_usd_velocity: ComputedFromHeight::forced_import(
|
||||
db,
|
||||
"cointime_adj_tx_usd_velocity",
|
||||
version,
|
||||
|
||||
@@ -2,11 +2,11 @@ use brk_traversable::Traversable;
|
||||
use brk_types::{StoredF32, StoredF64};
|
||||
use vecdb::{Rw, StorageMode};
|
||||
|
||||
use crate::internal::ComputedFromHeightLast;
|
||||
use crate::internal::ComputedFromHeight;
|
||||
|
||||
#[derive(Traversable)]
|
||||
pub struct Vecs<M: StorageMode = Rw> {
|
||||
pub cointime_adj_inflation_rate: ComputedFromHeightLast<StoredF32, M>,
|
||||
pub cointime_adj_tx_btc_velocity: ComputedFromHeightLast<StoredF64, M>,
|
||||
pub cointime_adj_tx_usd_velocity: ComputedFromHeightLast<StoredF64, M>,
|
||||
pub cointime_adj_inflation_rate: ComputedFromHeight<StoredF32, M>,
|
||||
pub cointime_adj_tx_btc_velocity: ComputedFromHeight<StoredF64, M>,
|
||||
pub cointime_adj_tx_usd_velocity: ComputedFromHeight<StoredF64, M>,
|
||||
}
|
||||
|
||||
@@ -3,16 +3,16 @@ use brk_types::Version;
|
||||
use vecdb::Database;
|
||||
|
||||
use super::Vecs;
|
||||
use crate::{indexes, internal::FiatFromHeightLast};
|
||||
use crate::{indexes, internal::FiatFromHeight};
|
||||
|
||||
impl Vecs {
|
||||
pub(crate) fn forced_import(db: &Database, version: Version, indexes: &indexes::Vecs) -> Result<Self> {
|
||||
Ok(Self {
|
||||
thermo_cap: FiatFromHeightLast::forced_import(db, "thermo_cap", version, indexes)?,
|
||||
investor_cap: FiatFromHeightLast::forced_import(db, "investor_cap", version, indexes)?,
|
||||
vaulted_cap: FiatFromHeightLast::forced_import(db, "vaulted_cap", version, indexes)?,
|
||||
active_cap: FiatFromHeightLast::forced_import(db, "active_cap", version, indexes)?,
|
||||
cointime_cap: FiatFromHeightLast::forced_import(db, "cointime_cap", version, indexes)?,
|
||||
thermo_cap: FiatFromHeight::forced_import(db, "thermo_cap", version, indexes)?,
|
||||
investor_cap: FiatFromHeight::forced_import(db, "investor_cap", version, indexes)?,
|
||||
vaulted_cap: FiatFromHeight::forced_import(db, "vaulted_cap", version, indexes)?,
|
||||
active_cap: FiatFromHeight::forced_import(db, "active_cap", version, indexes)?,
|
||||
cointime_cap: FiatFromHeight::forced_import(db, "cointime_cap", version, indexes)?,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,13 +2,13 @@ use brk_traversable::Traversable;
|
||||
use brk_types::Cents;
|
||||
use vecdb::{Rw, StorageMode};
|
||||
|
||||
use crate::internal::FiatFromHeightLast;
|
||||
use crate::internal::FiatFromHeight;
|
||||
|
||||
#[derive(Traversable)]
|
||||
pub struct Vecs<M: StorageMode = Rw> {
|
||||
pub thermo_cap: FiatFromHeightLast<Cents, M>,
|
||||
pub investor_cap: FiatFromHeightLast<Cents, M>,
|
||||
pub vaulted_cap: FiatFromHeightLast<Cents, M>,
|
||||
pub active_cap: FiatFromHeightLast<Cents, M>,
|
||||
pub cointime_cap: FiatFromHeightLast<Cents, M>,
|
||||
pub thermo_cap: FiatFromHeight<Cents, M>,
|
||||
pub investor_cap: FiatFromHeight<Cents, M>,
|
||||
pub vaulted_cap: FiatFromHeight<Cents, M>,
|
||||
pub active_cap: FiatFromHeight<Cents, M>,
|
||||
pub cointime_cap: FiatFromHeight<Cents, M>,
|
||||
}
|
||||
|
||||
@@ -2,16 +2,16 @@ use brk_traversable::Traversable;
|
||||
use brk_types::Cents;
|
||||
use vecdb::{Rw, StorageMode};
|
||||
|
||||
use crate::internal::{ComputedFromHeightLast, ComputedFromHeightRatioExtended, Price};
|
||||
use crate::internal::{ComputedFromHeight, ComputedFromHeightRatioExtended, Price};
|
||||
|
||||
#[derive(Traversable)]
|
||||
pub struct Vecs<M: StorageMode = Rw> {
|
||||
pub vaulted_price: Price<ComputedFromHeightLast<Cents, M>>,
|
||||
pub vaulted_price: Price<ComputedFromHeight<Cents, M>>,
|
||||
pub vaulted_price_ratio: ComputedFromHeightRatioExtended<M>,
|
||||
pub active_price: Price<ComputedFromHeightLast<Cents, M>>,
|
||||
pub active_price: Price<ComputedFromHeight<Cents, M>>,
|
||||
pub active_price_ratio: ComputedFromHeightRatioExtended<M>,
|
||||
pub true_market_mean: Price<ComputedFromHeightLast<Cents, M>>,
|
||||
pub true_market_mean: Price<ComputedFromHeight<Cents, M>>,
|
||||
pub true_market_mean_ratio: ComputedFromHeightRatioExtended<M>,
|
||||
pub cointime_price: Price<ComputedFromHeightLast<Cents, M>>,
|
||||
pub cointime_price: Price<ComputedFromHeight<Cents, M>>,
|
||||
pub cointime_price_ratio: ComputedFromHeightRatioExtended<M>,
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ use brk_types::Version;
|
||||
use vecdb::{Database, EagerVec, ImportableVec};
|
||||
|
||||
use super::Vecs;
|
||||
use crate::{indexes, internal::ComputedFromHeightLast};
|
||||
use crate::{indexes, internal::ComputedFromHeight};
|
||||
|
||||
impl Vecs {
|
||||
pub(crate) fn forced_import(
|
||||
@@ -15,7 +15,7 @@ impl Vecs {
|
||||
Ok(Self {
|
||||
vocdd_365d_median: EagerVec::forced_import(db, "vocdd_365d_median", v1)?,
|
||||
hodl_bank: EagerVec::forced_import(db, "hodl_bank", v1)?,
|
||||
reserve_risk: ComputedFromHeightLast::forced_import(db, "reserve_risk", v1, indexes)?,
|
||||
reserve_risk: ComputedFromHeight::forced_import(db, "reserve_risk", v1, indexes)?,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,11 +2,11 @@ use brk_traversable::Traversable;
|
||||
use brk_types::{Height, StoredF64};
|
||||
use vecdb::{EagerVec, PcoVec, Rw, StorageMode};
|
||||
|
||||
use crate::internal::ComputedFromHeightLast;
|
||||
use crate::internal::ComputedFromHeight;
|
||||
|
||||
#[derive(Traversable)]
|
||||
pub struct Vecs<M: StorageMode = Rw> {
|
||||
pub vocdd_365d_median: M::Stored<EagerVec<PcoVec<Height, StoredF64>>>,
|
||||
pub hodl_bank: M::Stored<EagerVec<PcoVec<Height, StoredF64>>>,
|
||||
pub reserve_risk: ComputedFromHeightLast<StoredF64, M>,
|
||||
pub reserve_risk: ComputedFromHeight<StoredF64, M>,
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ use brk_types::Version;
|
||||
use vecdb::Database;
|
||||
|
||||
use super::Vecs;
|
||||
use crate::{indexes, internal::ValueFromHeightLast};
|
||||
use crate::{indexes, internal::ValueFromHeight};
|
||||
|
||||
impl Vecs {
|
||||
pub(crate) fn forced_import(
|
||||
@@ -12,13 +12,13 @@ impl Vecs {
|
||||
indexes: &indexes::Vecs,
|
||||
) -> Result<Self> {
|
||||
Ok(Self {
|
||||
vaulted_supply: ValueFromHeightLast::forced_import(
|
||||
vaulted_supply: ValueFromHeight::forced_import(
|
||||
db,
|
||||
"vaulted_supply",
|
||||
version,
|
||||
indexes,
|
||||
)?,
|
||||
active_supply: ValueFromHeightLast::forced_import(
|
||||
active_supply: ValueFromHeight::forced_import(
|
||||
db,
|
||||
"active_supply",
|
||||
version,
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
use brk_traversable::Traversable;
|
||||
use vecdb::{Rw, StorageMode};
|
||||
|
||||
use crate::internal::ValueFromHeightLast;
|
||||
use crate::internal::ValueFromHeight;
|
||||
|
||||
#[derive(Traversable)]
|
||||
pub struct Vecs<M: StorageMode = Rw> {
|
||||
pub vaulted_supply: ValueFromHeightLast<M>,
|
||||
pub active_supply: ValueFromHeightLast<M>,
|
||||
pub vaulted_supply: ValueFromHeight<M>,
|
||||
pub active_supply: ValueFromHeight<M>,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user