mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-07-26 02:08:10 -07:00
global: snapshot
This commit is contained in:
@@ -8,7 +8,7 @@ use vecdb::{
|
||||
|
||||
use crate::{ComputeIndexes, blocks, indexes};
|
||||
|
||||
use crate::internal::{ComputedFromHeightLast, Price};
|
||||
use crate::internal::{ComputedFromHeight, Price};
|
||||
|
||||
use super::ComputedFromHeightStdDev;
|
||||
|
||||
@@ -17,34 +17,34 @@ pub struct ComputedFromHeightStdDevExtended<M: StorageMode = Rw> {
|
||||
#[traversable(flatten)]
|
||||
pub base: ComputedFromHeightStdDev<M>,
|
||||
|
||||
pub zscore: ComputedFromHeightLast<StoredF32, M>,
|
||||
pub zscore: ComputedFromHeight<StoredF32, M>,
|
||||
|
||||
pub p0_5sd: ComputedFromHeightLast<StoredF32, M>,
|
||||
pub p1sd: ComputedFromHeightLast<StoredF32, M>,
|
||||
pub p1_5sd: ComputedFromHeightLast<StoredF32, M>,
|
||||
pub p2sd: ComputedFromHeightLast<StoredF32, M>,
|
||||
pub p2_5sd: ComputedFromHeightLast<StoredF32, M>,
|
||||
pub p3sd: ComputedFromHeightLast<StoredF32, M>,
|
||||
pub m0_5sd: ComputedFromHeightLast<StoredF32, M>,
|
||||
pub m1sd: ComputedFromHeightLast<StoredF32, M>,
|
||||
pub m1_5sd: ComputedFromHeightLast<StoredF32, M>,
|
||||
pub m2sd: ComputedFromHeightLast<StoredF32, M>,
|
||||
pub m2_5sd: ComputedFromHeightLast<StoredF32, M>,
|
||||
pub m3sd: ComputedFromHeightLast<StoredF32, M>,
|
||||
pub p0_5sd: ComputedFromHeight<StoredF32, M>,
|
||||
pub p1sd: ComputedFromHeight<StoredF32, M>,
|
||||
pub p1_5sd: ComputedFromHeight<StoredF32, M>,
|
||||
pub p2sd: ComputedFromHeight<StoredF32, M>,
|
||||
pub p2_5sd: ComputedFromHeight<StoredF32, M>,
|
||||
pub p3sd: ComputedFromHeight<StoredF32, M>,
|
||||
pub m0_5sd: ComputedFromHeight<StoredF32, M>,
|
||||
pub m1sd: ComputedFromHeight<StoredF32, M>,
|
||||
pub m1_5sd: ComputedFromHeight<StoredF32, M>,
|
||||
pub m2sd: ComputedFromHeight<StoredF32, M>,
|
||||
pub m2_5sd: ComputedFromHeight<StoredF32, M>,
|
||||
pub m3sd: ComputedFromHeight<StoredF32, M>,
|
||||
|
||||
pub _0sd_price: Price<ComputedFromHeightLast<Cents, M>>,
|
||||
pub p0_5sd_price: Price<ComputedFromHeightLast<Cents, M>>,
|
||||
pub p1sd_price: Price<ComputedFromHeightLast<Cents, M>>,
|
||||
pub p1_5sd_price: Price<ComputedFromHeightLast<Cents, M>>,
|
||||
pub p2sd_price: Price<ComputedFromHeightLast<Cents, M>>,
|
||||
pub p2_5sd_price: Price<ComputedFromHeightLast<Cents, M>>,
|
||||
pub p3sd_price: Price<ComputedFromHeightLast<Cents, M>>,
|
||||
pub m0_5sd_price: Price<ComputedFromHeightLast<Cents, M>>,
|
||||
pub m1sd_price: Price<ComputedFromHeightLast<Cents, M>>,
|
||||
pub m1_5sd_price: Price<ComputedFromHeightLast<Cents, M>>,
|
||||
pub m2sd_price: Price<ComputedFromHeightLast<Cents, M>>,
|
||||
pub m2_5sd_price: Price<ComputedFromHeightLast<Cents, M>>,
|
||||
pub m3sd_price: Price<ComputedFromHeightLast<Cents, M>>,
|
||||
pub _0sd_price: Price<ComputedFromHeight<Cents, M>>,
|
||||
pub p0_5sd_price: Price<ComputedFromHeight<Cents, M>>,
|
||||
pub p1sd_price: Price<ComputedFromHeight<Cents, M>>,
|
||||
pub p1_5sd_price: Price<ComputedFromHeight<Cents, M>>,
|
||||
pub p2sd_price: Price<ComputedFromHeight<Cents, M>>,
|
||||
pub p2_5sd_price: Price<ComputedFromHeight<Cents, M>>,
|
||||
pub p3sd_price: Price<ComputedFromHeight<Cents, M>>,
|
||||
pub m0_5sd_price: Price<ComputedFromHeight<Cents, M>>,
|
||||
pub m1sd_price: Price<ComputedFromHeight<Cents, M>>,
|
||||
pub m1_5sd_price: Price<ComputedFromHeight<Cents, M>>,
|
||||
pub m2sd_price: Price<ComputedFromHeight<Cents, M>>,
|
||||
pub m2_5sd_price: Price<ComputedFromHeight<Cents, M>>,
|
||||
pub m3sd_price: Price<ComputedFromHeight<Cents, M>>,
|
||||
}
|
||||
|
||||
impl ComputedFromHeightStdDevExtended {
|
||||
@@ -59,7 +59,7 @@ impl ComputedFromHeightStdDevExtended {
|
||||
|
||||
macro_rules! import {
|
||||
($suffix:expr) => {
|
||||
ComputedFromHeightLast::forced_import(
|
||||
ComputedFromHeight::forced_import(
|
||||
db,
|
||||
&format!("{name}_{}", $suffix),
|
||||
version,
|
||||
|
||||
@@ -9,13 +9,13 @@ use vecdb::{AnyStoredVec, AnyVec, Database, Exit, ReadableVec, Rw, StorageMode,
|
||||
|
||||
use crate::{ComputeIndexes, blocks, indexes};
|
||||
|
||||
use crate::internal::ComputedFromHeightLast;
|
||||
use crate::internal::ComputedFromHeight;
|
||||
|
||||
#[derive(Traversable)]
|
||||
pub struct ComputedFromHeightStdDev<M: StorageMode = Rw> {
|
||||
days: usize,
|
||||
pub sma: ComputedFromHeightLast<StoredF32, M>,
|
||||
pub sd: ComputedFromHeightLast<StoredF32, M>,
|
||||
pub sma: ComputedFromHeight<StoredF32, M>,
|
||||
pub sd: ComputedFromHeight<StoredF32, M>,
|
||||
}
|
||||
|
||||
impl ComputedFromHeightStdDev {
|
||||
@@ -28,13 +28,13 @@ impl ComputedFromHeightStdDev {
|
||||
) -> Result<Self> {
|
||||
let version = parent_version + Version::TWO;
|
||||
|
||||
let sma = ComputedFromHeightLast::forced_import(
|
||||
let sma = ComputedFromHeight::forced_import(
|
||||
db,
|
||||
&format!("{name}_sma"),
|
||||
version,
|
||||
indexes,
|
||||
)?;
|
||||
let sd = ComputedFromHeightLast::forced_import(
|
||||
let sd = ComputedFromHeight::forced_import(
|
||||
db,
|
||||
&format!("{name}_sd"),
|
||||
version,
|
||||
@@ -84,7 +84,7 @@ impl ComputedFromHeightStdDev {
|
||||
}
|
||||
|
||||
fn compute_sd(
|
||||
sd: &mut ComputedFromHeightLast<StoredF32>,
|
||||
sd: &mut ComputedFromHeight<StoredF32>,
|
||||
blocks: &blocks::Vecs,
|
||||
starting_indexes: &ComputeIndexes,
|
||||
exit: &Exit,
|
||||
|
||||
Reference in New Issue
Block a user