mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-09 15:11:10 +00:00
Add currency converter provider failover and add config setting
This commit is contained in:
@@ -45,6 +45,7 @@ var (
|
||||
WarningWebserverListenAddressInvalid = "WARNING -- Webserver support disabled due to invalid listen address."
|
||||
WarningWebserverRootWebFolderNotFound = "WARNING -- Webserver support disabled due to missing web folder."
|
||||
WarningExchangeAuthAPIDefaultOrEmptyValues = "WARNING -- Exchange %s: Authenticated API support disabled due to default/empty APIKey/Secret/ClientID values."
|
||||
WarningCurrencyExchangeProvider = "WARNING -- Currency exchange provider invalid valid. Reset to Fixer."
|
||||
RenamingConfigFile = "Renaming config file %s to %s."
|
||||
Cfg Config
|
||||
)
|
||||
@@ -86,14 +87,15 @@ type CurrencyPairFormatConfig struct {
|
||||
// Config is the overarching object that holds all the information for
|
||||
// prestart management of portfolio, SMSGlobal, webserver and enabled exchange
|
||||
type Config struct {
|
||||
Name string
|
||||
EncryptConfig int
|
||||
Cryptocurrencies string
|
||||
CurrencyPairFormat *CurrencyPairFormatConfig `json:"CurrencyPairFormat"`
|
||||
Portfolio portfolio.Base `json:"PortfolioAddresses"`
|
||||
SMS SMSGlobalConfig `json:"SMSGlobal"`
|
||||
Webserver WebserverConfig `json:"Webserver"`
|
||||
Exchanges []ExchangeConfig `json:"Exchanges"`
|
||||
Name string
|
||||
EncryptConfig int
|
||||
Cryptocurrencies string
|
||||
CurrencyExchangeProvider string
|
||||
CurrencyPairFormat *CurrencyPairFormatConfig `json:"CurrencyPairFormat"`
|
||||
Portfolio portfolio.Base `json:"PortfolioAddresses"`
|
||||
SMS SMSGlobalConfig `json:"SMSGlobal"`
|
||||
Webserver WebserverConfig `json:"Webserver"`
|
||||
Exchanges []ExchangeConfig `json:"Exchanges"`
|
||||
}
|
||||
|
||||
// ExchangeConfig holds all the information needed for each enabled Exchange.
|
||||
@@ -429,6 +431,15 @@ func (c *Config) LoadConfig(configPath string) error {
|
||||
}
|
||||
}
|
||||
|
||||
if c.CurrencyExchangeProvider == "" {
|
||||
c.CurrencyExchangeProvider = "fixer"
|
||||
} else {
|
||||
if c.CurrencyExchangeProvider != "yahoo" && c.CurrencyExchangeProvider != "fixer" {
|
||||
log.Println(WarningCurrencyExchangeProvider)
|
||||
c.CurrencyExchangeProvider = "fixer"
|
||||
}
|
||||
}
|
||||
|
||||
if c.CurrencyPairFormat == nil {
|
||||
c.CurrencyPairFormat = &CurrencyPairFormatConfig{
|
||||
Delimiter: "-",
|
||||
|
||||
Reference in New Issue
Block a user