Administrator
2023-02-09 b74016d3ba3750cd27fee83675449da8f1da3926
l2/transaction_progress.py
@@ -3,6 +3,7 @@
'''
# 买入队列
import itertools
import json
import constant
@@ -79,9 +80,10 @@
        return num_list
    # 保存成交索引
    def save_traded_index(self, code, buy1_price, buyQueueBig):
    def compute_traded_index(self, code, buy1_price, buyQueueBig):
        total_datas = l2.l2_data_util.local_today_datas.get(code)
        today_num_operate_map = l2.l2_data_util.local_today_num_operate_map.get(code)
        index = None
        for i in range(0, len(buyQueueBig)):
            buyQueueBigTemp = buyQueueBig[i:]
            if i > 0 and len(buyQueueBigTemp) < 2:
@@ -90,18 +92,38 @@
            last_index, is_default = self.get_traded_index(code)
            c_last_index = 0
            if not is_default and last_index is not None:
                c_last_index = last_index
            # 如果是3个/4个数据找不到就调整顺序
            fbuyQueueBigTempList = []
            if 3 <= len(buyQueueBigTemp) <= 4:
                buyQueueBigTempList = itertools.permutations(buyQueueBigTemp, len(buyQueueBigTemp))
                for tempQueue in buyQueueBigTempList:
                    if list(tempQueue) != buyQueueBigTemp:
                        fbuyQueueBigTempList.append(tempQueue)
            fbuyQueueBigTempList.insert(0, buyQueueBigTemp)
            for temp in fbuyQueueBigTempList:
                try:
            index = l2.l2_data_util.L2TradeQueueUtils.find_traded_progress_index(buy1_price, total_datas,
                                                                                 today_num_operate_map, buyQueueBigTemp,
                                                                                 (
                                                                                     last_index if last_index is not is_default else 0),
                                                                                         today_num_operate_map,
                                                                                         temp,
                                                                                         c_last_index,
                                                                                 self.__get_latest_not_limit_up_time(
                                                                                     code))
            if index is not None:
                        break
                except:
                    pass
            if index is not None:
                break
        if index is not None:
                logger_l2_trade_buy_queue.info(f"确定交易进度:code-{code} index-{index}")
                # 保存成交进度
                self.__save_buy_progress_index(code, index, False)
            # self.__save_buy_progress_index(code, index, False)
                return index
        return None
        return index
    # 获取成交进度索引
    def get_traded_index(self, code):
@@ -111,6 +133,9 @@
    def set_default_traded_index(self, code, index):
        self.__save_buy_progress_index(code, index, True)
    def set_traded_index(self, code, index):
        self.__save_buy_progress_index(code, index, False)
if __name__ == '__main':
    pass