From 832d70d984316e43048a84ad61d0c8a12c319993 Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期四, 11 四月 2024 18:47:20 +0800 Subject: [PATCH] 深证买入方式改造 --- test/test_sell.py | 55 +++++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 39 insertions(+), 16 deletions(-) diff --git a/test/test_sell.py b/test/test_sell.py index 40e7ab9..c3a4abb 100644 --- a/test/test_sell.py +++ b/test/test_sell.py @@ -54,18 +54,34 @@ # 鍗栧崟缁熻 def statistic_sell_order(): - code = "002248" + def is_active_sell(sell_no, buy_no): + return sell_no > buy_no + + code = "002761" 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 + limit_up_price = 9.2 + last_type = -1 + for data in datas: for d in data: - if d[7] == 559018: - if d[7] > d[6]: - print("涓诲姩鍗�", d) - else: - print("琚姩鍗�", d) + + type = -1 + if d[7] > d[6]: + type = 0 + else: + type = 1 + if type == 0 and last_type == 1 and d[1] == limit_up_price: + print("琚姩鍗栧彉涓诲姩鍗�", d) + last_type = type + + # if d[6] == 21296620: + # if d[7] > d[6]: + # print("涓诲姩鍗�", d) + # else: + # print("琚姩鍗�", d[1] * d[2], 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: @@ -75,18 +91,23 @@ __latest_sell_order_dict[code][4] = (d[3], d[6]) else: info = __latest_sell_order_dict[code] + money = info[1] * info[2] + if is_active_sell(info[0], info[3][1]) and 1000 * 10000 > money > 10 * 10000 and 7852775 > info[ + 0] > 7807625: + total_money += money + # print("涓诲姩鍗栵細", round(money / 10000), total_money, info) # 涓婁釜鍗栧崟鎴愪氦瀹屾垚 # 灏佸瓨鏁版嵁锛岃绠楁柊璧风偣 # 澶т簬50w鐨勫崠鍗曟墠浼氫繚瀛� # 澶т簬50w鍔犲叆鍗栧崟 - money = info[1] * info[2] - if tool.trade_time_sub(l2_huaxin_util.convert_time(info[3][0]), "10:08:30") >= 0: - if info[2] >= 11.54: - total_money += money - print(money, round(total_money), info) - if money >= 500000: - pass + + # if tool.trade_time_sub(l2_huaxin_util.convert_time(info[3][0]), "10:08:30") >= 0: + # if info[2] >= 11.54: + # total_money += money + # print(money, round(total_money), info) + # if money >= 500000: + # pass __latest_sell_order_dict[code] = [d[7], d[2], d[1], (d[3], d[6]), (d[3], d[6])] @@ -103,7 +124,7 @@ def test_sell_order_info(): - code = "002248" + code = "600490" 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) @@ -117,11 +138,13 @@ 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)) + 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__': - test_sell_order_info() + statistic_sell_order() -- Gitblit v1.8.0