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

CoinGecko cryptocurrency data provider.

Provides access to CoinGecko's comprehensive cryptocurrency data including:

  • Historical price data (OHLCV)
  • Current market prices and statistics
  • Coin information and metadata
  • Market cap rankings

Rate Limits

CoinGecko API has the following rate limits:

  • Demo API: 10-30 calls/minute
  • Pro API: 500+ calls/minute

Configuration

config :quant,
  api_keys: %{
    coin_gecko: "your_api_key_here"  # Optional for demo tier
  }

Examples

# Get Bitcoin historical data
{:ok, df} = CoinGecko.history("bitcoin", days: 30)

# Get current prices for multiple coins
{:ok, df} = CoinGecko.quote(["bitcoin", "ethereum", "cardano"])

# Search for coins
{:ok, df} = CoinGecko.search("chainlink")

# Get coin information
{:ok, info} = CoinGecko.info("bitcoin")

Summary

Functions

Fetches historical market data for a cryptocurrency.

Fetches detailed information about a cryptocurrency.

Fetches current market data for cryptocurrencies.

Searches for cryptocurrencies by name or symbol.

Gets the top cryptocurrencies by market cap.

Functions

history(coin_ids, opts \\ [])

@spec history(
  String.t() | [String.t()],
  keyword()
) :: {:ok, Explorer.DataFrame.t()} | {:error, term()}

Fetches historical market data for a cryptocurrency.

Options

  • :days - Number of days of data to fetch (1, 7, 14, 30, 90, 180, 365, "max")
  • :vs_currency - Target currency (default: "usd")
  • :interval - Data interval ("daily" for > 1 day, "hourly" for <= 1 day)

Examples

# Get Bitcoin data for last 30 days
{:ok, df} = CoinGecko.history("bitcoin", days: 30)

# Get Ethereum data in EUR
{:ok, df} = CoinGecko.history("ethereum", days: 7, vs_currency: "eur")

info(coin_id, opts \\ [])

Fetches detailed information about a cryptocurrency.

Examples

{:ok, info} = CoinGecko.info("bitcoin")

quote(coin_ids, opts \\ [])

Fetches current market data for cryptocurrencies.

Examples

# Single coin
{:ok, df} = CoinGecko.quote("bitcoin")

# Multiple coins
{:ok, df} = CoinGecko.quote(["bitcoin", "ethereum"])

search(query, opts \\ [])

Searches for cryptocurrencies by name or symbol.

Examples

{:ok, df} = CoinGecko.search("bitcoin")
{:ok, df} = CoinGecko.search("BTC")

top_coins(opts \\ [])

@spec top_coins(keyword()) :: {:ok, Explorer.DataFrame.t()} | {:error, term()}

Gets the top cryptocurrencies by market cap.

Options

  • :vs_currency - Target currency (default: "usd")
  • :per_page - Results per page (default: 100, max: 250)
  • :page - Page number (default: 1)
  • :order - Sort order (default: "market_cap_desc")

Examples

{:ok, df} = CoinGecko.top_coins()
{:ok, df} = CoinGecko.top_coins(per_page: 50, vs_currency: "eur")