Add exchange GetAvailableCurrencies function

This commit is contained in:
Adrian Gallagher
2017-08-23 14:57:03 +10:00
parent 7be8c0272b
commit a4c996b346
2 changed files with 19 additions and 0 deletions

View File

@@ -85,6 +85,12 @@ func (e *Base) GetEnabledCurrencies() []string {
return e.EnabledPairs
}
// GetAvailableCurrencies is a method that returns the available currency pairs
// of the exchange base
func (e *Base) GetAvailableCurrencies() []string {
return e.AvailablePairs
}
// FormatCurrency is a method that formats and returns a currency pair
// based on the user currency display preferences
func FormatCurrency(p pair.CurrencyPair) pair.CurrencyItem {

View File

@@ -32,6 +32,19 @@ func TestGetEnabledCurrencies(t *testing.T) {
}
}
func TestGetAvailableCurrencies(t *testing.T) {
availablePairs := []string{"BTCUSD", "BTCAUD", "LTCUSD", "LTCAUD"}
GetEnabledCurrencies := Base{
Name: "TESTNAME",
AvailablePairs: availablePairs,
}
enCurr := GetEnabledCurrencies.GetAvailableCurrencies()
if enCurr[0] != "BTCUSD" {
t.Error("Test Failed - Exchange GetAvailableCurrencies() incorrect string")
}
}
func TestFormatCurrency(t *testing.T) {
cfg := config.GetConfig()
err := cfg.LoadConfig(config.ConfigTestFile)