mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-14 07:26:47 +00:00
exchanges: shift GetDefaultConfig wrapper function to exchange.go (#1472)
* Shift wrapper function GetDefaultConfig to exchange.Base method definition, to ensure set defaults doesn't get called twice and to reduce code * rm alphapoint bootstrap method as is defined as exchange.Base method * add tests * glorious: make it a function and make it IBOTEXCHANGE --------- Co-authored-by: shazbert <ryan.oharareid@thrasher.io>
This commit is contained in:
@@ -378,7 +378,7 @@ func TestGetDefaultConfigurations(t *testing.T) {
|
||||
t.Skipf("skipping %s unsupported", name)
|
||||
}
|
||||
|
||||
defaultCfg, err := exch.GetDefaultConfig(context.Background())
|
||||
defaultCfg, err := exchange.GetDefaultConfig(context.Background(), exch)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/thrasher-corp/gocryptotrader/currency"
|
||||
exchange "github.com/thrasher-corp/gocryptotrader/exchanges"
|
||||
"github.com/thrasher-corp/gocryptotrader/exchanges/asset"
|
||||
"github.com/thrasher-corp/gocryptotrader/exchanges/ticker"
|
||||
)
|
||||
@@ -281,8 +282,7 @@ func TestCheckEventCondition(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
exch.SetDefaults()
|
||||
conf, err := exch.GetDefaultConfig(context.Background())
|
||||
conf, err := exchange.GetDefaultConfig(context.Background(), exch)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
@@ -1054,7 +1054,7 @@ func NewExchangeByNameWithDefaults(ctx context.Context, name string) (exchange.I
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defaultConfig, err := exch.GetDefaultConfig(ctx)
|
||||
defaultConfig, err := exchange.GetDefaultConfig(ctx, exch)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -267,9 +267,8 @@ func OrdersSetup(t *testing.T) *OrderManager {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
exch.SetDefaults()
|
||||
|
||||
cfg, err := exch.GetDefaultConfig(context.Background())
|
||||
cfg, err := exchange.GetDefaultConfig(context.Background(), exch)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -24,8 +24,7 @@ func withdrawManagerTestHelper(t *testing.T) (*ExchangeManager, *portfolioManage
|
||||
t.Helper()
|
||||
em := NewExchangeManager()
|
||||
b := new(okx.Okx)
|
||||
b.SetDefaults()
|
||||
cfg, err := b.GetDefaultConfig(context.Background())
|
||||
cfg, err := exchange.GetDefaultConfig(context.Background(), b)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user