mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-24 06:39:58 -07:00
47 lines
1.2 KiB
Rust
47 lines
1.2 KiB
Rust
use brk_error::Result;
|
|
use brk_types::{BasisPointsSigned32, Indexes};
|
|
use vecdb::Exit;
|
|
|
|
use super::super::activity;
|
|
use super::Vecs;
|
|
use crate::supply;
|
|
|
|
impl Vecs {
|
|
pub(crate) fn compute(
|
|
&mut self,
|
|
starting_indexes: &Indexes,
|
|
supply: &supply::Vecs,
|
|
activity: &activity::Vecs,
|
|
exit: &Exit,
|
|
) -> Result<()> {
|
|
self.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.tx_velocity_btc.height.compute_multiply(
|
|
starting_indexes.height,
|
|
&activity.ratio.height,
|
|
&supply.velocity.native.height,
|
|
exit,
|
|
)?;
|
|
|
|
self.tx_velocity_usd.height.compute_multiply(
|
|
starting_indexes.height,
|
|
&activity.ratio.height,
|
|
&supply.velocity.fiat.height,
|
|
exit,
|
|
)?;
|
|
|
|
Ok(())
|
|
}
|
|
}
|