pub struct DataWindowInfo {Show 17 fields
pub symbol: String,
pub timestamp: String,
pub timeframe: String,
pub open: f64,
pub high: f64,
pub low: f64,
pub close: f64,
pub volume: f64,
pub change: f64,
pub change_percent: f64,
pub volume_precision: Option<u8>,
pub prev_close: f64,
pub price_decimals: Option<u8>,
pub formatted_prices: Option<[String; 4]>,
pub formatted_volume: Option<String>,
pub formatted_change: Option<String>,
pub studies: Vec<StudyValue>,
}Expand description
Data Window information (OHLCV at cursor position)
Displays real-time price data for the bar under the cursor.
Fields§
§symbol: StringSymbol name (e.g., “XAUUSD”)
timestamp: StringTimestamp at cursor position
timeframe: StringTimeframe (e.g., “1m”, “1H”, “1D”)
open: f64Open price
high: f64High price
low: f64Low price
close: f64Close price
volume: f64Volume
change: f64Change from previous close (absolute)
change_percent: f64Change from previous close (percentage)
volume_precision: Option<u8>Decimals of abbreviated volume fields.
prev_close: f64Previous close price
price_decimals: Option<u8>Instrument price decimals; None keeps magnitude-based formatting.
formatted_prices: Option<[String; 4]>Host-formatted open, high, low and close values, or None for instrument formatting.
formatted_volume: Option<String>Host-formatted volume, or None for instrument formatting.
formatted_change: Option<String>Host-formatted absolute and percentage change, or None for instrument formatting.
studies: Vec<StudyValue>Visible study plots at the same bar as the OHLCV values.
Implementations§
Source§impl DataWindowInfo
impl DataWindowInfo
Sourcepub fn from_chart(chart: &Chart) -> Self
pub fn from_chart(chart: &Chart) -> Self
Populates the readout from the hovered rendered bar, falling back to the latest bar with a
value.
Uses the chart’s time formatter, instrument precision and visible study plots.
Call after crate::widget::Chart::show so hover and study values describe the current frame.
Sourcepub fn with_chart_formatters(self, chart: &Chart) -> Self
pub fn with_chart_formatters(self, chart: &Chart) -> Self
Formats this readout’s raw values with the chart’s host formatters. Call after populating OHLCV and previous close; missing hooks retain instrument formatting.
Source§impl DataWindowInfo
impl DataWindowInfo
Sourcepub fn with_instrument(self, instrument: &Instrument) -> Self
pub fn with_instrument(self, instrument: &Instrument) -> Self
Applies the instrument’s price and volume precision to this readout.
Sourcepub fn with_ohlcv(
self,
open: f64,
high: f64,
low: f64,
close: f64,
volume: f64,
) -> Self
pub fn with_ohlcv( self, open: f64, high: f64, low: f64, close: f64, volume: f64, ) -> Self
Set OHLCV data
Sourcepub fn with_price_decimals(self, decimals: Option<u8>) -> Self
pub fn with_price_decimals(self, decimals: Option<u8>) -> Self
Set the instrument precision used for prices and absolute change.
Sourcepub fn with_timestamp(self, ts: impl Into<String>) -> Self
pub fn with_timestamp(self, ts: impl Into<String>) -> Self
Set timestamp
Sourcepub fn with_timeframe(self, tf: impl Into<String>) -> Self
pub fn with_timeframe(self, tf: impl Into<String>) -> Self
Set timeframe
Sourcepub fn with_prev_close(self, prev: f64) -> Self
pub fn with_prev_close(self, prev: f64) -> Self
Calculate and set change from previous close
Sourcepub fn is_bullish(&self) -> bool
pub fn is_bullish(&self) -> bool
Check if price is bullish (close >= open or change >= 0)
Trait Implementations§
Source§impl Clone for DataWindowInfo
impl Clone for DataWindowInfo
Source§fn clone(&self) -> DataWindowInfo
fn clone(&self) -> DataWindowInfo
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DataWindowInfo
impl Debug for DataWindowInfo
Source§impl Default for DataWindowInfo
impl Default for DataWindowInfo
Source§fn default() -> DataWindowInfo
fn default() -> DataWindowInfo
Auto Trait Implementations§
impl Freeze for DataWindowInfo
impl RefUnwindSafe for DataWindowInfo
impl Send for DataWindowInfo
impl Sync for DataWindowInfo
impl Unpin for DataWindowInfo
impl UnsafeUnpin for DataWindowInfo
impl UnwindSafe for DataWindowInfo
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more