From f46ddbbc3f4aa6078a35dad139b90637a08c630c Mon Sep 17 00:00:00 2001
From: Administrator <admin@example.com>
Date: 星期五, 24 五月 2024 13:27:15 +0800
Subject: [PATCH] bug修复

---
 main.py |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/main.py b/main.py
index d340d4d..62dcf2c 100644
--- a/main.py
+++ b/main.py
@@ -81,7 +81,10 @@
                 if direction == 2:
                     # price_type: 0-浠锋牸绗煎瓙 1-璺屽仠浠�  2-娑ㄥ仠浠� 3-鐜颁环 4-涔�5浠�
                     async_log_util.info(logger_trade, f"API鍗�: 鎺ユ敹鏁版嵁-{data}")
-                    current_price = None  # L1DataProcessor.get_l1_current_price(code)
+                    current_price = None
+                    market_info = code_market_manager.get_market_info(code)
+                    if market_info:
+                        current_price = market_info.price
                     limit_down_price = target_codes_manager.get_limit_down_price(code)
                     limit_up_price = target_codes_manager.get_limit_up_price(code)
                     order_ref = huaxin_util.create_order_ref()
@@ -139,7 +142,7 @@
             underlying_market = code_market_manager.get_market_info(underlying_code)
             if cb_market:
                 r["marketInfo"] = {"code": cb_market.code, "name": r["securityName"],
-                                   "rate": f"{round(cb_market.rate * 100,2)}%",
+                                   "rate": f"{round(cb_market.rate * 100, 2)}%",
                                    "price": cb_market.price, "lastVolume": cb_market.total_bid_volume // 100,
                                    "buy1Money": output_util.money_desc(cb_market.buy1_price * cb_market.buy1_volume)}
             if underlying_market:
@@ -151,7 +154,8 @@
 
                 r["underlyingMarketInfo"] = {"code": underlying_market.code,
                                              "name": gpcode_manager.CodesNameManager().get_code_name(
-                                                 underlying_market.code), "rate": f"{round(underlying_market.rate * 100,2)}%",
+                                                 underlying_market.code),
+                                             "rate": f"{round(underlying_market.rate * 100, 2)}%",
                                              "price": underlying_market.price,
                                              "lastVolume": underlying_market.total_bid_volume // 100,
                                              "buy1Money": output_util.money_desc(
@@ -190,6 +194,7 @@
 
 __deal_codes = set()
 
+
 def read_l2_results(trade_call_back_queue):
     while True:
         try:

--
Gitblit v1.8.0