1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
| document.addEventListener("DOMContentLoaded", function() {
| //把对象赋值到JS中
| try {
| new QWebChannel(qt.webChannelTransport, function(channel) {
| window.pyjs = channel.objects.Bridge;
| console.log("回调成功");
| });
| } catch (e) {
|
| }
| });
| var app;
| $(function() {
| function is_trade_time() {
| var nowdate = new Date();
| h = nowdate.getHours();
| m = nowdate.getMinutes();
| total_m = h * 60 + m;
| if ((total_m >= (9 * 60 + 25) && total_m <= (11 * 60 + 30)) || (total_m >= 13 * 60 && total_m <= 15 *
| 60)) {
| return true;
| } else {
| return false;
| }
| }
| // 定时拉取H撤数据
| setInterval(function() {
| if (app.code != '000000' && app.trade_data) {
| if (is_trade_time()) {
| http_util.get_h_cancel_data(app.code, function(res) {
| res = JSON.parse(res);
| console.log("结果:", res)
| if (res.code == 0) {
| app.$set(app.trade_data, 'h_cancel', res.data)
| }
| });
| }
| }
| }, 3000)
|
| new VConsole();
| app = new Vue({
| el: "#app",
| data: {
| code: "000000",
| code_name: "测试代码",
| trade_data: {},
| trade_record: {
| open_limit_up: "",
| records: []
| },
| },
| methods: {
| set_trade_info: function(code, code_name, trade_data, trade_record, initiative_buy_codes,
| passive_buy_codes) {
| console.log("交易数据", code, code_name, trade_data, trade_record)
| console.log("主动买入", initiative_buy_codes)
| console.log("被动买入", passive_buy_codes)
| app.code = code;
| app.code_name = code_name;
| if (trade_data) {
| var trade_data = JSON.parse(trade_data);
| app.trade_data = trade_data
| } else {
| app.trade_data = {
| "star": {
| "desc": "----",
| "count": 0
| },
| "safe_count": {
| "base": 0,
| "now": 0
| },
| "m_val": {
| "base": 0,
| "now": 0
| },
| "big_num": {
| "base": 0,
| "now": 0
| },
| "trade_progress": {
| "time": "00:00:00",
| "num": 0,
| "money": 0
| },
| "trade_state": {
| "order": false,
| "desc": "未交易"
| }
| };
| }
| if (trade_record) {
| app.trade_record = JSON.parse(trade_record);
| } else {
| app.trade_record = null;
| }
| if (initiative_buy_codes) {
| app.initiative_buy_codes = JSON.parse(initiative_buy_codes);
| } else {
| app.initiative_buy_codes = null;
| }
|
| if (passive_buy_codes) {
| app.passive_buy_codes = JSON.parse(passive_buy_codes);
| } else {
| app.passive_buy_codes = null;
| }
|
|
| }
| }
| })
|
|
|
| });
|
|