diff --git a/crypto-pair/tests/kraken.rs b/crypto-pair/tests/kraken.rs index e3e184f9..2bf8d73a 100644 --- a/crypto-pair/tests/kraken.rs +++ b/crypto-pair/tests/kraken.rs @@ -75,9 +75,8 @@ struct FuturesResponse { fn fetch_futures_markets_raw() -> Vec { let txt = http_get("https://futures.kraken.com/derivatives/api/v3/instruments").unwrap(); let obj = serde_json::from_str::>(&txt).unwrap(); - - obj - .instruments + + obj.instruments .into_iter() .filter(|x| x.tradeable) .filter(|m| m.symbol.starts_with("pi_") || m.symbol.starts_with("fi_")) diff --git a/crypto-ws-client/src/clients/binance.rs b/crypto-ws-client/src/clients/binance.rs index 78e5adf2..ce475238 100644 --- a/crypto-ws-client/src/clients/binance.rs +++ b/crypto-ws-client/src/clients/binance.rs @@ -311,8 +311,10 @@ mod tests { let translator = super::BinanceCommandTranslator { market_type: 'S' }; let commands = translator.translate_to_commands( true, - &[("aggTrade".to_string(), "BTCUSDT".to_string()), - ("ticker".to_string(), "BTCUSDT".to_string())], + &[ + ("aggTrade".to_string(), "BTCUSDT".to_string()), + ("ticker".to_string(), "BTCUSDT".to_string()), + ], ); assert_eq!(1, commands.len()); diff --git a/crypto-ws-client/src/clients/binance_option.rs b/crypto-ws-client/src/clients/binance_option.rs index c3ba1d0f..118c86d5 100644 --- a/crypto-ws-client/src/clients/binance_option.rs +++ b/crypto-ws-client/src/clients/binance_option.rs @@ -174,8 +174,10 @@ mod tests { let translator = super::BinanceOptionCommandTranslator {}; let commands = translator.translate_to_commands( true, - &[("trade".to_string(), "BTC-220429-50000-C".to_string()), - ("ticker".to_string(), "BTC-220429-50000-C".to_string())], + &[ + ("trade".to_string(), "BTC-220429-50000-C".to_string()), + ("ticker".to_string(), "BTC-220429-50000-C".to_string()), + ], ); assert_eq!(1, commands.len()); diff --git a/crypto-ws-client/src/clients/bitfinex.rs b/crypto-ws-client/src/clients/bitfinex.rs index ae42ad8e..543b5c36 100644 --- a/crypto-ws-client/src/clients/bitfinex.rs +++ b/crypto-ws-client/src/clients/bitfinex.rs @@ -315,10 +315,8 @@ mod tests { #[test] fn test_swap_command() { let translator = super::BitfinexCommandTranslator {}; - let commands = translator.translate_to_commands( - true, - &[("trades".to_string(), "tBTCF0:USTF0".to_string())], - ); + let commands = translator + .translate_to_commands(true, &[("trades".to_string(), "tBTCF0:USTF0".to_string())]); assert_eq!(1, commands.len()); assert_eq!( diff --git a/crypto-ws-client/src/clients/bitget/utils.rs b/crypto-ws-client/src/clients/bitget/utils.rs index f1a7e436..df56efa3 100644 --- a/crypto-ws-client/src/clients/bitget/utils.rs +++ b/crypto-ws-client/src/clients/bitget/utils.rs @@ -157,8 +157,8 @@ mod tests { #[test] fn test_one_topic() { let translator = super::BitgetCommandTranslator::<'S'> {}; - let commands = translator - .translate_to_commands(true, &[("trade".to_string(), "BTCUSDT".to_string())]); + let commands = + translator.translate_to_commands(true, &[("trade".to_string(), "BTCUSDT".to_string())]); assert_eq!(1, commands.len()); assert_eq!( @@ -172,8 +172,10 @@ mod tests { let translator = super::BitgetCommandTranslator::<'S'> {}; let commands = translator.translate_to_commands( true, - &[("trade".to_string(), "BTCUSDT".to_string()), - ("books".to_string(), "ETHUSDT".to_string())], + &[ + ("trade".to_string(), "BTCUSDT".to_string()), + ("books".to_string(), "ETHUSDT".to_string()), + ], ); assert_eq!(1, commands.len()); diff --git a/crypto-ws-client/src/clients/bithumb.rs b/crypto-ws-client/src/clients/bithumb.rs index 373164e2..8aef759d 100644 --- a/crypto-ws-client/src/clients/bithumb.rs +++ b/crypto-ws-client/src/clients/bithumb.rs @@ -131,8 +131,10 @@ mod tests { let translator = super::BithumbCommandTranslator {}; let commands = translator.translate_to_commands( true, - &[("TRADE".to_string(), "BTC-USDT".to_string()), - ("TRADE".to_string(), "ETH-USDT".to_string())], + &[ + ("TRADE".to_string(), "BTC-USDT".to_string()), + ("TRADE".to_string(), "ETH-USDT".to_string()), + ], ); assert_eq!(1, commands.len()); @@ -147,8 +149,10 @@ mod tests { let translator = super::BithumbCommandTranslator {}; let commands = translator.translate_to_commands( true, - &[("TRADE".to_string(), "BTC-USDT".to_string()), - ("ORDERBOOK".to_string(), "BTC-USDT".to_string())], + &[ + ("TRADE".to_string(), "BTC-USDT".to_string()), + ("ORDERBOOK".to_string(), "BTC-USDT".to_string()), + ], ); assert_eq!(1, commands.len()); diff --git a/crypto-ws-client/src/clients/bitmex.rs b/crypto-ws-client/src/clients/bitmex.rs index a3de3b3e..a7460743 100644 --- a/crypto-ws-client/src/clients/bitmex.rs +++ b/crypto-ws-client/src/clients/bitmex.rs @@ -177,8 +177,8 @@ mod tests { #[test] fn test_one_topic() { let translator = super::BitmexCommandTranslator {}; - let commands = translator - .translate_to_commands(true, &[("trade".to_string(), "XBTUSD".to_string())]); + let commands = + translator.translate_to_commands(true, &[("trade".to_string(), "XBTUSD".to_string())]); assert_eq!(1, commands.len()); assert_eq!(r#"{"op":"subscribe","args":["trade:XBTUSD"]}"#, commands[0]); @@ -189,10 +189,12 @@ mod tests { let translator = super::BitmexCommandTranslator {}; let commands = translator.translate_to_commands( true, - &[("trade".to_string(), "XBTUSD".to_string()), + &[ + ("trade".to_string(), "XBTUSD".to_string()), ("quote".to_string(), "XBTUSD".to_string()), ("orderBookL2_25".to_string(), "XBTUSD".to_string()), - ("tradeBin1m".to_string(), "XBTUSD".to_string())], + ("tradeBin1m".to_string(), "XBTUSD".to_string()), + ], ); assert_eq!(1, commands.len()); diff --git a/crypto-ws-client/src/clients/bitstamp.rs b/crypto-ws-client/src/clients/bitstamp.rs index 40b4f405..85973fe3 100644 --- a/crypto-ws-client/src/clients/bitstamp.rs +++ b/crypto-ws-client/src/clients/bitstamp.rs @@ -131,10 +131,8 @@ mod tests { #[test] fn test_one_topic() { let translator = super::BitstampCommandTranslator {}; - let commands = translator.translate_to_commands( - true, - &[("live_trades".to_string(), "btcusd".to_string())], - ); + let commands = translator + .translate_to_commands(true, &[("live_trades".to_string(), "btcusd".to_string())]); assert_eq!(1, commands.len()); assert_eq!( @@ -148,8 +146,10 @@ mod tests { let translator = super::BitstampCommandTranslator {}; let commands = translator.translate_to_commands( true, - &[("live_trades".to_string(), "btcusd".to_string()), - ("diff_order_book".to_string(), "btcusd".to_string())], + &[ + ("live_trades".to_string(), "btcusd".to_string()), + ("diff_order_book".to_string(), "btcusd".to_string()), + ], ); assert_eq!(2, commands.len()); diff --git a/crypto-ws-client/src/clients/bybit/utils.rs b/crypto-ws-client/src/clients/bybit/utils.rs index 732fbeb6..a5711a45 100644 --- a/crypto-ws-client/src/clients/bybit/utils.rs +++ b/crypto-ws-client/src/clients/bybit/utils.rs @@ -72,9 +72,11 @@ mod tests { #[test] fn test_multiple_channels() { let command = super::topics_to_command( - &[("trade".to_string(), "BTCUSD".to_string()), + &[ + ("trade".to_string(), "BTCUSD".to_string()), ("orderBookL2_25".to_string(), "BTCUSD".to_string()), - ("instrument_info.100ms".to_string(), "BTCUSD".to_string())], + ("instrument_info.100ms".to_string(), "BTCUSD".to_string()), + ], true, ); diff --git a/crypto-ws-client/src/clients/coinbase_pro.rs b/crypto-ws-client/src/clients/coinbase_pro.rs index 7b1a7f88..a551161c 100644 --- a/crypto-ws-client/src/clients/coinbase_pro.rs +++ b/crypto-ws-client/src/clients/coinbase_pro.rs @@ -162,8 +162,10 @@ mod tests { let translator = super::CoinbaseProCommandTranslator {}; let commands = translator.translate_to_commands( true, - &[("matches".to_string(), "BTC-USD".to_string()), - ("matches".to_string(), "ETH-USD".to_string())], + &[ + ("matches".to_string(), "BTC-USD".to_string()), + ("matches".to_string(), "ETH-USD".to_string()), + ], ); assert_eq!(1, commands.len()); @@ -178,8 +180,10 @@ mod tests { let translator = super::CoinbaseProCommandTranslator {}; let commands = translator.translate_to_commands( true, - &[("matches".to_string(), "BTC-USD".to_string()), - ("level2".to_string(), "BTC-USD".to_string())], + &[ + ("matches".to_string(), "BTC-USD".to_string()), + ("level2".to_string(), "BTC-USD".to_string()), + ], ); assert_eq!(1, commands.len()); diff --git a/crypto-ws-client/src/clients/deribit.rs b/crypto-ws-client/src/clients/deribit.rs index cbf814f1..f27e3ec9 100644 --- a/crypto-ws-client/src/clients/deribit.rs +++ b/crypto-ws-client/src/clients/deribit.rs @@ -206,8 +206,10 @@ mod tests { let translator = super::DeribitCommandTranslator {}; let commands = translator.translate_to_commands( true, - &[("trades.SYMBOL.100ms".to_string(), "BTC-26MAR21".to_string()), - ("ticker.SYMBOL.100ms".to_string(), "BTC-26MAR21".to_string())], + &[ + ("trades.SYMBOL.100ms".to_string(), "BTC-26MAR21".to_string()), + ("ticker.SYMBOL.100ms".to_string(), "BTC-26MAR21".to_string()), + ], ); assert_eq!(2, commands.len()); diff --git a/crypto-ws-client/src/clients/dydx/dydx_swap.rs b/crypto-ws-client/src/clients/dydx/dydx_swap.rs index cd4ca176..da789e84 100644 --- a/crypto-ws-client/src/clients/dydx/dydx_swap.rs +++ b/crypto-ws-client/src/clients/dydx/dydx_swap.rs @@ -131,10 +131,8 @@ mod tests { #[test] fn test_one_topic() { let translator = super::DydxCommandTranslator {}; - let commands = translator.translate_to_commands( - true, - &[("v3_trades".to_string(), "BTC-USD".to_string())], - ); + let commands = translator + .translate_to_commands(true, &[("v3_trades".to_string(), "BTC-USD".to_string())]); assert_eq!(1, commands.len()); assert_eq!( @@ -148,8 +146,10 @@ mod tests { let translator = super::DydxCommandTranslator {}; let commands = translator.translate_to_commands( true, - &[("v3_trades".to_string(), "BTC-USD".to_string()), - ("v3_orderbook".to_string(), "BTC-USD".to_string())], + &[ + ("v3_trades".to_string(), "BTC-USD".to_string()), + ("v3_orderbook".to_string(), "BTC-USD".to_string()), + ], ); assert_eq!(2, commands.len()); diff --git a/crypto-ws-client/src/clients/ftx.rs b/crypto-ws-client/src/clients/ftx.rs index 79796a0c..84140b0e 100644 --- a/crypto-ws-client/src/clients/ftx.rs +++ b/crypto-ws-client/src/clients/ftx.rs @@ -142,8 +142,10 @@ mod tests { let translator = super::FtxCommandTranslator {}; let commands = translator.translate_to_commands( true, - &[("trades".to_string(), "BTC/USD".to_string()), - ("orderbook".to_string(), "BTC/USD".to_string())], + &[ + ("trades".to_string(), "BTC/USD".to_string()), + ("orderbook".to_string(), "BTC/USD".to_string()), + ], ); assert_eq!(2, commands.len()); diff --git a/crypto-ws-client/src/clients/gate/utils.rs b/crypto-ws-client/src/clients/gate/utils.rs index 56296375..8845a73e 100644 --- a/crypto-ws-client/src/clients/gate/utils.rs +++ b/crypto-ws-client/src/clients/gate/utils.rs @@ -214,15 +214,19 @@ mod tests { r#"{"channel":"spot.trades", "event":"subscribe", "payload":["BTC_USDT","ETH_USDT"]}"#, translator.translate_to_commands( true, - &[("trades".to_string(), "BTC_USDT".to_string()), - ("trades".to_string(), "ETH_USDT".to_string())] + &[ + ("trades".to_string(), "BTC_USDT".to_string()), + ("trades".to_string(), "ETH_USDT".to_string()) + ] )[0] ); let commands = translator.translate_to_commands( true, - &[("order_book".to_string(), "BTC_USDT".to_string()), - ("order_book".to_string(), "ETH_USDT".to_string())], + &[ + ("order_book".to_string(), "BTC_USDT".to_string()), + ("order_book".to_string(), "ETH_USDT".to_string()), + ], ); assert_eq!(2, commands.len()); assert_eq!( @@ -236,8 +240,10 @@ mod tests { let commands = translator.translate_to_commands( true, - &[("order_book_update".to_string(), "BTC_USDT".to_string()), - ("order_book_update".to_string(), "ETH_USDT".to_string())], + &[ + ("order_book_update".to_string(), "BTC_USDT".to_string()), + ("order_book_update".to_string(), "ETH_USDT".to_string()), + ], ); assert_eq!(2, commands.len()); assert_eq!( @@ -258,15 +264,19 @@ mod tests { r#"{"channel":"futures.trades", "event":"subscribe", "payload":["BTC_USD","ETH_USD"]}"#, translator.translate_to_commands( true, - &[("trades".to_string(), "BTC_USD".to_string()), - ("trades".to_string(), "ETH_USD".to_string())] + &[ + ("trades".to_string(), "BTC_USD".to_string()), + ("trades".to_string(), "ETH_USD".to_string()) + ] )[0] ); let commands = translator.translate_to_commands( true, - &[("order_book".to_string(), "BTC_USD".to_string()), - ("order_book".to_string(), "ETH_USD".to_string())], + &[ + ("order_book".to_string(), "BTC_USD".to_string()), + ("order_book".to_string(), "ETH_USD".to_string()), + ], ); assert_eq!(2, commands.len()); assert_eq!( @@ -280,8 +290,10 @@ mod tests { let commands = translator.translate_to_commands( true, - &[("order_book_update".to_string(), "BTC_USD".to_string()), - ("order_book_update".to_string(), "ETH_USD".to_string())], + &[ + ("order_book_update".to_string(), "BTC_USD".to_string()), + ("order_book_update".to_string(), "ETH_USD".to_string()), + ], ); assert_eq!(2, commands.len()); assert_eq!( diff --git a/crypto-ws-client/src/clients/huobi.rs b/crypto-ws-client/src/clients/huobi.rs index ac4bcf58..812b618e 100644 --- a/crypto-ws-client/src/clients/huobi.rs +++ b/crypto-ws-client/src/clients/huobi.rs @@ -333,10 +333,8 @@ mod tests { #[test] fn test_one_topic() { let translator = super::HuobiCommandTranslator {}; - let commands = translator.translate_to_commands( - true, - &[("trade.detail".to_string(), "btcusdt".to_string())], - ); + let commands = translator + .translate_to_commands(true, &[("trade.detail".to_string(), "btcusdt".to_string())]); assert_eq!(1, commands.len()); assert_eq!( @@ -350,8 +348,10 @@ mod tests { let translator = super::HuobiCommandTranslator {}; let commands = translator.translate_to_commands( true, - &[("trade.detail".to_string(), "btcusdt".to_string()), - ("bbo".to_string(), "btcusdt".to_string())], + &[ + ("trade.detail".to_string(), "btcusdt".to_string()), + ("bbo".to_string(), "btcusdt".to_string()), + ], ); assert_eq!(2, commands.len()); diff --git a/crypto-ws-client/src/clients/kraken/kraken_futures.rs b/crypto-ws-client/src/clients/kraken/kraken_futures.rs index 677e2620..e7cb6841 100644 --- a/crypto-ws-client/src/clients/kraken/kraken_futures.rs +++ b/crypto-ws-client/src/clients/kraken/kraken_futures.rs @@ -166,8 +166,10 @@ mod tests { let translator = super::KrakenCommandTranslator {}; let commands = translator.translate_to_commands( true, - &[("trade".to_string(), "PI_XBTUSD".to_string()), - ("trade".to_string(), "PI_ETHUSD".to_string())], + &[ + ("trade".to_string(), "PI_XBTUSD".to_string()), + ("trade".to_string(), "PI_ETHUSD".to_string()), + ], ); assert_eq!(2, commands.len()); diff --git a/crypto-ws-client/src/clients/kraken/kraken_spot.rs b/crypto-ws-client/src/clients/kraken/kraken_spot.rs index 57c3a53d..93c745e4 100644 --- a/crypto-ws-client/src/clients/kraken/kraken_spot.rs +++ b/crypto-ws-client/src/clients/kraken/kraken_spot.rs @@ -250,8 +250,8 @@ mod tests { #[test] fn test_one_symbol() { let translator = super::KrakenCommandTranslator {}; - let commands = translator - .translate_to_commands(true, &[("trade".to_string(), "XBT/USD".to_string())]); + let commands = + translator.translate_to_commands(true, &[("trade".to_string(), "XBT/USD".to_string())]); assert_eq!(1, commands.len()); assert_eq!( @@ -265,8 +265,10 @@ mod tests { let translator = super::KrakenCommandTranslator {}; let commands = translator.translate_to_commands( true, - &[("trade".to_string(), "XBT/USD".to_string()), - ("trade".to_string(), "ETH/USD".to_string())], + &[ + ("trade".to_string(), "XBT/USD".to_string()), + ("trade".to_string(), "ETH/USD".to_string()), + ], ); assert_eq!(1, commands.len()); diff --git a/crypto-ws-client/src/clients/kucoin/kucoin_spot.rs b/crypto-ws-client/src/clients/kucoin/kucoin_spot.rs index 8ea44245..7663cdcb 100644 --- a/crypto-ws-client/src/clients/kucoin/kucoin_spot.rs +++ b/crypto-ws-client/src/clients/kucoin/kucoin_spot.rs @@ -132,8 +132,10 @@ mod tests { let commands = translator.translate_to_commands( true, - &[("/market/match".to_string(), "BTC-USDT".to_string()), - ("/market/match".to_string(), "ETH-USDT".to_string())], + &[ + ("/market/match".to_string(), "BTC-USDT".to_string()), + ("/market/match".to_string(), "ETH-USDT".to_string()), + ], ); assert_eq!(1, commands.len()); @@ -148,8 +150,10 @@ mod tests { let translator = super::KucoinCommandTranslator {}; let commands = translator.translate_to_commands( true, - &[("/market/match".to_string(), "BTC-USDT".to_string()), - ("/market/level2".to_string(), "ETH-USDT".to_string())], + &[ + ("/market/match".to_string(), "BTC-USDT".to_string()), + ("/market/level2".to_string(), "ETH-USDT".to_string()), + ], ); assert_eq!(2, commands.len()); @@ -164,10 +168,12 @@ mod tests { let commands = translator.translate_to_commands( true, - &[("/market/match".to_string(), "BTC-USDT".to_string()), + &[ + ("/market/match".to_string(), "BTC-USDT".to_string()), ("/market/match".to_string(), "ETH-USDT".to_string()), ("/market/level2".to_string(), "BTC-USDT".to_string()), - ("/market/level2".to_string(), "ETH-USDT".to_string())], + ("/market/level2".to_string(), "ETH-USDT".to_string()), + ], ); assert_eq!(2, commands.len()); diff --git a/crypto-ws-client/src/clients/kucoin/kucoin_swap.rs b/crypto-ws-client/src/clients/kucoin/kucoin_swap.rs index eff0a5a5..3469cf4d 100644 --- a/crypto-ws-client/src/clients/kucoin/kucoin_swap.rs +++ b/crypto-ws-client/src/clients/kucoin/kucoin_swap.rs @@ -131,14 +131,16 @@ mod tests { let commands = translator.translate_to_commands( true, - &[( + &[ + ( "/contractMarket/execution".to_string(), "BTC_USD".to_string(), ), ( "/contractMarket/execution".to_string(), "ETH_USD".to_string(), - )], + ), + ], ); assert_eq!(1, commands.len()); @@ -153,11 +155,13 @@ mod tests { let translator = super::KucoinCommandTranslator {}; let commands = translator.translate_to_commands( true, - &[( + &[ + ( "/contractMarket/execution".to_string(), "BTC_USD".to_string(), ), - ("/contractMarket/level2".to_string(), "ETH_USD".to_string())], + ("/contractMarket/level2".to_string(), "ETH_USD".to_string()), + ], ); assert_eq!(2, commands.len()); @@ -172,7 +176,8 @@ mod tests { let commands = translator.translate_to_commands( true, - &[( + &[ + ( "/contractMarket/execution".to_string(), "BTC_USD".to_string(), ), @@ -181,7 +186,8 @@ mod tests { "ETH_USD".to_string(), ), ("/contractMarket/level2".to_string(), "BTC_USD".to_string()), - ("/contractMarket/level2".to_string(), "ETH_USD".to_string())], + ("/contractMarket/level2".to_string(), "ETH_USD".to_string()), + ], ); assert_eq!(2, commands.len()); diff --git a/crypto-ws-client/src/clients/mexc/mexc_spot.rs b/crypto-ws-client/src/clients/mexc/mexc_spot.rs index 5cf2a95e..a26d852d 100644 --- a/crypto-ws-client/src/clients/mexc/mexc_spot.rs +++ b/crypto-ws-client/src/clients/mexc/mexc_spot.rs @@ -166,8 +166,8 @@ mod tests { #[test] fn test_one_topic() { let translator = super::MexcCommandTranslator {}; - let commands = translator - .translate_to_commands(true, &[("deal".to_string(), "BTC_USDT".to_string())]); + let commands = + translator.translate_to_commands(true, &[("deal".to_string(), "BTC_USDT".to_string())]); assert_eq!(1, commands.len()); assert_eq!(r#"{"op":"sub.deal","symbol":"BTC_USDT"}"#, commands[0]); @@ -178,8 +178,10 @@ mod tests { let translator = super::MexcCommandTranslator {}; let commands = translator.translate_to_commands( true, - &[("deal".to_string(), "BTC_USDT".to_string()), - ("depth".to_string(), "ETH_USDT".to_string())], + &[ + ("deal".to_string(), "BTC_USDT".to_string()), + ("depth".to_string(), "ETH_USDT".to_string()), + ], ); assert_eq!(2, commands.len()); diff --git a/crypto-ws-client/src/clients/mexc/mexc_swap.rs b/crypto-ws-client/src/clients/mexc/mexc_swap.rs index 79d19f34..49b139d6 100644 --- a/crypto-ws-client/src/clients/mexc/mexc_swap.rs +++ b/crypto-ws-client/src/clients/mexc/mexc_swap.rs @@ -153,8 +153,8 @@ mod tests { #[test] fn test_one_topic() { let translator = super::MexcCommandTranslator {}; - let commands = translator - .translate_to_commands(true, &[("deal".to_string(), "BTC_USDT".to_string())]); + let commands = + translator.translate_to_commands(true, &[("deal".to_string(), "BTC_USDT".to_string())]); assert_eq!(1, commands.len()); assert_eq!( @@ -168,8 +168,10 @@ mod tests { let translator = super::MexcCommandTranslator {}; let commands = translator.translate_to_commands( true, - &[("deal".to_string(), "BTC_USDT".to_string()), - ("depth".to_string(), "ETH_USDT".to_string())], + &[ + ("deal".to_string(), "BTC_USDT".to_string()), + ("depth".to_string(), "ETH_USDT".to_string()), + ], ); assert_eq!(2, commands.len()); diff --git a/crypto-ws-client/src/clients/okx.rs b/crypto-ws-client/src/clients/okx.rs index 9d4fde7c..7cc8ec11 100644 --- a/crypto-ws-client/src/clients/okx.rs +++ b/crypto-ws-client/src/clients/okx.rs @@ -231,8 +231,10 @@ mod tests { let translator = super::OkxCommandTranslator {}; let commands = translator.translate_to_commands( true, - &[("trades".to_string(), "BTC-USDT".to_string()), - ("tickers".to_string(), "BTC-USDT".to_string())], + &[ + ("trades".to_string(), "BTC-USDT".to_string()), + ("tickers".to_string(), "BTC-USDT".to_string()), + ], ); assert_eq!(1, commands.len()); diff --git a/crypto-ws-client/src/clients/zb/zb_spot.rs b/crypto-ws-client/src/clients/zb/zb_spot.rs index 2e2fc481..e02364f8 100644 --- a/crypto-ws-client/src/clients/zb/zb_spot.rs +++ b/crypto-ws-client/src/clients/zb/zb_spot.rs @@ -171,8 +171,10 @@ mod tests { let translator = super::ZbCommandTranslator {}; let commands = translator.translate_to_commands( true, - &[("trades".to_string(), "btc_usdt".to_string()), - ("depth".to_string(), "eth_usdt".to_string())], + &[ + ("trades".to_string(), "btc_usdt".to_string()), + ("depth".to_string(), "eth_usdt".to_string()), + ], ); assert_eq!(2, commands.len()); diff --git a/crypto-ws-client/src/clients/zb/zb_swap.rs b/crypto-ws-client/src/clients/zb/zb_swap.rs index 85255652..775ebdac 100644 --- a/crypto-ws-client/src/clients/zb/zb_swap.rs +++ b/crypto-ws-client/src/clients/zb/zb_swap.rs @@ -192,8 +192,10 @@ mod tests { let translator = super::ZbCommandTranslator {}; let commands = translator.translate_to_commands( true, - &[("Trade".to_string(), "BTC_USDT".to_string()), - ("Depth".to_string(), "ETH_USDT".to_string())], + &[ + ("Trade".to_string(), "BTC_USDT".to_string()), + ("Depth".to_string(), "ETH_USDT".to_string()), + ], ); assert_eq!(2, commands.len()); diff --git a/crypto-ws-client/src/clients/zbg/zbg_spot.rs b/crypto-ws-client/src/clients/zbg/zbg_spot.rs index c30e8bf3..893a8197 100644 --- a/crypto-ws-client/src/clients/zbg/zbg_spot.rs +++ b/crypto-ws-client/src/clients/zbg/zbg_spot.rs @@ -167,8 +167,10 @@ mod tests { let translator = super::ZbgCommandTranslator::new().await; let commands = translator.translate_to_commands( true, - &[("TRADE".to_string(), "btc_usdt".to_string()), - ("ENTRUST_ADD".to_string(), "eth_usdt".to_string())], + &[ + ("TRADE".to_string(), "btc_usdt".to_string()), + ("ENTRUST_ADD".to_string(), "eth_usdt".to_string()), + ], ); assert_eq!(2, commands.len()); diff --git a/crypto-ws-client/src/clients/zbg/zbg_swap.rs b/crypto-ws-client/src/clients/zbg/zbg_swap.rs index bfc8ff80..b4790591 100644 --- a/crypto-ws-client/src/clients/zbg/zbg_swap.rs +++ b/crypto-ws-client/src/clients/zbg/zbg_swap.rs @@ -149,10 +149,8 @@ mod tests { #[tokio::test(flavor = "multi_thread")] async fn test_one_topic() { let translator = super::ZbgCommandTranslator::new().await; - let commands = translator.translate_to_commands( - true, - &[("future_tick".to_string(), "BTC_USDT".to_string())], - ); + let commands = translator + .translate_to_commands(true, &[("future_tick".to_string(), "BTC_USDT".to_string())]); assert_eq!(1, commands.len()); assert_eq!( @@ -166,8 +164,10 @@ mod tests { let translator = super::ZbgCommandTranslator::new().await; let commands = translator.translate_to_commands( true, - &[("future_tick".to_string(), "BTC_USDT".to_string()), - ("future_snapshot_depth".to_string(), "ETH_USDT".to_string())], + &[ + ("future_tick".to_string(), "BTC_USDT".to_string()), + ("future_snapshot_depth".to_string(), "ETH_USDT".to_string()), + ], ); assert_eq!(2, commands.len()); diff --git a/crypto-ws-client/tests/binance.rs b/crypto-ws-client/tests/binance.rs index b11ac421..35f0dffc 100644 --- a/crypto-ws-client/tests/binance.rs +++ b/crypto-ws-client/tests/binance.rs @@ -10,8 +10,10 @@ mod binance_spot { gen_test_code!( BinanceSpotWSClient, subscribe, - &[("aggTrade".to_string(), "BTCUSDT".to_string()), - ("ticker".to_string(), "BTCUSDT".to_string())] + &[ + ("aggTrade".to_string(), "BTCUSDT".to_string()), + ("ticker".to_string(), "BTCUSDT".to_string()) + ] ); } @@ -95,8 +97,10 @@ mod binance_spot { ); gen_test_subscribe_candlestick!( BinanceSpotWSClient, - &[("BTCUSDT".to_string(), 2592000), - ("ETHUSDT".to_string(), 2592000)] + &[ + ("BTCUSDT".to_string(), 2592000), + ("ETHUSDT".to_string(), 2592000) + ] ); } } @@ -110,9 +114,11 @@ mod binance_inverse_future { gen_test_code!( BinanceInverseWSClient, subscribe, - &[("aggTrade".to_string(), "BTCUSD_220930".to_string()), + &[ + ("aggTrade".to_string(), "BTCUSD_220930".to_string()), ("aggTrade".to_string(), "ETHUSD_220930".to_string()), - ("aggTrade".to_string(), "BNBUSD_220930".to_string())] + ("aggTrade".to_string(), "BNBUSD_220930".to_string()) + ] ); } @@ -130,9 +136,11 @@ mod binance_inverse_future { gen_test_code!( BinanceInverseWSClient, subscribe_trade, - &["BTCUSD_220930".to_string(), + &[ + "BTCUSD_220930".to_string(), "ETHUSD_220930".to_string(), - "BNBUSD_220930".to_string()] + "BNBUSD_220930".to_string() + ] ); } @@ -141,9 +149,11 @@ mod binance_inverse_future { gen_test_code!( BinanceInverseWSClient, subscribe_ticker, - &["BTCUSD_220930".to_string(), + &[ + "BTCUSD_220930".to_string(), "ETHUSD_220930".to_string(), - "BNBUSD_220930".to_string()] + "BNBUSD_220930".to_string() + ] ); } @@ -161,9 +171,11 @@ mod binance_inverse_future { gen_test_code!( BinanceInverseWSClient, subscribe_bbo, - &["BTCUSD_220930".to_string(), + &[ + "BTCUSD_220930".to_string(), "ETHUSD_220930".to_string(), - "BNBUSD_220930".to_string()] + "BNBUSD_220930".to_string() + ] ); } @@ -172,9 +184,11 @@ mod binance_inverse_future { gen_test_code!( BinanceInverseWSClient, subscribe_orderbook, - &["BTCUSD_220930".to_string(), + &[ + "BTCUSD_220930".to_string(), "ETHUSD_220930".to_string(), - "BNBUSD_220930".to_string()] + "BNBUSD_220930".to_string() + ] ); } @@ -183,9 +197,11 @@ mod binance_inverse_future { gen_test_code!( BinanceInverseWSClient, subscribe_orderbook_topk, - &["BTCUSD_220930".to_string(), + &[ + "BTCUSD_220930".to_string(), "ETHUSD_220930".to_string(), - "BNBUSD_220930".to_string()] + "BNBUSD_220930".to_string() + ] ); } @@ -193,15 +209,19 @@ mod binance_inverse_future { async fn subscribe_candlestick() { gen_test_subscribe_candlestick!( BinanceInverseWSClient, - &[("BTCUSD_220930".to_string(), 60), + &[ + ("BTCUSD_220930".to_string(), 60), ("ETHUSD_220930".to_string(), 60), - ("BNBUSD_220930".to_string(), 60)] + ("BNBUSD_220930".to_string(), 60) + ] ); gen_test_subscribe_candlestick!( BinanceInverseWSClient, - &[("BTCUSD_220930".to_string(), 2592000), + &[ + ("BTCUSD_220930".to_string(), 2592000), ("ETHUSD_220930".to_string(), 2592000), - ("BNBUSD_220930".to_string(), 2592000)] + ("BNBUSD_220930".to_string(), 2592000) + ] ); } } @@ -215,8 +235,10 @@ mod binance_linear_future { gen_test_code!( BinanceLinearWSClient, subscribe, - &[("aggTrade".to_string(), "BTCUSDT_220930".to_string()), - ("aggTrade".to_string(), "ETHUSDT_220930".to_string())] + &[ + ("aggTrade".to_string(), "BTCUSDT_220930".to_string()), + ("aggTrade".to_string(), "ETHUSDT_220930".to_string()) + ] ); } @@ -287,13 +309,17 @@ mod binance_linear_future { async fn subscribe_candlestick() { gen_test_subscribe_candlestick!( BinanceLinearWSClient, - &[("BTCUSDT_220930".to_string(), 60), - ("ETHUSDT_220930".to_string(), 60)] + &[ + ("BTCUSDT_220930".to_string(), 60), + ("ETHUSDT_220930".to_string(), 60) + ] ); gen_test_subscribe_candlestick!( BinanceLinearWSClient, - &[("BTCUSDT_220930".to_string(), 2592000), - ("ETHUSDT_220930".to_string(), 2592000)] + &[ + ("BTCUSDT_220930".to_string(), 2592000), + ("ETHUSDT_220930".to_string(), 2592000) + ] ); } } @@ -378,13 +404,17 @@ mod binance_inverse_swap { async fn subscribe_candlestick() { gen_test_subscribe_candlestick!( BinanceInverseWSClient, - &[("btcusd_perp".to_string(), 60), - ("ethusd_perp".to_string(), 60)] + &[ + ("btcusd_perp".to_string(), 60), + ("ethusd_perp".to_string(), 60) + ] ); gen_test_subscribe_candlestick!( BinanceInverseWSClient, - &[("btcusd_perp".to_string(), 2592000), - ("ethusd_perp".to_string(), 2592000)] + &[ + ("btcusd_perp".to_string(), 2592000), + ("ethusd_perp".to_string(), 2592000) + ] ); } @@ -491,8 +521,10 @@ mod binance_linear_swap { ); gen_test_subscribe_candlestick!( BinanceLinearWSClient, - &[("BTCUSDT".to_string(), 2592000), - ("ETHUSDT".to_string(), 2592000)] + &[ + ("BTCUSDT".to_string(), 2592000), + ("ETHUSDT".to_string(), 2592000) + ] ); } diff --git a/crypto-ws-client/tests/binance_option.rs b/crypto-ws-client/tests/binance_option.rs index f3abc753..23da77a3 100644 --- a/crypto-ws-client/tests/binance_option.rs +++ b/crypto-ws-client/tests/binance_option.rs @@ -9,9 +9,11 @@ async fn subscribe() { gen_test_code!( BinanceOptionWSClient, subscribe, - &[("TICKER_ALL".to_string(), "BTCUSDT".to_string()), + &[ + ("TICKER_ALL".to_string(), "BTCUSDT".to_string()), ("TRADE_ALL".to_string(), "BTCUSDT_C".to_string()), - ("TRADE_ALL".to_string(), "BTCUSDT_P".to_string())] + ("TRADE_ALL".to_string(), "BTCUSDT_P".to_string()) + ] ); } @@ -21,8 +23,10 @@ async fn subscribe_trade() { gen_test_code!( BinanceOptionWSClient, subscribe_trade, - &["BTC-220325-40000-C".to_string(), - "BTC-220325-35000-P".to_string()] + &[ + "BTC-220325-40000-C".to_string(), + "BTC-220325-35000-P".to_string() + ] ); } @@ -32,8 +36,10 @@ async fn subscribe_ticker() { gen_test_code!( BinanceOptionWSClient, subscribe_ticker, - &["BTC-220325-40000-C".to_string(), - "BTC-220325-35000-P".to_string()] + &[ + "BTC-220325-40000-C".to_string(), + "BTC-220325-35000-P".to_string() + ] ); } @@ -53,8 +59,10 @@ async fn subscribe_orderbook() { gen_test_code!( BinanceOptionWSClient, subscribe_orderbook, - &["BTC-220325-40000-C".to_string(), - "BTC-220325-35000-P".to_string()] + &[ + "BTC-220325-40000-C".to_string(), + "BTC-220325-35000-P".to_string() + ] ); } @@ -64,8 +72,10 @@ async fn subscribe_orderbook_topk() { gen_test_code!( BinanceOptionWSClient, subscribe_orderbook_topk, - &["BTC-220325-40000-C".to_string(), - "BTC-220325-35000-P".to_string()] + &[ + "BTC-220325-40000-C".to_string(), + "BTC-220325-35000-P".to_string() + ] ); } @@ -74,12 +84,16 @@ async fn subscribe_orderbook_topk() { async fn subscribe_candlestick() { gen_test_subscribe_candlestick!( BinanceOptionWSClient, - &[("BTC-220325-40000-C".to_string(), 60), - ("BTC-220325-35000-P".to_string(), 60)] + &[ + ("BTC-220325-40000-C".to_string(), 60), + ("BTC-220325-35000-P".to_string(), 60) + ] ); gen_test_subscribe_candlestick!( BinanceOptionWSClient, - &[("BTC-220325-40000-C".to_string(), 60), - ("BTC-220325-35000-P".to_string(), 60)] + &[ + ("BTC-220325-40000-C".to_string(), 60), + ("BTC-220325-35000-P".to_string(), 60) + ] ); } diff --git a/crypto-ws-client/tests/bitfinex.rs b/crypto-ws-client/tests/bitfinex.rs index 6ce1edd8..9d34fdfb 100644 --- a/crypto-ws-client/tests/bitfinex.rs +++ b/crypto-ws-client/tests/bitfinex.rs @@ -10,8 +10,10 @@ mod bitfinex_spot { gen_test_code!( BitfinexWSClient, subscribe, - &[("trades".to_string(), "tBTCUST".to_string()), - ("trades".to_string(), "tETHUST".to_string())] + &[ + ("trades".to_string(), "tBTCUST".to_string()), + ("trades".to_string(), "tETHUST".to_string()) + ] ); } @@ -36,20 +38,12 @@ mod bitfinex_spot { #[tokio::test(flavor = "multi_thread")] async fn subscribe_ticker() { - gen_test_code!( - BitfinexWSClient, - subscribe_ticker, - &["tBTCUST".to_string()] - ); + gen_test_code!(BitfinexWSClient, subscribe_ticker, &["tBTCUST".to_string()]); } #[tokio::test(flavor = "multi_thread")] async fn subscribe_bbo() { - gen_test_code!( - BitfinexWSClient, - subscribe_bbo, - &["tBTCUST".to_string()] - ); + gen_test_code!(BitfinexWSClient, subscribe_bbo, &["tBTCUST".to_string()]); } #[tokio::test(flavor = "multi_thread")] @@ -138,9 +132,6 @@ mod bitfinex_swap { #[tokio::test(flavor = "multi_thread")] async fn subscribe_candlestick() { gen_test_subscribe_candlestick!(BitfinexWSClient, &[("tBTCF0:USTF0".to_string(), 60)]); - gen_test_subscribe_candlestick!( - BitfinexWSClient, - &[("tBTCF0:USTF0".to_string(), 2592000)] - ); + gen_test_subscribe_candlestick!(BitfinexWSClient, &[("tBTCF0:USTF0".to_string(), 2592000)]); } } diff --git a/crypto-ws-client/tests/bitget.rs b/crypto-ws-client/tests/bitget.rs index aecd20cc..ad42242b 100644 --- a/crypto-ws-client/tests/bitget.rs +++ b/crypto-ws-client/tests/bitget.rs @@ -72,11 +72,7 @@ mod bitget_inverse_swap { #[tokio::test(flavor = "multi_thread")] async fn subscribe_trade() { - gen_test_code!( - BitgetSwapWSClient, - subscribe_trade, - &["BTCUSD".to_string()] - ); + gen_test_code!(BitgetSwapWSClient, subscribe_trade, &["BTCUSD".to_string()]); } #[tokio::test(flavor = "multi_thread")] diff --git a/crypto-ws-client/tests/bithumb.rs b/crypto-ws-client/tests/bithumb.rs index 871ce08f..7be2ca89 100644 --- a/crypto-ws-client/tests/bithumb.rs +++ b/crypto-ws-client/tests/bithumb.rs @@ -9,8 +9,10 @@ async fn subscribe() { gen_test_code!( BithumbWSClient, subscribe, - &[("TRADE".to_string(), "BTC-USDT".to_string()), - ("TRADE".to_string(), "ETH-USDT".to_string())] + &[ + ("TRADE".to_string(), "BTC-USDT".to_string()), + ("TRADE".to_string(), "ETH-USDT".to_string()) + ] ); } diff --git a/crypto-ws-client/tests/bitmex.rs b/crypto-ws-client/tests/bitmex.rs index a3a016fa..e391dd77 100644 --- a/crypto-ws-client/tests/bitmex.rs +++ b/crypto-ws-client/tests/bitmex.rs @@ -21,8 +21,10 @@ mod bitmex_inverse_swap { gen_test_code!( BitmexWSClient, subscribe, - &[("trade".to_string(), "XBTUSD".to_string()), - ("quote".to_string(), "XBTUSD".to_string())] + &[ + ("trade".to_string(), "XBTUSD".to_string()), + ("quote".to_string(), "XBTUSD".to_string()) + ] ); } @@ -47,11 +49,7 @@ mod bitmex_inverse_swap { #[tokio::test(flavor = "multi_thread")] async fn subscribe_orderbook() { - gen_test_code!( - BitmexWSClient, - subscribe_orderbook, - &["XBTUSD".to_string()] - ); + gen_test_code!(BitmexWSClient, subscribe_orderbook, &["XBTUSD".to_string()]); } #[tokio::test(flavor = "multi_thread")] @@ -107,8 +105,10 @@ mod bitmex_inverse_future { gen_test_code!( BitmexWSClient, subscribe, - &[("trade".to_string(), "XBTU22".to_string()), - ("quote".to_string(), "XBTU22".to_string())] + &[ + ("trade".to_string(), "XBTU22".to_string()), + ("quote".to_string(), "XBTU22".to_string()) + ] ); } @@ -177,11 +177,7 @@ mod bitmex_quanto_swap { #[tokio::test(flavor = "multi_thread")] async fn subscribe_orderbook() { - gen_test_code!( - BitmexWSClient, - subscribe_orderbook, - &["ETHUSD".to_string()] - ); + gen_test_code!(BitmexWSClient, subscribe_orderbook, &["ETHUSD".to_string()]); } #[tokio::test(flavor = "multi_thread")] @@ -219,9 +215,11 @@ mod bitmex_linear_future { gen_test_code!( BitmexWSClient, subscribe_trade, - &["XBTUSDTU22".to_string(), + &[ + "XBTUSDTU22".to_string(), "ETHU22".to_string(), - "ETHUSDTU22".to_string()] + "ETHUSDTU22".to_string() + ] ); } @@ -232,11 +230,7 @@ mod bitmex_linear_future { #[tokio::test(flavor = "multi_thread")] async fn subscribe_orderbook() { - gen_test_code!( - BitmexWSClient, - subscribe_orderbook, - &["ETHU22".to_string()] - ); + gen_test_code!(BitmexWSClient, subscribe_orderbook, &["ETHU22".to_string()]); } #[tokio::test(flavor = "multi_thread")] diff --git a/crypto-ws-client/tests/bitstamp.rs b/crypto-ws-client/tests/bitstamp.rs index 08209d28..0885b704 100644 --- a/crypto-ws-client/tests/bitstamp.rs +++ b/crypto-ws-client/tests/bitstamp.rs @@ -8,8 +8,10 @@ async fn subscribe() { gen_test_code!( BitstampWSClient, subscribe, - &[("live_trades".to_string(), "btcusd".to_string()), - ("diff_order_book".to_string(), "btcusd".to_string())] + &[ + ("live_trades".to_string(), "btcusd".to_string()), + ("diff_order_book".to_string(), "btcusd".to_string()) + ] ); } @@ -18,8 +20,10 @@ async fn subscribe_raw_json() { gen_test_code!( BitstampWSClient, send, - &[r#"{"event":"bts:subscribe","data":{"channel":"live_trades_btcusd"}}"#.to_string(), - r#"{"event":"bts:subscribe","data":{"channel":"live_trades_ethusd"}}"#.to_string()] + &[ + r#"{"event":"bts:subscribe","data":{"channel":"live_trades_btcusd"}}"#.to_string(), + r#"{"event":"bts:subscribe","data":{"channel":"live_trades_ethusd"}}"#.to_string() + ] ); } diff --git a/crypto-ws-client/tests/bitz.rs b/crypto-ws-client/tests/bitz.rs index 428fec69..95c5985c 100644 --- a/crypto-ws-client/tests/bitz.rs +++ b/crypto-ws-client/tests/bitz.rs @@ -12,9 +12,11 @@ mod bitz_spot { gen_test_code!( BitzSpotWSClient, subscribe, - &[("market".to_string(), "btc_usdt".to_string()), + &[ + ("market".to_string(), "btc_usdt".to_string()), ("depth".to_string(), "btc_usdt".to_string()), - ("order".to_string(), "btc_usdt".to_string())] + ("order".to_string(), "btc_usdt".to_string()) + ] ); } @@ -37,11 +39,7 @@ mod bitz_spot { #[tokio::test(flavor = "multi_thread")] #[ignore = "bitz.com has shutdown since October 2021"] async fn subscribe_trade() { - gen_test_code!( - BitzSpotWSClient, - subscribe_trade, - &["btc_usdt".to_string()] - ); + gen_test_code!(BitzSpotWSClient, subscribe_trade, &["btc_usdt".to_string()]); } #[tokio::test(flavor = "multi_thread")] diff --git a/crypto-ws-client/tests/bybit.rs b/crypto-ws-client/tests/bybit.rs index 401d48ea..e37c12ab 100644 --- a/crypto-ws-client/tests/bybit.rs +++ b/crypto-ws-client/tests/bybit.rs @@ -112,10 +112,7 @@ mod bybit_inverse_swap { #[tokio::test(flavor = "multi_thread")] async fn subscribe_candlestick() { gen_test_subscribe_candlestick!(BybitInverseWSClient, &[("BTCUSD".to_string(), 60)]); - gen_test_subscribe_candlestick!( - BybitInverseWSClient, - &[("BTCUSD".to_string(), 2592000)] - ); + gen_test_subscribe_candlestick!(BybitInverseWSClient, &[("BTCUSD".to_string(), 2592000)]); } } @@ -152,10 +149,7 @@ mod bybit_linear_swap { #[tokio::test(flavor = "multi_thread")] async fn subscribe_candlestick() { - gen_test_subscribe_candlestick!( - BybitLinearSwapWSClient, - &[("BTCUSDT".to_string(), 60)] - ); + gen_test_subscribe_candlestick!(BybitLinearSwapWSClient, &[("BTCUSDT".to_string(), 60)]); gen_test_subscribe_candlestick!( BybitLinearSwapWSClient, &[("BTCUSDT".to_string(), 2592000)] diff --git a/crypto-ws-client/tests/coinbase_pro.rs b/crypto-ws-client/tests/coinbase_pro.rs index f503277b..0e1f9a43 100644 --- a/crypto-ws-client/tests/coinbase_pro.rs +++ b/crypto-ws-client/tests/coinbase_pro.rs @@ -8,8 +8,10 @@ async fn subscribe() { gen_test_code!( CoinbaseProWSClient, subscribe, - &[("matches".to_string(), "BTC-USD".to_string()), - ("heartbeat".to_string(), "BTC-USD".to_string())] + &[ + ("matches".to_string(), "BTC-USD".to_string()), + ("heartbeat".to_string(), "BTC-USD".to_string()) + ] ); } diff --git a/crypto-ws-client/tests/deribit.rs b/crypto-ws-client/tests/deribit.rs index 173a1a79..35f17d1e 100644 --- a/crypto-ws-client/tests/deribit.rs +++ b/crypto-ws-client/tests/deribit.rs @@ -9,8 +9,10 @@ async fn deribit_all_trades() { DeribitWSClient, subscribe, // https://docs.deribit.com/?javascript#trades-kind-currency-interval - &[("trades.future.SYMBOL.100ms".to_string(), "any".to_string()), - ("trades.option.SYMBOL.100ms".to_string(), "any".to_string())] + &[ + ("trades.future.SYMBOL.100ms".to_string(), "any".to_string()), + ("trades.option.SYMBOL.100ms".to_string(), "any".to_string()) + ] ); } @@ -66,11 +68,7 @@ mod deribit_inverse_future { #[tokio::test(flavor = "multi_thread")] async fn subscribe_bbo() { - gen_test_code!( - DeribitWSClient, - subscribe_bbo, - &["BTC-30SEP22".to_string()] - ); + gen_test_code!(DeribitWSClient, subscribe_bbo, &["BTC-30SEP22".to_string()]); } #[tokio::test(flavor = "multi_thread")] @@ -144,10 +142,7 @@ mod deribit_inverse_swap { #[tokio::test(flavor = "multi_thread")] async fn subscribe_candlestick() { gen_test_subscribe_candlestick!(DeribitWSClient, &[("BTC-PERPETUAL".to_string(), 60)]); - gen_test_subscribe_candlestick!( - DeribitWSClient, - &[("BTC-PERPETUAL".to_string(), 86400)] - ); + gen_test_subscribe_candlestick!(DeribitWSClient, &[("BTC-PERPETUAL".to_string(), 86400)]); } } diff --git a/crypto-ws-client/tests/dydx.rs b/crypto-ws-client/tests/dydx.rs index f3190d7f..46b55b40 100644 --- a/crypto-ws-client/tests/dydx.rs +++ b/crypto-ws-client/tests/dydx.rs @@ -10,8 +10,10 @@ mod dydx_linear_swap { gen_test_code!( DydxSwapWSClient, send, - &[r#"{"type": "subscribe", "channel": "v3_trades", "id": "BTC-USD"}"#.to_string(), - r#"{"type": "subscribe", "channel": "v3_trades", "id": "ETH-USD"}"#.to_string()] + &[ + r#"{"type": "subscribe", "channel": "v3_trades", "id": "BTC-USD"}"#.to_string(), + r#"{"type": "subscribe", "channel": "v3_trades", "id": "ETH-USD"}"#.to_string() + ] ); } diff --git a/crypto-ws-client/tests/ftx.rs b/crypto-ws-client/tests/ftx.rs index 5c40d15d..6897db7a 100644 --- a/crypto-ws-client/tests/ftx.rs +++ b/crypto-ws-client/tests/ftx.rs @@ -35,11 +35,7 @@ mod ftx_spot { #[tokio::test(flavor = "multi_thread")] async fn subscribe_orderbook() { - gen_test_code!( - FtxWSClient, - subscribe_orderbook, - &["BTC/USD".to_string()] - ); + gen_test_code!(FtxWSClient, subscribe_orderbook, &["BTC/USD".to_string()]); } } @@ -91,11 +87,7 @@ mod ftx_linear_future { #[tokio::test(flavor = "multi_thread")] async fn subscribe_orderbook() { - gen_test_code!( - FtxWSClient, - subscribe_orderbook, - &["BTC-0930".to_string()] - ); + gen_test_code!(FtxWSClient, subscribe_orderbook, &["BTC-0930".to_string()]); } } @@ -115,11 +107,7 @@ mod ftx_move { #[tokio::test(flavor = "multi_thread")] async fn subscribe_bbo() { - gen_test_code!( - FtxWSClient, - subscribe_bbo, - &["BTC-MOVE-2022Q4".to_string()] - ); + gen_test_code!(FtxWSClient, subscribe_bbo, &["BTC-MOVE-2022Q4".to_string()]); } #[tokio::test(flavor = "multi_thread")] @@ -149,10 +137,6 @@ mod ftx_bvol { #[tokio::test(flavor = "multi_thread")] async fn subscribe_orderbook() { - gen_test_code!( - FtxWSClient, - subscribe_orderbook, - &["BVOL/USD".to_string()] - ); + gen_test_code!(FtxWSClient, subscribe_orderbook, &["BVOL/USD".to_string()]); } } diff --git a/crypto-ws-client/tests/gate.rs b/crypto-ws-client/tests/gate.rs index 021405e4..096aa5cb 100644 --- a/crypto-ws-client/tests/gate.rs +++ b/crypto-ws-client/tests/gate.rs @@ -10,8 +10,10 @@ mod gate_spot { gen_test_code!( GateSpotWSClient, subscribe, - &[("trades".to_string(), "BTC_USDT".to_string()), - ("trades".to_string(), "ETH_USDT".to_string())] + &[ + ("trades".to_string(), "BTC_USDT".to_string()), + ("trades".to_string(), "ETH_USDT".to_string()) + ] ); } @@ -26,11 +28,7 @@ mod gate_spot { #[tokio::test(flavor = "multi_thread")] async fn subscribe_trade() { - gen_test_code!( - GateSpotWSClient, - subscribe_trade, - &["BTC_USDT".to_string()] - ); + gen_test_code!(GateSpotWSClient, subscribe_trade, &["BTC_USDT".to_string()]); } #[tokio::test(flavor = "multi_thread")] @@ -53,11 +51,7 @@ mod gate_spot { #[tokio::test(flavor = "multi_thread")] async fn subscribe_bbo() { - gen_test_code!( - GateSpotWSClient, - subscribe_bbo, - &["BTC_USDT".to_string()] - ); + gen_test_code!(GateSpotWSClient, subscribe_bbo, &["BTC_USDT".to_string()]); } #[tokio::test(flavor = "multi_thread")] @@ -87,10 +81,12 @@ mod gate_inverse_swap { gen_test_code!( GateInverseSwapWSClient, subscribe, - &[("trades".to_string(), "BTC_USD".to_string()), + &[ + ("trades".to_string(), "BTC_USD".to_string()), ("trades".to_string(), "ETH_USD".to_string()), ("trades".to_string(), "BNB_USD".to_string()), - ("trades".to_string(), "XRP_USD".to_string())] + ("trades".to_string(), "XRP_USD".to_string()) + ] ); } @@ -154,10 +150,7 @@ mod gate_inverse_swap { #[ignore] #[tokio::test(flavor = "multi_thread")] async fn subscribe_candlestick() { - gen_test_subscribe_candlestick!( - GateInverseSwapWSClient, - &[("BTC_USD".to_string(), 10)] - ); + gen_test_subscribe_candlestick!(GateInverseSwapWSClient, &[("BTC_USD".to_string(), 10)]); gen_test_subscribe_candlestick!( GateInverseSwapWSClient, &[("BTC_USD".to_string(), 604800)] @@ -217,10 +210,7 @@ mod gate_linear_swap { #[ignore] #[tokio::test(flavor = "multi_thread")] async fn subscribe_candlestick() { - gen_test_subscribe_candlestick!( - GateLinearSwapWSClient, - &[("BTC_USDT".to_string(), 10)] - ); + gen_test_subscribe_candlestick!(GateLinearSwapWSClient, &[("BTC_USDT".to_string(), 10)]); gen_test_subscribe_candlestick!( GateLinearSwapWSClient, &[("BTC_USDT".to_string(), 604800)] diff --git a/crypto-ws-client/tests/huobi.rs b/crypto-ws-client/tests/huobi.rs index ddabc719..1fe84ab4 100644 --- a/crypto-ws-client/tests/huobi.rs +++ b/crypto-ws-client/tests/huobi.rs @@ -25,11 +25,7 @@ mod huobi_spot { #[tokio::test(flavor = "multi_thread")] async fn subscribe_trade() { - gen_test_code!( - HuobiSpotWSClient, - subscribe_trade, - &["btcusdt".to_string()] - ); + gen_test_code!(HuobiSpotWSClient, subscribe_trade, &["btcusdt".to_string()]); } #[tokio::test(flavor = "multi_thread")] @@ -43,11 +39,7 @@ mod huobi_spot { #[tokio::test(flavor = "multi_thread")] async fn subscribe_bbo() { - gen_test_code!( - HuobiSpotWSClient, - subscribe_bbo, - &["btcusdt".to_string()] - ); + gen_test_code!(HuobiSpotWSClient, subscribe_bbo, &["btcusdt".to_string()]); } #[tokio::test(flavor = "multi_thread")] @@ -63,7 +55,9 @@ mod huobi_spot { ws_client.close(); }); - rx.into_iter().next().expect("should has at least 1 element"); + rx.into_iter() + .next() + .expect("should has at least 1 element"); } #[tokio::test(flavor = "multi_thread")] @@ -115,11 +109,7 @@ mod huobi_inverse_future { #[tokio::test(flavor = "multi_thread")] async fn subscribe_bbo() { - gen_test_code!( - HuobiFutureWSClient, - subscribe_bbo, - &["BTC_CQ".to_string()] - ); + gen_test_code!(HuobiFutureWSClient, subscribe_bbo, &["BTC_CQ".to_string()]); } #[tokio::test(flavor = "multi_thread")] @@ -143,10 +133,7 @@ mod huobi_inverse_future { #[tokio::test(flavor = "multi_thread")] async fn subscribe_candlestick() { gen_test_subscribe_candlestick!(HuobiFutureWSClient, &[("BTC_CQ".to_string(), 60)]); - gen_test_subscribe_candlestick!( - HuobiFutureWSClient, - &[("BTC_CQ".to_string(), 2592000)] - ); + gen_test_subscribe_candlestick!(HuobiFutureWSClient, &[("BTC_CQ".to_string(), 2592000)]); } } @@ -210,10 +197,7 @@ mod huobi_linear_swap { #[tokio::test(flavor = "multi_thread")] async fn subscribe_candlestick() { - gen_test_subscribe_candlestick!( - HuobiLinearSwapWSClient, - &[("BTC-USDT".to_string(), 60)] - ); + gen_test_subscribe_candlestick!(HuobiLinearSwapWSClient, &[("BTC-USDT".to_string(), 60)]); gen_test_subscribe_candlestick!( HuobiLinearSwapWSClient, &[("BTC-USDT".to_string(), 2592000)] @@ -237,7 +221,9 @@ mod huobi_linear_swap { ws_client.close(); }); - rx.into_iter().next().expect("should has at least 1 element"); + rx.into_iter() + .next() + .expect("should has at least 1 element"); } #[tokio::test(flavor = "multi_thread")] @@ -257,7 +243,9 @@ mod huobi_linear_swap { ws_client.close(); }); - rx.into_iter().next().expect("should has at least 1 element"); + rx.into_iter() + .next() + .expect("should has at least 1 element"); } } @@ -321,10 +309,7 @@ mod huobi_inverse_swap { #[tokio::test(flavor = "multi_thread")] async fn subscribe_candlestick() { - gen_test_subscribe_candlestick!( - HuobiInverseSwapWSClient, - &[("BTC-USD".to_string(), 60)] - ); + gen_test_subscribe_candlestick!(HuobiInverseSwapWSClient, &[("BTC-USD".to_string(), 60)]); gen_test_subscribe_candlestick!( HuobiInverseSwapWSClient, &[("BTC-USD".to_string(), 2592000)] @@ -346,7 +331,9 @@ mod huobi_inverse_swap { ws_client.close(); }); - rx.into_iter().next().expect("should has at least 1 element"); + rx.into_iter() + .next() + .expect("should has at least 1 element"); } #[tokio::test(flavor = "multi_thread")] @@ -364,7 +351,9 @@ mod huobi_inverse_swap { ws_client.close(); }); - rx.into_iter().next().expect("should has at least 1 element"); + rx.into_iter() + .next() + .expect("should has at least 1 element"); } #[tokio::test(flavor = "multi_thread")] diff --git a/crypto-ws-client/tests/kraken.rs b/crypto-ws-client/tests/kraken.rs index 707767fb..7d506d35 100644 --- a/crypto-ws-client/tests/kraken.rs +++ b/crypto-ws-client/tests/kraken.rs @@ -10,10 +10,12 @@ mod kraken_spot { gen_test_code!( KrakenSpotWSClient, subscribe, - &[("trade".to_string(), "XBT/USD".to_string()), + &[ + ("trade".to_string(), "XBT/USD".to_string()), ("ticker".to_string(), "XBT/USD".to_string()), ("spread".to_string(), "XBT/USD".to_string()), - ("book".to_string(), "XBT/USD".to_string())] + ("book".to_string(), "XBT/USD".to_string()) + ] ); } @@ -22,8 +24,10 @@ mod kraken_spot { gen_test_code!( KrakenSpotWSClient, send, - &[r#"{"event":"subscribe","pair":["XBT/USD"],"subscription":{"name":"trade"}}"# - .to_string()] + &[ + r#"{"event":"subscribe","pair":["XBT/USD"],"subscription":{"name":"trade"}}"# + .to_string() + ] ); } @@ -72,8 +76,10 @@ mod kraken_spot { gen_test_subscribe_candlestick!( KrakenSpotWSClient, - &[("XBT/USD".to_string(), 1296000), - ("ETH/USD".to_string(), 1296000)] + &[ + ("XBT/USD".to_string(), 1296000), + ("ETH/USD".to_string(), 1296000) + ] ); } } @@ -128,8 +134,10 @@ mod kraken_inverse_future { gen_test_code!( KrakenFuturesWSClient, send, - &[r#"{"event":"subscribe","feed":"trade","product_ids":["FI_XBTUSD_220930"]}"# - .to_string()] + &[ + r#"{"event":"subscribe","feed":"trade","product_ids":["FI_XBTUSD_220930"]}"# + .to_string() + ] ); } diff --git a/crypto-ws-client/tests/kucoin.rs b/crypto-ws-client/tests/kucoin.rs index 10e4ff48..029e1667 100644 --- a/crypto-ws-client/tests/kucoin.rs +++ b/crypto-ws-client/tests/kucoin.rs @@ -43,11 +43,7 @@ mod kucoin_spot { #[tokio::test(flavor = "multi_thread")] async fn subscribe_bbo() { - gen_test_code!( - KuCoinSpotWSClient, - subscribe_bbo, - &["BTC-USDT".to_string()] - ); + gen_test_code!(KuCoinSpotWSClient, subscribe_bbo, &["BTC-USDT".to_string()]); } #[tokio::test(flavor = "multi_thread")] @@ -90,8 +86,10 @@ mod kucoin_spot { async fn subscribe_candlestick() { gen_test_subscribe_candlestick!( KuCoinSpotWSClient, - &[("BTC-USDT".to_string(), 60), - ("BTC-USDT".to_string(), 604800)] + &[ + ("BTC-USDT".to_string(), 60), + ("BTC-USDT".to_string(), 604800) + ] ); } } @@ -105,7 +103,8 @@ mod kucoin_inverse_swap { gen_test_code!( KuCoinSwapWSClient, subscribe, - &[( + &[ + ( "/contractMarket/execution".to_string(), "XBTUSDM".to_string() ), @@ -120,7 +119,8 @@ mod kucoin_inverse_swap { ( "/contractMarket/execution".to_string(), "XRPUSDM".to_string() - )] + ) + ] ); } @@ -138,20 +138,18 @@ mod kucoin_inverse_swap { gen_test_code!( KuCoinSwapWSClient, subscribe_trade, - &["XBTUSDM".to_string(), + &[ + "XBTUSDM".to_string(), "ETHUSDM".to_string(), "DOTUSDM".to_string(), - "XRPUSDM".to_string()] + "XRPUSDM".to_string() + ] ); } #[tokio::test(flavor = "multi_thread")] async fn subscribe_bbo() { - gen_test_code!( - KuCoinSwapWSClient, - subscribe_bbo, - &["XBTUSDM".to_string()] - ); + gen_test_code!(KuCoinSwapWSClient, subscribe_bbo, &["XBTUSDM".to_string()]); } #[tokio::test(flavor = "multi_thread")] @@ -195,10 +193,12 @@ mod kucoin_inverse_swap { async fn subscribe_candlestick() { gen_test_subscribe_candlestick!( KuCoinSwapWSClient, - &[("XBTUSDM".to_string(), 60), + &[ + ("XBTUSDM".to_string(), 60), ("ETHUSDM".to_string(), 60), ("XBTUSDM".to_string(), 604800), - ("ETHUSDM".to_string(), 604800)] + ("ETHUSDM".to_string(), 604800) + ] ); } } @@ -239,11 +239,7 @@ mod kucoin_linear_swap { #[tokio::test(flavor = "multi_thread")] async fn subscribe_bbo() { - gen_test_code!( - KuCoinSwapWSClient, - subscribe_bbo, - &["XBTUSDTM".to_string()] - ); + gen_test_code!(KuCoinSwapWSClient, subscribe_bbo, &["XBTUSDTM".to_string()]); } #[tokio::test(flavor = "multi_thread")] @@ -287,10 +283,12 @@ mod kucoin_linear_swap { async fn subscribe_candlestick() { gen_test_subscribe_candlestick!( KuCoinSwapWSClient, - &[("XBTUSDTM".to_string(), 60), + &[ + ("XBTUSDTM".to_string(), 60), ("ETHUSDTM".to_string(), 60), ("XBTUSDTM".to_string(), 604800), - ("ETHUSDTM".to_string(), 604800)] + ("ETHUSDTM".to_string(), 604800) + ] ); } } @@ -335,11 +333,7 @@ mod kucoin_inverse_future { #[ignore] #[tokio::test(flavor = "multi_thread")] async fn subscribe_bbo() { - gen_test_code!( - KuCoinSwapWSClient, - subscribe_bbo, - &["XBTMU22".to_string()] - ); + gen_test_code!(KuCoinSwapWSClient, subscribe_bbo, &["XBTMU22".to_string()]); } #[tokio::test(flavor = "multi_thread")] diff --git a/crypto-ws-client/tests/mexc.rs b/crypto-ws-client/tests/mexc.rs index 72134662..fe9e8a26 100644 --- a/crypto-ws-client/tests/mexc.rs +++ b/crypto-ws-client/tests/mexc.rs @@ -10,9 +10,11 @@ mod mexc_spot { gen_test_code!( MexcSpotWSClient, subscribe, - &[("deal".to_string(), "BTC_USDT".to_string()), + &[ + ("deal".to_string(), "BTC_USDT".to_string()), ("deal".to_string(), "ETH_USDT".to_string()), - ("deal".to_string(), "MX_USDT".to_string())] + ("deal".to_string(), "MX_USDT".to_string()) + ] ); } @@ -21,9 +23,11 @@ mod mexc_spot { gen_test_code!( MexcSpotWSClient, send, - &[r#"{"op":"sub.deal","symbol":"BTC_USDT"}"#.to_string(), + &[ + r#"{"op":"sub.deal","symbol":"BTC_USDT"}"#.to_string(), r#"{"op":"sub.deal","symbol":"ETH_USDT"}"#.to_string(), - r#"{"op":"sub.deal","symbol":"MX_USDT"}"#.to_string()] + r#"{"op":"sub.deal","symbol":"MX_USDT"}"#.to_string() + ] ); } @@ -32,9 +36,11 @@ mod mexc_spot { gen_test_code!( MexcSpotWSClient, subscribe_trade, - &["BTC_USDT".to_string(), + &[ + "BTC_USDT".to_string(), "ETH_USDT".to_string(), - "MX_USDT".to_string()] + "MX_USDT".to_string() + ] ); } @@ -43,9 +49,11 @@ mod mexc_spot { gen_test_code!( MexcSpotWSClient, subscribe_orderbook, - &["BTC_USDT".to_string(), + &[ + "BTC_USDT".to_string(), "ETH_USDT".to_string(), - "MX_USDT".to_string()] + "MX_USDT".to_string() + ] ); } @@ -62,15 +70,19 @@ mod mexc_spot { async fn subscribe_candlestick() { gen_test_subscribe_candlestick!( MexcSpotWSClient, - &[("BTC_USDT".to_string(), 60), + &[ + ("BTC_USDT".to_string(), 60), ("ETH_USDT".to_string(), 60), - ("MX_USDT".to_string(), 60)] + ("MX_USDT".to_string(), 60) + ] ); gen_test_subscribe_candlestick!( MexcSpotWSClient, - &[("BTC_USDT".to_string(), 2592000), + &[ + ("BTC_USDT".to_string(), 2592000), ("ETH_USDT".to_string(), 2592000), - ("MX_USDT".to_string(), 2592000)] + ("MX_USDT".to_string(), 2592000) + ] ); } @@ -93,8 +105,10 @@ mod mexc_linear_swap { gen_test_code!( MexcSwapWSClient, subscribe, - &[("deal".to_string(), "BTC_USDT".to_string()), - ("deal".to_string(), "ETH_USDT".to_string())] + &[ + ("deal".to_string(), "BTC_USDT".to_string()), + ("deal".to_string(), "ETH_USDT".to_string()) + ] ); } @@ -109,11 +123,7 @@ mod mexc_linear_swap { #[tokio::test(flavor = "multi_thread")] async fn subscribe_trade() { - gen_test_code!( - MexcSwapWSClient, - subscribe_trade, - &["BTC_USDT".to_string()] - ); + gen_test_code!(MexcSwapWSClient, subscribe_trade, &["BTC_USDT".to_string()]); } #[tokio::test(flavor = "multi_thread")] @@ -156,20 +166,12 @@ mod mexc_inverse_swap { #[tokio::test(flavor = "multi_thread")] async fn subscribe_trade() { - gen_test_code!( - MexcSwapWSClient, - subscribe_trade, - &["BTC_USD".to_string()] - ); + gen_test_code!(MexcSwapWSClient, subscribe_trade, &["BTC_USD".to_string()]); } #[tokio::test(flavor = "multi_thread")] async fn subscribe_ticker() { - gen_test_code!( - MexcSwapWSClient, - subscribe_ticker, - &["BTC_USD".to_string()] - ); + gen_test_code!(MexcSwapWSClient, subscribe_ticker, &["BTC_USD".to_string()]); } #[tokio::test(flavor = "multi_thread")] diff --git a/crypto-ws-client/tests/okx.rs b/crypto-ws-client/tests/okx.rs index 5d60f602..fd2163be 100644 --- a/crypto-ws-client/tests/okx.rs +++ b/crypto-ws-client/tests/okx.rs @@ -30,8 +30,10 @@ mod okx_spot { gen_test_code!( OkxWSClient, send, - &[r#"{"op":"subscribe","args":[{"channel":"trades","instId":"BTC-USDT"}]}"# - .to_string()] + &[ + r#"{"op":"subscribe","args":[{"channel":"trades","instId":"BTC-USDT"}]}"# + .to_string() + ] ); } @@ -52,11 +54,7 @@ mod okx_spot { #[tokio::test(flavor = "multi_thread")] async fn subscribe_orderbook() { - gen_test_code!( - OkxWSClient, - subscribe_orderbook, - &["BTC-USDT".to_string()] - ); + gen_test_code!(OkxWSClient, subscribe_orderbook, &["BTC-USDT".to_string()]); } #[tokio::test(flavor = "multi_thread")] @@ -108,11 +106,7 @@ mod okx_future { #[tokio::test(flavor = "multi_thread")] async fn subscribe_bbo() { - gen_test_code!( - OkxWSClient, - subscribe_bbo, - &["BTC-USDT-220930".to_string()] - ); + gen_test_code!(OkxWSClient, subscribe_bbo, &["BTC-USDT-220930".to_string()]); } #[tokio::test(flavor = "multi_thread")] @@ -136,10 +130,7 @@ mod okx_future { #[tokio::test(flavor = "multi_thread")] async fn subscribe_candlestick() { gen_test_subscribe_candlestick!(OkxWSClient, &[("BTC-USDT-220930".to_string(), 60)]); - gen_test_subscribe_candlestick!( - OkxWSClient, - &[("BTC-USDT-220930".to_string(), 604800)] - ); + gen_test_subscribe_candlestick!(OkxWSClient, &[("BTC-USDT-220930".to_string(), 604800)]); } } @@ -158,11 +149,7 @@ mod okx_swap { #[tokio::test(flavor = "multi_thread")] async fn subscribe_trade() { - gen_test_code!( - OkxWSClient, - subscribe_trade, - &["BTC-USDT-SWAP".to_string()] - ); + gen_test_code!(OkxWSClient, subscribe_trade, &["BTC-USDT-SWAP".to_string()]); } #[tokio::test(flavor = "multi_thread")] @@ -176,11 +163,7 @@ mod okx_swap { #[tokio::test(flavor = "multi_thread")] async fn subscribe_bbo() { - gen_test_code!( - OkxWSClient, - subscribe_bbo, - &["BTC-USDT-SWAP".to_string()] - ); + gen_test_code!(OkxWSClient, subscribe_bbo, &["BTC-USDT-SWAP".to_string()]); } #[tokio::test(flavor = "multi_thread")] @@ -270,10 +253,7 @@ mod okx_option { #[tokio::test(flavor = "multi_thread")] #[ignore = "lack of liquidity"] async fn subscribe_candlestick() { - gen_test_subscribe_candlestick!( - OkxWSClient, - &[("BTC-USD-220930-50000-C".to_string(), 60)] - ); + gen_test_subscribe_candlestick!(OkxWSClient, &[("BTC-USD-220930-50000-C".to_string(), 60)]); gen_test_subscribe_candlestick!( OkxWSClient, &[("BTC-USD-220930-50000-C".to_string(), 604800)] diff --git a/crypto-ws-client/tests/zb.rs b/crypto-ws-client/tests/zb.rs index b8d0a96a..c00ddcbc 100644 --- a/crypto-ws-client/tests/zb.rs +++ b/crypto-ws-client/tests/zb.rs @@ -25,11 +25,7 @@ mod zb_spot { #[tokio::test(flavor = "multi_thread")] async fn subscribe_trade() { - gen_test_code!( - ZbSpotWSClient, - subscribe_trade, - &["btc_usdt".to_string()] - ); + gen_test_code!(ZbSpotWSClient, subscribe_trade, &["btc_usdt".to_string()]); } #[tokio::test(flavor = "multi_thread")] @@ -43,11 +39,7 @@ mod zb_spot { #[tokio::test(flavor = "multi_thread")] async fn subscribe_ticker() { - gen_test_code!( - ZbSpotWSClient, - subscribe_ticker, - &["btc_usdt".to_string()] - ); + gen_test_code!(ZbSpotWSClient, subscribe_ticker, &["btc_usdt".to_string()]); } #[tokio::test(flavor = "multi_thread")] @@ -66,8 +58,10 @@ mod zb_linear_swap { gen_test_code!( ZbSwapWSClient, subscribe, - &[("Trade".to_string(), "BTC_USDT".to_string()), - ("Depth".to_string(), "BTC_USDT".to_string())] + &[ + ("Trade".to_string(), "BTC_USDT".to_string()), + ("Depth".to_string(), "BTC_USDT".to_string()) + ] ); } @@ -76,8 +70,10 @@ mod zb_linear_swap { gen_test_code!( ZbSwapWSClient, send, - &[r#"{"action":"subscribe", "channel":"BTC_USDT.Trade", "size":100}"#.to_string(), - r#"{"action":"subscribe", "channel":"BTC_USDT.Depth", "size":200}"#.to_string()] + &[ + r#"{"action":"subscribe", "channel":"BTC_USDT.Trade", "size":100}"#.to_string(), + r#"{"action":"subscribe", "channel":"BTC_USDT.Depth", "size":200}"#.to_string() + ] ); } diff --git a/crypto-ws-client/tests/zbg.rs b/crypto-ws-client/tests/zbg.rs index f8fd1b6d..3a7053a1 100644 --- a/crypto-ws-client/tests/zbg.rs +++ b/crypto-ws-client/tests/zbg.rs @@ -25,11 +25,7 @@ mod zbg_spot { #[tokio::test(flavor = "multi_thread")] async fn subscribe_trade() { - gen_test_code!( - ZbgSpotWSClient, - subscribe_trade, - &["btc_usdt".to_string()] - ); + gen_test_code!(ZbgSpotWSClient, subscribe_trade, &["btc_usdt".to_string()]); } #[tokio::test(flavor = "multi_thread")] @@ -43,11 +39,7 @@ mod zbg_spot { #[tokio::test(flavor = "multi_thread")] async fn subscribe_ticker() { - gen_test_code!( - ZbgSpotWSClient, - subscribe_ticker, - &["btc_usdt".to_string()] - ); + gen_test_code!(ZbgSpotWSClient, subscribe_ticker, &["btc_usdt".to_string()]); } #[ignore] @@ -77,8 +69,10 @@ mod zbg_inverse_swap { gen_test_code!( ZbgSwapWSClient, subscribe, - &[("future_tick".to_string(), "1000001".to_string()), - ("future_tick".to_string(), "1000003".to_string())] + &[ + ("future_tick".to_string(), "1000001".to_string()), + ("future_tick".to_string(), "1000003".to_string()) + ] ); } @@ -88,8 +82,10 @@ mod zbg_inverse_swap { gen_test_code!( ZbgSwapWSClient, send, - &[r#"{"action":"sub", "topic":"future_tick-1000001"}"#.to_string(), - r#"{"action":"sub", "topic":"future_tick-1000003"}"#.to_string()] + &[ + r#"{"action":"sub", "topic":"future_tick-1000001"}"#.to_string(), + r#"{"action":"sub", "topic":"future_tick-1000003"}"#.to_string() + ] ); } @@ -142,8 +138,10 @@ mod zbg_inverse_swap { ); gen_test_subscribe_candlestick!( ZbgSwapWSClient, - &[("BTC_USD-R".to_string(), 604800), - ("ETH_USD-R".to_string(), 604800)] + &[ + ("BTC_USD-R".to_string(), 604800), + ("ETH_USD-R".to_string(), 604800) + ] ); } } @@ -158,8 +156,10 @@ mod zbg_linear_swap { gen_test_code!( ZbgSwapWSClient, subscribe, - &[("future_tick".to_string(), "1000000".to_string()), - ("future_tick".to_string(), "1000002".to_string())] + &[ + ("future_tick".to_string(), "1000000".to_string()), + ("future_tick".to_string(), "1000002".to_string()) + ] ); } @@ -169,8 +169,10 @@ mod zbg_linear_swap { gen_test_code!( ZbgSwapWSClient, send, - &[r#"{"action":"sub", "topic":"future_tick-1000000"}"#.to_string(), - r#"{"action":"sub", "topic":"future_tick-1000002"}"#.to_string()] + &[ + r#"{"action":"sub", "topic":"future_tick-1000000"}"#.to_string(), + r#"{"action":"sub", "topic":"future_tick-1000002"}"#.to_string() + ] ); } @@ -223,8 +225,10 @@ mod zbg_linear_swap { ); gen_test_subscribe_candlestick!( ZbgSwapWSClient, - &[("BTC_USDT".to_string(), 604800), - ("ETH_USDT".to_string(), 604800)] + &[ + ("BTC_USDT".to_string(), 604800), + ("ETH_USDT".to_string(), 604800) + ] ); } }