| | |
| | | |
| | | import win32gui |
| | | |
| | | import constant |
| | | import data_export_util |
| | | import multiprocessing |
| | | |
| | |
| | | clients = authority.get_l2_clients() |
| | | for client_id in clients: |
| | | self.l2_codes[client_id] = [] |
| | | for i in range(0, 8): |
| | | for i in range(0, constant.L2_CODE_COUNT_PER_DEVICE): |
| | | code = gpcode_manager.get_listen_code_by_pos(client_id, i) |
| | | self.l2_codes[client_id].append(code) |
| | | |
| | |
| | | index += 1 |
| | | table.redraw() |
| | | |
| | | start_y = 160 |
| | | start_y = 225 |
| | | btn = Button(frame, text="刷新收盘价", command=refresh_close_price_data) |
| | | btn.place(x=5, y=start_y) |
| | | |
| | |
| | | except: |
| | | pass |
| | | |
| | | |
| | | try: |
| | | codes = self.thsBuy1VolumnManager.get_current_codes() |
| | | count = 0 |
| | |
| | | except: |
| | | pass |
| | | |
| | | |
| | | |
| | | |
| | | # 获取有效的L2客户端数量 |
| | | l2_client_count = client_manager.getValidL2Clients() |
| | | if len(l2_client_count) < 2: |
| | |
| | | pass |
| | | time.sleep(2) |
| | | |
| | | start_y = 225 |
| | | start_y = 285 |
| | | |
| | | btn = Button(frame, text="刷新状态", command=refresh_data) |
| | | btn.place(x=10, y=start_y) |
| | |
| | | else: |
| | | client_state[client_id].configure(text="(离线:未知IP)", foreground="#999999") |
| | | |
| | | for i in range(0, 8): |
| | | for i in range(0, constant.L2_CODE_COUNT_PER_DEVICE): |
| | | 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: |
| | |
| | | check(self.selected_client) |
| | | |
| | | width = 800 |
| | | height = 290 |
| | | height = 360 |
| | | frame = Frame(root, {"height": height, "width": width, "bg": "#DDDDDD"}) |
| | | cl = Label(frame, text="L2采集状态", bg="#DDDDDD") |
| | | cl.place(x=5, y=5) |
| | |
| | | btn.place(x=5, y=35 + l2_client_count * 30) |
| | | |
| | | client_state_lb = Label(frame, text="(未知)", padx=0, pady=0, background="#DDDDDD", font=('微软雅黑', 8)) |
| | | client_state_lb.place(x=80, y=40 + l2_client_count * 30) |
| | | client_state_lb.place(x=82, y=40 + l2_client_count * 30) |
| | | client_state[key] = client_state_lb |
| | | code_sv_map[key] = [] |
| | | code_labels[key] = [] |
| | | for i in range(0, 8): |
| | | for i in range(0, constant.L2_CODE_COUNT_PER_DEVICE): |
| | | sv = StringVar(value=self.l2_codes[key][i]) |
| | | code_sv_map[key].append(sv) |
| | | cframe = Frame(frame, {"height": 23, "width": 70, "bg": "#FFFFFF"}) |
| | | cframe = Frame(frame, {"height": 23, "width": 80, "bg": "#FFFFFF"}) |
| | | code_label = Label(cframe, textvariable=sv, background="#FFFFFF", foreground="#FF0000") |
| | | code_labels[key].append(code_label) |
| | | |
| | | code_label.place(x=0, y=0) |
| | | cframe.place(x=200 + i * 75, y=40 + l2_client_count * 30) |
| | | cframe.place(x=200 + i * 85, y=40 + l2_client_count * 30) |
| | | l2_client_count += 1 |
| | | # 添加更新线程 |
| | | t1 = threading.Thread(target=lambda: update_data()) |
| | |
| | | pass |
| | | |
| | | # 禁止代码 |
| | | def forbidden_code(code_): |
| | | l2_trade_util.forbidden_trade(code_) |
| | | showinfo("提示","禁止成功") |
| | | def cancel_order(code_): |
| | | try: |
| | | l2.l2_data_util.load_l2_data(code_, True) |
| | | l2_data_manager_new.L2TradeDataProcessor.cancel_buy(code_, "手动撤销") |
| | | showinfo("提示", "撤单成功") |
| | | except Exception as e: |
| | | showwarning("提示", "撤单成功异常" + str(e)) |
| | | |
| | | frame = Frame(root, {"height": 280, "width": 300, "bg": "#DDDDDD"}) |
| | | frame.grid(row=2, column=2, rowspan=2, pady=5) |
| | |
| | | btn = Button(frame, text="清空l2数据", command=lambda: clear_l2(code.get())) |
| | | btn.place(x=150, y=130) |
| | | |
| | | btn = Button(frame, text="禁止交易", command=lambda: forbidden_code(code.get())) |
| | | btn = Button(frame, text="撤销挂单", command=lambda: cancel_order(code.get())) |
| | | btn.place(x=230, y=130) |
| | | |
| | | # 交易按钮 |
| | |
| | | self.__draw_trade_data(root) |
| | | self.__draw_test(root) |
| | | |
| | | root.geometry("1120x600") |
| | | root.geometry("1120x660") |
| | | root.mainloop() |
| | | |
| | | |