mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 23:16:45 +00:00
Added basic error handling for RetrieveConfigCurrencyPairs
This commit is contained in:
committed by
Adrian Gallagher
parent
58741e73ef
commit
e27260df6b
@@ -205,10 +205,19 @@ func (c *Config) CheckWebserverConfigValues() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Config) RetrieveConfigCurrencyPairs() {
|
||||
func (c *Config) RetrieveConfigCurrencyPairs() error {
|
||||
cryptoCurrencies := common.SplitStrings(c.Cryptocurrencies, ",")
|
||||
fiatCurrencies := common.SplitStrings(currency.DEFAULT_CURRENCIES, ",")
|
||||
|
||||
for _, s := range cryptoCurrencies {
|
||||
_, err := strconv.Atoi(s)
|
||||
if err != nil && common.StringContains(c.Cryptocurrencies, s) {
|
||||
continue
|
||||
} else {
|
||||
return errors.New("RetrieveConfigCurrencyPairs: Incorrect Crypto-Currency")
|
||||
}
|
||||
}
|
||||
|
||||
for _, exchange := range c.Exchanges {
|
||||
if exchange.Enabled {
|
||||
baseCurrencies := common.SplitStrings(exchange.BaseCurrencies, ",")
|
||||
@@ -252,6 +261,8 @@ func (c *Config) RetrieveConfigCurrencyPairs() {
|
||||
}
|
||||
c.Cryptocurrencies = common.JoinStrings(cryptoCurrencies, ",")
|
||||
currency.CryptoCurrencies = c.Cryptocurrencies
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Config) ReadConfig() error {
|
||||
|
||||
Reference in New Issue
Block a user