Skip to main content

Instrument

Struct Instrument 

Source
#[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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§symbol: String

The symbol as the feed knows it.

§description: Option<String>

Full name, such as “Apple Inc.”.

§exchange: Option<String>

Exchange or venue, such as “NASDAQ”.

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.

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: bool

Whether 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

Source

pub fn new(symbol: impl Into<String>) -> Self

symbol, with everything else unknown.

Source

pub fn with_description(self, description: impl Into<String>) -> Self

Source

pub fn with_unit(self, unit: impl Into<String>) -> Self

Sets the price unit.

Source

pub fn with_exchange(self, exchange: impl Into<String>) -> Self

Sets exchange.

Sets logo.

Source

pub fn with_country(self, country: impl Into<String>) -> Self

Sets country.

Source

pub fn with_root(self, root: impl Into<String>) -> Self

Sets root.

Source

pub fn with_symbol_type(self, symbol_type: SymbolType) -> Self

Source

pub fn with_tick_size(self, tick_size: f64) -> Self

Sets tick_size.

Source

pub fn with_pip_size(self, pip_size: f64) -> Self

Sets pip_size.

Source

pub fn with_price_decimals(self, decimals: u8) -> Self

Source

pub fn with_volume_decimals(self, decimals: u8) -> Self

Source

pub fn with_currency(self, currency: impl Into<String>) -> Self

Sets currency.

Source

pub fn with_time_zone(self, time_zone: TimezoneId) -> Self

Sets time_zone.

Source

pub fn with_session(self, session: Session) -> Self

Sets session.

Source

pub fn with_native_timeframes( self, timeframes: impl IntoIterator<Item = Timeframe>, ) -> Self

Source

pub fn with_supported_timeframes( self, timeframes: impl IntoIterator<Item = Timeframe>, ) -> Self

Source

pub fn with_services( self, services: impl IntoIterator<Item = FeedService>, ) -> Self

Sets services.

Source

pub fn with_dividend_adjustment(self, adjustment: bool) -> Self

Source

pub fn with_data_status(self, status: DataStatus) -> Self

Source

pub fn with_profile_resolutions( self, resolutions: impl IntoIterator<Item = ProfileResolution>, ) -> Self

Trait Implementations§

Source§

impl Clone for Instrument

Source§

fn clone(&self) -> Instrument

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Instrument

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Instrument

Source§

fn eq(&self, other: &Instrument) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Instrument

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> MaybeSend for T
where T: Send + Sync + ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

§

impl<T> SerializableAny for T
where T: 'static + Any + Clone + for<'a> Send + Sync,

§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

§

fn simd_from(_simd: S, value: T) -> T

§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

§

fn simd_into(self, simd: S) -> T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.