hikyuu 2.1.1__cp312-none-win_amd64.whl → 2.1.3__cp312-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/boost_date_time-mt.dll +0 -0
- hikyuu/cpp/boost_serialization-mt.dll +0 -0
- hikyuu/cpp/boost_wserialization-mt.dll +0 -0
- hikyuu/cpp/core312.pyd +0 -0
- hikyuu/cpp/hikyuu.dll +0 -0
- hikyuu/cpp/sqlite3.dll +0 -0
- hikyuu/data/mysql_upgrade/0019.sql +6 -0
- hikyuu/data/sqlite_upgrade/0020.sql +4 -0
- hikyuu/examples/notebook/006-TradeManager.ipynb +41 -39
- hikyuu/examples/notebook/008-Pickle.ipynb +27 -35
- hikyuu/fetcher/stock/zh_stock_a_qmt.py +58 -0
- hikyuu/gui/HikyuuTDX.py +2 -1
- hikyuu/gui/data/MainWindow.py +126 -126
- hikyuu/gui/spot_server.py +16 -7
- hikyuu/gui/start_qmt.py +36 -0
- hikyuu/include/hikyuu/Stock.h +1 -1
- hikyuu/include/hikyuu/StrategyContext.h +7 -2
- hikyuu/include/hikyuu/data_driver/base_info/table/HistoryFinanceTable.h +2 -2
- hikyuu/include/hikyuu/doc.h +2 -2
- hikyuu/include/hikyuu/global/GlobalSpotAgent.h +1 -0
- hikyuu/include/hikyuu/global/GlobalTaskGroup.h +4 -2
- hikyuu/include/hikyuu/global/SpotRecord.h +52 -0
- hikyuu/include/hikyuu/global/agent/SpotAgent.h +14 -41
- hikyuu/include/hikyuu/hikyuu.h +1 -0
- hikyuu/include/hikyuu/strategy/{AccountTradeManager.h → BrokerTradeManager.h} +98 -98
- hikyuu/include/hikyuu/strategy/RunPortfolioInStrategy.h +36 -0
- hikyuu/include/hikyuu/strategy/RunSystemInStrategy.h +37 -0
- hikyuu/include/hikyuu/strategy/Strategy.h +177 -0
- hikyuu/include/hikyuu/trade_manage/FundsRecord.h +8 -8
- hikyuu/include/hikyuu/trade_manage/OrderBrokerBase.h +66 -14
- hikyuu/include/hikyuu/trade_manage/PositionRecord.h +12 -12
- hikyuu/include/hikyuu/trade_manage/TradeManager.h +9 -0
- hikyuu/include/hikyuu/trade_manage/TradeManagerBase.h +19 -0
- hikyuu/include/hikyuu/utilities/TimerManager.h +23 -9
- hikyuu/include/hikyuu/utilities/arithmetic.h +2 -2
- hikyuu/include/hikyuu/utilities/config.h +1 -1
- hikyuu/include/hikyuu/utilities/datetime/Datetime.h +1 -0
- hikyuu/include/hikyuu/utilities/exception.h +15 -17
- hikyuu/include/hikyuu/utilities/http_client/HttpClient.h +1 -1
- hikyuu/include/hikyuu/utilities/mo/moFileReader.h +1 -1
- hikyuu/include/hikyuu/version.h +4 -4
- hikyuu/interactive.py +46 -137
- hikyuu/strategy/__init__.py +0 -1
- hikyuu/strategy/strategy_demo1.py +53 -0
- hikyuu/strategy/strategy_demo2.py +47 -0
- hikyuu/strategy/strategy_demo3.py +24 -0
- hikyuu/trade_manage/broker.py +27 -11
- hikyuu/trade_manage/broker_easytrader.py +52 -6
- hikyuu/trade_manage/broker_mail.py +17 -20
- {hikyuu-2.1.1.dist-info → hikyuu-2.1.3.dist-info}/METADATA +1 -1
- {hikyuu-2.1.1.dist-info → hikyuu-2.1.3.dist-info}/RECORD +55 -47
- {hikyuu-2.1.1.dist-info → hikyuu-2.1.3.dist-info}/top_level.txt +0 -1
- hikyuu/include/hikyuu/strategy/StrategyBase.h +0 -156
- hikyuu/strategy/demo/__init__.py +0 -3
- hikyuu/strategy/strategy.py +0 -27
- {hikyuu-2.1.1.dist-info → hikyuu-2.1.3.dist-info}/LICENSE +0 -0
- {hikyuu-2.1.1.dist-info → hikyuu-2.1.3.dist-info}/WHEEL +0 -0
- {hikyuu-2.1.1.dist-info → hikyuu-2.1.3.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#!/usr/bin/python
|
|
2
|
+
# -*- coding: utf8 -*-
|
|
3
|
+
#
|
|
4
|
+
# Create on: 2024-08-22
|
|
5
|
+
# Author: fasiondog
|
|
6
|
+
|
|
7
|
+
from hikyuu import Datetime
|
|
8
|
+
from hikyuu.util import *
|
|
9
|
+
|
|
10
|
+
try:
|
|
11
|
+
from xtquant import xtdata
|
|
12
|
+
|
|
13
|
+
@hku_catch(trace=True, callback=lambda stk: hku_warn("Failed parse stk: {}", stk))
|
|
14
|
+
def parse_one_result_qmt(stk_code: str, data: dict):
|
|
15
|
+
'''将 qmt tick 数据转为 spot 数据
|
|
16
|
+
|
|
17
|
+
:param str stk_code: qmt 风格的证券编码,如 000001.SZ
|
|
18
|
+
:param dict data: 对应的 qmt 全推 tick 数据
|
|
19
|
+
'''
|
|
20
|
+
result = {}
|
|
21
|
+
code, market = stk_code.split('.')
|
|
22
|
+
result['market'] = market
|
|
23
|
+
result['code'] = code
|
|
24
|
+
result['name'] = ''
|
|
25
|
+
result['datetime'] = Datetime(data['timetag']) if 'timetag' in data else xtdata.timetag_to_datetime(
|
|
26
|
+
data['time'], "%Y-%m-%d %H:%M:%S")
|
|
27
|
+
|
|
28
|
+
result['yesterday_close'] = data['lastClose']
|
|
29
|
+
result['open'] = data['open']
|
|
30
|
+
result['high'] = data['high']
|
|
31
|
+
result['low'] = data['low']
|
|
32
|
+
result['close'] = data['lastPrice']
|
|
33
|
+
result['amount'] = data['amount'] * 0.001 # 转千元
|
|
34
|
+
result['volume'] = data['pvolume'] * 0.01 # 转手数
|
|
35
|
+
|
|
36
|
+
for i in range(5):
|
|
37
|
+
result[f'bid{i+1}'] = data['bidPrice'][i]
|
|
38
|
+
result[f'bid{i+1}_amount'] = data['bidVol'][i]
|
|
39
|
+
result[f'ask{i+1}'] = data['askPrice'][i]
|
|
40
|
+
result[f'ask{i+1}_amount'] = data['askVol'][i]
|
|
41
|
+
return result
|
|
42
|
+
|
|
43
|
+
def get_spot(stocklist, unused1, unused2, batch_func=None):
|
|
44
|
+
code_list = [f'{s.code}.{s.market}' for s in stocklist]
|
|
45
|
+
full_tick = xtdata.get_full_tick(code_list)
|
|
46
|
+
records = [parse_one_result_qmt(code, data) for code, data in full_tick.items()]
|
|
47
|
+
if batch_func is not None:
|
|
48
|
+
batch_func(records)
|
|
49
|
+
return records
|
|
50
|
+
|
|
51
|
+
except:
|
|
52
|
+
def parse_one_result_qmt(stk_code: str, data: dict):
|
|
53
|
+
hku_error("Not fount xtquant")
|
|
54
|
+
return dict()
|
|
55
|
+
|
|
56
|
+
def get_spot(stocklist, unused1, unused2, batch_func=None):
|
|
57
|
+
hku_error("Not fount xtquant")
|
|
58
|
+
return list()
|
hikyuu/gui/HikyuuTDX.py
CHANGED
|
@@ -81,7 +81,8 @@ class MyMainWindow(QMainWindow, Ui_MainWindow):
|
|
|
81
81
|
self.hdf5_import_thread.stop()
|
|
82
82
|
if self.escape_time_thread:
|
|
83
83
|
self.escape_time_thread.stop()
|
|
84
|
-
self
|
|
84
|
+
if hasattr(self, 'mp_log_q_lisener'):
|
|
85
|
+
self.mp_log_q_lisener.stop()
|
|
85
86
|
event.accept()
|
|
86
87
|
|
|
87
88
|
def getUserConfigDir(self):
|
hikyuu/gui/data/MainWindow.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Form implementation generated from reading ui file 'MainWindow.ui'
|
|
4
4
|
#
|
|
5
|
-
# Created by: PyQt5 UI code generator 5.15.
|
|
5
|
+
# Created by: PyQt5 UI code generator 5.15.10
|
|
6
6
|
#
|
|
7
7
|
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
|
|
8
8
|
# run again. Do not edit this file unless you know what you are doing.
|
|
@@ -343,122 +343,121 @@ class Ui_MainWindow(object):
|
|
|
343
343
|
self.save_pushButton.setGeometry(QtCore.QRect(390, 190, 75, 23))
|
|
344
344
|
self.save_pushButton.setObjectName("save_pushButton")
|
|
345
345
|
self.layoutWidget4 = QtWidgets.QWidget(self.groupBox_6)
|
|
346
|
-
self.layoutWidget4.setGeometry(QtCore.QRect(40, 80, 321,
|
|
346
|
+
self.layoutWidget4.setGeometry(QtCore.QRect(40, 80, 321, 296))
|
|
347
347
|
self.layoutWidget4.setObjectName("layoutWidget4")
|
|
348
348
|
self.gridLayout_6 = QtWidgets.QGridLayout(self.layoutWidget4)
|
|
349
349
|
self.gridLayout_6.setContentsMargins(0, 0, 0, 0)
|
|
350
350
|
self.gridLayout_6.setObjectName("gridLayout_6")
|
|
351
|
-
self.
|
|
352
|
-
self.
|
|
353
|
-
self.gridLayout_6.addWidget(self.
|
|
351
|
+
self.preload_week_checkBox = QtWidgets.QCheckBox(self.layoutWidget4)
|
|
352
|
+
self.preload_week_checkBox.setObjectName("preload_week_checkBox")
|
|
353
|
+
self.gridLayout_6.addWidget(self.preload_week_checkBox, 1, 0, 1, 1)
|
|
354
354
|
self.label_24 = QtWidgets.QLabel(self.layoutWidget4)
|
|
355
355
|
self.label_24.setObjectName("label_24")
|
|
356
356
|
self.gridLayout_6.addWidget(self.label_24, 0, 1, 1, 1)
|
|
357
|
+
self.preload_day_checkBox = QtWidgets.QCheckBox(self.layoutWidget4)
|
|
358
|
+
self.preload_day_checkBox.setObjectName("preload_day_checkBox")
|
|
359
|
+
self.gridLayout_6.addWidget(self.preload_day_checkBox, 0, 0, 1, 1)
|
|
360
|
+
self.preload_min15_checkBox = QtWidgets.QCheckBox(self.layoutWidget4)
|
|
361
|
+
self.preload_min15_checkBox.setObjectName("preload_min15_checkBox")
|
|
362
|
+
self.gridLayout_6.addWidget(self.preload_min15_checkBox, 8, 0, 1, 1)
|
|
363
|
+
self.preload_month_checkBox = QtWidgets.QCheckBox(self.layoutWidget4)
|
|
364
|
+
self.preload_month_checkBox.setObjectName("preload_month_checkBox")
|
|
365
|
+
self.gridLayout_6.addWidget(self.preload_month_checkBox, 2, 0, 1, 1)
|
|
357
366
|
self.preload_day_spinBox = QtWidgets.QSpinBox(self.layoutWidget4)
|
|
358
367
|
self.preload_day_spinBox.setMaximum(999999)
|
|
359
368
|
self.preload_day_spinBox.setObjectName("preload_day_spinBox")
|
|
360
369
|
self.gridLayout_6.addWidget(self.preload_day_spinBox, 0, 2, 1, 1)
|
|
361
|
-
self.
|
|
362
|
-
self.
|
|
363
|
-
self.gridLayout_6.addWidget(self.
|
|
364
|
-
self.
|
|
365
|
-
self.
|
|
366
|
-
self.
|
|
367
|
-
self.
|
|
368
|
-
self.
|
|
369
|
-
self.
|
|
370
|
-
self.gridLayout_6.addWidget(self.
|
|
371
|
-
self.
|
|
372
|
-
self.
|
|
373
|
-
self.gridLayout_6.addWidget(self.
|
|
370
|
+
self.preload_min5_checkBox = QtWidgets.QCheckBox(self.layoutWidget4)
|
|
371
|
+
self.preload_min5_checkBox.setObjectName("preload_min5_checkBox")
|
|
372
|
+
self.gridLayout_6.addWidget(self.preload_min5_checkBox, 7, 0, 1, 1)
|
|
373
|
+
self.preload_halfyear_spinBox = QtWidgets.QSpinBox(self.layoutWidget4)
|
|
374
|
+
self.preload_halfyear_spinBox.setMaximum(999999)
|
|
375
|
+
self.preload_halfyear_spinBox.setObjectName("preload_halfyear_spinBox")
|
|
376
|
+
self.gridLayout_6.addWidget(self.preload_halfyear_spinBox, 4, 2, 1, 1)
|
|
377
|
+
self.label_30 = QtWidgets.QLabel(self.layoutWidget4)
|
|
378
|
+
self.label_30.setObjectName("label_30")
|
|
379
|
+
self.gridLayout_6.addWidget(self.label_30, 6, 1, 1, 1)
|
|
380
|
+
self.label_32 = QtWidgets.QLabel(self.layoutWidget4)
|
|
381
|
+
self.label_32.setObjectName("label_32")
|
|
382
|
+
self.gridLayout_6.addWidget(self.label_32, 8, 1, 1, 1)
|
|
374
383
|
self.label_26 = QtWidgets.QLabel(self.layoutWidget4)
|
|
375
384
|
self.label_26.setObjectName("label_26")
|
|
376
385
|
self.gridLayout_6.addWidget(self.label_26, 2, 1, 1, 1)
|
|
377
|
-
self.preload_month_spinBox = QtWidgets.QSpinBox(self.layoutWidget4)
|
|
378
|
-
self.preload_month_spinBox.setMaximum(999999)
|
|
379
|
-
self.preload_month_spinBox.setObjectName("preload_month_spinBox")
|
|
380
|
-
self.gridLayout_6.addWidget(self.preload_month_spinBox, 2, 2, 1, 1)
|
|
381
|
-
self.preload_quarter_checkBox = QtWidgets.QCheckBox(self.layoutWidget4)
|
|
382
|
-
self.preload_quarter_checkBox.setObjectName("preload_quarter_checkBox")
|
|
383
|
-
self.gridLayout_6.addWidget(self.preload_quarter_checkBox, 3, 0, 1, 1)
|
|
384
|
-
self.label_27 = QtWidgets.QLabel(self.layoutWidget4)
|
|
385
|
-
self.label_27.setObjectName("label_27")
|
|
386
|
-
self.gridLayout_6.addWidget(self.label_27, 3, 1, 1, 1)
|
|
387
386
|
self.preload_quarter_spinBox = QtWidgets.QSpinBox(self.layoutWidget4)
|
|
388
387
|
self.preload_quarter_spinBox.setMaximum(999999)
|
|
389
388
|
self.preload_quarter_spinBox.setObjectName("preload_quarter_spinBox")
|
|
390
389
|
self.gridLayout_6.addWidget(self.preload_quarter_spinBox, 3, 2, 1, 1)
|
|
390
|
+
self.preload_min60_checkBox = QtWidgets.QCheckBox(self.layoutWidget4)
|
|
391
|
+
self.preload_min60_checkBox.setObjectName("preload_min60_checkBox")
|
|
392
|
+
self.gridLayout_6.addWidget(self.preload_min60_checkBox, 10, 0, 1, 1)
|
|
393
|
+
self.preload_min1_checkBox = QtWidgets.QCheckBox(self.layoutWidget4)
|
|
394
|
+
self.preload_min1_checkBox.setObjectName("preload_min1_checkBox")
|
|
395
|
+
self.gridLayout_6.addWidget(self.preload_min1_checkBox, 6, 0, 1, 1)
|
|
396
|
+
self.preload_week_spinBox = QtWidgets.QSpinBox(self.layoutWidget4)
|
|
397
|
+
self.preload_week_spinBox.setMaximum(999999)
|
|
398
|
+
self.preload_week_spinBox.setObjectName("preload_week_spinBox")
|
|
399
|
+
self.gridLayout_6.addWidget(self.preload_week_spinBox, 1, 2, 1, 1)
|
|
391
400
|
self.preload_halfyear_checkBox = QtWidgets.QCheckBox(self.layoutWidget4)
|
|
392
401
|
self.preload_halfyear_checkBox.setObjectName("preload_halfyear_checkBox")
|
|
393
402
|
self.gridLayout_6.addWidget(self.preload_halfyear_checkBox, 4, 0, 1, 1)
|
|
394
|
-
self.
|
|
395
|
-
self.
|
|
396
|
-
self.gridLayout_6.addWidget(self.
|
|
397
|
-
self.preload_halfyear_spinBox = QtWidgets.QSpinBox(self.layoutWidget4)
|
|
398
|
-
self.preload_halfyear_spinBox.setMaximum(999999)
|
|
399
|
-
self.preload_halfyear_spinBox.setObjectName("preload_halfyear_spinBox")
|
|
400
|
-
self.gridLayout_6.addWidget(self.preload_halfyear_spinBox, 4, 2, 1, 1)
|
|
401
|
-
self.preload_year_checkBox = QtWidgets.QCheckBox(self.layoutWidget4)
|
|
402
|
-
self.preload_year_checkBox.setObjectName("preload_year_checkBox")
|
|
403
|
-
self.gridLayout_6.addWidget(self.preload_year_checkBox, 5, 0, 1, 1)
|
|
403
|
+
self.preload_min30_checkBox = QtWidgets.QCheckBox(self.layoutWidget4)
|
|
404
|
+
self.preload_min30_checkBox.setObjectName("preload_min30_checkBox")
|
|
405
|
+
self.gridLayout_6.addWidget(self.preload_min30_checkBox, 9, 0, 1, 1)
|
|
404
406
|
self.label_29 = QtWidgets.QLabel(self.layoutWidget4)
|
|
405
407
|
self.label_29.setObjectName("label_29")
|
|
406
408
|
self.gridLayout_6.addWidget(self.label_29, 5, 1, 1, 1)
|
|
409
|
+
self.preload_min30_spinBox = QtWidgets.QSpinBox(self.layoutWidget4)
|
|
410
|
+
self.preload_min30_spinBox.setMaximum(999999)
|
|
411
|
+
self.preload_min30_spinBox.setObjectName("preload_min30_spinBox")
|
|
412
|
+
self.gridLayout_6.addWidget(self.preload_min30_spinBox, 9, 2, 1, 1)
|
|
413
|
+
self.label_34 = QtWidgets.QLabel(self.layoutWidget4)
|
|
414
|
+
self.label_34.setObjectName("label_34")
|
|
415
|
+
self.gridLayout_6.addWidget(self.label_34, 10, 1, 1, 1)
|
|
416
|
+
self.preload_min5_spinBox = QtWidgets.QSpinBox(self.layoutWidget4)
|
|
417
|
+
self.preload_min5_spinBox.setMaximum(999999)
|
|
418
|
+
self.preload_min5_spinBox.setObjectName("preload_min5_spinBox")
|
|
419
|
+
self.gridLayout_6.addWidget(self.preload_min5_spinBox, 7, 2, 1, 1)
|
|
420
|
+
self.preload_min60_spinBox = QtWidgets.QSpinBox(self.layoutWidget4)
|
|
421
|
+
self.preload_min60_spinBox.setMaximum(999999)
|
|
422
|
+
self.preload_min60_spinBox.setObjectName("preload_min60_spinBox")
|
|
423
|
+
self.gridLayout_6.addWidget(self.preload_min60_spinBox, 10, 2, 1, 1)
|
|
407
424
|
self.preload_year_spinBox = QtWidgets.QSpinBox(self.layoutWidget4)
|
|
408
425
|
self.preload_year_spinBox.setMaximum(999999)
|
|
409
426
|
self.preload_year_spinBox.setObjectName("preload_year_spinBox")
|
|
410
427
|
self.gridLayout_6.addWidget(self.preload_year_spinBox, 5, 2, 1, 1)
|
|
411
|
-
self.
|
|
412
|
-
self.
|
|
413
|
-
self.
|
|
414
|
-
self.
|
|
415
|
-
self.
|
|
416
|
-
self.
|
|
428
|
+
self.preload_month_spinBox = QtWidgets.QSpinBox(self.layoutWidget4)
|
|
429
|
+
self.preload_month_spinBox.setMaximum(999999)
|
|
430
|
+
self.preload_month_spinBox.setObjectName("preload_month_spinBox")
|
|
431
|
+
self.gridLayout_6.addWidget(self.preload_month_spinBox, 2, 2, 1, 1)
|
|
432
|
+
self.label_25 = QtWidgets.QLabel(self.layoutWidget4)
|
|
433
|
+
self.label_25.setObjectName("label_25")
|
|
434
|
+
self.gridLayout_6.addWidget(self.label_25, 1, 1, 1, 1)
|
|
435
|
+
self.label_33 = QtWidgets.QLabel(self.layoutWidget4)
|
|
436
|
+
self.label_33.setObjectName("label_33")
|
|
437
|
+
self.gridLayout_6.addWidget(self.label_33, 9, 1, 1, 1)
|
|
438
|
+
self.label_27 = QtWidgets.QLabel(self.layoutWidget4)
|
|
439
|
+
self.label_27.setObjectName("label_27")
|
|
440
|
+
self.gridLayout_6.addWidget(self.label_27, 3, 1, 1, 1)
|
|
441
|
+
self.label_28 = QtWidgets.QLabel(self.layoutWidget4)
|
|
442
|
+
self.label_28.setObjectName("label_28")
|
|
443
|
+
self.gridLayout_6.addWidget(self.label_28, 4, 1, 1, 1)
|
|
444
|
+
self.label_31 = QtWidgets.QLabel(self.layoutWidget4)
|
|
445
|
+
self.label_31.setObjectName("label_31")
|
|
446
|
+
self.gridLayout_6.addWidget(self.label_31, 7, 1, 1, 1)
|
|
417
447
|
self.preload_min1_spinBox = QtWidgets.QSpinBox(self.layoutWidget4)
|
|
418
448
|
self.preload_min1_spinBox.setMaximum(999999)
|
|
419
449
|
self.preload_min1_spinBox.setObjectName("preload_min1_spinBox")
|
|
420
450
|
self.gridLayout_6.addWidget(self.preload_min1_spinBox, 6, 2, 1, 1)
|
|
421
|
-
self.preload_min5_checkBox = QtWidgets.QCheckBox(self.layoutWidget4)
|
|
422
|
-
self.preload_min5_checkBox.setObjectName("preload_min5_checkBox")
|
|
423
|
-
self.gridLayout_6.addWidget(self.preload_min5_checkBox, 7, 0, 1, 1)
|
|
424
|
-
self.label_31 = QtWidgets.QLabel(self.layoutWidget4)
|
|
425
|
-
self.label_31.setObjectName("label_31")
|
|
426
|
-
self.gridLayout_6.addWidget(self.label_31, 7, 1, 1, 1)
|
|
427
|
-
self.preload_min5_spinBox = QtWidgets.QSpinBox(self.layoutWidget4)
|
|
428
|
-
self.preload_min5_spinBox.setMaximum(999999)
|
|
429
|
-
self.preload_min5_spinBox.setObjectName("preload_min5_spinBox")
|
|
430
|
-
self.gridLayout_6.addWidget(self.preload_min5_spinBox, 7, 2, 1, 1)
|
|
431
|
-
self.preload_min15_checkBox = QtWidgets.QCheckBox(self.layoutWidget4)
|
|
432
|
-
self.preload_min15_checkBox.setObjectName("preload_min15_checkBox")
|
|
433
|
-
self.gridLayout_6.addWidget(self.preload_min15_checkBox, 8, 0, 1, 1)
|
|
434
|
-
self.label_32 = QtWidgets.QLabel(self.layoutWidget4)
|
|
435
|
-
self.label_32.setObjectName("label_32")
|
|
436
|
-
self.gridLayout_6.addWidget(self.label_32, 8, 1, 1, 1)
|
|
437
451
|
self.preload_min15_spinBox = QtWidgets.QSpinBox(self.layoutWidget4)
|
|
438
452
|
self.preload_min15_spinBox.setMaximum(999999)
|
|
439
453
|
self.preload_min15_spinBox.setObjectName("preload_min15_spinBox")
|
|
440
454
|
self.gridLayout_6.addWidget(self.preload_min15_spinBox, 8, 2, 1, 1)
|
|
441
|
-
self.
|
|
442
|
-
self.
|
|
443
|
-
self.gridLayout_6.addWidget(self.
|
|
444
|
-
self.
|
|
445
|
-
self.
|
|
446
|
-
self.gridLayout_6.addWidget(self.
|
|
447
|
-
self.preload_min30_spinBox = QtWidgets.QSpinBox(self.layoutWidget4)
|
|
448
|
-
self.preload_min30_spinBox.setMaximum(999999)
|
|
449
|
-
self.preload_min30_spinBox.setObjectName("preload_min30_spinBox")
|
|
450
|
-
self.gridLayout_6.addWidget(self.preload_min30_spinBox, 9, 2, 1, 1)
|
|
451
|
-
self.preload_min60_checkBox = QtWidgets.QCheckBox(self.layoutWidget4)
|
|
452
|
-
self.preload_min60_checkBox.setObjectName("preload_min60_checkBox")
|
|
453
|
-
self.gridLayout_6.addWidget(self.preload_min60_checkBox, 10, 0, 1, 1)
|
|
454
|
-
self.label_34 = QtWidgets.QLabel(self.layoutWidget4)
|
|
455
|
-
self.label_34.setObjectName("label_34")
|
|
456
|
-
self.gridLayout_6.addWidget(self.label_34, 10, 1, 1, 1)
|
|
457
|
-
self.preload_min60_spinBox = QtWidgets.QSpinBox(self.layoutWidget4)
|
|
458
|
-
self.preload_min60_spinBox.setMaximum(999999)
|
|
459
|
-
self.preload_min60_spinBox.setObjectName("preload_min60_spinBox")
|
|
460
|
-
self.gridLayout_6.addWidget(self.preload_min60_spinBox, 10, 2, 1, 1)
|
|
461
|
-
|
|
455
|
+
self.preload_year_checkBox = QtWidgets.QCheckBox(self.layoutWidget4)
|
|
456
|
+
self.preload_year_checkBox.setObjectName("preload_year_checkBox")
|
|
457
|
+
self.gridLayout_6.addWidget(self.preload_year_checkBox, 5, 0, 1, 1)
|
|
458
|
+
self.preload_quarter_checkBox = QtWidgets.QCheckBox(self.layoutWidget4)
|
|
459
|
+
self.preload_quarter_checkBox.setObjectName("preload_quarter_checkBox")
|
|
460
|
+
self.gridLayout_6.addWidget(self.preload_quarter_checkBox, 3, 0, 1, 1)
|
|
462
461
|
self.preload_hour2_checkBox = QtWidgets.QCheckBox(self.layoutWidget4)
|
|
463
462
|
self.preload_hour2_checkBox.setObjectName("preload_hour2_checkBox")
|
|
464
463
|
self.gridLayout_6.addWidget(self.preload_hour2_checkBox, 11, 0, 1, 1)
|
|
@@ -467,9 +466,8 @@ class Ui_MainWindow(object):
|
|
|
467
466
|
self.gridLayout_6.addWidget(self.label_42, 11, 1, 1, 1)
|
|
468
467
|
self.preload_hour2_spinBox = QtWidgets.QSpinBox(self.layoutWidget4)
|
|
469
468
|
self.preload_hour2_spinBox.setMaximum(999999)
|
|
470
|
-
self.preload_hour2_spinBox.setObjectName("
|
|
469
|
+
self.preload_hour2_spinBox.setObjectName("preload_hour2_spinBox")
|
|
471
470
|
self.gridLayout_6.addWidget(self.preload_hour2_spinBox, 11, 2, 1, 1)
|
|
472
|
-
|
|
473
471
|
self.layoutWidget5 = QtWidgets.QWidget(self.groupBox_6)
|
|
474
472
|
self.layoutWidget5.setGeometry(QtCore.QRect(40, 30, 362, 40))
|
|
475
473
|
self.layoutWidget5.setObjectName("layoutWidget5")
|
|
@@ -499,7 +497,7 @@ class Ui_MainWindow(object):
|
|
|
499
497
|
self.collect_sample_spinBox.setObjectName("collect_sample_spinBox")
|
|
500
498
|
self.horizontalLayout_10.addWidget(self.collect_sample_spinBox)
|
|
501
499
|
self.collect_use_zhima_checkBox = QtWidgets.QCheckBox(self.tab)
|
|
502
|
-
self.collect_use_zhima_checkBox.setGeometry(QtCore.QRect(40,
|
|
500
|
+
self.collect_use_zhima_checkBox.setGeometry(QtCore.QRect(40, 275, 141, 16))
|
|
503
501
|
self.collect_use_zhima_checkBox.setObjectName("collect_use_zhima_checkBox")
|
|
504
502
|
self.layoutWidget7 = QtWidgets.QWidget(self.tab)
|
|
505
503
|
self.layoutWidget7.setGeometry(QtCore.QRect(40, 190, 214, 24))
|
|
@@ -546,7 +544,7 @@ class Ui_MainWindow(object):
|
|
|
546
544
|
self.horizontalLayout_7.addWidget(self.collect_phase2_last_timeEdit)
|
|
547
545
|
self.horizontalLayout_9.addLayout(self.horizontalLayout_7)
|
|
548
546
|
self.textBrowser = QtWidgets.QTextBrowser(self.tab)
|
|
549
|
-
self.textBrowser.setGeometry(QtCore.QRect(30,
|
|
547
|
+
self.textBrowser.setGeometry(QtCore.QRect(30, 311, 511, 191))
|
|
550
548
|
self.textBrowser.setObjectName("textBrowser")
|
|
551
549
|
self.layoutWidget8 = QtWidgets.QWidget(self.tab)
|
|
552
550
|
self.layoutWidget8.setGeometry(QtCore.QRect(40, 90, 141, 23))
|
|
@@ -560,6 +558,7 @@ class Ui_MainWindow(object):
|
|
|
560
558
|
self.collect_source_comboBox = QtWidgets.QComboBox(self.layoutWidget8)
|
|
561
559
|
self.collect_source_comboBox.setObjectName("collect_source_comboBox")
|
|
562
560
|
self.collect_source_comboBox.addItem("")
|
|
561
|
+
self.collect_source_comboBox.addItem("")
|
|
563
562
|
self.horizontalLayout_13.addWidget(self.collect_source_comboBox)
|
|
564
563
|
self.collect_start_pushButton = QtWidgets.QPushButton(self.tab)
|
|
565
564
|
self.collect_start_pushButton.setGeometry(QtCore.QRect(40, 30, 141, 23))
|
|
@@ -639,50 +638,50 @@ class Ui_MainWindow(object):
|
|
|
639
638
|
self.label_9.setText(_translate("MainWindow", "导入权息数据:"))
|
|
640
639
|
self.hdf5_weight_label.setText(_translate("MainWindow", "TextLabel"))
|
|
641
640
|
self.import_detail_textEdit.setHtml(_translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
641
|
+
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
|
|
642
|
+
"p, li { white-space: pre-wrap; }\n"
|
|
643
|
+
"</style></head><body style=\" font-family:\'SimSun\'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
|
|
644
|
+
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">导入上证日线记录:</p>\n"
|
|
645
|
+
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">导入深证日线记录:</p>\n"
|
|
646
|
+
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">导入上证5分钟线记录:</p>\n"
|
|
647
|
+
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">导入深证5分钟线记录:</p>\n"
|
|
648
|
+
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">导入上证1分钟线记录:</p>\n"
|
|
649
|
+
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">导入深证1分钟线记录:</p>\n"
|
|
650
|
+
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">导入上证分笔记录:</p>\n"
|
|
651
|
+
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">导入深证分笔记录:</p>\n"
|
|
652
|
+
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">导入上证分时数据:</p>\n"
|
|
653
|
+
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">导入深证分时数据:</p>\n"
|
|
654
|
+
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">导入权息数据数:</p>\n"
|
|
655
|
+
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">导入完毕!</p></body></html>"))
|
|
657
656
|
self.import_status_label.setText(_translate("MainWindow", "import_status_label"))
|
|
658
657
|
self.sched_import_pushButton.setText(_translate("MainWindow", "启动定时导入"))
|
|
659
658
|
self.label_40.setText(_translate("MainWindow", "导入执行时间:"))
|
|
660
659
|
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), _translate("MainWindow", "执行导入"))
|
|
661
660
|
self.groupBox_6.setTitle(_translate("MainWindow", "预加载设置"))
|
|
662
661
|
self.save_pushButton.setText(_translate("MainWindow", "保存设置"))
|
|
663
|
-
self.preload_day_checkBox.setText(_translate("MainWindow", "预加载日线"))
|
|
664
|
-
self.label_24.setText(_translate("MainWindow", "最大缓存数量:"))
|
|
665
662
|
self.preload_week_checkBox.setText(_translate("MainWindow", "预加载周线"))
|
|
666
|
-
self.
|
|
663
|
+
self.label_24.setText(_translate("MainWindow", "最大缓存数量:"))
|
|
664
|
+
self.preload_day_checkBox.setText(_translate("MainWindow", "预加载日线"))
|
|
665
|
+
self.preload_min15_checkBox.setText(_translate("MainWindow", "预加载15分钟线"))
|
|
667
666
|
self.preload_month_checkBox.setText(_translate("MainWindow", "预加载月线"))
|
|
668
|
-
self.label_26.setText(_translate("MainWindow", "最大缓存数量:"))
|
|
669
|
-
self.preload_quarter_checkBox.setText(_translate("MainWindow", "预加载季线"))
|
|
670
|
-
self.label_27.setText(_translate("MainWindow", "最大缓存数量:"))
|
|
671
|
-
self.preload_halfyear_checkBox.setText(_translate("MainWindow", "预加载半年线"))
|
|
672
|
-
self.label_28.setText(_translate("MainWindow", "最大缓存数量:"))
|
|
673
|
-
self.preload_year_checkBox.setText(_translate("MainWindow", "预加载年线"))
|
|
674
|
-
self.label_29.setText(_translate("MainWindow", "最大缓存数量:"))
|
|
675
|
-
self.preload_min1_checkBox.setText(_translate("MainWindow", "预加载1分钟线"))
|
|
676
|
-
self.label_30.setText(_translate("MainWindow", "最大缓存数量:"))
|
|
677
667
|
self.preload_min5_checkBox.setText(_translate("MainWindow", "预加载5分钟线"))
|
|
678
|
-
self.
|
|
679
|
-
self.preload_min15_checkBox.setText(_translate("MainWindow", "预加载15分钟线"))
|
|
668
|
+
self.label_30.setText(_translate("MainWindow", "最大缓存数量:"))
|
|
680
669
|
self.label_32.setText(_translate("MainWindow", "最大缓存数量:"))
|
|
681
|
-
self.
|
|
682
|
-
self.label_33.setText(_translate("MainWindow", "最大缓存数量:"))
|
|
670
|
+
self.label_26.setText(_translate("MainWindow", "最大缓存数量:"))
|
|
683
671
|
self.preload_min60_checkBox.setText(_translate("MainWindow", "预加载60分钟线"))
|
|
672
|
+
self.preload_min1_checkBox.setText(_translate("MainWindow", "预加载1分钟线"))
|
|
673
|
+
self.preload_halfyear_checkBox.setText(_translate("MainWindow", "预加载半年线"))
|
|
674
|
+
self.preload_min30_checkBox.setText(_translate("MainWindow", "预加载30分钟线"))
|
|
675
|
+
self.label_29.setText(_translate("MainWindow", "最大缓存数量:"))
|
|
684
676
|
self.label_34.setText(_translate("MainWindow", "最大缓存数量:"))
|
|
685
|
-
self.
|
|
677
|
+
self.label_25.setText(_translate("MainWindow", "最大缓存数量:"))
|
|
678
|
+
self.label_33.setText(_translate("MainWindow", "最大缓存数量:"))
|
|
679
|
+
self.label_27.setText(_translate("MainWindow", "最大缓存数量:"))
|
|
680
|
+
self.label_28.setText(_translate("MainWindow", "最大缓存数量:"))
|
|
681
|
+
self.label_31.setText(_translate("MainWindow", "最大缓存数量:"))
|
|
682
|
+
self.preload_year_checkBox.setText(_translate("MainWindow", "预加载年线"))
|
|
683
|
+
self.preload_quarter_checkBox.setText(_translate("MainWindow", "预加载季线"))
|
|
684
|
+
self.preload_hour2_checkBox.setText(_translate("MainWindow", "预加载120分钟线"))
|
|
686
685
|
self.label_42.setText(_translate("MainWindow", "最大缓存数量:"))
|
|
687
686
|
self.label_35.setText(_translate("MainWindow", "此处为 Hikyuu 运行时的数据预加载设置,请根据机器内存大小选择"))
|
|
688
687
|
self.label_36.setText(_translate("MainWindow", "(目前加载全部日线数据目前需要约需900M内存)"))
|
|
@@ -694,17 +693,18 @@ class Ui_MainWindow(object):
|
|
|
694
693
|
self.label_37.setText(_translate("MainWindow", "执行时间段2:"))
|
|
695
694
|
self.label_38.setText(_translate("MainWindow", "-"))
|
|
696
695
|
self.textBrowser.setHtml(_translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
696
|
+
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
|
|
697
|
+
"p, li { white-space: pre-wrap; }\n"
|
|
698
|
+
"</style></head><body style=\" font-family:\'SimSun\'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
|
|
699
|
+
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">注:</p>\n"
|
|
700
|
+
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:10pt; font-weight:600; color:#ff0000;\">1、行情采集服务仅对预加载数据有效</span>,在行情采集服务运行期间,hikyuu.interactive运行时将自动连接采集服务获取行情数据,并更新预加载的内容数据。</p>\n"
|
|
701
|
+
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
|
|
702
|
+
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">2、如使用芝麻代理(<a href=\"http://h.zhimaruanjian.com/\"><span style=\" text-decoration: underline; color:#0000ff;\">http://h.zhimaruanjian.com/</span></a>),请自行申请(需付费),并确保ip为其白名单。</p>\n"
|
|
703
|
+
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
|
|
704
|
+
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:696; color:#0000ff;\">3、此处采集为网络采集,更推荐直接运行安装目录下gui子目录下的 start_qmt.py ,使用miniqmt 实时服务。该程序独立运行,不用关闭,和这里的采集效果一样。注意:miniqmt需要QMT交易端配合,且在同一机器上执行。</span></p></body></html>"))
|
|
706
705
|
self.label_39.setText(_translate("MainWindow", "行情数据源:"))
|
|
707
706
|
self.collect_source_comboBox.setItemText(0, _translate("MainWindow", "qq"))
|
|
707
|
+
self.collect_source_comboBox.setItemText(1, _translate("MainWindow", "qmt"))
|
|
708
708
|
self.collect_start_pushButton.setText(_translate("MainWindow", "启动采集"))
|
|
709
709
|
self.collect_status_label.setText(_translate("MainWindow", "TextLabel"))
|
|
710
710
|
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), _translate("MainWindow", "行情采集服务"))
|
hikyuu/gui/spot_server.py
CHANGED
|
@@ -18,7 +18,8 @@ import threading
|
|
|
18
18
|
import hikyuu.flat as fb
|
|
19
19
|
|
|
20
20
|
from hikyuu.util import *
|
|
21
|
-
from hikyuu.fetcher.stock.zh_stock_a_sina_qq import get_spot
|
|
21
|
+
from hikyuu.fetcher.stock.zh_stock_a_sina_qq import get_spot as qq_get_spot
|
|
22
|
+
from hikyuu.fetcher.stock.zh_stock_a_qmt import get_spot as qmt_get_spot
|
|
22
23
|
from hikyuu import hikyuu_init, StockManager, constant, Datetime, TimeDelta
|
|
23
24
|
|
|
24
25
|
|
|
@@ -269,14 +270,22 @@ def collect(server, use_proxy, source, seconds, phase1, phase2, ignore_weekend):
|
|
|
269
270
|
hikyuu_init(config_file, ignore_preload=True)
|
|
270
271
|
|
|
271
272
|
sm = StockManager.instance()
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
273
|
+
if source == 'qmt':
|
|
274
|
+
stk_list = [s for s in sm if s.valid]
|
|
275
|
+
else:
|
|
276
|
+
stk_list = [
|
|
277
|
+
stk.market_code.lower() for stk in sm if stk.valid and stk.type in
|
|
278
|
+
(constant.STOCKTYPE_A, constant.STOCKTYPE_INDEX, constant.STOCKTYPE_GEM,
|
|
279
|
+
constant.STOCKTYPE_START, constant.STOCKTYPE_A_BJ)
|
|
280
|
+
]
|
|
277
281
|
|
|
278
282
|
_ = get_nng_senders()
|
|
279
283
|
|
|
284
|
+
if source == 'qmt':
|
|
285
|
+
get_spot = qmt_get_spot
|
|
286
|
+
elif source == 'qq':
|
|
287
|
+
get_spot = qq_get_spot
|
|
288
|
+
|
|
280
289
|
start_time = Datetime.now()
|
|
281
290
|
delta = next_delta(start_time, seconds, phase1_delta, phase2_delta, ignore_weekend)
|
|
282
291
|
next_time = start_time + delta
|
|
@@ -308,7 +317,7 @@ def collect(server, use_proxy, source, seconds, phase1, phase2, ignore_weekend):
|
|
|
308
317
|
@click.command()
|
|
309
318
|
@click.option('-server', '--server', default='tcp://*:9200')
|
|
310
319
|
@click.option('-use_proxy', '--use_proxy', is_flag=True, help='是否使用代理,须自行申请芝麻http代理并加入ip白名单')
|
|
311
|
-
@click.option('-source', '--source', default='qq', type=click.Choice(['
|
|
320
|
+
@click.option('-source', '--source', default='qq', type=click.Choice(['qmt', 'qq']), help='数据来源')
|
|
312
321
|
@click.option('-seconds', '--seconds', default=10)
|
|
313
322
|
@click.option('-phase1', '--phase1', default='9:00-12:00')
|
|
314
323
|
@click.option('-phase2', '--phase2', default='13:00-15:00')
|
hikyuu/gui/start_qmt.py
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
from hikyuu.fetcher.stock.zh_stock_a_qmt import parse_one_result_qmt
|
|
6
|
+
from hikyuu.gui.spot_server import release_nng_senders, start_send_spot, end_send_spot, send_spot
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def callback(datas):
|
|
10
|
+
records = []
|
|
11
|
+
for stock_code, data in datas.items():
|
|
12
|
+
# print(stock_code, data)
|
|
13
|
+
records.append(parse_one_result_qmt(stock_code, data))
|
|
14
|
+
|
|
15
|
+
if records:
|
|
16
|
+
start_send_spot()
|
|
17
|
+
send_spot(records)
|
|
18
|
+
end_send_spot()
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
if __name__ == "__main__":
|
|
22
|
+
from hikyuu.interactive import *
|
|
23
|
+
from xtquant import xtdata
|
|
24
|
+
|
|
25
|
+
code_list = [f'{s.code}.{s.market}' for s in sm if s.valid]
|
|
26
|
+
# code_list = ['000001.SZ']
|
|
27
|
+
|
|
28
|
+
xtdata.subscribe_whole_quote(code_list, callback)
|
|
29
|
+
|
|
30
|
+
try:
|
|
31
|
+
xtdata.run()
|
|
32
|
+
except Exception as e:
|
|
33
|
+
hku_error(e)
|
|
34
|
+
finally:
|
|
35
|
+
# 退出释放资源
|
|
36
|
+
release_nng_senders()
|
hikyuu/include/hikyuu/Stock.h
CHANGED
|
@@ -278,7 +278,7 @@ struct HKU_API Stock::Data {
|
|
|
278
278
|
|
|
279
279
|
mutable vector<HistoryFinanceInfo>
|
|
280
280
|
m_history_finance; // 历史财务信息 [财务报告日期, 字段1, 字段2, ...]
|
|
281
|
-
mutable
|
|
281
|
+
mutable std::atomic_bool m_history_finance_ready{false};
|
|
282
282
|
mutable std::mutex m_history_finance_mutex;
|
|
283
283
|
|
|
284
284
|
price_t m_tick;
|
|
@@ -22,11 +22,16 @@ public:
|
|
|
22
22
|
explicit StrategyContext(vector<string>&& stockCodeList)
|
|
23
23
|
: m_stockCodeList(std::move(stockCodeList)) {}
|
|
24
24
|
|
|
25
|
+
StrategyContext(const vector<string>& stockCodeList, const vector<KQuery::KType>& ktypeList)
|
|
26
|
+
: m_stockCodeList(stockCodeList), m_ktypeList(ktypeList) {}
|
|
27
|
+
|
|
25
28
|
virtual ~StrategyContext() = default;
|
|
26
29
|
|
|
27
|
-
bool isAll() const;
|
|
30
|
+
bool isAll() const noexcept;
|
|
31
|
+
|
|
32
|
+
bool isValid() const noexcept;
|
|
28
33
|
|
|
29
|
-
Datetime startDatetime() const {
|
|
34
|
+
Datetime startDatetime() const noexcept {
|
|
30
35
|
return m_startDatetime;
|
|
31
36
|
}
|
|
32
37
|
|
|
@@ -13,8 +13,8 @@ namespace hku {
|
|
|
13
13
|
|
|
14
14
|
struct HistoryFinanceTable {
|
|
15
15
|
TABLE_BIND4(HistoryFinanceTable, HistoryFinance, file_date, report_date, market_code, values)
|
|
16
|
-
uint64_t file_date;
|
|
17
|
-
uint64_t report_date;
|
|
16
|
+
uint64_t file_date{0};
|
|
17
|
+
uint64_t report_date{0};
|
|
18
18
|
std::string market_code;
|
|
19
19
|
// std::vector<float> values;
|
|
20
20
|
std::vector<char> values;
|
hikyuu/include/hikyuu/doc.h
CHANGED
|
@@ -137,8 +137,8 @@
|
|
|
137
137
|
* @details 合成多因子
|
|
138
138
|
* @ingroup TradeSystem
|
|
139
139
|
*
|
|
140
|
-
* @defgroup
|
|
141
|
-
* @details
|
|
140
|
+
* @defgroup Stratgy Strategy 策略运行时
|
|
141
|
+
* @details 策略运行时
|
|
142
142
|
* @ingroup Hikyuu
|
|
143
143
|
*
|
|
144
144
|
* @defgroup Agent Agent 对外数据接收发送代理
|
|
@@ -11,15 +11,17 @@
|
|
|
11
11
|
#ifndef HKU_GLOBAL_TASK_GROUP
|
|
12
12
|
#define HKU_GLOBAL_TASK_GROUP
|
|
13
13
|
|
|
14
|
-
#include "../utilities/thread/
|
|
14
|
+
#include "../utilities/thread/thread.h"
|
|
15
15
|
|
|
16
16
|
namespace hku {
|
|
17
17
|
|
|
18
|
+
using TaskGroup = ThreadPool;
|
|
19
|
+
|
|
18
20
|
/**
|
|
19
21
|
* 获取全局线程池任务组
|
|
20
22
|
* @note 请使用 future 获取任务返回
|
|
21
23
|
*/
|
|
22
|
-
|
|
24
|
+
TaskGroup* getGlobalTaskGroup();
|
|
23
25
|
|
|
24
26
|
template <typename ResultType>
|
|
25
27
|
using task_handle = std::future<ResultType>;
|