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

Alpha Vantage data provider for Quant.Explorer.

Provides access to Alpha Vantage's comprehensive financial data including:

  • Historical stock data (daily, weekly, monthly)
  • Real-time quotes
  • Symbol search
  • Company fundamentals
  • Forex and commodity data

Configuration

Requires an API key from Alpha Vantage. Set the ALPHA_VANTAGE_API_KEY environment variable or configure it in your application config:

config :quant,
  api_keys: %{
    alpha_vantage: "your_api_key_here"
  }

Rate Limits

  • Free tier: 25 requests per day, 5 API requests per minute
  • Premium: 75 requests per minute, higher daily limits

Examples

# Historical data
{:ok, df} = AlphaVantage.history("IBM", outputsize: "compact")

# Real-time quote
{:ok, df} = AlphaVantage.quote("IBM")

# Search symbols
{:ok, df} = AlphaVantage.search("Microsoft")

Summary

Functions

Fetches historical data for a symbol.

Alpha Vantage doesn't provide company info in the same way as other providers. This function returns an error indicating the feature is not supported.

Fetches real-time quotes for one or more symbols.

Searches for symbols matching a query.

Types

options()

@type options() :: keyword()

symbol()

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

symbols()

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

Functions

history(symbol_or_symbols, opts \\ [])

@spec history(symbol() | symbols(), options()) ::
  {:ok, Explorer.DataFrame.t()} | {:error, term()}

Fetches historical data for a symbol.

Options

  • :interval - Time interval: "1min", "5min", "15min", "30min", "60min", "daily", "weekly", "monthly" (default: "daily")
  • :outputsize - Data size: "compact" (last 100 points) or "full" (all available) (default: "compact")
  • :adjusted - Whether to include adjusted close prices (default: true)

Examples

{:ok, df} = AlphaVantage.history("IBM")
{:ok, df} = AlphaVantage.history("AAPL", interval: "5min", outputsize: "full")

info(symbol, opts \\ [])

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

Alpha Vantage doesn't provide company info in the same way as other providers. This function returns an error indicating the feature is not supported.

Options

  • :api_key - Alpha Vantage API key (optional, will use config if not provided)

quote(symbol_or_symbols, opts \\ [])

@spec quote(symbol() | symbols(), options()) ::
  {:ok, Explorer.DataFrame.t()} | {:error, term()}

Fetches real-time quotes for one or more symbols.

Options

  • :api_key - Alpha Vantage API key (optional, will use config if not provided)

Examples

{:ok, df} = AlphaVantage.quote("IBM")
{:ok, df} = AlphaVantage.quote("IBM", api_key: "YOUR_API_KEY")
{:ok, df} = AlphaVantage.quote(["AAPL", "MSFT", "GOOGL"], api_key: "YOUR_API_KEY")

search(query, opts \\ [])

@spec search(String.t(), options()) ::
  {:ok, Explorer.DataFrame.t()} | {:error, term()}

Searches for symbols matching a query.

Options

  • :api_key - Alpha Vantage API key (optional, will use config if not provided)

Examples

{:ok, df} = AlphaVantage.search("Microsoft")
{:ok, df} = AlphaVantage.search("AAPL", api_key: "YOUR_API_KEY")