| | |
| | | |
| | | import win32gui |
| | | |
| | | import alert_util |
| | | import data_export_util |
| | | import multiprocessing |
| | | |
| | | import global_util |
| | | import log |
| | | import mysql_data |
| | | import redis_manager |
| | | import server |
| | | import trade_gui |
| | | from juejin import JueJinManager |
| | | from l2_code_operate import L2CodeOperate |
| | | from l2_trade_factor import L2TradeFactorUtil |
| | | |
| | |
| | | def createServer(pipe_juejin, pipe_gui): |
| | | print("create SocketServer") |
| | | # 初始化参数 |
| | | global_util.init() |
| | | global_data_loader.init() |
| | | |
| | | t1 = threading.Thread(target=lambda: __read_server_pipe(pipe_gui)) |
| | | # 后台运行 |
| | |
| | | except Exception as e: |
| | | normal = False |
| | | cl_win.configure(text="异常:{}".format(str(e)), foreground="#FF7F27") |
| | | |
| | | try: |
| | | 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") |
| | | except Exception as e: |
| | | pass |
| | | |
| | | |
| | | |
| | | # 状态有问题,需要报警 |
| | | if not normal: |
| | | alert_util.alarm() |
| | |
| | | cl_win = Label(frame, text="未知", bg="#DDDDDD") |
| | | cl_win.place(x=300, y=y_) |
| | | |
| | | cl = Label(frame, text="掘金代码回调数量:", bg="#DDDDDD") |
| | | cl.place(x=350, y=y_) |
| | | cl_codes = Label(frame, text="未知", bg="#DDDDDD") |
| | | cl_codes.place(x=450, y=y_) |
| | | |
| | | refresh_data() |
| | | # 添加更新线程 |
| | | t1 = threading.Thread(target=lambda: update_data()) |
| | |
| | | |
| | | def refresh_data(): |
| | | for client_id in code_sv_map: |
| | | ip = data_process.getActiveClientIP(client_id) |
| | | ths_dead = data_process.getTHSState(client_id) |
| | | ip = client_manager.getActiveClientIP(client_id) |
| | | ths_dead = client_manager.getTHSState(client_id) |
| | | if ip is not None and len(ip) > 0: |
| | | if ths_dead: |
| | | client_state[client_id].configure(text="(在线:{})".format(ip), foreground="#FF7F27") |
| | |
| | | |
| | | for i in range(0, 8): |
| | | code = gpcode_manager.get_listen_code_by_pos(client_id, i) |
| | | data_count = l2_data_manager.get_l2_data_latest_count(code) |
| | | data_count = l2_data_util.get_l2_latest_data_number(code) |
| | | if data_count is None: |
| | | 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 = L2TradeFactorUtil.compute_m_value(code) |
| | | m,msg = L2TradeFactorUtil.compute_m_value(code) |
| | | showinfo("提示", "{}".format(m)) |
| | | |
| | | def clear_l2(code): |