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

Creates Candle from any another OHLCV-object.

Trait Implementations

The resulting type after applying the + operator.

Performs the + operation. Read more

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Should return an open value of the period

Should return an highest value of the period

Should return an lowest value of the period

Should return an close value of the candle

Should return volume value for the period

Calculates Typical price. It’s just a simple (High + Low + Close) / 3 Read more

Calculates arithmetic average of high and low values of the candle Read more

Calculates arithmetic average of high, low, open and close values of the candle Read more

CLV = [(close - low) - (high - close)] / (high - low) Read more

Calculates True Range over last two candles Read more

Calculates True Range over last two candles using close price from the previous candle.

Validates candle attributes Read more

Returns Source field value of the candle. Read more

Volumed price Read more

Checks if candle is “rising”: it’s close value greater than open value

Checks if candle is “falling”: it’s close value smaller than open value

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.