Skip to content

Commit

Permalink
fixup! Huobi: Add V2 websocket support
Browse files Browse the repository at this point in the history
  • Loading branch information
gbjk committed Nov 6, 2024
1 parent c8231cf commit c2e73d5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions exchanges/huobi/huobi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1872,6 +1872,12 @@ func TestGenerateSubscriptions(t *testing.T) {
require.NoError(t, err, "generateSubscriptions must not error")
exp := subscription.List{}
for _, s := range h.Features.Subscriptions {
if s.Asset == asset.Empty {
s := s.Clone() //nolint:govet // Intentional lexical scope shadow
s.QualifiedChannel = channelName(s, nil)
exp = append(exp, s)
continue
}
for _, a := range h.GetAssetTypes(true) {
if s.Asset != asset.All && s.Asset != a {
continue
Expand Down
6 changes: 5 additions & 1 deletion exchanges/huobi/huobi_websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,11 @@ func getErrResp(msg []byte) error {
func channelName(s *subscription.Subscription, p *currency.Pair) string {
name := s.Channel
if n, ok := subscriptionNames[name]; ok {
return fmt.Sprintf(n, p)
if p != nil {
return fmt.Sprintf(n, p)
} else {
return n
}
}
panic(subscription.ErrPrivateChannelName)
}
Expand Down

0 comments on commit c2e73d5

Please sign in to comment.