How To Migrate From Catalog to Catalog V2 and Reference Data
This guide will help you migrate from using catalog
("Catalog V1") to catalog-v2
("Catalog V2") and reference-data
("Reference Data"). Catalog V1 contains both static metadata (name, category, product, etc.) and coverage for a given data type (e.g. min_time
and max_time
for trades
). Due to growing complexity in data coverage and the resulting performance bottlenecks from surfacing all of this data, this metadata is being separated. Catalog V2 and Reference Data allow for more lightweight and flexible queries as they can be queried across several dimensions (for example, catalog-v2/asset-metrics
lets you filter by both asset and metric).
Switching between Catalog to Catalog V2 requires a subtle change in how to think about and find the data you're looking for.
In general:
Use catalog-v2 to get information on when a data type is present.
Use reference-data to get information on which entities are available and descriptions of what they are.
catalog-v2 and reference-data take less time to retrieve data per call and go through pagination (which the Python API Client automatically takes care of).
For more information on the reasoning behind the catalog migration, see Catalog V1 to Catalog V2 Migration
Examples
How do I get the assets/markets/exchanges covered?
V1:
Use catalog/assets, catalog/markets, or catalog/exchanges respectively
V2:
Use reference-data/assets, reference-data/markets, or reference-data/exchanges respectively
How do I get which assets have been on an exchange?
V1: Use catalog/assets and get the "exchanges" field. Note that due to the size of the response, this might take a while.
V2: Use reference-data/markets?asset=<ASSET> and get the "exchange" field for each observation, loop through each observation. (Note that due to pagination, you will have to loop through the entire response).
Note that these responses includes exchanges or markets that are now defunct. To get a more precise real-time coverage, see How do I get which the min and max times an asset has been traded in an exchange?
How do I get which markets are on an exchange?
V1: Use catalog/exchanges and get "markets" field
V2: Use reference-data/markets?exchange=<EXCHANGE> and get the "market" field for each observation, loop through each observation. (Note that due to pagination, you will have to loop through the entire response).
How do I get the markets for which an asset is a base/quote?
V1: For getting markets where the asset is only one of a base or quote, use catalog/markets?base=<ASSET>
or catalog/markets?quote=<ASSET>
respectively. For getting markets where the asset is either a base or quote, use catalog/markets?asset=<ASSET>
.
V2: For getting markets where the asset is only one of a base or quote, use reference-data/markets?base=<ASSET>
or reference-data/markets?quote=<ASSET>
respectively. For getting markets where the asset is either a base or quote, use reference-data/markets?asset=<ASSET>
.
How do I get which metrics are covered for a given asset/pair/exchange/market/exchange-asset/institution?
V1: Usecatalog/*-metrics
respectively and pass asset, pair, exchange, or market where applicable. Then, loop through each element to search for the presence of that asset, pair, exchange, or market.
V2: Usecatalog-v2/*-metrics
respectively and pass asset, pair, exchange, or market where applicable.
Suppose you wanted to know which asset-metrics
are available for btc
:
How do I get which assets/pairs/exchanges/markets are covered for a given metric?
V1: Use catalog/*-metrics
and pass your metric(s). Each element will have a frequencies value with a nested assets
value for each frequency. Find the appropriate frequency and grab that list of assets.
V2: Use catalog-v2/*-metrics
and pass your metric(s). Loop through element and get the asset
value.
Suppose you wanted to know what assets are covered by PriceUSD
:
How do I get which raw observation data are covered for a given market?
V1 and V2: Use catalog/market-*
and catalog-v2/market-*
respectively and pass markets where applicable.
Below is an example of using market-trades:
How do I get min and max time for a market?
V1 and V2: Use catalog/market-trades?asset=<ASSET>&exchange=<EXCHANGE>
and catalog-v2/market-trades?asset=<ASSET>&exchange=<EXCHANGE>
respectively and get the min
and max
times.
How do I get which the min and max times an asset has been traded in an exchange?
V1 and V2: Use catalog/market-trades?asset=<ASSET>&exchange=<EXCHANGE>
and catalog-v2/market-trades?asset=<ASSET>&exchange=<EXCHANGE>
respectively and get the min
and max
times.
How do I get what metrics are available for a given product and frequency?
Suppose we wanted to get metrics for the Network Data product that are available at 1 hour frequency.
V1:
Use catalog/asset-metrics, filter by frequency = '1h' and 'product' = 'Network Data'
V2:
query
reference-data/asset-metrics
, filter for 'product' = 'Network Data'query
catalog-v2/asset-metrics?metrics=<LIST_OF_NETWORK_DATA_METRICS>
, filter for frequency = '1h'
A Mapping of Catalog Endpoints to Catalog V2 and Reference Data Endpoints
*Note that reference-data endpoints will show all data covered for a given entity, not just those visible in catalog-v2. This contrasts that of the behavior of catalog-v2 showing just the data available with your API key and catalog-v2-all showing all data.
Last updated