-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor ExchangeFactory to Interface for Flexible Exchange Creation
- Loading branch information
Showing
2 changed files
with
5 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,11 @@ | ||
package dealer | ||
|
||
import ( | ||
"errors" | ||
|
||
exchange "github.com/thrasher-corp/gocryptotrader/exchanges" | ||
) | ||
|
||
var ErrCreatorNotRegistered = errors.New("exchange creator not registered") | ||
|
||
type ( | ||
ExchangeFactory func(name string) (exchange.IBotExchange, error) | ||
) | ||
|
||
// NewExchangeByName implements gocryptotrader/engine.CustomExchangeBuilder. | ||
func (e ExchangeFactory) NewExchangeByName(name string) (exchange.IBotExchange, error) { | ||
return e(name) | ||
// ExchangeFactory defines an interface for creating exchange instances. | ||
// It abstracts the instantiation process, allowing for flexible and dynamic creation of different exchanges based on a given name. | ||
type ExchangeFactory interface { | ||
NewExchangeByName(name string) (exchange.IBotExchange, error) | ||
} |