mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-03 23:16:53 +00:00
Improve pairs/translation packages and various fixes
This commit is contained in:
@@ -354,6 +354,9 @@ func (c *COINUT) SendHTTPRequest(apiRequest string, params map[string]interface{
|
||||
return errors.New("unable to JSON Unmarshal generic response")
|
||||
}
|
||||
|
||||
if len(genResp.Status) < 1 {
|
||||
return errors.New("genResp.Status was empty")
|
||||
}
|
||||
if genResp.Status[0] != "OK" {
|
||||
return errors.New("status is not OK")
|
||||
}
|
||||
|
||||
@@ -218,9 +218,9 @@ func (e *Base) GetAvailableCurrencies() []pair.CurrencyPair {
|
||||
// exchange available currencies or not
|
||||
func (e *Base) SupportsCurrency(p pair.CurrencyPair, enabledPairs bool) bool {
|
||||
if enabledPairs {
|
||||
return pair.Contains(e.GetEnabledCurrencies(), p)
|
||||
return pair.Contains(e.GetEnabledCurrencies(), p, false)
|
||||
}
|
||||
return pair.Contains(e.GetAvailableCurrencies(), p)
|
||||
return pair.Contains(e.GetAvailableCurrencies(), p, false)
|
||||
}
|
||||
|
||||
// GetExchangeFormatCurrencySeperator returns whether or not a specific
|
||||
|
||||
@@ -503,12 +503,12 @@ func TestSetCurrencies(t *testing.T) {
|
||||
|
||||
UAC.Name = "ANX"
|
||||
UAC.SetCurrencies([]pair.CurrencyPair{newPair}, true)
|
||||
if !pair.Contains(UAC.GetEnabledCurrencies(), newPair) {
|
||||
if !pair.Contains(UAC.GetEnabledCurrencies(), newPair, true) {
|
||||
t.Fatal("Test failed. TestSetCurrencies failed to set currencies")
|
||||
}
|
||||
|
||||
UAC.SetCurrencies([]pair.CurrencyPair{newPair}, false)
|
||||
if !pair.Contains(UAC.GetAvailableCurrencies(), newPair) {
|
||||
if !pair.Contains(UAC.GetAvailableCurrencies(), newPair, true) {
|
||||
t.Fatal("Test failed. TestSetCurrencies failed to set currencies")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ func Append(exchange string, p pair.CurrencyPair, assetType string, price, volum
|
||||
// for a specific currency pair and asset type
|
||||
func AlreadyExists(exchange string, p pair.CurrencyPair, assetType string, price, volume float64) bool {
|
||||
for i := range Items {
|
||||
if Items[i].Exchange == exchange && Items[i].Pair.Equal(p) && Items[i].AssetType == assetType {
|
||||
if Items[i].Exchange == exchange && Items[i].Pair.Equal(p, false) && Items[i].AssetType == assetType {
|
||||
Items[i].Price, Items[i].Volume = price, volume
|
||||
return true
|
||||
}
|
||||
@@ -103,7 +103,7 @@ func AlreadyExists(exchange string, p pair.CurrencyPair, assetType string, price
|
||||
func SortExchangesByVolume(p pair.CurrencyPair, assetType string, reverse bool) []Item {
|
||||
var result []Item
|
||||
for x := range Items {
|
||||
if Items[x].Pair.Equal(p) && Items[x].AssetType == assetType {
|
||||
if Items[x].Pair.Equal(p, false) && Items[x].AssetType == assetType {
|
||||
result = append(result, Items[x])
|
||||
}
|
||||
}
|
||||
@@ -122,7 +122,7 @@ func SortExchangesByVolume(p pair.CurrencyPair, assetType string, reverse bool)
|
||||
func SortExchangesByPrice(p pair.CurrencyPair, assetType string, reverse bool) []Item {
|
||||
var result []Item
|
||||
for x := range Items {
|
||||
if Items[x].Pair.Equal(p) && Items[x].AssetType == assetType {
|
||||
if Items[x].Pair.Equal(p, false) && Items[x].AssetType == assetType {
|
||||
result = append(result, Items[x])
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user