From 9a8a924d75fd4e29c4c14c86c041c00ba89f615a Mon Sep 17 00:00:00 2001
From: Administrator <admin@example.com>
Date: 星期三, 10 四月 2024 18:07:22 +0800
Subject: [PATCH] 下单策略修改

---
 test/test_sell.py |   51 +++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 37 insertions(+), 14 deletions(-)

diff --git a/test/test_sell.py b/test/test_sell.py
index f449f6d..40e7ab9 100644
--- a/test/test_sell.py
+++ b/test/test_sell.py
@@ -1,18 +1,29 @@
 from l2.huaxin import l2_huaxin_util
+from l2.l2_data_manager import OrderBeginPosInfo
 from l2.l2_transaction_data_manager import HuaXinSellOrderStatisticManager
-from l2 import l2_data_util
+from l2 import l2_data_util, cancel_buy_strategy
 from log_module import log_export, async_log_util
 from utils import tool
 
 
 def statistic_buy_order():
-    code = "600768"
-    data_map = log_export.load_huaxin_transaction_map(date=tool.get_now_date_str())
+    code = "002187"
+    data_map = log_export.load_huaxin_transaction_map(date="2024-04-10", with_time=True)
     datas = data_map.get(code)
     __latest_buy_order_dict = {}
     total_money = 0
+    active_buy = 0
+    passive_buy = 0
     for data in datas:
-        for d in data:
+        time_str = data[0]
+        for d in data[1]:
+            if d[6] == 990054:
+                if d[7] < 990054:
+                    active_buy += d[2]
+                    print("涓诲姩涔帮細", time_str, d)
+                else:
+                    passive_buy += d[2]
+                    print("琚姩涔帮細", time_str, d)
             if code not in __latest_buy_order_dict:
                 # 鏍煎紡锛歔涔板崟鍙�,鎵嬫暟,鍗曚环]
                 __latest_buy_order_dict[code] = [d[6], d[2], d[1], (d[3], d[1]), (d[3], d[1])]
@@ -30,23 +41,31 @@
                     # 澶т簬50w鍔犲叆鍗栧崟
                     money = info[1] * info[2]
                     # if 101328000 > info[3] > 101324000:
-                    if tool.trade_time_sub(l2_huaxin_util.convert_time(info[3][0]), "10:08:30") >= 0 and info[2] >= 11.54:
+                    if tool.trade_time_sub(l2_huaxin_util.convert_time(info[3][0]), "10:08:30") >= 0 and info[
+                        2] >= 11.54:
                         total_money += money
                         print(int(total_money), round(money / 10000, 1), info)
                     if money >= 500000:
                         pass
                     __latest_buy_order_dict[code] = [d[6], d[2], d[1], (d[3], d[1]), (d[3], d[1])]
 
+    print(f"涓诲姩涔帮細{active_buy}", f"琚姩涔帮細{passive_buy}")
+
 
 # 鍗栧崟缁熻
 def statistic_sell_order():
-    code = "600768"
+    code = "002248"
     data_map = log_export.load_huaxin_transaction_map(date=tool.get_now_date_str())
     datas = data_map.get(code)
     __latest_sell_order_dict = {}
     total_money = 0
     for data in datas:
         for d in data:
+            if d[7] == 559018:
+                if d[7] > d[6]:
+                    print("涓诲姩鍗�", d)
+                else:
+                    print("琚姩鍗�", d)
             if code not in __latest_sell_order_dict:
                 __latest_sell_order_dict[code] = [d[7], d[2], d[1], (d[3], d[6]), (d[3], d[6])]
             else:
@@ -84,7 +103,7 @@
 
 
 def test_sell_order_info():
-    code = "002734"
+    code = "002248"
     l2_data_util.load_l2_data(code, force=True)
     date = tool.get_now_date_str()
     data_map = log_export.load_huaxin_transaction_map(date=date)
@@ -92,13 +111,17 @@
     for i in range(len(datas)):
         d = datas[i]
         big_sell_order_info = HuaXinSellOrderStatisticManager.add_transaction_datas(code, d)
-        if d[-1][7] >= 3911165:
-            sell_infos = HuaXinSellOrderStatisticManager.get_latest_transaction_datas(code, 3910694, "09:35:27")
-            print(sum([x[1] * x[2] for x in sell_infos]))
-        if big_sell_order_info[0] < 50 * 10000:
-            continue
-        print(i, sum([x[1] * x[2] for x in big_sell_order_info[1]]), big_sell_order_info)
+
+        if big_sell_order_info[1] and big_sell_order_info[1][-1][0] == 559018:
+            print(big_sell_order_info)
+            cancel_buy_strategy.SCancelBigNumComputer().set_real_place_order_index(code, 208, False)
+            cancel_buy_strategy.SCancelBigNumComputer().set_big_sell_order_info_for_cancel(code, big_sell_order_info,
+                                                                                           OrderBeginPosInfo(
+                                                                                               mode=OrderBeginPosInfo.MODE_ACTIVE,buy_single_index=0,buy_exec_index=13))
+        # if big_sell_order_info[0] < 50 * 10000:
+        #     continue
+        # print(i, sum([x[1] * x[2] for x in big_sell_order_info[1]]), big_sell_order_info)
 
 
 if __name__ == '__main__':
-    statistic_buy_order()
+    test_sell_order_info()

--
Gitblit v1.8.0