coinmarketcap

package
v1.6.10 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrFetchGraphData = errors.New("graph data fetch error")

ErrFetchGraphData is the error for when fetching graph data fails

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

ErrPingFailed is the error for when pinging the API fails

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

ErrQuoteNotFound is the error for when a quote is not found

Functions

This section is empty.

Types

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service service

func NewCMC

func NewCMC(apiKey string) *Service

NewCMC 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 string, name string, start int64, end int64) (apitypes.CoinGraph, error)

GetCoinGraphData gets coin graph data

func (*Service) GetExchangeRate added in v1.6.10

func (s *Service) GetExchangeRate(convertFrom, convertTo string, cached bool) (float64, error)

GetExchangeRate gets the current excange rate between two currencies

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL