Exchange interface update (#202)

* Adds helper function to get available asset types to the exchange interface

* Adds test to function
This commit is contained in:
Ryan O'Hara-Reid
2018-11-02 09:26:26 +11:00
committed by Adrian Gallagher
parent 5dd0fecc62
commit 19f65df236
3 changed files with 18 additions and 0 deletions

View File

@@ -186,6 +186,7 @@ type IBotExchange interface {
UpdateOrderbook(currency pair.CurrencyPair, assetType string) (orderbook.Base, error)
GetEnabledCurrencies() []pair.CurrencyPair
GetAvailableCurrencies() []pair.CurrencyPair
GetAssetTypes() []string
GetExchangeAccountInfo() (AccountInfo, error)
GetAuthenticatedAPISupport() bool
SetCurrencies(pairs []pair.CurrencyPair, enabledPairs bool) error
@@ -357,6 +358,11 @@ func (e *Base) SetAssetTypes() error {
return nil
}
// GetAssetTypes returns the available asset types for an individual exchange
func (e *Base) GetAssetTypes() []string {
return e.AssetTypes
}
// GetExchangeAssetTypes returns the asset types the exchange supports (SPOT,
// binary, futures)
func GetExchangeAssetTypes(exchName string) ([]string, error) {

View File

@@ -246,6 +246,17 @@ func TestSetAssetTypes(t *testing.T) {
}
}
func TestGetAssetTypes(t *testing.T) {
testExchange := Base{
AssetTypes: []string{"SPOT", "Binary", "Futures"},
}
aT := testExchange.GetAssetTypes()
if len(aT) != 3 {
t.Error("Test failed. TestGetAssetTypes failed")
}
}
func TestGetExchangeAssetTypes(t *testing.T) {
cfg := config.GetConfig()
err := cfg.LoadConfig(config.ConfigTestFile)

View File

@@ -1358,6 +1358,7 @@
],
"bankAccounts": [
{
"enabled": true,
"bankName": "test",
"bankAddress": "test",
"accountName": "TestAccount",