GithubHelp home page GithubHelp logo

miguelmota / go-coinmarketcap Goto Github PK

View Code? Open in Web Editor NEW
48.0 5.0 28.0 167 KB

The unofficial CoinMarketCap API client for Go.

Home Page: https://github.com/miguelmota/go-coinmarketcap

License: MIT License

Makefile 0.52% Go 99.48%
golang coinmarketcap api sdk bindings cryptocurrencies tokens graph digital-currency coin

go-coinmarketcap's Introduction


go-coinmarketcap


The unofficial CoinMarketCap API client for Go.

License Build Status Go Report Card GoDoc PRs Welcome

Supports the CoinMarketCap API Pro Version, V2 and V1 Public API

Contents

Documentation

https://godoc.org/github.com/miguelmota/go-coinmarketcap

Install

go get -u github.com/miguelmota/go-coinmarketcap

Pro V1 (latest)

Type Endpoint Implemented?
Cryptocurrency /v1/cryptocurrency/info
Cryptocurrency /v1/cryptocurrency/map
Cryptocurrency /v1/cryptocurrency/listings/latest
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

Note: some endpoints require a paid plan.

Getting started

package main

import (
	"fmt"
	"os"

	cmc "github.com/miguelmota/go-coinmarketcap/pro/v1"
)

func main() {
	client := cmc.NewClient(&cmc.Config{
		ProAPIKey: os.Getenv("CMC_PRO_API_KEY"),
	})

	listings, err := client.Cryptocurrency.LatestListings(&cmc.ListingOptions{
		Limit: 1,
	})
	if err != nil {
		panic(err)
	}

	for _, listing := range listings {
		fmt.Println(listing.Name)               // "Bitcoin"
		fmt.Println(listing.Quote["USD"].Price) // 6316.75736886
	}
}

Examples

For more examples, check out the ./pro/v1/example directory and documentation


V2

NOTE: CoinMarketCap deprecated this API on December 2018

Getting started

package main

import (
	"fmt"
	"log"

	cmc "github.com/miguelmota/go-coinmarketcap/v2"
)

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)
	}
}

Examples

For more examples, check out the ./v2/example directory and documentation


V1

NOTE: CoinMarketCap deprecated this API on November 2018

Getting started

package main

import (
	"fmt"
	"log"

	cmc "github.com/miguelmota/go-coinmarketcap/v1"
)

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)
	}
}

Examples

For more examples, check out the ./v1/example directory and documentation

Contributing

Pull requests are welcome.

Please make sure to add tests when adding new methods.

Development

Test

make test

Release

git tag v0.1.x
make release

License

MIT

go-coinmarketcap's People

Contributors

alxshelepenok avatar bearbeard avatar darccio avatar fabiodmferreira avatar kokosito avatar miguelmota avatar nexonsu avatar reteps avatar thecount avatar vsdutka avatar wallnutkraken avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

go-coinmarketcap's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.