Documentation ¶
Index ¶
Constants ¶
const ( // FiatRateDataExpiry : Any data older than FiatRateDataExpiry will be // discarded. FiatRateDataExpiry = 60 * time.Minute )
Variables ¶
This section is empty.
Functions ¶
func CoinpapSlug ¶
func FetchCoinpaprikaRates ¶
func FetchCoinpaprikaRates(ctx context.Context, assets []*CoinpaprikaAsset, log dex.Logger) map[uint32]float64
FetchCoinpaprikaRates retrieves and parses fiat rate data from the Coinpaprika API. See https://api.coinpaprika.com/#operation/getTickersById for sample request and response information.
Types ¶
type CoinpaprikaAsset ¶
type Config ¶
type Config struct { CryptoCompareAPIKey string `long:"ccdataapikey" description:"This is your free API Key from cryptocompare.com."` EnableBinanceUS bool `long:"enablebinanceus" description:"Set to true, if running the tatanka mesh from a US based server."` DisabledFiatSources string `long:"disabledfiatsources" description:"A list of disabled sources separated by comma. See fiatrate/sources.go."` }
func (Config) AllFiatSourceDisabled ¶
AllFiatSourceDisabled checks if all currently supported fiat rate sources are disabled.
type FiatRateInfo ¶
FiatRateInfo holds the fiat rate and the last update time for an asset.
type Oracle ¶
type Oracle struct {
// contains filtered or unexported fields
}
Oracle manages and retrieves fiat rate information from all enabled rate sources.
func NewFiatOracle ¶
func (*Oracle) AddFiatRateListener ¶
func (o *Oracle) AddFiatRateListener(uniqueID string, ratesChan chan<- map[string]*FiatRateInfo)
AddFiatRateListener adds a new fiat rate listener for the provided uniqueID. Overrides existing rateChan if uniqueID already exists.
func (*Oracle) Rates ¶
func (o *Oracle) Rates() map[string]*FiatRateInfo
Rates returns the current fiat rates. Returns an empty map if there are no valid rates.
func (*Oracle) RemoveFiatRateListener ¶
RemoveFiatRateListener removes a fiat rate listener. no-op if there's no listener for the provided uniqueID. The fiat rate chan will be closed to signal to readers that we are done sending.