| | |
| | | # 总卖单信息:{"code":[金额, 数量]} |
| | | self.__code_sell_money_dict = {} |
| | | |
| | | # 净流入大单金额 |
| | | self.__code_big_buy_mmoney_list_dict = {} |
| | | # 净流入大单买金额 |
| | | self.__code_big_buy_money_list_dict = {} |
| | | # 净流出大单卖金额 |
| | | self.__code_big_sell_money_list_dict = {} |
| | | self.__latest_price = {} |
| | | self.__load_data() |
| | | |
| | |
| | | self.add_data(item) |
| | | |
| | | def add_data(self, item): |
| | | """ |
| | | 添加数据 |
| | | @param item: (代码,类型, 订单数据) 订单数据:(订单号, 量, 金额, 时间, 最新成交价格) |
| | | @return: |
| | | """ |
| | | code = item[0] |
| | | if code not in self.__code_money_dict: |
| | | self.__code_money_dict[code] = 0 |
| | |
| | | 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] = [] |
| | | # 大买单信息:(金额,最后价格) |
| | | if code not in self.__code_big_buy_money_list_dict: |
| | | self.__code_big_buy_money_list_dict[code] = [] |
| | | # 大买单信息:(金额, 最新价格, 订单号) |
| | | if len(item[2]) >= 5: |
| | | self.__code_big_buy_mmoney_list_dict[code].append((item[2][2], item[2][4], item[2][0])) |
| | | self.__code_big_buy_money_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 |
| | | # 大卖单信息 |
| | | if code not in self.__code_big_sell_money_list_dict: |
| | | self.__code_big_sell_money_list_dict[code] = [] |
| | | if len(item[2]) >= 5: |
| | | # 大卖单信息:(金额, 最新价格, 订单号) |
| | | self.__code_big_sell_money_list_dict[code].append((item[2][2], item[2][4], item[2][0])) |
| | | |
| | | self.__latest_price[code] = item[2][4] |
| | | |
| | | def get_code_money_dict(self): |
| | |
| | | @param code: |
| | | @return:[(金额, 价格, 订单号)] |
| | | """ |
| | | return self.__code_big_buy_mmoney_list_dict.get(code) |
| | | return self.__code_big_buy_money_list_dict.get(code) |
| | | |
| | | def get_big_sell_money_list(self, code): |
| | | """ |
| | | 获取代码的大买单列表 |
| | | @param code: |
| | | @return:[(金额, 价格, 订单号)] |
| | | """ |
| | | return self.__code_big_sell_money_list_dict.get(code) |
| | | |
| | | def get_latest_price(self, code): |
| | | return self.__latest_price.get(code) |