pub struct OpenInterestMomentum { /* private fields */ }Expand description
Open-Interest Momentum — the percentage rate of change of open interest over a
period-tick lookback.
OIM = 100 · (OI_t − OI_{t−period}) / OI_{t−period}Where OIDelta reports the single-tick change in open
interest, OI Momentum measures the trend in positioning over a window: positive
values mean open interest is expanding (new money entering — a position build
that fuels the prevailing move), negative values mean it is contracting
(positions being closed — deleveraging or short-covering). Read alongside price:
rising OI with rising price is a strong new-long trend, while rising price with
falling OI is a short-covering rally on borrowed time.
The output is a percentage and may be negative. A zero base open interest
period ticks ago reports 0 rather than dividing by zero. The first value
lands after period + 1 inputs. Each update is O(1).
§Example
use wickra_core::{DerivativesTick, Indicator, OpenInterestMomentum};
let mut indicator = OpenInterestMomentum::new(5).unwrap();
let mut last = None;
for i in 0..20 {
let oi = 1_000.0 + f64::from(i) * 100.0;
let tick = DerivativesTick::new(0.0, 100.0, 100.0, 100.0, oi, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0).unwrap();
last = indicator.update(tick);
}
assert!(last.unwrap() > 0.0); // expanding OIImplementations§
Trait Implementations§
Source§impl Clone for OpenInterestMomentum
impl Clone for OpenInterestMomentum
Source§fn clone(&self) -> OpenInterestMomentum
fn clone(&self) -> OpenInterestMomentum
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for OpenInterestMomentum
impl Debug for OpenInterestMomentum
Source§impl Indicator for OpenInterestMomentum
impl Indicator for OpenInterestMomentum
Source§type Input = DerivativesTick
type Input = DerivativesTick
f64 for a price, or Candle / Tick).Source§fn update(&mut self, tick: DerivativesTick) -> Option<f64>
fn update(&mut self, tick: DerivativesTick) -> Option<f64>
None if the indicator is still warming up.Source§fn reset(&mut self)
fn reset(&mut self)
Source§fn warmup_period(&self) -> usize
fn warmup_period(&self) -> usize
None output can be produced.Auto Trait Implementations§
impl Freeze for OpenInterestMomentum
impl RefUnwindSafe for OpenInterestMomentum
impl Send for OpenInterestMomentum
impl Sync for OpenInterestMomentum
impl Unpin for OpenInterestMomentum
impl UnsafeUnpin for OpenInterestMomentum
impl UnwindSafe for OpenInterestMomentum
Blanket Implementations§
Source§impl<T> BatchExt for Twhere
T: Indicator,
impl<T> BatchExt for Twhere
T: Indicator,
Source§fn batch(&mut self, inputs: &[Self::Input]) -> Vec<Option<Self::Output>>
fn batch(&mut self, inputs: &[Self::Input]) -> Vec<Option<Self::Output>>
None during warmup) per input.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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more