pub struct PriceFeatures {
pub log_returns: Vec<f64>,
pub realized_volatility: f64,
pub momentum: f64,
pub rsi: f64,
pub macd_signal: f64,
pub bollinger_position: f64,
}Expand description
Price-derived features computed from a close-price series.
§Example
use fin_primitives::ml_features::PriceFeatures;
let closes = vec![100.0, 101.0, 102.0, 101.5, 103.0];
let pf = PriceFeatures::compute(&closes, 3).unwrap();
assert!(pf.log_returns.len() == 4);Fields§
§log_returns: Vec<f64>Log returns: ln(close_t / close_{t-1}).
realized_volatility: f64Realized volatility: rolling std-dev of log returns over the last window periods.
momentum: f64n-period momentum: close[-1] / close[-n-1] - 1.
rsi: f64RSI over the last window periods (0–100).
macd_signal: f64MACD signal line: EMA(12) − EMA(26) of closes.
bollinger_position: f64Bollinger Band position: (close - lower) / (upper - lower), in [0, 1].
Implementations§
Source§impl PriceFeatures
impl PriceFeatures
Trait Implementations§
Source§impl Clone for PriceFeatures
impl Clone for PriceFeatures
Auto Trait Implementations§
impl Freeze for PriceFeatures
impl RefUnwindSafe for PriceFeatures
impl Send for PriceFeatures
impl Sync for PriceFeatures
impl Unpin for PriceFeatures
impl UnsafeUnpin for PriceFeatures
impl UnwindSafe for PriceFeatures
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