Ticker

Struct Ticker 

Source
pub struct Ticker { /* private fields */ }
Expand description

Ticker for fetching symbol-specific data.

Provides access to quotes, charts, financials, news, and other data for a specific symbol. Uses smart lazy loading - quote data is fetched once and cached.

§Example

use finance_query::Ticker;

let ticker = Ticker::new("AAPL").await?;

// Get quote data
let quote = ticker.quote(false).await?;
println!("Price: {:?}", quote.regular_market_price);

// Get chart data
use finance_query::{Interval, TimeRange};
let chart = ticker.chart(Interval::OneDay, TimeRange::OneMonth).await?;
println!("Candles: {}", chart.candles.len());

Implementations§

Source§

impl Ticker

Source

pub async fn new(symbol: impl Into<String>) -> Result<Self>

Creates a new ticker with default configuration

§Arguments
  • symbol - Stock symbol (e.g., “AAPL”, “MSFT”)
§Examples
use finance_query::Ticker;

let ticker = Ticker::new("AAPL").await?;
Source

pub fn builder(symbol: impl Into<String>) -> TickerBuilder

Creates a new builder for Ticker

Use this for custom configuration (language, region, timeout, proxy).

§Arguments
  • symbol - Stock symbol (e.g., “AAPL”, “MSFT”)
§Examples
use finance_query::Ticker;

// Simple case with defaults (same as new())
let ticker = Ticker::builder("AAPL").build().await?;

// With custom configuration
let ticker = Ticker::builder("AAPL")
    .lang("ja-JP")
    .region_code("JP")
    .build()
    .await?;
Source

pub fn symbol(&self) -> &str

Returns the ticker symbol

Source§

impl Ticker

Source

pub async fn price(&self) -> Result<Option<Price>>

Get price information

Source

pub async fn summary_detail(&self) -> Result<Option<SummaryDetail>>

Get summary detail

Source

pub async fn financial_data(&self) -> Result<Option<FinancialData>>

Get financial data

Source

pub async fn key_stats(&self) -> Result<Option<DefaultKeyStatistics>>

Get key statistics

Source

pub async fn asset_profile(&self) -> Result<Option<AssetProfile>>

Get asset profile

Source

pub async fn calendar_events(&self) -> Result<Option<CalendarEvents>>

Get calendar events

Source

pub async fn earnings(&self) -> Result<Option<Earnings>>

Get earnings

Source

pub async fn earnings_trend(&self) -> Result<Option<EarningsTrend>>

Get earnings trend

Source

pub async fn earnings_history(&self) -> Result<Option<EarningsHistory>>

Get earnings history

Source

pub async fn recommendation_trend(&self) -> Result<Option<RecommendationTrend>>

Get recommendation trend

Source

pub async fn insider_holders(&self) -> Result<Option<InsiderHolders>>

Get insider holders

Source

pub async fn insider_transactions(&self) -> Result<Option<InsiderTransactions>>

Get insider transactions

Source

pub async fn institution_ownership( &self, ) -> Result<Option<InstitutionOwnership>>

Get institution ownership

Source

pub async fn fund_ownership(&self) -> Result<Option<FundOwnership>>

Get fund ownership

Source

pub async fn major_holders(&self) -> Result<Option<MajorHoldersBreakdown>>

Get major holders breakdown

Source

pub async fn share_purchase_activity( &self, ) -> Result<Option<NetSharePurchaseActivity>>

Get net share purchase activity

Source

pub async fn quote_type(&self) -> Result<Option<QuoteTypeData>>

Get quote type

Source

pub async fn summary_profile(&self) -> Result<Option<SummaryProfile>>

Get summary profile

Source

pub async fn sec_filings(&self) -> Result<Option<SecFilings>>

Get SEC filings

Source

pub async fn grading_history(&self) -> Result<Option<UpgradeDowngradeHistory>>

Get upgrade/downgrade history

Source§

impl Ticker

Source

pub async fn quote(&self, include_logo: bool) -> Result<Quote>

Get full quote data with optional logo URL

§Arguments
  • include_logo - Whether to fetch and include the company logo URL

When include_logo is true, fetches both quote summary and logo URL in parallel using tokio::join! for minimal latency impact (~0-100ms overhead).

Source

pub async fn chart(&self, interval: Interval, range: TimeRange) -> Result<Chart>

Get historical chart data

Source

pub async fn dividends(&self, range: TimeRange) -> Result<Vec<Dividend>>

Get dividend history

Returns historical dividend payments sorted by date. Events are lazily loaded (fetched once, then filtered by range).

§Arguments
  • range - Time range to filter dividends
§Example
use finance_query::{Ticker, TimeRange};

let ticker = Ticker::new("AAPL").await?;

// Get all dividends
let all = ticker.dividends(TimeRange::Max).await?;

// Get last year's dividends
let recent = ticker.dividends(TimeRange::OneYear).await?;
Source

pub async fn splits(&self, range: TimeRange) -> Result<Vec<Split>>

Get stock split history

Returns historical stock splits sorted by date. Events are lazily loaded (fetched once, then filtered by range).

§Arguments
  • range - Time range to filter splits
§Example
use finance_query::{Ticker, TimeRange};

let ticker = Ticker::new("NVDA").await?;

// Get all splits
let all = ticker.splits(TimeRange::Max).await?;

// Get last 5 years
let recent = ticker.splits(TimeRange::FiveYears).await?;
Source

pub async fn capital_gains(&self, range: TimeRange) -> Result<Vec<CapitalGain>>

Get capital gains distribution history

Returns historical capital gain distributions sorted by date. This is primarily relevant for mutual funds and ETFs. Events are lazily loaded (fetched once, then filtered by range).

§Arguments
  • range - Time range to filter capital gains
§Example
use finance_query::{Ticker, TimeRange};

let ticker = Ticker::new("VFIAX").await?;

// Get all capital gains
let all = ticker.capital_gains(TimeRange::Max).await?;

// Get last 2 years
let recent = ticker.capital_gains(TimeRange::TwoYears).await?;
Source

pub async fn indicators( &self, interval: Interval, range: TimeRange, ) -> Result<IndicatorsSummary>

Calculate all technical indicators from chart data

§Arguments
  • interval - The time interval for each candle
  • range - The time range to fetch data for
§Returns

Returns IndicatorsSummary containing all calculated indicators.

§Example
use finance_query::{Ticker, Interval, TimeRange};

let ticker = Ticker::new("AAPL").await?;
let indicators = ticker.indicators(Interval::OneDay, TimeRange::OneYear).await?;

println!("RSI(14): {:?}", indicators.rsi_14);
println!("MACD: {:?}", indicators.macd);
Source

pub async fn recommendations(&self, limit: u32) -> Result<Recommendation>

Get analyst recommendations

Source

pub async fn financials( &self, statement_type: StatementType, frequency: Frequency, ) -> Result<FinancialStatement>

Get financial statements

§Arguments
  • statement_type - Type of statement (Income, Balance, CashFlow)
  • frequency - Annual or Quarterly
§Example
use finance_query::{Ticker, Frequency, StatementType};

let ticker = Ticker::new("AAPL").await?;
let income = ticker.financials(StatementType::Income, Frequency::Annual).await?;
println!("Revenue: {:?}", income.statement.get("TotalRevenue"));
Source

pub async fn news(&self) -> Result<Vec<News>>

Get news articles for this symbol

§Example
use finance_query::Ticker;

let ticker = Ticker::new("AAPL").await?;
let news = ticker.news().await?;
for article in news {
    println!("{}: {}", article.source, article.title);
}
Source

pub async fn options(&self, date: Option<i64>) -> Result<Options>

Get options chain

Auto Trait Implementations§

§

impl Freeze for Ticker

§

impl !RefUnwindSafe for Ticker

§

impl Send for Ticker

§

impl Sync for Ticker

§

impl Unpin for Ticker

§

impl !UnwindSafe for Ticker

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

impl<T> PlanCallbackArgs for T

Source§

impl<T> PlanCallbackOut for T