mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 23:16:45 +00:00
exchange: upgrade UpdatePair method (#991)
* exchange: upgrade update pair * exchanges: Add enabled string matching and format handling if discrepency is found. * linter: fixes * bithumb: fix tests * BTSE: api change fix ordering * huobi: fix tests * gloriousnits: stage 1 * gloriousnits: stage 2 * currency: more nits * bitmex: add spot and process pairs before currency package call. * bitmex: finished correct orderbook matching and other implementations * linter: fix issue * currency: Fix linter * currency: segregate and protect pair store, update tests * currency/manager: clean code, rm log output * currency: Add store method and make sure formatting stays nil if not stored. * gct: check errors * engine/websocketroutineman: fix tests * bybit: fix duplication bug * huobi: fix test * btse: fix tests? * ob/buffer: fix tests * Update currency/manager.go Co-authored-by: Scott <gloriousCode@users.noreply.github.com> * glorious: nits * glorious: nits strikes again. * exchange: add bypassConfigFormatUpgrades to stop formatting * GLORIOUS LINTER * Update exchanges/bithumb/bithumb_wrapper.go Co-authored-by: Scott <gloriousCode@users.noreply.github.com> * glorious: nits * exchange: fix pair upgrade issue when duplications are in both avail and enabled pairs * linter: fix shadow dec * config: fix test * Update currency/pair_test.go Co-authored-by: Scott <gloriousCode@users.noreply.github.com> Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io> Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
This commit is contained in:
@@ -299,31 +299,31 @@ func testWrappers(e exchange.IBotExchange, base *exchange.Base, config *Config)
|
||||
for i := range assetTypes {
|
||||
var msg string
|
||||
log.Printf("%v %v", base.GetName(), assetTypes[i])
|
||||
if _, ok := base.Config.CurrencyPairs.Pairs[assetTypes[i]]; !ok {
|
||||
storedPairs, ok := base.Config.CurrencyPairs.Pairs[assetTypes[i]]
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
|
||||
var p currency.Pair
|
||||
var err error
|
||||
switch {
|
||||
case currencyPairOverride != "":
|
||||
var err error
|
||||
p, err = currency.NewPairFromString(currencyPairOverride)
|
||||
if err != nil {
|
||||
log.Printf("%v Encountered error: '%v'", base.GetName(), err)
|
||||
continue
|
||||
case len(storedPairs.Enabled) == 0:
|
||||
if len(storedPairs.Available) == 0 {
|
||||
err = fmt.Errorf("%v has no enabled or available currencies. Skipping", base.GetName())
|
||||
break
|
||||
}
|
||||
case len(base.Config.CurrencyPairs.Pairs[assetTypes[i]].Enabled) == 0:
|
||||
if len(base.Config.CurrencyPairs.Pairs[assetTypes[i]].Available) == 0 {
|
||||
log.Printf("%v has no enabled or available currencies. Skipping",
|
||||
base.GetName())
|
||||
continue
|
||||
}
|
||||
p = base.Config.CurrencyPairs.Pairs[assetTypes[i]].Available.GetRandomPair()
|
||||
p, err = storedPairs.Available.GetRandomPair()
|
||||
default:
|
||||
p = base.Config.CurrencyPairs.Pairs[assetTypes[i]].Enabled.GetRandomPair()
|
||||
p, err = storedPairs.Enabled.GetRandomPair()
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
log.Printf("%v Encountered error: '%v'", base.GetName(), err)
|
||||
continue
|
||||
}
|
||||
|
||||
var err error
|
||||
p, err = disruptFormatting(p)
|
||||
if err != nil {
|
||||
log.Println("failed to disrupt currency pair formatting:", err)
|
||||
|
||||
Reference in New Issue
Block a user