pub struct Candle {
pub open: ValueType,
pub high: ValueType,
pub low: ValueType,
pub close: ValueType,
pub volume: ValueType,
}
Expand description
Simple Candlestick structure for implementing OHLCV
Can be also used by an alias Candlestick
You may convert simple tuples of 4 or 5 float values into Candle:
use yata::prelude::Candle;
// open high low close
let my_candle = (3.0, 5.0, 2.0, 4.0 );
let converted: Candle = my_candle.into();
println!("{:?}", converted);
use yata::prelude::Candle;
// open high low close volume
let my_candle = (3.0, 5.0, 2.0, 4.0 , 50.0 );
let converted: Candle = my_candle.into();
println!("{:?}", converted);
Fields§
§open: ValueType
Open value of the candle
high: ValueType
High value of the candle
low: ValueType
Low value of the candle
close: ValueType
Close value of the candle
volume: ValueType
Volume value of the candle
Implementations§
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
source§impl OHLCV for Candle
impl OHLCV for Candle
source§fn tr(&self, prev_candle: &dyn OHLCV) -> ValueType
fn tr(&self, prev_candle: &dyn OHLCV) -> ValueType
Calculates True Range over last two candles Read more
source§fn tr_close(&self, prev_close: ValueType) -> ValueType
fn tr_close(&self, prev_close: ValueType) -> ValueType
Calculates True Range over last two candles using
close
price from the previous candle.source§fn volumed_price(&self) -> ValueType
fn volumed_price(&self) -> ValueType
Volumed price Read more
source§fn is_rising(&self) -> bool
fn is_rising(&self) -> bool
Checks if candle is “rising”: it’s close value greater than open value
source§fn is_falling(&self) -> bool
fn is_falling(&self) -> bool
Checks if candle is “falling”: it’s close value smaller than open value
source§impl PartialEq for Candle
impl PartialEq for Candle
source§impl PartialOrd for Candle
impl PartialOrd for Candle
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Copy for Candle
impl Eq for Candle
Auto Trait Implementations§
impl RefUnwindSafe for Candle
impl Send for Candle
impl Sync for Candle
impl Unpin 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