Version: v1.6.8 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2021 License: Apache-2.0 Imports: 11 Imported by: 0




This section is empty.


View Source
var ErrNotFound = errors.New("not found")

ErrNotFound is the error when the target is not found

View Source
var ErrPingFailed = errors.New("failed to ping")

ErrPingFailed is the error for when pinging the API fails


This section is empty.


type Config added in v1.6.3

type Config struct {
	PerPage  uint
	MaxPages uint

Config config

type Service

type Service struct {
	// contains filtered or unexported fields

Service service

func NewCoinGecko

func NewCoinGecko(config *Config) *Service

NewCoinGecko new service

func (s *Service) CoinLink(name string) string

CoinLink returns the URL link for the coin

func (*Service) GetAllCoinData

func (s *Service) GetAllCoinData(convert string, ch chan []apitypes.Coin) error

GetAllCoinData gets all coin data. Need to paginate through all pages

func (*Service) GetCoinData

func (s *Service) GetCoinData(name string, convert string) (apitypes.Coin, error)

GetCoinData gets all data of a coin.

func (*Service) GetCoinDataBatch

func (s *Service) GetCoinDataBatch(names []string, convert string) ([]apitypes.Coin, error)

GetCoinDataBatch gets all data of specified coins.

func (*Service) GetCoinGraphData

func (s *Service) GetCoinGraphData(convert, symbol, name string, start, end int64) (apitypes.CoinGraph, error)

GetCoinGraphData gets coin graph data

func (*Service) GetGlobalMarketData

func (s *Service) GetGlobalMarketData(convert string) (apitypes.GlobalMarketData, error)

GetGlobalMarketData gets global market data

func (*Service) GetGlobalMarketGraphData

func (s *Service) GetGlobalMarketGraphData(convert string, start int64, end int64) (apitypes.MarketGraph, error)

GetGlobalMarketGraphData gets global market graph data

func (*Service) Ping

func (s *Service) Ping() error

Ping ping API

func (*Service) Price

func (s *Service) Price(name string, convert string) (float64, error)

Price returns the current price of the coin

func (*Service) SupportedCurrencies

func (s *Service) SupportedCurrencies() []string

SupportedCurrencies returns a list of supported currencies

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL