gepangpang пре 1 година
родитељ
комит
3e2c1f44b2
3 измењених фајлова са 34 додато и 24 уклоњено
  1. 8 8
      config.toml.sample
  2. 22 14
      src/export/html.rs
  3. 4 2
      src/main.rs

+ 8 - 8
config.toml.sample

@@ -1,21 +1,21 @@
 # 配置代理
 proxy_address = "127.0.0.1:7890"
 # 配置币对
-symbol = "xrp_usdt"
+symbol = "jto_usdt"
 # 配置交易所 目前支持["binance", "gate", "okx"]
 exchanges = ["binance", "gate"]
 # 配置查询时间(格式:2023-12-6 15:00:00)
-range_time = ["2023-12-11 10:12:00", "2023-12-11 10:12:59"]
+range_time = ["2023-12-13 11:24:00", "2023-12-13 11:24:50"]
 # 回溯时间(单位ms)
-recall_time = 1000
+recall_time = 1680
 # 最大回溯条数
-recall_max_count = 1000
+recall_max_count = 1680
 # 主动性跌比率(0.01代表1%)
-short_volume_rate = 0.55
+short_volume_rate = 0.8
 # 主动性涨比率(0.01代表1%)
-long_volume_rate = 0.55
-# 策略机器人名称
-robot_name = "gate49"
+long_volume_rate = 0.8
+# 策略机器人名称(为""不查询)
+robot_name = ""
 # 导出路径(不填则为默认路径"./")
 export_path = ""
 # 导出文件名字(不填则为默认名字"export")

+ 22 - 14
src/export/html.rs

@@ -122,8 +122,6 @@ pub fn export_html(export_info: Vec<ExportExchangeTickerInfo>, start_at: &str, e
     let mut legend_list: Vec<String> = vec![];
     let mut series_info: Vec<SeriesInfo> = vec![];
 
-    let ref_robot_info: Vec<Trades> = robot_info.iter().filter(|trades| trades.data_type == "robot_ref_info").cloned().collect();
-
     for item in export_info.clone() {
         name_list.push(format!("'{}'", item.name));
         series_info.push(SeriesInfo {
@@ -134,17 +132,20 @@ pub fn export_html(export_info: Vec<ExportExchangeTickerInfo>, start_at: &str, e
     }
     series_info.push(initiative_info);
 
-    series_info.push(SeriesInfo {
-        name: "预定价格".to_string(),
-        classify: "robot_ref".to_string(),
-        data: ref_robot_info.clone(),
-    });
-    let reg_robot_info: Vec<Trades> = robot_info.iter().filter(|trades| trades.data_type == "robot_reg_info").cloned().collect();
-    series_info.push(SeriesInfo {
-        name: "挂单价格".to_string(),
-        classify: "robot_reg".to_string(),
-        data: reg_robot_info.clone(),
-    });
+    if config.robot_name != "" {
+        let ref_robot_info: Vec<Trades> = robot_info.iter().filter(|trades| trades.data_type == "robot_ref_info").cloned().collect();
+        series_info.push(SeriesInfo {
+            name: "预定价格".to_string(),
+            classify: "robot_ref".to_string(),
+            data: ref_robot_info.clone(),
+        });
+        let reg_robot_info: Vec<Trades> = robot_info.iter().filter(|trades| trades.data_type == "robot_reg_info").cloned().collect();
+        series_info.push(SeriesInfo {
+            name: "挂单价格".to_string(),
+            classify: "robot_reg".to_string(),
+            data: reg_robot_info.clone(),
+        });
+    }
 
     for item in series_info.clone() {
         legend_list.push(format!("'{}'", item.name));
@@ -322,7 +323,14 @@ pub fn export_html(export_info: Vec<ExportExchangeTickerInfo>, start_at: &str, e
                         }
                       ]
                     ]
-                  }
+                  },
+
+                  markPoint: {
+                    data: [
+                      { type: 'max', name: 'Max' },
+                      { type: 'min', name: 'Min' }
+                    ]
+                  },
                 },
                 {{/each}}
               ]

+ 4 - 2
src/main.rs

@@ -91,7 +91,9 @@ async fn main() {
         };
         exchange_list.push(exchange_result);
     }
-
-    let robot_info = handle_ticker::get_robot_info(&symbol, &config_clone.robot_name, &start_at.to_string(), &end_at.to_string()).await;
+    let mut robot_info = vec![];
+    if config_clone.robot_name != "" {
+        robot_info = handle_ticker::get_robot_info(&symbol, &config_clone.robot_name, &start_at.to_string(), &end_at.to_string()).await;
+    }
     export::html::export_html(exchange_list, &start_at.to_string(), &end_at.to_string(), config.clone(), robot_info);
 }