finance-query v3.2.0

finance-query API reference#

Generated by cargo soothfast docs reference Measurements and verified claims come from the latest baseline; CI gates them.

finance_query#

AnalystEstimate struct#

rust · ignore
pub struct AnalystEstimate { pub symbol: Option<String>, pub date: Option<String>, pub estimated_revenue_low: Option<f64>, pub estimated_revenue_high: Option<f64>, pub estimated_revenue_avg: Option<f64>, pub estimated_ebitda_low: Option<f64>, pub estimated_ebitda_high: Option<f64>, pub estimated_ebitda_avg: Option<f64>, pub estimated_eps_avg: Option<f64>, pub estimated_eps_high: Option<f64>, pub estimated_eps_low: Option<f64>, pub number_analyst_estimated_revenue: Option<i32>, pub number_analysts_estimated_eps: Option<i32> }

AnalystRecommendation struct#

rust · ignore
pub struct AnalystRecommendation { pub symbol: Option<String>, pub date: Option<String>, pub analyst_ratings_buy: Option<i32>, pub analyst_ratings_hold: Option<i32>, pub analyst_ratings_sell: Option<i32>, pub analyst_ratings_strong_buy: Option<i32>, pub analyst_ratings_strong_sell: Option<i32> }

AroonData struct#

rust · ignore
pub struct AroonData { pub aroon_up: Option<f64>, pub aroon_down: Option<f64> }

AssetClass enum#

rust · ignore
pub enum AssetClass { Stocks, Options, Fx, Crypto, Indices }

BatchCapitalGainsResponse struct#

rust · ignore
define_batch_response! {  }

BatchChartsResponse struct#

rust · ignore
define_batch_response! {  }

BatchDividendsResponse struct#

rust · ignore
define_batch_response! {  }

BatchFinancialsResponse struct#

rust · ignore
define_batch_response! {  }

BatchIndicatorsResponse struct#

rust · ignore
define_batch_response! {  }

BatchNewsResponse struct#

rust · ignore
define_batch_response! {  }

BatchOptionsResponse struct#

rust · ignore
define_batch_response! {  }

BatchQuotesResponse struct#

rust · ignore
define_batch_response! {  }

BatchRecommendationsResponse struct#

rust · ignore
define_batch_response! {  }

BatchSparksResponse struct#

rust · ignore
define_batch_response! {  }

BatchSplitsResponse struct#

rust · ignore
define_batch_response! {  }

BollingerBands struct#

rust · ignore
pub struct BollingerBands { pub upper: Vec<Option<f64>>, pub middle: Vec<Option<f64>>, pub lower: Vec<Option<f64>> }

BollingerBandsData struct#

rust · ignore
pub struct BollingerBandsData { pub upper: Option<f64>, pub middle: Option<f64>, pub lower: Option<f64> }

BullBearPowerData struct#

rust · ignore
pub struct BullBearPowerData { pub bull_power: Option<f64>, pub bear_power: Option<f64> }

CalendarDetail enum#

rust · ignore
pub enum CalendarDetail { Earnings { eps: Option<f64>, eps_estimated: Option<f64>, revenue: Option<f64>, revenue_estimated: Option<f64>, fiscal_date_ending: Option<String>, time: Option<String>, company: Option<String>, estimate_count: Option<u32>, surprise_percent: Option<f64>, previous_eps: Option<f64>, previous_report_date: Option<String>, market_cap: Option<f64>, }, Ipo { company: Option<String>, exchange: Option<String>, actions: Option<String>, shares: Option<f64>, price_range: Option<String>, market_cap: Option<f64>, }, Dividend { dividend: Option<f64>, adj_dividend: Option<f64>, record_date: Option<String>, payment_date: Option<String>, declaration_date: Option<String>, }, Split { numerator: Option<f64>, denominator: Option<f64>, }, MarketHoliday { name: Option<String>, exchange: Option<String>, status: Option<String>, open: Option<String>, close: Option<String>, }, Economic { event: Option<String>, country: Option<String>, actual: Option<f64>, previous: Option<f64>, estimate: Option<f64>, change: Option<f64>, change_percentage: Option<f64>, impact: Option<String>, } }

CalendarEvent struct#

rust · ignore
pub struct CalendarEvent { pub timestamp: i64, pub date: String, pub symbol: Option<String>, pub event: EventKind }

CalendarKind enum#

rust · ignore
pub enum CalendarKind { Earnings, Ipo, Dividend, Split, Economic, MarketHoliday, MarketStatus }

Candle struct#

rust · ignore
pub struct Candle { pub timestamp: i64, pub open: f64, pub high: f64, pub low: f64, pub close: f64, pub volume: i64, pub adj_close: Option<f64>, pub provider_id: Option<Provider> }

CandlePattern enum#

rust · ignore
pub enum CandlePattern { MorningStar, EveningStar, ThreeWhiteSoldiers, ThreeBlackCrows, BullishEngulfing, BearishEngulfing, BullishHarami, BearishHarami, PiercingLine, DarkCloudCover, TweezerTop, TweezerBottom, Doji, SpinningTop, BullishMarubozu, BearishMarubozu, Hammer, InvertedHammer, HangingMan, ShootingStar }

Capability struct#

rust · ignore
pub struct Capability(u32)
measured as `finance_query::dispatch_select`
instructions/iter68
callgrind Ir/iter68
median walltime (ns)3
p99 walltime (ns)4
allocations/iter0
allocated bytes/iter0

CapitalGain struct#

rust · ignore
pub struct CapitalGain { pub timestamp: i64, pub amount: f64, pub provider_id: Option<Provider> }

Chart struct#

rust · ignore
pub struct Chart { pub symbol: String, pub meta: ChartMeta, pub candles: Vec<Candle>, pub interval: Option<Interval>, pub range: Option<TimeRange>, pub provider_id: Option<Provider> }
measured as `finance_query::de_chart`
instructions/iter107185
callgrind Ir/iter107185
median walltime (ns)8807
p99 walltime (ns)9303
allocations/iter13
allocated bytes/iter4369

ChartEvents struct#

rust · ignore
pub struct ChartEvents {  }

ChartMeta struct#

rust · ignore
pub struct ChartMeta { pub symbol: String, pub currency: Option<String>, pub exchange_name: Option<String>, pub full_exchange_name: Option<String>, pub instrument_type: Option<String>, pub first_trade_date: Option<i64>, pub regular_market_time: Option<i64>, pub has_pre_post_market_data: Option<bool>, pub gmt_offset: Option<i64>, pub timezone: Option<String>, pub exchange_timezone_name: Option<String>, pub regular_market_price: Option<f64>, pub fifty_two_week_high: Option<f64>, pub fifty_two_week_low: Option<f64>, pub regular_market_day_high: Option<f64>, pub regular_market_day_low: Option<f64>, pub regular_market_volume: Option<i64>, pub chart_previous_close: Option<f64>, pub previous_close: Option<f64>, pub price_hint: Option<i32>, pub data_granularity: Option<String>, pub range: Option<String>, pub provider_id: Option<Provider> }

CikEntry struct#

rust · ignore
pub struct CikEntry { pub cik: u64, pub ticker: String, pub title: String }

ClientHandle struct#

rust · ignore
pub struct ClientHandle(pub(crate) Arc<YahooClient>)

CommitmentsOfTraders struct#

rust · ignore
pub struct CommitmentsOfTraders { pub symbol: String, pub market_and_exchange_name: String, pub cftc_contract_market_code: String, pub observations: Vec<CotObservation> }

Commodity struct#

rust · ignore
domain_handle! { pub struct Commodity { symbol, symbol } cache: crate::models::commodities::CommodityQuote }

CommodityQuote struct#

rust · ignore
pub struct CommodityQuote { pub symbol: String, pub name: Option<String>, pub unit: Option<String>, pub price: Option<f64>, pub change: Option<f64>, pub change_percent: Option<f64>, pub timestamp: Option<i64> }

CompanyFacts struct#

rust · ignore
pub struct CompanyFacts { pub cik: Option<u64>, pub entity_name: Option<String>, pub facts: HashMap<String, FactsByTaxonomy> }
measured as `finance_query::de_edgar_facts`
instructions/iter13780743
callgrind Ir/iter13780743
median walltime (ns)1275998
p99 walltime (ns)1598066
allocations/iter11899
allocated bytes/iter1356382

CompanyProfile struct#

rust · ignore
pub struct CompanyProfile { pub symbol: Option<String>, pub name: Option<String>, pub description: Option<String>, pub asset_type: Option<String>, pub exchange: Option<String>, pub currency: Option<String>, pub country: Option<String>, pub sector: Option<String>, pub industry: Option<String>, pub market_capitalization: Option<f64>, pub isin: Option<String>, pub cusip: Option<String>, pub active: Option<bool>, pub is_etf: Option<bool>, pub is_adr: Option<bool>, pub is_fund: Option<bool>, pub cik: Option<String>, pub ipo_date: Option<String>, pub provider_id: Option<crate::Provider> }

ConditionValue enum#

rust · ignore
pub enum ConditionValue { Number(f64), Between(f64, f64), StringEq(String) }

CongressionalTrade struct#

rust · ignore
pub struct CongressionalTrade { pub symbol: Option<String>, pub first_name: Option<String>, pub last_name: Option<String>, pub office: Option<String>, pub district: Option<String>, pub trade_type: Option<String>, pub amount: Option<String>, pub asset_description: Option<String>, pub transaction_date: Option<String>, pub disclosure_date: Option<String>, pub link: Option<String> }

Contracts struct#

rust · ignore
pub struct Contracts(pub Vec<OptionContract>)

CotObservation struct#

rust · ignore
pub struct CotObservation { pub report_date: String, pub open_interest: Option<i64>, pub producer_merchant_long: Option<i64>, pub producer_merchant_short: Option<i64>, pub swap_dealer_long: Option<i64>, pub swap_dealer_short: Option<i64>, pub swap_dealer_spread: Option<i64>, pub managed_money_long: Option<i64>, pub managed_money_short: Option<i64>, pub managed_money_spread: Option<i64>, pub other_reportable_long: Option<i64>, pub other_reportable_short: Option<i64>, pub other_reportable_spread: Option<i64>, pub total_reportable_long: Option<i64>, pub total_reportable_short: Option<i64>, pub nonreportable_long: Option<i64>, pub nonreportable_short: Option<i64> }

CryptoCoin struct#

rust · ignore
domain_handle! { pub struct CryptoCoin { id, id } cache: crate::models::crypto::CryptoQuote }

CryptoProvider trait#

rust · ignore
pub trait CryptoProvider: ProviderCore

CryptoQuote struct#

rust · ignore
pub struct CryptoQuote { pub id: String, pub symbol: String, pub name: String, pub price: Option<f64>, pub market_cap: Option<f64>, pub volume_24h: Option<f64>, pub change_24h: Option<f64>, pub change_percent_24h: Option<f64>, pub high_24h: Option<f64>, pub low_24h: Option<f64>, pub circulating_supply: Option<f64> }

Currency struct#

rust · ignore
pub struct Currency { pub short_name: Option<String>, pub long_name: Option<String>, pub symbol: Option<String>, pub local_long_name: Option<String> }
measured as `finance_query::de_currencies`
instructions/iter591466
callgrind Ir/iter591466
median walltime (ns)51811
p99 walltime (ns)56609
allocations/iter647
allocated bytes/iter54672
measured as `finance_query::ser_currencies`
instructions/iter202363
callgrind Ir/iter202363
median walltime (ns)16160
p99 walltime (ns)16359
allocations/iter8
allocated bytes/iter32640

CustomId struct#

rust · ignore
pub struct CustomId(u16)

Discovery struct#

rust · ignore
domain_handle! { pub struct Discovery caches: { cache: Vec<SymbolMatch>, details_cache: SymbolDetails, } }

Dividend struct#

rust · ignore
pub struct Dividend { pub timestamp: i64, pub amount: f64, pub provider_id: Option<Provider> }

DividendAnalytics struct#

rust · ignore
pub struct DividendAnalytics { pub total_paid: f64, pub payment_count: usize, pub average_payment: f64, pub cagr: Option<f64>, pub last_payment: Option<Dividend>, pub first_payment: Option<Dividend> }

DonchianChannelsData struct#

rust · ignore
pub struct DonchianChannelsData { pub upper: Option<f64>, pub middle: Option<f64>, pub lower: Option<f64> }

EarningsCalendarEntry struct#

rust · ignore
pub struct EarningsCalendarEntry { pub symbol: String, pub name: Option<String>, pub report_date: Option<String>, pub fiscal_date_ending: Option<String>, pub estimate: Option<f64>, pub currency: Option<String> }

EarningsSurprise struct#

rust · ignore
pub struct EarningsSurprise { pub symbol: Option<String>, pub date: Option<String>, pub actual_eps: Option<f64>, pub estimated_eps: Option<f64>, pub surprise: Option<f64>, pub surprise_percent: Option<f64> }

EarningsTranscript struct#

rust · ignore
pub struct EarningsTranscript { pub symbol: Option<String>, pub quarter: Option<String>, pub year: Option<i32>, pub date: Option<String>, pub text: String }

EconomicCatalog struct#

rust · ignore
pub struct EconomicCatalog {  }

EconomicCategory struct#

rust · ignore
pub struct EconomicCategory { pub id: i64, pub name: Option<String>, pub parent_id: Option<i64> }

EconomicIndicator struct#

rust · ignore
domain_handle! { pub struct EconomicIndicator { series_id, series_id } cache: crate::models::economic::EconomicSeries }

EconomicProvider trait#

rust · ignore
pub trait EconomicProvider: ProviderCore

EconomicRelease struct#

rust · ignore
pub struct EconomicRelease { pub id: i64, pub name: Option<String>, pub press_release: Option<bool>, pub link: Option<String> }

EconomicSeries struct#

rust · ignore
pub struct EconomicSeries { pub series_id: String, pub title: Option<String>, pub units: Option<String>, pub frequency: Option<String>, pub observations: Vec<MacroObservation> }

EconomicSeriesMatch struct#

rust · ignore
pub struct EconomicSeriesMatch { pub id: String, pub title: Option<String>, pub frequency: Option<String>, pub units: Option<String>, pub seasonal_adjustment: Option<String>, pub observation_start: Option<String>, pub observation_end: Option<String>, pub popularity: Option<i64>, pub notes: Option<String> }

EdgarFiling struct#

rust · ignore
pub struct EdgarFiling { pub accession_number: String, pub filing_date: String, pub report_date: String, pub acceptance_date_time: String, pub form: String, pub size: u64, pub is_xbrl: bool, pub is_inline_xbrl: bool, pub primary_document: String, pub primary_doc_description: String }

EdgarFilingFile struct#

rust · ignore
pub struct EdgarFilingFile { pub name: Option<String>, pub filing_count: Option<u32>, pub filing_from: Option<String>, pub filing_to: Option<String> }

EdgarFilingIndex struct#

rust · ignore
pub struct EdgarFilingIndex { pub directory: EdgarFilingIndexDirectory }

EdgarFilingIndexItem struct#

rust · ignore
pub struct EdgarFilingIndexItem { pub name: String, pub item_type: String, pub size: Option<u64> }

EdgarFilingRecent struct#

rust · ignore
pub struct EdgarFilingRecent { pub accession_number: Vec<String>, pub filing_date: Vec<String>, pub report_date: Vec<String>, pub acceptance_date_time: Vec<String>, pub form: Vec<String>, pub size: Vec<u64>, pub is_xbrl: Vec<u8>, pub is_inline_xbrl: Vec<u8>, pub primary_document: Vec<String>, pub primary_doc_description: Vec<String> }

EdgarFilings struct#

rust · ignore
pub struct EdgarFilings { pub recent: Option<EdgarFilingRecent>, pub files: Vec<EdgarFilingFile> }

EdgarSearchHit struct#

rust · ignore
pub struct EdgarSearchHit { pub _index: Option<String>, pub _id: Option<String>, pub _score: Option<f64>, pub _source: Option<EdgarSearchSource> }

EdgarSearchHitsContainer struct#

rust · ignore
pub struct EdgarSearchHitsContainer { pub total: Option<EdgarSearchTotal>, pub max_score: Option<f64>, pub hits: Vec<EdgarSearchHit> }

EdgarSearchResults struct#

rust · ignore
pub struct EdgarSearchResults { pub query: Option<serde_json::Value>, pub hits: Option<EdgarSearchHitsContainer> }

EdgarSearchSource struct#

rust · ignore
pub struct EdgarSearchSource { pub ciks: Vec<String>, pub file_date: Option<String>, pub form: Option<String>, pub adsh: Option<String>, pub display_names: Vec<String>, pub period_ending: Option<String>, pub root_forms: Vec<String>, pub sics: Vec<String> }

EdgarSearchTotal struct#

rust · ignore
pub struct EdgarSearchTotal { pub value: Option<u64>, pub relation: Option<String> }

EdgarSubmissions struct#

rust · ignore
pub struct EdgarSubmissions { pub cik: Option<String>, pub name: Option<String>, pub entity_type: Option<String>, pub sic: Option<String>, pub sic_description: Option<String>, pub tickers: Vec<String>, pub exchanges: Vec<String>, pub state_of_incorporation: Option<String>, pub fiscal_year_end: Option<String>, pub ein: Option<String>, pub website: Option<String>, pub category: Option<String>, pub insider_transaction_for_owner_exists: Option<u8>, pub insider_transaction_for_issuer_exists: Option<u8>, pub filings: Option<EdgarFilings> }
measured as `finance_query::de_edgar_submissions`
instructions/iter5230527
callgrind Ir/iter5230527
median walltime (ns)447979
p99 walltime (ns)455318
allocations/iter6784
allocated bytes/iter465397

ElderRayData struct#

rust · ignore
pub struct ElderRayData { pub bull_power: Option<f64>, pub bear_power: Option<f64> }

EmployeeCount struct#

rust · ignore
pub struct EmployeeCount { pub symbol: Option<String>, pub cik: Option<String>, pub company_name: Option<String>, pub employee_count: Option<i64>, pub period_of_report: Option<String>, pub form_type: Option<String>, pub filing_date: Option<String>, pub source: Option<String> }

EquityField enum#

rust · ignore
pub enum EquityField { Ticker, CompanyShortName, EodPrice, IntradayPrice, IntradayPriceChange, PercentChange, Lastclose52WkHigh, FiftyTwoWkPctChange, Lastclose52WkLow, IntradayMarketCap, LastcloseMarketCap, Region, Sector, PeerGroup, Industry, Exchange, Beta, AvgDailyVol3M, PctHeldInsider, PctHeldInst, DayVolume, EodVolume, ShortPctSharesOut, ShortInterest, ShortPctFloat, DaysToCover, ShortInterestPctChange, BookValueShare, MarketCapToRevenue, TevToRevenue, PriceBookRatio, PeRatio, PriceTangibleBook, PriceEarnings, PegRatio5Y, ConsecutiveDivYears, Roa, Roe, ForwardDivPerShare, ForwardDivYield, ReturnOnCapital, TevEbit, NetDebtEbitda, TotalDebtEquity, LtDebtEquity, EbitInterestExp, EbitdaInterestExp, TevEbitda, TotalDebtEbitda, QuickRatio, AltmanZScore, CurrentRatio, OcfToCurrentLiab, TotalRevenues, NetIncomeMargin, GrossProfit, Ebitda1YrGrowth, DilutedEpsContOps, QuarterlyRevGrowth, EpsGrowth, NetIncome, Ebitda, DilutedEps1YrGrowth, Revenue1YrGrowth, OperatingIncome, NetIncome1YrGrowth, GrossProfitMargin, EbitdaMargin, Ebit, BasicEpsContOps, NetEpsBasic, NetEpsDiluted, TotalAssets, CommonSharesOut, TotalDebt, TotalEquity, TotalCurrentAssets, CashAndStInvestments, TotalCommonEquity, TotalCurrentLiab, TotalSharesOut, LeveredFcf, Capex, CashFromOps, LeveredFcf1YrGrowth, UnleveredFcf, CashFromOps1YrGrowth, EsgScore, EnvironmentalScore, GovernanceScore, SocialScore, HighestControversy }

EquityScreenerQuery type_alias#

rust · ignore
pub type EquityScreenerQuery = ScreenerQuery<EquityField>

ErrorCategory enum#

rust · ignore
pub enum ErrorCategory { Auth, RateLimit, Timeout, Server, NotFound, Validation, Parsing, Other }

EtfCountryWeighting struct#

rust · ignore
pub struct EtfCountryWeighting { pub country: Option<String>, pub weight: Option<f64> }

EtfHolding struct#

rust · ignore
pub struct EtfHolding { pub symbol: Option<String>, pub description: Option<String>, pub weight: Option<f64> }

EtfProfile struct#

rust · ignore
pub struct EtfProfile { pub symbol: Option<String>, pub name: Option<String>, pub asset_type: Option<String>, pub net_assets: Option<f64>, pub net_expense_ratio: Option<f64>, pub portfolio_turnover: Option<f64>, pub dividend_yield: Option<f64>, pub inception_date: Option<String>, pub holdings: Vec<EtfHolding>, pub sector_weightings: Vec<EtfSectorWeighting>, pub country_weightings: Vec<EtfCountryWeighting> }

EtfSectorWeighting struct#

rust · ignore
pub struct EtfSectorWeighting { pub sector: Option<String>, pub weight: Option<f64> }

EventKind enum#

rust · ignore
pub enum EventKind { Earnings { eps_estimate_low: Option<f64>, eps_estimate_avg: Option<f64>, eps_estimate_high: Option<f64>, revenue_estimate_avg: Option<i64>, is_estimate: bool, }, ExDividend { amount: Option<f64>, }, DividendPayment { amount: Option<f64>, }, OptionsExpiration { contract_count: Option<usize>, }, EconomicRelease { name: String, series_id: String, } }

Exchange struct#

rust · ignore
pub struct Exchange { pub country: String, pub market: String, pub suffix: String, pub delay: String, pub data_provider: String }

ExchangeCode enum#

rust · ignore
pub enum ExchangeCode { Ase, Bts, Ncm, Ngm, Nms, Nyq, Pcx, Pnk, Nas, Asx, Bse, Hkg, Krx, Lse, Nsi, Shh, Shz, Tyo, Tor, Ger }

ExchangeInfo struct#

rust · ignore
pub struct ExchangeInfo { pub id: Option<i64>, pub name: Option<String>, pub mic: Option<String>, pub operating_mic: Option<String>, pub asset_class: Option<String>, pub locale: Option<String>, pub exchange_type: Option<String>, pub url: Option<String> }

ExecutiveCompensation struct#

rust · ignore
pub struct ExecutiveCompensation { pub symbol: Option<String>, pub cik: Option<String>, pub company_name: Option<String>, pub name_and_position: Option<String>, pub year: Option<i32>, pub salary: Option<f64>, pub bonus: Option<f64>, pub stock_award: Option<f64>, pub option_award: Option<f64>, pub incentive_plan_compensation: Option<f64>, pub other_compensation: Option<f64>, pub total: Option<f64>, pub filing_date: Option<String>, pub url: Option<String> }

FactConcept struct#

rust · ignore
pub struct FactConcept { pub label: Option<String>, pub description: Option<String>, pub units: HashMap<String, Vec<FactUnit>> }

FactUnit struct#

rust · ignore
pub struct FactUnit { pub start: Option<String>, pub end: Option<String>, pub val: Option<f64>, pub accn: Option<String>, pub fy: Option<i32>, pub fp: Option<String>, pub form: Option<String>, pub filed: Option<String>, pub frame: Option<String> }

FactsByTaxonomy struct#

rust · ignore
pub struct FactsByTaxonomy(pub HashMap<String, FactConcept>)

FailToDeliver struct#

rust · ignore
pub struct FailToDeliver { pub symbol: Option<String>, pub date: Option<String>, pub quantity: Option<f64>, pub price: Option<f64>, pub name: Option<String>, pub description: Option<String> }

FearAndGreed struct#

rust · ignore
pub struct FearAndGreed { pub value: u8, pub classification: FearGreedLabel, pub timestamp: i64 }
measured as `finance_query::de_fear_and_greed`
instructions/iter1390
callgrind Ir/iter1390
median walltime (ns)106
p99 walltime (ns)110
allocations/iter0
allocated bytes/iter0
measured as `finance_query::de_fear_and_greed_crypto_history`
instructions/iter15314
callgrind Ir/iter15314
median walltime (ns)1265
p99 walltime (ns)1290
allocations/iter3
allocated bytes/iter448

FearGreedLabel enum#

rust · ignore
pub enum FearGreedLabel { ExtremeFear, Fear, Neutral, Greed, ExtremeGreed }

Fetch enum#

rust · ignore
pub enum Fetch { Sequential, Parallel }

FilingSearchFilters struct#

rust · ignore
pub struct FilingSearchFilters { pub forms: Option<Vec<String>>, pub start_date: Option<String>, pub end_date: Option<String>, pub cik: Option<String>, pub limit: Option<u32> }

FilingSearchHit struct#

rust · ignore
pub struct FilingSearchHit { pub accession_number: Option<String>, pub form: Option<String>, pub filed_date: Option<String>, pub period_ending: Option<String>, pub company_names: Vec<String>, pub ciks: Vec<String>, pub score: Option<f64>, pub url: Option<String> }

FilingSection struct#

rust · ignore
pub struct FilingSection { pub section: Option<String>, pub content: Option<String> }

FilingSectionForm enum#

rust · ignore
pub enum FilingSectionForm { TenK, EightK }

Filings struct#

rust · ignore
domain_handle! { pub struct Filings { symbol, symbol } cache: crate::models::filings::ProviderFilings }

FinanceError enum#

rust · ignore
pub enum FinanceError { AuthenticationFailed { context: String, }, NotEntitled { context: String, }, ProviderNotConfigured { provider: String, env_var: String, }, SymbolNotFound { symbol: Option<String>, context: String, }, RateLimited { retry_after: Option<u64>, }, #[error("HTTP request failed: {0}")] HttpError(#[from] reqwest::Error), #[error("Network request to {api} failed")] NetworkError { api: String, }, #[error("JSON parse error: {0}")] JsonParseError(#[from] serde_json::Error), #[error("Response structure error in '{field}': {context}")] ResponseStructureError { field: String, context: String, }, #[error("Invalid parameter '{param}': {reason}")] InvalidParameter { param: String, reason: String, }, #[error("Request timeout after {timeout_ms}ms")] Timeout { timeout_ms: u64, }, #[error("Server error {status}: {context}")] ServerError { status: u16, context: String, }, #[error("Unexpected response: {0}")] UnexpectedResponse(String), #[error("Internal error: {0}")] InternalError(String), #[error("API error: {0}")] ApiError(String), #[error("Runtime error: {0}")] RuntimeError(#[from] std::io::Error), #[cfg(feature = "indicators")] #[error("Indicator calculation error: {0}")] IndicatorError(#[from] crate::indicators::IndicatorError), #[error("External API error from '{api}': HTTP {status}")] ExternalApiError { api: String, status: u16, }, #[error("Macro data error from '{provider}': {context}")] MacroDataError { provider: String, context: String, }, #[error("Feed parse error for '{url}': {context}")] FeedParseError { url: String, context: String, }, #[error( "{provider} does not support {operation} (supported by: {}; route it via Providers::builder().route(...))", join_providers(candidates) )] NotSupported { provider: Provider, operation: Operation, candidates: Vec<Provider>, }, #[error( "no provider available for {operation} (supported by: {}; route it via Providers::builder().route(...))", join_providers(candidates) )] NoProviderAvailable { operation: Capability, candidates: Vec<Provider>, }, #[error( "no adapter registered for {provider}; register it with \ ProvidersBuilder::with_adapter(..) before routing to it" )] ProviderNotRegistered { provider: Provider, }, #[cfg(feature = "translation")] #[error("Translation error: {context}")] TranslationError { context: String, }, }

FinancialRatiosTtm struct#

rust · ignore
pub struct FinancialRatiosTtm { pub symbol: Option<String>, pub gross_profit_margin: Option<f64>, pub ebit_margin: Option<f64>, pub ebitda_margin: Option<f64>, pub operating_profit_margin: Option<f64>, pub pretax_profit_margin: Option<f64>, pub continuous_operations_profit_margin: Option<f64>, pub net_profit_margin: Option<f64>, pub bottom_line_profit_margin: Option<f64>, pub receivables_turnover: Option<f64>, pub payables_turnover: Option<f64>, pub inventory_turnover: Option<f64>, pub fixed_asset_turnover: Option<f64>, pub asset_turnover: Option<f64>, pub current_ratio: Option<f64>, pub quick_ratio: Option<f64>, pub solvency_ratio: Option<f64>, pub cash_ratio: Option<f64>, pub price_earnings_ratio: Option<f64>, pub peg_ratio: Option<f64>, pub forward_peg_ratio: Option<f64>, pub price_to_earnings_diluted_ratio: Option<f64>, pub price_to_earnings_diluted_growth_ratio: Option<f64>, pub price_to_book_ratio: Option<f64>, pub price_to_sales_ratio: Option<f64>, pub price_to_free_cash_flows_ratio: Option<f64>, pub price_to_operating_cash_flow_ratio: Option<f64>, pub debt_ratio: Option<f64>, pub debt_equity_ratio: Option<f64>, pub debt_to_capital_ratio: Option<f64>, pub long_term_debt_to_capital_ratio: Option<f64>, pub financial_leverage_ratio: Option<f64>, pub working_capital_turnover_ratio: Option<f64>, pub operating_cash_flow_ratio: Option<f64>, pub operating_cash_flow_sales_ratio: Option<f64>, pub free_cash_flow_operating_cash_flow_ratio: Option<f64>, pub debt_service_coverage_ratio: Option<f64>, pub interest_coverage: Option<f64>, pub short_term_operating_cash_flow_coverage_ratio: Option<f64>, pub operating_cash_flow_coverage_ratio: Option<f64>, pub capital_expenditure_coverage_ratio: Option<f64>, pub dividend_paid_and_capex_coverage_ratio: Option<f64>, pub payout_ratio: Option<f64>, pub dividend_yield: Option<f64>, pub dividend_per_share: Option<f64>, pub enterprise_value: Option<f64>, pub enterprise_value_multiple: Option<f64>, pub revenue_per_share: Option<f64>, pub net_income_per_share: Option<f64>, pub interest_debt_per_share: Option<f64>, pub cash_per_share: Option<f64>, pub book_value_per_share: Option<f64>, pub tangible_book_value_per_share: Option<f64>, pub shareholders_equity_per_share: Option<f64>, pub operating_cash_flow_per_share: Option<f64>, pub capex_per_share: Option<f64>, pub free_cash_flow_per_share: Option<f64>, pub net_income_per_ebt: Option<f64>, pub ebt_per_ebit: Option<f64>, pub price_to_fair_value: Option<f64>, pub debt_to_market_cap: Option<f64>, pub effective_tax_rate: Option<f64> }

FinancialStatement struct#

rust · ignore
pub struct FinancialStatement { pub symbol: String, pub statement_type: String, pub frequency: String, pub statement: HashMap<String, HashMap<String, f64>>, pub provider_id: Option<crate::providers::Provider> }
measured as `finance_query::de_financials`
instructions/iter235575
callgrind Ir/iter235575
median walltime (ns)20415
p99 walltime (ns)20630
allocations/iter206
allocated bytes/iter22532

ForexPair struct#

rust · ignore
domain_handle! { pub struct ForexPair { from, from, to, to, } cache: crate::models::forex::ForexQuote }

ForexProvider trait#

rust · ignore
pub trait ForexProvider: ProviderCore

ForexQuote struct#

rust · ignore
pub struct ForexQuote { pub symbol: String, pub base_currency: Option<String>, pub quote_currency: Option<String>, pub bid: Option<f64>, pub ask: Option<f64>, pub price: Option<f64>, pub change: Option<f64>, pub change_percent: Option<f64>, pub timestamp: Option<i64> }

FormattedValue struct#

rust · ignore
pub struct FormattedValue<T> { pub fmt: Option<String>, pub long_fmt: Option<String>, pub raw: Option<T> }

Frequency enum#

rust · ignore
pub enum Frequency { Annual, Quarterly }

FundField enum#

rust · ignore
pub enum FundField { Ticker, CompanyShortName, EodPrice, IntradayPriceChange, IntradayPrice, CategoryName, PerformanceRating, InitialInvestment, AnnualReturnRank, RiskRating, Exchange }

FundScreenerQuery type_alias#

rust · ignore
pub type FundScreenerQuery = ScreenerQuery<FundField>

FuturesContract struct#

rust · ignore
domain_handle! { pub struct FuturesContract { symbol, symbol } cache: crate::models::futures::FuturesQuote }

FuturesQuote struct#

rust · ignore
pub struct FuturesQuote { pub symbol: String, pub name: Option<String>, pub underlying: Option<String>, pub exchange: Option<String>, pub expiration_date: Option<String>, pub price: Option<f64>, pub change: Option<f64>, pub change_percent: Option<f64>, pub open_interest: Option<u64>, pub volume: Option<u64>, pub timestamp: Option<i64> }

GradingAction struct#

rust · ignore
pub struct GradingAction { pub symbol: Option<String>, pub date: Option<String>, pub grading_company: Option<String>, pub previous_grade: Option<String>, pub new_grade: Option<String> }

IchimokuData struct#

rust · ignore
pub struct IchimokuData { pub conversion_line: Option<f64>, pub base_line: Option<f64>, pub leading_span_a: Option<f64>, pub leading_span_b: Option<f64>, pub lagging_span: Option<f64> }

Index struct#

rust · ignore
domain_handle! { pub struct Index { symbol, symbol } cache: crate::models::indices::IndexQuote }

IndexConstituent struct#

rust · ignore
pub struct IndexConstituent { pub symbol: String, pub name: Option<String>, pub sector: Option<String>, pub sub_sector: Option<String>, pub headquarters: Option<String>, pub date_first_added: Option<String>, pub cik: Option<String>, pub founded: Option<String> }

IndexConstituentChange struct#

rust · ignore
pub struct IndexConstituentChange { pub date: Option<String>, pub symbol: Option<String>, pub added_security: Option<String>, pub removed_ticker: Option<String>, pub removed_security: Option<String>, pub reason: Option<String> }

IndexQuote struct#

rust · ignore
pub struct IndexQuote { pub symbol: String, pub name: Option<String>, pub price: Option<f64>, pub change: Option<f64>, pub change_percent: Option<f64>, pub timestamp: Option<i64> }

Indicator enum#

rust · ignore
pub enum Indicator { Sma(usize), Ema(usize), Rsi(usize), Macd { fast: usize, slow: usize, signal: usize, }, Bollinger { period: usize, std_dev: f64, }, Atr(usize), Obv, Vwap, Wma(usize), Dema(usize), Tema(usize), Hma(usize), Vwma(usize), Alma { period: usize, offset: f64, sigma: f64, }, McginleyDynamic(usize), Stochastic { k_period: usize, k_slow: usize, d_period: usize, }, StochasticRsi { rsi_period: usize, stoch_period: usize, k_period: usize, d_period: usize, }, Cci(usize), WilliamsR(usize), Roc(usize), Momentum(usize), Cmo(usize), AwesomeOscillator { fast: usize, slow: usize, }, CoppockCurve { wma_period: usize, long_roc: usize, short_roc: usize, }, Adx(usize), Aroon(usize), Supertrend { period: usize, multiplier: f64, }, Ichimoku { conversion: usize, base: usize, lagging: usize, displacement: usize, }, ParabolicSar { step: f64, max: f64, }, BullBearPower(usize), ElderRay(usize), KeltnerChannels { period: usize, multiplier: f64, atr_period: usize, }, DonchianChannels(usize), TrueRange, ChoppinessIndex(usize), Mfi(usize), Cmf(usize), ChaikinOscillator, AccumulationDistribution, BalanceOfPower(Option<usize>), PivotPointsStandard, PivotPointsFibonacci, HeikinAshi, ZigZag(f64), FibonacciRetracement(usize) }

IndicatorError enum#

rust · ignore
pub enum IndicatorError { InsufficientData { need: usize, got: usize, }, InvalidPeriod(String) }

IndicatorResult enum#

rust · ignore
pub enum IndicatorResult { Series(Vec<Option<f64>>), Macd(MacdResult), Bollinger(BollingerBands), Stochastic(StochasticResult), Aroon(AroonResult), SuperTrend(SuperTrendResult), Ichimoku(IchimokuResult), BullBearPower(BullBearPowerResult), ElderRay(ElderRayResult), Keltner(KeltnerChannelsResult), Donchian(DonchianChannelsResult), PivotPoints(Vec<Option<PivotPoints>>), HeikinAshi(Vec<crate::Candle>), ZigZag(Vec<ZigZagPoint>), FibonacciRetracement(Vec<Option<FibonacciLevels>>) }

IndicatorsSummary struct#

rust · ignore
pub struct IndicatorsSummary { pub sma_10: Option<f64>, pub sma_20: Option<f64>, pub sma_50: Option<f64>, pub sma_100: Option<f64>, pub sma_200: Option<f64>, pub ema_10: Option<f64>, pub ema_20: Option<f64>, pub ema_50: Option<f64>, pub ema_100: Option<f64>, pub ema_200: Option<f64>, pub wma_10: Option<f64>, pub wma_20: Option<f64>, pub wma_50: Option<f64>, pub wma_100: Option<f64>, pub wma_200: Option<f64>, pub dema_20: Option<f64>, pub tema_20: Option<f64>, pub hma_20: Option<f64>, pub vwma_20: Option<f64>, pub alma_9: Option<f64>, pub mcginley_dynamic_20: Option<f64>, pub rsi_14: Option<f64>, pub stochastic: Option<StochasticData>, pub cci_20: Option<f64>, pub williams_r_14: Option<f64>, pub stochastic_rsi: Option<StochasticData>, pub roc_12: Option<f64>, pub momentum_10: Option<f64>, pub cmo_14: Option<f64>, pub awesome_oscillator: Option<f64>, pub coppock_curve: Option<f64>, pub macd: Option<MacdData>, pub adx_14: Option<f64>, pub aroon: Option<AroonData>, pub supertrend: Option<SuperTrendData>, pub ichimoku: Option<IchimokuData>, pub parabolic_sar: Option<f64>, pub bull_bear_power: Option<BullBearPowerData>, pub elder_ray_index: Option<ElderRayData>, pub bollinger_bands: Option<BollingerBandsData>, pub atr_14: Option<f64>, pub keltner_channels: Option<KeltnerChannelsData>, pub donchian_channels: Option<DonchianChannelsData>, pub true_range: Option<f64>, pub choppiness_index_14: Option<f64>, pub obv: Option<f64>, pub mfi_14: Option<f64>, pub cmf_20: Option<f64>, pub chaikin_oscillator: Option<f64>, pub accumulation_distribution: Option<f64>, pub vwap: Option<f64>, pub balance_of_power: Option<f64>, pub pivot_points: Option<PivotPoints>, pub fibonacci_pivot_points: Option<PivotPoints>, pub heikin_ashi: Option<Candle>, pub zigzag_last_pivot: Option<ZigZagPoint>, pub fibonacci_retracement_50: Option<FibonacciLevels> }

IndicesRegion enum#

rust · ignore
pub enum Region { Americas, Europe, AsiaPacific, MiddleEastAfrica, Currencies }

Industry enum#

rust · ignore
pub enum Industry { AgriculturalInputs, Aluminum, Coal, Copper, FarmProducts, ForestProducts, Gold, LumberAndWoodProduction, OtherIndustrialMetalsAndMining, OtherPreciousMetalsAndMining, Silver, Steel, ThermalCoal, Uranium, ApparelManufacturing, ApparelRetail, AutoAndTruckDealerships, AutoManufacturers, AutoParts, BeveragesBrewers, BeveragesNonAlcoholic, BeveragesWineriesAndDistilleries, Confectioners, DepartmentStores, DiscountStores, ElectronicGamingAndMultimedia, FoodDistribution, FootwearAndAccessories, FurnishingsFixturesAndAppliances, Gambling, GroceryStores, HomeImprovementRetail, HouseholdAndPersonalProducts, InternetRetail, Leisure, Lodging, LuxuryGoods, PackagedFoods, PersonalServices, ResidentialConstruction, ResortsAndCasinos, Restaurants, SpecialtyRetail, TextileManufacturing, Tobacco, TravelServices, OilAndGasDrilling, OilAndGasEAndP, OilAndGasEquipmentAndServices, OilAndGasIntegrated, OilAndGasMidstream, OilAndGasRefiningAndMarketing, Solar, AssetManagement, BanksDiversified, BanksRegional, CapitalMarkets, CreditServices, FinancialDataAndStockExchanges, InsuranceBrokers, InsuranceDiversified, InsuranceLife, InsurancePropertyAndCasualty, InsuranceReinsurance, InsuranceSpecialty, MortgageFinance, ShellCompanies, Biotechnology, DiagnosticsAndResearch, DrugManufacturersGeneral, DrugManufacturersSpecialtyAndGeneric, HealthInformationServices, HealthcarePlans, MedicalCareFacilities, MedicalDevices, MedicalDistribution, MedicalInstrumentsAndSupplies, PharmaceuticalRetailers, AerospaceAndDefense, BuildingMaterials, BuildingProductsAndEquipment, BusinessEquipmentAndSupplies, ChemicalManufacturing, Chemicals, Conglomerates, ConsultingServices, ElectricalEquipmentAndParts, EngineeringAndConstruction, FarmAndHeavyConstructionMachinery, IndustrialDistribution, InfrastructureOperations, IntegratedFreightAndLogistics, ManufacturingDiversified, MarinePortsAndServices, MarineShipping, MetalFabrication, PaperAndPaperProducts, PollutionAndTreatmentControls, Railroads, RentalAndLeasingServices, SecurityAndProtectionServices, SpecialtyBusinessServices, SpecialtyChemicals, SpecialtyIndustrialMachinery, StaffingAndEmploymentServices, ToolsAndAccessories, Trucking, WasteManagement, RealEstateDevelopment, RealEstateDiversified, RealEstateServices, ReitDiversified, ReitHealthcareFacilities, ReitHotelAndMotel, ReitIndustrial, ReitMortgage, ReitOffice, ReitResidential, ReitRetail, ReitSpecialty, CommunicationEquipment, ComputerHardware, ConsumerElectronics, DataAnalytics, ElectronicComponents, ElectronicsAndComputerDistribution, HardwareAndSoftwareDistribution, InformationTechnologyServices, InternetContentAndInformation, ScientificAndTechnicalInstruments, SemiconductorEquipmentAndMaterials, Semiconductors, SoftwareApplication, SoftwareInfrastructure, Broadcasting, Entertainment, Publishing, TelecomServices, UtilitiesDiversified, UtilitiesIndependentPowerProducers, UtilitiesRegulatedElectric, UtilitiesRegulatedGas, UtilitiesRegulatedWater, UtilitiesRenewable, ClosedEndFundDebt, ClosedEndFundEquity, ClosedEndFundForeign, ExchangeTradedFund }

IndustryData struct#

rust · ignore
pub struct IndustryData { pub name: String, pub key: String, pub symbol: Option<String>, pub sector_name: Option<String>, pub sector_key: Option<String>, pub overview: Option<IndustryOverview>, pub performance: Option<IndustryPerformance>, pub benchmark: Option<BenchmarkPerformance>, pub top_companies: Vec<IndustryCompany>, pub top_performing_companies: Vec<PerformingCompany>, pub top_growth_companies: Vec<GrowthCompany>, pub research_reports: Vec<ResearchReport> }

IndustryPe struct#

rust · ignore
pub struct IndustryPe { pub industry: String, pub exchange: Option<String>, pub pe: Option<f64>, pub date: Option<String> }

InsiderTrade struct#

rust · ignore
pub struct InsiderTrade { pub symbol: Option<String>, pub issuer_name: Option<String>, pub insider_name: Option<String>, pub insider_cik: Option<String>, pub is_director: bool, pub is_officer: bool, pub is_ten_percent_owner: bool, pub officer_title: Option<String>, pub form_type: Option<String>, pub accession_number: Option<String>, pub url: Option<String>, pub security_title: Option<String>, pub transaction_date: Option<String>, pub transaction_code: Option<String>, pub acquired_disposed: Option<String>, pub shares: Option<f64>, pub price_per_share: Option<f64>, pub shares_owned_after: Option<f64>, pub is_derivative: bool }

InsiderTransaction struct#

rust · ignore
pub struct InsiderTransaction { pub symbol: Option<String>, pub filing_date: Option<String>, pub transaction_date: Option<String>, pub reporting_name: Option<String>, pub transaction_type: Option<String>, pub securities_transacted: Option<f64>, pub price: Option<f64>, pub securities_owned: Option<f64>, pub type_of_owner: Option<String>, pub link: Option<String> }

InstitutionalHolding struct#

rust · ignore
pub struct InstitutionalHolding { pub issuer_name: Option<String>, pub title_of_class: Option<String>, pub cusip: Option<String>, pub value: Option<f64>, pub shares: Option<f64>, pub share_type: Option<String>, pub put_call: Option<String>, pub investment_discretion: Option<String>, pub voting_sole: Option<f64>, pub voting_shared: Option<f64>, pub voting_none: Option<f64>, pub accession_number: Option<String>, pub report_date: Option<String> }

Interval enum#

rust · ignore
pub enum Interval { OneMinute, TwoMinutes, FiveMinutes, FifteenMinutes, ThirtyMinutes, OneHour, NinetyMinutes, OneDay, FiveDays, OneWeek, OneMonth, ThreeMonths }

IpoCalendarEntry struct#

rust · ignore
pub struct IpoCalendarEntry { pub symbol: Option<String>, pub name: Option<String>, pub ipo_date: Option<String>, pub price_range: Option<String>, pub exchange: Option<String> }

KeltnerChannelsData struct#

rust · ignore
pub struct KeltnerChannelsData { pub upper: Option<f64>, pub middle: Option<f64>, pub lower: Option<f64> }

KeyMetricsTtm struct#

rust · ignore
pub struct KeyMetricsTtm { pub symbol: Option<String>, pub market_cap: Option<f64>, pub enterprise_value: Option<f64>, pub ev_to_sales: Option<f64>, pub ev_to_operating_cash_flow: Option<f64>, pub ev_to_free_cash_flow: Option<f64>, pub ev_to_ebitda: Option<f64>, pub net_debt_to_ebitda: Option<f64>, pub current_ratio: Option<f64>, pub income_quality: Option<f64>, pub graham_number: Option<f64>, pub graham_net_net: Option<f64>, pub tax_burden: Option<f64>, pub interest_burden: Option<f64>, pub working_capital: Option<f64>, pub invested_capital: Option<f64>, pub return_on_assets: Option<f64>, pub operating_return_on_assets: Option<f64>, pub return_on_tangible_assets: Option<f64>, pub return_on_equity: Option<f64>, pub return_on_invested_capital: Option<f64>, pub return_on_capital_employed: Option<f64>, pub earnings_yield: Option<f64>, pub free_cash_flow_yield: Option<f64>, pub capex_to_operating_cash_flow: Option<f64>, pub capex_to_depreciation: Option<f64>, pub capex_to_revenue: Option<f64>, pub sales_general_and_administrative_to_revenue: Option<f64>, pub research_and_development_to_revenue: Option<f64>, pub stock_based_compensation_to_revenue: Option<f64>, pub intangibles_to_total_assets: Option<f64>, pub average_receivables: Option<f64>, pub average_payables: Option<f64>, pub average_inventory: Option<f64>, pub days_of_sales_outstanding: Option<f64>, pub days_of_payables_outstanding: Option<f64>, pub days_of_inventory_outstanding: Option<f64>, pub operating_cycle: Option<f64>, pub cash_conversion_cycle: Option<f64>, pub free_cash_flow_to_equity: Option<f64>, pub free_cash_flow_to_firm: Option<f64>, pub tangible_asset_value: Option<f64>, pub net_current_asset_value: Option<f64> }

LogicalOperator enum#

rust · ignore
pub enum LogicalOperator { And, Or }

LookupOptions struct#

rust · ignore
pub struct LookupOptions { pub lookup_type: LookupType, pub count: u32, pub include_logo: bool, pub fetch_pricing_data: bool, pub region: Option<Region> }

LookupQuote struct#

rust · ignore
pub struct LookupQuote { pub symbol: String, pub short_name: Option<String>, pub long_name: Option<String>, pub quote_type: Option<String>, pub exchange: Option<String>, pub exch_disp: Option<String>, pub type_disp: Option<String>, pub industry: Option<String>, pub sector: Option<String>, pub regular_market_price: Option<f64>, pub regular_market_change: Option<f64>, pub regular_market_change_percent: Option<f64>, pub regular_market_previous_close: Option<f64>, pub logo_url: Option<String>, pub company_logo_url: Option<String> }

LookupResults struct#

rust · ignore
pub struct LookupResults { pub quotes: Vec<LookupQuote>, pub start: Option<i32>, pub count: Option<i32> }

LookupType enum#

rust · ignore
pub enum LookupType { All, Equity, MutualFund, Etf, Index, Future, Currency, Cryptocurrency }

MacdData struct#

rust · ignore
pub struct MacdData { pub macd: Option<f64>, pub signal: Option<f64>, pub histogram: Option<f64> }

MacdResult struct#

rust · ignore
pub struct MacdResult { pub macd_line: Vec<Option<f64>>, pub signal_line: Vec<Option<f64>>, pub histogram: Vec<Option<f64>> }

MajorIndex enum#

rust · ignore
pub enum MajorIndex { Sp500, Nasdaq100, DowJones }

Market struct#

rust · ignore
pub struct Market {  }

MarketCalendar struct#

rust · ignore
domain_handle! { pub struct MarketCalendar caches: { cache: Vec<MarketCalendarEntry> } }

MarketCalendarEntry struct#

rust · ignore
pub struct MarketCalendarEntry { pub symbol: Option<String>, pub date: Option<String>, pub detail: CalendarDetail }

MarketHours struct#

rust · ignore
pub struct MarketHours { pub markets: Vec<MarketTime> }
measured as `finance_query::de_hours`
instructions/iter7350
callgrind Ir/iter7350
median walltime (ns)678
p99 walltime (ns)702
allocations/iter10
allocated bytes/iter1046

MarketSnapshot struct#

rust · ignore
pub struct MarketSnapshot { pub symbol: Option<String>, pub name: Option<String>, pub asset_class: Option<AssetClass>, pub market_status: Option<String>, pub last_price: Option<f64>, pub bid: Option<f64>, pub ask: Option<f64>, pub open: Option<f64>, pub high: Option<f64>, pub low: Option<f64>, pub close: Option<f64>, pub previous_close: Option<f64>, pub volume: Option<f64>, pub change: Option<f64>, pub change_percent: Option<f64>, pub error: Option<String>, pub message: Option<String> }

MarketSummaryQuote struct#

rust · ignore
pub struct MarketSummaryQuote { pub symbol: String, pub full_exchange_name: Option<String>, pub exchange: Option<String>, pub short_name: Option<String>, pub quote_type: Option<String>, pub market_state: Option<String>, pub regular_market_price: Option<FormattedValue<f64>>, pub regular_market_change: Option<FormattedValue<f64>>, pub regular_market_change_percent: Option<FormattedValue<f64>>, pub regular_market_previous_close: Option<FormattedValue<f64>>, pub regular_market_time: Option<FormattedValue<i64>>, pub spark: Option<SparkData> }
measured as `finance_query::de_market_summary`
instructions/iter258626
callgrind Ir/iter258626
median walltime (ns)27568
p99 walltime (ns)27919
allocations/iter228
allocated bytes/iter36044

MarketTime struct#

rust · ignore
pub struct MarketTime { pub id: String, pub name: String, pub status: String, pub message: Option<String>, pub open: Option<String>, pub close: Option<String>, pub time: Option<String>, pub timezone: Option<String>, pub timezone_short: Option<String>, pub gmt_offset: Option<i32>, pub dst: Option<bool> }

MoverDirection enum#

rust · ignore
pub enum MoverDirection { Gainers, Losers, MostActive }

MoverQuote struct#

rust · ignore
pub struct MoverQuote { pub symbol: String, pub name: Option<String>, pub price: Option<f64>, pub change: Option<f64>, pub change_percent: Option<f64>, pub exchange: Option<String> }

News struct#

rust · ignore
pub struct News { pub title: String, pub link: String, pub source: String, pub img: String, pub time: String, pub provider_id: Option<crate::providers::Provider>, pub sentiment: Option<crate::models::sentiment::Sentiment> }
measured as `finance_query::de_news`
instructions/iter44234
callgrind Ir/iter44234
median walltime (ns)3531
p99 walltime (ns)3820
allocations/iter53
allocated bytes/iter6690

Operation enum#

rust · ignore
pub enum Operation { DelistedStocksPage, DelistedStocksPageAt, StockList, CompanyProfilesBulk, StockListingsPage, SymbolDetailsAt, StockTypes, TickerChanges, StockBarsPage, Quote, Chart, ChartRange, Financials, News, Recommendations, Options, Events, QuotesBatch, Spark, CryptoQuote, CryptoNews, EconomicSeries, ForexQuote, ForexNews, IndicesQuote, FuturesQuote, CommoditiesQuote, Filings, SymbolSearch, SymbolDetails, Exchanges, Screener, EarningsCalendar, IpoCalendar, DividendCalendar, SplitCalendar, EconomicCalendar, SectorPerformance, MarketMovers, SectorPerformanceHistory, HolidayCalendar, MarketStatus, IndexConstituents, IndexConstituentChanges, ShortInterest, ShortVolume, ShareFloat, FilingSections, RiskFactors, PressReleases, EarningsTranscript, ProtocolTvl, ProtocolTvlHistory, CommitmentsOfTraders, PriceTargetConsensus, PriceTargetSummary, RatingConsensus, KeyMetricsTtm, RatiosTtm, ExecutiveCompensation, EmployeeCount, CompanyProfile, UnifiedSnapshot, FilingSearch, InsiderTrades, InstitutionalHoldings, CongressionalTrades, FailsToDeliver, EconomicSeriesAsOf, EconomicSearch, EconomicCategories, EconomicReleases, TreasuryAuctions, UpcomingAuctions, EtfProfile, EarningsSurprises, GradingHistory, ListingStatus, GroupedDaily, CryptoGroupedDaily, ForexGroupedDaily, CryptoTrending, CryptoGlobal }

Operator enum#

rust · ignore
pub enum Operator { Eq, Gt, Gte, Lt, Lte, Between }

OptionChain struct#

rust · ignore
pub struct OptionChain { pub expiration_date: i64, pub has_mini_options: Option<bool>, pub calls: Vec<OptionContract>, pub puts: Vec<OptionContract> }

OptionContract struct#

rust · ignore
pub struct OptionContract { pub contract_symbol: String, pub strike: f64, pub currency: Option<String>, pub last_price: Option<f64>, pub change: Option<f64>, pub percent_change: Option<f64>, pub volume: Option<i64>, pub open_interest: Option<i64>, pub bid: Option<f64>, pub ask: Option<f64>, pub contract_size: Option<String>, pub expiration: Option<i64>, pub last_trade_date: Option<i64>, pub implied_volatility: Option<f64>, pub in_the_money: Option<bool> }

Options struct#

rust · ignore
pub struct Options { pub provider_id: Option<Provider> }
measured as `finance_query::de_options`
instructions/iter12405
callgrind Ir/iter12405
median walltime (ns)1035
p99 walltime (ns)1149
allocations/iter6
allocated bytes/iter1028

OptionsQuote struct#

rust · ignore
pub struct OptionsQuote { pub symbol: String, pub short_name: Option<String>, pub regular_market_price: Option<f64>, pub regular_market_time: Option<i64> }

PageCursor struct#

rust · ignore
pub struct PageCursor {  }

PatternSentiment enum#

rust · ignore
pub enum PatternSentiment { Bullish, Bearish, Neutral }

Period enum#

rust · ignore
pub enum Period { Annual, Quarter }

PressRelease struct#

rust · ignore
pub struct PressRelease { pub symbol: Option<String>, pub date: Option<String>, pub title: Option<String>, pub text: Option<String> }

PriceAdjustment enum#

rust · ignore
pub enum PriceAdjustment { Unadjusted, SplitAdjusted }

PriceTargetConsensus struct#

rust · ignore
pub struct PriceTargetConsensus { pub symbol: Option<String>, pub target_high: Option<f64>, pub target_low: Option<f64>, pub target_consensus: Option<f64>, pub target_median: Option<f64> }

PriceTargetSummary struct#

rust · ignore
pub struct PriceTargetSummary { pub symbol: Option<String>, pub last_month_count: Option<i64>, pub last_month_avg: Option<f64>, pub last_quarter_count: Option<i64>, pub last_quarter_avg: Option<f64>, pub last_year_count: Option<i64>, pub last_year_avg: Option<f64>, pub all_time_count: Option<i64>, pub all_time_avg: Option<f64> }

Provider enum#

rust · ignore
pub enum Provider { Yahoo, Polygon, Fmp, AlphaVantage, CoinGecko, Fred, WorldBank, FiscalData, Bls, Frankfurter, Binance, Kraken, Finra, DefiLlama, Gdelt, Cftc, Nasdaq, Wikipedia, CongressTrades, Edgar, LocalMarketCalendar, LocalExchange, Custom(CustomId) }

ProviderFiling struct#

rust · ignore
pub struct ProviderFiling { pub accession_number: Option<String>, pub filing_date: Option<String>, pub filing_type: Option<String>, pub filing_url: Option<String>, pub company_name: Option<String>, pub cik: Option<String> }

ProviderFilings struct#

rust · ignore
pub struct ProviderFilings { pub symbol: String, pub filings: Vec<ProviderFiling> }

ProviderHealth struct#

rust · ignore
pub struct ProviderHealth { pub provider: Provider, pub is_healthy: bool, pub recent_successes: u32, pub recent_failures: u32, pub last_error: Option<String>, pub requests_remaining_estimate: Option<f64> }

ProviderPage struct#

rust · ignore
pub struct ProviderPage<T> { pub items: Vec<T>, pub next: Option<PageCursor>, pub provider_id: Provider, pub request_id: Option<String>, pub results_count: Option<usize>, pub query_count: Option<usize>, pub reported_symbol: Option<String>, pub adjusted: Option<bool> }

Providers struct#

rust · ignore
pub struct Providers {  }

ProvidersBuilder struct#

rust · ignore
pub struct ProvidersBuilder {  }

QueryCondition struct#

rust · ignore
pub struct QueryCondition<F: ScreenerField> { pub field: F, pub operator: Operator, pub value: ConditionValue }

QueryGroup struct#

rust · ignore
pub struct QueryGroup<F: ScreenerField> { pub operator: LogicalOperator, pub operands: Vec<QueryOperand<F>> }

QueryOperand enum#

rust · ignore
pub enum QueryOperand<F: ScreenerField> { Condition(QueryCondition<F>), Group(QueryGroup<F>) }

Quote struct#

rust · ignore
pub struct Quote<F: Format = Both> { pub symbol: String, pub logo_url: Option<String>, pub company_logo_url: Option<String>, pub short_name: Option<String>, pub long_name: Option<String>, pub exchange: Option<String>, pub exchange_name: Option<String>, pub quote_type: Option<String>, pub currency: Option<String>, pub currency_symbol: Option<String>, pub underlying_symbol: Option<String>, pub from_currency: Option<String>, pub to_currency: Option<String>, pub regular_market_price: Option<F::Value<f64>>, pub regular_market_change: Option<F::Value<f64>>, pub regular_market_change_percent: Option<F::Value<f64>>, pub regular_market_time: Option<i64>, pub regular_market_day_high: Option<F::Value<f64>>, pub regular_market_day_low: Option<F::Value<f64>>, pub regular_market_open: Option<F::Value<f64>>, pub regular_market_previous_close: Option<F::Value<f64>>, pub regular_market_volume: Option<F::Value<i64>>, pub market_state: Option<String>, pub day_high: Option<F::Value<f64>>, pub day_low: Option<F::Value<f64>>, pub open: Option<F::Value<f64>>, pub previous_close: Option<F::Value<f64>>, pub volume: Option<F::Value<i64>>, pub all_time_high: Option<F::Value<f64>>, pub all_time_low: Option<F::Value<f64>>, pub pre_market_price: Option<F::Value<f64>>, pub pre_market_change: Option<F::Value<f64>>, pub pre_market_change_percent: Option<F::Value<f64>>, pub pre_market_time: Option<i64>, pub post_market_price: Option<F::Value<f64>>, pub post_market_change: Option<F::Value<f64>>, pub post_market_change_percent: Option<F::Value<f64>>, pub post_market_time: Option<i64>, pub average_daily_volume10_day: Option<F::Value<i64>>, pub average_daily_volume3_month: Option<F::Value<i64>>, pub average_volume: Option<F::Value<i64>>, pub average_volume10days: Option<F::Value<i64>>, pub market_cap: Option<F::Value<i64>>, pub enterprise_value: Option<F::Value<i64>>, pub enterprise_to_revenue: Option<F::Value<f64>>, pub enterprise_to_ebitda: Option<F::Value<f64>>, pub price_to_book: Option<F::Value<f64>>, pub price_to_sales_trailing12_months: Option<F::Value<f64>>, pub forward_pe: Option<F::Value<f64>>, pub trailing_pe: Option<F::Value<f64>>, pub beta: Option<F::Value<f64>>, pub fifty_two_week_high: Option<F::Value<f64>>, pub fifty_two_week_low: Option<F::Value<f64>>, pub fifty_day_average: Option<F::Value<f64>>, pub two_hundred_day_average: Option<F::Value<f64>>, pub week_52_change: Option<F::Value<f64>>, pub sand_p_52_week_change: Option<F::Value<f64>>, pub dividend_rate: Option<F::Value<f64>>, pub dividend_yield: Option<F::Value<f64>>, pub trailing_annual_dividend_rate: Option<F::Value<f64>>, pub trailing_annual_dividend_yield: Option<F::Value<f64>>, pub five_year_avg_dividend_yield: Option<F::Value<f64>>, pub ex_dividend_date: Option<F::Value<i64>>, pub payout_ratio: Option<F::Value<f64>>, pub last_dividend_value: Option<F::Value<f64>>, pub last_dividend_date: Option<F::Value<i64>>, pub bid: Option<F::Value<f64>>, pub bid_size: Option<F::Value<i64>>, pub ask: Option<F::Value<f64>>, pub ask_size: Option<F::Value<i64>>, pub shares_outstanding: Option<F::Value<i64>>, pub float_shares: Option<F::Value<i64>>, pub implied_shares_outstanding: Option<F::Value<i64>>, pub held_percent_insiders: Option<F::Value<f64>>, pub held_percent_institutions: Option<F::Value<f64>>, pub shares_short: Option<F::Value<i64>>, pub shares_short_prior_month: Option<F::Value<i64>>, pub short_ratio: Option<F::Value<f64>>, pub short_percent_of_float: Option<F::Value<f64>>, pub shares_percent_shares_out: Option<F::Value<f64>>, pub date_short_interest: Option<F::Value<i64>>, pub current_price: Option<F::Value<f64>>, pub target_high_price: Option<F::Value<f64>>, pub target_low_price: Option<F::Value<f64>>, pub target_mean_price: Option<F::Value<f64>>, pub target_median_price: Option<F::Value<f64>>, pub recommendation_mean: Option<F::Value<f64>>, pub recommendation_key: Option<String>, pub number_of_analyst_opinions: Option<F::Value<i64>>, pub total_cash: Option<F::Value<i64>>, pub total_cash_per_share: Option<F::Value<f64>>, pub ebitda: Option<F::Value<i64>>, pub total_debt: Option<F::Value<i64>>, pub total_revenue: Option<F::Value<i64>>, pub net_income_to_common: Option<F::Value<i64>>, pub debt_to_equity: Option<F::Value<f64>>, pub revenue_per_share: Option<F::Value<f64>>, pub return_on_assets: Option<F::Value<f64>>, pub return_on_equity: Option<F::Value<f64>>, pub free_cashflow: Option<F::Value<i64>>, pub operating_cashflow: Option<F::Value<i64>>, pub profit_margins: Option<F::Value<f64>>, pub gross_margins: Option<F::Value<f64>>, pub ebitda_margins: Option<F::Value<f64>>, pub operating_margins: Option<F::Value<f64>>, pub gross_profits: Option<F::Value<i64>>, pub earnings_growth: Option<F::Value<f64>>, pub revenue_growth: Option<F::Value<f64>>, pub earnings_quarterly_growth: Option<F::Value<f64>>, pub current_ratio: Option<F::Value<f64>>, pub quick_ratio: Option<F::Value<f64>>, pub trailing_eps: Option<F::Value<f64>>, pub forward_eps: Option<F::Value<f64>>, pub book_value: Option<F::Value<f64>>, pub sector: Option<String>, pub sector_key: Option<String>, pub sector_disp: Option<String>, pub industry: Option<String>, pub industry_key: Option<String>, pub industry_disp: Option<String>, pub long_business_summary: Option<String>, pub website: Option<String>, pub ir_website: Option<String>, pub address1: Option<String>, pub city: Option<String>, pub state: Option<String>, pub zip: Option<String>, pub country: Option<String>, pub phone: Option<String>, pub full_time_employees: Option<i64>, pub category: Option<String>, pub fund_family: Option<String>, pub audit_risk: Option<i32>, pub board_risk: Option<i32>, pub compensation_risk: Option<i32>, pub shareholder_rights_risk: Option<i32>, pub overall_risk: Option<i32>, pub time_zone_full_name: Option<String>, pub time_zone_short_name: Option<String>, pub gmt_off_set_milliseconds: Option<i64>, pub first_trade_date_epoch_utc: Option<i64>, pub message_board_id: Option<String>, pub exchange_data_delayed_by: Option<i32>, pub nav_price: Option<F::Value<f64>>, pub total_assets: Option<F::Value<i64>>, pub yield_value: Option<F::Value<f64>>, pub last_split_factor: Option<String>, pub last_split_date: Option<F::Value<i64>>, pub last_fiscal_year_end: Option<F::Value<i64>>, pub next_fiscal_year_end: Option<F::Value<i64>>, pub most_recent_quarter: Option<F::Value<i64>>, pub price_hint: Option<F::Value<i64>>, pub tradeable: Option<bool>, pub financial_currency: Option<String>, pub company_officers: Option<Vec<super::CompanyOfficer>>, pub earnings: Option<Earnings>, pub calendar_events: Option<CalendarEvents>, pub recommendation_trend: Option<RecommendationTrend>, pub upgrade_downgrade_history: Option<UpgradeDowngradeHistory>, pub earnings_history: Option<EarningsHistory>, pub earnings_trend: Option<EarningsTrend>, pub insider_holders: Option<InsiderHolders>, pub insider_transactions: Option<InsiderTransactions>, pub institution_ownership: Option<InstitutionOwnership>, pub fund_ownership: Option<FundOwnership>, pub major_holders_breakdown: Option<MajorHoldersBreakdown>, pub net_share_purchase_activity: Option<NetSharePurchaseActivity>, pub sec_filings: Option<SecFilings>, pub balance_sheet_history: Option<BalanceSheetHistory>, pub balance_sheet_history_quarterly: Option<BalanceSheetHistoryQuarterly>, pub cashflow_statement_history: Option<CashflowStatementHistory>, pub cashflow_statement_history_quarterly: Option<CashflowStatementHistoryQuarterly>, pub income_statement_history: Option<IncomeStatementHistory>, pub income_statement_history_quarterly: Option<IncomeStatementHistoryQuarterly>, pub equity_performance: Option<EquityPerformance>, pub index_trend: Option<IndexTrend>, pub industry_trend: Option<IndustryTrend>, pub sector_trend: Option<SectorTrend>, pub fund_profile: Option<FundProfile>, pub fund_performance: Option<FundPerformance>, pub top_holdings: Option<TopHoldings> }
measured as `finance_query::de_quote`
instructions/iter9389383
callgrind Ir/iter9389383
median walltime (ns)962631
p99 walltime (ns)982198
allocations/iter8235
allocated bytes/iter767090

QuoteSummaryResponse struct#

rust · ignore
pub struct QuoteSummaryResponse { pub symbol: String, pub price: Option<Price>, pub summary_detail: Option<SummaryDetail>, pub financial_data: Option<FinancialData>, pub default_key_statistics: Option<DefaultKeyStatistics>, pub asset_profile: Option<AssetProfile>, pub calendar_events: Option<CalendarEvents>, pub earnings: Option<Earnings>, pub earnings_trend: Option<EarningsTrend>, pub earnings_history: Option<EarningsHistory>, pub recommendation_trend: Option<RecommendationTrend>, pub insider_holders: Option<InsiderHolders>, pub insider_transactions: Option<InsiderTransactions>, pub institution_ownership: Option<InstitutionOwnership>, pub fund_ownership: Option<FundOwnership>, pub major_holders_breakdown: Option<MajorHoldersBreakdown>, pub net_share_purchase_activity: Option<NetSharePurchaseActivity>, pub quote_type: Option<QuoteTypeData>, pub summary_profile: Option<SummaryProfile>, pub sec_filings: Option<SecFilings>, pub upgrade_downgrade_history: Option<UpgradeDowngradeHistory>, pub fund_performance: Option<FundPerformance>, pub fund_profile: Option<FundProfile>, pub top_holdings: Option<TopHoldings>, pub index_trend: Option<IndexTrend>, pub industry_trend: Option<IndustryTrend>, pub sector_trend: Option<SectorTrend>, pub equity_performance: Option<EquityPerformance> }

QuoteType enum#

rust · ignore
pub enum QuoteType { Equity, MutualFund }

RatingConsensus struct#

rust · ignore
pub struct RatingConsensus { pub symbol: Option<String>, pub strong_buy: Option<i64>, pub buy: Option<i64>, pub hold: Option<i64>, pub sell: Option<i64>, pub strong_sell: Option<i64>, pub consensus: Option<String> }

Recommendation struct#

rust · ignore
pub struct Recommendation { pub symbol: String, pub recommendations: Vec<SimilarSymbol>, pub provider_id: Option<crate::providers::Provider> }

Region enum#

rust · ignore
pub enum Region { Argentina, Australia, Brazil, Canada, China, Denmark, Finland, France, Germany, Greece, HongKong, India, Israel, Italy, Japan, Korea, Malaysia, Mexico, NewZealand, Norway, Portugal, Qatar, Russia, Singapore, Spain, Sweden, Taiwan, Thailand, Turkey, UnitedKingdom, UnitedStates, Vietnam }

ResearchReport struct#

rust · ignore
pub struct ResearchReport { pub report_headline: Option<String>, pub author: Option<String>, pub report_date: Option<i64>, pub id: Option<String>, pub provider: Option<String> }

ResearchReports struct#

rust · ignore
pub struct ResearchReports(pub Vec<ResearchReport>)

Result type_alias#

rust · ignore
pub type Result<T> = std::result::Result<T, FinanceError>

RetryPolicy struct#

rust · ignore
pub struct RetryPolicy { pub max_attempts: u32, pub base_delay: Duration, pub multiplier: f64, pub jitter: f64, pub max_delay: Duration, pub max_retry_after: Duration }

RiskFactor struct#

rust · ignore
pub struct RiskFactor { pub title: Option<String>, pub text: Option<String>, pub category: Option<String>, pub filing_date: Option<String> }

Routes struct#

rust · ignore
pub struct Routes {  }

Screener enum#

rust · ignore
pub enum Screener { AggressiveSmallCaps, DayGainers, DayLosers, GrowthTechnologyStocks, MostActives, MostShortedStocks, SmallCapGainers, UndervaluedGrowthStocks, UndervaluedLargeCaps, ConservativeForeignFunds, HighYieldBond, PortfolioAnchors, SolidLargeGrowthFunds, SolidMidcapGrowthFunds, TopMutualFunds }

ScreenerField trait#

rust · ignore
pub trait ScreenerField: Clone + Serialize + 'static

ScreenerFieldExt trait#

rust · ignore
pub trait ScreenerFieldExt: ScreenerField + Sized

ScreenerFilters struct#

rust · ignore
pub struct ScreenerFilters { pub market_cap_min: Option<f64>, pub market_cap_max: Option<f64>, pub price_min: Option<f64>, pub price_max: Option<f64>, pub volume_min: Option<f64>, pub beta_min: Option<f64>, pub beta_max: Option<f64>, pub sector: Option<String>, pub industry: Option<String>, pub exchange: Option<String>, pub country: Option<String>, pub actively_trading: Option<bool>, pub limit: Option<u32>, pub is_etf: Option<bool>, pub is_fund: Option<bool> }

ScreenerFundCategory enum#

rust · ignore
pub enum ScreenerFundCategory { UsLargeBlend, UsLargeGrowth, UsLargeValue, UsMidCapBlend, UsMidCapGrowth, UsMidCapValue, UsSmallBlend, UsSmallGrowth, UsSmallValue, UsDiversifiedEmergingMarkets, UsForeignLargeBlend, UsForeignLargeGrowth, UsForeignLargeValue, UsForeignSmallMidBlend, UsForeignSmallMidGrowth, UsForeignSmallMidValue, UsWorldLargeStockBlend, UsWorldLargeStockGrowth, UsWorldSmallMidStock, UsIntermediateCoreBond, UsIntermediateCorePlusBond, UsShortTermBond, UsLongTermBond, UsCorporateBond, UsHighYieldBond, UsUltrashortBond, UsInflationProtectedBond, UsMultisectorBond, UsShortGovernment, UsIntermediateGovernment, UsLongGovernment, UsMuniNationalInterm, UsMuniNationalShort, UsMuniNationalLong, UsMoneyMarketTaxable, UsMoneyMarketTaxFree, UsBankLoan, UsEmergingMarketsBond, UsAllocation15To30Equity, UsAllocation30To50Equity, UsAllocation50To70Equity, UsAllocation70To85Equity, UsAllocation85PlusEquity, UsRealEstate, UsHealth, UsTechnology, UsNaturalResources, UsUtilities, UsCommunications, UsIndustrials, UsFinancial, UsConsumerDefensive, UsConsumerCyclical, UsEnergyLimitedPartnership, UsMiscellaneousSector, UsInfrastructure, UsTargetDate2025, UsTargetDate2030, UsTargetDate2035, UsTargetDate2040, UsTargetDate2045, UsTargetDate2050, UsTargetDate2055, UsTargetDate2060, UsTargetDate2065Plus, UsTargetDateRetirement, UsConvertibles, UsPreferredStock, UsMultialternative, UsOptionsBased, EaaEuropeLargeCapBlendEquity, EaaEuropeLargeCapGrowthEquity, EaaEuropeLargeCapValueEquity, EaaGlobalLargeCapBlendEquity, EaaGlobalLargeCapGrowthEquity, EaaEurDiversifiedBond, EaaEurCorporateBond, EaaUsdCorporateBond, EaaUsdHighYieldBond, EaaGlobalBond, EaaUsdMoneyMarket, EaaEurMoneyMarket }

ScreenerMatch struct#

rust · ignore
pub struct ScreenerMatch { pub symbol: String, pub name: Option<String>, pub price: Option<f64>, pub market_cap: Option<f64>, pub sector: Option<String>, pub industry: Option<String>, pub beta: Option<f64>, pub volume: Option<f64>, pub exchange: Option<String>, pub country: Option<String>, pub is_etf: Option<bool>, pub is_actively_trading: Option<bool>, pub is_fund: Option<bool> }

ScreenerPeerGroup enum#

rust · ignore
pub enum ScreenerPeerGroup { Semiconductors, SemiconductorEquipment, SoftwareAndServices, TechnologyHardwareAndEquipment, InternetCompanies, ElectronicEquipment, Banks, DiversifiedBanks, RegionalBanks, CapitalMarkets, Insurance, LifeAndHealthInsurance, PropertyAndCasualtyInsurance, AssetManagement, ConsumerFinance, MortgageFinance, SpecialtyFinance, DiversifiedFinancialServices, InvestmentBankingAndBrokerage, Pharmaceuticals, Biotechnology, HealthCareEquipment, HealthCareServices, HealthCareFacilities, ManagedHealthcare, Automobiles, AutoComponents, FoodProducts, PackagedFoodsAndMeats, Beverages, HouseholdProducts, HouseholdDurables, PersonalProducts, ApparelAndLuxuryGoods, Retailers, FoodAndDrugRetailing, GeneralMerchandiseStores, SpecialtyRetail, LeisureProducts, Hotels, Restaurants, Media, DrugRetail, IntegratedOilAndGas, OilAndGasExplorationAndProduction, OilAndGasRefiningAndMarketing, OilAndGasStorageAndTransportation, EnergyEquipmentAndServices, AerospaceAndDefense, Airlines, IndustrialMachinery, IndustrialConglomerates, IndustrialGases, BuildingProducts, Chemicals, SpecialtyChemicals, MetalsAndMining, PaperAndForestProducts, ContainersAndPackaging, CommercialServicesAndSupplies, Railroads, Trucking, ResearchAndConsultingServices, HumanResourceAndEmploymentServices, DataProcessingAndOutsourcedServices, ItConsultingAndOtherServices, RealEstate, RetailReits, ElectricUtilities, GasUtilities, WaterUtilities, MultiUtilities, RenewableElectricity, TelecomServices, WirelessTelecommunicationServices, Steel, Gold, OilAndGas, WasteManagement, Tobacco, OfficeElectronics, CommunicationsEquipment, HomeBuilding, HomeFurnishings, HouseholdAppliances, Publishing }

ScreenerQuery struct#

rust · ignore
pub struct ScreenerQuery<F: ScreenerField = EquityField> { pub size: u32, pub offset: u32, pub sort_type: SortType, pub sort_field: F, pub include_fields: Vec<F>, pub top_operator: LogicalOperator, pub query: QueryGroup<F>, pub quote_type: QuoteType }

ScreenerQuote struct#

rust · ignore
pub struct ScreenerQuote { pub symbol: String, pub short_name: String, pub long_name: Option<String>, pub display_name: Option<String>, pub quote_type: String, pub exchange: String, pub regular_market_price: FormattedValue<f64>, pub regular_market_change: FormattedValue<f64>, pub regular_market_change_percent: FormattedValue<f64>, pub regular_market_open: Option<FormattedValue<f64>>, pub regular_market_day_high: Option<FormattedValue<f64>>, pub regular_market_day_low: Option<FormattedValue<f64>>, pub regular_market_previous_close: Option<FormattedValue<f64>>, pub regular_market_time: Option<FormattedValue<i64>>, pub regular_market_volume: Option<FormattedValue<i64>>, pub average_daily_volume3_month: Option<FormattedValue<i64>>, pub average_daily_volume10_day: Option<FormattedValue<i64>>, pub market_cap: Option<FormattedValue<i64>>, pub shares_outstanding: Option<FormattedValue<i64>>, pub fifty_two_week_high: Option<FormattedValue<f64>>, pub fifty_two_week_low: Option<FormattedValue<f64>>, pub fifty_two_week_change: Option<FormattedValue<f64>>, pub fifty_two_week_change_percent: Option<FormattedValue<f64>>, pub fifty_day_average: Option<FormattedValue<f64>>, pub fifty_day_average_change: Option<FormattedValue<f64>>, pub fifty_day_average_change_percent: Option<FormattedValue<f64>>, pub two_hundred_day_average: Option<FormattedValue<f64>>, pub two_hundred_day_average_change: Option<FormattedValue<f64>>, pub two_hundred_day_average_change_percent: Option<FormattedValue<f64>>, pub average_analyst_rating: Option<String>, pub trailing_pe: Option<FormattedValue<f64>>, pub forward_pe: Option<FormattedValue<f64>>, pub price_to_book: Option<FormattedValue<f64>>, pub book_value: Option<FormattedValue<f64>>, pub eps_trailing_twelve_months: Option<FormattedValue<f64>>, pub eps_forward: Option<FormattedValue<f64>>, pub eps_current_year: Option<FormattedValue<f64>>, pub price_eps_current_year: Option<FormattedValue<f64>>, pub dividend_yield: Option<FormattedValue<f64>>, pub dividend_rate: Option<FormattedValue<f64>>, pub dividend_date: Option<FormattedValue<i64>>, pub trailing_annual_dividend_rate: Option<FormattedValue<f64>>, pub trailing_annual_dividend_yield: Option<FormattedValue<f64>>, pub bid: Option<FormattedValue<f64>>, pub bid_size: Option<FormattedValue<i64>>, pub ask: Option<FormattedValue<f64>>, pub ask_size: Option<FormattedValue<i64>>, pub post_market_price: Option<FormattedValue<f64>>, pub post_market_change: Option<FormattedValue<f64>>, pub post_market_change_percent: Option<FormattedValue<f64>>, pub post_market_time: Option<FormattedValue<i64>>, pub pre_market_price: Option<FormattedValue<f64>>, pub pre_market_change: Option<FormattedValue<f64>>, pub pre_market_change_percent: Option<FormattedValue<f64>>, pub pre_market_time: Option<FormattedValue<i64>>, pub earnings_timestamp: Option<FormattedValue<i64>>, pub earnings_timestamp_start: Option<FormattedValue<i64>>, pub earnings_timestamp_end: Option<FormattedValue<i64>>, pub currency: Option<String> }

ScreenerResults struct#

rust · ignore
pub struct ScreenerResults { pub quotes: Vec<ScreenerQuote>, pub screener_type: String, pub description: Option<String>, pub last_updated: Option<i64>, pub total: Option<i64> }
measured as `finance_query::de_screener`
instructions/iter3795931
callgrind Ir/iter3795931
median walltime (ns)421585
p99 walltime (ns)434779
allocations/iter4498
allocated bytes/iter484379

SearchNews struct#

rust · ignore
pub struct SearchNews { pub uuid: Option<String>, pub title: Option<String>, pub publisher: Option<String>, pub link: Option<String>, pub provider_publish_time: Option<i64>, pub news_type: Option<String>, pub thumbnail: Option<NewsThumbnail>, pub related_tickers: Option<Vec<String>>, pub sentiment: Option<crate::models::sentiment::Sentiment> }

SearchNewsList struct#

rust · ignore
pub struct SearchNewsList(pub Vec<SearchNews>)

SearchOptions struct#

rust · ignore
pub struct SearchOptions { pub quotes_count: u32, pub news_count: u32, pub enable_fuzzy_query: bool, pub enable_logo_url: bool, pub enable_research_reports: bool, pub enable_cultural_assets: bool, pub recommend_count: u32, pub region: Option<Region> }

SearchQuote struct#

rust · ignore
pub struct SearchQuote { pub symbol: String, pub short_name: Option<String>, pub long_name: Option<String>, pub quote_type: Option<String>, pub exchange: Option<String>, pub exch_disp: Option<String>, pub type_disp: Option<String>, pub industry: Option<String>, pub industry_disp: Option<String>, pub sector: Option<String>, pub sector_disp: Option<String>, pub is_yahoo_finance: Option<bool>, pub disp_sec_ind_flag: Option<bool>, pub logo_url: Option<String>, pub score: Option<f64>, pub index: Option<String>, pub prev_name: Option<String>, pub name_change_date: Option<String> }

SearchQuotes struct#

rust · ignore
pub struct SearchQuotes(pub Vec<SearchQuote>)

SearchResults struct#

rust · ignore
pub struct SearchResults { pub count: Option<i32>, pub quotes: SearchQuotes, pub news: SearchNewsList, pub research_reports: ResearchReports, pub total_time: Option<i64> }
measured as `finance_query::de_search`
instructions/iter55205
callgrind Ir/iter55205
median walltime (ns)4986
p99 walltime (ns)6122
allocations/iter55
allocated bytes/iter5105

Sector enum#

rust · ignore
pub enum Sector { Technology, FinancialServices, ConsumerCyclical, CommunicationServices, Healthcare, Industrials, ConsumerDefensive, Energy, BasicMaterials, RealEstate, Utilities }

SectorData struct#

rust · ignore
pub struct SectorData { pub name: String, pub symbol: Option<String>, pub key: String, pub overview: Option<SectorOverview>, pub performance: Option<SectorPerformance>, pub benchmark: Option<SectorPerformance>, pub benchmark_name: Option<String>, pub top_companies: Vec<SectorCompany>, pub top_etfs: Vec<SectorETF>, pub top_mutual_funds: Vec<SectorMutualFund>, pub industries: Vec<SectorIndustry>, pub research_reports: Vec<ResearchReport> }

SectorPe struct#

rust · ignore
pub struct SectorPe { pub sector: String, pub exchange: Option<String>, pub pe: Option<f64>, pub date: Option<String> }

SectorPerformance struct#

rust · ignore
pub struct SectorPerformance { pub sector: String, pub exchange: Option<String>, pub change_percent: Option<f64> }

SectorPerformanceHistory struct#

rust · ignore
pub struct SectorPerformanceHistory { pub date: Option<String>, pub sectors: Vec<SectorPerformance> }

Sentiment struct#

rust · ignore
pub struct Sentiment { pub label: SentimentLabel, pub score: f64, pub confidence: f64 }

SentimentLabel enum#

rust · ignore
pub enum SentimentLabel { Bullish, Neutral, Bearish }

ShareFloat struct#

rust · ignore
pub struct ShareFloat { pub symbol: Option<String>, pub float_shares: Option<f64>, pub outstanding_shares: Option<f64>, pub float_percent: Option<f64>, pub date: Option<String> }

ShortInterest struct#

rust · ignore
pub struct ShortInterest { pub settlement_date: Option<String>, pub short_interest: Option<f64>, pub avg_daily_volume: Option<f64>, pub days_to_cover: Option<f64> }

ShortVolume struct#

rust · ignore
pub struct ShortVolume { pub date: Option<String>, pub short_volume: Option<f64>, pub short_exempt_volume: Option<f64>, pub total_volume: Option<f64> }

SimilarSymbol struct#

rust · ignore
pub struct SimilarSymbol { pub symbol: String, pub score: f64 }

Snapshot struct#

rust · ignore
domain_handle! { pub struct Snapshot caches: { cache: Vec<MarketSnapshot> } }

SortType enum#

rust · ignore
pub enum SortType { Asc, Desc }

Spark struct#

rust · ignore
pub struct Spark { pub symbol: String, pub meta: ChartMeta, pub timestamps: Vec<i64>, pub closes: Vec<f64>, pub interval: Option<String>, pub range: Option<String> }

SparkData struct#

rust · ignore
pub struct SparkData { pub close: Option<Vec<Option<f64>>>, pub timestamp: Option<Vec<i64>>, pub symbol: Option<String>, pub previous_close: Option<f64>, pub chart_previous_close: Option<f64> }

Split struct#

rust · ignore
pub struct Split { pub timestamp: i64, pub numerator: f64, pub denominator: f64, pub ratio: String, pub provider_id: Option<Provider> }

StatementType enum#

rust · ignore
pub enum StatementType { Income, Balance, CashFlow }

StochasticData struct#

rust · ignore
pub struct StochasticData { pub k: Option<f64>, pub d: Option<f64> }

StockBar struct#

rust · ignore
pub struct StockBar { pub timestamp_ms: i64, pub open: f64, pub high: f64, pub low: f64, pub close: f64, pub volume: f64, pub transactions: Option<u64>, pub vwap: Option<f64> }

StockBarsRequest struct#

rust · ignore
pub struct StockBarsRequest {  }

StockListing struct#

rust · ignore
pub struct StockListing { pub symbol: String, pub name: Option<String>, pub exchange: Option<String>, pub stock_type: Option<String>, pub locale: Option<String>, pub active: Option<bool>, pub cik: Option<String>, pub composite_figi: Option<String>, pub share_class_figi: Option<String>, pub list_date: Option<String>, pub delisted_utc: Option<String> }

StockListingRequest struct#

rust · ignore
pub struct StockListingRequest {  }

StockType struct#

rust · ignore
pub struct StockType { pub code: String, pub description: Option<String>, pub asset_class: Option<String>, pub locale: Option<String> }

SuperTrendData struct#

rust · ignore
pub struct SuperTrendData { pub value: Option<f64>, pub trend: Option<String> }

SymbolDetails struct#

rust · ignore
pub struct SymbolDetails { pub symbol: String, pub name: Option<String>, pub description: Option<String>, pub exchange: Option<String>, pub asset_type: Option<String>, pub cik: Option<String>, pub sic_code: Option<String>, pub sic_description: Option<String>, pub homepage_url: Option<String>, pub employees: Option<u64>, pub market_cap: Option<f64>, pub list_date: Option<String>, pub shares_outstanding: Option<f64>, pub composite_figi: Option<String>, pub share_class_figi: Option<String>, pub active: Option<bool>, pub delisted_utc: Option<String>, pub provider_id: Option<crate::Provider> }

SymbolMatch struct#

rust · ignore
pub struct SymbolMatch { pub symbol: String, pub id: Option<String>, pub name: Option<String>, pub exchange: Option<String>, pub asset_type: Option<String>, pub currency: Option<String>, pub active: Option<bool>, pub market_cap_rank: Option<u32>, pub thumbnail: Option<String>, pub image: Option<String>, pub ipo_date: Option<String>, pub delisted_date: Option<String> }

SymbolSentiment struct#

rust · ignore
pub struct SymbolSentiment { pub score: Option<f64>, pub label: Option<String> }

Ticker struct#

rust · ignore
pub struct Ticker {  }

TickerBuilder struct#

rust · ignore
pub struct TickerBuilder {  }

TickerChange struct#

rust · ignore
pub struct TickerChange { pub date: String, pub ticker: String }

Tickers struct#

rust · ignore
pub struct Tickers {  }

TickersBuilder struct#

rust · ignore
pub struct TickersBuilder {  }

TimeRange enum#

rust · ignore
pub enum TimeRange { OneDay, FiveDays, OneMonth, ThreeMonths, SixMonths, OneYear, TwoYears, FiveYears, TenYears, YearToDate, Max }

Transcript struct#

rust · ignore
pub struct Transcript { pub transcript_content: TranscriptContent, pub transcript_metadata: TranscriptMetadata }

TranscriptWithMeta struct#

rust · ignore
pub struct TranscriptWithMeta { pub event_id: String, pub quarter: Option<String>, pub year: Option<i32>, pub title: String, pub url: String, pub transcript: Transcript }

TreasuryAuction struct#

rust · ignore
pub struct TreasuryAuction { pub record_date: String, pub cusip: String, pub security_type: String, pub security_term: String, pub auction_date: String, pub issue_date: String, pub maturity_date: String, pub reopening: Option<bool>, pub auction_format: Option<String>, pub int_rate: Option<f64>, pub offering_amt: Option<f64>, pub total_tendered: Option<f64>, pub total_accepted: Option<f64>, pub bid_to_cover_ratio: Option<f64>, pub high_yield: Option<f64>, pub high_discnt_rate: Option<f64>, pub high_investment_rate: Option<f64>, pub high_price: Option<f64>, pub primary_dealer_accepted: Option<f64>, pub direct_bidder_accepted: Option<f64>, pub indirect_bidder_accepted: Option<f64>, pub comp_accepted: Option<f64>, pub noncomp_accepted: Option<f64>, pub soma_accepted: Option<f64> }

TreasuryAuctionQuery struct#

rust · ignore
pub struct TreasuryAuctionQuery { pub security_type: Option<String>, pub security_term: Option<String>, pub from: Option<String>, pub to: Option<String>, pub limit: Option<u32> }

TrendingQuote struct#

rust · ignore
pub struct TrendingQuote { pub symbol: String }
measured as `finance_query::de_trending`
instructions/iter18081
callgrind Ir/iter18081
median walltime (ns)1375
p99 walltime (ns)1397
allocations/iter24
allocated bytes/iter1551

UpcomingAuction struct#

rust · ignore
pub struct UpcomingAuction { pub record_date: String, pub security_type: String, pub security_term: String, pub cusip: String, pub reopening: Option<bool>, pub offering_amt: Option<f64>, pub announcement_date: String, pub auction_date: String, pub issue_date: String }

ValueFormat enum#

rust · ignore
pub enum ValueFormat { Raw, Pretty, Both }

analyst_estimates function#

rust · ignore
pub async fn analyst_estimates(symbol: &str, period: Period) -> Result<Vec<AnalystEstimate>>

analyst_recommendations function#

rust · ignore
pub async fn analyst_recommendations(symbol: &str) -> Result<Vec<AnalystRecommendation>>

analyze_sentiment function#

rust · ignore
pub fn analyze(text: &str) -> Sentiment
measured as `finance_query::score_news`
instructions/iter938996
callgrind Ir/iter938996
median walltime (ns)86685
p99 walltime (ns)90614
allocations/iter976
allocated bytes/iter17381

atr function#

rust · ignore
pub fn atr(highs: &[f64], lows: &[f64], closes: &[f64], period: usize) -> Result<Vec<Option<f64>>>
measured as `finance_query::ind_atr`
instructions/iter56478
callgrind Ir/iter56478
median walltime (ns)9843
p99 walltime (ns)9893
allocations/iter2
allocated bytes/iter23896

earnings_calendar function#

rust · ignore
pub async fn earnings_calendar() -> Result<Vec<EarningsCalendarEntry>>

insider_trading function#

rust · ignore
pub async fn insider_trading(symbol: &str, limit: u32) -> Result<Vec<InsiderTransaction>>

ipo_calendar function#

rust · ignore
pub async fn ipo_calendar() -> Result<Vec<IpoCalendarEntry>>

patterns function#

rust · ignore
pub fn patterns(candles: &[Candle]) -> Vec<Option<CandlePattern>>
measured as `finance_query::ind_patterns`
instructions/iter1184450
callgrind Ir/iter1184450
median walltime (ns)98301
p99 walltime (ns)100553
allocations/iter1
allocated bytes/iter16384

symbol_sentiment function#

rust · ignore
pub async fn symbol_sentiment(symbol: &str) -> Result<crate::models::sentiment::SymbolSentiment>

finance_query::adapters::alphavantage::models#

EarningsCalendarEntryDTO struct#

rust · ignore
pub struct EarningsCalendarEntryDTO { pub symbol: String, pub name: Option<String>, pub report_date: Option<String>, pub fiscal_date_ending: Option<String>, pub estimate: Option<f64>, pub currency: Option<String> }

A single earnings calendar entry.

IpoCalendarEntryDTO struct#

rust · ignore
pub struct IpoCalendarEntryDTO { pub symbol: Option<String>, pub name: Option<String>, pub ipo_date: Option<String>, pub price_range: Option<String>, pub exchange: Option<String> }

A single IPO calendar entry.

finance_query::adapters::fmp::corporate::insider_trading#

InsiderTradeDTO struct#

rust · ignore
pub struct InsiderTradeDTO { pub symbol: Option<String>, pub filing_date: Option<String>, pub transaction_date: Option<String>, pub reporting_cik: Option<String>, pub reporting_name: Option<String>, pub transaction_type: Option<String>, pub securities_transacted: Option<f64>, pub price: Option<f64>, pub securities_owned: Option<f64>, pub type_of_owner: Option<String>, pub link: Option<String> }

Insider trading transaction record.

finance_query::adapters::fmp::fundamentals::estimates#

AnalystEstimateDTO struct#

rust · ignore
pub struct AnalystEstimateDTO { pub symbol: Option<String>, pub date: Option<String>, pub estimated_revenue_low: Option<f64>, pub estimated_revenue_high: Option<f64>, pub estimated_revenue_avg: Option<f64>, pub estimated_ebitda_low: Option<f64>, pub estimated_ebitda_high: Option<f64>, pub estimated_ebitda_avg: Option<f64>, pub estimated_eps_avg: Option<f64>, pub estimated_eps_high: Option<f64>, pub estimated_eps_low: Option<f64>, pub number_analyst_estimated_revenue: Option<i32>, pub number_analysts_estimated_eps: Option<i32> }

Analyst estimate entry.

AnalystRecommendationDTO struct#

rust · ignore
pub struct AnalystRecommendationDTO { pub symbol: Option<String>, pub date: Option<String>, pub analyst_ratings_buy: Option<i32>, pub analyst_ratings_hold: Option<i32>, pub analyst_ratings_sell: Option<i32>, pub analyst_ratings_strong_buy: Option<i32>, pub analyst_ratings_strong_sell: Option<i32> }

Analyst recommendation entry.

finance_query::backtesting#

BacktestComparison struct#

rust · ignore
pub struct BacktestComparison {  }

BacktestConfig struct#

rust · ignore
pub struct BacktestConfig { pub initial_capital: f64, pub commission: f64, pub commission_pct: f64, pub slippage_pct: f64, pub position_size_pct: f64, pub max_positions: Option<usize>, pub allow_short: bool, pub min_signal_strength: f64, pub stop_loss_pct: Option<f64>, pub take_profit_pct: Option<f64>, pub close_at_end: bool, pub risk_free_rate: f64, pub trailing_stop_pct: Option<f64>, pub reinvest_dividends: bool, pub bars_per_year: f64, pub spread_pct: f64, pub transaction_tax_pct: f64, pub commission_fn: Option<CommissionFn>, pub max_leverage: f64, pub maintenance_margin_pct: f64, pub short_borrow_rate: f64, pub margin_interest_rate: f64, pub position_sizing: PositionSizing }

BacktestConfigBuilder struct#

rust · ignore
pub struct BacktestConfigBuilder {  }

BacktestEngine struct#

rust · ignore
pub struct BacktestEngine {  }

BacktestError enum#

rust · ignore
pub enum BacktestError { InvalidParameter { param: String, reason: String, }, InsufficientData { need: usize, got: usize, }, StrategyError(String), IndicatorError(#[from] crate::indicators::IndicatorError), ChartError(String), PositionError(String) }

BacktestResult struct#

rust · ignore
pub struct BacktestResult { pub symbol: String, pub strategy_name: String, pub config: BacktestConfig, pub start_timestamp: i64, pub end_timestamp: i64, pub initial_capital: f64, pub final_equity: f64, pub metrics: PerformanceMetrics, pub trades: Vec<Trade>, pub equity_curve: Vec<EquityPoint>, pub signals: Vec<SignalRecord>, pub open_position: Option<Position>, pub benchmark: Option<BenchmarkMetrics>, pub diagnostics: Vec<String>, pub max_leverage_used: f64 }

BayesianSearch struct#

rust · ignore
pub struct BayesianSearch {  }
measured as `finance_query::bt_bayesian_search`
instructions/iter29252482
callgrind Ir/iter29252482
median walltime (ns)3094712
p99 walltime (ns)3146608
allocations/iter2382
allocated bytes/iter2592578

BenchmarkMetrics struct#

rust · ignore
pub struct BenchmarkMetrics { pub symbol: String, pub benchmark_return_pct: f64, pub buy_and_hold_return_pct: f64, pub alpha: f64, pub beta: f64, pub information_ratio: f64, pub tracking_error: f64 }

BollingerMeanReversion struct#

rust · ignore
pub struct BollingerMeanReversion { pub period: usize, pub std_dev: f64, pub exit_at_middle: bool }

ComparisonReport struct#

rust · ignore
pub struct ComparisonReport { pub rows: Vec<ComparisonRow>, pub metric: OptimizeMetric }

ComparisonRow struct#

rust · ignore
pub struct ComparisonRow { pub label: String, pub strategy_name: String, pub symbol: String, pub total_return_pct: f64, pub annualized_return_pct: f64, pub sharpe_ratio: f64, pub sortino_ratio: f64, pub calmar_ratio: f64, pub max_drawdown_pct: f64, pub win_rate: f64, pub profit_factor: f64, pub total_trades: usize, pub kelly_criterion: f64, pub sqn: f64, pub expectancy: f64, pub omega_ratio: f64, pub time_in_market_pct: f64, pub rank_score: f64, pub rank: usize }

DonchianBreakout struct#

rust · ignore
pub struct DonchianBreakout { pub period: usize, pub exit_at_middle: bool }

EnsembleMode enum#

rust · ignore
pub enum EnsembleMode { Unanimous, WeightedMajority, AnySignal, StrongestSignal }

EnsembleStrategy struct#

rust · ignore
pub struct EnsembleStrategy {  }

EquityPoint struct#

rust · ignore
pub struct EquityPoint { pub timestamp: i64, pub equity: f64, pub drawdown_pct: f64 }

GridSearch struct#

rust · ignore
pub struct GridSearch {  }
measured as `finance_query::bt_grid_search`
instructions/iter13085157
callgrind Ir/iter13085157
median walltime (ns)656455
p99 walltime (ns)739562
allocations/iter3012
allocated bytes/iter3101794

MacdSignal struct#

rust · ignore
pub struct MacdSignal { pub fast: usize, pub slow: usize, pub signal: usize }

MonteCarloConfig struct#

rust · ignore
pub struct MonteCarloConfig { pub num_simulations: usize, pub seed: Option<u64>, pub method: MonteCarloMethod }
measured as `finance_query::bt_monte_carlo`
instructions/iter1066998
callgrind Ir/iter1066998
median walltime (ns)179551
p99 walltime (ns)187576
allocations/iter6
allocated bytes/iter16384

MonteCarloMethod enum#

rust · ignore
pub enum MonteCarloMethod { IidShuffle, BlockBootstrap { block_size: usize, }, StationaryBootstrap { mean_block_size: usize, }, Parametric }

MonteCarloResult struct#

rust · ignore
pub struct MonteCarloResult { pub num_simulations: usize, pub method: MonteCarloMethod, pub total_return: PercentileStats, pub max_drawdown: PercentileStats, pub sharpe_ratio: PercentileStats, pub profit_factor: PercentileStats }

OptimizationReport struct#

rust · ignore
pub struct OptimizationReport { pub strategy_name: String, pub total_combinations: usize, pub results: Vec<OptimizationResult>, pub best: OptimizationResult, pub skipped_errors: usize, pub convergence_curve: Vec<f64>, pub n_evaluations: usize }

OptimizationResult struct#

rust · ignore
pub struct OptimizationResult { pub params: HashMap<String, ParamValue>, pub result: BacktestResult }

OptimizeMetric enum#

rust · ignore
pub enum OptimizeMetric { TotalReturn, SharpeRatio, SortinoRatio, CalmarRatio, ProfitFactor, WinRate, MinDrawdown, OmegaRatio, Expectancy }

OrderType enum#

rust · ignore
pub enum OrderType { Market, BuyLimit { limit_price: f64, }, BuyStop { stop_price: f64, }, SellLimit { limit_price: f64, }, SellStop { stop_price: f64, }, BuyStopLimit { stop_price: f64, limit_price: f64, } }

ParamRange enum#

rust · ignore
pub enum ParamRange { IntRange { start: i64, end: i64, step: i64, }, FloatRange { start: f64, end: f64, step: f64, }, Values(Vec<ParamValue>) }

ParamValue enum#

rust · ignore
pub enum ParamValue { Int(i64), Float(f64) }

ParetoPoint struct#

rust · ignore
pub struct ParetoPoint { pub params: HashMap<String, ParamValue>, pub result: BacktestResult, pub scores: Vec<f64> }

ParetoReport struct#

rust · ignore
pub struct ParetoReport { pub strategy_name: String, pub objectives: Vec<OptimizeMetric>, pub front: Vec<ParetoPoint>, pub total_evaluated: usize, pub dominated_count: usize, pub non_finite_count: usize }

PendingOrder struct#

rust · ignore
pub struct PendingOrder { pub signal: Signal, pub order_type: OrderType, pub created_bar: usize, pub expires_in_bars: Option<usize> }

PercentileStats struct#

rust · ignore
pub struct PercentileStats { pub p5: f64, pub p25: f64, pub p50: f64, pub p75: f64, pub p95: f64, pub mean: f64 }

PerformanceMetrics struct#

rust · ignore
pub struct PerformanceMetrics { pub total_return_pct: f64, pub annualized_return_pct: f64, pub sharpe_ratio: f64, pub sortino_ratio: f64, pub max_drawdown_pct: f64, pub max_drawdown_duration: i64, pub win_rate: f64, pub profit_factor: f64, pub avg_trade_return_pct: f64, pub avg_win_pct: f64, pub avg_loss_pct: f64, pub avg_trade_duration: f64, pub total_trades: usize, pub winning_trades: usize, pub losing_trades: usize, pub largest_win: f64, pub largest_loss: f64, pub max_consecutive_wins: usize, pub max_consecutive_losses: usize, pub calmar_ratio: f64, pub total_commission: f64, pub total_financing_cost: f64, pub long_trades: usize, pub short_trades: usize, pub total_signals: usize, pub executed_signals: usize, pub avg_win_duration: f64, pub avg_loss_duration: f64, pub time_in_market_pct: f64, pub max_idle_period: i64, pub total_dividend_income: f64, pub kelly_criterion: f64, pub sqn: f64, pub expectancy: f64, pub omega_ratio: f64, pub tail_ratio: f64, pub recovery_factor: f64, pub ulcer_index: f64, pub serenity_ratio: f64 }

Position struct#

rust · ignore
pub struct Position { pub side: PositionSide, pub entry_timestamp: i64, pub entry_price: f64, pub quantity: f64, pub entry_quantity: f64, pub entry_commission: f64, pub entry_transaction_tax: f64, pub entry_signal: Signal, pub dividend_income: f64, pub unreinvested_dividends: f64, pub scale_in_count: usize, pub partial_close_count: usize, pub bracket_stop_loss_pct: Option<f64>, pub bracket_take_profit_pct: Option<f64>, pub bracket_trailing_stop_pct: Option<f64>, pub financing_cost_accrued: f64 }

PositionExtremes struct#

rust · ignore
pub struct PositionExtremes { pub high: f64, pub low: f64, pub close_high: f64, pub close_low: f64 }

PositionSide enum#

rust · ignore
pub enum PositionSide { Long, Short }

PositionSizing enum#

rust · ignore
pub enum PositionSizing { FixedFraction, Atr { risk_pct: f64, atr_period: usize, atr_multiple: f64, }, VolatilityTarget { target_vol_pct: f64, lookback: usize, }, FractionalKelly { kelly_fraction: f64, lookback_trades: usize, } }

Result type_alias#

rust · ignore
pub type Result<T> = std::result::Result<T, BacktestError>

RsiReversal struct#

rust · ignore
pub struct RsiReversal { pub period: usize, pub oversold: f64, pub overbought: f64 }

Signal struct#

rust · ignore
pub struct Signal { pub direction: SignalDirection, pub strength: SignalStrength, pub timestamp: i64, pub price: f64, pub reason: Option<String>, pub metadata: Option<SignalMetadata>, pub tags: Vec<String>, pub scale_fraction: Option<f64>, pub order_type: OrderType, pub expires_in_bars: Option<usize>, pub bracket_stop_loss_pct: Option<f64>, pub bracket_take_profit_pct: Option<f64>, pub bracket_trailing_stop_pct: Option<f64> }

SignalDirection enum#

rust · ignore
pub enum SignalDirection { Long, Short, Exit, Hold, ScaleIn, ScaleOut }

SignalMetadata struct#

rust · ignore
pub struct SignalMetadata { pub indicators: HashMap<String, f64> }

SignalRecord struct#

rust · ignore
pub struct SignalRecord { pub timestamp: i64, pub price: f64, pub direction: SignalDirection, pub strength: f64, pub reason: Option<String>, pub executed: bool, pub tags: Vec<String> }

SignalStrength struct#

rust · ignore
pub struct SignalStrength(f64)

SizingContext struct#

rust · ignore
pub struct SizingContext { pub atr: Option<f64>, pub recent_volatility: Option<f64>, pub win_rate: Option<f64>, pub payoff_ratio: Option<f64> }

SmaCrossover struct#

rust · ignore
pub struct SmaCrossover { pub fast_period: usize, pub slow_period: usize }

Strategy trait#

rust · ignore
pub trait Strategy: Send + Sync

StrategyBuilder struct#

rust · ignore
pub struct StrategyBuilder<E = (), X = ()> {  }
measured as `finance_query::bt_strategy_builder`
instructions/iter1072307
callgrind Ir/iter1072307
median walltime (ns)165073
p99 walltime (ns)173114
allocations/iter328
allocated bytes/iter265698

StrategyContext struct#

rust · ignore
pub struct StrategyContext<'a> { pub candles: &'a [Candle], pub index: usize, pub position: Option<&'a Position>, pub equity: f64, pub indicators: &'a HashMap<String, Vec<Option<f64>>>, pub extremes: Option<&'a PositionExtremes>, pub indicator_index: Option<usize> }

SuperTrendFollow struct#

rust · ignore
pub struct SuperTrendFollow { pub period: usize, pub multiplier: f64 }

Trade struct#

rust · ignore
pub struct Trade { pub side: PositionSide, pub entry_timestamp: i64, pub exit_timestamp: i64, pub entry_price: f64, pub exit_price: f64, pub quantity: f64, pub entry_quantity: f64, pub commission: f64, pub transaction_tax: f64, pub pnl: f64, pub return_pct: f64, pub dividend_income: f64, pub unreinvested_dividends: f64, pub financing_cost: f64, pub entry_signal: Signal, pub exit_signal: Signal, pub tags: Vec<String>, pub is_partial: bool, pub scale_sequence: usize }

WalkForwardConfig struct#

rust · ignore
pub struct WalkForwardConfig { pub grid: GridSearch, pub config: BacktestConfig, pub in_sample_bars: usize, pub out_of_sample_bars: usize, pub step_bars: Option<usize> }

WalkForwardReport struct#

rust · ignore
pub struct WalkForwardReport { pub strategy_name: String, pub windows: Vec<WindowResult>, pub aggregate_metrics: PerformanceMetrics, pub consistency_ratio: f64, pub optimization_reports: Vec<OptimizationReport> }

WindowResult struct#

rust · ignore
pub struct WindowResult { pub window: usize, pub optimized_params: HashMap<String, ParamValue>, pub in_sample: BacktestResult, pub out_of_sample: BacktestResult }

finance_query::backtesting::comparison::BacktestComparison#

ranked_by function#

rust · ignore
pub fn ranked_by(self, metric: OptimizeMetric) -> ComparisonReport

Rank all added results by metric and return a [ComparisonReport].

Results are sorted best-first (highest score wins for all metrics except [OptimizeMetric::MinDrawdown], which is already negated internally so that a lower drawdown yields a higher score).

finance_query::backtesting::condition#

Above struct#

rust · ignore
pub struct Above<R: IndicatorRef> {  }

AboveRef struct#

rust · ignore
pub struct AboveRef<R1: IndicatorRef, R2: IndicatorRef> {  }

All struct#

rust · ignore
pub struct All<C: Condition> {  }

And struct#

rust · ignore
pub struct And<C1: Condition, C2: Condition> {  }

Any struct#

rust · ignore
pub struct Any<C: Condition> {  }

Below struct#

rust · ignore
pub struct Below<R: IndicatorRef> {  }

BelowRef struct#

rust · ignore
pub struct BelowRef<R1: IndicatorRef, R2: IndicatorRef> {  }

Between struct#

rust · ignore
pub struct Between<R: IndicatorRef> {  }

Condition trait#

rust · ignore
pub trait Condition: Clone + Send + Sync + 'static

A condition that can be evaluated on each candle.

Conditions are the building blocks of trading strategies. They can be combined using and(), or(), and not() operations.

Example#

ignore
use finance_query::backtesting::condition::Condition;

fn my_custom_condition(ctx: &StrategyContext) -> bool {
    // Custom logic here
    true
}

ConditionBuilder struct#

rust · ignore
pub struct ConditionBuilder<C: Condition> {  }

ConstantCondition struct#

rust · ignore
pub struct ConstantCondition(bool)

A condition that always returns the same value.

Useful for testing or as a placeholder.

CrossesAbove struct#

rust · ignore
pub struct CrossesAbove<R: IndicatorRef> {  }

CrossesAboveRef struct#

rust · ignore
pub struct CrossesAboveRef<R1: IndicatorRef, R2: IndicatorRef> {  }

CrossesBelow struct#

rust · ignore
pub struct CrossesBelow<R: IndicatorRef> {  }

CrossesBelowRef struct#

rust · ignore
pub struct CrossesBelowRef<R1: IndicatorRef, R2: IndicatorRef> {  }

Equals struct#

rust · ignore
pub struct Equals<R: IndicatorRef> {  }

HasPosition struct#

rust · ignore
pub struct HasPosition

HeldForBars struct#

rust · ignore
pub struct HeldForBars { pub min_bars: usize }

HtfIndicatorSpec struct#

rust · ignore
pub struct HtfIndicatorSpec { pub interval: Interval, pub htf_key: String, pub base_key: String, pub indicator: Indicator, pub utc_offset_secs: i64 }

Describes an indicator that must be pre-computed on a resampled (HTF) candle series.

Returned by [Condition::htf_requirements] and processed by the engine to build stretched arrays stored in StrategyContext::indicators under htf_key.

InLoss struct#

rust · ignore
pub struct InLoss

InProfit struct#

rust · ignore
pub struct InProfit

IsLong struct#

rust · ignore
pub struct IsLong

IsShort struct#

rust · ignore
pub struct IsShort

NoPosition struct#

rust · ignore
pub struct NoPosition

Not struct#

rust · ignore
pub struct Not<C: Condition> {  }

Or struct#

rust · ignore
pub struct Or<C1: Condition, C2: Condition> {  }

StopLoss struct#

rust · ignore
pub struct StopLoss { pub pct: f64 }

TakeProfit struct#

rust · ignore
pub struct TakeProfit { pub pct: f64 }

TrailingStop struct#

rust · ignore
pub struct TrailingStop { pub trail_pct: f64 }

TrailingTakeProfit struct#

rust · ignore
pub struct TrailingTakeProfit { pub trail_pct: f64 }

always_false function#

rust · ignore
pub fn always_false() -> ConstantCondition

Convenience function to create a condition that always returns false.

measured as `finance_query::cond_bench_always_false`
instructions/iter248425
callgrind Ir/iter248425
median walltime (ns)19439
p99 walltime (ns)20098
allocations/iter6
allocated bytes/iter24257

always_true function#

rust · ignore
pub fn always_true() -> ConstantCondition

Convenience function to create a condition that always returns true.

measured as `finance_query::cond_bench_always_true`
instructions/iter4328542
callgrind Ir/iter4328542
median walltime (ns)427869
p99 walltime (ns)449604
allocations/iter4045
allocated bytes/iter1710867

has_position function#

rust · ignore
pub fn has_position() -> HasPosition
measured as `finance_query::cond_bench_has_position`
instructions/iter4317549
callgrind Ir/iter4317549
median walltime (ns)424658
p99 walltime (ns)436720
allocations/iter4045
allocated bytes/iter1712862

held_for_bars function#

rust · ignore
pub fn held_for_bars(min_bars: usize) -> HeldForBars
measured as `finance_query::cond_bench_held_for_bars`
instructions/iter1509061
callgrind Ir/iter1509061
median walltime (ns)162713
p99 walltime (ns)164283
allocations/iter1041
allocated bytes/iter458837

in_loss function#

rust · ignore
pub fn in_loss() -> InLoss
measured as `finance_query::cond_bench_in_loss`
instructions/iter4354832
callgrind Ir/iter4354832
median walltime (ns)432452
p99 walltime (ns)444269
allocations/iter4045
allocated bytes/iter1702887

in_profit function#

rust · ignore
pub fn in_profit() -> InProfit
measured as `finance_query::cond_bench_in_profit`
instructions/iter553732
callgrind Ir/iter553732
median walltime (ns)49178
p99 walltime (ns)53090
allocations/iter142
allocated bytes/iter88980

is_long function#

rust · ignore
pub fn is_long() -> IsLong
measured as `finance_query::cond_bench_is_long`
instructions/iter4312789
callgrind Ir/iter4312789
median walltime (ns)425943
p99 walltime (ns)439914
allocations/iter4045
allocated bytes/iter1702887

is_short function#

rust · ignore
pub fn is_short() -> IsShort
measured as `finance_query::cond_bench_is_short`
instructions/iter396632
callgrind Ir/iter396632
median walltime (ns)34850
p99 walltime (ns)37847
allocations/iter13
allocated bytes/iter42860

no_position function#

rust · ignore
pub fn no_position() -> NoPosition
measured as `finance_query::cond_bench_no_position`
instructions/iter396632
callgrind Ir/iter396632
median walltime (ns)34846
p99 walltime (ns)36053
allocations/iter13
allocated bytes/iter42860

stop_loss function#

rust · ignore
pub fn stop_loss(pct: f64) -> StopLoss
measured as `finance_query::cond_bench_stop_loss`
instructions/iter451899
callgrind Ir/iter451899
median walltime (ns)42488
p99 walltime (ns)42733
allocations/iter24
allocated bytes/iter43690

take_profit function#

rust · ignore
pub fn take_profit(pct: f64) -> TakeProfit
measured as `finance_query::cond_bench_take_profit`
instructions/iter438554
callgrind Ir/iter438554
median walltime (ns)40503
p99 walltime (ns)40790
allocations/iter13
allocated bytes/iter42860

trailing_stop function#

rust · ignore
pub fn trailing_stop(trail_pct: f64) -> TrailingStop
measured as `finance_query::cond_bench_trailing_stop`
instructions/iter586825
callgrind Ir/iter586825
median walltime (ns)52332
p99 walltime (ns)54777
allocations/iter92
allocated bytes/iter88644

trailing_take_profit function#

rust · ignore
pub fn trailing_take_profit(trail_pct: f64) -> TrailingTakeProfit
measured as `finance_query::cond_bench_trailing_take_profit`
instructions/iter595922
callgrind Ir/iter595922
median walltime (ns)54258
p99 walltime (ns)56895
allocations/iter72
allocated bytes/iter63588

finance_query::backtesting::config::BacktestConfig#

calculate_position_size function#

rust · ignore
pub fn calculate_position_size(&self, available_capital: f64, price: f64) -> f64

Calculate position size based on available capital.

price must be the fully-adjusted entry price (after slippage and spread) so that subsequent fill guards (entry_value + costs > cash) do not over-allocate capital.

When commission_fn is set the commission component cannot be analytically solved for, so only spread and transaction-tax fractions are deducted from the denominator; the fill-rejection guard catches any remaining over-allocation.

finance_query::backtesting::config::builder::BacktestConfigBuilder#

margin_interest_rate function#

rust · ignore
pub fn margin_interest_rate(mut self, rate: f64) -> Self

Set the annual interest rate charged on a debit cash balance.

finance_query::backtesting::config::costs#

CommissionFn struct#

rust · ignore
pub struct CommissionFn(Arc<dyn Fn(f64, f64) -> f64 + Send + Sync>)

A custom commission function: f(size, price) -> commission_amount.

When set on [BacktestConfig] via [BacktestConfigBuilder::commission_fn], it replaces the flat commission + percentage commission_pct fields. Use it to model broker-specific fee schedules such as per-share fees with a minimum, tiered rates, or Robinhood-style zero-commission structures.

Example#

use finance_query::backtesting::BacktestConfig;

// IB-style: $0.005 per share, minimum $1.00 per order
let config = BacktestConfig::builder()
    .commission_fn(|size, price| (size * 0.005_f64).max(1.00))
    .build()
    .unwrap();

finance_query::backtesting::engine::BacktestEngine#

run_with_dividends function#

rust · ignore
pub fn run_with_dividends<S: Strategy>( &self, symbol: &str, candles: &[Candle], strategy: S, dividends: &[Dividend], ) -> Result<BacktestResult>

Run a backtest and credit dividend income for any dividends paid while a position is open.

dividends should be sorted by timestamp (ascending). The engine credits each dividend whose ex-date falls on or before the current candle bar. When [BacktestConfig::reinvest_dividends] is true, the income is also used to notionally purchase additional shares at the ex-date close price.

finance_query::backtesting::optimizer::ParamRange#

float_bounds function#

rust · ignore
pub fn float_bounds(start: f64, end: f64) -> Self

Continuous float bounds — [BayesianSearch] only.

A step of 0.0 intentionally makes [GridSearch] return an error, giving a clear signal when the wrong optimiser is used with this range type.

float_range function#

rust · ignore
pub fn float_range(start: f64, end: f64, step: f64) -> Self

Stepped float range — compatible with both [GridSearch] and [BayesianSearch].

int_bounds function#

rust · ignore
pub fn int_bounds(start: i64, end: i64) -> Self

Continuous integer bounds for [BayesianSearch].

Equivalent to int_range(start, end, 1). Also usable with [GridSearch] (enumerates every integer in [start, end]), but prefer int_range with a wider step when the grid would be very large.

int_range function#

rust · ignore
pub fn int_range(start: i64, end: i64, step: i64) -> Self

Stepped integer range — compatible with both [GridSearch] and [BayesianSearch].

finance_query::backtesting::optimizer::grid::GridSearch#

run function#

rust · ignore
pub fn run<S, F>( &self, symbol: &str, candles: &[Candle], config: &BacktestConfig, factory: F, ) -> Result<OptimizationReport> where S: Strategy + Send, F: Fn(&HashMap<String, ParamValue>) -> S + Send + Sync,

Run the grid search.

symbol is used only for labelling in the returned results.

factory receives the current parameter map and returns a strategy instance. Combinations that exceed the strategy's warmup period are silently skipped.

Returns an error when the grid is empty or all combinations were skipped.

finance_query::backtesting::portfolio#

AllocationSnapshot struct#

rust · ignore
pub struct AllocationSnapshot { pub timestamp: i64, pub cash: f64, pub positions: HashMap<String, f64> }

PortfolioConfig struct#

rust · ignore
pub struct PortfolioConfig { pub base: BacktestConfig, pub max_allocation_per_symbol: Option<f64>, pub max_total_positions: Option<usize>, pub rebalance: RebalanceMode }

PortfolioEngine struct#

rust · ignore
pub struct PortfolioEngine {  }

PortfolioResult struct#

rust · ignore
pub struct PortfolioResult { pub symbols: HashMap<String, BacktestResult>, pub portfolio_equity_curve: Vec<EquityPoint>, pub portfolio_metrics: PerformanceMetrics, pub initial_capital: f64, pub final_equity: f64, pub allocation_history: Vec<AllocationSnapshot> }

RebalanceMode enum#

rust · ignore
pub enum RebalanceMode { AvailableCapital, EqualWeight, CustomWeights(HashMap<String, f64>) }

SymbolData struct#

rust · ignore
pub struct SymbolData { pub symbol: String, pub candles: Vec<Candle>, pub dividends: Vec<Dividend> }

finance_query::backtesting::position::Position#

close function#

rust · ignore
pub fn close( self, exit_timestamp: i64, exit_price: f64, exit_commission: f64, exit_signal: Signal, ) -> Trade

Close this position and create a Trade.

dividend_income accumulated during the hold is added to P&L and preserved on the returned Trade for reporting purposes.

partial_close function#

rust · ignore
pub fn partial_close( &mut self, fraction: f64, exit_ts: i64, exit_price: f64, commission: f64, exit_tax: f64, signal: Signal, ) -> Trade

Partially close this position and return a completed [Trade].

Closes fraction of the current position quantity, allocating a proportional share of accumulated entry costs and dividend income to the trade P&L. The remaining position stays open with reduced quantity, dividend balances, and entry cost bases.

[Trade::is_partial] is true for all trades returned by this method. For a full close prefer Position::close (or the crate-internal close_with_tax for tax-aware exits), which sets is_partial = false. The engine's scale_out_position delegates fraction >= 1.0 to close_position for exactly this reason.

The caller is responsible for updating cash from the returned trade's exit proceeds.

Arguments#

scale_in function#

rust · ignore
pub fn scale_in( &mut self, fill_price: f64, additional_qty: f64, commission: f64, entry_tax: f64, )

Add shares to this position (pyramid / scale-in).

Updates the weighted-average entry_price and entry_quantity to reflect the blended cost basis and increments scale_in_count. The caller is responsible for debiting the entry cost from available cash and for applying slippage/spread to fill_price before calling this method.

Arguments#

finance_query::backtesting::refs#

AccumulationDistributionRef struct#

rust · ignore
pub struct AccumulationDistributionRef

AdxRef struct#

rust · ignore
pub struct AdxRef { pub period: usize }

AlmaConfig struct#

rust · ignore
pub struct AlmaConfig { pub period: usize, pub offset: f64, pub sigma: f64 }

AlmaRef struct#

rust · ignore
pub struct AlmaRef { pub period: usize, pub offset: f64, pub sigma: f64 }

AroonConfig struct#

rust · ignore
pub struct AroonConfig { pub period: usize }

AroonDownRef struct#

rust · ignore
pub struct AroonDownRef { pub period: usize }

AroonUpRef struct#

rust · ignore
pub struct AroonUpRef { pub period: usize }

AtrRef struct#

rust · ignore
pub struct AtrRef { pub period: usize }

AwesomeOscillatorRef struct#

rust · ignore
pub struct AwesomeOscillatorRef { pub fast: usize, pub slow: usize }

BalanceOfPowerRef struct#

rust · ignore
pub struct BalanceOfPowerRef { pub period: Option<usize> }

BearPowerRef struct#

rust · ignore
pub struct BearPowerRef { pub period: usize }

BollingerConfig struct#

rust · ignore
pub struct BollingerConfig { pub period: usize, pub std_dev: f64 }

BollingerLowerRef struct#

rust · ignore
pub struct BollingerLowerRef { pub period: usize, pub std_dev: f64 }

BollingerMiddleRef struct#

rust · ignore
pub struct BollingerMiddleRef { pub period: usize, pub std_dev: f64 }

BollingerUpperRef struct#

rust · ignore
pub struct BollingerUpperRef { pub period: usize, pub std_dev: f64 }

BullPowerRef struct#

rust · ignore
pub struct BullPowerRef { pub period: usize }

CandleBody struct#

rust · ignore
pub struct CandleBody

CandleRange struct#

rust · ignore
pub struct CandleRange

CciRef struct#

rust · ignore
pub struct CciRef { pub period: usize }

ChaikinOscillatorRef struct#

rust · ignore
pub struct ChaikinOscillatorRef

ChoppinessIndexRef struct#

rust · ignore
pub struct ChoppinessIndexRef { pub period: usize }

ClosePrice struct#

rust · ignore
pub struct ClosePrice

CmfRef struct#

rust · ignore
pub struct CmfRef { pub period: usize }

CmoRef struct#

rust · ignore
pub struct CmoRef { pub period: usize }

CoppockCurveRef struct#

rust · ignore
pub struct CoppockCurveRef { pub wma_period: usize, pub long_roc: usize, pub short_roc: usize }

DemaRef struct#

rust · ignore
pub struct DemaRef { pub period: usize }

DonchianConfig struct#

rust · ignore
pub struct DonchianConfig { pub period: usize }

DonchianLowerRef struct#

rust · ignore
pub struct DonchianLowerRef { pub period: usize }

DonchianMiddleRef struct#

rust · ignore
pub struct DonchianMiddleRef { pub period: usize }

DonchianUpperRef struct#

rust · ignore
pub struct DonchianUpperRef { pub period: usize }

ElderBearPowerRef struct#

rust · ignore
pub struct ElderBearPowerRef { pub period: usize }

ElderBullPowerRef struct#

rust · ignore
pub struct ElderBullPowerRef { pub period: usize }

EmaRef struct#

rust · ignore
pub struct EmaRef { pub period: usize }

GapPct struct#

rust · ignore
pub struct GapPct

HighPrice struct#

rust · ignore
pub struct HighPrice

HmaRef struct#

rust · ignore
pub struct HmaRef { pub period: usize }

HtfCondition struct#

rust · ignore
pub struct HtfCondition<C: Condition> {  }

IchimokuBaseRef struct#

rust · ignore
pub struct IchimokuBaseRef { pub conversion: usize, pub base: usize, pub lagging: usize, pub displacement: usize }

IchimokuConfig struct#

rust · ignore
pub struct IchimokuConfig { pub conversion: usize, pub base: usize, pub lagging: usize, pub displacement: usize }

IchimokuConversionRef struct#

rust · ignore
pub struct IchimokuConversionRef { pub conversion: usize, pub base: usize, pub lagging: usize, pub displacement: usize }

IchimokuLaggingRef struct#

rust · ignore
pub struct IchimokuLaggingRef { pub conversion: usize, pub base: usize, pub lagging: usize, pub displacement: usize }

IchimokuLeadingARef struct#

rust · ignore
pub struct IchimokuLeadingARef { pub conversion: usize, pub base: usize, pub lagging: usize, pub displacement: usize }

IchimokuLeadingBRef struct#

rust · ignore
pub struct IchimokuLeadingBRef { pub conversion: usize, pub base: usize, pub lagging: usize, pub displacement: usize }

IndicatorRef trait#

rust · ignore
pub trait IndicatorRef: Clone + Send + Sync + 'static

A reference to a value that can be compared in conditions.

This is the building block for creating conditions. Each indicator reference knows:

Implementing Custom References#

ignore
use finance_query::backtesting::refs::IndicatorRef;

#[derive(Clone)]
struct MyCustomRef {
    period: usize,
}

impl IndicatorRef for MyCustomRef {
    fn key(&self) -> &str {
        "my_custom_14" // pre-computed at construction time
    }

    fn required_indicators(&self) -> Vec<(String, Indicator)> {
        vec![(self.key().to_string(), Indicator::Sma(self.period))]
    }

    fn value(&self, ctx: &StrategyContext) -> Option<f64> {
        ctx.indicator(self.key())
    }

    fn prev_value(&self, ctx: &StrategyContext) -> Option<f64> {
        ctx.indicator_prev(self.key())
    }
}

IndicatorRefExt trait#

rust · ignore
pub trait IndicatorRefExt: IndicatorRef + Sized

Extension trait that adds condition-building methods to all indicator references.

This trait provides a fluent API for building conditions from indicator values. It is automatically implemented for all types that implement IndicatorRef.

Example#

ignore
use finance_query::backtesting::refs::*;

// All these methods are available on any IndicatorRef
let cond1 = rsi(14).above(70.0);
let cond2 = rsi(14).below(30.0);
let cond3 = rsi(14).crosses_above(30.0);
let cond4 = rsi(14).crosses_below(70.0);
let cond5 = rsi(14).between(30.0, 70.0);
let cond6 = sma(10).above_ref(sma(20));
let cond7 = sma(10).crosses_above_ref(sma(20));

IsBearish struct#

rust · ignore
pub struct IsBearish

IsBullish struct#

rust · ignore
pub struct IsBullish

KeltnerConfig struct#

rust · ignore
pub struct KeltnerConfig { pub period: usize, pub multiplier: f64, pub atr_period: usize }

KeltnerLowerRef struct#

rust · ignore
pub struct KeltnerLowerRef { pub period: usize, pub multiplier: f64, pub atr_period: usize }

KeltnerMiddleRef struct#

rust · ignore
pub struct KeltnerMiddleRef { pub period: usize, pub multiplier: f64, pub atr_period: usize }

KeltnerUpperRef struct#

rust · ignore
pub struct KeltnerUpperRef { pub period: usize, pub multiplier: f64, pub atr_period: usize }

LowPrice struct#

rust · ignore
pub struct LowPrice

MacdConfig struct#

rust · ignore
pub struct MacdConfig { pub fast: usize, pub slow: usize, pub signal: usize }

MacdHistogramRef struct#

rust · ignore
pub struct MacdHistogramRef { pub fast: usize, pub slow: usize, pub signal: usize }

MacdLineRef struct#

rust · ignore
pub struct MacdLineRef { pub fast: usize, pub slow: usize, pub signal: usize }

MacdSignalRef struct#

rust · ignore
pub struct MacdSignalRef { pub fast: usize, pub slow: usize, pub signal: usize }

McginleyDynamicRef struct#

rust · ignore
pub struct McginleyDynamicRef { pub period: usize }

MedianPrice struct#

rust · ignore
pub struct MedianPrice

MfiRef struct#

rust · ignore
pub struct MfiRef { pub period: usize }

MomentumRef struct#

rust · ignore
pub struct MomentumRef { pub period: usize }

ObvRef struct#

rust · ignore
pub struct ObvRef

OpenPrice struct#

rust · ignore
pub struct OpenPrice

ParabolicSarConfig struct#

rust · ignore
pub struct ParabolicSarConfig { pub step: f64, pub max: f64 }

ParabolicSarRef struct#

rust · ignore
pub struct ParabolicSarRef { pub step: f64, pub max: f64 }

PriceChangePct struct#

rust · ignore
pub struct PriceChangePct

RelativeVolume struct#

rust · ignore
pub struct RelativeVolume { pub period: usize }

RocRef struct#

rust · ignore
pub struct RocRef { pub period: usize }

RsiRef struct#

rust · ignore
pub struct RsiRef { pub period: usize }

SmaRef struct#

rust · ignore
pub struct SmaRef { pub period: usize }

StochasticConfig struct#

rust · ignore
pub struct StochasticConfig { pub k_period: usize, pub k_slow: usize, pub d_period: usize }

StochasticDRef struct#

rust · ignore
pub struct StochasticDRef { pub k_period: usize, pub k_slow: usize, pub d_period: usize }

StochasticKRef struct#

rust · ignore
pub struct StochasticKRef { pub k_period: usize, pub k_slow: usize, pub d_period: usize }

StochasticRsiConfig struct#

rust · ignore
pub struct StochasticRsiConfig { pub rsi_period: usize, pub stoch_period: usize, pub k_period: usize, pub d_period: usize }

StochasticRsiDRef struct#

rust · ignore
pub struct StochasticRsiDRef { pub rsi_period: usize, pub stoch_period: usize, pub k_period: usize, pub d_period: usize }

StochasticRsiRef struct#

rust · ignore
pub struct StochasticRsiRef { pub rsi_period: usize, pub stoch_period: usize, pub k_period: usize, pub d_period: usize }

SupertrendConfig struct#

rust · ignore
pub struct SupertrendConfig { pub period: usize, pub multiplier: f64 }

SupertrendUptrendRef struct#

rust · ignore
pub struct SupertrendUptrendRef { pub period: usize, pub multiplier: f64 }

SupertrendValueRef struct#

rust · ignore
pub struct SupertrendValueRef { pub period: usize, pub multiplier: f64 }

TemaRef struct#

rust · ignore
pub struct TemaRef { pub period: usize }

TrueRangeRef struct#

rust · ignore
pub struct TrueRangeRef

TypicalPrice struct#

rust · ignore
pub struct TypicalPrice

VolumeRef struct#

rust · ignore
pub struct VolumeRef

VwapRef struct#

rust · ignore
pub struct VwapRef

VwmaRef struct#

rust · ignore
pub struct VwmaRef { pub period: usize }

WilliamsRRef struct#

rust · ignore
pub struct WilliamsRRef { pub period: usize }

WmaRef struct#

rust · ignore
pub struct WmaRef { pub period: usize }

accumulation_distribution function#

rust · ignore
pub fn accumulation_distribution() -> AccumulationDistributionRef
measured as `finance_query::ref_bench_accumulation_distribution`
instructions/iter569200
callgrind Ir/iter569200
median walltime (ns)51392
p99 walltime (ns)51825
allocations/iter23
allocated bytes/iter73469

adx function#

rust · ignore
pub fn adx(period: usize) -> AdxRef
measured as `finance_query::ref_bench_adx`
instructions/iter5303321
callgrind Ir/iter5303321
median walltime (ns)528624
p99 walltime (ns)540359
allocations/iter4930
allocated bytes/iter1765123

alma function#

rust · ignore
pub fn alma(period: usize, offset: f64, sigma: f64) -> AlmaRef
measured as `finance_query::ref_bench_alma`
instructions/iter5892195
callgrind Ir/iter5892195
median walltime (ns)562921
p99 walltime (ns)603891
allocations/iter5019
allocated bytes/iter1772359

aroon function#

rust · ignore
pub fn aroon(period: usize) -> AroonConfig
measured as `finance_query::ref_bench_aroon`
instructions/iter5646577
callgrind Ir/iter5646577
median walltime (ns)523842
p99 walltime (ns)540469
allocations/iter4950
allocated bytes/iter1795683

atr function#

rust · ignore
pub fn atr(period: usize) -> AtrRef
measured as `finance_query::ref_bench_atr`
instructions/iter5540288
callgrind Ir/iter5540288
median walltime (ns)529623
p99 walltime (ns)565583
allocations/iter4996
allocated bytes/iter1773994

awesome_oscillator function#

rust · ignore
pub fn awesome_oscillator(fast: usize, slow: usize) -> AwesomeOscillatorRef
measured as `finance_query::ref_bench_awesome_oscillator`
instructions/iter3084773
callgrind Ir/iter3084773
median walltime (ns)324492
p99 walltime (ns)329740
allocations/iter2636
allocated bytes/iter1742627

balance_of_power function#

rust · ignore
pub fn balance_of_power(period: Option<usize>) -> BalanceOfPowerRef
measured as `finance_query::ref_bench_balance_of_power`
instructions/iter574518
callgrind Ir/iter574518
median walltime (ns)49723
p99 walltime (ns)51445
allocations/iter25
allocated bytes/iter81476

bear_power function#

rust · ignore
pub fn bear_power(period: usize) -> BearPowerRef
measured as `finance_query::ref_bench_bear_power`
instructions/iter1535967
callgrind Ir/iter1535967
median walltime (ns)145146
p99 walltime (ns)151738
allocations/iter806
allocated bytes/iter516030

bollinger function#

rust · ignore
pub fn bollinger(period: usize, std_dev: f64) -> BollingerConfig
measured as `finance_query::ref_bench_bollinger`
instructions/iter6095689
callgrind Ir/iter6095689
median walltime (ns)561729
p99 walltime (ns)570933
allocations/iter4968
allocated bytes/iter1834706

bull_power function#

rust · ignore
pub fn bull_power(period: usize) -> BullPowerRef
measured as `finance_query::ref_bench_bull_power`
instructions/iter5296640
callgrind Ir/iter5296640
median walltime (ns)500552
p99 walltime (ns)521100
allocations/iter4238
allocated bytes/iter1792914

candle_body function#

rust · ignore
pub fn candle_body() -> CandleBody
measured as `finance_query::ref_bench_candle_body`
instructions/iter252407
callgrind Ir/iter252407
median walltime (ns)19749
p99 walltime (ns)20261
allocations/iter6
allocated bytes/iter24257

candle_range function#

rust · ignore
pub fn candle_range() -> CandleRange
measured as `finance_query::ref_bench_candle_range`
instructions/iter5160149
callgrind Ir/iter5160149
median walltime (ns)493579
p99 walltime (ns)504840
allocations/iter5043
allocated bytes/iter1743801

cci function#

rust · ignore
pub fn cci(period: usize) -> CciRef
measured as `finance_query::ref_bench_cci`
instructions/iter3250756
callgrind Ir/iter3250756
median walltime (ns)315602
p99 walltime (ns)333841
allocations/iter2605
allocated bytes/iter927343

chaikin_oscillator function#

rust · ignore
pub fn chaikin_oscillator() -> ChaikinOscillatorRef
measured as `finance_query::ref_bench_chaikin_oscillator`
instructions/iter643692
callgrind Ir/iter643692
median walltime (ns)66288
p99 walltime (ns)71101
allocations/iter26
allocated bytes/iter97417

choppiness_index function#

rust · ignore
pub fn choppiness_index(period: usize) -> ChoppinessIndexRef
measured as `finance_query::ref_bench_choppiness_index`
instructions/iter5810247
callgrind Ir/iter5810247
median walltime (ns)547940
p99 walltime (ns)556700
allocations/iter5002
allocated bytes/iter1767649

close function#

rust · ignore
pub fn close() -> ClosePrice
measured as `finance_query::ref_bench_close`
instructions/iter5184975
callgrind Ir/iter5184975
median walltime (ns)505231
p99 walltime (ns)537187
allocations/iter5043
allocated bytes/iter1724839

cmf function#

rust · ignore
pub fn cmf(period: usize) -> CmfRef
measured as `finance_query::ref_bench_cmf`
instructions/iter584657
callgrind Ir/iter584657
median walltime (ns)50597
p99 walltime (ns)53391
allocations/iter25
allocated bytes/iter81493

cmo function#

rust · ignore
pub fn cmo(period: usize) -> CmoRef
measured as `finance_query::ref_bench_cmo`
instructions/iter3077572
callgrind Ir/iter3077572
median walltime (ns)300438
p99 walltime (ns)303939
allocations/iter2598
allocated bytes/iter911276

coppock_curve function#

rust · ignore
pub fn coppock_curve(wma_period: usize, long_roc: usize, short_roc: usize) -> CoppockCurveRef
measured as `finance_query::ref_bench_coppock_curve`
instructions/iter3336766
callgrind Ir/iter3336766
median walltime (ns)316866
p99 walltime (ns)333968
allocations/iter2559
allocated bytes/iter935478

dema function#

rust · ignore
pub fn dema(period: usize) -> DemaRef
measured as `finance_query::ref_bench_dema`
instructions/iter5489782
callgrind Ir/iter5489782
median walltime (ns)539925
p99 walltime (ns)555133
allocations/iter4875
allocated bytes/iter1764809

donchian function#

rust · ignore
pub fn donchian(period: usize) -> DonchianConfig
measured as `finance_query::ref_bench_donchian`
instructions/iter5991142
callgrind Ir/iter5991142
median walltime (ns)573177
p99 walltime (ns)582654
allocations/iter4976
allocated bytes/iter1839378

elder_bear_power function#

rust · ignore
pub fn elder_bear_power(period: usize) -> ElderBearPowerRef
measured as `finance_query::ref_bench_elder_bear_power`
instructions/iter1534663
callgrind Ir/iter1534663
median walltime (ns)144826
p99 walltime (ns)150327
allocations/iter806
allocated bytes/iter516030

elder_bull_power function#

rust · ignore
pub fn elder_bull_power(period: usize) -> ElderBullPowerRef
measured as `finance_query::ref_bench_elder_bull_power`
instructions/iter5208960
callgrind Ir/iter5208960
median walltime (ns)508550
p99 walltime (ns)526136
allocations/iter4238
allocated bytes/iter1792914

ema function#

rust · ignore
pub fn ema(period: usize) -> EmaRef
measured as `finance_query::ref_bench_ema`
instructions/iter5391691
callgrind Ir/iter5391691
median walltime (ns)529900
p99 walltime (ns)548989
allocations/iter4963
allocated bytes/iter1749648

gap_pct function#

rust · ignore
pub fn gap_pct() -> GapPct
measured as `finance_query::ref_bench_gap_pct`
instructions/iter2493054
callgrind Ir/iter2493054
median walltime (ns)263917
p99 walltime (ns)276251
allocations/iter2489
allocated bytes/iter877279

high function#

rust · ignore
pub fn high() -> HighPrice
measured as `finance_query::ref_bench_high`
instructions/iter5185933
callgrind Ir/iter5185933
median walltime (ns)497917
p99 walltime (ns)505508
allocations/iter5043
allocated bytes/iter1723841

hma function#

rust · ignore
pub fn hma(period: usize) -> HmaRef
measured as `finance_query::ref_bench_hma`
instructions/iter5398160
callgrind Ir/iter5398160
median walltime (ns)537898
p99 walltime (ns)546210
allocations/iter4957
allocated bytes/iter1780946

htf function#

rust · ignore
pub fn htf<C: Condition>(interval: Interval, cond: C) -> HtfCondition<C>
measured as `finance_query::ref_bench_htf`
instructions/iter6523089
callgrind Ir/iter6523089
median walltime (ns)626255
p99 walltime (ns)643895
allocations/iter7039
allocated bytes/iter1776735

htf_region function#

rust · ignore
pub fn htf_region<C: Condition>(interval: Interval, region: Region, cond: C) -> HtfCondition<C>
measured as `finance_query::ref_bench_htf_region`
instructions/iter6415079
callgrind Ir/iter6415079
median walltime (ns)619807
p99 walltime (ns)630587
allocations/iter7039
allocated bytes/iter1776735

ichimoku function#

rust · ignore
pub fn ichimoku() -> IchimokuConfig
measured as `finance_query::ref_bench_ichimoku`
instructions/iter6304056
callgrind Ir/iter6304056
median walltime (ns)604789
p99 walltime (ns)635609
allocations/iter4836
allocated bytes/iter1915384

ichimoku_custom function#

rust · ignore
pub fn ichimoku_custom( conversion: usize, base: usize, lagging: usize, displacement: usize, ) -> IchimokuConfig
measured as `finance_query::ref_bench_ichimoku_custom`
instructions/iter6329068
callgrind Ir/iter6329068
median walltime (ns)602331
p99 walltime (ns)625571
allocations/iter4836
allocated bytes/iter1915384

is_bearish function#

rust · ignore
pub fn is_bearish() -> IsBearish
measured as `finance_query::ref_bench_is_bearish`
instructions/iter253406
callgrind Ir/iter253406
median walltime (ns)19498
p99 walltime (ns)19747
allocations/iter6
allocated bytes/iter24257

is_bullish function#

rust · ignore
pub fn is_bullish() -> IsBullish
measured as `finance_query::ref_bench_is_bullish`
instructions/iter253406
callgrind Ir/iter253406
median walltime (ns)19459
p99 walltime (ns)20267
allocations/iter6
allocated bytes/iter24257

keltner function#

rust · ignore
pub fn keltner(period: usize, multiplier: f64, atr_period: usize) -> KeltnerConfig
measured as `finance_query::ref_bench_keltner`
instructions/iter5829939
callgrind Ir/iter5829939
median walltime (ns)588228
p99 walltime (ns)601690
allocations/iter4972
allocated bytes/iter1870394

low function#

rust · ignore
pub fn low() -> LowPrice
measured as `finance_query::ref_bench_low`
instructions/iter5188927
callgrind Ir/iter5188927
median walltime (ns)494558
p99 walltime (ns)501150
allocations/iter5043
allocated bytes/iter1722843

macd function#

rust · ignore
pub fn macd(fast: usize, slow: usize, signal: usize) -> MacdConfig
measured as `finance_query::ref_bench_macd`
instructions/iter3316295
callgrind Ir/iter3316295
median walltime (ns)331810
p99 walltime (ns)353676
allocations/iter2541
allocated bytes/iter984571

mcginley function#

rust · ignore
pub fn mcginley(period: usize) -> McginleyDynamicRef
measured as `finance_query::ref_bench_mcginley`
instructions/iter5507025
callgrind Ir/iter5507025
median walltime (ns)529339
p99 walltime (ns)542279
allocations/iter4963
allocated bytes/iter1763384

median_price function#

rust · ignore
pub fn median_price() -> MedianPrice
measured as `finance_query::ref_bench_median_price`
instructions/iter5161147
callgrind Ir/iter5161147
median walltime (ns)492678
p99 walltime (ns)526995
allocations/iter5043
allocated bytes/iter1743801

mfi function#

rust · ignore
pub fn mfi(period: usize) -> MfiRef
measured as `finance_query::ref_bench_mfi`
instructions/iter5592350
callgrind Ir/iter5592350
median walltime (ns)531266
p99 walltime (ns)547349
allocations/iter4998
allocated bytes/iter1790098

momentum function#

rust · ignore
pub fn momentum(period: usize) -> MomentumRef
measured as `finance_query::ref_bench_momentum`
instructions/iter3101455
callgrind Ir/iter3101455
median walltime (ns)302114
p99 walltime (ns)309882
allocations/iter2552
allocated bytes/iter909675

obv function#

rust · ignore
pub fn obv() -> ObvRef
measured as `finance_query::ref_bench_obv`
instructions/iter627692
callgrind Ir/iter627692
median walltime (ns)59892
p99 walltime (ns)62132
allocations/iter30
allocated bytes/iter76095

open function#

rust · ignore
pub fn open() -> OpenPrice
measured as `finance_query::ref_bench_open`
instructions/iter5185933
callgrind Ir/iter5185933
median walltime (ns)507204
p99 walltime (ns)520329
allocations/iter5043
allocated bytes/iter1723841

parabolic_sar function#

rust · ignore
pub fn parabolic_sar(step: f64, max: f64) -> ParabolicSarRef
measured as `finance_query::ref_bench_parabolic_sar`
instructions/iter5841105
callgrind Ir/iter5841105
median walltime (ns)569887
p99 walltime (ns)576056
allocations/iter5056
allocated bytes/iter1788988

price function#

rust · ignore
pub fn price() -> ClosePrice
measured as `finance_query::ref_bench_price`
instructions/iter5184975
callgrind Ir/iter5184975
median walltime (ns)503634
p99 walltime (ns)510437
allocations/iter5043
allocated bytes/iter1724839

price_change_pct function#

rust · ignore
pub fn price_change_pct() -> PriceChangePct
measured as `finance_query::ref_bench_price_change_pct`
instructions/iter2913726
callgrind Ir/iter2913726
median walltime (ns)286513
p99 walltime (ns)295084
allocations/iter2489
allocated bytes/iter893407

relative_volume function#

rust · ignore
pub fn relative_volume(period: usize) -> RelativeVolume
measured as `finance_query::ref_bench_relative_volume`
instructions/iter5667955
callgrind Ir/iter5667955
median walltime (ns)542570
p99 walltime (ns)550345
allocations/iter4949
allocated bytes/iter1765562

roc function#

rust · ignore
pub fn roc(period: usize) -> RocRef
measured as `finance_query::ref_bench_roc`
instructions/iter2908624
callgrind Ir/iter2908624
median walltime (ns)296984
p99 walltime (ns)324766
allocations/iter2587
allocated bytes/iter903142

rsi function#

rust · ignore
pub fn rsi(period: usize) -> RsiRef
measured as `finance_query::ref_bench_rsi`
instructions/iter5536798
callgrind Ir/iter5536798
median walltime (ns)525402
p99 walltime (ns)534979
allocations/iter4994
allocated bytes/iter1757986

sma function#

rust · ignore
pub fn sma(period: usize) -> SmaRef
measured as `finance_query::ref_bench_sma`
instructions/iter5395607
callgrind Ir/iter5395607
median walltime (ns)519814
p99 walltime (ns)538943
allocations/iter4963
allocated bytes/iter1749648

stochastic function#

rust · ignore
pub fn stochastic(k_period: usize, k_slow: usize, d_period: usize) -> StochasticConfig
measured as `finance_query::ref_bench_stochastic`
instructions/iter6142286
callgrind Ir/iter6142286
median walltime (ns)589511
p99 walltime (ns)624519
allocations/iter4987
allocated bytes/iter1851282

stochastic_rsi function#

rust · ignore
pub fn stochastic_rsi( rsi_period: usize, stoch_period: usize, k_period: usize, d_period: usize, ) -> StochasticRsiConfig
measured as `finance_query::ref_bench_stochastic_rsi`
instructions/iter5996370
callgrind Ir/iter5996370
median walltime (ns)579395
p99 walltime (ns)595268
allocations/iter4831
allocated bytes/iter1846555

supertrend function#

rust · ignore
pub fn supertrend(period: usize, multiplier: f64) -> SupertrendConfig
measured as `finance_query::ref_bench_supertrend`
instructions/iter6014891
callgrind Ir/iter6014891
median walltime (ns)577923
p99 walltime (ns)599122
allocations/iter5021
allocated bytes/iter1860896

tema function#

rust · ignore
pub fn tema(period: usize) -> TemaRef
measured as `finance_query::ref_bench_tema`
instructions/iter5396266
callgrind Ir/iter5396266
median walltime (ns)520639
p99 walltime (ns)554686
allocations/iter4781
allocated bytes/iter1770909

true_range function#

rust · ignore
pub fn true_range() -> TrueRangeRef
measured as `finance_query::ref_bench_true_range`
instructions/iter5333039
callgrind Ir/iter5333039
median walltime (ns)530151
p99 walltime (ns)538533
allocations/iter5059
allocated bytes/iter1777061

typical_price function#

rust · ignore
pub fn typical_price() -> TypicalPrice
measured as `finance_query::ref_bench_typical_price`
instructions/iter5602419
callgrind Ir/iter5602419
median walltime (ns)535083
p99 walltime (ns)568308
allocations/iter5043
allocated bytes/iter1747793

volume function#

rust · ignore
pub fn volume() -> VolumeRef
measured as `finance_query::ref_bench_volume`
instructions/iter5185957
callgrind Ir/iter5185957
median walltime (ns)493726
p99 walltime (ns)518866
allocations/iter5043
allocated bytes/iter1725837

vwap function#

rust · ignore
pub fn vwap() -> VwapRef
measured as `finance_query::ref_bench_vwap`
instructions/iter5625003
callgrind Ir/iter5625003
median walltime (ns)525121
p99 walltime (ns)536348
allocations/iter5060
allocated bytes/iter1773061

vwma function#

rust · ignore
pub fn vwma(period: usize) -> VwmaRef
measured as `finance_query::ref_bench_vwma`
instructions/iter5353837
callgrind Ir/iter5353837
median walltime (ns)527642
p99 walltime (ns)540182
allocations/iter4964
allocated bytes/iter1758633

williams_r function#

rust · ignore
pub fn williams_r(period: usize) -> WilliamsRRef
measured as `finance_query::ref_bench_williams_r`
instructions/iter744939
callgrind Ir/iter744939
median walltime (ns)60896
p99 walltime (ns)65801
allocations/iter29
allocated bytes/iter65983

wma function#

rust · ignore
pub fn wma(period: usize) -> WmaRef
measured as `finance_query::ref_bench_wma`
instructions/iter5481344
callgrind Ir/iter5481344
median walltime (ns)524870
p99 walltime (ns)538108
allocations/iter4969
allocated bytes/iter1772256

finance_query::backtesting::refs::oscillators::StochasticRsiConfig#

d function#

rust · ignore
pub fn d(&self) -> StochasticRsiDRef

Reference to the %D signal line (SMA of %K).

k function#

rust · ignore
pub fn k(&self) -> StochasticRsiRef

Reference to the smoothed %K line.

finance_query::backtesting::resample#

base_to_htf_index function#

rust · ignore
pub fn base_to_htf_index(base_candles: &[Candle], htf_candles: &[Candle]) -> Vec<Option<usize>>

Map each base-timeframe index to the most recently completed HTF bar index.

A "completed" HTF bar is one whose timestamp (the last constituent bar's timestamp) is less than or equal to the current base bar's timestamp. Using <= rather than < ensures that on the final bar of an HTF period (e.g. a Friday close for a weekly bar), the engine can immediately see the now-finalized HTF candle. Using < would introduce an artificial one-bar delay: on Friday, htf.timestamp == base.timestamp, so < fails and the engine falls back to the prior week's data even though the weekly bar is already complete.

htf_candles must have been produced by [resample] with the same utc_offset_secs used for the base series so that bucket boundaries are consistent.

Returns None for bars where no HTF bar has completed yet (e.g. during the first HTF period).

measured as `finance_query::bt_base_to_htf_index`
instructions/iter321100
callgrind Ir/iter321100
median walltime (ns)27729
p99 walltime (ns)29749
allocations/iter1
allocated bytes/iter262144

resample function#

rust · ignore
pub fn resample(candles: &[Candle], interval: Interval, utc_offset_secs: i64) -> Vec<Candle>

Resample candles from their base timeframe to interval.

utc_offset_secs shifts each candle's timestamp into the exchange's local time before computing calendar bucket boundaries (weekly Monday start, month boundary, etc.). Pass 0 for UTC-aligned bucketing (default for US markets). Use Region::utc_offset_secs to obtain the correct value for non-US exchanges.

Notes#

measured as `finance_query::bt_resample`
instructions/iter1437605
callgrind Ir/iter1437605
median walltime (ns)104449
p99 walltime (ns)107174
allocations/iter11
allocated bytes/iter589536

finance_query::backtesting::result::BacktestResult#

by_day_of_week function#

rust · ignore
pub fn by_day_of_week(&self) -> HashMap<Weekday, PerformanceMetrics>

Performance metrics broken down by day of week.

Each trade is attributed to the weekday on which it closed (exit_timestamp). Only weekdays present in the trade log appear in the result. Trades and equity-curve points with timestamps that cannot be converted to a valid date are silently skipped.

Sharpe / Sortino annualisation#

The equity curve is filtered to bars that fall on each specific weekday, so consecutive equity points in each slice are roughly one week apart (for a daily-bar backtest). bars_per_year is inferred from the calendar span of each slice so that annualisation matches the actual sampling frequency — you do not need to adjust the config. The inferred value is approximately 52 for daily bars, 12 for weekly bars, and so on.

Other caveats#

The same open-position and signal-count caveats from by_year apply here.

by_month function#

rust · ignore
pub fn by_month(&self) -> HashMap<(i32, u32), PerformanceMetrics>

Performance metrics broken down by calendar month.

Each trade is attributed to the (year, month) in which it closed. Uses the same equity-slicing approach as by_year; the same caveats about open positions, partial periods, and signal counts apply here as well.

by_year function#

rust · ignore
pub fn by_year(&self) -> HashMap<i32, PerformanceMetrics>

Performance metrics broken down by calendar year.

Each trade is attributed to the year in which it closed (exit_timestamp). The equity curve is sliced to the bars that fall within that calendar year, and the equity at the first bar of the year serves as initial_capital for the period metrics.

Years with no closed trades are omitted from the result.

Caveats#

finance_query::backtesting::result::metrics::PerformanceMetrics#

max_drawdown_percentage function#

rust · ignore
pub fn max_drawdown_percentage(&self) -> f64

Maximum drawdown as a conventional percentage (0–100).

Equivalent to self.max_drawdown_pct * 100.0. Provided because max_drawdown_pct is stored as a fraction (0.0–1.0) while most other return fields use true percentages.

finance_query::backtesting::signal::Signal#

exit function#

rust · ignore
pub fn exit(timestamp: i64, price: f64) -> Self

Create an exit signal

scale_in function#

rust · ignore
pub fn scale_in(fraction: f64, timestamp: i64, price: f64) -> Self

Create a scale-in signal — add to an existing position.

fraction is the portion of current portfolio equity to allocate to the additional shares. Must be in 0.0..=1.0; values outside this range are clamped by the engine. Has no effect if no position is currently open.

Example#

rust,no_run
use finance_query::backtesting::Signal;

// In a custom Strategy::on_candle implementation:
# let (ctx_timestamp, ctx_price) = (0i64, 0.0f64);
// Add 10% of current equity to the existing long position.
let signal = Signal::scale_in(0.10, ctx_timestamp, ctx_price);

scale_out function#

rust · ignore
pub fn scale_out(fraction: f64, timestamp: i64, price: f64) -> Self

Create a scale-out signal — partially exit an existing position.

fraction is the portion of the current position quantity to close. Must be in 0.0..=1.0; values outside this range are clamped. A fraction of 1.0 closes the entire position (equivalent to [Signal::exit]). Has no effect if no position is currently open.

Example#

rust,no_run
use finance_query::backtesting::Signal;

// In a custom Strategy::on_candle implementation:
# let (ctx_timestamp, ctx_price) = (0i64, 0.0f64);
// Close half the current position to lock in partial profits.
let signal = Signal::scale_out(0.50, ctx_timestamp, ctx_price);

finance_query::backtesting::strategy#

CustomStrategy struct#

rust · ignore
pub struct CustomStrategy<E: Condition, X: Condition> {  }

finance_query::backtesting::strategy::StrategyContext#

crossed_above function#

rust · ignore
pub fn crossed_above(&self, fast_name: &str, slow_name: &str) -> bool

Check if crossover occurred (fast crosses above slow)

indicator function#

rust · ignore
pub fn indicator(&self, name: &str) -> Option<f64>

Get indicator value at current index

indicator_crossed_above function#

rust · ignore
pub fn indicator_crossed_above(&self, name: &str, threshold: f64) -> bool

Check if indicator crossed above a threshold.

Returns true when prev <= threshold and current > threshold. The inclusive lower bound (<=) means a signal fires even when the previous bar sat exactly on the threshold, the same inclusive-previous convention crossed_above uses for indicator-vs-indicator crossings.

indicator_prev function#

rust · ignore
pub fn indicator_prev(&self, name: &str) -> Option<f64>

Get indicator value at previous index

finance_query::backtesting::strategy::builder::StrategyBuilder#

regime_filter function#

rust · ignore
pub fn regime_filter<C: Condition>(mut self, condition: C) -> Self

Set a market regime filter.

When set, entry signals (long and short) are suppressed on any bar where the filter evaluates to false. Exit signals are never blocked by the regime filter, ensuring open positions can always be closed regardless of market conditions.

The regime filter's indicators are included in required_indicators() and therefore pre-computed by the engine like any other indicator.

Example#

rust,no_run
use finance_query::backtesting::strategy::StrategyBuilder;
use finance_query::backtesting::refs::*;

// Only trade when price is above the 200-period SMA
let strategy = StrategyBuilder::new("Trend Following")
    .regime_filter(sma(200).above_ref(sma(400)))
    .entry(ema(10).crosses_above_ref(ema(30)))
    .exit(ema(10).crosses_below_ref(ema(30)))
    .build();

finance_query::backtesting::strategy::ensemble::EnsembleStrategy#

add function#

rust · ignore
pub fn add<S: Strategy + 'static>(mut self, strategy: S, weight: f64) -> Self

Add a sub-strategy with the given weight.

Weight is only meaningful for [EnsembleMode::WeightedMajority]; other modes ignore it. Negative weights are treated as zero.

build function#

rust · ignore
pub fn build(self) -> Self

Finalise the ensemble. Returns self (all configuration happens in the builder methods).

mode function#

rust · ignore
pub fn mode(mut self, mode: EnsembleMode) -> Self

Set the voting mode.

finance_query::backtesting::walk_forward::WalkForwardConfig#

new function#

rust · ignore
pub fn new(grid: GridSearch, config: BacktestConfig) -> Self

Create a new walk-forward config.

Defaults: in_sample_bars = 252, out_of_sample_bars = 63, step_bars = None.

run function#

rust · ignore
pub fn run<S, F>( &self, symbol: &str, candles: &[Candle], factory: F, ) -> Result<WalkForwardReport> where S: Strategy + Clone + Send, F: Fn(&HashMap<String, ParamValue>) -> S, F: Send + Sync,

Run the walk-forward test.

symbol is used only for labelling. factory receives the parameter map selected by each in-sample optimisation and must return a fresh strategy instance.

Returns an error if there is not enough data for at least one complete window pair, or if the grid search or the out-of-sample simulation fails on any window (fail-fast — a partial result is never returned).

finance_query::cftc#

commitments_of_traders function#

rust · ignore
pub async fn fetch_commitments_of_traders_response(symbol: &str) -> Result<CommitmentsOfTraders>

finance_query::constants::enums::interval::Interval#

as_str function#

rust · ignore
pub fn as_str(&self) -> &'static str

Convert interval to Yahoo Finance API format

finance_query::constants::enums::region::Region#

utc_offset_secs function#

rust · ignore
pub const fn utc_offset_secs(&self) -> i64

UTC offset in seconds for the region's primary exchange.

Returns the standard-time (non-DST) UTC offset of each country's main exchange. This is used by the backtesting engine to align higher-timeframe resampling bucket boundaries to local calendar weeks and months, preventing APAC and other non-UTC exchanges from having bars mis-bucketed into the prior week due to UTC midnight falling inside their local trading day.

Note#

DST transitions are not modelled. For exchanges in regions with DST (e.g. NYSE, LSE) the boundary shift is at most ±1 hour and affects only the transition candles. This is a deliberate simplification — exact DST handling would require a timezone database dependency.

finance_query::constants::enums::time_range::TimeRange#

as_str function#

rust · ignore
pub fn as_str(&self) -> &'static str

Convert time range to Yahoo Finance API format

default_interval function#

rust · ignore
pub fn default_interval(&self) -> Interval

A sensible default candle interval for this range, used by the history(range) convenience on domain handles: finer granularity for short ranges, coarser for long ones.

finance_query::constants::industries::Industry#

as_slug function#

rust · ignore
pub fn as_slug(self) -> &'static str

Returns the lowercase hyphenated slug used by finance::industry().

Example#

use finance_query::Industry;
assert_eq!(Industry::Semiconductors.as_slug(), "semiconductors");
assert_eq!(Industry::SoftwareApplication.as_slug(), "software-application");

finance_query::crypto#

CoinQuote struct#

rust · ignore
pub struct CoinQuote { pub id: String, pub symbol: String, pub name: String, pub current_price: Option<f64>, pub market_cap: Option<f64>, pub price_change_percentage_24h: Option<f64>, pub total_volume: Option<f64>, pub circulating_supply: Option<f64>, pub image: Option<String>, pub market_cap_rank: Option<u32> }
measured as `finance_query::de_crypto_coins`
instructions/iter346280
callgrind Ir/iter346280
median walltime (ns)32822
p99 walltime (ns)36644
allocations/iter205
allocated bytes/iter28185

GlobalCryptoStats struct#

rust · ignore
pub struct GlobalCryptoStats { pub active_cryptocurrencies: Option<u32>, pub markets: Option<u32>, pub total_market_cap_usd: Option<f64>, pub total_volume_usd: Option<f64>, pub btc_dominance: Option<f64>, pub eth_dominance: Option<f64>, pub market_cap_change_percentage_24h_usd: Option<f64> }

TrendingCoin struct#

rust · ignore
pub struct TrendingCoin { pub id: Option<String>, pub symbol: Option<String>, pub name: Option<String>, pub market_cap_rank: Option<u32>, pub price_btc: Option<f64>, pub score: Option<u32> }

coin function#

rust · ignore
pub async fn coin(id: &str, vs_currency: &str) -> Result<CoinQuote>

coins function#

rust · ignore
pub async fn coins(vs_currency: &str, count: usize) -> Result<Vec<CoinQuote>>

global function#

rust · ignore
pub async fn fetch_crypto_global_response() -> Result<crate::models::crypto::GlobalCryptoStats>

search function#

rust · ignore
pub async fn fetch_symbol_search_response(query: &str, limit: u32) -> Result<Vec<SymbolMatch>>
rust · ignore
pub async fn fetch_crypto_trending_response() -> Result<Vec<crate::models::crypto::TrendingCoin>>

finance_query::defi#

ChainAllocation struct#

rust · ignore
pub struct ChainAllocation { pub chain: String, pub tvl: f64 }

ChainTvl struct#

rust · ignore
pub struct ChainTvl { pub name: String, pub token_symbol: Option<String>, pub gecko_id: Option<String>, pub chain_id: Option<i64>, pub tvl: Option<f64> }

ProtocolTvl struct#

rust · ignore
pub struct ProtocolTvl { pub slug: String, pub name: Option<String>, pub symbol: Option<String>, pub url: Option<String>, pub chains: Vec<String>, pub tvl: Option<f64>, pub tvl_by_chain: Vec<ChainAllocation>, pub change_1d_percent: Option<f64>, pub change_7d_percent: Option<f64>, pub market_cap: Option<f64> }

StablecoinSupply struct#

rust · ignore
pub struct StablecoinSupply { pub name: String, pub symbol: Option<String>, pub gecko_id: Option<String>, pub peg_type: Option<String>, pub peg_mechanism: Option<String>, pub circulating: Option<f64>, pub circulating_prev_day: Option<f64>, pub circulating_prev_week: Option<f64>, pub circulating_prev_month: Option<f64> }

TvlPoint struct#

rust · ignore
pub struct TvlPoint { pub timestamp: i64, pub tvl: f64 }

chains function#

rust · ignore
pub async fn chains() -> Result<Vec<ChainTvl>>

Fetch aggregate total value locked for every chain, largest first.

stablecoins function#

rust · ignore
pub async fn stablecoins() -> Result<Vec<StablecoinSupply>>

Fetch circulating supply for every tracked stablecoin, largest first.

Supplies are denominated in the coin's pegged asset — read peg_type before summing across coins pegged to different currencies.

finance_query::domains::commodities::Commodity#

quote function#

rust · ignore
pub async fn quote(&self) -> Result<crate::models::commodities::CommodityQuote>

Fetch the current quote for this commodity.

finance_query::domains::crypto::CryptoCoin#

quote function#

rust · ignore
pub async fn quote(&self, vs_currency: &str) -> Result<crate::models::crypto::CryptoQuote>

Fetch the current quote for this coin priced in vs_currency (e.g., "usd").

tvl function#

rust · ignore
pub async fn tvl(&self) -> Result<crate::models::crypto::defi::ProtocolTvl>

Fetch total value locked for this handle read as a DeFi protocol slug (e.g. providers.crypto("aave")).

Routed through Capability::CRYPTO; only DefiLlama serves it, so route CRYPTO to include Provider::DefiLlama. The id is a protocol slug here, not a coin id — most DefiLlama slugs happen to match their CoinGecko id, but not all do. The response is cached on the handle, so a repeat call costs nothing.

tvl_history function#

rust · ignore
pub async fn tvl_history(&self) -> Result<Vec<crate::models::crypto::defi::TvlPoint>>

Fetch this protocol's full TVL history, oldest first.

Same routing and slug semantics as tvl.

finance_query::domains::discovery::Discovery#

delisted_stocks_page function#

rust · ignore
pub async fn delisted_stocks_page( &self, limit: u32, cursor: Option<&crate::PageCursor>, ) -> Result<crate::ProviderPage<SymbolMatch>>

Fetch one delisted-stock page of 1–100 rows. Persist the returned cursor with the records and pass it back with the same limit.

search function#

rust · ignore
pub async fn search(&self, query: &str, limit: u32) -> Result<Vec<SymbolMatch>>

Search the configured providers' symbol universe.

Results are cached per (query, limit) pair.

finance_query::domains::economic::EconomicCatalog#

treasury_auctions function#

rust · ignore
pub async fn treasury_auctions( &self, query: &TreasuryAuctionQuery, ) -> Result<Vec<TreasuryAuction>>

Fetch US Treasury securities auctions matching query, most recent auction date first.

Covers auctions from announcement onwards, so the newest rows carry their terms with the result figures still unset. US Treasury FiscalData is the only provider.

finance_query::domains::economic::EconomicIndicator#

series function#

rust · ignore
pub async fn series(&self) -> Result<crate::models::economic::EconomicSeries>

Fetch the full data series for this economic indicator.

finance_query::domains::filings::Filings#

get function#

rust · ignore
pub async fn get(&self) -> Result<crate::models::filings::ProviderFilings>

Fetch SEC filings for this symbol.

search_all function#

rust · ignore
pub async fn search_all( &self, query: &str, filters: crate::models::filings::FilingSearchFilters, ) -> Result<Vec<crate::models::filings::FilingSearchHit>>

Full-text search across every filer via the FILINGS route (currently EDGAR only). Not cached.

Searches filing text, so it answers "which filings mention this" rather than "what has this company filed" — the query shape get cannot express.

finance_query::domains::forex::ForexPair#

quote function#

rust · ignore
pub async fn quote(&self) -> Result<crate::models::forex::ForexQuote>

Fetch the current exchange rate for this currency pair.

finance_query::domains::futures::FuturesContract#

commitments_of_traders function#

rust · ignore
pub async fn commitments_of_traders( &self, ) -> Result<crate::models::futures::cot::CommitmentsOfTraders>

Fetch weekly CFTC Commitments of Traders positioning for this futures contract — long/short/spread broken down by trader category (commercial hedgers, swap dealers, managed money, other reportables, small traders).

Routed through Capability::FUTURES; only Provider::Cftc serves it, so route FUTURES to include it. CFTC covers physical commodities only (agriculture, energy, metals) via the disaggregated futures-only report — the symbol is either a recognised Yahoo-style continuous futures root ("GC=F", "CL=F", …) or a raw CFTC cftc_contract_market_code passed straight through.

finance_query::domains::indices::Index#

constituents function#

rust · ignore
pub async fn constituents(&self) -> Result<Vec<crate::models::indices::IndexConstituent>>

Fetch the index's current constituents (major indices only). Not cached — constituent lists change rarely but the call is uncommon.

finance_query::domains::market::Market#

crypto_global function#

rust · ignore
pub async fn crypto_global(&self) -> Result<crate::models::crypto::GlobalCryptoStats>

Fetch aggregate global cryptocurrency market statistics.

Routes through Capability::CRYPTO. Currently CoinGecko only.

rust · ignore
pub async fn crypto_trending(&self) -> Result<Vec<crate::models::crypto::TrendingCoin>>

Fetch coins/nfts/categories trending in the last 24h.

Routes through Capability::CRYPTO. Currently CoinGecko only.

grouped_daily function#

rust · ignore
pub async fn grouped_daily(&self, date: &str) -> Result<Vec<(String, Candle)>>

Fetch grouped daily OHLCV bars for every stock ticker on date (YYYY-MM-DD) in one call — "give me every ticker's OHLC for this date" rather than one symbol at a time.

Routes through Capability::CHART (the same capability backing per-symbol chart methods) rather than MARKET, since it's OHLCV data rather than a performance statistic. Currently Polygon only. Not cached — one date is one request either way.

finance_query::edgar#

archive function#

rust · ignore
pub async fn archive(url: &str) -> Result<Vec<u8>>

company_facts function#

rust · ignore
pub async fn company_facts(cik: u64) -> Result<CompanyFacts>

filing_index function#

rust · ignore
pub async fn filing_index(accession_number: &str) -> Result<EdgarFilingIndex>

init function#

rust · ignore
pub fn init(email: impl Into<String>) -> Result<()>

init_with_config function#

rust · ignore
pub fn init_with_config( email: impl Into<String>, app_name: impl Into<String>, timeout: Duration, ) -> Result<()>

init_with_rate function#

rust · ignore
pub fn init_with_rate( email: impl Into<String>, app_name: impl Into<String>, timeout: Duration, requests_per_second: f64, ) -> Result<()>

resolve_cik function#

rust · ignore
pub async fn resolve_cik(symbol: &str) -> Result<u64>

search function#

rust · ignore
pub async fn search( query: &str, forms: Option<&[&str]>, start_date: Option<&str>, end_date: Option<&str>, from: Option<usize>, size: Option<usize>, ) -> Result<EdgarSearchResults>

submissions function#

rust · ignore
pub async fn submissions(cik: u64) -> Result<EdgarSubmissions>

finance_query::feeds#

FeedEntry struct#

rust · ignore
pub struct FeedEntry { pub title: String, pub url: String, pub published: Option<String>, pub summary: Option<String>, pub source: String }

A single entry from an RSS/Atom feed.

FeedSource enum#

rust · ignore
pub enum FeedSource { FederalReserve, SecPressReleases, SecFilings(String), MarketWatch, Cnbc, Bloomberg, FinancialTimes, NytBusiness, GuardianBusiness, Investing, Bea, Ecb, Cfpb, WsjMarkets, Fortune, BusinessWire, CoinDesk, CoinTelegraph, TechCrunch, HackerNews, OilPrice, CalculatedRisk, Scmp, NikkeiAsia, BankOfEngland, VentureBeat, YCombinator, TheEconomist, FinancialPost, FtLex, RitholtzBigPicture, Custom(String) }

A named or custom RSS/Atom feed source.

fetch function#

rust · ignore
pub async fn fetch(source: FeedSource) -> Result<Vec<FeedEntry>>

Fetch and parse a single feed source.

Returns an empty Vec (not an error) when the feed is reachable but empty.

fetch_all function#

rust · ignore
pub async fn fetch_all(sources: impl IntoIterator<Item = FeedSource>) -> Result<Vec<FeedEntry>>

Fetch multiple feed sources concurrently and merge the results.

Results are deduplicated by URL and sorted newest-first when dates are available. Feeds that fail individually are skipped (not propagated as errors).

A single reqwest::Client is shared across all concurrent fetches within this call, reusing connection pools and TLS state.

parse_bytes function#

rust · ignore
pub fn parse_bytes(bytes: &[u8], source_name: &str) -> Result<Vec<FeedEntry>>

Parse already-fetched RSS/Atom bytes into entries, without a network round-trip.

Used internally by [fetch]/[fetch_all]; also useful for callers that fetch feed bytes through their own HTTP client/cache/proxy, and for offline parsing benchmarks/tests.

measured as `finance_query::rss_parse`
instructions/iter64637
callgrind Ir/iter64637
median walltime (ns)6038
p99 walltime (ns)6445
allocations/iter48
allocated bytes/iter3714

finance_query::feeds::FeedSource#

url function#

rust · ignore
pub fn url(&self) -> String

Return the URL for this feed source.

finance_query::finance#

currencies function#

rust · ignore
pub async fn currencies() -> Result<Vec<crate::models::market::currencies::Currency>>

Get list of available currencies

Returns currency information from Yahoo Finance.

Examples#

no_run
use finance_query::finance;

# async fn example() -> Result<(), Box<dyn std::error::Error>> {
let currencies = finance::currencies().await?;
# Ok(())
# }

custom_screener function#

rust · ignore
pub async fn custom_screener<F: crate::models::discovery::screeners::ScreenerField>( query: crate::models::discovery::screeners::ScreenerQuery<F>, ) -> Result<ScreenerResults>

Execute a custom screener query

Allows flexible filtering of stocks/funds/ETFs based on various criteria. Use [EquityScreenerQuery][crate::EquityScreenerQuery] for stock screeners or [FundScreenerQuery][crate::FundScreenerQuery] for mutual fund screeners.

Arguments#

Examples#

no_run
use finance_query::{finance, EquityField, EquityScreenerQuery, ScreenerFieldExt};

# async fn example() -> Result<(), Box<dyn std::error::Error>> {
// Find US large-cap stocks with high volume
let query = EquityScreenerQuery::new()
    .size(25)
    .sort_by(EquityField::IntradayMarketCap, false)
    .add_condition(EquityField::Region.eq_str("us"))
    .add_condition(EquityField::AvgDailyVol3M.gt(200_000.0))
    .add_condition(EquityField::IntradayMarketCap.gt(10_000_000_000.0));

let result = finance::custom_screener(query).await?;
println!("Found {} stocks", result.quotes.len());
# Ok(())
# }

earnings_transcript function#

rust · ignore
pub async fn earnings_transcript( symbol: &str, quarter: Option<&str>, year: Option<i32>, ) -> Result<Transcript>

Get earnings transcript for a symbol

Fetches the earnings call transcript, handling all the complexity internally:

  1. Gets the company ID (quartrId) from the quote_type endpoint
  2. Scrapes available earnings calls
  3. Fetches the requested transcript

Arguments#

Examples#

no_run
use finance_query::finance;

# async fn example() -> Result<(), Box<dyn std::error::Error>> {
// Get the latest transcript
let latest = finance::earnings_transcript("AAPL", None, None).await?;
println!("Quarter: {} {}", latest.quarter(), latest.year());

// Get a specific quarter
let q4_2024 = finance::earnings_transcript("AAPL", Some("Q4"), Some(2024)).await?;
# Ok(())
# }

earnings_transcripts function#

rust · ignore
pub async fn earnings_transcripts( symbol: &str, limit: Option<usize>, ) -> Result<Vec<TranscriptWithMeta>>

Get all earnings transcripts for a symbol

Fetches transcripts for all available earnings calls.

Arguments#

Examples#

no_run
use finance_query::finance;

# async fn example() -> Result<(), Box<dyn std::error::Error>> {
// Get all transcripts
let all = finance::earnings_transcripts("AAPL", None).await?;

// Get only the 5 most recent
let recent = finance::earnings_transcripts("AAPL", Some(5)).await?;
for t in &recent {
    println!("{}: {} {}", t.title, t.transcript.quarter(), t.transcript.year());
}
# Ok(())
# }

exchanges function#

rust · ignore
pub async fn exchanges() -> Result<Vec<crate::models::market::exchanges::Exchange>>

Get list of supported exchanges

Scrapes the Yahoo Finance help page for a list of supported exchanges with their symbol suffixes and data delay information.

Examples#

no_run
use finance_query::finance;

# async fn example() -> Result<(), Box<dyn std::error::Error>> {
let exchanges = finance::exchanges().await?;
for exchange in &exchanges {
    println!("{} - {} ({})", exchange.country, exchange.market, exchange.suffix);
}
# Ok(())
# }

fear_and_greed function#

rust · ignore
pub async fn fear_and_greed() -> Result<crate::models::sentiment::FearAndGreed>

Fetch the current CNN Fear & Greed Index from Alternative.me.

Returns a 0–100 sentiment score and its classification. No API key required.

Examples#

no_run
use finance_query::finance;

# async fn example() -> Result<(), Box<dyn std::error::Error>> {
let fg = finance::fear_and_greed().await?;
println!("Fear & Greed: {} ({})", fg.value, fg.classification.as_str());
# Ok(())
# }

fear_and_greed_crypto function#

rust · ignore
pub async fn fear_and_greed_crypto( limit: u32, ) -> Result<Vec<crate::models::sentiment::FearAndGreed>>

Fetch the crypto Fear & Greed Index from Alternative.me — current value plus up to limit - 1 historical readings (newest first).

Alternative.me's index specifically tracks crypto (Bitcoin) market sentiment from volatility, momentum, social media, dominance, and Google Trends signals. No API key required.

Arguments#

Examples#

no_run
use finance_query::finance;

# async fn example() -> Result<(), Box<dyn std::error::Error>> {
let history = finance::fear_and_greed_crypto(7).await?;
let latest = &history[0];
println!("Crypto Fear & Greed: {} ({})", latest.value, latest.classification.as_str());
# Ok(())
# }

hours function#

rust · ignore
pub async fn hours(region: Option<Region>) -> Result<crate::models::market::hours::MarketHours>

Get market hours/status

Returns the current status for various markets.

Arguments#

Examples#

no_run
use finance_query::{finance, Region};

# async fn example() -> Result<(), Box<dyn std::error::Error>> {
// Get US market hours (default)
let hours = finance::hours(None).await?;

// Get Japan market hours
let jp_hours = finance::hours(Some(Region::Japan)).await?;
# Ok(())
# }

indices function#

rust · ignore
pub async fn indices( region: Option<crate::constants::indices::Region>, ) -> Result<crate::tickers::BatchQuotesResponse>

Get world market indices quotes

Returns quotes for major world indices, optionally filtered by region.

Arguments#

Examples#

no_run
use finance_query::{finance, IndicesRegion};

# async fn example() -> Result<(), Box<dyn std::error::Error>> {
// Get all world indices
let all = finance::indices(None).await?;
println!("Fetched {} indices", all.success_count());

// Get only Americas indices
let americas = finance::indices(Some(IndicesRegion::Americas)).await?;
# Ok(())
# }

industry function#

rust · ignore
pub async fn industry(industry_key: impl AsRef<str>) -> Result<IndustryData>

Fetch detailed industry data from Yahoo Finance

Returns comprehensive industry information including overview, performance, top companies, top performing companies, top growth companies, and research reports.

Arguments#

Examples#

no_run
use finance_query::finance;

# async fn example() -> Result<(), Box<dyn std::error::Error>> {
let industry = finance::industry("semiconductors").await?;
println!("Industry: {} ({} companies)", industry.name,
    industry.overview.as_ref().map(|o| o.companies_count.unwrap_or(0)).unwrap_or(0));

for company in industry.top_companies.iter().take(5) {
    println!("  {} - {:?}", company.symbol, company.name);
}
# Ok(())
# }

lookup function#

rust · ignore
pub async fn lookup( query: &str, options: &LookupOptions, ) -> Result<crate::models::discovery::lookup::LookupResults>

Look up symbols by type (equity, ETF, mutual fund, index, future, currency, cryptocurrency)

Unlike search, lookup specializes in discovering tickers filtered by asset type. Optionally fetches logo URLs via an additional API call.

Arguments#

Examples#

no_run
use finance_query::{finance, LookupOptions, LookupType, Region};

# async fn example() -> Result<(), Box<dyn std::error::Error>> {
// Simple lookup with defaults
let results = finance::lookup("Apple", &LookupOptions::default()).await?;
println!("Found {} results", results.result_count());

// Lookup equities with logos
let options = LookupOptions::new()
    .lookup_type(LookupType::Equity)
    .count(10)
    .include_logo(true);
let results = finance::lookup("NVDA", &options).await?;
for quote in &results.quotes {
    println!("{}: {:?}", quote.symbol, quote.logo_url);
}
# Ok(())
# }

market_summary function#

rust · ignore
pub async fn market_summary( region: Option<Region>, ) -> Result<Vec<crate::models::market::market_summary::MarketSummaryQuote>>

Get market summary

Returns market summary with major indices, currencies, and commodities.

Arguments#

Examples#

no_run
use finance_query::{finance, Region};

# async fn example() -> Result<(), Box<dyn std::error::Error>> {
// Use default (US)
let summary = finance::market_summary(None).await?;
// Or specify a region
let summary = finance::market_summary(Some(Region::Canada)).await?;
# Ok(())
# }

news function#

rust · ignore
pub async fn news() -> Result<Vec<crate::models::corporate::news::News>>

Get general market news

Examples#

no_run
use finance_query::finance;

# async fn example() -> Result<(), Box<dyn std::error::Error>> {
let news = finance::news().await?;
for article in news {
    println!("{}: {}", article.source, article.title);
}
# Ok(())
# }

screener function#

rust · ignore
pub async fn screener(screener_type: Screener, count: u32) -> Result<ScreenerResults>

Fetch data from a predefined Yahoo Finance screener

Returns stocks/funds matching the criteria of the specified screener type.

Arguments#

Examples#

no_run
use finance_query::{finance, Screener};

# async fn example() -> Result<(), Box<dyn std::error::Error>> {
// Get top gainers
let gainers = finance::screener(Screener::DayGainers, 25).await?;
println!("Top gainers: {:#?}", gainers);

// Get most shorted stocks
let shorted = finance::screener(Screener::MostShortedStocks, 25).await?;

// Get growth technology stocks
let tech = finance::screener(Screener::GrowthTechnologyStocks, 25).await?;
# Ok(())
# }

search function#

rust · ignore
pub async fn search(query: &str, options: &SearchOptions) -> Result<SearchResults>

Search for stock symbols and companies

Arguments#

Examples#

no_run
use finance_query::{finance, SearchOptions, Region};

# async fn example() -> Result<(), Box<dyn std::error::Error>> {
// Simple search with defaults
let results = finance::search("Apple", &SearchOptions::default()).await?;
println!("Found {} results", results.result_count());

// Search with custom options
let options = SearchOptions::new()
    .quotes_count(10)
    .news_count(5)
    .enable_research_reports(true)
    .region(Region::Canada);
let results = finance::search("NVDA", &options).await?;
println!("Found {} quotes", results.quotes.len());
# Ok(())
# }

sector function#

rust · ignore
pub async fn sector(sector_type: Sector) -> Result<SectorData>

Fetch detailed sector data from Yahoo Finance

Returns comprehensive sector information including overview, performance, top companies, ETFs, mutual funds, industries, and research reports.

Arguments#

Examples#

no_run
use finance_query::{finance, Sector};

# async fn example() -> Result<(), Box<dyn std::error::Error>> {
let sector = finance::sector(Sector::Technology).await?;
println!("Sector: {} ({} companies)", sector.name,
    sector.overview.as_ref().map(|o| o.companies_count.unwrap_or(0)).unwrap_or(0));

for company in sector.top_companies.iter().take(5) {
    println!("  {} - {:?}", company.symbol, company.name);
}
# Ok(())
# }
rust · ignore
pub async fn trending( region: Option<Region>, ) -> Result<Vec<crate::models::discovery::trending::TrendingQuote>>

Get trending tickers for a region

Returns trending stocks for a specific region.

Arguments#

Examples#

no_run
use finance_query::{finance, Region};

# async fn example() -> Result<(), Box<dyn std::error::Error>> {
// Use default (US)
let trending = finance::trending(None).await?;
// Or specify a region
let trending = finance::trending(Some(Region::Canada)).await?;
# Ok(())
# }

finance_query::fmp#

init function#

rust · ignore
pub fn init(api_key: impl Into<String>) -> Result<()>

init_with_timeout function#

rust · ignore
pub fn init_with_timeout(api_key: impl Into<String>, timeout: Duration) -> Result<()>

finance_query::format#

Both struct#

rust · ignore
pub struct Both

Pretty struct#

rust · ignore
pub struct Pretty

Raw struct#

rust · ignore
pub struct Raw

finance_query::fred#

MacroObservation struct#

rust · ignore
pub struct MacroObservation { pub date: String, pub value: Option<f64> }

MacroSeries struct#

rust · ignore
pub struct MacroSeries { pub id: String, pub observations: Vec<MacroObservation> }
measured as `finance_query::de_fred_series`
instructions/iter1039714
callgrind Ir/iter1039714
median walltime (ns)103823
p99 walltime (ns)104754
allocations/iter873
allocated bytes/iter90398

ReleaseDate struct#

rust · ignore
pub struct ReleaseDate { pub release_id: u64, pub release_name: String, pub date: String }

TreasuryYield struct#

rust · ignore
pub struct TreasuryYield { pub date: String, pub y1m: Option<f64>, pub y2m: Option<f64>, pub y3m: Option<f64>, pub y4m: Option<f64>, pub y6m: Option<f64>, pub y1: Option<f64>, pub y2: Option<f64>, pub y3: Option<f64>, pub y5: Option<f64>, pub y7: Option<f64>, pub y10: Option<f64>, pub y20: Option<f64>, pub y30: Option<f64> }
measured as `finance_query::de_treasury_yields`
instructions/iter765954
callgrind Ir/iter765954
median walltime (ns)76255
p99 walltime (ns)77681
allocations/iter119
allocated bytes/iter59594

release_dates function#

rust · ignore
pub async fn release_dates() -> Result<Vec<ReleaseDate>>

series function#

rust · ignore
pub async fn series(series_id: &str) -> Result<MacroSeries>

treasury_yields function#

rust · ignore
pub async fn treasury_yields(year: u32) -> Result<Vec<TreasuryYield>>

finance_query::gdelt#

news function#

rust · ignore
pub async fn fetch_news_response(symbol: &str) -> Result<Vec<News>>

finance_query::indicators#

AroonResult struct#

rust · ignore
pub struct AroonResult { pub aroon_up: Vec<Option<f64>>, pub aroon_down: Vec<Option<f64>> }

DonchianChannelsResult struct#

rust · ignore
pub struct DonchianChannelsResult { pub upper: Vec<Option<f64>>, pub middle: Vec<Option<f64>>, pub lower: Vec<Option<f64>> }

ElderRayResult struct#

rust · ignore
pub struct BullBearPowerResult { pub bull_power: Vec<Option<f64>>, pub bear_power: Vec<Option<f64>> }

FibonacciLevels struct#

rust · ignore
pub struct FibonacciLevels { pub swing_high: f64, pub swing_low: f64, pub level_23_6: f64, pub level_38_2: f64, pub level_50: f64, pub level_61_8: f64, pub level_78_6: f64 }

IchimokuResult struct#

rust · ignore
pub struct IchimokuResult { pub conversion_line: Vec<Option<f64>>, pub base_line: Vec<Option<f64>>, pub leading_span_a: Vec<Option<f64>>, pub leading_span_b: Vec<Option<f64>>, pub lagging_span: Vec<Option<f64>> }

KeltnerChannelsResult struct#

rust · ignore
pub struct KeltnerChannelsResult { pub upper: Vec<Option<f64>>, pub middle: Vec<Option<f64>>, pub lower: Vec<Option<f64>> }

PivotPoints struct#

rust · ignore
pub struct PivotPoints { pub pivot: f64, pub r1: f64, pub r2: f64, pub r3: f64, pub s1: f64, pub s2: f64, pub s3: f64 }

Result type_alias#

rust · ignore
pub type Result<T> = std::result::Result<T, IndicatorError>

Result type for indicator calculations

StochasticResult struct#

rust · ignore
pub struct StochasticResult { pub k: Vec<Option<f64>>, pub d: Vec<Option<f64>> }

SuperTrendResult struct#

rust · ignore
pub struct SuperTrendResult { pub value: Vec<Option<f64>>, pub is_uptrend: Vec<Option<bool>> }

ZigZagPoint struct#

rust · ignore
pub struct ZigZagPoint { pub index: usize, pub price: f64, pub is_high: bool }

accumulation_distribution function#

rust · ignore
pub fn accumulation_distribution( highs: &[f64], lows: &[f64], closes: &[f64], volumes: &[f64], ) -> Result<Vec<Option<f64>>>
measured as `finance_query::ind_accumulation_distribution`
instructions/iter27672
callgrind Ir/iter27672
median walltime (ns)3886
p99 walltime (ns)3944
allocations/iter1
allocated bytes/iter16000

adx function#

rust · ignore
pub fn adx(highs: &[f64], lows: &[f64], closes: &[f64], period: usize) -> Result<Vec<Option<f64>>>
measured as `finance_query::ind_trend`
instructions/iter1034742
callgrind Ir/iter1034742
median walltime (ns)94335
p99 walltime (ns)95102
allocations/iter48
allocated bytes/iter267808

alma function#

rust · ignore
pub fn alma(data: &[f64], period: usize, offset: f64, sigma: f64) -> Result<Vec<Option<f64>>>
measured as `finance_query::ind_alma`
instructions/iter107851
callgrind Ir/iter107851
median walltime (ns)6432
p99 walltime (ns)6558
allocations/iter2
allocated bytes/iter16072

aroon function#

rust · ignore
pub fn aroon(highs: &[f64], lows: &[f64], period: usize) -> Result<AroonResult>
measured as `finance_query::ind_aroon`
instructions/iter185942
callgrind Ir/iter185942
median walltime (ns)12584
p99 walltime (ns)12882
allocations/iter9
allocated bytes/iter32704

awesome_oscillator function#

rust · ignore
pub fn awesome_oscillator( highs: &[f64], lows: &[f64], fast: usize, slow: usize, ) -> Result<Vec<Option<f64>>>
measured as `finance_query::ind_awesome_oscillator`
instructions/iter52501
callgrind Ir/iter52501
median walltime (ns)8522
p99 walltime (ns)8563
allocations/iter4
allocated bytes/iter39704

balance_of_power function#

rust · ignore
pub fn balance_of_power( opens: &[f64], highs: &[f64], lows: &[f64], closes: &[f64], period: Option<usize>, ) -> Result<Vec<Option<f64>>>
measured as `finance_query::ind_balance_of_power`
instructions/iter27342
callgrind Ir/iter27342
median walltime (ns)2268
p99 walltime (ns)2300
allocations/iter2
allocated bytes/iter24000

bollinger_bands function#

rust · ignore
pub fn bollinger_bands( data: &[f64], period: usize, std_dev_multiplier: f64, ) -> Result<BollingerBands>
measured as `finance_query::ind_volatility`
instructions/iter673318
callgrind Ir/iter673318
median walltime (ns)67867
p99 walltime (ns)68927
allocations/iter28
allocated bytes/iter216680

bull_bear_power function#

rust · ignore
pub fn bull_bear_power( highs: &[f64], lows: &[f64], closes: &[f64], period: usize, ) -> Result<BullBearPowerResult>
measured as `finance_query::ind_bull_bear_power`
instructions/iter29581
callgrind Ir/iter29581
median walltime (ns)6971
p99 walltime (ns)7040
allocations/iter3
allocated bytes/iter39904

cci function#

rust · ignore
pub fn cci(highs: &[f64], lows: &[f64], closes: &[f64], period: usize) -> Result<Vec<Option<f64>>>
measured as `finance_query::ind_cci`
instructions/iter149203
callgrind Ir/iter149203
median walltime (ns)17302
p99 walltime (ns)17460
allocations/iter2
allocated bytes/iter24000

chaikin_oscillator function#

rust · ignore
pub fn chaikin_oscillator( highs: &[f64], lows: &[f64], closes: &[f64], volumes: &[f64], ) -> Result<Vec<Option<f64>>>
measured as `finance_query::ind_chaikin_oscillator`
instructions/iter66908
callgrind Ir/iter66908
median walltime (ns)15922
p99 walltime (ns)16032
allocations/iter4
allocated bytes/iter39912

choppiness_index function#

rust · ignore
pub fn choppiness_index( highs: &[f64], lows: &[f64], closes: &[f64], period: usize, ) -> Result<Vec<Option<f64>>>
measured as `finance_query::ind_choppiness_index`
instructions/iter280369
callgrind Ir/iter280369
median walltime (ns)22339
p99 walltime (ns)22563
allocations/iter8
allocated bytes/iter16560

cmf function#

rust · ignore
pub fn cmf( highs: &[f64], lows: &[f64], closes: &[f64], volumes: &[f64], period: usize, ) -> Result<Vec<Option<f64>>>
measured as `finance_query::ind_cmf`
instructions/iter49414
callgrind Ir/iter49414
median walltime (ns)3984
p99 walltime (ns)4052
allocations/iter2
allocated bytes/iter24000

cmo function#

rust · ignore
pub fn cmo(data: &[f64], period: usize) -> Result<Vec<Option<f64>>>
measured as `finance_query::ind_cmo`
instructions/iter61742
callgrind Ir/iter61742
median walltime (ns)5143
p99 walltime (ns)5202
allocations/iter2
allocated bytes/iter24000

coppock_curve function#

rust · ignore
pub fn coppock_curve( data: &[f64], long_roc: usize, short_roc: usize, wma_period: usize, ) -> Result<Vec<Option<f64>>>
measured as `finance_query::ind_coppock_curve`
instructions/iter72734
callgrind Ir/iter72734
median walltime (ns)7656
p99 walltime (ns)7837
allocations/iter3
allocated bytes/iter31704

dema function#

rust · ignore
pub fn dema(data: &[f64], period: usize) -> Result<Vec<Option<f64>>>
measured as `finance_query::ind_dema`
instructions/iter40936
callgrind Ir/iter40936
median walltime (ns)11739
p99 walltime (ns)11785
allocations/iter3
allocated bytes/iter31544

donchian_channels function#

rust · ignore
pub fn donchian_channels( highs: &[f64], lows: &[f64], period: usize, ) -> Result<DonchianChannelsResult>
measured as `finance_query::ind_donchian_channels`
instructions/iter181283
callgrind Ir/iter181283
median walltime (ns)11929
p99 walltime (ns)12152
allocations/iter9
allocated bytes/iter48448

elder_ray function#

rust · ignore
pub fn elder_ray( highs: &[f64], lows: &[f64], closes: &[f64], period: usize, ) -> Result<ElderRayResult>
measured as `finance_query::ind_elder_ray`
instructions/iter29582
callgrind Ir/iter29582
median walltime (ns)6974
p99 walltime (ns)7040
allocations/iter3
allocated bytes/iter39904

ema function#

rust · ignore
pub fn ema(data: &[f64], period: usize) -> Vec<Option<f64>>
measured as `finance_query::ind_moving_averages`
instructions/iter479263
callgrind Ir/iter479263
median walltime (ns)86074
p99 walltime (ns)86524
allocations/iter27
allocated bytes/iter268760

fibonacci_pivot_points function#

rust · ignore
pub fn fibonacci_pivot_points( highs: &[f64], lows: &[f64], closes: &[f64], ) -> Result<Vec<Option<PivotPoints>>>
measured as `finance_query::ind_fibonacci_pivot_points`
instructions/iter24555
callgrind Ir/iter24555
median walltime (ns)2426
p99 walltime (ns)2456
allocations/iter1
allocated bytes/iter64000

fibonacci_retracement function#

rust · ignore
pub fn fibonacci_retracement( highs: &[f64], lows: &[f64], period: usize, ) -> Result<Vec<Option<FibonacciLevels>>>
measured as `finance_query::ind_fibonacci_retracement`
instructions/iter184909
callgrind Ir/iter184909
median walltime (ns)11218
p99 walltime (ns)11252
allocations/iter9
allocated bytes/iter64960

heikin_ashi function#

rust · ignore
pub fn heikin_ashi(candles: &[Candle]) -> Result<Vec<Candle>>
measured as `finance_query::ind_heikin_ashi`
instructions/iter129763
callgrind Ir/iter129763
median walltime (ns)16477
p99 walltime (ns)17621
allocations/iter9
allocated bytes/iter136000

hma function#

rust · ignore
pub fn hma(data: &[f64], period: usize) -> Result<Vec<Option<f64>>>
measured as `finance_query::ind_hma`
instructions/iter100281
callgrind Ir/iter100281
median walltime (ns)13179
p99 walltime (ns)13261
allocations/iter5
allocated bytes/iter47448

ichimoku function#

rust · ignore
pub fn ichimoku( highs: &[f64], lows: &[f64], closes: &[f64], conversion: usize, base: usize, lagging: usize, displacement: usize, ) -> Result<IchimokuResult>
measured as `finance_query::ind_ichimoku`
instructions/iter535351
callgrind Ir/iter535351
median walltime (ns)36058
p99 walltime (ns)37336
allocations/iter27
allocated bytes/iter82368

keltner_channels function#

rust · ignore
pub fn keltner_channels( highs: &[f64], lows: &[f64], closes: &[f64], period: usize, atr_period: usize, multiplier: f64, ) -> Result<KeltnerChannelsResult>
measured as `finance_query::ind_keltner_channels`
instructions/iter97515
callgrind Ir/iter97515
median walltime (ns)17200
p99 walltime (ns)17393
allocations/iter5
allocated bytes/iter63776

last_value function#

rust · ignore
pub fn last_value(values: &[Option<f64>]) -> Option<f64>

Helper function to extract the last non-None value from a vector.

Useful for converting historical indicator values to latest value only.

Example#

use finance_query::indicators::last_value;

let values = vec![None, None, Some(10.0), Some(20.0)];
assert_eq!(last_value(&values), Some(20.0));
measured as `finance_query::ind_last_value`
instructions/iter20
callgrind Ir/iter20
median walltime (ns)2
p99 walltime (ns)2
allocations/iter0
allocated bytes/iter0

macd function#

rust · ignore
pub fn macd( data: &[f64], fast_period: usize, slow_period: usize, signal_period: usize, ) -> Result<MacdResult>
measured as `finance_query::ind_macd`
instructions/iter82597
callgrind Ir/iter82597
median walltime (ns)19689
p99 walltime (ns)19920
allocations/iter7
allocated bytes/iter79248

mcginley_dynamic function#

rust · ignore
pub fn mcginley_dynamic(data: &[f64], period: usize) -> Result<Vec<Option<f64>>>
measured as `finance_query::ind_mcginley_dynamic`
instructions/iter21714
callgrind Ir/iter21714
median walltime (ns)12038
p99 walltime (ns)12199
allocations/iter1
allocated bytes/iter16000

mfi function#

rust · ignore
pub fn mfi( highs: &[f64], lows: &[f64], closes: &[f64], volumes: &[f64], period: usize, ) -> Result<Vec<Option<f64>>>
measured as `finance_query::ind_mfi`
instructions/iter94229
callgrind Ir/iter94229
median walltime (ns)7583
p99 walltime (ns)8266
allocations/iter3
allocated bytes/iter32000

momentum function#

rust · ignore
pub fn momentum(data: &[f64], period: usize) -> Result<Vec<Option<f64>>>
measured as `finance_query::ind_momentum_single`
instructions/iter8020
callgrind Ir/iter8020
median walltime (ns)533
p99 walltime (ns)538
allocations/iter1
allocated bytes/iter16000

obv function#

rust · ignore
pub fn obv(closes: &[f64], volumes: &[f64]) -> Result<Vec<Option<f64>>>
measured as `finance_query::ind_volume`
instructions/iter316423
callgrind Ir/iter316423
median walltime (ns)41489
p99 walltime (ns)42042
allocations/iter14
allocated bytes/iter167912

parabolic_sar function#

rust · ignore
pub fn parabolic_sar( highs: &[f64], lows: &[f64], closes: &[f64], acceleration: f64, maximum: f64, ) -> Result<Vec<Option<f64>>>
measured as `finance_query::ind_parabolic_sar`
instructions/iter25132
callgrind Ir/iter25132
median walltime (ns)2223
p99 walltime (ns)2254
allocations/iter1
allocated bytes/iter16000

pivot_points function#

rust · ignore
pub fn pivot_points( highs: &[f64], lows: &[f64], closes: &[f64], ) -> Result<Vec<Option<PivotPoints>>>
measured as `finance_query::ind_pivot_points`
instructions/iter26050
callgrind Ir/iter26050
median walltime (ns)2867
p99 walltime (ns)2923
allocations/iter1
allocated bytes/iter64000

roc function#

rust · ignore
pub fn roc(data: &[f64], period: usize) -> Result<Vec<Option<f64>>>
measured as `finance_query::ind_roc`
instructions/iter16876
callgrind Ir/iter16876
median walltime (ns)1633
p99 walltime (ns)1647
allocations/iter1
allocated bytes/iter16000

rsi function#

rust · ignore
pub fn rsi(data: &[f64], period: usize) -> Result<Vec<Option<f64>>>
measured as `finance_query::ind_momentum`
instructions/iter1186788
callgrind Ir/iter1186788
median walltime (ns)124109
p99 walltime (ns)128069
allocations/iter52
allocated bytes/iter390856

sma function#

rust · ignore
pub fn sma(data: &[f64], period: usize) -> Vec<Option<f64>>
measured as `finance_query::ind_sma`
instructions/iter2200136
callgrind Ir/iter2200136
median walltime (ns)376811
p99 walltime (ns)388669
allocations/iter1
allocated bytes/iter1600000

stochastic function#

rust · ignore
pub fn stochastic( highs: &[f64], lows: &[f64], closes: &[f64], k_period: usize, k_slow: usize, d_period: usize, ) -> Result<StochasticResult>
measured as `finance_query::ind_stochastic`
instructions/iter225850
callgrind Ir/iter225850
median walltime (ns)16287
p99 walltime (ns)16670
allocations/iter11
allocated bytes/iter56224

stochastic_rsi function#

rust · ignore
pub fn stochastic_rsi( data: &[f64], rsi_period: usize, stoch_period: usize, k_period: usize, d_period: usize, ) -> Result<StochasticResult>
measured as `finance_query::ind_stochastic_rsi`
instructions/iter287826
callgrind Ir/iter287826
median walltime (ns)26759
p99 walltime (ns)27428
allocations/iter12
allocated bytes/iter63640

supertrend function#

rust · ignore
pub fn supertrend( highs: &[f64], lows: &[f64], closes: &[f64], period: usize, multiplier: f64, ) -> Result<SuperTrendResult>
measured as `finance_query::ind_supertrend`
instructions/iter117931
callgrind Ir/iter117931
median walltime (ns)13681
p99 walltime (ns)13918
allocations/iter4
allocated bytes/iter40928

tema function#

rust · ignore
pub fn tema(data: &[f64], period: usize) -> Result<Vec<Option<f64>>>
measured as `finance_query::ind_tema`
instructions/iter58081
callgrind Ir/iter58081
median walltime (ns)17421
p99 walltime (ns)17514
allocations/iter4
allocated bytes/iter39088

true_range function#

rust · ignore
pub fn true_range(highs: &[f64], lows: &[f64], closes: &[f64]) -> Result<Vec<Option<f64>>>
measured as `finance_query::ind_true_range`
instructions/iter17091
callgrind Ir/iter17091
median walltime (ns)1186
p99 walltime (ns)1193
allocations/iter1
allocated bytes/iter16000

vwap function#

rust · ignore
pub fn vwap( highs: &[f64], lows: &[f64], closes: &[f64], volumes: &[f64], ) -> Result<Vec<Option<f64>>>
measured as `finance_query::ind_vwap`
instructions/iter31671
callgrind Ir/iter31671
median walltime (ns)3914
p99 walltime (ns)4004
allocations/iter1
allocated bytes/iter16000

vwma function#

rust · ignore
pub fn vwma(data: &[f64], volumes: &[f64], period: usize) -> Result<Vec<Option<f64>>>
measured as `finance_query::ind_vwma`
instructions/iter43618
callgrind Ir/iter43618
median walltime (ns)2987
p99 walltime (ns)3088
allocations/iter1
allocated bytes/iter16000

williams_r function#

rust · ignore
pub fn williams_r( highs: &[f64], lows: &[f64], closes: &[f64], period: usize, ) -> Result<Vec<Option<f64>>>
measured as `finance_query::ind_williams_r`
instructions/iter180153
callgrind Ir/iter180153
median walltime (ns)10869
p99 walltime (ns)11232
allocations/iter7
allocated bytes/iter16448

wma function#

rust · ignore
pub fn wma(data: &[f64], period: usize) -> Result<Vec<Option<f64>>>
measured as `finance_query::ind_wma`
instructions/iter31019
callgrind Ir/iter31019
median walltime (ns)4465
p99 walltime (ns)4555
allocations/iter7
allocated bytes/iter38608

zigzag function#

rust · ignore
pub fn zigzag(highs: &[f64], lows: &[f64], deviation_pct: f64) -> Result<Vec<ZigZagPoint>>
measured as `finance_query::ind_zigzag`
instructions/iter18257
callgrind Ir/iter18257
median walltime (ns)1535
p99 walltime (ns)1577
allocations/iter4
allocated bytes/iter1440

finance_query::indicators::Indicator#

warmup_bars function#

rust · ignore
pub fn warmup_bars(&self) -> usize

Minimum number of data bars required before this indicator produces meaningful output.

Used by the backtesting engine's CustomStrategy to automatically compute the warmup period instead of parsing key-name suffixes.

Examples#

use finance_query::indicators::Indicator;

assert_eq!(Indicator::Sma(20).warmup_bars(), 20);
assert_eq!(Indicator::Macd { fast: 12, slow: 26, signal: 9 }.warmup_bars(), 35);
assert_eq!(Indicator::Bollinger { period: 20, std_dev: 2.0 }.warmup_bars(), 20);

finance_query::models::chart::data::Chart#

pivot_points function#

rust · ignore
pub fn pivot_points( &self, ) -> crate::indicators::Result<Vec<Option<crate::indicators::PivotPoints>>>

Calculate classic (standard) Pivot Points.

Each bar's levels are derived from the previous bar's high/low/close; the first bar is None.

finance_query::models::chart::stock_bars::StockBarsRequest#

with_sort function#

rust · ignore
pub fn with_sort(mut self, order: SortType) -> Self

Select oldest-first ([SortType::Asc]) or newest-first order.

finance_query::models::corporate::calendar_events#

EarningsCalendar struct#

rust · ignore
pub struct EarningsCalendar { pub earnings_date: Option<Vec<FormattedValue<i64>>>, pub earnings_average: Option<FormattedValue<f64>>, pub earnings_low: Option<FormattedValue<f64>>, pub earnings_high: Option<FormattedValue<f64>>, pub revenue_average: Option<FormattedValue<i64>>, pub revenue_low: Option<FormattedValue<i64>>, pub revenue_high: Option<FormattedValue<i64>> }

Earnings calendar information

finance_query::models::corporate::earnings#

EarningsChart struct#

rust · ignore
pub struct EarningsChart { pub quarterly: Vec<QuarterlyEarnings>, pub current_quarter_estimate: Option<crate::models::quote::FormattedValue<f64>>, pub current_quarter_estimate_date: Option<String>, pub current_quarter_estimate_year: Option<i32>, pub current_fiscal_quarter: Option<String>, pub current_calendar_quarter: Option<String>, pub earnings_date: Vec<crate::models::quote::FormattedValue<i64>>, pub is_earnings_date_estimate: Option<bool> }

Earnings chart showing quarterly data

FinancialsChart struct#

rust · ignore
pub struct FinancialsChart { pub yearly: Vec<YearlyFinancials>, pub quarterly: Vec<QuarterlyFinancials> }

Financial chart showing revenue and earnings over time

QuarterlyEarnings struct#

rust · ignore
pub struct QuarterlyEarnings { pub date: Option<String>, pub actual: Option<crate::models::quote::FormattedValue<f64>>, pub estimate: Option<crate::models::quote::FormattedValue<f64>>, pub difference: Option<String>, pub surprise_pct: Option<String>, pub calendar_quarter: Option<String>, pub fiscal_quarter: Option<String> }

Quarterly earnings entry

QuarterlyFinancials struct#

rust · ignore
pub struct QuarterlyFinancials { pub date: Option<String>, pub revenue: Option<crate::models::quote::FormattedValue<i64>>, pub earnings: Option<crate::models::quote::FormattedValue<i64>> }

Quarterly financial data entry

YearlyFinancials struct#

rust · ignore
pub struct YearlyFinancials { pub date: Option<i64>, pub revenue: Option<crate::models::quote::FormattedValue<i64>>, pub earnings: Option<crate::models::quote::FormattedValue<i64>> }

Yearly financial data entry

finance_query::models::corporate::earnings_history#

EarningsHistoryEntry struct#

rust · ignore
pub struct EarningsHistoryEntry { pub max_age: Option<i64>, pub quarter: Option<crate::models::quote::FormattedValue<i64>>, pub period: Option<String>, pub currency: Option<String>, pub eps_actual: Option<crate::models::quote::FormattedValue<f64>>, pub eps_estimate: Option<crate::models::quote::FormattedValue<f64>>, pub eps_difference: Option<crate::models::quote::FormattedValue<f64>>, pub surprise_percent: Option<crate::models::quote::FormattedValue<f64>> }

Single historical earnings entry

finance_query::models::corporate::earnings_trend#

EarningsEstimate struct#

rust · ignore
pub struct EarningsEstimate { pub avg: Option<crate::models::quote::FormattedValue<f64>>, pub low: Option<crate::models::quote::FormattedValue<f64>>, pub high: Option<crate::models::quote::FormattedValue<f64>>, pub year_ago_eps: Option<crate::models::quote::FormattedValue<f64>>, pub number_of_analysts: Option<crate::models::quote::FormattedValue<i64>>, pub growth: Option<crate::models::quote::FormattedValue<f64>>, pub earnings_currency: Option<String> }

Earnings estimate data

EarningsTrendPeriod struct#

rust · ignore
pub struct EarningsTrendPeriod { pub end_date: Option<String>, pub earnings_estimate: Option<EarningsEstimate>, pub revenue_estimate: Option<RevenueEstimate>, pub eps_trend: Option<EpsTrend>, pub eps_revisions: Option<EpsRevisions> }

Earnings trend for a specific period

EpsRevisions struct#

rust · ignore
pub struct EpsRevisions { pub up_last7days: Option<crate::models::quote::FormattedValue<i64>>, pub up_last30days: Option<crate::models::quote::FormattedValue<i64>>, pub down_last7_days: Option<crate::models::quote::FormattedValue<i64>>, pub down_last30days: Option<crate::models::quote::FormattedValue<i64>>, pub down_last90days: Option<crate::models::quote::FormattedValue<i64>>, pub eps_revisions_currency: Option<String> }

EPS revision data

EpsTrend struct#

rust · ignore
pub struct EpsTrend { pub current: Option<crate::models::quote::FormattedValue<f64>>, pub seven_days_ago: Option<crate::models::quote::FormattedValue<f64>>, pub thirty_days_ago: Option<crate::models::quote::FormattedValue<f64>>, pub sixty_days_ago: Option<crate::models::quote::FormattedValue<f64>>, pub ninety_days_ago: Option<crate::models::quote::FormattedValue<f64>> }

EPS trend over time

RevenueEstimate struct#

rust · ignore
pub struct RevenueEstimate { pub avg: Option<crate::models::quote::FormattedValue<i64>>, pub low: Option<crate::models::quote::FormattedValue<i64>>, pub high: Option<crate::models::quote::FormattedValue<i64>>, pub number_of_analysts: Option<crate::models::quote::FormattedValue<i64>>, pub year_ago_revenue: Option<crate::models::quote::FormattedValue<i64>>, pub growth: Option<crate::models::quote::FormattedValue<f64>> }

Revenue estimate data

finance_query::models::corporate::equity_performance#

Benchmark struct#

rust · ignore
pub struct Benchmark { pub symbol: Option<String>, pub short_name: Option<String> }

Benchmark information

PerformanceOverview struct#

rust · ignore
pub struct PerformanceOverview { pub as_of_date: Option<crate::models::quote::FormattedValue<i64>>, pub five_days_return: Option<crate::models::quote::FormattedValue<f64>>, pub one_month_return: Option<crate::models::quote::FormattedValue<f64>>, pub three_month_return: Option<crate::models::quote::FormattedValue<f64>>, pub six_month_return: Option<crate::models::quote::FormattedValue<f64>>, pub ytd_return_pct: Option<crate::models::quote::FormattedValue<f64>>, pub one_year_total_return: Option<crate::models::quote::FormattedValue<f64>>, pub two_year_total_return: Option<crate::models::quote::FormattedValue<f64>>, pub three_year_total_return: Option<crate::models::quote::FormattedValue<f64>>, pub five_year_total_return: Option<crate::models::quote::FormattedValue<f64>>, pub ten_year_total_return: Option<crate::models::quote::FormattedValue<f64>>, pub max_return: Option<crate::models::quote::FormattedValue<f64>> }

Performance metrics across multiple time periods

finance_query::models::corporate::fund_ownership#

FundOwner struct#

rust · ignore
pub struct FundOwner { pub max_age: Option<i64>, pub organization: Option<String>, pub pct_held: Option<crate::models::quote::FormattedValue<f64>>, pub position: Option<crate::models::quote::FormattedValue<i64>>, pub value: Option<crate::models::quote::FormattedValue<i64>>, pub pct_change: Option<crate::models::quote::FormattedValue<f64>>, pub report_date: Option<crate::models::quote::FormattedValue<i64>> }

Individual fund owner

finance_query::models::corporate::fund_performance#

AnnualReturn struct#

rust · ignore
pub struct AnnualReturn { pub year: Option<String>, pub annual_value: Option<FormattedValue<f64>> }

Single year's return data

AnnualTotalReturns struct#

rust · ignore
pub struct AnnualTotalReturns { pub returns: Option<Vec<AnnualReturn>>, pub returns_cat: Option<Vec<AnnualReturn>> }

Annual total returns by year

PastQuarterlyReturns struct#

rust · ignore
pub struct PastQuarterlyReturns { pub returns: Option<Vec<serde_json::Value>> }

Past quarterly returns

PerformanceOverview struct#

rust · ignore
pub struct PerformanceOverview { pub as_of_date: Option<FormattedValue<i64>>, pub ytd_return_pct: Option<FormattedValue<f64>>, pub five_yr_avg_return_pct: Option<FormattedValue<f64>>, pub one_year_total_return: Option<FormattedValue<f64>>, pub three_year_total_return: Option<FormattedValue<f64>> }

Performance overview with key return metrics

PerformanceOverviewCat struct#

rust · ignore
pub struct PerformanceOverviewCat { pub ytd_return_pct: Option<FormattedValue<f64>>, pub five_yr_avg_return_pct: Option<FormattedValue<f64>>, pub one_year_total_return: Option<FormattedValue<f64>>, pub three_year_total_return: Option<FormattedValue<f64>> }

Category average performance overview

RiskOverviewStatistics struct#

rust · ignore
pub struct RiskOverviewStatistics { pub risk_statistics: Option<Vec<RiskStatistic>> }

Risk overview statistics

RiskOverviewStatisticsCat struct#

rust · ignore
pub struct RiskOverviewStatisticsCat { pub risk_statistics_cat: Option<Vec<RiskStatistic>> }

Category average risk overview statistics

RiskStatistic struct#

rust · ignore
pub struct RiskStatistic { pub year: Option<String>, pub alpha: Option<FormattedValue<f64>>, pub beta: Option<FormattedValue<f64>>, pub mean_annual_return: Option<FormattedValue<f64>>, pub r_squared: Option<FormattedValue<f64>>, pub std_dev: Option<FormattedValue<f64>>, pub sharpe_ratio: Option<FormattedValue<f64>>, pub treynor_ratio: Option<FormattedValue<f64>> }

Risk statistics for a specific time period

TrailingReturns struct#

rust · ignore
pub struct TrailingReturns { pub as_of_date: Option<FormattedValue<i64>>, pub ytd: Option<FormattedValue<f64>>, pub one_month: Option<FormattedValue<f64>>, pub three_month: Option<FormattedValue<f64>>, pub one_year: Option<FormattedValue<f64>>, pub three_year: Option<FormattedValue<f64>>, pub five_year: Option<FormattedValue<f64>>, pub ten_year: Option<FormattedValue<f64>>, pub last_bull_mkt: Option<FormattedValue<f64>>, pub last_bear_mkt: Option<FormattedValue<f64>> }

Trailing returns at market price

TrailingReturnsCat struct#

rust · ignore
pub struct TrailingReturnsCat { pub ytd: Option<FormattedValue<f64>>, pub one_month: Option<FormattedValue<f64>>, pub three_month: Option<FormattedValue<f64>>, pub one_year: Option<FormattedValue<f64>>, pub three_year: Option<FormattedValue<f64>>, pub five_year: Option<FormattedValue<f64>>, pub ten_year: Option<FormattedValue<f64>>, pub last_bull_mkt: Option<FormattedValue<f64>>, pub last_bear_mkt: Option<FormattedValue<f64>> }

Category average trailing returns

TrailingReturnsNav struct#

rust · ignore
pub struct TrailingReturnsNav { pub ytd: Option<FormattedValue<f64>>, pub one_month: Option<FormattedValue<f64>>, pub three_month: Option<FormattedValue<f64>>, pub one_year: Option<FormattedValue<f64>>, pub three_year: Option<FormattedValue<f64>>, pub five_year: Option<FormattedValue<f64>>, pub ten_year: Option<FormattedValue<f64>> }

Trailing returns at NAV (Net Asset Value)

finance_query::models::corporate::fund_profile#

FeesExpenses struct#

rust · ignore
pub struct FeesExpenses { pub annual_report_expense_ratio: Option<FormattedValue<f64>>, pub annual_holdings_turnover: Option<FormattedValue<f64>>, pub total_net_assets: Option<FormattedValue<f64>>, pub projection_values: Option<serde_json::Value> }

Fees and expenses for a fund

FeesExpensesCat struct#

rust · ignore
pub struct FeesExpensesCat { pub annual_report_expense_ratio: Option<FormattedValue<f64>>, pub annual_holdings_turnover: Option<FormattedValue<f64>>, pub total_net_assets: Option<FormattedValue<f64>>, pub projection_values_cat: Option<serde_json::Value> }

Average fees and expenses for funds in the same category

ManagementInfo struct#

rust · ignore
pub struct ManagementInfo { pub manager_name: Option<String>, pub manager_bio: Option<String> }

Fund management information

finance_query::models::corporate::insider_holders#

InsiderHolder struct#

rust · ignore
pub struct InsiderHolder { pub max_age: Option<i64>, pub name: Option<String>, pub relation: Option<String>, pub url: Option<String>, pub transaction_description: Option<String>, pub latest_trans_date: Option<crate::models::quote::FormattedValue<i64>>, pub position_direct: Option<crate::models::quote::FormattedValue<i64>>, pub position_direct_date: Option<crate::models::quote::FormattedValue<i64>>, pub position_indirect: Option<crate::models::quote::FormattedValue<i64>>, pub position_indirect_date: Option<crate::models::quote::FormattedValue<i64>> }

Individual insider holder information

finance_query::models::corporate::insider_transactions#

InsiderTransaction struct#

rust · ignore
pub struct InsiderTransaction { pub max_age: Option<i64>, pub shares: Option<crate::models::quote::FormattedValue<i64>>, pub value: Option<crate::models::quote::FormattedValue<i64>>, pub filer_name: Option<String>, pub filer_relation: Option<String>, pub filer_url: Option<String>, pub money_text: Option<String>, pub start_date: Option<crate::models::quote::FormattedValue<i64>>, pub ownership: Option<String>, pub transaction_text: Option<String> }

Individual insider transaction

finance_query::models::corporate::institution_ownership#

InstitutionOwner struct#

rust · ignore
pub struct InstitutionOwner { pub max_age: Option<i64>, pub organization: Option<String>, pub pct_held: Option<crate::models::quote::FormattedValue<f64>>, pub position: Option<crate::models::quote::FormattedValue<i64>>, pub value: Option<crate::models::quote::FormattedValue<i64>>, pub pct_change: Option<crate::models::quote::FormattedValue<f64>>, pub report_date: Option<crate::models::quote::FormattedValue<i64>> }

Individual institutional owner

finance_query::models::corporate::recommendation_trend#

RecommendationPeriod struct#

rust · ignore
pub struct RecommendationPeriod { pub period: Option<String>, pub strong_buy: Option<i32>, pub buy: Option<i32>, pub hold: Option<i32>, pub sell: Option<i32>, pub strong_sell: Option<i32> }

Recommendations for a specific time period

finance_query::models::corporate::sec_filings#

SecExhibit struct#

rust · ignore
pub struct SecExhibit { pub exhibit_type: Option<String>, pub url: Option<String> }

SEC filing exhibit

SecFiling struct#

rust · ignore
pub struct SecFiling { pub max_age: Option<i64>, pub date: Option<String>, pub epoch_date: Option<i64>, pub filing_type: Option<String>, pub title: Option<String>, pub edgar_url: Option<String>, pub exhibits: Vec<SecExhibit> }

Individual SEC filing

finance_query::models::corporate::top_holdings#

BondRating struct#

rust · ignore
pub struct BondRating { pub us_government: Option<FormattedValue<f64>>, pub aaa: Option<FormattedValue<f64>>, pub aa: Option<FormattedValue<f64>>, pub a: Option<FormattedValue<f64>>, pub bbb: Option<FormattedValue<f64>>, pub bb: Option<FormattedValue<f64>>, pub b: Option<FormattedValue<f64>>, pub below_b: Option<FormattedValue<f64>>, pub not_rated: Option<FormattedValue<f64>>, pub other: Option<FormattedValue<f64>> }

Bond rating distribution

EquityHoldings struct#

rust · ignore
pub struct EquityHoldings { pub price_to_earnings: Option<FormattedValue<f64>>, pub price_to_book: Option<FormattedValue<f64>>, pub price_to_sales: Option<FormattedValue<f64>>, pub price_to_cashflow: Option<FormattedValue<f64>> }

Equity holdings valuation metrics

Holding struct#

rust · ignore
pub struct Holding { pub symbol: Option<String>, pub holding_name: Option<String>, pub holding_percent: Option<FormattedValue<f64>> }

Individual holding in the fund

SectorWeighting struct#

rust · ignore
pub struct SectorWeighting { pub realestate: Option<FormattedValue<f64>>, pub consumer_cyclical: Option<FormattedValue<f64>>, pub basic_materials: Option<FormattedValue<f64>>, pub consumer_defensive: Option<FormattedValue<f64>>, pub technology: Option<FormattedValue<f64>>, pub communication_services: Option<FormattedValue<f64>>, pub financial_services: Option<FormattedValue<f64>>, pub utilities: Option<FormattedValue<f64>>, pub industrials: Option<FormattedValue<f64>>, pub energy: Option<FormattedValue<f64>>, pub healthcare: Option<FormattedValue<f64>> }

Sector weighting distribution (single sector from Yahoo's array format)

finance_query::models::corporate::transcript#

Paragraph struct#

rust · ignore
pub struct Paragraph { pub speaker: i32, pub start: f64, pub end: f64, pub text: String, pub sentences: Vec<Sentence>, pub sentiment: Option<crate::models::sentiment::Sentiment> }

A paragraph (section spoken by one speaker).

Sentence struct#

rust · ignore
pub struct Sentence { pub start: f64, pub end: f64, pub text: String, pub words: Vec<Word> }

A sentence within a paragraph.

SpeakerData struct#

rust · ignore
pub struct SpeakerData { pub company: Option<String>, pub name: String, pub role: Option<String> }

Information about a speaker.

SpeakerMapping struct#

rust · ignore
pub struct SpeakerMapping { pub speaker: i32, pub speaker_data: SpeakerData }

Mapping of a speaker ID to speaker information.

TranscriptContent struct#

rust · ignore
pub struct TranscriptContent { pub company_id: i64, pub event_id: i64, pub version: Option<String>, pub speaker_mapping: Vec<SpeakerMapping>, pub transcript: Option<TranscriptData> }

Transcript content including speakers and full transcript.

TranscriptData struct#

rust · ignore
pub struct TranscriptData { pub number_of_speakers: i32, pub text: String, pub paragraphs: Vec<Paragraph> }

Full transcript data with paragraphs.

TranscriptMetadata struct#

rust · ignore
pub struct TranscriptMetadata { pub date: i64, pub event_id: i64, pub event_type: String, pub fiscal_period: String, pub fiscal_year: i32, pub is_latest: bool, pub s3_url: String, pub title: String, pub transcript_id: i64, pub transcript_type: String, pub updated: i64 }

Metadata about the transcript.

Word struct#

rust · ignore
pub struct Word { pub word: String, pub punctuated_word: String, pub start: f64, pub end: f64, pub confidence: f64 }

A word with timing and confidence information.

finance_query::models::corporate::upgrade_downgrade_history#

GradeChange struct#

rust · ignore
pub struct GradeChange { pub epoch_grade_date: Option<i64>, pub firm: Option<String>, pub from_grade: Option<String>, pub to_grade: Option<String>, pub action: Option<String>, pub prior_price_target: Option<f64>, pub current_price_target: Option<f64>, pub price_target_action: Option<String> }

Individual analyst rating change

finance_query::models::discovery::reference::ScreenerFilters#

new function#

rust · ignore
pub fn new() -> Self

An empty filter set — matches the provider's default universe.

finance_query::models::discovery::screeners::query::ScreenerQuery#

add_or_conditions function#

rust · ignore
pub fn add_or_conditions(mut self, conditions: Vec<QueryCondition<F>>) -> Self

Add multiple conditions that are OR'd together.

Example#

use finance_query::{EquityField, EquityScreenerQuery, ScreenerFieldExt};

// Accept US or GB region
let query = EquityScreenerQuery::new()
    .add_or_conditions(vec![
        EquityField::Region.eq_str("us"),
        EquityField::Region.eq_str("gb"),
    ]);

finance_query::models::discovery::search::thumbnail#

NewsThumbnail struct#

rust · ignore
pub struct NewsThumbnail { pub resolutions: Option<Vec<ThumbnailResolution>> }

Thumbnail image with multiple resolutions

ThumbnailResolution struct#

rust · ignore
pub struct ThumbnailResolution { pub url: Option<String>, pub width: Option<i32>, pub height: Option<i32>, pub tag: Option<String> }

Individual thumbnail resolution

finance_query::models::filings::filing_index#

EdgarFilingIndexDirectory struct#

rust · ignore
pub struct EdgarFilingIndexDirectory { pub item: Vec<EdgarFilingIndexItem> }

Directory metadata for an EDGAR filing.

finance_query::models::filings::submissions::EdgarFilingRecent#

to_filings function#

rust · ignore
pub fn to_filings(&self) -> Vec<EdgarFiling>

Convert parallel arrays into a vector of individual filings.

Example#

no_run
# use finance_query::EdgarSubmissions;
# fn example(submissions: EdgarSubmissions) {
if let Some(filings) = &submissions.filings {
    if let Some(recent) = &filings.recent {
        for filing in recent.to_filings() {
            println!("{}: {} ({})", filing.filing_date, filing.form, filing.primary_doc_description);
        }
    }
}
# }

finance_query::models::format#

Format trait#

rust · ignore
pub trait Format: sealed::Sealed + Clone + std::fmt::Debug + PartialEq + 'static

Marker trait that controls how FormattedValue fields are typed.

Sealed — only [Both], [Raw], and [Pretty] implement this trait.

finance_query::models::format::sealed#

Sealed trait#

rust · ignore
pub trait Sealed

Blocks external crates from implementing Format; only this module can name Sealed, so it can only be satisfied here.

finance_query::models::fundamentals::balance_sheet_history#

BalanceSheetHistory struct#

rust · ignore
pub struct BalanceSheetHistory { pub balance_sheet_statements: Option<Vec<Value>>, pub max_age: Option<i64> }

Balance sheet history (annual statements)

BalanceSheetHistoryQuarterly struct#

rust · ignore
pub struct BalanceSheetHistoryQuarterly { pub balance_sheet_statements: Option<Vec<Value>>, pub max_age: Option<i64> }

Balance sheet history (quarterly statements)

finance_query::models::fundamentals::cashflow_statement_history#

CashflowStatementHistory struct#

rust · ignore
pub struct CashflowStatementHistory { pub cashflow_statements: Option<Vec<Value>>, pub max_age: Option<i64> }

Cash flow statement history (annual statements)

CashflowStatementHistoryQuarterly struct#

rust · ignore
pub struct CashflowStatementHistoryQuarterly { pub cashflow_statements: Option<Vec<Value>>, pub max_age: Option<i64> }

Cash flow statement history (quarterly statements)

finance_query::models::fundamentals::income_statement_history#

IncomeStatementHistory struct#

rust · ignore
pub struct IncomeStatementHistory { pub income_statement_history: Option<Vec<Value>>, pub max_age: Option<i64> }

Income statement history (annual statements)

IncomeStatementHistoryQuarterly struct#

rust · ignore
pub struct IncomeStatementHistoryQuarterly { pub income_statement_history: Option<Vec<Value>>, pub max_age: Option<i64> }

Income statement history (quarterly statements)

finance_query::models::market::index_trend#

TrendEstimate struct#

rust · ignore
pub struct TrendEstimate { pub period: Option<String>, pub growth: Option<FormattedValue<f64>> }

Growth estimate for a specific period

finance_query::models::market::industries::response#

BenchmarkPerformance struct#

rust · ignore
pub struct BenchmarkPerformance { pub name: Option<String>, pub day_change_percent: Option<f64>, pub ytd_change_percent: Option<f64>, pub one_year_change_percent: Option<f64>, pub three_year_change_percent: Option<f64>, pub five_year_change_percent: Option<f64> }

Benchmark performance for comparison

GrowthCompany struct#

rust · ignore
pub struct GrowthCompany { pub symbol: String, pub name: Option<String>, pub last_price: Option<f64>, pub ytd_return: Option<f64>, pub growth_estimate: Option<f64> }

Top growth company by growth estimate

IndustryCompany struct#

rust · ignore
pub struct IndustryCompany { pub symbol: String, pub name: Option<String>, pub last_price: Option<f64>, pub market_cap: Option<f64>, pub market_weight: Option<f64>, pub day_change_percent: Option<f64>, pub ytd_return: Option<f64>, pub rating: Option<String>, pub target_price: Option<f64> }

Company within an industry

IndustryOverview struct#

rust · ignore
pub struct IndustryOverview { pub description: Option<String>, pub companies_count: Option<i64>, pub market_cap: Option<f64>, pub market_weight: Option<f64>, pub employee_count: Option<i64> }

Industry overview statistics

IndustryPerformance struct#

rust · ignore
pub struct IndustryPerformance { pub day_change_percent: Option<f64>, pub ytd_change_percent: Option<f64>, pub one_year_change_percent: Option<f64>, pub three_year_change_percent: Option<f64>, pub five_year_change_percent: Option<f64> }

Industry performance metrics

PerformingCompany struct#

rust · ignore
pub struct PerformingCompany { pub symbol: String, pub name: Option<String>, pub last_price: Option<f64>, pub ytd_return: Option<f64>, pub target_price: Option<f64> }

Top performing company by YTD return

ResearchReport struct#

rust · ignore
pub struct ResearchReport { pub id: Option<String>, pub title: Option<String>, pub provider: Option<String>, pub report_date: Option<String>, pub report_type: Option<String>, pub investment_rating: Option<String>, pub target_price: Option<f64>, pub target_price_status: Option<String> }

Research report

finance_query::models::market::sectors::response#

ResearchReport struct#

rust · ignore
pub struct ResearchReport { pub id: String, pub headline: Option<String>, pub provider: Option<String>, pub report_date: Option<String>, pub report_title: Option<String>, pub report_type: Option<String>, pub target_price: Option<f64>, pub target_price_status: Option<String>, pub investment_rating: Option<String> }

A research report about the sector

SectorCompany struct#

rust · ignore
pub struct SectorCompany { pub symbol: String, pub name: Option<String>, pub market_cap: Option<FormattedValue<f64>>, pub market_weight: Option<FormattedValue<f64>>, pub last_price: Option<FormattedValue<f64>>, pub target_price: Option<FormattedValue<f64>>, pub day_change_percent: Option<FormattedValue<f64>>, pub ytd_return: Option<FormattedValue<f64>>, pub rating: Option<String> }

A company in the sector's top companies list

SectorETF struct#

rust · ignore
pub struct SectorETF { pub symbol: String, pub name: Option<String>, pub net_assets: Option<FormattedValue<f64>>, pub expense_ratio: Option<FormattedValue<f64>>, pub last_price: Option<FormattedValue<f64>>, pub ytd_return: Option<FormattedValue<f64>> }

An ETF tracking the sector

SectorIndustry struct#

rust · ignore
pub struct SectorIndustry { pub symbol: Option<String>, pub key: Option<String>, pub name: String, pub market_weight: Option<FormattedValue<f64>>, pub day_change_percent: Option<FormattedValue<f64>>, pub ytd_return: Option<FormattedValue<f64>> }

An industry within the sector

SectorMutualFund struct#

rust · ignore
pub struct SectorMutualFund { pub symbol: String, pub name: Option<String>, pub net_assets: Option<FormattedValue<f64>>, pub expense_ratio: Option<FormattedValue<f64>>, pub last_price: Option<FormattedValue<f64>>, pub ytd_return: Option<FormattedValue<f64>> }

A mutual fund in the sector

SectorOverview struct#

rust · ignore
pub struct SectorOverview { pub companies_count: Option<i64>, pub market_cap: Option<FormattedValue<f64>>, pub description: Option<String>, pub industries_count: Option<i64>, pub market_weight: Option<FormattedValue<f64>>, pub employee_count: Option<FormattedValue<i64>> }

Sector overview statistics

SectorPerformance struct#

rust · ignore
pub struct SectorPerformance { pub ytd_change_percent: Option<FormattedValue<f64>>, pub day_change_percent: Option<FormattedValue<f64>>, pub one_year_change_percent: Option<FormattedValue<f64>>, pub three_year_change_percent: Option<FormattedValue<f64>>, pub five_year_change_percent: Option<FormattedValue<f64>> }

Sector performance metrics

finance_query::models::pagination::PageCursor#

continuation function#

rust · ignore
pub fn continuation(provider: Provider, target: String) -> Self

A continuation for an adapter to return in [ProviderPage::next].

provider must be the adapter's own id and target is whatever state the adapter needs to fetch the next page. The routing layer binds the cursor to the operation and request, and checks both before handing it back.

finance_query::models::quote::data::Quote#

as_raw function#

rust · ignore
#[derive(Debug, Clone, Serialize, Deserialize, FormatConvert)]

Clone and convert into a Raw view.

finance_query::models::sentiment::score::Sentiment#

neutral function#

rust · ignore
pub fn neutral() -> Self

A neutral, zero-confidence score (used as the empty aggregate).

finance_query::openfigi#

MappingFilter struct#

rust · ignore
pub struct MappingFilter { pub exchange_code: Option<String>, pub include_unlisted: bool }

SecurityIdKind enum#

rust · ignore
pub enum SecurityIdKind { Cusip, Isin, Sedol, Figi, Ticker }

SecurityMapping struct#

rust · ignore
pub struct SecurityMapping { pub figi: String, pub ticker: Option<String>, pub name: Option<String>, pub exchange_code: Option<String>, pub composite_figi: Option<String>, pub share_class_figi: Option<String>, pub security_type: Option<String>, pub market_sector: Option<String> }

resolve function#

rust · ignore
pub async fn resolve(kind: SecurityIdKind, id: &str) -> Result<Vec<SecurityMapping>>

Resolve an identifier of any supported [SecurityIdKind].

resolve_cusip function#

rust · ignore
pub async fn resolve_cusip(cusip: &str) -> Result<Vec<SecurityMapping>>

Resolve a CUSIP to every instrument carrying it.

Returns an empty list when the identifier is well-formed but matches nothing; a malformed identifier is an error.

resolve_isin function#

rust · ignore
pub async fn resolve_isin(isin: &str) -> Result<Vec<SecurityMapping>>

Resolve an ISIN to every instrument carrying it.

resolve_many function#

rust · ignore
pub async fn resolve_many( kind: SecurityIdKind, ids: &[&str], ) -> Result<Vec<Vec<SecurityMapping>>>

Resolve many identifiers of the same kind in as few requests as possible (OpenFIGI accepts 10 per request without a key).

The result is positional: element i answers ids[i], with an empty list where nothing matched.

resolve_many_with function#

rust · ignore
pub async fn resolve_many_with( kind: SecurityIdKind, ids: &[&str], filter: &MappingFilter, ) -> Result<Vec<Vec<SecurityMapping>>>

[resolve_many] narrowed to one exchange code, optionally including delisted equities. A ticker resolves to its current holder, so check a returned name before trusting it for a delisted company.

resolve_sedol function#

rust · ignore
pub async fn resolve_sedol(sedol: &str) -> Result<Vec<SecurityMapping>>

Resolve a SEDOL to every instrument carrying it.

finance_query::providers::adapter#

ProviderCore trait#

rust · ignore
pub trait ProviderCore: Send + Sync

Identity shared by every capability trait: the provider id and the NotSupported error constructor used by default method bodies.

finance_query::providers::adapter::dispatch#

ProviderAdapter trait#

rust · ignore
pub trait ProviderAdapter: ProviderCore

A configured provider as seen by [crate::ProviderSet] dispatch: lifecycle plus one as_* accessor per capability. Override an accessor to Some(self) for each capability trait the provider implements.

capabilities is derived from which accessors are overridden, so a provider cannot advertise a capability it does not serve.

finance_query::providers::adapter::equity#

ChartProvider trait#

rust · ignore
pub trait ChartProvider: ProviderCore

[crate::Capability::CHART] — historical OHLCV candles and sparklines.

CorporateProvider trait#

rust · ignore
pub trait CorporateProvider: ProviderCore

[crate::Capability::CORPORATE] — news, corporate events, similar-symbol recommendations.

FilingsProvider trait#

rust · ignore
pub trait FilingsProvider: ProviderCore

[crate::Capability::FILINGS] — SEC filing data.

FundamentalsProvider trait#

rust · ignore
pub trait FundamentalsProvider: ProviderCore

[crate::Capability::FUNDAMENTALS] — financial statements and share-supply data.

OptionsProvider trait#

rust · ignore
pub trait OptionsProvider: ProviderCore

[crate::Capability::OPTIONS] — options chains.

QuoteProvider trait#

rust · ignore
pub trait QuoteProvider: ProviderCore

[crate::Capability::QUOTE] — single and batch equity quotes.

finance_query::providers::adapter::markets#

CalendarProvider trait#

rust · ignore
pub trait CalendarProvider: ProviderCore

[crate::Capability::CALENDAR] — market-wide calendars.

CommoditiesProvider trait#

rust · ignore
pub trait CommoditiesProvider: ProviderCore

[crate::Capability::COMMODITIES] — commodity price quotes.

DiscoveryProvider trait#

rust · ignore
pub trait DiscoveryProvider: ProviderCore

[crate::Capability::DISCOVERY] — symbol search, reference data, exchanges, screeners.

FuturesProvider trait#

rust · ignore
pub trait FuturesProvider: ProviderCore

[crate::Capability::FUTURES] — futures contract quotes.

IndicesProvider trait#

rust · ignore
pub trait IndicesProvider: ProviderCore

[crate::Capability::INDICES] — stock market index quotes.

MarketProvider trait#

rust · ignore
pub trait MarketProvider: ProviderCore

[crate::Capability::MARKET] — sector/industry performance and movers.

Movers is the required primary (every current implementor serves it); the sector/industry statistics default to NotSupported since coverage is ragged (FMP serves all of them; Yahoo and Alpha Vantage only movers).

finance_query::providers::capability::Capability#

name function#

rust · ignore
pub fn name(self) -> &'static str

Returns a short lowercase name for this capability (e.g., "quote", "chart").

Returns "unknown" for combined capability flags or unrecognised bits; Display spells combined sets out instead (e.g. "quote|chart").

finance_query::providers::config::Providers#

builder function#

rust · ignore
pub fn builder() -> ProvidersBuilder

Create a builder for configuring providers.

calendar function#

rust · ignore
pub fn calendar(&self) -> crate::domains::MarketCalendar

Create a MarketCalendar handle backed by this provider set.

Routes market-wide earnings/IPO/dividend/split/economic calendars through Capability::CALENDAR.

commodity function#

rust · ignore
pub fn commodity(&self, symbol: impl Into<String>) -> crate::domains::Commodity

Create a Commodity handle backed by this provider set.

crypto function#

rust · ignore
pub fn crypto(&self, id: impl Into<String>) -> crate::domains::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.

discovery function#

rust · ignore
pub fn discovery(&self) -> crate::domains::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.

economic function#

rust · ignore
pub fn economic(&self, series_id: impl Into<String>) -> crate::domains::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.

economic_catalog function#

rust · ignore
pub fn economic_catalog(&self) -> crate::domains::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.

filings function#

rust · ignore
pub fn filings(&self, symbol: impl Into<String>) -> crate::domains::Filings

Create a Filings handle backed by this provider set.

Always available — EDGAR is auto-injected when no other FILINGS provider is configured.

forex function#

rust · ignore
pub fn forex( &self, from: impl Into<String>, to: impl Into<String>, ) -> crate::domains::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.

from_set function#

rust · ignore
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.

futures function#

rust · ignore
pub fn futures(&self, symbol: impl Into<String>) -> crate::domains::FuturesContract

Create a FuturesContract handle backed by this provider set.

health function#

rust · ignore
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#

no_run
use finance_query::Providers;

# async fn example() -> Result<(), Box<dyn std::error::Error>> {
let providers = Providers::builder().build().await?;
for health in providers.health() {
    println!("{:?}: healthy={}", health.provider, health.is_healthy);
}
# Ok(())
# }

index function#

rust · ignore
pub fn index(&self, symbol: impl Into<String>) -> crate::domains::Index

Create an Index handle backed by this provider set.

market function#

rust · ignore
pub fn market(&self) -> crate::domains::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).

snapshot function#

rust · ignore
pub fn snapshot(&self) -> crate::domains::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.

ticker function#

rust · ignore
pub fn ticker(&self, symbol: impl Into<String>) -> crate::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.

tickers function#

rust · ignore
pub fn tickers<S, I>(&self, symbols: I) -> crate::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.

finance_query::providers::config::ProvidersBuilder#

api_key function#

rust · ignore
pub fn api_key(mut self, provider: Provider, key: impl Into<String>) -> Self

Set provider's API key for the [Providers] this builds, instead of the process-global key from its init function.

Two Providers can hold different keys for the same provider, and a key can be replaced without restarting. Each distinct key gets its own rate-limit budget. Providers left unset fall back to the process-global key, then to the environment variable.

endpoint function#

rust · ignore
pub fn endpoint(mut self, provider: Provider, base_url: impl Into<String>) -> Self

Send this provider's requests to a compatible service or local HTTP fixture.

Only HTTPS and loopback HTTP origins are accepted, and continuations cannot leave the origin. No global endpoint is modified. Requires an explicit api_key and a provider whose adapter accepts an endpoint.

fetch function#

rust · ignore
pub fn fetch(mut self, mode: Fetch) -> Self

Configure how providers are queried. Default: Sequential.

Use [Fetch::Sequential] or [Fetch::Parallel].

lang function#

rust · ignore
pub fn lang(mut self, lang: impl Into<String>) -> Self

Set the language code (e.g., "en-US", "ja-JP").

Inherited by every Ticker/Tickers handle created from the built [Providers]. With the translation feature, a non-English language translates text fields on those handles automatically.

region function#

rust · ignore
pub fn region(mut self, region: crate::constants::Region) -> Self

Set the region (automatically sets lang and region code).

requests_per_minute function#

rust · ignore
pub fn requests_per_minute(mut self, provider: Provider, limit: u32) -> Self

Set the request budget for this provider's API key. Zero is rejected by build.

Instances using the same key share one bucket: the most recently built explicit budget sets its rate, and instances without one never change it. Requires an explicit api_key and a provider whose adapter accepts a budget.

retry function#

rust · ignore
pub fn retry(mut self, policy: RetryPolicy) -> Self

Opt into retrying FinanceError::RateLimited errors during dispatch See [RetryPolicy] for the exact semantics.

Default is no retry — omitting this call preserves the exact prior behavior: a RateLimited error is treated like any other failure and dispatch moves straight to the next routed provider.

with_adapter function#

rust · ignore
pub fn with_adapter(mut self, adapter: Arc<dyn crate::ProviderAdapter>) -> Self

Register an adapter this crate does not build itself.

Route to it by the id its ProviderCore::id returns, usually [Provider::Custom]. Registering alone does not route anything: a capability with no explicit route still falls back to its default provider.

no_run
# use std::sync::Arc;
# use finance_query::{Capability, Provider, Providers, ProviderAdapter};
# async fn f(my_adapter: Arc<dyn ProviderAdapter>) -> finance_query::Result<()> {
let providers = Providers::builder()
    .with_adapter(my_adapter)
    .route(Capability::ECONOMIC, [Provider::custom("my-source")])
    .build()
    .await?;
# let _ = providers;
# Ok(())
# }

finance_query::providers::operation::Operation#

capability function#

rust · ignore
pub fn capability(self) -> Capability

The coarser [Capability] bit this operation falls under.

finance_query::providers::provider::Provider#

capabilities function#

rust · ignore
pub fn capabilities(self) -> Capability

Capability bitflags for this provider variant, derived from each adapter's as_* accessor overrides — implementing a capability trait and declaring it can no longer drift apart. Yahoo is the one exception: constructing YahooProvider needs a live auth handshake, so its set is a const declared beside its accessor overrides (yahoo::CAPS).

[Provider::Custom] returns [Capability::NONE]. An id carries no adapter, so a custom provider's real set is ProviderAdapter::capabilities on the registered instance.

custom function#

rust · ignore
pub fn custom(id: &'static str) -> Self

A provider this crate does not build, identified by id.

Interning is process-wide and append-only, so the same id always maps to the same value and Provider::custom("x") == Provider::custom("x").

finance_query::providers::retry::RetryPolicy#

base_delay function#

rust · ignore
pub fn base_delay(mut self, delay: Duration) -> Self

Override the base delay (see [RetryPolicy::base_delay] field docs).

jitter function#

rust · ignore
pub fn jitter(mut self, jitter: f64) -> Self

Override the jitter fraction (see [RetryPolicy::jitter] field docs).

max_delay function#

rust · ignore
pub fn max_delay(mut self, max_delay: Duration) -> Self

Override the max delay cap (see [RetryPolicy::max_delay] field docs).

max_retry_after function#

rust · ignore
pub fn max_retry_after(mut self, max_retry_after: Duration) -> Self

Override the cap on an explicit retry_after hint (see [RetryPolicy::max_retry_after] field docs).

multiplier function#

rust · ignore
pub fn multiplier(mut self, multiplier: f64) -> Self

Override the backoff multiplier (see [RetryPolicy::multiplier] field docs).

finance_query::quote#

AssetProfile struct#

rust · ignore
pub struct AssetProfile { pub address1: Option<String>, pub address2: Option<String>, pub address3: Option<String>, pub city: Option<String>, pub state: Option<String>, pub zip: Option<String>, pub country: Option<String>, pub phone: Option<String>, pub fax: Option<String>, pub website: Option<String>, pub industry: Option<String>, pub industry_key: Option<String>, pub industry_disp: Option<String>, pub sector: Option<String>, pub sector_key: Option<String>, pub sector_disp: Option<String>, pub long_business_summary: Option<String>, pub full_time_employees: Option<i64>, pub company_officers: Vec<CompanyOfficer>, pub audit_risk: Option<i32>, pub board_risk: Option<i32>, pub compensation_risk: Option<i32>, pub shareholder_rights_risk: Option<i32>, pub overall_risk: Option<i32>, pub governance_epoch_date: Option<i64>, pub compensation_as_of_epoch_date: Option<i64>, pub max_age: Option<i64> }

CalendarEvents struct#

rust · ignore
pub struct CalendarEvents { pub max_age: Option<i64>, pub earnings: Option<EarningsCalendar>, pub ex_dividend_date: Option<FormattedValue<i64>>, pub dividend_date: Option<FormattedValue<i64>> }

CompanyOfficer struct#

rust · ignore
pub struct CompanyOfficer { pub max_age: Option<i64>, pub name: Option<String>, pub age: Option<i32>, pub title: Option<String>, pub year_born: Option<i32>, pub fiscal_year: Option<i32>, pub total_pay: Option<crate::models::quote::FormattedValue<i64>>, pub exercised_value: Option<crate::models::quote::FormattedValue<i64>>, pub unexercised_value: Option<crate::models::quote::FormattedValue<i64>> }

DefaultKeyStatistics struct#

rust · ignore
pub struct DefaultKeyStatistics<F: Format = Both> { pub week_52_change: Option<F::Value<f64>>, pub sand_p_52_week_change: Option<F::Value<f64>>, pub annual_holdings_turnover: Option<Value>, pub annual_report_expense_ratio: Option<Value>, pub beta: Option<F::Value<f64>>, pub beta3_year: Option<Value>, pub book_value: Option<F::Value<f64>>, pub category: Option<String>, pub date_short_interest: Option<F::Value<i64>>, pub earnings_quarterly_growth: Option<F::Value<f64>>, pub enterprise_to_ebitda: Option<F::Value<f64>>, pub enterprise_to_revenue: Option<F::Value<f64>>, pub enterprise_value: Option<F::Value<i64>>, pub five_year_average_return: Option<Value>, pub float_shares: Option<F::Value<i64>>, pub forward_eps: Option<F::Value<f64>>, pub forward_pe: Option<F::Value<f64>>, pub fund_family: Option<String>, pub fund_inception_date: Option<Value>, pub funding_to_date: Option<Value>, pub held_percent_insiders: Option<F::Value<f64>>, pub held_percent_institutions: Option<F::Value<f64>>, pub implied_shares_outstanding: Option<F::Value<i64>>, pub last_cap_gain: Option<Value>, pub last_dividend_date: Option<F::Value<i64>>, pub last_dividend_value: Option<F::Value<f64>>, pub last_fiscal_year_end: Option<F::Value<i64>>, pub last_split_date: Option<F::Value<i64>>, pub last_split_factor: Option<String>, pub latest_amount_raised: Option<Value>, pub latest_funding_date: Option<Value>, pub latest_implied_valuation: Option<Value>, pub latest_share_class: Option<String>, pub lead_investor: Option<String>, pub legal_type: Option<String>, pub max_age: Option<i64>, pub morning_star_overall_rating: Option<Value>, pub morning_star_risk_rating: Option<Value>, pub most_recent_quarter: Option<F::Value<i64>>, pub net_income_to_common: Option<F::Value<i64>>, pub next_fiscal_year_end: Option<F::Value<i64>>, pub peg_ratio: Option<Value>, pub price_hint: Option<F::Value<i64>>, pub price_to_book: Option<F::Value<f64>>, pub price_to_sales_trailing12_months: Option<Value>, pub profit_margins: Option<F::Value<f64>>, pub qtd_return: Option<Value>, pub revenue_quarterly_growth: Option<Value>, pub shares_outstanding: Option<F::Value<i64>>, pub shares_percent_shares_out: Option<F::Value<f64>>, pub shares_short: Option<F::Value<i64>>, pub shares_short_previous_month_date: Option<F::Value<i64>>, pub shares_short_prior_month: Option<F::Value<i64>>, pub short_percent_of_float: Option<F::Value<f64>>, pub short_ratio: Option<F::Value<f64>>, pub three_year_average_return: Option<Value>, pub total_assets: Option<Value>, pub total_funding_rounds: Option<Value>, pub trailing_eps: Option<F::Value<f64>>, pub yield_value: Option<Value>, pub ytd_return: Option<Value> }

Earnings struct#

rust · ignore
pub struct Earnings { pub default_methodology: Option<String>, pub earnings_chart: Option<EarningsChart>, pub financials_chart: Option<FinancialsChart> }

EarningsHistory struct#

rust · ignore
pub struct EarningsHistory { pub default_methodology: Option<String>, pub history: Vec<EarningsHistoryEntry> }

EarningsTrend struct#

rust · ignore
pub struct EarningsTrend { pub default_methodology: Option<String>, pub max_age: Option<i64>, pub trend: Vec<EarningsTrendPeriod> }

EquityPerformance struct#

rust · ignore
pub struct EquityPerformance { pub max_age: Option<i64>, pub benchmark: Option<Benchmark>, pub performance_overview: Option<PerformanceOverview>, pub performance_overview_benchmark: Option<PerformanceOverview> }

FinancialData struct#

rust · ignore
pub struct FinancialData<F: Format = Both> { pub current_price: Option<F::Value<f64>>, pub current_ratio: Option<F::Value<f64>>, pub debt_to_equity: Option<F::Value<f64>>, pub earnings_growth: Option<F::Value<f64>>, pub ebitda: Option<F::Value<i64>>, pub ebitda_margins: Option<F::Value<f64>>, pub financial_currency: Option<String>, pub free_cashflow: Option<F::Value<i64>>, pub gross_margins: Option<F::Value<f64>>, pub gross_profits: Option<F::Value<i64>>, pub max_age: Option<i64>, pub number_of_analyst_opinions: Option<F::Value<i64>>, pub operating_cashflow: Option<F::Value<i64>>, pub operating_margins: Option<F::Value<f64>>, pub profit_margins: Option<F::Value<f64>>, pub quick_ratio: Option<F::Value<f64>>, pub recommendation_key: Option<String>, pub recommendation_mean: Option<F::Value<f64>>, pub return_on_assets: Option<F::Value<f64>>, pub return_on_equity: Option<F::Value<f64>>, pub revenue_growth: Option<F::Value<f64>>, pub revenue_per_share: Option<F::Value<f64>>, pub target_high_price: Option<F::Value<f64>>, pub target_low_price: Option<F::Value<f64>>, pub target_mean_price: Option<F::Value<f64>>, pub target_median_price: Option<F::Value<f64>>, pub total_cash: Option<F::Value<i64>>, pub total_cash_per_share: Option<F::Value<f64>>, pub total_debt: Option<F::Value<i64>>, pub total_revenue: Option<F::Value<i64>> }

FundOwnership struct#

rust · ignore
pub struct FundOwnership { pub max_age: Option<i64>, pub ownership_list: Vec<FundOwner> }

FundPerformance struct#

rust · ignore
pub struct FundPerformance { pub max_age: Option<i64>, pub fund_category_name: Option<String>, pub performance_overview: Option<PerformanceOverview>, pub performance_overview_cat: Option<PerformanceOverviewCat>, pub trailing_returns: Option<TrailingReturns>, pub trailing_returns_nav: Option<TrailingReturnsNav>, pub trailing_returns_cat: Option<TrailingReturnsCat>, pub annual_total_returns: Option<AnnualTotalReturns>, pub past_quarterly_returns: Option<PastQuarterlyReturns>, pub risk_overview_statistics: Option<RiskOverviewStatistics>, pub risk_overview_statistics_cat: Option<RiskOverviewStatisticsCat> }

FundProfile struct#

rust · ignore
pub struct FundProfile { pub max_age: Option<i64>, pub style_box_url: Option<String>, pub family: Option<String>, pub category_name: Option<String>, pub legal_type: Option<String>, pub management_info: Option<ManagementInfo>, pub fees_expenses_investment: Option<FeesExpenses>, pub fees_expenses_investment_cat: Option<FeesExpensesCat>, pub brokerages: Option<Vec<String>> }

IndexTrend struct#

rust · ignore
pub struct IndexTrend { pub max_age: Option<i64>, pub symbol: Option<String>, pub estimates: Option<Vec<TrendEstimate>>, pub pe_ratio: Option<FormattedValue<f64>>, pub peg_ratio: Option<FormattedValue<f64>> }

IndustryTrend struct#

rust · ignore
pub struct IndustryTrend { pub max_age: Option<i64>, pub symbol: Option<String>, pub estimates: Option<Vec<TrendEstimate>>, pub pe_ratio: Option<FormattedValue<f64>>, pub peg_ratio: Option<FormattedValue<f64>> }

InsiderHolders struct#

rust · ignore
pub struct InsiderHolders { pub holders: Vec<InsiderHolder> }

InsiderTransactions struct#

rust · ignore
pub struct InsiderTransactions { pub max_age: Option<i64>, pub transactions: Vec<InsiderTransaction> }

InstitutionOwnership struct#

rust · ignore
pub struct InstitutionOwnership { pub max_age: Option<i64>, pub ownership_list: Vec<InstitutionOwner> }

MajorHoldersBreakdown struct#

rust · ignore
pub struct MajorHoldersBreakdown { pub insiders_percent_held: Option<crate::models::quote::FormattedValue<f64>>, pub institutions_count: Option<crate::models::quote::FormattedValue<i64>>, pub institutions_float_percent_held: Option<crate::models::quote::FormattedValue<f64>>, pub institutions_percent_held: Option<crate::models::quote::FormattedValue<f64>>, pub max_age: Option<i64> }

NetSharePurchaseActivity struct#

rust · ignore
pub struct NetSharePurchaseActivity { pub period: Option<String>, pub buy_info_count: Option<crate::models::quote::FormattedValue<i64>>, pub buy_info_shares: Option<crate::models::quote::FormattedValue<i64>>, pub buy_percent_insider_shares: Option<crate::models::quote::FormattedValue<f64>>, pub sell_info_count: Option<crate::models::quote::FormattedValue<i64>>, pub sell_info_shares: Option<crate::models::quote::FormattedValue<i64>>, pub sell_percent_insider_shares: Option<crate::models::quote::FormattedValue<f64>>, pub net_info_count: Option<crate::models::quote::FormattedValue<i64>>, pub net_info_shares: Option<crate::models::quote::FormattedValue<i64>>, pub net_percent_insider_shares: Option<crate::models::quote::FormattedValue<f64>>, pub total_insider_shares: Option<crate::models::quote::FormattedValue<i64>>, pub max_age: Option<i64> }

Price struct#

rust · ignore
pub struct Price<F: Format = Both> { pub max_age: Option<i64>, pub pre_market_change_percent: Option<F::Value<f64>>, pub pre_market_change: Option<F::Value<f64>>, pub pre_market_time: Option<i64>, pub pre_market_price: Option<F::Value<f64>>, pub pre_market_source: Option<String>, pub post_market_change_percent: Option<F::Value<f64>>, pub post_market_change: Option<F::Value<f64>>, pub post_market_time: Option<i64>, pub post_market_price: Option<F::Value<f64>>, pub post_market_source: Option<String>, pub regular_market_change_percent: Option<F::Value<f64>>, pub regular_market_change: Option<F::Value<f64>>, pub regular_market_time: Option<i64>, pub price_hint: Option<F::Value<i64>>, pub regular_market_price: Option<F::Value<f64>>, pub regular_market_day_high: Option<F::Value<f64>>, pub regular_market_day_low: Option<F::Value<f64>>, pub regular_market_volume: Option<F::Value<i64>>, pub average_daily_volume10_day: Option<F::Value<i64>>, pub average_daily_volume3_month: Option<F::Value<i64>>, pub regular_market_previous_close: Option<F::Value<f64>>, pub regular_market_source: Option<String>, pub regular_market_open: Option<F::Value<f64>>, pub exchange: Option<String>, pub exchange_name: Option<String>, pub exchange_data_delayed_by: Option<i32>, pub market_state: Option<String>, pub quote_type: Option<String>, pub symbol: Option<String>, pub underlying_symbol: Option<String>, pub short_name: Option<String>, pub long_name: Option<String>, pub currency: Option<String>, pub quote_source_name: Option<String>, pub currency_symbol: Option<String>, pub from_currency: Option<String>, pub to_currency: Option<String>, pub last_market: Option<String>, pub market_cap: Option<F::Value<i64>> }

QuoteTypeData struct#

rust · ignore
pub struct QuoteTypeData { pub exchange: Option<String>, pub first_trade_date_epoch_utc: Option<i64>, pub gmt_off_set_milliseconds: Option<i64>, pub long_name: Option<String>, pub max_age: Option<i64>, pub message_board_id: Option<String>, pub quote_type: Option<String>, pub short_name: Option<String>, pub symbol: Option<String>, pub time_zone_full_name: Option<String>, pub time_zone_short_name: Option<String>, pub underlying_symbol: Option<String>, pub uuid: Option<String> }

RecommendationTrend struct#

rust · ignore
pub struct RecommendationTrend { pub trend: Vec<RecommendationPeriod>, pub max_age: Option<i64> }

SecFilings struct#

rust · ignore
pub struct SecFilings { pub max_age: Option<i64>, pub filings: Vec<SecFiling> }

SectorTrend struct#

rust · ignore
pub struct SectorTrend { pub max_age: Option<i64>, pub symbol: Option<String>, pub estimates: Option<Vec<TrendEstimate>>, pub pe_ratio: Option<FormattedValue<f64>>, pub peg_ratio: Option<FormattedValue<f64>> }

SummaryDetail struct#

rust · ignore
pub struct SummaryDetail<F: Format = Both> { pub algorithm: Option<Value>, pub all_time_high: Option<F::Value<f64>>, pub all_time_low: Option<F::Value<f64>>, pub ask: Option<F::Value<f64>>, pub ask_size: Option<F::Value<i64>>, pub average_daily_volume10_day: Option<F::Value<i64>>, pub average_volume: Option<F::Value<i64>>, pub average_volume10days: Option<F::Value<i64>>, pub beta: Option<F::Value<f64>>, pub bid: Option<F::Value<f64>>, pub bid_size: Option<F::Value<i64>>, pub circulating_supply: Option<Value>, pub coin_market_cap_link: Option<Value>, pub currency: Option<String>, pub day_high: Option<F::Value<f64>>, pub day_low: Option<F::Value<f64>>, pub dividend_rate: Option<F::Value<f64>>, pub dividend_yield: Option<F::Value<f64>>, pub ex_dividend_date: Option<F::Value<i64>>, pub expire_date: Option<Value>, pub fifty_day_average: Option<F::Value<f64>>, pub fifty_two_week_high: Option<F::Value<f64>>, pub fifty_two_week_low: Option<F::Value<f64>>, pub five_year_avg_dividend_yield: Option<F::Value<f64>>, pub forward_pe: Option<F::Value<f64>>, pub from_currency: Option<String>, pub last_market: Option<String>, pub market_cap: Option<F::Value<i64>>, pub max_age: Option<i64>, pub max_supply: Option<Value>, pub nav_price: Option<F::Value<f64>>, pub open: Option<F::Value<f64>>, pub open_interest: Option<Value>, pub payout_ratio: Option<F::Value<f64>>, pub previous_close: Option<F::Value<f64>>, pub price_hint: Option<F::Value<i64>>, pub price_to_sales_trailing12_months: Option<F::Value<f64>>, pub qtd_return: Option<Value>, pub regular_market_day_high: Option<F::Value<f64>>, pub regular_market_day_low: Option<F::Value<f64>>, pub regular_market_open: Option<F::Value<f64>>, pub regular_market_previous_close: Option<F::Value<f64>>, pub regular_market_volume: Option<F::Value<i64>>, pub start_date: Option<Value>, pub strike_price: Option<Value>, pub to_currency: Option<String>, pub total_assets: Option<F::Value<i64>>, pub tradeable: Option<bool>, pub trailing_annual_dividend_rate: Option<F::Value<f64>>, pub trailing_annual_dividend_yield: Option<F::Value<f64>>, pub trailing_pe: Option<F::Value<f64>>, pub two_hundred_day_average: Option<F::Value<f64>>, pub volume: Option<F::Value<i64>>, pub volume24_hr: Option<Value>, pub volume_all_currencies: Option<Value>, pub yield_value: Option<F::Value<f64>>, pub ytd_return: Option<Value> }

SummaryProfile struct#

rust · ignore
pub struct SummaryProfile { pub address1: Option<String>, pub city: Option<String>, pub company_officers: Option<Vec<Value>>, pub country: Option<String>, pub executive_team: Option<Vec<Value>>, pub full_time_employees: Option<i64>, pub industry: Option<String>, pub industry_disp: Option<String>, pub industry_key: Option<String>, pub ir_website: Option<String>, pub long_business_summary: Option<String>, pub max_age: Option<i64>, pub phone: Option<String>, pub sector: Option<String>, pub sector_disp: Option<String>, pub sector_key: Option<String>, pub state: Option<String>, pub website: Option<String>, pub zip: Option<String> }

TopHoldings struct#

rust · ignore
pub struct TopHoldings { pub max_age: Option<i64>, pub cash_position: Option<FormattedValue<f64>>, pub stock_position: Option<FormattedValue<f64>>, pub bond_position: Option<FormattedValue<f64>>, pub other_position: Option<FormattedValue<f64>>, pub preferred_position: Option<FormattedValue<f64>>, pub convertible_position: Option<FormattedValue<f64>>, pub holdings: Option<Vec<Holding>>, pub equity_holdings: Option<EquityHoldings>, pub bond_holdings: Option<serde_json::Value>, pub bond_ratings: Option<Vec<BondRating>>, pub sector_weightings: Option<SectorWeighting> }

UpgradeDowngradeHistory struct#

rust · ignore
pub struct UpgradeDowngradeHistory { pub history: Vec<GradeChange>, pub max_age: Option<i64> }

finance_query::risk#

RiskSummary struct#

rust · ignore
pub struct RiskSummary { pub var_95: f64, pub var_99: f64, pub parametric_var_95: f64, pub cvar_95: f64, pub cvar_99: f64, pub parametric_cvar_95: f64, pub omega: f64, pub kelly: f64, pub sharpe: Option<f64>, pub sortino: Option<f64>, pub calmar: Option<f64>, pub beta: Option<f64>, pub max_drawdown: f64, pub max_drawdown_recovery_periods: Option<u64>, pub ulcer_index: f64, pub information_ratio: Option<f64>, pub tracking_error: Option<f64> }

Comprehensive risk summary for a symbol.

Obtain via Ticker::risk.

beta function#

rust · ignore
pub fn beta(asset_returns: &[f64], benchmark_returns: &[f64]) -> Option<f64>
measured as `finance_query::risk_beta`
instructions/iter270416
callgrind Ir/iter270416
median walltime (ns)61228
p99 walltime (ns)61609
allocations/iter0
allocated bytes/iter0

calmar_ratio function#

rust · ignore
pub fn calmar_ratio(total_return: f64, years: f64, max_drawdown: f64) -> Option<f64>
measured as `finance_query::risk_calmar`
instructions/iter156
callgrind Ir/iter156
median walltime (ns)16
p99 walltime (ns)17
allocations/iter0
allocated bytes/iter0

historical_cvar function#

rust · ignore
pub fn historical_cvar(returns: &[f64], confidence: f64) -> Option<f64>
measured as `finance_query::risk_historical_cvar`
instructions/iter4313739
callgrind Ir/iter4313739
median walltime (ns)335372
p99 walltime (ns)340331
allocations/iter2
allocated bytes/iter262144

historical_var function#

rust · ignore
pub fn historical_var(returns: &[f64], confidence: f64) -> Option<f64>
measured as `finance_query::risk_historical_var`
instructions/iter31047001
callgrind Ir/iter31047001
median walltime (ns)2501552
p99 walltime (ns)2546665
allocations/iter2
allocated bytes/iter1600000

information_ratio function#

rust · ignore
pub fn information_ratio( asset_returns: &[f64], benchmark_returns: &[f64], periods_per_year: f64, ) -> Option<f64>
measured as `finance_query::risk_information_ratio`
instructions/iter145879
callgrind Ir/iter145879
median walltime (ns)35535
p99 walltime (ns)36010
allocations/iter1
allocated bytes/iter131072

kelly_criterion function#

rust · ignore
pub fn kelly_criterion(win_rate: f64, avg_win_pct: f64, avg_loss_pct: f64) -> f64
measured as `finance_query::risk_kelly_criterion`
instructions/iter30958
callgrind Ir/iter30958
median walltime (ns)3783
p99 walltime (ns)3918
allocations/iter16
allocated bytes/iter16320

max_drawdown function#

rust · ignore
pub fn max_drawdown(returns: &[f64]) -> DrawdownResult
measured as `finance_query::risk_max_drawdown`
instructions/iter35115
callgrind Ir/iter35115
median walltime (ns)8032
p99 walltime (ns)8113
allocations/iter1
allocated bytes/iter8008

omega_ratio function#

rust · ignore
pub fn omega_ratio(returns: &[f64]) -> f64
measured as `finance_query::risk_omega_ratio`
instructions/iter143401
callgrind Ir/iter143401
median walltime (ns)30575
p99 walltime (ns)30748
allocations/iter0
allocated bytes/iter0

parametric_cvar function#

rust · ignore
pub fn parametric_cvar(returns: &[f64], confidence: f64) -> Option<f64>
measured as `finance_query::risk_parametric_cvar`
instructions/iter100416
callgrind Ir/iter100416
median walltime (ns)30601
p99 walltime (ns)30897
allocations/iter0
allocated bytes/iter0

parametric_var function#

rust · ignore
pub fn parametric_var(returns: &[f64], confidence: f64) -> Option<f64>
measured as `finance_query::risk_parametric_var`
instructions/iter100412
callgrind Ir/iter100412
median walltime (ns)30606
p99 walltime (ns)30737
allocations/iter0
allocated bytes/iter0

sharpe_ratio function#

rust · ignore
pub fn sharpe_ratio(returns: &[f64], risk_free_rate: f64, periods_per_year: f64) -> Option<f64>
measured as `finance_query::risk_sharpe`
instructions/iter100406
callgrind Ir/iter100406
median walltime (ns)30612
p99 walltime (ns)30852
allocations/iter0
allocated bytes/iter0

sortino_ratio function#

rust · ignore
pub fn sortino_ratio(returns: &[f64], risk_free_rate: f64, periods_per_year: f64) -> Option<f64>
measured as `finance_query::risk_sortino`
instructions/iter170035
callgrind Ir/iter170035
median walltime (ns)30606
p99 walltime (ns)31391
allocations/iter0
allocated bytes/iter0

tracking_error function#

rust · ignore
pub fn tracking_error( asset_returns: &[f64], benchmark_returns: &[f64], periods_per_year: f64, ) -> Option<f64>
measured as `finance_query::risk_tracking_error`
instructions/iter145876
callgrind Ir/iter145876
median walltime (ns)35680
p99 walltime (ns)36407
allocations/iter1
allocated bytes/iter131072

ulcer_index function#

rust · ignore
pub fn ulcer_index(returns: &[f64]) -> f64
measured as `finance_query::risk_ulcer_index`
instructions/iter619414
callgrind Ir/iter619414
median walltime (ns)174433
p99 walltime (ns)175435
allocations/iter2
allocated bytes/iter262160

win_loss_stats function#

rust · ignore
pub fn win_loss_stats(returns: &[f64]) -> (f64, f64, f64)
measured as `finance_query::risk_win_loss_stats`
instructions/iter389693
callgrind Ir/iter389693
median walltime (ns)171067
p99 walltime (ns)177110
allocations/iter25
allocated bytes/iter393152

finance_query::risk::drawdown#

DrawdownResult struct#

rust · ignore
pub struct DrawdownResult { pub max_drawdown: f64, pub recovery_periods: Option<u64> }

Maximum drawdown result.

finance_query::streaming#

AlertCondition enum#

rust · ignore
pub enum AlertCondition { CrossesAbove(f64), CrossesBelow(f64), PriceAbove(f64), PriceBelow(f64), PercentChangeAbove(f64), PercentChangeBelow(f64), VolumeAbove(i64) }

AlertConditionKind enum#

rust · ignore
pub enum AlertConditionKind { CrossesAbove, CrossesBelow, PriceAbove, PriceBelow, PercentChangeAbove, PercentChangeBelow, VolumeAbove }

AlertEvaluator struct#

rust · ignore
pub struct AlertEvaluator {  }

AlertEvent struct#

rust · ignore
pub struct AlertEvent { pub symbol: String, pub condition: AlertCondition, pub price: f32, pub previous_price: Option<f32>, pub change_percent: f32, pub time: i64, pub update: PriceUpdate }

AlertExt trait#

rust · ignore
pub trait AlertExt: Stream<Item = PriceUpdate> + Sized + Unpin

AlertRule struct#

rust · ignore
pub struct AlertRule { pub symbol: String, pub condition: AlertCondition, pub repeat: bool }

AlertStream struct#

rust · ignore
pub struct AlertStream<S> {  }

AssetClass enum#

rust · ignore
pub enum AssetClass { Stocks, Options, Forex, Crypto, Futures, Indices }

Batched struct#

rust · ignore
pub struct Batched<S> where S: Stream, {  }

BookLevel struct#

rust · ignore
pub struct BookLevel { pub price: f64, pub size: f64 }

DepthStream struct#

rust · ignore
stream_handle! {  }

DepthStreamBuilder struct#

rust · ignore
pub struct DepthStreamBuilder {  }

EconomicStream struct#

rust · ignore
stream_handle! {  }

EconomicStreamBuilder struct#

rust · ignore
pub struct EconomicStreamBuilder {  }

Greeks struct#

rust · ignore
pub struct Greeks { pub delta: Option<f64>, pub gamma: Option<f64>, pub theta: Option<f64>, pub vega: Option<f64> }

MarketHoursType enum#

rust · ignore
pub enum MarketHoursType { PreMarket, RegularMarket, PostMarket, ExtendedHoursMarket }

NewsStream struct#

rust · ignore
pub struct NewsStream {  }

NewsStreamBuilder struct#

rust · ignore
pub struct NewsStreamBuilder {  }

OptionContractUpdate struct#

rust · ignore
pub struct OptionContractUpdate { pub contract_symbol: String, pub underlying: String, pub expiration: Option<i64>, pub strike: Option<f64>, pub option_type: Option<OptionType>, pub bid: Option<f64>, pub bid_size: Option<f64>, pub ask: Option<f64>, pub ask_size: Option<f64>, pub last_price: Option<f64>, pub last_size: Option<f64>, pub volume: Option<i64>, pub open_interest: Option<i64>, pub implied_volatility: Option<f64>, pub greeks: Option<Greeks>, pub time: i64 }

OptionType enum#

rust · ignore
pub enum OptionType { Call, Put }

OptionsChainStream struct#

rust · ignore
stream_handle! {  }

OptionsChainStreamBuilder struct#

rust · ignore
pub struct OptionsChainStreamBuilder {  }

OrderBookUpdate struct#

rust · ignore
pub struct OrderBookUpdate { pub symbol: String, pub bids: Vec<BookLevel>, pub asks: Vec<BookLevel>, pub exchange: Option<i32>, pub time: i64 }

PriceSource enum#

rust · ignore
pub enum PriceSource { Yahoo, Polygon(crate::streaming::AssetClass) }

PriceStream struct#

rust · ignore
pub struct PriceStream {  }

PriceStreamBuilder struct#

rust · ignore
pub struct PriceStreamBuilder {  }

PriceUpdate struct#

rust · ignore
pub struct PriceUpdate { pub id: String, pub price: f32, pub time: i64, pub currency: String, pub exchange: String, pub quote_type: QuoteType, pub market_hours: MarketHoursType, pub change_percent: f32, pub day_volume: i64, pub day_high: f32, pub day_low: f32, pub change: f32, pub short_name: String, pub expire_date: i64, pub open_price: f32, pub previous_close: f32, pub strike_price: f32, pub underlying_symbol: String, pub open_interest: i64, pub options_type: OptionType, pub mini_option: i64, pub last_size: i64, pub bid: f32, pub bid_size: i64, pub ask: f32, pub ask_size: i64, pub price_hint: i64, pub vol_24hr: i64, pub vol_all_currencies: i64, pub from_currency: String, pub last_market: String, pub circulating_supply: f64, pub market_cap: f64 }
measured as `finance_query::stream_deserialize`
instructions/iter14301
callgrind Ir/iter14301
median walltime (ns)1088
p99 walltime (ns)1142
allocations/iter4
allocated bytes/iter20
measured as `finance_query::stream_serialize`
instructions/iter10463
callgrind Ir/iter10463
median walltime (ns)941
p99 walltime (ns)1005
allocations/iter4
allocated bytes/iter1920

QuoteType enum#

rust · ignore
pub enum QuoteType { None, AltSymbol, Heartbeat, Equity, Index, MutualFund, MoneyMarket, Option, Currency, Warrant, Bond, Future, Etf, Commodity, EcnQuote, Cryptocurrency, Indicator, Industry }

SeriesUpdate struct#

rust · ignore
pub struct SeriesUpdate { pub series_id: String, pub date: String, pub value: Option<f64>, pub previous_value: Option<f64>, pub revision: bool, pub observed_at: i64 }

StreamBatchExt trait#

rust · ignore
pub trait StreamBatchExt: Stream + Sized + Unpin

StreamError enum#

rust · ignore
pub enum StreamError { ConnectionFailed(String), WebSocketError(String), DecodeError(String) }

StreamResult type_alias#

rust · ignore
pub type StreamResult<T> = std::result::Result<T, StreamError>

TradeStream struct#

rust · ignore
stream_handle! {  }

TradeStreamBuilder struct#

rust · ignore
pub struct TradeStreamBuilder {  }

TradeTick struct#

rust · ignore
pub struct TradeTick { pub symbol: String, pub price: f64, pub size: f64, pub exchange: Option<i32>, pub conditions: Vec<i32>, pub trade_id: Option<String>, pub time: i64 }

finance_query::streaming::book::DepthStreamBuilder#

max_reconnect_attempts function#

rust · ignore
stream_builder!( DepthStreamBuilder, pairs = "Add crypto pairs to subscribe to." )

Cap the number of consecutive reconnect attempts before the stream gives up and ends (default: unlimited, i.e. retry forever).

finance_query::streaming::client::PriceStreamBuilder#

max_reconnect_attempts function#

rust · ignore
pub fn max_reconnect_attempts(mut self, max: u32) -> Self

Cap the number of consecutive reconnect attempts before the stream gives up and ends (default: unlimited, i.e. retry forever).

finance_query::streaming::news::NewsStream#

resubscribe function#

rust · ignore
pub fn resubscribe(&self) -> Self

Create a new receiver for this stream.

Useful when you need multiple consumers of the same news subscription.

finance_query::streaming::news::NewsStreamBuilder#

poll_interval function#

rust · ignore
pub fn poll_interval(mut self, interval: Duration) -> Self

Set the interval between polls of all subscribed sources (default: 5 minutes).

finance_query::streaming::options::OptionsChainStreamBuilder#

greeks_refresh function#

rust · ignore
pub fn greeks_refresh(mut self, interval: Option<Duration>) -> Self

Interval between greeks/open-interest snapshot refreshes.

None disables them, leaving only WebSocket bid/ask/last (one REST call per underlying per interval otherwise). Default: 60s.

max_reconnect_attempts function#

rust · ignore
stream_builder!( OptionsChainStreamBuilder, underlyings = "Add underlyings (or full OCC contract symbols) to follow." )

Cap the number of consecutive reconnect attempts before the stream gives up and ends (default: unlimited, i.e. retry forever).

finance_query::streaming::pricing#

MarketHoursTypeProto enum#

rust · ignore
pub enum MarketHoursTypeProto { PreMarket = 0, RegularMarket = 1, PostMarket = 2, ExtendedHoursMarket = 3 }

Protobuf enum for market hours type

QuoteTypeProto enum#

rust · ignore
pub enum QuoteTypeProto { None = 0, AltSymbol = 5, Heartbeat = 7, Equity = 8, Index = 9, MutualFund = 11, MoneyMarket = 12, Option = 13, Currency = 14, Warrant = 15, Bond = 17, Future = 18, Etf = 20, Commodity = 23, EcnQuote = 28, Cryptocurrency = 41, Indicator = 42, Industry = 1000 }

Protobuf enum for quote type

finance_query::streaming::trades::TradeStreamBuilder#

build function#

rust · ignore
pub async fn build(self) -> StreamResult<TradeStream>

Build and start the stream.

Errors#

Returns StreamError::ConnectionFailed when the chosen asset class has no trade feed.

max_reconnect_attempts function#

rust · ignore
stream_builder!(TradeStreamBuilder, symbols = "Add symbols to subscribe to.")

Cap the number of consecutive reconnect attempts before the stream gives up and ends (default: unlimited, i.e. retry forever).

finance_query::ticker::core::Ticker#

builder function#

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

Creates a new builder for Ticker.

calendar function#

rust · ignore
pub async fn calendar( &self, range: TimeRange, ) -> Result<Vec<crate::models::calendar::CalendarEvent>>

Aggregate upcoming financial events for this ticker into a single time-sorted list.

Combines earnings, ex-dividend and dividend-payment dates with standard monthly options expirations, plus — when the fred feature is enabled — a curated set of major economic releases (CPI, NFP, GDP, …). Limited to the forward window [now, now + range] and sorted ascending by timestamp.

Options are best-effort: a symbol with no listed options contributes no expiration events rather than failing the call.

client_handle function#

rust · ignore
pub fn client_handle(&self) -> ClientHandle

Returns a handle to the underlying Yahoo Finance session.

Pass to other builders via .client(handle) to share the authenticated session without a new auth handshake.

Panics#

Panics if this ticker was created via Providers with no Yahoo provider configured. For session sharing across multiple tickers, prefer Providers::ticker instead.

dividend_analytics function#

rust · ignore
pub async fn dividend_analytics(&self, range: TimeRange) -> Result<DividendAnalytics>

Compute dividend analytics for the requested time range.

edgar_company_facts function#

rust · ignore
pub async fn edgar_company_facts(&self) -> Result<CompanyFacts>

Get SEC EDGAR company facts (structured XBRL financial data).

Always uses EDGAR directly — XBRL us-gaap/ifrs/dei fact data is unique to the SEC's EDGAR API. For routable filing data use filings.

edgar_submissions function#

rust · ignore
pub async fn edgar_submissions(&self) -> Result<EdgarSubmissions>

Get SEC EDGAR filing history for this symbol.

Always uses EDGAR directly — this is an EDGAR-specific API (CIK-based submission history and XBRL company facts) that no other provider replicates. For routable provider-agnostic filing data use filings instead.

filings function#

rust · ignore
pub async fn filings(&self) -> Result<ProviderFilings>

Fetch SEC filings via the configured [Capability::FILINGS] provider.

Routes through the provider system; EDGAR is always available as a fallback (auto-injected when no explicit FILINGS route is set). To prefer Polygon: .route(Capability::FILINGS, [Provider::Polygon, Provider::Edgar]).

For the full EDGAR submissions response or structured XBRL data, use edgar_submissions / edgar_company_facts.

financials function#

rust · ignore
pub async fn financials( &self, stmt_type: StatementType, frequency: Frequency, ) -> Result<FinancialStatement>

Get financial statements.

news function#

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

Get news articles for this symbol.

price function#

rust · ignore
super::macros::define_quote_accessors!

Regular, pre- and post-market price, plus the day's range and volume.

quote function#

rust · ignore
pub async fn quote<F>(&self) -> Result<Quote<F>> where F: Format, Quote<Both>: Into<Quote<F>>,

Get full quote data, optionally including logo URLs.

rating_consensus function#

rust · ignore
pub async fn rating_consensus(&self) -> Result<crate::models::fundamentals::RatingConsensus>

Fetch the aggregated analyst rating consensus (grade distribution plus a headline label) via the configured [Capability::FUNDAMENTALS] provider (currently FMP only). Distinct from recommendations, which returns similar symbols.

recommendations function#

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

Get analyst recommendations and similar symbols.

risk function#

rust · ignore
pub async fn risk( &self, interval: Interval, range: TimeRange, benchmark: Option<&str>, ) -> Result<risk::RiskSummary>

Compute a risk summary for this symbol.

finance_query::ticker::core::TickerBuilder#

build function#

rust · ignore
pub async fn build(self) -> Result<Ticker>

Build the Ticker instance.

cache function#

rust · ignore
pub fn cache(mut self, ttl: Duration) -> Self

Cache responses for ttl instead of the default 60 seconds.

no_cache function#

rust · ignore
pub fn no_cache(mut self) -> Self

Disable caching — every call fetches fresh data.

By default a Ticker caches each response for 60 seconds, so repeated accessor calls within that window reuse one fetch.

finance_query::tickers::core::Tickers#

builder function#

rust · ignore
pub fn builder<S, I>(symbols: I) -> TickersBuilder where S: Into<String>, I: IntoIterator<Item = S>,

Creates a new builder for Tickers

charts function#

rust · ignore
pub async fn charts( &self, interval: Interval, range: TimeRange, ) -> Result<BatchChartsResponse>

Batch fetch charts for all symbols concurrently

Chart data cannot be batched in a single request, so this fetches all charts concurrently using tokio for maximum performance.

client_handle function#

rust · ignore
pub fn client_handle(&self) -> ClientHandle

Returns a handle to the underlying Yahoo Finance session.

Pass to Ticker::builder or other [Tickers::builder] calls via .client(handle) to share the authenticated session without a new auth handshake.

Panics#

Panics if these tickers were created via Providers with no Yahoo provider configured. For session sharing across multiple tickers, prefer Providers::tickers instead.

finance_query::tickers::core::TickersBuilder#

logo function#

rust · ignore
pub fn logo(mut self) -> Self

Include company logo URLs in quote responses.

When enabled, quotes() will fetch logo URLs in parallel with the quote batch request, adding a small extra request.

finance_query::translation#

Lang struct#

rust · ignore
pub struct Lang {  }

Translatable trait#

rust · ignore
pub trait Translatable

TranslationBackend trait#

rust · ignore
pub trait TranslationBackend: Send + Sync

set_backend function#

rust · ignore
pub fn set_backend(backend: Arc<dyn TranslationBackend>)
measured as `finance_query::translation_set_backend`
instructions/iter244
callgrind Ir/iter244
median walltime (ns)18
p99 walltime (ns)19
allocations/iter1
allocated bytes/iter16

translate function#

rust · ignore
pub async fn translate<T: Translatable + ?Sized>(value: &mut T, lang: &str) -> Result<()>

Translate the human-readable text fields of a value in place.

lang is a BCP 47 language tag (e.g. "ja", "de-DE", "zh-Hant"). English targets are a no-op. Returns an error for structurally invalid tags or when the machine-translation backend fails; fields not covered by the dictionary are left in English when no backend is available.

measured as `finance_query::translation_translate`
instructions/iter53375
callgrind Ir/iter53375
median walltime (ns)3545
p99 walltime (ns)3677
allocations/iter79
allocated bytes/iter6298

translate_texts function#

rust · ignore
pub async fn translate_texts<S, I>(texts: I, lang: &Lang) -> Result<Vec<String>> where S: Into<String>, I: IntoIterator<Item = S>,

Translate a batch of raw English texts, preserving order.

Applies the dictionary, the process-wide memo cache, and the active machine-translation backend in that order. Texts without a dictionary hit are returned unchanged when no backend is available.

measured as `finance_query::translate_dictionary`
instructions/iter19765
callgrind Ir/iter19765
median walltime (ns)1859
p99 walltime (ns)1870
allocations/iter49
allocated bytes/iter2880

translate_with function#

rust · ignore
pub async fn translate_with<T: Translatable + ?Sized>(value: &mut T, lang: &Lang) -> Result<()>

Like [translate], with an already-parsed [Lang].

measured as `finance_query::translation_translate_with`
instructions/iter52652
callgrind Ir/iter52652
median walltime (ns)3430
p99 walltime (ns)3728
allocations/iter77
allocated bytes/iter6294
built with cargo soothfast docs build source