hikyuu 2.6.8.3__py3-none-manylinux2014_x86_64.whl → 2.6.9__py3-none-manylinux2014_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (198) hide show
  1. hikyuu/__init__.py +5 -12
  2. hikyuu/__init__.pyi +612 -587
  3. hikyuu/analysis/__init__.pyi +589 -563
  4. hikyuu/analysis/analysis.pyi +590 -564
  5. hikyuu/core.py +2 -0
  6. hikyuu/core.pyi +591 -565
  7. hikyuu/cpp/__init__.pyi +2 -2
  8. hikyuu/cpp/core310.pyi +446 -13
  9. hikyuu/cpp/core310.so +0 -0
  10. hikyuu/cpp/core311.pyi +440 -13
  11. hikyuu/cpp/core311.so +0 -0
  12. hikyuu/cpp/core312.pyi +440 -13
  13. hikyuu/cpp/core312.so +0 -0
  14. hikyuu/cpp/core313.pyi +446 -13
  15. hikyuu/cpp/core313.so +0 -0
  16. hikyuu/cpp/i18n/zh_CN/hikyuu.mo +0 -0
  17. hikyuu/cpp/libboost_charconv-mt.so +0 -0
  18. hikyuu/cpp/libboost_charconv-mt.so.1.88.0 +0 -0
  19. hikyuu/cpp/libboost_chrono-mt.so +0 -0
  20. hikyuu/cpp/libboost_chrono-mt.so.1.88.0 +0 -0
  21. hikyuu/cpp/libboost_date_time-mt.so +0 -0
  22. hikyuu/cpp/libboost_date_time-mt.so.1.88.0 +0 -0
  23. hikyuu/cpp/libboost_serialization-mt.so +0 -0
  24. hikyuu/cpp/libboost_serialization-mt.so.1.88.0 +0 -0
  25. hikyuu/cpp/libboost_system-mt.so +0 -0
  26. hikyuu/cpp/libboost_system-mt.so.1.88.0 +0 -0
  27. hikyuu/cpp/libboost_thread-mt.so +0 -0
  28. hikyuu/cpp/libboost_thread-mt.so.1.88.0 +0 -0
  29. hikyuu/cpp/libboost_wserialization-mt.so +0 -0
  30. hikyuu/cpp/libboost_wserialization-mt.so.1.88.0 +0 -0
  31. hikyuu/cpp/libhikyuu.so +0 -0
  32. hikyuu/cpp/libsqlite3.so +0 -0
  33. hikyuu/data/clickhouse_upgrade/createdb.sql +105 -105
  34. hikyuu/data/common.py +3 -3
  35. hikyuu/data/common_clickhouse.py +1 -1
  36. hikyuu/data/download_block.py +318 -0
  37. hikyuu/data/em_block_to_clickhouse.py +26 -74
  38. hikyuu/data/em_block_to_mysql.py +25 -75
  39. hikyuu/data/em_block_to_sqlite.py +26 -78
  40. hikyuu/data/hku_config_template.py +3 -3
  41. hikyuu/data/pytdx_to_clickhouse.py +15 -11
  42. hikyuu/data/pytdx_to_h5.py +6 -2
  43. hikyuu/data/pytdx_to_mysql.py +5 -1
  44. hikyuu/data/pytdx_weight_to_clickhouse.py +1 -1
  45. hikyuu/data/pytdx_weight_to_mysql.py +1 -1
  46. hikyuu/data/pytdx_weight_to_sqlite.py +1 -1
  47. hikyuu/data/zh_bond10_to_clickhouse.py +1 -1
  48. hikyuu/draw/drawplot/__init__.pyi +8 -8
  49. hikyuu/draw/drawplot/bokeh_draw.pyi +603 -578
  50. hikyuu/draw/drawplot/common.pyi +1 -1
  51. hikyuu/draw/drawplot/echarts_draw.pyi +605 -580
  52. hikyuu/draw/drawplot/matplotlib_draw.py +4 -74
  53. hikyuu/draw/drawplot/matplotlib_draw.pyi +615 -590
  54. hikyuu/draw/elder.pyi +11 -11
  55. hikyuu/draw/kaufman.pyi +18 -18
  56. hikyuu/draw/volume.pyi +10 -10
  57. hikyuu/examples/notebook/Demo/Demo1.ipynb +48 -33
  58. hikyuu/extend.pyi +599 -573
  59. hikyuu/fetcher/stock/zh_block_em.py +50 -18
  60. hikyuu/gui/HikyuuTDX.py +81 -30
  61. hikyuu/gui/data/CollectSpotThread.py +1 -1
  62. hikyuu/gui/data/EscapetimeThread.py +8 -14
  63. hikyuu/gui/data/ImportBlockInfoTask.py +3 -10
  64. hikyuu/gui/data/MainWindow.py +1168 -715
  65. hikyuu/gui/data/SchedImportThread.py +2 -2
  66. hikyuu/gui/data/UsePytdxImportToH5Thread.py +3 -3
  67. hikyuu/gui/data/UseQmtImportToH5Thread.py +2 -2
  68. hikyuu/gui/data/UseTdxImportToH5Thread.py +3 -3
  69. hikyuu/gui/data/tool.py +32 -25
  70. hikyuu/gui/dataserver.py +5 -3
  71. hikyuu/gui/importdata.py +4 -0
  72. hikyuu/hub.pyi +6 -6
  73. hikyuu/include/hikyuu/DataType.h +4 -16
  74. hikyuu/include/hikyuu/KData.h +6 -3
  75. hikyuu/include/hikyuu/KDataPrivatedBufferImp.h +1 -1
  76. hikyuu/include/hikyuu/KDataSharedBufferImp.h +1 -1
  77. hikyuu/include/hikyuu/KQuery.h +2 -2
  78. hikyuu/include/hikyuu/Stock.h +3 -0
  79. hikyuu/include/hikyuu/StockManager.h +13 -3
  80. hikyuu/include/hikyuu/config.h +3 -0
  81. hikyuu/include/hikyuu/data_driver/BaseInfoDriver.h +8 -0
  82. hikyuu/include/hikyuu/data_driver/BlockInfoDriver.h +6 -0
  83. hikyuu/include/hikyuu/data_driver/KDataDriver.h +26 -1
  84. hikyuu/include/hikyuu/data_driver/base_info/mysql/MySQLBaseInfoDriver.h +1 -1
  85. hikyuu/include/hikyuu/data_driver/base_info/sqlite/SQLiteBaseInfoDriver.h +1 -1
  86. hikyuu/include/hikyuu/data_driver/block_info/mysql/MySQLBlockInfoDriver.h +2 -1
  87. hikyuu/include/hikyuu/data_driver/block_info/qianlong/QLBlockInfoDriver.h +2 -1
  88. hikyuu/include/hikyuu/data_driver/block_info/sqlite/SQLiteBlockInfoDriver.h +2 -1
  89. hikyuu/include/hikyuu/data_driver/kdata/DoNothingKDataDriver.h +1 -1
  90. hikyuu/include/hikyuu/data_driver/kdata/cvs/KDataTempCsvDriver.h +1 -1
  91. hikyuu/include/hikyuu/data_driver/kdata/hdf5/H5KDataDriver.h +1 -1
  92. hikyuu/include/hikyuu/data_driver/kdata/mysql/MySQLKDataDriver.h +1 -1
  93. hikyuu/include/hikyuu/data_driver/kdata/sqlite/SQLiteKDataDriver.h +1 -1
  94. hikyuu/include/hikyuu/data_driver/kdata/tdx/TdxKDataDriver.h +1 -1
  95. hikyuu/include/hikyuu/hikyuu.h +1 -1
  96. hikyuu/include/hikyuu/indicator/build_in.h +1 -0
  97. hikyuu/include/hikyuu/indicator/crt/CYCLE.h +4 -4
  98. hikyuu/include/hikyuu/indicator/crt/HSL.h +2 -2
  99. hikyuu/include/hikyuu/indicator/crt/QUANTILE_TRUNC.h +30 -0
  100. hikyuu/include/hikyuu/indicator/crt/TURNOVER.h +1 -0
  101. hikyuu/include/hikyuu/indicator/crt/ZSCORE.h +2 -2
  102. hikyuu/include/hikyuu/indicator/imp/IQuantileTrunc.h +25 -0
  103. hikyuu/include/hikyuu/lang.h +15 -2
  104. hikyuu/include/hikyuu/misc.h +38 -0
  105. hikyuu/include/hikyuu/plugin/dataserver.h +2 -1
  106. hikyuu/include/hikyuu/plugin/extind.h +37 -0
  107. hikyuu/include/hikyuu/plugin/hkuextra.h +0 -18
  108. hikyuu/include/hikyuu/plugin/hkuviews.h +36 -0
  109. hikyuu/include/hikyuu/plugin/interface/DataServerPluginInterface.h +2 -2
  110. hikyuu/include/hikyuu/plugin/interface/ExtendIndicatorsPluginInterface.h +12 -0
  111. hikyuu/include/hikyuu/plugin/interface/HkuExtraPluginInterface.h +0 -14
  112. hikyuu/include/hikyuu/plugin/interface/HkuViewsPluginInterface.h +34 -0
  113. hikyuu/include/hikyuu/plugin/interface/plugins.h +8 -1
  114. hikyuu/include/hikyuu/python/pybind_utils.h +8 -3
  115. hikyuu/include/hikyuu/strategy/RunSystemInStrategy.h +3 -0
  116. hikyuu/include/hikyuu/trade_manage/Performance.h +4 -4
  117. hikyuu/include/hikyuu/trade_manage/TradeManagerBase.h +10 -1
  118. hikyuu/include/hikyuu/trade_sys/moneymanager/imp/FixedCapitalFundsMM.h +0 -4
  119. hikyuu/include/hikyuu/trade_sys/multifactor/MultiFactorBase.h +36 -3
  120. hikyuu/include/hikyuu/trade_sys/multifactor/NormalizeBase.h +125 -0
  121. hikyuu/include/hikyuu/trade_sys/multifactor/ScoresFilterBase.h +125 -0
  122. hikyuu/include/hikyuu/trade_sys/multifactor/build_in.h +3 -0
  123. hikyuu/include/hikyuu/trade_sys/multifactor/buildin_norm.h +36 -0
  124. hikyuu/include/hikyuu/trade_sys/multifactor/buildin_scfilter.h +51 -0
  125. hikyuu/include/hikyuu/trade_sys/multifactor/filter/GroupSCFilter.h +24 -0
  126. hikyuu/include/hikyuu/trade_sys/multifactor/filter/IgnoreLessOrEqualValueSCFilter.h +24 -0
  127. hikyuu/include/hikyuu/trade_sys/multifactor/filter/IgnoreNanSCFilter.h +24 -0
  128. hikyuu/include/hikyuu/trade_sys/multifactor/filter/MinAmountPercentSCFilter.h +25 -0
  129. hikyuu/include/hikyuu/trade_sys/multifactor/filter/PriceSCFilter.h +24 -0
  130. hikyuu/include/hikyuu/trade_sys/multifactor/filter/TopNSCFilter.h +24 -0
  131. hikyuu/include/hikyuu/trade_sys/multifactor/filter/__init__.py +1 -0
  132. hikyuu/include/hikyuu/trade_sys/multifactor/imp/EqualWeightMultiFactor.h +1 -1
  133. hikyuu/include/hikyuu/trade_sys/multifactor/imp/ICIRMultiFactor.h +1 -1
  134. hikyuu/include/hikyuu/trade_sys/multifactor/imp/ICMultiFactor.h +1 -1
  135. hikyuu/include/hikyuu/trade_sys/multifactor/imp/WeightMultiFactor.h +1 -1
  136. hikyuu/include/hikyuu/trade_sys/multifactor/normalize/NormMinMax.h +23 -0
  137. hikyuu/include/hikyuu/trade_sys/multifactor/normalize/NormQuantile.h +28 -0
  138. hikyuu/include/hikyuu/trade_sys/multifactor/normalize/NormQuantileUniform.h +28 -0
  139. hikyuu/include/hikyuu/trade_sys/multifactor/normalize/NormZScore.h +25 -0
  140. hikyuu/include/hikyuu/trade_sys/multifactor/normalize/__init__.py +1 -0
  141. hikyuu/include/hikyuu/trade_sys/multifactor/normalize/quantile_trunc.h +16 -0
  142. hikyuu/include/hikyuu/trade_sys/portfolio/Portfolio.h +7 -0
  143. hikyuu/include/hikyuu/trade_sys/portfolio/imp/SimplePortfolio.h +7 -0
  144. hikyuu/include/hikyuu/trade_sys/portfolio/imp/WithoutAFPortfolio.h +7 -0
  145. hikyuu/include/hikyuu/trade_sys/selector/SelectorBase.h +49 -0
  146. hikyuu/include/hikyuu/trade_sys/selector/build_in.h +1 -0
  147. hikyuu/include/hikyuu/trade_sys/selector/crt/SE_MultiFactor2.h +40 -0
  148. hikyuu/include/hikyuu/trade_sys/selector/imp/MultiFactorSelector.h +0 -3
  149. hikyuu/include/hikyuu/trade_sys/selector/imp/MultiFactorSelector2.h +49 -0
  150. hikyuu/include/hikyuu/trade_sys/selector/imp/logic/OperatorSelector.h +1 -1
  151. hikyuu/include/hikyuu/trade_sys/selector/imp/logic/OperatorValueSelector.h +1 -1
  152. hikyuu/include/hikyuu/trade_sys/signal/imp/BandSignal2.h +0 -4
  153. hikyuu/include/hikyuu/trade_sys/signal/imp/logic/AddValueSignal.h +2 -2
  154. hikyuu/include/hikyuu/trade_sys/signal/imp/logic/DivValueSignal.h +2 -2
  155. hikyuu/include/hikyuu/trade_sys/signal/imp/logic/MulValueSignal.h +2 -2
  156. hikyuu/include/hikyuu/trade_sys/signal/imp/logic/OperatorSignal.h +1 -1
  157. hikyuu/include/hikyuu/trade_sys/signal/imp/logic/OperatorValueSignal.h +4 -4
  158. hikyuu/include/hikyuu/trade_sys/signal/imp/logic/SubValueSignal.h +2 -2
  159. hikyuu/include/hikyuu/trade_sys/system/System.h +14 -1
  160. hikyuu/include/hikyuu/utilities/SpendTimer.h +17 -7
  161. hikyuu/include/hikyuu/utilities/arithmetic.h +55 -0
  162. hikyuu/include/hikyuu/utilities/db_connect/mysql/MySQLConnect.h +1 -1
  163. hikyuu/include/hikyuu/utilities/db_connect/mysql/MySQLStatement.h +1 -1
  164. hikyuu/include/hikyuu/utilities/db_connect/sqlite/SQLiteConnect.h +1 -1
  165. hikyuu/include/hikyuu/utilities/db_connect/sqlite/SQLiteStatement.h +1 -1
  166. hikyuu/include/hikyuu/utilities/plugin/PluginLoader.h +4 -1
  167. hikyuu/include/hikyuu/version.h +4 -4
  168. hikyuu/plugin/libbacktest.so +0 -0
  169. hikyuu/plugin/libclickhousedriver.so +0 -0
  170. hikyuu/plugin/libdataserver.so +0 -0
  171. hikyuu/plugin/libdevice.so +0 -0
  172. hikyuu/plugin/libextind.so +0 -0
  173. hikyuu/plugin/libhkuextra.so +0 -0
  174. hikyuu/plugin/libhkuviews.so +0 -0
  175. hikyuu/plugin/libimport2hdf5.so +0 -0
  176. hikyuu/plugin/libtmreport.so +0 -0
  177. hikyuu/trade_manage/__init__.pyi +602 -577
  178. hikyuu/trade_manage/broker.pyi +3 -3
  179. hikyuu/trade_manage/broker_easytrader.pyi +1 -1
  180. hikyuu/trade_manage/trade.pyi +602 -577
  181. hikyuu/util/__init__.pyi +1 -1
  182. hikyuu/util/singleton.pyi +1 -1
  183. {hikyuu-2.6.8.3.dist-info → hikyuu-2.6.9.dist-info}/METADATA +13 -13
  184. {hikyuu-2.6.8.3.dist-info → hikyuu-2.6.9.dist-info}/RECORD +187 -158
  185. {hikyuu-2.6.8.3.dist-info → hikyuu-2.6.9.dist-info}/top_level.txt +2 -1
  186. hikyuu/cpp/core39.pyi +0 -14385
  187. hikyuu/cpp/core39.so +0 -0
  188. hikyuu/data_driver/__init__.py +0 -49
  189. hikyuu/data_driver/jqdata_data_driver.py +0 -277
  190. hikyuu/data_driver/pytdx_data_driver.py +0 -292
  191. hikyuu/fetcher/stock/zh_stock_a_huatai.py +0 -51
  192. hikyuu/fetcher/stock/zh_stock_a_pytdx.py +0 -129
  193. hikyuu/gui/data/CollectToMemThread.py +0 -123
  194. hikyuu/gui/data/CollectToMySQLThread.py +0 -178
  195. hikyuu/gui/start_huatai_insight.py +0 -510
  196. hikyuu/tools/update_block_info.py +0 -168
  197. {hikyuu-2.6.8.3.dist-info → hikyuu-2.6.9.dist-info}/WHEEL +0 -0
  198. {hikyuu-2.6.8.3.dist-info → hikyuu-2.6.9.dist-info}/entry_points.txt +0 -0
@@ -6,14 +6,14 @@ import logging
6
6
  import time
7
7
  import datetime
8
8
  from math import ceil
9
- from PyQt5.QtCore import QThread, QWaitCondition, QMutex, pyqtSignal
9
+ from PySide6.QtCore import QThread, QWaitCondition, QMutex, Signal
10
10
 
11
11
  from hikyuu.util import *
12
12
  from hikyuu import Datetime, TimeDelta
13
13
 
14
14
 
15
15
  class SchedImportThread(QThread):
16
- message = pyqtSignal()
16
+ message = Signal()
17
17
 
18
18
  def __init__(self, config):
19
19
  super(self.__class__, self).__init__()
@@ -28,7 +28,7 @@ import datetime
28
28
  import mysql.connector
29
29
  import queue
30
30
  from multiprocessing import Queue, Process
31
- from PyQt5.QtCore import QThread, pyqtSignal
31
+ from PySide6.QtCore import QThread, Signal
32
32
  from hikyuu.gui.data.ImportWeightToSqliteTask import ImportWeightToSqliteTask
33
33
  from hikyuu.gui.data.ImportPytdxToH5Task import ImportPytdxToH5
34
34
  from hikyuu.gui.data.ImportPytdxTransToH5Task import ImportPytdxTransToH5
@@ -58,7 +58,7 @@ from hikyuu.util.mylog import class_logger
58
58
 
59
59
 
60
60
  class UsePytdxImportToH5Thread(QThread):
61
- message = pyqtSignal(list)
61
+ message = Signal(list)
62
62
 
63
63
  def __init__(self, parent, config):
64
64
  super(UsePytdxImportToH5Thread, self).__init__()
@@ -98,7 +98,7 @@ class UsePytdxImportToH5Thread(QThread):
98
98
 
99
99
  if self.config.getboolean('block', 'enable', fallback=True):
100
100
  self.tasks.append(ImportBlockInfoTask(self.log_queue, self.queue,
101
- self.config, ('行业板块', '指数板块'))) # '概念板块', '地域板块',
101
+ self.config)) # '概念板块', '地域板块',
102
102
 
103
103
  self.tasks.append(ImportZhBond10Task(self.log_queue, self.queue, self.config))
104
104
 
@@ -28,7 +28,7 @@ import datetime
28
28
  import mysql.connector
29
29
  import queue
30
30
  from multiprocessing import Queue, Process
31
- from PyQt5.QtCore import QThread, pyqtSignal
31
+ from PySide6.QtCore import QThread, Signal
32
32
  from hikyuu.gui.data.ImportQmtToH5Task import ImportQmtToH5Task
33
33
  from hikyuu.gui.data.ImportWeightToSqliteTask import ImportWeightToSqliteTask
34
34
  from hikyuu.gui.data.ImportQmtToH5Task import ImportQmtToH5Task
@@ -51,7 +51,7 @@ from hikyuu.util.mylog import class_logger
51
51
 
52
52
 
53
53
  class UseQmtImportToH5Thread(QThread):
54
- message = pyqtSignal(list)
54
+ message = Signal(list)
55
55
 
56
56
  def __init__(self, parent, config):
57
57
  super(UseQmtImportToH5Thread, self).__init__()
@@ -28,7 +28,7 @@ import datetime
28
28
  import mysql.connector
29
29
  import queue
30
30
  from multiprocessing import Queue, Process
31
- from PyQt5.QtCore import QThread, pyqtSignal
31
+ from PySide6.QtCore import QThread, Signal
32
32
  from hikyuu.gui.data.ImportTdxToH5Task import ImportTdxToH5Task
33
33
  from hikyuu.gui.data.ImportWeightToSqliteTask import ImportWeightToSqliteTask
34
34
  from hikyuu.gui.data.ImportTdxToH5Task import ImportTdxToH5Task
@@ -55,7 +55,7 @@ from hikyuu.util.mylog import class_logger
55
55
 
56
56
 
57
57
  class UseTdxImportToH5Thread(QThread):
58
- message = pyqtSignal(list)
58
+ message = Signal(list)
59
59
 
60
60
  def __init__(self, parent, config):
61
61
  super(UseTdxImportToH5Thread, self).__init__()
@@ -95,7 +95,7 @@ class UseTdxImportToH5Thread(QThread):
95
95
  ImportHistoryFinanceTask(self.log_queue, self.queue, self.config, dest_dir))
96
96
 
97
97
  self.tasks.append(ImportBlockInfoTask(self.log_queue, self.queue,
98
- self.config, ('行业板块', '指数板块'))) # '概念板块', '地域板块'
98
+ self.config)) # '概念板块', '地域板块'
99
99
  self.tasks.append(ImportZhBond10Task(self.log_queue, self.queue, self.config))
100
100
 
101
101
  task_count = 0
hikyuu/gui/data/tool.py CHANGED
@@ -6,38 +6,45 @@
6
6
 
7
7
  '''
8
8
 
9
- import os
10
- import os.path
9
+ import os
10
+ import os.path
11
11
 
12
- # UI文件所在的路径
13
- dir = './'
12
+ # UI文件所在的路径
13
+ dir = './'
14
14
 
15
15
  # 列出目录下的所有ui文件
16
- def listUiFile():
17
- list = []
18
- files = os.listdir(dir)
19
- for filename in files:
20
- #print( dir + os.sep + f )
21
- #print(filename)
22
- if os.path.splitext(filename)[1] == '.ui':
23
- list.append(filename)
24
-
25
- return list
26
-
27
- # 把后缀为ui的文件改成后缀为py的文件名
28
- def transPyFile(filename):
29
- return os.path.splitext(filename)[0] + '.py'
16
+
17
+
18
+ def listUiFile():
19
+ list = []
20
+ files = os.listdir(dir)
21
+ for filename in files:
22
+ # print( dir + os.sep + f )
23
+ # print(filename)
24
+ if os.path.splitext(filename)[1] == '.ui':
25
+ list.append(filename)
26
+
27
+ return list
28
+
29
+ # 把后缀为ui的文件改成后缀为py的文件名
30
+
31
+
32
+ def transPyFile(filename):
33
+ return os.path.splitext(filename)[0] + '.py'
30
34
 
31
35
  # 调用系统命令把ui转换成py
36
+
37
+
32
38
  def runMain():
33
39
  list = listUiFile()
34
- for uifile in list :
40
+ for uifile in list:
35
41
  pyfile = transPyFile(uifile)
36
- cmd = 'pyuic5 -o {pyfile} {uifile}'.format(pyfile=pyfile,uifile=uifile)
37
- #cmd = 'pyside2-uic -o {pyfile} {uifile}'.format(pyfile=pyfile, uifile=uifile)
38
- #print(cmd)
42
+ cmd = 'pyside6-uic -o {pyfile} {uifile}'.format(pyfile=pyfile, uifile=uifile)
43
+ # cmd = 'pyside2-uic -o {pyfile} {uifile}'.format(pyfile=pyfile, uifile=uifile)
44
+ # print(cmd)
39
45
  os.system(cmd)
40
46
 
41
- ###### 程序的主入口
42
- if __name__ == "__main__":
43
- runMain()
47
+
48
+ # 程序的主入口
49
+ if __name__ == "__main__":
50
+ runMain()
hikyuu/gui/dataserver.py CHANGED
@@ -11,13 +11,15 @@ import click
11
11
 
12
12
 
13
13
  @click.command()
14
- @click.option('--addr', '-addr', default="tcp://127.0.0.1:9201", help='行情接收处理服务地址')
14
+ @click.option('--addr', '-addr', default="tcp://0.0.0.0:9201", help='自身对外提供的服务地址, 如需外部机器访问,请使用 tcp://0.0.0.0:port')
15
15
  @click.option('--work_num', '-n', default=2, type=int, help='行情接收处理线程数')
16
16
  @click.option('--save', '-save', default=False, type=bool, help='保存行情数据(仅支持clickhouse)')
17
17
  @click.option('--buf', '-buf', default=False, type=bool, help='缓存行情数据')
18
- def main(addr, work_num, save, buf):
18
+ @click.option('--parquet_path', '-parquet_path', default="", help='Parquet 文件存储路径, 空字符串表示不保存')
19
+ def main(addr, work_num, save, buf, parquet_path):
20
+ # 如需其他机器访问,addr 参数需为 tcp://0.0.0.0:port
19
21
  try:
20
- start_data_server(addr, work_num, save_tick=save, buf_tick=buf)
22
+ start_data_server(addr, work_num, save_tick=save, buf_tick=buf, parquet_path=parquet_path)
21
23
 
22
24
  while True:
23
25
  try:
hikyuu/gui/importdata.py CHANGED
@@ -9,6 +9,7 @@ from configparser import ConfigParser
9
9
 
10
10
  from hikyuu.data.weight_to_sqlite import qianlong_import_weight
11
11
  from hikyuu.data.common_pytdx import search_best_tdx
12
+ from hikyuu.data.hku_config_template import generate_default_config
12
13
 
13
14
  from hikyuu.gui.data.UseTdxImportToH5Thread import UseTdxImportToH5Thread
14
15
  from hikyuu.gui.data.UsePytdxImportToH5Thread import UsePytdxImportToH5Thread
@@ -26,7 +27,10 @@ class HKUImportDataCMD:
26
27
  # 读取保存的配置文件信息,如果不存在,则使用默认配置
27
28
  this_dir = self.getUserConfigDir()
28
29
  import_config = ConfigParser()
30
+ if not os.path.exists(this_dir + '/importdata-gui.ini'):
31
+ generate_default_config()
29
32
  import_config.read(this_dir + '/importdata-gui.ini', encoding='utf-8')
33
+
30
34
  if self.ignore_kdata:
31
35
  import_config.set('ktype', 'day', 'False')
32
36
  import_config.set('ktype', 'min', 'False')
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 0x7a63e421e280; ConfigModel>
31
+ __mapper__: typing.ClassVar[sqlalchemy.orm.mapper.Mapper] # value = <Mapper at 0x7bbd398bfbb0; 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 7a63e42054a0>
35
+ _sa_class_manager: typing.ClassVar[sqlalchemy.orm.instrumentation.ClassManager] # value = <ClassManager of <class 'hikyuu.hub.ConfigModel'> at 7bbd398da340>
36
36
  def __init__(self, **kwargs):
37
37
  """
38
38
  A simple constructor that allows initialization from kwargs.
@@ -109,11 +109,11 @@ class HubManager:
109
109
  def print_part_info(self, name):
110
110
  ...
111
111
  class HubModel(sqlalchemy.orm.decl_api.Base):
112
- __mapper__: typing.ClassVar[sqlalchemy.orm.mapper.Mapper] # value = <Mapper at 0x7a63e421edc0; HubModel>
112
+ __mapper__: typing.ClassVar[sqlalchemy.orm.mapper.Mapper] # value = <Mapper at 0x7bbd39904340; HubModel>
113
113
  __table__: typing.ClassVar[sqlalchemy.sql.schema.Table] # value = Table('hub_repo', MetaData(), Column('id', Integer(), table=<hub_repo>, primary_key=True, nullable=False, default=Sequence('remote_id_seq', metadata=MetaData())), Column('name', String(), table=<hub_repo>), Column('hub_type', String(), table=<hub_repo>), Column('local_base', String(), table=<hub_repo>), Column('local', String(), table=<hub_repo>), Column('url', String(), table=<hub_repo>), Column('branch', String(), table=<hub_repo>), schema=None)
114
114
  __table_args__: typing.ClassVar[tuple] # value = (UniqueConstraint(Column('name', String(), table=<hub_repo>)))
115
115
  __tablename__: typing.ClassVar[str] = 'hub_repo'
116
- _sa_class_manager: typing.ClassVar[sqlalchemy.orm.instrumentation.ClassManager] # value = <ClassManager of <class 'hikyuu.hub.HubModel'> at 7a646ffc0bd0>
116
+ _sa_class_manager: typing.ClassVar[sqlalchemy.orm.instrumentation.ClassManager] # value = <ClassManager of <class 'hikyuu.hub.HubModel'> at 7bbd398fed40>
117
117
  def __init__(self, **kwargs):
118
118
  """
119
119
  A simple constructor that allows initialization from kwargs.
@@ -146,11 +146,11 @@ class ModuleConflictError(Exception):
146
146
  def __str__(self):
147
147
  ...
148
148
  class PartModel(sqlalchemy.orm.decl_api.Base):
149
- __mapper__: typing.ClassVar[sqlalchemy.orm.mapper.Mapper] # value = <Mapper at 0x7a646ffd2520; PartModel>
149
+ __mapper__: typing.ClassVar[sqlalchemy.orm.mapper.Mapper] # value = <Mapper at 0x7bbd39905060; PartModel>
150
150
  __table__: typing.ClassVar[sqlalchemy.sql.schema.Table] # value = Table('hub_part', MetaData(), Column('id', Integer(), table=<hub_part>, primary_key=True, nullable=False, default=Sequence('part_id_seq', metadata=MetaData())), Column('hub_name', String(), table=<hub_part>), Column('part', String(), table=<hub_part>), Column('name', String(), table=<hub_part>), Column('author', String(), table=<hub_part>), Column('version', String(), table=<hub_part>), Column('doc', String(), table=<hub_part>), Column('module_name', String(), table=<hub_part>), Column('label', String(), table=<hub_part>), schema=None)
151
151
  __table_args__: typing.ClassVar[tuple] # value = (UniqueConstraint(Column('name', String(), table=<hub_part>)))
152
152
  __tablename__: typing.ClassVar[str] = 'hub_part'
153
- _sa_class_manager: typing.ClassVar[sqlalchemy.orm.instrumentation.ClassManager] # value = <ClassManager of <class 'hikyuu.hub.PartModel'> at 7a646ffcd680>
153
+ _sa_class_manager: typing.ClassVar[sqlalchemy.orm.instrumentation.ClassManager] # value = <ClassManager of <class 'hikyuu.hub.PartModel'> at 7bbd398ffd30>
154
154
  def __init__(self, **kwargs):
155
155
  """
156
156
  A simple constructor that allows initialization from kwargs.
@@ -42,6 +42,10 @@
42
42
  #include "utilities/config.h"
43
43
  #include "lang.h"
44
44
 
45
+ #if HKU_OS_OSX
46
+ #include <MacTypes.h>
47
+ #endif
48
+
45
49
  #if HKU_SUPPORT_SERIALIZATION
46
50
  #include <boost/serialization/nvp.hpp>
47
51
  #include <boost/serialization/split_free.hpp>
@@ -156,22 +160,6 @@ inline bool iszero(price_t num) {
156
160
 
157
161
  using fmt::format;
158
162
 
159
- inline std::ostream &operator<<(std::ostream &os, const PriceList &p) {
160
- size_t len = p.size();
161
- const size_t print = 3;
162
- os << "[";
163
- for (size_t i = 0; i < len; i++) {
164
- if ((i < print) || (i >= len - print)) {
165
- os << p[i];
166
- if (i != len - 1)
167
- os << ", ";
168
- } else if (i == 3)
169
- os << "..., ";
170
- }
171
- os << "]";
172
- return os;
173
- }
174
-
175
163
  /** @} */
176
164
 
177
165
  } // namespace hku
@@ -191,7 +191,10 @@ public:
191
191
  }
192
192
 
193
193
  private:
194
- static shared_ptr<KDataImp> ms_null_kdata_imp;
194
+ std::shared_ptr<KDataImp>& get_null_kdata_imp() {
195
+ static std::shared_ptr<KDataImp> instance = std::make_shared<KDataImp>(); // 第一次调用时初始化
196
+ return instance;
197
+ }
195
198
 
196
199
  private:
197
200
  KDataImpPtr m_imp;
@@ -249,7 +252,7 @@ KData HKU_API getKData(const string& market_code, int64_t start = 0, int64_t end
249
252
  inline KData::KData(const KData& x) : m_imp(x.m_imp) {}
250
253
 
251
254
  inline KData::KData(KData&& x) : m_imp(std::move(x.m_imp)) {
252
- x.m_imp = ms_null_kdata_imp;
255
+ x.m_imp = get_null_kdata_imp();
253
256
  }
254
257
 
255
258
  inline KData& KData::operator=(const KData& x) {
@@ -263,7 +266,7 @@ inline KData& KData::operator=(KData&& x) {
263
266
  if (this == &x)
264
267
  return *this;
265
268
  m_imp = std::move(x.m_imp);
266
- x.m_imp = ms_null_kdata_imp;
269
+ x.m_imp = get_null_kdata_imp();
267
270
  return *this;
268
271
  }
269
272
 
@@ -15,7 +15,7 @@ class HKU_API KDataPrivatedBufferImp : public KDataImp {
15
15
  public:
16
16
  KDataPrivatedBufferImp();
17
17
  KDataPrivatedBufferImp(const Stock& stock, const KQuery& query);
18
- virtual ~KDataPrivatedBufferImp();
18
+ virtual ~KDataPrivatedBufferImp() override;
19
19
 
20
20
  virtual bool empty() const override {
21
21
  return m_buffer.empty();
@@ -15,7 +15,7 @@ class HKU_API KDataSharedBufferImp : public KDataImp {
15
15
  public:
16
16
  KDataSharedBufferImp() = default;
17
17
  KDataSharedBufferImp(const Stock& stock, const KQuery& query);
18
- virtual ~KDataSharedBufferImp();
18
+ virtual ~KDataSharedBufferImp() override;
19
19
 
20
20
  virtual bool empty() const override {
21
21
  return m_size == 0;
@@ -157,7 +157,7 @@ public:
157
157
 
158
158
  /** 获取K线数据类型 */
159
159
  // KType kType() const { return m_dataType; }
160
- string kType() const {
160
+ const string& kType() const {
161
161
  return m_dataType;
162
162
  }
163
163
 
@@ -191,7 +191,7 @@ public:
191
191
  static string getQueryTypeName(QueryType);
192
192
 
193
193
  /** 获取KType名称,用于显示输出 */
194
- static string getKTypeName(KType);
194
+ static string getKTypeName(const KType&);
195
195
 
196
196
  /** 获取recoverType名称,用于显示输出 */
197
197
  static string getRecoverTypeName(RecoverType);
@@ -276,6 +276,9 @@ private:
276
276
 
277
277
  bool isPreload(KQuery::KType ktype) const;
278
278
 
279
+ void loadKDataToBufferFromKRecordList(const KQuery::KType& ktype, KRecordList&& ks) const;
280
+ void setHistoryFinance(vector<HistoryFinanceInfo>&&);
281
+
279
282
  private:
280
283
  struct HKU_API Data;
281
284
  shared_ptr<Data> m_data;
@@ -130,6 +130,9 @@ public:
130
130
  /** 获取市场简称列表 */
131
131
  StringList getAllMarket() const;
132
132
 
133
+ /** 获取所有板块分类 */
134
+ StringList getAllCategory();
135
+
133
136
  /**
134
137
  * 获取预定义的板块
135
138
  * @param category 板块分类
@@ -265,6 +268,11 @@ public:
265
268
  /** 设置多语言支持路径(仅在初始化之前有效) */
266
269
  void setLanguagePath(const std::string& path);
267
270
 
271
+ /** 取消加载,退出时使用 */
272
+ void cancelLoad() {
273
+ m_cancel_load = true;
274
+ }
275
+
268
276
  public:
269
277
  typedef StockMapIterator const_iterator;
270
278
  const_iterator begin() const {
@@ -280,6 +288,7 @@ private:
280
288
 
281
289
  /* 加载 K线数据至缓存 */
282
290
  void loadAllKData();
291
+ std::unordered_set<string> tryLoadAllKDataFromColumnFirst(const vector<KQuery::KType>& ktypes);
283
292
 
284
293
  /* 加载节假日信息 */
285
294
  void loadAllHolidays();
@@ -307,9 +316,10 @@ private:
307
316
 
308
317
  private:
309
318
  static StockManager* m_sm;
310
- std::atomic_bool m_initializing;
311
- std::atomic_bool m_data_ready; // 用于指示是否所有数据准备完毕
312
- std::thread::id m_thread_id; // 记录线程id,用于判断Stratege是以独立进程方式还是线程方式运行
319
+ std::atomic_bool m_initializing{false};
320
+ std::atomic_bool m_cancel_load{false}; // 取消加载, 用于退出指示
321
+ std::atomic_bool m_data_ready{false}; // 用于指示是否所有数据准备完毕
322
+ std::thread::id m_thread_id; // 记录线程id,用于判断Stratege是以独立进程方式还是线程方式运行
313
323
  string m_tmpdir;
314
324
  string m_datadir;
315
325
  BaseInfoDriverPtr m_baseInfoDriver;
@@ -46,6 +46,9 @@
46
46
  // 使用 TA-Lib
47
47
  #define HKU_ENABLE_TA_LIB 1
48
48
 
49
+ // 使用 Arrow
50
+ #define HKU_ENABLE_ARROW 1
51
+
49
52
  // clang-format on
50
53
 
51
54
  #endif /* HIKYUU_CONFIG_H_ */
@@ -216,6 +216,14 @@ public:
216
216
  */
217
217
  virtual ZhBond10List getAllZhBond10() = 0;
218
218
 
219
+ /**
220
+ * 获取所有历史财务信息, 用于列式存储时数据初始化使用
221
+ */
222
+ virtual unordered_map<string, vector<HistoryFinanceInfo>> getAllHistoryFinance() {
223
+ HKU_ERROR("Not support getAllHistoryFinance()!");
224
+ return unordered_map<string, vector<HistoryFinanceInfo>>();
225
+ }
226
+
219
227
  private:
220
228
  bool checkType();
221
229
 
@@ -53,6 +53,12 @@ public:
53
53
  */
54
54
  virtual bool _init() = 0;
55
55
 
56
+ /**
57
+ * 获取所有板块分类
58
+ * @return StringList
59
+ */
60
+ virtual StringList getAllCategory() = 0;
61
+
56
62
  /**
57
63
  * 获取指定的板块
58
64
  * @param category 指定的板块分类
@@ -119,6 +119,21 @@ public:
119
119
  */
120
120
  virtual TransList getTransList(const string& market, const string& code, const KQuery& query);
121
121
 
122
+ //---------------------------------------------------
123
+ // 以下为列式数据库接口
124
+ //---------------------------------------------------
125
+
126
+ /** 是否列优先(列数据库存储K线数据) */
127
+ virtual bool isColumnFirst() const {
128
+ return false;
129
+ }
130
+
131
+ virtual std::unordered_map<std::string, KRecordList> getAllKRecordList(
132
+ const KQuery::KType& ktype, const Datetime& start_date,
133
+ const std::atomic<bool>& cancel_flag) {
134
+ HKU_THROW("Not support getAllKRecordList");
135
+ }
136
+
122
137
  protected:
123
138
  virtual bool isPythonObject() const {
124
139
  return false;
@@ -169,7 +184,7 @@ public:
169
184
  return m_driver->canParallelLoad();
170
185
  }
171
186
 
172
- size_t getCount(const string& market, const string& code, KQuery::KType kType) {
187
+ size_t getCount(const string& market, const string& code, const KQuery::KType& kType) {
173
188
  return m_driver->getCount(market, code, kType);
174
189
  }
175
190
 
@@ -190,6 +205,16 @@ public:
190
205
  return m_driver->getTransList(market, code, query);
191
206
  }
192
207
 
208
+ bool isColumnFirst() const {
209
+ return m_driver->isColumnFirst();
210
+ }
211
+
212
+ std::unordered_map<std::string, KRecordList> getAllKRecordList(
213
+ const KQuery::KType& ktype, const Datetime& start_date,
214
+ const std::atomic<bool>& cancel_flag) {
215
+ return m_driver->getAllKRecordList(ktype, start_date, cancel_flag);
216
+ }
217
+
193
218
  private:
194
219
  KDataDriverPtr m_driver;
195
220
  };
@@ -24,7 +24,7 @@ namespace hku {
24
24
  class MySQLBaseInfoDriver : public BaseInfoDriver {
25
25
  public:
26
26
  MySQLBaseInfoDriver();
27
- virtual ~MySQLBaseInfoDriver();
27
+ virtual ~MySQLBaseInfoDriver() override;
28
28
 
29
29
  virtual bool _init() override;
30
30
  virtual vector<StockInfo> getAllStockInfo() override;
@@ -20,7 +20,7 @@ namespace hku {
20
20
  class SQLiteBaseInfoDriver : public BaseInfoDriver {
21
21
  public:
22
22
  SQLiteBaseInfoDriver();
23
- virtual ~SQLiteBaseInfoDriver();
23
+ virtual ~SQLiteBaseInfoDriver() override;
24
24
 
25
25
  virtual bool _init() override;
26
26
  virtual vector<MarketInfo> getAllMarketInfo() override;
@@ -15,10 +15,11 @@ namespace hku {
15
15
  class MySQLBlockInfoDriver : public BlockInfoDriver {
16
16
  public:
17
17
  MySQLBlockInfoDriver() : BlockInfoDriver("mysql") {};
18
- virtual ~MySQLBlockInfoDriver();
18
+ virtual ~MySQLBlockInfoDriver() override;
19
19
 
20
20
  virtual void load() override;
21
21
  virtual bool _init() override;
22
+ virtual StringList getAllCategory() override;
22
23
  virtual Block getBlock(const string&, const string&) override;
23
24
  virtual BlockList getBlockList(const string& category) override;
24
25
  virtual BlockList getBlockList() override;
@@ -16,9 +16,10 @@ namespace hku {
16
16
  class QLBlockInfoDriver : public BlockInfoDriver {
17
17
  public:
18
18
  QLBlockInfoDriver() : BlockInfoDriver("qianlong") {};
19
- virtual ~QLBlockInfoDriver();
19
+ virtual ~QLBlockInfoDriver() override;
20
20
 
21
21
  virtual bool _init() override;
22
+ virtual StringList getAllCategory() override;
22
23
  virtual Block getBlock(const string&, const string&) override;
23
24
  virtual BlockList getBlockList(const string& category) override;
24
25
  virtual BlockList getBlockList() override;
@@ -15,10 +15,11 @@ namespace hku {
15
15
  class SQLiteBlockInfoDriver : public BlockInfoDriver {
16
16
  public:
17
17
  SQLiteBlockInfoDriver() : BlockInfoDriver("sqlite3") {};
18
- virtual ~SQLiteBlockInfoDriver();
18
+ virtual ~SQLiteBlockInfoDriver() override;
19
19
 
20
20
  virtual void load() override;
21
21
  virtual bool _init() override;
22
+ virtual StringList getAllCategory() override;
22
23
  virtual Block getBlock(const string&, const string&) override;
23
24
  virtual BlockList getBlockList(const string& category) override;
24
25
  virtual BlockList getBlockList() override;
@@ -15,7 +15,7 @@ namespace hku {
15
15
  class DoNothingKDataDriver : public KDataDriver {
16
16
  public:
17
17
  DoNothingKDataDriver() : KDataDriver("DoNothing") {}
18
- virtual ~DoNothingKDataDriver() = default;
18
+ virtual ~DoNothingKDataDriver() override = default;
19
19
 
20
20
  virtual KDataDriverPtr _clone() override {
21
21
  return std::make_shared<DoNothingKDataDriver>();
@@ -21,7 +21,7 @@ class KDataTempCsvDriver : public KDataDriver {
21
21
  public:
22
22
  KDataTempCsvDriver();
23
23
  KDataTempCsvDriver(const string& day_filename, const string& min_filename);
24
- virtual ~KDataTempCsvDriver();
24
+ virtual ~KDataTempCsvDriver() override;
25
25
 
26
26
  void setDayFileName(const string& day_filename) {
27
27
  m_day_filename = day_filename;
@@ -17,7 +17,7 @@ namespace hku {
17
17
  class HKU_API H5KDataDriver : public KDataDriver {
18
18
  public:
19
19
  H5KDataDriver();
20
- virtual ~H5KDataDriver();
20
+ virtual ~H5KDataDriver() override;
21
21
 
22
22
  virtual KDataDriverPtr _clone() override {
23
23
  return std::make_shared<H5KDataDriver>();
@@ -24,7 +24,7 @@ namespace hku {
24
24
  class MySQLKDataDriver : public KDataDriver {
25
25
  public:
26
26
  MySQLKDataDriver();
27
- virtual ~MySQLKDataDriver();
27
+ virtual ~MySQLKDataDriver() override;
28
28
 
29
29
  virtual KDataDriverPtr _clone() override {
30
30
  return std::make_shared<MySQLKDataDriver>();
@@ -17,7 +17,7 @@ namespace hku {
17
17
  class SQLiteKDataDriver : public KDataDriver {
18
18
  public:
19
19
  SQLiteKDataDriver();
20
- virtual ~SQLiteKDataDriver();
20
+ virtual ~SQLiteKDataDriver() override;
21
21
 
22
22
  virtual KDataDriverPtr _clone() override {
23
23
  return std::make_shared<SQLiteKDataDriver>();
@@ -16,7 +16,7 @@ namespace hku {
16
16
  class TdxKDataDriver : public KDataDriver {
17
17
  public:
18
18
  TdxKDataDriver();
19
- virtual ~TdxKDataDriver();
19
+ virtual ~TdxKDataDriver() override;
20
20
 
21
21
  virtual KDataDriverPtr _clone() override {
22
22
  return std::make_shared<TdxKDataDriver>();
@@ -13,10 +13,10 @@
13
13
  #include "Stock.h"
14
14
  #include "StockManager.h"
15
15
  #include "utilities/Parameter.h"
16
- #include "indicator/build_in.h"
17
16
  #include "trade_manage/build_in.h"
18
17
  #include "trade_sys/all.h"
19
18
  #include "strategy/Strategy.h"
19
+ #include "indicator/build_in.h"
20
20
 
21
21
  namespace hku {
22
22
 
@@ -129,5 +129,6 @@
129
129
  #include "crt/ZHBOND10.h"
130
130
  #include "crt/ZONGGUBEN.h"
131
131
  #include "crt/ZSCORE.h"
132
+ #include "crt/QUANTILE_TRUNC.h"
132
133
 
133
134
  #endif /* INDICATOR_BUILD_IN_H_ */