hikyuu 2.5.6__py3-none-win_amd64.whl → 2.6.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 (118) hide show
  1. hikyuu/__init__.py +33 -49
  2. hikyuu/__init__.pyi +530 -516
  3. hikyuu/analysis/__init__.pyi +498 -490
  4. hikyuu/analysis/analysis.pyi +499 -491
  5. hikyuu/core.pyi +500 -492
  6. hikyuu/cpp/__init__.pyi +2 -2
  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/core310.pyi +187 -22
  12. hikyuu/cpp/core311.pyd +0 -0
  13. hikyuu/cpp/core311.pyi +187 -22
  14. hikyuu/cpp/core312.pyd +0 -0
  15. hikyuu/cpp/core312.pyi +187 -22
  16. hikyuu/cpp/core313.pyd +0 -0
  17. hikyuu/cpp/core313.pyi +186 -22
  18. hikyuu/cpp/core39.pyd +0 -0
  19. hikyuu/cpp/core39.pyi +187 -22
  20. hikyuu/cpp/hikyuu.dll +0 -0
  21. hikyuu/cpp/hikyuu.lib +0 -0
  22. hikyuu/draw/__init__.pyi +1 -1
  23. hikyuu/draw/drawplot/__init__.py +2 -0
  24. hikyuu/draw/drawplot/__init__.pyi +9 -8
  25. hikyuu/draw/drawplot/bokeh_draw.pyi +519 -506
  26. hikyuu/draw/drawplot/common.pyi +1 -1
  27. hikyuu/draw/drawplot/echarts_draw.pyi +521 -508
  28. hikyuu/draw/drawplot/matplotlib_draw.py +80 -0
  29. hikyuu/draw/drawplot/matplotlib_draw.pyi +540 -517
  30. hikyuu/draw/elder.pyi +11 -11
  31. hikyuu/draw/kaufman.pyi +18 -18
  32. hikyuu/draw/volume.pyi +10 -10
  33. hikyuu/examples/notebook/002-HowToGetStock.ipynb +1 -1
  34. hikyuu/examples/notebook/004-IndicatorOverview.ipynb +117 -52
  35. hikyuu/extend.pyi +507 -500
  36. hikyuu/gui/HikyuuTDX.py +85 -15
  37. hikyuu/gui/data/ImportQmtToH5Task.py +209 -0
  38. hikyuu/gui/data/ImportTdxToH5Task.py +8 -1
  39. hikyuu/gui/data/MainWindow.py +94 -13
  40. hikyuu/gui/data/UseQmtImportToH5Thread.py +316 -0
  41. hikyuu/gui/data/UseTdxImportToH5Thread.py +221 -65
  42. hikyuu/gui/dataserver.py +25 -0
  43. hikyuu/gui/images/star.png +0 -0
  44. hikyuu/gui/importdata.py +24 -11
  45. hikyuu/hub.pyi +6 -6
  46. hikyuu/include/hikyuu/KData.h +5 -0
  47. hikyuu/include/hikyuu/KDataImp.h +4 -0
  48. hikyuu/include/hikyuu/StockManager.h +23 -0
  49. hikyuu/include/hikyuu/data_driver/kdata/mysql/KRecordTable.h +41 -2
  50. hikyuu/include/hikyuu/global/agent/spot_generated.h +3 -3
  51. hikyuu/include/hikyuu/indicator/crt/COUNT.h +3 -3
  52. hikyuu/include/hikyuu/indicator/crt/DISCARD.h +1 -1
  53. hikyuu/include/hikyuu/indicator/crt/ISINF.h +1 -1
  54. hikyuu/include/hikyuu/indicator/crt/ISINFA.h +1 -1
  55. hikyuu/include/hikyuu/indicator/crt/ISNA.h +1 -1
  56. hikyuu/include/hikyuu/indicator/crt/LAST.h +2 -2
  57. hikyuu/include/hikyuu/indicator/crt/MAX.h +1 -1
  58. hikyuu/include/hikyuu/indicator/crt/MIN.h +1 -1
  59. hikyuu/include/hikyuu/indicator/crt/PRICELIST.h +1 -15
  60. hikyuu/include/hikyuu/indicator/crt/SUMBARS.h +1 -1
  61. hikyuu/include/hikyuu/plugin/KDataToHdf5Importer.h +33 -0
  62. hikyuu/include/hikyuu/plugin/__init__.py +1 -0
  63. hikyuu/include/hikyuu/plugin/backtest.h +37 -0
  64. hikyuu/include/hikyuu/plugin/dataserver.h +18 -0
  65. hikyuu/include/hikyuu/plugin/device.h +29 -0
  66. hikyuu/include/hikyuu/plugin/interface/BackTestPluginInterface.h +26 -0
  67. hikyuu/include/hikyuu/plugin/interface/DataServerPluginInterface.h +23 -0
  68. hikyuu/include/hikyuu/plugin/interface/DevicePluginInterface.h +25 -0
  69. hikyuu/include/hikyuu/plugin/interface/ImportKDataToHdf5PluginInterface.h +33 -0
  70. hikyuu/include/hikyuu/plugin/interface/__init__.py +1 -0
  71. hikyuu/include/hikyuu/plugin/interface/plugins.h +22 -0
  72. hikyuu/include/hikyuu/python/pybind_utils.h +8 -0
  73. hikyuu/include/hikyuu/strategy/BrokerTradeManager.h +2 -1
  74. hikyuu/include/hikyuu/strategy/RunPortfolioInStrategy.h +1 -0
  75. hikyuu/include/hikyuu/strategy/Strategy.h +93 -16
  76. hikyuu/include/hikyuu/trade_manage/TradeManagerBase.h +4 -2
  77. hikyuu/include/hikyuu/trade_sys/portfolio/Portfolio.h +2 -1
  78. hikyuu/include/hikyuu/trade_sys/selector/SelectorBase.h +12 -9
  79. hikyuu/include/hikyuu/trade_sys/selector/imp/MultiFactorSelector.h +1 -1
  80. hikyuu/include/hikyuu/trade_sys/selector/imp/logic/OperatorSelector.h +12 -12
  81. hikyuu/include/hikyuu/trade_sys/selector/imp/logic/OperatorValueSelector.h +2 -2
  82. hikyuu/include/hikyuu/trade_sys/selector/imp/optimal/PerformanceOptimalSelector.h +1 -1
  83. hikyuu/include/hikyuu/trade_sys/system/System.h +12 -3
  84. hikyuu/include/hikyuu/trade_sys/system/imp/DelegateSystem.h +0 -1
  85. hikyuu/include/hikyuu/trade_sys/system/imp/WalkForwardSystem.h +0 -1
  86. hikyuu/include/hikyuu/trade_sys/system/imp/WalkForwardTradeManager.h +3 -2
  87. hikyuu/include/hikyuu/utilities/arithmetic.h +32 -22
  88. hikyuu/include/hikyuu/utilities/datetime/Datetime.h +1 -0
  89. hikyuu/include/hikyuu/utilities/plugin/PluginClient.h +2 -2
  90. hikyuu/include/hikyuu/utilities/plugin/PluginLoader.h +66 -13
  91. hikyuu/include/hikyuu/utilities/plugin/PluginManager.h +72 -0
  92. hikyuu/include/hikyuu/version.h +5 -5
  93. hikyuu/plugin/__init__.py +1 -0
  94. hikyuu/plugin/backtest.dll +0 -0
  95. hikyuu/plugin/dataserver.dll +0 -0
  96. hikyuu/plugin/device.dll +0 -0
  97. hikyuu/plugin/import2hdf5.dll +0 -0
  98. hikyuu/strategy/strategy_demo1.py +7 -8
  99. hikyuu/strategy/strategy_demo2.py +1 -1
  100. hikyuu/trade_manage/__init__.pyi +518 -505
  101. hikyuu/trade_manage/broker.pyi +3 -3
  102. hikyuu/trade_manage/broker_easytrader.pyi +1 -1
  103. hikyuu/trade_manage/trade.pyi +518 -505
  104. hikyuu/util/__init__.py +1 -0
  105. hikyuu/util/__init__.pyi +2 -1
  106. hikyuu/util/mylog.py +30 -3
  107. hikyuu/util/mylog.pyi +3 -1
  108. hikyuu/util/singleton.pyi +1 -1
  109. {hikyuu-2.5.6.dist-info → hikyuu-2.6.1.dist-info}/METADATA +6 -2
  110. {hikyuu-2.5.6.dist-info → hikyuu-2.6.1.dist-info}/RECORD +115 -97
  111. {hikyuu-2.5.6.dist-info → hikyuu-2.6.1.dist-info}/entry_points.txt +1 -0
  112. {hikyuu-2.5.6.dist-info → hikyuu-2.6.1.dist-info}/top_level.txt +4 -0
  113. hikyuu/cpp/core38.pyd +0 -0
  114. hikyuu/cpp/core38.pyi +0 -13173
  115. hikyuu/examples/notebook/011-PyechartsDrawplot.ipynb +0 -21821
  116. /hikyuu/gui/{hikyuu_small.png → images/hikyuu_small.png} +0 -0
  117. {hikyuu-2.5.6.dist-info → hikyuu-2.6.1.dist-info}/LICENSE +0 -0
  118. {hikyuu-2.5.6.dist-info → hikyuu-2.6.1.dist-info}/WHEEL +0 -0
@@ -9,6 +9,7 @@
9
9
  #define HIKYUU_DATA_DRIVER_KDATA_MYSQL_KRECORDTABLE_H
10
10
 
11
11
  #include "../../../KQuery.h"
12
+ #include "../../../KRecord.h"
12
13
  #include "../../../utilities/db_connect/SQLStatementBase.h"
13
14
 
14
15
  namespace hku {
@@ -32,6 +33,45 @@ public:
32
33
  to_lower(m_db_name);
33
34
  };
34
35
 
36
+ KRecordTable(const string& market, const string& code, const KQuery::KType& ktype,
37
+ const KRecord& record)
38
+ : KRecordTable(market, code, ktype) {
39
+ m_date = record.datetime.ymdhm();
40
+ m_open = record.openPrice;
41
+ m_high = record.highPrice;
42
+ m_low = record.lowPrice;
43
+ m_close = record.closePrice;
44
+ m_count = record.transCount;
45
+ m_amount = record.transAmount;
46
+ }
47
+
48
+ KRecordTable(const KRecordTable&) = default;
49
+ KRecordTable& operator=(const KRecordTable&) = default;
50
+ KRecordTable(KRecordTable&& rhs)
51
+ : m_db_name(std::move(rhs.m_db_name)),
52
+ m_code(std::move(rhs.m_code)),
53
+ m_date(rhs.m_date),
54
+ m_open(rhs.m_open),
55
+ m_high(rhs.m_high),
56
+ m_low(rhs.m_low),
57
+ m_close(rhs.m_close),
58
+ m_amount(rhs.m_amount),
59
+ m_count(rhs.m_count) {}
60
+
61
+ KRecordTable& operator=(KRecordTable&& rhs) {
62
+ if (&rhs != this) {
63
+ m_db_name = std::move(rhs.m_db_name);
64
+ m_code = std::move(rhs.m_code);
65
+ m_date = rhs.m_date;
66
+ m_open = rhs.m_open;
67
+ m_high = rhs.m_high;
68
+ m_low = rhs.m_low;
69
+ m_close = rhs.m_close;
70
+ m_amount = rhs.m_amount;
71
+ }
72
+ return *this;
73
+ }
74
+
35
75
  Datetime date() const {
36
76
  return m_date == 0 ? Null<Datetime>() : Datetime((uint64_t)m_date);
37
77
  }
@@ -90,8 +130,7 @@ public:
90
130
 
91
131
  string getSelectSQLNoDB() {
92
132
  return fmt::format(
93
- "select `date`,`open`,`high`, `low`, `close`, `amount`, `count` from `{}`",
94
- m_code);
133
+ "select `date`,`open`,`high`, `low`, `close`, `amount`, `count` from `{}`", m_code);
95
134
  }
96
135
 
97
136
  void save(const SQLStatementPtr& st) const {
@@ -8,9 +8,9 @@
8
8
 
9
9
  // Ensure the included flatbuffers.h is the same version as when this file was
10
10
  // generated, otherwise it may not be compatible.
11
- static_assert(FLATBUFFERS_VERSION_MAJOR == 24 &&
12
- FLATBUFFERS_VERSION_MINOR == 3 &&
13
- FLATBUFFERS_VERSION_REVISION == 25,
11
+ static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
12
+ FLATBUFFERS_VERSION_MINOR == 2 &&
13
+ FLATBUFFERS_VERSION_REVISION == 10,
14
14
  "Non-compatible flatbuffers version included");
15
15
 
16
16
  namespace hikyuu {
@@ -6,8 +6,8 @@
6
6
  */
7
7
 
8
8
  #pragma once
9
- #ifndef COUNT_H_
10
- #define COUNT_H_
9
+ #ifndef INDICATOR_CRT_COUNT_H_
10
+ #define INDICATOR_CRT_COUNT_H_
11
11
 
12
12
  #include "../Indicator.h"
13
13
 
@@ -51,4 +51,4 @@ inline Indicator HKU_API COUNT(const Indicator& ind, const Indicator& n) {
51
51
 
52
52
  } // namespace hku
53
53
 
54
- #endif /* CVAL_H_ */
54
+ #endif /* INDICATOR_CRT_COUNT_H_ */
@@ -11,7 +11,7 @@
11
11
  #ifndef INDICATOR_CRT_DISCARD_H_
12
12
  #define INDICATOR_CRT_DISCARD_H_
13
13
 
14
- #include "CVAL.h"
14
+ #include "../Indicator.h"
15
15
 
16
16
  namespace hku {
17
17
 
@@ -9,7 +9,7 @@
9
9
  #ifndef INDICATOR_CRT_ISINF_H_
10
10
  #define INDICATOR_CRT_ISINF_H_
11
11
 
12
- #include "CVAL.h"
12
+ #include "../Indicator.h"
13
13
 
14
14
  namespace hku {
15
15
 
@@ -9,7 +9,7 @@
9
9
  #ifndef INDICATOR_CRT_ISINFA_H_
10
10
  #define INDICATOR_CRT_ISINFA_H_
11
11
 
12
- #include "CVAL.h"
12
+ #include "../Indicator.h"
13
13
 
14
14
  namespace hku {
15
15
 
@@ -9,7 +9,7 @@
9
9
  #ifndef INDICATOR_CRT_ISNA_H_
10
10
  #define INDICATOR_CRT_ISNA_H_
11
11
 
12
- #include "CVAL.h"
12
+ #include "../Indicator.h"
13
13
 
14
14
  namespace hku {
15
15
 
@@ -39,7 +39,7 @@ inline Indicator LAST(int m = 10, int n = 5) {
39
39
 
40
40
  inline Indicator LAST(const IndParam& m, int n = 5) {
41
41
  Indicator ind_m = m.get();
42
- Indicator ind_n = CVAL(ind_m, 5);
42
+ Indicator ind_n = CVAL(ind_m, n);
43
43
  Indicator max = MAX(ind_m, ind_n);
44
44
  Indicator min = MIN(ind_m, ind_n);
45
45
  Indicator result = REF(EVERY(max - min + 1), min);
@@ -49,7 +49,7 @@ inline Indicator LAST(const IndParam& m, int n = 5) {
49
49
 
50
50
  inline Indicator LAST(int m, const IndParam& n) {
51
51
  Indicator ind_n = n.get();
52
- Indicator ind_m = CVAL(ind_n, 5);
52
+ Indicator ind_m = CVAL(ind_n, m);
53
53
  Indicator max = MAX(ind_m, ind_n);
54
54
  Indicator min = MIN(ind_m, ind_n);
55
55
  Indicator result = REF(EVERY(max - min + 1), min);
@@ -9,7 +9,7 @@
9
9
  #ifndef INDICATOR_CRT_MAX_H_
10
10
  #define INDICATOR_CRT_MAX_H_
11
11
 
12
- #include "CVAL.h"
12
+ #include "../Indicator.h"
13
13
 
14
14
  namespace hku {
15
15
 
@@ -9,7 +9,7 @@
9
9
  #ifndef INDICATOR_CRT_MIN_H_
10
10
  #define INDICATOR_CRT_MIN_H_
11
11
 
12
- #include "CVAL.h"
12
+ #include "../Indicator.h"
13
13
 
14
14
  namespace hku {
15
15
 
@@ -23,21 +23,7 @@ namespace hku {
23
23
  */
24
24
  Indicator HKU_API PRICELIST(const PriceList& data, int discard = 0);
25
25
  Indicator HKU_API PRICELIST(const PriceList& data, const DatetimeList& ds, int discard = 0);
26
-
27
- /**
28
- * 将某指标转化为PRICELIST
29
- * @param ind 源数据
30
- * @param result_index 源数据中指定的结果集
31
- * @ingroup Indicator
32
- */
33
- Indicator HKU_API PRICELIST(const Indicator& ind, int result_index = 0);
34
-
35
- /**
36
- * 将某指标转化为PRICELIST
37
- * @param result_index 源数据中指定的结果集
38
- * @ingroup Indicator
39
- */
40
- Indicator HKU_API PRICELIST(int result_index = 0);
26
+ Indicator HKU_API PRICELIST();
41
27
 
42
28
  /**
43
29
  * 包装数组成Indicator,用于计算其他指标
@@ -11,7 +11,7 @@
11
11
  #ifndef INDICATOR_CRT_SUMBARS_H_
12
12
  #define INDICATOR_CRT_SUMBARS_H_
13
13
 
14
- #include "CVAL.h"
14
+ #include "../Indicator.h"
15
15
 
16
16
  namespace hku {
17
17
 
@@ -0,0 +1,33 @@
1
+ /*
2
+ * Copyright (c) 2025 hikyuu.org
3
+ *
4
+ * Created on: 2025-05-06
5
+ * Author: fasiondog
6
+ */
7
+
8
+ #pragma once
9
+
10
+ #include "hikyuu/DataType.h"
11
+ #include "interface/ImportKDataToHdf5PluginInterface.h"
12
+
13
+ namespace hku {
14
+
15
+ class HKU_API KDataToHdf5Importer {
16
+ public:
17
+ KDataToHdf5Importer();
18
+ virtual ~KDataToHdf5Importer();
19
+
20
+ bool setConfig(const string& datapath, const vector<string>& markets = {"SH", "SZ", "BJ"});
21
+
22
+ Datetime getLastDatetime(const string& market, const string& code, const KQuery::KType& ktype);
23
+
24
+ void addKRecordList(const string& market, const string& code, const vector<KRecord>& krecords,
25
+ const KQuery::KType& ktype);
26
+
27
+ void updateIndex(const string& market, const string& code, const KQuery::KType& ktype);
28
+
29
+ private:
30
+ ImportKDataToHdf5PluginInterface* m_plugin{nullptr};
31
+ };
32
+
33
+ } // namespace hku
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,37 @@
1
+ /*
2
+ * Copyright (c) 2025 hikyuu.org
3
+ *
4
+ * Created on: 2025-04-12
5
+ * Author: fasiondog
6
+ */
7
+
8
+ #pragma once
9
+ #include "hikyuu/strategy/Strategy.h"
10
+
11
+ namespace hku {
12
+
13
+ /**
14
+ * @brief 策略回测(事件驱动方式)
15
+ *
16
+ * @param context 策略上下文
17
+ * @param on_bar 策略主体执行函数
18
+ * @param tm 策略测试账户
19
+ * @param start_date 起始日期
20
+ * @param end_date 结束日期(不包含本身)
21
+ * @param ktype K线类型
22
+ * @param ref_market 所属市场
23
+ * @param mode 模式 0: 当前bar收盘价执行买卖操作;1: 下一bar开盘价执行买卖操作;
24
+ */
25
+ void HKU_API backtest(const StrategyContext& context, const std::function<void(Strategy*)>& on_bar,
26
+ const TradeManagerPtr& tm, const Datetime& start_date,
27
+ const Datetime& end_date = Null<Datetime>(),
28
+ const KQuery::KType& ktype = KQuery::DAY, const string& ref_market = "SH",
29
+ int mode = 0);
30
+
31
+ // 仅在 sm.init 之后使用
32
+ void HKU_API backtest(const std::function<void(Strategy*)>& on_bar, const TradeManagerPtr& tm,
33
+ const Datetime& start_date, const Datetime& end_date = Null<Datetime>(),
34
+ const KQuery::KType& ktype = KQuery::DAY, const string& ref_market = "SH",
35
+ int mode = 0);
36
+
37
+ } // namespace hku
@@ -0,0 +1,18 @@
1
+ /*
2
+ * Copyright (c) 2025 hikyuu.org
3
+ *
4
+ * Created on: 2025-04-15
5
+ * Author: fasiondog
6
+ */
7
+
8
+ #pragma once
9
+
10
+ #include "hikyuu/DataType.h"
11
+
12
+ namespace hku {
13
+
14
+ void HKU_API startDataServer(const std::string& addr = "tcp://0.0.0.0:9201", size_t work_num = 2);
15
+
16
+ void HKU_API stopDataServer();
17
+
18
+ } // namespace hku
@@ -0,0 +1,29 @@
1
+ /*
2
+ * Copyright (c) 2025 hikyuu.org
3
+ *
4
+ * Created on: 2025-04-12
5
+ * Author: fasiondog
6
+ */
7
+
8
+ #pragma once
9
+
10
+ #include "hikyuu/DataType.h"
11
+
12
+ namespace hku {
13
+
14
+ /**
15
+ * @brief 激活设备
16
+ * @param active_code 授权码
17
+ */
18
+ void HKU_API activeDevice(const std::string& active_code);
19
+
20
+ // 查看当前授权
21
+ std::string HKU_API viewLicense();
22
+
23
+ // 移除授权
24
+ void HKU_API removeLicense();
25
+
26
+ // 获取试用授权
27
+ std::string HKU_API fetchTrialLicense(const std::string& email);
28
+
29
+ } // namespace hku
@@ -0,0 +1,26 @@
1
+ /*
2
+ * Copyright (c) 2025 hikyuu.org
3
+ *
4
+ * Created on: 2025-04-08
5
+ * Author: fasiondog
6
+ */
7
+
8
+ #pragma once
9
+
10
+ #include "hikyuu/strategy/Strategy.h"
11
+ #include "hikyuu/utilities/plugin/PluginBase.h"
12
+
13
+ namespace hku {
14
+
15
+ class BackTestPluginInterface : public PluginBase {
16
+ public:
17
+ BackTestPluginInterface() = default;
18
+ virtual ~BackTestPluginInterface() = default;
19
+
20
+ virtual void backtest(const StrategyContext& context,
21
+ const std::function<void(Strategy*)>& on_bar, const TradeManagerPtr& tm,
22
+ const Datetime& start_date, const Datetime& end_date,
23
+ const KQuery::KType& ktype, const string& ref_market, int mode) = 0;
24
+ };
25
+
26
+ } // namespace hku
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Copyright (c) 2025 hikyuu.org
3
+ *
4
+ * Created on: 2025-04-08
5
+ * Author: fasiondog
6
+ */
7
+
8
+ #pragma once
9
+
10
+ #include "hikyuu/utilities/plugin/PluginBase.h"
11
+
12
+ namespace hku {
13
+
14
+ class DataServerPluginInterface : public PluginBase {
15
+ public:
16
+ DataServerPluginInterface() = default;
17
+ virtual ~DataServerPluginInterface() = default;
18
+
19
+ virtual void start(const std::string& addr, size_t work_num) noexcept = 0;
20
+ virtual void stop() noexcept = 0;
21
+ };
22
+
23
+ } // namespace hku
@@ -0,0 +1,25 @@
1
+ /*
2
+ * Copyright (c) 2025 hikyuu.org
3
+ *
4
+ * Created on: 2025-04-08
5
+ * Author: fasiondog
6
+ */
7
+
8
+ #pragma once
9
+
10
+ #include "hikyuu/utilities/plugin/PluginBase.h"
11
+
12
+ namespace hku {
13
+
14
+ class DevicePluginInterface : public PluginBase {
15
+ public:
16
+ DevicePluginInterface() = default;
17
+ virtual ~DevicePluginInterface() = default;
18
+
19
+ virtual void activate(const std::string& active_code) noexcept = 0;
20
+ virtual std::string viewLicense() noexcept = 0;
21
+ virtual void removeLicense() noexcept = 0;
22
+ virtual std::string fetchTrialLicense(const std::string& email) noexcept = 0;
23
+ };
24
+
25
+ } // namespace hku
@@ -0,0 +1,33 @@
1
+ /*
2
+ * Copyright (c) 2025 hikyuu.org
3
+ *
4
+ * Created on: 2025-04-08
5
+ * Author: fasiondog
6
+ */
7
+
8
+ #pragma once
9
+
10
+ #include "hikyuu/KRecord.h"
11
+ #include "hikyuu/KQuery.h"
12
+ #include "hikyuu/utilities/plugin/PluginBase.h"
13
+
14
+ namespace hku {
15
+
16
+ class ImportKDataToHdf5PluginInterface : public PluginBase {
17
+ public:
18
+ ImportKDataToHdf5PluginInterface() = default;
19
+ virtual ~ImportKDataToHdf5PluginInterface() = default;
20
+
21
+ virtual bool setConfig(const string& datapath, const vector<string>& markets) = 0;
22
+
23
+ virtual Datetime getLastDatetime(const string& market, const string& code,
24
+ const KQuery::KType& ktype) = 0;
25
+
26
+ virtual void addKRecordList(const string& market, const string& code,
27
+ const vector<KRecord>& krecords, const KQuery::KType& ktype) = 0;
28
+
29
+ virtual void updateIndex(const string& market, const string& code,
30
+ const KQuery::KType& ktype) = 0;
31
+ };
32
+
33
+ } // namespace hku
@@ -0,0 +1,22 @@
1
+ /*
2
+ * Copyright (c) 2025 hikyuu.org
3
+ *
4
+ * Created on: 2025-04-10
5
+ * Author: fasiondog
6
+ */
7
+
8
+ #pragma once
9
+
10
+ #include "BackTestPluginInterface.h"
11
+ #include "DevicePluginInterface.h"
12
+ #include "DataServerPluginInterface.h"
13
+ #include "ImportKDataToHdf5PluginInterface.h"
14
+
15
+ namespace hku {
16
+
17
+ #define HKU_PLUGIN_BACKTEST "backtest"
18
+ #define HKU_PLUGIN_DEVICE "device"
19
+ #define HKU_PLUGIN_DATASERVER "dataserver"
20
+ #define HKU_PLUGIN_IMPORTKDATATOHDF5 "import2hdf5"
21
+
22
+ }
@@ -98,6 +98,14 @@ public: \
98
98
  return std::shared_ptr<classname>(keep_python_state_alive, ptr); \
99
99
  }
100
100
 
101
+ // 用于检查已 py::object 方式传递的函数参数个数是否符合预期
102
+ inline bool check_pyfunction_arg_num(py::object& func, size_t arg_num) {
103
+ py::module_ inspect = py::module_::import("inspect");
104
+ py::object sig = inspect.attr("signature")(func);
105
+ py::object params = sig.attr("parameters");
106
+ return len(params) == arg_num;
107
+ }
108
+
101
109
  } // namespace hku
102
110
 
103
111
  #endif // HIKYUU_PYTHON_BIND_UTILS_H
@@ -23,7 +23,8 @@ public:
23
23
 
24
24
  virtual shared_ptr<TradeManagerBase> _clone() override;
25
25
 
26
- virtual void fetchAssetInfoFromBroker(const OrderBrokerPtr& broker) override;
26
+ virtual void fetchAssetInfoFromBroker(const OrderBrokerPtr& broker,
27
+ const Datetime& datetime = Null<Datetime>()) override;
27
28
 
28
29
  /**
29
30
  * 根据权息信息更新当前持仓与交易情况
@@ -25,6 +25,7 @@ private:
25
25
  PFPtr m_pf;
26
26
  OrderBrokerPtr m_broker;
27
27
  KQuery m_query;
28
+ std::unordered_set<Stock> m_stocks;
28
29
  };
29
30
 
30
31
  StrategyPtr HKU_API crtPFStrategy(const PFPtr& pf, const KQuery& query,