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:
Ryan O'Hara-Reid
2022-09-16 08:59:27 +10:00
committed by GitHub
parent ecc3b10402
commit f843b7d277
55 changed files with 1832 additions and 685 deletions

View File

@@ -51,6 +51,11 @@ func TestMain(m *testing.M) {
log.Fatal("Bithumb setup error", err)
}
err = b.UpdateTradablePairs(context.Background(), false)
if err != nil {
log.Fatal("Bithumb Setup() init error")
}
os.Exit(m.Run())
}

View File

@@ -175,11 +175,16 @@ func (b *Bithumb) GenerateSubscriptions() ([]stream.ChannelSubscription, error)
return nil, err
}
pFmt, err := b.GetPairFormat(asset.Spot, true)
if err != nil {
return nil, err
}
for x := range pairs {
for y := range channels {
subscriptions = append(subscriptions, stream.ChannelSubscription{
Channel: channels[y],
Currency: pairs[x].Format("_", true),
Currency: pairs[x].Format(pFmt),
Asset: asset.Spot,
})
}

View File

@@ -40,6 +40,7 @@ func TestWsHandleData(t *testing.T) {
Enabled: pairs,
ConfigFormat: &currency.PairFormat{
Uppercase: true,
Delimiter: currency.DashDelimiter,
},
},
},

View File

@@ -67,7 +67,7 @@ func (b *Bithumb) SetDefaults() {
b.API.CredentialsValidator.RequiresSecret = true
requestFmt := &currency.PairFormat{Uppercase: true, Delimiter: currency.UnderscoreDelimiter}
configFmt := &currency.PairFormat{Uppercase: true, Index: "KRW"}
configFmt := &currency.PairFormat{Uppercase: true, Delimiter: currency.DashDelimiter}
err := b.SetGlobalPairsManager(requestFmt, configFmt, asset.Spot)
if err != nil {
log.Errorln(log.ExchangeSys, err)
@@ -237,7 +237,7 @@ func (b *Bithumb) FetchTradablePairs(ctx context.Context, asset asset.Item) ([]s
}
for x := range currencies {
currencies[x] += "KRW"
currencies[x] += currency.DashDelimiter + "KRW"
}
return currencies, nil