| | |
| | | SERVER_HOST = "43.138.167.68" |
| | | # SERVER_HOST = "192.168.3.122" |
| | | WEB_HOST = "192.168.3.252" |
| | | IS_TEST = False |
| | | IS_TEST = True |
| | |
| | | </span> |
| | | <button class="btn" style="font-size: 15px;margin: 5px;" v-on:click="load_data">加载数据</button> |
| | | </div> |
| | | <div class="nav" style="background-color: white;"> |
| | | <div :class="{'active': data_type==0 }" v-on:click="change_data_type(0)">交易数据</div> |
| | | <div :class="{'active': data_type==1 }" v-on:click="change_data_type(1)">L2数据</div> |
| | | </div> |
| | | |
| | | <!-- 交易参数 --> |
| | | |
| | | <!-- 交易参数 --> |
| | | |
| | | <table style="position: relative;margin-top: 40px;" > |
| | | <caption class="table-name"> |
| | | <span> |
| | | 买入预期(可用:¥{{account_available_money}}) |
| | | </span> |
| | | <button style="position: absolute;right: 5px;top: 16px;font-size: 14px;" class="btn" v-on:click="get_delegated_buy_code_infos">刷新</button> |
| | | </caption> |
| | | |
| | | <thead> |
| | | <tr v-if="delegated_buy_code_infos.length>0"> |
| | | <td> |
| | | <div class="delegated_codes_info"> |
| | | <div v-for="(item,index) in delegated_buy_code_infos" class="delegate_item"> |
| | | <div> |
| | | <div>{{item.code_info[0]}}</div> |
| | | <div>{{item.code_info[1]}}</div> |
| | | </div> |
| | | <div> |
| | | <div style="display: flex;justify-content: space-between;align-items: center;"> |
| | | <div style="color: red;" :style="{'visibility': item.pay_attention?'visible':'hidden' }">***</div> |
| | | <div class="layui-progress" style="background-color: #BBB; width: 75%; visibility: hidden;" :id="'progress_'+item.code_info[0]"> |
| | | <div class="layui-progress-bar" lay-percent="{{item.percent+'%'}}" ></div> |
| | | </div> |
| | | <div> |
| | | <button class="layui-btn layui-btn-xs layui-btn-danger" v-on:click="cancel_order(item.code_info[0])">撤单</button> |
| | | <button class="layui-btn layui-btn-xs" v-on:click="view_details(item.code_info[0],true)">查看</button> |
| | | </div> |
| | | |
| | | </div> |
| | | |
| | | |
| | | <div> |
| | | 剩<span :class="{'red':item.left_count <=4}">{{item.left_count}}</span>笔<span>{{item.left_money}}/封单{{item.buy1_money}}【比例:{{item.trade_progress_percent+'%'}}】</span>,已成大单 |
| | | {{item.big_num_count}}笔{{item.big_num_money}} 待成前大单{{item.not_deal_big_num_count[0]}}笔{{item.not_deal_big_num_money[0]}} 待成后大单{{item.not_deal_big_num_count[1]}}笔{{item.not_deal_big_num_money[1]}} |
| | | </div> |
| | | </div> |
| | | |
| | | <div style="margin-top: 70px;" class="scroll-y"> |
| | | </div> |
| | | </div> |
| | | </td> |
| | | </tr> |
| | | </thead> |
| | | |
| | | <div id="trade_data" :style="{'visibility':data_type==0?'visible':'hidden'}"> |
| | | </table> |
| | | |
| | | <table style="position: relative;margin-top: 40px;" > |
| | | <caption class="table-name"> |
| | | <span> |
| | | 最近撤单 |
| | | </span> |
| | | <button style="position: absolute;right: 5px;top: 16px;font-size: 14px;" class="btn" v-on:click="get_latest_cancel_orders">刷新</button> |
| | | </caption> |
| | | |
| | | <thead> |
| | | <tr style="padding: 2px 0px;"> |
| | | <td>代码</td> |
| | | <td>撤单时间</td> |
| | | <td>下单时间</td> |
| | | <td>价格</td> |
| | | <td>委托量</td> |
| | | <td>操作</td> |
| | | </tr> |
| | | </thead> |
| | | <tbody style="max-height: 50px;" class="scroll-y"> |
| | | <tr v-for="item in latest_cancel_orders"> |
| | | <td>{{item.securityID}}({{item.securityName}})</td> |
| | | <td>{{item.cancelTime}}</td> |
| | | <td>{{item.acceptTime}}</td> |
| | | <td>{{item.limitPrice}}</td> |
| | | <td>{{item.volume}}</td> |
| | | <td><button class="layui-btn layui-btn-xs layui-btn-primary" v-on:click="view_details(item.securityID,false)">查看</button></td> |
| | | </tr> |
| | | |
| | | </tbody> |
| | | |
| | | </table> |
| | | |
| | | |
| | | |
| | | |
| | | <div class="layui-tab layui-tab-card" lay-filter="test-handle"> |
| | | <ul class="layui-tab-title"> |
| | | <li class="layui-this" lay-id="0">交易数据</li> |
| | | <li lay-id="1">L2数据</li> |
| | | |
| | | </ul> |
| | | <div class="layui-tab-content"> |
| | | <div class="layui-tab-item layui-show"> |
| | | <div id="trade_data" class="scroll-y" > |
| | | <div v-if="same_reason_codes"> |
| | | <table class="half-width"> |
| | | <caption class="table-name">昨日相同板块代码({{same_reason_codes.reason}})</caption> |
| | |
| | | </div> |
| | | |
| | | |
| | | <!-- 交易参数 --> |
| | | |
| | | <table style="position: relative;" > |
| | | <caption class="table-name"> |
| | | <span> |
| | | 买入预期 |
| | | </span> |
| | | <button style="position: absolute;right: 5px;top: 16px;font-size: 14px;" class="btn" v-on:click="get_delegated_buy_code_infos">刷新</button> |
| | | </caption> |
| | | |
| | | <thead> |
| | | <tr v-if="delegated_buy_code_infos.length>0"> |
| | | <td> |
| | | <div class="delegated_codes_info"> |
| | | <div v-for="(item,index) in delegated_buy_code_infos"> |
| | | <div> |
| | | <div>{{item.code_info[0]}}</div> |
| | | <div>{{item.code_info[1]}}</div> |
| | | </div> |
| | | <div> |
| | | <div style="display: flex;justify-content: space-between;align-items: center;"> |
| | | <div style="color: red;" :style="{'visibility': item.pay_attention?'visible':'hidden' }">***</div> |
| | | <div class="layui-progress" style="background-color: #BBB; width: 75%;" :id="'progress_'+item.code_info[0]"> |
| | | <div class="layui-progress-bar" lay-percent="{{item.percent+'%'}}" ></div> |
| | | </div> |
| | | <div> |
| | | <button class="layui-btn layui-btn-xs layui-btn-danger" v-on:click="cancel_order(item.code_info[0])">撤单</button> |
| | | <button class="layui-btn layui-btn-xs" v-on:click="view_details(item.code_info[0])">查看</button> |
| | | </div> |
| | | |
| | | </div> |
| | | |
| | | |
| | | <div> |
| | | 剩<span :class="{'red':item.left_count <=4}">{{item.left_count}}</span>笔<span>{{item.left_money}}/封单{{item.buy1_money}}</span>,已成大单 |
| | | {{item.big_num_count}}笔{{item.big_num_money}} 待成大单{{item.not_deal_big_num_count}}笔{{item.not_deal_big_num_money}} |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | </td> |
| | | </tr> |
| | | </thead> |
| | | |
| | | </table> |
| | | |
| | | |
| | | |
| | |
| | | |
| | | |
| | | </div> |
| | | <div id="l2" :style="{'visibility':data_type==1?'visible':'hidden'}"> |
| | | |
| | | |
| | | </div> |
| | | <div class="layui-tab-item"> |
| | | <div style="position: relative;"> |
| | | <div class="l2-nav"> |
| | | <div> |
| | | <ul class="ul-colors"> |
| | |
| | | </div> |
| | | |
| | | |
| | | <div class="l2-content scroll-x"> |
| | | <div class="l2-content scroll-x scroll-y" style="width: 100%;"> |
| | | <div style="width: 700px;"> |
| | | <table style="width: 100%;"> |
| | | <table > |
| | | <thead> |
| | | <tr> |
| | | <td style="width: 40px;">序号</td> |
| | |
| | | </div> |
| | | |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script> |
| | |
| | | height: 12px; |
| | | } |
| | | |
| | | #l2{ |
| | | position: relative; |
| | | top: 0; |
| | | } |
| | | |
| | | .l2-nav{ |
| | | display: flex; |
| | | align-items: center; |
| | | position: fixed; |
| | | top: 67px; |
| | | position: absolute; |
| | | top: 0; |
| | | background-color: white; |
| | | height: 120px; |
| | | z-index: 100; |
| | | } |
| | | .l2-content{ |
| | | position: absolute; |
| | | top: 190px; |
| | | top: 120px; |
| | | height: 1000px; |
| | | z-index: -1; |
| | | } |
| | | |
| | |
| | | .delegated_codes_info .layui-progress{ |
| | | margin-bottom: 5px; |
| | | } |
| | | .delegate_item{ |
| | | border-top: solid 2px gray; |
| | | padding: 2px 2px; |
| | | |
| | | } |
| | | |
| | |
| | | app = new Vue({ |
| | | el: "#app", |
| | | data: { |
| | | element: null, |
| | | code: "000000", |
| | | code_name: "测试代码", |
| | | account_available_money: 0, |
| | | origin_code:null, |
| | | trade_data: {}, |
| | | trade_record: { |
| | |
| | | delegated_buy_code_infos:[], |
| | | layui_element:null, |
| | | l2_cant_buy_reasons:[], |
| | | latest_cancel_orders: [] |
| | | }, |
| | | watch:{ |
| | | delegated_buy_code_infos:function(){ |
| | |
| | | setInterval(function(){ |
| | | if(is_trade_time()){ |
| | | app.get_delegated_buy_code_infos(); |
| | | app.get_latest_cancel_orders(); |
| | | } |
| | | },1000*3); |
| | | |
| | | layui.use(function() { |
| | | app.element = layui.element; |
| | | }); |
| | | |
| | | }, |
| | | methods: { |
| | | change_data_type: function(type) { |
| | | if (app.data_type == type) { |
| | | return; |
| | | } |
| | | app.data_type = type; |
| | | window.scrollTo(0,0); |
| | | // if (app.data_type == type) { |
| | | // return; |
| | | // } |
| | | // app.data_type = type; |
| | | // window.scrollTo(0,0); |
| | | app.element.tabChange('test-handle', type); |
| | | }, |
| | | refresh_trade_progress: function() { |
| | | if (app.code == "000000") { |
| | |
| | | http_util.get_delegated_buy_code_infos(function(result){ |
| | | if (result.code == 0) { |
| | | console.log("已挂买单数据:",result.data); |
| | | result.data.forEach(function(e){ |
| | | result.data.delegates.forEach(function(e) { |
| | | if(e.total_num>0){ |
| | | e.percent = e.finish_num*100/e.total_num; |
| | | }else{ |
| | | e.percent = 0; |
| | | } |
| | | }); |
| | | app.delegated_buy_code_infos = result.data |
| | | app.delegated_buy_code_infos = result.data.delegates; |
| | | app.account_available_money = result.data.account_available_money; |
| | | app.reset_l2_height(); |
| | | |
| | | }else{ |
| | | console.log("已挂买单错误:",result.msg); |
| | | app.delegated_buy_code_infos=[]; |
| | |
| | | }); |
| | | }, |
| | | |
| | | get_latest_cancel_orders: function() { |
| | | http_util.get_latest_cancel_orders(function(res) { |
| | | res = JSON.parse(res); |
| | | console.log("最近的撤单", res); |
| | | if (res.code == 0) { |
| | | app.latest_cancel_orders = res.data; |
| | | app.reset_l2_height(); |
| | | } |
| | | }); |
| | | |
| | | }, |
| | | |
| | | reset_l2_height: function() { |
| | | var height = document.documentElement.clientHeight; |
| | | console.log("屏幕:", height); |
| | | $(".l2-content").eq(0).css("height", (height - 370 - 66 * app |
| | | .delegated_buy_code_infos.length - 24 * app.latest_cancel_orders.length |
| | | ) + "px"); |
| | | }, |
| | | clear_cancel_mark: function() { |
| | | //清除撤单标记 |
| | | app.l_up_cancel_indexes = []; |
| | |
| | | layer.msg("请输入数字"); |
| | | return; |
| | | }else{ |
| | | http_util.set_real_place_order_index(app.code,parseInt(value),function(res){ |
| | | http_util.set_real_place_order_index(app.code, parseInt( |
| | | value), function(res) { |
| | | // 获取到结果 |
| | | console.log(res); |
| | | if(res.code!=0){ |
| | | layer.msg(res.msg,{icon: 5}); |
| | | layer.msg(res.msg, { |
| | | icon: 5 |
| | | }); |
| | | }else{ |
| | | layer.msg("设置成功",{icon: 1}); |
| | | layer.msg("设置成功", { |
| | | icon: 1 |
| | | }); |
| | | } |
| | | }) |
| | | } |
| | | }catch(e){ |
| | | } |
| | | } catch (e) {} |
| | | layer.close(index); |
| | | }); |
| | | |
| | |
| | | |
| | | }, |
| | | need_show:function(item){ |
| | | if(app.hidden_canceled&&(item[2][6].indexOf('买撤')>=0||(item[2][8]!=null&&item[2][8].indexOf("-")>0))){ |
| | | if (app.hidden_canceled && (item[2][6].indexOf('买撤') >= 0 || (item[2][8] != null && |
| | | item[2][8].indexOf("-") > 0))) { |
| | | return false; |
| | | } |
| | | |
| | |
| | | if(app.hidden_cancel&&(item[2][6].indexOf('买撤')>=0)){ |
| | | return false; |
| | | } |
| | | if(app.hidden_little_money&&parseFloat(item[2][3])<50&&item[2][0]!=app.latest_real_order_index){ |
| | | if (app.hidden_little_money && parseFloat(item[2][3]) < 50 && item[2][0] != app |
| | | .latest_real_order_index) { |
| | | return false; |
| | | } |
| | | |
| | |
| | | }); |
| | | }, |
| | | |
| | | view_details:function(code){ |
| | | view_details: function(code, need_l2) { |
| | | pyjs.add_code_to_ths(code); |
| | | // 设置目标代码 |
| | | app.set_target_code(code); |
| | | // 点击选择L2选项 |
| | | app.change_data_type(1); |
| | | // 将目标票传递到首页 |
| | | pyjs.set_target_code(code); |
| | | if (need_l2) { |
| | | // 点击选择L2选项 |
| | | app.change_data_type(1); |
| | | app.load_data(true); |
| | | } else { |
| | | app.change_data_type(0); |
| | | app.load_data(false); |
| | | } |
| | | }, |
| | | |
| | | get_l2_cant_buy_reasons:function(code){ |
| | |
| | | var params={code:code} |
| | | console.log("参数",params) |
| | | http_util.http_request("/get_l2_cant_buy_reasons", params, callback); |
| | | }, |
| | | get_latest_cancel_orders:function(callback){ |
| | | var params={type:"get_latest_cancel_orders",data:{},sign:''} |
| | | http_util.socket_request(JSON.stringify(params), function(result) { |
| | | result = JSON.parse(result); |
| | | callback(result); |
| | | }); |
| | | } |
| | | |
| | | |
| | |
| | | <!DOCTYPE html> |
| | | <html> |
| | | |
| | | <script src="js/http.js"></script> |
| | | |
| | | <body> |
| | | <video src="http://www.test.cn"></video> |
| | | <script> |
| | | var sign = http_util.get_sign({type:"123123"}); |
| | | console.log(sign); |
| | | </script> |
| | | </body> |
| | | |
| | | |
| | | |
| | | |
| | | </html> |
| | |
| | | import queue |
| | | import threading |
| | | import time |
| | | from multiprocessing import freeze_support |
| | | import sys |
| | | from urllib.parse import urlparse, parse_qs |
| | | from multiprocessing import Pipe, Process, freeze_support |
| | | |
| | | import torch |
| | | import win32gui |
| | |
| | | |
| | | from PyQt5.QtWebChannel import QWebChannel |
| | | from PyQt5.QtWebEngineWidgets import QWebEngineView, QWebEngineSettings |
| | | from PyQt5.QtWidgets import QMainWindow, QApplication, QAction, QMessageBox, QLabel, QDialog, QVBoxLayout, QPushButton, \ |
| | | QWidget, QMenu |
| | | from PyQt5.QtWidgets import QMainWindow, QApplication, QAction, QMessageBox, QLabel |
| | | |
| | | from PyQt5.QtCore import Qt, pyqtSlot, QObject, pyqtSignal, QTimer, QUrl, QPoint |
| | | |
| | |
| | | import setting |
| | | from utils import tool |
| | | import win32_util |
| | | from juejin_core import JueJinApi |
| | | from kpl import kpl_util, kpl_api |
| | | from kpl.kpl_data_manager import KPLLimitUpDataManager |
| | | |
| | | freeze_support() |
| | | |
| | | URL_MSG_LIST = f"http://{constant.WEB_HOST}/kp/msg_list.html" |
| | | |
| | |
| | | time.sleep(0.5) |
| | | |
| | | |
| | | # 打包命令 |
| | | # cd D:\workspace\GP\trade_desk |
| | | # D:\workspace\GP\trade_desk\dist\env\pk_env\Scripts\pyinstaller.exe main.spec |
| | | |
| | | |
| | | def recieve_code(pipe, mainWindow): |
| | | latest_code = '' |
| | | while True: |
| | |
| | | except Exception as e: |
| | | logging.exception(e) |
| | | |
| | | # 打包命令 |
| | | # cd D:\workspace\GP\trade_desk |
| | | # D:\workspace\GP\trade_desk\dist\env\pk_env\Scripts\pyinstaller.exe main.spec |
| | | # 为了不出现意外的bug,运行时请将目录放在英文路径 |
| | | |
| | | if __name__ == "__main__": |
| | | freeze_support() |
| | | p1, p2 = multiprocessing.Pipe() |
| | | wxGuiProcess = multiprocessing.Process(target=gui_wx.run, args=(p1,)) |
| | | wxGuiProcess = Process(target=gui_wx.run, args=(p1,)) |
| | | wxGuiProcess.start() |
| | | |
| | | app = QApplication(sys.argv) |
| | |
| | | pathex=[], |
| | | binaries=[], |
| | | datas=[('res','res'),('datas','datas'),('logs','logs'),('venv/Lib/site-packages/dateutil','dateutil')], |
| | | hiddenimports=[], |
| | | hiddenimports=[ |
| | | 'multiprocessing', |
| | | 'multiprocessing.context', |
| | | 'multiprocessing.process', |
| | | 'multiprocessing.reduction', |
| | | 'multiprocessing.shared_memory', |
| | | 'multiprocessing.spawn', |
| | | 'multiprocessing.spawn', |
| | | 'multiprocessing.connection', |
| | | 'multiprocessing.synchronize', |
| | | 'multiprocessing.managers', |
| | | 'multiprocessing.util'], |
| | | hookspath=[], |
| | | hooksconfig={}, |
| | | runtime_hooks=[], |
| | |
| | | win_no_prefer_redirects=False, |
| | | win_private_assemblies=False, |
| | | cipher=block_cipher, |
| | | noarchive=False, |
| | | noarchive=False |
| | | ) |
| | | pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) |
| | | |
| | |
| | | debug=False, |
| | | bootloader_ignore_signals=False, |
| | | strip=False, |
| | | upx=True, |
| | | upx=False, |
| | | console=False, |
| | | disable_windowed_traceback=False, |
| | | argv_emulation=False, |
| | |
| | | while True: |
| | | if temp and win32gui.IsWindowVisible(temp): |
| | | classname = win32gui.GetClassName(temp) |
| | | if classname == 'Afx:00400000:0': |
| | | if classname and classname.find("Afx:") == 0 and classname.endswith(":0"): |
| | | hwnds.append(temp) |
| | | temp = win32gui.FindWindowEx(hwnd, temp, None, None) |
| | | if not temp: |
| | | break |
| | | except: |
| | | |
| | | pass |
| | | hwnd = win32gui.FindWindowEx(hwnds[0], None, "Edit", "") |
| | | print(hwnd) |
| | |
| | | time.sleep(0.5) |
| | | win32gui.SendMessage(hwnds[0], win32con.WM_KEYDOWN, win32con.VK_RETURN, 0) |
| | | win32gui.PostMessage(hwnds[0], win32con.WM_KEYUP, win32con.VK_RETURN, 0) |
| | | time.sleep(0.2) |
| | | win32gui.SetForegroundWindow(origin_hwnd) |
| | | win32api.keybd_event(win32con.VK_INSERT, 0, 0, 0) # 按下键 |
| | | win32api.keybd_event(win32con.VK_INSERT, 0, win32con.KEYEVENTF_KEYUP, 0) |
| | | # time.sleep(0.5) |
| | | # win32gui.SetForegroundWindow(origin_hwnd) |
| | | # win32api.keybd_event(win32con.VK_INSERT, 0, 0, 0) # 按下键 |
| | | # win32api.keybd_event(win32con.VK_INSERT, 0, win32con.KEYEVENTF_KEYUP, 0) |
| | | |
| | | |
| | | if __name__ == "__main__": |