exchanges: improves GetDefaultConfig method (#1245)

* exchanges: Add function to get standard config

* exchanges: add tests (cherry-pick here and above)

* after pick stuff

* cleanup

---------

Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
This commit is contained in:
Ryan O'Hara-Reid
2023-09-18 11:45:02 +10:00
committed by GitHub
parent ade2d9c5d2
commit 1adbc99526
33 changed files with 430 additions and 345 deletions

View File

@@ -119,7 +119,7 @@ func (w *Websocket) Setup(s *WebsocketSetup) error {
if w.features.Unsubscribe && s.Unsubscriber == nil {
return fmt.Errorf("%s %w", w.exchangeName, errWebsocketUnsubscriberUnset)
}
w.connectionMonitorDelay = s.ConnectionMonitorDelay
w.connectionMonitorDelay = s.ExchangeConfig.ConnectionMonitorDelay
if w.connectionMonitorDelay <= 0 {
w.connectionMonitorDelay = config.DefaultConnectionMonitorDelay
}

View File

@@ -97,16 +97,15 @@ type Websocket struct {
// WebsocketSetup defines variables for setting up a websocket connection
type WebsocketSetup struct {
ExchangeConfig *config.Exchange
DefaultURL string
RunningURL string
RunningURLAuth string
Connector func() error
Subscriber func([]ChannelSubscription) error
Unsubscriber func([]ChannelSubscription) error
GenerateSubscriptions func() ([]ChannelSubscription, error)
Features *protocol.Features
ConnectionMonitorDelay time.Duration
ExchangeConfig *config.Exchange
DefaultURL string
RunningURL string
RunningURLAuth string
Connector func() error
Subscriber func([]ChannelSubscription) error
Unsubscriber func([]ChannelSubscription) error
GenerateSubscriptions func() ([]ChannelSubscription, error)
Features *protocol.Features
// Local orderbook buffer config values
OrderbookBufferConfig buffer.Config