| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- mod exchange_test;
- use tracing::instrument;
- use exchanges::binance_swap_ws::BinanceSwapSubscribeType;
- use standard::exchange::ExchangeEnum;
- use crate::exchange_test::test_new_exchange_wss;
- const SYMBOL: &str = "BTC_USDT";
- // 测试订阅深度信息
- #[tokio::test(flavor = "multi_thread", worker_threads = 4)]
- #[instrument(level = "TRACE")]
- async fn test_get_wss_depth() {
- global::log_utils::init_log_with_trace();
- let binance_subscribe_type = vec![
- BinanceSwapSubscribeType::PuDepth20levels100ms,
- ];
- test_new_exchange_wss(ExchangeEnum::BinanceSwap, SYMBOL, binance_subscribe_type, "depth").await;
- }
- // 测试订阅Ticker信息
- #[tokio::test(flavor = "multi_thread", worker_threads = 4)]
- #[instrument(level = "TRACE")]
- async fn test_get_wss_ticker() {
- global::log_utils::init_log_with_trace();
- let binance_subscribe_type = vec![
- BinanceSwapSubscribeType::PuBookTicker,
- ];
- test_new_exchange_wss(ExchangeEnum::BinanceSwap, SYMBOL, binance_subscribe_type, "ticker").await;
- }
- // 测试订阅Trade信息
- #[tokio::test(flavor = "multi_thread", worker_threads = 4)]
- #[instrument(level = "TRACE")]
- async fn test_get_wss_trade() {
- global::log_utils::init_log_with_trace();
- let binance_subscribe_type = vec![
- BinanceSwapSubscribeType::PuAggTrade,
- ];
- test_new_exchange_wss(ExchangeEnum::BinanceSwap, SYMBOL, binance_subscribe_type, "trade").await;
- }
- // // 测试订阅Record信息
- // #[tokio::test(flavor = "multi_thread", worker_threads = 4)]
- // #[instrument(level = "TRACE")]
- // async fn test_get_wss_record() {
- // global::log_utils::init_log_with_trace();
- //
- // let binance_subscribe_type = vec![
- // BinanceSwapSubscribeType::PuDepth20levels100ms,
- // ];
- // test_new_exchange_wss(ExchangeEnum::BinanceSwap, SYMBOL, binance_subscribe_type, "record").await;
- // }
- // 测试订阅Account信息
- #[tokio::test(flavor = "multi_thread", worker_threads = 4)]
- #[instrument(level = "TRACE")]
- async fn test_get_wss_account() {
- global::log_utils::init_log_with_trace();
- let binance_subscribe_type = vec![
- BinanceSwapSubscribeType::PrBalance,
- ];
- test_new_exchange_wss(ExchangeEnum::BinanceSwap, SYMBOL, binance_subscribe_type, "account").await;
- }
- // 测试订阅Order信息
- #[tokio::test(flavor = "multi_thread", worker_threads = 4)]
- #[instrument(level = "TRACE")]
- async fn test_get_wss_order() {
- global::log_utils::init_log_with_trace();
- let binance_subscribe_type = vec![
- BinanceSwapSubscribeType::PrAccount,
- ];
- test_new_exchange_wss(ExchangeEnum::BinanceSwap, SYMBOL, binance_subscribe_type, "order").await;
- }
- // 测试订阅Position信息
- #[tokio::test(flavor = "multi_thread", worker_threads = 4)]
- #[instrument(level = "TRACE")]
- async fn test_get_wss_position() {
- global::log_utils::init_log_with_trace();
- let binance_subscribe_type = vec![
- BinanceSwapSubscribeType::PrPosition,
- ];
- test_new_exchange_wss(ExchangeEnum::BinanceSwap, SYMBOL, binance_subscribe_type, "position").await;
- }
|