engine/exchange manager: Add support for custom exchanges (#749)

* engine: Setup exchange manager earlier

So it's available for applications before starting.

* engine: Add a custom exchange builder interface

Allows applications that import GCT as a lib to build new
custom exchanges without further modifications.
This commit is contained in:
Luis Rascão
2021-08-17 05:03:05 +01:00
committed by GitHub
parent 736c92a99b
commit 96669e29cf
4 changed files with 329 additions and 1 deletions

View File

@@ -105,6 +105,8 @@ func NewFromSettings(settings *Settings, flagSet map[string]bool) (*Engine, erro
return nil, fmt.Errorf("failed to create script manager. Err: %s", err)
}
b.ExchangeManager = SetupExchangeManager()
validateSettings(&b, settings, flagSet)
return &b, nil
@@ -363,7 +365,6 @@ func (bot *Engine) Start() error {
bot.Config.PurgeExchangeAPICredentials()
}
bot.ExchangeManager = SetupExchangeManager()
gctlog.Debugln(gctlog.Global, "Setting up exchanges..")
err = bot.SetupExchanges()
if err != nil {