pub struct SymbolDetailsPanel { /* private fields */ }Expand description
Details of the chart’s symbol, fed by the host’s Datafeed and Storage.
Keep it on the chart’s symbol with set_instrument, its latest quote
with set_quote, such as the one
WatchlistPanel::quote holds, and its average volume with
set_average_volume. The quote’s last price, change, update time,
extended-hours trade and session volume are shown, the extended-hours change measured from the
regular last price; update times are shown in the time zone set with
set_timezone, UTC by default. The header’s layout button shows or
hides sections, the edit button moves to the notes, and a feed that supplies
SymbolDetails::url gets a link to the instrument beside its name, and one that supplies
SymbolDetails::category gets the category under it. For each new symbol the panel asks the
feed for Datafeed::symbol_details and shows the statistics, on a card, and the profile it
answers; an empty section, or a feed that does not support the request, shows nothing. Notes
are kept in memory per symbol, and with a storage service attached they are read from and
written to one StoreKind::SymbolNotes document per symbol as they are edited, one write per
document at a time. Call poll each frame, even while the panel is hidden, then
show while it is open. The More menu’s Financials item is reported by
take_financials_request, for the host to open a
FinancialsPanel with the company’s figures.
The Performance and Seasonality sections show what the host supplies. Call
take_market_requests each frame: the first call for a symbol
returns its MarketDetailRequests and shows both sections as loading, and the host answers
with set_period_returns and
set_seasonality. A host that never calls it sees neither section.
Each section says whether it is loading, empty, unavailable or failed.
Implementations§
Source§impl SymbolDetailsPanel
impl SymbolDetailsPanel
Sourcepub fn set_feed(&mut self, feed: Arc<dyn Datafeed>)
pub fn set_feed(&mut self, feed: Arc<dyn Datafeed>)
Ask feed for the details of each symbol from now on, starting with the shown one.
Sourcepub fn set_storage(&mut self, storage: Arc<dyn Storage>)
pub fn set_storage(&mut self, storage: Arc<dyn Storage>)
Keep notes in storage, reading them again from it. Edits not yet written are dropped.
Sourcepub fn set_instrument(&mut self, instrument: &Instrument)
pub fn set_instrument(&mut self, instrument: &Instrument)
Show instrument, such as the chart’s. A new symbol clears the quote and the average
volume and asks for its details and notes; the same symbol only takes the new name,
exchange and currency.
Sourcepub fn set_quote(&mut self, quote: Quote)
pub fn set_quote(&mut self, quote: Quote)
Sets the latest quote of the shown symbol. Its extended-hours trade shows below the regular price while it is set.
Sourcepub fn set_average_volume(&mut self, average: f64)
pub fn set_average_volume(&mut self, average: f64)
Sets the average daily volume of the shown symbol over the last 30 days. With the quote’s session volume, both are drawn as a bar split in proportion to the two.
Sourcepub fn set_timezone(&mut self, timezone: TimezoneId)
pub fn set_timezone(&mut self, timezone: TimezoneId)
Shows update times in timezone, such as the chart’s.
Sourcepub fn set_financials_visible(&mut self, visible: bool)
pub fn set_financials_visible(&mut self, visible: bool)
Show or hide Financials in the More menu, shown by default. Hide it when the host cannot supply company financials.
Sourcepub fn take_financials_request(&mut self) -> bool
pub fn take_financials_request(&mut self) -> bool
Whether the user chose Financials in the More menu since the last call.
Sourcepub fn take_market_requests(&mut self) -> Vec<MarketDetailRequest>
pub fn take_market_requests(&mut self) -> Vec<MarketDetailRequest>
The market detail the sections still lack for the shown symbol, each returned once; it
marks them loading. Call it every frame and answer with
set_period_returns and
set_seasonality.
Sourcepub fn set_period_returns(
&mut self,
symbol: &str,
returns: MarketDetail<Vec<PeriodReturn>>,
)
pub fn set_period_returns( &mut self, symbol: &str, returns: MarketDetail<Vec<PeriodReturn>>, )
Answers the MarketDetailRequest::PeriodReturns of symbol. An answer for a symbol the
panel no longer shows is ignored.
Sourcepub fn set_seasonality(
&mut self,
symbol: &str,
seasonality: MarketDetail<Seasonality>,
)
pub fn set_seasonality( &mut self, symbol: &str, seasonality: MarketDetail<Seasonality>, )
Answers the MarketDetailRequest::Seasonality of symbol. An answer for a symbol the
panel no longer shows is ignored.
Trait Implementations§
Source§impl Default for SymbolDetailsPanel
impl Default for SymbolDetailsPanel
Source§fn default() -> SymbolDetailsPanel
fn default() -> SymbolDetailsPanel
Auto Trait Implementations§
impl !RefUnwindSafe for SymbolDetailsPanel
impl !UnwindSafe for SymbolDetailsPanel
impl Freeze for SymbolDetailsPanel
impl Send for SymbolDetailsPanel
impl Sync for SymbolDetailsPanel
impl Unpin for SymbolDetailsPanel
impl UnsafeUnpin for SymbolDetailsPanel
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> 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