Documentation
¶
Index ¶
- Constants
- type CoinList
- type Coingecko
- func (p *Coingecko) FetchRate(coin string, fiat string) (rate types.ExchangeRate, err error)
- func (p *Coingecko) FetchRateSynced(coin string, fiat string, rates *types.ExchangeRates, wg *sync.WaitGroup)
- func (p *Coingecko) PopulateCoinList() (err error)
- func (p *Coingecko) SetMarket(market string) (err error)
- func (p *Coingecko) SymbolToID(symbol string) (id string, err error)
- type Prices
Constants ¶
View Source
const ( // ProviderName cotains the common name of the provider. ProviderName string = "Coingecko" // APIBaseURL points to the basic API endpoint used for all requests. APIBaseURL string = "https://api.coingecko.com/api/v3" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CoinList ¶
type CoinList []struct { ID string `json:"id"` Symbol string `json:"symbol"` Name string `json:"name"` }
CoinList stores the symbol to ID mappings required for Coingecko API usage.
type Coingecko ¶
type Coingecko struct { // Error is used to convey possible errors. Error error // contains filtered or unexported fields }
Coingecko is a specific implementation of a Provider.
func (*Coingecko) FetchRateSynced ¶
func (p *Coingecko) FetchRateSynced(coin string, fiat string, rates *types.ExchangeRates, wg *sync.WaitGroup)
FetchRateSynced is a multi-threading implementation of FetchRate.
func (*Coingecko) PopulateCoinList ¶
PopulateCoinList retrieves all coins known to Coingecko and stores that information for further use. This is required for Coingecko because common currency symbols need to be mapped to Coingecko-specific IDs for FetchRate().
Click to show internal directories.
Click to hide internal directories.