hikyuu 2.5.5__py3-none-win_amd64.whl → 2.6.0__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.
- hikyuu/__init__.py +15 -0
- hikyuu/__init__.pyi +524 -516
- hikyuu/analysis/__init__.pyi +497 -490
- hikyuu/analysis/analysis.pyi +498 -491
- hikyuu/core.pyi +499 -492
- hikyuu/cpp/__init__.pyi +2 -2
- hikyuu/cpp/core310.pyd +0 -0
- hikyuu/cpp/core310.pyi +153 -21
- hikyuu/cpp/core311.pyd +0 -0
- hikyuu/cpp/core311.pyi +153 -21
- hikyuu/cpp/core312.pyd +0 -0
- hikyuu/cpp/core312.pyi +153 -21
- hikyuu/cpp/core313.pyd +0 -0
- hikyuu/cpp/core313.pyi +152 -21
- hikyuu/cpp/core39.pyd +0 -0
- hikyuu/cpp/core39.pyi +153 -21
- hikyuu/cpp/hikyuu.dll +0 -0
- hikyuu/cpp/hikyuu.lib +0 -0
- hikyuu/cpp/sqlite3.dll +0 -0
- hikyuu/data/tdx_to_mysql.py +15 -15
- hikyuu/draw/drawplot/__init__.py +2 -0
- hikyuu/draw/drawplot/__init__.pyi +9 -8
- hikyuu/draw/drawplot/bokeh_draw.pyi +514 -507
- hikyuu/draw/drawplot/common.pyi +1 -1
- hikyuu/draw/drawplot/echarts_draw.pyi +516 -509
- hikyuu/draw/drawplot/matplotlib_draw.py +80 -0
- hikyuu/draw/drawplot/matplotlib_draw.pyi +535 -518
- hikyuu/draw/elder.pyi +11 -11
- hikyuu/draw/kaufman.pyi +18 -18
- hikyuu/draw/volume.pyi +10 -10
- hikyuu/examples/notebook/002-HowToGetStock.ipynb +1 -1
- hikyuu/examples/notebook/004-IndicatorOverview.ipynb +117 -52
- hikyuu/extend.pyi +507 -501
- hikyuu/gui/HikyuuTDX.py +19 -3
- hikyuu/gui/data/MainWindow.py +87 -24
- hikyuu/gui/data/UseTdxImportToH5Thread.py +2 -2
- hikyuu/gui/dataserver.py +25 -0
- hikyuu/gui/images/star.png +0 -0
- hikyuu/hub.py +7 -13
- hikyuu/hub.pyi +9 -6
- hikyuu/include/hikyuu/StockManager.h +23 -0
- hikyuu/include/hikyuu/global/agent/spot_generated.h +3 -3
- hikyuu/include/hikyuu/plugin/__init__.py +1 -0
- hikyuu/include/hikyuu/plugin/backtest.h +37 -0
- hikyuu/include/hikyuu/plugin/dataserver.h +18 -0
- hikyuu/include/hikyuu/plugin/device.h +29 -0
- hikyuu/include/hikyuu/plugin/interface/BackTestPluginInterface.h +26 -0
- hikyuu/include/hikyuu/plugin/interface/DataServerPluginInterface.h +23 -0
- hikyuu/include/hikyuu/plugin/interface/DevicePluginInterface.h +25 -0
- hikyuu/include/hikyuu/plugin/interface/__init__.py +1 -0
- hikyuu/include/hikyuu/plugin/interface/plugins.h +20 -0
- hikyuu/include/hikyuu/python/pybind_utils.h +8 -0
- hikyuu/include/hikyuu/strategy/BrokerTradeManager.h +2 -1
- hikyuu/include/hikyuu/strategy/RunPortfolioInStrategy.h +1 -0
- hikyuu/include/hikyuu/strategy/Strategy.h +96 -16
- hikyuu/include/hikyuu/trade_manage/TradeManagerBase.h +4 -2
- hikyuu/include/hikyuu/trade_sys/system/imp/WalkForwardTradeManager.h +3 -2
- hikyuu/include/hikyuu/utilities/config.h +1 -1
- hikyuu/include/hikyuu/utilities/datetime/Datetime.h +3 -3
- hikyuu/include/hikyuu/utilities/datetime/TimeDelta.h +8 -0
- hikyuu/include/hikyuu/utilities/plugin/PluginBase.h +47 -0
- hikyuu/include/hikyuu/utilities/plugin/PluginClient.h +55 -0
- hikyuu/include/hikyuu/utilities/plugin/PluginLoader.h +117 -0
- hikyuu/include/hikyuu/utilities/plugin/PluginManager.h +72 -0
- hikyuu/include/hikyuu/utilities/plugin/__init__.py +1 -0
- hikyuu/include/hikyuu/utilities/thread/MQStealThreadPool.h +1 -1
- hikyuu/include/hikyuu/utilities/thread/MQThreadPool.h +1 -1
- hikyuu/include/hikyuu/utilities/thread/StealThreadPool.h +1 -1
- hikyuu/include/hikyuu/utilities/thread/ThreadPool.h +1 -1
- hikyuu/include/hikyuu/version.h +5 -5
- hikyuu/indicator/indicator.py +1 -1
- hikyuu/plugin/__init__.py +1 -0
- hikyuu/plugin/backtest.dll +0 -0
- hikyuu/plugin/dataserver.dll +0 -0
- hikyuu/plugin/device.dll +0 -0
- hikyuu/strategy/strategy_demo1.py +7 -8
- hikyuu/strategy/strategy_demo2.py +1 -1
- hikyuu/trade_manage/__init__.pyi +513 -506
- hikyuu/trade_manage/broker.pyi +3 -3
- hikyuu/trade_manage/broker_easytrader.pyi +1 -1
- hikyuu/trade_manage/trade.pyi +513 -506
- hikyuu/util/__init__.pyi +2 -2
- hikyuu/util/singleton.pyi +1 -1
- {hikyuu-2.5.5.dist-info → hikyuu-2.6.0.dist-info}/METADATA +6 -2
- {hikyuu-2.5.5.dist-info → hikyuu-2.6.0.dist-info}/RECORD +90 -73
- {hikyuu-2.5.5.dist-info → hikyuu-2.6.0.dist-info}/entry_points.txt +1 -0
- {hikyuu-2.5.5.dist-info → hikyuu-2.6.0.dist-info}/top_level.txt +5 -0
- hikyuu/cpp/core38.pyd +0 -0
- hikyuu/cpp/core38.pyi +0 -13172
- hikyuu/examples/notebook/011-PyechartsDrawplot.ipynb +0 -21821
- /hikyuu/gui/{hikyuu_small.png → images/hikyuu_small.png} +0 -0
- {hikyuu-2.5.5.dist-info → hikyuu-2.6.0.dist-info}/LICENSE +0 -0
- {hikyuu-2.5.5.dist-info → hikyuu-2.6.0.dist-info}/WHEEL +0 -0
hikyuu/gui/HikyuuTDX.py
CHANGED
|
@@ -16,7 +16,7 @@ import PyQt5
|
|
|
16
16
|
|
|
17
17
|
from PyQt5.QtWidgets import QApplication, QMainWindow, QFileDialog, QMessageBox
|
|
18
18
|
from PyQt5.QtCore import pyqtSlot, QObject, pyqtSignal
|
|
19
|
-
from PyQt5.QtGui import QIcon, QTextCursor, QFont, QPalette
|
|
19
|
+
from PyQt5.QtGui import QIcon, QTextCursor, QFont, QPalette, QPixmap
|
|
20
20
|
|
|
21
21
|
import mysql.connector
|
|
22
22
|
from mysql.connector import errorcode
|
|
@@ -33,7 +33,7 @@ from hikyuu.gui.data.CollectSpotThread import CollectSpotThread
|
|
|
33
33
|
from hikyuu.gui.data.SchedImportThread import SchedImportThread
|
|
34
34
|
from hikyuu.gui.spot_server import release_nng_senders
|
|
35
35
|
|
|
36
|
-
from hikyuu import can_upgrade, get_last_version
|
|
36
|
+
from hikyuu import can_upgrade, get_last_version, fetch_trial_license, view_license
|
|
37
37
|
from hikyuu.data import hku_config_template
|
|
38
38
|
from hikyuu.util import *
|
|
39
39
|
|
|
@@ -267,7 +267,14 @@ class MyMainWindow(QMainWindow, Ui_MainWindow):
|
|
|
267
267
|
self.log_textEdit.document().setMaximumBlockCount(1000)
|
|
268
268
|
|
|
269
269
|
current_dir = os.path.dirname(__file__)
|
|
270
|
-
icon = QIcon(f"{current_dir}/hikyuu_small.png")
|
|
270
|
+
icon = QIcon(f"{current_dir}/images/hikyuu_small.png")
|
|
271
|
+
star_img = QPixmap(f"{current_dir}/images/star.png")
|
|
272
|
+
self.label_44.setPixmap(star_img)
|
|
273
|
+
self.label_46.setOpenExternalLinks(True)
|
|
274
|
+
self.label_license.setText(view_license())
|
|
275
|
+
if os.path.exists(self.getUserConfigDir() + '/.hikyuu.lic'):
|
|
276
|
+
self.fetch_trial_pushButton.setEnabled(False)
|
|
277
|
+
|
|
271
278
|
self.setWindowIcon(icon)
|
|
272
279
|
QApplication.instance().setWindowIcon(icon)
|
|
273
280
|
self.import_detail_textEdit.clear()
|
|
@@ -494,6 +501,15 @@ class MyMainWindow(QMainWindow, Ui_MainWindow):
|
|
|
494
501
|
'5MIN': self.hdf5_5min_progressBar
|
|
495
502
|
}
|
|
496
503
|
|
|
504
|
+
@pyqtSlot()
|
|
505
|
+
def on_fetch_trial_pushButton_clicked(self):
|
|
506
|
+
email = self.email_lineEdit.text()
|
|
507
|
+
info = fetch_trial_license(email)
|
|
508
|
+
QMessageBox.about(self, "获取试用许可", info)
|
|
509
|
+
self.label_license.setText(view_license())
|
|
510
|
+
if os.path.exists(self.getUserConfigDir() + '/.hikyuu.lic'):
|
|
511
|
+
self.fetch_trial_pushButton.setEnabled(False)
|
|
512
|
+
|
|
497
513
|
@pyqtSlot()
|
|
498
514
|
def on_pytdx_radioButton_clicked(self):
|
|
499
515
|
if self.pytdx_radioButton.isChecked():
|
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.11
|
|
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.
|
|
@@ -14,7 +14,7 @@ from PyQt5 import QtCore, QtGui, QtWidgets
|
|
|
14
14
|
class Ui_MainWindow(object):
|
|
15
15
|
def setupUi(self, MainWindow):
|
|
16
16
|
MainWindow.setObjectName("MainWindow")
|
|
17
|
-
MainWindow.resize(1269,
|
|
17
|
+
MainWindow.resize(1269, 797)
|
|
18
18
|
self.centralwidget = QtWidgets.QWidget(MainWindow)
|
|
19
19
|
self.centralwidget.setObjectName("centralwidget")
|
|
20
20
|
self.horizontalLayout_12 = QtWidgets.QHBoxLayout(self.centralwidget)
|
|
@@ -165,7 +165,7 @@ class Ui_MainWindow(object):
|
|
|
165
165
|
self.label_6.setObjectName("label_6")
|
|
166
166
|
self.gridLayout_4.addWidget(self.label_6, 3, 0, 1, 1)
|
|
167
167
|
self.min5_start_dateEdit = QtWidgets.QDateEdit(self.groupBox_7)
|
|
168
|
-
self.min5_start_dateEdit.setMinimumDateTime(QtCore.QDateTime(QtCore.QDate(1989, 12,
|
|
168
|
+
self.min5_start_dateEdit.setMinimumDateTime(QtCore.QDateTime(QtCore.QDate(1989, 12, 28), QtCore.QTime(8, 0, 0)))
|
|
169
169
|
self.min5_start_dateEdit.setCalendarPopup(True)
|
|
170
170
|
self.min5_start_dateEdit.setObjectName("min5_start_dateEdit")
|
|
171
171
|
self.gridLayout_4.addWidget(self.min5_start_dateEdit, 1, 1, 1, 1)
|
|
@@ -187,7 +187,7 @@ class Ui_MainWindow(object):
|
|
|
187
187
|
self.trans_start_dateEdit.setObjectName("trans_start_dateEdit")
|
|
188
188
|
self.gridLayout_4.addWidget(self.trans_start_dateEdit, 3, 1, 1, 1)
|
|
189
189
|
self.day_start_dateEdit = QtWidgets.QDateEdit(self.groupBox_7)
|
|
190
|
-
self.day_start_dateEdit.setMinimumDateTime(QtCore.QDateTime(QtCore.QDate(1989, 12,
|
|
190
|
+
self.day_start_dateEdit.setMinimumDateTime(QtCore.QDateTime(QtCore.QDate(1989, 12, 28), QtCore.QTime(8, 0, 0)))
|
|
191
191
|
self.day_start_dateEdit.setCalendarPopup(True)
|
|
192
192
|
self.day_start_dateEdit.setObjectName("day_start_dateEdit")
|
|
193
193
|
self.gridLayout_4.addWidget(self.day_start_dateEdit, 0, 1, 1, 1)
|
|
@@ -681,6 +681,61 @@ class Ui_MainWindow(object):
|
|
|
681
681
|
self.horizontalLayout_17.addWidget(self.textBrowser)
|
|
682
682
|
self.verticalLayout_2.addLayout(self.horizontalLayout_17)
|
|
683
683
|
self.tabWidget.addTab(self.tab, "")
|
|
684
|
+
self.tab_star = QtWidgets.QWidget()
|
|
685
|
+
self.tab_star.setEnabled(True)
|
|
686
|
+
self.tab_star.setObjectName("tab_star")
|
|
687
|
+
self.label_44 = QtWidgets.QLabel(self.tab_star)
|
|
688
|
+
self.label_44.setGeometry(QtCore.QRect(40, 370, 291, 171))
|
|
689
|
+
self.label_44.setText("")
|
|
690
|
+
self.label_44.setPixmap(QtGui.QPixmap("../images/star.png"))
|
|
691
|
+
self.label_44.setScaledContents(True)
|
|
692
|
+
self.label_44.setObjectName("label_44")
|
|
693
|
+
self.label_46 = QtWidgets.QLabel(self.tab_star)
|
|
694
|
+
self.label_46.setGeometry(QtCore.QRect(30, 10, 561, 201))
|
|
695
|
+
self.label_46.setObjectName("label_46")
|
|
696
|
+
self.line_2 = QtWidgets.QFrame(self.tab_star)
|
|
697
|
+
self.line_2.setGeometry(QtCore.QRect(30, 200, 531, 16))
|
|
698
|
+
self.line_2.setFrameShape(QtWidgets.QFrame.HLine)
|
|
699
|
+
self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
|
|
700
|
+
self.line_2.setObjectName("line_2")
|
|
701
|
+
self.label_47 = QtWidgets.QLabel(self.tab_star)
|
|
702
|
+
self.label_47.setGeometry(QtCore.QRect(40, 230, 121, 16))
|
|
703
|
+
self.label_47.setObjectName("label_47")
|
|
704
|
+
self.line_3 = QtWidgets.QFrame(self.tab_star)
|
|
705
|
+
self.line_3.setGeometry(QtCore.QRect(30, 310, 531, 16))
|
|
706
|
+
self.line_3.setFrameShape(QtWidgets.QFrame.HLine)
|
|
707
|
+
self.line_3.setFrameShadow(QtWidgets.QFrame.Sunken)
|
|
708
|
+
self.line_3.setObjectName("line_3")
|
|
709
|
+
self.label_48 = QtWidgets.QLabel(self.tab_star)
|
|
710
|
+
self.label_48.setGeometry(QtCore.QRect(40, 340, 211, 16))
|
|
711
|
+
self.label_48.setObjectName("label_48")
|
|
712
|
+
self.line_4 = QtWidgets.QFrame(self.tab_star)
|
|
713
|
+
self.line_4.setGeometry(QtCore.QRect(30, 560, 531, 16))
|
|
714
|
+
self.line_4.setFrameShape(QtWidgets.QFrame.HLine)
|
|
715
|
+
self.line_4.setFrameShadow(QtWidgets.QFrame.Sunken)
|
|
716
|
+
self.line_4.setObjectName("line_4")
|
|
717
|
+
self.label_49 = QtWidgets.QLabel(self.tab_star)
|
|
718
|
+
self.label_49.setGeometry(QtCore.QRect(40, 580, 81, 16))
|
|
719
|
+
self.label_49.setObjectName("label_49")
|
|
720
|
+
self.label_license = QtWidgets.QLabel(self.tab_star)
|
|
721
|
+
self.label_license.setGeometry(QtCore.QRect(40, 610, 521, 91))
|
|
722
|
+
self.label_license.setObjectName("label_license")
|
|
723
|
+
self.widget = QtWidgets.QWidget(self.tab_star)
|
|
724
|
+
self.widget.setGeometry(QtCore.QRect(40, 260, 511, 33))
|
|
725
|
+
self.widget.setObjectName("widget")
|
|
726
|
+
self.horizontalLayout_20 = QtWidgets.QHBoxLayout(self.widget)
|
|
727
|
+
self.horizontalLayout_20.setContentsMargins(0, 0, 0, 0)
|
|
728
|
+
self.horizontalLayout_20.setObjectName("horizontalLayout_20")
|
|
729
|
+
self.label_45 = QtWidgets.QLabel(self.widget)
|
|
730
|
+
self.label_45.setObjectName("label_45")
|
|
731
|
+
self.horizontalLayout_20.addWidget(self.label_45)
|
|
732
|
+
self.email_lineEdit = QtWidgets.QLineEdit(self.widget)
|
|
733
|
+
self.email_lineEdit.setObjectName("email_lineEdit")
|
|
734
|
+
self.horizontalLayout_20.addWidget(self.email_lineEdit)
|
|
735
|
+
self.fetch_trial_pushButton = QtWidgets.QPushButton(self.widget)
|
|
736
|
+
self.fetch_trial_pushButton.setObjectName("fetch_trial_pushButton")
|
|
737
|
+
self.horizontalLayout_20.addWidget(self.fetch_trial_pushButton)
|
|
738
|
+
self.tabWidget.addTab(self.tab_star, "")
|
|
684
739
|
self.horizontalLayout_12.addWidget(self.tabWidget)
|
|
685
740
|
self.verticalLayout_6 = QtWidgets.QVBoxLayout()
|
|
686
741
|
self.verticalLayout_6.setObjectName("verticalLayout_6")
|
|
@@ -759,19 +814,19 @@ class Ui_MainWindow(object):
|
|
|
759
814
|
"hr { height: 1px; border-width: 0; }\n"
|
|
760
815
|
"li.unchecked::marker { content: \"\\2610\"; }\n"
|
|
761
816
|
"li.checked::marker { content: \"\\2612\"; }\n"
|
|
762
|
-
"</style></head><body style=\" font-family:\'
|
|
763
|
-
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'SimSun\';\">导入上证日线记录:</span></p>\n"
|
|
764
|
-
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'SimSun\';\">导入深证日线记录:</span></p>\n"
|
|
765
|
-
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'SimSun\';\">导入上证5分钟线记录:</span></p>\n"
|
|
766
|
-
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'SimSun\';\">导入深证5分钟线记录:</span></p>\n"
|
|
767
|
-
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'SimSun\';\">导入上证1分钟线记录:</span></p>\n"
|
|
768
|
-
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'SimSun\';\">导入深证1分钟线记录:</span></p>\n"
|
|
769
|
-
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'SimSun\';\">导入上证分笔记录:</span></p>\n"
|
|
770
|
-
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'SimSun\';\">导入深证分笔记录:</span></p>\n"
|
|
771
|
-
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'SimSun\';\">导入上证分时数据:</span></p>\n"
|
|
772
|
-
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'SimSun\';\">导入深证分时数据:</span></p>\n"
|
|
773
|
-
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'SimSun\';\">导入权息数据数:</span></p>\n"
|
|
774
|
-
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'SimSun\';\">导入完毕!</span></p></body></html>"))
|
|
817
|
+
"</style></head><body style=\" font-family:\'.AppleSystemUIFont\'; font-size:13pt; font-weight:400; font-style:normal;\">\n"
|
|
818
|
+
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'SimSun\'; font-size:9pt;\">导入上证日线记录:</span></p>\n"
|
|
819
|
+
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'SimSun\'; font-size:9pt;\">导入深证日线记录:</span></p>\n"
|
|
820
|
+
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'SimSun\'; font-size:9pt;\">导入上证5分钟线记录:</span></p>\n"
|
|
821
|
+
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'SimSun\'; font-size:9pt;\">导入深证5分钟线记录:</span></p>\n"
|
|
822
|
+
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'SimSun\'; font-size:9pt;\">导入上证1分钟线记录:</span></p>\n"
|
|
823
|
+
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'SimSun\'; font-size:9pt;\">导入深证1分钟线记录:</span></p>\n"
|
|
824
|
+
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'SimSun\'; font-size:9pt;\">导入上证分笔记录:</span></p>\n"
|
|
825
|
+
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'SimSun\'; font-size:9pt;\">导入深证分笔记录:</span></p>\n"
|
|
826
|
+
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'SimSun\'; font-size:9pt;\">导入上证分时数据:</span></p>\n"
|
|
827
|
+
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'SimSun\'; font-size:9pt;\">导入深证分时数据:</span></p>\n"
|
|
828
|
+
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'SimSun\'; font-size:9pt;\">导入权息数据数:</span></p>\n"
|
|
829
|
+
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'SimSun\'; font-size:9pt;\">导入完毕!</span></p></body></html>"))
|
|
775
830
|
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), _translate("MainWindow", "执行导入"))
|
|
776
831
|
self.groupBox_6.setTitle(_translate("MainWindow", "预加载设置"))
|
|
777
832
|
self.label_35.setText(_translate("MainWindow", "此处为 Hikyuu 运行时的数据预加载设置,请根据机器内存大小选择"))
|
|
@@ -819,12 +874,20 @@ class Ui_MainWindow(object):
|
|
|
819
874
|
"hr { height: 1px; border-width: 0; }\n"
|
|
820
875
|
"li.unchecked::marker { content: \"\\2610\"; }\n"
|
|
821
876
|
"li.checked::marker { content: \"\\2612\"; }\n"
|
|
822
|
-
"</style></head><body style=\" font-family:\'
|
|
823
|
-
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'SimSun\';\">注:</span></p>\n"
|
|
824
|
-
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'SimSun\'; font-size:10pt; font-weight:600; color:#ff0000;\">1、行情采集服务仅对预加载数据有效</span><span style=\" font-family:\'SimSun\';\">,在行情采集服务运行期间,hikyuu.interactive运行时将自动连接采集服务获取行情数据,并更新预加载的内容数据。</span></p>\n"
|
|
825
|
-
"<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; font-family:\'SimSun\';\"><br /></p>\n"
|
|
826
|
-
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'SimSun\';\">2、如使用芝麻代理(</span><a href=\"http://h.zhimaruanjian.com/\"><span style=\" font-family:\'SimSun\'; text-decoration: underline; color:#0000ff;\">http://h.zhimaruanjian.com/</span></a><span style=\" font-family:\'SimSun\';\">),请自行申请(需付费),并确保ip为其白名单。</span></p>\n"
|
|
827
|
-
"<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; font-family:\'SimSun\';\"><br /></p>\n"
|
|
828
|
-
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'SimSun\'; font-weight:696; color:#0000ff;\">3、此处采集为网络采集,更推荐直接运行安装目录下gui子目录下的 start_qmt.py ,使用miniqmt 实时服务。该程序独立运行,不用关闭,和这里的采集效果一样。注意:miniqmt需要QMT交易端配合,且在同一机器上执行。</span></p></body></html>"))
|
|
877
|
+
"</style></head><body style=\" font-family:\'.AppleSystemUIFont\'; font-size:13pt; font-weight:400; font-style:normal;\">\n"
|
|
878
|
+
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'SimSun\'; font-size:9pt;\">注:</span></p>\n"
|
|
879
|
+
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'SimSun\'; font-size:10pt; font-weight:600; color:#ff0000;\">1、行情采集服务仅对预加载数据有效</span><span style=\" font-family:\'SimSun\'; font-size:9pt;\">,在行情采集服务运行期间,hikyuu.interactive运行时将自动连接采集服务获取行情数据,并更新预加载的内容数据。</span></p>\n"
|
|
880
|
+
"<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; font-family:\'SimSun\'; font-size:9pt;\"><br /></p>\n"
|
|
881
|
+
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'SimSun\'; font-size:9pt;\">2、如使用芝麻代理(</span><a href=\"http://h.zhimaruanjian.com/\"><span style=\" font-family:\'SimSun\'; font-size:9pt; text-decoration: underline; color:#0000ff;\">http://h.zhimaruanjian.com/</span></a><span style=\" font-family:\'SimSun\'; font-size:9pt;\">),请自行申请(需付费),并确保ip为其白名单。</span></p>\n"
|
|
882
|
+
"<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; font-family:\'SimSun\'; font-size:9pt;\"><br /></p>\n"
|
|
883
|
+
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'SimSun\'; font-size:9pt; font-weight:696; color:#0000ff;\">3、此处采集为网络采集,更推荐直接运行安装目录下gui子目录下的 start_qmt.py ,使用miniqmt 实时服务。该程序独立运行,不用关闭,和这里的采集效果一样。注意:miniqmt需要QMT交易端配合,且在同一机器上执行。</span></p></body></html>"))
|
|
829
884
|
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), _translate("MainWindow", "行情采集服务"))
|
|
885
|
+
self.label_46.setText(_translate("MainWindow", "<html><head/><body><p>Hikyuu 专注于量化交易领域的核心技术构建,涵盖交易模型开发、极速计算引擎、高效回测框架<br/>及实盘拓展能力,定位为量化交易的基础设施级计算引擎。项目设计理念聚焦技术内核,暂不涉及<br/>GUI 界面开发,致力于为量化交易爱好者和专业提供高性能底层架构支持。 </p><p>随着社区规模扩大,项目持续迭代及技术支持事务逐渐分散了作者在策略研究上的精力。为保障技<br/>术研发的专注度与可持续性,现推出扩展 VIP 支持计划,通过提供专属功能模块作为回馈,构建良<br/>性的项目发展生态。我们诚挚期待社区伙伴的支持 —— 无论是通过项目捐赠还是加入 VIP 计划,<br/>您的参与都将直接助力 Hikyuu 的技术创新,共同推动量化交易基础设施的迭代升级。 </p><p>详情参见:<a href=\"https://gitee.com/fasiondog/hikyuu/blob/master/vip-plan.md\"><span style=\" text-decoration: underline; color:#3586ff;\">项目支持计划</span></a></p></body></html>"))
|
|
886
|
+
self.label_47.setText(_translate("MainWindow", "申请试用许可"))
|
|
887
|
+
self.label_48.setText(_translate("MainWindow", "加入知识星球,获取星球许可"))
|
|
888
|
+
self.label_49.setText(_translate("MainWindow", "当前授权信息"))
|
|
889
|
+
self.label_license.setText(_translate("MainWindow", "TextLabel"))
|
|
890
|
+
self.label_45.setText(_translate("MainWindow", "电子邮件地址:"))
|
|
891
|
+
self.fetch_trial_pushButton.setText(_translate("MainWindow", "申请试用许可"))
|
|
892
|
+
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_star), _translate("MainWindow", "项目支持"))
|
|
830
893
|
self.label_41.setText(_translate("MainWindow", "执行日志"))
|
|
@@ -145,8 +145,8 @@ class UseTdxImportToH5Thread(QThread):
|
|
|
145
145
|
connect = sqlite3.connect(dest_dir + "/stock.db")
|
|
146
146
|
create_database(connect)
|
|
147
147
|
|
|
148
|
-
tdx_import_stock_name_from_file(connect, src_dir + "
|
|
149
|
-
tdx_import_stock_name_from_file(connect, src_dir + "
|
|
148
|
+
tdx_import_stock_name_from_file(connect, src_dir + "/T0002/hq_cache/shm.tnf", 'SH', self.quotations)
|
|
149
|
+
tdx_import_stock_name_from_file(connect, src_dir + "/T0002/hq_cache/szm.tnf", 'SZ', self.quotations)
|
|
150
150
|
|
|
151
151
|
self.send_message(['FINISHED_IMPORT_CODE'])
|
|
152
152
|
|
hikyuu/gui/dataserver.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/python
|
|
2
|
+
# -*- coding: utf8 -*-
|
|
3
|
+
#
|
|
4
|
+
# Create on: 2025-04-15
|
|
5
|
+
# Author: fasiondog
|
|
6
|
+
|
|
7
|
+
from hikyuu import start_data_server, stop_data_server
|
|
8
|
+
import time
|
|
9
|
+
import sys
|
|
10
|
+
|
|
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
|
+
|
|
15
|
+
try:
|
|
16
|
+
start_data_server(data_server_addr, work_num)
|
|
17
|
+
|
|
18
|
+
while True:
|
|
19
|
+
try:
|
|
20
|
+
time.sleep(1)
|
|
21
|
+
except KeyboardInterrupt:
|
|
22
|
+
break
|
|
23
|
+
|
|
24
|
+
finally:
|
|
25
|
+
stop_data_server()
|
|
Binary file
|
hikyuu/hub.py
CHANGED
|
@@ -344,6 +344,10 @@ class HubManager(metaclass=SingletonType):
|
|
|
344
344
|
self._session.query(PartModel).filter_by(hub_name=name).delete()
|
|
345
345
|
self._session.query(HubModel).filter_by(name=name).delete()
|
|
346
346
|
|
|
347
|
+
@lru_cache
|
|
348
|
+
def _get_module(self, module_name):
|
|
349
|
+
return importlib.import_module(module_name)
|
|
350
|
+
|
|
347
351
|
@dbsession
|
|
348
352
|
def import_part_to_db(self, hub_model):
|
|
349
353
|
part_dict = {
|
|
@@ -387,7 +391,8 @@ class HubManager(metaclass=SingletonType):
|
|
|
387
391
|
|
|
388
392
|
# 导入模块
|
|
389
393
|
try:
|
|
390
|
-
part_module = importlib.import_module(module_name)
|
|
394
|
+
# part_module = importlib.import_module(module_name)
|
|
395
|
+
part_module = self._get_module(module_name)
|
|
391
396
|
except ModuleNotFoundError:
|
|
392
397
|
self.logger.error('{} 缺失 part.py 文件, 位置:"{}"!'.format(module_name, entry.path))
|
|
393
398
|
continue
|
|
@@ -645,18 +650,7 @@ def get_part(name, *args, **kwargs):
|
|
|
645
650
|
:param args: 其他部件相关参数
|
|
646
651
|
:param kwargs: 其他部件相关参数
|
|
647
652
|
"""
|
|
648
|
-
|
|
649
|
-
def _get_part(name, *args, **kwargs):
|
|
650
|
-
return HubManager().get_part(name, *args, **kwargs)
|
|
651
|
-
|
|
652
|
-
try:
|
|
653
|
-
return _get_part(name, *args, **kwargs)
|
|
654
|
-
except TypeError as e:
|
|
655
|
-
if "unhashable type" in str(e):
|
|
656
|
-
hku_info("{}! 该对象不可hash无法缓存, 可考虑优化", str(e))
|
|
657
|
-
return HubManager().get_part(name, *args, **kwargs)
|
|
658
|
-
else:
|
|
659
|
-
raise e
|
|
653
|
+
return HubManager().get_part(name, *args, **kwargs)
|
|
660
654
|
|
|
661
655
|
|
|
662
656
|
def get_part_list(name_list):
|
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
|
|
31
|
+
__mapper__: typing.ClassVar[sqlalchemy.orm.mapper.Mapper] # value = <Mapper at 0x2b2ffb758e0; 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
|
|
35
|
+
_sa_class_manager: typing.ClassVar[sqlalchemy.orm.instrumentation.ClassManager] # value = <ClassManager of <class 'hikyuu.hub.ConfigModel'> at 2b280530e10>
|
|
36
36
|
def __init__(self, **kwargs):
|
|
37
37
|
"""
|
|
38
38
|
A simple constructor that allows initialization from kwargs.
|
|
@@ -55,6 +55,9 @@ class HubManager:
|
|
|
55
55
|
"""
|
|
56
56
|
_instance: typing.ClassVar[HubManager] # value = <hikyuu.hub.HubManager object>
|
|
57
57
|
@staticmethod
|
|
58
|
+
def _get_module(*args, **kwargs):
|
|
59
|
+
...
|
|
60
|
+
@staticmethod
|
|
58
61
|
def add_local_hub(*args, **kwargs):
|
|
59
62
|
...
|
|
60
63
|
@staticmethod
|
|
@@ -106,11 +109,11 @@ class HubManager:
|
|
|
106
109
|
def print_part_info(self, name):
|
|
107
110
|
...
|
|
108
111
|
class HubModel(sqlalchemy.orm.decl_api.Base):
|
|
109
|
-
__mapper__: typing.ClassVar[sqlalchemy.orm.mapper.Mapper] # value = <Mapper at
|
|
112
|
+
__mapper__: typing.ClassVar[sqlalchemy.orm.mapper.Mapper] # value = <Mapper at 0x2b280513020; HubModel>
|
|
110
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)
|
|
111
114
|
__table_args__: typing.ClassVar[tuple] # value = (UniqueConstraint(Column('name', String(), table=<hub_repo>)))
|
|
112
115
|
__tablename__: typing.ClassVar[str] = 'hub_repo'
|
|
113
|
-
_sa_class_manager: typing.ClassVar[sqlalchemy.orm.instrumentation.ClassManager] # value = <ClassManager of <class 'hikyuu.hub.HubModel'> at
|
|
116
|
+
_sa_class_manager: typing.ClassVar[sqlalchemy.orm.instrumentation.ClassManager] # value = <ClassManager of <class 'hikyuu.hub.HubModel'> at 2b280549720>
|
|
114
117
|
def __init__(self, **kwargs):
|
|
115
118
|
"""
|
|
116
119
|
A simple constructor that allows initialization from kwargs.
|
|
@@ -143,11 +146,11 @@ class ModuleConflictError(Exception):
|
|
|
143
146
|
def __str__(self):
|
|
144
147
|
...
|
|
145
148
|
class PartModel(sqlalchemy.orm.decl_api.Base):
|
|
146
|
-
__mapper__: typing.ClassVar[sqlalchemy.orm.mapper.Mapper] # value = <Mapper at
|
|
149
|
+
__mapper__: typing.ClassVar[sqlalchemy.orm.mapper.Mapper] # value = <Mapper at 0x2b280513800; PartModel>
|
|
147
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)
|
|
148
151
|
__table_args__: typing.ClassVar[tuple] # value = (UniqueConstraint(Column('name', String(), table=<hub_part>)))
|
|
149
152
|
__tablename__: typing.ClassVar[str] = 'hub_part'
|
|
150
|
-
_sa_class_manager: typing.ClassVar[sqlalchemy.orm.instrumentation.ClassManager] # value = <ClassManager of <class 'hikyuu.hub.PartModel'> at
|
|
153
|
+
_sa_class_manager: typing.ClassVar[sqlalchemy.orm.instrumentation.ClassManager] # value = <ClassManager of <class 'hikyuu.hub.PartModel'> at 2b28054a2b0>
|
|
151
154
|
def __init__(self, **kwargs):
|
|
152
155
|
"""
|
|
153
156
|
A simple constructor that allows initialization from kwargs.
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
#include <thread>
|
|
14
14
|
#include "hikyuu/utilities/Parameter.h"
|
|
15
15
|
#include "hikyuu/utilities/thread/thread.h"
|
|
16
|
+
#include "hikyuu/utilities/plugin/PluginManager.h"
|
|
16
17
|
#include "hikyuu/data_driver/DataDriverFactory.h"
|
|
17
18
|
#include "Block.h"
|
|
18
19
|
#include "MarketInfo.h"
|
|
@@ -235,6 +236,17 @@ public:
|
|
|
235
236
|
return m_load_tg.get();
|
|
236
237
|
}
|
|
237
238
|
|
|
239
|
+
/** 设置插件路径(仅在初始化之前有效) */
|
|
240
|
+
void setPluginPath(const std::string& path);
|
|
241
|
+
|
|
242
|
+
/** 获取当前插件路径 */
|
|
243
|
+
const string& getPluginPath() const {
|
|
244
|
+
return m_plugin_manager.pluginPath();
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
template <typename PluginInterfaceT>
|
|
248
|
+
PluginInterfaceT* getPlugin(const std::string& pluginname) noexcept;
|
|
249
|
+
|
|
238
250
|
public:
|
|
239
251
|
typedef StockMapIterator const_iterator;
|
|
240
252
|
const_iterator begin() const {
|
|
@@ -312,6 +324,8 @@ private:
|
|
|
312
324
|
StrategyContext m_context;
|
|
313
325
|
|
|
314
326
|
std::unique_ptr<ThreadPool> m_load_tg; // 异步数据加载辅助线程组
|
|
327
|
+
|
|
328
|
+
PluginManager m_plugin_manager;
|
|
315
329
|
};
|
|
316
330
|
|
|
317
331
|
inline size_t StockManager::size() const {
|
|
@@ -367,6 +381,15 @@ inline vector<HistoryFinanceInfo> StockManager::getHistoryFinance(const Stock& s
|
|
|
367
381
|
return m_baseInfoDriver->getHistoryFinance(stk.market(), stk.code(), start, end);
|
|
368
382
|
}
|
|
369
383
|
|
|
384
|
+
inline void StockManager::setPluginPath(const std::string& path) {
|
|
385
|
+
m_plugin_manager.pluginPath(path);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
template <typename PluginInterfaceT>
|
|
389
|
+
inline PluginInterfaceT* StockManager::getPlugin(const std::string& pluginname) noexcept {
|
|
390
|
+
return m_plugin_manager.getPlugin<PluginInterfaceT>(pluginname);
|
|
391
|
+
}
|
|
392
|
+
|
|
370
393
|
} // namespace hku
|
|
371
394
|
|
|
372
395
|
#endif /* STOCKMANAGER_H_ */
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
|
|
9
9
|
// Ensure the included flatbuffers.h is the same version as when this file was
|
|
10
10
|
// generated, otherwise it may not be compatible.
|
|
11
|
-
static_assert(FLATBUFFERS_VERSION_MAJOR ==
|
|
12
|
-
FLATBUFFERS_VERSION_MINOR ==
|
|
13
|
-
FLATBUFFERS_VERSION_REVISION ==
|
|
11
|
+
static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
|
|
12
|
+
FLATBUFFERS_VERSION_MINOR == 2 &&
|
|
13
|
+
FLATBUFFERS_VERSION_REVISION == 10,
|
|
14
14
|
"Non-compatible flatbuffers version included");
|
|
15
15
|
|
|
16
16
|
namespace hikyuu {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 hikyuu.org
|
|
3
|
+
*
|
|
4
|
+
* Created on: 2025-04-12
|
|
5
|
+
* Author: fasiondog
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
#include "hikyuu/strategy/Strategy.h"
|
|
10
|
+
|
|
11
|
+
namespace hku {
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @brief 策略回测(事件驱动方式)
|
|
15
|
+
*
|
|
16
|
+
* @param context 策略上下文
|
|
17
|
+
* @param on_bar 策略主体执行函数
|
|
18
|
+
* @param tm 策略测试账户
|
|
19
|
+
* @param start_date 起始日期
|
|
20
|
+
* @param end_date 结束日期(不包含本身)
|
|
21
|
+
* @param ktype K线类型
|
|
22
|
+
* @param ref_market 所属市场
|
|
23
|
+
* @param mode 模式 0: 当前bar收盘价执行买卖操作;1: 下一bar开盘价执行买卖操作;
|
|
24
|
+
*/
|
|
25
|
+
void HKU_API backtest(const StrategyContext& context, const std::function<void(Strategy*)>& on_bar,
|
|
26
|
+
const TradeManagerPtr& tm, const Datetime& start_date,
|
|
27
|
+
const Datetime& end_date = Null<Datetime>(),
|
|
28
|
+
const KQuery::KType& ktype = KQuery::DAY, const string& ref_market = "SH",
|
|
29
|
+
int mode = 0);
|
|
30
|
+
|
|
31
|
+
// 仅在 sm.init 之后使用
|
|
32
|
+
void HKU_API backtest(const std::function<void(Strategy*)>& on_bar, const TradeManagerPtr& tm,
|
|
33
|
+
const Datetime& start_date, const Datetime& end_date = Null<Datetime>(),
|
|
34
|
+
const KQuery::KType& ktype = KQuery::DAY, const string& ref_market = "SH",
|
|
35
|
+
int mode = 0);
|
|
36
|
+
|
|
37
|
+
} // namespace hku
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 hikyuu.org
|
|
3
|
+
*
|
|
4
|
+
* Created on: 2025-04-15
|
|
5
|
+
* Author: fasiondog
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "hikyuu/DataType.h"
|
|
11
|
+
|
|
12
|
+
namespace hku {
|
|
13
|
+
|
|
14
|
+
void HKU_API startDataServer(const std::string& addr = "tcp://0.0.0.0:9201", size_t work_num = 2);
|
|
15
|
+
|
|
16
|
+
void HKU_API stopDataServer();
|
|
17
|
+
|
|
18
|
+
} // namespace hku
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 hikyuu.org
|
|
3
|
+
*
|
|
4
|
+
* Created on: 2025-04-12
|
|
5
|
+
* Author: fasiondog
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "hikyuu/DataType.h"
|
|
11
|
+
|
|
12
|
+
namespace hku {
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @brief 激活设备
|
|
16
|
+
* @param active_code 授权码
|
|
17
|
+
*/
|
|
18
|
+
void HKU_API activeDevice(const std::string& active_code);
|
|
19
|
+
|
|
20
|
+
// 查看当前授权
|
|
21
|
+
std::string HKU_API viewLicense();
|
|
22
|
+
|
|
23
|
+
// 移除授权
|
|
24
|
+
void HKU_API removeLicense();
|
|
25
|
+
|
|
26
|
+
// 获取试用授权
|
|
27
|
+
std::string HKU_API fetchTrialLicense(const std::string& email);
|
|
28
|
+
|
|
29
|
+
} // namespace hku
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 hikyuu.org
|
|
3
|
+
*
|
|
4
|
+
* Created on: 2025-04-08
|
|
5
|
+
* Author: fasiondog
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "hikyuu/strategy/Strategy.h"
|
|
11
|
+
#include "hikyuu/utilities/plugin/PluginBase.h"
|
|
12
|
+
|
|
13
|
+
namespace hku {
|
|
14
|
+
|
|
15
|
+
class BackTestPluginInterface : public PluginBase {
|
|
16
|
+
public:
|
|
17
|
+
BackTestPluginInterface() = default;
|
|
18
|
+
virtual ~BackTestPluginInterface() = default;
|
|
19
|
+
|
|
20
|
+
virtual void backtest(const StrategyContext& context,
|
|
21
|
+
const std::function<void(Strategy*)>& on_bar, const TradeManagerPtr& tm,
|
|
22
|
+
const Datetime& start_date, const Datetime& end_date,
|
|
23
|
+
const KQuery::KType& ktype, const string& ref_market, int mode) = 0;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
} // namespace hku
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 hikyuu.org
|
|
3
|
+
*
|
|
4
|
+
* Created on: 2025-04-08
|
|
5
|
+
* Author: fasiondog
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "hikyuu/utilities/plugin/PluginBase.h"
|
|
11
|
+
|
|
12
|
+
namespace hku {
|
|
13
|
+
|
|
14
|
+
class DataServerPluginInterface : public PluginBase {
|
|
15
|
+
public:
|
|
16
|
+
DataServerPluginInterface() = default;
|
|
17
|
+
virtual ~DataServerPluginInterface() = default;
|
|
18
|
+
|
|
19
|
+
virtual void start(const std::string& addr, size_t work_num) noexcept = 0;
|
|
20
|
+
virtual void stop() noexcept = 0;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
} // namespace hku
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 hikyuu.org
|
|
3
|
+
*
|
|
4
|
+
* Created on: 2025-04-08
|
|
5
|
+
* Author: fasiondog
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "hikyuu/utilities/plugin/PluginBase.h"
|
|
11
|
+
|
|
12
|
+
namespace hku {
|
|
13
|
+
|
|
14
|
+
class DevicePluginInterface : public PluginBase {
|
|
15
|
+
public:
|
|
16
|
+
DevicePluginInterface() = default;
|
|
17
|
+
virtual ~DevicePluginInterface() = default;
|
|
18
|
+
|
|
19
|
+
virtual void activate(const std::string& active_code) noexcept = 0;
|
|
20
|
+
virtual std::string viewLicense() noexcept = 0;
|
|
21
|
+
virtual void removeLicense() noexcept = 0;
|
|
22
|
+
virtual std::string fetchTrialLicense(const std::string& email) noexcept = 0;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
} // namespace hku
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 hikyuu.org
|
|
3
|
+
*
|
|
4
|
+
* Created on: 2025-04-10
|
|
5
|
+
* Author: fasiondog
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "BackTestPluginInterface.h"
|
|
11
|
+
#include "DevicePluginInterface.h"
|
|
12
|
+
#include "DataServerPluginInterface.h"
|
|
13
|
+
|
|
14
|
+
namespace hku {
|
|
15
|
+
|
|
16
|
+
#define HKU_PLUGIN_BACKTEST "backtest"
|
|
17
|
+
#define HKU_PLUGIN_DEVICE "device"
|
|
18
|
+
#define HKU_PLUGIN_DATASERVER "dataserver"
|
|
19
|
+
|
|
20
|
+
}
|
|
@@ -98,6 +98,14 @@ public: \
|
|
|
98
98
|
return std::shared_ptr<classname>(keep_python_state_alive, ptr); \
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
+
// 用于检查已 py::object 方式传递的函数参数个数是否符合预期
|
|
102
|
+
inline bool check_pyfunction_arg_num(py::object& func, size_t arg_num) {
|
|
103
|
+
py::module_ inspect = py::module_::import("inspect");
|
|
104
|
+
py::object sig = inspect.attr("signature")(func);
|
|
105
|
+
py::object params = sig.attr("parameters");
|
|
106
|
+
return len(params) == arg_num;
|
|
107
|
+
}
|
|
108
|
+
|
|
101
109
|
} // namespace hku
|
|
102
110
|
|
|
103
111
|
#endif // HIKYUU_PYTHON_BIND_UTILS_H
|
|
@@ -23,7 +23,8 @@ public:
|
|
|
23
23
|
|
|
24
24
|
virtual shared_ptr<TradeManagerBase> _clone() override;
|
|
25
25
|
|
|
26
|
-
virtual void fetchAssetInfoFromBroker(const OrderBrokerPtr& broker
|
|
26
|
+
virtual void fetchAssetInfoFromBroker(const OrderBrokerPtr& broker,
|
|
27
|
+
const Datetime& datetime = Null<Datetime>()) override;
|
|
27
28
|
|
|
28
29
|
/**
|
|
29
30
|
* 根据权息信息更新当前持仓与交易情况
|