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 from_set(set: Arc<ProviderSet>) -> Self
pub fn from_set(set: Arc<ProviderSet>) -> Self
Wrap a [ProviderSet] assembled by hand.
The lower-level counterpart to builder, for a caller
that has already built its own adapters and route table. Nothing is
initialised: ProviderAdapter::initialize
is the builder’s job, so a hand-built set must be ready to use.
Sourcepub fn from_set_with_lang(
set: Arc<ProviderSet>,
lang: impl Into<String>,
) -> Self
pub fn from_set_with_lang( set: Arc<ProviderSet>, lang: impl Into<String>, ) -> Self
from_set with an explicit language for the handles
this set creates.
Sourcepub fn provider_set(&self) -> &Arc<ProviderSet> ⓘ
pub fn provider_set(&self) -> &Arc<ProviderSet> ⓘ
The underlying set, for TickerBuilder::with_provider_set and friends.
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().
The language configured via ProvidersBuilder::lang or
ProvidersBuilder::region is inherited (override with .lang() on
the returned builder). With the translation feature, a non-English
language translates text fields automatically.
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().
The language configured via ProvidersBuilder::lang or
ProvidersBuilder::region is inherited (override with .lang() on
the returned builder). With the translation feature, a non-English
language translates text fields automatically.
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.
Compiled in unconditionally. With no built-in provider for this
capability, register one with ProvidersBuilder::with_adapter or
enable its feature, or these calls return NoProviderAvailable.
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.
Compiled in unconditionally. With no built-in provider for this
capability, register one with ProvidersBuilder::with_adapter or
enable its feature, or these calls return NoProviderAvailable.
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.
Compiled in unconditionally. With no built-in provider for this
capability, register one with ProvidersBuilder::with_adapter or
enable its feature, or these calls return NoProviderAvailable.
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.
Sourcepub fn commodity(&self, symbol: impl Into<String>) -> Commodity
pub fn commodity(&self, symbol: impl Into<String>) -> Commodity
Create a Commodity handle backed by this provider set.
Sourcepub fn discovery(&self) -> Discovery
pub fn discovery(&self) -> Discovery
Create a Discovery handle backed by this provider set.
Routes symbol search, reference data, and screening through
Capability::DISCOVERY. Distinct from
crate::finance::search, which is a Yahoo-only shortcut.
Sourcepub fn calendar(&self) -> MarketCalendar
pub fn calendar(&self) -> MarketCalendar
Create a MarketCalendar handle backed by this provider set.
Routes market-wide earnings/IPO/dividend/split/economic calendars
through Capability::CALENDAR.
Sourcepub fn market(&self) -> Market
pub fn market(&self) -> Market
Create a Market handle backed by this provider set.
Routes sector/industry performance and movers through
Capability::MARKET. Movers work on the
default keyless route (Yahoo screeners); the sector/industry
statistics need a keyed provider (FMP).
Sourcepub fn economic_catalog(&self) -> EconomicCatalog
pub fn economic_catalog(&self) -> EconomicCatalog
Create an EconomicCatalog handle backed by
this provider set.
Routes series search and category/release browsing through
Capability::ECONOMIC. Unlike
economic it takes no series id — it is how you find
one.
Compiled in unconditionally. With no built-in provider for this
capability, register one with ProvidersBuilder::with_adapter or
enable its feature, or these calls return NoProviderAvailable.
Sourcepub fn snapshot(&self) -> Snapshot
pub fn snapshot(&self) -> Snapshot
Create a Snapshot handle backed by this provider set.
Routes cross-market snapshots through
Capability::QUOTE. Needs a provider whose
snapshot endpoint spans asset classes, currently Polygon alone.
Compiled in unconditionally. With no built-in provider for this
capability, register one with ProvidersBuilder::with_adapter or
enable its feature, or these calls return NoProviderAvailable.
Sourcepub fn filings(&self, symbol: impl Into<String>) -> Filings
pub fn filings(&self, symbol: impl Into<String>) -> Filings
Create a Filings handle backed by this provider set.
Always available — EDGAR is auto-injected when no other FILINGS provider is configured.
Sourcepub fn health(&self) -> Vec<ProviderHealth>
pub fn health(&self) -> Vec<ProviderHealth>
Snapshot recent health for every configured provider.
Each ProviderHealth entry reflects up to the last 20 dispatch
outcomes recorded in-process for that provider (recency window is
internal and unspecified beyond “recent”), plus a best-effort
rate-limit budget estimate where the provider exposes one. Purely
observational — it does not affect routing or retries.
§Example
use finance_query::Providers;
let providers = Providers::builder().build().await?;
for health in providers.health() {
println!("{:?}: healthy={}", health.provider, health.is_healthy);
}Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Providers
impl !UnwindSafe for Providers
impl Freeze for Providers
impl Send for Providers
impl Sync for Providers
impl Unpin for Providers
impl UnsafeUnpin 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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