Currency: Add new forex provider exchangerate.host (#682)

* Add new forex provider ExchangeRateHost.io

* Fix linter paramTypeComine

* Add templates and README files

* Convert all times to UTC

* Fix cosmetic issue and address nits

* Add support for fx exchangerate.host engine override

* Address nit plus use remove plural
This commit is contained in:
Adrian Gallagher
2021-05-05 15:32:49 +10:00
committed by GitHub
parent 5d445991c7
commit 6ff453c364
20 changed files with 968 additions and 117 deletions

View File

@@ -313,6 +313,7 @@ func PrintSettings(s *Settings) {
gctlog.Debugf(gctlog.Global, "\t Enable currency layer: %v", s.EnableCurrencyLayer)
gctlog.Debugf(gctlog.Global, "\t Enable fixer: %v", s.EnableFixer)
gctlog.Debugf(gctlog.Global, "\t Enable OpenExchangeRates: %v", s.EnableOpenExchangeRates)
gctlog.Debugf(gctlog.Global, "\t Enable ExchangeRateHost: %v", s.EnableExchangeRateHost)
gctlog.Debugf(gctlog.Global, "- EXCHANGE SETTINGS:")
gctlog.Debugf(gctlog.Global, "\t Enable exchange auto pair updates: %v", s.EnableExchangeAutoPairUpdates)
gctlog.Debugf(gctlog.Global, "\t Disable all exchange auto pair updates: %v", s.DisableExchangeAutoPairUpdates)
@@ -412,13 +413,15 @@ func (bot *Engine) Start() error {
bot.Settings.EnableCurrencyConverter ||
bot.Settings.EnableCurrencyLayer ||
bot.Settings.EnableFixer ||
bot.Settings.EnableOpenExchangeRates {
bot.Settings.EnableOpenExchangeRates ||
bot.Settings.EnableExchangeRateHost {
err = currency.RunStorageUpdater(currency.BotOverrides{
Coinmarketcap: bot.Settings.EnableCoinmarketcapAnalysis,
FxCurrencyConverter: bot.Settings.EnableCurrencyConverter,
FxCurrencyLayer: bot.Settings.EnableCurrencyLayer,
FxFixer: bot.Settings.EnableFixer,
FxOpenExchangeRates: bot.Settings.EnableOpenExchangeRates,
FxExchangeRateHost: bot.Settings.EnableExchangeRateHost,
},
&currency.MainConfiguration{
ForexProviders: bot.Config.GetForexProviders(),
@@ -563,7 +566,8 @@ func (bot *Engine) Stop() {
bot.Settings.EnableCurrencyConverter ||
bot.Settings.EnableCurrencyLayer ||
bot.Settings.EnableFixer ||
bot.Settings.EnableOpenExchangeRates {
bot.Settings.EnableOpenExchangeRates ||
bot.Settings.EnableExchangeRateHost {
if err := currency.ShutdownStorageUpdater(); err != nil {
gctlog.Errorf(gctlog.Global, "ExchangeSettings storage system. Error: %v", err)
}

View File

@@ -52,6 +52,7 @@ type Settings struct {
EnableCurrencyLayer bool
EnableFixer bool
EnableOpenExchangeRates bool
EnableExchangeRateHost bool
// Exchange tuning settings
EnableExchangeHTTPRateLimiter bool