| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- 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;
- }
|