Documentation ¶
Index ¶
- type Coingecko
- func (cg *Coingecko) CurrentTickers() (*common.CurrencyRatesTicker, error)
- func (cg *Coingecko) FiveMinutesTickers() (*[]common.CurrencyRatesTicker, error)
- func (cg *Coingecko) HourlyTickers() (*[]common.CurrencyRatesTicker, error)
- func (cg *Coingecko) UpdateHistoricalTickers() error
- func (cg *Coingecko) UpdateHistoricalTokenTickers() error
- type FiatRates
- type OnNewFiatRatesTicker
- type RatesDownloaderInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Coingecko ¶
type Coingecko struct {
// contains filtered or unexported fields
}
Coingecko is a structure that implements RatesDownloaderInterface
func (*Coingecko) CurrentTickers ¶
func (cg *Coingecko) CurrentTickers() (*common.CurrencyRatesTicker, error)
CurrentTickers returns the latest exchange rates
func (*Coingecko) FiveMinutesTickers ¶
func (cg *Coingecko) FiveMinutesTickers() (*[]common.CurrencyRatesTicker, error)
HourlyTickers returns the array of the exchange rates in five minutes granularity
func (*Coingecko) HourlyTickers ¶
func (cg *Coingecko) HourlyTickers() (*[]common.CurrencyRatesTicker, error)
HourlyTickers returns the array of the exchange rates in hourly granularity
func (*Coingecko) UpdateHistoricalTickers ¶
UpdateHistoricalTickers gets historical tickers for the main crypto currency
func (*Coingecko) UpdateHistoricalTokenTickers ¶
UpdateHistoricalTokenTickers gets historical tickers for the tokens
type FiatRates ¶
type FiatRates struct { Enabled bool // contains filtered or unexported fields }
FiatRates is used to fetch and refresh fiat rates
func NewFiatRates ¶
func NewFiatRates(db *db.RocksDB, configFileContent []byte, metrics *common.Metrics, callback OnNewFiatRatesTicker) (*FiatRates, error)
NewFiatRates initializes the FiatRates handler
func (*FiatRates) GetCurrentTicker ¶
func (fr *FiatRates) GetCurrentTicker(vsCurrency string, token string) *common.CurrencyRatesTicker
GetCurrentTicker returns current ticker
func (*FiatRates) GetTickersForTimestamps ¶
func (fr *FiatRates) GetTickersForTimestamps(timestamps []int64, vsCurrency string, token string) (*[]*common.CurrencyRatesTicker, error)
GetTickersForTimestamps returns tickers for slice of timestamps, that contain requested vsCurrency and token
func (*FiatRates) RunDownloader ¶
RunDownloader periodically downloads current (every 15 minutes) and historical (once a day) tickers
type OnNewFiatRatesTicker ¶
type OnNewFiatRatesTicker func(ticker *common.CurrencyRatesTicker)
OnNewFiatRatesTicker is used to send notification about a new FiatRates ticker
type RatesDownloaderInterface ¶
type RatesDownloaderInterface interface { CurrentTickers() (*common.CurrencyRatesTicker, error) HourlyTickers() (*[]common.CurrencyRatesTicker, error) FiveMinutesTickers() (*[]common.CurrencyRatesTicker, error) UpdateHistoricalTickers() error UpdateHistoricalTokenTickers() error }
RatesDownloaderInterface provides method signatures for a specific fiat rates downloader
func NewCoinGeckoDownloader ¶
func NewCoinGeckoDownloader(db *db.RocksDB, url string, coin string, platformIdentifier string, platformVsCurrency string, allowedVsCurrencies string, timeFormat string, metrics *common.Metrics, throttleDown bool) RatesDownloaderInterface
NewCoinGeckoDownloader creates a coingecko structure that implements the RatesDownloaderInterface