| | |
| | | def __get_redis(self): |
| | | return self.__redisManager.getRedis() |
| | | |
| | | # 保存最大量 |
| | | def __save_max_buy1_volume(self, code, volume): |
| | | key = "max_buy1_volumn-{}".format(code) |
| | | self.__get_redis().setex(key, tool.get_expire(), volume) |
| | | |
| | | def __get_max_buy1_volume(self, code): |
| | | key = "max_buy1_volumn-{}".format(code) |
| | | val = self.__get_redis().get(key) |
| | | if val is not None: |
| | | return int(val) |
| | | return None |
| | | |
| | | def __save_recod(self, code, time_str, volumn): |
| | | |
| | | # 保存每一次的 |
| | |
| | | return False, False, None |
| | | self.__last_data[code] = volumn |
| | | |
| | | if int(time_str.replace(':', '')) >= int("093000"): |
| | | # 保存最大量(9:30过后的量) |
| | | max_volume = self.__get_max_buy1_volume(code) |
| | | if max_volume is None: |
| | | max_volume = 0 |
| | | if volumn > max_volume: |
| | | self.__save_max_buy1_volume(code, volumn) |
| | | |
| | | if code not in self.__code_time_volumn_dict: |
| | | self.__code_time_volumn_dict[code] = {} |
| | | self.__code_time_volumn_dict[code][time_str] = volumn |
| | |
| | | time_str, volumn = self.__get_latest_record(code) |
| | | return time_str, volumn |
| | | |
| | | def get_max_buy1_volume(self, code): |
| | | val = self.__get_max_buy1_volume(code) |
| | | if val is None: |
| | | return -1 |
| | | return val |
| | | |
| | | |
| | | class JueJinBuy1VolumnManager: |
| | | __redisManager = redis_manager.RedisManager(1) |