| | |
| | | import data_export_util |
| | | import multiprocessing |
| | | |
| | | import log |
| | | import mysql_data |
| | | import redis_manager |
| | | import server |
| | |
| | | |
| | | |
| | | # 读取server进程的消息 |
| | | from trade_data_manager import CodeActualPriceProcessor |
| | | |
| | | |
| | | def __read_server_pipe(pipe): |
| | | while True: |
| | | value = pipe.recv() |
| | |
| | | |
| | | class GUI: |
| | | |
| | | |
| | | def __init__(self): |
| | | p1, p2 = multiprocessing.Pipe() |
| | | gs_gui_pipe, gs_server_pipe = multiprocessing.Pipe() |
| | |
| | | self.p1 = p1 |
| | | self.p2 = p2 |
| | | self.gs_gui_pipe = gs_gui_pipe |
| | | self.thsBuy1VolumnManager = THSBuy1VolumnManager() |
| | | self.codeActualPriceProcessor = CodeActualPriceProcessor() |
| | | # L2显示 |
| | | self.l2_codes = {} |
| | | # 获取l2的客户端列表 |
| | |
| | | self.l2_codes[client_id].append(code) |
| | | |
| | | # 读取server进程的消息 |
| | | def __read_gui_server_pipe(self,pipe): |
| | | def __read_gui_server_pipe(self, pipe): |
| | | while True: |
| | | value = pipe.recv() |
| | | if value is not None: |
| | | value = json.loads(value) |
| | | if value.get("type") == "l2_data_notify": |
| | | code = value["data"]["code"] |
| | | count =value["data"]["count"] |
| | | print("l2数据通知:{}-{}", code,count) |
| | | count = value["data"]["count"] |
| | | print("l2数据通知:{}-{}", code, count) |
| | | |
| | | time.sleep(0.1) |
| | | |
| | |
| | | cl_win.configure(text="异常:{}".format(str(e)), foreground="#FF7F27") |
| | | |
| | | try: |
| | | juejin_length= JueJinManager.get_listen_codes_lenth() |
| | | juejin_length = JueJinManager.get_listen_codes_lenth() |
| | | codes_length = len(gpcode_manager.get_gp_list()) |
| | | cl_codes.configure(text="{}/{}".format(juejin_length,codes_length), foreground="#008000") |
| | | cl_codes.configure(text="{}/{}".format(juejin_length, codes_length), foreground="#008000") |
| | | except Exception as e: |
| | | pass |
| | | |
| | | try: |
| | | codes = self.thsBuy1VolumnManager.get_current_codes() |
| | | count = 0 |
| | | if codes: |
| | | count = len(codes) |
| | | cl_buy_1.configure(text="{}".format(count), foreground="#008000") |
| | | except: |
| | | pass |
| | | |
| | | |
| | | try: |
| | | cl_price_count.configure(text="{}".format(self.codeActualPriceProcessor.get_current_price_codes_count()), foreground="#008000") |
| | | except: |
| | | pass |
| | | |
| | | # 状态有问题,需要报警 |
| | | if not normal: |
| | |
| | | cl_codes = Label(frame, text="未知", bg="#DDDDDD") |
| | | cl_codes.place(x=450, y=y_) |
| | | |
| | | cl = Label(frame, text="买1代码数量:", bg="#DDDDDD") |
| | | cl.place(x=500, y=y_) |
| | | cl_buy_1 = Label(frame, text="未知", bg="#DDDDDD") |
| | | cl_buy_1.place(x=580, y=y_) |
| | | |
| | | cl = Label(frame, text="现价代码数量:", bg="#DDDDDD") |
| | | cl.place(x=620, y=y_) |
| | | cl_price_count = Label(frame, text="未知", bg="#DDDDDD") |
| | | cl_price_count.place(x=700, y=y_) |
| | | |
| | | refresh_data() |
| | | # 添加更新线程 |
| | | t1 = threading.Thread(target=lambda: update_data()) |
| | |
| | | code = gpcode_manager.get_listen_code_by_pos(client_id, i) |
| | | data_count = l2_data_util.get_l2_latest_data_number(code) |
| | | if data_count is None: |
| | | data_count=0 |
| | | data_count = 0 |
| | | if code is not None and len(code) > 0: |
| | | code_sv_map[client_id][i].set(code + "({})".format(data_count)) |
| | | else: |
| | |
| | | showinfo("提示", "导出完成") |
| | | |
| | | def compute_m(code): |
| | | m,msg = L2TradeFactorUtil.compute_m_value(code) |
| | | m, msg = L2TradeFactorUtil.compute_m_value(code) |
| | | showinfo("提示", "{}".format(m)) |
| | | |
| | | def clear_l2(code): |