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 OpenInterestDelta 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§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 there is no value for this input. Read moreSource§fn reset(&mut self)
fn reset(&mut self)
Source§fn warmup_period(&self) -> usize
fn warmup_period(&self) -> usize
None output can be produced.Source§fn is_ready(&self) -> bool
fn is_ready(&self) -> bool
Source§fn name(&self) -> &'static str
fn name(&self) -> &'static str
Source§fn batch_nan_into(&mut self, inputs: &[Self::Input], out: &mut [f64])
fn batch_nan_into(&mut self, inputs: &[Self::Input], out: &mut [f64])
Source§fn batch_fast_into(&mut self, inputs: &[Self::Input], out: &mut [f64])
fn batch_fast_into(&mut self, inputs: &[Self::Input], out: &mut [f64])
batch_nan_into, but
an indicator with a vectorised kernel may reassociate its arithmetic to
run it in SIMD lanes. Each value then agrees with the exact batch to within
the tolerance the indicator documents (a few units in the last place), not
bit for bit; warmup positions, NaN placement and the output length are
identical. The kernels are deterministic: the same input produces the same
bits on every platform, with or without SIMD hardware. Read moreAuto 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