The latest and most up-to-date CoinMarketCap API client for Go.
Supports the CoinMarketCap API Pro Version, V2 and V1 Public API
https://godoc.org/github.com/miguelmota/go-coinmarketcap
go get -u github.com/miguelmota/go-coinmarketcap| Type | Endpoint | Implemented? |
|---|---|---|
| Cryptocurrency | /v1/cryptocurrency/info | Yes |
| Cryptocurrency | /v1/cryptocurrency/map | - |
| Cryptocurrency | /v1/cryptocurrency/listings/latest | Yes |
| Cryptocurrency | /v1/cryptocurrency/market-pairs/latest | - |
| Cryptocurrency | /v1/cryptocurrency/ohlcv/historical | - |
| Cryptocurrency | /v1/cryptocurrency/quotes/latest | - |
| Cryptocurrency | /v1/cryptocurrency/quotes/historical | - |
| Exchange | /v1/exchange/info | - |
| Exchange | /v1/exchange/map | - |
| Exchange | /v1/exchange/listings/latest | - |
| Exchange | /v1/exchange/market-pairs/latest | - |
| Exchange | /v1/exchange/quotes/latest | - |
| Exchange | /v1/exchange/quotes/historical | - |
| Global Metrics | /v1/global-metrics/quotes/latest | - |
| Global Metrics | /v1/global-metrics/quotes/historical | - |
| Tools | /v1/tools/price-conversion | - |
package main
import (
"fmt"
"log"
cmc "github.com/miguelmota/go-coinmarketcap/pro/v1"
)
func main() {
client := cmc.NewClient(&cmc.Config{
ProAPIKey: "01585d6d-123-456-789-3146576cbc70",
})
listings, err := client.CryptocurrencyListingsLatest(&cmc.CryptocurrencyListingsLatestOptions{
Limit: 1,
})
if err != nil {
log.Fatal(err)
}
for _, listing := range listings {
fmt.Println(listing.Name) // "Bitcoin"
fmt.Println(listing.Quote["USD"].Price) // 6316.75736886
}
}For more examples, check out the ./pro/v1/example directory and documentation
NOTE: CoinMarketCap will deprecated this API on December 2018
package main
import (
"fmt"
"log"
cmc "github.com/miguelmota/go-coinmarketcap"
)
func main() {
tickers, err := cmc.Tickers(&cmc.TickersOptions{
Start: 0,
Limit: 100,
Convert: "USD",
})
if err != nil {
log.Fatal(err)
}
for _, ticker := range tickers {
fmt.Println(ticker.Symbol, ticker.Quotes["USD"].Price)
}
}For more examples, check out the ./v2/example directory and documentation
NOTE: CoinMarketCap will deprecated this API on November 2018
package main
import (
"fmt"
"log"
cmc "github.com/miguelmota/go-coinmarketcap"
)
func main() {
tickers, err := cmc.Tickers(&cmc.TickersOptions{
Start: 0,
Limit: 100,
Convert: "USD",
})
if err != nil {
log.Fatal(err)
}
for _, ticker := range tickers {
fmt.Println(ticker.Symbol, ticker.Quotes["USD"].Price)
}
}For more examples, check out the ./v1/example directory and documentation
MIT
