pub struct Providers { /* private fields */ }Expand description
Central provider configuration shared across query handles.
Build once with Providers::builder, then create lightweight
Ticker handles that share the same underlying
provider connections and authentication.
§Example
use finance_query::{Providers, Provider, Fetch, Capability};
let providers = Providers::builder()
.route(Capability::QUOTE, &[Provider::Yahoo])
.fetch(Fetch::Sequential)
.build().await?;
// All Ticker handles share the same Arc<ProviderSet>
let aapl = providers.ticker("AAPL").build().await?;
let nvda = providers.ticker("NVDA").logo().build().await?;Implementations§
Source§impl Providers
impl Providers
Sourcepub fn builder() -> ProvidersBuilder
pub fn builder() -> ProvidersBuilder
Create a builder for configuring providers.
Sourcepub fn ticker(&self, symbol: impl Into<String>) -> TickerBuilder
pub fn ticker(&self, symbol: impl Into<String>) -> TickerBuilder
Create a TickerBuilder pre-wired to this provider set.
The returned builder accepts the same optional configuration as
Ticker::builder (.cache(), .logo(),
.format()) before calling .build().
Sourcepub fn tickers<S, I>(&self, symbols: I) -> TickersBuilder
pub fn tickers<S, I>(&self, symbols: I) -> TickersBuilder
Create a TickersBuilder pre-wired to this provider set.
The returned builder accepts the same optional configuration as
Tickers::builder (.cache(),
.max_concurrency(), .logo(), .format()) before calling .build().
Sourcepub fn crypto(&self, id: impl Into<String>) -> CryptoCoin
pub fn crypto(&self, id: impl Into<String>) -> CryptoCoin
Create a CryptoCoin handle backed by this provider set.
Sourcepub fn forex(&self, from: impl Into<String>, to: impl Into<String>) -> ForexPair
pub fn forex(&self, from: impl Into<String>, to: impl Into<String>) -> ForexPair
Create a ForexPair handle backed by this provider set.
Sourcepub fn economic(&self, series_id: impl Into<String>) -> EconomicIndicator
pub fn economic(&self, series_id: impl Into<String>) -> EconomicIndicator
Create an EconomicIndicator handle backed by this provider set.
Sourcepub fn index(&self, symbol: impl Into<String>) -> Index
pub fn index(&self, symbol: impl Into<String>) -> Index
Create an Index handle backed by this provider set.
Sourcepub fn futures(&self, symbol: impl Into<String>) -> FuturesContract
pub fn futures(&self, symbol: impl Into<String>) -> FuturesContract
Create a FuturesContract handle backed by this provider set.
Auto Trait Implementations§
impl Freeze for Providers
impl !RefUnwindSafe for Providers
impl Send for Providers
impl Sync for Providers
impl Unpin for Providers
impl UnsafeUnpin for Providers
impl !UnwindSafe for Providers
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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