messari.tokenterminal package
Submodules
messari.tokenterminal.helpers module
This module is dedicated to helpers for the TokenTerminal class
- messari.tokenterminal.helpers.response_to_df(response: Dict)
Transforms Token Terminal’s JSON response to pandas DataFrame
- Parameters
resp – dict API JSON response
- Returns
pandas DataFrame
messari.tokenterminal.tokenterminal module
This module is meant to contain the TokenTerminal class
- class messari.tokenterminal.tokenterminal.TokenTerminal(api_key: str)
Bases:
messari.dataloader.DataLoader
This class is a wrapper for the Token Terminal API
Methods
get_all_protocol_data
([to_dataframe])Returns an overview of latest data for all projects, ranging from metadata such as launch dates, logos brand colors and Twitter followers to more fundamental metrics such as Revenue, GMV, TVL and P/S ratios.
get_historical_metric_data
(protocol_ids, metric)Returns the time series of a specified metric for a given list of project.
Returns all the project ids available in Token Terminal
get_protocol_data
(protocol_ids[, ...])Returns a time series of the latest data for a given project, ranging from metadata such as Twitter followers to more fundamental metrics such as Revenue, GMV, TVL and P/S ratios.
get_response
(endpoint_url[, params, headers])Gets response from endpoint and checks for HTTP errors when requesting data.
set_api_dict
(api_dict)Sets a new dictionary to be used as an API key pair
set_taxonomy_dict
(taxonomy_dict)Sets a new dictionary to be used for taxonomy translations
translate
(input_slugs)Wrapper around messari.utils.validate_input, validate input & check if it's supported by DeFi Llama
- get_all_protocol_data(to_dataframe=True)
Returns an overview of latest data for all projects, ranging from metadata such as launch dates, logos brand colors and Twitter followers to more fundamental metrics such as Revenue, GMV, TVL and P/S ratios.
The data is updated every 10 minutes.
- Parameters
- to_dataframe: bool
Return data as pandas DataFrame or JSON. Default is set to JSON.
- Returns
- ——-
- dict, DataFrame
Dictionary or pandas DataFrame of asset data.
- get_historical_metric_data(protocol_ids: Union[str, List], metric: str, start_date: Optional[Union[str, datetime.datetime]] = None, end_date: Optional[Union[str, datetime.datetime]] = None) pandas.core.frame.DataFrame
Returns the time series of a specified metric for a given list of project.
- Parameters
- protocol_ids: str, list
List of project IDs
- metric: str
Single metric string to filter data. Available metrics include:
price,
market_cap
market_cap_circulating
market_cap_fully_diluted
volume
vol_mc
pe
ps
tvl
gmv
revenue
revenue_supply_side
revenue_protocol
token_incentives
- start_date: str, datetime.datetime
Optional start date to set filter for timeseries (“YYYY-MM-DD”)
- end_date: str, datetime.datetime
Optional end date to set filter for timeseries (“YYYY-MM-DD”)
- Returns
- DataFrame
pandas DataFrame with asset metric data.
- get_project_ids()
Returns all the project ids available in Token Terminal
- Returns
- List
List of token ids.
- get_protocol_data(protocol_ids: Union[str, List], start_date: Optional[Union[str, datetime.datetime]] = None, end_date: Optional[Union[str, datetime.datetime]] = None) pandas.core.frame.DataFrame
Returns a time series of the latest data for a given project, ranging from metadata such as Twitter followers to more fundamental metrics such as Revenue, GMV, TVL and P/S ratios.
- Parameters
- protocol_ids: str, list
String of protocol ID
- start_date: str, datetime.datetime
Optional start date to set filter for timeseries (“YYYY-MM-DD”)
- end_date: str, datetime.datetime
Optional end date to set filter for timeseries (“YYYY-MM-DD”)
- to_dataframe: bool
Return data as pandas DataFrame or JSON. Default is set to DataFrame.
- Returns
- ——-
- dict, DataFrame
Dictionary or pandas DataFrame of asset data.
Module contents
Module to handle initialization, imports, for TokenTerminal class