Quant.Explorer.Providers.YahooFinance (quant v0.1.0-alpha.1)

Yahoo Finance provider implementation.

This module provides access to Yahoo Finance data including:

  • Historical data (OHLCV) with multiple periods and intervals
  • Real-time quotes with streaming support
  • Company information and fundamentals
  • Symbol search functionality
  • Options data (advanced)

All data is returned as Explorer DataFrames for immediate analysis.

Yahoo Finance API Endpoints

  • Historical: https://query1.finance.yahoo.com/v8/finance/chart/{symbol}
  • Quote: https://query1.finance.yahoo.com/v7/finance/quote?symbols={symbols}
  • Search: https://query1.finance.yahoo.com/v1/finance/search?q={query}
  • Options: https://query1.finance.yahoo.com/v7/finance/options/{symbol}

Rate Limiting

Yahoo Finance has burst-tolerant rate limiting (around 100-200 requests/minute). Uses the advanced rate limiter with burst allowance configuration.

Examples

# Historical data
{:ok, df} = YahooFinance.history("AAPL", period: "1y", interval: "1d")

# Multiple symbols
{:ok, df} = YahooFinance.history(["AAPL", "MSFT"], period: "1mo")

# Real-time quotes
{:ok, df} = YahooFinance.quote(["AAPL", "MSFT", "GOOGL"])

# Company information
{:ok, info} = YahooFinance.info("AAPL")

# Symbol search
{:ok, df} = YahooFinance.search("Apple")

# Streaming historical data (large datasets)
stream = YahooFinance.history_stream("AAPL", period: "max", interval: "1d")
df = stream |> Enum.to_list() |> Explorer.DataFrame.concat_rows()

Summary

Functions

Returns a stream of historical data for large datasets.

Fetches options chain data for a symbol.

Types

interval()

@type interval() :: String.t()

options()

@type options() :: keyword()

period()

@type period() :: String.t()

symbol()

@type symbol() :: String.t()

symbols()

@type symbols() :: [symbol()] | symbol()

Functions

history_stream(symbol, opts \\ [])

@spec history_stream(symbol(), options()) :: Enumerable.t()

Returns a stream of historical data for large datasets.

Useful for fetching max period data or when working with multiple intervals. Each chunk is a DataFrame that can be processed independently or combined.

options(symbol, opts \\ [])

@spec options(symbol(), options()) :: {:ok, map()} | {:error, term()}

Fetches options chain data for a symbol.

Returns both calls and puts with various expiration dates.