فهرست منبع

exchange添加marker西悉尼

gepangpang 2 سال پیش
والد
کامیت
4d594932fa

+ 1 - 1
standard/Cargo.toml

@@ -16,4 +16,4 @@ rust_decimal_macros = "1.32.0"
 chrono = "0.4.30"
 futures = "0.3"
 tracing = "0.1"
-tracing-subscriber = "0.3.17"
+tracing-subscriber = { version = "0.3.17", features = ["env-filter"] }

+ 2 - 0
standard/src/binance_spot.rs

@@ -47,6 +47,8 @@ impl Platform for BinanceSpot {
         self.params.clone()
     }
 
+    fn get_self_market(&self) -> Market { todo!() }
+
     async fn get_server_time(&self) -> Result<String, Error> {
         todo!()
     }

+ 5 - 4
standard/src/binance_swap.rs

@@ -20,7 +20,7 @@ pub struct BinanceSwap {
 }
 
 impl BinanceSwap {
-    pub fn new(symbol: String, is_colo: bool, params: BTreeMap<String, String>) -> BinanceSwap {
+    pub async fn new(symbol: String, is_colo: bool, params: BTreeMap<String, String>) -> BinanceSwap {
         BinanceSwap {
             exchange: ExchangeEnum::BinanceSwap,
             symbol,
@@ -47,6 +47,9 @@ impl Platform for BinanceSwap {
     fn get_self_params(&self) -> BTreeMap<String, String> {
         self.params.clone()
     }
+    // 获取market信息
+    fn get_self_market(&self) -> Market { todo!() }
+
     // 获取服务器时间
     async fn get_server_time(&self) -> Result<String, Error> {
         todo!()
@@ -91,9 +94,7 @@ impl Platform for BinanceSwap {
         todo!()
     }
 
-    async fn get_market(&self) -> Result<Market, Error> {
-        todo!()
-    }
+    async fn get_market(&self) -> Result<Market, Error> { todo!() }
 
     async fn get_order_detail(&self, _order_id: &str, _custom_id: &str) -> Result<Order, Error> { todo!() }
 

+ 4 - 4
standard/src/exchange.rs

@@ -53,22 +53,22 @@ pub enum ExchangeEnum {
 pub struct Exchange;
 
 impl Exchange {
-    pub fn new(exchange: ExchangeEnum, symbol: String, is_colo: bool, params: BTreeMap<String, String>) -> Box<dyn Platform + Send + Sync> {
+    pub async fn new(exchange: ExchangeEnum, symbol: String, is_colo: bool, params: BTreeMap<String, String>) -> Box<dyn Platform + Send + Sync> {
         match exchange {
             ExchangeEnum::BinanceSwap => {
-                Box::new(BinanceSwap::new(symbol, is_colo, params))
+                Box::new(BinanceSwap::new(symbol, is_colo, params).await)
             }
             ExchangeEnum::BinanceSpot => {
                 Box::new(BinanceSpot::new(symbol, is_colo, params))
             }
             ExchangeEnum::GateSwap => {
-                Box::new(GateSwap::new(symbol, is_colo, params))
+                Box::new(GateSwap::new(symbol, is_colo, params).await)
             }
             ExchangeEnum::GateSpot => {
                 Box::new(GateSpot::new(symbol, is_colo, params))
             }
             ExchangeEnum::KucoinSwap => {
-                Box::new(KucoinSwap::new(symbol, is_colo, params))
+                Box::new(KucoinSwap::new(symbol, is_colo, params).await)
             }
         }
     }

+ 2 - 0
standard/src/gate_spot.rs

@@ -45,6 +45,8 @@ impl Platform for GateSpot {
         self.params.clone()
     }
 
+    fn get_self_market(&self) -> Market { todo!() }
+
     async fn get_server_time(&self) -> Result<String, Error> {
         todo!()
     }

+ 13 - 7
standard/src/gate_swap.rs

@@ -20,17 +20,22 @@ pub struct GateSwap {
     is_colo: bool,
     params: BTreeMap<String, String>,
     request: GateSwapRest,
+    market: Market,
 }
 
 impl GateSwap {
-    pub fn new(symbol: String, is_colo: bool, params: BTreeMap<String, String>) -> GateSwap {
-        GateSwap {
+    pub async fn new(symbol: String, is_colo: bool, params: BTreeMap<String, String>) -> GateSwap {
+        let market = Market::new();
+        let mut gate_swap = GateSwap {
             exchange: ExchangeEnum::GateSwap,
             symbol,
             is_colo,
             params: params.clone(),
             request: GateSwapRest::new(is_colo, params.clone()),
-        }
+            market,
+        };
+        gate_swap.market = GateSwap::get_market(&gate_swap).await.unwrap_or(gate_swap.market);
+        return gate_swap;
     }
 }
 
@@ -50,6 +55,9 @@ impl Platform for GateSwap {
     fn get_self_params(&self) -> BTreeMap<String, String> {
         self.params.clone()
     }
+    // 获取market信息
+    fn get_self_market(&self) -> Market { self.market.clone() }
+
     // 获取服务器时间
     async fn get_server_time(&self) -> Result<String, Error> {
         let res_data = self.request.get_server_time().await;
@@ -239,7 +247,7 @@ impl Platform for GateSwap {
             "contract": self.symbol.to_string(),
             "price": price.to_string(),
         });
-        let size = amount;
+        let size = (amount / self.market.amount_size).floor();
         if price.eq(&dec!(0)) {
             params["tif"] = json!("ioc".to_string());
         }
@@ -332,17 +340,15 @@ impl Platform for GateSwap {
         let mut limits = HashMap::new();
         limits.extend(order_command.limits_open);
         limits.extend(order_command.limits_close);
-        let market = self.get_market().await.unwrap();
         for item in limits.keys() {
             let self_clone = self.clone();
             let limits_clone = limits.clone();
             let item_clone = item.clone();
-            let market_clone = market.clone();
             let result_sd = order_sender.clone();
             let err_sd = error_sender.clone();
             let handle = tokio::spawn(async move {
                 let value = limits_clone[&item_clone].clone();
-                let amount = (Decimal::from_str(value.get(0).unwrap_or(&"0".to_string())).unwrap() / market_clone.amount_size).floor();
+                let amount = Decimal::from_str(value.get(0).unwrap_or(&"0".to_string())).unwrap();
                 let side = value.get(1).unwrap();
                 let price = Decimal::from_str(value.get(2).unwrap_or(&"0".to_string())).unwrap();
                 let cid = value.get(3).unwrap();

+ 12 - 8
standard/src/kucoin_swap.rs

@@ -21,17 +21,22 @@ pub struct KucoinSwap {
     is_colo: bool,
     params: BTreeMap<String, String>,
     request: KucoinSwapRest,
+    market: Market,
 }
 
 impl KucoinSwap {
-    pub fn new(symbol: String, is_colo: bool, params: BTreeMap<String, String>) -> KucoinSwap {
-        KucoinSwap {
+    pub async fn new(symbol: String, is_colo: bool, params: BTreeMap<String, String>) -> KucoinSwap {
+        let market = Market::new();
+        let mut kucoin_swap = KucoinSwap {
             exchange: ExchangeEnum::KucoinSwap,
             symbol,
             is_colo,
             params: params.clone(),
             request: KucoinSwapRest::new(is_colo, params.clone()),
-        }
+            market,
+        };
+        kucoin_swap.market = KucoinSwap::get_market(&kucoin_swap).await.unwrap_or(kucoin_swap.market);
+        return kucoin_swap;
     }
 }
 
@@ -50,7 +55,8 @@ impl Platform for KucoinSwap {
     fn get_self_params(&self) -> BTreeMap<String, String> {
         self.params.clone()
     }
-
+    // 获取market信息
+    fn get_self_market(&self) -> Market { self.market.clone() }
     // 获取服务器时间
     async fn get_server_time(&self) -> Result<String, Error> {
         let res_data = self.request.get_server_time().await;
@@ -213,7 +219,7 @@ impl Platform for KucoinSwap {
             "leverage": "10",
             "price": price.to_string(),
         });
-        let size = amount;
+        let size = (amount / self.market.amount_size).floor();
         params["size"] = json!(size);
         match origin_side {
             "kd" => {
@@ -288,17 +294,15 @@ impl Platform for KucoinSwap {
         let mut limits = HashMap::new();
         limits.extend(order_command.limits_open);
         limits.extend(order_command.limits_close);
-        let market = self.get_market().await.unwrap();
         for item in limits.keys() {
             let self_clone = self.clone();
             let limits_clone = limits.clone();
             let item_clone = item.clone();
-            let market_clone = market.clone();
             let result_sd = order_sender.clone();
             let err_sd = error_sender.clone();
             let handle = tokio::spawn(async move {
                 let value = limits_clone[&item_clone].clone();
-                let amount = (Decimal::from_str(value.get(0).unwrap_or(&"0".to_string())).unwrap() / market_clone.amount_size).floor();
+                let amount = Decimal::from_str(value.get(0).unwrap_or(&"0".to_string())).unwrap();
                 let side = value.get(1).unwrap();
                 let price = Decimal::from_str(value.get(2).unwrap_or(&"0".to_string())).unwrap();
                 let cid = value.get(3).unwrap();

+ 33 - 0
standard/src/lib.rs

@@ -87,6 +87,19 @@ pub struct Account {
     pub frozen_stocks: Decimal,
 }
 
+impl Account {
+    pub fn new() -> Account {
+        Account {
+            balance: Default::default(),
+            available_balance: Default::default(),
+            frozen_balance: Default::default(),
+            stocks: Default::default(),
+            available_stocks: Default::default(),
+            frozen_stocks: Default::default(),
+        }
+    }
+}
+
 /// Depth结构体(市场深度)
 /// - `time(i64)`: 深度更新时间戳(ms);
 /// - `asks(Vec<MarketOrder>)`: 卖方深度列表;
@@ -222,6 +235,24 @@ pub struct Market {
     pub max_notional: Decimal,
     pub ct_val: Decimal,
 }
+impl Market{
+    pub fn new()->Market{
+        Market{
+            symbol: "".to_string(),
+            base_asset: "".to_string(),
+            quote_asset: "".to_string(),
+            tick_size: Default::default(),
+            amount_size: Default::default(),
+            price_precision: Default::default(),
+            amount_precision: Default::default(),
+            min_qty: Default::default(),
+            max_qty: Default::default(),
+            min_notional: Default::default(),
+            max_notional: Default::default(),
+            ct_val: Default::default(),
+        }
+    }
+}
 
 /// Position结构体(仓位信息)
 /// - `symbol(String)`: 币对
@@ -338,6 +369,8 @@ pub trait Platform {
     fn get_self_is_colo(&self) -> bool;
     // 获取登录params信息
     fn get_self_params(&self) -> BTreeMap<String, String>;
+    // 获取market信息
+    fn get_self_market(&self) -> Market;
     // 获取服务器时间
     async fn get_server_time(&self) -> Result<String, Error>;
     // 获取账号信息

+ 34 - 30
standard/tests/libs_test.rs

@@ -8,8 +8,7 @@ use standard::utils;
 use standard::exchange::{Exchange, ExchangeEnum};
 
 // 创建交易所实体方法
-#[instrument(skip(exchange), level = "TRACE")]
-fn test_new_exchange(exchange: ExchangeEnum) -> Box<dyn Platform> {
+async fn test_new_exchange(exchange: ExchangeEnum) -> Box<dyn Platform> {
     if proxy::ParsingDetail::http_enable_proxy() {
         trace!("检测有代理配置,配置走代理");
     }
@@ -20,7 +19,7 @@ fn test_new_exchange(exchange: ExchangeEnum) -> Box<dyn Platform> {
             let secret_key = env::var("binance_secret_key").unwrap_or("".to_string());
             params.insert("access_key".to_string(), access_key);
             params.insert("secret_key".to_string(), secret_key);
-            Exchange::new(exchange, "ROSE_USDT".to_string(), false, params)
+            Exchange::new(exchange, "ROSE_USDT".to_string(), false, params).await
         }
         ExchangeEnum::BinanceSpot => {
             let mut params: BTreeMap<String, String> = BTreeMap::new();
@@ -28,7 +27,7 @@ fn test_new_exchange(exchange: ExchangeEnum) -> Box<dyn Platform> {
             let secret_key = env::var("binance_secret_key").unwrap_or("".to_string());
             params.insert("access_key".to_string(), access_key);
             params.insert("secret_key".to_string(), secret_key);
-            Exchange::new(exchange, "ROSE_USDT".to_string(), false, params)
+            Exchange::new(exchange, "ROSE_USDT".to_string(), false, params).await
         }
         ExchangeEnum::GateSwap => {
             let mut params: BTreeMap<String, String> = BTreeMap::new();
@@ -36,7 +35,7 @@ fn test_new_exchange(exchange: ExchangeEnum) -> Box<dyn Platform> {
             let secret_key = env::var("gate_secret_key").unwrap_or("".to_string());
             params.insert("access_key".to_string(), access_key);
             params.insert("secret_key".to_string(), secret_key);
-            Exchange::new(exchange, "ROSE_USDT".to_string(), false, params)
+            Exchange::new(exchange, "ROSE_USDT".to_string(), false, params).await
         }
         ExchangeEnum::GateSpot => {
             let mut params: BTreeMap<String, String> = BTreeMap::new();
@@ -44,7 +43,7 @@ fn test_new_exchange(exchange: ExchangeEnum) -> Box<dyn Platform> {
             let secret_key = env::var("gate_secret_key").unwrap_or("".to_string());
             params.insert("access_key".to_string(), access_key);
             params.insert("secret_key".to_string(), secret_key);
-            Exchange::new(exchange, "ROSE_USDT".to_string(), false, params)
+            Exchange::new(exchange, "ROSE_USDT".to_string(), false, params).await
         }
         ExchangeEnum::KucoinSwap => {
             let mut params: BTreeMap<String, String> = BTreeMap::new();
@@ -54,7 +53,7 @@ fn test_new_exchange(exchange: ExchangeEnum) -> Box<dyn Platform> {
             params.insert("access_key".to_string(), access_key);
             params.insert("secret_key".to_string(), secret_key);
             params.insert("pass_key".to_string(), pass_key);
-            Exchange::new(exchange, "ROSE_USDT".to_string(), false, params)
+            Exchange::new(exchange, "ROSE_USDT".to_string(), false, params).await
         }
     }
 }
@@ -65,7 +64,7 @@ fn test_new_exchange(exchange: ExchangeEnum) -> Box<dyn Platform> {
 async fn test_binance_swap_account() {
     global::log_utils::init_log_with_trace();
 
-    let binance_swap_exchange = test_new_exchange(ExchangeEnum::BinanceSwap);
+    let binance_swap_exchange = test_new_exchange(ExchangeEnum::BinanceSwap).await;
     let self_exchange = binance_swap_exchange.get_self_exchange();
     let self_is_colo = binance_swap_exchange.get_self_is_colo();
     let self_params = binance_swap_exchange.get_self_params();
@@ -79,7 +78,7 @@ async fn test_binance_swap_account() {
 async fn test_binance_spot_account() {
     global::log_utils::init_log_with_trace();
 
-    let binance_spot_exchange = test_new_exchange(ExchangeEnum::BinanceSpot);
+    let binance_spot_exchange = test_new_exchange(ExchangeEnum::BinanceSpot).await;
     let self_exchange = binance_spot_exchange.get_self_exchange();
     let self_is_colo = binance_spot_exchange.get_self_is_colo();
     let self_params = binance_spot_exchange.get_self_params();
@@ -90,20 +89,25 @@ async fn test_binance_spot_account() {
 
 // 测试获取Gate交易所期货实体
 #[tokio::test]
+#[instrument(level = "TRACE")]
 async fn test_gate_swap_account() {
-    let gate_swap_exchange = test_new_exchange(ExchangeEnum::GateSwap);
+    global::log_utils::init_log_with_trace();
+
+    let gate_swap_exchange = test_new_exchange(ExchangeEnum::GateSwap).await;
     let self_exchange = gate_swap_exchange.get_self_exchange();
     let self_is_colo = gate_swap_exchange.get_self_is_colo();
     let self_params = gate_swap_exchange.get_self_params();
+    let self_market = gate_swap_exchange.get_self_market();
     trace!(?self_exchange);
     trace!(?self_is_colo);
     trace!(?self_params);
+    trace!(?self_market);
 }
 
 // 测试获取Gate交易所现货实体
 #[tokio::test]
 async fn test_gate_spot_account() {
-    let gate_spot_exchange = test_new_exchange(ExchangeEnum::GateSpot);
+    let gate_spot_exchange = test_new_exchange(ExchangeEnum::GateSpot).await;
     println!("exchange: {:?}", gate_spot_exchange.get_self_exchange());
     println!("is_colo: {:?}", gate_spot_exchange.get_self_is_colo());
     println!("params: {:?}", gate_spot_exchange.get_self_params());
@@ -112,7 +116,7 @@ async fn test_gate_spot_account() {
 // 测试获取Gate交易所现货实体
 #[tokio::test]
 async fn test_kucoin_swap_account() {
-    let kucoin_swap_exchange = test_new_exchange(ExchangeEnum::KucoinSwap);
+    let kucoin_swap_exchange = test_new_exchange(ExchangeEnum::KucoinSwap).await;
     println!("exchange: {:?}", kucoin_swap_exchange.get_self_exchange());
     println!("is_colo: {:?}", kucoin_swap_exchange.get_self_is_colo());
     println!("params: {:?}", kucoin_swap_exchange.get_self_params());
@@ -127,115 +131,115 @@ async fn test_replace_symbol() {
 // 测试Binance期货K线推送
 #[tokio::test]
 async fn test_get_account() {
-    let binance_swap_exchange: Box<dyn Platform> = test_new_exchange(ExchangeEnum::BinanceSwap);
+    let binance_swap_exchange: Box<dyn Platform> = test_new_exchange(ExchangeEnum::BinanceSwap).await;
     println!("binance_swap account:{:?}", binance_swap_exchange.get_account().await);
-    let gate_swap_exchange: Box<dyn Platform> = test_new_exchange(ExchangeEnum::GateSwap);
+    let gate_swap_exchange: Box<dyn Platform> = test_new_exchange(ExchangeEnum::GateSwap).await;
     println!("gate_swap account:{:?}", gate_swap_exchange.get_account().await);
-    let kucoin_swap_exchange: Box<dyn Platform> = test_new_exchange(ExchangeEnum::KucoinSwap);
+    let kucoin_swap_exchange: Box<dyn Platform> = test_new_exchange(ExchangeEnum::KucoinSwap).await;
     println!("kucoin_swap account:{:?}", kucoin_swap_exchange.get_account().await);
 }
 
 // 测试Gate 获取持仓信息
 #[tokio::test]
 async fn test_gate_swap_get_position() {
-    let gate_swap_exchange: Box<dyn Platform> = test_new_exchange(ExchangeEnum::GateSwap);
+    let gate_swap_exchange: Box<dyn Platform> = test_new_exchange(ExchangeEnum::GateSwap).await;
     println!("gate_swap get_position:{:?}", gate_swap_exchange.get_position().await);
 }
 
 // 测试Gate 获取所有持仓信息
 #[tokio::test]
 async fn test_gate_swap_get_positions() {
-    let gate_swap_exchange: Box<dyn Platform> = test_new_exchange(ExchangeEnum::GateSwap);
+    let gate_swap_exchange: Box<dyn Platform> = test_new_exchange(ExchangeEnum::GateSwap).await;
     println!("gate_swap get_positions:{:?}", gate_swap_exchange.get_positions().await);
 }
 
 // 测试Gate获取Ticker信息
 #[tokio::test]
 async fn test_gate_swap_get_ticker() {
-    let gate_swap_exchange: Box<dyn Platform> = test_new_exchange(ExchangeEnum::GateSwap);
+    let gate_swap_exchange: Box<dyn Platform> = test_new_exchange(ExchangeEnum::GateSwap).await;
     println!("gate_swap get_ticker:{:?}", gate_swap_exchange.get_ticker().await);
 }
 
 // 测试Gate获取Market信息
 #[tokio::test]
 async fn test_gate_swap_get_market() {
-    let gate_swap_exchange: Box<dyn Platform> = test_new_exchange(ExchangeEnum::GateSwap);
+    let gate_swap_exchange: Box<dyn Platform> = test_new_exchange(ExchangeEnum::GateSwap).await;
     println!("gate_swap get_market:{:?}", gate_swap_exchange.get_market().await);
 }
 
 // 测试Gate获取Order详情信息
 #[tokio::test]
 async fn test_gate_swap_get_order_detail() {
-    let gate_swap_exchange: Box<dyn Platform> = test_new_exchange(ExchangeEnum::GateSwap);
+    let gate_swap_exchange: Box<dyn Platform> = test_new_exchange(ExchangeEnum::GateSwap).await;
     println!("gate_swap get_order_detail:{:?}", gate_swap_exchange.get_order_detail("336321097375", "").await);
 }
 
 // 测试Gate获取Order列表信息
 #[tokio::test]
 async fn test_gate_swap_get_orders_list() {
-    let gate_swap_exchange: Box<dyn Platform> = test_new_exchange(ExchangeEnum::GateSwap);
+    let gate_swap_exchange: Box<dyn Platform> = test_new_exchange(ExchangeEnum::GateSwap).await;
     println!("gate_swap get_orders_list:{:?}", gate_swap_exchange.get_orders_list("finished").await);
 }
 
 // 测试Gate 设置持仓模式
 #[tokio::test]
 async fn test_set_dual_mode() {
-    let gate_swap_exchange: Box<dyn Platform> = test_new_exchange(ExchangeEnum::GateSwap);
+    let gate_swap_exchange: Box<dyn Platform> = test_new_exchange(ExchangeEnum::GateSwap).await;
     println!("gate_swap set_dual_mode:{:?}", gate_swap_exchange.set_dual_mode("usdt", true).await);
 }
 
 // 测试Gate 设置持仓模式
 #[tokio::test]
 async fn test_set_dual_leverage() {
-    let gate_swap_exchange: Box<dyn Platform> = test_new_exchange(ExchangeEnum::GateSwap);
+    let gate_swap_exchange: Box<dyn Platform> = test_new_exchange(ExchangeEnum::GateSwap).await;
     println!("gate_swap set_dual_leverage:{:?}", gate_swap_exchange.set_dual_leverage("10").await);
 }
 
 // 测试Gate 测试下单
 #[tokio::test]
 async fn test_take_order() {
-    let gate_swap_exchange: Box<dyn Platform> = test_new_exchange(ExchangeEnum::GateSwap);
+    let gate_swap_exchange: Box<dyn Platform> = test_new_exchange(ExchangeEnum::GateSwap).await;
     println!("gate_swap take_order:{:?}", gate_swap_exchange.take_order("123456", "pd", dec!(0.038850), dec!(1)).await);
 }
 
 // 测试Gate 撤销订单
 #[tokio::test]
 async fn test_cancel_order() {
-    let gate_swap_exchange: Box<dyn Platform> = test_new_exchange(ExchangeEnum::GateSwap);
+    let gate_swap_exchange: Box<dyn Platform> = test_new_exchange(ExchangeEnum::GateSwap).await;
     println!("gate_swap cancel_order:{:?}", gate_swap_exchange.cancel_order("337811438982", "").await);
 }
 
 // 测试kucoin 获取持仓信息
 #[tokio::test]
 async fn test_kucoin_swap_get_position() {
-    let kucoin_swap_exchange: Box<dyn Platform> = test_new_exchange(ExchangeEnum::KucoinSwap);
+    let kucoin_swap_exchange: Box<dyn Platform> = test_new_exchange(ExchangeEnum::KucoinSwap).await;
     println!("kucoin_swap get_position:{:?}", kucoin_swap_exchange.get_position().await);
 }
 
 // 测试kucoin 获取所有持仓信息
 #[tokio::test]
 async fn test_kucoin_swap_get_positions() {
-    let kucoin_swap_exchange: Box<dyn Platform> = test_new_exchange(ExchangeEnum::KucoinSwap);
+    let kucoin_swap_exchange: Box<dyn Platform> = test_new_exchange(ExchangeEnum::KucoinSwap).await;
     println!("kucoin_swap get_positions:{:?}", kucoin_swap_exchange.get_positions().await);
 }
 
 // 测试kucoin 获取Ticker信息
 #[tokio::test]
 async fn test_kucoin_swap_get_ticker() {
-    let kucoin_swap_exchange: Box<dyn Platform> = test_new_exchange(ExchangeEnum::KucoinSwap);
+    let kucoin_swap_exchange: Box<dyn Platform> = test_new_exchange(ExchangeEnum::KucoinSwap).await;
     println!("kucoin_swap get_ticker:{:?}", kucoin_swap_exchange.get_ticker().await);
 }
 
 // 测试kucoin 获取Market信息
 #[tokio::test]
 async fn test_kucoin_swap_get_market() {
-    let kucoin_swap_exchange: Box<dyn Platform> = test_new_exchange(ExchangeEnum::KucoinSwap);
+    let kucoin_swap_exchange: Box<dyn Platform> = test_new_exchange(ExchangeEnum::KucoinSwap).await;
     println!("kucoin_swap get_market:{:?}", kucoin_swap_exchange.get_market().await);
 }
 
 // 测试kucoin 获取订单信息
 #[tokio::test]
 async fn test_kucoin_swap_get_order_detail() {
-    let kucoin_swap_exchange: Box<dyn Platform> = test_new_exchange(ExchangeEnum::KucoinSwap);
+    let kucoin_swap_exchange: Box<dyn Platform> = test_new_exchange(ExchangeEnum::KucoinSwap).await;
     println!("kucoin_swap get_market:{:?}", kucoin_swap_exchange.get_order_detail("123", "").await);
 }