| | |
| | | # tcpserver.handle_request() # 只接受一个客户端连接 |
| | | tcpserver.serve_forever() # 永久循环执行,可以接受多个客户端连接 |
| | | |
| | | |
| | | def createOCRServer(): |
| | | print("create OCRServer") |
| | | laddr = "", 9002 |
| | |
| | | self.serverProcess = multiprocessing.Process(target=createServer, args=(p1, gs_server_pipe,)) |
| | | self.jueJinProcess = multiprocessing.Process(target=startJueJin, args=(p2,)) |
| | | self.ocrServerProcess = multiprocessing.Process(target=createOCRServer) |
| | | |
| | | |
| | | |
| | | |
| | | self.p1 = p1 |
| | | self.p2 = p2 |
| | |
| | | win.geometry("{}x{}".format(width, height)) |
| | | win.mainloop() |
| | | |
| | | # 绘制代码交易窗口分配 |
| | | def refresh_trade_buy_win_data(): |
| | | code_wins = trade_gui.THSBuyWinManagerNew.get_distributed_code_wins() |
| | | # 获取代码涨幅 |
| | | codeActualPriceProcessor = trade_data_manager.CodeActualPriceProcessor() |
| | | datas = [] |
| | | for data in code_wins: |
| | | rate = codeActualPriceProcessor.get_current_rate(data[0]) |
| | | datas.append((data[0], rate, data[1])) |
| | | datas.sort(key=lambda tup: tup[1] if tup[1] is not None else 1) |
| | | datas.reverse() |
| | | index = 0 |
| | | table.model.deleteRows() |
| | | for data in datas: |
| | | table.model.addRow() |
| | | table.model.setValueAt(data[0], index, 0) |
| | | table.model.setValueAt(f"{data[1]}%", index, 1) |
| | | table.model.setValueAt(data[2], index, 2) |
| | | # table.model.setValueAt(data["apply_time"], index, 2) |
| | | index += 1 |
| | | table.redraw() |
| | | |
| | | btn = Button(frame, text="刷新收盘价", command=refresh_close_price_data) |
| | | btn.place(x=5, y=150) |
| | | |
| | | |
| | | sv_num = StringVar(value="获取到收盘价数量:未知") |
| | | cl = Label(frame, textvariable=sv_num, bg="#DDDDDD", fg="#666666") |
| | |
| | | |
| | | btn = Button(frame, text="今日涨停", command=get_limit_up_codes_win) |
| | | btn.place(x=300, y=150) |
| | | |
| | | trade_win_datas = [] |
| | | # draw_trade_buy_win(360, 140) |
| | | table_width = 300 |
| | | table_height = 90 |
| | | _frame = Frame(frame, {"height": table_height, "width": table_width, "bg": "#DDDDDD"}) |
| | | |
| | | table = tkintertable.TableCanvas(_frame, data={"row0": {'代码': '', '涨幅': '', '窗口句柄': ''}}, read_only=True, |
| | | width=table_width, height=table_height, thefont=('微软雅黑', 9), cellwidth=100, |
| | | rowheaderwidth=20) |
| | | table.show() |
| | | _frame.place(x=380-12, y=130) |
| | | refresh_trade_buy_win_data() |
| | | refresh_close_price_data() |
| | | |
| | | btn = Button(frame, text="刷新", command=refresh_trade_buy_win_data,height=1) |
| | | btn.place(x=730-12, y=130) |
| | | |
| | | def re_distribute_buy_win(): |
| | | try: |
| | | juejin.distribute_buy_win() |
| | | refresh_trade_buy_win_data() |
| | | showinfo("提示", "分配完成") |
| | | except Exception as e: |
| | | showerror("分配出错", str(e)) |
| | | |
| | | btn = Button(frame, text="重新分配窗口", command=re_distribute_buy_win, height=1) |
| | | btn.place(x=730-12, y=165) |
| | | |
| | | # 绘制交易状态 |
| | | def __draw_trade_state(self, frame): |
| | |
| | | cl = Label(frame, text="今日委托:", bg="#DDDDDD", fg="#666666") |
| | | cl.place(x=5, y=30) |
| | | delegate_datas = {} |
| | | delegate_datas["row{}".format(0)] = {'委托时间': '', '代码': '', '申报时间': '', '委托数量': '', '委托价格': '', '成交均价': '', '成交数量': '', |
| | | delegate_datas["row{}".format(0)] = {'委托时间': '', '代码': '', '申报时间': '', '委托数量': '', '委托价格': '', '成交均价': '', |
| | | '成交数量': '', |
| | | '操作': ''} |
| | | |
| | | cl = Label(frame, text="更新时间:", bg="#DDDDDD", fg="#666666") |