Bläddra i källkod

Merge branch 'dev' of http://git.skyfffire.com/skyfffire/as-rust into dev

875428575@qq.com 2 år sedan
förälder
incheckning
f9de086272
2 ändrade filer med 22 tillägg och 10 borttagningar
  1. 9 10
      standard/src/bitget_spot.rs
  2. 13 0
      standard/src/handle_info.rs

+ 9 - 10
standard/src/bitget_spot.rs

@@ -67,16 +67,15 @@ impl Platform for BitgetSpot {
     fn get_request_max_delay(&self) -> i64 { self.request.get_max_delay() }
 
     async fn get_server_time(&mut self) -> Result<String, Error> {
-        Err(Error::new(ErrorKind::NotFound, "bitget_spot:该交易所方法未实现".to_string()))
-        // let res_data = self.request.get().await;
-        // if res_data.code == "200" {
-        //     let res_data_str = &res_data.data;
-        //     let res_data_json: serde_json::Value = serde_json::from_str(res_data_str).unwrap();
-        //     let result = res_data_json["serverTime"].as_str().unwrap().to_string();
-        //     Ok(result)
-        // } else {
-        //     Err(Error::new(ErrorKind::Other, res_data.to_string()))
-        // }
+        let res_data = self.request.get_server_time().await;
+        if res_data.code == "200" {
+            let res_data_str = &res_data.data;
+            let res_data_json: serde_json::Value = serde_json::from_str(res_data_str).unwrap();
+            let result = res_data_json["serverTime"].as_str().unwrap().to_string();
+            Ok(result)
+        } else {
+            Err(Error::new(ErrorKind::Other, res_data.to_string()))
+        }
     }
 
     async fn get_account(&mut self) -> Result<Account, Error> {

+ 13 - 0
standard/src/handle_info.rs

@@ -26,6 +26,9 @@ impl HandleSwapInfo {
             ExchangeEnum::KucoinSwap => {
                 kucoin_handle::handle_account_info(res_data, symbol)
             }
+            ExchangeEnum::BitgetSpot =>{
+                bitget_spot_handle::handle_account_info(res_data, symbol)
+            }
             _ => {
                 error!("参数错误!handle_account_info: {:?}",exchange);
                 panic!("参数错误!handle_account_info: {:?}", exchange);
@@ -48,6 +51,9 @@ impl HandleSwapInfo {
             ExchangeEnum::KucoinSwap => {
                 kucoin_handle::handle_special_ticker(res_data)
             }
+            ExchangeEnum::BitgetSpot =>{
+                bitget_spot_handle::handle_special_ticker(res_data)
+            }
             _ => {
                 error!("参数错误!handle_special_ticker: {:?}",exchange);
                 panic!("参数错误!handle_special_ticker: {:?}", exchange);
@@ -67,6 +73,10 @@ impl HandleSwapInfo {
             ExchangeEnum::KucoinSwap => {
                 kucoin_handle::handle_position(res_data, amount_size)
             }
+            ExchangeEnum::BitgetSpot =>{
+                error!("暂未提供此交易所方法!handle_position:{:?}", exchange);
+                panic!("暂未提供此交易所方法!handle_position:{:?}", exchange);
+            }
             _ => {
                 error!("参数错误!handle_position: {:?}",exchange);
                 panic!("参数错误!handle_position: {:?}", exchange);
@@ -86,6 +96,9 @@ impl HandleSwapInfo {
             ExchangeEnum::KucoinSwap => {
                 kucoin_handle::handle_order(res_data, amount_size)
             }
+            ExchangeEnum::BitgetSpot =>{
+                bitget_spot_handle::handle_order(res_data, amount_size)
+            }
             _ => {
                 error!("参数错误!handle_order: {:?}",exchange);
                 panic!("参数错误!handle_order: {:?}", exchange);