Administrator
2025-01-02 d957e0dc6dcfb15304a6499e1b9ddee4e18be531
third_data/custom_block_in_money_manager.py
@@ -18,6 +18,11 @@
    def __init__(self):
        # 总的净流入
        self.__code_money_dict = {}
        # 总买单信息:{"code":[金额, 数量]}
        self.__code_buy_money_dict = {}
        # 总卖单信息:{"code":[金额, 数量]}
        self.__code_sell_money_dict = {}
        # 净流入大单金额
        self.__code_big_buy_mmoney_list_dict = {}
        self.__latest_price = {}
@@ -37,6 +42,13 @@
        code = item[0]
        if code not in self.__code_money_dict:
            self.__code_money_dict[code] = 0
        if code not in self.__code_buy_money_dict:
            self.__code_buy_money_dict[code] = [0, 0]
        if code not in self.__code_sell_money_dict:
            self.__code_sell_money_dict[code] = [0, 0]
        if not tool.is_ge_code(code) and item[2][2] < 299e4:
            return
        if tool.is_ge_code(code) and item[2][2] < 299e4 and item[2][1] < 290000:
@@ -44,6 +56,9 @@
        if item[1] == 0:
            # item[2]的数据结构:  (买单号, 量, 金额, 时间, 最新成交价格)
            self.__code_money_dict[code] += item[2][2]
            self.__code_buy_money_dict[code][0] += item[2][2]
            self.__code_buy_money_dict[code][1] += 1
            if code not in self.__code_big_buy_mmoney_list_dict:
                self.__code_big_buy_mmoney_list_dict[code] = []
            # 大买单信息:(金额,最后价格)
@@ -51,6 +66,8 @@
                self.__code_big_buy_mmoney_list_dict[code].append((item[2][2], item[2][4], item[2][0]))
        else:
            self.__code_money_dict[code] -= item[2][2]
            self.__code_sell_money_dict[code][0] += item[2][2]
            self.__code_sell_money_dict[code][1] += 1
        self.__latest_price[code] = item[2][4]
    def get_code_money_dict(self):
@@ -61,6 +78,15 @@
            return self.__code_money_dict.get(code)
        return 0
    def get_money_info(self, code):
        """
        获取代码流入信息
        @param code: 代码信息
        @return: 净流入金额,[大单买金额, 大单买数量],[大单卖金额,大单卖数量]
        """
        return self.__code_money_dict.get(code), self.__code_buy_money_dict.get(code), self.__code_sell_money_dict.get(
            code)
    def set_money(self, code, money):
        self.__code_money_dict[code] = money