mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-07-14 04:28:11 -07:00
global: snapshot
This commit is contained in:
@@ -1,30 +0,0 @@
|
||||
use brk_traversable::Traversable;
|
||||
|
||||
#[derive(Clone, Traversable)]
|
||||
pub struct Emas1w1m<A> {
|
||||
#[traversable(rename = "1w")]
|
||||
pub _1w: A,
|
||||
#[traversable(rename = "1m")]
|
||||
pub _1m: A,
|
||||
}
|
||||
|
||||
impl<A> Emas1w1m<A> {
|
||||
pub const SUFFIXES: [&'static str; 2] = ["ema_1w", "ema_1m"];
|
||||
|
||||
pub fn try_from_fn<E>(
|
||||
mut f: impl FnMut(&str) -> std::result::Result<A, E>,
|
||||
) -> std::result::Result<Self, E> {
|
||||
Ok(Self {
|
||||
_1w: f(Self::SUFFIXES[0])?,
|
||||
_1m: f(Self::SUFFIXES[1])?,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn as_array(&self) -> [&A; 2] {
|
||||
[&self._1w, &self._1m]
|
||||
}
|
||||
|
||||
pub fn as_mut_array(&mut self) -> [&mut A; 2] {
|
||||
[&mut self._1w, &mut self._1m]
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,7 @@
|
||||
mod distribution_stats;
|
||||
mod emas;
|
||||
mod per_period;
|
||||
mod windows;
|
||||
|
||||
pub use distribution_stats::*;
|
||||
pub use emas::*;
|
||||
pub use per_period::*;
|
||||
pub use windows::*;
|
||||
|
||||
Reference in New Issue
Block a user