hikyuu 2.6.5__py3-none-win_amd64.whl → 2.6.6__py3-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.
Files changed (108) hide show
  1. hikyuu/__init__.py +6 -0
  2. hikyuu/__init__.pyi +548 -545
  3. hikyuu/analysis/__init__.pyi +519 -518
  4. hikyuu/analysis/analysis.pyi +520 -519
  5. hikyuu/core.pyi +521 -520
  6. hikyuu/cpp/__init__.pyi +2 -2
  7. hikyuu/cpp/boost_date_time-mt.dll +0 -0
  8. hikyuu/cpp/boost_serialization-mt.dll +0 -0
  9. hikyuu/cpp/boost_wserialization-mt.dll +0 -0
  10. hikyuu/cpp/core310.pyd +0 -0
  11. hikyuu/cpp/core310.pyi +35 -25
  12. hikyuu/cpp/core311.pyd +0 -0
  13. hikyuu/cpp/core311.pyi +35 -25
  14. hikyuu/cpp/core312.pyd +0 -0
  15. hikyuu/cpp/core312.pyi +35 -25
  16. hikyuu/cpp/core313.pyd +0 -0
  17. hikyuu/cpp/core313.pyi +35 -25
  18. hikyuu/cpp/core39.pyd +0 -0
  19. hikyuu/cpp/core39.pyi +35 -25
  20. hikyuu/cpp/hikyuu.dll +0 -0
  21. hikyuu/cpp/hikyuu.lib +0 -0
  22. hikyuu/cpp/i18n/__init__.py +0 -0
  23. hikyuu/cpp/i18n/zh_CN.mo +0 -0
  24. hikyuu/cpp/sqlite3.dll +0 -0
  25. hikyuu/data/clickhouse_upgrade/__init__.py +1 -0
  26. hikyuu/data/clickhouse_upgrade/createdb.sql +1085 -0
  27. hikyuu/data/common_clickhouse.py +512 -0
  28. hikyuu/data/em_block_to_clickhouse.py +120 -0
  29. hikyuu/data/hku_config_template.py +58 -3
  30. hikyuu/data/pytdx_finance_to_clickhouse.py +107 -0
  31. hikyuu/data/pytdx_to_clickhouse.py +841 -0
  32. hikyuu/data/pytdx_to_mysql.py +4 -4
  33. hikyuu/data/pytdx_weight_to_clickhouse.py +191 -0
  34. hikyuu/data/tdx_to_clickhouse.py +448 -0
  35. hikyuu/data/zh_bond10_to_clickhouse.py +49 -0
  36. hikyuu/draw/drawplot/__init__.pyi +9 -9
  37. hikyuu/draw/drawplot/bokeh_draw.pyi +537 -534
  38. hikyuu/draw/drawplot/common.pyi +1 -1
  39. hikyuu/draw/drawplot/echarts_draw.pyi +539 -536
  40. hikyuu/draw/drawplot/matplotlib_draw.pyi +549 -546
  41. hikyuu/draw/elder.pyi +11 -11
  42. hikyuu/draw/kaufman.pyi +18 -18
  43. hikyuu/draw/volume.pyi +10 -10
  44. hikyuu/extend.pyi +527 -526
  45. hikyuu/fetcher/stock/zh_stock_a_pytdx.py +9 -20
  46. hikyuu/fetcher/stock/zh_stock_a_qmt.py +4 -5
  47. hikyuu/fetcher/stock/zh_stock_a_sina_qq.py +16 -60
  48. hikyuu/flat/Spot.py +96 -200
  49. hikyuu/gui/HikyuuTDX.py +132 -3
  50. hikyuu/gui/data/ImportBlockInfoTask.py +11 -0
  51. hikyuu/gui/data/ImportHistoryFinanceTask.py +15 -1
  52. hikyuu/gui/data/ImportPytdxTimeToH5Task.py +11 -1
  53. hikyuu/gui/data/ImportPytdxToH5Task.py +13 -1
  54. hikyuu/gui/data/ImportPytdxTransToH5Task.py +11 -1
  55. hikyuu/gui/data/ImportTdxToH5Task.py +13 -1
  56. hikyuu/gui/data/ImportWeightToSqliteTask.py +14 -1
  57. hikyuu/gui/data/ImportZhBond10Task.py +11 -0
  58. hikyuu/gui/data/MainWindow.py +76 -12
  59. hikyuu/gui/data/UsePytdxImportToH5Thread.py +45 -26
  60. hikyuu/gui/data/UseTdxImportToH5Thread.py +19 -1
  61. hikyuu/gui/dataserver.py +12 -4
  62. hikyuu/gui/spot_server.py +30 -40
  63. hikyuu/gui/start_qmt.py +20 -3
  64. hikyuu/hub.pyi +6 -6
  65. hikyuu/include/hikyuu/DataType.h +11 -0
  66. hikyuu/include/hikyuu/StockManager.h +8 -0
  67. hikyuu/include/hikyuu/data_driver/kdata/mysql/KRecordTable.h +1 -0
  68. hikyuu/include/hikyuu/global/GlobalSpotAgent.h +1 -1
  69. hikyuu/include/hikyuu/global/SpotRecord.h +15 -31
  70. hikyuu/include/hikyuu/global/agent/spot_generated.h +48 -232
  71. hikyuu/include/hikyuu/global/schedule/scheduler.h +1 -1
  72. hikyuu/include/hikyuu/plugin/KDataToHdf5Importer.h +3 -0
  73. hikyuu/include/hikyuu/plugin/dataserver.h +26 -1
  74. hikyuu/include/hikyuu/plugin/device.h +2 -1
  75. hikyuu/include/hikyuu/plugin/interface/DataDriverPluginInterface.h +27 -0
  76. hikyuu/include/hikyuu/plugin/interface/DataServerPluginInterface.h +2 -1
  77. hikyuu/include/hikyuu/plugin/interface/DevicePluginInterface.h +1 -1
  78. hikyuu/include/hikyuu/plugin/interface/ImportKDataToHdf5PluginInterface.h +3 -0
  79. hikyuu/include/hikyuu/plugin/interface/plugins.h +2 -0
  80. hikyuu/include/hikyuu/strategy/Strategy.h +0 -9
  81. hikyuu/include/hikyuu/utilities/config.h +1 -1
  82. hikyuu/include/hikyuu/utilities/mo/mo.h +30 -14
  83. hikyuu/include/hikyuu/utilities/os.h +6 -0
  84. hikyuu/include/hikyuu/version.h +4 -4
  85. hikyuu/plugin/backtest.dll +0 -0
  86. hikyuu/plugin/clickhousedriver.dll +0 -0
  87. hikyuu/plugin/dataserver.dll +0 -0
  88. hikyuu/plugin/device.dll +0 -0
  89. hikyuu/plugin/extind.dll +0 -0
  90. hikyuu/plugin/import2hdf5.dll +0 -0
  91. hikyuu/plugin/tmreport.dll +0 -0
  92. hikyuu/trade_manage/__init__.pyi +537 -534
  93. hikyuu/trade_manage/broker.pyi +3 -3
  94. hikyuu/trade_manage/broker_easytrader.pyi +1 -1
  95. hikyuu/trade_manage/trade.pyi +537 -534
  96. hikyuu/util/__init__.py +1 -0
  97. hikyuu/util/__init__.pyi +4 -3
  98. hikyuu/util/check.py +8 -0
  99. hikyuu/util/check.pyi +5 -1
  100. hikyuu/util/singleton.pyi +1 -1
  101. {hikyuu-2.6.5.dist-info → hikyuu-2.6.6.dist-info}/METADATA +2 -2
  102. {hikyuu-2.6.5.dist-info → hikyuu-2.6.6.dist-info}/RECORD +106 -95
  103. {hikyuu-2.6.5.dist-info → hikyuu-2.6.6.dist-info}/top_level.txt +2 -2
  104. hikyuu/include/hikyuu/global/agent/hikyuu/__init__.py +0 -1
  105. hikyuu/include/hikyuu/global/agent/hikyuu/flat/__init__.py +0 -1
  106. {hikyuu-2.6.5.dist-info → hikyuu-2.6.6.dist-info}/LICENSE +0 -0
  107. {hikyuu-2.6.5.dist-info → hikyuu-2.6.6.dist-info}/WHEEL +0 -0
  108. {hikyuu-2.6.5.dist-info → hikyuu-2.6.6.dist-info}/entry_points.txt +0 -0
@@ -48,6 +48,12 @@ from hikyuu.data.common_mysql import create_database as mysql_create_database
48
48
  from hikyuu.data.common_mysql import import_new_holidays as mysql_import_new_holidays
49
49
  from hikyuu.data.pytdx_to_mysql import import_index_name as mysql_import_index_name
50
50
  from hikyuu.data.pytdx_to_mysql import import_stock_name as mysql_import_stock_name
51
+
52
+ from hikyuu.data.common_clickhouse import create_database as clickhouse_create_database
53
+ from hikyuu.data.common_clickhouse import import_new_holidays as clickhouse_import_new_holidays
54
+ from hikyuu.data.pytdx_to_clickhouse import import_index_name as clickhouse_import_index_name
55
+ from hikyuu.data.pytdx_to_clickhouse import import_stock_name as clickhouse_import_stock_name
56
+
51
57
  from hikyuu.util.mylog import class_logger
52
58
 
53
59
 
@@ -140,6 +146,32 @@ class UsePytdxImportToH5Thread(QThread):
140
146
  cur_host = 0
141
147
 
142
148
  # 以下按数据量从大到小依次使用速度从高到低的TDX服务器
149
+ if self.config.getboolean('ktype', 'min5', fallback=False):
150
+ start_date = datetime.datetime.strptime(
151
+ config['ktype']['min5_start_date'], '%Y-%m-%d').date()
152
+ for market in g_market_list:
153
+ self.tasks.append(
154
+ ImportPytdxToH5(
155
+ self.log_queue, self.queue, self.config, market,
156
+ '5MIN', self.quotations, use_hosts[cur_host][0],
157
+ use_hosts[cur_host][1], dest_dir,
158
+ start_date.year * 100000000 +
159
+ start_date.month * 1000000 + start_date.day * 10000))
160
+ cur_host += 1
161
+
162
+ if self.config.getboolean('ktype', 'day', fallback=False):
163
+ start_date = datetime.datetime.strptime(
164
+ config['ktype']['day_start_date'], '%Y-%m-%d').date()
165
+ for market in g_market_list:
166
+ self.tasks.append(
167
+ ImportPytdxToH5(
168
+ self.log_queue, self.queue, self.config, market, 'DAY',
169
+ self.quotations, use_hosts[cur_host][0],
170
+ use_hosts[cur_host][1], dest_dir,
171
+ start_date.year * 100000000 +
172
+ start_date.month * 1000000 + start_date.day * 10000))
173
+ cur_host += 1
174
+
143
175
  if self.config.getboolean('ktype', 'trans', fallback=False):
144
176
  today = datetime.date.today()
145
177
  trans_start_date = datetime.datetime.strptime(
@@ -182,32 +214,6 @@ class UsePytdxImportToH5Thread(QThread):
182
214
  time_max_days))
183
215
  cur_host += 1
184
216
 
185
- if self.config.getboolean('ktype', 'min5', fallback=False):
186
- start_date = datetime.datetime.strptime(
187
- config['ktype']['min5_start_date'], '%Y-%m-%d').date()
188
- for market in g_market_list:
189
- self.tasks.append(
190
- ImportPytdxToH5(
191
- self.log_queue, self.queue, self.config, market,
192
- '5MIN', self.quotations, use_hosts[cur_host][0],
193
- use_hosts[cur_host][1], dest_dir,
194
- start_date.year * 100000000 +
195
- start_date.month * 1000000 + start_date.day * 10000))
196
- cur_host += 1
197
-
198
- if self.config.getboolean('ktype', 'day', fallback=False):
199
- start_date = datetime.datetime.strptime(
200
- config['ktype']['day_start_date'], '%Y-%m-%d').date()
201
- for market in g_market_list:
202
- self.tasks.append(
203
- ImportPytdxToH5(
204
- self.log_queue, self.queue, self.config, market, 'DAY',
205
- self.quotations, use_hosts[cur_host][0],
206
- use_hosts[cur_host][1], dest_dir,
207
- start_date.year * 100000000 +
208
- start_date.month * 1000000 + start_date.day * 10000))
209
- cur_host += 1
210
-
211
217
  if self.config.getboolean('weight', 'enable', fallback=False):
212
218
  for market in g_market_list:
213
219
  self.tasks.append(
@@ -265,6 +271,19 @@ class UsePytdxImportToH5Thread(QThread):
265
271
  import_new_holidays = mysql_import_new_holidays
266
272
  import_index_name = mysql_import_index_name
267
273
  import_stock_name = mysql_import_stock_name
274
+ elif self.config.getboolean('clickhouse', 'enable', fallback=True):
275
+ db_config = {
276
+ 'username': self.config['clickhouse']['usr'],
277
+ 'password': self.config['clickhouse']['pwd'],
278
+ 'host': self.config['clickhouse']['host'],
279
+ 'port': self.config['clickhouse']['http_port']
280
+ }
281
+ import clickhouse_connect
282
+ connect = clickhouse_connect.get_client(**db_config)
283
+ create_database = clickhouse_create_database
284
+ import_new_holidays = clickhouse_import_new_holidays
285
+ import_index_name = clickhouse_import_index_name
286
+ import_stock_name = clickhouse_import_stock_name
268
287
 
269
288
  create_database(connect)
270
289
 
@@ -47,6 +47,10 @@ from hikyuu.data.common_mysql import create_database as mysql_create_database
47
47
  from hikyuu.data.common_mysql import import_new_holidays as mysql_import_new_holidays
48
48
  from hikyuu.data.pytdx_to_mysql import import_index_name as mysql_import_index_name
49
49
  from hikyuu.data.pytdx_to_mysql import import_stock_name as mysql_import_stock_name
50
+ from hikyuu.data.common_clickhouse import create_database as clickhouse_create_database
51
+ from hikyuu.data.common_clickhouse import import_new_holidays as clickhouse_import_new_holidays
52
+ from hikyuu.data.pytdx_to_clickhouse import import_index_name as clickhouse_import_index_name
53
+ from hikyuu.data.pytdx_to_clickhouse import import_stock_name as clickhouse_import_stock_name
50
54
  from hikyuu.util.mylog import class_logger
51
55
 
52
56
 
@@ -218,7 +222,7 @@ class UseTdxImportToH5Thread(QThread):
218
222
  import_new_holidays = sqlite_import_new_holidays
219
223
  import_index_name = sqlite_import_index_name
220
224
  import_stock_name = sqlite_import_stock_name
221
- else:
225
+ elif self.config.getboolean('mysql', 'enable', fallback=True):
222
226
  db_config = {
223
227
  'user': self.config['mysql']['usr'],
224
228
  'password': self.config['mysql']['pwd'],
@@ -231,6 +235,20 @@ class UseTdxImportToH5Thread(QThread):
231
235
  import_index_name = mysql_import_index_name
232
236
  import_stock_name = mysql_import_stock_name
233
237
 
238
+ elif self.config.getboolean('clickhouse', 'enable', fallback=True):
239
+ db_config = {
240
+ 'username': self.config['clickhouse']['usr'],
241
+ 'password': self.config['clickhouse']['pwd'],
242
+ 'host': self.config['clickhouse']['host'],
243
+ 'port': self.config['clickhouse']['http_port']
244
+ }
245
+ import clickhouse_connect
246
+ connect = clickhouse_connect.get_client(**db_config)
247
+ create_database = clickhouse_create_database
248
+ import_new_holidays = clickhouse_import_new_holidays
249
+ import_index_name = clickhouse_import_index_name
250
+ import_stock_name = clickhouse_import_stock_name
251
+
234
252
  create_database(connect)
235
253
 
236
254
  pytdx_api = TdxHq_API()
hikyuu/gui/dataserver.py CHANGED
@@ -7,13 +7,17 @@
7
7
  from hikyuu import start_data_server, stop_data_server
8
8
  import time
9
9
  import sys
10
+ import click
10
11
 
11
- if __name__ == "__main__":
12
- data_server_addr = "tcp://0.0.0.0:9201" if len(sys.argv) <= 1 else sys.argv[1]
13
- work_num = 2 if len(sys.argv) <= 2 else int(sys.argv[2])
14
12
 
13
+ @click.command()
14
+ @click.option('--addr', '-addr', default="tcp://127.0.0.1:9201", help='行情接收处理服务地址')
15
+ @click.option('--work_num', '-n', default=2, type=int, help='行情接收处理线程数')
16
+ @click.option('--save', '-save', default=False, type=bool, help='保存行情数据(仅支持clickhouse)')
17
+ @click.option('--buf', '-buf', default=False, type=bool, help='缓存行情数据')
18
+ def main(addr, work_num, save, buf):
15
19
  try:
16
- start_data_server(data_server_addr, work_num)
20
+ start_data_server(addr, work_num, save_tick=save, buf_tick=buf)
17
21
 
18
22
  while True:
19
23
  try:
@@ -23,3 +27,7 @@ if __name__ == "__main__":
23
27
 
24
28
  finally:
25
29
  stop_data_server()
30
+
31
+
32
+ if __name__ == "__main__":
33
+ main()
hikyuu/gui/spot_server.py CHANGED
@@ -29,6 +29,26 @@ def create_fb_spot_record(builder, record):
29
29
  name = builder.CreateString(record['name'])
30
30
  datetime = builder.CreateString(str(record['datetime']))
31
31
 
32
+ builder.StartVector(8, len(record['bid']), 8) # 8 字节 = double
33
+ for value in reversed(record['bid']): # 必须逆序添加元素
34
+ builder.PrependFloat64(value)
35
+ bid = builder.EndVector(len(record['bid']))
36
+
37
+ builder.StartVector(8, len(record['bid_amount']), 8)
38
+ for value in reversed(record['bid_amount']):
39
+ builder.PrependFloat64(value)
40
+ bid_amount = builder.EndVector(len(record['bid_amount']))
41
+
42
+ builder.StartVector(8, len(record['ask']), 8)
43
+ for value in reversed(record['ask']):
44
+ builder.PrependFloat64(value)
45
+ ask = builder.EndVector(len(record['ask']))
46
+
47
+ builder.StartVector(8, len(record['ask_amount']), 8)
48
+ for value in reversed(record['ask_amount']):
49
+ builder.PrependFloat64(value)
50
+ ask_amount = builder.EndVector(len(record['ask_amount']))
51
+
32
52
  fb.SpotStart(builder)
33
53
  fb.SpotAddMarket(builder, market)
34
54
  fb.SpotAddCode(builder, code)
@@ -41,29 +61,15 @@ def create_fb_spot_record(builder, record):
41
61
  fb.SpotAddClose(builder, record['close'])
42
62
  fb.SpotAddAmount(builder, record['amount'])
43
63
  fb.SpotAddVolume(builder, record['volume'])
44
- fb.SpotAddBid1(builder, record['bid1'])
45
- fb.SpotAddBid1Amount(builder, record['bid1_amount'])
46
- fb.SpotAddBid2(builder, record['bid2'])
47
- fb.SpotAddBid2Amount(builder, record['bid2_amount'])
48
- fb.SpotAddBid3(builder, record['bid3'])
49
- fb.SpotAddBid3Amount(builder, record['bid3_amount'])
50
- fb.SpotAddBid4(builder, record['bid4'])
51
- fb.SpotAddBid4Amount(builder, record['bid4_amount'])
52
- fb.SpotAddBid5(builder, record['bid5'])
53
- fb.SpotAddBid5Amount(builder, record['bid5_amount'])
54
- fb.SpotAddAsk1(builder, record['ask1'])
55
- fb.SpotAddAsk1Amount(builder, record['ask1_amount'])
56
- fb.SpotAddAsk2(builder, record['ask2'])
57
- fb.SpotAddAsk2Amount(builder, record['ask2_amount'])
58
- fb.SpotAddAsk3(builder, record['ask3'])
59
- fb.SpotAddAsk3Amount(builder, record['ask3_amount'])
60
- fb.SpotAddAsk4(builder, record['ask4'])
61
- fb.SpotAddAsk4Amount(builder, record['ask4_amount'])
62
- fb.SpotAddAsk5(builder, record['ask5'])
63
- fb.SpotAddAsk5Amount(builder, record['ask5_amount'])
64
+
65
+ fb.SpotAddBid(builder, bid)
66
+ fb.SpotAddBidAmount(builder, bid_amount)
67
+ fb.SpotAddAsk(builder, ask)
68
+ fb.SpotAddAskAmount(builder, ask_amount)
64
69
  return fb.SpotEnd(builder)
65
70
 
66
71
 
72
+ @hku_catch(trace=True)
67
73
  def create_fb_spot(records):
68
74
  builder = flatbuffers.Builder(0)
69
75
  end = None
@@ -100,26 +106,10 @@ def print_spot(spot):
100
106
  print(spot.Close())
101
107
  print(spot.Amount())
102
108
  print(spot.volume())
103
- print(spot.Bid1())
104
- print(spot.Bid1Amount())
105
- print(spot.Bid2())
106
- print(spot.Bid2Amount())
107
- print(spot.Bid3())
108
- print(spot.Bid3Amount())
109
- print(spot.Bid4())
110
- print(spot.Bid4Amount())
111
- print(spot.Bid5())
112
- print(spot.Bid5Amount())
113
- print(spot.Ask1())
114
- print(spot.Ask1Amount())
115
- print(spot.Ask2())
116
- print(spot.Ask2Amount())
117
- print(spot.Ask3())
118
- print(spot.Ask3Amount())
119
- print(spot.Ask4())
120
- print(spot.Ask4Amount())
121
- print(spot.Ask5())
122
- print(spot.Ask5Amount())
109
+ print(spot.Bid())
110
+ print(spot.BidAmount())
111
+ print(spot.Ask())
112
+ print(spot.AskAmount())
123
113
 
124
114
 
125
115
  def print_spot_list(buf):
hikyuu/gui/start_qmt.py CHANGED
@@ -4,13 +4,14 @@
4
4
 
5
5
  from hikyuu.fetcher.stock.zh_stock_a_qmt import parse_one_result_qmt, get_spot
6
6
  from hikyuu.gui.spot_server import release_nng_senders, start_send_spot, end_send_spot, send_spot
7
+ from hikyuu.util import hku_info
7
8
 
8
9
 
9
10
  def callback(datas):
10
11
  records = []
11
12
  for stock_code, data in datas.items():
12
13
  records.append(parse_one_result_qmt(stock_code, data))
13
- # print(len(records))
14
+ hku_info(f"接收: {len(records)}")
14
15
 
15
16
  if records:
16
17
  start_send_spot()
@@ -38,6 +39,10 @@ if __name__ == "__main__":
38
39
  hku_param["datadir"] = ini.get('hikyuu', 'datadir')
39
40
  if ini.has_option('hikyuu', 'quotation_server'):
40
41
  hku_param["quotation_server"] = ini['hikyuu']['quotation_server']
42
+ if ini.has_option('hikyuu', 'plugindir'):
43
+ hku_param["plugindir"] = ini.get('hikyuu', 'plugindir')
44
+ else:
45
+ hku_param["plugindir"] = plugin_path
41
46
 
42
47
  # 不加载历史财务信息及权息数据
43
48
  hku_param["load_history_finance"] = False
@@ -75,7 +80,7 @@ if __name__ == "__main__":
75
80
  hku_info("waiting all data loaded ...")
76
81
  while not sm.data_ready:
77
82
  import time
78
- time.sleep(100)
83
+ time.sleep(1)
79
84
 
80
85
  stk_list = [s for s in sm if s.valid and s.type in (
81
86
  constant.STOCKTYPE_A, constant.STOCKTYPE_INDEX, constant.STOCKTYPE_ETF,
@@ -84,7 +89,19 @@ if __name__ == "__main__":
84
89
  hku_info("start xtquant")
85
90
  code_list = [f'{s.code}.{s.market}' for s in stk_list]
86
91
  from xtquant import xtdata
87
- xtdata.subscribe_whole_quote(code_list, callback)
92
+ import time
93
+ # xtdata.subscribe_whole_quote(['SH', 'SZ', 'BJ'], callback)
94
+ batch_size = 250
95
+ n = len(code_list) // batch_size
96
+ for i in range(n):
97
+ codes = code_list[i * batch_size: (i + 1) * batch_size]
98
+ v = xtdata.subscribe_whole_quote(codes, callback)
99
+ hku_info_if(v < 0, "订阅失败")
100
+ time.sleep(0.5)
101
+ codes = code_list[n * batch_size:]
102
+ if codes:
103
+ v = xtdata.subscribe_whole_quote(codes, callback)
104
+ hku_info_if(v < 0, "订阅失败")
88
105
 
89
106
  # 每日 9:30 时,主动读取行情一次,以便 hikyuu 生成当日首个分钟线
90
107
  while True:
hikyuu/hub.pyi CHANGED
@@ -28,11 +28,11 @@ import sys as sys
28
28
  import typing
29
29
  __all__: list = ['add_remote_hub', 'add_local_hub', 'update_hub', 'remove_hub', 'build_hub', 'help_part', 'get_part', 'get_part_list', 'get_hub_path', 'get_part_info', 'get_part_module', 'print_part_info', 'get_hub_name_list', 'get_part_name_list', 'get_current_hub', 'search_part']
30
30
  class ConfigModel(sqlalchemy.orm.decl_api.Base):
31
- __mapper__: typing.ClassVar[sqlalchemy.orm.mapper.Mapper] # value = <Mapper at 0x254a51cdc10; ConfigModel>
31
+ __mapper__: typing.ClassVar[sqlalchemy.orm.mapper.Mapper] # value = <Mapper at 0x1fc04455310; ConfigModel>
32
32
  __table__: typing.ClassVar[sqlalchemy.sql.schema.Table] # value = Table('hub_config', MetaData(), Column('id', Integer(), table=<hub_config>, primary_key=True, nullable=False, default=Sequence('config_id_seq', metadata=MetaData())), Column('key', String(), table=<hub_config>), Column('value', String(), table=<hub_config>), schema=None)
33
33
  __table_args__: typing.ClassVar[tuple] # value = (UniqueConstraint(Column('key', String(), table=<hub_config>)))
34
34
  __tablename__: typing.ClassVar[str] = 'hub_config'
35
- _sa_class_manager: typing.ClassVar[sqlalchemy.orm.instrumentation.ClassManager] # value = <ClassManager of <class 'hikyuu.hub.ConfigModel'> at 254a521fbd0>
35
+ _sa_class_manager: typing.ClassVar[sqlalchemy.orm.instrumentation.ClassManager] # value = <ClassManager of <class 'hikyuu.hub.ConfigModel'> at 1fc046b1590>
36
36
  def __init__(self, **kwargs):
37
37
  """
38
38
  A simple constructor that allows initialization from kwargs.
@@ -109,11 +109,11 @@ class HubManager:
109
109
  def print_part_info(self, name):
110
110
  ...
111
111
  class HubModel(sqlalchemy.orm.decl_api.Base):
112
- __mapper__: typing.ClassVar[sqlalchemy.orm.mapper.Mapper] # value = <Mapper at 0x254a5259280; HubModel>
112
+ __mapper__: typing.ClassVar[sqlalchemy.orm.mapper.Mapper] # value = <Mapper at 0x1fc04693590; HubModel>
113
113
  __table__: typing.ClassVar[sqlalchemy.sql.schema.Table] # value = Table('hub_repo', MetaData(), Column('id', Integer(), table=<hub_repo>, primary_key=True, nullable=False, default=Sequence('remote_id_seq', metadata=MetaData())), Column('name', String(), table=<hub_repo>), Column('hub_type', String(), table=<hub_repo>), Column('local_base', String(), table=<hub_repo>), Column('local', String(), table=<hub_repo>), Column('url', String(), table=<hub_repo>), Column('branch', String(), table=<hub_repo>), schema=None)
114
114
  __table_args__: typing.ClassVar[tuple] # value = (UniqueConstraint(Column('name', String(), table=<hub_repo>)))
115
115
  __tablename__: typing.ClassVar[str] = 'hub_repo'
116
- _sa_class_manager: typing.ClassVar[sqlalchemy.orm.instrumentation.ClassManager] # value = <ClassManager of <class 'hikyuu.hub.HubModel'> at 254a5254630>
116
+ _sa_class_manager: typing.ClassVar[sqlalchemy.orm.instrumentation.ClassManager] # value = <ClassManager of <class 'hikyuu.hub.HubModel'> at 1fc046c9ef0>
117
117
  def __init__(self, **kwargs):
118
118
  """
119
119
  A simple constructor that allows initialization from kwargs.
@@ -146,11 +146,11 @@ class ModuleConflictError(Exception):
146
146
  def __str__(self):
147
147
  ...
148
148
  class PartModel(sqlalchemy.orm.decl_api.Base):
149
- __mapper__: typing.ClassVar[sqlalchemy.orm.mapper.Mapper] # value = <Mapper at 0x254a52671f0; PartModel>
149
+ __mapper__: typing.ClassVar[sqlalchemy.orm.mapper.Mapper] # value = <Mapper at 0x1fc0322b3b0; PartModel>
150
150
  __table__: typing.ClassVar[sqlalchemy.sql.schema.Table] # value = Table('hub_part', MetaData(), Column('id', Integer(), table=<hub_part>, primary_key=True, nullable=False, default=Sequence('part_id_seq', metadata=MetaData())), Column('hub_name', String(), table=<hub_part>), Column('part', String(), table=<hub_part>), Column('name', String(), table=<hub_part>), Column('author', String(), table=<hub_part>), Column('version', String(), table=<hub_part>), Column('doc', String(), table=<hub_part>), Column('module_name', String(), table=<hub_part>), Column('label', String(), table=<hub_part>), schema=None)
151
151
  __table_args__: typing.ClassVar[tuple] # value = (UniqueConstraint(Column('name', String(), table=<hub_part>)))
152
152
  __tablename__: typing.ClassVar[str] = 'hub_part'
153
- _sa_class_manager: typing.ClassVar[sqlalchemy.orm.instrumentation.ClassManager] # value = <ClassManager of <class 'hikyuu.hub.PartModel'> at 254a52660e0>
153
+ _sa_class_manager: typing.ClassVar[sqlalchemy.orm.instrumentation.ClassManager] # value = <ClassManager of <class 'hikyuu.hub.PartModel'> at 1fc046caa80>
154
154
  def __init__(self, **kwargs):
155
155
  """
156
156
  A simple constructor that allows initialization from kwargs.
@@ -39,6 +39,11 @@
39
39
  #include "utilities/Null.h"
40
40
  #include "utilities/arithmetic.h"
41
41
  #include "utilities/SpendTimer.h"
42
+ #include "utilities/config.h"
43
+
44
+ #if HKU_ENABLE_MO
45
+ #include "utilities/mo/mo.h"
46
+ #endif
42
47
 
43
48
  #if HKU_SUPPORT_SERIALIZATION
44
49
  #include <boost/serialization/nvp.hpp>
@@ -144,6 +149,12 @@ using std::vector;
144
149
  typedef vector<price_t> PriceList;
145
150
  typedef vector<string> StringList;
146
151
 
152
+ #if HKU_ENABLE_MO
153
+ using mo::_tr;
154
+ #else
155
+ #define _tr(x) x
156
+ #endif
157
+
147
158
  using std::isfinite;
148
159
  using std::isinf;
149
160
  using std::isnan;
@@ -253,6 +253,9 @@ public:
253
253
  template <typename PluginInterfaceT>
254
254
  PluginInterfaceT* getPlugin(const std::string& pluginname) noexcept;
255
255
 
256
+ /** 设置多语言支持路径(仅在初始化之前有效) */
257
+ void setLanguagePath(const std::string& path);
258
+
256
259
  public:
257
260
  typedef StockMapIterator const_iterator;
258
261
  const_iterator begin() const {
@@ -332,6 +335,7 @@ private:
332
335
  std::unique_ptr<ThreadPool> m_load_tg; // 异步数据加载辅助线程组
333
336
 
334
337
  PluginManager m_plugin_manager;
338
+ std::string m_i18n_path;
335
339
  };
336
340
 
337
341
  inline size_t StockManager::size() const {
@@ -396,6 +400,10 @@ inline PluginInterfaceT* StockManager::getPlugin(const std::string& pluginname)
396
400
  return m_plugin_manager.getPlugin<PluginInterfaceT>(pluginname);
397
401
  }
398
402
 
403
+ inline void StockManager::setLanguagePath(const std::string& path) {
404
+ m_i18n_path = path;
405
+ }
406
+
399
407
  } // namespace hku
400
408
 
401
409
  #endif /* STOCKMANAGER_H_ */
@@ -68,6 +68,7 @@ public:
68
68
  m_low = rhs.m_low;
69
69
  m_close = rhs.m_close;
70
70
  m_amount = rhs.m_amount;
71
+ m_count = rhs.m_count;
71
72
  }
72
73
  return *this;
73
74
  }
@@ -26,7 +26,7 @@ void HKU_API startSpotAgent(bool print = true, size_t worker_num = 1,
26
26
  */
27
27
  void HKU_API stopSpotAgent();
28
28
 
29
- SpotAgent* getGlobalSpotAgent();
29
+ HKU_API SpotAgent* getGlobalSpotAgent();
30
30
 
31
31
  void HKU_API releaseGlobalSpotAgent();
32
32
 
@@ -16,37 +16,21 @@ namespace hku {
16
16
  * @ingroup Agent
17
17
  */
18
18
  struct HKU_API SpotRecord {
19
- string market; ///< 市场标识
20
- string code; ///< 证券代码
21
- string name; ///< 证券名称
22
- Datetime datetime; ///< 数据时间
23
- price_t yesterday_close; ///< 昨日收盘价
24
- price_t open; ///< 开盘价
25
- price_t high; ///< 最高价
26
- price_t low; ///< 最低价
27
- price_t close; ///< 收盘价
28
- price_t amount; ///< 成交金额 (千元)
29
- price_t volume; ///< 成交量(手)
30
- price_t bid1; ///< 买一价
31
- price_t bid1_amount; ///< 买一数量(手)
32
- price_t bid2; ///< 买二价
33
- price_t bid2_amount; ///< 买二数量
34
- price_t bid3; ///< 买三价
35
- price_t bid3_amount; ///< 买三数量
36
- price_t bid4; ///< 买四价
37
- price_t bid4_amount; ///< 买四数量
38
- price_t bid5; ///< 买五价
39
- price_t bid5_amount; ///< 买五数量
40
- price_t ask1; ///< 卖一价
41
- price_t ask1_amount; ///< 卖一数量
42
- price_t ask2; ///< 卖二价
43
- price_t ask2_amount; ///< 卖二数量
44
- price_t ask3; ///< 卖三价
45
- price_t ask3_amount; ///< 卖三数量
46
- price_t ask4; ///< 卖四价
47
- price_t ask4_amount; ///< 卖四数量
48
- price_t ask5; ///< 卖五价
49
- price_t ask5_amount; ///< 卖五数量
19
+ string market; ///< 市场标识
20
+ string code; ///< 证券代码
21
+ string name; ///< 证券名称
22
+ Datetime datetime; ///< 数据时间
23
+ price_t yesterday_close; ///< 昨日收盘价
24
+ price_t open; ///< 开盘价
25
+ price_t high; ///< 最高价
26
+ price_t low; ///< 最低价
27
+ price_t close; ///< 收盘价
28
+ price_t amount; ///< 成交金额 (千元)
29
+ price_t volume; ///< 成交量(手)
30
+ vector<double> bid; ///< 委买价
31
+ vector<double> bid_amount; ///< 委买量
32
+ vector<double> ask; ///< 委卖价
33
+ vector<double> ask_amount; ///< 委卖量
50
34
  };
51
35
 
52
36
  } // namespace hku