mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 23:16:45 +00:00
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:
committed by
Adrian Gallagher
parent
5dd0fecc62
commit
19f65df236
@@ -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) {
|
||||
|
||||
@@ -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)
|
||||
|
||||
1
testdata/configtest.json
vendored
1
testdata/configtest.json
vendored
@@ -1358,6 +1358,7 @@
|
||||
],
|
||||
"bankAccounts": [
|
||||
{
|
||||
"enabled": true,
|
||||
"bankName": "test",
|
||||
"bankAddress": "test",
|
||||
"accountName": "TestAccount",
|
||||
|
||||
Reference in New Issue
Block a user