gate_handle_test.rs 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. // mod exchange_test;
  2. //
  3. // use std::collections::BTreeMap;
  4. // use tracing::{instrument, trace};
  5. // use exchanges::gate_swap_rest::GateSwapRest;
  6. // use exchanges::gate_swap_ws::GateSwapSubscribeType;
  7. // use standard::exchange::ExchangeEnum;
  8. // use crate::exchange_test::{test_new_exchange_wss};
  9. //
  10. // const SYMBOL: &str = "BTC_USDT";
  11. //
  12. // async fn get_user_id() -> String {
  13. // let account_info = global::account_info::get_account_info("../test_account.toml");
  14. // let mut params: BTreeMap<String, String> = BTreeMap::new();
  15. // let access_key = account_info.gate_access_key;
  16. // let secret_key = account_info.gate_secret_key;
  17. // params.insert("access_key".to_string(), access_key);
  18. // params.insert("secret_key".to_string(), secret_key);
  19. //
  20. // let mut gate_request = GateSwapRest::new(false, params);
  21. // let res_data = gate_request.wallet_fee().await;
  22. // if res_data.code == "200" {
  23. // let res_data_json: serde_json::Value = serde_json::from_str(&res_data.data).unwrap();
  24. // res_data_json["user_id"].to_string()
  25. // } else {
  26. // "".to_string()
  27. // }
  28. // }
  29. //
  30. // // 测试订阅深度订阅
  31. // #[tokio::test(flavor = "multi_thread", worker_threads = 4)]
  32. // #[instrument(level = "TRACE")]
  33. // async fn test_get_wss_depth() {
  34. // global::log_utils::init_log_with_trace();
  35. //
  36. // let gate_subscribe_type = vec![
  37. // GateSwapSubscribeType::PuFuturesOrderBook
  38. // ];
  39. // test_new_exchange_wss(ExchangeEnum::GateSwap, SYMBOL, gate_subscribe_type, "depth").await;
  40. // }
  41. //
  42. // // 测试订阅Ticker信息
  43. // #[tokio::test(flavor = "multi_thread", worker_threads = 4)]
  44. // #[instrument(level = "TRACE")]
  45. // async fn test_get_wss_ticker() {
  46. // global::log_utils::init_log_with_trace();
  47. //
  48. // let gate_subscribe_type = vec![
  49. // GateSwapSubscribeType::PuFuturesOrderBook
  50. // ];
  51. // test_new_exchange_wss(ExchangeEnum::GateSwap, SYMBOL, gate_subscribe_type, "ticker").await;
  52. // }
  53. //
  54. // // 测试订阅Account信息
  55. // #[tokio::test(flavor = "multi_thread", worker_threads = 4)]
  56. // #[instrument(level = "TRACE")]
  57. // async fn test_get_wss_account() {
  58. // global::log_utils::init_log_with_trace();
  59. //
  60. // let user_id = get_user_id().await;
  61. // trace!(?user_id);
  62. // let gate_subscribe_type = vec![
  63. // GateSwapSubscribeType::PrFuturesBalances(user_id)
  64. // ];
  65. // test_new_exchange_wss(ExchangeEnum::GateSwap, SYMBOL, gate_subscribe_type, "account").await;
  66. // }
  67. //
  68. // // 测试订阅Position信息
  69. // #[tokio::test(flavor = "multi_thread", worker_threads = 4)]
  70. // #[instrument(level = "TRACE")]
  71. // async fn test_get_wss_position() {
  72. // global::log_utils::init_log_with_trace();
  73. //
  74. // let user_id = get_user_id().await;
  75. // let gate_subscribe_type = vec![
  76. // GateSwapSubscribeType::PrFuturesPositions(user_id)
  77. // ];
  78. // test_new_exchange_wss(ExchangeEnum::GateSwap, SYMBOL, gate_subscribe_type, "position").await;
  79. // }
  80. //
  81. // // 测试订阅Orders信息
  82. // #[tokio::test(flavor = "multi_thread", worker_threads = 4)]
  83. // #[instrument(level = "TRACE")]
  84. // async fn test_get_wss_orders() {
  85. // global::log_utils::init_log_with_trace();
  86. //
  87. // let user_id = get_user_id().await;
  88. // let gate_subscribe_type = vec![
  89. // GateSwapSubscribeType::PrFuturesOrders(user_id)
  90. // ];
  91. // test_new_exchange_wss(ExchangeEnum::GateSwap, SYMBOL, gate_subscribe_type, "orders").await;
  92. // }