computer: snapshot

This commit is contained in:
nym21
2026-02-26 23:01:51 +01:00
parent cccaf6b206
commit 78fc5ffcf7
69 changed files with 1578 additions and 2205 deletions

View File

@@ -47,7 +47,7 @@ impl Vecs {
prices,
starting_indexes,
exit,
Some(&self.vaulted_price.usd.height),
&self.vaulted_price.usd.height,
)?;
self.active_price.usd.height.compute_multiply(
@@ -62,7 +62,7 @@ impl Vecs {
prices,
starting_indexes,
exit,
Some(&self.active_price.usd.height),
&self.active_price.usd.height,
)?;
self.true_market_mean.usd.height.compute_divide(
@@ -77,7 +77,7 @@ impl Vecs {
prices,
starting_indexes,
exit,
Some(&self.true_market_mean.usd.height),
&self.true_market_mean.usd.height,
)?;
// cointime_price = cointime_cap / circulating_supply
@@ -93,7 +93,7 @@ impl Vecs {
prices,
starting_indexes,
exit,
Some(&self.cointime_price.usd.height),
&self.cointime_price.usd.height,
)?;
Ok(())

View File

@@ -5,7 +5,7 @@ use vecdb::Database;
use super::Vecs;
use crate::{
indexes,
internal::{ComputedFromHeightRatio, Price},
internal::{ComputedFromHeightRatioExtended, Price},
};
impl Vecs {
@@ -15,46 +15,24 @@ impl Vecs {
indexes: &indexes::Vecs,
) -> Result<Self> {
let vaulted_price = Price::forced_import(db, "vaulted_price", version, indexes)?;
let vaulted_price_ratio = ComputedFromHeightRatio::forced_import(
db,
"vaulted_price",
Some(&vaulted_price.usd),
version,
indexes,
true,
)?;
let vaulted_price_ratio =
ComputedFromHeightRatioExtended::forced_import(db, "vaulted_price", version, indexes)?;
let active_price = Price::forced_import(db, "active_price", version, indexes)?;
let active_price_ratio = ComputedFromHeightRatio::forced_import(
db,
"active_price",
Some(&active_price.usd),
version,
indexes,
true,
)?;
let active_price_ratio =
ComputedFromHeightRatioExtended::forced_import(db, "active_price", version, indexes)?;
let true_market_mean =
Price::forced_import(db, "true_market_mean", version, indexes)?;
let true_market_mean_ratio = ComputedFromHeightRatio::forced_import(
let true_market_mean = Price::forced_import(db, "true_market_mean", version, indexes)?;
let true_market_mean_ratio = ComputedFromHeightRatioExtended::forced_import(
db,
"true_market_mean",
Some(&true_market_mean.usd),
version,
indexes,
true,
)?;
let cointime_price =
Price::forced_import(db, "cointime_price", version, indexes)?;
let cointime_price_ratio = ComputedFromHeightRatio::forced_import(
db,
"cointime_price",
Some(&cointime_price.usd),
version,
indexes,
true,
)?;
let cointime_price = Price::forced_import(db, "cointime_price", version, indexes)?;
let cointime_price_ratio =
ComputedFromHeightRatioExtended::forced_import(db, "cointime_price", version, indexes)?;
Ok(Self {
vaulted_price,

View File

@@ -2,16 +2,16 @@ use brk_traversable::Traversable;
use brk_types::Dollars;
use vecdb::{Rw, StorageMode};
use crate::internal::{ComputedFromHeightLast, ComputedFromHeightRatio, Price};
use crate::internal::{ComputedFromHeightLast, ComputedFromHeightRatioExtended, Price};
#[derive(Traversable)]
pub struct Vecs<M: StorageMode = Rw> {
pub vaulted_price: Price<ComputedFromHeightLast<Dollars, M>>,
pub vaulted_price_ratio: ComputedFromHeightRatio<M>,
pub vaulted_price_ratio: ComputedFromHeightRatioExtended<M>,
pub active_price: Price<ComputedFromHeightLast<Dollars, M>>,
pub active_price_ratio: ComputedFromHeightRatio<M>,
pub active_price_ratio: ComputedFromHeightRatioExtended<M>,
pub true_market_mean: Price<ComputedFromHeightLast<Dollars, M>>,
pub true_market_mean_ratio: ComputedFromHeightRatio<M>,
pub true_market_mean_ratio: ComputedFromHeightRatioExtended<M>,
pub cointime_price: Price<ComputedFromHeightLast<Dollars, M>>,
pub cointime_price_ratio: ComputedFromHeightRatio<M>,
pub cointime_price_ratio: ComputedFromHeightRatioExtended<M>,
}