hikyuu 2.3.1__py3-none-win_amd64.whl → 2.5.1__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.
Files changed (157) hide show
  1. hikyuu/__init__.py +438 -6
  2. hikyuu/__init__.pyi +647 -496
  3. hikyuu/analysis/__init__.pyi +478 -466
  4. hikyuu/analysis/analysis.pyi +500 -486
  5. hikyuu/core.pyi +480 -468
  6. hikyuu/cpp/core310.pyd +0 -0
  7. hikyuu/cpp/core311.pyd +0 -0
  8. hikyuu/cpp/core312.pyd +0 -0
  9. hikyuu/cpp/core313.pyd +0 -0
  10. hikyuu/cpp/core38.pyd +0 -0
  11. hikyuu/cpp/core39.pyd +0 -0
  12. hikyuu/cpp/hikyuu.dll +0 -0
  13. hikyuu/cpp/hikyuu.lib +0 -0
  14. hikyuu/cpp/sqlite3.dll +0 -0
  15. hikyuu/data/common_mysql.py +24 -7
  16. hikyuu/data/common_pytdx.py +17 -1
  17. hikyuu/data/em_block_to_mysql.py +3 -2
  18. hikyuu/data/em_block_to_sqlite.py +8 -3
  19. hikyuu/data/mysql_upgrade/0026.sql +9 -0
  20. hikyuu/data/sqlite_upgrade/0026.sql +10 -0
  21. hikyuu/draw/__init__.pyi +35 -0
  22. hikyuu/draw/drawplot/__init__.pyi +134 -0
  23. hikyuu/draw/drawplot/bokeh_draw.pyi +796 -0
  24. hikyuu/draw/drawplot/common.pyi +10 -0
  25. hikyuu/draw/drawplot/echarts_draw.py +5 -12
  26. hikyuu/draw/drawplot/echarts_draw.pyi +682 -0
  27. hikyuu/draw/drawplot/matplotlib_draw.py +18 -3
  28. hikyuu/draw/drawplot/matplotlib_draw.pyi +1101 -0
  29. hikyuu/draw/elder.pyi +44 -0
  30. hikyuu/draw/kaufman.pyi +38 -0
  31. hikyuu/draw/volume.pyi +31 -0
  32. hikyuu/examples/notebook/Demo/Demo2.ipynb +1 -1
  33. hikyuu/extend.py +9 -3
  34. hikyuu/extend.pyi +524 -504
  35. hikyuu/fetcher/stock/zh_block_em.py +118 -51
  36. hikyuu/gui/data/EscapetimeThread.py +4 -4
  37. hikyuu/gui/data/ImportBlockInfoTask.py +3 -2
  38. hikyuu/gui/data/ImportHistoryFinanceTask.py +2 -0
  39. hikyuu/gui/data/MainWindow.py +48 -42
  40. hikyuu/gui/importdata.py +13 -26
  41. hikyuu/hub.py +2 -4
  42. hikyuu/hub.pyi +52 -58
  43. hikyuu/include/hikyuu/DataType.h +5 -0
  44. hikyuu/include/hikyuu/Stock.h +7 -0
  45. hikyuu/include/hikyuu/indicator/Indicator.h +1 -1
  46. hikyuu/include/hikyuu/indicator/Indicator2InImp.h +65 -0
  47. hikyuu/include/hikyuu/indicator/IndicatorImp.h +1 -3
  48. hikyuu/include/hikyuu/indicator/build_in.h +7 -0
  49. hikyuu/include/hikyuu/indicator/crt/COST.h +3 -0
  50. hikyuu/include/hikyuu/indicator/crt/CYCLE.h +24 -0
  51. hikyuu/include/hikyuu/indicator/crt/DISCARD.h +27 -0
  52. hikyuu/include/hikyuu/indicator/crt/HSL.h +1 -13
  53. hikyuu/include/hikyuu/indicator/crt/INBLOCK.h +31 -0
  54. hikyuu/include/hikyuu/indicator/crt/INDEX.h +35 -23
  55. hikyuu/include/hikyuu/indicator/crt/JUMPDOWN.h +24 -0
  56. hikyuu/include/hikyuu/indicator/crt/JUMPUP.h +24 -0
  57. hikyuu/include/hikyuu/indicator/crt/LASTVALUE.h +29 -0
  58. hikyuu/include/hikyuu/indicator/crt/LIUTONGPAN.h +1 -0
  59. hikyuu/include/hikyuu/indicator/crt/WINNER.h +38 -0
  60. hikyuu/include/hikyuu/indicator/imp/ICorr.h +6 -21
  61. hikyuu/include/hikyuu/indicator/imp/ICost.h +31 -0
  62. hikyuu/include/hikyuu/indicator/imp/ICycle.h +30 -0
  63. hikyuu/include/hikyuu/indicator/imp/IDiscard.h +28 -0
  64. hikyuu/include/hikyuu/indicator/imp/IDma.h +6 -23
  65. hikyuu/include/hikyuu/indicator/imp/IHsl.h +30 -0
  66. hikyuu/include/hikyuu/indicator/imp/IInBlock.h +30 -0
  67. hikyuu/include/hikyuu/indicator/imp/IIndex.h +26 -0
  68. hikyuu/include/hikyuu/indicator/imp/IJumpDown.h +24 -0
  69. hikyuu/include/hikyuu/indicator/imp/IJumpUp.h +24 -0
  70. hikyuu/include/hikyuu/indicator/imp/ILastValue.h +26 -0
  71. hikyuu/include/hikyuu/indicator/imp/ISpearman.h +5 -20
  72. hikyuu/include/hikyuu/indicator/imp/IWinner.h +26 -0
  73. hikyuu/include/hikyuu/indicator_talib/imp/TaMavp.h +5 -19
  74. hikyuu/include/hikyuu/indicator_talib/imp/ta_defines.h +12 -63
  75. hikyuu/include/hikyuu/indicator_talib/imp/ta_imp.h +7 -53
  76. hikyuu/include/hikyuu/strategy/RunPortfolioInStrategy.h +3 -4
  77. hikyuu/include/hikyuu/strategy/Strategy.h +4 -5
  78. hikyuu/include/hikyuu/trade_manage/TradeRecord.h +5 -1
  79. hikyuu/include/hikyuu/trade_sys/allocatefunds/build_in.h +1 -0
  80. hikyuu/include/hikyuu/trade_sys/allocatefunds/crt/AF_FixedWeightList.h +22 -0
  81. hikyuu/include/hikyuu/trade_sys/allocatefunds/imp/FixedWeightListAllocateFunds.h +25 -0
  82. hikyuu/include/hikyuu/trade_sys/moneymanager/MoneyManagerBase.h +17 -4
  83. hikyuu/include/hikyuu/trade_sys/moneymanager/build_in.h +2 -0
  84. hikyuu/include/hikyuu/trade_sys/moneymanager/crt/MM_FixedCapital.h +6 -0
  85. hikyuu/include/hikyuu/trade_sys/moneymanager/crt/MM_FixedCapitalFunds.h +26 -0
  86. hikyuu/include/hikyuu/trade_sys/moneymanager/crt/MM_FixedCountTps.h +27 -0
  87. hikyuu/include/hikyuu/trade_sys/moneymanager/crt/MM_FixedRisk.h +6 -0
  88. hikyuu/include/hikyuu/trade_sys/moneymanager/crt/MM_FixedUnits.h +6 -0
  89. hikyuu/include/hikyuu/trade_sys/moneymanager/crt/MM_WilliamsFixedRisk.h +7 -0
  90. hikyuu/include/hikyuu/trade_sys/moneymanager/imp/FixedCapitalFundsMM.h +28 -0
  91. hikyuu/include/hikyuu/trade_sys/moneymanager/imp/FixedCountTpsMM.h +44 -0
  92. hikyuu/include/hikyuu/trade_sys/portfolio/Portfolio.h +38 -37
  93. hikyuu/include/hikyuu/trade_sys/portfolio/build_in.h +1 -0
  94. hikyuu/include/hikyuu/trade_sys/portfolio/crt/PF_Simple.h +25 -1
  95. hikyuu/include/hikyuu/trade_sys/portfolio/crt/PF_WithoutAF.h +50 -0
  96. hikyuu/include/hikyuu/trade_sys/portfolio/imp/SimplePortfolio.h +53 -0
  97. hikyuu/include/hikyuu/trade_sys/portfolio/imp/WithoutAFPortfolio.h +57 -0
  98. hikyuu/include/hikyuu/trade_sys/selector/imp/MultiFactorSelector.h +7 -0
  99. hikyuu/include/hikyuu/trade_sys/signal/SignalBase.h +51 -5
  100. hikyuu/include/hikyuu/trade_sys/signal/build_in.h +2 -0
  101. hikyuu/include/hikyuu/trade_sys/signal/crt/SG_Bool.h +2 -1
  102. hikyuu/include/hikyuu/trade_sys/signal/crt/SG_Logic.h +37 -0
  103. hikyuu/include/hikyuu/trade_sys/signal/crt/SG_OneSide.h +28 -0
  104. hikyuu/include/hikyuu/trade_sys/signal/imp/OneSideSignal.h +46 -0
  105. hikyuu/include/hikyuu/trade_sys/signal/imp/logic/AddSignal.h +19 -0
  106. hikyuu/include/hikyuu/trade_sys/signal/imp/logic/AddValueSignal.h +19 -0
  107. hikyuu/include/hikyuu/trade_sys/signal/imp/logic/DivSignal.h +19 -0
  108. hikyuu/include/hikyuu/trade_sys/signal/imp/logic/DivValueSignal.h +22 -0
  109. hikyuu/include/hikyuu/trade_sys/signal/imp/logic/MulSignal.h +19 -0
  110. hikyuu/include/hikyuu/trade_sys/signal/imp/logic/MulValueSignal.h +19 -0
  111. hikyuu/include/hikyuu/trade_sys/signal/imp/logic/OperatorSignal.h +68 -0
  112. hikyuu/include/hikyuu/trade_sys/signal/imp/logic/OperatorValueSignal.h +67 -0
  113. hikyuu/include/hikyuu/trade_sys/signal/imp/logic/SubSignal.h +19 -0
  114. hikyuu/include/hikyuu/trade_sys/signal/imp/logic/SubValueSignal.h +22 -0
  115. hikyuu/include/hikyuu/trade_sys/signal/imp/logic/__init__.py +1 -0
  116. hikyuu/include/hikyuu/trade_sys/stoploss/crt/ST_Indicator.h +1 -1
  117. hikyuu/include/hikyuu/trade_sys/stoploss/imp/IndicatorStoploss.h +3 -4
  118. hikyuu/include/hikyuu/utilities/FilterNode.h +2 -2
  119. hikyuu/include/hikyuu/utilities/Log.h +42 -15
  120. hikyuu/include/hikyuu/utilities/datetime/Datetime.h +1 -1
  121. hikyuu/include/hikyuu/utilities/datetime/TimeDelta.h +2 -2
  122. hikyuu/include/hikyuu/utilities/db_connect/DBCondition.h +4 -0
  123. hikyuu/include/hikyuu/utilities/db_connect/SQLResultSet.h +2 -2
  124. hikyuu/include/hikyuu/utilities/db_connect/mysql/MySQLConnect.h +5 -1
  125. hikyuu/include/hikyuu/utilities/node/NodeServer.h +4 -4
  126. hikyuu/include/hikyuu/utilities/thread/MQStealThreadPool.h +2 -2
  127. hikyuu/include/hikyuu/utilities/thread/MQThreadPool.h +2 -2
  128. hikyuu/include/hikyuu/utilities/thread/StealThreadPool.h +5 -5
  129. hikyuu/include/hikyuu/utilities/thread/ThreadPool.h +2 -2
  130. hikyuu/include/hikyuu/utilities/thread/algorithm.h +16 -10
  131. hikyuu/include/hikyuu/version.h +4 -4
  132. hikyuu/indicator/indicator.py +1 -0
  133. hikyuu/interactive.py +1 -318
  134. hikyuu/trade_manage/__init__.pyi +492 -478
  135. hikyuu/trade_manage/broker.pyi +18 -19
  136. hikyuu/trade_manage/broker_easytrader.pyi +4 -6
  137. hikyuu/trade_manage/broker_mail.pyi +24 -22
  138. hikyuu/trade_manage/trade.pyi +492 -478
  139. hikyuu/util/check.pyi +15 -17
  140. hikyuu/util/mylog.pyi +7 -8
  141. hikyuu/util/notebook.pyi +11 -9
  142. hikyuu/util/singleton.pyi +6 -8
  143. hikyuu/util/slice.pyi +2 -1
  144. {hikyuu-2.3.1.dist-info → hikyuu-2.5.1.dist-info}/METADATA +2 -2
  145. {hikyuu-2.3.1.dist-info → hikyuu-2.5.1.dist-info}/RECORD +149 -105
  146. {hikyuu-2.3.1.dist-info → hikyuu-2.5.1.dist-info}/top_level.txt +1 -0
  147. hikyuu/cpp/__init__.pyi +0 -3
  148. hikyuu/cpp/core310.pyi +0 -12503
  149. hikyuu/cpp/core311.pyi +0 -12503
  150. hikyuu/cpp/core312.pyi +0 -12503
  151. hikyuu/cpp/core313.pyi +0 -12494
  152. hikyuu/cpp/core38.pyi +0 -12503
  153. hikyuu/cpp/core39.pyi +0 -12503
  154. hikyuu/deprecated.py +0 -651
  155. {hikyuu-2.3.1.dist-info → hikyuu-2.5.1.dist-info}/LICENSE +0 -0
  156. {hikyuu-2.3.1.dist-info → hikyuu-2.5.1.dist-info}/WHEEL +0 -0
  157. {hikyuu-2.3.1.dist-info → hikyuu-2.5.1.dist-info}/entry_points.txt +0 -0
hikyuu/hub.pyi CHANGED
@@ -28,23 +28,22 @@ import sys as sys
28
28
  import typing
29
29
  __all__: list = ['add_remote_hub', 'add_local_hub', 'update_hub', 'remove_hub', 'build_hub', 'get_part', 'get_hub_path', 'get_part_info', 'print_part_info', 'get_hub_name_list', 'get_part_name_list', 'get_current_hub']
30
30
  class ConfigModel(sqlalchemy.orm.decl_api.Base):
31
- __firstlineno__: typing.ClassVar[int] = 36
32
- __mapper__: typing.ClassVar[sqlalchemy.orm.mapper.Mapper] # value = <Mapper at 0x275f9da5fd0; ConfigModel>
33
- __static_attributes__: typing.ClassVar[tuple] = tuple()
31
+ __mapper__: typing.ClassVar[sqlalchemy.orm.mapper.Mapper] # value = <Mapper at 0x247390a0f50; ConfigModel>
34
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)
35
33
  __table_args__: typing.ClassVar[tuple] # value = (UniqueConstraint(Column('key', String(), table=<hub_config>)))
36
34
  __tablename__: typing.ClassVar[str] = 'hub_config'
37
- _sa_class_manager: typing.ClassVar[sqlalchemy.orm.instrumentation.ClassManager] # value = <ClassManager of <class 'hikyuu.hub.ConfigModel'> at 275f9e10c80>
35
+ _sa_class_manager: typing.ClassVar[sqlalchemy.orm.instrumentation.ClassManager] # value = <ClassManager of <class 'hikyuu.hub.ConfigModel'> at 2473909a800>
38
36
  def __init__(self, **kwargs):
39
37
  """
40
38
  A simple constructor that allows initialization from kwargs.
41
39
 
42
- Sets attributes on the constructed instance using the names and
43
- values in ``kwargs``.
40
+ Sets attributes on the constructed instance using the names and
41
+ values in ``kwargs``.
44
42
 
45
- Only keys that are present as
46
- attributes of the instance's class are allowed. These could be,
47
- for example, any mapped columns or relationships.
43
+ Only keys that are present as
44
+ attributes of the instance's class are allowed. These could be,
45
+ for example, any mapped columns or relationships.
46
+
48
47
  """
49
48
  def __repr__(self):
50
49
  ...
@@ -54,8 +53,6 @@ class HubManager:
54
53
  """
55
54
  策略库管理
56
55
  """
57
- __firstlineno__: typing.ClassVar[int] = 164
58
- __static_attributes__: typing.ClassVar[tuple] = ('_scoped_Session', '_session', 'logger', 'remote_cache_dir')
59
56
  _instance: typing.ClassVar[HubManager] # value = <hikyuu.hub.HubManager object>
60
57
  @staticmethod
61
58
  def add_local_hub(*args, **kwargs):
@@ -103,81 +100,69 @@ class HubManager:
103
100
  def print_part_info(self, name):
104
101
  ...
105
102
  class HubModel(sqlalchemy.orm.decl_api.Base):
106
- __firstlineno__: typing.ClassVar[int] = 51
107
- __mapper__: typing.ClassVar[sqlalchemy.orm.mapper.Mapper] # value = <Mapper at 0x275f9d73110; HubModel>
108
- __static_attributes__: typing.ClassVar[tuple] = tuple()
103
+ __mapper__: typing.ClassVar[sqlalchemy.orm.mapper.Mapper] # value = <Mapper at 0x2473847b0e0; HubModel>
109
104
  __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)
110
105
  __table_args__: typing.ClassVar[tuple] # value = (UniqueConstraint(Column('name', String(), table=<hub_repo>)))
111
106
  __tablename__: typing.ClassVar[str] = 'hub_repo'
112
- _sa_class_manager: typing.ClassVar[sqlalchemy.orm.instrumentation.ClassManager] # value = <ClassManager of <class 'hikyuu.hub.HubModel'> at 275f9e311d0>
107
+ _sa_class_manager: typing.ClassVar[sqlalchemy.orm.instrumentation.ClassManager] # value = <ClassManager of <class 'hikyuu.hub.HubModel'> at 247390bf110>
113
108
  def __init__(self, **kwargs):
114
109
  """
115
110
  A simple constructor that allows initialization from kwargs.
116
111
 
117
- Sets attributes on the constructed instance using the names and
118
- values in ``kwargs``.
112
+ Sets attributes on the constructed instance using the names and
113
+ values in ``kwargs``.
119
114
 
120
- Only keys that are present as
121
- attributes of the instance's class are allowed. These could be,
122
- for example, any mapped columns or relationships.
115
+ Only keys that are present as
116
+ attributes of the instance's class are allowed. These could be,
117
+ for example, any mapped columns or relationships.
118
+
123
119
  """
124
120
  def __repr__(self):
125
121
  ...
126
122
  def __str__(self):
127
123
  ...
128
124
  class HubNameRepeatError(Exception):
129
- __firstlineno__: typing.ClassVar[int] = 92
130
- __static_attributes__: typing.ClassVar[tuple] = ('name')
131
125
  def __init__(self, name):
132
126
  ...
133
127
  def __str__(self):
134
128
  ...
135
129
  class HubNotFoundError(Exception):
136
- __firstlineno__: typing.ClassVar[int] = 100
137
- __static_attributes__: typing.ClassVar[tuple] = ('name')
138
130
  def __init__(self, name):
139
131
  ...
140
132
  def __str__(self):
141
133
  ...
142
134
  class ModuleConflictError(Exception):
143
- __firstlineno__: typing.ClassVar[int] = 108
144
- __static_attributes__: typing.ClassVar[tuple] = ('conflict_module', 'hub_name', 'hub_path')
145
135
  def __init__(self, hub_name, conflict_module, hub_path):
146
136
  ...
147
137
  def __str__(self):
148
138
  ...
149
139
  class PartModel(sqlalchemy.orm.decl_api.Base):
150
- __firstlineno__: typing.ClassVar[int] = 72
151
- __mapper__: typing.ClassVar[sqlalchemy.orm.mapper.Mapper] # value = <Mapper at 0x275f9d73890; PartModel>
152
- __static_attributes__: typing.ClassVar[tuple] = tuple()
140
+ __mapper__: typing.ClassVar[sqlalchemy.orm.mapper.Mapper] # value = <Mapper at 0x247390a1ca0; PartModel>
153
141
  __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>), schema=None)
154
142
  __tablename__: typing.ClassVar[str] = 'hub_part'
155
- _sa_class_manager: typing.ClassVar[sqlalchemy.orm.instrumentation.ClassManager] # value = <ClassManager of <class 'hikyuu.hub.PartModel'> at 275f9e31b80>
143
+ _sa_class_manager: typing.ClassVar[sqlalchemy.orm.instrumentation.ClassManager] # value = <ClassManager of <class 'hikyuu.hub.PartModel'> at 247390bfbb0>
156
144
  def __init__(self, **kwargs):
157
145
  """
158
146
  A simple constructor that allows initialization from kwargs.
159
147
 
160
- Sets attributes on the constructed instance using the names and
161
- values in ``kwargs``.
148
+ Sets attributes on the constructed instance using the names and
149
+ values in ``kwargs``.
162
150
 
163
- Only keys that are present as
164
- attributes of the instance's class are allowed. These could be,
165
- for example, any mapped columns or relationships.
151
+ Only keys that are present as
152
+ attributes of the instance's class are allowed. These could be,
153
+ for example, any mapped columns or relationships.
154
+
166
155
  """
167
156
  def __repr__(self):
168
157
  ...
169
158
  def __str__(self):
170
159
  ...
171
160
  class PartNameError(Exception):
172
- __firstlineno__: typing.ClassVar[int] = 129
173
- __static_attributes__: typing.ClassVar[tuple] = ('name')
174
161
  def __init__(self, name):
175
162
  ...
176
163
  def __str__(self):
177
164
  ...
178
165
  class PartNotFoundError(Exception):
179
- __firstlineno__: typing.ClassVar[int] = 120
180
- __static_attributes__: typing.ClassVar[tuple] = ('cause', 'name')
181
166
  def __init__(self, name, cause):
182
167
  ...
183
168
  def __str__(self):
@@ -186,31 +171,34 @@ def add_local_hub(name, path):
186
171
  """
187
172
  增加本地数据仓库
188
173
 
189
- :param str name: 仓库名称
190
- :param str path: 本地全路径
174
+ :param str name: 仓库名称
175
+ :param str path: 本地全路径
176
+
191
177
  """
192
178
  def add_remote_hub(name, url, branch = 'main'):
193
179
  """
194
180
  增加远程策略仓库
195
181
 
196
- :param str name: 本地仓库名称(自行起名)
197
- :param str url: git 仓库地址
198
- :param str branch: git 仓库分支
182
+ :param str name: 本地仓库名称(自行起名)
183
+ :param str url: git 仓库地址
184
+ :param str branch: git 仓库分支
185
+
199
186
  """
200
187
  def build_hub(name, cmd = 'buildall'):
201
188
  """
202
189
  构建 cpp 部分 part
203
190
 
204
- :param str name: 仓库名称
205
- :param str cmd: 同仓库下 python setup.py 后的命令参数,如: build -t ind -n cpp_example
191
+ :param str name: 仓库名称
192
+ :param str cmd: 同仓库下 python setup.py 后的命令参数,如: build -t ind -n cpp_example
193
+
206
194
  """
207
195
  def dbsession(func):
208
196
  ...
209
197
  def get_current_hub(filename):
210
198
  """
211
- 用于在仓库part.py中获取当前所在的仓库名
212
-
213
- 示例: get_current_hub(__file__)
199
+ 用于在仓库part.py中获取当前所在的仓库名。
200
+ 示例: get_current_hub(__file__)
201
+
214
202
  """
215
203
  def get_hub_name_list():
216
204
  """
@@ -220,27 +208,31 @@ def get_hub_path(name):
220
208
  """
221
209
  获取仓库所在的本地路径
222
210
 
223
- :param str name: 仓库名
211
+ :param str name: 仓库名
212
+
224
213
  """
225
214
  def get_part(name, *args, **kwargs):
226
215
  """
227
216
  获取指定策略部件
228
217
 
229
- :param str name: 策略部件名称
230
- :param args: 其他部件相关参数
231
- :param kwargs: 其他部件相关参数
218
+ :param str name: 策略部件名称
219
+ :param args: 其他部件相关参数
220
+ :param kwargs: 其他部件相关参数
221
+
232
222
  """
233
223
  def get_part_info(name):
234
224
  """
235
225
  获取策略部件信息
236
226
 
237
- :param str name: 部件名称
227
+ :param str name: 部件名称
228
+
238
229
  """
239
230
  def get_part_name_list(hub = None, part_type = None):
240
231
  """
241
232
  获取部件名称列表
242
- :param str hub: 仓库名
243
- :param str part_type: 部件类型
233
+ :param str hub: 仓库名
234
+ :param str part_type: 部件类型
235
+
244
236
  """
245
237
  def handle_remove_read_only(func, path, exc):
246
238
  ...
@@ -250,11 +242,13 @@ def remove_hub(name):
250
242
  """
251
243
  删除指定的仓库
252
244
 
253
- :param str name: 仓库名称
245
+ :param str name: 仓库名称
246
+
254
247
  """
255
248
  def update_hub(name):
256
249
  """
257
250
  更新指定仓库
258
251
 
259
- :param str name: 仓库名称
252
+ :param str name: 仓库名称
253
+
260
254
  """
@@ -148,6 +148,11 @@ using std::isfinite;
148
148
  using std::isinf;
149
149
  using std::isnan;
150
150
 
151
+ inline bool iszero(price_t num) {
152
+ const price_t epsilon = std::numeric_limits<price_t>::epsilon();
153
+ return std::abs(num) < epsilon;
154
+ }
155
+
151
156
  using fmt::format;
152
157
 
153
158
  inline std::ostream &operator<<(std::ostream &os, const PriceList &p) {
@@ -204,6 +204,13 @@ public:
204
204
  */
205
205
  const vector<HistoryFinanceInfo>& getHistoryFinance() const;
206
206
 
207
+ /**
208
+ * 获取自身市场的交易日日历(不是本身的交易日期)
209
+ * @param query
210
+ * @return DatetimeList
211
+ */
212
+ DatetimeList getTradingCalendar(const KQuery& query) const;
213
+
207
214
  /** 设置权息信息, 仅供初始化时调用 */
208
215
  void setWeightList(const StockWeightList&);
209
216
 
@@ -44,7 +44,7 @@ public:
44
44
  typedef IndicatorImp::value_t value_t;
45
45
 
46
46
  public:
47
- Indicator() {}
47
+ Indicator() : m_imp(make_shared<IndicatorImp>()) {}
48
48
  Indicator(const IndicatorImpPtr& imp);
49
49
  Indicator(const Indicator& ind);
50
50
  Indicator(Indicator&& ind) noexcept;
@@ -0,0 +1,65 @@
1
+ /*
2
+ * Copyright (c) 2025 hikyuu.org
3
+ *
4
+ * Created on: 2025-02-03
5
+ * Author: fasiondog
6
+ */
7
+
8
+ #pragma once
9
+
10
+ #include "Indicator.h"
11
+
12
+ namespace hku {
13
+
14
+ class Indicator2InImp : public IndicatorImp {
15
+ public:
16
+ Indicator2InImp();
17
+ explicit Indicator2InImp(const string& name, size_t result_num = 1);
18
+ Indicator2InImp(const string& name, const Indicator& ref_a, bool fill_null = false,
19
+ size_t result_num = 1);
20
+ virtual ~Indicator2InImp();
21
+
22
+ virtual IndicatorImpPtr _clone() override;
23
+
24
+ protected:
25
+ Indicator prepare(const Indicator& ind);
26
+
27
+ protected:
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
+ #if HKU_SUPPORT_SERIALIZATION
45
+ #define INDICATOR2IN_IMP_NO_PRIVATE_MEMBER_SERIALIZATION \
46
+ private: \
47
+ friend class boost::serialization::access; \
48
+ template <class Archive> \
49
+ void serialize(Archive& ar, const unsigned int version) { \
50
+ ar& BOOST_SERIALIZATION_BASE_OBJECT_NVP(Indicator2InImp); \
51
+ }
52
+ #else
53
+ #define INDICATOR2IN_IMP_NO_PRIVATE_MEMBER_SERIALIZATION
54
+ #endif
55
+
56
+ #define INDICATOR2IN_IMP(classname) \
57
+ public: \
58
+ virtual void _calculate(const Indicator& data) override; \
59
+ virtual IndicatorImpPtr _clone() override { \
60
+ auto p = make_shared<classname>(); \
61
+ p->m_ref_ind = m_ref_ind.clone(); \
62
+ return p; \
63
+ }
64
+
65
+ } // namespace hku
@@ -152,9 +152,7 @@ public:
152
152
  // ===================
153
153
  // 子类接口
154
154
  // ===================
155
- virtual void _calculate(const Indicator&) {
156
- HKU_WARN("{} will be empty always!", m_name);
157
- }
155
+ virtual void _calculate(const Indicator&);
158
156
 
159
157
  virtual void _dyn_run_one_step(const Indicator& ind, size_t curPos, size_t step) {}
160
158
 
@@ -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/CYCLE.h"
31
32
  #include "crt/CONTEXT.h"
32
33
  #include "crt/CORR.h"
33
34
  #include "crt/COS.h"
@@ -38,6 +39,7 @@
38
39
  #include "crt/DECLINE.h"
39
40
  #include "crt/DEVSQ.h"
40
41
  #include "crt/DIFF.h"
42
+ #include "crt/DISCARD.h"
41
43
  #include "crt/DMA.h"
42
44
  #include "crt/DOWNNDAY.h"
43
45
  #include "crt/DROPNA.h"
@@ -53,6 +55,7 @@
53
55
  #include "crt/HSL.h"
54
56
  #include "crt/IC.h"
55
57
  #include "crt/ICIR.h"
58
+ #include "crt/INBLOCK.h"
56
59
  #include "crt/INDEX.h"
57
60
  #include "crt/INSUM.h"
58
61
  #include "crt/IR.h"
@@ -61,7 +64,10 @@
61
64
  #include "crt/ISINFA.h"
62
65
  #include "crt/ISLASTBAR.h"
63
66
  #include "crt/ISNA.h"
67
+ #include "crt/JUMPUP.h"
68
+ #include "crt/JUMPDOWN.h"
64
69
  #include "crt/LAST.h"
70
+ #include "crt/LASTVALUE.h"
65
71
  #include "crt/LIUTONGPAN.h"
66
72
  #include "crt/LLV.h"
67
73
  #include "crt/LLVBARS.h"
@@ -114,6 +120,7 @@
114
120
  #include "crt/VAR.h"
115
121
  #include "crt/VARP.h"
116
122
  #include "crt/VIGOR.h"
123
+ #include "crt/WINNER.h"
117
124
  #include "crt/WMA.h"
118
125
  #include "crt/ZHBOND10.h"
119
126
  #include "crt/ZONGGUBEN.h"
@@ -30,5 +30,8 @@ namespace hku {
30
30
  Indicator HKU_API COST(const KData& k, double x = 10.0);
31
31
  Indicator HKU_API COST(double x = 10.0);
32
32
 
33
+ Indicator HKU_API COST2(const KData& k, double x = 10.0);
34
+ Indicator HKU_API COST2(double x = 10.0);
35
+
33
36
  } // namespace hku
34
37
  #endif /* INDICATOR_CRT_COST_H_ */
@@ -0,0 +1,24 @@
1
+ /*
2
+ * Copyright (c) 2025 hikyuu.org
3
+ *
4
+ * Created on: 2025-02-10
5
+ * Author: fasiondog
6
+ */
7
+
8
+ #pragma once
9
+
10
+ #include "hikyuu/indicator/Indicator.h"
11
+
12
+ namespace hku {
13
+
14
+ /**
15
+ * PF调仓周期指标,主要用于PF调仓日验证,及作为SG
16
+ * @param k 关联的K线数据
17
+ * @ingroup Indicator
18
+ */
19
+ Indicator CYCLE(const KData& k, int adjust_cycle = 1, const string& adjust_mode = "query",
20
+ bool delay_to_trading_day = true);
21
+ Indicator CYCLE(int adjust_cycle = 1, const string& adjust_mode = "query",
22
+ bool delay_to_trading_day = true);
23
+
24
+ } // namespace hku
@@ -0,0 +1,27 @@
1
+ /*
2
+ * COS.h
3
+ *
4
+ * Copyright (c) 2019 hikyuu.org
5
+ *
6
+ * Created on: 2019-5-1
7
+ * Author: fasiondog
8
+ */
9
+
10
+ #pragma once
11
+ #ifndef INDICATOR_CRT_DISCARD_H_
12
+ #define INDICATOR_CRT_DISCARD_H_
13
+
14
+ #include "CVAL.h"
15
+
16
+ namespace hku {
17
+
18
+ /** 以指标公式的方式设置抛弃值 */
19
+ Indicator HKU_API DISCARD(int discard);
20
+
21
+ inline Indicator DISCARD(const Indicator& ind, int discard) {
22
+ return DISCARD(discard)(ind);
23
+ }
24
+
25
+ } // namespace hku
26
+
27
+ #endif /* INDICATOR_CRT_DISCARD_H_ */
@@ -16,24 +16,12 @@
16
16
  namespace hku {
17
17
 
18
18
  /**
19
- * 获取换手率,等于 VOL(k) / CAPITAL(k)
19
+ * 获取换手率, 乘以 100 才是百分比,等于 VOL(k) / CAPITAL(k) * 0.01
20
20
  * @param k 关联的K线数据
21
21
  * @ingroup Indicator
22
22
  */
23
23
  Indicator HSL(const KData& k);
24
24
  Indicator HSL();
25
25
 
26
- inline Indicator HSL() {
27
- Indicator hsl = VOL() / LIUTONGPAN();
28
- hsl.name("HSL");
29
- return hsl;
30
- }
31
-
32
- inline Indicator HSL(const KData& k) {
33
- Indicator hsl = HSL();
34
- hsl.setContext(k);
35
- return hsl;
36
- }
37
-
38
26
  } // namespace hku
39
27
  #endif /* INDICATOR_CRT_HSL_H_ */
@@ -0,0 +1,31 @@
1
+ /*
2
+ * Copyright (c) 2025 hikyuu.org
3
+ *
4
+ * Created on: 2025-01-26
5
+ * Author: fasiondog
6
+ */
7
+
8
+ #pragma once
9
+
10
+ #include "../Indicator.h"
11
+
12
+ namespace hku {
13
+
14
+ /**
15
+ * @brief 返回品种是否属于某板块
16
+ * @param category 指定板块分类
17
+ * @param name 板块名称
18
+ * @return Indicator
19
+ */
20
+ Indicator HKU_API INBLOCK(const string& category, const string& name);
21
+
22
+ /**
23
+ * @brief 返回品种是否属于某板块
24
+ * @param kdata K线数据
25
+ * @param category 指定板块分类
26
+ * @param name 板块名称
27
+ * @return Indicator
28
+ */
29
+ Indicator HKU_API INBLOCK(const KData& kdata, const string& category, const string& name);
30
+
31
+ } // namespace hku
@@ -13,29 +13,41 @@ namespace hku {
13
13
 
14
14
  // 这里的大盘都指 sh000001
15
15
 
16
- /** 大盘开盘价 */
17
- Indicator HKU_API INDEXO();
18
- Indicator HKU_API INDEXO(const KQuery& query);
19
-
20
- /** 大盘最高价盘价 */
21
- Indicator HKU_API INDEXH();
22
- Indicator HKU_API INDEXH(const KQuery& query);
23
-
24
- /** 大盘最低价 */
25
- Indicator HKU_API INDEXL();
26
- Indicator HKU_API INDEXL(const KQuery& query);
27
-
28
- /** 大盘收盘价 */
29
- Indicator HKU_API INDEXC();
30
- Indicator HKU_API INDEXC(const KQuery& query);
31
-
32
- /** 大盘成交额 */
33
- Indicator HKU_API INDEXA();
34
- Indicator HKU_API INDEXA(const KQuery& query);
35
-
36
- /** 大盘成交量 */
37
- Indicator HKU_API INDEXV();
38
- Indicator HKU_API INDEXV(const KQuery& query);
16
+ /** 对应的大盘开盘价,分别是上证指数,深证成指,科创50,创业板指 */
17
+ Indicator HKU_API INDEXO(bool fill_null = true);
18
+ inline Indicator INDEXO(const KData& k, bool fill_null = true) {
19
+ return INDEXO(fill_null)(k);
20
+ }
21
+
22
+ /** 对应的大盘最高价,分别是上证指数,深证成指,科创50,创业板指 */
23
+ Indicator HKU_API INDEXH(bool fill_null = true);
24
+ inline Indicator INDEXH(const KData& k, bool fill_null = true) {
25
+ return INDEXH(fill_null)(k);
26
+ }
27
+
28
+ /** 对应的大盘最低价,分别是上证指数,深证成指,科创50,创业板指 */
29
+ Indicator HKU_API INDEXL(bool fill_null = true);
30
+ inline Indicator INDEXL(const KData& k, bool fill_null = true) {
31
+ return INDEXL(fill_null)(k);
32
+ }
33
+
34
+ /** 对应的大盘收盘价,分别是上证指数,深证成指,科创50,创业板指 */
35
+ Indicator HKU_API INDEXC(bool fill_null = true);
36
+ inline Indicator INDEXC(const KData& k, bool fill_null = true) {
37
+ return INDEXC(fill_null)(k);
38
+ }
39
+
40
+ /** 对应的大盘成交金额,分别是上证指数,深证成指,科创50,创业板指 */
41
+ Indicator HKU_API INDEXA(bool fill_null = true);
42
+ inline Indicator INDEXA(const KData& k, bool fill_null = true) {
43
+ return INDEXA(fill_null)(k);
44
+ }
45
+
46
+ /** 对应的大盘成交量,分别是上证指数,深证成指,科创50,创业板指 */
47
+ Indicator HKU_API INDEXV(bool fill_null = true);
48
+ inline Indicator INDEXV(const KData& k, bool fill_null = true) {
49
+ return INDEXV(fill_null)(k);
50
+ }
39
51
 
40
52
  /** 大盘上涨家数, 使用通达信 SH880005,可能无法用于实盘 */
41
53
  Indicator HKU_API INDEXADV();
@@ -0,0 +1,24 @@
1
+ /*
2
+ * Copyright (c) 2025 hikyuu.org
3
+ *
4
+ * Created on: 2025-02-10
5
+ * Author: fasiondog
6
+ */
7
+
8
+ #pragma once
9
+
10
+ #include "../Indicator.h"
11
+
12
+ namespace hku {
13
+
14
+ /**
15
+ * 边缘跳变,从大于0.0,跳变到 <= 0.0
16
+ * @ingroup Indicator
17
+ */
18
+ Indicator HKU_API JUMPDOWN();
19
+
20
+ inline Indicator JUMPDOWN(const Indicator& ind) {
21
+ return JUMPDOWN()(ind);
22
+ }
23
+
24
+ } // namespace hku
@@ -0,0 +1,24 @@
1
+ /*
2
+ * Copyright (c) 2025 hikyuu.org
3
+ *
4
+ * Created on: 2025-02-10
5
+ * Author: fasiondog
6
+ */
7
+
8
+ #pragma once
9
+
10
+ #include "../Indicator.h"
11
+
12
+ namespace hku {
13
+
14
+ /**
15
+ * 边缘跳变,从小于等于0.0,跳变到 > 0.0
16
+ * @ingroup Indicator
17
+ */
18
+ Indicator HKU_API JUMPUP();
19
+
20
+ inline Indicator JUMPUP(const Indicator& ind) {
21
+ return JUMPUP()(ind);
22
+ }
23
+
24
+ } // namespace hku
@@ -0,0 +1,29 @@
1
+ /*
2
+ * Copyright (c) 2025 hikyuu.org
3
+ *
4
+ * Created on: 2025-02-04
5
+ * Author: fasiondog
6
+ */
7
+
8
+ #pragma once
9
+ #ifndef INDICATOR_CRT_LASTVALUE_H_
10
+ #define INDICATOR_CRT_LASTVALUE_H_
11
+
12
+ #include "../Indicator.h"
13
+
14
+ namespace hku {
15
+
16
+ /**
17
+ * 取输入指标最后值为常数,即结果中所有值均为输入指标的最后值,谨慎使用
18
+ * @note 等同于通达信 CONST 指标, 由于 Windows 下 CONST 命名冲突,取名 LASTVALUE
19
+ * @ingroup Indicator
20
+ */
21
+ Indicator HKU_API LASTVALUE(bool ignore_discard = false);
22
+
23
+ inline Indicator LASTVALUE(const Indicator& ind, bool ignore_discard = false) {
24
+ return LASTVALUE(ignore_discard)(ind);
25
+ }
26
+
27
+ } // namespace hku
28
+
29
+ #endif /* INDICATOR_CRT_LASTVALUE_H_ */
@@ -15,6 +15,7 @@
15
15
 
16
16
  namespace hku {
17
17
 
18
+ /** 流通盘,单位万股 */
18
19
  Indicator HKU_API LIUTONGPAN();
19
20
  Indicator HKU_API LIUTONGPAN(const KData&);
20
21