Skip to content

Commit

Permalink
fixup! Kucoin: Subscription configuration
Browse files Browse the repository at this point in the history
Rename base argument to avoid package conflict
  • Loading branch information
gbjk committed Nov 11, 2023
1 parent d1f73bf commit a1f316a
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions exchanges/kucoin/kucoin_websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -1111,22 +1111,22 @@ func channelName(name string) string {
// spotOrMarginPairSubs accepts a map of pairs and a template subscription and returns a list of subscriptions for Spot and Margin pairs
// If there's a Spot subscription, it won't be added again as a Margin subscription
// If joined param is true then one subscription per asset type with the currencies comma delimited
func spotOrMarginPairSubs(assetPairs map[asset.Item]currency.Pairs, base *subscription.Subscription, join bool, fmtArgs ...any) []subscription.Subscription {
func spotOrMarginPairSubs(assetPairs map[asset.Item]currency.Pairs, b *subscription.Subscription, join bool, fmtArgs ...any) []subscription.Subscription {
subs := []subscription.Subscription{}
add := func(a asset.Item, pairs currency.Pairs) {
if len(pairs) == 0 {
return
}
s := *base
s := *b
s.Asset = a
if join {
f := append([]any{pairs.Join()}, fmtArgs...)
s.Channel = fmt.Sprintf(base.Channel, f...)
s.Channel = fmt.Sprintf(b.Channel, f...)
subs = append(subs, s)
} else {
for _, p := range pairs {
f := append([]any{p.String()}, fmtArgs...)
s.Channel = fmt.Sprintf(base.Channel, f...)
s.Channel = fmt.Sprintf(b.Channel, f...)
subs = append(subs, s)
}
}
Expand All @@ -1147,16 +1147,16 @@ func spotOrMarginPairSubs(assetPairs map[asset.Item]currency.Pairs, base *subscr

// spotOrMarginCurrencySubs accepts a map of pairs and a template subscription and returns a list of subscriptions for every currency in Spot and Margin pairs
// If there's a Spot subscription, it won't be added again as a Margin subscription
func spotOrMarginCurrencySubs(assetPairs map[asset.Item]currency.Pairs, base *subscription.Subscription) []subscription.Subscription {
func spotOrMarginCurrencySubs(assetPairs map[asset.Item]currency.Pairs, b *subscription.Subscription) []subscription.Subscription {
subs := []subscription.Subscription{}
add := func(a asset.Item, currs currency.Currencies) {
if len(currs) == 0 {
return
}
s := *base
s := *b
s.Asset = a
for _, c := range currs {
s.Channel = fmt.Sprintf(base.Channel, c)
s.Channel = fmt.Sprintf(b.Channel, c)
subs = append(subs, s)
}
}
Expand Down

0 comments on commit a1f316a

Please sign in to comment.