cmc

package
Version: v0.0.0-...-0616b20 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AvailableCurrencies = map[string]bool{"usd": true, "eur": true, "gbp": true, "cny": true}

Functions

This section is empty.

Types

type CoinGecko

type CoinGecko struct {
	Cache *cache.Cache
}

CoinGecko is market data provider.

func NewCoinGecko

func NewCoinGecko() *CoinGecko

func (CoinGecko) GetTezosMarketData

func (c CoinGecko) GetTezosMarketData(curr string) (md models.MarketInfo, err error)

GetTezosMarketData gets the tezos prices and price change from CoinGecko API.

func (CoinGecko) GetTezosMarketDataByCurr

func (c CoinGecko) GetTezosMarketDataByCurr(curr string) (md CurrMarketData, err error)

type CurrMarketData

type CurrMarketData struct {
	Price          float64 `json:"current_price"`
	Price24hChange float64 `json:"price_change_24h"`
	MarketCap      float64 `json:"market_cap"`
	Volume         float64 `json:"total_volume"`
	Supply         float64 `json:"circulating_supply"`
}

MarketData is a Price and Price Change with json deserialization for USD .

func (CurrMarketData) GetMarketCap

func (md CurrMarketData) GetMarketCap() float64

func (CurrMarketData) GetPrice

func (md CurrMarketData) GetPrice() float64

GetPrice returns the price in USD.

func (CurrMarketData) GetPriceChange

func (md CurrMarketData) GetPriceChange() float64

GetPriceChange returns the price change during the last 24 hours in percents.

func (CurrMarketData) GetSupply

func (md CurrMarketData) GetSupply() float64

func (CurrMarketData) GetVolume

func (md CurrMarketData) GetVolume() float64

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