Add/improve common string functions, currency pair handling, fix LBTC orderbook amount

This commit is contained in:
Adrian Gallagher
2018-02-08 11:59:54 +11:00
parent 5f10897b5b
commit e8f8e32609
19 changed files with 129 additions and 51 deletions

View File

@@ -338,8 +338,8 @@ func (c *Config) RetrieveConfigCurrencyPairs(enabledOnly bool) error {
baseCurrencies := common.SplitStrings(c.Exchanges[x].BaseCurrencies, ",")
for y := range baseCurrencies {
if !common.DataContains(fiatCurrencies, baseCurrencies[y]) {
fiatCurrencies = append(fiatCurrencies, baseCurrencies[y])
if !common.StringDataCompare(fiatCurrencies, common.StringToUpper(baseCurrencies[y])) {
fiatCurrencies = append(fiatCurrencies, common.StringToUpper(baseCurrencies[y]))
}
}
}
@@ -358,26 +358,20 @@ func (c *Config) RetrieveConfigCurrencyPairs(enabledOnly bool) error {
}
for y := range pairs {
if !common.DataContains(fiatCurrencies, pairs[y].FirstCurrency.String()) &&
!common.DataContains(cryptoCurrencies, pairs[y].FirstCurrency.String()) {
cryptoCurrencies = append(cryptoCurrencies, pairs[y].FirstCurrency.String())
if !common.StringDataCompare(fiatCurrencies, pairs[y].FirstCurrency.Upper().String()) &&
!common.StringDataCompare(cryptoCurrencies, pairs[y].FirstCurrency.Upper().String()) {
cryptoCurrencies = append(cryptoCurrencies, pairs[y].FirstCurrency.Upper().String())
}
if !common.DataContains(fiatCurrencies, pairs[y].SecondCurrency.String()) &&
!common.DataContains(cryptoCurrencies, pairs[y].SecondCurrency.String()) {
cryptoCurrencies = append(cryptoCurrencies, pairs[y].SecondCurrency.String())
if !common.StringDataCompare(fiatCurrencies, pairs[y].SecondCurrency.Upper().String()) &&
!common.StringDataCompare(cryptoCurrencies, pairs[y].SecondCurrency.Upper().String()) {
cryptoCurrencies = append(cryptoCurrencies, pairs[y].SecondCurrency.Upper().String())
}
}
}
currency.Update(fiatCurrencies, false)
currency.Update(cryptoCurrencies, true)
for x := range currency.BaseCurrencies {
if currency.BaseCurrencies[x] == "RUR" {
currency.BaseCurrencies[x] = "RUB"
}
}
return nil
}

View File

@@ -95,7 +95,7 @@ func TestGetEnabledExchanges(t *testing.T) {
)
}
if !common.DataContains(exchanges, "Bitfinex") {
if !common.StringDataCompare(exchanges, "Bitfinex") {
t.Error(
"Test failed. TestGetEnabledExchanges. Expected exchange Bitfinex not found",
)