CM Launches R API Client

CM now offers an official R API client.  Our R API client joins our Python API client to make it easier to collect and clean data enabling users to spend more time on valuable  analytical and engineering efforts.   R is an open-source programming language, popular for statistical computing and data analysis. The CM official R client provides a simple way to access all data available via the Coin Metrics’ API using the R programming language.  By default, data from the API is returned as a tibble so it can be easily manipulated.   For every API endpoint supported in the Coin Metrics docs, there is a related function that follows the same format.  Below is an example:

> library(coinmetrics)
> Sys.setenv("CM_API_KEY" = "<YOUR_API_KEY>")
> assets = c("btc", "eth", "avax")
> start_date = "2023-01-01"
> frequency = "1h"
> coinmetrics::get_asset_metrics(assets = assets, frequency = frequency, start_time = start_date,
metrics = c("ReferenceRateUSD"))# A tibble: 1,281 × 3
   asset time                ReferenceRateUSD
   <chr> <dttm>                         <dbl>
 1 avax  2023-01-01 00:00:00             10.9
 2 avax  2023-01-01 01:00:00             10.8
 3 avax  2023-01-01 02:00:00             10.8
 4 avax  2023-01-01 03:00:00             10.8
 5 avax  2023-01-01 04:00:00             10.8
 6 avax  2023-01-01 05:00:00             10.7
 7 avax  2023-01-01 06:00:00             10.7
 8 avax  2023-01-01 07:00:00             10.7
 9 avax  2023-01-01 08:00:00             10.7
10 avax  2023-01-01 09:00:00             10.7
# … with 1,271 more rows

Please note this is an initial implementation and is considered a beta product.  We welcome feedback so we can make improvements over time.  The official documentation can be found here.

Happy coding!

More

LinkedIn
X.com
Telegram
Email