skyffire 1 éve
szülő
commit
d83257c699
2 módosított fájl, 8 hozzáadás és 8 törlés
  1. 7 7
      kappa/data_processing.py
  2. 1 1
      kappa/ws_client.py

+ 7 - 7
kappa/data_processing.py

@@ -20,8 +20,8 @@ trade_snapshots = deque(maxlen=6000)            # 存储过去6000个成交数
 stop_event = threading.Event()
 
 # 初始参数
-k_initial = 10
-A_initial = 100
+k_initial = 6
+A_initial = 140
 
 # 定义参数范围
 bounds = [(10, 1000.0),             # A 的范围
@@ -149,8 +149,8 @@ def process_depth_data():
     global order_book_snapshots, trade_snapshots, spread_delta_snapshots
     global k_initial, A_initial, S0
 
-    # 数据预热,至少10条深度数据以及100条成交数据才能用于计算
-    if len(order_book_snapshots) < 10 or len(trade_snapshots) < 100:
+    # 数据预热,至少3条深度数据以及10条成交数据才能用于计算
+    if len(order_book_snapshots) < 3 or len(trade_snapshots) < 10:
         return
 
     S_values = [((snapshot['bids'][0][0] + snapshot['asks'][0][0]) / 2) for snapshot in order_book_snapshots]
@@ -193,8 +193,8 @@ def process_depth_data():
     if result.success:
         A_initial, k_initial = result.x
 
-        logger.info(f"Optimal A: {A_initial}, Optimal k: {k_initial}")
-    else:
-        logger.error("Optimization failed")
+        logger.info(f"Optimal k: {k_initial}, delta_max: {delta_max}")
+    # else:
+    #     logger.error("Optimization failed")
 
     # logger.info("log(λ(δ)): {}, log(∫ φ(k, ξ) dξ): {}".format(log_lambda_hat_value, log_integral_phi_value))

+ 1 - 1
kappa/ws_client.py

@@ -7,7 +7,7 @@ from logger_config import logger
 from data_processing import on_message_depth, on_message_trade, stop_event
 
 # Binance WebSocket API URL
-SYMBOL = "not" + "usdt"
+SYMBOL = "1000pepe" + "usdt"
 SOCKET_TRADE = "wss://fstream.binance.com/stream?streams=" + SYMBOL + "@trade"
 SOCKET_DEPTH = "wss://fstream.binance.com/stream?streams=" + SYMBOL + "@depth20@100ms"