price

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2021 License: LGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ETH - the ethereum currency.
	ETH currency = "ethereum"
	// MYST - the mysterium coin.
	MYST currency = "mysterium"
	// MATIC - the matic coin.
	MATIC currency = "matic-network"
	// USD - the good old dollar.
	USD currency = "usd"
	// EUR - the official currency of the European Union
	EUR currency = "eur"
)
View Source
const DefaultCoinRankingURI = "https://api.coinranking.com/v2/"

DefaultCoinRankingURI points to default CoinRanking api.

View Source
const DefaultGeckoURI = "https://api.coingecko.com/api/v3"

DefaultGeckoURI points to default coingecko api.

Variables

This section is empty.

Functions

This section is empty.

Types

type CoinRanking

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

CoinRanking represents a CoinRanking REST API client.

func NewCoinRanking

func NewCoinRanking(baseURI string, coinRankingAccessToken *string) *CoinRanking

NewCoinRanking returns a new CoinRanking API client.

func (*CoinRanking) GetCoinPrice

func (g *CoinRanking) GetCoinPrice(coins []string, vsCurrencies []string) (PriceResponse, error)

GetCoinPrice returns the coin price in the given currencies for given coins.

type Gecko

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

Gecko represents a gecko REST API client.

func NewGecko

func NewGecko(baseURI string) *Gecko

NewGecko returns a new gecko API client.

func (*Gecko) GetCoinPrice

func (g *Gecko) GetCoinPrice(coins []string, vsCurrencies []string) (PriceResponse, error)

GetCoinPrice returns the coin price in the given currencies for given coins.

type PriceResponse

type PriceResponse map[string]Prices

PriceResponse represents the gecko price response.

func (PriceResponse) GetPriceInUSD

func (pr PriceResponse) GetPriceInUSD(c currency) (float64, bool)

GetPriceInUSD returns the price in USD.

type Prices

type Prices map[string]float64

Prices represents a single coin pricing information.

Jump to

Keyboard shortcuts

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