| | |
| | | import constant |
| | | import redis_manager |
| | | import tool |
| | | import l2_data_manager |
| | | from l2 import l2_data_manager |
| | | import l2.l2_data_util |
| | | |
| | | |
| | |
| | | return None |
| | | return int(val) |
| | | |
| | | # 最近的非涨停买1的时间 |
| | | def __save_latest_not_limit_up_time(self, code, time_str): |
| | | key = "latest_not_limit_up_time-{}".format(code) |
| | | self.__getRedis().setex(key, tool.get_expire(), time_str) |
| | | |
| | | def __get_latest_not_limit_up_time(self, code): |
| | | key = "latest_not_limit_up_time-{}".format(code) |
| | | self.__getRedis().get(key) |
| | | |
| | | # 保存数据,返回保存数据的条数 |
| | | def save(self, code, limit_up_price, queues): |
| | | def save(self, code, limit_up_price, buy_1_price, buy_1_time, queues): |
| | | # 如果买1不为涨停价就不需要保存 |
| | | if queues == self.last_buy_queue_data.get(code): |
| | | return None |
| | | if abs(float(buy_1_price) - float(limit_up_price)) >= 0.01: |
| | | # 保存最近的涨停起始时间 |
| | | self.__save_latest_not_limit_up_time(code, buy_1_time) |
| | | return None |
| | | |
| | | self.last_buy_queue_data[code] = queues |
| | | min_num = round(constant.L2_MIN_MONEY / (limit_up_price * 100)) |
| | | num_list = [] |
| | |
| | | def save_traded_index(self, code, buy1_price, buyQueueBig): |
| | | total_datas = l2_data_manager.local_today_datas.get(code) |
| | | today_num_operate_map = l2_data_manager.local_today_num_operate_map.get(code) |
| | | index = l2.l2_data_util.L2TradeQueueUtils.find_traded_progress_index(buy1_price, total_datas, total_datas, |
| | | today_num_operate_map, buyQueueBig) |
| | | index = l2.l2_data_util.L2TradeQueueUtils.find_traded_progress_index(buy1_price, total_datas, |
| | | today_num_operate_map, buyQueueBig,self.__get_latest_not_limit_up_time(code)) |
| | | if index is not None: |
| | | # 保存成交进度 |
| | | self.__save_buy_progress_index(code, index) |
| | |
| | | index = self.__get_buy_progress_index(code) |
| | | return index |
| | | |
| | | |
| | | if __name__ == '__main': |
| | | |
| | | |
| | | pass |