hikyuu 2.1.3__cp38-none-win_amd64.whl → 2.1.5__cp38-none-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hikyuu/cpp/core38.pyd +0 -0
- hikyuu/cpp/hikyuu.dll +0 -0
- hikyuu/cpp/sqlite3.dll +0 -0
- hikyuu/data/em_block_to_mysql.py +45 -31
- hikyuu/data/em_block_to_sqlite.py +48 -33
- hikyuu/data/mysql_upgrade/0020.sql +4 -0
- hikyuu/data/mysql_upgrade/0021.sql +4 -0
- hikyuu/data/mysql_upgrade/0022.sql +5 -0
- hikyuu/data/pytdx_to_h5.py +21 -15
- hikyuu/data/pytdx_to_mysql.py +20 -2
- hikyuu/data/pytdx_weight_to_mysql.py +1 -1
- hikyuu/data/pytdx_weight_to_sqlite.py +1 -1
- hikyuu/data/sqlite_upgrade/0021.sql +6 -0
- hikyuu/data/sqlite_upgrade/0022.sql +6 -0
- hikyuu/data/sqlite_upgrade/0023.sql +7 -0
- hikyuu/fetcher/stock/zh_stock_a_pytdx.py +57 -9
- hikyuu/fetcher/stock/zh_stock_a_qmt.py +3 -3
- hikyuu/fetcher/stock/zh_stock_a_sina_qq.py +15 -5
- hikyuu/gui/HikyuuTDX.py +1 -1
- hikyuu/gui/data/ImportWeightToSqliteTask.py +18 -27
- hikyuu/gui/data/UsePytdxImportToH5Thread.py +17 -6
- hikyuu/gui/data/UseTdxImportToH5Thread.py +30 -6
- hikyuu/gui/spot_server.py +3 -1
- hikyuu/gui/start_qmt.py +99 -13
- hikyuu/include/hikyuu/KQuery.h +5 -2
- hikyuu/include/hikyuu/KRecord.h +1 -1
- hikyuu/include/hikyuu/Stock.h +1 -1
- hikyuu/include/hikyuu/StockManager.h +26 -20
- hikyuu/include/hikyuu/StrategyContext.h +66 -25
- hikyuu/include/hikyuu/data_driver/BaseInfoDriver.h +1 -0
- hikyuu/include/hikyuu/doc.h +1 -1
- hikyuu/include/hikyuu/global/GlobalSpotAgent.h +5 -2
- hikyuu/include/hikyuu/global/agent/SpotAgent.h +28 -6
- hikyuu/include/hikyuu/hikyuu.h +13 -0
- hikyuu/include/hikyuu/indicator/crt/AMA.h +1 -1
- hikyuu/include/hikyuu/indicator/crt/CORR.h +1 -1
- hikyuu/include/hikyuu/indicator/crt/DMA.h +1 -7
- hikyuu/include/hikyuu/indicator/crt/ICIR.h +1 -0
- hikyuu/include/hikyuu/indicator/crt/SMA.h +1 -1
- hikyuu/include/hikyuu/indicator/crt/SPEARMAN.h +1 -1
- hikyuu/include/hikyuu/indicator/imp/IDma.h +47 -0
- hikyuu/include/hikyuu/strategy/BrokerTradeManager.h +1 -2
- hikyuu/include/hikyuu/strategy/Strategy.h +15 -4
- hikyuu/include/hikyuu/trade_manage/OrderBrokerBase.h +3 -0
- hikyuu/include/hikyuu/trade_manage/TradeManagerBase.h +1 -2
- hikyuu/include/hikyuu/trade_sys/allocatefunds/AllocateFundsBase.h +0 -1
- hikyuu/include/hikyuu/trade_sys/condition/ConditionBase.h +1 -0
- hikyuu/include/hikyuu/trade_sys/portfolio/Portfolio.h +1 -0
- hikyuu/include/hikyuu/trade_sys/selector/imp/FixedSelector.h +1 -1
- hikyuu/include/hikyuu/trade_sys/selector/imp/OperatorSelector.h +11 -2
- hikyuu/include/hikyuu/trade_sys/selector/imp/OperatorValueSelector.h +19 -2
- hikyuu/include/hikyuu/utilities/Parameter.h +1 -1
- hikyuu/include/hikyuu/utilities/TimerManager.h +2 -2
- hikyuu/include/hikyuu/utilities/arithmetic.h +4 -4
- hikyuu/include/hikyuu/utilities/base64.h +1 -2
- hikyuu/include/hikyuu/utilities/mo/moFileReader.h +2 -2
- hikyuu/include/hikyuu/utilities/node/NodeMessage.h +1 -3
- hikyuu/include/hikyuu/utilities/thread/MQStealThreadPool.h +6 -7
- hikyuu/include/hikyuu/version.h +4 -4
- hikyuu/interactive.py +55 -135
- {hikyuu-2.1.3.dist-info → hikyuu-2.1.5.dist-info}/METADATA +1 -1
- {hikyuu-2.1.3.dist-info → hikyuu-2.1.5.dist-info}/RECORD +66 -61
- hikyuu/include/hikyuu/global/GlobalTaskGroup.h +0 -44
- hikyuu/puppet.py +0 -297
- {hikyuu-2.1.3.dist-info → hikyuu-2.1.5.dist-info}/LICENSE +0 -0
- {hikyuu-2.1.3.dist-info → hikyuu-2.1.5.dist-info}/WHEEL +0 -0
- {hikyuu-2.1.3.dist-info → hikyuu-2.1.5.dist-info}/entry_points.txt +0 -0
- {hikyuu-2.1.3.dist-info → hikyuu-2.1.5.dist-info}/top_level.txt +0 -0
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* GlobalTaskGroup.h
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2019 hikyuu.org
|
|
5
|
-
*
|
|
6
|
-
* Created on: 2020-4-20
|
|
7
|
-
* Author: fasiondog
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
#pragma once
|
|
11
|
-
#ifndef HKU_GLOBAL_TASK_GROUP
|
|
12
|
-
#define HKU_GLOBAL_TASK_GROUP
|
|
13
|
-
|
|
14
|
-
#include "../utilities/thread/thread.h"
|
|
15
|
-
|
|
16
|
-
namespace hku {
|
|
17
|
-
|
|
18
|
-
using TaskGroup = ThreadPool;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* 获取全局线程池任务组
|
|
22
|
-
* @note 请使用 future 获取任务返回
|
|
23
|
-
*/
|
|
24
|
-
TaskGroup* getGlobalTaskGroup();
|
|
25
|
-
|
|
26
|
-
template <typename ResultType>
|
|
27
|
-
using task_handle = std::future<ResultType>;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* 向全局任务池中增加任务
|
|
31
|
-
*/
|
|
32
|
-
template <typename FunctionType>
|
|
33
|
-
task_handle<typename std::result_of<FunctionType()>::type> addTask(FunctionType f) {
|
|
34
|
-
return getGlobalTaskGroup()->submit(f);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* 程序退出时释放全局任务组实例,仅内部调用
|
|
39
|
-
*/
|
|
40
|
-
void releaseGlobalTaskGroup();
|
|
41
|
-
|
|
42
|
-
} /* namespace hku */
|
|
43
|
-
|
|
44
|
-
#endif /* HKU_GLOBAL_TASK_GROUP */
|
hikyuu/puppet.py
DELETED
|
@@ -1,297 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
扯线木偶界面自动化应用编程接口(Puppet UIAutomation API),是扯线木偶量化框架(Puppet Quant Framework)的一个组件。
|
|
3
|
-
技术群:624585416
|
|
4
|
-
"""
|
|
5
|
-
__author__ = "睿瞳深邃(https://github.com/Raytone-D)"
|
|
6
|
-
__project__ = 'Puppet'
|
|
7
|
-
__version__ = "0.4.12"
|
|
8
|
-
__license__ = 'MIT'
|
|
9
|
-
|
|
10
|
-
# coding: utf-8
|
|
11
|
-
import ctypes
|
|
12
|
-
from functools import reduce
|
|
13
|
-
import time
|
|
14
|
-
import pyperclip
|
|
15
|
-
|
|
16
|
-
MSG = {'WM_SETTEXT': 12,
|
|
17
|
-
'WM_GETTEXT': 13,
|
|
18
|
-
'WM_KEYDOWN': 256,
|
|
19
|
-
'WM_KEYUP': 257,
|
|
20
|
-
'WM_COMMAND': 273,
|
|
21
|
-
'BM_CLICK': 245,
|
|
22
|
-
'CB_GETCOUNT': 326,
|
|
23
|
-
'CB_SETCURSEL': 334,
|
|
24
|
-
'CBN_SELCHANGE': 1,
|
|
25
|
-
'COPY_DATA': 57634}
|
|
26
|
-
|
|
27
|
-
NODE = {'FRAME': (59648, 59649),
|
|
28
|
-
'FORM': (59648, 59649, 1047, 200, 1047),
|
|
29
|
-
'ACCOUNT': (59392, 0, 1711),
|
|
30
|
-
'COMBO': (59392, 0, 2322),
|
|
31
|
-
'BUY': (161, (1032, 1033, 1034), 1006),
|
|
32
|
-
'SELL':(162, (1032, 1033, 1034), 1006),
|
|
33
|
-
'撤单': 163,
|
|
34
|
-
'双向委托': 512,
|
|
35
|
-
'新股申购': 554,
|
|
36
|
-
'中签查询': 1070}
|
|
37
|
-
|
|
38
|
-
TWO_WAY = {'买入代码': 1032,
|
|
39
|
-
'买入价格': 1033,
|
|
40
|
-
'买入数量': 1034,
|
|
41
|
-
'买入': 1006,
|
|
42
|
-
'卖出代码': 1035,
|
|
43
|
-
'卖出价格': 1058,
|
|
44
|
-
'卖出数量': 1039,
|
|
45
|
-
'卖出': 1008,
|
|
46
|
-
'可用余额': 1038,
|
|
47
|
-
'刷新': 32790,
|
|
48
|
-
'全撤': 30001,
|
|
49
|
-
'撤买': 30002,
|
|
50
|
-
'撤卖': 30003,
|
|
51
|
-
'报表': 1047}
|
|
52
|
-
|
|
53
|
-
TAB = {'持仓': ord('W'),
|
|
54
|
-
'成交': ord('E'),
|
|
55
|
-
'委托': ord('R')}
|
|
56
|
-
|
|
57
|
-
SCHEDULE = {'证券代码': '',
|
|
58
|
-
'证券名称': '',
|
|
59
|
-
'实际数量': '',
|
|
60
|
-
'市值': ''}
|
|
61
|
-
|
|
62
|
-
CANCEL = {'全选': 1098,
|
|
63
|
-
'撤单': 1099,
|
|
64
|
-
'全撤': 30001,
|
|
65
|
-
'撤买': 30002,
|
|
66
|
-
'撤卖': 30003,
|
|
67
|
-
'填单': 3348,
|
|
68
|
-
'查单': 3349}
|
|
69
|
-
|
|
70
|
-
NEW = {'新股代码': 1032,
|
|
71
|
-
'新股名称': 1036,
|
|
72
|
-
'申购价格': 1033,
|
|
73
|
-
'可申购数量': 1018,
|
|
74
|
-
'申购数量': 1034,
|
|
75
|
-
'申购': 1006}
|
|
76
|
-
|
|
77
|
-
RAFFLE = ['新股代码', '证券代码', '申购价格', '申购上限']
|
|
78
|
-
#CMD = {'COPY': 57634}
|
|
79
|
-
VKCODE = {'F1': 112,
|
|
80
|
-
'F2': 113,
|
|
81
|
-
'F3': 114,
|
|
82
|
-
'F4': 115,
|
|
83
|
-
'F5': 116,
|
|
84
|
-
'F6': 117}
|
|
85
|
-
|
|
86
|
-
MKT = {'CYB': '3',
|
|
87
|
-
'SH': '7',
|
|
88
|
-
'SZ': '0',
|
|
89
|
-
'创业板': '3',
|
|
90
|
-
'沪市': '7',
|
|
91
|
-
'深市': '0'}
|
|
92
|
-
|
|
93
|
-
op = ctypes.windll.user32
|
|
94
|
-
|
|
95
|
-
def switch_combo(index, idCombo, hCombo):
|
|
96
|
-
op.SendMessageW(hCombo, MSG['CB_SETCURSEL'], index, 0)
|
|
97
|
-
op.SendMessageW(op.GetParent(hCombo), MSG['WM_COMMAND'], MSG['CBN_SELCHANGE']<<16|idCombo, hCombo)
|
|
98
|
-
|
|
99
|
-
class Puppet:
|
|
100
|
-
"""
|
|
101
|
-
界面自动化操控包装类
|
|
102
|
-
# 方法 # '委买': buy(), '委卖': sell(), '撤单': cancel(), '打新': raffle(),
|
|
103
|
-
# 属性 # '帐号': account, '可用余额': balance, '持仓': position, '成交': deals, '可撤委托': cancelable,
|
|
104
|
-
# # '新股': new, '中签': bingo,
|
|
105
|
-
"""
|
|
106
|
-
def __init__(self, main=None, title='网上股票交易系统5.0'):
|
|
107
|
-
|
|
108
|
-
print('我正在热身,稍等一下...')
|
|
109
|
-
self.main = main or op.FindWindowW(0, title)
|
|
110
|
-
self.switch = lambda node: op.SendMessageW(self.main, MSG['WM_COMMAND'], node, 0)
|
|
111
|
-
self._order = []
|
|
112
|
-
for i in (NODE['BUY'],NODE['SELL']):
|
|
113
|
-
node, parts, button = i
|
|
114
|
-
self.switch(node)
|
|
115
|
-
time.sleep(0.3)
|
|
116
|
-
x = reduce(op.GetDlgItem, NODE['FRAME'], self.main)
|
|
117
|
-
self._order.append((tuple(op.GetDlgItem(x, v) for v in parts), button, x))
|
|
118
|
-
|
|
119
|
-
op.SendMessageW(self.main, MSG['WM_COMMAND'], NODE['双向委托'], 0) # 切换到交易操作台
|
|
120
|
-
self.wait_a_second = lambda sec=0.2: time.sleep(sec)
|
|
121
|
-
self.wait_a_second() # 可调整区间值(0.01~0.5)
|
|
122
|
-
self.buff = ctypes.create_unicode_buffer(32)
|
|
123
|
-
self.two_way = reduce(op.GetDlgItem, NODE['FRAME'], self.main)
|
|
124
|
-
self.members = {k: op.GetDlgItem(self.two_way, v) for k, v in TWO_WAY.items()}
|
|
125
|
-
print('我准备好了,开干吧!人生巅峰在前面!') if self.main else print("没找到已登录的客户交易端,我先撤了!")
|
|
126
|
-
# 获取登录账号
|
|
127
|
-
self.account = reduce(op.GetDlgItem, NODE['ACCOUNT'], self.main)
|
|
128
|
-
op.SendMessageW(self.account, MSG['WM_GETTEXT'], 32, self.buff)
|
|
129
|
-
self.account = self.buff.value
|
|
130
|
-
self.combo = reduce(op.GetDlgItem, NODE['COMBO'], self.main)
|
|
131
|
-
self.count = op.SendMessageW(self.combo, MSG['CB_GETCOUNT'])
|
|
132
|
-
|
|
133
|
-
def switch_tab(self, hCtrl, keyCode, param=0): # 单击
|
|
134
|
-
op.PostMessageW(hCtrl, MSG['WM_KEYDOWN'], keyCode, param)
|
|
135
|
-
self.wait_a_second(0.5)
|
|
136
|
-
op.PostMessageW(hCtrl, MSG['WM_KEYUP'], keyCode, param)
|
|
137
|
-
|
|
138
|
-
def copy_data(self, key=0): # background mode
|
|
139
|
-
"将CVirtualGridCtrl|Custom<n>的数据复制到剪贴板,默认取当前的表格"
|
|
140
|
-
if key:
|
|
141
|
-
self.switch_tab(self.two_way, key) # 切换到持仓('W')、成交('E')、委托('R')
|
|
142
|
-
print("正在等待实时数据返回,请稍候...")
|
|
143
|
-
pyperclip.copy('')
|
|
144
|
-
# 查到只有列表头的空白数据等3秒...orz
|
|
145
|
-
for i in range(10):
|
|
146
|
-
time.sleep(0.3)
|
|
147
|
-
op.SendMessageW(reduce(op.GetDlgItem, NODE['FORM'], self.main),
|
|
148
|
-
MSG['WM_COMMAND'], MSG['COPY_DATA'], NODE['FORM'][-1])
|
|
149
|
-
if len(pyperclip.paste().splitlines()) > 1:
|
|
150
|
-
break
|
|
151
|
-
return pyperclip.paste()
|
|
152
|
-
|
|
153
|
-
def buy(self, symbol, price, qty):
|
|
154
|
-
self.switch(NODE['BUY'][0])
|
|
155
|
-
tuple(map(lambda hCtrl, arg: op.SendMessageW(
|
|
156
|
-
hCtrl, MSG['WM_SETTEXT'], 0, str(arg)), self._order[0][0], (symbol, price, qty)))
|
|
157
|
-
op.PostMessageW(self._order[0][-1], MSG['WM_COMMAND'], self._order[0][1], 0)
|
|
158
|
-
|
|
159
|
-
def sell(self, symbol, price, qty):
|
|
160
|
-
self.switch(NODE['SELL'][0])
|
|
161
|
-
tuple(map(lambda hCtrl, arg: op.SendMessageW(
|
|
162
|
-
hCtrl, MSG['WM_SETTEXT'], 0, str(arg)), self._order[1][0], (symbol, price, qty)))
|
|
163
|
-
op.PostMessageW(self._order[1][-1], MSG['WM_COMMAND'], self._order[1][1], 0)
|
|
164
|
-
|
|
165
|
-
def buy2(self, symbol, price, qty): # 买入(B)
|
|
166
|
-
self.switch(NODE['双向委托'])
|
|
167
|
-
op.SendMessageW(self.members['买入代码'], MSG['WM_SETTEXT'], 0, str(symbol))
|
|
168
|
-
op.SendMessageW(self.members['买入价格'], MSG['WM_SETTEXT'], 0, str(price))
|
|
169
|
-
op.SendMessageW(self.members['买入数量'], MSG['WM_SETTEXT'], 0, str(qty))
|
|
170
|
-
#op.SendMessageW(self.members['买入'], MSG['BM_CLICK'], 0, 0)
|
|
171
|
-
op.PostMessageW(self.two_way, MSG['WM_COMMAND'], TWO_WAY['买入'], self.members['买入'])
|
|
172
|
-
|
|
173
|
-
def sell2(self, symbol, price, qty): # 卖出(S)
|
|
174
|
-
self.switch(NODE['双向委托'])
|
|
175
|
-
op.SendMessageW(self.members['卖出代码'], MSG['WM_SETTEXT'], 0, str(symbol))
|
|
176
|
-
op.SendMessageW(self.members['卖出价格'], MSG['WM_SETTEXT'], 0, str(price))
|
|
177
|
-
op.SendMessageW(self.members['卖出数量'], MSG['WM_SETTEXT'], 0, str(qty))
|
|
178
|
-
#op.SendMessageW(self.members['卖出'], MSG['BM_CLICK'], 0, 0)
|
|
179
|
-
op.PostMessageW(self.two_way, MSG['WM_COMMAND'], TWO_WAY['卖出'], self.members['卖出'])
|
|
180
|
-
|
|
181
|
-
def refresh(self): # 刷新(F5)
|
|
182
|
-
op.PostMessageW(self.two_way, MSG['WM_COMMAND'], TWO_WAY['刷新'], self.members['刷新'])
|
|
183
|
-
|
|
184
|
-
def cancel(self, symbol=None, way='撤买'):
|
|
185
|
-
|
|
186
|
-
op.SendMessageW(self.main, MSG['WM_COMMAND'], NODE['撤单'], 0) # 切换到撤单操作台
|
|
187
|
-
if way and str(symbol).isdecimal():
|
|
188
|
-
#print(self.copy_data())
|
|
189
|
-
self.cancel_c = reduce(op.GetDlgItem, NODE['FRAME'], self.main)
|
|
190
|
-
self.cancel_ctrl = {k: op.GetDlgItem(self.cancel_c, v) for k, v in CANCEL.items()}
|
|
191
|
-
op.SendMessageW(self.cancel_ctrl['填单'], MSG['WM_SETTEXT'], 0, symbol)
|
|
192
|
-
self.wait_a_second()
|
|
193
|
-
op.PostMessageW(self.cancel_c, MSG['WM_COMMAND'], CANCEL['查单'], self.cancel_ctrl['查单'])
|
|
194
|
-
op.PostMessageW(self.cancel_c, MSG['WM_COMMAND'], CANCEL[way], self.cancel_ctrl[way])
|
|
195
|
-
schedule = self.copy_data()
|
|
196
|
-
op.SendMessageW(self.main, MSG['WM_COMMAND'], NODE['双向委托'], 0) # 必须返回交易操作台
|
|
197
|
-
return schedule
|
|
198
|
-
|
|
199
|
-
@property
|
|
200
|
-
def balance(self):
|
|
201
|
-
print('可用余额: %s' % ('$'*68))
|
|
202
|
-
op.SendMessageW(self.members['可用余额'], MSG['WM_GETTEXT'], 32, self.buff)
|
|
203
|
-
return self.buff.value
|
|
204
|
-
|
|
205
|
-
@property
|
|
206
|
-
def position(self):
|
|
207
|
-
print('实时持仓: %s' % ('$'*68))
|
|
208
|
-
return self.copy_data(TAB['持仓'])
|
|
209
|
-
|
|
210
|
-
@property
|
|
211
|
-
def market_value(self):
|
|
212
|
-
form = (x.split() for x in self.position.splitlines())
|
|
213
|
-
index = next(form).index('市值')
|
|
214
|
-
return sum((float(row[index]) for row in form))
|
|
215
|
-
|
|
216
|
-
@property
|
|
217
|
-
def deals(self):
|
|
218
|
-
print('当天成交: %s' % ('$'*68))
|
|
219
|
-
return self.copy_data(TAB['成交'])
|
|
220
|
-
|
|
221
|
-
@property
|
|
222
|
-
def cancelable(self):
|
|
223
|
-
print('可撤委托: %s' % ('$'*68))
|
|
224
|
-
return self.cancel(way=False)
|
|
225
|
-
|
|
226
|
-
@property
|
|
227
|
-
def new(self):
|
|
228
|
-
print('新股名单: %s' % ('$'*68))
|
|
229
|
-
return self.raffle(way=False)
|
|
230
|
-
|
|
231
|
-
@property
|
|
232
|
-
def bingo(self):
|
|
233
|
-
print('新股中签: {0}'.format('$'*68))
|
|
234
|
-
op.SendMessageW(self.main, MSG['WM_COMMAND'], NODE['中签查询'], 0)
|
|
235
|
-
return self.copy_data()
|
|
236
|
-
|
|
237
|
-
def cancel_all(self): # 全撤(Z)
|
|
238
|
-
op.PostMessageW(self.two_way, MSG['WM_COMMAND'], 30001, self.members[30001])
|
|
239
|
-
|
|
240
|
-
def cancel_buy(self): # 撤买(X)
|
|
241
|
-
op.PostMessageW(self.two_way, MSG['WM_COMMAND'], 30002, self.members[30002])
|
|
242
|
-
|
|
243
|
-
def cancel_sell(self): # 撤卖(C)
|
|
244
|
-
op.PostMessageW(self.two_way, MSG['WM_COMMAND'], 30003, self.members[30003])
|
|
245
|
-
|
|
246
|
-
def cancel_last(self): # 撤最后一笔,仅限华泰定制版有效
|
|
247
|
-
op.PostMessageW(self.two_way, MSG['WM_COMMAND'], 2053, self.members[2053])
|
|
248
|
-
|
|
249
|
-
def cancel_same(self): # 撤相同代码,仅限华泰定制版
|
|
250
|
-
#op.PostMessageW(self.two_way, WM_COMMAND, 30022, self.members[30022])
|
|
251
|
-
pass
|
|
252
|
-
|
|
253
|
-
def raffle(self, skip=None, way=True): # 打新股。
|
|
254
|
-
op.SendMessageW(self.main, MSG['WM_COMMAND'], NODE['新股申购'], 0)
|
|
255
|
-
#close_pop() # 弹窗无需关闭,不影响交易。
|
|
256
|
-
schedule = self.copy_data()
|
|
257
|
-
if way:
|
|
258
|
-
print("开始打新股%s" % ('>'*68))
|
|
259
|
-
print(schedule)
|
|
260
|
-
self.raffle_c = reduce(op.GetDlgItem, NODE['FRAME'], self.main)
|
|
261
|
-
self.raffle_ctrl = {k: op.GetDlgItem(self.raffle_c, v) for k, v in NEW.items()}
|
|
262
|
-
new = [x.split() for x in schedule.splitlines()]
|
|
263
|
-
index = [new[0].index(x) for x in RAFFLE if x in new[0]] # 索引映射:代码0, 价格1, 数量2
|
|
264
|
-
new = map(lambda x: [x[y] for y in index], new[1:])
|
|
265
|
-
for symbol, price, qty in new:
|
|
266
|
-
if symbol[0] == skip:
|
|
267
|
-
print({symbol: (qty, "跳过<%s>开头的新股!" % skip)})
|
|
268
|
-
continue
|
|
269
|
-
if qty == '0':
|
|
270
|
-
print({symbol: (qty, "数量为零")})
|
|
271
|
-
continue
|
|
272
|
-
op.SendMessageW(self.raffle_ctrl['新股代码'], MSG['WM_SETTEXT'], 0, symbol)
|
|
273
|
-
self.wait_a_second(1)
|
|
274
|
-
#op.SendMessageW(self.raffle_ctrl['可申购数量'], MSG['WM_GETTEXT'], 32, self.buff)
|
|
275
|
-
#qty = self.buff.value
|
|
276
|
-
op.SendMessageW(self.raffle_ctrl['申购数量'], MSG['WM_SETTEXT'], 0, qty)
|
|
277
|
-
self.wait_a_second()
|
|
278
|
-
op.PostMessageW(self.raffle_c, MSG['WM_COMMAND'], NEW['申购'], self.raffle_ctrl['申购'])
|
|
279
|
-
print({symbol: (qty, "已申购")})
|
|
280
|
-
print(self.cancelable)
|
|
281
|
-
op.SendMessageW(self.main, MSG['WM_COMMAND'], NODE['双向委托'], 0) # 切换到交易操作台
|
|
282
|
-
return schedule
|
|
283
|
-
|
|
284
|
-
if __name__ == '__main__':
|
|
285
|
-
|
|
286
|
-
trader = Puppet()
|
|
287
|
-
#trader = Puppet(title='广发证券核新网上交易系统7.60')
|
|
288
|
-
if trader.account:
|
|
289
|
-
print(trader.account) # 帐号
|
|
290
|
-
#print(trader.new) # 查当天新股名单
|
|
291
|
-
#trader.raffle(MKT['创业板']) # 确定打新股,跳过创业板不打。
|
|
292
|
-
#print(trader.balance) # 可用余额
|
|
293
|
-
#print(trader.position) # 实时持仓
|
|
294
|
-
#print(trader.deals) # 当天成交
|
|
295
|
-
#print(trader.cancelable) # 可撤委托
|
|
296
|
-
print(trader.market_value)
|
|
297
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|