pub struct Candle {
pub open: f64,
pub high: f64,
pub low: f64,
pub close: f64,
pub volume: f64,
pub timestamp: i64,
}Expand description
One OHLCV bar.
Field order and semantics match wickra_core::ohlcv::Candle, so a candle
built here feeds the parity oracle unchanged. Copy keeps the indicator
update path allocation- and clone-free.
Fields§
§open: f64Bar open price.
high: f64Bar high price.
low: f64Bar low price.
close: f64Bar close price.
volume: f64Bar volume.
timestamp: i64Bar timestamp (caller-defined epoch / resolution).
Implementations§
Source§impl Candle
impl Candle
Sourcepub const fn new(
open: f64,
high: f64,
low: f64,
close: f64,
volume: f64,
timestamp: i64,
) -> Self
pub const fn new( open: f64, high: f64, low: f64, close: f64, volume: f64, timestamp: i64, ) -> Self
Construct a candle from its fields. Unlike the std Candle::new, this is
a plain const constructor with no validation: on bare metal the caller
(the C ABI, the firmware) is trusted to pass finite, ordered OHLC values,
and a validating constructor would add a panic path the core forbids.
Sourcepub fn true_range(&self, prev_close: Option<f64>) -> f64
pub fn true_range(&self, prev_close: Option<f64>) -> f64
True range for this bar given the previous close, identical to
wickra-core: max(high - low, |high - prev|, |low - prev|), or just
high - low for the first bar.