Skip to main content

Providers

Struct Providers 

Source
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

Source

pub fn builder() -> ProvidersBuilder

Create a builder for configuring providers.

Source

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.

Source

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.

Source

pub fn provider_set(&self) -> &Arc<ProviderSet>

The underlying set, for TickerBuilder::with_provider_set and friends.

Source

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.

Source

pub fn tickers<S, I>(&self, symbols: I) -> TickersBuilder
where S: Into<String>, I: IntoIterator<Item = S>,

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.

Source

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.

Source

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.

Source

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.

Source

pub fn index(&self, symbol: impl Into<String>) -> Index

Create an Index handle backed by this provider set.

Source

pub fn futures(&self, symbol: impl Into<String>) -> FuturesContract

Create a FuturesContract handle backed by this provider set.

Source

pub fn commodity(&self, symbol: impl Into<String>) -> Commodity

Create a Commodity handle backed by this provider set.

Source

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.

Source

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.

Source

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).

Source

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.

Source

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.

Source

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.

Source

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§

Source§

impl Debug for Providers

Source§

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

Formats the value using the given formatter. Read more

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

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

Source§

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

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PlanCallbackArgs for T

Source§

impl<T> PlanCallbackOut for T

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

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

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more