mod exchange_test; use tracing::{instrument}; use exchanges::okx_swap_ws::OkxSwapSubscribeType; 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 okx_subscribe_type = vec![ OkxSwapSubscribeType::PuBooks5 ]; test_new_exchange_wss(ExchangeEnum::OkxSwap, SYMBOL, okx_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 okx_subscribe_type = vec![ OkxSwapSubscribeType::PuBooks5 ]; test_new_exchange_wss(ExchangeEnum::OkxSwap, SYMBOL, okx_subscribe_type, "ticker").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 okx_subscribe_type = vec![ OkxSwapSubscribeType::PrAccount("USDT".to_string()) ]; test_new_exchange_wss(ExchangeEnum::OkxSwap, SYMBOL, okx_subscribe_type, "account").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 okx_subscribe_type = vec![ OkxSwapSubscribeType::PrPositions ]; test_new_exchange_wss(ExchangeEnum::OkxSwap, SYMBOL, okx_subscribe_type, "position").await; } // 测试订阅Orders信息 #[tokio::test(flavor = "multi_thread", worker_threads = 4)] #[instrument(level = "TRACE")] async fn test_get_wss_orders() { global::log_utils::init_log_with_trace(); let okx_subscribe_type = vec![ OkxSwapSubscribeType::PrOrders ]; test_new_exchange_wss(ExchangeEnum::OkxSwap, SYMBOL, okx_subscribe_type, "orders").await; }