pub struct CloseToClose { /* private fields */ }Expand description
Standard close-to-close realised volatility estimator.
Uses log-returns: r_t = ln(C_t / C_{t-1}). σ_ann = std(r) × √(bars_per_year).
Implementations§
Source§impl CloseToClose
impl CloseToClose
Sourcepub fn new(window: usize, bars_per_year: f64) -> Result<Self, FinError>
pub fn new(window: usize, bars_per_year: f64) -> Result<Self, FinError>
Create a new close-to-close estimator.
window: number of bars in the rolling window.bars_per_year: annualisation factor (252 for daily, 252×6.5×60 for minute bars).
§Errors
FinError::InvalidPeriod if window == 0.
Sourcepub fn update(&mut self, close: f64) -> Option<f64>
pub fn update(&mut self, close: f64) -> Option<f64>
Push the latest close price. Returns annualised volatility once the window is full.
Sourcepub fn warmup_period(&self) -> usize
pub fn warmup_period(&self) -> usize
Minimum observations before output is emitted.
Trait Implementations§
Source§impl Clone for CloseToClose
impl Clone for CloseToClose
Auto Trait Implementations§
impl Freeze for CloseToClose
impl RefUnwindSafe for CloseToClose
impl Send for CloseToClose
impl Sync for CloseToClose
impl Unpin for CloseToClose
impl UnsafeUnpin for CloseToClose
impl UnwindSafe for CloseToClose
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more