Skip to main content

OnlineFeatures

Struct OnlineFeatures 

Source
#[repr(C)]
pub struct OnlineFeatures {
Show 35 fields pub version: u16, pub flags: u16, pub _pad0: [u8; 4], pub microprice_1e9: u64, pub ofi_1level_1e8: i64, pub ofi_5level_1e8: i64, pub mlofi_10_1e8: i64, pub ofi_ewma_1e6: i64, pub trade_sign_imbalance_1e6: i64, pub trade_arrival_rate_1e3: u32, pub vpin_1e4: u16, pub _pad1: u16, pub spread_regime: u8, pub _pad2a: u8, pub spread_zscore_1e3: i16, pub cancel_rate_1e4: u16, pub depth_imbalance_1e4: i16, pub rv_1m_bps: u32, pub rv_5m_bps: u32, pub rv_1h_bps: u32, pub _pad3: u32, pub pred_dir_up_1e4: u16, pub pred_dir_flat_1e4: u16, pub pred_dir_down_1e4: u16, pub pred_stress_normal_1e4: u16, pub pred_stress_widening_1e4: u16, pub pred_stress_crisis_1e4: u16, pub pred_toxic_1e4: u16, pub prediction_age_ms: u16, pub fill_prob_bid_1e4: u16, pub fill_prob_ask_1e4: u16, pub queue_decay_rate_1e4: u16, pub _fill_pad: u16, pub feature_ts_ns: u64, pub _reserved: [u8; 136],
}
Expand description

Online microstructure features delivered by the CC data engine. Written to WASM memory before each algo callback. Old algos that never read 0x1A000 are unaffected (backward compatible).

Fields§

§version: u16

ABI version (currently 1).

§flags: u16

Bit flags: bit 0 = vpin_valid.

§_pad0: [u8; 4]§microprice_1e9: u64

Microprice scaled 1e9.

§ofi_1level_1e8: i64

Order flow imbalance, top-of-book, scaled 1e8.

§ofi_5level_1e8: i64

Order flow imbalance, 5 levels, scaled 1e8.

§mlofi_10_1e8: i64

Multi-level OFI (10 levels), scaled 1e8.

§ofi_ewma_1e6: i64

OFI EWMA, scaled 1e6.

§trade_sign_imbalance_1e6: i64

Trade sign imbalance [-1e6, +1e6].

§trade_arrival_rate_1e3: u32

Trades/sec x 1000.

§vpin_1e4: u16

VPIN [0, 10000] — only valid when flags bit 0 is set.

§_pad1: u16§spread_regime: u8

0=tight, 1=normal, 2=wide, 3=crisis.

§_pad2a: u8§spread_zscore_1e3: i16

Spread z-score x 1000.

§cancel_rate_1e4: u16

Cancel rate [0, 10000].

§depth_imbalance_1e4: i16

Depth imbalance [-10000, +10000].

§rv_1m_bps: u32

1-minute realized vol in basis points.

§rv_5m_bps: u32

5-minute realized vol in basis points.

§rv_1h_bps: u32

1-hour realized vol in basis points.

§_pad3: u32§pred_dir_up_1e4: u16

Probability of up direction [0, 10000].

§pred_dir_flat_1e4: u16

Probability of flat direction [0, 10000].

§pred_dir_down_1e4: u16

Probability of down direction [0, 10000].

§pred_stress_normal_1e4: u16

Probability of normal stress [0, 10000].

§pred_stress_widening_1e4: u16

Probability of widening stress [0, 10000].

§pred_stress_crisis_1e4: u16

Probability of crisis stress [0, 10000].

§pred_toxic_1e4: u16

Probability of toxic flow [0, 10000].

§prediction_age_ms: u16

Age of prediction in ms.

§fill_prob_bid_1e4: u16

Fill probability on bid side [0, 10000].

§fill_prob_ask_1e4: u16

Fill probability on ask side [0, 10000].

§queue_decay_rate_1e4: u16

Queue decay rate [0, 10000].

§_fill_pad: u16§feature_ts_ns: u64

Feature computation timestamp in nanoseconds.

§_reserved: [u8; 136]

Reserved for future expansion.

Implementations§

Source§

impl OnlineFeatures

Source

pub fn vpin_valid(&self) -> bool

Whether the VPIN field is valid (flags bit 0).

Source

pub fn microprice_f64(&self) -> f64

Microprice as f64 (divide by 1e9).

Source

pub fn ofi_1level_f64(&self) -> f64

OFI 1-level as f64 (divide by 1e8).

Source

pub fn trade_sign_imbalance_f64(&self) -> f64

Trade sign imbalance as f64 in [-1.0, +1.0].

Trait Implementations§

Source§

impl Clone for OnlineFeatures

Source§

fn clone(&self) -> OnlineFeatures

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for OnlineFeatures

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for OnlineFeatures

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Copy for OnlineFeatures

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.