mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-20 15:10:10 +00:00
Engine/ExchangeManager: Return error for method GetExchangeByName (#760)
* engine: Add error returns * engine: after merge fixes * engine: remove interface * linter: fix shadow declarations * engine: fix tests * niterinos: fixed * GLORIOUS NITS!
This commit is contained in:
@@ -2,7 +2,6 @@ package exchange
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"sort"
|
||||
"strconv"
|
||||
"time"
|
||||
@@ -30,12 +29,7 @@ func (e Exchange) Exchanges(enabledOnly bool) []string {
|
||||
|
||||
// GetExchange returns IBotExchange for exchange or error if exchange is not found
|
||||
func (e Exchange) GetExchange(exch string) (exchange.IBotExchange, error) {
|
||||
ex := engine.Bot.GetExchangeByName(exch)
|
||||
if ex == nil {
|
||||
return nil, fmt.Errorf("%v exchange not found", exch)
|
||||
}
|
||||
|
||||
return ex, nil
|
||||
return engine.Bot.GetExchangeByName(exch)
|
||||
}
|
||||
|
||||
// IsEnabled returns if requested exchange is enabled or disabled
|
||||
|
||||
@@ -220,8 +220,12 @@ func cleanup() {
|
||||
}
|
||||
|
||||
func configureExchangeKeys() bool {
|
||||
ex := engine.Bot.GetExchangeByName(exchName).GetBase()
|
||||
ex.SetAPIKeys(exchAPIKEY, exchAPISECRET, exchClientID)
|
||||
ex.SkipAuthCheck = true
|
||||
return ex.ValidateAPICredentials()
|
||||
ex, err := engine.Bot.GetExchangeByName(exchName)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
b := ex.GetBase()
|
||||
b.SetAPIKeys(exchAPIKEY, exchAPISECRET, exchClientID)
|
||||
b.SkipAuthCheck = true
|
||||
return b.ValidateAPICredentials()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user