pub struct Candle {
pub time: i64,
pub open: f64,
pub high: f64,
pub low: f64,
pub close: f64,
pub volume: f64,
}Expand description
One OHLCV bar.
Fields§
§time: i64Open time in milliseconds (Unix epoch).
open: f64§high: f64§low: f64§close: f64§volume: f64Implementations§
Source§impl Candle
impl Candle
Sourcepub fn from_raw(row: &[Value]) -> Option<Self>
pub fn from_raw(row: &[Value]) -> Option<Self>
Parse from a raw 6-element array [timestamp_ms, open, high, low, close, volume]
where every element is a JSON string.
Sourcepub fn typical_price(&self) -> f64
pub fn typical_price(&self) -> f64
Typical price (H+L+C)/3.
Sourcepub fn true_range(&self, prev_close: Option<f64>) -> f64
pub fn true_range(&self, prev_close: Option<f64>) -> f64
True range against an optional previous close.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Candle
impl<'de> Deserialize<'de> for Candle
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Candle
impl RefUnwindSafe for Candle
impl Send for Candle
impl Sync for Candle
impl Unpin for Candle
impl UnsafeUnpin for Candle
impl UnwindSafe for Candle
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