mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-07-14 20:48:12 -07:00
global: BIG snapshot
This commit is contained in:
@@ -15,28 +15,25 @@ impl Vecs {
|
||||
indexes: &indexes::Vecs,
|
||||
compute_dollars: bool,
|
||||
) -> Result<Self> {
|
||||
let v0 = Version::ZERO;
|
||||
|
||||
let height_to_opreturn = EagerVec::forced_import(db, "opreturn_supply", version + v0)?;
|
||||
let height_to_opreturn = EagerVec::forced_import(db, "opreturn_supply", version)?;
|
||||
|
||||
let indexes_to_opreturn = ComputedValueVecsFromHeight::forced_import(
|
||||
db,
|
||||
"opreturn_supply",
|
||||
Source::Vec(height_to_opreturn.boxed_clone()),
|
||||
version + v0,
|
||||
version,
|
||||
VecBuilderOptions::default().add_last().add_cumulative(),
|
||||
compute_dollars,
|
||||
indexes,
|
||||
)?;
|
||||
|
||||
let height_to_unspendable =
|
||||
EagerVec::forced_import(db, "unspendable_supply", version + v0)?;
|
||||
let height_to_unspendable = EagerVec::forced_import(db, "unspendable_supply", version)?;
|
||||
|
||||
let indexes_to_unspendable = ComputedValueVecsFromHeight::forced_import(
|
||||
db,
|
||||
"unspendable_supply",
|
||||
Source::Vec(height_to_unspendable.boxed_clone()),
|
||||
version + v0,
|
||||
version,
|
||||
VecBuilderOptions::default().add_last().add_cumulative(),
|
||||
compute_dollars,
|
||||
indexes,
|
||||
|
||||
@@ -9,21 +9,19 @@ use crate::{
|
||||
|
||||
impl Vecs {
|
||||
pub fn import(version: Version, distribution: &distribution::Vecs) -> Self {
|
||||
let v0 = Version::ZERO;
|
||||
|
||||
// Reference distribution's actual circulating supply lazily
|
||||
let supply_metrics = &distribution.utxo_cohorts.all.metrics.supply;
|
||||
|
||||
let height_to_sats = LazyVecFrom1::init(
|
||||
"circulating_sats",
|
||||
version + v0,
|
||||
version,
|
||||
supply_metrics.height_to_supply.boxed_clone(),
|
||||
|height, iter| iter.get(height),
|
||||
);
|
||||
|
||||
let height_to_btc = LazyVecFrom1::transformed::<SatsToBitcoin>(
|
||||
"circulating_btc",
|
||||
version + v0,
|
||||
version,
|
||||
supply_metrics.height_to_supply.boxed_clone(),
|
||||
);
|
||||
|
||||
@@ -34,7 +32,7 @@ impl Vecs {
|
||||
.map(|d| {
|
||||
LazyVecFrom1::init(
|
||||
"circulating_usd",
|
||||
version + v0,
|
||||
version,
|
||||
d.boxed_clone(),
|
||||
|height, iter| iter.get(height),
|
||||
)
|
||||
@@ -45,7 +43,7 @@ impl Vecs {
|
||||
SatsIdentity,
|
||||
SatsToBitcoin,
|
||||
DollarsIdentity,
|
||||
>("circulating", &supply_metrics.indexes_to_supply, version + v0);
|
||||
>("circulating", &supply_metrics.indexes_to_supply, version);
|
||||
|
||||
Self {
|
||||
height_to_sats,
|
||||
|
||||
@@ -9,18 +9,12 @@ use crate::{
|
||||
};
|
||||
|
||||
impl Vecs {
|
||||
pub fn forced_import(
|
||||
db: &Database,
|
||||
version: Version,
|
||||
indexes: &indexes::Vecs,
|
||||
) -> Result<Self> {
|
||||
let v0 = Version::ZERO;
|
||||
|
||||
pub fn forced_import(db: &Database, version: Version, indexes: &indexes::Vecs) -> Result<Self> {
|
||||
let indexes_to_inflation_rate = ComputedVecsFromDateIndex::forced_import(
|
||||
db,
|
||||
"inflation_rate",
|
||||
Source::Compute,
|
||||
version + v0,
|
||||
version,
|
||||
indexes,
|
||||
VecBuilderOptions::default().add_average(),
|
||||
)?;
|
||||
|
||||
@@ -9,7 +9,6 @@ use crate::{
|
||||
|
||||
impl Vecs {
|
||||
pub fn import(version: Version, distribution: &distribution::Vecs) -> Self {
|
||||
let v0 = Version::ZERO;
|
||||
let supply_metrics = &distribution.utxo_cohorts.all.metrics.supply;
|
||||
|
||||
// Market cap by height (lazy from distribution's supply in USD)
|
||||
@@ -18,19 +17,16 @@ impl Vecs {
|
||||
.dollars
|
||||
.as_ref()
|
||||
.map(|d| {
|
||||
LazyVecFrom1::init(
|
||||
"market_cap",
|
||||
version + v0,
|
||||
d.boxed_clone(),
|
||||
|height, iter| iter.get(height),
|
||||
)
|
||||
LazyVecFrom1::init("market_cap", version, d.boxed_clone(), |height, iter| {
|
||||
iter.get(height)
|
||||
})
|
||||
});
|
||||
|
||||
// Market cap by indexes (lazy from distribution's supply in USD)
|
||||
let indexes = supply_metrics.indexes_to_supply.dollars.as_ref().map(|d| {
|
||||
LazyVecsFromDateIndex::from_computed::<DollarsIdentity>(
|
||||
"market_cap",
|
||||
version + v0,
|
||||
version,
|
||||
d.dateindex.as_ref().map(|v| v.boxed_clone()),
|
||||
d,
|
||||
)
|
||||
|
||||
@@ -15,13 +15,11 @@ impl Vecs {
|
||||
indexes: &indexes::Vecs,
|
||||
compute_dollars: bool,
|
||||
) -> Result<Self> {
|
||||
let v0 = Version::ZERO;
|
||||
|
||||
let indexes_to_btc = ComputedVecsFromDateIndex::forced_import(
|
||||
db,
|
||||
"btc_velocity",
|
||||
Source::Compute,
|
||||
version + v0,
|
||||
version,
|
||||
indexes,
|
||||
VecBuilderOptions::default().add_average(),
|
||||
)?;
|
||||
@@ -31,7 +29,7 @@ impl Vecs {
|
||||
db,
|
||||
"usd_velocity",
|
||||
Source::Compute,
|
||||
version + v0,
|
||||
version,
|
||||
indexes,
|
||||
VecBuilderOptions::default().add_average(),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user