Skip to content

Commit

Permalink
Kucoin: Fix transient test failure on XMR (#1485)
Browse files Browse the repository at this point in the history
Kucoin delisted XMR temporarily for margin trading.
That seems quite likely long term too, due to XMR's privacy features.

Replace XMR with TRX to hopefully avoid in future
  • Loading branch information
gbjk authored Feb 20, 2024
1 parent 422ebbe commit 40193bb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions exchanges/kucoin/kucoin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2021,7 +2021,7 @@ func verifySubs(tb testing.TB, subs []subscription.Subscription, a asset.Item, p
// Pairs for Subscription tests:
// Only in Spot: BTC-USDT, ETH-USDT
// In Both: ETH-BTC, LTC-USDT
// Only in Margin: XMR-BTC, SOL-USDC
// Only in Margin: TRX-BTC, SOL-USDC

func TestGenerateDefaultSubscriptions(t *testing.T) {
t.Parallel()
Expand All @@ -2032,7 +2032,7 @@ func TestGenerateDefaultSubscriptions(t *testing.T) {
assert.Len(t, subs, 12, "Should generate the correct number of subs when not logged in")
for _, p := range []string{"ticker", "match", "level2"} {
verifySubs(t, subs, asset.Spot, "/market/"+p+":", "BTC-USDT", "ETH-USDT", "LTC-USDT", "ETH-BTC")
verifySubs(t, subs, asset.Margin, "/market/"+p+":", "SOL-USDC", "XMR-BTC")
verifySubs(t, subs, asset.Margin, "/market/"+p+":", "SOL-USDC", "TRX-BTC")
}
for _, c := range []string{"ETHUSDCM", "XBTUSDCM", "SOLUSDTM"} {
verifySubs(t, subs, asset.Futures, "/contractMarket/tickerV2:", c)
Expand All @@ -2055,18 +2055,18 @@ func TestGenerateAuthSubscriptions(t *testing.T) {
assert.Len(t, subs, 25, "Should generate the correct number of subs when logged in")
for _, p := range []string{"ticker", "match", "level2"} {
verifySubs(t, subs, asset.Spot, "/market/"+p+":", "BTC-USDT", "ETH-USDT", "LTC-USDT", "ETH-BTC")
verifySubs(t, subs, asset.Margin, "/market/"+p+":", "SOL-USDC", "XMR-BTC")
verifySubs(t, subs, asset.Margin, "/market/"+p+":", "SOL-USDC", "TRX-BTC")
}
for _, c := range []string{"ETHUSDCM", "XBTUSDCM", "SOLUSDTM"} {
verifySubs(t, subs, asset.Futures, "/contractMarket/tickerV2:", c)
verifySubs(t, subs, asset.Futures, "/contractMarket/level2Depth50:", c)
}
for _, c := range []string{"SOL", "BTC", "XMR", "LTC", "USDC", "USDT", "ETH"} {
for _, c := range []string{"SOL", "BTC", "TRX", "LTC", "USDC", "USDT", "ETH"} {
verifySubs(t, subs, asset.Margin, "/margin/loan:", c)
}
verifySubs(t, subs, asset.Spot, "/account/balance")
verifySubs(t, subs, asset.Margin, "/margin/position")
verifySubs(t, subs, asset.Margin, "/margin/fundingBook:", "SOL", "BTC", "XMR", "LTC", "USDT", "USDC", "ETH")
verifySubs(t, subs, asset.Margin, "/margin/fundingBook:", "SOL", "BTC", "TRX", "LTC", "USDT", "USDC", "ETH")
verifySubs(t, subs, asset.Futures, "/contractAccount/wallet")
verifySubs(t, subs, asset.Futures, "/contractMarket/advancedOrders")
verifySubs(t, subs, asset.Futures, "/contractMarket/tradeOrders")
Expand All @@ -2092,7 +2092,7 @@ func TestGenerateCandleSubscription(t *testing.T) {
for _, c := range []string{"BTC-USDT", "ETH-USDT", "LTC-USDT", "ETH-BTC"} {
verifySubs(t, subs, asset.Spot, "/market/candles:", c+"_4hour")
}
for _, c := range []string{"SOL-USDC", "XMR-BTC"} {
for _, c := range []string{"SOL-USDC", "TRX-BTC"} {
verifySubs(t, subs, asset.Margin, "/market/candles:", c+"_4hour")
}
}
Expand All @@ -2117,7 +2117,7 @@ func TestGenerateMarketSubscription(t *testing.T) {
for _, c := range []string{"BTC", "ETH", "LTC", "USDT"} {
verifySubs(t, subs, asset.Spot, "/market/snapshot:", c)
}
for _, c := range []string{"SOL", "USDC", "XMR"} {
for _, c := range []string{"SOL", "USDC", "TRX"} {
verifySubs(t, subs, asset.Margin, "/market/snapshot:", c)
}
}
Expand Down Expand Up @@ -2503,7 +2503,7 @@ func TestProcessMarketSnapshot(t *testing.T) {
assert.Equal(t, 0.004445, v.High, "high")
assert.Equal(t, 0.004415, v.Last, "lastTradedPrice")
assert.Equal(t, 0.004191, v.Low, "low")
assert.Equal(t, currency.NewPairWithDelimiter("XMR", "BTC", "-"), v.Pair, "symbol")
assert.Equal(t, currency.NewPairWithDelimiter("TRX", "BTC", "-"), v.Pair, "symbol")
assert.Equal(t, 13097.3357, v.Volume, "volume")
assert.Equal(t, 57.44552981, v.QuoteVolume, "volValue")
case 2, 3:
Expand Down
2 changes: 1 addition & 1 deletion exchanges/kucoin/testdata/wsMarketSnapshot.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{"type":"message","topic":"/market/snapshot:BTC","subject":"trade.snapshot","data":{"sequence":"459320318","data":{"averagePrice":0.00442293,"baseCurrency":"XMR","board":1,"buy":0.004411,"changePrice":0.00000000000000000000,"changeRate":0.0000,"close":0.004415,"datetime":1700555342007,"high":0.00444500000000000000,"lastTradedPrice":0.004415,"low":0.00419100000000000000,"makerCoefficient":1.000000,"makerFeeRate":0.001,"marginTrade":true,"mark":0,"market":"BTC","marketChange1h":{"changePrice":-0.00000200000000000000,"changeRate":-0.0004,"high":0.00443600000000000000,"low":0.00441300000000000000,"open":0.00441700000000000000,"vol":505.11910000000000000000,"volValue":2.23457327520000000000},"marketChange24h":{"changePrice":0.00000000000000000000,"changeRate":0.0000,"high":0.00444500000000000000,"low":0.00419100000000000000,"open":0.00441500000000000000,"vol":13097.33570000000000000000,"volValue":57.44552981000000000000},"marketChange4h":{"changePrice":0.00001100000000000000,"changeRate":0.0024,"high":0.00443600000000000000,"low":0.00439300000000000000,"open":0.00440400000000000000,"vol":2124.84330000000000000000,"volValue":9.37472351370000000000},"markets":["BTC"],"open":0.00441500000000000000,"quoteCurrency":"BTC","sell":0.004415,"sort":100,"symbol":"XMR-BTC","symbolCode":"XMR-BTC","takerCoefficient":1.000000,"takerFeeRate":0.001,"trading":true,"vol":13097.33570000000000000000,"volValue":57.44552981000000000000}}}
{"type":"message","topic":"/market/snapshot:BTC","subject":"trade.snapshot","data":{"sequence":"459320318","data":{"averagePrice":0.00442293,"baseCurrency":"TRX","board":1,"buy":0.004411,"changePrice":0.00000000000000000000,"changeRate":0.0000,"close":0.004415,"datetime":1700555342007,"high":0.00444500000000000000,"lastTradedPrice":0.004415,"low":0.00419100000000000000,"makerCoefficient":1.000000,"makerFeeRate":0.001,"marginTrade":true,"mark":0,"market":"BTC","marketChange1h":{"changePrice":-0.00000200000000000000,"changeRate":-0.0004,"high":0.00443600000000000000,"low":0.00441300000000000000,"open":0.00441700000000000000,"vol":505.11910000000000000000,"volValue":2.23457327520000000000},"marketChange24h":{"changePrice":0.00000000000000000000,"changeRate":0.0000,"high":0.00444500000000000000,"low":0.00419100000000000000,"open":0.00441500000000000000,"vol":13097.33570000000000000000,"volValue":57.44552981000000000000},"marketChange4h":{"changePrice":0.00001100000000000000,"changeRate":0.0024,"high":0.00443600000000000000,"low":0.00439300000000000000,"open":0.00440400000000000000,"vol":2124.84330000000000000000,"volValue":9.37472351370000000000},"markets":["BTC"],"open":0.00441500000000000000,"quoteCurrency":"BTC","sell":0.004415,"sort":100,"symbol":"TRX-BTC","symbolCode":"TRX-BTC","takerCoefficient":1.000000,"takerFeeRate":0.001,"trading":true,"vol":13097.33570000000000000000,"volValue":57.44552981000000000000}}}
{"type":"message","topic":"/market/snapshot:BTC","subject":"trade.snapshot","data":{"sequence":"692562428","data":{"averagePrice":0.05414932,"baseCurrency":"ETH","board":1,"buy":0.053778,"changePrice":-0.00045800000000000000,"changeRate":-0.0084,"close":0.053778,"datetime":1700555340197,"high":0.05484600000000000000,"lastTradedPrice":0.053778,"low":0.05364000000000000000,"makerCoefficient":1.000000,"makerFeeRate":0.001,"marginTrade":true,"mark":0,"market":"BTC","marketChange1h":{"changePrice":-0.00008000000000000000,"changeRate":-0.0014,"high":0.05387400000000000000,"low":0.05371000000000000000,"open":0.05385800000000000000,"vol":63.72190510000000000000,"volValue":3.42879155215990000000},"marketChange24h":{"changePrice":-0.00045800000000000000,"changeRate":-0.0084,"high":0.05484600000000000000,"low":0.05364000000000000000,"open":0.05423600000000000000,"vol":2958.31391160000000000000,"volValue":160.78476727842130000000},"marketChange4h":{"changePrice":-0.00002700000000000000,"changeRate":-0.0005,"high":0.05399000000000000000,"low":0.05371000000000000000,"open":0.05380500000000000000,"vol":166.22099950000000000000,"volValue":8.95534024043750000000},"markets":["BTC","Shanghai-Upgrade"],"open":0.05423600000000000000,"quoteCurrency":"BTC","sell":0.053779,"sort":100,"symbol":"ETH-BTC","symbolCode":"ETH-BTC","takerCoefficient":1.000000,"takerFeeRate":0.001,"trading":true,"vol":2958.31391160000000000000,"volValue":160.78476727842130000000}}}
{"type":"message","topic":"/market/snapshot:BTC","subject":"trade.snapshot","data":{"sequence":"9860735911","data":{"averagePrice":37110.27939304,"baseCurrency":"BTC","board":1,"buy":37366.7,"changePrice":171.50000000000000000000,"changeRate":0.0046,"close":37366.8,"datetime":1700555342151,"high":37750.00000000000000000000,"lastTradedPrice":37366.8,"low":36700.00000000000000000000,"makerCoefficient":1.000000,"makerFeeRate":0.001,"marginTrade":true,"mark":0,"market":"USDS","marketChange1h":{"changePrice":105.60000000000000000000,"changeRate":0.0028,"high":37366.80000000000000000000,"low":37232.30000000000000000000,"open":37261.20000000000000000000,"vol":52.88854739000000000000,"volValue":1972678.83173137400000000000},"marketChange24h":{"changePrice":171.50000000000000000000,"changeRate":0.0046,"high":37750.00000000000000000000,"low":36700.00000000000000000000,"open":37195.30000000000000000000,"vol":2900.37846402000000000000,"volValue":108210331.34015163900000000000},"marketChange4h":{"changePrice":-94.70000000000000000000,"changeRate":-0.0025,"high":37476.40000000000000000000,"low":37232.30000000000000000000,"open":37461.50000000000000000000,"vol":263.14059486000000000000,"volValue":9829529.74388805200000000000},"markets":["USDS"],"open":37195.30000000000000000000,"quoteCurrency":"USDT","sell":37366.8,"sort":100,"symbol":"BTC-USDT","symbolCode":"BTC-USDT","takerCoefficient":1.000000,"takerFeeRate":0.001,"trading":true,"vol":2900.37846402000000000000,"volValue":108210331.34015163900000000000}}}
Loading

0 comments on commit 40193bb

Please sign in to comment.