mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-07 07:26:48 +00:00
Huobi: Add subscription configuration (#1604)
* Huobi: Update test config format * Huobi: Add subscription configuration * Huobi: Add subscription documentation * Huobi: Clarify OB sub Levels usage * Huobi: Enable websocket for tests * Subscriptions: Rename ErrPrivateChannelName Rename ErrPrivateChannelName to ErrUseConstChannelName
This commit is contained in:
@@ -1001,7 +1001,7 @@ func TestWsSubscribe(t *testing.T) {
|
||||
Channel: c,
|
||||
Pairs: currency.Pairs{spotTestPair},
|
||||
}})
|
||||
assert.ErrorIs(t, err, subscription.ErrPrivateChannelName, "Must error when trying to use a private channel name")
|
||||
assert.ErrorIs(t, err, subscription.ErrUseConstChannelName, "Must error when trying to use a private channel name")
|
||||
assert.ErrorContains(t, err, c+" => subscription.CandlesChannel", "Must error when trying to use a private channel name")
|
||||
}
|
||||
}
|
||||
@@ -1703,6 +1703,6 @@ func TestEnforceStandardChannelNames(t *testing.T) {
|
||||
}
|
||||
for _, n := range []string{krakenWsOrderbook, krakenWsOHLC, krakenWsTrade, krakenWsOwnTrades, krakenWsOpenOrders, krakenWsOrderbook + "-5"} {
|
||||
err := enforceStandardChannelNames(&subscription.Subscription{Channel: n})
|
||||
assert.ErrorIsf(t, err, subscription.ErrPrivateChannelName, "Private channel names should not be allowed for %s", n)
|
||||
assert.ErrorIsf(t, err, subscription.ErrUseConstChannelName, "Private channel names should not be allowed for %s", n)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1237,7 +1237,7 @@ func channelName(s *subscription.Subscription) string {
|
||||
func enforceStandardChannelNames(s *subscription.Subscription) error {
|
||||
name := strings.Split(s.Channel, "-") // Protect against attempted usage of book-N as a channel name
|
||||
if n, ok := reverseChannelNames[name[0]]; ok && n != s.Channel {
|
||||
return fmt.Errorf("%w: %s => subscription.%s%sChannel", subscription.ErrPrivateChannelName, s.Channel, bytes.ToUpper([]byte{n[0]}), n[1:])
|
||||
return fmt.Errorf("%w: %s => subscription.%s%sChannel", subscription.ErrUseConstChannelName, s.Channel, bytes.ToUpper([]byte{n[0]}), n[1:])
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user