#[non_exhaustive]pub struct Instrument {Show 22 fields
pub symbol: String,
pub description: Option<String>,
pub exchange: Option<String>,
pub logo: Option<String>,
pub exchange_logo: Option<String>,
pub country: Option<String>,
pub root: Option<String>,
pub symbol_type: Option<SymbolType>,
pub tick_size: Option<f64>,
pub pip_size: Option<f64>,
pub price_decimals: Option<u8>,
pub volume_decimals: Option<u8>,
pub currency: Option<String>,
pub unit: Option<String>,
pub time_zone: Option<TimezoneId>,
pub session: Option<Session>,
pub native_timeframes: Option<Vec<Timeframe>>,
pub supported_timeframes: Option<Vec<Timeframe>>,
pub services: Option<Vec<FeedService>>,
pub data_status: Option<DataStatus>,
pub dividend_adjustment: bool,
pub profile_resolutions: Vec<ProfileResolution>,
}Expand description
What a feed or a search service reports about a symbol. Build it with Instrument::new and the with_ setters;
fields left out stay unknown.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.symbol: StringThe symbol as the feed knows it.
description: Option<String>Full name, such as “Apple Inc.”.
exchange: Option<String>Exchange or venue, such as “NASDAQ”.
logo: Option<String>URI of the symbol’s logo for egui’s installed image loaders; supply a square image. The
legend and symbol choosers draw it in a circle, and the symbol’s first letter or digit
while it is unknown, loading or unreadable. A prefixed symbol such as VENUE:ABC shows V.
exchange_logo: Option<String>URI of the exchange’s mark, for egui’s installed image loaders. Symbol search shows the exchange name alone while it is unknown, loading or unreadable.
country: Option<String>Country of the listing, as an ISO 3166-1 alpha-2 code such as “US”.
root: Option<String>Root shared by related instruments, such as “ES” for the contracts of a futures root or one security listed on several exchanges. Symbol search lists the first instrument of a root and offers the others under it.
symbol_type: Option<SymbolType>Instrument type.
tick_size: Option<f64>Smallest price increment: positive and finite. Consumers ignore any other value.
pip_size: Option<f64>Price represented by one pip: positive and finite. Unknown for instruments without pips.
price_decimals: Option<u8>Decimals of price labels.
volume_decimals: Option<u8>Decimals of volume readouts, including abbreviated K/M/B values.
currency: Option<String>Currency of prices, such as “USD”.
unit: Option<String>Host-supplied price unit, such as “USD/barrel”; no conversion is performed.
time_zone: Option<TimezoneId>Exchange time zone.
session: Option<Session>Regular trading hours, in exchange time.
native_timeframes: Option<Vec<Timeframe>>OHLCV intervals supplied without aggregation. None means unspecified; an empty list
means no native bar history. Derived intervals remain available through host resampling.
supported_timeframes: Option<Vec<Timeframe>>Intervals Datafeed::history answers, native or
derived. None allows every interval. A chart does not ask the feed for any other
interval. Pass the list to ui::top_toolbar::TimeframeSelector::set_supported_timeframes
so that the interval picker offers only these.
services: Option<Vec<FeedService>>Optional services supplied for this symbol, narrowing the feed’s
services. None defers to the feed’s list;
an empty list supplies none. Use FeedCapabilities::declares
to require explicit confirmation from either list while respecting both.
data_status: Option<DataStatus>How current the feed’s data is. The legend marks delayed and end-of-day data.
dividend_adjustment: boolWhether the feed supplies dividend-adjusted history when
HistoryRequest::adjusted is set.
profile_resolutions: Vec<ProfileResolution>Bar intervals the feed suggests for volume profile studies and drawings, by profile length. A study whose source follows the chart, or a fixed range or anchored drawing without executions, reads the shortest suggested interval shorter than the chart’s that serves its length. Empty, the default, suggests none; profiles then spread each chart bar’s volume over its range.
Implementations§
Source§impl Instrument
impl Instrument
Sourcepub fn with_description(self, description: impl Into<String>) -> Self
pub fn with_description(self, description: impl Into<String>) -> Self
Sets description.
Sourcepub fn with_exchange(self, exchange: impl Into<String>) -> Self
pub fn with_exchange(self, exchange: impl Into<String>) -> Self
Sets exchange.
Sourcepub fn with_exchange_logo(self, uri: impl Into<String>) -> Self
pub fn with_exchange_logo(self, uri: impl Into<String>) -> Self
Sets exchange_logo.
Sourcepub fn with_country(self, country: impl Into<String>) -> Self
pub fn with_country(self, country: impl Into<String>) -> Self
Sets country.
Sourcepub fn with_symbol_type(self, symbol_type: SymbolType) -> Self
pub fn with_symbol_type(self, symbol_type: SymbolType) -> Self
Sets symbol_type.
Sourcepub fn with_tick_size(self, tick_size: f64) -> Self
pub fn with_tick_size(self, tick_size: f64) -> Self
Sets tick_size.
Sourcepub fn with_pip_size(self, pip_size: f64) -> Self
pub fn with_pip_size(self, pip_size: f64) -> Self
Sets pip_size.
Sourcepub fn with_price_decimals(self, decimals: u8) -> Self
pub fn with_price_decimals(self, decimals: u8) -> Self
Sets price_decimals.
Sourcepub fn with_volume_decimals(self, decimals: u8) -> Self
pub fn with_volume_decimals(self, decimals: u8) -> Self
Sets volume_decimals.
Sourcepub fn with_currency(self, currency: impl Into<String>) -> Self
pub fn with_currency(self, currency: impl Into<String>) -> Self
Sets currency.
Sourcepub fn with_time_zone(self, time_zone: TimezoneId) -> Self
pub fn with_time_zone(self, time_zone: TimezoneId) -> Self
Sets time_zone.
Sourcepub fn with_session(self, session: Session) -> Self
pub fn with_session(self, session: Session) -> Self
Sets session.
Sourcepub fn with_native_timeframes(
self,
timeframes: impl IntoIterator<Item = Timeframe>,
) -> Self
pub fn with_native_timeframes( self, timeframes: impl IntoIterator<Item = Timeframe>, ) -> Self
Sets native_timeframes, reported by Datafeed::resolve.
Sourcepub fn with_supported_timeframes(
self,
timeframes: impl IntoIterator<Item = Timeframe>,
) -> Self
pub fn with_supported_timeframes( self, timeframes: impl IntoIterator<Item = Timeframe>, ) -> Self
Sets supported_timeframes.
Sourcepub fn with_services(
self,
services: impl IntoIterator<Item = FeedService>,
) -> Self
pub fn with_services( self, services: impl IntoIterator<Item = FeedService>, ) -> Self
Sets services.
Sourcepub fn with_dividend_adjustment(self, adjustment: bool) -> Self
pub fn with_dividend_adjustment(self, adjustment: bool) -> Self
Sets dividend_adjustment.
Sourcepub fn with_data_status(self, status: DataStatus) -> Self
pub fn with_data_status(self, status: DataStatus) -> Self
Sets data_status.
Sourcepub fn with_profile_resolutions(
self,
resolutions: impl IntoIterator<Item = ProfileResolution>,
) -> Self
pub fn with_profile_resolutions( self, resolutions: impl IntoIterator<Item = ProfileResolution>, ) -> Self
Sets profile_resolutions.
Trait Implementations§
Source§impl Clone for Instrument
impl Clone for Instrument
Source§fn clone(&self) -> Instrument
fn clone(&self) -> Instrument
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 Instrument
impl Debug for Instrument
Source§impl PartialEq for Instrument
impl PartialEq for Instrument
impl StructuralPartialEq for Instrument
Auto Trait Implementations§
impl Freeze for Instrument
impl RefUnwindSafe for Instrument
impl Send for Instrument
impl Sync for Instrument
impl Unpin for Instrument
impl UnsafeUnpin for Instrument
impl UnwindSafe for Instrument
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