An open API service indexing awesome lists of open source software.

https://github.com/tech-branch/coinmetrics

Basic Golang API wrapper for CoinMetrics
https://github.com/tech-branch/coinmetrics

Last synced: 5 months ago
JSON representation

Basic Golang API wrapper for CoinMetrics

Awesome Lists containing this project

README

          

## How to use this wrapper

#### Simple code example

```golang
whichMetric := "CapRealUSD"
sinceWhen := YesterdaySimpleDate() // "" will start with earliest possible datapoint
UntilWhen := "" // most recent datapoint

opts := CMAPIListOptions{Metrics: whichMetric, Start: sinceWhen, End: UntilWhen}
md, err := GetMetricData(context.Background(), *NewCommunityClient(""), &opts)
if err != nil {
panic(err)
}

res := fmt.Sprintf(
"latest %s : %s @ %s",
whichMetric,
md.Data.Series[0].Values[0],
md.Data.Series[0].Date,
)

println(res)
// latest CapRealUSD : 357839722701.057414591381506310739636 @ 2021-04-22T00:00:00.000Z
```

#### Public Safety Announcement

At this particular moment, only the community client is implemented.

This implementation uses V3 of CM API. Unfortunately CM's V4 API introduced a breaking change that
made parsing the json response quite difficult.