Skip to content

Commit

Permalink
Add exchange GetAvailableCurrencies function
Browse files Browse the repository at this point in the history
  • Loading branch information
thrasher- committed Aug 23, 2017
1 parent 7be8c02 commit a4c996b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
6 changes: 6 additions & 0 deletions exchanges/exchange.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
13 changes: 13 additions & 0 deletions exchanges/exchange_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit a4c996b

Please sign in to comment.