pub struct OhlcBar { /* private fields */ }Expand description
A primitive OHLC bar.
Implementations§
Source§impl OhlcBar
impl OhlcBar
Sourcepub fn new(
time: BarTime,
interval: BarInterval,
open: MarketPrice,
high: MarketPrice,
low: MarketPrice,
close: MarketPrice,
) -> Result<Self, BarError>
pub fn new( time: BarTime, interval: BarInterval, open: MarketPrice, high: MarketPrice, low: MarketPrice, close: MarketPrice, ) -> Result<Self, BarError>
Creates an OHLC bar from validated price values.
§Errors
Returns BarError::InvalidHigh or BarError::InvalidLow when obvious OHLC
constraints are violated.
Sourcepub fn from_values(
time: BarTime,
interval: BarInterval,
open: f64,
high: f64,
low: f64,
close: f64,
) -> Result<Self, BarError>
pub fn from_values( time: BarTime, interval: BarInterval, open: f64, high: f64, low: f64, close: f64, ) -> Result<Self, BarError>
Sourcepub const fn interval(&self) -> &BarInterval
pub const fn interval(&self) -> &BarInterval
Returns the bar interval.
Sourcepub const fn open(&self) -> MarketPrice
pub const fn open(&self) -> MarketPrice
Returns the open price.
Sourcepub const fn high(&self) -> MarketPrice
pub const fn high(&self) -> MarketPrice
Returns the high price.
Sourcepub const fn low(&self) -> MarketPrice
pub const fn low(&self) -> MarketPrice
Returns the low price.
Sourcepub const fn close(&self) -> MarketPrice
pub const fn close(&self) -> MarketPrice
Returns the close price.
Trait Implementations§
impl StructuralPartialEq for OhlcBar
Auto Trait Implementations§
impl Freeze for OhlcBar
impl RefUnwindSafe for OhlcBar
impl Send for OhlcBar
impl Sync for OhlcBar
impl Unpin for OhlcBar
impl UnsafeUnpin for OhlcBar
impl UnwindSafe for OhlcBar
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