Struct OhlcBar
pub struct OhlcBar { /* private fields */ }Expand description
A primitive OHLC bar.
Implementations§
§impl OhlcBar
impl OhlcBar
pub fn new(
time: BarTime,
interval: BarInterval,
open: MarketPrice,
high: MarketPrice,
low: MarketPrice,
close: MarketPrice,
) -> Result<OhlcBar, BarError>
pub fn new( time: BarTime, interval: BarInterval, open: MarketPrice, high: MarketPrice, low: MarketPrice, close: MarketPrice, ) -> Result<OhlcBar, BarError>
Creates an OHLC bar from validated price values.
§Errors
Returns [BarError::InvalidHigh] or [BarError::InvalidLow] when obvious OHLC
constraints are violated.
pub fn from_values(
time: BarTime,
interval: BarInterval,
open: f64,
high: f64,
low: f64,
close: f64,
) -> Result<OhlcBar, BarError>
pub fn from_values( time: BarTime, interval: BarInterval, open: f64, high: f64, low: f64, close: f64, ) -> Result<OhlcBar, BarError>
Creates an OHLC bar from raw f64 price values.
§Errors
Returns [BarError] when any price is invalid or OHLC constraints are violated.
pub const fn interval(&self) -> &BarInterval
pub const fn interval(&self) -> &BarInterval
Returns the bar interval.
pub const fn open(&self) -> MarketPrice
pub const fn open(&self) -> MarketPrice
Returns the open price.
pub const fn high(&self) -> MarketPrice
pub const fn high(&self) -> MarketPrice
Returns the high price.
pub const fn low(&self) -> MarketPrice
pub const fn low(&self) -> MarketPrice
Returns the low price.
pub 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