Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.
/ go-gecko Public archive

Simple API Client for CoinGecko written in Go.

License

Notifications You must be signed in to change notification settings

superoo7/go-gecko

Repository files navigation

CoinGecko API Client for Go

Build Status GoDoc

Simple API Client for CoinGecko written in Go

gogecko

gopher resources from free-gophers-pack

Available endpoint

Refer to CoinGecko official API

Endpoint Status Testing Function
/ping [/] [/] Ping
/simple/price [/] [/] SimpleSinglePrice, SimplePrice
/simple/supported_vs_currencies [/] [/] SimpleSupportedVSCurrencies
/coins/list [/] [/] CoinsList
/coins/market [/] [/] CoinsMarket
/coins/{id} [/] CoinsID
/coins/{id}/history [/] CoinsIDHistory
/coins/{id}/market_chart [/] CoinsIDMarketChart
/events/countries [/] EventsCountries
/events/types [/] EventsType
/exchange_rates [/] ExchangeRate
/global [/] Global

Usage

Installation with go get.

go get -u github.com/superoo7/go-gecko

For usage, checkout Example folder for v3

For production, you might need to set time out for httpClient, here's a sample code:

package main

import (
	"net/http"
	"time"

	coingecko "github.com/superoo7/go-gecko/v3"
)

func main() {
	httpClient := &http.Client{
		Timeout: time.Second * 10,
	}
	CG := coingecko.NewClient(httpClient)
}

Convention

refer to https://medium.com/@marcus.olsson/writing-a-go-client-for-your-restful-api-c193a2f4998c

License

MIT