| | |
| | | import datetime |
| | | import json |
| | | import time |
| | | from tool import async_call |
| | | |
| | | import l2_data_manager |
| | | import tool |
| | | from trade_gui import async_call |
| | | |
| | | |
| | | def run_time(): |
| | |
| | | return True |
| | | sell_datas = local_today_num_operate_map.get( |
| | | "{}-{}-{}".format(sell_cancel_data["val"]["num"], "2", sell_cancel_data["val"]["price"])) |
| | | if sell_datas: |
| | | for i in range(0, len(sell_datas)): |
| | | data = sell_datas[i] |
| | | if int(data["val"]["operateType"]) != 2: |
| | |
| | | break |
| | | |
| | | |
| | | # 保存l2最新数据的大小 |
| | | @async_call |
| | | def save_l2_latest_data_number(code, num): |
| | | redis = l2_data_manager._redisManager.getRedis() |
| | | redis.setex("l2_latest_data_num-{}".format(code), 3, num) |
| | | |
| | | |
| | | # 获取最新数据条数 |
| | | def get_l2_latest_data_number(code): |
| | | redis = l2_data_manager._redisManager.getRedis() |
| | | num = redis.get("l2_latest_data_num-{}".format(code)) |
| | | if num is not None: |
| | | return int(num) |
| | | return None |
| | | |
| | | |
| | | # l2数据拼接工具 |
| | | class L2DataConcatUtil: |
| | | |
| | |
| | | def get_add_datas(self): |
| | | # 查询当前数据是否在最近一次数据之后 |
| | | if self.last_datas and self.datas: |
| | | if int(self.datas[-1]["val"]["time"].replace(":", "")) - int(self.last_datas[-1]["val"]["time"].replace(":", "")) < 0: |
| | | if int(self.datas[-1]["val"]["time"].replace(":", "")) - int( |
| | | self.last_datas[-1]["val"]["time"].replace(":", "")) < 0: |
| | | return [] |
| | | |
| | | # 获取拼接点 |