Comparing Stablecoin Prices Using Different Pricing Methods
Since Tether's launch in 2014, stablecoins have grown to become one of the most dominant sectors in the world of digital assets. Many considered them to be crypto's "killer app," providing global access to stable savings and payment rails beyond the rigid confines of the traditional banking system. In this walkthrough, we use Coin Metrics Market Data Feed and CM Prices to explore the various venues where these assets are traded, and examine various pricing methodologies that allow us to better understand how they perform in comparison to the underlying fiat currencies.
Resources
This notebook demonstrates basic functionality offered by the Coin Metrics Python API Client and Market Data Feed.
Coin Metrics offers a vast assortment of data for hundreds of cryptoassets. The Python API Client allows for easy access to this data using Python without needing to create your own wrappers using requests
and other such libraries.
To understand the data that Coin Metrics offers, feel free to peruse the resources below.
The Coin Metrics API v4 website contains the full set of endpoints and data offered by Coin Metrics.
The Coin Metrics Product Documentation gives detailed, conceptual explanations of the data that Coin Metrics offers.
The API Spec contains a full list of functions.
File Download
Download the entire notebook as either a jupyter notebook to run yourself or as a pdf from the two links below
Notebook Setup
Get Stablecoin Markets
The catalog/markets endpoint returns a list of available markets along with time ranges of available data. Users can pass in a list of markets, exchanges, or market types (spot, futures, options). We can retrieve our stablecoin markets by fetching a list of all 'spot' markets, then filtering for the markets where the 'base' or 'quote' parameter is equivalent to our stablecoin of interest.
market | exchange | base | quote | symbol | |
---|---|---|---|---|---|
0 | bibox-1inch-usdt-spot | bibox | 1inch | usdt | 1INCH_USDT |
1 | bibox-aaa-usdt-spot | bibox | aaa | usdt | AAA_USDT |
2 | bibox-aave-usdt-spot | bibox | aave | usdt | AAVE_USDT |
3 | bibox-ac-usdt-spot | bibox | ac | usdt | AC_USDT |
4 | bibox-acmd-usdt-spot | bibox | acmd | usdt | ACMD_USDT |
... | ... | ... | ... | ... | ... |
19944 | zb.com-yfii-usdt-spot | zb.com | yfii | usdt | yfii_usdt |
19945 | zb.com-ygg-usdt-spot | zb.com | ygg | usdt | ygg_usdt |
19946 | zb.com-zb-usdt-spot | zb.com | zb | usdt | zb_usdt |
19947 | zb.com-zkn-usdt-spot | zb.com | zkn | usdt | zkn_usdt |
19948 | zb.com-zrx-usdt-spot | zb.com | zrx | usdt | zrx_usdt |
19949 rows × 5 columns
Get stablecoin prices
Single market trades
Trades are one of the foundational data types we collect from exchanges. From raw trades data, we can construct additional aggregated metrics.
market | time | coin_metrics_id | amount | price | database_time | side | |
---|---|---|---|---|---|---|---|
0 | coinbase-usdt-usd-spot | 2024-10-03 16:37:50.356121+00:00 | 109485916 | 3000.0 | 0.99985 | 2024-10-03 16:37:51.099860+00:00 | buy |
1 | coinbase-usdt-usd-spot | 2024-10-03 16:37:52.857847+00:00 | 109485917 | 3000.0 | 0.99985 | 2024-10-03 16:37:53.278230+00:00 | buy |
2 | coinbase-usdt-usd-spot | 2024-10-03 16:37:54.748770+00:00 | 109485918 | 1555.08 | 0.99985 | 2024-10-03 16:37:55.566500+00:00 | buy |
3 | coinbase-usdt-usd-spot | 2024-10-03 16:37:55.358549+00:00 | 109485919 | 3000.0 | 0.99985 | 2024-10-03 16:37:55.652974+00:00 | buy |
4 | coinbase-usdt-usd-spot | 2024-10-03 16:37:59.787414+00:00 | 109485920 | 2069.41 | 0.99985 | 2024-10-03 16:38:00.856793+00:00 | buy |
... | ... | ... | ... | ... | ... | ... | ... |
95 | coinbase-usdt-usd-spot | 2024-10-03 16:41:24.050200+00:00 | 109486011 | 19.56 | 0.99985 | 2024-10-03 16:41:24.700790+00:00 | buy |
96 | coinbase-usdt-usd-spot | 2024-10-03 16:41:24.746299+00:00 | 109486012 | 1170.67 | 0.99985 | 2024-10-03 16:41:25.211754+00:00 | buy |
97 | coinbase-usdt-usd-spot | 2024-10-03 16:41:26.109516+00:00 | 109486013 | 7.18 | 0.99985 | 2024-10-03 16:41:26.660344+00:00 | buy |
98 | coinbase-usdt-usd-spot | 2024-10-03 16:41:26.855646+00:00 | 109486014 | 3000.0 | 0.99984 | 2024-10-03 16:41:27.752326+00:00 | sell |
99 | coinbase-usdt-usd-spot | 2024-10-03 16:41:34.937992+00:00 | 109486015 | 23.49 | 0.99984 | 2024-10-03 16:41:35.141694+00:00 | sell |
100 rows × 7 columns
Single market candles
From raw trades data, we construct OHLC candles for each market. Candles include the following data types:
price_open: The opening price of the candle.
price_high: The high price of the candle.
price_low: The low price of the candle.
price_close: The close price of the candle.
vwap: The volume-weighted average price of the candle.
volume: The volume of the candle in units of the base asset.
candle_usd_volume: The volume of the candle in units of U.S. dollars.
candle_trades_count: The number of trades in the candle interval.
market | time | price_open | price_close | price_high | price_low | vwap | volume | candle_usd_volume | candle_trades_count | |
---|---|---|---|---|---|---|---|---|---|---|
0 | coinbase-usdt-usd-spot | 2021-05-04 00:00:00+00:00 | 1.002 | 1.0006 | 1.003 | 0.999 | 1.000696 | 24564061.73 | 24581147.409593 | 30527 |
1 | coinbase-usdt-usd-spot | 2021-05-05 00:00:00+00:00 | 1.0006 | 1.0013 | 1.002 | 0.9997 | 1.000816 | 40170830.16 | 40203590.541009 | 43688 |
2 | coinbase-usdt-usd-spot | 2021-05-06 00:00:00+00:00 | 1.0013 | 1.0009 | 1.002 | 1.0004 | 1.001023 | 51129166.79 | 51181449.603235 | 51177 |
3 | coinbase-usdt-usd-spot | 2021-05-07 00:00:00+00:00 | 1.0008 | 1.0011 | 1.0018 | 1.0 | 1.001045 | 44247619.59 | 44293836.840656 | 48729 |
4 | coinbase-usdt-usd-spot | 2021-05-08 00:00:00+00:00 | 1.001 | 1.0016 | 1.0022 | 1.0009 | 1.00147 | 26972741.16 | 27012382.918589 | 50140 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
1243 | coinbase-usdt-usd-spot | 2024-09-28 00:00:00+00:00 | 1.00012 | 1.00011 | 1.00021 | 1.0 | 1.000127 | 69876132.62 | 69884972.64875 | 33216 |
1244 | coinbase-usdt-usd-spot | 2024-09-29 00:00:00+00:00 | 1.00011 | 1.00013 | 1.00021 | 1.00001 | 1.000107 | 85000340.62 | 85009396.570012 | 34237 |
1245 | coinbase-usdt-usd-spot | 2024-09-30 00:00:00+00:00 | 1.00014 | 0.99971 | 1.00014 | 0.99958 | 0.999863 | 250585092.98 | 250550678.3691 | 81461 |
1246 | coinbase-usdt-usd-spot | 2024-10-01 00:00:00+00:00 | 0.9997 | 0.99975 | 0.99991 | 0.99923 | 0.999677 | 460273457.69 | 460124819.483157 | 169777 |
1247 | coinbase-usdt-usd-spot | 2024-10-02 00:00:00+00:00 | 0.99975 | 0.99977 | 1.0 | 0.99958 | 0.999796 | 345349657.46 | 345279261.97222 | 144072 |
1248 rows × 10 columns
Reference Rate Candles
We offer reference rates quoted in USD, Euro, Bitcoin, and Ethereum. We now support these quote currencies for our entire reference rates coverage universe of over 500 assets and for all of our frequencies, including 1s, 1m, 1h, 1d-ny-close and 1d.
Current composition of markets for USDT-USD Reference Rate pair (as of May 17, 2023):
"coinbase-usdt-usd-spot",
"coinbase-eth-usdt-spot",
"coinbase-btc-usdt-spot",
"kraken-usdt-usd-spot",
"binance-btc-usdt-spot",
"binance-eth-usdt-spot",
"crypto.com-usdt-usd-spot"
pair | frequency | min_time | max_time | |
---|---|---|---|---|
8640 | usdt-usd | 1m | 2013-12-28 00:00:00+00:00 | 2024-10-03 16:39:00+00:00 |
8641 | usdt-usd | 5m | 2013-12-28 00:00:00+00:00 | 2024-10-03 16:35:00+00:00 |
8642 | usdt-usd | 10m | 2013-12-28 00:00:00+00:00 | 2024-10-03 16:30:00+00:00 |
8643 | usdt-usd | 15m | 2013-12-28 00:00:00+00:00 | 2024-10-03 16:15:00+00:00 |
8644 | usdt-usd | 30m | 2013-12-28 00:00:00+00:00 | 2024-10-03 16:00:00+00:00 |
8645 | usdt-usd | 1h | 2013-12-28 00:00:00+00:00 | 2024-10-03 15:00:00+00:00 |
8646 | usdt-usd | 4h | 2013-12-28 00:00:00+00:00 | 2024-10-03 12:00:00+00:00 |
8647 | usdt-usd | 1d | 2013-12-28 00:00:00+00:00 | 2024-10-02 00:00:00+00:00 |
pair | time | price_open | price_close | price_high | price_low | |
---|---|---|---|---|---|---|
22 | usdt-usd | 2024-09-28 00:00:00+00:00 | 1.00016 | 1.000153 | 1.00053 | 0.999861 |
23 | usdt-usd | 2024-09-29 00:00:00+00:00 | 1.000116 | 1.00013 | 1.000492 | 0.999772 |
24 | usdt-usd | 2024-09-30 00:00:00+00:00 | 1.00013 | 0.999649 | 1.00053 | 0.99937 |
25 | usdt-usd | 2024-10-01 00:00:00+00:00 | 0.999639 | 0.9998 | 1.000897 | 0.998931 |
26 | usdt-usd | 2024-10-02 00:00:00+00:00 | 0.9998 | 0.99982 | 1.000601 | 0.999219 |
Reference Rate
asset | metrics | |
---|---|---|
0 | usdt | [{'metric': 'ReferenceRateUSD', 'frequencies':... |
asset | time | ReferenceRateUSD | |
---|---|---|---|
0 | usdt | 2024-10-02 11:42:00+00:00 | 0.99984 |
1 | usdt | 2024-10-02 11:43:00+00:00 | 0.99979 |
2 | usdt | 2024-10-02 11:44:00+00:00 | 0.99983 |
3 | usdt | 2024-10-02 11:45:00+00:00 | 0.999845 |
4 | usdt | 2024-10-02 11:46:00+00:00 | 0.99982 |
... | ... | ... | ... |
1735 | usdt | 2024-10-03 16:37:00+00:00 | 0.999861 |
1736 | usdt | 2024-10-03 16:38:00+00:00 | 0.99985 |
1737 | usdt | 2024-10-03 16:39:00+00:00 | 0.99985 |
1738 | usdt | 2024-10-03 16:40:00+00:00 | 0.99984 |
1739 | usdt | 2024-10-03 16:41:00+00:00 | 0.999835 |
1740 rows × 3 columns
Principal Market Price
The Principal Market Prices identify a principal market for each asset and utilize the most recent price from this market. Common use cases are for fair value measurement, preparing financial statements, and calculating closing prices for indexes or financial benchmarks.
asset | time | principal_market_price_usd | principal_market_usd | |
---|---|---|---|---|
0 | usdt | 2024-10-02 11:42:00+00:00 | 0.999835 | binance-btc-usdt-spot |
1 | usdt | 2024-10-02 11:43:00+00:00 | 0.999921 | binance-btc-usdt-spot |
2 | usdt | 2024-10-02 11:44:00+00:00 | 0.999892 | binance-btc-usdt-spot |
3 | usdt | 2024-10-02 11:45:00+00:00 | 0.999845 | binance-btc-usdt-spot |
4 | usdt | 2024-10-02 11:46:00+00:00 | 0.999763 | binance-btc-usdt-spot |
... | ... | ... | ... | ... |
1735 | usdt | 2024-10-03 16:37:00+00:00 | 0.999861 | crypto.com-btc-usdt-spot |
1736 | usdt | 2024-10-03 16:38:00+00:00 | 0.999839 | crypto.com-btc-usdt-spot |
1737 | usdt | 2024-10-03 16:39:00+00:00 | 0.999777 | crypto.com-btc-usdt-spot |
1738 | usdt | 2024-10-03 16:40:00+00:00 | 0.999679 | crypto.com-btc-usdt-spot |
1739 | usdt | 2024-10-03 16:41:00+00:00 | 0.999798 | crypto.com-btc-usdt-spot |
1740 rows × 4 columns
Last updated