From 045a5aa6434da6e83c3d850b17e7e58cd7b55ef5 Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期一, 15 五月 2023 15:46:32 +0800 Subject: [PATCH] 开盘啦板块影响交易逻辑 --- gui.py | 73 ++++++++++++++++++++---------------- 1 files changed, 41 insertions(+), 32 deletions(-) diff --git a/gui.py b/gui.py index 6282b5e..9fe9591 100644 --- a/gui.py +++ b/gui.py @@ -22,13 +22,14 @@ from trade import l2_trade_util from trade.l2_trade_factor import L2TradeFactorUtil from ocr import ocr_server -from third_data import data_server +from third_data import data_server, kpl_data_manager, kpl_util from server import * import l2.l2_data_util # 璇诲彇server杩涚▼鐨勬秷鎭� from trade.trade_data_manager import CodeActualPriceProcessor +from ui.my_widget import FlatButton def __read_server_pipe(pipe): @@ -217,7 +218,7 @@ text = Text(frame, height=100, undo=True) text.place(x=0, y=40) - btn = Button(frame, text="杩愯鐜妫�娴�", command=click) + btn = FlatButton(frame, text="杩愯鐜妫�娴�", command=click) btn.place(x=5, y=5) frame.grid(row=1, column=2) @@ -303,20 +304,27 @@ # table.model.setValueAt(data["apply_time"], index, 2) index += 1 table.redraw() + # 鍒锋柊寮�鐩樺暒鏁版嵁 + def refresh_kpl_data(): + kpl_data_manager.KPLDataManager().get_data(kpl_util.KPLDataType.LIMIT_UP) + kpl_data_manager.KPLDataManager().get_data(kpl_util.KPLDataType.OPEN_LIMIT_UP) + kpl_data_manager.KPLDataManager().get_data(kpl_util.KPLDataType.BEST_FENG_KOU) + kpl_data_manager.KPLDataManager().get_data(kpl_util.KPLDataType.FENG_KOU) + kpl_data_manager.KPLDataManager().get_data(kpl_util.KPLDataType.FENG_XIANG) + start_y = 225 - btn = Button(frame, text="鍒锋柊鏀剁洏浠�", command=refresh_close_price_data) + btn = FlatButton(frame, text="鍒锋柊鏀剁洏浠�", command=refresh_close_price_data) btn.place(x=5, y=start_y) sv_num = StringVar(value="鑾峰彇鍒版敹鐩樹环鏁伴噺锛氭湭鐭�") cl = Label(frame, textvariable=sv_num, bg="#DDDDDD", fg="#666666") cl.place(x=5, y=start_y + 30) - btn = Button(frame, text="閲嶆柊鑾峰彇鏀剁洏浠�", command=re_get_close_price) - btn.place(x=130, y=start_y) - - btn = Button(frame, text="浠婃棩娑ㄥ仠", command=get_limit_up_codes_win) - btn.place(x=250, y=start_y) + btn = FlatButton(frame, text="閲嶆柊鑾峰彇鏀剁洏浠�", command=re_get_close_price) + btn.place(x=80, y=start_y) + kpl_data = Label(text="娑ㄥ仠锛歕n鐐告澘锛歕n鏈�寮猴細\n椋庡悜锛歕n椋庡彛锛�",bg="#DDDDDD",fg="#666666") + kpl_data.place(x=190, y=start_y) trade_win_datas = [] # draw_trade_buy_win(360, 140) @@ -332,7 +340,7 @@ refresh_trade_buy_win_data() refresh_close_price_data() - btn = Button(frame, text="鍒锋柊", command=refresh_trade_buy_win_data, height=1) + btn = FlatButton(frame, text="鍒锋柊", command=refresh_trade_buy_win_data) btn.place(x=450 - 35, y=start_y) def re_distribute_buy_win(): @@ -348,7 +356,7 @@ except Exception as e: showerror("鍒嗛厤鍑洪敊", str(e)) - btn = Button(frame, text="閲嶆柊鍒嗛厤绐楀彛", command=re_distribute_buy_win, height=1) + btn = FlatButton(frame, text="閲嶆柊鍒嗛厤绐楀彛", command=re_distribute_buy_win) btn.place(x=450 - 83, y=start_y + 30) # 缁樺埗浜ゆ槗鐘舵�� @@ -436,7 +444,7 @@ start_y = 285 - btn = Button(frame, text="鍒锋柊鐘舵��", command=refresh_data) + btn = FlatButton(frame, text="鍒锋柊鐘舵��", command=refresh_data) btn.place(x=10, y=start_y) auo_refresh = IntVar() @@ -579,7 +587,7 @@ win.resizable(height=False, width=False) text = Text(win, height=100, undo=True) text.place(x=0, y=30) - btn = Button(win, text="涓�閿慨澶�", command=repair) + btn = FlatButton(win, text="涓�閿慨澶�", command=repair) btn.place(x=0, y=0) line = 0 @@ -652,10 +660,10 @@ else: accept_l2.set(0) - btn = Button(frame, text="姣忔棩鍒濆鍖�", command=init) + btn = FlatButton(frame, text="姣忔棩鍒濆鍖�", command=init) btn.place(x=width - 250, y=5) - btn = Button(frame, text="鍒锋柊鏁版嵁", command=refresh_data) + btn = FlatButton(frame, text="鍒锋柊鏁版嵁", command=refresh_data) btn.place(x=width - 150, y=5) auo_refresh = IntVar() ch1 = Checkbutton(frame, text='鑷姩鍒锋柊', variable=auo_refresh, onvalue=1, offvalue=0, background="#DDDDDD", @@ -676,16 +684,17 @@ menu.add_command(label="鐜妫�娴�", command=check_env) menu.add_command(label="鍚岃姳椤烘祴閫�", command=ths_test_speed) + device_index =0 for key in self.l2_codes: - - client_lb = Label(frame, text="璁惧:{}".format(key), background="#DDDDDD") + device_index += 1 + client_lb = Label(frame, text="璁惧:{} ID:{}".format(device_index,key), background="#DDDDDD") client_lb.place(x=38, y=40 + l2_client_count * 30) - btn = Button(frame, text="妫�娴�", command=key) + btn = FlatButton(frame, text="妫�娴�", command=key) btn.bind('<Button-3>', lambda event: pop_menu(event)) 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=82, y=40 + l2_client_count * 30) + client_state_lb.place(x=112, y=40 + l2_client_count * 30) client_state[key] = client_state_lb code_sv_map[key] = [] code_labels[key] = [] @@ -697,7 +706,7 @@ code_labels[key].append(code_label) code_label.place(x=0, y=0) - cframe.place(x=200 + i * 85, y=40 + l2_client_count * 30) + cframe.place(x=250 + i * 85, y=40 + l2_client_count * 30) l2_client_count += 1 # 娣诲姞鏇存柊绾跨▼ t1 = threading.Thread(target=lambda: update_data()) @@ -794,7 +803,7 @@ cl = Label(frame, textvariable=sv_trade_money, bg="#DDDDDD", fg="#666666") cl.place(x=190, y=5) - btn = Button(frame, text="鍒锋柊鏁版嵁", command=refresh_data) + btn = FlatButton(frame, text="鍒锋柊鏁版嵁", command=refresh_data) btn.place(x=width - 150, y=5) auo_refresh = IntVar() ch1 = Checkbutton(frame, text='鑷姩鍒锋柊', variable=auo_refresh, onvalue=1, offvalue=0, background="#DDDDDD", @@ -887,7 +896,7 @@ entry = Entry(frame, textvariable=token_var, width=30) entry.place(x=left + 60, y=top + 60) - btn = Button(frame, text="璁剧疆鎺橀噾鍙傛暟", command=click) + btn = FlatButton(frame, text="璁剧疆鎺橀噾鍙傛暟", command=click) btn.place(x=left + 60, y=top + 90) # frame.place(x=260,y=10) frame.grid(row=0, column=2, pady=5, padx=5) @@ -991,40 +1000,40 @@ code = Entry(frame) code.place(x=50, y=70) - btn = Button(frame, text="璁剧疆浠g爜", command=lambda: setGPCode(ep_client.get(), ep.get(), code.get()), ) + btn = FlatButton(frame, text="璁剧疆浠g爜", command=lambda: setGPCode(ep_client.get(), ep.get(), code.get()), ) btn.place(x=10, y=100) - btn = Button(frame, text="淇L2鏁版嵁", command=lambda: L2CodeOperate.get_instance().repaire_l2_data(code.get())) + btn = FlatButton(frame, text="淇L2鏁版嵁", command=lambda: L2CodeOperate.get_instance().repaire_l2_data(code.get())) btn.place(x=70 , y=100) - btn = Button(frame, text="瀵煎嚭L2鏁版嵁", command=lambda: export_l2_data(code.get())) + btn = FlatButton(frame, text="瀵煎嚭L2鏁版嵁", command=lambda: export_l2_data(code.get())) btn.place(x=145, y=100) - btn = Button(frame, text="瀵煎嚭L2鍘熷鏁版嵁", command=lambda: export_l2_data_origin(code.get())) + btn = FlatButton(frame, text="瀵煎嚭L2鍘熷鏁版嵁", command=lambda: export_l2_data_origin(code.get())) btn.place(x=220, y=100) - btn = Button(frame, text="鑾峰彇m鍊�", command=lambda: compute_m(code.get())) + btn = FlatButton(frame, text="鑾峰彇m鍊�", command=lambda: compute_m(code.get())) btn.place(x=10, y=130) - btn = Button(frame, text="瀵煎嚭浜ゆ槗鏃ュ織", command=lambda: log.export_l2_log(code.get())) + btn = FlatButton(frame, text="瀵煎嚭浜ゆ槗鏃ュ織", command=lambda: log.export_l2_log(code.get())) btn.place(x=80, y=130) - btn = Button(frame, text="娓呯┖l2鏁版嵁", command=lambda: clear_l2(code.get())) + btn = FlatButton(frame, text="娓呯┖l2鏁版嵁", command=lambda: clear_l2(code.get())) btn.place(x=150, y=130) - btn = Button(frame, text="鎾ら攢鎸傚崟", command=lambda: cancel_order(code.get())) + btn = FlatButton(frame, text="鎾ら攢鎸傚崟", command=lambda: cancel_order(code.get())) btn.place(x=230, y=130) # 浜ゆ槗鎸夐挳 - btn = Button(frame, textvariable=btntext, command=startJueJinGui) + btn = FlatButton(frame, textvariable=btntext, command=startJueJinGui) btn.place(x=10, y=160) btntext.set("鍚姩鎺橀噾") - btn = Button(frame, text="閲嶆柊璁㈤槄琛屾儏", command=resub) + btn = FlatButton(frame, text="閲嶆柊璁㈤槄琛屾儏", command=resub) btn.place(x=10, y=190) - btn = Button(frame, text="鍒锋柊绐楀彛鍙ユ焺", command=refresh_hwnds) + btn = FlatButton(frame, text="鍒锋柊绐楀彛鍙ユ焺", command=refresh_hwnds) btn.place(x=200, y=190) def create_gui(self): -- Gitblit v1.8.0