mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-24 15:10:19 +00:00
stream/websocket: Consolidate fields by using exchange config pointer (#809)
* stream: add exchange config pointer to setup WebsocketSetup struct to reduce and consolidate setting of variables. * config: reduce stutter * config: reduce minor stutter * glorious: nits addr. * Update exchanges/stream/websocket.go Co-authored-by: Scott <gloriousCode@users.noreply.github.com> * websocket: implement fix * engine/helpers: fix test * exchanges: fix after merge issues * exchange_template: fix output Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
This commit is contained in:
@@ -926,7 +926,7 @@ func (bot *Engine) SetupExchanges() error {
|
||||
continue
|
||||
}
|
||||
wg.Add(1)
|
||||
go func(c config.ExchangeConfig) {
|
||||
go func(c config.Exchange) {
|
||||
defer wg.Done()
|
||||
err := bot.LoadExchange(c.Name, &wg)
|
||||
if err != nil {
|
||||
|
||||
@@ -215,7 +215,7 @@ func TestUnloadExchange(t *testing.T) {
|
||||
exch.SetEnabled(true)
|
||||
em.Add(exch)
|
||||
e := &Engine{ExchangeManager: em,
|
||||
Config: &config.Config{Exchanges: []config.ExchangeConfig{{Name: testExchange}}},
|
||||
Config: &config.Config{Exchanges: []config.Exchange{{Name: testExchange}}},
|
||||
}
|
||||
err = e.UnloadExchange("asdf")
|
||||
if !errors.Is(err, config.ErrExchangeNotFound) {
|
||||
@@ -240,7 +240,7 @@ func TestDryRunParamInteraction(t *testing.T) {
|
||||
ExchangeManager: SetupExchangeManager(),
|
||||
Settings: Settings{},
|
||||
Config: &config.Config{
|
||||
Exchanges: []config.ExchangeConfig{
|
||||
Exchanges: []config.Exchange{
|
||||
{
|
||||
Name: testExchange,
|
||||
WebsocketTrafficTimeout: time.Second,
|
||||
|
||||
@@ -60,7 +60,7 @@ func CreateTestBot(t *testing.T) *Engine {
|
||||
}
|
||||
bot := &Engine{
|
||||
ExchangeManager: SetupExchangeManager(),
|
||||
Config: &config.Config{Exchanges: []config.ExchangeConfig{
|
||||
Config: &config.Config{Exchanges: []config.Exchange{
|
||||
{
|
||||
Name: testExchange,
|
||||
Enabled: true,
|
||||
@@ -368,7 +368,7 @@ func TestGetSpecificAvailablePairs(t *testing.T) {
|
||||
},
|
||||
}
|
||||
e.Config = &config.Config{
|
||||
Exchanges: []config.ExchangeConfig{
|
||||
Exchanges: []config.Exchange{
|
||||
{
|
||||
Enabled: true,
|
||||
Name: testExchange,
|
||||
@@ -714,7 +714,7 @@ func TestGetExchangeNamesByCurrency(t *testing.T) {
|
||||
|
||||
e := CreateTestBot(t)
|
||||
bf := "Bitflyer"
|
||||
e.Config.Exchanges = append(e.Config.Exchanges, config.ExchangeConfig{
|
||||
e.Config.Exchanges = append(e.Config.Exchanges, config.Exchange{
|
||||
Enabled: true,
|
||||
Name: bf,
|
||||
CurrencyPairs: ¤cy.PairsManager{Pairs: map[asset.Item]*currency.PairStore{
|
||||
@@ -1063,7 +1063,7 @@ func createDepositEngine(opts *fakeDepositExchangeOpts) *Engine {
|
||||
return &Engine{
|
||||
Settings: Settings{Verbose: true},
|
||||
Config: &config.Config{
|
||||
Exchanges: []config.ExchangeConfig{
|
||||
Exchanges: []config.Exchange{
|
||||
{
|
||||
Name: "fake",
|
||||
Enabled: true,
|
||||
|
||||
@@ -807,7 +807,7 @@ func TestProcessOrders(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}
|
||||
exch.GetBase().Config = &config.ExchangeConfig{
|
||||
exch.GetBase().Config = &config.Exchange{
|
||||
CurrencyPairs: ¤cy.PairsManager{
|
||||
UseGlobalFormat: true,
|
||||
RequestFormat: ¤cy.PairFormat{
|
||||
|
||||
@@ -849,7 +849,7 @@ func TestSetExchangeTradeProcessing(t *testing.T) {
|
||||
}
|
||||
exch.SetDefaults()
|
||||
b := exch.GetBase()
|
||||
b.Config = &config.ExchangeConfig{
|
||||
b.Config = &config.Exchange{
|
||||
Features: &config.FeaturesConfig{Enabled: config.FeaturesEnabledConfig{SaveTradeData: false}},
|
||||
}
|
||||
em.Add(exch)
|
||||
|
||||
Reference in New Issue
Block a user