marketflows.providers.coingecko

Set of functions to handle querying CoinGecko.

Functions

define_frequency_min_and_max_timestamp(...)

Define the frequency, minimum, and maximum timestamp retrieved from CoinGecko.

load_coingecko_data(*, api_key, provider_config)

Entrypoint for all CoinGecko data querying.

Classes

GetValues(url, params)

Create a dataclass to hold the values we want to send with session.get.

class marketflows.providers.coingecko.GetValues(url, params)

Bases: object

Create a dataclass to hold the values we want to send with session.get.

url

URL to be queried

Type:

str

params

Dictionary of query parameters

Type:

dict[str, str] | None

marketflows.providers.coingecko.define_frequency_min_and_max_timestamp(provider_config)

Define the frequency, minimum, and maximum timestamp retrieved from CoinGecko.

Time spans that are lower than 1 day are set to 1 day. Time spans that are higher than 365 days are set to 365 days. Otherwise: - 1 day: 5-minutely data - 1 < days <= 90 days: hourly data - > 90 days: daily data (00:00 UTC)

Daily data is published at 00:10 UTC for 00:00 UTC.

Parameters:

provider_config (ProviderConfig) – CoinGecko configuration including days

Return type:

tuple[str, Timestamp, Timestamp]

Returns:

the frequency, minimum timestamp, and maximum timestamp

marketflows.providers.coingecko.load_coingecko_data(*, api_key, provider_config)

Entrypoint for all CoinGecko data querying.

This will query CoinGecko for all the necessary chart data.

Parameters:
  • api_key (str) – CoinGecko API key

  • provider_config (ProviderConfig) – configuration values for the providers

Return type:

tuple[dict[str, DataFrame], dict[str, str], dict[str, set[str]]]

Returns:

CoinGecko market cap data for all requested coins, symbol for each coin, and a set of coins in each narrative

Raises:

ValueError – if flow_type is not yet implemented