Administrator
2023-10-25 29ab6e6d4eab469fd38f4be842b3ff111d47f685
bug修复
4个文件已修改
60 ■■■■ 已修改文件
l2/cancel_buy_strategy.py 36 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/l2_data_manager_new.py 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/huaxin/huaxin_trade_api.py 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
utils/data_export_util.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/cancel_buy_strategy.py
@@ -981,10 +981,10 @@
            if not_cancel_indexes:
                temp_count = len(not_cancel_indexes)
                # 取后1/3的数据
                if temp_count >= 15:
                    temp_index = int(temp_count * 2 / 3)
                if temp_count >= 30:
                    temp_index = int(temp_count * 5 / 6)
                    re_start_index = not_cancel_indexes[temp_index]
                    MAX_COUNT = len(not_cancel_indexes[temp_index:]) // 3
                    MAX_COUNT = len(not_cancel_indexes[temp_index:])
                elif temp_count >= 5:
                    re_start_index = not_cancel_indexes[-5]
                else:
@@ -993,8 +993,6 @@
            watch_indexes = set()
            for min_money in MIN_MONEYS:
                for i in range(end_index, re_start_index, -1):
                    # if i > len(total_datas):
                    #     continue
                    try:
                        data = total_datas[i]
                        val = data['val']
@@ -1018,6 +1016,34 @@
                if len(watch_indexes) >= MAX_COUNT:
                    break
            if watch_indexes:
                ##判断监听的数据中是否有大单##
                has_big_num = False
                for i in watch_indexes:
                    # 是否有大单
                    data = total_datas[i]
                    val = data['val']
                    if float(val['price']) * val['num'] > 100 * 100:
                        has_big_num = True
                        break
                if not has_big_num:
                    # 无大单,需要找大单
                    for i in range(re_start_index, start_index, -1):
                        data = total_datas[i]
                        val = data['val']
                        # 涨停买,且未撤单
                        if not L2DataUtil.is_limit_up_price_buy(val):
                            continue
                        # 小金额过滤
                        if float(val['price']) * val['num'] < 100 * 100:
                            continue
                        left_count = l2_data_source_util.L2DataSourceUtils.get_limit_up_buy_no_canceled_count_v2(code,
                                                                                                                 i,
                                                                                                                 total_datas,
                                                                                                                 local_today_canceled_buyno_map.get(
                                                                                                                     code))
                        if left_count > 0:
                            watch_indexes.add(i)
                            break
                self.__set_watch_indexes(code, watch_indexes)
                l2_log.l_cancel_debug(code, f"设置监听范围, 数据范围:{re_start_index}-{end_index} 监听范围-{watch_indexes}")
l2/l2_data_manager_new.py
@@ -8,7 +8,7 @@
import constant
from db.redis_manager_delegate import RedisUtils
from l2.huaxin import l2_huaxin_util, huaxin_delegate_postion_manager
from log_module import async_log_util
from log_module import async_log_util, log_export
from third_data import kpl_data_manager, block_info
from utils import global_util, ths_industry_util, tool
import l2_data_util
@@ -1318,12 +1318,18 @@
if __name__ == "__main__":
    test_trade_record()
    # test_trade_record()
    # yesterday_limit_up_data_records = kpl_data_manager.get_current_limit_up_data_records(1)[0][1]
    # yesterday_codes = set([x[0] for x in yesterday_limit_up_data_records])
    # print(yesterday_codes)
    code = "002137"
    l2.l2_data_util.load_l2_data(code)
    start_index = 200
    end_index = 259
    code = "603003"
    datas = log_export.load_l2_from_log()
    datas = datas.get(code)
    if datas is None:
        datas = []
    l2.l2_data_util.local_today_datas[code] = datas[:191]
    l2.l2_data_util.load_buy_no_map(l2.l2_data_util.local_today_buyno_map,code, l2.l2_data_util.local_today_datas[code])
    l2.l2_data_util.load_canceled_buy_no_map(l2.l2_data_util.local_today_canceled_buyno_map, code, l2.l2_data_util.local_today_datas[code])
    start_index = 73
    end_index = 190
    LCancelBigNumComputer().compute_watch_index(code, start_index, end_index)
trade/huaxin/huaxin_trade_api.py
@@ -75,7 +75,7 @@
                                direction = data.get("direction")
                                limitPrice = data.get("limitPrice")
                                volume = data.get("volume")
                                async_log_util.info(hx_logger_trade_callback, f"华鑫订单状态上报:code-{code} orderRef-{orderRef} orderSysID-{orderSysID} orderStatus-{orderStatus}")
                                is_shadow_order = False
                                # 获取涨停价
                                limit_up_price = gpcode_manager.get_limit_up_price(code)
@@ -95,6 +95,8 @@
                                        # 加入2次,增大加入成功率
                                        __response_thread_pool.submit(
                                            huaxin_trade_record_manager.DelegateRecordManager.add_one, data)
                                        async_log_util.info(hx_logger_trade_callback,
                                                            f"华鑫订单状态处理完成:code-{code} orderRef-{orderRef} orderSysID-{orderSysID} orderStatus-{orderStatus}")
                                    except Exception as e:
                                        hx_logger_trade_debug.exception(e)
utils/data_export_util.py
@@ -265,6 +265,6 @@
if __name__ == "__main__":
    try:
        export_l2_excel("000981")
        export_l2_excel("002042")
    except Exception as e:
        logging.exception(e)