hikyuu 2.6.6__py3-none-win_amd64.whl → 2.6.8__py3-none-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hikyuu/__init__.py +16 -2
- hikyuu/__init__.pyi +658 -627
- hikyuu/analysis/__init__.pyi +563 -519
- hikyuu/analysis/analysis.pyi +583 -541
- hikyuu/core.pyi +565 -521
- hikyuu/cpp/__init__.pyi +2 -2
- hikyuu/cpp/concrt140.dll +0 -0
- hikyuu/cpp/core310.pyd +0 -0
- hikyuu/cpp/core310.pyi +1424 -865
- hikyuu/cpp/core311.pyd +0 -0
- hikyuu/cpp/core311.pyi +1424 -865
- hikyuu/cpp/core312.pyd +0 -0
- hikyuu/cpp/core312.pyi +1424 -865
- hikyuu/cpp/core313.pyd +0 -0
- hikyuu/cpp/core313.pyi +1424 -863
- hikyuu/cpp/core39.pyd +0 -0
- hikyuu/cpp/core39.pyi +1424 -865
- hikyuu/cpp/hikyuu.dll +0 -0
- hikyuu/cpp/hikyuu.lib +0 -0
- hikyuu/cpp/hku_hdf5.dll +0 -0
- hikyuu/cpp/hku_hdf5_cpp.dll +0 -0
- hikyuu/cpp/hku_hdf5_hl.dll +0 -0
- hikyuu/cpp/hku_hdf5_hl_cpp.dll +0 -0
- hikyuu/cpp/i18n/zh_CN/__init__.py +0 -0
- hikyuu/cpp/i18n/zh_CN/hikyuu.mo +0 -0
- hikyuu/cpp/msvcp140.dll +0 -0
- hikyuu/cpp/msvcp140_1.dll +0 -0
- hikyuu/cpp/msvcp140_2.dll +0 -0
- hikyuu/cpp/msvcp140_atomic_wait.dll +0 -0
- hikyuu/cpp/msvcp140_codecvt_ids.dll +0 -0
- hikyuu/cpp/sqlite3.dll +0 -0
- hikyuu/cpp/vcruntime140.dll +0 -0
- hikyuu/cpp/vcruntime140_1.dll +0 -0
- hikyuu/data/common_clickhouse.py +0 -47
- hikyuu/data/tdx_to_h5.py +1 -1
- hikyuu/draw/drawplot/__init__.pyi +32 -37
- hikyuu/draw/drawplot/bokeh_draw.pyi +651 -632
- hikyuu/draw/drawplot/common.pyi +3 -4
- hikyuu/draw/drawplot/echarts_draw.py +9 -8
- hikyuu/draw/drawplot/echarts_draw.pyi +598 -567
- hikyuu/draw/drawplot/matplotlib_draw.py +3 -3
- hikyuu/draw/drawplot/matplotlib_draw.pyi +872 -874
- hikyuu/draw/elder.pyi +19 -20
- hikyuu/draw/kaufman.py +1 -1
- hikyuu/draw/kaufman.pyi +18 -18
- hikyuu/draw/volume.pyi +10 -10
- hikyuu/examples/notebook/000-Index.ipynb +1 -1
- hikyuu/examples/notebook/001-overview.ipynb +78 -63
- hikyuu/examples/notebook/002-HowToGetStock.ipynb +259 -40
- hikyuu/examples/notebook/003-HowToGetKDataAndDraw.ipynb +49 -41
- hikyuu/examples/notebook/004-IndicatorOverview.ipynb +29 -29
- hikyuu/examples/notebook/005-Drawplot.ipynb +66 -37
- hikyuu/examples/notebook/006-TradeManager.ipynb +808 -61
- hikyuu/examples/notebook/007-SystemDetails.ipynb +23 -23
- hikyuu/examples/notebook/009-RealData.ipynb +3 -3
- hikyuu/examples/notebook/010-Portfolio.ipynb +761 -122
- hikyuu/extend.py +32 -98
- hikyuu/extend.pyi +597 -593
- hikyuu/gui/HikyuuTDX.py +2 -4
- hikyuu/gui/data/MainWindow.py +185 -174
- hikyuu/hub.pyi +69 -67
- hikyuu/include/hikyuu/DataType.h +3 -12
- hikyuu/include/hikyuu/KData.h +83 -25
- hikyuu/include/hikyuu/KDataImp.h +31 -46
- hikyuu/include/hikyuu/KDataPrivatedBufferImp.h +73 -0
- hikyuu/include/hikyuu/KDataSharedBufferImp.h +69 -0
- hikyuu/include/hikyuu/KQuery.h +38 -32
- hikyuu/include/hikyuu/KRecord.h +4 -1
- hikyuu/include/hikyuu/MarketInfo.h +1 -1
- hikyuu/include/hikyuu/Stock.h +24 -6
- hikyuu/include/hikyuu/StockManager.h +15 -6
- hikyuu/include/hikyuu/StockTypeInfo.h +6 -0
- hikyuu/include/hikyuu/TransRecord.h +2 -8
- hikyuu/include/hikyuu/data_driver/KDataDriver.h +5 -0
- hikyuu/include/hikyuu/doc.h +4 -0
- hikyuu/include/hikyuu/global/GlobalSpotAgent.h +8 -0
- hikyuu/include/hikyuu/global/agent/SpotAgent.h +12 -7
- hikyuu/include/hikyuu/indicator/Indicator.h +48 -0
- hikyuu/include/hikyuu/indicator/Indicator2InImp.h +9 -0
- hikyuu/include/hikyuu/indicator/IndicatorImp.h +83 -15
- hikyuu/include/hikyuu/indicator/build_in.h +1 -0
- hikyuu/include/hikyuu/indicator/crt/AMA.h +2 -1
- hikyuu/include/hikyuu/indicator/crt/ATR.h +1 -1
- hikyuu/include/hikyuu/indicator/crt/CONTEXT.h +2 -0
- hikyuu/include/hikyuu/indicator/crt/CYCLE.h +3 -0
- hikyuu/include/hikyuu/indicator/crt/DMA.h +1 -1
- hikyuu/include/hikyuu/indicator/crt/IC.h +14 -6
- hikyuu/include/hikyuu/indicator/crt/ICIR.h +8 -4
- hikyuu/include/hikyuu/indicator/crt/INSUM.h +2 -0
- hikyuu/include/hikyuu/indicator/crt/PRICELIST.h +2 -0
- hikyuu/include/hikyuu/indicator/crt/REFX.h +25 -0
- hikyuu/include/hikyuu/indicator/crt/SLICE.h +4 -4
- hikyuu/include/hikyuu/indicator/crt/SPEARMAN.h +3 -2
- hikyuu/include/hikyuu/indicator/imp/IContext.h +5 -0
- hikyuu/include/hikyuu/indicator/imp/ICval.h +6 -0
- hikyuu/include/hikyuu/indicator/imp/IDropna.h +9 -0
- hikyuu/include/hikyuu/indicator/imp/IIc.h +2 -1
- hikyuu/include/hikyuu/indicator/imp/IPriceList.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/IRefX.h +23 -0
- hikyuu/include/hikyuu/lang.h +27 -0
- hikyuu/include/hikyuu/plugin/KDataToHdf5Importer.h +6 -1
- hikyuu/include/hikyuu/plugin/backtest.h +2 -0
- hikyuu/include/hikyuu/plugin/extind.h +45 -0
- hikyuu/include/hikyuu/plugin/hkuextra.h +77 -0
- hikyuu/include/hikyuu/plugin/interface/HkuExtraPluginInterface.h +54 -0
- hikyuu/include/hikyuu/plugin/interface/ImportKDataToHdf5PluginInterface.h +10 -1
- hikyuu/include/hikyuu/plugin/interface/TMReportPluginInterface.h +1 -0
- hikyuu/include/hikyuu/plugin/interface/plugins.h +2 -0
- hikyuu/include/hikyuu/python/pybind_utils.h +28 -11
- hikyuu/include/hikyuu/trade_manage/Performance.h +0 -1
- hikyuu/include/hikyuu/trade_manage/TradeCostBase.h +5 -0
- hikyuu/include/hikyuu/trade_manage/TradeManager.h +4 -0
- hikyuu/include/hikyuu/trade_manage/TradeManagerBase.h +10 -1
- hikyuu/include/hikyuu/trade_manage/TradeRecord.h +1 -1
- hikyuu/include/hikyuu/trade_sys/allocatefunds/AllocateFundsBase.h +5 -0
- hikyuu/include/hikyuu/trade_sys/condition/ConditionBase.h +5 -0
- hikyuu/include/hikyuu/trade_sys/environment/EnvironmentBase.h +5 -0
- hikyuu/include/hikyuu/trade_sys/moneymanager/MoneyManagerBase.h +5 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/MultiFactorBase.h +6 -3
- hikyuu/include/hikyuu/trade_sys/portfolio/Portfolio.h +4 -0
- hikyuu/include/hikyuu/trade_sys/profitgoal/ProfitGoalBase.h +5 -0
- hikyuu/include/hikyuu/trade_sys/selector/SelectorBase.h +5 -2
- hikyuu/include/hikyuu/trade_sys/signal/SignalBase.h +5 -0
- hikyuu/include/hikyuu/trade_sys/slippage/SlippageBase.h +5 -0
- hikyuu/include/hikyuu/trade_sys/stoploss/StoplossBase.h +6 -1
- hikyuu/include/hikyuu/trade_sys/system/System.h +5 -0
- hikyuu/include/hikyuu/utilities/config.h +0 -2
- hikyuu/include/hikyuu/utilities/datetime/Datetime.h +2 -2
- hikyuu/include/hikyuu/utilities/os.h +7 -0
- hikyuu/include/hikyuu/utilities/plugin/PluginLoader.h +2 -1
- hikyuu/include/hikyuu/utilities/thread/GlobalMQStealThreadPool.h +1 -1
- hikyuu/include/hikyuu/utilities/thread/GlobalMQThreadPool.h +1 -1
- hikyuu/include/hikyuu/utilities/thread/GlobalThreadPool.h +1 -1
- hikyuu/include/hikyuu/utilities/thread/MQThreadPool.h +1 -1
- hikyuu/include/hikyuu/version.h +4 -4
- hikyuu/include/hikyuu/views/arrow_common.h +38 -0
- hikyuu/include/hikyuu/views/arrow_views.h +117 -0
- hikyuu/indicator/__init__.py +0 -1
- hikyuu/indicator/indicator.py +17 -57
- hikyuu/plugin/backtest.dll +0 -0
- hikyuu/plugin/clickhousedriver.dll +0 -0
- hikyuu/plugin/dataserver.dll +0 -0
- hikyuu/plugin/device.dll +0 -0
- hikyuu/plugin/extind.dll +0 -0
- hikyuu/plugin/hkuextra.dll +0 -0
- hikyuu/plugin/import2hdf5.dll +0 -0
- hikyuu/plugin/tmreport.dll +0 -0
- hikyuu/strategy/strategy_demo1.py +1 -1
- hikyuu/test/test_init.py +73 -14
- hikyuu/test/test_real_tdx_import.py +336 -0
- hikyuu/test/test_tdx_import.py +315 -0
- hikyuu/test/test_tdx_real_data_import.py +281 -0
- hikyuu/trade_manage/__init__.pyi +583 -553
- hikyuu/trade_manage/broker.pyi +19 -18
- hikyuu/trade_manage/broker_easytrader.pyi +6 -4
- hikyuu/trade_manage/broker_mail.pyi +22 -24
- hikyuu/trade_manage/trade.py +10 -65
- hikyuu/trade_manage/trade.pyi +583 -565
- hikyuu/trade_sys/__init__.py +15 -0
- hikyuu/util/__init__.pyi +0 -1
- hikyuu/util/check.pyi +17 -15
- hikyuu/util/mylog.pyi +8 -7
- hikyuu/util/notebook.pyi +9 -11
- hikyuu/util/singleton.pyi +8 -6
- {hikyuu-2.6.6.dist-info → hikyuu-2.6.8.dist-info}/METADATA +8 -4
- {hikyuu-2.6.6.dist-info → hikyuu-2.6.8.dist-info}/RECORD +172 -160
- {hikyuu-2.6.6.dist-info → hikyuu-2.6.8.dist-info}/top_level.txt +2 -1
- hikyuu/cpp/i18n/zh_CN.mo +0 -0
- hikyuu/include/hikyuu/utilities/mo/mo.h +0 -64
- hikyuu/indicator/talib_wrap.py +0 -1273
- /hikyuu/include/hikyuu/utilities/{mo/moFileReader.h → moFileReader.h} +0 -0
- /hikyuu/include/hikyuu/{utilities/mo → views}/__init__.py +0 -0
- {hikyuu-2.6.6.dist-info → hikyuu-2.6.8.dist-info}/LICENSE +0 -0
- {hikyuu-2.6.6.dist-info → hikyuu-2.6.8.dist-info}/WHEEL +0 -0
- {hikyuu-2.6.6.dist-info → hikyuu-2.6.8.dist-info}/entry_points.txt +0 -0
hikyuu/extend.py
CHANGED
|
@@ -13,6 +13,9 @@ from datetime import datetime, timedelta, date # NOQA: E402
|
|
|
13
13
|
import numpy as np # NOQA: E402
|
|
14
14
|
import pandas as pd # NOQA: E402
|
|
15
15
|
|
|
16
|
+
# 解决中文对齐问题
|
|
17
|
+
pd.set_option('display.unicode.ambiguous_as_wide', True)
|
|
18
|
+
pd.set_option('display.unicode.east_asian_width', True)
|
|
16
19
|
|
|
17
20
|
# ------------------------------------------------------------------
|
|
18
21
|
# 增加Datetime、Stock的hash支持,以便可做为dict的key
|
|
@@ -152,43 +155,6 @@ TimeDelta.__add__ = __new_TimeDelta_add__
|
|
|
152
155
|
TimeDelta.__sub__ = __new_TimeDelta_sub__
|
|
153
156
|
TimeDelta.timedelta = TimeDelta_timedelta
|
|
154
157
|
|
|
155
|
-
# ------------------------------------------------------------------
|
|
156
|
-
# 增强 KData 的遍历
|
|
157
|
-
# ------------------------------------------------------------------
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
def KData_getitem(kdata, i):
|
|
161
|
-
"""
|
|
162
|
-
:param i: int | Datetime | slice | str 类型
|
|
163
|
-
"""
|
|
164
|
-
if isinstance(i, int):
|
|
165
|
-
length = len(kdata)
|
|
166
|
-
index = length + i if i < 0 else i
|
|
167
|
-
if index < 0 or index >= length:
|
|
168
|
-
raise IndexError("index out of range: %d" % i)
|
|
169
|
-
return kdata.get(index)
|
|
170
|
-
|
|
171
|
-
elif isinstance(i, Datetime):
|
|
172
|
-
return kdata.get_by_datetime(i)
|
|
173
|
-
|
|
174
|
-
elif isinstance(i, str):
|
|
175
|
-
return kdata.get_by_datetime(Datetime(i))
|
|
176
|
-
|
|
177
|
-
elif isinstance(i, slice):
|
|
178
|
-
return [kdata.get(x) for x in range(*i.indices(len(kdata)))]
|
|
179
|
-
|
|
180
|
-
else:
|
|
181
|
-
raise IndexError("Error index type")
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
def KData_iter(kdata):
|
|
185
|
-
for i in range(len(kdata)):
|
|
186
|
-
yield kdata[i]
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
KData.__getitem__ = KData_getitem
|
|
190
|
-
KData.__iter__ = KData_iter
|
|
191
|
-
|
|
192
158
|
|
|
193
159
|
# ------------------------------------------------------------------
|
|
194
160
|
# 重定义Query
|
|
@@ -247,83 +213,51 @@ Query.__init__ = new_Query_init
|
|
|
247
213
|
# ------------------------------------------------------------------
|
|
248
214
|
# 增加转化为 np.array、pandas.DataFrame 的功能
|
|
249
215
|
# ------------------------------------------------------------------
|
|
250
|
-
def
|
|
251
|
-
|
|
252
|
-
if kdata.get_query().ktype in ('DAY', 'WEEK', 'MONTH', 'QUARTER', 'HALFYEAR', 'YEAR'):
|
|
253
|
-
k_type = np.dtype(
|
|
254
|
-
{
|
|
255
|
-
'names': ['datetime', 'open', 'high', 'low', 'close', 'amount', 'volume'],
|
|
256
|
-
'formats': ['datetime64[D]', 'd', 'd', 'd', 'd', 'd', 'd']
|
|
257
|
-
}
|
|
258
|
-
)
|
|
259
|
-
else:
|
|
260
|
-
k_type = np.dtype(
|
|
261
|
-
{
|
|
262
|
-
'names': ['datetime', 'open', 'high', 'low', 'close', 'amount', 'volume'],
|
|
263
|
-
'formats': ['datetime64[ms]', 'd', 'd', 'd', 'd', 'd', 'd']
|
|
264
|
-
}
|
|
265
|
-
)
|
|
266
|
-
return np.array(
|
|
267
|
-
[(k.datetime.datetime(), k.open, k.high, k.low, k.close, k.amount, k.volume) for k in kdata], dtype=k_type
|
|
268
|
-
)
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
def KData_to_df(kdata):
|
|
272
|
-
"""转化为pandas的DataFrame"""
|
|
273
|
-
return pd.DataFrame.from_records(KData_to_np(kdata), index='datetime')
|
|
274
|
-
|
|
216
|
+
def DatetimeList_to_np(data: DatetimeList):
|
|
217
|
+
return dates_to_np(data)
|
|
275
218
|
|
|
276
|
-
KData.to_np = KData_to_np
|
|
277
|
-
KData.to_df = KData_to_df
|
|
278
219
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
"""仅在安装了numpy模块时生效,转换为numpy.array"""
|
|
282
|
-
return np.array(data, dtype='datetime64[D]')
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
def DatetimeList_to_df(data):
|
|
286
|
-
"""仅在安装了pandas模块时生效,转换为pandas.DataFrame"""
|
|
287
|
-
return pd.DataFrame(data.to_np(), columns=('Datetime', ))
|
|
220
|
+
def DatetimeList_to_df(data: DatetimeList):
|
|
221
|
+
return pd.DataFrame.from_records(dates_to_np(data))
|
|
288
222
|
|
|
289
223
|
|
|
290
224
|
DatetimeList.to_np = DatetimeList_to_np
|
|
291
225
|
DatetimeList.to_df = DatetimeList_to_df
|
|
226
|
+
DatetimeList.to_numpy = DatetimeList.to_np
|
|
227
|
+
DatetimeList.to_pandas = DatetimeList.to_df
|
|
228
|
+
DatetimeList.to_pyarrow = lambda data: dates_to_pa(data)
|
|
292
229
|
|
|
293
230
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
231
|
+
TimeLineList.to_np = lambda data: timeline_to_np(data)
|
|
232
|
+
TimeLineList.to_df = lambda data: timeline_to_df(data)
|
|
233
|
+
TimeLineList.to_numpy = TimeLineList.to_np
|
|
234
|
+
TimeLineList.to_pandas = TimeLineList.to_df
|
|
235
|
+
TimeLineList.to_pyarrow = lambda data: timeline_to_pa(data)
|
|
298
236
|
|
|
299
237
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
238
|
+
TransList.to_np = lambda data: translist_to_np(data)
|
|
239
|
+
TransList.to_df = lambda data: translist_to_df(data)
|
|
240
|
+
TransList.to_numpy = TransList.to_np
|
|
241
|
+
TransList.to_pandas = TransList.to_df
|
|
242
|
+
TransList.to_pyarrow = lambda data: translist_to_pa(data)
|
|
303
243
|
|
|
304
244
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
"""转化为numpy结构数组"""
|
|
311
|
-
t_type = np.dtype(
|
|
312
|
-
{
|
|
313
|
-
'names': ['datetime', 'price', 'vol', 'direct'],
|
|
314
|
-
'formats': ['datetime64[ms]', 'd', 'd', 'd']
|
|
315
|
-
}
|
|
316
|
-
)
|
|
317
|
-
return np.array([(t.date.datetime(), t.price, t.vol, t.direct) for t in data], dtype=t_type)
|
|
245
|
+
StockWeightList.to_np = lambda data: weights_to_np(data)
|
|
246
|
+
StockWeightList.to_df = lambda data: weights_to_df(data)
|
|
247
|
+
StockWeightList.to_numpy = StockWeightList.to_np
|
|
248
|
+
StockWeightList.to_pandas = StockWeightList.to_df
|
|
249
|
+
StockWeightList.to_pyarrow = lambda data: weights_to_pa(data)
|
|
318
250
|
|
|
319
251
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
252
|
+
KRecordList.to_np = lambda data: krecords_to_np(data)
|
|
253
|
+
KRecordList.to_df = lambda data: krecords_to_df(data)
|
|
254
|
+
KRecordList.to_numpy = KRecordList.to_np
|
|
255
|
+
KRecordList.to_pandas = KRecordList.to_df
|
|
256
|
+
KRecordList.to_pyarrow = lambda data: krecords_to_pa(data)
|
|
323
257
|
|
|
258
|
+
KData.to_numpy = KData.to_np
|
|
259
|
+
KData.to_pandas = KData.to_df
|
|
324
260
|
|
|
325
|
-
TransList.to_np = TransList_to_np
|
|
326
|
-
TransList.to_df = TransList_to_df
|
|
327
261
|
|
|
328
262
|
# ------------------------------------------------------------------
|
|
329
263
|
# 增强 Parameter
|