Skip to main content

EquityClient

Struct EquityClient 

Source
pub struct EquityClient<'a> { /* private fields */ }
Expand description

High-level equity data facade built on top of TradingView screener and quote sessions.

This facade exposes typed products for common stock workflows such as:

  • quotes and market movers
  • fundamentals snapshots
  • analyst summaries, targets, forecasts, and earnings metadata
  • native estimate history and point-in-time fundamentals

§Examples

use tvdata_rs::{Result, TradingViewClient};

#[tokio::main]
async fn main() -> Result<()> {
    let client = TradingViewClient::builder().build()?;
    let equity = client.equity();

    let quote = equity.quote("NASDAQ:AAPL").await?;
    let analyst = equity.analyst_summary("NASDAQ:AAPL").await?;

    println!("{:?} {:?}", quote.close, analyst.price_targets.average);
    Ok(())
}

Implementations§

Source§

impl<'a> EquityClient<'a>

Source

pub const fn new(client: &'a TradingViewClient) -> Self

Source

pub fn client(&self) -> &'a TradingViewClient

Source

pub async fn quote(&self, symbol: impl Into<Ticker>) -> Result<QuoteSnapshot>

Fetches a typed equity quote snapshot for a single symbol.

Source

pub async fn quotes<I, T>(&self, symbols: I) -> Result<Vec<QuoteSnapshot>>
where I: IntoIterator<Item = T>, T: Into<Ticker>,

Fetches typed quote snapshots for multiple symbols while preserving the requested order.

Source

pub async fn fundamentals( &self, symbol: impl Into<Ticker>, ) -> Result<FundamentalsSnapshot>

Fetches a fundamentals snapshot for a single equity symbol.

§Examples
use tvdata_rs::{Result, TradingViewClient};

#[tokio::main]
async fn main() -> Result<()> {
    let client = TradingViewClient::builder().build()?;
    let fundamentals = client.equity().fundamentals("NASDAQ:AAPL").await?;

    println!("{:?}", fundamentals.market_cap);
    Ok(())
}
Source

pub async fn fundamentals_history( &self, symbol: impl Into<Ticker>, ) -> Result<PointInTimeFundamentals>

Source

pub async fn fundamentals_point_in_time( &self, symbol: impl Into<Ticker>, ) -> Result<PointInTimeFundamentals>

Fetches native point-in-time fundamentals history from TradingView quote sessions.

Source

pub async fn fundamentals_histories<I, T>( &self, symbols: I, ) -> Result<Vec<PointInTimeFundamentals>>
where I: IntoIterator<Item = T>, T: Into<Ticker>,

Source

pub async fn fundamentals_point_in_time_batch<I, T>( &self, symbols: I, ) -> Result<Vec<PointInTimeFundamentals>>
where I: IntoIterator<Item = T>, T: Into<Ticker>,

Source

pub async fn fundamentals_batch<I, T>( &self, symbols: I, ) -> Result<Vec<FundamentalsSnapshot>>
where I: IntoIterator<Item = T>, T: Into<Ticker>,

Source

pub async fn analyst_summary( &self, symbol: impl Into<Ticker>, ) -> Result<AnalystSummary>

Fetches a rich analyst snapshot combining recommendations, targets, forecasts, earnings, and FX conversion metadata.

§Examples
use tvdata_rs::{Result, TradingViewClient};

#[tokio::main]
async fn main() -> Result<()> {
    let client = TradingViewClient::builder().build()?;
    let analyst = client.equity().analyst_summary("NASDAQ:AAPL").await?;

    println!("{:?}", analyst.recommendations.rating);
    Ok(())
}
Source

pub async fn estimate_history( &self, symbol: impl Into<Ticker>, ) -> Result<EstimateHistory>

Fetches native analyst estimate history from TradingView quote sessions.

The returned model is point-in-time aware and distinguishes annual and quarterly observations.

§Examples
use tvdata_rs::{Result, TradingViewClient};

#[tokio::main]
async fn main() -> Result<()> {
    let client = TradingViewClient::builder().build()?;
    let history = client.equity().estimate_history("NASDAQ:AAPL").await?;

    println!(
        "quarterly observations: {}",
        history.quarterly.len()
    );
    Ok(())
}
Source

pub async fn earnings_history( &self, symbol: impl Into<Ticker>, ) -> Result<EstimateHistory>

Source

pub async fn estimate_histories<I, T>( &self, symbols: I, ) -> Result<Vec<EstimateHistory>>
where I: IntoIterator<Item = T>, T: Into<Ticker>,

Source

pub async fn earnings_histories<I, T>( &self, symbols: I, ) -> Result<Vec<EstimateHistory>>
where I: IntoIterator<Item = T>, T: Into<Ticker>,

Source

pub async fn analyst_recommendations( &self, symbol: impl Into<Ticker>, ) -> Result<AnalystRecommendations>

Source

pub async fn price_targets( &self, symbol: impl Into<Ticker>, ) -> Result<AnalystPriceTargets>

Source

pub async fn analyst_forecasts( &self, symbol: impl Into<Ticker>, ) -> Result<AnalystForecasts>

Source

pub async fn earnings_calendar( &self, symbol: impl Into<Ticker>, ) -> Result<EarningsCalendar>

Source

pub async fn earnings_events( &self, symbol: impl Into<Ticker>, ) -> Result<EarningsCalendar>

Source

pub async fn analyst_fx_rates( &self, symbol: impl Into<Ticker>, ) -> Result<AnalystFxRates>

Source

pub async fn analyst_summaries<I, T>( &self, symbols: I, ) -> Result<Vec<AnalystSummary>>
where I: IntoIterator<Item = T>, T: Into<Ticker>,

Source

pub async fn technical_summary( &self, symbol: impl Into<Ticker>, ) -> Result<TechnicalSummary>

Source

pub async fn technical_summaries<I, T>( &self, symbols: I, ) -> Result<Vec<TechnicalSummary>>
where I: IntoIterator<Item = T>, T: Into<Ticker>,

Source

pub async fn overview( &self, symbol: impl Into<Ticker>, ) -> Result<EquityOverview>

Source

pub async fn overviews<I, T>(&self, symbols: I) -> Result<Vec<EquityOverview>>
where I: IntoIterator<Item = T>, T: Into<Ticker>,

Source

pub async fn top_gainers( &self, market: impl Into<Market>, limit: usize, ) -> Result<Vec<QuoteSnapshot>>

Fetches the strongest equity movers in a market by percentage change.

Source

pub async fn top_losers( &self, market: impl Into<Market>, limit: usize, ) -> Result<Vec<QuoteSnapshot>>

Source

pub async fn most_active( &self, market: impl Into<Market>, limit: usize, ) -> Result<Vec<QuoteSnapshot>>

Trait Implementations§

Source§

impl<'a> Clone for EquityClient<'a>

Source§

fn clone(&self) -> EquityClient<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for EquityClient<'a>

Source§

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

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

impl<'a> Copy for EquityClient<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for EquityClient<'a>

§

impl<'a> !RefUnwindSafe for EquityClient<'a>

§

impl<'a> Send for EquityClient<'a>

§

impl<'a> Sync for EquityClient<'a>

§

impl<'a> Unpin for EquityClient<'a>

§

impl<'a> UnsafeUnpin for EquityClient<'a>

§

impl<'a> !UnwindSafe for EquityClient<'a>

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<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> 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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: 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: 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> Same for T

Source§

type Output = T

Should always be Self
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.
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