hikyuu 2.1.0__cp311-none-win_amd64.whl → 2.1.2__cp311-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/core311.pyd +0 -0
- hikyuu/cpp/hikyuu.dll +0 -0
- hikyuu/cpp/sqlite3.dll +0 -0
- hikyuu/examples/notebook/006-TradeManager.ipynb +41 -39
- hikyuu/examples/notebook/008-Pickle.ipynb +27 -35
- hikyuu/extend.py +3 -1
- hikyuu/fetcher/stock/zh_stock_a_qmt.py +49 -0
- hikyuu/gui/HikyuuTDX.py +13 -7
- hikyuu/gui/data/MainWindow.py +126 -126
- hikyuu/gui/spot_server.py +16 -7
- hikyuu/gui/start_qmt.py +36 -0
- hikyuu/include/hikyuu/DataType.h +2 -1
- hikyuu/include/hikyuu/KRecord.h +1 -1
- hikyuu/include/hikyuu/Stock.h +1 -1
- hikyuu/include/hikyuu/StockManager.h +3 -0
- hikyuu/include/hikyuu/StrategyContext.h +7 -2
- hikyuu/include/hikyuu/analysis/combinate.h +1 -1
- hikyuu/include/hikyuu/config.h +0 -12
- 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} +97 -95
- hikyuu/include/hikyuu/strategy/RunPortfolioInStrategy.h +36 -0
- hikyuu/include/hikyuu/strategy/RunSystemInStrategy.h +37 -0
- hikyuu/include/hikyuu/strategy/Strategy.h +174 -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/FilterNode.h +267 -0
- hikyuu/include/hikyuu/utilities/LRUCache11.h +230 -0
- hikyuu/include/hikyuu/{Log.h → utilities/Log.h} +91 -113
- hikyuu/include/hikyuu/utilities/Null.h +1 -0
- hikyuu/include/hikyuu/utilities/Parameter.h +2 -1
- hikyuu/include/hikyuu/utilities/ResourcePool.h +636 -0
- hikyuu/include/hikyuu/utilities/SpendTimer.h +10 -9
- hikyuu/include/hikyuu/utilities/TimerManager.h +25 -11
- hikyuu/include/hikyuu/utilities/any_to_string.h +142 -0
- hikyuu/include/hikyuu/utilities/arithmetic.h +71 -35
- hikyuu/include/hikyuu/utilities/base64.h +59 -0
- hikyuu/include/hikyuu/utilities/config.h +41 -0
- hikyuu/include/hikyuu/utilities/datetime/Datetime.h +42 -31
- hikyuu/include/hikyuu/utilities/datetime/TimeDelta.h +24 -13
- hikyuu/include/hikyuu/utilities/db_connect/DBCondition.h +48 -48
- hikyuu/include/hikyuu/utilities/db_connect/DBConnect.h +10 -0
- hikyuu/include/hikyuu/utilities/db_connect/DBConnectBase.h +5 -22
- hikyuu/include/hikyuu/utilities/db_connect/DBUpgrade.h +3 -3
- hikyuu/include/hikyuu/utilities/db_connect/SQLException.h +1 -1
- hikyuu/include/hikyuu/utilities/db_connect/SQLResultSet.h +1 -1
- hikyuu/include/hikyuu/utilities/db_connect/SQLStatementBase.h +7 -7
- hikyuu/include/hikyuu/utilities/db_connect/TableMacro.h +1 -2
- hikyuu/include/hikyuu/utilities/db_connect/mysql/MySQLConnect.h +9 -9
- hikyuu/include/hikyuu/utilities/db_connect/mysql/MySQLStatement.h +18 -18
- hikyuu/include/hikyuu/utilities/db_connect/sqlite/SQLiteConnect.h +3 -3
- hikyuu/include/hikyuu/utilities/db_connect/sqlite/SQLiteStatement.h +2 -2
- hikyuu/include/hikyuu/utilities/db_connect/sqlite/SQLiteUtil.h +6 -6
- hikyuu/include/hikyuu/{exception.h → utilities/exception.h} +15 -16
- hikyuu/include/hikyuu/utilities/http_client/HttpClient.h +229 -0
- hikyuu/include/hikyuu/utilities/http_client/nng_wrap.h +517 -0
- hikyuu/include/hikyuu/utilities/http_client/url.h +25 -0
- hikyuu/include/hikyuu/utilities/{IniParser.h → ini_parser/IniParser.h} +10 -5
- hikyuu/include/hikyuu/utilities/ini_parser/__init__.py +1 -0
- hikyuu/include/hikyuu/utilities/md5.h +41 -0
- hikyuu/include/hikyuu/utilities/mo/__init__.py +1 -0
- hikyuu/include/hikyuu/utilities/mo/mo.h +48 -0
- hikyuu/include/hikyuu/utilities/mo/moFileReader.h +836 -0
- hikyuu/include/hikyuu/{global → utilities}/node/NodeClient.h +25 -18
- hikyuu/include/hikyuu/{global → utilities}/node/NodeError.h +1 -1
- hikyuu/include/hikyuu/{global → utilities}/node/NodeMessage.h +3 -2
- hikyuu/include/hikyuu/utilities/node/NodeServer.h +246 -0
- hikyuu/include/hikyuu/utilities/node/__init__.py +1 -0
- hikyuu/include/hikyuu/utilities/os.h +16 -15
- hikyuu/include/hikyuu/utilities/snowflake.h +110 -0
- hikyuu/include/hikyuu/utilities/string_view.h +70 -0
- hikyuu/include/hikyuu/utilities/thread/MQStealThreadPool.h +3 -3
- hikyuu/include/hikyuu/utilities/thread/MQThreadPool.h +3 -3
- hikyuu/include/hikyuu/utilities/thread/StealThreadPool.h +3 -3
- hikyuu/include/hikyuu/utilities/thread/ThreadPool.h +3 -3
- hikyuu/include/hikyuu/version.h +4 -4
- hikyuu/interactive.py +42 -137
- hikyuu/sqlite3.dll +0 -0
- 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/vcruntime140.dll +0 -0
- hikyuu/vcruntime140_1.dll +0 -0
- hikyuu-2.1.2.dist-info/METADATA +115 -0
- {hikyuu-2.1.0.dist-info → hikyuu-2.1.2.dist-info}/RECORD +105 -79
- {hikyuu-2.1.0.dist-info → hikyuu-2.1.2.dist-info}/top_level.txt +4 -2
- hikyuu/README.rst +0 -79
- hikyuu/include/hikyuu/strategy/StrategyBase.h +0 -156
- hikyuu/strategy/demo/__init__.py +0 -3
- hikyuu/strategy/strategy.py +0 -27
- hikyuu-2.1.0.dist-info/METADATA +0 -126
- /hikyuu/include/hikyuu/{global/node → utilities/http_client}/__init__.py +0 -0
- {hikyuu-2.1.0.dist-info → hikyuu-2.1.2.dist-info}/LICENSE +0 -0
- {hikyuu-2.1.0.dist-info → hikyuu-2.1.2.dist-info}/WHEEL +0 -0
- {hikyuu-2.1.0.dist-info → hikyuu-2.1.2.dist-info}/entry_points.txt +0 -0
hikyuu/gui/HikyuuTDX.py
CHANGED
|
@@ -8,6 +8,10 @@ import datetime
|
|
|
8
8
|
import multiprocessing
|
|
9
9
|
from configparser import ConfigParser
|
|
10
10
|
from logging.handlers import QueueListener
|
|
11
|
+
|
|
12
|
+
# 优先加载,处理 VS 17.10 升级后依赖 dll 不兼容问题
|
|
13
|
+
import hikyuu
|
|
14
|
+
|
|
11
15
|
import PyQt5
|
|
12
16
|
|
|
13
17
|
from PyQt5.QtWidgets import QApplication, QMainWindow, QFileDialog, QMessageBox
|
|
@@ -77,7 +81,8 @@ class MyMainWindow(QMainWindow, Ui_MainWindow):
|
|
|
77
81
|
self.hdf5_import_thread.stop()
|
|
78
82
|
if self.escape_time_thread:
|
|
79
83
|
self.escape_time_thread.stop()
|
|
80
|
-
self
|
|
84
|
+
if hasattr(self, 'mp_log_q_lisener'):
|
|
85
|
+
self.mp_log_q_lisener.stop()
|
|
81
86
|
event.accept()
|
|
82
87
|
|
|
83
88
|
def getUserConfigDir(self):
|
|
@@ -240,6 +245,13 @@ class MyMainWindow(QMainWindow, Ui_MainWindow):
|
|
|
240
245
|
self.mp_log_q_lisener.start()
|
|
241
246
|
|
|
242
247
|
def initUI(self):
|
|
248
|
+
# 读取配置文件放在 output 重定向之前,防止配置文件读取失败没有提示
|
|
249
|
+
# 读取保存的配置文件信息,如果不存在,则使用默认配置
|
|
250
|
+
this_dir = self.getUserConfigDir()
|
|
251
|
+
import_config = ConfigParser()
|
|
252
|
+
if os.path.exists(this_dir + '/importdata-gui.ini'):
|
|
253
|
+
import_config.read(this_dir + '/importdata-gui.ini', encoding='utf-8')
|
|
254
|
+
|
|
243
255
|
self._is_sched_import_running = False
|
|
244
256
|
self._is_collect_running = False
|
|
245
257
|
self._stream = None
|
|
@@ -272,12 +284,6 @@ class MyMainWindow(QMainWindow, Ui_MainWindow):
|
|
|
272
284
|
self.time_start_dateEdit.setMinimumDate(today - datetime.timedelta(300))
|
|
273
285
|
self.collect_status_label.setText("已停止")
|
|
274
286
|
|
|
275
|
-
# 读取保存的配置文件信息,如果不存在,则使用默认配置
|
|
276
|
-
this_dir = self.getUserConfigDir()
|
|
277
|
-
import_config = ConfigParser()
|
|
278
|
-
if os.path.exists(this_dir + '/importdata-gui.ini'):
|
|
279
|
-
import_config.read(this_dir + '/importdata-gui.ini', encoding='utf-8')
|
|
280
|
-
|
|
281
287
|
# 初始化导入行情数据类型配置
|
|
282
288
|
self.import_stock_checkBox.setChecked(import_config.getboolean('quotation', 'stock', fallback=True))
|
|
283
289
|
self.import_fund_checkBox.setChecked(import_config.getboolean('quotation', 'fund', fallback=True))
|
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/DataType.h
CHANGED
hikyuu/include/hikyuu/KRecord.h
CHANGED
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
|
|
hikyuu/include/hikyuu/config.h
CHANGED
|
@@ -19,18 +19,6 @@
|
|
|
19
19
|
// 检查下标越界
|
|
20
20
|
#define CHECK_ACCESS_BOUND 1
|
|
21
21
|
|
|
22
|
-
// 默认激活的日志级别
|
|
23
|
-
#define LOG_ACTIVE_LEVEL 2
|
|
24
|
-
|
|
25
|
-
// 是否使用 spdlog
|
|
26
|
-
#define USE_SPDLOG_LOGGER 1
|
|
27
|
-
|
|
28
|
-
// 使用异步 logger
|
|
29
|
-
#define HKU_USE_SPDLOG_ASYNC_LOGGER 0
|
|
30
|
-
|
|
31
|
-
// spdlog默认日志级别
|
|
32
|
-
#define SPDLOG_ACTIVE_LEVEL 2
|
|
33
|
-
|
|
34
22
|
// 启用MSVC内存泄漏检查
|
|
35
23
|
#define ENABLE_MSVC_LEAK_DETECT 0
|
|
36
24
|
|
|
@@ -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 对外数据接收发送代理
|