hikyuu 2.7.0__py3-none-manylinux2014_aarch64.whl → 2.7.3__py3-none-manylinux2014_aarch64.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 (149) hide show
  1. hikyuu/__init__.py +25 -7
  2. hikyuu/__init__.pyi +23 -12
  3. hikyuu/analysis/__init__.pyi +6 -1
  4. hikyuu/analysis/analysis.pyi +7 -2
  5. hikyuu/core.pyi +8 -3
  6. hikyuu/cpp/core310.pyi +94 -24
  7. hikyuu/cpp/core310.so +0 -0
  8. hikyuu/cpp/core311.pyi +94 -24
  9. hikyuu/cpp/core311.so +0 -0
  10. hikyuu/cpp/core312.pyi +94 -24
  11. hikyuu/cpp/core312.so +0 -0
  12. hikyuu/cpp/core313.pyi +94 -24
  13. hikyuu/cpp/core313.so +0 -0
  14. hikyuu/cpp/i18n/zh_CN/hikyuu.mo +0 -0
  15. hikyuu/cpp/i18n/zh_CN/hikyuu_plugin.mo +0 -0
  16. hikyuu/cpp/libboost_atomic.so +0 -0
  17. hikyuu/cpp/libboost_atomic.so.1.90.0 +0 -0
  18. hikyuu/cpp/{libboost_charconv-mt.so → libboost_charconv.so} +0 -0
  19. hikyuu/cpp/{libboost_charconv-mt.so.1.88.0 → libboost_charconv.so.1.90.0} +0 -0
  20. hikyuu/cpp/libboost_chrono.so +0 -0
  21. hikyuu/cpp/libboost_chrono.so.1.90.0 +0 -0
  22. hikyuu/cpp/libboost_container.so +0 -0
  23. hikyuu/cpp/libboost_container.so.1.90.0 +0 -0
  24. hikyuu/cpp/libboost_date_time.so +0 -0
  25. hikyuu/cpp/libboost_date_time.so.1.90.0 +0 -0
  26. hikyuu/cpp/libboost_locale.so +0 -0
  27. hikyuu/cpp/libboost_locale.so.1.90.0 +0 -0
  28. hikyuu/cpp/libboost_random.so +0 -0
  29. hikyuu/cpp/libboost_random.so.1.90.0 +0 -0
  30. hikyuu/cpp/libboost_serialization.so +0 -0
  31. hikyuu/cpp/libboost_serialization.so.1.90.0 +0 -0
  32. hikyuu/cpp/libboost_thread.so +0 -0
  33. hikyuu/cpp/libboost_thread.so.1.90.0 +0 -0
  34. hikyuu/cpp/libboost_wserialization.so +0 -0
  35. hikyuu/cpp/libboost_wserialization.so.1.90.0 +0 -0
  36. hikyuu/cpp/libhikyuu.so +0 -0
  37. hikyuu/cpp/libsqlite3.so +0 -0
  38. hikyuu/data/clickhouse_upgrade/0001.sql +2 -0
  39. hikyuu/data/common_clickhouse.py +1 -3
  40. hikyuu/data/download_block.py +1 -1
  41. hikyuu/data/hku_config_template.py +30 -3
  42. hikyuu/data/mysql_upgrade/0029.sql +2 -0
  43. hikyuu/data/pytdx_to_clickhouse.py +86 -32
  44. hikyuu/data/pytdx_to_h5.py +73 -28
  45. hikyuu/data/pytdx_to_mysql.py +65 -21
  46. hikyuu/data/pytdx_weight_to_clickhouse.py +2 -0
  47. hikyuu/data/pytdx_weight_to_mysql.py +2 -0
  48. hikyuu/data/pytdx_weight_to_sqlite.py +2 -0
  49. hikyuu/data/sqlite_upgrade/0029.sql +4 -0
  50. hikyuu/data/tdx_to_clickhouse.py +2 -2
  51. hikyuu/data/tdx_to_h5.py +11 -11
  52. hikyuu/data/tdx_to_mysql.py +2 -2
  53. hikyuu/draw/drawplot/bokeh_draw.pyi +14 -7
  54. hikyuu/draw/drawplot/echarts_draw.pyi +14 -7
  55. hikyuu/draw/drawplot/matplotlib_draw.py +8 -2
  56. hikyuu/draw/drawplot/matplotlib_draw.pyi +14 -7
  57. hikyuu/extend.pyi +8 -3
  58. hikyuu/gui/HikyuuTDX.py +42 -3
  59. hikyuu/gui/data/MainWindow.py +189 -129
  60. hikyuu/hub.pyi +6 -6
  61. hikyuu/include/hikyuu/StockManager.h +17 -2
  62. hikyuu/include/hikyuu/StrategyContext.h +4 -4
  63. hikyuu/include/hikyuu/data_driver/BaseInfoDriver.h +2 -1
  64. hikyuu/include/hikyuu/data_driver/KDataDriver.h +2 -4
  65. hikyuu/include/hikyuu/data_driver/kdata/mysql/MySQLKDataDriver.h +5 -1
  66. hikyuu/include/hikyuu/data_driver/kdata/sqlite/SQLiteKDataDriver.h +1 -1
  67. hikyuu/include/hikyuu/global/sysinfo.h +24 -5
  68. hikyuu/include/hikyuu/indicator/IndicatorImp.h +1 -1
  69. hikyuu/include/hikyuu/plugin/KDataToClickHouseImporter.h +40 -0
  70. hikyuu/include/hikyuu/plugin/KDataToMySQLImporter.h +40 -0
  71. hikyuu/include/hikyuu/plugin/checkdata.h +20 -0
  72. hikyuu/include/hikyuu/plugin/extind.h +3 -0
  73. hikyuu/include/hikyuu/plugin/hkuextra.h +2 -0
  74. hikyuu/include/hikyuu/plugin/interface/CheckDataPluginInterface.h +25 -0
  75. hikyuu/include/hikyuu/plugin/interface/HkuExtraPluginInterface.h +2 -0
  76. hikyuu/include/hikyuu/plugin/interface/ImportKDataToClickHousePluginInterface.h +44 -0
  77. hikyuu/include/hikyuu/plugin/interface/ImportKDataToMySQLPluginInterface.h +42 -0
  78. hikyuu/include/hikyuu/plugin/interface/plugins.h +6 -0
  79. hikyuu/include/hikyuu/python/convert_any.h +9 -6
  80. hikyuu/include/hikyuu/python/pybind_utils.h +1 -1
  81. hikyuu/include/hikyuu/strategy/Strategy.h +1 -1
  82. hikyuu/include/hikyuu/trade_manage/TradeManagerBase.h +0 -1
  83. hikyuu/include/hikyuu/trade_manage/TradeRecord.h +2 -1
  84. hikyuu/include/hikyuu/trade_sys/allocatefunds/AllocateFundsBase.h +0 -1
  85. hikyuu/include/hikyuu/trade_sys/allocatefunds/build_in.h +1 -0
  86. hikyuu/include/hikyuu/trade_sys/allocatefunds/crt/AF_FixedAmount.h +26 -0
  87. hikyuu/include/hikyuu/trade_sys/allocatefunds/imp/FixAmountFunds.h +18 -0
  88. hikyuu/include/hikyuu/trade_sys/condition/ConditionBase.h +0 -1
  89. hikyuu/include/hikyuu/trade_sys/environment/EnvironmentBase.h +0 -1
  90. hikyuu/include/hikyuu/trade_sys/moneymanager/MoneyManagerBase.h +0 -1
  91. hikyuu/include/hikyuu/trade_sys/multifactor/MultiFactorBase.h +0 -1
  92. hikyuu/include/hikyuu/trade_sys/multifactor/NormalizeBase.h +0 -1
  93. hikyuu/include/hikyuu/trade_sys/multifactor/ScoresFilterBase.h +0 -1
  94. hikyuu/include/hikyuu/trade_sys/portfolio/Portfolio.h +13 -13
  95. hikyuu/include/hikyuu/trade_sys/profitgoal/ProfitGoalBase.h +9 -11
  96. hikyuu/include/hikyuu/trade_sys/selector/SelectorBase.h +0 -1
  97. hikyuu/include/hikyuu/trade_sys/signal/SignalBase.h +0 -1
  98. hikyuu/include/hikyuu/trade_sys/slippage/SlippageBase.h +0 -1
  99. hikyuu/include/hikyuu/trade_sys/stoploss/StoplossBase.h +0 -1
  100. hikyuu/include/hikyuu/trade_sys/system/System.h +1 -2
  101. hikyuu/include/hikyuu/utilities/Log.h +6 -7
  102. hikyuu/include/hikyuu/utilities/Parameter.h +17 -0
  103. hikyuu/include/hikyuu/utilities/config.h +28 -0
  104. hikyuu/include/hikyuu/utilities/plugin/PluginBase.h +17 -2
  105. hikyuu/include/hikyuu/utilities/plugin/PluginManager.h +41 -22
  106. hikyuu/include/hikyuu/utilities/thread/GlobalStealThreadPool.h +1 -2
  107. hikyuu/include/hikyuu/utilities/thread/GlobalThreadPool.h +1 -1
  108. hikyuu/include/hikyuu/utilities/thread/MQStealThreadPool.h +286 -0
  109. hikyuu/include/hikyuu/utilities/thread/MQThreadPool.h +1 -0
  110. hikyuu/include/hikyuu/utilities/thread/StealThreadPool.h +297 -0
  111. hikyuu/include/hikyuu/utilities/thread/ThreadPool.h +1 -0
  112. hikyuu/include/hikyuu/utilities/thread/WorkStealQueue.h +9 -8
  113. hikyuu/include/hikyuu/utilities/thread/algorithm.h +64 -14
  114. hikyuu/include/hikyuu/version.h +4 -4
  115. hikyuu/plugin/libbacktest.so +0 -0
  116. hikyuu/plugin/libcheckdata.so +0 -0
  117. hikyuu/plugin/libclickhousedriver.so +0 -0
  118. hikyuu/plugin/libdataserver.so +0 -0
  119. hikyuu/plugin/libdataserver_parquet.so +0 -0
  120. hikyuu/plugin/libdevice.so +0 -0
  121. hikyuu/plugin/libextind.so +0 -0
  122. hikyuu/plugin/libhkuextra.so +0 -0
  123. hikyuu/plugin/libimport2ch.so +0 -0
  124. hikyuu/plugin/libimport2hdf5.so +0 -0
  125. hikyuu/plugin/libimport2mysql.so +0 -0
  126. hikyuu/plugin/libtmreport.so +0 -0
  127. hikyuu/trade_manage/__init__.pyi +12 -7
  128. hikyuu/trade_manage/trade.pyi +12 -7
  129. hikyuu/trade_sys/trade_sys.py +54 -5
  130. hikyuu/util/__init__.pyi +1 -1
  131. hikyuu/util/singleton.pyi +1 -1
  132. {hikyuu-2.7.0.dist-info → hikyuu-2.7.3.dist-info}/METADATA +10 -4
  133. {hikyuu-2.7.0.dist-info → hikyuu-2.7.3.dist-info}/RECORD +136 -114
  134. hikyuu/cpp/libboost_chrono-mt.so +0 -0
  135. hikyuu/cpp/libboost_chrono-mt.so.1.88.0 +0 -0
  136. hikyuu/cpp/libboost_date_time-mt.so +0 -0
  137. hikyuu/cpp/libboost_date_time-mt.so.1.88.0 +0 -0
  138. hikyuu/cpp/libboost_serialization-mt.so +0 -0
  139. hikyuu/cpp/libboost_serialization-mt.so.1.88.0 +0 -0
  140. hikyuu/cpp/libboost_system-mt.so +0 -0
  141. hikyuu/cpp/libboost_system-mt.so.1.88.0 +0 -0
  142. hikyuu/cpp/libboost_thread-mt.so +0 -0
  143. hikyuu/cpp/libboost_thread-mt.so.1.88.0 +0 -0
  144. hikyuu/cpp/libboost_wserialization-mt.so +0 -0
  145. hikyuu/cpp/libboost_wserialization-mt.so.1.88.0 +0 -0
  146. hikyuu/data/pytdx_to_taos.py +0 -736
  147. {hikyuu-2.7.0.dist-info → hikyuu-2.7.3.dist-info}/WHEEL +0 -0
  148. {hikyuu-2.7.0.dist-info → hikyuu-2.7.3.dist-info}/entry_points.txt +0 -0
  149. {hikyuu-2.7.0.dist-info → hikyuu-2.7.3.dist-info}/top_level.txt +0 -0
@@ -43,7 +43,7 @@ public:
43
43
  const KQuery& query) override;
44
44
 
45
45
  private:
46
- string _getTableName(const string& market, const string& code, KQuery::KType ktype);
46
+ static string _getTableName(const string& market, const string& code, KQuery::KType ktype);
47
47
  KRecordList _getKRecordList(const string& market, const string& code,
48
48
  const KQuery::KType& kType, size_t start_ix, size_t end_ix);
49
49
  KRecordList _getKRecordList(const string& market, const string& code,
@@ -8,6 +8,7 @@
8
8
  #pragma once
9
9
 
10
10
  #include <string>
11
+ #include "hikyuu/utilities/datetime/Datetime.h"
11
12
 
12
13
  #ifndef HKU_API
13
14
  #define HKU_API
@@ -15,6 +16,9 @@
15
16
 
16
17
  namespace hku {
17
18
 
19
+ void sysinfo_init();
20
+ void sysinfo_clean();
21
+
18
22
  /**
19
23
  * 获取Hikyuu当前版本号
20
24
  * @return 版本号
@@ -34,11 +38,26 @@ std::string HKU_API getVersionWithGit();
34
38
  */
35
39
  bool HKU_API CanUpgrade();
36
40
 
37
- /**
38
- * 获取当前最新的版本号,用于判断是否升级
39
- * @return std::string
40
- */
41
- std::string HKU_API getLatestVersion();
41
+ struct HKU_API LatestVersionInfo {
42
+ int version{1003001};
43
+ Datetime release_date;
44
+ std::string remark;
45
+ LatestVersionInfo() = default;
46
+ LatestVersionInfo(const LatestVersionInfo&) = default;
47
+ LatestVersionInfo(LatestVersionInfo&& rhs)
48
+ : version(rhs.version), release_date(rhs.release_date), remark(std::move(rhs.remark)) {}
49
+ LatestVersionInfo& operator=(LatestVersionInfo&& rhs) {
50
+ if (this == &rhs) {
51
+ return *this;
52
+ }
53
+ version = rhs.version;
54
+ release_date = rhs.release_date;
55
+ remark = std::move(rhs.remark);
56
+ return *this;
57
+ }
58
+ };
59
+
60
+ LatestVersionInfo HKU_API getLatestVersionInfo();
42
61
 
43
62
  /** 发送反馈信息 */
44
63
  void HKU_API sendFeedback();
@@ -338,8 +338,8 @@ private:
338
338
 
339
339
  size_t act_result_num = 0;
340
340
  ar& BOOST_SERIALIZATION_NVP(act_result_num);
341
+ _readyBuffer(0, act_result_num);
341
342
  for (size_t i = 0; i < act_result_num; ++i) {
342
- m_pBuffer[i] = new vector<value_t>();
343
343
  size_t count = 0;
344
344
  ar& bs::make_nvp<size_t>(format("count_{}", i).c_str(), count);
345
345
  vector<value_t>& values = *m_pBuffer[i];
@@ -0,0 +1,40 @@
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/ImportKDataToClickHousePluginInterface.h"
12
+
13
+ namespace hku {
14
+
15
+ class HKU_API KDataToClickHouseImporter {
16
+ public:
17
+ KDataToClickHouseImporter();
18
+ virtual ~KDataToClickHouseImporter();
19
+
20
+ bool setConfig(const string& host, int port, const string& user, const string& pwd);
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 addTimeLineList(const string& market, const string& code, const TimeLineList& timeline);
28
+
29
+ void addTransList(const string& market, const string& code, const TransRecordList& translist);
30
+
31
+ void updateIndex(const string& market, const string& code, const KQuery::KType& ktype);
32
+
33
+ void remove(const string& market, const string& code, const KQuery::KType& ktype,
34
+ Datetime start);
35
+
36
+ private:
37
+ ImportKDataToClickHousePluginInterface* m_plugin{nullptr};
38
+ };
39
+
40
+ } // namespace hku
@@ -0,0 +1,40 @@
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/ImportKDataToMySQLPluginInterface.h"
12
+
13
+ namespace hku {
14
+
15
+ class HKU_API KDataToMySQLImporter {
16
+ public:
17
+ KDataToMySQLImporter();
18
+ virtual ~KDataToMySQLImporter();
19
+
20
+ bool setConfig(const string& host, int port, const string& user, const string& pwd);
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 addTimeLineList(const string& market, const string& code, const TimeLineList& timeline);
28
+
29
+ void addTransList(const string& market, const string& code, const TransRecordList& translist);
30
+
31
+ void updateIndex(const string& market, const string& code, const KQuery::KType& ktype);
32
+
33
+ void remove(const string& market, const string& code, const KQuery::KType& ktype,
34
+ Datetime start);
35
+
36
+ private:
37
+ ImportKDataToMySQLPluginInterface* m_plugin{nullptr};
38
+ };
39
+
40
+ } // namespace hku
@@ -0,0 +1,20 @@
1
+ /*
2
+ * Copyright (c) 2025 hikyuu.org
3
+ *
4
+ * Created on: 2025-12-20
5
+ * Author: fasiondog
6
+ */
7
+
8
+ #pragma once
9
+
10
+ #include "hikyuu/DataType.h"
11
+ #include "interface/CheckDataPluginInterface.h"
12
+
13
+ namespace hku {
14
+
15
+ std::pair<std::string, vector<std::string>> HKU_API checkData(const StockList& stock_list,
16
+ const Datetime& start_date,
17
+ const Datetime& end_date,
18
+ const KQuery::KType& check_ktype);
19
+
20
+ }
@@ -191,6 +191,9 @@ Indicator HKU_API AGG_VAR(const Indicator& ind, const KQuery::KType& ktype = KQu
191
191
  Indicator HKU_API AGG_QUANTILE(const Indicator& ind, const KQuery::KType& ktype = KQuery::MIN,
192
192
  bool fill_null = false, int unit = 1, double quantile = 0.75);
193
193
 
194
+ Indicator HKU_API AGG_VWAP(const KQuery::KType& ktype = KQuery::MIN, bool fill_null = false,
195
+ int unit = 1);
196
+
194
197
  using agg_func_t = std::function<double(const DatetimeList& src_ds, const Indicator::value_t* src,
195
198
  size_t group_start, size_t group_last)>;
196
199
  Indicator HKU_API AGG_FUNC(const Indicator& ind, agg_func_t agg_func,
@@ -56,4 +56,6 @@ bool getStockExtraIndexRange(const Stock& stk, const KQuery& query, size_t& out_
56
56
 
57
57
  KDataImpPtr getKDataImp(const Stock& stk, const KQuery& query);
58
58
 
59
+ bool canLazyLoad(const KQuery::KType& ktype);
60
+
59
61
  } // namespace hku
@@ -0,0 +1,25 @@
1
+ /*
2
+ * Copyright (c) 2025 hikyuu.org
3
+ *
4
+ * Created on: 2025-05-19
5
+ * Author: fasiondog
6
+ */
7
+
8
+ #pragma once
9
+
10
+ #include "hikyuu/Stock.h"
11
+ #include "hikyuu/utilities/plugin/PluginBase.h"
12
+
13
+ namespace hku {
14
+
15
+ class CheckDataPluginInterface : public PluginBase {
16
+ public:
17
+ CheckDataPluginInterface() = default;
18
+ virtual ~CheckDataPluginInterface() = default;
19
+
20
+ virtual std::pair<std::string, vector<std::string>> checkData(
21
+ const StockList& stock_list, const Datetime& start_date, const Datetime& end_date,
22
+ const KQuery::KType& check_ktype) = 0;
23
+ };
24
+
25
+ } // namespace hku
@@ -35,6 +35,8 @@ public:
35
35
  size_t& out_end) = 0;
36
36
 
37
37
  virtual KDataImpPtr getKDataImp(const Stock& stk, const KQuery& query) = 0;
38
+
39
+ virtual bool canLazyLoad(const KQuery::KType& ktype) = 0;
38
40
  };
39
41
 
40
42
  } // namespace hku
@@ -0,0 +1,44 @@
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/TimeLineRecord.h"
13
+ #include "hikyuu/TransRecord.h"
14
+ #include "hikyuu/utilities/plugin/PluginBase.h"
15
+
16
+ namespace hku {
17
+
18
+ class ImportKDataToClickHousePluginInterface : public PluginBase {
19
+ public:
20
+ ImportKDataToClickHousePluginInterface() = default;
21
+ virtual ~ImportKDataToClickHousePluginInterface() = default;
22
+
23
+ virtual bool setConfig(const string& host, int port, const string& user, const string& pwd) = 0;
24
+
25
+ virtual Datetime getLastDatetime(const string& market, const string& code,
26
+ const KQuery::KType& ktype) = 0;
27
+
28
+ virtual void addKRecordList(const string& market, const string& code,
29
+ const vector<KRecord>& krecords, const KQuery::KType& ktype) = 0;
30
+
31
+ virtual void addTimeLineList(const string& market, const string& code,
32
+ const TimeLineList& timeline) = 0;
33
+
34
+ virtual void addTransList(const string& market, const string& code,
35
+ const TransRecordList& translist) = 0;
36
+
37
+ virtual void updateIndex(const string& market, const string& code,
38
+ const KQuery::KType& ktype) = 0;
39
+
40
+ virtual void remove(const string& market, const string& code, const KQuery::KType& ktype,
41
+ Datetime start) = 0;
42
+ };
43
+
44
+ } // namespace hku
@@ -0,0 +1,42 @@
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 ImportKDataToMySQLPluginInterface : public PluginBase {
17
+ public:
18
+ ImportKDataToMySQLPluginInterface() = default;
19
+ virtual ~ImportKDataToMySQLPluginInterface() = default;
20
+
21
+ virtual bool setConfig(const string& host, int port, const string& user, const string& pwd) = 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
+ virtual void addTimeLineList(const string& market, const string& code,
33
+ const TimeLineList& timeline) = 0;
34
+
35
+ virtual void addTransList(const string& market, const string& code,
36
+ const TransRecordList& translist) = 0;
37
+
38
+ virtual void remove(const string& market, const string& code, const KQuery::KType& ktype,
39
+ Datetime start) = 0;
40
+ };
41
+
42
+ } // namespace hku
@@ -13,10 +13,13 @@
13
13
  #include "DevicePluginInterface.h"
14
14
  #include "DataServerPluginInterface.h"
15
15
  #include "ImportKDataToHdf5PluginInterface.h"
16
+ #include "ImportKDataToClickHousePluginInterface.h"
17
+ #include "ImportKDataToMySQLPluginInterface.h"
16
18
  #include "ExtendIndicatorsPluginInterface.h"
17
19
  #include "TMReportPluginInterface.h"
18
20
  #include "DataDriverPluginInterface.h"
19
21
  #include "HkuExtraPluginInterface.h"
22
+ #include "CheckDataPluginInterface.h"
20
23
 
21
24
  namespace hku {
22
25
 
@@ -24,9 +27,12 @@ namespace hku {
24
27
  #define HKU_PLUGIN_DEVICE "device"
25
28
  #define HKU_PLUGIN_DATASERVER "dataserver"
26
29
  #define HKU_PLUGIN_IMPORTKDATATOHDF5 "import2hdf5"
30
+ #define HKU_PLUGIN_IMPORTKDATATOCLICKHOUSE "import2ch"
31
+ #define HKU_PLUGIN_IMPORTKDATATOMYSQL "import2mysql"
27
32
  #define HKU_PLUGIN_EXTEND_INDICATOR "extind"
28
33
  #define HKU_PLUGIN_TMREPORT "tmreport"
29
34
  #define HKU_PLUGIN_CLICKHOUSE_DRIVER "clickhousedriver"
30
35
  #define HKU_PLUGIN_HKU_EXTRA "hkuextra"
36
+ #define HKU_PLUGIN_CHECK_DATA "checkdata"
31
37
 
32
38
  } // namespace hku
@@ -104,12 +104,12 @@ public:
104
104
  }
105
105
 
106
106
  if (PyLong_Check(src)) {
107
- int overflow;
108
- long tmp = PyLong_AsLongAndOverflow(src, &overflow);
109
- if (overflow == 0) {
110
- value = static_cast<int>(tmp);
107
+ long long ll_val = PyLong_AsLongLong(src);
108
+ if (ll_val < std::numeric_limits<int>::min() ||
109
+ ll_val > std::numeric_limits<int>::max()) {
110
+ value = static_cast<int64_t>(ll_val);
111
111
  } else {
112
- value = PyLong_AsLongLong(src);
112
+ value = static_cast<int>(ll_val);
113
113
  }
114
114
  return true;
115
115
  }
@@ -192,8 +192,11 @@ public:
192
192
  } else {
193
193
  Py_RETURN_FALSE;
194
194
  }
195
+ } else if (x.type() == typeid(int64_t)) {
196
+ long long ll_val = (long long)boost::any_cast<int64_t>(x);
197
+ return PyLong_FromLongLong(ll_val);
195
198
  } else if (x.type() == typeid(int)) {
196
- return Py_BuildValue("n", boost::any_cast<int>(x));
199
+ return Py_BuildValue("i", boost::any_cast<int>(x));
197
200
  } else if (x.type() == typeid(double)) {
198
201
  return Py_BuildValue("d", boost::any_cast<double>(x));
199
202
  } else if (x.type() == typeid(std::string)) {
@@ -102,7 +102,7 @@ public:
102
102
  return this->_clone(); \
103
103
  } \
104
104
  \
105
- protected: \
105
+ public: \
106
106
  inline bool isPythonObject() const override { \
107
107
  return true; \
108
108
  }
@@ -35,7 +35,7 @@ public:
35
35
  Strategy();
36
36
  explicit Strategy(const string& name, const string& config_file = "");
37
37
  Strategy(const vector<string>& codeList, const vector<KQuery::KType>& ktypeList,
38
- const unordered_map<string, int>& preloadNum = {}, const string& name = "Strategy",
38
+ const unordered_map<string, int64_t>& preloadNum = {}, const string& name = "Strategy",
39
39
  const string& config_file = "");
40
40
  explicit Strategy(const StrategyContext& context, const string& name = "Strategy",
41
41
  const string& config_file = "");
@@ -769,7 +769,6 @@ public:
769
769
  std::vector<std::pair<Datetime, double>> getProfitPercentYearly(
770
770
  const Datetime& datetime = Datetime::now());
771
771
 
772
- protected:
773
772
  virtual bool isPythonObject() const {
774
773
  return false;
775
774
  }
@@ -38,7 +38,8 @@ enum BUSINESS {
38
38
  BUSINESS_RETURN_STOCK = 12, /**< 归还股票资产 */
39
39
  BUSINESS_SELL_SHORT = 13, /**< 卖空 */
40
40
  BUSINESS_BUY_SHORT = 14, /**< 卖空后回补 */
41
- BUSINESS_INVALID = 15 /**< 无效类型 */
41
+ BUSINESS_SUOGU = 15, /**< 缩扩股 */
42
+ BUSINESS_INVALID = 16 /**< 无效类型 */
42
43
  };
43
44
 
44
45
  /**
@@ -101,7 +101,6 @@ public:
101
101
  static void adjustWeight(SystemWeightList& sw_list, double can_allocate_weight,
102
102
  bool auto_adjust, bool ignore_zero);
103
103
 
104
- protected:
105
104
  virtual bool isPythonObject() const {
106
105
  return false;
107
106
  }
@@ -13,5 +13,6 @@
13
13
  #include "crt/AF_FixedWeight.h"
14
14
  #include "crt/AF_FixedWeightList.h"
15
15
  #include "crt/AF_MultiFactor.h"
16
+ #include "crt/AF_FixedAmount.h"
16
17
 
17
18
  #endif /* TRADE_SYS_ALLOCATEFUNDS_BUILD_IN_H_ */
@@ -0,0 +1,26 @@
1
+ /*
2
+ * Copyright (c) 2019 hikyuu.org
3
+ *
4
+ * Created on: 2025年12月9日
5
+ * Author: stone
6
+ */
7
+
8
+ #pragma once
9
+ #ifndef TRADE_SYS_ALLOCATEFUNDS_CRT_AF_FIXEDAMOUNT_H_
10
+ #define TRADE_SYS_ALLOCATEFUNDS_CRT_AF_FIXEDAMOUNT_H_
11
+
12
+ #include "../AllocateFundsBase.h"
13
+
14
+ namespace hku {
15
+
16
+ /**
17
+ * @brief 固定金额分配,每个选中的资产都不能超过此金额交易
18
+ * @param amount 指定的固定交易金额
19
+ * @return AFPtr
20
+ * @ingroup AllocateFunds
21
+ */
22
+ AFPtr HKU_API AF_FixedAmount(double amount = 20000.0);
23
+
24
+ } /* namespace hku */
25
+
26
+ #endif /* TRADE_SYS_ALLOCATEFUNDS_CRT_AF_FIXEDAMOUNT_H_ */
@@ -0,0 +1,18 @@
1
+ #pragma once
2
+ #include "../AllocateFundsBase.h"
3
+
4
+ namespace hku {
5
+
6
+ class FixedAmountFunds : public AllocateFundsBase {
7
+ ALLOCATEFUNDS_IMP(FixedAmountFunds)
8
+ ALLOCATEFUNDS_NO_PRIVATE_MEMBER_SERIALIZATION
9
+
10
+ public:
11
+ FixedAmountFunds();
12
+ virtual ~FixedAmountFunds();
13
+ virtual void _checkParam(const string& name) const override;
14
+ };
15
+
16
+ } /* namespace hku */
17
+
18
+
@@ -109,7 +109,6 @@ public:
109
109
  return m_values.cend();
110
110
  }
111
111
 
112
- protected:
113
112
  virtual bool isPythonObject() const {
114
113
  return false;
115
114
  }
@@ -93,7 +93,6 @@ public:
93
93
  /** 子类克隆接口 */
94
94
  virtual EnvironmentPtr _clone() = 0;
95
95
 
96
- protected:
97
96
  virtual bool isPythonObject() const {
98
97
  return false;
99
98
  }
@@ -152,7 +152,6 @@ public:
152
152
  /** 子类克隆私有变量接口 */
153
153
  virtual MoneyManagerPtr _clone() = 0;
154
154
 
155
- protected:
156
155
  virtual bool isPythonObject() const {
157
156
  return false;
158
157
  }
@@ -164,7 +164,6 @@ public:
164
164
  virtual MultiFactorPtr _clone() = 0;
165
165
  virtual IndicatorList _calculate(const vector<IndicatorList>&) = 0;
166
166
 
167
- protected:
168
167
  virtual bool isPythonObject() const {
169
168
  return false;
170
169
  }
@@ -42,7 +42,6 @@ public:
42
42
 
43
43
  virtual PriceList normalize(const PriceList& data) = 0;
44
44
 
45
- protected:
46
45
  virtual bool isPythonObject() const {
47
46
  return false;
48
47
  }
@@ -49,7 +49,6 @@ public:
49
49
  public:
50
50
  friend HKU_API ScoresFilterPtr operator|(const ScoresFilterPtr& a, const ScoresFilterPtr& b);
51
51
 
52
- protected:
53
52
  virtual bool isPythonObject() const {
54
53
  return false;
55
54
  }
@@ -88,7 +88,7 @@ public:
88
88
 
89
89
  /** 克隆操作 */
90
90
  typedef shared_ptr<Portfolio> PortfolioPtr;
91
- PortfolioPtr clone() const;
91
+ PortfolioPtr clone();
92
92
 
93
93
  /** 运行前准备 */
94
94
  void readyForRun();
@@ -99,7 +99,7 @@ public:
99
99
  virtual string str() const;
100
100
 
101
101
  virtual void _reset() {}
102
- virtual PortfolioPtr _clone() const {
102
+ virtual PortfolioPtr _clone() {
103
103
  return std::make_shared<Portfolio>();
104
104
  }
105
105
 
@@ -113,6 +113,10 @@ public:
113
113
  */
114
114
  virtual json lastSuggestion() const;
115
115
 
116
+ virtual bool isPythonObject() const {
117
+ return false;
118
+ }
119
+
116
120
  private:
117
121
  void initParam();
118
122
 
@@ -122,10 +126,6 @@ private:
122
126
  const string& mode);
123
127
 
124
128
  protected:
125
- virtual bool isPythonObject() const {
126
- return false;
127
- }
128
-
129
129
  // 跟踪打印当前TM持仓情况
130
130
  void traceMomentTMAfterRunAtOpen(const Datetime& date);
131
131
  void traceMomentTMAfterRunAtClose(const Datetime& date);
@@ -177,13 +177,13 @@ private:
177
177
  #endif /* HKU_SUPPORT_SERIALIZATION */
178
178
  };
179
179
 
180
- #define PORTFOLIO_IMP(classname) \
181
- public: \
182
- virtual PortfolioPtr _clone() const override { \
183
- return std::make_shared<classname>(); \
184
- } \
185
- virtual void _reset() override; \
186
- virtual void _readyForRun() override; \
180
+ #define PORTFOLIO_IMP(classname) \
181
+ public: \
182
+ virtual PortfolioPtr _clone() override { \
183
+ return std::make_shared<classname>(); \
184
+ } \
185
+ virtual void _reset() override; \
186
+ virtual void _readyForRun() override; \
187
187
  virtual void _runMoment(const Datetime& date, const Datetime& nextCycle, bool adjust) override;
188
188
 
189
189
  /**
@@ -62,8 +62,8 @@ public:
62
62
 
63
63
  /**
64
64
  * 买入时计算目标价格
65
- * @param datetime 买入时间
66
- * @param price 买入价格
65
+ * @param datetime 当前时间
66
+ * @param price 当前价格
67
67
  * @return 返回Null<price_t>时,表示未限定目标; 返回0,意味着需要卖出
68
68
  */
69
69
  virtual price_t getGoal(const Datetime& datetime, price_t price) = 0;
@@ -80,9 +80,8 @@ public:
80
80
  virtual ProfitGoalPtr _clone() = 0;
81
81
 
82
82
  /** 子类计算接口,由setTO调用 */
83
- virtual void _calculate() = 0;
83
+ virtual void _calculate() {}
84
84
 
85
- protected:
86
85
  virtual bool isPythonObject() const {
87
86
  return false;
88
87
  }
@@ -143,13 +142,12 @@ private: \
143
142
  #define PROFIT_GOAL_NO_PRIVATE_MEMBER_SERIALIZATION
144
143
  #endif
145
144
 
146
- #define PROFITGOAL_IMP(classname) \
147
- public: \
148
- virtual ProfitGoalPtr _clone() override { \
149
- return std::make_shared<classname>(); \
150
- } \
151
- virtual price_t getGoal(const Datetime&, price_t) override; \
152
- virtual void _calculate() override;
145
+ #define PROFITGOAL_IMP(classname) \
146
+ public: \
147
+ virtual ProfitGoalPtr _clone() override { \
148
+ return std::make_shared<classname>(); \
149
+ } \
150
+ virtual price_t getGoal(const Datetime&, price_t) override;
153
151
 
154
152
  /**
155
153
  * 客户程序都应使用该指针类型
@@ -163,7 +163,6 @@ public:
163
163
  /** 在已有过滤基础上追加过滤,仅用于 MF 相关的 Selector,从 MF 获取 Score 列表时进行过滤 */
164
164
  void addScoresFilter(const ScoresFilterPtr& filter);
165
165
 
166
- protected:
167
166
  virtual bool isPythonObject() const {
168
167
  return false;
169
168
  }
@@ -130,7 +130,6 @@ public:
130
130
  /** 子类计算接口,在setTO中调用 */
131
131
  virtual void _calculate(const KData&) = 0;
132
132
 
133
- protected:
134
133
  virtual bool isPythonObject() const {
135
134
  return false;
136
135
  }