hikyuu 2.2.3__py3-none-win_amd64.whl → 2.3.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/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/core310.pyd +0 -0
- hikyuu/cpp/core311.pyd +0 -0
- hikyuu/cpp/core312.pyd +0 -0
- hikyuu/cpp/core313.pyd +0 -0
- hikyuu/cpp/core38.pyd +0 -0
- hikyuu/cpp/core39.pyd +0 -0
- hikyuu/cpp/hikyuu.dll +0 -0
- hikyuu/cpp/hikyuu.lib +0 -0
- hikyuu/data/mysql_upgrade/0024.sql +2 -0
- hikyuu/draw/__init__.py +12 -6
- hikyuu/draw/drawplot/__init__.py +7 -1
- hikyuu/draw/drawplot/icon/1.png +0 -0
- hikyuu/draw/drawplot/icon/10.png +0 -0
- hikyuu/draw/drawplot/icon/11.png +0 -0
- hikyuu/draw/drawplot/icon/12.png +0 -0
- hikyuu/draw/drawplot/icon/13.png +0 -0
- hikyuu/draw/drawplot/icon/14.png +0 -0
- hikyuu/draw/drawplot/icon/15.png +0 -0
- hikyuu/draw/drawplot/icon/16.png +0 -0
- hikyuu/draw/drawplot/icon/17.png +0 -0
- hikyuu/draw/drawplot/icon/18.png +0 -0
- hikyuu/draw/drawplot/icon/19.png +0 -0
- hikyuu/draw/drawplot/icon/2.png +0 -0
- hikyuu/draw/drawplot/icon/20.png +0 -0
- hikyuu/draw/drawplot/icon/21.png +0 -0
- hikyuu/draw/drawplot/icon/22.png +0 -0
- hikyuu/draw/drawplot/icon/23.png +0 -0
- hikyuu/draw/drawplot/icon/24.png +0 -0
- hikyuu/draw/drawplot/icon/25.png +0 -0
- hikyuu/draw/drawplot/icon/26.png +0 -0
- hikyuu/draw/drawplot/icon/27.png +0 -0
- hikyuu/draw/drawplot/icon/28.png +0 -0
- hikyuu/draw/drawplot/icon/29.png +0 -0
- hikyuu/draw/drawplot/icon/3.png +0 -0
- hikyuu/draw/drawplot/icon/30.png +0 -0
- hikyuu/draw/drawplot/icon/31.png +0 -0
- hikyuu/draw/drawplot/icon/32.png +0 -0
- hikyuu/draw/drawplot/icon/33.png +0 -0
- hikyuu/draw/drawplot/icon/34.png +0 -0
- hikyuu/draw/drawplot/icon/35.png +0 -0
- hikyuu/draw/drawplot/icon/36.png +0 -0
- hikyuu/draw/drawplot/icon/37.png +0 -0
- hikyuu/draw/drawplot/icon/38.png +0 -0
- hikyuu/draw/drawplot/icon/39.png +0 -0
- hikyuu/draw/drawplot/icon/4.png +0 -0
- hikyuu/draw/drawplot/icon/40.png +0 -0
- hikyuu/draw/drawplot/icon/41.png +0 -0
- hikyuu/draw/drawplot/icon/42.png +0 -0
- hikyuu/draw/drawplot/icon/43.png +0 -0
- hikyuu/draw/drawplot/icon/44.png +0 -0
- hikyuu/draw/drawplot/icon/45.png +0 -0
- hikyuu/draw/drawplot/icon/46.png +0 -0
- hikyuu/draw/drawplot/icon/47.png +0 -0
- hikyuu/draw/drawplot/icon/48.png +0 -0
- hikyuu/draw/drawplot/icon/49.png +0 -0
- hikyuu/draw/drawplot/icon/5.png +0 -0
- hikyuu/draw/drawplot/icon/6.png +0 -0
- hikyuu/draw/drawplot/icon/7.png +0 -0
- hikyuu/draw/drawplot/icon/8.png +0 -0
- hikyuu/draw/drawplot/icon/9.png +0 -0
- hikyuu/draw/drawplot/icon/__init__.py +0 -0
- hikyuu/draw/drawplot/matplotlib_draw.py +553 -4
- hikyuu/examples/notebook/Demo/Demo1.ipynb +85 -84
- hikyuu/gui/HikyuuTDX.py +19 -16
- hikyuu/gui/data/MainWindow.py +14 -11
- hikyuu/gui/hikyuu_small.png +0 -0
- hikyuu/hub.py +4 -4
- hikyuu/include/hikyuu/DataType.h +3 -1
- hikyuu/include/hikyuu/StockManager.h +10 -0
- hikyuu/include/hikyuu/config.h +3 -0
- hikyuu/include/hikyuu/data_driver/BlockInfoDriver.h +15 -1
- hikyuu/include/hikyuu/data_driver/block_info/mysql/MySQLBlockInfoDriver.h +8 -1
- hikyuu/include/hikyuu/data_driver/block_info/qianlong/QLBlockInfoDriver.h +3 -1
- hikyuu/include/hikyuu/data_driver/block_info/sqlite/SQLiteBlockInfoDriver.h +8 -1
- hikyuu/include/hikyuu/indicator/Indicator.h +4 -4
- hikyuu/include/hikyuu/indicator/IndicatorImp.h +11 -8
- hikyuu/include/hikyuu/indicator/build_in.h +3 -0
- hikyuu/include/hikyuu/indicator/crt/CONTEXT.h +30 -0
- hikyuu/include/hikyuu/indicator/crt/CORR.h +1 -1
- hikyuu/include/hikyuu/indicator/crt/ISLASTBAR.h +30 -0
- hikyuu/include/hikyuu/indicator/crt/SPEARMAN.h +2 -2
- hikyuu/include/hikyuu/indicator/crt/WMA.h +46 -0
- hikyuu/include/hikyuu/indicator/imp/IContext.h +44 -0
- hikyuu/include/hikyuu/indicator/imp/ICorr.h +0 -1
- hikyuu/include/hikyuu/indicator/imp/IIsLastBar.h +27 -0
- hikyuu/include/hikyuu/indicator/imp/ISpearman.h +0 -1
- hikyuu/include/hikyuu/indicator/imp/IWma.h +30 -0
- hikyuu/include/hikyuu/indicator_talib/__init__.py +1 -0
- hikyuu/include/hikyuu/indicator_talib/imp/TaAdosc.h +26 -0
- hikyuu/include/hikyuu/indicator_talib/imp/TaApo.h +24 -0
- hikyuu/include/hikyuu/indicator_talib/imp/TaBbands.h +24 -0
- hikyuu/include/hikyuu/indicator_talib/imp/TaMa.h +24 -0
- hikyuu/include/hikyuu/indicator_talib/imp/TaMacd.h +24 -0
- hikyuu/include/hikyuu/indicator_talib/imp/TaMacdext.h +24 -0
- hikyuu/include/hikyuu/indicator_talib/imp/TaMama.h +24 -0
- hikyuu/include/hikyuu/indicator_talib/imp/TaMavp.h +41 -0
- hikyuu/include/hikyuu/indicator_talib/imp/TaPpo.h +24 -0
- hikyuu/include/hikyuu/indicator_talib/imp/TaSar.h +26 -0
- hikyuu/include/hikyuu/indicator_talib/imp/TaSarext.h +31 -0
- hikyuu/include/hikyuu/indicator_talib/imp/TaStddev.h +24 -0
- hikyuu/include/hikyuu/indicator_talib/imp/TaStoch.h +27 -0
- hikyuu/include/hikyuu/indicator_talib/imp/TaStochf.h +26 -0
- hikyuu/include/hikyuu/indicator_talib/imp/TaStochrsi.h +24 -0
- hikyuu/include/hikyuu/indicator_talib/imp/TaT3.h +24 -0
- hikyuu/include/hikyuu/indicator_talib/imp/TaUltosc.h +26 -0
- hikyuu/include/hikyuu/indicator_talib/imp/TaVar.h +24 -0
- hikyuu/include/hikyuu/indicator_talib/imp/__init__.py +1 -0
- hikyuu/include/hikyuu/indicator_talib/imp/ta_defines.h +288 -0
- hikyuu/include/hikyuu/indicator_talib/imp/ta_imp.h +1364 -0
- hikyuu/include/hikyuu/indicator_talib/ta_crt.h +320 -0
- hikyuu/include/hikyuu/trade_manage/OrderBrokerBase.h +25 -0
- hikyuu/include/hikyuu/trade_manage/TradeManagerBase.h +0 -4
- hikyuu/include/hikyuu/trade_sys/selector/imp/optimal/PerformanceOptimalSelector.h +1 -1
- hikyuu/include/hikyuu/utilities/Null.h +33 -0
- hikyuu/include/hikyuu/utilities/Parameter.h +9 -9
- hikyuu/include/hikyuu/utilities/db_connect/mysql/MySQLStatement.h +1 -0
- hikyuu/include/hikyuu/version.h +5 -5
- hikyuu/indicator/talib_wrap.py +424 -415
- hikyuu/test/Datetime.py +12 -12
- hikyuu/test/Indicator.py +36 -36
- hikyuu/test/KData.py +11 -11
- hikyuu/test/Stock.py +10 -10
- {hikyuu-2.2.3.dist-info → hikyuu-2.3.0.dist-info}/METADATA +26 -3
- {hikyuu-2.2.3.dist-info → hikyuu-2.3.0.dist-info}/RECORD +131 -52
- {hikyuu-2.2.3.dist-info → hikyuu-2.3.0.dist-info}/top_level.txt +3 -0
- hikyuu/sqlite3.dll +0 -0
- hikyuu/vcruntime140.dll +0 -0
- hikyuu/vcruntime140_1.dll +0 -0
- {hikyuu-2.2.3.dist-info → hikyuu-2.3.0.dist-info}/LICENSE +0 -0
- {hikyuu-2.2.3.dist-info → hikyuu-2.3.0.dist-info}/WHEEL +0 -0
- {hikyuu-2.2.3.dist-info → hikyuu-2.3.0.dist-info}/entry_points.txt +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
|
|
19
|
+
from PyQt5.QtGui import QIcon, QTextCursor, QFont, QPalette
|
|
20
20
|
|
|
21
21
|
import mysql.connector
|
|
22
22
|
from mysql.connector import errorcode
|
|
@@ -50,11 +50,12 @@ class EmittingStream(QObject):
|
|
|
50
50
|
|
|
51
51
|
|
|
52
52
|
class MyMainWindow(QMainWindow, Ui_MainWindow):
|
|
53
|
-
def __init__(self, parent=None, capture_output=False
|
|
53
|
+
def __init__(self, parent=None, capture_output=False):
|
|
54
54
|
super(MyMainWindow, self).__init__(parent)
|
|
55
55
|
self._capture_output = capture_output # 捕获Python stdout 输出
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
palette = QApplication.instance().palette()
|
|
57
|
+
# 获取文字默认颜色
|
|
58
|
+
self._text_color = palette.color(QPalette.WindowText).name()
|
|
58
59
|
self.setupUi(self)
|
|
59
60
|
self.initUI()
|
|
60
61
|
self.initLogger()
|
|
@@ -266,7 +267,9 @@ class MyMainWindow(QMainWindow, Ui_MainWindow):
|
|
|
266
267
|
self.log_textEdit.document().setMaximumBlockCount(1000)
|
|
267
268
|
|
|
268
269
|
current_dir = os.path.dirname(__file__)
|
|
269
|
-
|
|
270
|
+
icon = QIcon(f"{current_dir}/hikyuu_small.png")
|
|
271
|
+
self.setWindowIcon(icon)
|
|
272
|
+
QApplication.instance().setWindowIcon(icon)
|
|
270
273
|
self.import_detail_textEdit.clear()
|
|
271
274
|
self.reset_progress_bar()
|
|
272
275
|
self.day_start_dateEdit.setMinimumDate(datetime.date(1990, 12, 19))
|
|
@@ -711,6 +714,14 @@ class MyMainWindow(QMainWindow, Ui_MainWindow):
|
|
|
711
714
|
QMessageBox.about(self, "错误", str(e))
|
|
712
715
|
return
|
|
713
716
|
|
|
717
|
+
now = hikyuu.Datetime.now()
|
|
718
|
+
today = hikyuu.Datetime.today()
|
|
719
|
+
if now.day_of_week() not in (0, 6) and hikyuu.TimeDelta(0, 8, 30) < now - today < hikyuu.TimeDelta(0, 15, 45):
|
|
720
|
+
reply = QMessageBox.question(self, '警告', '交易日8:30-15:45分之间导入数据将导致盘后数据错误,是否仍要继续执行导入?',
|
|
721
|
+
QMessageBox.Yes | QMessageBox.No, QMessageBox.No)
|
|
722
|
+
if reply == QMessageBox.No:
|
|
723
|
+
return
|
|
724
|
+
|
|
714
725
|
self.import_running = True
|
|
715
726
|
self.start_import_pushButton.setEnabled(False)
|
|
716
727
|
self.reset_progress_bar()
|
|
@@ -797,11 +808,7 @@ def start():
|
|
|
797
808
|
logging.getLogger("requests").setLevel(logging.WARNING)
|
|
798
809
|
logging.getLogger("urllib3").setLevel(logging.WARNING)
|
|
799
810
|
app = QApplication(sys.argv)
|
|
800
|
-
|
|
801
|
-
if use_dark_style:
|
|
802
|
-
import qdarkstyle
|
|
803
|
-
app.setStyleSheet(qdarkstyle.load_stylesheet(qt_api='pyqt5'))
|
|
804
|
-
myWin = MyMainWindow(capture_output=True, use_dark_style=use_dark_style)
|
|
811
|
+
myWin = MyMainWindow(capture_output=True)
|
|
805
812
|
myWin.show()
|
|
806
813
|
sys.exit(app.exec())
|
|
807
814
|
|
|
@@ -822,18 +829,14 @@ if __name__ == "__main__":
|
|
|
822
829
|
f.setPixelSize(12)
|
|
823
830
|
app.setFont(f)
|
|
824
831
|
|
|
825
|
-
use_dark_style = False # 使用暗黑主题
|
|
826
|
-
if use_dark_style:
|
|
827
|
-
import qdarkstyle
|
|
828
|
-
app.setStyleSheet(qdarkstyle.load_stylesheet(qt_api='pyqt5'))
|
|
829
832
|
if (len(sys.argv) > 1 and sys.argv[1] == '0'):
|
|
830
833
|
FORMAT = '%(asctime)-15s [%(levelname)s]: %(message)s [%(name)s::%(funcName)s]'
|
|
831
834
|
logging.basicConfig(format=FORMAT, level=logging.INFO, handlers=[
|
|
832
835
|
logging.StreamHandler(),
|
|
833
836
|
])
|
|
834
|
-
myWin = MyMainWindow(capture_output=False
|
|
837
|
+
myWin = MyMainWindow(capture_output=False)
|
|
835
838
|
else:
|
|
836
|
-
myWin = MyMainWindow(capture_output=True
|
|
839
|
+
myWin = MyMainWindow(capture_output=True)
|
|
837
840
|
|
|
838
841
|
myWin.show()
|
|
839
842
|
sys.exit(app.exec())
|
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.
|
|
@@ -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(
|
|
17
|
+
MainWindow.resize(1269, 690)
|
|
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(
|
|
168
|
+
self.min5_start_dateEdit.setMinimumDateTime(QtCore.QDateTime(QtCore.QDate(1989, 12, 30), QtCore.QTime(16, 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)
|
|
@@ -174,9 +174,6 @@ class Ui_MainWindow(object):
|
|
|
174
174
|
self.min_start_dateEdit.setObjectName("min_start_dateEdit")
|
|
175
175
|
self.gridLayout_4.addWidget(self.min_start_dateEdit, 2, 1, 1, 1)
|
|
176
176
|
self.label_3 = QtWidgets.QLabel(self.groupBox_7)
|
|
177
|
-
font = QtGui.QFont()
|
|
178
|
-
font.setPointSize(9)
|
|
179
|
-
self.label_3.setFont(font)
|
|
180
177
|
self.label_3.setObjectName("label_3")
|
|
181
178
|
self.gridLayout_4.addWidget(self.label_3, 0, 0, 1, 1)
|
|
182
179
|
self.label_10 = QtWidgets.QLabel(self.groupBox_7)
|
|
@@ -190,7 +187,7 @@ class Ui_MainWindow(object):
|
|
|
190
187
|
self.trans_start_dateEdit.setObjectName("trans_start_dateEdit")
|
|
191
188
|
self.gridLayout_4.addWidget(self.trans_start_dateEdit, 3, 1, 1, 1)
|
|
192
189
|
self.day_start_dateEdit = QtWidgets.QDateEdit(self.groupBox_7)
|
|
193
|
-
self.day_start_dateEdit.setMinimumDateTime(QtCore.QDateTime(QtCore.QDate(
|
|
190
|
+
self.day_start_dateEdit.setMinimumDateTime(QtCore.QDateTime(QtCore.QDate(1989, 12, 30), QtCore.QTime(16, 0, 0)))
|
|
194
191
|
self.day_start_dateEdit.setCalendarPopup(True)
|
|
195
192
|
self.day_start_dateEdit.setObjectName("day_start_dateEdit")
|
|
196
193
|
self.gridLayout_4.addWidget(self.day_start_dateEdit, 0, 1, 1, 1)
|
|
@@ -751,9 +748,12 @@ class Ui_MainWindow(object):
|
|
|
751
748
|
self.label_12.setText(_translate("MainWindow", "导入5分钟线:"))
|
|
752
749
|
self.label_9.setText(_translate("MainWindow", "导入权息数据:"))
|
|
753
750
|
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"
|
|
754
|
-
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
|
|
751
|
+
"<html><head><meta name=\"qrichtext\" content=\"1\" /><meta charset=\"utf-8\" /><style type=\"text/css\">\n"
|
|
755
752
|
"p, li { white-space: pre-wrap; }\n"
|
|
756
|
-
"
|
|
753
|
+
"hr { height: 1px; border-width: 0; }\n"
|
|
754
|
+
"li.unchecked::marker { content: \"\\2610\"; }\n"
|
|
755
|
+
"li.checked::marker { content: \"\\2612\"; }\n"
|
|
756
|
+
"</style></head><body style=\" font-family:\'Microsoft YaHei UI\'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
|
|
757
757
|
"<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"
|
|
758
758
|
"<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"
|
|
759
759
|
"<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"
|
|
@@ -808,9 +808,12 @@ class Ui_MainWindow(object):
|
|
|
808
808
|
self.label_38.setText(_translate("MainWindow", "-"))
|
|
809
809
|
self.collect_use_zhima_checkBox.setText(_translate("MainWindow", "使用芝麻代理"))
|
|
810
810
|
self.textBrowser.setHtml(_translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
|
|
811
|
-
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
|
|
811
|
+
"<html><head><meta name=\"qrichtext\" content=\"1\" /><meta charset=\"utf-8\" /><style type=\"text/css\">\n"
|
|
812
812
|
"p, li { white-space: pre-wrap; }\n"
|
|
813
|
-
"
|
|
813
|
+
"hr { height: 1px; border-width: 0; }\n"
|
|
814
|
+
"li.unchecked::marker { content: \"\\2610\"; }\n"
|
|
815
|
+
"li.checked::marker { content: \"\\2612\"; }\n"
|
|
816
|
+
"</style></head><body style=\" font-family:\'Microsoft YaHei UI\'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
|
|
814
817
|
"<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"
|
|
815
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:10pt; font-weight:600; color:#ff0000;\">1、行情采集服务仅对预加载数据有效</span><span style=\" font-family:\'SimSun\';\">,在行情采集服务运行期间,hikyuu.interactive运行时将自动连接采集服务获取行情数据,并更新预加载的内容数据。</span></p>\n"
|
|
816
819
|
"<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"
|
|
Binary file
|
hikyuu/hub.py
CHANGED
|
@@ -206,7 +206,7 @@ class HubManager(metaclass=SingletonType):
|
|
|
206
206
|
# 检查并下载 hikyuu 默认策略仓库, hikyuu_hub 避免导入时模块和 hikyuu 重名
|
|
207
207
|
hikyuu_hub_path = self._session.query(HubModel.local).filter(HubModel.name == 'default').first()
|
|
208
208
|
if hikyuu_hub_path is None:
|
|
209
|
-
self.add_remote_hub('default', 'https://gitee.com/fasiondog/hikyuu_hub.git', '
|
|
209
|
+
self.add_remote_hub('default', 'https://gitee.com/fasiondog/hikyuu_hub.git', 'main')
|
|
210
210
|
|
|
211
211
|
def download_remote_hub(self, local_dir, url, branch):
|
|
212
212
|
print('正在下载 hikyuu 策略仓库至:"{}"'.format(local_dir))
|
|
@@ -222,7 +222,7 @@ class HubManager(metaclass=SingletonType):
|
|
|
222
222
|
print('下载完毕')
|
|
223
223
|
|
|
224
224
|
@dbsession
|
|
225
|
-
def add_remote_hub(self, name, url, branch='
|
|
225
|
+
def add_remote_hub(self, name, url, branch='main'):
|
|
226
226
|
"""增加远程策略仓库
|
|
227
227
|
|
|
228
228
|
:param str name: 本地仓库名称(自行起名)
|
|
@@ -266,7 +266,7 @@ class HubManager(metaclass=SingletonType):
|
|
|
266
266
|
# 检查仓库目录名称是否与其他 python 模块存在冲突
|
|
267
267
|
tmp = importlib.import_module(os.path.basename(local_path))
|
|
268
268
|
checkif(
|
|
269
|
-
tmp.__path__[0] != local_path,
|
|
269
|
+
tmp.__path__[0] != local_path if sys.platform == 'win32' else tmp.__path__[0].lower() != local_path.lower(),
|
|
270
270
|
name,
|
|
271
271
|
ModuleConflictError,
|
|
272
272
|
conflict_module=tmp.__path__[0],
|
|
@@ -502,7 +502,7 @@ class HubManager(metaclass=SingletonType):
|
|
|
502
502
|
return hub_model.name
|
|
503
503
|
|
|
504
504
|
|
|
505
|
-
def add_remote_hub(name, url, branch='
|
|
505
|
+
def add_remote_hub(name, url, branch='main'):
|
|
506
506
|
"""增加远程策略仓库
|
|
507
507
|
|
|
508
508
|
:param str name: 本地仓库名称(自行起名)
|
hikyuu/include/hikyuu/DataType.h
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
#define NOMINMAX
|
|
18
18
|
#endif
|
|
19
19
|
|
|
20
|
+
#include "config.h"
|
|
20
21
|
#include <boost/config.hpp>
|
|
21
22
|
|
|
22
23
|
#include <stdio.h>
|
|
@@ -28,8 +29,9 @@
|
|
|
28
29
|
// #include <vector>
|
|
29
30
|
#include <map>
|
|
30
31
|
#include <unordered_map>
|
|
32
|
+
#include <set>
|
|
33
|
+
#include <unordered_set>
|
|
31
34
|
|
|
32
|
-
#include "config.h"
|
|
33
35
|
#include "utilities/Log.h"
|
|
34
36
|
#include "utilities/osdef.h"
|
|
35
37
|
#include "utilities/cppdef.h"
|
|
@@ -129,6 +129,16 @@ public:
|
|
|
129
129
|
*/
|
|
130
130
|
Block getBlock(const string& category, const string& name);
|
|
131
131
|
|
|
132
|
+
void addBlock(const Block& blk) {
|
|
133
|
+
saveBlock(blk);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
void saveBlock(const Block& blk);
|
|
137
|
+
void removeBlock(const string& category, const string& name);
|
|
138
|
+
void removeBlock(const Block& blk) {
|
|
139
|
+
removeBlock(blk.category(), blk.name());
|
|
140
|
+
}
|
|
141
|
+
|
|
132
142
|
/**
|
|
133
143
|
* 获取指定分类的板块列表
|
|
134
144
|
* @param category 板块分类
|
hikyuu/include/hikyuu/config.h
CHANGED
|
@@ -23,7 +23,7 @@ class HKU_API BlockInfoDriver {
|
|
|
23
23
|
|
|
24
24
|
public:
|
|
25
25
|
BlockInfoDriver(const string& name);
|
|
26
|
-
virtual ~BlockInfoDriver(){};
|
|
26
|
+
virtual ~BlockInfoDriver() {};
|
|
27
27
|
|
|
28
28
|
/** 获取驱动名称 */
|
|
29
29
|
const string& name() const;
|
|
@@ -74,6 +74,20 @@ public:
|
|
|
74
74
|
*/
|
|
75
75
|
virtual BlockList getBlockList() = 0;
|
|
76
76
|
|
|
77
|
+
/**
|
|
78
|
+
* 保存指定的板块
|
|
79
|
+
* @note 如果已存在同名板块,则覆盖;如果板块分类或名称存在修改,需要手工在修改前删除原板块
|
|
80
|
+
* @param block
|
|
81
|
+
*/
|
|
82
|
+
virtual void save(const Block& block) = 0;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* 删除指定的板块
|
|
86
|
+
* @param category 板块分类
|
|
87
|
+
* @param name 板块名称
|
|
88
|
+
*/
|
|
89
|
+
virtual void remove(const string& category, const string& name) = 0;
|
|
90
|
+
|
|
77
91
|
private:
|
|
78
92
|
bool checkType();
|
|
79
93
|
|
|
@@ -7,13 +7,14 @@
|
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
9
9
|
|
|
10
|
+
#include <mutex>
|
|
10
11
|
#include "../../BlockInfoDriver.h"
|
|
11
12
|
|
|
12
13
|
namespace hku {
|
|
13
14
|
|
|
14
15
|
class MySQLBlockInfoDriver : public BlockInfoDriver {
|
|
15
16
|
public:
|
|
16
|
-
MySQLBlockInfoDriver() : BlockInfoDriver("mysql"){};
|
|
17
|
+
MySQLBlockInfoDriver() : BlockInfoDriver("mysql") {};
|
|
17
18
|
virtual ~MySQLBlockInfoDriver();
|
|
18
19
|
|
|
19
20
|
virtual void load() override;
|
|
@@ -21,9 +22,15 @@ public:
|
|
|
21
22
|
virtual Block getBlock(const string&, const string&) override;
|
|
22
23
|
virtual BlockList getBlockList(const string& category) override;
|
|
23
24
|
virtual BlockList getBlockList() override;
|
|
25
|
+
virtual void save(const Block& block) override;
|
|
26
|
+
virtual void remove(const string& category, const string& name) override;
|
|
27
|
+
|
|
28
|
+
private:
|
|
29
|
+
DBConnectPtr getConnect();
|
|
24
30
|
|
|
25
31
|
private:
|
|
26
32
|
unordered_map<string, unordered_map<string, Block>> m_buffer;
|
|
33
|
+
std::shared_mutex m_buffer_mutex;
|
|
27
34
|
};
|
|
28
35
|
|
|
29
36
|
} // namespace hku
|
|
@@ -15,13 +15,15 @@ namespace hku {
|
|
|
15
15
|
|
|
16
16
|
class QLBlockInfoDriver : public BlockInfoDriver {
|
|
17
17
|
public:
|
|
18
|
-
QLBlockInfoDriver() : BlockInfoDriver("qianlong"){};
|
|
18
|
+
QLBlockInfoDriver() : BlockInfoDriver("qianlong") {};
|
|
19
19
|
virtual ~QLBlockInfoDriver();
|
|
20
20
|
|
|
21
21
|
virtual bool _init() override;
|
|
22
22
|
virtual Block getBlock(const string&, const string&) override;
|
|
23
23
|
virtual BlockList getBlockList(const string& category) override;
|
|
24
24
|
virtual BlockList getBlockList() override;
|
|
25
|
+
virtual void save(const Block& block) override;
|
|
26
|
+
virtual void remove(const string& category, const string& name) override;
|
|
25
27
|
};
|
|
26
28
|
|
|
27
29
|
} /* namespace hku */
|
|
@@ -7,13 +7,14 @@
|
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
9
9
|
|
|
10
|
+
#include <mutex>
|
|
10
11
|
#include "../../BlockInfoDriver.h"
|
|
11
12
|
|
|
12
13
|
namespace hku {
|
|
13
14
|
|
|
14
15
|
class SQLiteBlockInfoDriver : public BlockInfoDriver {
|
|
15
16
|
public:
|
|
16
|
-
SQLiteBlockInfoDriver() : BlockInfoDriver("sqlite3"){};
|
|
17
|
+
SQLiteBlockInfoDriver() : BlockInfoDriver("sqlite3") {};
|
|
17
18
|
virtual ~SQLiteBlockInfoDriver();
|
|
18
19
|
|
|
19
20
|
virtual void load() override;
|
|
@@ -21,9 +22,15 @@ public:
|
|
|
21
22
|
virtual Block getBlock(const string&, const string&) override;
|
|
22
23
|
virtual BlockList getBlockList(const string& category) override;
|
|
23
24
|
virtual BlockList getBlockList() override;
|
|
25
|
+
virtual void save(const Block& block) override;
|
|
26
|
+
virtual void remove(const string& category, const string& name) override;
|
|
27
|
+
|
|
28
|
+
private:
|
|
29
|
+
DBConnectPtr getConnect();
|
|
24
30
|
|
|
25
31
|
private:
|
|
26
32
|
unordered_map<string, unordered_map<string, Block>> m_buffer;
|
|
33
|
+
std::shared_mutex m_buffer_mutex;
|
|
27
34
|
};
|
|
28
35
|
|
|
29
36
|
} // namespace hku
|
|
@@ -176,12 +176,12 @@ public:
|
|
|
176
176
|
return m_imp;
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
-
value_t* data(size_t
|
|
180
|
-
return m_imp ? m_imp->data(
|
|
179
|
+
value_t* data(size_t result_idx = 0) {
|
|
180
|
+
return m_imp ? m_imp->data(result_idx) : nullptr;
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
-
value_t const* data(size_t
|
|
184
|
-
return m_imp ? m_imp->data(
|
|
183
|
+
value_t const* data(size_t result_idx = 0) const {
|
|
184
|
+
return m_imp ? m_imp->data(result_idx) : nullptr;
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
/**
|
|
@@ -115,7 +115,8 @@ public:
|
|
|
115
115
|
/** 返回形如:Name(param1=val,param2=val,...) */
|
|
116
116
|
string long_name() const;
|
|
117
117
|
|
|
118
|
-
string formula() const;
|
|
118
|
+
virtual string formula() const;
|
|
119
|
+
virtual string str() const;
|
|
119
120
|
|
|
120
121
|
bool isLeaf() const;
|
|
121
122
|
|
|
@@ -142,13 +143,15 @@ public:
|
|
|
142
143
|
typedef std::map<string, IndicatorImpPtr> ind_param_map_t;
|
|
143
144
|
const ind_param_map_t& getIndParams() const;
|
|
144
145
|
|
|
145
|
-
value_t* data(size_t
|
|
146
|
-
value_t const* data(size_t
|
|
146
|
+
value_t* data(size_t result_idx = 0);
|
|
147
|
+
value_t const* data(size_t result_idx = 0) const;
|
|
147
148
|
|
|
148
149
|
// ===================
|
|
149
150
|
// 子类接口
|
|
150
151
|
// ===================
|
|
151
|
-
virtual void _calculate(const Indicator&) {
|
|
152
|
+
virtual void _calculate(const Indicator&) {
|
|
153
|
+
HKU_WARN("{} will be empty always!", m_name);
|
|
154
|
+
}
|
|
152
155
|
|
|
153
156
|
virtual void _dyn_run_one_step(const Indicator& ind, size_t curPos, size_t step) {}
|
|
154
157
|
|
|
@@ -391,12 +394,12 @@ inline bool IndicatorImp::haveIndParam(const string& name) const {
|
|
|
391
394
|
return m_ind_params.find(name) != m_ind_params.end();
|
|
392
395
|
}
|
|
393
396
|
|
|
394
|
-
inline IndicatorImp::value_t* IndicatorImp::data(size_t
|
|
395
|
-
return m_pBuffer[
|
|
397
|
+
inline IndicatorImp::value_t* IndicatorImp::data(size_t result_idx) {
|
|
398
|
+
return m_pBuffer[result_idx] ? m_pBuffer[result_idx]->data() : nullptr;
|
|
396
399
|
}
|
|
397
400
|
|
|
398
|
-
inline IndicatorImp::value_t const* IndicatorImp::data(size_t
|
|
399
|
-
return m_pBuffer[
|
|
401
|
+
inline IndicatorImp::value_t const* IndicatorImp::data(size_t result_idx) const {
|
|
402
|
+
return m_pBuffer[result_idx] ? m_pBuffer[result_idx]->data() : nullptr;
|
|
400
403
|
}
|
|
401
404
|
|
|
402
405
|
inline size_t IndicatorImp::_get_step_start(size_t pos, size_t step, size_t discard) {
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
#include "crt/BETWEEN.h"
|
|
29
29
|
#include "crt/BLOCKSETNUM.h"
|
|
30
30
|
#include "crt/CEILING.h"
|
|
31
|
+
#include "crt/CONTEXT.h"
|
|
31
32
|
#include "crt/CORR.h"
|
|
32
33
|
#include "crt/COS.h"
|
|
33
34
|
#include "crt/COST.h"
|
|
@@ -55,6 +56,7 @@
|
|
|
55
56
|
#include "crt/INSUM.h"
|
|
56
57
|
#include "crt/IR.h"
|
|
57
58
|
#include "crt/INTPART.h"
|
|
59
|
+
#include "crt/ISLASTBAR.h"
|
|
58
60
|
#include "crt/LAST.h"
|
|
59
61
|
#include "crt/LIUTONGPAN.h"
|
|
60
62
|
#include "crt/LLV.h"
|
|
@@ -107,6 +109,7 @@
|
|
|
107
109
|
#include "crt/VAR.h"
|
|
108
110
|
#include "crt/VARP.h"
|
|
109
111
|
#include "crt/VIGOR.h"
|
|
112
|
+
#include "crt/WMA.h"
|
|
110
113
|
#include "crt/ZHBOND10.h"
|
|
111
114
|
#include "crt/ZONGGUBEN.h"
|
|
112
115
|
#include "crt/ZSCORE.h"
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 hikyuu.org
|
|
3
|
+
*
|
|
4
|
+
* Created on: 2024-12-28
|
|
5
|
+
* Author: fasiondog
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "../Indicator.h"
|
|
11
|
+
|
|
12
|
+
namespace hku {
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* 独立上下文指标
|
|
16
|
+
* @ingroup Indicator
|
|
17
|
+
*/
|
|
18
|
+
Indicator HKU_API CONTEXT(const Indicator& ind);
|
|
19
|
+
Indicator HKU_API CONTEXT();
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 获取指标上下文
|
|
23
|
+
* @note Indicator::getContext()方法获取的是当前的上下文,但对于 CONTEXT
|
|
24
|
+
* 独立上下文指标无法获取其指定的独立上下文,需用此方法获取
|
|
25
|
+
* @param ind
|
|
26
|
+
* @return KData
|
|
27
|
+
*/
|
|
28
|
+
KData HKU_API CONTEXT_K(const Indicator& ind);
|
|
29
|
+
|
|
30
|
+
} // namespace hku
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 hikyuu.org
|
|
3
|
+
*
|
|
4
|
+
* Created on: 2024-12-16
|
|
5
|
+
* Author: fasiondog
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
#ifndef INDICATOR_CRT_LASTBAR_H_
|
|
10
|
+
#define INDICATOR_CRT_LASTBAR_H_
|
|
11
|
+
|
|
12
|
+
#include "../Indicator.h"
|
|
13
|
+
|
|
14
|
+
namespace hku {
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* 判断当前数据是否为最后一个数据,若为最后一个数据,则返回1,否则返回0.
|
|
18
|
+
* @ingroup Indicator
|
|
19
|
+
*/
|
|
20
|
+
Indicator HKU_API ISLASTBAR();
|
|
21
|
+
Indicator HKU_API ISLASTBAR(const KData& kdata);
|
|
22
|
+
Indicator ISLASTBAR(const Indicator& ind);
|
|
23
|
+
|
|
24
|
+
inline Indicator ISLASTBAR(const Indicator& ind) {
|
|
25
|
+
return ISLASTBAR()(ind);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
} // namespace hku
|
|
29
|
+
|
|
30
|
+
#endif /* INDICATOR_CRT_LASTBAR_H_ */
|
|
@@ -17,7 +17,7 @@ namespace hku {
|
|
|
17
17
|
* @param n 滚动窗口(大于2 或 等于0),等于0时,代表 n 实际使用 ind 的长度
|
|
18
18
|
* @ingroup Indicator
|
|
19
19
|
*/
|
|
20
|
-
Indicator HKU_API SPEARMAN(const Indicator&
|
|
21
|
-
Indicator HKU_API SPEARMAN(int n = 0);
|
|
20
|
+
Indicator HKU_API SPEARMAN(const Indicator& ind, const Indicator& ref_ind, int n = 0);
|
|
21
|
+
Indicator HKU_API SPEARMAN(const Indicator& ref_ind, int n = 0);
|
|
22
22
|
|
|
23
23
|
} // namespace hku
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 hikyuu.org
|
|
3
|
+
*
|
|
4
|
+
* Created on: 2024-12-15
|
|
5
|
+
* Author: fasiondog
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
#ifndef WMA_H_
|
|
10
|
+
#define WMA_H_
|
|
11
|
+
|
|
12
|
+
#include "../Indicator.h"
|
|
13
|
+
|
|
14
|
+
namespace hku {
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* 加权移动平均
|
|
18
|
+
* 算法:Yn=(1*X1+2*X2+...+n*Xn)/(1+2+...+n)
|
|
19
|
+
* @param n 计算均值的周期窗口,n >= 1
|
|
20
|
+
* @ingroup Indicator
|
|
21
|
+
*/
|
|
22
|
+
Indicator HKU_API WMA(int n = 22);
|
|
23
|
+
Indicator HKU_API WMA(const IndParam& n);
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* 加权移动平均
|
|
27
|
+
* 算法:Yn=(1*X1+2*X2+...+n*Xn)/(1+2+...+n)
|
|
28
|
+
* @param ind 待计算的数据
|
|
29
|
+
* @param n 计算均值的周期窗口
|
|
30
|
+
* @ingroup Indicator
|
|
31
|
+
*/
|
|
32
|
+
inline Indicator HKU_API WMA(const Indicator& ind, int n = 22) {
|
|
33
|
+
return WMA(n)(ind);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
inline Indicator HKU_API WMA(const Indicator& ind, const IndParam& n) {
|
|
37
|
+
return WMA(n)(ind);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
inline Indicator WMA(const Indicator& ind, const Indicator& n) {
|
|
41
|
+
return WMA(IndParam(n))(ind);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
} // namespace hku
|
|
45
|
+
|
|
46
|
+
#endif /* MA_H_ */
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 hikyuu.org
|
|
3
|
+
*
|
|
4
|
+
* Created on: 2024-12-28
|
|
5
|
+
* Author: fasiondog
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "../Indicator.h"
|
|
11
|
+
|
|
12
|
+
namespace hku {
|
|
13
|
+
|
|
14
|
+
class IContext : public IndicatorImp {
|
|
15
|
+
public:
|
|
16
|
+
IContext();
|
|
17
|
+
IContext(const Indicator& ref_ind);
|
|
18
|
+
virtual ~IContext();
|
|
19
|
+
|
|
20
|
+
virtual string str() const override;
|
|
21
|
+
virtual string formula() const override;
|
|
22
|
+
virtual void _calculate(const Indicator& data) override;
|
|
23
|
+
virtual IndicatorImpPtr _clone() override;
|
|
24
|
+
|
|
25
|
+
KData getContextKdata() const;
|
|
26
|
+
|
|
27
|
+
private:
|
|
28
|
+
Indicator m_ref_ind;
|
|
29
|
+
|
|
30
|
+
//============================================
|
|
31
|
+
// 序列化支持
|
|
32
|
+
//============================================
|
|
33
|
+
#if HKU_SUPPORT_SERIALIZATION
|
|
34
|
+
private:
|
|
35
|
+
friend class boost::serialization::access;
|
|
36
|
+
template <class Archive>
|
|
37
|
+
void serialize(Archive& ar, const unsigned int version) {
|
|
38
|
+
ar& BOOST_SERIALIZATION_BASE_OBJECT_NVP(IndicatorImp);
|
|
39
|
+
ar& BOOST_SERIALIZATION_NVP(m_ref_ind);
|
|
40
|
+
}
|
|
41
|
+
#endif
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
} // namespace hku
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 hikyuu.org
|
|
3
|
+
*
|
|
4
|
+
* Created on: 2024-12-16
|
|
5
|
+
* Author: fasiondog
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
#ifndef INDICATOR_IMP_IISLASTBAR_H_
|
|
10
|
+
#define INDICATOR_IMP_IISLASTBAR_H_
|
|
11
|
+
|
|
12
|
+
#include "../Indicator.h"
|
|
13
|
+
|
|
14
|
+
namespace hku {
|
|
15
|
+
|
|
16
|
+
class IIsLastBar : public IndicatorImp {
|
|
17
|
+
INDICATOR_IMP(IIsLastBar)
|
|
18
|
+
INDICATOR_IMP_NO_PRIVATE_MEMBER_SERIALIZATION
|
|
19
|
+
|
|
20
|
+
public:
|
|
21
|
+
IIsLastBar();
|
|
22
|
+
explicit IIsLastBar(const KData&);
|
|
23
|
+
virtual ~IIsLastBar();
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
} /* namespace hku */
|
|
27
|
+
#endif /* INDICATOR_IMP_IISLASTBAR_H_ */
|