livecoinwatch

package
v0.0.0-...-8ca3a07 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: NCSA Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ProviderName cotains the common name of the provider.
	ProviderName string = "LiveCoinWatch"
	// APIBaseURL points to the basic API endpoint used for all requests.
	APIBaseURL string = "https://api.livecoinwatch.com"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type LiveCoinWatch

type LiveCoinWatch struct {

	// Error is used to convey possible errors.
	Error error
	// contains filtered or unexported fields
}

LiveCoinWatch is a specific implementation of a Provider.

func New

func New(c *resty.Client) (p LiveCoinWatch)

New initializes and returns a usable Provider object.

func (*LiveCoinWatch) FetchRate

func (p *LiveCoinWatch) FetchRate(coin string, fiat string) (rate types.ExchangeRate, err error)

FetchRate returns a single ExchangeRate.

func (*LiveCoinWatch) FetchRateSynced

func (p *LiveCoinWatch) FetchRateSynced(coin string, fiat string, rates *types.ExchangeRates, wg *sync.WaitGroup)

FetchRateSynced is a multi-threading implementation of FetchRate.

func (*LiveCoinWatch) SetMarket

func (p *LiveCoinWatch) SetMarket(market string) (err error)

SetMarket does nothing, but needs to be implemented to satisfy the Provider interface.

type PriceQuery

type PriceQuery struct {
	Currency string `json:"currency"`
	Code     string `json:"code"`
	Meta     bool   `json:"meta"`
}

PriceQuery encapsulates an API request for an exchange rate.

type PriceResult

type PriceResult struct {
	Name              string      `json:"name,omitempty"`
	Symbol            string      `json:"symbol,omitempty"`
	Color             string      `json:"color,omitempty"`
	PNG32             string      `json:"png32,omitempty"`
	PNG64             string      `json:"png64,omitempty"`
	WebP32            string      `json:"webp32,omitempty"`
	WebP64            string      `json:"webp64,omitempty"`
	Exchanges         int         `json:"exchanges,omitempty"`
	Markets           int         `json:"markets,omitempty"`
	Pairs             int         `json:"pairs,omitempty"`
	AllTimeHighUSD    float64     `json:"allTimeHighUSD,omitempty"`
	CirculatingSupply int64       `json:"circulatingSupply,omitempty"`
	TotalSupply       interface{} `json:"totalSupply,omitempty"`
	MaxSupply         interface{} `json:"maxSupply,omitempty"`
	Rate              float64     `json:"rate"`
	Volume            int64       `json:"volume"`
	Cap               int64       `json:"cap"`
	Error             struct {
		Code        int    `json:"code"`
		Status      string `json:"status"`
		Description string `json:"description"`
	} `json:"error,omitempty"`
}

PriceResult stores a single exchange rate as returned by the LiveCoinWatch API.

Jump to

Keyboard shortcuts

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