Bladeren bron

提交standard测试配置文件

gepangpang 2 jaren geleden
bovenliggende
commit
d1256bdab0
4 gewijzigde bestanden met toevoegingen van 36 en 8 verwijderingen
  1. 1 0
      standard/.gitignore
  2. 22 0
      standard/config.toml.sample
  3. 12 7
      standard/src/okx_swap.rs
  4. 1 1
      standard/tests/exchange_test.rs

+ 1 - 0
standard/.gitignore

@@ -1,3 +1,4 @@
 /target
 /.idea
 /logs*
+/config.toml

+ 22 - 0
standard/config.toml.sample

@@ -0,0 +1,22 @@
+# gate账号密码
+gate_access_key = ""
+gate_secret_key = ""
+
+# binance账号密码
+binance_access_key = ""
+binance_secret_key = ""
+
+# kucoin账号密码
+kucoin_access_key = ""
+kucoin_secret_key = ""
+kucoin_pass = ""
+
+# okx账号密码
+okx_access_key = ""
+okx_secret_key = ""
+okx_pass = ""
+
+# bitget账号密码
+bitget_access_key = ""
+bitget_secret_key = ""
+bitget_pass = ""

+ 12 - 7
standard/src/okx_swap.rs

@@ -9,7 +9,7 @@ use rust_decimal::Decimal;
 use rust_decimal::prelude::FromPrimitive;
 use serde::{Deserialize, Serialize};
 use serde_json::json;
-use tracing::error;
+use tracing::{debug, error};
 use exchanges::okx_swap_rest::OkxSwapRest;
 use global::trace_stack::TraceStack;
 use crate::exchange::ExchangeEnum;
@@ -796,7 +796,7 @@ impl Platform for OkxSwap {
                 avg_price: Decimal::ZERO,
                 status: "NEW".to_string(),
                 order_type: "".to_string(),
-                trace_stack: TraceStack::default().on_special("798 okx_swap".to_string()),
+                trace_stack: TraceStack::default().on_special("799 okx_swap".to_string()),
             };
             Ok(result)
         } else {
@@ -850,7 +850,7 @@ impl Platform for OkxSwap {
                 avg_price: Decimal::ZERO,
                 status: "NEW".to_string(),
                 order_type: "".to_string(),
-                trace_stack: TraceStack::default().on_special("852 okx_swap".to_string()),
+                trace_stack: TraceStack::default().on_special("853 okx_swap".to_string()),
             };
             Ok(result)
         } else {
@@ -876,7 +876,7 @@ impl Platform for OkxSwap {
                 avg_price: Decimal::ZERO,
                 status: "REMOVE".to_string(),
                 order_type: "".to_string(),
-                trace_stack: TraceStack::default().on_special("854 okx_swap".to_string()),
+                trace_stack: TraceStack::default().on_special("879 okx_swap".to_string()),
             };
             Ok(result)
         } else {
@@ -1027,6 +1027,8 @@ impl Platform for OkxSwap {
 }
 
 pub fn format_order_item(data: SwapOrder, ct_val: Decimal) -> Order {
+    debug!("format-order-start, okx_swap");
+    debug!(?data);
     let custom_status = if ["canceled", "filled", "mmp_canceled"].contains(&data.state.as_str()) {
         "REMOVE".to_string()
     } else if ["live", "partially_filled"].contains(&data.state.as_str()) {
@@ -1035,7 +1037,7 @@ pub fn format_order_item(data: SwapOrder, ct_val: Decimal) -> Order {
         "NULL".to_string()
     };
 
-    Order {
+    let result = Order {
         id: data.ord_id,
         custom_id: data.cl_ord_id,
         price: data.px,
@@ -1044,6 +1046,9 @@ pub fn format_order_item(data: SwapOrder, ct_val: Decimal) -> Order {
         avg_price: if data.avg_px != "" { Decimal::from_str(&data.avg_px).unwrap() } else { Decimal::ZERO },
         status: custom_status,
         order_type: data.ord_type,
-        trace_stack: TraceStack::default().on_special("1022 okx_swap".to_string()),
-    }
+        trace_stack: TraceStack::default().on_special("1049 okx_swap".to_string()),
+    };
+    debug!(?result);
+    debug!("format-order-end, okx_swap");
+    result
 }

+ 1 - 1
standard/tests/exchange_test.rs

@@ -63,7 +63,7 @@ impl AccountInfo {
 
 // 获取文件内容
 pub fn get_account_info(file_path: &str) -> AccountInfo {
-    let mut file = File::open(file_path);
+    let file = File::open(file_path);
     let mut contents = String::new();
     let result = match file {
         Ok(mut value) => {