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
- Host: GitHub
- URL: https://github.com/tech-branch/coinmetrics
- Owner: tech-branch
- License: mit
- Created: 2021-04-23T17:12:57.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-05-02T16:07:55.000Z (about 5 years ago)
- Last Synced: 2024-06-20T17:30:58.950Z (almost 2 years ago)
- Language: Go
- Size: 5.86 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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.