hikyuu 2.3.0__py3-none-win_amd64.whl → 2.5.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.
Files changed (179) hide show
  1. hikyuu/__init__.py +438 -6
  2. hikyuu/__init__.pyi +791 -0
  3. hikyuu/analysis/__init__.pyi +487 -0
  4. hikyuu/analysis/analysis.pyi +517 -0
  5. hikyuu/core.pyi +482 -0
  6. hikyuu/cpp/__init__.pyi +3 -0
  7. hikyuu/cpp/boost_date_time-mt.dll +0 -0
  8. hikyuu/cpp/boost_serialization-mt.dll +0 -0
  9. hikyuu/cpp/boost_wserialization-mt.dll +0 -0
  10. hikyuu/cpp/core310.pyd +0 -0
  11. hikyuu/cpp/core311.pyd +0 -0
  12. hikyuu/cpp/core312.pyd +0 -0
  13. hikyuu/cpp/core312.pyi +12867 -0
  14. hikyuu/cpp/core313.pyd +0 -0
  15. hikyuu/cpp/core38.pyd +0 -0
  16. hikyuu/cpp/core39.pyd +0 -0
  17. hikyuu/cpp/hikyuu.dll +0 -0
  18. hikyuu/cpp/hikyuu.lib +0 -0
  19. hikyuu/cpp/sqlite3.dll +0 -0
  20. hikyuu/data/common_mysql.py +24 -7
  21. hikyuu/data/common_pytdx.py +17 -1
  22. hikyuu/data/em_block_to_mysql.py +3 -2
  23. hikyuu/data/em_block_to_sqlite.py +8 -3
  24. hikyuu/data/mysql_upgrade/0025.sql +61 -0
  25. hikyuu/data/mysql_upgrade/0026.sql +9 -0
  26. hikyuu/data/sqlite_upgrade/0025.sql +63 -0
  27. hikyuu/data/sqlite_upgrade/0026.sql +10 -0
  28. hikyuu/draw/__init__.pyi +35 -0
  29. hikyuu/draw/drawplot/__init__.py +3 -0
  30. hikyuu/draw/drawplot/__init__.pyi +134 -0
  31. hikyuu/draw/drawplot/bokeh_draw.pyi +796 -0
  32. hikyuu/draw/drawplot/common.pyi +10 -0
  33. hikyuu/draw/drawplot/echarts_draw.py +219 -24
  34. hikyuu/draw/drawplot/echarts_draw.pyi +682 -0
  35. hikyuu/draw/drawplot/matplotlib_draw.py +18 -3
  36. hikyuu/draw/drawplot/matplotlib_draw.pyi +1101 -0
  37. hikyuu/draw/elder.pyi +44 -0
  38. hikyuu/draw/kaufman.pyi +38 -0
  39. hikyuu/draw/volume.pyi +31 -0
  40. hikyuu/examples/notebook/Demo/Demo2.ipynb +1 -1
  41. hikyuu/extend.py +9 -3
  42. hikyuu/extend.pyi +636 -0
  43. hikyuu/fetcher/stock/zh_block_em.py +118 -51
  44. hikyuu/gui/data/EscapetimeThread.py +4 -4
  45. hikyuu/gui/data/ImportBlockInfoTask.py +3 -2
  46. hikyuu/gui/data/ImportHistoryFinanceTask.py +2 -0
  47. hikyuu/gui/data/MainWindow.py +48 -42
  48. hikyuu/gui/importdata.py +13 -26
  49. hikyuu/hub.py +2 -4
  50. hikyuu/hub.pyi +254 -0
  51. hikyuu/include/hikyuu/DataType.h +5 -0
  52. hikyuu/include/hikyuu/Stock.h +7 -0
  53. hikyuu/include/hikyuu/indicator/Indicator.h +8 -1
  54. hikyuu/include/hikyuu/indicator/Indicator2InImp.h +65 -0
  55. hikyuu/include/hikyuu/indicator/IndicatorImp.h +4 -3
  56. hikyuu/include/hikyuu/indicator/build_in.h +12 -0
  57. hikyuu/include/hikyuu/indicator/crt/ADVANCE.h +3 -1
  58. hikyuu/include/hikyuu/indicator/crt/CONTEXT.h +2 -2
  59. hikyuu/include/hikyuu/indicator/crt/CORR.h +4 -2
  60. hikyuu/include/hikyuu/indicator/crt/COST.h +3 -0
  61. hikyuu/include/hikyuu/indicator/crt/CYCLE.h +24 -0
  62. hikyuu/include/hikyuu/indicator/crt/DECLINE.h +3 -1
  63. hikyuu/include/hikyuu/indicator/crt/DISCARD.h +27 -0
  64. hikyuu/include/hikyuu/indicator/crt/DMA.h +2 -1
  65. hikyuu/include/hikyuu/indicator/crt/HSL.h +1 -13
  66. hikyuu/include/hikyuu/indicator/crt/INBLOCK.h +31 -0
  67. hikyuu/include/hikyuu/indicator/crt/INDEX.h +60 -0
  68. hikyuu/include/hikyuu/indicator/crt/INSUM.h +5 -2
  69. hikyuu/include/hikyuu/indicator/crt/ISINF.h +28 -0
  70. hikyuu/include/hikyuu/indicator/crt/ISINFA.h +28 -0
  71. hikyuu/include/hikyuu/indicator/crt/ISNA.h +29 -0
  72. hikyuu/include/hikyuu/indicator/crt/JUMPDOWN.h +24 -0
  73. hikyuu/include/hikyuu/indicator/crt/JUMPUP.h +24 -0
  74. hikyuu/include/hikyuu/indicator/crt/LASTVALUE.h +29 -0
  75. hikyuu/include/hikyuu/indicator/crt/LIUTONGPAN.h +1 -0
  76. hikyuu/include/hikyuu/indicator/crt/REPLACE.h +29 -0
  77. hikyuu/include/hikyuu/indicator/crt/SPEARMAN.h +3 -2
  78. hikyuu/include/hikyuu/indicator/crt/WINNER.h +38 -0
  79. hikyuu/include/hikyuu/indicator/imp/IContext.h +1 -1
  80. hikyuu/include/hikyuu/indicator/imp/ICorr.h +7 -22
  81. hikyuu/include/hikyuu/indicator/imp/ICost.h +31 -0
  82. hikyuu/include/hikyuu/indicator/imp/ICycle.h +30 -0
  83. hikyuu/include/hikyuu/indicator/imp/IDiscard.h +28 -0
  84. hikyuu/include/hikyuu/indicator/imp/IDma.h +7 -24
  85. hikyuu/include/hikyuu/indicator/imp/IHsl.h +30 -0
  86. hikyuu/include/hikyuu/indicator/imp/IInBlock.h +30 -0
  87. hikyuu/include/hikyuu/indicator/imp/IIndex.h +26 -0
  88. hikyuu/include/hikyuu/indicator/imp/IIsInf.h +26 -0
  89. hikyuu/include/hikyuu/indicator/imp/IIsInfa.h +26 -0
  90. hikyuu/include/hikyuu/indicator/imp/IIsNa.h +26 -0
  91. hikyuu/include/hikyuu/indicator/imp/IJumpDown.h +24 -0
  92. hikyuu/include/hikyuu/indicator/imp/IJumpUp.h +24 -0
  93. hikyuu/include/hikyuu/indicator/imp/ILastValue.h +26 -0
  94. hikyuu/include/hikyuu/indicator/imp/IReplace.h +26 -0
  95. hikyuu/include/hikyuu/indicator/imp/ISpearman.h +6 -21
  96. hikyuu/include/hikyuu/indicator/imp/IWinner.h +26 -0
  97. hikyuu/include/hikyuu/indicator_talib/imp/TaMavp.h +6 -20
  98. hikyuu/include/hikyuu/indicator_talib/imp/ta_defines.h +14 -65
  99. hikyuu/include/hikyuu/indicator_talib/imp/ta_imp.h +54 -90
  100. hikyuu/include/hikyuu/indicator_talib/ta_crt.h +11 -9
  101. hikyuu/include/hikyuu/strategy/RunPortfolioInStrategy.h +3 -4
  102. hikyuu/include/hikyuu/strategy/Strategy.h +4 -5
  103. hikyuu/include/hikyuu/trade_manage/TradeRecord.h +5 -1
  104. hikyuu/include/hikyuu/trade_sys/allocatefunds/build_in.h +1 -0
  105. hikyuu/include/hikyuu/trade_sys/allocatefunds/crt/AF_FixedWeightList.h +22 -0
  106. hikyuu/include/hikyuu/trade_sys/allocatefunds/imp/FixedWeightListAllocateFunds.h +25 -0
  107. hikyuu/include/hikyuu/trade_sys/moneymanager/MoneyManagerBase.h +17 -4
  108. hikyuu/include/hikyuu/trade_sys/moneymanager/build_in.h +2 -0
  109. hikyuu/include/hikyuu/trade_sys/moneymanager/crt/MM_FixedCapital.h +6 -0
  110. hikyuu/include/hikyuu/trade_sys/moneymanager/crt/MM_FixedCapitalFunds.h +26 -0
  111. hikyuu/include/hikyuu/trade_sys/moneymanager/crt/MM_FixedCountTps.h +27 -0
  112. hikyuu/include/hikyuu/trade_sys/moneymanager/crt/MM_FixedRisk.h +6 -0
  113. hikyuu/include/hikyuu/trade_sys/moneymanager/crt/MM_FixedUnits.h +6 -0
  114. hikyuu/include/hikyuu/trade_sys/moneymanager/crt/MM_WilliamsFixedRisk.h +7 -0
  115. hikyuu/include/hikyuu/trade_sys/moneymanager/imp/FixedCapitalFundsMM.h +28 -0
  116. hikyuu/include/hikyuu/trade_sys/moneymanager/imp/FixedCountTpsMM.h +44 -0
  117. hikyuu/include/hikyuu/trade_sys/multifactor/build_in.h +1 -0
  118. hikyuu/include/hikyuu/trade_sys/multifactor/crt/MF_Weight.h +30 -0
  119. hikyuu/include/hikyuu/trade_sys/multifactor/imp/WeightMultiFactor.h +41 -0
  120. hikyuu/include/hikyuu/trade_sys/portfolio/Portfolio.h +38 -37
  121. hikyuu/include/hikyuu/trade_sys/portfolio/build_in.h +1 -0
  122. hikyuu/include/hikyuu/trade_sys/portfolio/crt/PF_Simple.h +25 -1
  123. hikyuu/include/hikyuu/trade_sys/portfolio/crt/PF_WithoutAF.h +50 -0
  124. hikyuu/include/hikyuu/trade_sys/portfolio/imp/SimplePortfolio.h +53 -0
  125. hikyuu/include/hikyuu/trade_sys/portfolio/imp/WithoutAFPortfolio.h +57 -0
  126. hikyuu/include/hikyuu/trade_sys/selector/imp/MultiFactorSelector.h +7 -0
  127. hikyuu/include/hikyuu/trade_sys/signal/SignalBase.h +51 -5
  128. hikyuu/include/hikyuu/trade_sys/signal/build_in.h +2 -0
  129. hikyuu/include/hikyuu/trade_sys/signal/crt/SG_Bool.h +2 -1
  130. hikyuu/include/hikyuu/trade_sys/signal/crt/SG_Logic.h +37 -0
  131. hikyuu/include/hikyuu/trade_sys/signal/crt/SG_OneSide.h +28 -0
  132. hikyuu/include/hikyuu/trade_sys/signal/imp/OneSideSignal.h +46 -0
  133. hikyuu/include/hikyuu/trade_sys/signal/imp/logic/AddSignal.h +19 -0
  134. hikyuu/include/hikyuu/trade_sys/signal/imp/logic/AddValueSignal.h +19 -0
  135. hikyuu/include/hikyuu/trade_sys/signal/imp/logic/DivSignal.h +19 -0
  136. hikyuu/include/hikyuu/trade_sys/signal/imp/logic/DivValueSignal.h +22 -0
  137. hikyuu/include/hikyuu/trade_sys/signal/imp/logic/MulSignal.h +19 -0
  138. hikyuu/include/hikyuu/trade_sys/signal/imp/logic/MulValueSignal.h +19 -0
  139. hikyuu/include/hikyuu/trade_sys/signal/imp/logic/OperatorSignal.h +68 -0
  140. hikyuu/include/hikyuu/trade_sys/signal/imp/logic/OperatorValueSignal.h +67 -0
  141. hikyuu/include/hikyuu/trade_sys/signal/imp/logic/SubSignal.h +19 -0
  142. hikyuu/include/hikyuu/trade_sys/signal/imp/logic/SubValueSignal.h +22 -0
  143. hikyuu/include/hikyuu/trade_sys/signal/imp/logic/__init__.py +1 -0
  144. hikyuu/include/hikyuu/trade_sys/stoploss/crt/ST_Indicator.h +1 -1
  145. hikyuu/include/hikyuu/trade_sys/stoploss/imp/IndicatorStoploss.h +3 -4
  146. hikyuu/include/hikyuu/utilities/FilterNode.h +2 -2
  147. hikyuu/include/hikyuu/utilities/Log.h +42 -15
  148. hikyuu/include/hikyuu/utilities/datetime/Datetime.h +1 -1
  149. hikyuu/include/hikyuu/utilities/datetime/TimeDelta.h +2 -2
  150. hikyuu/include/hikyuu/utilities/db_connect/DBCondition.h +4 -0
  151. hikyuu/include/hikyuu/utilities/db_connect/SQLResultSet.h +2 -2
  152. hikyuu/include/hikyuu/utilities/db_connect/mysql/MySQLConnect.h +5 -1
  153. hikyuu/include/hikyuu/utilities/node/NodeServer.h +4 -4
  154. hikyuu/include/hikyuu/utilities/thread/MQStealThreadPool.h +2 -2
  155. hikyuu/include/hikyuu/utilities/thread/MQThreadPool.h +2 -2
  156. hikyuu/include/hikyuu/utilities/thread/StealThreadPool.h +5 -5
  157. hikyuu/include/hikyuu/utilities/thread/ThreadPool.h +2 -2
  158. hikyuu/include/hikyuu/utilities/thread/algorithm.h +16 -10
  159. hikyuu/include/hikyuu/version.h +4 -4
  160. hikyuu/indicator/indicator.py +1 -0
  161. hikyuu/interactive.py +3 -266
  162. hikyuu/trade_manage/__init__.pyi +584 -0
  163. hikyuu/trade_manage/broker.pyi +54 -0
  164. hikyuu/trade_manage/broker_easytrader.pyi +21 -0
  165. hikyuu/trade_manage/broker_mail.pyi +55 -0
  166. hikyuu/trade_manage/trade.pyi +590 -0
  167. hikyuu/util/__init__.pyi +55 -0
  168. hikyuu/util/check.pyi +59 -0
  169. hikyuu/util/mylog.pyi +70 -0
  170. hikyuu/util/notebook.pyi +23 -0
  171. hikyuu/util/singleton.pyi +18 -0
  172. hikyuu/util/slice.pyi +8 -0
  173. {hikyuu-2.3.0.dist-info → hikyuu-2.5.0.dist-info}/METADATA +3 -2
  174. {hikyuu-2.3.0.dist-info → hikyuu-2.5.0.dist-info}/RECORD +178 -95
  175. {hikyuu-2.3.0.dist-info → hikyuu-2.5.0.dist-info}/top_level.txt +1 -0
  176. hikyuu/deprecated.py +0 -651
  177. {hikyuu-2.3.0.dist-info → hikyuu-2.5.0.dist-info}/LICENSE +0 -0
  178. {hikyuu-2.3.0.dist-info → hikyuu-2.5.0.dist-info}/WHEEL +0 -0
  179. {hikyuu-2.3.0.dist-info → hikyuu-2.5.0.dist-info}/entry_points.txt +0 -0
hikyuu/hub.pyi ADDED
@@ -0,0 +1,254 @@
1
+ from __future__ import annotations
2
+ from configparser import ConfigParser
3
+ import errno as errno
4
+ import git as git
5
+ from hikyuu.util.check import checkif
6
+ from hikyuu.util.singleton import SingletonType
7
+ import importlib as importlib
8
+ import logging as logging
9
+ import os as os
10
+ import pathlib as pathlib
11
+ import shutil as shutil
12
+ from sqlalchemy.engine.create import create_engine
13
+ from sqlalchemy.orm.decl_api import Base
14
+ from sqlalchemy.orm.decl_api import declarative_base
15
+ import sqlalchemy.orm.instrumentation
16
+ import sqlalchemy.orm.mapper
17
+ from sqlalchemy.orm.scoping import scoped_session
18
+ from sqlalchemy.orm.session import sessionmaker
19
+ from sqlalchemy.sql._elements_constructors import and_
20
+ import sqlalchemy.sql.schema
21
+ from sqlalchemy.sql.schema import Column
22
+ from sqlalchemy.sql.schema import Sequence
23
+ from sqlalchemy.sql.schema import UniqueConstraint
24
+ from sqlalchemy.sql.sqltypes import Integer
25
+ from sqlalchemy.sql.sqltypes import String
26
+ import stat as stat
27
+ import sys as sys
28
+ import typing
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
+ class ConfigModel(sqlalchemy.orm.decl_api.Base):
31
+ __mapper__: typing.ClassVar[sqlalchemy.orm.mapper.Mapper] # value = <Mapper at 0x247390a0f50; ConfigModel>
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
+ __table_args__: typing.ClassVar[tuple] # value = (UniqueConstraint(Column('key', String(), table=<hub_config>)))
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 2473909a800>
36
+ def __init__(self, **kwargs):
37
+ """
38
+ A simple constructor that allows initialization from kwargs.
39
+
40
+ Sets attributes on the constructed instance using the names and
41
+ values in ``kwargs``.
42
+
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
+
47
+ """
48
+ def __repr__(self):
49
+ ...
50
+ def __str__(self):
51
+ ...
52
+ class HubManager:
53
+ """
54
+ 策略库管理
55
+ """
56
+ _instance: typing.ClassVar[HubManager] # value = <hikyuu.hub.HubManager object>
57
+ @staticmethod
58
+ def add_local_hub(*args, **kwargs):
59
+ ...
60
+ @staticmethod
61
+ def add_remote_hub(*args, **kwargs):
62
+ ...
63
+ @staticmethod
64
+ def build_hub(*args, **kwargs):
65
+ ...
66
+ @staticmethod
67
+ def get_current_hub(*args, **kwargs):
68
+ ...
69
+ @staticmethod
70
+ def get_hub_name_list(*args, **kwargs):
71
+ ...
72
+ @staticmethod
73
+ def get_hub_path(*args, **kwargs):
74
+ ...
75
+ @staticmethod
76
+ def get_part(*args, **kwargs):
77
+ ...
78
+ @staticmethod
79
+ def get_part_info(*args, **kwargs):
80
+ ...
81
+ @staticmethod
82
+ def get_part_name_list(*args, **kwargs):
83
+ ...
84
+ @staticmethod
85
+ def import_part_to_db(*args, **kwargs):
86
+ ...
87
+ @staticmethod
88
+ def remove_hub(*args, **kwargs):
89
+ ...
90
+ @staticmethod
91
+ def setup_hub(*args, **kwargs):
92
+ ...
93
+ @staticmethod
94
+ def update_hub(*args, **kwargs):
95
+ ...
96
+ def __init__(self):
97
+ ...
98
+ def download_remote_hub(self, local_dir, url, branch):
99
+ ...
100
+ def print_part_info(self, name):
101
+ ...
102
+ class HubModel(sqlalchemy.orm.decl_api.Base):
103
+ __mapper__: typing.ClassVar[sqlalchemy.orm.mapper.Mapper] # value = <Mapper at 0x2473847b0e0; HubModel>
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)
105
+ __table_args__: typing.ClassVar[tuple] # value = (UniqueConstraint(Column('name', String(), table=<hub_repo>)))
106
+ __tablename__: typing.ClassVar[str] = 'hub_repo'
107
+ _sa_class_manager: typing.ClassVar[sqlalchemy.orm.instrumentation.ClassManager] # value = <ClassManager of <class 'hikyuu.hub.HubModel'> at 247390bf110>
108
+ def __init__(self, **kwargs):
109
+ """
110
+ A simple constructor that allows initialization from kwargs.
111
+
112
+ Sets attributes on the constructed instance using the names and
113
+ values in ``kwargs``.
114
+
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
+
119
+ """
120
+ def __repr__(self):
121
+ ...
122
+ def __str__(self):
123
+ ...
124
+ class HubNameRepeatError(Exception):
125
+ def __init__(self, name):
126
+ ...
127
+ def __str__(self):
128
+ ...
129
+ class HubNotFoundError(Exception):
130
+ def __init__(self, name):
131
+ ...
132
+ def __str__(self):
133
+ ...
134
+ class ModuleConflictError(Exception):
135
+ def __init__(self, hub_name, conflict_module, hub_path):
136
+ ...
137
+ def __str__(self):
138
+ ...
139
+ class PartModel(sqlalchemy.orm.decl_api.Base):
140
+ __mapper__: typing.ClassVar[sqlalchemy.orm.mapper.Mapper] # value = <Mapper at 0x247390a1ca0; PartModel>
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)
142
+ __tablename__: typing.ClassVar[str] = 'hub_part'
143
+ _sa_class_manager: typing.ClassVar[sqlalchemy.orm.instrumentation.ClassManager] # value = <ClassManager of <class 'hikyuu.hub.PartModel'> at 247390bfbb0>
144
+ def __init__(self, **kwargs):
145
+ """
146
+ A simple constructor that allows initialization from kwargs.
147
+
148
+ Sets attributes on the constructed instance using the names and
149
+ values in ``kwargs``.
150
+
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
+
155
+ """
156
+ def __repr__(self):
157
+ ...
158
+ def __str__(self):
159
+ ...
160
+ class PartNameError(Exception):
161
+ def __init__(self, name):
162
+ ...
163
+ def __str__(self):
164
+ ...
165
+ class PartNotFoundError(Exception):
166
+ def __init__(self, name, cause):
167
+ ...
168
+ def __str__(self):
169
+ ...
170
+ def add_local_hub(name, path):
171
+ """
172
+ 增加本地数据仓库
173
+
174
+ :param str name: 仓库名称
175
+ :param str path: 本地全路径
176
+
177
+ """
178
+ def add_remote_hub(name, url, branch = 'main'):
179
+ """
180
+ 增加远程策略仓库
181
+
182
+ :param str name: 本地仓库名称(自行起名)
183
+ :param str url: git 仓库地址
184
+ :param str branch: git 仓库分支
185
+
186
+ """
187
+ def build_hub(name, cmd = 'buildall'):
188
+ """
189
+ 构建 cpp 部分 part
190
+
191
+ :param str name: 仓库名称
192
+ :param str cmd: 同仓库下 python setup.py 后的命令参数,如: build -t ind -n cpp_example
193
+
194
+ """
195
+ def dbsession(func):
196
+ ...
197
+ def get_current_hub(filename):
198
+ """
199
+ 用于在仓库part.py中获取当前所在的仓库名。
200
+ 示例: get_current_hub(__file__)
201
+
202
+ """
203
+ def get_hub_name_list():
204
+ """
205
+ 返回仓库名称列表
206
+ """
207
+ def get_hub_path(name):
208
+ """
209
+ 获取仓库所在的本地路径
210
+
211
+ :param str name: 仓库名
212
+
213
+ """
214
+ def get_part(name, *args, **kwargs):
215
+ """
216
+ 获取指定策略部件
217
+
218
+ :param str name: 策略部件名称
219
+ :param args: 其他部件相关参数
220
+ :param kwargs: 其他部件相关参数
221
+
222
+ """
223
+ def get_part_info(name):
224
+ """
225
+ 获取策略部件信息
226
+
227
+ :param str name: 部件名称
228
+
229
+ """
230
+ def get_part_name_list(hub = None, part_type = None):
231
+ """
232
+ 获取部件名称列表
233
+ :param str hub: 仓库名
234
+ :param str part_type: 部件类型
235
+
236
+ """
237
+ def handle_remove_read_only(func, path, exc):
238
+ ...
239
+ def print_part_info(name):
240
+ ...
241
+ def remove_hub(name):
242
+ """
243
+ 删除指定的仓库
244
+
245
+ :param str name: 仓库名称
246
+
247
+ """
248
+ def update_hub(name):
249
+ """
250
+ 更新指定仓库
251
+
252
+ :param str name: 仓库名称
253
+
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;
@@ -138,6 +138,9 @@ public:
138
138
  */
139
139
  PriceList getResultAsPriceList(size_t num) const;
140
140
 
141
+ /** 指定结果集中是否包含 nan 值 */
142
+ bool existNan(size_t result_idx) const;
143
+
141
144
  /**
142
145
  * 获取 DatetimeList
143
146
  */
@@ -259,6 +262,10 @@ inline DatetimeList Indicator::getDatetimeList() const {
259
262
  return m_imp ? m_imp->getDatetimeList() : DatetimeList();
260
263
  }
261
264
 
265
+ inline bool Indicator::existNan(size_t result_idx) const {
266
+ return m_imp ? m_imp->existNan(result_idx) : false;
267
+ }
268
+
262
269
  inline Indicator::value_t Indicator::getByDate(Datetime date, size_t num) const {
263
270
  return m_imp ? m_imp->getByDate(date, num) : Null<Indicator::value_t>();
264
271
  }
@@ -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
@@ -109,6 +109,9 @@ public:
109
109
  */
110
110
  void _readyBuffer(size_t len, size_t result_num);
111
111
 
112
+ /** 数据中是否包含 nan 值 */
113
+ bool existNan(size_t result_idx = 0) const;
114
+
112
115
  const string& name() const;
113
116
  void name(const string& name);
114
117
 
@@ -149,9 +152,7 @@ public:
149
152
  // ===================
150
153
  // 子类接口
151
154
  // ===================
152
- virtual void _calculate(const Indicator&) {
153
- HKU_WARN("{} will be empty always!", m_name);
154
- }
155
+ virtual void _calculate(const Indicator&);
155
156
 
156
157
  virtual void _dyn_run_one_step(const Indicator& ind, size_t curPos, size_t step) {}
157
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,11 +55,19 @@
53
55
  #include "crt/HSL.h"
54
56
  #include "crt/IC.h"
55
57
  #include "crt/ICIR.h"
58
+ #include "crt/INBLOCK.h"
59
+ #include "crt/INDEX.h"
56
60
  #include "crt/INSUM.h"
57
61
  #include "crt/IR.h"
58
62
  #include "crt/INTPART.h"
63
+ #include "crt/ISINF.h"
64
+ #include "crt/ISINFA.h"
59
65
  #include "crt/ISLASTBAR.h"
66
+ #include "crt/ISNA.h"
67
+ #include "crt/JUMPUP.h"
68
+ #include "crt/JUMPDOWN.h"
60
69
  #include "crt/LAST.h"
70
+ #include "crt/LASTVALUE.h"
61
71
  #include "crt/LIUTONGPAN.h"
62
72
  #include "crt/LLV.h"
63
73
  #include "crt/LLVBARS.h"
@@ -78,6 +88,7 @@
78
88
  #include "crt/PRICELIST.h"
79
89
  #include "crt/RECOVER.h"
80
90
  #include "crt/REF.h"
91
+ #include "crt/REPLACE.h"
81
92
  #include "crt/RESULT.h"
82
93
  #include "crt/REVERSE.h"
83
94
  #include "crt/ROC.h"
@@ -109,6 +120,7 @@
109
120
  #include "crt/VAR.h"
110
121
  #include "crt/VARP.h"
111
122
  #include "crt/VIGOR.h"
123
+ #include "crt/WINNER.h"
112
124
  #include "crt/WMA.h"
113
125
  #include "crt/ZHBOND10.h"
114
126
  #include "crt/ZONGGUBEN.h"
@@ -22,10 +22,12 @@ namespace hku {
22
22
  * @param market 所属市场,等于 "" 时,获取所有市场
23
23
  * @param stk_type 证券类型, 大于 constant.STOCKTYPE_TMP 时,获取所有类型证券
24
24
  * @param ignore_context 是否忽略上下文。忽略时,强制使用 query, market, stk_type 参数。
25
+ * @param fill_null 数据对齐时,缺失日期数据填充 nan 值。
25
26
  * @ingroup Indicator
26
27
  */
27
28
  Indicator HKU_API ADVANCE(const KQuery& query = KQueryByIndex(-100), const string& market = "SH",
28
- int stk_type = STOCKTYPE_A, bool ignore_context = false);
29
+ int stk_type = STOCKTYPE_A, bool ignore_context = false,
30
+ bool fill_null = true);
29
31
 
30
32
  } // namespace hku
31
33
 
@@ -15,8 +15,8 @@ namespace hku {
15
15
  * 独立上下文指标
16
16
  * @ingroup Indicator
17
17
  */
18
- Indicator HKU_API CONTEXT(const Indicator& ind);
19
- Indicator HKU_API CONTEXT();
18
+ Indicator HKU_API CONTEXT(const Indicator& ind, bool fill_null = true);
19
+ Indicator HKU_API CONTEXT(bool fill_null = true);
20
20
 
21
21
  /**
22
22
  * 获取指标上下文
@@ -16,9 +16,11 @@ namespace hku {
16
16
  * @param ind1 指标1
17
17
  * @param ind2 指标2
18
18
  * @param n 滚动窗口 (大于2或等于0),等于0时使用输入的ind实际长度。
19
+ * @param fill_null 日期对齐时,缺失日期填充 nan 值
19
20
  * @ingroup Indicator
20
21
  */
21
- Indicator HKU_API CORR(const Indicator& ind1, const Indicator& ind2, int n = 10);
22
- Indicator HKU_API CORR(const Indicator& ref_ind, int n = 10);
22
+ Indicator HKU_API CORR(const Indicator& ind1, const Indicator& ind2, int n = 10,
23
+ bool fill_null = true);
24
+ Indicator HKU_API CORR(const Indicator& ref_ind, int n = 10, bool fill_null = true);
23
25
 
24
26
  } // namespace hku
@@ -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
@@ -22,10 +22,12 @@ namespace hku {
22
22
  * @param market 所属市场,等于 "" 时,获取所有市场
23
23
  * @param stk_type 证券类型, 大于 constant.STOCKTYPE_TMP 时,获取所有类型证券
24
24
  * @param ignore_context 是否忽略上下文。忽略时,强制使用 query, market, stk_type 参数。
25
+ * @param fill_null 日期对齐时,缺失数据填充 nan 值
25
26
  * @ingroup Indicator
26
27
  */
27
28
  Indicator HKU_API DECLINE(const KQuery& query = KQueryByIndex(-100), const string& market = "SH",
28
- int stk_type = STOCKTYPE_A, bool ignore_context = false);
29
+ int stk_type = STOCKTYPE_A, bool ignore_context = false,
30
+ bool fill_null = true);
29
31
 
30
32
  } // namespace hku
31
33
 
@@ -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_ */
@@ -25,9 +25,10 @@ namespace hku {
25
25
  * </pre>
26
26
  * @param ind1 待计算的数据
27
27
  * @param a 动态系数
28
+ * @param fill_null 日期对齐时缺失数据填充nan值
28
29
  * @ingroup Indicator
29
30
  */
30
- Indicator HKU_API DMA(const Indicator& x, const Indicator& a);
31
+ Indicator HKU_API DMA(const Indicator& x, const Indicator& a, bool fill_null = true);
31
32
 
32
33
  } // namespace hku
33
34
 
@@ -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