Moved checking function downstream + Added default currency for test

This commit is contained in:
Ryan O'Hara-Reid
2017-04-11 22:25:01 +10:00
parent 8e9d6095c4
commit c425d7dba4

View File

@@ -45,21 +45,22 @@ func (this ByVolume) Swap(i, j int) {
}
func AddExchangeInfo(exchange, crypto, fiat string, price, volume float64) {
if currency.BaseCurrencies == "" {
currency.BaseCurrencies = currency.DEFAULT_CURRENCIES
}
if !currency.IsFiatCurrency(fiat) {
return
}
if len(ExchInfo) == 0 {
AppendExchangeInfo(exchange, crypto, fiat, price, volume)
} else {
if ExchangeInfoAlreadyExists(exchange, crypto, fiat, price, volume) {
return
} else {
AppendExchangeInfo(exchange, crypto, fiat, price, volume)
}
}
AppendExchangeInfo(exchange, crypto, fiat, price, volume)
}
func AppendExchangeInfo(exchange, crypto, fiat string, price, volume float64) {
if ExchangeInfoAlreadyExists(exchange, crypto, fiat, price, volume) {
return
}
exch := ExchangeInfo{}
exch.Exchange = exchange
exch.FirstCurrency = crypto