瀏覽代碼

start_time与end_time

skyffire 9 月之前
父節點
當前提交
6266520bc7
共有 2 個文件被更改,包括 12 次插入5 次删除
  1. 2 1
      README.MD
  2. 10 4
      src/msv.rs

+ 2 - 1
README.MD

@@ -56,7 +56,8 @@
     "query": {                              // 查询结构
         "exchange": "binance_usdt_swap",    // 交易所,当前支持[binance_usdt_swap]
         "symbol": "btc",                    // 符号,支持大小写,如果不写usdt会自动在后面添加_USDT
-        "minute_time_range": "240",         // 查询多少分钟的数据
+        "start_time": "1737427818367",      // 开始时间戳,毫秒
+        "end_time": "1737427818367",        // 结束时间戳,毫秒
         "value_ln": "10",                   // 量的阈值(ln)
     }
 }

+ 10 - 4
src/msv.rs

@@ -438,7 +438,15 @@ pub async fn generate_fot(query_value: Value) -> HttpResponse {
             return response
         }
     };
-    let minute_time_range = match parse_str_to_decimal(query_value.clone(), "minute_time_range") {
+    let start_time = match parse_str_to_decimal(query_value.clone(), "start_time") {
+        Ok(t) => {
+            t.to_i64().unwrap()
+        }
+        Err(response) => {
+            return response
+        }
+    };
+    let end_time = match parse_str_to_decimal(query_value.clone(), "end_time") {
         Ok(t) => {
             t.to_i64().unwrap()
         }
@@ -454,9 +462,7 @@ pub async fn generate_fot(query_value: Value) -> HttpResponse {
             return response
         }
     };
-    // 链接数据服务器查询数据
-    let end_time = Utc::now().timestamp_millis();
-    let start_time = end_time - minute_time_range * 60 * 1000;
+
     let trades_response = get_trades_json(
         exchange.as_str(),
         symbol.as_str(),