diff --git a/exchanges/huobi/huobi_test.go b/exchanges/huobi/huobi_test.go index 1f0ee094bd2..b2437645b0d 100644 --- a/exchanges/huobi/huobi_test.go +++ b/exchanges/huobi/huobi_test.go @@ -1888,6 +1888,12 @@ func TestGenerateSubscriptions(t *testing.T) { pairs = common.SortStrings(pairs).Format(currency.PairFormat{Uppercase: false, Delimiter: ""}) s := s.Clone() //nolint:govet // Intentional lexical scope shadow s.Asset = a + if isWildcardChannel(s) { + s.Pairs = pairs + s.QualifiedChannel = channelName(s) + exp = append(exp, s) + continue + } for i, p := range pairs { s := s.Clone() //nolint:govet // Intentional lexical scope shadow s.QualifiedChannel = channelName(s, p) @@ -1934,7 +1940,7 @@ func TestSubscribe(t *testing.T) { err = h.Subscribe(subs) require.NoError(t, err, "Subscribe must not error") got := h.Websocket.GetSubscriptions() - require.Equal(t, 4, len(got), "Should get correct number of subscriptions") + require.Equal(t, 8, len(got), "Should get correct number of subscriptions") for _, s := range got { assert.Equal(t, subscription.SubscribedState, s.State()) } @@ -1951,7 +1957,7 @@ func TestAuthSubscribe(t *testing.T) { err = h.Subscribe(subs) require.NoError(t, err, "Subscribe must not error") got := h.Websocket.GetSubscriptions() - require.Equal(t, 7, len(got), "Should get correct number of subscriptions") + require.Equal(t, 11, len(got), "Should get correct number of subscriptions") for _, s := range got { assert.Equal(t, subscription.SubscribedState, s.State()) } @@ -1963,6 +1969,12 @@ func TestChannelName(t *testing.T) { assert.Panics(t, func() { channelName(&subscription.Subscription{Channel: wsOrderbookChannel}, btcusdPair) }) } +func TestIsWildcardChannel(t *testing.T) { + assert.False(t, isWildcardChannel(&subscription.Subscription{Channel: subscription.CandlesChannel})) + assert.True(t, isWildcardChannel(&subscription.Subscription{Channel: subscription.MyOrdersChannel})) + assert.Panics(t, func() { channelName(&subscription.Subscription{Channel: wsOrderbookChannel}) }) +} + func TestGetErrResp(t *testing.T) { err := getErrResp([]byte(`{"status":"error","err-code":"bad-request","err-msg":"invalid topic promiscuous.drop🐻s.nearby"}`)) assert.ErrorContains(t, err, "invalid topic promiscuous.drop🐻s.nearby (bad-request)", "V1 errors must return correctly") diff --git a/exchanges/huobi/huobi_websocket.go b/exchanges/huobi/huobi_websocket.go index 3f8db4cadea..51a2d025864 100644 --- a/exchanges/huobi/huobi_websocket.go +++ b/exchanges/huobi/huobi_websocket.go @@ -707,7 +707,6 @@ const subTplText = ` {{ range $asset, $pairs := $.AssetPairs }} {{- if isWildcardChannel $.S }} {{- channelName $.S -}} - {{ $.PairSeparator }} {{- else }} {{- range $p := $pairs }} {{- channelName $.S $p -}} diff --git a/testdata/configtest.json b/testdata/configtest.json index 150e10d20f5..14e603e1c80 100644 --- a/testdata/configtest.json +++ b/testdata/configtest.json @@ -1816,7 +1816,7 @@ }, "spot": { "assetEnabled": true, - "enabled": "BTC-USDT", + "enabled": "BTC-USDT,ETH-BTC", "available": "PROPY-ETH,IOTA-BTC,UGAS-ETH,PAI-USDT,BSV-HUSD,MTX-ETH,BCH-BTC,LTC-HT,SOC-USDT,WXT-BTC,SALT-BTC,RCN-ETH,PNT-ETH,TT-USDT,AIDOC-ETH,BIX-BTC,OCN-USDT,QTUM-ETH,KCASH-ETH,SNT-USDT,LUN-BTC,QASH-BTC,ITC-BTC,NAS-BTC,XMR-BTC,TNT-ETH,UC-ETH,FAIR-BTC,PC-ETH,YEE-BTC,PAY-ETH,XMX-BTC,CRE-USDT,BAT-ETH,BHT-USDT,CKB-HT,LAMB-HT,AE-USDT,QUN-ETH,LYM-BTC,BCH-HT,BHT-BTC,RUFF-ETH,CNN-BTC,FOR-USDT,GTC-ETH,TRX-ETH,ELA-USDT,ACT-ETH,SMT-ETH,BUT-ETH,BCH-USDT,ICX-BTC,MEET-BTC,NCC-BTC,APPC-BTC,GVE-ETH,TNB-BTC,STEEM-ETH,18C-ETH,LBA-BTC,EKO-BTC,REQ-BTC,SOC-BTC,BOX-ETH,ELF-BTC,ZRX-ETH,LET-USDT,HT-BTC,TUSD-HUSD,EGCC-BTC,WTC-BT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