Messari Python API Tutorial
This tutorial aims to be a quick guide to get you started using messari’s python library.
The first thing is to authenticate your account. You can create an API key by first creating a messari account and then navigating to https://messari.io/account/api.
After generating an API, import the library and add your key by running:
[1]:
from messari.messari import Messari
messari = Messari('your_api_key')
Library Structure
The library is structured in three main sections represented by three separate modules:
Assets
Makets
Timeseries
Assets Module
The assets module contains all the functions to pull asset specific data. The functions follow a get_* convention for simplicity of use. The available data functions are:
get_all_assets
Get the paginated list of all assets including metrics and profile.
get_asset
Get basic metadata for an asset.
get_asset_market_data
Get the latest market data for an asset.
get_asset_metrics
Get all the quantitative metrics for an asset.
get_asset_profile
Get all the qualitative information for an asset.
Get all assets
If you are interested in getting bulk data for all assets that Messari supports use the get_all_assets function. The function returns lots of data so the default returned value is a python dictionary with asset slugs as keys and the asset data as the values.
The parameters of the function are: * page: Page number starting at 1. Increment value to paginate through results. * limit: Limit of assets to return. Default is 20, max value is 500. * asset_fields: Single filter string or list of fields to filter data. Available fields include: * id * name * slug * metrics * profile
asset_metric: Single metric string to filter metric data. Available asset metrics include:
market_data
marketcap
supply
blockchain_stats_24_hours
market_data_liquidity
all_time_high
cycle_low
token_sale_stats
staking_stats
mining_stats
developer_activity
roi_data
roi_by_year
risk_metrics
misc_data
lend_rates
borrow_rates
loan_data
reddit
on_chain_data
exchange_flows
alert_messages
asset_profile_metric: Single profile metric string to filter profile data.
general
contributors
advisors
investors
ecosystem
economics
technology
governance
metadata
to_dataframe: Return data as pandas DataFrame or JSON. Default is set to JSON.
[2]:
response_data = messari.get_all_assets()
You can turned the results to a nice pandas DataFrame if the only information you are requesting is metric data.
NOTE: If you include any other asset fields or pass an asset profile metric the function will return an error.
[3]:
response_data_df = messari.get_all_assets(asset_fields=['metrics'], to_dataframe=True)
response_data_df.head()
[3]:
metrics_market_data_price_usd | metrics_market_data_price_btc | metrics_market_data_price_eth | metrics_market_data_volume_last_24_hours | metrics_market_data_real_volume_last_24_hours | metrics_market_data_volume_last_24_hours_overstatement_multiple | metrics_market_data_percent_change_usd_last_1_hour | metrics_market_data_percent_change_btc_last_1_hour | metrics_market_data_percent_change_eth_last_1_hour | metrics_market_data_percent_change_usd_last_24_hours | ... | metrics_supply_distribution_supply_in_contracts_usd | metrics_supply_distribution_supply_in_contracts_native_units | metrics_supply_distribution_supply_shielded | metrics_supply_distribution_supply_in_top_100_addresses | metrics_supply_distribution_supply_in_top_10_percent_addresses | metrics_supply_distribution_supply_in_top_1_percent_addresses | metrics_supply_distribution_supply_in_utxo_in_loss | metrics_supply_distribution_supply_in_utxo_in_profit | metrics_alert_messages | slug | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
bitcoin | 63549.138557 | 1.000000 | 14.000438 | 6.696020e+09 | 5.615102e+09 | 1.192502 | -0.827104 | 0.000000 | -0.262311 | -1.232825 | ... | NaN | NaN | None | 2.791041e+06 | 1.869062e+07 | 1.729667e+07 | 272579.562794 | 1.860070e+07 | None | bitcoin |
ethereum | 4551.458697 | 0.071621 | 1.000000 | 5.426996e+09 | 4.641549e+09 | 1.169221 | -0.566278 | 0.263001 | 0.000000 | -0.543660 | ... | 1.367004e+11 | 2.965612e+07 | None | 4.592305e+07 | 1.169773e+08 | 1.142389e+08 | NaN | NaN | None | ethereum |
binance-coin | 631.461714 | 0.009937 | 0.138997 | 1.027663e+09 | 9.102840e+08 | 1.128948 | -0.784175 | 0.043287 | -0.219138 | -2.646269 | ... | NaN | NaN | None | NaN | NaN | NaN | NaN | NaN | None | binance-coin |
tether | 1.002894 | 0.000016 | 0.000221 | 3.636292e+10 | 2.092726e+10 | 1.737586 | -0.070167 | 0.763250 | 0.498937 | -0.773392 | ... | 7.379604e+09 | 7.377586e+09 | None | 1.730566e+10 | 3.745281e+10 | 3.609309e+10 | NaN | NaN | None | tether |
solana | 234.662429 | 0.003693 | 0.051645 | 1.589884e+09 | 1.178056e+09 | 1.349582 | -2.070842 | -1.254111 | -1.513132 | -0.639508 | ... | NaN | NaN | None | NaN | NaN | NaN | NaN | NaN | None | solana |
5 rows × 370 columns
Additionally, you can filter the metric data by passing an asset metric. For example you can get all the mining statistics for all the assets in the first page.
[4]:
metric = 'mining_stats'
response_data_df_market_data = messari.get_all_assets(asset_metric=metric, to_dataframe=True)
response_data_df_market_data.head()
[4]:
slug | metrics_mining_stats_mining_algo | metrics_mining_stats_network_hash_rate | metrics_mining_stats_available_on_nicehash_percent | metrics_mining_stats_1_hour_attack_cost | metrics_mining_stats_24_hours_attack_cost | metrics_mining_stats_attack_appeal | metrics_mining_stats_hash_rate | metrics_mining_stats_hash_rate_30d_average | metrics_mining_stats_mining_revenue_per_hash_usd | metrics_mining_stats_mining_revenue_per_hash_native_units | metrics_mining_stats_mining_revenue_per_hash_per_second_usd | metrics_mining_stats_mining_revenue_per_hash_per_second_native_units | metrics_mining_stats_mining_revenue_from_fees_percent_last_24_hours | metrics_mining_stats_mining_revenue_native | metrics_mining_stats_mining_revenue_usd | metrics_mining_stats_mining_revenue_total | metrics_mining_stats_average_difficulty | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
bitcoin | bitcoin | SHA-256 | 175785 PH/s | 0.204757 | None | None | None | 1.753464e+08 | 1.578817e+08 | 0.000004 | 6.500000e-11 | 0.367195 | 0.000006 | 0.890598 | 990.067517 | None | 3.554869e+10 | 2.246731e+13 |
ethereum | ethereum | Ethash | 812 TH/s | 3.804177 | None | None | None | 8.070931e+02 | NaN | 0.959108 | 2.080714e-04 | 82866.973737 | 17.977368 | 78.515707 | 14509.409289 | None | 2.431323e+10 | 1.099016e+16 |
binance-coin | binance-coin | None | None | NaN | None | None | None | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | None | NaN | NaN |
tether | tether | None | None | NaN | None | None | None | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | None | NaN | NaN |
solana | solana | None | None | NaN | None | None | None | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | None | NaN | NaN |
Lastly, if you are interested in getting metrics for all available assets, you can loop through all pages creating a pandas DataFrame per page then merging them all together!
[5]:
import pandas as pd
dfs = [] # list to hold metric DataFrames
for i in range(1, 5, 1):
df = messari.get_all_assets(page=1, limit=500, asset_metric='marketcap', to_dataframe=True)
dfs.append(df)
merged_df = pd.concat(dfs)
print(f'Number of assets in DataFrame {len(merged_df)}')
merged_df.head()
Number of assets in DataFrame 2000
[5]:
slug | metrics_marketcap_rank | metrics_marketcap_marketcap_dominance_percent | metrics_marketcap_current_marketcap_usd | metrics_marketcap_y_2050_marketcap_usd | metrics_marketcap_y_plus10_marketcap_usd | metrics_marketcap_liquid_marketcap_usd | metrics_marketcap_volume_turnover_last_24_hours_percent | metrics_marketcap_realized_marketcap_usd | metrics_marketcap_outstanding_marketcap_usd | |
---|---|---|---|---|---|---|---|---|---|---|
bitcoin | bitcoin | 1 | 43.232673 | 1.208326e+12 | 1.343606e+12 | 1.322402e+12 | 1.208853e+12 | 0.475198 | 4.571419e+11 | 1.227371e+12 |
ethereum | ethereum | 2 | 19.194453 | 5.364731e+11 | 6.177026e+11 | 5.600073e+11 | 5.305415e+11 | 0.896623 | 2.662798e+11 | 5.414160e+11 |
binance-coin | binance-coin | 3 | 3.788568 | 1.058881e+11 | 6.348166e+10 | 6.877961e+10 | 6.877961e+10 | 1.355334 | NaN | NaN |
tether | tether | 4 | 2.651714 | 7.411376e+10 | NaN | NaN | NaN | NaN | 3.784762e+10 | 3.784412e+10 |
solana | solana | 5 | 2.572619 | 7.190312e+10 | 2.241007e+11 | 1.759675e+11 | 1.188495e+11 | 1.020476 | NaN | NaN |
Get asset
The get_asset function is very useful when you are trying to get the metadata of an asset. The default value back from this functions is a pandas DataFrame
The paremeters of the function are:
asset_slugs: Single asset slug string or list of asset slugs (i.e. bitcoin).
asset_fields: Single filter string or list of fields to filter data. Available fields include:
id
symbol
name
slug
to_dataframe: Return data as DataFrame or JSON. Default is set to DataFrame.
[6]:
assets = ['bitcoin', 'ethereum', 'tether']
asset_metadata = messari.get_asset(asset_slugs=assets)
asset_metadata.head()
[6]:
id | symbol | name | slug | contract_addresses | _internal_temp_agora_id | |
---|---|---|---|---|---|---|
bitcoin | 1e31218a-e44e-4285-820c-8282ee222035 | BTC | Bitcoin | bitcoin | [] | 9793eae6-f374-46b4-8764-c2d224429791 |
ethereum | 21c795f5-1bfd-40c3-858e-e9d7e820c6d0 | ETH | Ethereum | ethereum | [{'platform': 'avalanche', 'contract_address':... | 263d8b01-5a96-41f0-85d5-09687bbbf7ca |
tether | 51f8ea5e-f426-4f40-939a-db7e05495374 | USDT | Tether | tether | [{'platform': 'arbitrum-one', 'contract_addres... | 1eaf063a-b8dd-4cfb-95dd-a06338565720 |
If you are only interested in some fields, you filter the data by passing the asset fields of interest.
[7]:
fields = ['id', 'name']
asset_metadata_filtered = messari.get_asset(asset_slugs=assets, asset_fields=fields)
asset_metadata_filtered.head()
[7]:
id | name | slug | |
---|---|---|---|
bitcoin | 1e31218a-e44e-4285-820c-8282ee222035 | Bitcoin | bitcoin |
ethereum | 21c795f5-1bfd-40c3-858e-e9d7e820c6d0 | Ethereum | ethereum |
tether | 51f8ea5e-f426-4f40-939a-db7e05495374 | Tether | tether |
Get asset profile
The get_asset_profile function can be used to get profile information about an asset. The default value back from this functions is a python dictionary due to the high number of text fileds.
The paremeters of the function are:
asset_slugs: Single asset slug string or list of asset slugs (i.e. bitcoin).
asset_profile_metric: Single profile metric string to filter profile data. Available metrics include:
general
contributors
advisors
investors
ecosystem
economics
technology
governance
metadata
[8]:
asset_profile_data = messari.get_asset_profile(asset_slugs=assets)
asset_profile_data['bitcoin']['profile_general_overview_project_details']
[8]:
'Bitcoin is the first <a href="https://messari.io/resource/distributed-systems">distributed consensus-based</a>, censorship-resistant, permissionless, peer-to-peer payment settlement network with a provably scarce, programmable, native currency. Bitcoin (BTC), the native asset of the Bitcoin blockchain, is the world\'s first digital currency without a central bank or administrator. The Bitcoin network is an emergent decentralized monetary institution that exists through the interplay between <a href="https://messari.io/resource/node">full nodes</a>, <a href="https://messari.io/resource/mining">miners</a>, and developers. It is set by a social contract that is created and opted into by the users of the network and hardened through <a href="https://messari.io/c/resource/game-theory">game theory</a> and <a href="https://messari.io/resource/cryptography">cryptography</a>. Bitcoin is the first, oldest, and largest cryptocurrency in the world.'
You can filter the results by passing an asset profile metric. For example, if you are interested in looking at the investor list of Uniswap, you can get it by running:
[9]:
asset = 'Uniswap'
profile_metric = 'investors'
governance_data = messari.get_asset_profile(asset_slugs=asset, asset_profile_metric=profile_metric)
governance_data
[9]:
{'Uniswap': {'id': '1d51479d-68f6-4886-8644-2a55ea9007bf',
'slug': 'uniswap',
'profile_investors_individuals': [],
'profile_investors_organizations': [{'slug': 'coinbase-ventures',
'name': 'Coinbase Ventures',
'logo': 'https://messari.s3.amazonaws.com/images/agora-images/HVEeWmV4_400x400.png',
'description': 'Coinbase Ventures invests in companies building the open financial system. It provides financing to early-stage companies that have the teams and ideas that can move the cryptoasset industry forward.'},
{'slug': 'defiance-capital',
'name': 'Defiance Capital',
'logo': 'https://messari.s3.amazonaws.com/images/agora-images/0%3Fe%3D1609372800%26v%3Dbeta%26t%3D2wLf66PgCxyDRFc1oqSaql8bXLUiujOQY_YzpuTdjzU',
'description': 'Leading DeFi focused Cryptoasset Fund combining fundamental research and activist investment strategy.'},
{'slug': 'paradigm',
'name': 'Paradigm',
'logo': 'https://messari.s3.amazonaws.com/images/agora-images/gv546pvglklhdkr64jpe',
'description': 'A digital asset investment firm'},
{'slug': 'three-arrows-capital',
'name': 'Three Arrows Capital',
'logo': 'https://messari.s3.amazonaws.com/images/agora-images/EZPJ3XBUwAACZ0E.jpg',
'description': 'Three Arrows Capital Pte. Ltd. is a hedge fund manager established in 2012 and focused on providing superior risk-adjusted returns, founded by Su Zhu and Kyle Davies.'},
{'slug': 'parafi-capital',
'name': 'ParaFi Capital',
'logo': 'https://messari.s3.amazonaws.com/images/agora-images/HjNuqyoH_400x400.jpg',
'description': None},
{'slug': 'delphi-digital',
'name': 'Delphi Digital',
'logo': 'https://messari.s3.amazonaws.com/images/agora-images/iNTyjk96_400x400.jpg',
'description': 'Delphi Digital is an independent research and consulting boutique specializing in the digital asset market.'}]}}
Get asset metric
The get_asset_metric function allows you to pull quantitative data for an asset. The default value back from this function is a pandas DataFrame.
The paremeters of the function are:
asset_slugs: Single asset slug string or list of asset slugs (i.e. bitcoin).
asset_metric: Single metric string to filter metric data. Available metrics include:
market_data
marketcap
supply
blockchain_stats_24_hours
market_data_liquidity
all_time_high
cycle_low
token_sale_stats
staking_stats
mining_stats
developer_activity
roi_data
roi_by_year
risk_metrics
misc_data
lend_rates
borrow_rates
loan_data
reddit
on_chain_data
exchange_flows
alert_messages
to_dataframe: Return data as DataFrame or JSON. Default is set to DataFrame.
The function will return all avaiable metrics for the assets supplied.
[11]:
asset_metric_df = messari.get_asset_metrics(asset_slugs=assets)
asset_metric_df.head()
[11]:
id | symbol | name | slug | contract_addresses | _internal_temp_agora_id | market_data_price_usd | market_data_price_btc | market_data_price_eth | market_data_volume_last_24_hours | ... | supply_distribution_supply_in_addresses_balance_greater_1_native_units | supply_distribution_supply_in_contracts_usd | supply_distribution_supply_in_contracts_native_units | supply_distribution_supply_shielded | supply_distribution_supply_in_top_100_addresses | supply_distribution_supply_in_top_10_percent_addresses | supply_distribution_supply_in_top_1_percent_addresses | supply_distribution_supply_in_utxo_in_loss | supply_distribution_supply_in_utxo_in_profit | alert_messages | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
bitcoin | 1e31218a-e44e-4285-820c-8282ee222035 | BTC | Bitcoin | bitcoin | [] | 9793eae6-f374-46b4-8764-c2d224429791 | 63877.744122 | 1.000000 | 14.003232 | 6.696020e+09 | ... | 1.787605e+07 | NaN | NaN | None | 2.791041e+06 | 1.869062e+07 | 1.729667e+07 | 272579.562794 | 1.860070e+07 | None |
ethereum | 21c795f5-1bfd-40c3-858e-e9d7e820c6d0 | ETH | Ethereum | ethereum | [{'platform': 'avalanche', 'contract_address':... | 263d8b01-5a96-41f0-85d5-09687bbbf7ca | 4572.992315 | 0.071590 | 1.000000 | 5.426996e+09 | ... | 1.153521e+08 | 1.367004e+11 | 2.965612e+07 | None | 4.592305e+07 | 1.169773e+08 | 1.142389e+08 | NaN | NaN | None |
tether | 51f8ea5e-f426-4f40-939a-db7e05495374 | USDT | Tether | tether | [{'platform': 'arbitrum-one', 'contract_addres... | 1eaf063a-b8dd-4cfb-95dd-a06338565720 | 1.003057 | 0.000016 | 0.000220 | 3.636292e+10 | ... | 3.783364e+10 | 7.379604e+09 | 7.377586e+09 | None | 1.730566e+10 | 3.745281e+10 | 3.609309e+10 | NaN | NaN | None |
3 rows × 375 columns
Also, you can provide an asset metric to filter the metrics data.
[12]:
metric = 'marketcap'
asset_metric_df_marketcap = messari.get_asset_metrics(asset_slugs=assets, asset_metric=metric)
asset_metric_df_marketcap.head()
[12]:
id | symbol | marketcap_rank | marketcap_marketcap_dominance_percent | marketcap_current_marketcap_usd | marketcap_y_2050_marketcap_usd | marketcap_y_plus10_marketcap_usd | marketcap_liquid_marketcap_usd | marketcap_volume_turnover_last_24_hours_percent | marketcap_realized_marketcap_usd | marketcap_outstanding_marketcap_usd | |
---|---|---|---|---|---|---|---|---|---|---|---|
bitcoin | 1e31218a-e44e-4285-820c-8282ee222035 | BTC | 1 | 43.218651 | 1.206339e+12 | 1.341395e+12 | 1.320226e+12 | 1.206865e+12 | 0.475864 | 4.571419e+11 | 1.227371e+12 |
ethereum | 21c795f5-1bfd-40c3-858e-e9d7e820c6d0 | ETH | 2 | 19.189260 | 5.356194e+11 | 6.167196e+11 | 5.591161e+11 | 5.296972e+11 | 0.897591 | 2.662798e+11 | 5.414160e+11 |
tether | 51f8ea5e-f426-4f40-939a-db7e05495374 | USDT | 4 | 2.655952 | 7.413415e+10 | NaN | NaN | NaN | NaN | 3.784762e+10 | 3.784412e+10 |
Get asset market data
The get_asset_market_data function pull the latest market data for an asset. The default value back from this function is a pandas DataFrame.
The paremeters of the function are:
asset_slugs: Single asset slug string or list of asset slugs (i.e. bitcoin).
to_dataframe: Return data as DataFrame or JSON. Default is set to DataFrame.
[13]:
market_data = messari.get_asset_market_data(asset_slugs=assets)
market_data.head()
[13]:
id | symbol | market_data_price_usd | market_data_price_btc | market_data_price_eth | market_data_volume_last_24_hours | market_data_real_volume_last_24_hours | market_data_volume_last_24_hours_overstatement_multiple | market_data_percent_change_usd_last_1_hour | market_data_percent_change_btc_last_1_hour | ... | market_data_ohlcv_last_1_hour_high | market_data_ohlcv_last_1_hour_low | market_data_ohlcv_last_1_hour_close | market_data_ohlcv_last_1_hour_volume | market_data_ohlcv_last_24_hour_open | market_data_ohlcv_last_24_hour_high | market_data_ohlcv_last_24_hour_low | market_data_ohlcv_last_24_hour_close | market_data_ohlcv_last_24_hour_volume | market_data_last_trade_at | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
bitcoin | 1e31218a-e44e-4285-820c-8282ee222035 | BTC | 63895.998103 | 1.000000 | 14.003232 | 6.696020e+09 | 5.743741e+09 | 1.165794 | -0.109754 | 0.000000 | ... | 64143.421918 | 63387.991540 | 63897.011656 | 3.345042e+08 | 64197.144700 | 66395.435549 | 63387.152997 | 63895.998103 | 6.741573e+09 | 2021-11-15T21:06:13.498Z |
ethereum | 21c795f5-1bfd-40c3-858e-e9d7e820c6d0 | ETH | 4574.191597 | 0.071588 | 1.000000 | 5.426996e+09 | 4.757243e+09 | 1.140786 | 0.057229 | 0.166956 | ... | 4579.045515 | 4542.824040 | 4574.409617 | 2.546684e+08 | 4550.062092 | 4771.906982 | 4539.207138 | 4574.191597 | 5.409993e+09 | 2021-11-15T21:06:13.976Z |
tether | 51f8ea5e-f426-4f40-939a-db7e05495374 | USDT | 1.003025 | 0.000016 | 0.000220 | 3.636292e+10 | 2.145719e+10 | 1.694673 | -0.040783 | 0.066726 | ... | 1.007714 | 0.998665 | 1.003238 | 1.195032e+09 | 1.010482 | 1.016971 | 0.993462 | 1.003025 | 2.631996e+10 | 2021-11-15T21:06:13.889Z |
3 rows × 25 columns
Markets Module
The get_all_markets function pulls all information of all the exchanges and pairs supported by Messari’s API. The default return value of this function is a pandas DataFrame.
The paremeters of the function are:
page: Page number starting at 1. Increment value to paginate through results.
limit: Limit of assets to return. Default is 20, max value is 500.
to_dataframe: Return data as DataFrame or list of dictionaries. Default is set to DataFrame.
[14]:
markets_df = messari.get_all_markets()
markets_df.head()
[14]:
id | exchange_id | base_asset_id | quote_asset_id | class | trade_start | trade_end | version | excluded_from_price | exchange_name | base_asset_symbol | quote_asset_symbol | pair | price_usd | vwap_weight | volume_last_24_hours | has_real_volume | deviation_from_vwap_percent | last_trade_at | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
exchange_slug | |||||||||||||||||||
uniswap | 0006addf-d3d2-491a-8a66-36236445c527 | 6efbfc8a-18c9-4c6f-aa78-feea100521cf | 3f548a16-866f-4e2c-b3e9-5df6d32d9083 | 51f8ea5e-f426-4f40-939a-db7e05495374 | spot | 2020-08-30T16:40:06Z | None | 1 | False | Uniswap (v2) | UOS | USDT | UOS-USDT | NaN | 0.0 | NaN | False | NaN | None |
yobit | 000bd377-28be-488c-80cc-cd18e90ba3ff | 2087a29e-6a27-4d51-ba3b-d9f112f93c38 | c10e0960-9175-4c44-9390-86a8de17c2a1 | 1e31218a-e44e-4285-820c-8282ee222035 | spot | 2019-04-12T10:49:20Z | 2019-04-25T18:24:16Z | 1 | True | YoBit | LUC | BTC | LUC-BTC | NaN | 0.0 | NaN | False | NaN | None |
binance | 000de500-0515-4d00-8e73-be8b327cc298 | d8b0ea44-1963-451e-ac37-aead4ba3b4c7 | 6d667f96-24f2-420b-9a22-73f5cd594bcf | 1e31218a-e44e-4285-820c-8282ee222035 | spot | 2019-09-24T18:58:30Z | None | 1 | False | Binance | XTZ | BTC | XTZ-BTC | 5.720711 | 1.0 | 3.398368e+06 | True | 0.002639 | 2021-11-15T21:06:00Z |
binance | 000ef1f2-89e2-4096-b02f-feaa11b7467d | d8b0ea44-1963-451e-ac37-aead4ba3b4c7 | 577bebe9-f569-44a1-aed8-0484325fddf2 | 7dc551ba-cfed-4437-a027-386044415e3e | spot | 2020-09-15T20:51:42Z | 2021-09-30T08:59:59Z | 1 | False | Binance | SWRV | BNB | SWRV-BNB | NaN | 0.0 | NaN | False | NaN | None |
binance | 000f7f7c-5994-4c18-92f2-1ff37f167665 | d8b0ea44-1963-451e-ac37-aead4ba3b4c7 | 362f0140-ecdd-4205-b8a0-36f0fd5d8167 | 74cc014e-d925-496a-928b-b43c0393c455 | spot | 2021-03-19T08:00:00Z | None | 1 | False | Binance | ADA | RUB | ADA-RUB | NaN | 0.0 | NaN | False | NaN | None |
The get_metric_timeseries function allows you to pull time series data for a number of metrics. The default return value of this function is a pandas DataFrame.
The paremeters of the function are:
asset_slugs: Single asset slug string or list of asset slugs (i.e. bitcoin).
asset_metric: Single metric string to filter timeseries data. Available metrics include:
blk.cnt
The sum count of blocks created each day.
txn.fee.avg
The USD value of the mean fee per transaction.
txn.cnt
The sum count of transactions that interval. Transactions represent a bundle of intended actions to alter the ledger initiated by a user (human or machine). Transactions are counted whether they execute or not and whether they result in the transfer of native units.
txn.tsfr.val.adj
The sum USD value of all native units transferred removing noise and certain artifacts.
sply.circ
The circulating supply acknowledges that tokens may be held by projects/foundations which have no intent to sell down their positions, but which have not locked up supply in a formal contract. Thus, circulating supply does not include known project treasury holdings (which can be significant). Note that an investor must carefully consider both liquid and circulating supplies when evaluating an asset, and the two can vary significantly. A risk of depending entirely on circulating supply is that the number can change dramatically based on discretionary sales from project treasuries.
mcap.circ
The circulating marketcap is the price of the asset multiplied by the circulating supply. If no price is found for an asset because no trades occurred, the last price of the last trade is used. After 30 days with no trades, a marketcap of 0 is reported until trading resumes.
reddit.subscribers
The number of subscribers on the asset’s primary subreddit
iss.rate
The percentage of new native units (continuous) issued over that interval, extrapolated to one year (i.e., multiplied by 365), and divided by the current supply at the end of that interval. Also referred to as the annual inflation rate.
mcap.realized
The sum USD value based on the USD closing price on the day that a native unit last moved (i.e., last transacted) for all native units.
bitwise.volume
It is well known that many exchanges conduct wash trading practices in order to inflate trading volume. They are incentivized to report inflated volumes in order to attract traders. “Bitwise Volume” refers to the total volume over 10 exchanges identified by Bitwise to be free of wash trading activities. They tend to be regulated exchanges. However, that does not necessarily mean that the volume reported by other exchanges is 100% wash trades. As such, the Bitwise Volume underestimates the total volume.
txn.tsfr.val.avg
The sum USD value of native units transferred divided by the count of transfers (i.e., the mean “size” in USD of a transfer).
act.addr.cnt
The sum count of unique addresses that were active in the network (either as a recipient or originator of a ledger change) that interval. All parties in a ledger change action (recipients and originators) are counted. Individual addresses are not double-counted.
fees.ntv
The sum of all fees paid to miners in native units. Fees do not include new issuance.
exch.flow.in.usd.incl
The sum USD value sent to exchanges that interval, including exchange to exchange activity.
blk.size.byte
The sum of the size (in bytes) of all blocks created each day.
txn.tsfr.val.med
The median transfer value in US dollars.
exch.flow.in.ntv.incl
The amount of the asset sent to exchanges that interval, including exchange to exchange activity.
exch.flow.out.usd
The sum USD value withdrawn from exchanges that interval, excluding exchange to exchange activity.’
txn.vol
The sum USD value of all native units transferred (i.e., the aggregate size in USD of all transfers).
fees
The sum USD value of all fees paid to miners that interval. Fees do not include new issuance.
exch.flow.out.ntv.incl
The amount of the asset withdrawn from exchanges that interval, including exchange to exchange activity.
exch.flow.out.usd.incl
The sum USD value withdrawn from exchanges that interval, including exchange to exchange activity.
txn.fee.med
The USD value of the median fee per transaction.
min.rev.ntv
The sum of all miner revenue, which constitutes fees plus newly issued native units.
exch.sply.usd
The sum USD value of all native units held in hot or cold exchange wallets.
diff.avg
The mean difficulty of finding a hash that meets the protocol-designated requirement (i.e., the difficulty of finding a new block) that interval. The requirement is unique to each applicable cryptocurrency protocol.
daily.shp
The Sharpe ratio (performance of the asset compared to a “risk-free” asset) over a window of time).
txn.tsfr.cnt
The sum count of transfers that interval. Transfers represent movements of native units from one ledger entity to another distinct ledger entity. Only transfers that are the result of a transaction and that have a positive (non-zero) value are counted.
exch.flow.in.ntv
The amount of the asset sent to exchanges that interval, excluding exchange to exchange activity.
new.iss.usd
The sum USD value of new native units issued that interval. Only those native units that are issued by a protocol-mandated continuous emission schedule are included (i.e., units manually released from escrow or otherwise disbursed are not included).
mcap.dom
The marketcap dominance is the asset’s percentage share of total crypto circulating marketcap.
daily.vol
The annualized standard-deviation of daily returns over a window of time.
reddit.active.users
The number of active users on the asset’s primary subreddit
exch.sply
The sum of all native units held in hot or cold exchange wallets
nvt.adj
The ratio of the network value (or market capitalization, current supply) divided by the adjusted transfer value. Also referred to as NVT.
exch.flow.out.ntv
The amount of the asset withdrawn from exchanges that interval, excluding exchange to exchange activity.
min.rev.usd
The sum USD value of all miner revenue, which constitutes fees plus newly issued native units, represented as the US dollar amount earned if all native units were sold at the closing price on the same day.
bitwise.price
Volume weighted average price over Bitwise 10 exchanges.
new.iss.ntv
The sum of new native units issued that interval. Only those native units that are issued by a protocol-mandated continuous emission schedule are included (i.e., units manually released from escrow or otherwise disbursed are not included).
blk.size.bytes.avg
The mean size (in bytes) of all blocks created.
hashrate
The mean rate at which miners are solving hashes that interval.
exch.flow.in.usd
The sum USD value sent to exchanges that interval, excluding exchange to exchange activity.
price
Volume weighted average price computed using Messari Methodology
real.vol
It is well known that many exchanges conduct wash trading practices in order to inflate trading volume. They are incentivized to report inflated volumes in order to attract traders. “Real Volume” refers to the total volume on the exchanges that we believe with high level of confidence are free of wash trading activities. However, that does not necessarily mean that the volume reported by other exchanges is 100% wash trades. As such, the Messari “Real Volume” applies a penalty to these exchanges to discount the volume believed to come from wash trading activity. For more information, see our methodology page.
start: Starting date string for timeseries data. A default start date will provided if not specified.
end: Ending date string for timeseries data. A default end date will provided if not specified.
interval: Interval of timeseries data. Default value is set to 1d. For any given interval, at most 2016 points will be returned. For example, with interval=5m, the maximum range of the request is 2016 * 5 minutes = 7 days. With interval=1h, the maximum range is 2016 * 1 hour = 84 days. Exceeding the maximum range will result in an error, which can be solved by reducing the date range specified in the request. Interval options include:
1m
5m
15m
30m
1hr
1d
1w
to_dataframe: Return data as DataFrame or JSON. Default is set to DataFrame.
[15]:
metric = 'price'
start = '2020-06-01'
end = '2021-01-01'
timeseries_df = messari.get_metric_timeseries(asset_slugs=assets, asset_metric=metric, start=start, end=end)
timeseries_df
[15]:
bitcoin | ethereum | tether | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
open | high | low | close | volume | open | high | low | close | volume | open | high | low | close | volume | |
timestamp | |||||||||||||||
2020-06-01 | 9446.359337 | 10411.368446 | 9415.969996 | 10207.837560 | 2.546875e+09 | 231.418675 | 251.880973 | 230.555621 | 248.420898 | 8.967023e+08 | 0.999376 | 1.031920 | 0.992700 | 1.001592 | 4.317591e+09 |
2020-06-02 | 10207.170730 | 10235.407915 | 9247.901259 | 9519.293396 | 4.445485e+09 | 247.088209 | 253.667458 | 224.949475 | 237.718348 | 1.048456e+09 | 1.002874 | 1.008979 | 0.982826 | 1.000406 | 5.734804e+09 |
2020-06-03 | 9528.264497 | 9694.116996 | 9376.263171 | 9665.937361 | 1.789072e+09 | 237.857362 | 245.205872 | 233.249205 | 244.559197 | 4.947757e+08 | 0.998064 | 1.011970 | 0.992956 | 1.000404 | 2.841139e+09 |
2020-06-04 | 9656.485925 | 9883.971306 | 9449.824258 | 9788.178936 | 2.183610e+09 | 244.445697 | 246.610619 | 235.973443 | 243.221280 | 6.650226e+08 | 1.001681 | 1.011502 | 0.983112 | 1.000884 | 3.353472e+09 |
2020-06-05 | 9790.242751 | 9856.404984 | 9586.252232 | 9617.090421 | 1.965504e+09 | 243.344371 | 247.945284 | 239.014255 | 239.974526 | 5.535803e+08 | 1.001512 | 1.005469 | 0.988998 | 1.000122 | 3.036441e+09 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
2020-12-28 | 26248.564564 | 27469.396137 | 26069.019129 | 27032.289152 | 5.653047e+09 | 684.007261 | 747.146848 | 680.802699 | 729.225118 | 4.131698e+09 | 0.998800 | 1.009537 | 0.988917 | 0.998043 | 1.323048e+10 |
2020-12-29 | 27036.832984 | 27387.310760 | 25832.269524 | 27360.005185 | 5.558736e+09 | 729.372510 | 739.503440 | 688.494556 | 731.413028 | 2.731104e+09 | 0.998220 | 1.009277 | 0.982313 | 0.998654 | 1.281210e+10 |
2020-12-30 | 27363.633892 | 28999.010850 | 27337.600922 | 28886.315853 | 7.442424e+09 | 731.617969 | 758.444774 | 716.975766 | 752.458953 | 2.537980e+09 | 1.000533 | 1.008489 | 0.986462 | 1.000573 | 1.245562e+10 |
2020-12-31 | 28893.616815 | 29304.876699 | 27852.684695 | 28961.164191 | 7.007439e+09 | 752.636151 | 756.208116 | 722.118872 | 737.255391 | 2.125796e+09 | 1.000973 | 1.013499 | 0.980359 | 1.002135 | 1.049599e+10 |
2021-01-01 | 28963.116282 | 29674.366390 | 28692.320100 | 29402.176951 | 5.206879e+09 | 737.183725 | 750.432877 | 716.538809 | 730.756766 | 1.702361e+09 | 1.001124 | 1.013243 | 0.991402 | 1.002321 | 1.136276e+10 |
215 rows × 15 columns