Skip to content

Commit

Permalink
Bitfinex: Fix tests for MarginFunding subs
Browse files Browse the repository at this point in the history
  • Loading branch information
gbjk committed Nov 27, 2024
1 parent 08c7f36 commit d650ca9
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions exchanges/bitfinex/bitfinex_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1155,15 +1155,23 @@ func TestGenerateSubscriptions(t *testing.T) {
s := baseSub.Clone()
s.Asset = a
s.Pairs = currency.Pairs{p}
prefix := "t"
if a == asset.MarginFunding {
prefix = "f"
}
switch s.Channel {
case subscription.TickerChannel:
s.QualifiedChannel = `{"channel":"ticker","symbol":"t` + p.String() + `"}`
s.QualifiedChannel = `{"channel":"ticker","symbol":"` + prefix + p.String() + `"}`
case subscription.CandlesChannel:
s.QualifiedChannel = `{"channel":"candles","key":"trade:1m:t` + p.String() + `"}`
if a == asset.MarginFunding {
s.QualifiedChannel = `{"channel":"candles","key":"trade:1m:` + prefix + p.String() + `:p30"}`
} else {
s.QualifiedChannel = `{"channel":"candles","key":"trade:1m:` + prefix + p.String() + `"}`
}
case subscription.OrderbookChannel:
s.QualifiedChannel = `{"channel":"book","len":100,"prec":"R0","symbol":"t` + p.String() + `"}`
s.QualifiedChannel = `{"channel":"book","len":100,"prec":"R0","symbol":"` + prefix + p.String() + `"}`
case subscription.AllTradesChannel:
s.QualifiedChannel = `{"channel":"trades","symbol":"t` + p.String() + `"}`
s.QualifiedChannel = `{"channel":"trades","symbol":"` + prefix + p.String() + `"}`
}
exp = append(exp, s)
}
Expand Down

0 comments on commit d650ca9

Please sign in to comment.